Skip to content
LIBRARY
Components.ElastoGap.md

Components.ElastoGap

1D translational spring damper combination with gap.

This component models a spring damper combination that can lift off. It can be connected between a sliding mass and the housing (model Fixed), to describe the contact of a sliding mass with the housing.

As long as s_rel > s_rel0, no force is exerted (s_rel = flange_b.s - flange_a.s). If s_rel ≤ s_rel0, the contact force is basically computed with a linear spring/damper characteristic. With parameter n ≥ 1 (exponent of spring force), a nonlinear spring force can be modeled:

desiredContactForce=fref|srelsrel0sref|n+ds˙rel

Hertzian contact is described by:

  • Contact between two metallic spheres: n = 1.5

  • Contact between two metallic plates: n = 1

The damping force is bounded by the spring force (|f_d| ≤ |f_c|) to prevent unphysical pulling/sticking forces and ensure continuity at the contact transition.

Dissipated power is exported through the heat_port connector. Connect it to a thermal network (e.g., FixedTemperature) to close the energy balance.

This component extends from TranslationalComponents.Interfaces.PartialCompliantWithRelativeStates

Usage

TranslationalComponents.Components.ElastoGap(c, d, s_rel0=0, s_ref=1, f_ref=c * s_ref, n=1)

Parameters:

NameDescriptionUnitsDefault value
cSpring constantN/m
dDamping constantN.s/m
s_rel0Unstretched spring lengthm0
s_refReference relative compression at which f_c = f_refm1
f_refReference spring force at s_refNc * s_ref
nExponent of spring force (f_c = -f_ref *ratio^n)

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)

  • heat_port - This connector represents a thermal port with temperature and heat flow as the potential and flow variables, respectively. (HeatPort)

Variables

NameDescriptionUnits
s_relRelative displacement between flange_b and flange_a (flange_b.s - flange_a.s).m
v_relRelative velocity between flange_b and flange_a, defined as der(s_rel).m/s
fInternal force exerted by the compliant element between the flanges.N
f_cSpring forceN
f_d2Linear damping forceN
f_dDamping force limited by spring force (f_d
ratioScaling ratio of relative compression to s_ref
lossPowerLoss power leaving component via heat_port (> 0 if heat is flowing out)W

Behavior

julia
using TranslationalComponents #hide
using ModelingToolkit #hide
@variables c #hide
@variables d #hide
@variables s_rel0 #hide
@variables s_ref #hide
@variables f_ref #hide
@variables n #hide
@named sys = TranslationalComponents.Components.ElastoGap(c=c, d=d, s_rel0=s_rel0, s_ref=s_ref, f_ref=f_ref, n=n) #hide
full_equations(sys) #hide
<< @example-block not executed in draft mode >>

Source

dyad
"""
1D translational spring damper combination with gap.

This component models a spring damper combination that can lift off.
It can be connected between a sliding mass and the housing (model Fixed),
to describe the contact of a sliding mass with the housing.

As long as `s_rel > s_rel0`, no force is exerted (`s_rel = flange_b.s - flange_a.s`).
If `s_rel ≤ s_rel0`, the contact force is basically computed with a linear
spring/damper characteristic. With parameter `n ≥ 1` (exponent of spring force),
a nonlinear spring force can be modeled:

```math
desiredContactForce = f_{ref} \cdot \left|\frac{s_{rel} - s_{rel0}}{s_{ref}}\right|^n + d \cdot \dot{s}_{rel}
```

Hertzian contact is described by:
- Contact between two metallic spheres: `n = 1.5`
- Contact between two metallic plates: `n = 1`

The damping force is bounded by the spring force (`|f_d| ≤ |f_c|`) to prevent
unphysical pulling/sticking forces and ensure continuity at the contact transition.

Dissipated power is exported through the `heat_port` connector. Connect it to a
thermal network (e.g., `FixedTemperature`) to close the energy balance.
"""
component ElastoGap
  extends TranslationalComponents.Interfaces.PartialCompliantWithRelativeStates
  "Thermal port for dissipated losses"
  heat_port = HeatPort() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 950, "x2": 50, "y2": 1050}}}}
  "Spring constant"
  parameter c::TranslationalSpringConstant(min = 0)
  "Damping constant"
  parameter d::TranslationalDampingConstant(min = 0)
  "Unstretched spring length"
  parameter s_rel0::Dyad.Position = 0
  "Reference relative compression at which f_c = f_ref"
  parameter s_ref::Length(min = eps(Float64)) = 1
  "Reference spring force at s_ref"
  parameter f_ref::Dyad.Force(min = 0) = c * s_ref
  "Exponent of spring force (f_c = -f_ref * |ratio|^n)"
  parameter n::Real(min = 1) = 1
  "Spring force"
  variable f_c::Dyad.Force
  "Linear damping force"
  variable f_d2::Dyad.Force
  "Damping force limited by spring force (|f_d| <= |f_c|)"
  variable f_d::Dyad.Force
  "Scaling ratio of relative compression to s_ref"
  variable ratio::Real
  "Loss power leaving component via heat_port (> 0 if heat is flowing out)"
  variable lossPower::Power
