Marine systems simulation
ViscousShip.h
1#ifndef CViscousShip_h__
2#define CViscousShip_h__
3
4#include <deque>
5#include <string>
6
7#include <Eigen/Eigen>
8
9#include "HullData/HullData.h"
10namespace Ship{
12 {
13 public :
14 enum EFileType
15 {
16 FILE_TYPE_VERES,
17 FILE_TYPE_WAMIT
18 };
19
21
22 void SetupFromFile( std::string fname, EFileType type, HullData *H);
23
24 void SetHullData( HullData *HD ){ myHullData = HD; }
25 // 0 = ITTC, 1= SeaWay
26 void SetTheoryFormulation( int theory ){ rollDampingTheory = theory;}
27 // amplitude horizon as a fraction of natural period ~B
28 void SetPhiAmplitudeHorizon(double horizon){phiAmplitudeHorizon = horizon;}
29
30
31 void GetViscousAddedMass(double u, double v, double r, Eigen::Matrix3d &Mat);
32
33 double GetViscousSurge(double u, double v, double r);
34 double GetViscousSway(double u, double v, double r);
35 double GetViscousYaw(double u, double v, double r);
36
37 double GetViscousRoll(double phiDot, double u = 0);
38 double EddieDamping( double phiDot, double u = 0);
39 double BilgeKeelDamping( double phiDot, double u = 0);
40 double FricitonDamping( double phiDot, double u = 0);
41 double LiftDamping( double phiDot, double u = 0);
42 double SkegDamping( double phiDot, double u = 0);
43
44 double SkegLiftDamping( double phiDot, double u );
45
46 void AddToRollTimeHistory( const double T, double RollAngle, const bool bIsMajorTimeStep );
47 void MakeBildgeKeel( double m_BilgeKeelStartPosition, double m_BilgeKeelEndPosition, double m_BilgeKeelHeight );
48 void MakeSkeg();
49
50 void SetHorizontalDampingBlend(double blendSpeed, double blendFraction=0.5);
51 void SetDpDampingX(double Xu, double Xv, double Xr);
52 void SetDpDampingY(double Yu, double Yv, double Yr);
53 void SetDpDampingN(double Nu, double Nv, double Nr);
54
55 double ManeuverReferenceSpeed() const { return m_maneuverReferenceSpeed; }
56 void ManeuverReferenceSpeed(double val) { m_maneuverReferenceSpeed = val; }
57 protected:
58
59 double deltaWingKP(double A_ratio);
60 double deltaWingKV(double A_ratio);
61 double deltaWingCL(double alfa, double Kp, double Kv);
62
63 double m_maneuverReferenceSpeed;
64 double m_viscousDampingBlender;
65
66 double Yv_man, Yr_man, Yrd_man, Yvd_man;
67 double Nv_man, Nr_man, Nrd_man, Nvd_man;
68 double Xrr_man, Xud_man, Xvr_man, Xvv_man, Xvvvv_man;
69
70 double Xu_dp, Yu_dp, Nu_dp;
71 double Xv_dp, Yv_dp, Nv_dp;
72 double Xr_dp, Yr_dp, Nr_dp;
73
74 int m_bilgeKeelStartSection;
75 int m_bilgeKeelEndSection;
76 double m_startSectionFractionBK;
77 double m_endSectionFractionBK;
78
79 int rollDampingTheory;
80
81 int m_withSkeg;
82 int SkegStartSection;
83 int SkegEndSection;
84 int *SkegStartPoints;
85 int *SkegEndPoints;
86
87 protected:
88 void ReadMainDimensionsVeres( std::string fname );
89 void ReadMainDimensionsWamit( std::string fname );
90 HullData *myHullData;
91
92 double surfaceOfHull;
93 double kinematicViscosity;
94
95 double *SectionalNormalBilgeKeelForce;
96 double *SectionalPressureOnHullFromBilgeKeels;
97 double *SectionalEddieForce;
98 double *bilgeKeelHeight;
99
100 double* Ds;
101 double* Bs;
102 double* H0;
103 double* SigmaS;
104 double* A1;
105 double* A3;
106 double* Ms;
107
108 double Lpp,B,T;
109 double Cb,VCG;
110
111 double Lo,Lr,Kn;
112
113 double* SectionLength;
114 std::deque<double> phi_history;
115 std::deque<double> time_history;
116 double phiAmplitude;
117 double phiAmplitudeTime;
118 double m_rf;
119 double OG;
120 double phiAmplitudeHorizon;
121 int numberOfStations;
122 bool m_skegLift;
123 bool m_hullLift;
124 };
125}
126#endif // CViscousShip_h__
Definition: HullData.h:14
Definition: ViscousShip.h:12
Simple waypoint object.
Definition: CableAttach.h:16