1#ifndef _CSHIP_SIM_OBJECT_H_
2#define _CSHIP_SIM_OBJECT_H_
179#include <ISimObjectCreator.h>
180#include <CFhSimMgr.h>
181#include <CPrintDuringExec.h>
188#ifdef FH_VISUALIZATION
190#pragma warning( disable : 4251 )
193 #include <CInputManager.h>
196 #include "sfh/ogre/C3DArrow.h"
197 #include "sfh/ogre/DotSceneLoader.h"
200#include <environment/DeepSeaGravityWaves.h>
202#include <sfh/math/interpolation/SplineInterp.h>
205#include "Ship/Resistance/ShipResistance.h"
206#include "Ship/ViscousShip.h"
207#include "Ship/HullData/HullData.h"
208#include "Ship/HullData/VeresHullData.h"
209#include "Ship/HullData/NapaCGALHullData.h"
210#include "Ship/PotentialData/PotentialData.h"
211#include "Ship/PotentialData/VeresData.h"
218 #ifdef FH_VISUALIZATION
219 class ShipSimObject:
public SimObject,
public ViscousShip,
public OIS::KeyListener
225 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
227 #ifdef FH_VISUALIZATION
238 ShipSimObject(
const string simObjectName, ISimObjectCreator*
const creator);
244 void FinalSetup(
const double T,
const double *
const X, ISimObjectCreator*
const creator );
247 void GetCurrent(
const double T,
const double*
const X,
const double position[3],
double* currentVelocity);
250 virtual void PreOdeFcn(
const double T,
const double *
const X, IStateUpdater* updater);
253 virtual void OdeFcn(
const double T,
const double*
const X,
double*
const XDot,
const bool bIsMajorTimeStep);
255 #ifdef FH_VISUALIZATION
258 virtual void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
261 virtual void RenderUpdate(
const double T,
const double*
const X );
264 bool keyPressed(
const OIS::KeyEvent &e );
267 bool keyReleased(
const OIS::KeyEvent &e );
288 const double* EulerAnglesNED(
const double T,
const double*
const X);
294 const double*
OmegaNED(
const double T,
const double*
const X);
297 void ComputeRollPitchYaw(
const double T,
const double*
const X);
298 void ComputeRelativeVelocity(
const double T,
const double*
const X);
301 const double*
BodyForce(
const double T,
const double*
const X);
330 const double*
Encounter(
const double T,
const double*
const X);
339 const double*
SpeedInfo(
const double T,
const double *
const X);
348 const double *
FluidEnergy(
const double T,
const double*
const X);
349 const double * FluidEnergy2(
const double T,
const double*
const X);
350 const double * UFluidMemSpeed(
const double T,
const double*
const X);
352 const double* FluidForceBySpeedBody(
const double T,
const double*
const X,
int index);
411 const double * ViscousRoll(
const double T,
const double*
const X);
412 double m_ViscousRoll[6];
419 const double * DriftSpeed(
const double T,
const double*
const X);
422 double m_waveElevation;
428 void printShipInfo();
430 CPrintDuringExec* m_logg;
432 Eigen::Vector3d m_forceExtNED;
433 Eigen::Vector3d m_forceExtBody;
435 Eigen::Vector3d m_PositionMidpoint;
436 Eigen::Vector3d m_PositionAP;
437 Eigen::Vector3d m_angles;
439 Eigen::Matrix<double,6,6> m_mrb;
440 Eigen::Matrix<double,6,6> m_invMrb;
448 Eigen::Matrix<double,1,20> Horener_X;
449 Eigen::Matrix<double,1,20> Horener_Y;
450 std::vector<double> hx, hy;
451 sfh::math::SplineInterp *hoerner;
455 ISignalPort *m_InForceNED;
458 ISignalPort *m_InMomentNED;
461 ISignalPort *m_InForceBODY;
464 ISignalPort *m_InMomentBODY;
466 ICommonComputation *m_computeRelativeVelocity;
467 ICommonComputation *m_computeRotationAngles;
471 std::vector<double> m_waveHeight;
472 std::vector<double> m_waveFreq;
473 std::vector<double> m_wavePhase;
474 std::vector<double> m_waveDirection;
475 std::vector<double> m_waveNumber;
477 std::vector<double> m_uHistory;
478 std::vector<double> m_psiHistory;
479 std::vector<double> m_tHistory;
481 double **m_fluidForce;
482 double m_fluidForceExperienced[6];
483 double m_rotationForceFrame[4];
484 double m_speedInformation[5];
489 double m_steadyStateBody[6];
490 double m_steadyStateNED[6];
494 double m_rollPitchYaw[3];
496 double m_relativeSpeed[6];
498 double m_firstOrderForce[6];
499 double m_waveDriftForce[6];
500 double m_CforcesBody[6];
501 double m_CforcesFluid[6];
503 double m_crossFlowBody[6];
504 double m_resistance[6];
506 double m_fluidMemForce[6];
507 double m_restoringForce[6];
508 double m_sumBodyForce[6];
509 double m_encounterFreq[52];
512 double m_hydrostaticSpring[3];
517 bool m_zeroSpeedRadiation;
519 bool m_hydroStaticsType;
523 bool m_waveforceHframe;
535 double m_surgeVelocity;
537 double m_wakeFraction;
539 double m_hydroStaticsStationVerticalStep;
541 double m_hydroStaticsStationHorizontalStep;
543 double m_hydroStaticsStationTop;
545 double m_hydroStaticsStationBottom;
547 double m_bilgeKeelStartPosition;
549 double m_bilgeKeelEndPosition;
551 double m_bilgeKeelHeight;
553 double m_damperLinear[3];
555 double m_damperQuadratic[3];
557 double m_damperRotLinear[3];
559 double m_damperRotQuadratic[3];
561 double m_dampingBlendSpeed;
563 double m_dampingBlendFraction;
566 double m_waveForceTransient;
583 double m_ForceScale[11];
585 std::string m_ForceInput;
587 std::string m_PotentialFileLocation;
589 std::string m_PotentialFileName;
591 std::string m_PotentialType;
593 double m_stablizeDOF[6];
595 bool m_coriolisRollOnly;
596 Eigen::Matrix<double, 6,1> m_coriolisDOFmangler;
598 static inline Eigen::Matrix3d S(
const Eigen::Vector3d &v){
599 Eigen::Matrix3d retval = Eigen::Matrix3d::Zero();
609#ifdef FH_VISUALIZATION
611 bool m_ShowForceArrows;
613 std::string m_Material;
619 RenderType m_RenderAs;
621 std::string m_RenderType;
624 CInputManager* m_InputMgr;
626 OIS::Keyboard* m_Keyboard;
630 int ***m_IFluidState;
631 int ***m_FluidStateSize;
639 #ifdef FH_VISUALIZATION
642 void DrawShip(Ogre::SceneNode* renderNode, Ogre::SceneManager* sceneMgr);
643 void DrawStations( Ogre::SceneNode* m_RenderNode, Ogre::SceneManager * sceneMgr );
645 Ogre::ManualObject *manual ;
646 Ogre::SceneNode* m_RenderNodeHull;
647 Ogre::SceneNode* m_RenderNodeZeroCross;
648 Ogre::SceneNode* m_RenderNodeStations;
649 Ogre::SceneNode** m_RenderNodeSkegPoint;
651 double m_NodeOffset[3];
652 C3DArrow *FKF_u,*FKF_v,*FKF_w;
653 C3DArrow *FKT_u,*FKT_v,*FKT_w;
655 C3DArrow *FMF_u,*FMF_v,*FMF_w;
656 C3DArrow *FMT_u,*FMT_v,*FMT_w;
658 C3DArrow *RSF_u,*RSF_v,*RSF_w;
659 C3DArrow *RST_u,*RST_v,*RST_w;
674 double m_maxWavePeriod;
Definition: DeepSeaGravityWaves.h:172
Definition: HullData.h:14
Definition: PotentialData.h:28
Definition: ShipResistance.h:9
Definition: ShipSimObject.h:223
const double * KineticEnergy(const double T, const double *const X)
const double * SteadyStateControlNED(const double T, const double *const X)
const double * CoriolisRigidBody(const double T, const double *const X)
const double * FluidEnergy(const double T, const double *const X)
const double * ExternalForceBody(const double T, const double *const X)
const double * CrossFlowBody(const double T, const double *const X)
const double * AdditionalDampeningBody(const double T, const double *const X)
const double * ViscousForceBody(const double T, const double *const X)
const double * PositionAPNED(const double T, const double *const X)
const double * SpeedInfo(const double T, const double *const X)
const double * Encounter(const double T, const double *const X)
const double * ExternalForceNED(const double T, const double *const X)
const double * SteadyStateControlBODY(const double T, const double *const X)
const double * RelativeVelocityBody(const double T, const double *const X)
const double * RotationForceFrame(const double T, const double *const X)
const double * RotationBody(const double T, const double *const X)
const double * FluidMemoryForceBody(const double T, const double *const X)
const double * QuaternionNED(const double T, const double *const X)
const double * PositionZeroCrossNED(const double T, const double *const X)
const double * ResistanceBody(const double T, const double *const X)
The calm water resistance of the hull in the surge direction The resistance force is the defined as t...
const double * WaveDriftBody(const double T, const double *const X)
The mean value of the higher order wave forces as experienced in the body frame of the vessel....
const double *const FluidMemForceBody(const double T, const double *const X)
const double * BodyForce(const double T, const double *const X)
const double * FirstOrderWaveBody(const double T, const double *const X)
The first order wave force, or froude-krylov force, as experienced in the body frame of the vessel Th...
const double * OmegaNED(const double T, const double *const X)
const double * CoriolisFluidBody(const double T, const double *const X)
const double * PositionNED(const double T, const double *const X)
const double * VelocityBody(const double T, const double *const X)
const double * RestoringForceBody(const double T, const double *const X)
const double * VelocityNED(const double T, const double *const X)
Definition: ViscousShip.h:12
Simple waypoint object.
Definition: CableAttach.h:16