Marine systems simulation
SupergridCable.h
1#pragma once
2
3#include "SupergridLineStructure.h"
4#include "CollisionManager.h"
5
6namespace CoRiBoDynamics {
7
8namespace Structures {
9 class DiscreteCylinderElement;
10
11
12 /*
13 Line segment implementation with cylinder elements with hydrodynamical forces
14 */
15 class CableSegment : public LineSegment
16 {
17 friend class DiscreteCylinderElement;
18 public:
19 CableSegment(cable_spec spec, Environment_Interface* environment, double beta, double length, int num_elements, int sub_division);
20 virtual void XmlInfo(TiXmlElement& xml_node);
21
22 virtual std::string GetSegmentTypeName();
23
24 Environment_Interface* GetEnvironment();
25
26 vec6 DiagonalInertia(double length);
27 vec6 AddedMassDiagonalInertia(double length);
28
29 void SetDisplacementArea(double displacement_area);
30
31 double Beta(){return m_beta;}
32
33 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34 protected:
35
36 Environment_Interface* m_environment;
37 //double m_length_3;
38 //double m_diameter_3;
39 double m_beta;
40
41 vec6 m_DiagonalInertia;
42 vec6 m_AddedMassDiagonalInertia;
43 };
44
52{
53public:
54 DiscreteCylinderElement(CableSegment* line_segment, double length);
56
57 virtual void Setup(double T, const double * const X, mat6& InertiaMatrix, vec6& Force);
58
59 virtual void SplitElement(int N);
60
61 void SetDisplacementArea(double displacement_area);
62protected:
63 double m_buoyancy_volume;
64};
65
66
67
68
80public:
81 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
82
83 PointRetractableCable(ConstraintSolver* solver, ISimObjectCreator* creator, Environment_Interface* environment, int rigid_element_buffer_size, double beta, std::string name);
84
85 virtual void SetRetractedLength(double retracted_length, double retraction_speed);
86 double GetRetractedLength(){return m_retracted_length;}
87 double GetRetractionSpeed(){return m_retraction_speed;}
88
89 vec3 GetCableUpperEndPosition();
90 vec3 GetCableLowerEndPosition();
91
96 virtual void AllocateElementBuffer(const double T, double* const X);
97
98 virtual void InitialConditionSetup(const double T, double* const updatedIC, const vec3& PA, const vec3& PB, double initial_retracted_length);
99
100 /*
101 Extends SuperGridLineStructure with endpoint connections at both sides to either a controlled point or element.
102 "Second element straightening" to prepare for element deactivation when winching.
103 "sub-element straightening" to prepare for super element merging when winching.
104 */
105 virtual void ComputeConstraints(const double T, const double * const X);
106
107 void SetEndpointPositionA(const vec3& position, const vec3& velocity, double connection_strength = 1.0);
108 void SetEndpointPositionB(const vec3& position, const vec3& velocity, double connection_strength = 1.0);
109 void SetEndpointElementConnectionA(RigidElement* connection_element, double element_connection_strength = 1.0);
110 void SetEndpointElementConnectionB(RigidElement* connection_element, double element_connection_strength = 1.0);
111 void SetEndpointElementConnectionA(RigidElement* connection_element, const vec3& ConnectionVector, double element_connection_strength = 1.0);
112 void SetEndpointElementConnectionB(RigidElement* connection_element, const vec3& ConnectionVector, double element_connection_strength = 1.0);
113
114#ifdef FH_VISUALIZATION
115 virtual void RenderUpdate(const double T, const double* const X);
116#endif
117
118 vec3 GetEndpointReactionForceA();
119 vec3 GetEndpointA();
120
121 vec3 GetEndpointReactionForceB();
122 vec3 GetEndpointB();
123
124 vec3 GetElementConnectionForceA(){return m_element_connectionA.ReactionForce.segment<3>(0);}
125 vec3 GetElementConnectionForceB(){return m_element_connectionB.ReactionForce.segment<3>(0);}
126
127 DiscreteElement* GetDiscreteElementA();
129
130 virtual void XmlInfo(TiXmlElement& xml_node);
131
132
133 virtual void AddSegment(LineSegment* l);
134
135
136protected:
137 /*
138 For the current retracted length, what is the index of the super and sub element that are in active simulation.
139 Recomputes m_retracted_element_length and m_residual_length
140 */
141 void NumRetractedElements(size_t &super_element_ix, size_t &sub_element_ix);
142
143 double m_retracted_length;
146
147 size_t m_num_retracted_super;
153
156
158 RigidElement* m_connection_elementB;
159 double m_element_connection_strengthA;
160 double m_element_connection_strengthB;
161 vec3 m_connection_vector_elementA;
162 vec3 m_connection_vector_elementB;
163
164 double m_endpoint_connectionA_strength;
165 double m_endpoint_positionA[3];
166 double m_endpoint_velocityA[3];
167 ExternalBallJointCoupling m_endpoint_connectionA;
168 double m_endpoint_connectionB_strength;
169 double m_endpoint_positionB[3];
170 double m_endpoint_velocityB[3];
171 ExternalBallJointCoupling m_endpoint_connectionB;
172
173 RigidCoupling m_element_connectionA;
174 RigidCoupling m_element_connectionB;
175};
176
177
178/*
179 Contact detection between cable elements in a SupergridLineStructure.
180*/
182public:
183 SupergridCableCollisionManager(ConstraintSolver* solver, SupergridLineStructure* cable, double timeConstant);
184
185 /*
186 Contact detection between cable elements. Skips contact between consecutive elements.
187 */
188 virtual void ComputeConstraints(const double T, const double * const X);
189
190protected:
191 SupergridLineStructure* m_cable;
192};
193
194}
195}
Definition: CollisionManager.h:37
Definition: ConstraintSolver.h:31
Definition: SupergridLineStructure.h:15
Definition: RigidElement.h:15
Definition: SupergridCable.h:16
Definition: SupergridLineStructure.h:73
Definition: SupergridLineStructure.h:170
double m_retraction_speed
current set retracted length [m]
Definition: SupergridCable.h:144
virtual void XmlInfo(TiXmlElement &xml_node)
returns the last active discrete element
RigidElement * m_connection_elementA
discrete retracted length
Definition: SupergridCable.h:157
size_t m_minimum_sub_super_treshold
current number of inactive rigid elements in the "free tail"
Definition: SupergridCable.h:151
double m_sub_super_threshold_strength
minimum possible value of the sub-super threshold. no need to apply straightening forces at or below ...
Definition: SupergridCable.h:152
size_t m_num_free_rigid_elements
current index of the last super-element with currently active sub-elements
Definition: SupergridCable.h:150
double m_retracted_element_length
actual retracted length - discrete retracted length
Definition: SupergridCable.h:155
virtual void ComputeConstraints(const double T, const double *const X)
double m_max_retraction_length
current set retraction speed [m/s]
Definition: SupergridCable.h:145
virtual void AllocateElementBuffer(const double T, double *const X)
double m_residual_length
Gamma0 value of the sub-super straightening force.
Definition: SupergridCable.h:154
size_t m_num_retracted_sub
current number of retracted super-elements
Definition: SupergridCable.h:148
DiscreteElement * GetDiscreteElementB()
returns the first active discrete element
size_t m_sub_super_threshold_ix
current number of retracted sub-elements of the first free super-element
Definition: SupergridCable.h:149
void SetEndpointPositionA(const vec3 &position, const vec3 &velocity, double connection_strength=1.0)
Computes structural connections.
virtual void ComputeConstraints(const double T, const double *const X)
Definition: SupergridLineStructure.h:237
Definition: CollisionManager.h:6
Definition: JointConstraint.h:125
Definition: SupergridLineStructure.h:172