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