|
FhSim
3.1.0
Marine systems simulation
|
#include <ParameterLibrary.h>
Classes | |
| class | Species |
| One species of the library. More... | |
Public Member Functions | |
| const std::string & | Version () const |
| The library version, e.g. "0.6.0". | |
| const std::string & | Path () const |
| The file the library was read from; empty when it was read from a string. | |
| const Species * | Find (const std::string &key) const |
| std::vector< std::string > | SpeciesKeys () const |
| The species keys, sorted. | |
Static Public Member Functions | |
| static std::vector< std::string > | CandidatePaths (const std::string &configured, const std::string &inputFilePath) |
| static ParameterLibrary | Load (const std::string &configured, const std::string &inputFilePath) |
| static ParameterLibrary | FromFile (const std::string &path) |
| static ParameterLibrary | FromJsonString (const std::string &document) |
Static Public Attributes | |
| static constexpr const char * | kInstalledPath = "resources/acoustics/parameter_library.json" |
| The installed library, relative to a resources directory. | |
The versioned set of empirical acoustic parameters per species, read from a JSON file.
The file is a copy of the echosounder sensor repository's parameters/parameter_library.json (data/acoustics/README.md), and this class ports that repository's reference model (julia/EchosounderModel/src/fish.jl): a species' target strength TS(L, f), its weight W(L) = a L^b and its normal length spread with coefficient of variation length_cv. Only the species section is read; the calibration targets and sediments are not used in FhSim.
Two kinds of species are known: ts_length, TS = 20 log10(L / cm) + b20(f), and ts_table, TS tabulated over length and interpolated linearly in log10(L), never extrapolated. Data exist only at the frequencies the file lists (18, 38, 70, 120 and 200 kHz).
|
static |
The files tried, in order, for the ParameterLibrary parameter of a SimObject.
An empty configured is the installed copy: <input dir>/resources/..., which is where an FMU keeps it (the model XML sits in the FMU root), then ../resources/... from the working directory, which is a playpen's bin. An absolute configured is itself; a relative one is tried beside the input file, then in the working directory, as fhsim's InputReader does.
| configured | The ParameterLibrary parameter; empty for the installed copy. |
| inputFilePath | The main input file (ISimObjectCreator::GetInputfilePath); empty when unknown. |
| const Species * ParameterLibrary::Find | ( | const std::string & | key | ) | const |
The species of a key.
| key | The species key, e.g. "herring". |
|
static |
Reads the library from a JSON file.
| path | The file, relative to the working directory or absolute. |
| std::invalid_argument | if the file cannot be read or is not a valid library. |
|
static |
Reads the library from a JSON document.
| document | The JSON text. |
| std::invalid_argument | if the document is not a valid library. |
|
static |
Finds and reads the library for the ParameterLibrary parameter of a SimObject: the first existing file of CandidatePaths().
| configured | The ParameterLibrary parameter; empty for the installed copy. |
| inputFilePath | The main input file (ISimObjectCreator::GetInputfilePath); empty when unknown. |
| std::invalid_argument | naming every path tried when none exists, or as FromFile. |