Marine systems simulation
CablePendulum.h
1#pragma once
2
3#include "SimObject.h"
4
5#include "sfh/constants.h"
6#include "sfh/math.h"
7#include "sfh/text.h"
8#include "sfh/util.h"
9
10#include <Eigen/Dense>
11
12#include <CEnvironment.h>
13#include <memory>
82class CablePendulum : public SimObject
83{
84 public:
85 CablePendulum(const std::string& simObjectName, ISimObjectCreator* const creator);
86 void OdeFcn(const double T, const double* const X, double* const XDot, const bool IsMajorTimeStep);
87 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
88 void FinalSetup(const double T, const double* const X, ISimObjectCreator* const creator);
89
90#ifdef FH_VISUALIZATION
91 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
92 void RenderUpdate(const double T, const double* const X);
93#endif
94
95 protected:
96 void SetOutputPortValues(const double T, const double* const X);
97 const double* MidpointPosition(const double T, const double* const X);
98 const double* BallPosition(const double T, const double* const X);
99 const double* BallVelocity(const double T, const double* const X);
100 Eigen::Vector3d Drag(int k, int l, const double T, const double* const X);
101 Eigen::Vector3d Spring(int k, int l, const double T, const double* const X);
102 Eigen::Vector3d Damp(int k, int l, const double T, const double* const X);
103 const double* SuspensionForce(const double T, const double* const X);
104 const double* CableOnBallForce(const double T, const double* const X);
105
106
107 ICommonComputation* m_SetOutputPortValues;
108 ISignalPort* m_SuspensionPos;
109 ISignalPort* m_SuspensionVel;
110
111 CEnvironment* Environment;
112 std::vector<int> m_PositionIndex, m_VelocityIndex;
113 int m_BallPositionIndex, m_BallVelocityIndex;
114 int m_NumPoints;
115 double m_MidpointPosition[3];
116 double m_BallPosition[3];
117 double m_BallVelocity[3];
118 double m_SuspensionForce[3];
119 double m_CableOnBallForce[3];
120
121 double m_BallMass, m_BallRadius, m_BallDragCoef, m_RhoWater, m_BallRho;
122 double m_ElementMass, m_ElementLength0;
123 double m_SpringCoef, m_DamperCoef, m_GravYancy;
124 double m_CrossDragCoef, m_AlongDragCoef;
125 double m_Mass, m_Length, m_Diameter, m_RhoCable, m_Modulus;
126
127#ifdef FH_VISUALIZATION
128 Ogre::ManualObject* m_Line;
129 Ogre::SceneNode* m_RenderNode;
130 std::string m_MaterialName;
131 std::string m_MeshName;
132 double m_Scale;
133#endif
134};
Definition: CEnvironment.h:10
Definition: CablePendulum.h:83