.Modelica_LinearSystems2.DiscreteStateSpace.'-'.subtract

Information

Syntax

dss = DiscreteStateSpace.'-'.subtract(dss1, dss2)

Description

This operator function computes the subtraction of two discrete 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:

dss3 := dss1 - dss2;

Example

  DiscreteStateSpace dss1 = DiscreteStateSpace(A=[-1, 0; 0, -2], B=[1;2], C=[0, 1], D=[0]);
  DiscreteStateSpace dss2 = DiscreteStateSpace(A=[-3, 0; 0, -4], B=[3;4], C=[0, 2], D=[0]);

  DiscreteStateSpace dss3;

algorithm
  dss3 := dss1 - dss2;
// dss.A = [-1, 0, 0, 0; 0, -2, 0, 0; 0, 0, -3, 0; 0, 0, 0, -4],
// dss.B = [1; 2; 3; 4],
// dss.C = [0, 1, 0, -2],
// dss.D = [0],
// dss.B2 = [0; 0; 0; 0],

Interface

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

Generated at 2024-04-15T18:15:56Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos