# Spring

Linear translational spring with optional mass

# Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

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 the equation:

```   f = c*(s - s_unstretched);
```

where "c" and "s_unstretched" are parameters and "s" is the distance between the origin of frame_a and the origin of frame_b.

Optionally, the mass of the spring is taken into account by a point mass located on the line between frame_a and frame_b (default: middle of the line). If the spring mass is zero, the additional equations to handle the mass are removed.

In the following figure a typical animation of the spring is shown. The blue sphere in the middle of the spring characterizes the location of the point mass.

# Parameters (10)

animation Value: true Type: Boolean Description: = true, if animation shall be enabled Value: true Type: Boolean Description: = true, if point mass shall be visualized as sphere if animation=true and m>0 Value: Type: TranslationalSpringConstant (N/m) Description: Spring constant Value: 0 Type: Length (m) Description: Unstretched spring length Value: 0 Type: Mass (kg) Description: Spring mass located on the connection line between the origin of frame_a and the origin of frame_b Value: 0.5 Type: Real Description: Location of spring mass with respect to frame_a as a fraction of the distance from frame_a to frame_b (=0: at frame_a; =1: at frame_b) Value: 5 Type: Integer Description: Number of spring windings Value: 1e-10 Type: Distance (m) Description: Prevent zero-division if distance between frame_a and frame_b is zero Value: false Type: Boolean Description: =true, if rotation frame_a.R is fixed (to directly connect line forces) Value: false Type: Boolean Description: =true, if rotation frame_b.R is fixed (to directly connect line forces)

# Inputs (6)

width Default Value: world.defaultForceWidth Type: Distance (m) Description: Width of spring Default Value: width / 10 Type: Distance (m) Description: Width of spring coil Default Value: Modelica.Mechanics.MultiBody.Types.Defaults.SpringColor Type: Color Description: Color of spring Default Value: world.defaultSpecularCoefficient Type: SpecularCoefficient Description: Reflection of ambient light (= 0: light is completely absorbed) Default Value: max(0, (width - 2 * coilWidth) * 0.9) Type: Diameter (m) Description: Diameter of mass point sphere Default Value: Modelica.Mechanics.MultiBody.Types.Defaults.BodyColor Type: Color Description: Color of mass point

# Connectors (2)

frame_a Type: Frame_a Description: Coordinate system a fixed to the component with one cut-force and cut-torque Type: Frame_b Description: Coordinate system b fixed to the component with one cut-force and cut-torque

# Components (3)

world Type: World Type: LineForceWithMass Type: Spring

# Used in Examples (13)

 FreeBody Modelica.Mechanics.MultiBody.Examples.Elementary Free flying body attached by two springs to environment InitSpringConstant Modelica.Mechanics.MultiBody.Examples.Elementary Determine spring constant such that system is in steady state at given position PendulumWithSpringDamper Modelica.Mechanics.MultiBody.Examples.Elementary Simple spring/damper/mass system PointGravityWithPointMasses Modelica.Mechanics.MultiBody.Examples.Elementary Two point masses in a point gravity field (rotation of bodies is neglected) SpringDamperSystem Modelica.Mechanics.MultiBody.Examples.Elementary Simple spring/damper/mass system SpringMassSystem Modelica.Mechanics.MultiBody.Examples.Elementary Mass attached with a spring to the world frame SpringWithMass Modelica.Mechanics.MultiBody.Examples.Elementary Point mass hanging on a spring ThreeSprings Modelica.Mechanics.MultiBody.Examples.Elementary 3-dim. springs in series and parallel connection HeatLosses Modelica.Mechanics.MultiBody.Examples.Elementary Demonstrate the modeling of heat losses PrismaticConstraint Modelica.Mechanics.MultiBody.Examples.Constraints Body attached by one spring and two prismatic joints or constrained to environment RevoluteConstraint Modelica.Mechanics.MultiBody.Examples.Constraints Body attached by one spring and revolute joint or constrained to environment SphericalConstraint Modelica.Mechanics.MultiBody.Examples.Constraints Body attached by one spring and spherical joint or constrained to environment UniversalConstraint Modelica.Mechanics.MultiBody.Examples.Constraints Body attached by one spring and universal joint or constrained to environment