Marine systems simulation
CNetCageWakeEffect.h
1#pragma once
2
3#include <stdio.h>
4#include <string>
5
6#include <ISimObjectCreator.h>
7#include <SimObject.h>
8#include <Eigen/Eigen>
9#include <net/CNetStructureWakeEffect.h>
10#include <environment/DeepSeaGravityWaves.h>
11
12#ifdef FH_VISUALIZATION
13//#include "CFhVis.h"
14#endif
15
16namespace Netcage {
99{
100public:
112 CNetCageWakeEffect(const string& simObjectName, ISimObjectCreator* const creator);
113
114 virtual void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const pCreator);
116
128 virtual void OdeFcn(const double T, const double* const X, double* const XDot, const bool IsMajorTimeStep);
129
139 const double* outSumHydDynForce(const double T, const double* const X);
149 const double* outNodeSumForce(const double T, const double* const X);
159 const double* outNodeSumDragForceAbs(const double T, const double* const X);
169 const double* outNodeSumDragForceDirection(const double T, const double* const X);
179 const double* outNodeSumLiftForce(const double T, const double* const X);
189 const double* outBottomPosition(const double T, const double* const X);
190 const double* outSteadyStateEst_Tau(const double T, const double* const X);
191 const double* outSteadyStateEst_K(const double T, const double* const X);
192 const double* LowerMembranePosition(const double dT, const double* const adX);
193 const double* outMiddleCurrentVelocity(const double dT, const double* const adX);
194 const double* outNetPosition(const double T, const double* const X, int iNode);
195
206 const virtual double * InternalNodeForce(const double T, const double *const X, int iExtNode);
217 const virtual double * NodeForce(const double T, const double *const X, int iNode);
223 void GetNodePositionIndices( std::vector<int> &NodePositions);
229 void GetNodeVelocityIndices( std::vector<int> &NodeVelocities);
235 vector<CNetElement3NWakeEffect*> getNetElements();
241 void getNetElementConnections(vector<int*> &ElementConnections);
247 void setTraversedElements(vector<bool> TraversedElements);
258 void calculations(const double T, const double* const X);
259#ifdef FH_VISUALIZATION
260
269 void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator); // Overridden to be able to run two NetCageSim simobjects.
278 virtual void RenderUpdate(const double T, const double* const X); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
279
280#endif
281
282protected:
283 void DecomposeDragForcesInCurrentDirection(double* const DragForcesProjected, const double T, const double* const X);
284 bool SteadyStateEstimator(const double T, const double* const X);
285 void AddDeadFishWeightForce(const double T, const double* const X);
286
287 void SetExternalPos(const double dT, const double *const adX); // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
288 void SetExternalVel(const double dT, const double *const adX); // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
289
290 virtual void CreateDataStructures(); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
291 virtual void AddInputPorts(ISimObjectCreator *pCreator); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
292 virtual void CreateOutputPorts(ISimObjectCreator *pCreator); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
293 virtual void CalcStateDerivatives(const double *const adX, double *const adXDot); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
294 virtual double AddNodeBottomForce(const double *const adX, int iNode, double dDiam, double adForceInOut[3]);// NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
295 virtual void AddNetForces(const double dT, const double *const adX); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
296 virtual void AddCableForces(const double dT, const double *const adX); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
297
298 //ISignalPort* m_CurrentVel; // Current velocity input
299 ISignalPort **m_InExternalPos; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
300 ISignalPort **m_InExternalVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
301 ISignalPort *m_MembraneDepth; // Depth of membrane (Perma skirt.)
302
303 double* m_NodeExternalPos; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
304 double* m_NodeExternalVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
305
306 double m_adNodeSumForce[3];
307 double m_adSumHydDynForce[3];
308 double m_dNodeSumDragForceAbs;
309 double m_dNodeSumDragDirection;
310 double m_dNodeSumLiftForce;
311 double m_MiddleCurrentVelocity[3];
312
313 double* m_adNodeHydDynForce;
314
315 double* m_NodeInternalForces; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
316
317 int(* m_hasPosAndVelStates)[2]; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
318
319 int m_NumNodesInputPosAndVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
320 int m_NumNodesOutputForce; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
321
322 VSPairStrInt m_VsNodesInputPosAndVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
323 VSPairStrInt m_VsNodesOutputForce; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
324
325 Eigen::MatrixXd m_SSPhi; // Regression matrix for steady state estimation
326 Eigen::MatrixXd m_SSY; // Output matrix for steady state estimation
327 double m_SS_Tau; // Estimated first order time constant
328 double m_SS_K; // Estimated gain
329 sfh::timers::StopWatch m_SSCalcIntervalWatch; // Stop watch for timing of steady state calculations
330
331 int m_IsMembrane; // True if simobject is (membrane)
332 int m_MembraneIsInSystem; // True if membrane is added
333 double m_LowerMembraneDepth;
334 std::string m_simobjectname; // for debug
335 bool m_TerminateAtSteadyState; // True if automatic termination at predefied steady state level
336
337 double m_PI;
338
339 // VARIABLES FOR SCREEN METHOD
340
341 // Net position output
342 int m_outNetPosNum;
343 int* m_outNetPosIndex;
344
345 // NEW VARIABLES ASSOCIATED WITH WAKE EFFECT
346 std::string m_CageShape;
347 /*
348 double m_TopDiameter;
349 double m_BottomDiameter;
350 double m_WallDepth;
351 double m_ConeDepth;
352 */
353 double* m_CageCentre;
354
355 int m_BottomNodeIndex;
356 double m_DeadFishInertia[3]; // Inertia for dead fish
357 double m_DeadFishWeigthForce;
358 bool m_HasDeadFish;
359 sfh::timers::StopWatch m_RealTimeWatch; // For calculation of elapsedtime in simulation
360 ICommonComputation* m_calcDynamics;
361#ifdef FH_VISUALIZATION
362/*
363 double m_Scale; ///< Scale factor for the visualization.
364 const Ogre::Root* m_OgreRoot;
365 Ogre::SceneNode* m_renderNode;
366*/
367#endif
368};
369
370} // namespace
Definition: CNetStructureWakeEffect.h:204
Definition: CNetCageWakeEffect.h:99
CNetCageWakeEffect(const string &simObjectName, ISimObjectCreator *const creator)
Reads parameters, registers states, input/output ports and shared resources.
void getNetElementConnections(vector< int * > &ElementConnections)
Returns list of all node connections of all net elements.
const double * outNodeSumForce(const double T, const double *const X)
Output port. Returns the sum of forces acting on net structure.
virtual const double * NodeForce(const double T, const double *const X, int iNode)
Output port. Returns the forces acting on the node identified by the index iExtNode.
virtual void OdeFcn(const double T, const double *const X, double *const XDot, const bool IsMajorTimeStep)
Computes object derivatives as a function of time, states and input ports.
void calculations(const double T, const double *const X)
Performs a series of computations within the cable object.
virtual void CalcStateDerivatives(const double *const adX, double *const adXDot)
For screen model. Checking calculated total net force.
const double * outBottomPosition(const double T, const double *const X)
Output port. Returns the position of the bottom node in the net structure.
const double * outSumHydDynForce(const double T, const double *const X)
Output port. Returns the sum of hydrodynamic forces acting on net structure.
void setTraversedElements(vector< bool > TraversedElements)
Returns list that describes which net elements in structure have been traversed by ROV.
void GetNodeVelocityIndices(std::vector< int > &NodeVelocities)
Returns indices for memory locations of the velocities of all nodes in structure.
vector< CNetElement3NWakeEffect * > getNetElements()
Returns list of all net elements in structure.
void GetNodePositionIndices(std::vector< int > &NodePositions)
Returns indices for memory locations of the positions of all nodes in structure.
const double * outNodeSumDragForceDirection(const double T, const double *const X)
Output port. Returns the direction of the summed drag forces acting on net structure.
const double * outNodeSumDragForceAbs(const double T, const double *const X)
Output port. Returns the absolute value of the summed drag forces acting on net structure.
virtual const double * InternalNodeForce(const double T, const double *const X, int iExtNode)
Output port. Returns the internally computed forces acting on the node identified by the index iExtNo...
const double * outNodeSumLiftForce(const double T, const double *const X)
Output port. Returns the sum of lift forces acting on net structure.
Class modelling a Net cage.
Definition: CBottomRing.h:35