Skip to content
LIBRARY
Sources.SignTorque.md

Sources.SignTorque

Constant torque changing sign with speed.

Model of constant torque which changes sign with direction of rotation. Positive torque accelerates in both directions of rotation. Negative torque brakes in both directions of rotation. Around zero speed regularization avoids numerical problems.

This component extends from RotationalComponents.Interfaces.PartialTorque

Usage

RotationalComponents.Sources.SignTorque(tau_nominal, w0=0.1)

Parameters:

NameDescriptionUnitsDefault value
regType of regularizationRotationalC...ation.Exp()
tau_nominalNominal torque (if negative, torque is acting as load)N.m
w0Regularization below w0rad/s0.1

Connectors

  • spline - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. (Spline)

  • support - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. (Spline)

Variables

NameDescriptionUnits
phi_supportAbsolute angle of the support splinerad
phiAngle of spline with respect to support
wAngular velocity of spline with respect to support (= der(phi))rad/s
tauAccelerating torque acting at spline (= -spline.tau)N.m

Behavior

julia
using RotationalComponents #hide
using ModelingToolkit #hide
@variables tau_nominal #hide
@variables w0 #hide
@named sys = RotationalComponents.Sources.SignTorque(tau_nominal=tau_nominal, w0=w0) #hide
full_equations(sys) #hide
<< @example-block not executed in draft mode >>

Source

dyad
"""
Constant torque changing sign with speed.

Model of constant torque which changes sign with direction of rotation.
Positive torque accelerates in both directions of rotation.
Negative torque brakes in both directions of rotation.
Around zero speed regularization avoids numerical problems.
"""
component SignTorque
  extends RotationalComponents.Interfaces.PartialTorque
  "Nominal torque (if negative, torque is acting as load)"
  parameter tau_nominal::Torque
  "Type of regularization"
  structural parameter reg::RotationalComponents.Sources.Regularization = RotationalComponents.Sources.Regularization.Exp()
  "Regularization below w0"
  parameter w0::AngularVelocity(min = eps(Float64)) = 0.1
  "Angular velocity of spline with respect to support (= der(phi))"
  variable w::AngularVelocity
  "Accelerating torque acting at spline (= -spline.tau)"
  variable tau::Torque
relations
  w = der(phi)
  tau = -spline.tau
  switch reg
    case Exp
      tau = tau_nominal * (2.0 / (1.0 + exp(-w / (0.01 * w0))) - 1.0)
    case Sine
      tau = tau_nominal * ifelse(abs(w) >= w0, sign(w), sin(π / 2 * w / w0))
    case Linear
      tau = tau_nominal * ifelse(abs(w) >= w0, sign(w), w / w0)
    case Cosine
      tau = tau_nominal * ifelse(abs(w) >= w0, sign(w), sign(w) * (1.0 - cos(π / 2 * w / w0)))
  end
metadata {"Dyad": {"icons": {"default": "dyad://RotationalComponents/SignTorque.svg"}}}
end
Flattened Source
dyad
"""
Constant torque changing sign with speed.

Model of constant torque which changes sign with direction of rotation.
Positive torque accelerates in both directions of rotation.
Negative torque brakes in both directions of rotation.
Around zero speed regularization avoids numerical problems.
"""
component SignTorque
  "Primary rotational shaft spline connector"
  spline = Spline() {"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}
  "Support spline connector"
  support = Spline() {
    "Dyad": {
      "placement": {"icon": {"iconName": "support", "x1": 450, "y1": 950, "x2": 550, "y2": 1050}}
    }
  }
  "Absolute angle of the support spline"
  variable phi_support::Angle
  "Angle of spline with respect to support"
  variable phi::Real
  "Nominal torque (if negative, torque is acting as load)"
  parameter tau_nominal::Torque
  "Type of regularization"
  structural parameter reg::RotationalComponents.Sources.Regularization = RotationalComponents.Sources.Regularization.Exp()
  "Regularization below w0"
  parameter w0::AngularVelocity(min = eps(Float64)) = 0.1
  "Angular velocity of spline with respect to support (= der(phi))"
  variable w::AngularVelocity
  "Accelerating torque acting at spline (= -spline.tau)"
  variable tau::Torque
relations
  support.phi = phi_support
  support.tau = -spline.tau
  phi = spline.phi - phi_support
  w = der(phi)
  tau = -spline.tau
  switch reg
    case Exp
      tau = tau_nominal * (2.0 / (1.0 + exp(-w / (0.01 * w0))) - 1.0)
    case Sine
      tau = tau_nominal * ifelse(abs(w) >= w0, sign(w), sin(π / 2 * w / w0))
    case Linear
      tau = tau_nominal * ifelse(abs(w) >= w0, sign(w), w / w0)
    case Cosine
      tau = tau_nominal * ifelse(abs(w) >= w0, sign(w), sign(w) * (1.0 - cos(π / 2 * w / w0)))
  end
metadata {"Dyad": {"icons": {"default": "dyad://RotationalComponents/SignTorque.svg"}}}
end


Test Cases

No test cases defined.