subsystem = StateSpace.Transformation.extract(ss, outputIndex, inputIndex)
This function computes the subsystem of a state space system corresponding to the indices in outputIndex and inputIndex, i.e.
subsystem.A = ss.A; subsystem.B = ss.B[:, inputIndex]; subsystem.C = ss.C[outputIndex, :]; subsystem.D = ss.D[outputIndex, inputIndex];
Modelica_LinearSystems2.StateSpace ss=Modelica_LinearSystems2.StateSpace(
A=[-1, 1, 2; 0, -2, 3;-3, 2, 1],
B=[1, 0; 0, 1; 1, 0],
C=[1, 1, 0; 0, 1, 1],
D=[0, 0; 0,0]);
Integer outputIndex={1, 2};
Integer inputIndex={2}
algorithm
tss:=Modelica_LinearSystems2.StateSpace.Transformation.extract(ss, outputIndex, inputIndex);
// tss=StateSpace(
A=[-1, 1, 2; 0, -2, 3;-3, 2, 1],
B=[0; 1; 0],
C=[1, 1, 0; 0, 1, 1],
D=[0; 0])
encapsulated function extract
import Modelica;
import Modelica_LinearSystems2;
import Modelica_LinearSystems2.StateSpace;
input StateSpace ss "State space system";
input Integer outputIndex[:] = {1} "Vector of subsystem outputs indices";
input Integer inputIndex[:] = {1} "Vector of subsystem inputs indices";
output StateSpace subSc(redeclare Real A[size(ss.A, 1), size(ss.A, 2)], redeclare Real B[size(ss.B, 1), size(inputIndex, 1)], redeclare Real C[size(outputIndex, 1), size(ss.C, 2)], redeclare Real D[size(outputIndex, 1), size(inputIndex, 1)]) "Subsystem state space record";
end extract;