FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Vector norm

Vector 2-norm of input (Pythagorean).

+ Collaboration diagram for Vector norm:

With input \(x\), the output is calculated as \(\|x\|_2 = \sqrt{x_{1}^{2} + x_{2}^{2} + ... + x_{N}^{2}}\), where N is the number of std::vector elements in \(x\).

Author
Jorgen Haavind Jensen
Date
Q3 2014: Initial version.

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Math/VectorNorm"
Name = "A"
PortWidth = "2"
/>
...
<Connection
A.In = "10,4"
/>

Input Ports

Name Width Description
In <PortWidth> The input port

Output Ports

Name Width Description
Out <PortWidth> The norm of "In".

Configuration parameters

Name Width Description
PortWidth 1 The number of elements in the signal.

Initial conditions

This SimObject contains no initial conditions.

Full example file

<Contents>
<OBJECTS>
<Lib
LibName="base"
SimObject="Math/VectorNorm"
Name="Norm"
PortWidth = "3"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
Norm.In="3,2,0"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
/>
</INITIALIZATION>
<SIMULATION>
<Timing TStart="0" TEnd="6.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, 3:1:5, 30" Select="objects:all"/>
</OBSERVERS>
</Contents>

This SimObject is referred to as Math/VectorNorm