WrapToZero Icon
Discontinuous.WrapToZero
Wrap to zero block that sets output to zero when input exceeds threshold.
When the input exceeds a threshold, the output wraps to zero:
- If u > threshold: y = 0
- If u <= threshold: y = u
Useful for implementing upper limit cutoffs.
Arguments: threshold - Maximum allowed input value before wrapping to zero
Usage
PrimitiveComponents.Discontinuous.WrapToZero(threshold=1.0)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
threshold | Threshold for wrapping to zero | – | 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)
Behavior
\[ \begin{align} y\left( t \right) &= ifelse\left( u\left( t \right) > \mathtt{threshold}, 0, u\left( t \right) \right) \end{align} \]
Source
"""
Wrap to zero block that sets output to zero when input exceeds threshold.
When the input exceeds a threshold, the output wraps to zero:
- If u > threshold: y = 0
- If u <= threshold: y = u
Useful for implementing upper limit cutoffs.
Arguments:
`threshold` - Maximum allowed input value before wrapping to zero
"""
component WrapToZero
"Input signal port"
u = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 450, "x2": 100, "y2": 550, "rot": 0}
}
}
}
"Output signal port"
y = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 900, "y1": 450, "x2": 1000, "y2": 550, "rot": 0}
}
}
}
"Threshold for wrapping to zero"
parameter threshold::Real = 1.0
relations
y = ifelse(u > threshold, 0.0, u)
metadata {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/WrapToZero.svg"}}}
end
Flattened Source
"""
Wrap to zero block that sets output to zero when input exceeds threshold.
When the input exceeds a threshold, the output wraps to zero:
- If u > threshold: y = 0
- If u <= threshold: y = u
Useful for implementing upper limit cutoffs.
Arguments:
`threshold` - Maximum allowed input value before wrapping to zero
"""
component WrapToZero
"Input signal port"
u = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 0, "y1": 450, "x2": 100, "y2": 550, "rot": 0}
}
}
}
"Output signal port"
y = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 900, "y1": 450, "x2": 1000, "y2": 550, "rot": 0}
}
}
}
"Threshold for wrapping to zero"
parameter threshold::Real = 1.0
relations
y = ifelse(u > threshold, 0.0, u)
metadata {"Dyad": {"icons": {"default": "dyad://PrimitiveComponents/WrapToZero.svg"}}}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses
- Tests