FirstOrder
First-order filter with a single real pole and adjustable gain.
Implements a dynamic system with transfer function
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:
| Name | Description | Units | Default value |
|---|---|---|---|
T | Time constant controlling the speed of response | – | |
k | Gain factor applied to the input | – | 1 |
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
| Name | Description | Units |
|---|---|---|
x | State variable representing the filtered value | – |
Behavior
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"}
}
}
endFlattened 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"}
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests