ObjectConnectorLinearSpringDamper

An linear spring-damper element acting on relative translations along given axis of local joint0 coordinate system; connects to position and orientation-based markers; the linear spring-damper is intended to act within prismatic joints or in situations where only one translational axis is free; if the two markers rotate relative to each other, the spring-damper will always act in the local joint0 coordinate system.

Additional information for ObjectConnectorLinearSpringDamper:

  • This Object has/provides the following types = Connector
  • Requested Marker type = Position + Orientation
  • Short name for Python = LinearSpringDamper
  • Short name for Python visualization object = VLinearSpringDamper

The item ObjectConnectorLinearSpringDamper with type = ‘ConnectorLinearSpringDamper’ has the following parameters:

  • name [type = String, default = ‘’]:
    connector’s unique name
  • markerNumbers [\([m0,\, m1]\), type = ArrayMarkerIndex, default = [ invalid [-1], invalid [-1] ]]:
    list of markers used in connector
  • stiffness [\(k\), type = Real, default = 0.]:
    torsional stiffness [SI:Nm/rad] against relative rotation
  • damping [\(d\), type = Real, default = 0.]:
    torsional damping [SI:Nm/(rad/s)]
  • axisMarker0 [\(\LU{m0}{{\mathbf{d}}}\), type = Vector3D, default = [1,0,0]]:
    local axis of spring-damper in marker 0 coordinates; this axis will co-move with marker \(m0\); if marker m0 is attached to ground, the spring-damper represents linear equations
  • offset [\(x_\mathrm{off}\), type = Real, default = 0.]:
    translational offset considered in the spring force calculation (this can be used as position control input!)
  • velocityOffset [\(v_\mathrm{off}\), type = Real, default = 0.]:
    velocity offset considered in the damper force calculation (this can be used as velocity control input!)
  • force [\(f_c\), type = Real, default = 0.]:
    additional constant force [SI:Nm] added to spring-damper; this can be used to prescribe a force between the two attached bodies (e.g., for actuation and control)
  • activeConnector [type = Bool, default = True]:
    flag, which determines, if the connector is active; used to deactivate (temporarily) a connector or constraint
  • springForceUserFunction [\(\mathrm{UF} \in \Rcal\), type = PyFunctionMbsScalarIndexScalar5, default = 0]:
    A Python function which computes the scalar force between the two rigid body markers along axisMarker0 in \(m0\) coordinates, if activeConnector=True; see description below
  • visualization [type = VObjectConnectorLinearSpringDamper]:
    parameters for visualization of item

The item VObjectConnectorLinearSpringDamper has the following parameters:

  • show [type = Bool, default = True]:
    set true, if item is shown in visualization and false if it is not shown
  • drawSize [type = float, default = -1.]:
    drawing size = diameter of spring; size == -1.f means that default connector size is used
  • drawAsCylinder [type = Bool, default = False]:
    if this flag is True, the spring-damper is represented as cylinder; this may fit better if the spring-damper represents an actuator
  • color [type = Float4, default = [-1.,-1.,-1.,-1.]]:
    RGBA connector color; if R==-1, use default color

DESCRIPTION of ObjectConnectorLinearSpringDamper

The following output variables are available as OutputVariableType in sensors, Get…Output() and other functions:

  • DisplacementLocal: \(\Delta x\)
    (scalar) relative displacement of the spring-damper
  • VelocityLocal: \(\Delta v\)
    (scalar) relative velocity of spring-damper
  • ForceLocal: \(f\)
    (scalar) spring-damper force

Definition of quantities

input parameter
symbol
description
markerNumbers[0]
\(m0\)
global marker number m0
markerNumbers[1]
\(m1\)
global marker number m1
intermediate variables
symbol
description
marker m0 orientation
\(\LU{0,m0}{\Rot}\)
current rotation matrix provided by marker m0
marker m0 position
\(\LU{0}{{\mathbf{p}}_{m0}}\)
current position matrix provided by marker m0
marker m1 position
\(\LU{0}{{\mathbf{p}}_{m1}}\)
current position matrix provided by marker m1
marker m0 velocity
\(\LU{0}{{\mathbf{v}}}_{m0}\)
current global velocity vector provided by marker m0
marker m1 velocity
\(\LU{0}{{\mathbf{v}}}_{m1}\)
current global velocity vector provided by marker m1
relative displacement
\(\Delta x = (\LU{0,m0}{\Rot} \LU{m0}{{\mathbf{d}}})\tp (\LU{0}{{\mathbf{p}}_{m1}} - \LU{0}{{\mathbf{p}}_{m0}})\)
scalar relative displacement
relative velocity
\(\Delta v = (\LU{0,m0}{\Rot} \LU{m0}{{\mathbf{d}}})\tp (\LU{0}{{\mathbf{v}}_{m1}} - \LU{0}{{\mathbf{v}}_{m0}})\)
scalar relative velocity; note that this only corresponds to the time derivative of \(\Delta x\) if the markers only move along the axis (in a prismatic joint)

