FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
RadiationModel.h
1#ifndef SHIP2_RADIATIONMODEL_H
2#define SHIP2_RADIATIONMODEL_H
3
4#include "Ship2/VesselData.h"
5
6#include <Eigen/Core>
7
8#include <complex>
9#include <vector>
10
11namespace Ship
12{
13namespace Ship2
14{
15
28{
29public:
30 struct Options
31 {
32 int maxOrder = 10;
33 double tolerance = 0.03;
34 double negligible = 1e-3;
35 double minDamping = 0.1;
36 };
37
38 struct Pair
39 {
40 int i = 0, j = 0;
41 Eigen::MatrixXd A;
42 Eigen::VectorXd B;
43 Eigen::RowVectorXd C;
44 int offset = 0;
45 double error = 0.0;
47 };
48
49 RadiationModel() = default;
50
52 static RadiationModel Fit(const VesselData& data, const Options& options);
53 static RadiationModel Fit(const VesselData& data) { return Fit(data, Options()); }
54
55 int NumStates() const { return m_numStates; }
56 const std::vector<Pair>& Pairs() const { return m_pairs; }
58 const Matrix6d& AddedMassInfinite() const { return m_addedMassInfinite; }
59
61 void Derivatives(const double* x, const Vector6d& nu, double* xdot) const;
62
64 Vector6d MemoryForce(const double* x) const;
65
67 Eigen::Matrix<std::complex<double>, 6, 6> Response(double omega) const;
68
69private:
70 std::vector<Pair> m_pairs;
71 int m_numStates = 0;
72 Matrix6d m_addedMassInfinite = Matrix6d::Zero();
73};
74
75} // namespace Ship2
76} // namespace Ship
77
78#endif
Definition RadiationModel.h:28
Vector6d MemoryForce(const double *x) const
The memory force mu (the radiation force is -A(inf) dnu/dt - mu).
void Derivatives(const double *x, const Vector6d &nu, double *xdot) const
dx/dt for the states x and the body velocity nu.
Eigen::Matrix< std::complex< double >, 6, 6 > Response(double omega) const
The fitted K(j omega), for checks.
const Matrix6d & AddedMassInfinite() const
The added mass at infinite frequency the model was fitted with.
Definition RadiationModel.h:58
static RadiationModel Fit(const VesselData &data, const Options &options)
Fits the model to data (needs its added mass at infinite frequency; without it A(omega_max) is used).
Superclass of control algorithms for the control system.
Definition CableAttach.h:58
Definition RadiationModel.h:31
double minDamping
smallest damping ratio of a pole: lighter ones fit noise and ring for minutes
Definition RadiationModel.h:35
Definition RadiationModel.h:39
double error
Definition RadiationModel.h:45
int j
force mode i, velocity mode j
Definition RadiationModel.h:40
int offset
first state of the pair
Definition RadiationModel.h:44
Definition VesselData.h:33