FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Derivative

Output is the time derivative of input.

+ Collaboration diagram for Derivative:

Output is the time derivative of input: the difference between the input and its value at the last accepted step, divided by the time between them (owner ruling D23). The memory is updated on accepted steps only, so the output does not depend on how often the integrator evaluates the model inside a step (Runge-Kutta stages, Jacobian columns). At the time of an accepted step the output is the difference over that step, which is the derivative in the middle of the step: it lags the true derivative by half a step. Before the first step it is 0. The accuracy follows the step size, so the block gives inaccurate results when the step is long, for example when the integrator only steps to the output times.

Author
Karl-Johan Reite
Benjamin Scholz
Date
14.08.2007 KJR: Initial version.
20.07.2011 KGA: Ported to FhSim 2.0.
25.07.2011 KGA: Added documentation.
29.10.2026 Memory is kept on accepted steps (D23).

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Math/Derivative"
Name = "A"
PortWidth = "2"
/>
...
<Connection
A.In = "1,2"
/>

Input Ports

Name Width Description
In <PortWidth> The input port

Output Ports

Name Width Description
Out <PortWidth> The derivative of the input signal

Configuration parameters

Name Width Description
PortWidth The number of elements in the input and output ports

Initial conditions

This SimObject contains no initial conditions.

Full example file

<Contents>
<OBJECTS>
<Lib
LibName="base"
SimObject="Math/Derivative"
Name="A"
/>
<Lib
LibName="base"
SimObject="Src/Clock"
Name="M"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
A.In="M.SimTime"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
/>
</INITIALIZATION>
<SIMULATION>
<Timing TStart="1" TEnd="30"/>
<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="1, 1,2,3,4,5, 30" Select="object.A:ports"/>
</OBSERVERS>
</Contents>

This SimObject is referred to as Math/Derivative