|
| struct | Channel |
| | The instrument imperfections of one measured channel. More...
|
| |
| struct | Reading |
| | One held instrument reading. More...
|
| |
| struct | Settings |
| | Everything that makes one instrument out of the shared sensor machinery. More...
|
| |
|
| | SensorCtd (std::string simObjectName, ISimObjectCreator *creator) |
| |
| | SensorCtd (std::string simObjectName, const Settings &settings) |
| |
|
void | OdeFcn (const double dT, const double *const adX, double *const adXDot) const override |
| | Writes the three lag derivatives and nothing else.
|
| |
| void | AcceptedStep (const double dT, const double *const adX) override |
| |
| void | InitialConditionSetup (const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const creator) override |
| |
| void | FinalSetup (const double dT, const double *const adX, ISimObjectCreator *const creator) override |
| |
| bool | SampleIfDue (double t, double temperature, double salinity, double depth, const double position[3]) |
| |
| void | Update (double temperature, double salinity, double depth, const double position[3]) |
| |
|
const Reading & | HeldReading () const |
| | The reading currently held on the output ports.
|
| |
|
const Settings & | GetSettings () const |
| | The settings the instrument was built with.
|
| |
|
double | NextSampleTime () const |
| | The time at which the next sample is due, s.
|
| |
|
| static double | LagDerivative (double fieldValue, double lagState, double timeConstant) |
| |
| static double | MeasuredValueOf (double lagState, double fieldValue, double timeConstant) |
| |
| static double | Quantize (double value, double resolution) |
| |
| static double | PressureOf (double depth) |
| |
| static double | Perturb (double trueValue, const Channel &channel, SensorNoise &noise) |
| |
|
|
const double * | OutTemperature (const double dT, const double *const adX) |
| | The measured water temperature, degC.
|
| |
|
const double * | OutSalinity (const double dT, const double *const adX) |
| | The measured salinity, PSU.
|
| |
|
const double * | OutDepth (const double dT, const double *const adX) |
| | The measured depth of the sensor head, m.
|
| |
|
const double * | OutPressure (const double dT, const double *const adX) |
| | The measured pressure, dbar.
|
| |
|
const double * | OutMeasurement (const double dT, const double *const adX) |
| | The three measurements as [Salinity, Temperature, Depth].
|
| |
|
const double * | OutPosition (const double dT, const double *const adX) |
| | The NED position the held sample was taken at, m.
|
| |
◆ SensorCtd() [1/2]
| SensorCtd::SensorCtd |
( |
std::string |
simObjectName, |
|
|
ISimObjectCreator * |
creator |
|
) |
| |
Constructs the sensor from the simulation input file.
- Parameters
-
| simObjectName | The name of this object in the simulation. |
| creator | The creator of this object. |
◆ SensorCtd() [2/2]
| SensorCtd::SensorCtd |
( |
std::string |
simObjectName, |
|
|
const Settings & |
settings |
|
) |
| |
Constructs the sensor with its settings given directly.
No ports and no states are registered, so OdeFcn, AcceptedStep and InitialConditionSetup all do nothing and the instrument must be driven through SampleIfDue or Update instead. This constructor exists so that the sampling and the imperfection model can be unit tested without a host simulation, which matters because ISimObjectCreator has some thirty pure virtuals and FhSim exports no mock.
- Parameters
-
| simObjectName | The name of this object. |
| settings | The instrument settings. |
◆ AcceptedStep()
| void SensorCtd::AcceptedStep |
( |
const double |
dT, |
|
|
const double *const |
adX |
|
) |
| |
|
override |
Takes any samples that have fallen due since the previous accepted step.
- Parameters
-
| dT | The current simulation time, s. |
| adX | The state vector. |
◆ FinalSetup()
| void SensorCtd::FinalSetup |
( |
const double |
dT, |
|
|
const double *const |
adX, |
|
|
ISimObjectCreator *const |
creator |
|
) |
| |
|
override |
Resolves the environment and the two scalar field handles.
- Parameters
-
| dT | The initial simulation time, s. |
| adX | The state vector. |
| creator | The creator of this object. |
◆ InitialConditionSetup()
| void SensorCtd::InitialConditionSetup |
( |
const double |
dT, |
|
|
const double *const |
adCurrentIC, |
|
|
double *const |
adUpdatedIC, |
|
|
ISimObjectCreator *const |
creator |
|
) |
| |
|
override |
Seeds the three lag states with the field values at the start position.
- Parameters
-
| dT | The initial simulation time, s. |
| adCurrentIC | The initial conditions known so far. |
| adUpdatedIC | The initial conditions this object can supply. |
| creator | The creator of this object. |
◆ LagDerivative()
| static double SensorCtd::LagDerivative |
( |
double |
fieldValue, |
|
|
double |
lagState, |
|
|
double |
timeConstant |
|
) |
| |
|
static |
The derivative of one first-order instrument lag.
- Parameters
-
| fieldValue | The value of the field at the sensor head. |
| lagState | The current lagged value. |
| timeConstant | The lag time constant, s. Zero or less means no lag. |
- Returns
- The state derivative, which is zero when there is no lag.
◆ MeasuredValueOf()
| static double SensorCtd::MeasuredValueOf |
( |
double |
lagState, |
|
|
double |
fieldValue, |
|
|
double |
timeConstant |
|
) |
| |
|
static |
Picks the value a channel measures, which bypasses the state when there is no lag.
- Parameters
-
| lagState | The current lagged value. |
| fieldValue | The value of the field at the sensor head. |
| timeConstant | The lag time constant, s. |
- Returns
- The lagged value, or the field value when the time constant is zero.
◆ Perturb()
| static double SensorCtd::Perturb |
( |
double |
trueValue, |
|
|
const Channel & |
channel, |
|
|
SensorNoise & |
noise |
|
) |
| |
|
static |
Applies one channel's bias, noise and quantisation.
- Parameters
-
| trueValue | The lagged, true value. |
| channel | The channel's imperfections. |
| noise | The random generator; a deterministic one leaves the value alone. |
- Returns
- The value the instrument reports.
◆ PressureOf()
| static double SensorCtd::PressureOf |
( |
double |
depth | ) |
|
|
static |
Converts a depth to the nominal pressure this class reports.
- Parameters
-
| depth | The depth below the mean water level, m. |
- Returns
- The pressure, dbar.
◆ Quantize()
| static double SensorCtd::Quantize |
( |
double |
value, |
|
|
double |
resolution |
|
) |
| |
|
static |
Rounds a value to a multiple of a quantisation step.
- Parameters
-
| value | The value to quantise. |
| resolution | The quantisation step. Zero or less leaves the value alone. |
- Returns
- The quantised value.
◆ SampleIfDue()
| bool SensorCtd::SampleIfDue |
( |
double |
t, |
|
|
double |
temperature, |
|
|
double |
salinity, |
|
|
double |
depth, |
|
|
const double |
position[3] |
|
) |
| |
Takes every sample that is due at a time, and holds the last one.
- Parameters
-
| t | The current simulation time, s. |
| temperature | The lagged temperature at the sensor head, degC. |
| salinity | The lagged salinity at the sensor head, PSU. |
| depth | The lagged depth of the sensor head, m. |
| position | The NED position of the sensor head, m. |
- Returns
- True when at least one sample was taken, so the held reading changed.
◆ Update()
| void SensorCtd::Update |
( |
double |
temperature, |
|
|
double |
salinity, |
|
|
double |
depth, |
|
|
const double |
position[3] |
|
) |
| |
Takes one sample unconditionally, applying the bias, the noise and the quantisation.
- Parameters
-
| temperature | The lagged temperature at the sensor head, degC. |
| salinity | The lagged salinity at the sensor head, PSU. |
| depth | The lagged depth of the sensor head, m. |
| position | The NED position of the sensor head, m. |
The documentation for this class was generated from the following file:
- /update_root/webfhsim/reloadrepos/fhsim_fishery/src/auv/SensorCtd.h