Skip to content
PrescribeInitialVelocity.md

PrescribeInitialVelocity

Sets an initial velocity condition for a translational mechanical flange.

This component defines the starting velocity of a one-dimensional mechanical translational interface, represented by its flange. It utilizes a parameter v0 to specify this desired initial velocity. At the beginning of a simulation, an internal variable v (which also represents the flange's velocity) is set to v0. The component ensures that the derivative of the flange's position, der(flange.s), is equal to this velocity v. Additionally, it exerts no force through the flange, as indicated by flange.f = 0, acting as a pure kinematic specification for the initial velocity. The key relations are:

v(0)=v0d(flange.s)dt=vflange.f=0

Usage

PrescribeInitialVelocity(v0)

Parameters:

NameDescriptionUnitsDefault value
v0User-defined initial velocity for the flangem/s

Connectors

Variables

NameDescriptionUnits
vVelocity of the connected flangem/s

Behavior

dflange.s(t)dt=v(t)flange.f(t)=0

Source

dyad
# Sets an initial velocity condition for a translational mechanical flange.
#
# This component defines the starting velocity of a one-dimensional mechanical
# translational interface, represented by its `flange`. It utilizes a parameter `v0`
# to specify this desired initial velocity. At the beginning of a simulation,
# an internal variable `v` (which also represents the flange's velocity) is set
# to `v0`. The component ensures that the derivative of the flange's position,
# `der(flange.s)`, is equal to this velocity `v`. Additionally, it exerts no
# force through the flange, as indicated by `flange.f = 0`, acting as a pure
# kinematic specification for the initial velocity. The key relations are:
# ```math
# \begin{align*}
# v(0) &= v0 \\
# \frac{d(flange.s)}{dt} &= v\\
# flange.f &= 0
# \end{align*}
# ```
component PrescribeInitialVelocity
  # Represents a 1D mechanical translational interface
  flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
  # User-defined initial velocity for the flange
  parameter v0::Velocity
  # Velocity of the connected flange
  variable v::Velocity
relations
  initial v = v0
  der(flange.s) = v
  flange.f = 0
metadata {
  "Dyad": {
    "labels": [{"label": "initial v=$(v0)", "x": 500, "y": 800, "rot": 0}],
    "icons": {"default": "dyad://TranslationalComponents/Position.svg"}
  }
}
end
Flattened Source
dyad
# Sets an initial velocity condition for a translational mechanical flange.
#
# This component defines the starting velocity of a one-dimensional mechanical
# translational interface, represented by its `flange`. It utilizes a parameter `v0`
# to specify this desired initial velocity. At the beginning of a simulation,
# an internal variable `v` (which also represents the flange's velocity) is set
# to `v0`. The component ensures that the derivative of the flange's position,
# `der(flange.s)`, is equal to this velocity `v`. Additionally, it exerts no
# force through the flange, as indicated by `flange.f = 0`, acting as a pure
# kinematic specification for the initial velocity. The key relations are:
# ```math
# \begin{align*}
# v(0) &= v0 \\
# \frac{d(flange.s)}{dt} &= v\\
# flange.f &= 0
# \end{align*}
# ```
component PrescribeInitialVelocity
  # Represents a 1D mechanical translational interface
  flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
  # User-defined initial velocity for the flange
  parameter v0::Velocity
  # Velocity of the connected flange
  variable v::Velocity
relations
  initial v = v0
  der(flange.s) = v
  flange.f = 0
metadata {
  "Dyad": {
    "labels": [{"label": "initial v=$(v0)", "x": 500, "y": 800, "rot": 0}],
    "icons": {"default": "dyad://TranslationalComponents/Position.svg"}
  }
}
end


Test Cases

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

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

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

  • Experiments

  • Analyses