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