Marine systems simulation
Linear mapping

Linear combination mapping.

+ Collaboration diagram for Linear mapping:

Implements a linear combination mapping. The sim object takes two inputs \(u\), \(v\) and maps them to the output \(y\).

\(y=C_u u + C_v v\)

The dimensions of the output vector and the inputs \(u\) and \(u\) are derived from the sizes of the input matrices \(C_u\) and \(C_v\). The matrices are defined as a list of comma-separated row vectors, which in turn are separated by ";". The number of rows in these matrices must be equal, i.e. the dimension of the output.

The input matrices,

\(c_{u}=\begin{bmatrix}0 & 1 & 2\\0 & -2 & -3\end{bmatrix}\) and \(c_{v}=\begin{bmatrix}1 & 2\\3 & 2\end{bmatrix}\)

and the inputs,

\(u=\begin{bmatrix}3\\2\\1\end{bmatrix}\) and \(v=\begin{bmatrix}2\\2\end{bmatrix}\)

yields the following linear mapping:

\(y=\begin{bmatrix}0 & 1 & 2\\0 & -2 & -3\end{bmatrix} \cdot \begin{bmatrix}3\\2\\1\end{bmatrix} + \begin{bmatrix}1 & 2\\3 & 2\end{bmatrix}\ \cdot \begin{bmatrix}2\\2\end{bmatrix} = \begin{bmatrix}10\\3\end{bmatrix}\)

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Math/LinearMapping"
Name = "LinearMap"
Cu = "0,1,2;0,-2,-3"
Cv = "1,2;3,2"
/>
...
...
<Connection
LinearMap.InU = "3,2,1"
LinearMap.InV = "2,2"
/>

Dimension of vectors and matrices are: \(y : M\), \(u: K\), \(v: K\), \(C_u : M \times K\), \(C_v : M \times L\).

Input Ports

Name Width Description
InU K The first input signal.
InV L The second input signal.

Output Ports

Name Width Description
Out M The output vector \(y\).
Out1 .. Out<M> 1 De-muxed output \(y_i\).

Configuration parameters

Name Width Description
Cu MxK Matrix \(C_u\).
Cv MxL Matrix \(C_v\).

Full example file

<Contents>
<OBJECTS>
<Lib
LibName = "fhsim_base"
SimObject = "Math/LinearMapping"
Name = "LinearMap"
Cu = "0,1,2;0,-2,-3"
Cv = "1,2;3,2"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
LinearMap.InU = "3,2,1"
LinearMap.InV = "2,2"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
/>
</INITIALIZATION>
<INTEGRATION>
<Engine
IntegratorMethod = "2"
NumCores = "1"
TOutput = "0, 5, 10"
LogStates = "1"
stepsize = "0"
HMax = "0.002"
HMin = "0.00000001"
AbsTol = "1e-3"
RelTol = "1e-3"
UseRSSNormInsteadOfInfNorm = "0"
FileOutput = "objects:all"
/>
</INTEGRATION>
</Contents>

This SimObject is referred to as Math/LinearMapping