.Modelica_LinearSystems2.Internal.StateSpace2.'-'.subtract

Information

Syntax

ss = Modelica_LinearSystems2.StateSpace.'-'.subtract(ss1, ss2)

Description

This operator function computes the subtraction of two state space systems connected in parallel, i.e. the inputs are the same and the outputs of the two systems are subtracted. Therefore, The systems must have the same number of inputs and outputs but not the same number of states. The resulting system has an order of system_order1 + system_order2.

The operator is used by writing just the following command:

ss3 := ss1 - ss2;

Example

  StateSpace ss1 = StateSpace(A=[-1, 0; 0, -2], B=[1;2], C=[0, 1], D=[0]);
  StateSpace ss2 = StateSpace(A=[-3, 0; 0, -4], B=[3;4], C=[0, 2], D=[0]);

  StateSpace ss3;

algorithm
  ss3 := ss1 - ss2;
// ss.A = [-1, 0, 0, 0; 0, -2, 0, 0; 0, 0, -3, 0; 0, 0, 0, -4],
// ss.B = [1; 2; 3; 4],
// ss.C = [0, 1, 0, -2],
// ss.D = [0],

Interface

function subtract
  import Modelica;
  import Modelica_LinearSystems2.Internal.StateSpace2;
  input StateSpace2 ss1 "State space system 1";
  input StateSpace2 ss2 "State Space system 2 is subtracted from system 1";
  output StateSpace2 result(redeclare Real A[size(ss1.A, 1) + size(ss2.A, 1), size(ss1.A, 2) + size(ss2.A, 2)], redeclare Real B[size(ss1.B, 1) + size(ss2.B, 1), size(ss1.B, 2)], redeclare Real C[size(ss1.C, 1), size(ss1.C, 2) + size(ss2.C, 2)], redeclare Real D[size(ss1.D, 1), size(ss1.D, 2)]) "= ss1 - ss2";
end subtract;

Generated at 2024-12-27T19:26:12Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos