Skip to content
LIBRARY
Spring.md

Spring

Linear spring acting as line force between frame_a and frame_b.

A force f is exerted on the origin of frame_b and with opposite sign on the origin of frame_a along the line from the origin of frame_a to the origin of frame_b according to Hooke's law: f = c * (s - s_unstretched).

Optionally, the mass of the spring is taken into account by a point mass located on the line between frame_a and frame_b.

This component extends from PartialTwoFrames This component extends from Renderable

Usage

MultibodyComponents.Spring(render=true, color=world_default_spring_color(), specular_coefficient=1.5, c=1.0, s_unstretched=0, m=1.0, lengthfraction=0.5, radius=world_default_force_width(), num_windings=6, N=200, end_ratio=0.1)

Parameters:

NameDescriptionUnitsDefault value
fixed_rotation_at_frame_afalse
fixed_rotation_at_frame_bfalse
hasmassfalse
rendertrue
colorworld_defau...ing_color()
specular_coefficient1.5
cspring constantN/m1.0
s_unstretchedunstretched length of springm0
mmasskg1.0
lengthfractionLocation of point mass with respect to frame_a as a fraction of the distance from frame_a to frame_b0.5
radiusRadius of spring coil when renderedworld_defau...rce_width()
num_windingsNumber of spring coil windings6
NNumber of points used to render each winding200
end_ratioFraction of total length used for the tapered ends0.1

Connectors

  • frame_a - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several Frame

connectors that can be connected together (Frame3D)

  • frame_b - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several Frame

connectors that can be connected together (Frame3D)

Variables

NameDescriptionUnits
r_rel_aPosition vector from origin of frame_a to origin of frame_b, resolved in frame_am
e_aUnit vector on the line connecting the origin of frame_a with the origin of frame_b resolved in frame_a (directed from frame_a to frame_b)
fLine force acting on frame_a and on frame_b (positive, if acting on frame_b and directed from frame_a to frame_b)N
lengthDistance between the origin of frame_a and the origin of frame_bm
s(Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small))m
vderivative of sm/s
r_rel_0Position vector from frame_a to frame_b resolved in world framem
e_rel_0Unit vector in direction from frame_a to frame_b, resolved in world frame

Behavior

Source

dyad
"""
Linear spring acting as line force between `frame_a` and `frame_b`.

A force `f` is exerted on the origin of `frame_b` and with opposite sign
on the origin of `frame_a` along the line from the origin of `frame_a` to
the origin of `frame_b` according to Hooke's law: `f = c * (s - s_unstretched)`.

Optionally, the mass of the spring is taken into account by a point mass
located on the line between `frame_a` and `frame_b`.
"""
component Spring
  extends PartialTwoFrames
  extends Renderable(color = world_default_spring_color())
  lineforce = LineForceWithMass(final hasmass = hasmass, final fixed_rotation_at_frame_a = fixed_rotation_at_frame_a, final fixed_rotation_at_frame_b = fixed_rotation_at_frame_b) if !hasmass
  spring1d = TranslationalComponents.Components.Spring(final c = c, final s_rel0 = s_unstretched)
  # Visualization shape
  spring_shape = SpringShape(render = render, color = color, num_windings = num_windings, N = N, end_ratio = end_ratio, r = frame_a.r_0, length_direction = r_rel_0, length = s, width = radius)
  structural parameter fixed_rotation_at_frame_a::Boolean = false
  structural parameter fixed_rotation_at_frame_b::Boolean = false
  structural parameter hasmass::Boolean = false
  "spring constant"
  parameter c::TranslationalSpringConstant = 1.0
  "unstretched length of spring"
  parameter s_unstretched::Length = 0
  "mass"
  parameter m::Mass = 1.0 if hasmass
  "Location of point mass with respect to frame_a as a fraction of the distance from frame_a to frame_b"
  parameter lengthfraction::Real = 0.5 if hasmass
  "Radius of spring coil when rendered"
  parameter radius::Real = world_default_force_width()
  "Number of spring coil windings"
  parameter num_windings::Real = 6
  "Number of points used to render each winding"
  parameter N::Integer = 200
  "Fraction of total length used for the tapered ends"
  parameter end_ratio::Real = 0.1
  "Position vector from origin of frame_a to origin of frame_b, resolved in frame_a"
  variable r_rel_a::Position[3]
  "Unit vector on the line connecting the origin of frame_a with the origin of frame_b resolved in frame_a (directed from frame_a to frame_b)"
  variable e_a::Real[3]
  "Line force acting on frame_a and on frame_b (positive, if acting on frame_b and directed from frame_a to frame_b)"
  variable f::Dyad.Force
  "Distance between the origin of frame_a and the origin of frame_b"
  variable length::Length
  "(Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small))"
  variable s::Length
  "derivative of s"
  variable v::Velocity
  "Position vector from frame_a to frame_b resolved in world frame"
  variable r_rel_0::Position[3]
  "Unit vector in direction from frame_a to frame_b, resolved in world frame"
  variable e_rel_0::Real[3]
relations
  der(s) = v
  r_rel_a = resolve2(frame_a.R, r_rel_0)
  e_a = r_rel_a / s
  f = spring1d.f
  length = lineforce.length
  s = lineforce.s
  r_rel_0 = lineforce.r_rel_0
  e_rel_0 = lineforce.e_rel_0
  connect(lineforce.frame_a, frame_a)
  connect(lineforce.frame_b, frame_b)
  connect(spring1d.flange_b, lineforce.flange_b)
  connect(spring1d.flange_a, lineforce.flange_a)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Spring.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 280,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
Flattened Source
dyad
"""
Linear spring acting as line force between `frame_a` and `frame_b`.

A force `f` is exerted on the origin of `frame_b` and with opposite sign
on the origin of `frame_a` along the line from the origin of `frame_a` to
the origin of `frame_b` according to Hooke's law: `f = c * (s - s_unstretched)`.

Optionally, the mass of the spring is taken into account by a point mass
located on the line between `frame_a` and `frame_b`.
"""
component Spring
  frame_a = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  parameter render::Boolean = true
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  parameter specular_coefficient::Real = 1.5
  lineforce = LineForceWithMass(final hasmass = hasmass, final fixed_rotation_at_frame_a = fixed_rotation_at_frame_a, final fixed_rotation_at_frame_b = fixed_rotation_at_frame_b) if !hasmass
  spring1d = TranslationalComponents.Components.Spring(final c = c, final s_rel0 = s_unstretched)
  # Visualization shape
  spring_shape = SpringShape(render = render, color = color, num_windings = num_windings, N = N, end_ratio = end_ratio, r = frame_a.r_0, length_direction = r_rel_0, length = s, width = radius)
  structural parameter fixed_rotation_at_frame_a::Boolean = false
  structural parameter fixed_rotation_at_frame_b::Boolean = false
  structural parameter hasmass::Boolean = false
  "spring constant"
  parameter c::TranslationalSpringConstant = 1.0
  "unstretched length of spring"
  parameter s_unstretched::Length = 0
  "mass"
  parameter m::Mass = 1.0 if hasmass
  "Location of point mass with respect to frame_a as a fraction of the distance from frame_a to frame_b"
  parameter lengthfraction::Real = 0.5 if hasmass
  "Radius of spring coil when rendered"
  parameter radius::Real = world_default_force_width()
  "Number of spring coil windings"
  parameter num_windings::Real = 6
  "Number of points used to render each winding"
  parameter N::Integer = 200
  "Fraction of total length used for the tapered ends"
  parameter end_ratio::Real = 0.1
  "Position vector from origin of frame_a to origin of frame_b, resolved in frame_a"
  variable r_rel_a::Position[3]
  "Unit vector on the line connecting the origin of frame_a with the origin of frame_b resolved in frame_a (directed from frame_a to frame_b)"
  variable e_a::Real[3]
  "Line force acting on frame_a and on frame_b (positive, if acting on frame_b and directed from frame_a to frame_b)"
  variable f::Dyad.Force
  "Distance between the origin of frame_a and the origin of frame_b"
  variable length::Length
  "(Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small))"
  variable s::Length
  "derivative of s"
  variable v::Velocity
  "Position vector from frame_a to frame_b resolved in world frame"
  variable r_rel_0::Position[3]
  "Unit vector in direction from frame_a to frame_b, resolved in world frame"
  variable e_rel_0::Real[3]
relations
  der(s) = v
  r_rel_a = resolve2(frame_a.R, r_rel_0)
  e_a = r_rel_a / s
  f = spring1d.f
  length = lineforce.length
  s = lineforce.s
  r_rel_0 = lineforce.r_rel_0
  e_rel_0 = lineforce.e_rel_0
  connect(lineforce.frame_a, frame_a)
  connect(lineforce.frame_b, frame_b)
  connect(spring1d.flange_b, lineforce.flange_b)
  connect(spring1d.flange_a, lineforce.flange_a)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Spring.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 280,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses