FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
TrawlVessel.h
1
10
11#pragma once
12
13#include <array>
14#include <fhsim/simobject/SimObject.h>
15#include <stdio.h>
16#include <string>
17#include <vector>
18
19class TrawlVessel : public SimObject
20{
21public:
22 TrawlVessel(std::string simObjectName, ISimObjectCreator* creator);
24
25 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot) const;
26
29 virtual double DesiredSpeed(const double dT, const double* const adX) const;
30
32 virtual double DesiredHeading(const double dT, const double* const adX) const;
33
40 bool HasJacobians() const override;
41 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
42 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
44
45#ifdef FH_VISUALIZATION
46 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
47 virtual void RenderUpdate(const double dT, const double* const adX);
48#endif
49
50protected:
51#ifdef FH_VISUALIZATION
59 void FitDefaultMesh();
60#endif
61
62 double m_apSpeed;
63
65 const double* OutHeading(const double dT, const double* const adX);
66 const double* OutPos(const double dT, const double* const adX);
67 const double* OutVel(const double dT, const double* const adX);
68 const double* OutWarpPos(const double dT, const double* const adX, int warp);
69 const double* OutWarpVel(const double dT, const double* const adX, int warp);
70 void CalcOutput(const double dT, const double* const adX);
71 void CalcOutputCommon(const double dT, const double* const adX) const;
72 virtual void DoDerivedOutputUpdate(const double dT, const double* const adX) { }
73
74 double m_out_Pos[3];
75 double m_out_Vel[3];
76 double* m_out_WarpPos;
77 double* m_out_WarpVel;
78 ICommonComputation* m_commonCalc;
79
80
81 int m_IStatePos;
82 int m_IStateHeading;
83 double m_Breadth;
84 double m_Draught;
85 double m_Length;
86 double m_WarpPosPrt[3];
87 double m_WarpPosStb[3];
88 double m_pitch;
89 std::vector<std::array<double, 3>> m_warpPos;
90 int m_numWarps;
91 // The commands are read at (T, X) wherever they are used, never stored: with NumCores > 1 the
92 // ports' calculation runs while OdeFcn runs on another thread (FISH-0104).
95
96#ifdef FH_VISUALIZATION
97 Ogre::Entity* m_RenderMass;
98 Ogre::SceneNode* m_RenderNode;
99 Ogre::Quaternion m_InitOrientation;
100 double m_LengthScale;
101 double m_BreadthScale;
102 double m_DepthScale;
103 double m_deltaRenderPos[3];
104 std::string m_MeshName;
105 bool m_meshGiven;
106 bool m_scaleGiven[3];
107#endif
108};
Class modelling a simple vessel used for the trawl optimization tool.
Definition TrawlVessel.h:20
ICommonComputation * m_commonCalc
Calculations necessary for more than one output port.
Definition TrawlVessel.h:78
virtual double DesiredSpeed(const double dT, const double *const adX) const
std::vector< std::array< double, 3 > > m_warpPos
The warp fastenings in the body frame, port to starboard.
Definition TrawlVessel.h:89
double m_initialSpeed
InitialSpeed: the speed command of a vessel without a Vel input.
Definition TrawlVessel.h:93
const double * OutHeading(const double dT, const double *const adX)
Output ports.
double m_initialHeading
InitialHeading: the heading command of a vessel without a Heading input.
Definition TrawlVessel.h:94
double m_apSpeed
The speed of the autopilot.
Definition TrawlVessel.h:62
virtual double DesiredHeading(const double dT, const double *const adX) const
The commanded heading at (dT, adX), as DesiredSpeed: InitialHeading here.