Skip to content
Constant.md

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

BlockComponents.Constant(k)

Parameters:

NameDescriptionUnitsDefault value
kThe constant value to output

Connectors

  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior

y(t)=k

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},
      {"label": "$(instance)", "x": 500, "y": -150, "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": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  # The constant value to output
  parameter k::Real
relations
  y = k
metadata {
  "Dyad": {
    "labels": [
      {"label": "k = $(k)", "x": 500, "y": 1100, "rot": 0},
      {"label": "$(instance)", "x": 500, "y": -150, "rot": 0}
    ],
    "icons": {"default": "dyad://BlockComponents/Constant.svg"}
  }
}
end


Test Cases

No test cases defined.