Skip to content
LIBRARY
Sources.Tests.ConstantVelocity.md

Sources.Tests.ConstantVelocity

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

ConstantVelocity 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.ConstantVelocity()

Behavior

Source

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

ConstantVelocity 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 ConstantVelocity
  "Fixed ground for source support"
  fixed = RotationalComponents.Components.Fixed() {
    "Dyad": {"placement": {"diagram": {"x1": 140, "x2": 240, "y1": 230, "y2": 330}}}
  }
  "Constant velocity source (w_fixed=11)"
  constant_velocity = RotationalComponents.Sources.ConstantVelocity(w_fixed = 11) {"Dyad": {"placement": {"diagram": {"x1": 20, "x2": 120, "y1": 20, "y2": 120}}}}
  "Inertia (J=3)"
  inertia = RotationalComponents.Components.Inertia(J = 3) {
    "Dyad": {"placement": {"diagram": {"x1": 150, "x2": 250, "y1": 20, "y2": 120}}}
  }
relations
  initial inertia.phi = 0
  connect(constant_velocity.spline, inertia.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
  connect(constant_velocity.support, fixed.spline) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 70, "y": 175}, {"x": 190, "y": 175}], "E": 2}],
      "path": {}
    }
  }
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 ConstantVelocity source, matching MSL ModelicaTest.Rotational.AllComponents topology.

ConstantVelocity 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 ConstantVelocity
  "Fixed ground for source support"
  fixed = RotationalComponents.Components.Fixed() {
    "Dyad": {"placement": {"diagram": {"x1": 140, "x2": 240, "y1": 230, "y2": 330}}}
  }
  "Constant velocity source (w_fixed=11)"
  constant_velocity = RotationalComponents.Sources.ConstantVelocity(w_fixed = 11) {"Dyad": {"placement": {"diagram": {"x1": 20, "x2": 120, "y1": 20, "y2": 120}}}}
  "Inertia (J=3)"
  inertia = RotationalComponents.Components.Inertia(J = 3) {
    "Dyad": {"placement": {"diagram": {"x1": 150, "x2": 250, "y1": 20, "y2": 120}}}
  }
relations
  initial inertia.phi = 0
  connect(constant_velocity.spline, inertia.spline_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "path": {}}}
  connect(constant_velocity.support, fixed.spline) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 70, "y": 175}, {"x": 190, "y": 175}], "E": 2}],
      "path": {}
    }
  }
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