Hysteresis¶
y goes to 1 when u rises above uHigh and back to 0 when u falls below uLow (CDL Hysteresis), as a bistable state switching within tau
FastSmoothBuildings.Controls.Hysteresis, model (source)
Purpose
A hysteresis without events: the output y goes to 1 when the input u rises above
uHigh and back to 0 when it falls below uLow. Instead of the pre(y) of a
switching hysteresis, the memory is a state with two stable values, and the threshold is crossed by
regStep instead of an if: the model stays
an explicit ODE that CasADi and IPOPT can differentiate.
Equations
τ dy/dt = regStep(u − uthr, 1, 0, dU) −
y, uthr = uHigh + (uLow −
uHigh) y, y(0) = y_start.
The threshold moves with the output: it is uHigh at y = 0 and uLow at
y = 1. For uLow + dU < u < uHigh −
dU, both y = 0 and y = 1 are equilibria and the output keeps the one it is at. When u
comes within dU of the threshold, the target of y leaves its value; as y moves, the threshold
moves away from u and the switch completes, y relaxing to its new value with the time constant
τ.
Parameters
| Name | Default | Meaning |
|---|---|---|
uLow, uHigh | thresholds of the switches to 0 and to 1 | |
tau | 10 s | switching time |
dU | (uHigh − uLow)/10 |
half-width of the smooth transition at each threshold |
y_start | 0 | initial output |
tau and dU are the smoothing of the switch: the defaults reproduce a switching hysteresis,
and a model exported for calibration or optimal control can lengthen tau and widen dU.
The band where the output is held is not empty only while dU < (uHigh −
uLow)/2.
Relation to Buildings
The Hysteresis block of CDL, with the output a Real state between 0 and 1 instead of a
Boolean.
Use
The output is the variable y, read as hys.y; u is usually bound in the
declaration. It switches the on/off emission control
EmissionOnOff, the demand of
BoilerDemand, the pump of
CollectorControl and the heating season and
buffer charging of HeatPumpControl. See
Validation.Hysteresis.
Parameters¶
| Parameter | Type | Unit | Default | Description |
|---|---|---|---|---|
| uLow | Real | Threshold of the switch to 0 | ||
| uHigh | Real | Threshold of the switch to 1 | ||
| tau | Real | s | 10 | Switching time |
| dU | Real | (uHigh - uLow)/10 | Half-width of the smooth transition of the switch | |
| y_start | Real | 0 | Initial output |
Revisions¶
- October 2026: moved from trano's
FastModel.Controls.