SpringSpring Icon

Spring

Linear 1D translational spring relating force to displacement via Hooke's Law.

This component represents a one-dimensional translational mechanical spring. It models the linear relationship between the force ($f$) exerted by the spring and its deformation ($s_{rel}$) relative to an unstretched length ($s_{rel0}$). The governing equation is Hooke's Law:

\[f = c \cdot (s_{rel} - s_{rel0})\]

Here, c is the spring constant (stiffness), $s_{rel}$ is the current relative displacement between the spring's two connection flanges (typically inherited from PartialCompliant), and $s_{rel0}$ is the relative displacement at which the spring exerts no force.

This component extends from PartialCompliant

Usage

TranslationalComponents.Spring(c, s_rel0=0)

Parameters:

NameDescriptionUnitsDefault value
cSpring constant, representing the stiffness of the spring.N/m
s_rel0Unstretched relative displacement of the spring, where the spring force is zero.m0

Connectors

  • flange_a - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. (Flange)
  • flange_b - This connector represents a mechanical flange with position and force as the potential and flow variables, respectively. (Flange)

Variables

NameDescriptionUnits
s_relRelative distance between flange_b and flange_am
fInternal force exerted by the compliant connection on flangeb (and -f on flangea).N

Behavior

\[ \begin{align} \mathtt{s\_rel}\left( t \right) &= \mathtt{flange\_b.s}\left( t \right) - \mathtt{flange\_a.s}\left( t \right) \\ \mathtt{flange\_b.f}\left( t \right) &= f\left( t \right) \\ \mathtt{flange\_a.f}\left( t \right) &= - f\left( t \right) \\ f\left( t \right) &= c \left( - \mathtt{s\_rel0} + \mathtt{s\_rel}\left( t \right) \right) \end{align} \]

Source

"""
Linear 1D translational spring relating force to displacement via Hooke's Law.

This component represents a one-dimensional translational mechanical spring.
It models the linear relationship between the force ($f$) exerted by the
spring and its deformation ($s_{rel}$) relative to an unstretched length ($s_{rel0}$).
The governing equation is Hooke's Law:

math f = c \cdot (s{rel} - s{rel0})

Here, `c` is the spring constant (stiffness), $s_{rel}$ is the current
relative displacement between the spring's two connection flanges (typically
inherited from `PartialCompliant`), and $s_{rel0}$ is the relative displacement
at which the spring exerts no force.
"""</span>
<span class="hljs-keyword">component</span> Spring
&nbsp;&nbsp;<span class="hljs-keyword">extends</span> <span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/TranslationalComponents/types/PartialCompliant.html">PartialCompliant</a></span>
&nbsp;&nbsp;<span class="hljs-comment">"Spring constant, representing the stiffness of the spring."</span>
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">c</span>::<span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/types/TranslationalSpringConstant.html">TranslationalSpringConstant</a></span>
&nbsp;&nbsp;<span class="hljs-comment">"Unstretched relative displacement of the spring, where the spring force is zero."</span>
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">s_rel0</span>::<span class="hljs-link"><a href="https://help.juliahub.com/dyad/dev/stdlib/Dyad/types/Distance.html">Distance</a></span> = 0
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;f = c * (s_rel - s_rel0)
<span class="hljs-keyword">metadata</span> {"Dyad": {"icons": {"default": "dyad://TranslationalComponents/Spring.svg"}}}
<span class="hljs-keyword">end</span></code></pre>
Flattened Source
"""
Linear 1D translational spring relating force to displacement via Hooke's Law.

This component represents a one-dimensional translational mechanical spring.
It models the linear relationship between the force ($f$) exerted by the
spring and its deformation ($s_{rel}$) relative to an unstretched length ($s_{rel0}$).
The governing equation is Hooke's Law:

math f = c \cdot (s{rel} - s{rel0})

Here, `c` is the spring constant (stiffness), $s_{rel}$ is the current
relative displacement between the spring's two connection flanges (typically
inherited from `PartialCompliant`), and $s_{rel0}$ is the relative displacement
at which the spring exerts no force.
"""</span>
<span class="hljs-keyword">component</span> Spring
&nbsp;&nbsp;<span class="hljs-comment">"Port representing the first translational 1D shaft flange."</span>
&nbsp;&nbsp;<span class="hljs-symbol">flange_a</span> = <span>Flange</span>() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
&nbsp;&nbsp;<span class="hljs-comment">"Port representing the second translational 1D shaft flange."</span>
&nbsp;&nbsp;<span class="hljs-symbol">flange_b</span> = <span>Flange</span>() {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
&nbsp;&nbsp;<span class="hljs-comment">"Relative distance between `flange_b` and `flange_a`"</span>
&nbsp;&nbsp;<span class="hljs-keyword">variable</span> <span class="hljs-symbol">s_rel</span>::<span>Distance</span>
&nbsp;&nbsp;<span class="hljs-comment">"Internal force exerted by the compliant connection on flange_b (and -f on flange_a)."</span>
&nbsp;&nbsp;<span class="hljs-keyword">variable</span> <span class="hljs-symbol">f</span>::<span>Dyad.Force</span>
&nbsp;&nbsp;<span class="hljs-comment">"Spring constant, representing the stiffness of the spring."</span>
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">c</span>::<span>TranslationalSpringConstant</span>
&nbsp;&nbsp;<span class="hljs-comment">"Unstretched relative displacement of the spring, where the spring force is zero."</span>
&nbsp;&nbsp;<span class="hljs-keyword">parameter</span> <span class="hljs-symbol">s_rel0</span>::<span>Distance</span> = 0
<span class="hljs-keyword">relations</span>
&nbsp;&nbsp;s_rel = flange_b.s - flange_a.s
&nbsp;&nbsp;flange_b.f = f
&nbsp;&nbsp;flange_a.f = -f
&nbsp;&nbsp;f = c * (s_rel - s_rel0)
<span class="hljs-keyword">metadata</span> {"Dyad": {"icons": {"default": "dyad://TranslationalComponents/Spring.svg"}}}
<span class="hljs-keyword">end</span></code></pre>


Test Cases

No test cases defined.