%% Series Interconnection of Passive Systems
% This example illustrates the properties of a series interconnection of passive systems.
%% Series Interconnection of Passive Systems
% Consider an interconnection of two subsystems G_1 and G_2 in series. The interconnected system H is given by the mapping from input u to output y_2.
%
% In contrast with parallel and feedback interconnections, passivity of the subsystems G_1 and G_2 does not guarantee passivity for the interconnected system H. Take for example
%  G_1(s) = \frac{5s^2 + 3s + 1}{s^2 + 2s +1} , \;\;\;
%    G_2(s) = \frac{s^2 + s + 5s + 0.1}{s^3 + 2s^2+ 3s + 4} .
% Both systems are passive as confirmed by

G1 = tf([5 3 1],[1,2,1]);
isPassive(G1)

%

G2 = tf([1,1,5,.1],[1,2,3,4]);
isPassive(G2)

%
% However the series interconnection of G_1 and G_2 is not passive:

H = G2*G1;
isPassive(H)

%
% This is confirmed by verifying that the Nyquist plot of G_2 G_1 is not positive real.

nyquist(H)

%
%% Passivity Indices for Series Interconnection
% While the series interconnection of passive systems is not passive in general, there is a relationship between the passivity indices of  G_1 and G_2 and the passivity indices of H = G_2  G_1. Let \nu_1 and \nu_2 denote the input passivity indices for G_1 and G_2, and let \rho_1 and \rho_2 denote the output passivity indices. If all these indices are positive, then the input passivity index \nu and the output passivity index \rho for the series interconnection  H satisfy
% \nu \geq -\frac{0.125}{\rho_1\rho_2} , \;\;\; \rho \geq -\frac{0.125}{\nu_1\nu_2} .
% In other words, the shortage of passivity at the inputs or outputs of H is no worse than the right-hand-side expressions. For details, see the paper by Arcak, M. and Sontag, E.D., "Diagonal stability of a class of cyclic systems and its connection with the secant criterion," Automatica, Vol 42, No. 9, 2006, pp. 1531-1537. Verify these lower bounds for the example above.

% Output passivity index for G1
rho1 = getPassiveIndex(G1,'output');
% Output passivity index for G2
rho2 = getPassiveIndex(G2,'output');
% Input passivity index for H=G2*G1
nu = getPassiveIndex(H,'input')

%

% Lower bound
-0.125/(rho1*rho2)

%
% Similarly, verify the lower bound for the output passivity index of H.

% Input passivity index for G1
nu1 = getPassiveIndex(G1,'input');
% Input passivity index for G2
nu2 = getPassiveIndex(G2,'input');
% Output passivity index for H=G2*G1
rho = getPassiveIndex(H,'output')

%

% Lower bound
-0.125/(nu1*nu2)

% Copyright 2015 The MathWorks, Inc.