Connector forces

If activeConnector = True, the vector spring force is computed as

\[f_{SD} = k \left(\Delta x - x_\mathrm{off} \right) + d \left(\Delta v - v_\mathrm{off} \right) + f_c\]

if activeConnector = False, \(\tau_{SD}\) is set zero.

If the springForceUserFunction \(\mathrm{UF}\) is defined and activeConnector = True, \(\tau_{SD}\) instead becomes (\(t\) is current time)

\[\tau_{SD} = \mathrm{UF}(mbs, t, i_N, \Delta x, \Delta v, \mathrm{stiffness}, \mathrm{damping}, \mathrm{offset})\]

and iN represents the itemNumber (=objectNumber).


Userfunction: springForceUserFunction(mbs, t, itemNumber, displacement, velocity, stiffness, damping, offset)

A user function, which computes the scalar torque depending on mbs, time, local quantities (relative displacement, relative velocity), which are evaluated at current time. Furthermore, the user function contains object parameters (stiffness, damping, offset). Note that itemNumber represents the index of the object in mbs, which can be used to retrieve additional data from the object through mbs.GetObjectParameter(itemNumber, ...), see the according description of GetObjectParameter.

Detailed description of the arguments and local quantities:

arguments / return
type or size
description
mbs
MainSystem
provides MainSystem mbs in which underlying item is defined
t
Real
current time in mbs
itemNumber
Index
integer number \(i_N\) of the object in mbs, allowing easy access to all object data via mbs.GetObjectParameter(itemNumber, …)
displacement
Real
\(\Delta x\)
velocity
Real
\(\Delta v\)
stiffness
Real
copied from object
damping
Real
copied from object
offset
Real
copied from object
returnValue
Real
computed force

User function example:

#define simple cubic force for spring-damper:
def UFforce(mbs, t, itemNumber, displacement, velocity, stiffness, damping, offset):
    k = stiffness #passed as list
    return k*displacement + 0.1*k* displacement**3

#markerNumbers and parameters taken from mini example
mbs.AddObject(LinearSpringDamper(markerNumbers = [mGround, mBody],
                                 stiffness = k,
                                 damping = k*0.01,
                                 offset = 0,
                                 springForceUserFunction = UFforce))

MINI EXAMPLE for ObjectConnectorLinearSpringDamper

 1#example with rigid body at [0,0,0], with torsional load
 2k=2e3
 3nBody = mbs.AddNode(RigidRxyz())
 4oBody = mbs.AddObject(RigidBody(physicsMass=1, physicsInertia=[1,1,1,0,0,0],
 5                                nodeNumber=nBody))
 6
 7mBody = mbs.AddMarker(MarkerNodeRigid(nodeNumber=nBody))
 8mGround = mbs.AddMarker(MarkerBodyRigid(bodyNumber=oGround,
 9                                        localPosition = [0,0,0]))
10mbs.AddObject(PrismaticJointX(markerNumbers = [mGround, mBody])) #motion along ground X-axis
11mbs.AddObject(LinearSpringDamper(markerNumbers = [mGround, mBody], axisMarker0=[1,0,0],
12                                 stiffness = k, damping = k*0.01, offset = 0))
13
14#force along x-axis; expect approx. Delta x = 1/k=0.0005
15mbs.AddLoad(Force(markerNumber = mBody, loadVector=[1,0,0]))
16
17#assemble and solve system for default parameters
18mbs.Assemble()
19mbs.SolveDynamic(exu.SimulationSettings())
20
21#check result at default integration time
22exudynTestGlobals.testResult = mbs.GetNodeOutput(nBody, exu.OutputVariableType.Displacement)[0]

The web version may not be complete. For details, consider also the Exudyn PDF documentation : theDoc.pdf