FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
SensorSilCam Class Reference
+ Inheritance diagram for SensorSilCam:
+ Collaboration diagram for SensorSilCam:

Classes

struct  Measurement
 One completed measurement window, held on the output ports until the next closes. More...
 
struct  Settings
 Everything that makes one silhouette camera out of the shared sensor machinery. More...
 

Public Member Functions

 SensorSilCam (std::string simObjectName, ISimObjectCreator *creator)
 
 SensorSilCam (std::string simObjectName, const Settings &settings)
 
void OdeFcn (const double dT, const double *const adX, double *const adXDot) const override
 An empty function: nothing about a frame counting instrument is a continuous state.
 
void AcceptedStep (const double dT, const double *const adX) override
 
void FinalSetup (const double dT, const double *const adX, ISimObjectCreator *const creator) override
 
int CaptureIfDue (double t, double numberConcentration, const double position[3])
 
bool CaptureFrame (double t, double numberConcentration, const double position[3])
 
const MeasurementHeldMeasurement () const
 The measurement currently held on the output ports.
 
const SettingsGetSettings () const
 The settings the instrument was built with.
 
int FramesInWindow () const
 The number of frames captured since the current window opened.
 
long long FramesCaptured () const
 The total number of frames captured since the instrument was built.
 
double NextFrameTime () const
 The time at which the next frame is due, s.
 

Static Public Member Functions

static double SampleVolumeOf (const double sideLengths[3])
 
static double FrameLambdaOf (double numberConcentration, double sampleVolume, double captureEfficiency, double detectionProbability)
 
static double LengthLogSigmaOf (double medianLength, double stdLength)
 
static int BinIndexOf (double length, double binMin, double binMax, int numBins)
 

Protected Member Functions

const double * OutConcentration (const double dT, const double *const adX)
 The measured mass concentration, kg/m^3.
 
const double * OutNumberConcentration (const double dT, const double *const adX)
 The measured number concentration, individuals per m^3.
 
const double * OutCount (const double dT, const double *const adX)
 The raw aggregated count over the window.
 
const double * OutSizeMean (const double dT, const double *const adX)
 The mean measured particle length, m.
 
const double * OutSizeStd (const double dT, const double *const adX)
 The standard deviation of the measured particle lengths, m.
 
const double * OutSizeHistogram (const double dT, const double *const adX)
 The normalised size distribution.
 
const double * OutSampleTime (const double dT, const double *const adX)
 The mid time of the held window, s.
 
const double * OutPosition (const double dT, const double *const adX)
 The mean NED position of the sensor head over the held window, m.
 
const double * OutValid (const double dT, const double *const adX)
 One once the first window has closed.
 

Constructor & Destructor Documentation

◆ SensorSilCam() [1/2]

SensorSilCam::SensorSilCam ( std::string  simObjectName,
ISimObjectCreator *  creator 
)

Constructs the sensor from the simulation input file.

Parameters
simObjectNameThe name of this object in the simulation.
creatorThe creator of this object.

◆ SensorSilCam() [2/2]

SensorSilCam::SensorSilCam ( std::string  simObjectName,
const Settings settings 
)

Constructs the sensor with its settings given directly.

No ports are registered, so AcceptedStep and FinalSetup do nothing and the instrument must be driven through CaptureIfDue instead. This constructor exists so the counting, the sizing and the aggregation can be unit tested without a host simulation, which matters because ISimObjectCreator has some thirty pure virtuals and FhSim exports no mock. It is the same seam SensorCtd uses.

Parameters
simObjectNameThe name of this object.
settingsThe instrument settings.

Member Function Documentation

◆ AcceptedStep()

void SensorSilCam::AcceptedStep ( const double  dT,
const double *const  adX 
)
override

Captures every frame that has fallen due since the previous accepted step.

Parameters
dTThe current simulation time, s.
adXThe state vector.

◆ BinIndexOf()

static int SensorSilCam::BinIndexOf ( double  length,
double  binMin,
double  binMax,
int  numBins 
)
static

The histogram bin a length falls in, clamping the tails into the end bins.

Parameters
lengthThe length, m.
binMinThe lower edge of the first bin, m.
binMaxThe upper edge of the last bin, m.
numBinsThe number of bins.
Returns
The bin index in [0, numBins - 1].

◆ CaptureFrame()

bool SensorSilCam::CaptureFrame ( double  t,
double  numberConcentration,
const double  position[3] 
)

Captures exactly one frame, closing the window if it is the last of one.

Parameters
tThe time of the frame, s.
numberConcentrationThe number concentration at the sensor head, per m^3.
positionThe NED position of the sensor head, m.
Returns
True when this frame closed a window, so the held measurement changed.

◆ CaptureIfDue()

int SensorSilCam::CaptureIfDue ( double  t,
double  numberConcentration,
const double  position[3] 
)

Captures every frame that is due at a time.

A loop and not a single test, so that a long accepted step consumes every frame that fell inside it rather than throwing the signal away.

Parameters
tThe current simulation time, s.
numberConcentrationThe number concentration at the sensor head, per m^3.
positionThe NED position of the sensor head, m.
Returns
The number of frames captured, which may be zero or more than one.

◆ FinalSetup()

void SensorSilCam::FinalSetup ( const double  dT,
const double *const  adX,
ISimObjectCreator *const  creator 
)
override

Resolves the environment, the species field handle and the field's properties.

Parameters
dTThe initial simulation time, s.
adXThe state vector.
creatorThe creator of this object.

◆ FrameLambdaOf()

static double SensorSilCam::FrameLambdaOf ( double  numberConcentration,
double  sampleVolume,
double  captureEfficiency,
double  detectionProbability 
)
static

The expected number of counted particles in one frame.

Parameters
numberConcentrationThe number concentration at the sensor head, per m^3.
sampleVolumeThe imaged volume, m^3.
captureEfficiencyThe fraction of present animals carried through the volume.
detectionProbabilityThe probability an imaged animal is counted.
Returns
The Poisson rate of one frame.

◆ LengthLogSigmaOf()

static double SensorSilCam::LengthLogSigmaOf ( double  medianLength,
double  stdLength 
)
static

The log-sigma of the length distribution implied by a median and a standard deviation.

Parameters
medianLengthThe median length, m.
stdLengthThe standard deviation of the length, m.
Returns
The log-sigma, which is zero when either argument is non-positive.

◆ SampleVolumeOf()

static double SensorSilCam::SampleVolumeOf ( const double  sideLengths[3])
static

The imaged volume, m^3.

Parameters
sideLengthsThe three side lengths of the imaged volume, m.
Returns
The product of the three, m^3.

The documentation for this class was generated from the following file: