K = dcGain(ss); (K, finite) = dcGain(ss);
This function computes the steady state gain K of a state space system. K is defined in the following way:
The linear state space system
der(x) = A*x + B*u y = C*x + D*u
is solved for y under steady state conditions, i.e.,
der(x) = 0
resulting in
y = ( D + C*inv(A)*B )*u = K*u
Interpretations of matrix K:
If A is singular (e.g. due to a zero eigenvalue), then a unique inverse of A does not exist. If there are non-unique solutions of the equation "A*X=B", the one with the smallest norm in X is used to compute K. If no solution of this equation exists, K cannot be computed. In this case, output argument finite = false and all elements of K are set to Modelica.Constants.inf (when K could be computed, finite = true).
encapsulated function dcGain import Modelica; import Modelica_LinearSystems2.StateSpace; input StateSpace ss "Linear system in state space form"; output Real K[size(ss.C, 1), size(ss.B, 2)] "DC gain matrix K (= G(s=0) = D - C*inv(A)*B)"; output Boolean finite "True, if K is finite, otherwise K is infinite (K=fill(Modelica.Constants.inf,..) returned)"; end dcGain;