260#include "SampleClock.h"
261#include "SensorFrame.h"
262#include "SensorNoise.h"
264#include <fhsim/simobject/SimObject.h>
272class EnvironmentProvider;
359 static double AltitudeOf(
double slantRange,
const double beamDirection[3]);
392 static double NoiseFloorLinear(
double noiseSvAt1mDb,
double absorptionDbPerKm,
double range);
395 void OdeFcn(
const double dT,
const double*
const adX,
double*
const adXDot)
const override;
410 void FinalSetup(
const double dT,
const double*
const adX, ISimObjectCreator*
const creator)
override;
412#ifdef FH_VISUALIZATION
423 void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator)
override;
430 void RenderUpdate(
const double dT,
const double*
const adX)
override;
440 const std::vector<Species>&
GetSpecies()
const {
return m_species; }
446 const std::vector<double>&
Frequencies()
const {
return m_frequencykHz; }
456 const double*
OutAltitude(
const double dT,
const double*
const adX);
459 const double*
OutValid(
const double dT,
const double*
const adX);
462 const double*
OutPingTime(
const double dT,
const double*
const adX);
469 void ReadFrequencyArrays(ISimObjectCreator*
const creator);
475 void ReadFileParameters(ISimObjectCreator*
const creator);
481 void ResolveEnvironment(ISimObjectCreator*
const creator);
489 void ResolveSpecies(ISimObjectCreator*
const creator);
496 void Ping(
double dT,
const double*
const adX);
506 double MeasureBottom(
double dT,
const double position[3],
const double beamDown[3]);
518 void WriteBeam(
double dT,
const double position[3],
const double direction[3],
519 const char* beamLabel,
double beamRange,
double bottomRange);
528 static double RangeToSurface(
const double position[3],
const double direction[3],
double maxRange);
534 void OpenFileAndWriteHeader(ISimObjectCreator*
const creator);
537 void Warn(
const std::string& text)
const;
546 std::vector<std::string> m_speciesFieldNames;
547 bool m_autoDiscover =
false;
548 std::vector<Species> m_species;
550 std::vector<double> m_frequencykHz;
551 std::vector<double> m_absorptionDbPerKm;
552 std::vector<double> m_bottomBackscatterDb;
553 std::vector<double> m_noiseSvAt1mDb;
554 std::vector<double> m_svBiasDb;
556 bool m_writeFile =
true;
557 std::string m_fileName;
558 int m_flushEveryNPings = 20;
559 int m_svPrecision = 2;
561 std::unique_ptr<std::ofstream> m_stream;
563 environment::EnvironmentProvider* m_environment =
nullptr;
564 PrintDuringExec* m_print =
nullptr;
566 bool m_hasPorts =
false;
567 int m_pingsTaken = 0;
572 std::vector<double> m_binConcentration;
577#ifdef FH_VISUALIZATION
578 Ogre::SceneManager* m_sceneMgr =
nullptr;
579 Ogre::SceneNode* m_beamNode =
nullptr;
580 Ogre::ManualObject* m_beamObject =
nullptr;
Definition SampleClock.h:40
Definition SensorEchosounder.h:276
static double NoiseFloorLinear(double noiseSvAt1mDb, double absorptionDbPerKm, double range)
const double * OutSeafloorDepth(const double dT, const double *const adX)
The inferred depth of the seafloor, m.
const double * OutAltitude(const double dT, const double *const adX)
The measured height above the seafloor, m.
const double * OutValid(const double dT, const double *const adX)
One when the last ping found a bottom, zero otherwise.
const std::vector< double > & Frequencies() const
The operating frequencies, kHz.
Definition SensorEchosounder.h:446
static double BackscatterCrossSection(const Species &species, double frequencykHz)
static double AltitudeOf(double slantRange, const double beamDirection[3])
void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const creator) override
static double PerturbRange(double trueRange, const Settings &settings, SensorNoise &noise)
int PingsTaken() const
The number of pings taken so far.
Definition SensorEchosounder.h:443
const double * OutSeafloorDistance(const double dT, const double *const adX)
The measured slant range to the seafloor, m.
static double TargetStrengthDb(const Species &species, double frequencykHz)
SensorEchosounder(std::string simObjectName, const Settings &settings)
void OdeFcn(const double dT, const double *const adX, double *const adXDot) const override
Writes no derivatives: this SimObject declares no states.
SensorEchosounder(std::string simObjectName, ISimObjectCreator *creator)
const std::vector< Species > & GetSpecies() const
The species entering the acoustic model, in file column order.
Definition SensorEchosounder.h:440
const Reading & HeldReading() const
The reading currently held on the output ports.
Definition SensorEchosounder.h:434
~SensorEchosounder() override
Flushes and closes the echogram file, and releases the visualisation geometry.
const double * OutPingTime(const double dT, const double *const adX)
The time of the ping the held reading came from, s.
void AcceptedStep(const double dT, const double *const adX) override
const Settings & GetSettings() const
The settings the instrument was built with.
Definition SensorEchosounder.h:437
static int BinIndexOf(double range, double binSize)
Definition SensorFrame.h:36
Definition SensorNoise.h:39
The altimeter reading held on the output ports between pings.
Definition SensorEchosounder.h:301
double valid
One when a bottom was found, zero otherwise.
Definition SensorEchosounder.h:305
double pingTime
The time of the ping this reading came from, s.
Definition SensorEchosounder.h:306
double seafloorDepth
The inferred depth of the seafloor, m.
Definition SensorEchosounder.h:303
double seafloorDistance
The measured slant range to the seafloor, m.
Definition SensorEchosounder.h:302
double altitude
The measured height above the seafloor, m.
Definition SensorEchosounder.h:304
Everything the instrument is configured with.
Definition SensorEchosounder.h:280
double independentSamplesPerBin
The Gamma shape of the speckle.
Definition SensorEchosounder.h:294
double rayTolerance
The convergence tolerance of the ray intersection, m.
Definition SensorEchosounder.h:285
double maxRangeUp
The longest slant range binned upwards, m.
Definition SensorEchosounder.h:283
double rangeNoiseRelative
The relative range noise standard deviation.
Definition SensorEchosounder.h:288
double beamWidthDeg
The full opening angle of the drawn beam, degrees. Visualisation only.
Definition SensorEchosounder.h:290
double rangeBias
The constant offset of the measured range, m.
Definition SensorEchosounder.h:286
double svFloorDb
The lowest Sv ever reported, dB.
Definition SensorEchosounder.h:293
double rayStepSize
The search step of the ray intersection, m.
Definition SensorEchosounder.h:284
unsigned int noiseSeed
The random seed; zero is a perfect instrument.
Definition SensorEchosounder.h:296
double maxRangeDown
The longest slant range searched downwards, m.
Definition SensorEchosounder.h:282
double rangeNoiseStd
The absolute range noise standard deviation, m.
Definition SensorEchosounder.h:287
double binSize
The echogram range bin size, m.
Definition SensorEchosounder.h:292
double pingPeriod
The time between pings, s.
Definition SensorEchosounder.h:281
One species as the acoustic model sees it.
Definition SensorEchosounder.h:311
int handle
The field handle, resolved once in FinalSetup.
Definition SensorEchosounder.h:313
double slopeDbPerOctave
The target strength slope with frequency, dB per octave.
Definition SensorEchosounder.h:318
std::string name
The scalar field name.
Definition SensorEchosounder.h:312
double refFreqkHz
The frequency the target strength was measured at, kHz.
Definition SensorEchosounder.h:317
double tsRefDb
The target strength constant at the reference frequency, dB.
Definition SensorEchosounder.h:316
double lengthM
The median animal length, m.
Definition SensorEchosounder.h:315
double massKg
The mass of one animal, kg.
Definition SensorEchosounder.h:314