relations
  # Contact force: pushing only, continuous at transition
  ratio = (s_rel - s_rel0) / s_ref
  f_c = ifelse(s_rel < s_rel0, -f_ref * abs(ratio) ^ n, 0)
  f_d2 = ifelse(s_rel < s_rel0, d * v_rel, 0)
  f_d = ifelse(s_rel < s_rel0, min(max(f_d2, f_c), -f_c), 0)
  f = f_c + f_d
  lossPower = f_d * v_rel
  heat_port.Q_flow = -lossPower
metadata {"Dyad": {"icons": {"default": "dyad://TranslationalComponents/ElastoGap.svg"}}}
end
Flattened Source
dyad
"""
1D translational spring damper combination with gap.

This component models a spring damper combination that can lift off.
It can be connected between a sliding mass and the housing (model Fixed),
to describe the contact of a sliding mass with the housing.

As long as `s_rel > s_rel0`, no force is exerted (`s_rel = flange_b.s - flange_a.s`).
If `s_rel ≤ s_rel0`, the contact force is basically computed with a linear
spring/damper characteristic. With parameter `n ≥ 1` (exponent of spring force),
a nonlinear spring force can be modeled:

```math
desiredContactForce = f_{ref} \cdot \left|\frac{s_{rel} - s_{rel0}}{s_{ref}}\right|^n + d \cdot \dot{s}_{rel}
```

Hertzian contact is described by:
- Contact between two metallic spheres: `n = 1.5`
- Contact between two metallic plates: `n = 1`

The damping force is bounded by the spring force (`|f_d| ≤ |f_c|`) to prevent
unphysical pulling/sticking forces and ensure continuity at the contact transition.

Dissipated power is exported through the `heat_port` connector. Connect it to a
thermal network (e.g., `FixedTemperature`) to close the energy balance.
"""
component ElastoGap
  "Left mechanical translational flange (connector)"
  flange_a = Flange() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}
  "Right mechanical translational flange (connector)"
  flange_b = Flange() {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
  "Relative displacement between flange_b and flange_a (flange_b.s - flange_a.s)."
  variable s_rel::Distance(statePriority = 50)
  "Relative velocity between flange_b and flange_a, defined as der(s_rel)."
  variable v_rel::Velocity(statePriority = 50)
  "Internal force exerted by the compliant element between the flanges."
  variable f::Dyad.Force
  "Thermal port for dissipated losses"
  heat_port = HeatPort() {"Dyad": {"placement": {"icon": {"x1": -50, "y1": 950, "x2": 50, "y2": 1050}}}}
  "Spring constant"
  parameter c::TranslationalSpringConstant(min = 0)
  "Damping constant"
  parameter d::TranslationalDampingConstant(min = 0)
  "Unstretched spring length"
  parameter s_rel0::Dyad.Position = 0
  "Reference relative compression at which f_c = f_ref"
  parameter s_ref::Length(min = eps(Float64)) = 1
  "Reference spring force at s_ref"
  parameter f_ref::Dyad.Force(min = 0) = c * s_ref
  "Exponent of spring force (f_c = -f_ref * |ratio|^n)"
  parameter n::Real(min = 1) = 1
  "Spring force"
  variable f_c::Dyad.Force
  "Linear damping force"
  variable f_d2::Dyad.Force
  "Damping force limited by spring force (|f_d| <= |f_c|)"
  variable f_d::Dyad.Force
  "Scaling ratio of relative compression to s_ref"
  variable ratio::Real
  "Loss power leaving component via heat_port (> 0 if heat is flowing out)"
  variable lossPower::Power
relations
  s_rel = flange_b.s - flange_a.s
  v_rel = der(s_rel)
  flange_b.f = f
  flange_a.f = -f
  # Contact force: pushing only, continuous at transition
  ratio = (s_rel - s_rel0) / s_ref
  f_c = ifelse(s_rel < s_rel0, -f_ref * abs(ratio) ^ n, 0)
  f_d2 = ifelse(s_rel < s_rel0, d * v_rel, 0)
  f_d = ifelse(s_rel < s_rel0, min(max(f_d2, f_c), -f_c), 0)
  f = f_c + f_d
  lossPower = f_d * v_rel
  heat_port.Q_flow = -lossPower
metadata {"Dyad": {"icons": {"default": "dyad://TranslationalComponents/ElastoGap.svg"}}}
end


Test Cases

No test cases defined.