FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Linear system

Linear time-invariant system.

+ Collaboration diagram for Linear system:

Implements a linear system with constant coefficients. The system is formulated as from the input \(u\) to the output \(y\) with the internal state \(x\).

\[\dot{x}=Ax+Bu,\\ y=Cx+Du\]

The size of the system state std::vector \(x\), the input \(u\) and the output \(y\) is derived from the sizes of the input matrices which define the system. The matrices are defined as a list of comma separated row vectors, which are in turn separated by the column separator ";".

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Math/LinearSystem"
Name = "SystemOne"
A = "0,1;-0.5,-2"
B = "0;1"
C = "1,0"
/>
...
<Connection
SystemOne.In = "1"
/>
...
<InitialCondition
SystemOne.State="10,5"
/>

The number of internal system states is N, the number of inputs M and the number of outputs K.

Input Ports

Name Width Description
In M The input signal \(u\)

Output Ports

Name Width Description
Out K \(y=Cx+Du\)

Configuration parameters

Name Width Description
A NxN System matrix
B NxM Gain matrix
C KxN Output matrix
D KxM Feedthrough matrix (Default: zero-matrix)

Initial conditions

Name Width Description
State N State std::vector initial conditions

Full example file

<Contents>
<OBJECTS>
<Lib
LibName="base"
SimObject="Math/LinearSystem"
Name="LinSys"
A="2"
B="1"
C="1"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
LinSys.In="5"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
LinSys.State="0"
/>
</INITIALIZATION>
<SIMULATION>
<Timing TStart="0" TEnd="11.0"/>
<Integrator Method="RK45_i" NumCores="1" LogStates="1" UseRSSNorm="0">
<StepControl StepMax="0.002" StepMin="0.00000001" AbsTol="1e-3" RelTol="1e-3"/>
</Integrator>
</SIMULATION>
<OBSERVERS>
<FileOutput TOutput="0, 0:1:10, 30" Select="objects:all"/>
</OBSERVERS>
</Contents>

This SimObject is referred to as Math/LinearSystem