OverflowIntegratorFE Icon
DiscretePrimitives.OverflowIntegratorFE
OverflowIntegratorFE(; name, y_min = -1e6, y_max = 1e6)A discrete-time forward Euler integrator with saturation limits and reset capability.
Arguments
name: Component namey_min: Minimum output value (default: -1e6)y_max: Maximum output value (default: 1e6)
Variables
u(t): Input signal to integrateic(t): Initial condition inputreset(t): Reset signal (boolean, when true output is reset to reset_value)y(t): Integrated and saturated output signalreset_value(t): Internal state for tracking reset valueip(t): Internal parameter (unused, for compatibility)y_candidate(t): Candidate output before saturationy_sat(t): Saturated output value
Description
Implements forward Euler integration with output saturation: y[k] = clamp(y[k-1] + u[k] * dt, ymin, ymax) When reset is active, output is set to the initial condition value. Prevents integrator windup by clamping output to specified limits.
Usage
PrimitiveComponents.DiscretePrimitives.OverflowIntegratorFE(y_max=1e6, y_min=-1e6)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
y_max | – | 1000000 | |
y_min | – | -1000000 |
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)ic- This connector represents a real signal as an input to a component (RealInput)reset- This connector represents a boolean signal as an input to a component (BooleanInput)
Behavior
\[ \begin{align} \mathtt{y\_candidate}\left( t \right) &= Shift(t, -1)\left( y\left( t \right) \right) + u\left( t \right) ModelingToolkit.SampleTime \\ \mathtt{y\_sat}\left( t \right) &= clamp\left( \mathtt{y\_candidate}\left( t \right), \mathtt{y\_min\_p}, \mathtt{y\_max\_p} \right) \\ y\left( t \right) &= ifelse\left( \mathtt{reset}\left( t \right), \mathtt{reset\_value}\left( t \right), ifelse\left( isnan\_wrapper\left( \mathtt{y\_sat}\left( t \right) \right), \mathtt{reset\_value}\left( t \right), \mathtt{y\_sat}\left( t \right) \right) \right) \\ \mathtt{reset\_value}\left( t \right) &= ifelse\left( isnan\_wrapper\left( Shift(t, -1)\left( \mathtt{reset\_value}\left( t \right) \right) \right), \mathtt{ic}\left( t \right), Shift(t, -1)\left( \mathtt{reset\_value}\left( t \right) \right) \right) \\ \frac{\mathrm{d} \mathtt{dummy.l}\left( t \right)}{\mathrm{d}t} &= 0 \end{align} \]
Source
"""
OverflowIntegratorFE(; name, y_min = -1e6, y_max = 1e6)
A discrete-time forward Euler integrator with saturation limits and reset capability.
# Arguments
- `name`: Component name
- `y_min`: Minimum output value (default: -1e6)
- `y_max`: Maximum output value (default: 1e6)
# Variables
- `u(t)`: Input signal to integrate
- `ic(t)`: Initial condition input
- `reset(t)`: Reset signal (boolean, when true output is reset to reset_value)
- `y(t)`: Integrated and saturated output signal
- `reset_value(t)`: Internal state for tracking reset value
- `ip(t)`: Internal parameter (unused, for compatibility)
- `y_candidate(t)`: Candidate output before saturation
- `y_sat(t)`: Saturated output value
# Description
Implements forward Euler integration with output saturation:
y[k] = clamp(y[k-1] + u[k] * dt, y_min, y_max)
When reset is active, output is set to the initial condition value.
Prevents integrator windup by clamping output to specified limits.
"""
external component OverflowIntegratorFE@[input inclk, input outclk]
u = RealInput@[inclk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 450, "x2": 100, "y2": 550, "rot": 0}
},
"tags": []
}
}
y = RealOutput@[outclk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 900, "y1": 450, "x2": 1000, "y2": 550, "rot": 0}
},
"tags": []
}
}
ic = Dyad.RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 850, "x2": 100, "y2": 950, "rot": 0}
},
"tags": []
}
}
reset = Dyad.BooleanInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 40, "x2": 100, "y2": 140, "rot": 0}
},
"tags": []
}
}
parameter y_max::Real = 1e6
parameter y_min::Real = -1e6
relations
metadata {
"Dyad": {
"icons": {"default": "dyad://PrimitiveComponents/OverflowIntegratorAnimated.svg"}
}
}
end
Flattened Source
"""
OverflowIntegratorFE(; name, y_min = -1e6, y_max = 1e6)
A discrete-time forward Euler integrator with saturation limits and reset capability.
# Arguments
- `name`: Component name
- `y_min`: Minimum output value (default: -1e6)
- `y_max`: Maximum output value (default: 1e6)
# Variables
- `u(t)`: Input signal to integrate
- `ic(t)`: Initial condition input
- `reset(t)`: Reset signal (boolean, when true output is reset to reset_value)
- `y(t)`: Integrated and saturated output signal
- `reset_value(t)`: Internal state for tracking reset value
- `ip(t)`: Internal parameter (unused, for compatibility)
- `y_candidate(t)`: Candidate output before saturation
- `y_sat(t)`: Saturated output value
# Description
Implements forward Euler integration with output saturation:
y[k] = clamp(y[k-1] + u[k] * dt, y_min, y_max)
When reset is active, output is set to the initial condition value.
Prevents integrator windup by clamping output to specified limits.
"""
external component OverflowIntegratorFE
u = RealInput@[inclk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 450, "x2": 100, "y2": 550, "rot": 0}
},
"tags": []
}
}
y = RealOutput@[outclk]() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 900, "y1": 450, "x2": 1000, "y2": 550, "rot": 0}
},
"tags": []
}
}
ic = Dyad.RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 850, "x2": 100, "y2": 950, "rot": 0}
},
"tags": []
}
}
reset = Dyad.BooleanInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 40, "x2": 100, "y2": 140, "rot": 0}
},
"tags": []
}
}
parameter y_max::Real = 1e6
parameter y_min::Real = -1e6
relations
metadata {
"Dyad": {
"icons": {"default": "dyad://PrimitiveComponents/OverflowIntegratorAnimated.svg"}
}
}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses
- Tests