FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Cable6Dof.h
1#pragma once
2
107#include <string>
108
109#include <Eigen/Eigen>
110
111#include <fhsim/PrintDuringExec.h>
112#include <fhsim/simobject/SimObject.h>
113#include <fhsim_environment/EnvironmentProvider.h>
114#include <fhsim_environment/ElementFlowInteraction.h>
115
116#include "cable/GaussPointDrag.h"
117
118#ifdef FH_VISUALIZATION
119# include "sfh/ogre/C3DLine.h"
120#endif
121
122namespace RbCable
123{
124class Cable6Dof : public SimObject
125{
126public:
127 Cable6Dof(const std::string& simObjectName, ISimObjectCreator* const creator);
128 ~Cable6Dof();
129 void OdeFcn(const double T, const double* const X, double* const XDot) const;
130 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
131 void FinalSetup(const double T, const double* const X, ISimObjectCreator* const creator) override;
132 void PreOdeFcn(const double T, const double* const X) override;
133
134 const double* forceA(const double T, const double* const X);
135 const double* forceB(const double T, const double* const X);
136
137 // const double* const energy(const double T, const double* const X);
138
139 void calculations(const double T, const double* const X);
140
142 void BuildGaussPoints(const double* const X);
143 void calculationsCommon(const double T, const double* const X) const;
144
145#ifdef FH_VISUALIZATION
146 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
147 void RenderUpdate(const double T, const double* const X);
148 Ogre::ColourValue tensionColor(double N);
149#endif
150
151protected:
152 typedef Eigen::Matrix<double, 3, 3> mat3;
153 typedef Eigen::Matrix<double, 3, 1> vec3;
154
155 // double m_energy[3];
156
157 int m_numElements;
158 double m_totalLength;
159 double m_radius;
160 double m_alpha;
161 double m_beta;
162 double m_epsilon;
163 double m_weight;
164 double m_rho;
165 double m_rhoWater;
166 PrintDuringExec* m_print = nullptr;
167 environment::wake::ElementFlowInteraction m_flow;
168 bool m_gaussPointDrag = true;
170 double m_Ct; // tangential damping coefficient
171 double m_Cn; // normal damping coefficient
172
173 double m_L;
174 double m_M;
175 double m_Ixy;
176 double m_Iz;
177 mat3 m_baseM;
178
179 struct element
180 {
181 vec3 k;
182 vec3 LkXw;
183 mat3 Mi;
184 mat3 MiT;
185 mat3 JMiJt;
186 int p;
187 int q;
188 int v;
189 int w;
190 };
191 element* m_el;
192
193 ISignalPort* m_posA;
194 ISignalPort* m_posB;
195 ISignalPort* m_velA;
196 ISignalPort* m_velB;
197
198 ICommonComputation* m_calcDynamics;
199 Eigen::Matrix<double, Eigen::Dynamic, 1> m_lambda;
200 Eigen::Matrix<double, Eigen::Dynamic, 1> m_F;
201 // double* m_lambda;
202
203 double m_forceA[3];
204 double m_forceB[3];
205
206#ifdef FH_VISUALIZATION
207 Ogre::ManualObject* m_ManualObject;
208 // Ogre::SceneManager* m_SceneMgr;
209 double m_scale;
210 Ogre::SceneNode* m_ManualObjectNode;
211 // C3DLine* m_line; ///< white linestrip visualization object
212#endif
213};
214} // namespace RbCable
Definition Cable6Dof.h:125
environment::wake::ElementFlowInteraction m_flow
The flow at the element centres, the other objects' wakes taken per step (MARE-0223); the Environment...
Definition Cable6Dof.h:167
void FinalSetup(const double T, const double *const X, ISimObjectCreator *const creator) override
Takes the Environment (MARE-0315).
wet_cylinder_water::ElementGaussPoints m_gaussPoints
The Gauss points of the elements of the chain, and the water at them; buffers kept from call to call.
Definition Cable6Dof.h:169
PrintDuringExec * m_print
The shared printer for run errors; null if the creator has none, as in a unit test.
Definition Cable6Dof.h:166
void PreOdeFcn(const double T, const double *const X) override
Takes the other objects' wakes at the element centres, or with the Gauss-point drag at the Gauss poin...
void BuildGaussPoints(const double *const X)
Finds the Gauss points of the chain of elements from the state; the axis of an element is its quatern...
bool m_gaussPointDrag
Gauss-point drag with the water at the Gauss points (MARE-0396).
Definition Cable6Dof.h:168
Cable6Dof(const std::string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, output and intput ports.
Definition GaussPointDrag.h:56
Definition Cable6Dof.h:180
mat3 MiT
The inverse of the translational inertia with the added mass normal to the axis, global frame (MARE-0...
Definition Cable6Dof.h:184