Skip to content
FirstOrder.md

FirstOrder

First-order filter with a single real pole and adjustable gain.

Implements a dynamic system with transfer function

ksT+1

where T is the time constant and k is the gain. The filter has a single real pole at s = -1/T and smoothly tracks the input signal with the specified time constant.

This component extends from SISO

Usage

BlockComponents.FirstOrder(T, k=1.0)

Parameters:

NameDescriptionUnitsDefault value
TTime constant controlling the speed of response
kGain factor applied to the input1

Connectors

  • u - This connector represents a real signal as an input to a component (RealInput)

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

Variables

NameDescriptionUnits
xState variable representing the filtered value

Behavior

dx(t)dt=x(t)+ku(t)Ty(t)=x(t)

Source

dyad
# First-order filter with a single real pole and adjustable gain.
#
# Implements a dynamic system with transfer function
#
# ```math
# \frac{k}{sT + 1}
# ```
# where `T` is the time constant and `k` is the gain. The filter has a single real pole at s = -1/T
# and smoothly tracks the input signal with the specified time constant.
component FirstOrder
  extends SISO
  # State variable representing the filtered value
  variable x::Real
  # Time constant controlling the speed of response
  parameter T::Real
  # Gain factor applied to the input
  parameter k::Real = 1.0
relations
  der(x) = (k * u - x) / T
  y = x
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/FirstOrder.svg"}
  }
}
end
Flattened Source
dyad
# First-order filter with a single real pole and adjustable gain.
#
# Implements a dynamic system with transfer function
#
# ```math
# \frac{k}{sT + 1}
# ```
# where `T` is the time constant and `k` is the gain. The filter has a single real pole at s = -1/T
# and smoothly tracks the input signal with the specified time constant.
component FirstOrder
  # Input signal port
  u = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
        "diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
      }
    }
  }
  # Output signal port
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  # State variable representing the filtered value
  variable x::Real
  # Time constant controlling the speed of response
  parameter T::Real
  # Gain factor applied to the input
  parameter k::Real = 1.0
relations
  der(x) = (k * u - x) / T
  y = x
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/FirstOrder.svg"}
  }
}
end


Test Cases

No test cases defined.