Skip to content

Forces

Every force acts on body1; forces between two bodies act on body2 (default: the ground) with the opposite sign. Points and frames are given globally at t = 0.

Spring-damper

Along the line between point1 on body1 and point2 on body2: s = k (l − l0) + d l̇ + f0, tension positive.

forces:
  suspension:
    type: spring_damper
    body1: wheel
    body2: body
    point1: [0, 0, 0.3]
    point2: [0, 0, 0.65]
    stiffness: 25000      # k [N/m]
    damping: 1800         # d [N s/m]
    length: 0.35          # l0; default: the initial distance (no force at t = 0)
    preload: -3924        # f0 [N]; negative: compression

Channels: suspension.length, .velocity, .force.

Torsion spring

About the z axis of a frame (orientation) fixed on body2 or the ground: τ = −k (φ − φ0) − d φ̇ + τ0 on body1.

  coil:
    type: torsion_spring
    body1: disk
    orientation: [1, 0, 0, 0]     # axis z
    stiffness: 50                 # [N m/rad]
    damping: 0.2
    angle: 0                      # phi0

Channels: .angle, .rate, .torque.

Bushing

Six springs and dampers between body1 and body2 in a frame (location, orientation): three translations and three rotations, each with its own stiffness and damping (a number for all three axes, or a list of three).

  mount:
    type: bushing
    body1: engine
    body2: chassis
    location: [0.2, 0, 0.4]
    stiffness: [2.0e5, 2.0e5, 5.0e5]     # [N/m] along the frame axes
    damping: 300
    rot_stiffness: [3000, 3000, 1000]    # [N m/rad]
    rot_damping: 5

Channels: .displacement_x/y/z, .rotation_x/y/z, .force_x/y/z, .torque_x/y/z (in the bushing frame on body2).

Constant force and torque

  push: {type: force, body1: block, point: [0, 0, 0.1], vector: [10, 0, 0], frame: global}
  twist: {type: torque, body1: block, vector: [0, 0, 2], frame: body}   # turns with the body

Channels: .force_x/y/z or .torque_x/y/z, global.

Expression force and torque

A magnitude from a law you write – an expression of time, the parameters, measures and splines – along a direction (or about an axis) on body1, and opposite on body2. These are compiled into a model plugin (a C compiler is needed); the derivatives are exact.

measures:
  z: {type: displacement, body1: mass, component: z, offset: initial}
  vz: {type: velocity, body1: mass, component: z}
forces:
  actuator:
    type: expression_force
    body1: mass
    direction: [0, 0, 1]            # or line_of_sight (point1 to point2, the default)
    force: -k * z - d * vz + F0 * sin(w * t)
  motor:
    type: expression_torque
    body1: rotor
    body2: stator
    axis: [0, 0, 1]
    frame: body                     # the axis turns with body1
    torque: T_max * step(t, 0, 0, 0.5, 1) - c * w_rel

Channels: .value (the law), .force_x/y/z or .torque_x/y/z.

Direction: fixed in space or in body1

the direction e
no direction (line_of_sight) from point1 on body1 to point2 on body2 (or the ground), at every instant
direction: [x, y, z] given globally at t = 0, fixed in space (the default, frame: global)
direction: [x, y, z], frame: body given globally at t = 0, then fixed in body1: it turns with body1

A direction is never carried by body2. The same holds for the axis of an expression_torque and for the vector of a constant force or torque (with frame: body its components are taken in the body1 frame).

The force acts as +value · e on body1 at point1 and −value · e on body2 at point2. With a fixed direction and points that do not lie on one line along e, the pair of forces also makes a moment: action and reaction are equal and opposite, but not collinear.

Tire

See Tires and roads.

All keys

key value
id id
type (required) spring_damper | force | torque | torsion_spring | bushing | expression_force | expression_torque | tire spring_damper: line of sight between point1 (body1) and point2 (body2 or ground), s = k (l - l0) + d ldot + f0, tension > 0. force / torque: constant vector on body1. torsion_spring: about the z axis of the frame (orientation) fixed on body2 or the ground, tau = -k (phi - phi0) - d phidot + tau0 on body1. expression_force / expression_torque: magnitude from an expression of t, parameters and measures (compiled into the model plugin), along direction / axis on body1 and opposite on body2.
body1 (required) string A body.
body2 string spring_damper, torsion_spring: a body or 'ground'. Default ground.
point1 [x, y, z] or a point name spring_damper: point on body1, global, at t = 0. Default its center of mass.
point2 [x, y, z] or a point name spring_damper: point on body2 / the ground, global, at t = 0. Default its center of mass (the origin for the ground).
point [x, y, z] or a point name force: point of application, global, at t = 0. Default the center of mass.
vector [x, y, z] force / torque: force [N] or torque [N m].
frame global | body force / torque: components of vector in the global frame (fixed direction) or in the body1 frame (turns with the body). Default global.
orientation list of 4 or a frame name torsion_spring (axis z) / bushing: frame as Euler parameters, global, at t = 0. Default [1,0,0,0].
stiffness number or list k [N/m] or [N m/rad]; bushing: translational stiffness along the frame axes (number or 3).
damping number or list d [N s/m] or [N m s/rad]; bushing: per frame axis. Default 0.
rot_stiffness number or list bushing: rotational stiffness about the frame axes [N m/rad].
rot_damping number or list bushing: rotational damping [N m s/rad]. Default 0.
location [x, y, z] or a point name bushing: frame origin, global, at t = 0. Default the center of mass of body1.
radius number tire: unloaded radius r0 [m]. Default 0.3.
tire object tire: parameters overriding the defaults: fdgen.tire.TIRE_KEYS (kz, cz, Magic Formula coefficients, ...).
length number spring_damper: free length l0. Default the initial distance.
angle number torsion_spring: phi0 [rad]. Default 0 (the initial configuration).
preload number f0 [N] or tau0 [N m]. Default 0.
force string expression_force: force law, e.g. '-c * y - d * vy + 10 * sin(t)'.
torque string expression_torque: torque law.
direction see text expression_force: 'line_of_sight' (default, from point1 to point2) or a vector (global at t = 0; fixed in space or, with frame body, in body1).
axis [x, y, z] expression_torque: axis, global at t = 0 (fixed in space or, with frame body, in body1).