Marine systems simulation
Samplifier

Sample and hold.

+ Collaboration diagram for Samplifier:
Author
Joakim Haugen

Samplifier is a SimObject that samples the input signals in a sample-and-hold fashion. It can simulate a variety of real-world properties in the sampled signal. The following things can be configured to happen with the output signals:

Example configuration excerpt

<Lib
LibName = "fhsim_base"
SimObject = "Signal/Samplifier"
Name = "Sample"
PortWidth = "1"
NoiseSeed = "42"
Tags = "OutVector1"
SamplingPeriod1 = "1, 1, 1"
FirstSampleTime1 = "0.9999,0.9999,0.9999"
TimeDelay1 = "0, 0, 0"
OutlierProbability1= "0, 0, 0.01"
LossProbability1 = "0, 0, 0.1"
AvgLostSamples1 = "0, 0, 3"
NoiseBias1 = "0, 0, 0.1"
NoiseStdDev1 = "1, 1, 2"
/>

Input Ports

Name Width Description
In1 .. In<PortWidth> n_i Vector inputs. The dimension of each input is inferred from the configuration parameter's dimension.

Output Ports

Name Width Description
Out1 .. Out<PortWidth> n_i Vector outputs samplified.
<Tags> <PortWidth> Named outputs (Optional).

Configuration parameters

Name Width Description
NoiseSeed 0 or 1 Seed number for random generator (Optional).
PortWidth 1 Number of vector input signals.
Tags <PortWidth> or 0 Named output ports (Optional).
SamplingPeriod<1..PortWidth> n_i List of positive sampling periods.
FirstSampleTime<1..PortWidth> n_i or 0 List of first available sample times. Note that the sample will be available on the first time step after the sampling instant. Default is \(-\infty\).
TimeDelay<1..PortWidth> n_i or 0 List of non-negative time delays. Default is zeros.
OutlierProbability<1..PortWidth> n_i or 0 List of probabilities for outliers. Default is zeros.
LossProbability<1..PortWidth> n_i or 0 List of probabilities for loss of signal. Default is zeros.
AvgLostSamples<1..PortWidth> n_i or 0 List of average number of lost signals (when loss). Default is zeros.
NoiseBias<1..PortWidth> n_i or 0 List of bias (mean) for each noisy output. Default is zeros.
NoiseStdDev<1..PortWidth> n_i or 0 List of standard deviations. Default is zeros.

Initial conditions

This SimObject contains no initial conditions.

Full example file

<Contents>
<OBJECTS>
<Lib
LibName = "fhsim_base"
SimObject = "Signal/Samplifier"
Name = "S"
PortWidth = "1"
NoiseSeed = "42"
Tags = "OutVector1"
SamplingPeriod1 = "1, 1, 1"
FirstSampleTime1 = "0.9999,0.9999,0.9999"
TimeDelay1 = "0, 0, 0"
OutlierProbability1= "0, 0, 0.01"
LossProbability1 = "0, 0, 0.1"
AvgLostSamples1 = "0, 0, 3"
NoiseBias1 = "0, 0, 0.1"
NoiseStdDev1 = "1, 1, 2"
/>
<Lib
LibName = "fhsim_base"
SimObject = "Src/Random"
Name = "R"
PortWidth = "3"
RandomType = "VariableRandom"
RandomMin = "0.2, 0.2, 0.2"
RandomMax = "1.2, 1.2, 1.2"
/>
</OBJECTS>
<INTERCONNECTIONS>
<Connection
S.In1 = "R.Out"
/>
</INTERCONNECTIONS>
<INITIALIZATION>
<InitialCondition
/>
</INITIALIZATION>
<INTEGRATION>
<Engine
IntegratorMethod = "2"
NumCores = "1"
TOutput = "0, 0:0.5:2, 30"
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 Signal/Samplifier