ModelingToolkit Standard Library: Mechanical Components

Index

Rotational Components

Rotational Utils

ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialCompliantWithRelativeStatesConstant
PartialCompliantWithRelativeStates(; name, phi_rel = 0.0, tau = 0.0)

Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states

States:

  • phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi). It accepts an initial value, which defaults to 0.0.
  • w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel)). It accepts an initial value, which defaults to 0.0.
  • a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel)). It accepts an initial value, which defaults to 0.0.
  • tau(t): [N.m] Torque between flanges (= flange_b.tau). It accepts an initial value, which defaults to 0.0.

Connectors:

source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialElementaryTwoFlangesAndSupport2Function
PartialElementaryTwoFlangesAndSupport2(;name, use_support=false)

Partial model for a component with two rotational 1-dim. shaft flanges and a support used for textual modeling, i.e., for elementary models

States:

  • phi_support(t): [rad] Absolute angle of support flange

Connectors:

Parameters:

  • use_support: If support flange enabled, otherwise implicitly grounded
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialCompliantConstant
PartialCompliant(;  name, phi_rel = 0.0, tau = 0.0)

Partial model for the compliant connection of two rotational 1-dim. shaft flanges.

States:

  • phi_rel(t): [rad] Relative rotation angle (flange_b.phi - flange_a.phi). It accepts an initial value, which defaults to 0.0.
  • tau(t): [N.m] Torque between flanges (flange_b.tau). It accepts an initial value, which defaults to 0.0.

Connectors:

source

Rotational Core Components

ModelingToolkitStandardLibrary.Mechanical.Rotational.InertiaConstant
Inertia(;name, J, phi = 0.0, w = 0.0, a = 0.0)

1D-rotational component with inertia.

States:

  • phi: [rad] Absolute rotation angle of component
  • w: [rad/s] Absolute angular velocity of component (= D(phi))
  • a: [rad/s²] Absolute angular acceleration of component (= D(w))

Connectors:

Parameters:

  • J: [kg·m²] Moment of inertia
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringConstant
Spring(; name, c, phi_rel0 = 0.0)

Linear 1D rotational spring

States:

  • phi_rel(t): [rad] Relative rotation angle (flange_b.phi - flange_a.phi)
  • tau(t): [N.m] Torque between flanges (flange_b.tau)

Connectors:

Parameters:

  • c: [N.m/rad] Spring constant
  • phi_rel0: [rad] Unstretched spring angle. Defaults to 0.0.
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.DamperConstant
Damper(; name, d)

Linear 1D rotational damper

States:

  • phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi)
  • w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel))
  • a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel))
  • tau(t): [N.m] Torque between flanges (= flange_b.tau)

Connectors:

Parameters:

  • d: [N.m.s/rad] Damping constant
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringDamperConstant
SpringDamper(; name, d)

Linear 1D rotational spring and damper

States:

  • phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi)
  • w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel))
  • a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel))
  • tau(t): [N.m] Torque between flanges (= flange_b.tau)

Connectors:

Parameters:

  • d: [N.m.s/rad] Damping constant
  • c: [N.m/rad] Spring constant
  • phi_rel0: [rad] Unstretched spring angle. Defaults to 0.0
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.IdealGearConstant
IdealGear(; name, ratio, use_support = false)

Ideal gear without inertia.

This element characterizes any type of gear box which is fixed in the ground and which has one driving shaft and one driven shaft.

States:

  • phi_a(t): [rad] Relative angle between shaft a and the support
  • phi_b(t): [rad] Relative angle between shaft b and the support

Connectors:

Parameters:

  • ratio: Transmission ratio (flangea.phi/flangeb.phi)
  • use_support: If support flange enabled, otherwise implicitly grounded. By default it is false
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.RotationalFrictionConstant
RotationalFriction(; name, f, tau_c, w_brk, tau_brk)

Models rotational friction with Stribeck effect, Coulomb friction and viscous friction between the two flanges. The friction torque is a function of the relative angular velocity between flange_a and flange_b.

Friction model: "Armstrong, B. and C.C. de Wit, Friction Modeling and Compensation, The Control Handbook, CRC Press, 1995."

States:

  • phi_rel(t): [rad] Relative rotation angle (= flange_b.phi - flange_a.phi)
  • w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel))
  • a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel))
  • tau(t): [N.m] Torque between flanges (= flange_b.tau)

Connectors:

Parameters:

  • f: [N⋅m/(rad/s)] Viscous friction coefficient
  • tau_c: [N⋅m] Coulomb friction torque
  • w_brk: [rad/s] Breakaway friction velocity
  • tau_brk: [N⋅m] Breakaway friction torque
source

Rotational Sources

