Generic bang-bang controller with hysteresis and minimum switch interval.
More...
#include <stdint.h>
Go to the source code of this file.
|
| #define | INIT_BANG_BANG(name, upper, lower, on_callback, off_callback, min_interval) |
| |
|
| void | bangbang_update (bangbang_t *controller, float value, uint32_t current_time) |
| | Update the state of the bang-bang controller based on the input value and current time. It calls the appropriate on/off functions if the state changes.
|
| |
Generic bang-bang controller with hysteresis and minimum switch interval.
- Author
- Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
◆ INIT_BANG_BANG
| #define INIT_BANG_BANG |
( |
| name, |
|
|
| upper, |
|
|
| lower, |
|
|
| on_callback, |
|
|
| off_callback, |
|
|
| min_interval ) |
Value:
.upper_bound = upper, \
.lower_bound = lower, \
.on_func = on_callback, \
.off_func = off_callback, \
.min_switch_interval = min_interval, \
.last_switch_ms = 0, \
.is_on = false \
}; \
static_assert(upper > lower, "Upper bound must be greater than lower bound for bang-bang controller");
◆ bangbang_update()
| void bangbang_update |
( |
bangbang_t * | controller, |
|
|
float | value, |
|
|
uint32_t | current_time ) |
Update the state of the bang-bang controller based on the input value and current time. It calls the appropriate on/off functions if the state changes.
- Parameters
-
| controller | Pointer to the bang-bang controller. |
| value | The current input value. |
| current_time | The current time in milliseconds. |