Constant
Provides a constant output signal of value k.
Generates a constant signal that doesn't change over time. The output y is always equal to the parameter k, regardless of simulation time or system state. This is often used as a reference signal, bias term, or fixed input to other components in a control system or simulation.
This component extends from SO
Usage
Constant(k)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
k | The constant value to output | – |
Connectors
y
- This connector represents a real signal as an output from a component (RealOutput
)
Behavior
Source
dyad
# Provides a constant output signal of value k.
#
# Generates a constant signal that doesn't change over time. The output y is always equal
# to the parameter k, regardless of simulation time or system state. This is often used
# as a reference signal, bias term, or fixed input to other components in a control system or simulation.
component Constant
extends SO
# The constant value to output
parameter k::Real
relations
y = k
metadata {
"Dyad": {
"labels": [{"label": "k = $(k)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://BlockComponents/Constant.svg"}
}
}
end
Flattened Source
dyad
# Provides a constant output signal of value k.
#
# Generates a constant signal that doesn't change over time. The output y is always equal
# to the parameter k, regardless of simulation time or system state. This is often used
# as a reference signal, bias term, or fixed input to other components in a control system or simulation.
component Constant
# Real-valued output connector for the component
y = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
# The constant value to output
parameter k::Real
relations
y = k
metadata {
"Dyad": {
"labels": [{"label": "k = $(k)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://BlockComponents/Constant.svg"}
}
}
end
Test Cases
This is setup code, that must be run before each test case.
julia
using BlockComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames
snapshotsdir = joinpath(dirname(dirname(pathof(BlockComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/BlockComponents/77kIK/test/snapshots"
Related
Examples
Experiments
Analyses
Tests