Skip to content
LIBRARY
Sources.Tests.ConstantSpeed.md

Sources.Tests.ConstantSpeed

Test for ConstantSpeed source, matching MSL ModelicaTest.Rotational.AllComponents topology.

ConstantSpeed prescribes a fixed angular velocity w_fixed=11 rad/s on the inertia. The inertia's speed is constrained to w_fixed at all times.

Usage

RotationalComponents.Sources.Tests.ConstantSpeed()

Behavior

[connect(constantspeed+spline,inertia+splinea)connect(constantspeed+support,fixed+spline)fixed.spline.phi(t)=fixed.phi0constantspeed.support.phi(t)=constantspeed.phi_support(t)constantspeed.support.tau(t)=constantspeed.spline.tau(t)constantspeed.phi(t)=constantspeed.phi_support(t)+constantspeed.spline.phi(t)constantspeed.w(t)=dconstantspeed.phi(t)dtconstantspeed.w(t)=constantspeed.w_fixedinertia.phi(t)=inertia.splinea.phi(t)inertia.phi(t)=inertia.splineb.phi(t)dinertia.phi(t)dt=inertia.w(t)dinertia.w(t)dt=inertia.a(t)inertia.Jinertia.a(t)=inertia.splinea.tau(t)+inertia.splineb.tau(t)]

Source

dyad
"""
Test for ConstantSpeed source, matching MSL ModelicaTest.Rotational.AllComponents topology.

ConstantSpeed prescribes a fixed angular velocity w_fixed=11 rad/s on the inertia.
The inertia's speed is constrained to w_fixed at all times.
"""
test component ConstantSpeed
  "Fixed ground for source support"
  fixed = RotationalComponents.Components.Fixed()
  "Constant speed source (w_fixed=11)"
  constant_speed = RotationalComponents.Sources.ConstantSpeed(w_fixed = 11)
  "Inertia (J=3)"
  inertia = RotationalComponents.Components.Inertia(J = 3)
relations
  initial inertia.phi = 0
  connect(constant_speed.spline, inertia.spline_a)
  connect(constant_speed.support, fixed.spline)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://RotationalComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 1,
        "atol": {"inertia.w": 0.001, "inertia.phi": 0.001},
        "expect": {
          "initial": {"inertia.phi": 0, "inertia.w": 11},
          "final": {"inertia.w": 11, "inertia.phi": 11},
          "signals": ["inertia.w", "inertia.phi"]
        }
      }
    }
  }
}
end
Flattened Source
dyad
"""
Test for ConstantSpeed source, matching MSL ModelicaTest.Rotational.AllComponents topology.

ConstantSpeed prescribes a fixed angular velocity w_fixed=11 rad/s on the inertia.
The inertia's speed is constrained to w_fixed at all times.
"""
test component ConstantSpeed
  "Fixed ground for source support"
  fixed = RotationalComponents.Components.Fixed()
  "Constant speed source (w_fixed=11)"
  constant_speed = RotationalComponents.Sources.ConstantSpeed(w_fixed = 11)
  "Inertia (J=3)"
  inertia = RotationalComponents.Components.Inertia(J = 3)
relations
  initial inertia.phi = 0
  connect(constant_speed.spline, inertia.spline_a)
  connect(constant_speed.support, fixed.spline)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://RotationalComponents/Example.svg"},
    "tests": {
      "case1": {
        "stop": 1,
        "atol": {"inertia.w": 0.001, "inertia.phi": 0.001},
        "expect": {
          "initial": {"inertia.phi": 0, "inertia.w": 11},
          "final": {"inertia.w": 11, "inertia.phi": 11},
          "signals": ["inertia.w", "inertia.phi"]
        }
      }
    }
  }
}
end


Test Cases

Test Case case1

julia
plt

julia
plt