FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Tide.h
1#pragma once
2
3#include <memory>
4#include <string>
5#include <vector>
6
7namespace environment
8{
9
27class Tide
28{
29public:
32 {
33 std::string name;
34 double amplitude;
35 double phase;
36 };
37
42 Tide(double meanLevel, std::vector<Constituent> constituents, double startTime);
43
55 static std::vector<Constituent> ReadFile(const std::string& path, double& meanLevel);
56
60 static double ParseUtc(const std::string& text);
61
63 static bool Known(const std::string& name);
64
66 double Level(double t) const;
67
69 double Rate(double t) const;
70
72 double MaxLevel() const { return m_maxLevel; }
73
74 double MeanLevel() const { return m_meanLevel; }
75 double StartTime() const { return m_startTime; }
76 const std::vector<Constituent>& Constituents() const { return m_constituents; }
77
79 static double SpeedDegPerHour(const std::string& name);
80
81private:
82 struct Term
83 {
84 double amplitude;
85 double omega;
86 double phase0;
87 };
88
89 double m_meanLevel;
90 double m_startTime;
91 double m_maxLevel = 0.0;
92 std::vector<Constituent> m_constituents;
93 std::vector<Term> m_terms;
94};
95
96} // namespace environment
Definition Tide.h:28
Tide(double meanLevel, std::vector< Constituent > constituents, double startTime)
static double ParseUtc(const std::string &text)
double MaxLevel() const
An upper bound of |eta| [m]: |Z0| + sum of f_i H_i.
Definition Tide.h:72
static bool Known(const std::string &name)
True when the name is in the constituent table (case-insensitive).
static double SpeedDegPerHour(const std::string &name)
The angular speed [deg/h] of a constituent in the table (for tests and documentation).
double Level(double t) const
The water level eta [m] at the simulation time t [s], positive up.
double Rate(double t) const
The rate of the water level [m/s] at the simulation time t [s].
static std::vector< Constituent > ReadFile(const std::string &path, double &meanLevel)
Definition FlukeAnchor.h:124
One constituent of the input.
Definition Tide.h:32
double amplitude
H [m], not negative.
Definition Tide.h:34
double phase
Greenwich phase lag g [deg], UTC.
Definition Tide.h:35
std::string name
IHO name, e.g. "M2".
Definition Tide.h:33