PrescribeInitialPosition
Sets the initial position of a translational mechanical flange.
This component is used to define the starting position for a one-dimensional translational mechanical system connected to its flange
. It uses an initial equation
to set the flange.s
(position) to the specified parameter s0
at the very beginning of a simulation. During the simulation, the component exerts no force, as defined by the equation:
The initial position is set using:
Usage
PrescribeInitialPosition(s0)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
s0 | Prescribed initial position for the flange | m |
Connectors
flange
- (Flange
)
Behavior
Source
dyad
# Sets the initial position of a translational mechanical flange.
#
# This component is used to define the starting position for a one-dimensional translational mechanical system connected to its `flange`.
# It uses an `initial equation` to set the `flange.s` (position) to the specified parameter `s0` at the very beginning of a simulation.
# During the simulation, the component exerts no force, as defined by the equation:
# ```math
# flange.f = 0
# ```
# The initial position is set using:
# ```math
# flange.s(0) = s0
# ```
component PrescribeInitialPosition
# Translational mechanical connector
flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
# Prescribed initial position for the flange
parameter s0::Dyad.Position
relations
initial flange.s = s0
flange.f = 0
metadata {
"Dyad": {
"labels": [{"label": "initial s = $(s0)", "x": 500, "y": 800, "rot": 0}],
"icons": {"default": "dyad://TranslationalComponents/Position.svg"}
}
}
end
Flattened Source
dyad
# Sets the initial position of a translational mechanical flange.
#
# This component is used to define the starting position for a one-dimensional translational mechanical system connected to its `flange`.
# It uses an `initial equation` to set the `flange.s` (position) to the specified parameter `s0` at the very beginning of a simulation.
# During the simulation, the component exerts no force, as defined by the equation:
# ```math
# flange.f = 0
# ```
# The initial position is set using:
# ```math
# flange.s(0) = s0
# ```
component PrescribeInitialPosition
# Translational mechanical connector
flange = Flange() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 450, "x2": 50, "y2": 550}}}}]
# Prescribed initial position for the flange
parameter s0::Dyad.Position
relations
initial flange.s = s0
flange.f = 0
metadata {
"Dyad": {
"labels": [{"label": "initial s = $(s0)", "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"
Related
Examples
Experiments
Analyses