Skip to content

Commit beac21c

Browse files
committed
Improve ElastoGap
Closes #4197 Prefer code to pre, and move things. Add scaling ratio variable and add parameter description Simplify computation of f_d Documentation: add non-braking spaces where needed Add scaling ratio variable and add parameter description Simplify computation of f_d Documentation: add non-braking spaces where needed Improve documentation concerning s_rel and f_rel Enable only positive values of s_rel and f_rel
1 parent 349a1fb commit beac21c

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

Modelica/Mechanics/Translational/Components/ElastoGap.mo

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ model ElastoGap "1D translational spring damper combination with gap"
66
parameter SI.TranslationalDampingConstant d(final min=0, start=1)
77
"Damping constant";
88
parameter SI.Position s_rel0=0 "Unstretched spring length";
9+
parameter SI.Force f_ref(min=0) = c*s_ref "Reference spring force at s_ref" annotation(Dialog(tab="Advanced"));
10+
parameter SI.Length s_ref(min=Modelica.Constants.eps) = 1 "Reference relative compression at which f_c = f_ref" annotation(Dialog(tab="Advanced"));
911
parameter Real n(final min=1) = 1
10-
"Exponent of spring force ( f_c = -c*|s_rel-s_rel0|^n )";
12+
"Exponent of spring force ( f_c = -f_ref*|(s_rel-s_rel0)/s_ref|^n )";
1113
extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT;
1214

1315
/*
@@ -22,14 +24,15 @@ protected
2224
SI.Force f_d2 "Linear damping force";
2325
SI.Force f_d
2426
"Linear damping force which is limited by spring force (|f_d| <= |f_c|)";
27+
Real ratio "Scaling ratio of relative compression to s_ref";
2528
equation
2629
// Modify contact force, so that it is only "pushing" and not
2730
// "pulling/sticking" and that it is continuous
2831
contact = s_rel < s_rel0;
29-
f_c = smooth(1, noEvent(if contact then -c*abs(s_rel - s_rel0)^n else 0));
32+
ratio = (s_rel - s_rel0)/s_ref;
33+
f_c = smooth(1, noEvent(if contact then -f_ref*abs(ratio)^n else 0));
3034
f_d2 = if contact then d*v_rel else 0;
31-
f_d = smooth(0, noEvent(if contact then (if f_d2 < f_c then f_c else if
32-
f_d2 > -f_c then -f_c else f_d2) else 0));
35+
f_d = smooth(0, noEvent(if contact then min(max(f_d2, f_c), -f_c) else 0));
3336
f = f_c + f_d;
3437
lossPower = f_d*v_rel;
3538
annotation (
@@ -49,7 +52,7 @@ a nonlinear spring force can be modeled:
4952
</p>
5053
5154
<blockquote><pre>
52-
desiredContactForce = c*|s_rel - s_rel0|^n + d*<strong>der</strong>(s_rel)
55+
desiredContactForce = f_ref*|(s_rel - s_rel0)/s_ref|^n + d*<strong>der</strong>(s_rel)
5356
</pre></blockquote>
5457
5558
<p>
@@ -112,8 +115,23 @@ If s_rel0 = 0, the equations are:
112115
</pre></blockquote>
113116
114117
<p>
115-
Note, since |f_d| &le; |f_c|, pulling forces cannot occur and the contact force
116-
is always continuous, especially around the start of the penetration at s_rel = s_rel0.
118+
Note, since |f_d|&nbsp;&le;&nbsp;|f_c|, pulling forces cannot occur and the contact force
119+
is always continuous, especially around the start of the penetration at s_rel&nbsp;= s_rel0.
120+
On the contrary, this leads to the contact force <code>f&nbsp;=&nbsp;0</code> even if
121+
<code>contact&nbsp;= true</code> is still indicated around the end of the penetration.
122+
This is because <code>contact</code> indicates only the occurance of geometry penetration.
123+
</p>
124+
125+
<p>
126+
In order to have consistent units for nonlinear springs, the term <code>c*|s_rel|^n</code>
127+
is replaced by <code>f_ref*|s_rel/s_ref|^n</code>, whereby <code>s_ref</code> is a&nbsp;reference
128+
length for the spring and <code>f_ref</code> is the spring force when
129+
<code>s_rel&nbsp;=&nbsp;s_ref</code>. The default values <code>s_ref&nbsp;=&nbsp;1</code>
130+
and <code>f_ref&nbsp;= c*s_ref</code> lead to the same results of the two above-mentioned terms.
131+
Setting the advanced parameters <code>s_ref</code> and <code>f_ref</code> for a&nbsp;nonlinear
132+
spring directly gives a&nbsp;cleaner and straightforward parametrization.
133+
For simplicity reasons, both <code>s_ref</code> and <code>f_ref</code> are considered being
134+
positive.
117135
</p>
118136
119137
<p>

0 commit comments

Comments
 (0)