# Body Spring & Damper

Damped linear oscillator force between two bodies

## Library

First Generation/Force Elements

## Description

### Warning

This content is specific to Simscape™ Multibody™ First Generation software. First-generation features are slated to be deprecated and should be avoided.

The Body Spring & Damper block models the force of a damped spring acting between two bodies. By Newton's third law, the spring applies equal and opposite forces to the two bodies. You can use this Force Element block to model any linear (Hooke's law) force with constant coefficients that acts between a pair of bodies.

You connect a Body Spring & Damper between two Body coordinate systems (CSs), each on one body. The vector between the Body CSs defines the direction and length of the spring. One of the Bodies can be a Ground.

### Caution

The spring and the damper forces act only along the axis connecting the two Body CSs.

The Body Spring & Damper has no degrees of freedom (DoFs).

### Grounding the Connected Submachines

The Body Spring & Damper block contains a Shared Environment block. The submachines connected to either side of this block constitute a single composite machine that requires exactly one Machine Environment block, but at least one Ground for each submachine.

### Referencing Coordinate Systems on the Connected Bodies

The Body Spring & Damper block is not a Joint and cannot propagate adjoining coordinate systems from a Body on one side to a Body on the other side.

One Body is connected to one side of the Body Spring & Damper at one of that Body's CSs. If you attempt to define that CS in terms of the adjoining CS (the connected CS of the other Body connected to the other side), the first Body cannot detect the connected CS of the second body. If you need to define adjoining CSs on either side of a Body Spring & Damper, add a Joint block in parallel with the spring-damper.

### Adding Joints in Parallel to the Body Spring & Damper

To represent the DoFs of one body with respect to the other, either

• Connect one or more Joints in series with the Bodies.

• Create additional Body CSs on each body and connect them with a Joint in parallel with the Body Spring & Damper. To create parallel grounds, insert additional Ground blocks.

You can add more Joint blocks between the Bodies to represent one, two, or three prismatic primitives. Use Prismatic blocks or a Custom Joint block to accomplish this.

### Body Spring and Damper Force Law

You connect this block to each Body, A or B, at a Body coordinate system (CS). If rA and rB are the positions of these Body CSs, the relative position vector connecting them is r = rB - rA. The distance of separation is |r|. The relative velocity is v = dr/dt. Then the vector force that body A exerts on body B is

`$F=-k\left(|r|-{r}_{0}\right)\left(r/|r|\right)-b\left(v\cdot r\right)\left(r/|r{|}^{2}\right)$`

The first term represents the spring or linear displacement force. The second represents the damper or velocity dissipation force, which acts only along the direction of r. Thus the damper is equivalent to a dashpot, not a viscous medium.

You specify

• The spring constant k. A stable spring requires k > 0.

• The natural spring length (offset) r0. The natural length is the length of the spring with no forces acting on it and physically must be nonnegative: r0 ≥ 0.

• The damping constant b. A damping representing dissipation and respecting the second law of thermodynamics requires b ≥ 0. You can use a negative b to represent energy pumping.

### Caution

In certain cases, the force formula breaks down, and the block uses special-case rules to determine the spring-damper force.

To avoid singularities in the initial state of motion, be sure to set the bodies' initial conditions of position and velocity to physically sensible values.

Singular cases include the following:

• If both r0 and v ≠ 0, and r = 0 at some instant, both terms in the force become singular. The spring force is reprojected along the velocity vector. That is, v/|v| replaces r/|r| in both terms of the force law, once in the first term and twice in the second. If the state r = 0 does not persist for more than an instant, this replacement has no effect on the motion.

• If r0 ≠ 0, and both r and v = 0 at some instant, the force direction is undefined. The simulation stops with an error.

## Dialog Box and Parameters

The dialog has two active areas, Parameters and Units.

## Parameters

Spring constant (k)

Enter the linear spring force constant k. The default is `0`.

The units for k are derived implicitly from your choice of position and force units.

Damper constant (b)

Enter the linear damping force constant b. The default is `0`.

The units for b are derived implicitly from your choice of velocity and force units.

Spring natural length (r0)

Enter the spring's natural length (offset) r0. The default is `0`.

## Units

Position

In the pull-down menu, choose units for the relative position vector r. The default is `m` (meters).

Velocity

In the pull-down menu, choose units for the relative velocity vector v. The default is `m/s` (meters/second).

Force

In the pull-down menu, choose units for the spring-damper force F acting between the bodies. The default is `N` (newtons).

## Example

This is a simple but representative use of the Body Spring & Damper.