3#include "sfh/constants.h"
12#include <fhsim/simobject/SimObject.h>
13#include <fhsim_environment/BodyFlowInteraction.h>
14#include <fhsim_environment/EnvironmentProvider.h>
15#include <fhsim_environment/ElementFlowInteraction.h>
16#include <fhsim_environment/hydrodynamics/SphereHydro.h>
115 CablePendulum(
const std::string& simObjectName, ISimObjectCreator*
const creator);
116 void OdeFcn(
const double T,
const double*
const X,
double*
const XDot)
const;
117 void InitialConditionSetup(
const double T,
const double*
const currentIC,
double*
const updatedIC, ISimObjectCreator*
const creator);
118 void FinalSetup(
const double T,
const double*
const X, ISimObjectCreator*
const creator);
122#ifdef FH_VISUALIZATION
123 void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
124 void RenderUpdate(
const double T,
const double*
const X);
128 void SetOutputPortValues(
const double T,
const double*
const X)
const;
129 const double* MidpointPosition(
const double T,
const double*
const X);
130 const double* BallPosition(
const double T,
const double*
const X);
131 const double* BallVelocity(
const double T,
const double*
const X);
138 bool HasJacobians()
const override;
139 void OdeJacobian(
double T,
const double* X,
double* J,
int nStates)
override;
140 int GetJacobianSparsity(
int nStates,
int* rowPtr,
int* colIdx)
override;
144 void addDragJacobian(
const double T,
int segment,
const double* pk,
const double* pl,
const double* vk,
145 double dF_dpk[9],
double dF_dpl[9],
double dF_dvk[9])
const;
147 Eigen::Vector3d
NodePosition(
int k,
const double T,
const double*
const X)
const;
149 Eigen::Vector3d
NodeVelocity(
int k,
const double T,
const double*
const X)
const;
150 Eigen::Vector3d Drag(
int k,
int l,
const double T,
const double*
const X)
const;
153 Eigen::Vector3d Spring(
int k,
int l,
const double T,
const double*
const X)
const;
154 Eigen::Vector3d Damp(
int k,
int l,
const double T,
const double*
const X)
const;
157 const double* SuspensionForce(
const double T,
const double*
const X);
158 const double* CableOnBallForce(
const double T,
const double*
const X);
161 ICommonComputation* m_SetOutputPortValues;
162 ISignalPort* m_SuspensionPos;
163 ISignalPort* m_SuspensionVel;
165 environment::EnvironmentProvider* Environment;
166 std::vector<int> m_PositionIndex, m_VelocityIndex;
167 int m_BallPositionIndex, m_BallVelocityIndex;
170 mutable double m_MidpointPosition[3];
171 mutable double m_BallPosition[3];
172 mutable double m_BallVelocity[3];
173 mutable double m_SuspensionForce[3];
174 mutable double m_CableOnBallForce[3];
175 double m_BallWaterVelocity[3] = {0.0, 0.0, 0.0};
180 std::optional<environment::wake::ElementFlowInteraction>
m_cableFlow;
182 double m_BallMass, m_BallRadius, m_RhoWater, m_BallRho;
183 double m_ElementMass, m_ElementLength0;
184 double m_SpringCoef, m_DamperCoef, m_GravYancy;
185 double m_Mass, m_Length, m_Diameter, m_RhoCable, m_Modulus;
187#ifdef FH_VISUALIZATION
188 Ogre::ManualObject* m_Line;
189 Ogre::SceneNode* m_RenderNode;
190 std::string m_MaterialName;
191 std::string m_MeshName;
Definition CablePendulum.h:113
std::optional< environment::sphere_hydro::SphereCaster > m_ballCaster
The ball on its states, for the wake.
Definition CablePendulum.h:178
void ballWaterVelocity(const double T, const double *X, double velocity[3]) const
The water velocity at the ball: the BodyFlowInteraction's, without the ball's own wake.
Eigen::Vector3d NodeVelocity(int k, const double T, const double *const X) const
Velocity of node k, numbered as NodePosition.
void PreOdeFcn(double T, const double *X) override
Rebuilds the ball's wake when due and takes the other objects' wakes at the ball.
const double * BallWaterVelocity(const double T, const double *const X)
Output port BallWaterVelocity [m/s], NED.
environment::sphere_hydro::Sphere m_ballShape
ρ, D = 2 R and C_d of the ball's drag.
Definition CablePendulum.h:177
Eigen::Vector3d NodePosition(int k, const double T, const double *const X) const
Position of node k: 0 is end A, 1..n are the cable's states, n+1 is end B.
environment::wake::BodyFlowInteraction m_ballFlow
The wake the ball casts and receives.
Definition CablePendulum.h:179
void takeCableWakes(const double T, const double *X)
Takes the other objects' wakes at the segment midpoints of X for the step (MARE-0223); from PreOdeFcn...
void addDragJacobian(const double T, int segment, const double *pk, const double *pl, const double *vk, double dF_dpk[9], double dF_dpl[9], double dF_dvk[9]) const
Adds the derivatives of Drag(k,l), the force on node k, to the blocks SetCableSegmentStructuralJacobi...
std::optional< environment::wake::ElementFlowInteraction > m_cableFlow
The flow at the segment midpoints, the other objects' wakes taken per step, received as the ball (MAR...
Definition CablePendulum.h:180
CableSegmentStructuralForces StructuralForce(int k, int l, const double T, const double *const X) const
Spring and Damp of the segment k-l with one evaluation of the law.
int m_stateBase
Global index of this object's first state; cached in the constructor.
Definition CablePendulum.h:168
The spring force and the damper force on node k of a segment k-l, each along the segment (towards l w...
Definition CableSegmentStructuralJacobian.h:9