FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CableAxialLaw.h
1#pragma once
14
15#include "sfh/math/math.h"
16
17#include <cmath>
18
21constexpr double kMaxCompressionSpeedSaturation = 1.0e2;
24constexpr double kMinLengthSaturation = 1.0e-3;
26constexpr double kMaxLengthSaturation = 1.0e4;
27
28namespace cable_axial_law
29{
31struct Element
32{
34 double stiffness;
36 double meanTension;
37 double dampingCoeff;
38 double maxTension;
39};
40
42struct Tension
43{
44 double strain;
45 double value;
46 double lengthSlope;
47 double speedSlope;
48 bool bounded;
49};
50
54inline Tension AxialTension(const Element& element, double length, double compressionSpeed)
55{
56 const double boundedLength = sfh::math::Bound(length, kMinLengthSaturation, kMaxLengthSaturation);
57 const double clampedSpeed = sfh::math::Bound(compressionSpeed, -kMaxCompressionSpeedSaturation, kMaxCompressionSpeedSaturation);
58 double strain = (boundedLength - element.relaxedLength) / element.relaxedLength;
59 if (!(strain == strain))
60 strain = 0;
61 const double spring = strain * element.stiffnessFactor * element.stiffness + (1 - element.stiffnessFactor) * element.meanTension;
62 const double damping = element.dampingCoeff * clampedSpeed * std::sqrt(element.stiffnessFactor);
63 const double sum = spring + damping;
64
65 Tension tension;
66 tension.strain = strain;
67 tension.value = sfh::math::Bound(sum, 0.0, element.maxTension);
68 tension.bounded = sum <= 0.0 || sum >= element.maxTension;
69 const bool lengthOut = length < kMinLengthSaturation || length > kMaxLengthSaturation;
70 const bool speedOut = std::fabs(compressionSpeed) >= kMaxCompressionSpeedSaturation;
71 tension.lengthSlope = (tension.bounded || lengthOut) ? 0.0 : element.stiffnessFactor * element.stiffness / element.relaxedLength;
72 tension.speedSlope = (tension.bounded || speedOut) ? 0.0 : element.dampingCoeff * std::sqrt(element.stiffnessFactor);
73 return tension;
74}
75
78inline double SpringTension(const Element& element, double strain)
79{
80 return sfh::math::Bound(strain * element.stiffnessFactor * element.stiffness + (1.0 - element.stiffnessFactor) * element.meanTension, 0.0,
81 element.maxTension);
82}
83
92inline void EndBlocks(const Tension& tension, const double direction[3], double length, const double relativeVelocity[3], double dFA_dpB[9],
93 double dFA_dvA[9])
94{
95 const double* e = direction;
96 double s = 0.0;
97 for (int k = 0; k < 3; k++)
98 s += relativeVelocity[k] * e[k];
99 double relVelPerp[3];
100 for (int k = 0; k < 3; k++)
101 relVelPerp[k] = relativeVelocity[k] - e[k] * s;
102
103 for (int k = 0; k < 3; k++) {
104 for (int j = 0; j < 3; j++) {
105 const double dij = (k == j) ? 1.0 : 0.0;
106 dFA_dpB[k * 3 + j] = (dij - e[k] * e[j]) * tension.value / length + e[k] * e[j] * tension.lengthSlope + e[k] * tension.speedSlope * relVelPerp[j] / length;
107 dFA_dvA[k * 3 + j] = tension.speedSlope * e[k] * e[j];
108 }
109 }
110}
111} // namespace cable_axial_law
The axial properties of one element at one evaluation (CableElDynStiff::AxialElement).
Definition CableAxialLaw.h:32
double dampingCoeff
c < 0 [N s/m]; the law applies √eFactor.
Definition CableAxialLaw.h:37
double maxTension
[N].
Definition CableAxialLaw.h:38
double stiffnessFactor
eFactor in (0, 1]: the share of EA that acts at once.
Definition CableAxialLaw.h:35
double meanTension
The mean tension, held through the step, so it has no derivative (MARE-0359) [N].
Definition CableAxialLaw.h:36
double relaxedLength
L0 > 0 [m].
Definition CableAxialLaw.h:33
double stiffness
EA [N].
Definition CableAxialLaw.h:34
The tension at one state and its two slopes.
Definition CableAxialLaw.h:43
double lengthSlope
∂T/∂L = eFactor EA / L0; 0 where T is bounded or L is outside the length bounds [N/m].
Definition CableAxialLaw.h:46
double value
T in [0, maxTension] [N].
Definition CableAxialLaw.h:45
bool bounded
The unbounded sum is <= 0 or >= maxTension.
Definition CableAxialLaw.h:48
double speedSlope
∂T/∂s = c √eFactor; 0 where T is bounded or |s| >= kMaxCompressionSpeedSaturation [N s/m].
Definition CableAxialLaw.h:47
double strain
ε, from the bounded length; 0 if not a number.
Definition CableAxialLaw.h:44