Skip to content
PrescribeInitialVelocity.md

PrescribeInitialVelocity

Sets a defined initial angular velocity to a rotational mechanical connector.

This component is used to define and enforce a specific initial angular velocity (w_0) on a rotational mechanical system at the commencement of a simulation. It interfaces with the system through a spline, which acts as a rotational connector. The component ensures that at time t=0, the angular velocity w of the connector is precisely equal to the user-defined parameter w_0. The relationship dspline.phidt=w establishes that w is indeed the angular velocity of the spline connector. Importantly, the torque transmitted through this connector is constrained to be zero (spline.tau=0), meaning the component prescribes motion kinematically without imparting any dynamic load itself. It effectively acts as an ideal angular velocity source at the initial moment.

Usage

PrescribeInitialVelocity(w0)

Parameters:

NameDescriptionUnitsDefault value
w0Desired initial angular velocity at the start of the simulationm/s

Connectors

Variables

NameDescriptionUnits
wActual angular velocity of the component, initialized to w0m/s

Behavior

dspline.phi(t)dt=w(t)spline.tau(t)=0

Source

dyad
# Sets a defined initial angular velocity to a rotational mechanical connector.
#
# This component is used to define and enforce a specific initial angular velocity
# (`w_0`) on a rotational mechanical system at the commencement of a
# simulation. It interfaces with the system through a `spline`, which
# acts as a rotational connector. The component ensures that at time t=0, the
# angular velocity `w` of the connector is precisely equal to the user-defined
# parameter `w_0`. The relationship \$\frac{d\text{spline.phi}}{dt} = w\$
# establishes that `w` is indeed the angular velocity of the `spline` connector.
# Importantly, the torque transmitted through this connector is constrained to be
# zero (\$\text{spline.tau} = 0\$), meaning the component prescribes motion
# kinematically without imparting any dynamic load itself. It effectively acts as
# an ideal angular velocity source at the initial moment.
component PrescribeInitialVelocity
  spline = Spline() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
  # Desired initial angular velocity at the start of the simulation
  parameter w0::Velocity
  # Actual angular velocity of the component, initialized to w0
  variable w::Velocity
relations
  initial w = w0
  der(spline.phi) = w
  spline.tau = 0
metadata {
  "Dyad": {
    "labels": [{"label": "initial w=$(w0)", "x": 500, "y": 800, "rot": 0}],
    "icons": {"default": "dyad://RotationalComponents/Pos-Speed-Acc-Move.svg"}
  }
}
end
Flattened Source
dyad
# Sets a defined initial angular velocity to a rotational mechanical connector.
#
# This component is used to define and enforce a specific initial angular velocity
# (`w_0`) on a rotational mechanical system at the commencement of a
# simulation. It interfaces with the system through a `spline`, which
# acts as a rotational connector. The component ensures that at time t=0, the
# angular velocity `w` of the connector is precisely equal to the user-defined
# parameter `w_0`. The relationship \$\frac{d\text{spline.phi}}{dt} = w\$
# establishes that `w` is indeed the angular velocity of the `spline` connector.
# Importantly, the torque transmitted through this connector is constrained to be
# zero (\$\text{spline.tau} = 0\$), meaning the component prescribes motion
# kinematically without imparting any dynamic load itself. It effectively acts as
# an ideal angular velocity source at the initial moment.
component PrescribeInitialVelocity
  spline = Spline() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
  # Desired initial angular velocity at the start of the simulation
  parameter w0::Velocity
  # Actual angular velocity of the component, initialized to w0
  variable w::Velocity
relations
  initial w = w0
  der(spline.phi) = w
  spline.tau = 0
metadata {
  "Dyad": {
    "labels": [{"label": "initial w=$(w0)", "x": 500, "y": 800, "rot": 0}],
    "icons": {"default": "dyad://RotationalComponents/Pos-Speed-Acc-Move.svg"}
  }
}
end


Test Cases

This is setup code, that must be run before each test case.

julia
using RotationalComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames

snapshotsdir = joinpath(dirname(dirname(pathof(RotationalComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/RotationalComponents/0VPxm/test/snapshots"
  • Examples

  • Experiments

  • Analyses