---
url: /dyad/stable/stdlib/RotationalComponents/tests/Sources.Tests.ConstantVelocity.md
description: >-
  Dyad Sources.Tests.ConstantVelocity docs.  Test for ConstantVelocity source,
  matching MSL ModelicaTest.Rotational.AllComponents topology.
---

# `Sources.Tests.ConstantVelocity` {#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 {#Usage}

`RotationalComponents.Sources.Tests.ConstantVelocity()`

## Behavior {#Behavior}

$$ \begin{align}
0 &= \mathrm{connect}\left( constant\_{velocity\_{+}spline}, inertia\_{+}spline\_{a} \right) \\
0 &= \mathrm{connect}\left( constant\_{velocity\_{+}support}, fixed\_{+}spline \right) \\
\mathtt{fixed.spline.phi}\left( t \right) &= \mathtt{fixed.phi0} \\
\mathtt{constant_velocity.support.phi}\left( t \right) &= \mathtt{constant_velocity.phi_support}\left( t \right) \\
\mathtt{constant_velocity.support.tau}\left( t \right) &=  - \mathtt{constant_velocity.spline.tau}\left( t \right) \\
\mathtt{constant_velocity.phi}\left( t \right) &=  - \mathtt{constant_velocity.phi_support}\left( t \right) + \mathtt{constant_velocity.spline.phi}\left( t \right) \\
\mathtt{constant_velocity.w}\left( t \right) &= \frac{\mathrm{d}\mathtt{constant_velocity.phi}\left( t \right)}{\mathrm{d}t} \\
\mathtt{constant_velocity.w}\left( t \right) &= \mathtt{constant_velocity.w_fixed} \\
\mathtt{inertia.phi}\left( t \right) &= \mathtt{inertia.spline_a.phi}\left( t \right) \\
\mathtt{inertia.phi}\left( t \right) &= \mathtt{inertia.spline_b.phi}\left( t \right) \\
\frac{\mathrm{d}\mathtt{inertia.phi}\left( t \right)}{\mathrm{d}t} &= \mathtt{inertia.w}\left( t \right) \\
\frac{\mathrm{d}\mathtt{inertia.w}\left( t \right)}{\mathrm{d}t} &= \mathtt{inertia.a}\left( t \right) \\
\mathtt{inertia.J} ~ \mathtt{inertia.a}\left( t \right) &= \mathtt{inertia.spline_a.tau}\left( t \right) + \mathtt{inertia.spline_b.tau}\left( t \right)
\end{align}
$$

## Source {#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
```

```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-Cases}

### Test Case `case1` {#Test-Case-case1}

```julia
plt
```

![](donnolq.svg)

```julia
plt
```

![](ubzntjg.svg)

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`ConstantVelocity`](Sources.Tests.ConstantVelocity.md)

  * [`ConstantVelocity`](Sources.Tests.ConstantVelocity.md)

  * [`Fixed`](Sources.Tests.ConstantVelocity.md)

  * [`Inertia`](Sources.Tests.ConstantVelocity.md)
