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>
121 CablePendulum(
const std::string& simObjectName, ISimObjectCreator*
const creator);
122 void OdeFcn(
const double T,
const double*
const X,
double*
const XDot)
const;
123 void InitialConditionSetup(
const double T,
const double*
const currentIC,
double*
const updatedIC, ISimObjectCreator*
const creator);
124 void FinalSetup(
const double T,
const double*
const X, ISimObjectCreator*
const creator);
128#ifdef FH_VISUALIZATION
129 void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
130 void RenderUpdate(
const double T,
const double*
const X);
134 void SetOutputPortValues(
const double T,
const double*
const X)
const;
135 const double* MidpointPosition(
const double T,
const double*
const X);
136 const double* BallPosition(
const double T,
const double*
const X);
137 const double* BallVelocity(
const double T,
const double*
const X);
144 bool HasJacobians()
const override;
145 void OdeJacobian(
double T,
const double* X,
double* J,
int nStates)
override;
146 int GetJacobianSparsity(
int nStates,
int* rowPtr,
int* colIdx)
override;
150 void addDragJacobian(
const double T,
int segment,
const double* pk,
const double* pl,
const double* vk,
151 double dF_dpk[9],
double dF_dpl[9],
double dF_dvk[9])
const;
153 Eigen::Vector3d
NodePosition(
int k,
const double T,
const double*
const X)
const;
155 Eigen::Vector3d
NodeVelocity(
int k,
const double T,
const double*
const X)
const;
156 Eigen::Vector3d Drag(
int k,
int l,
const double T,
const double*
const X)
const;
159 Eigen::Vector3d Spring(
int k,
int l,
const double T,
const double*
const X)
const;
160 Eigen::Vector3d Damp(
int k,
int l,
const double T,
const double*
const X)
const;
163 const double* SuspensionForce(
const double T,
const double*
const X);
164 const double* CableOnBallForce(
const double T,
const double*
const X);
167 ICommonComputation* m_SetOutputPortValues;
168 ISignalPort* m_SuspensionPos;
169 ISignalPort* m_SuspensionVel;
171 environment::EnvironmentProvider* Environment;
172 std::vector<int> m_PositionIndex, m_VelocityIndex;
173 int m_BallPositionIndex, m_BallVelocityIndex;
176 mutable double m_MidpointPosition[3];
177 mutable double m_BallPosition[3];
178 mutable double m_BallVelocity[3];
179 mutable double m_SuspensionForce[3];
180 mutable double m_CableOnBallForce[3];
181 double m_BallWaterVelocity[3] = {0.0, 0.0, 0.0};
186 std::optional<environment::wake::ElementFlowInteraction>
m_cableFlow;
189 double m_BallMass, m_BallRadius, m_RhoWater, m_BallRho;
190 double m_ElementMass, m_ElementLength0;
191 double m_SpringCoef, m_DamperCoef, m_GravYancy;
192 double m_Mass, m_Length, m_Diameter, m_RhoCable, m_Modulus;
194#ifdef FH_VISUALIZATION
195 Ogre::ManualObject* m_Line;
196 Ogre::SceneNode* m_RenderNode;
197 std::string m_MaterialName;
198 std::string m_MeshName;
Definition CablePendulum.h:119
std::optional< environment::sphere_hydro::SphereCaster > m_ballCaster
The ball on its states, for the wake.
Definition CablePendulum.h:184
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, C_d (empty: standard curve) and ν of the ball's drag.
Definition CablePendulum.h:183
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.
double m_BallInertia
Ball mass plus its added mass [kg].
Definition CablePendulum.h:188
environment::wake::BodyFlowInteraction m_ballFlow
The wake the ball casts and receives.
Definition CablePendulum.h:185
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:186
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:174
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