FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
VesselData.h
1#ifndef SHIP2_VESSELDATA_H
2#define SHIP2_VESSELDATA_H
3
4#include <Eigen/Core>
5
6#include <complex>
7#include <string>
8#include <vector>
9
10namespace Ship
11{
12namespace Ship2
13{
14
15using Matrix6d = Eigen::Matrix<double, 6, 6>;
16using Vector6d = Eigen::Matrix<double, 6, 1>;
17using Vector6cd = Eigen::Matrix<std::complex<double>, 6, 1>;
18
33{
34 struct Section
35 {
36 double x = 0.0;
37 std::vector<Eigen::Vector2d> points;
38 };
39
40 std::string name;
41 std::string licence;
42 std::string attribution;
43 std::string directory;
44
45 double rho = 1025.0;
46 double g = 9.81;
47
48 // main dimensions [m]
49 double lpp = 0.0, beam = 0.0, draught = 0.0, loa = 0.0;
50
51 // loading condition (body frame)
52 double mass = 0.0;
53 Eigen::Vector3d cog = Eigen::Vector3d::Zero();
54 Eigen::Vector3d radii = Eigen::Vector3d::Zero();
55
56 // radiation: finite frequencies ascending [rad/s], added mass and damping per frequency
57 std::vector<double> omega;
58 std::vector<Matrix6d> addedMass;
59 std::vector<Matrix6d> damping;
60 Matrix6d addedMassZero = Matrix6d::Zero();
61 Matrix6d addedMassInfinite = Matrix6d::Zero();
62 bool hasZero = false, hasInfinite = false;
63
65 Matrix6d restoring = Matrix6d::Zero();
66
67 // excitation: frequencies, headings [rad, 0..2 pi ascending, both ends], X[frequency][heading]
68 std::vector<double> omegaExcitation;
69 std::vector<double> betaExcitation;
70 std::vector<std::vector<Vector6cd>> excitation;
71
72 // mean drift (surge, sway, yaw) per unit amplitude squared, same layout; empty without a .8 file
73 std::vector<double> omegaDrift;
74 std::vector<double> betaDrift;
75 std::vector<std::vector<Eigen::Vector3d>> drift;
76
77 std::vector<Section> sections;
78
81 bool symmetric = false;
82
85 static VesselData Load(const std::string& vesselFile);
86
88 Matrix6d RigidBodyMass() const;
89
92 Vector6cd Excitation(double w, double beta) const;
93
95 Eigen::Vector3d Drift(double w, double beta) const;
96
98 Matrix6d AddedMassAt(double w) const;
99 Matrix6d DampingAt(double w) const;
100};
101
102} // namespace Ship2
103} // namespace Ship
104
105#endif
Superclass of control algorithms for the control system.
Definition CableAttach.h:58
Definition VesselData.h:35
std::vector< Eigen::Vector2d > points
(y, z): half-section from the keel to the deck edge, z down
Definition VesselData.h:37
double x
[m] from the origin
Definition VesselData.h:36
Definition VesselData.h:33
static VesselData Load(const std::string &vesselFile)
Eigen::Vector3d cog
centre of gravity [m]
Definition VesselData.h:53
bool symmetric
Definition VesselData.h:81
Matrix6d AddedMassAt(double w) const
Added mass and damping at frequency w (linear between the frequencies, held at the ends).
Vector6cd Excitation(double w, double beta) const
double mass
[kg]
Definition VesselData.h:52
std::string directory
where the files are
Definition VesselData.h:43
Eigen::Vector3d Drift(double w, double beta) const
The mean drift force (surge, sway, yaw) per unit amplitude squared (zero without drift data).
Matrix6d RigidBodyMass() const
The rigid-body mass matrix about the origin (the centre of gravity's offset included).
Eigen::Vector3d radii
radii of gyration about it, roll, pitch, yaw [m]
Definition VesselData.h:54
Matrix6d restoring
The restoring matrix about the origin, buoyancy and the gravity of mass at cog (WAMIT's convention).
Definition VesselData.h:65