|
Humidistat
Arduino firmware for a humidistat (humidity controller)
|
Base class for a controller. Owns a PID instance, and holds a reference to a ConfigStore instance. More...
#include <Controller.h>
Public Member Functions | |
| Controller (const ConfigStore *cs, double Kp, double Ki, double Kd, double Kf, uint16_t dt, double cvMin, double cvMax, double defaultSP, double defaultCV) | |
| Constructor. | |
| void | getTerms (double &pTerm, double &iTerm, double &dTerm) const |
| Get the three PID terms by reference. | |
| void | update () |
| Run the controller: Typically reads a sensor, runs a cycle of the PID loop and drives some actuator. | |
| void | updatePIDParameters () |
| Update the PID parameters from the configStore. | |
| const ConfigStore * | getConfigStore () |
| Get a pointer to the ConfigStore instance. | |
Public Attributes | |
| bool | active = false |
| double | pv = 0 |
| Process variable. | |
| double | sp |
| Setpoint. | |
| double | cv |
| Control variable. | |
Protected Attributes | |
| PID | pid |
| const ConfigStore & | cs |
| unsigned long | sensorLastRead = 0 |
Base class for a controller. Owns a PID instance, and holds a reference to a ConfigStore instance.
Definition at line 11 of file Controller.h.
| Controller::Controller | ( | const ConfigStore * | cs, |
| double | Kp, | ||
| double | Ki, | ||
| double | Kd, | ||
| double | Kf, | ||
| uint16_t | dt, | ||
| double | cvMin, | ||
| double | cvMax, | ||
| double | defaultSP, | ||
| double | defaultCV ) |
Constructor.
| cs | Pointer to a ConfigStore instance |
| Kp | Proportional gain |
| Ki | Integral gain (in 1/s) |
| Kd | Derivative gain (in s) |
| Kf | Feed-forward gain |
| dt | Timestep (in ms) |
| cvMin | Lower limit for control value |
| cvMax | Upper limit for control value |
| defaultSP | Default value for the setpoint |
| defaultCV | Default value for the control variable |
Definition at line 3 of file Controller.cpp.
| const ConfigStore * Controller::getConfigStore | ( | ) |
Get a pointer to the ConfigStore instance.
Definition at line 13 of file Controller.cpp.
| void Controller::getTerms | ( | double & | pTerm, |
| double & | iTerm, | ||
| double & | dTerm ) const |
Get the three PID terms by reference.
| pTerm | |
| iTerm | |
| dTerm |
Definition at line 7 of file Controller.cpp.
| void Controller::update | ( | ) |
Run the controller: Typically reads a sensor, runs a cycle of the PID loop and drives some actuator.
| void Controller::updatePIDParameters | ( | ) |
Update the PID parameters from the configStore.
| bool Controller::active = false |
Definition at line 19 of file Controller.h.
|
protected |
Definition at line 14 of file Controller.h.
| double Controller::cv |
Control variable.
Definition at line 23 of file Controller.h.
|
protected |
Definition at line 13 of file Controller.h.
| double Controller::pv = 0 |
Process variable.
Definition at line 21 of file Controller.h.
|
protected |
Definition at line 16 of file Controller.h.
| double Controller::sp |
Setpoint.
Definition at line 22 of file Controller.h.