ModelingToolkitStandardLibrary.Mechanical.Rotational.SpeedFunction
Speed(; name, use_support = false, exact = false, f_crit = 50)

Forced movement of a flange according to a reference angular velocity signal

States:

  • phi_support(t): [rad] Absolute angle of support flange"

Connectors:

  • flangeFlange
  • w_refRealInput Reference angular velocity of flange with respect to support as input signal needs to be continuously differential

Parameters:

  • use_support: If support flange enabled, otherwise implicitly grounded
  • exact: true/false exact treatment/filtering the input signal
  • tau_filt: [rad/s] if exact=false, Time constant of low-pass filter to filter input signal
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PositionFunction
Position(; name, exact = false, f_crit = 50, use_support = false)

Forced movement of a flange according to a reference angle signal.

The input signal phi_ref defines the reference angle in [rad]. Flange is forced to move according to this reference motion relative to flange support. According to parameter exact (default = false), this is done in the following way:

  • exact=true: The reference angle is treated exactly. This is only possible if the input signal is defined by an analytical function that can be differentiated at least twice in order to compute the acceleration.
  • exact=false: The reference angle is filtered and the second derivative of the filtered curve is used to compute the reference acceleration of the flange. This second derivative is not computed by numerical differentiation but by an appropriate realization of the filter. For filtering, a second-order Bessel filter is used. The critical frequency (also called cut-off frequency) of the filter is defined via parameter f_crit in [Hz]. This value should be selected in such a way that it is higher than the essential low frequencies in the signal.

Connectors

  • flange::Flange: Flange to be moved
  • phi_ref::RealInput: Reference angle of flange with respect to support

Variables

  • phi(t): Rotation angle of flange with respect to support
  • w(t): If exact=false, Angular velocity of flange with respect to support
  • a(t): If exact=false, Angular acceleration of flange with respect to support

Parameters

  • exact: (structural) true/false exact treatment/filtering the input signal
  • f_crit: [Hz] if exact=false, Critical frequency of filter to filter input signal
source

Rotational Sensors

Translational Components

Translational Utils

Translational Core Components

ModelingToolkitStandardLibrary.Mechanical.Translational.MassFunction
Mass(; name, m, g = 0)

Sliding mass with inertia

Parameters:

  • m: [kg] mass of sliding body
  • g = 0: [m/s^2] [m/s²] gravity field acting on the mass, positive value acts in the positive direction

States:

  • v: [m/s] absolute linear velocity of sliding mass
  • s: [m] absolute position of sliding mass (optional with parameter s)

Connectors:

  • flange: 1-dim. translational flange
source
ModelingToolkitStandardLibrary.Mechanical.Translational.SpringFunction
Spring(; name, k, delta_s = 0.0,  va=0.0, v_b_0=0.0)

Linear 1D translational spring

Parameters:

  • k: [N/m] Spring constant
  • delta_s: initial spring stretch
  • va: [m/s] Initial value of absolute linear velocity at flange_a (default 0 m/s)
  • v_b_0: [m/s] Initial value of absolute linear velocity at flange_b (default 0 m/s)

Connectors:

  • flange_a: 1-dim. translational flange on one side of spring
  • flange_b: 1-dim. translational flange on opposite side of spring
source
ModelingToolkitStandardLibrary.Mechanical.Translational.DamperConstant
Damper(; name, d, flange_a.v = 0.0, flange_b.v = 0.0)

Linear 1D translational damper

Parameters:

  • d: [N.s/m] Damping constant

Connectors:

  • flange_a: 1-dim. translational flange on one side of damper. Initial value of state v is set to 0.0 m/s.
  • flange_b: 1-dim. translational flange on opposite side of damper. Initial value of state v is set to 0.0 m/s.
source

Translational Sources

ModelingToolkitStandardLibrary.Mechanical.Translational.PositionFunction
Position(solves_force = true; name)

Linear 1D position input source. Set solves_force=false to force input force to 0 (i.e. only the position is given, the respective force needed is already provided elsewhere in the model).

Connectors:

  • flange: 1-dim. translational flange
  • s: real input
source
ModelingToolkitStandardLibrary.Mechanical.Translational.VelocityFunction
Velocity(solves_force = true; name)

Linear 1D position input source. Set solves_force=false to force input force to 0 (i.e. only the velocity is given, the respective force needed is already provided elsewhere in the model).

Connectors:

  • flange: 1-dim. translational flange
  • v: real input
source
ModelingToolkitStandardLibrary.Mechanical.Translational.AccelerationFunction

Acceleration(solves_force = true; name)

Linear 1D position input source. Set solves_force=false to force input force to 0 (i.e. only the acceleration is given, the respective force needed is already provided elsewhere in the model).

Connectors:

  • flange: 1-dim. translational flange
  • a: real input
source

Translational Sensors