Humidistat
Arduino firmware for a humidistat (humidity controller)
Loading...
Searching...
No Matches
Controller.h
Go to the documentation of this file.
1#ifndef HUMIDISTAT_CONTROLLER_H
2#define HUMIDISTAT_CONTROLLER_H
3
4#include <stdint.h>
5
6#include "PID.h"
7#include "../EEPROMConfig.h"
8
12protected:
15
16 unsigned long sensorLastRead = 0;
17
18public:
19 bool active = false;
20
21 double pv = 0;
22 double sp;
23 double cv;
24
36 Controller(const ConfigStore *cs, double Kp, double Ki, double Kd, double Kf, uint16_t dt, double cvMin,
37 double cvMax, double defaultSP, double defaultCV);
38
43 void getTerms(double &pTerm, double &iTerm, double &dTerm) const;
44
47 void update();
48
51
55};
56
57
58#endif //HUMIDISTAT_CONTROLLER_H
Base class for a controller. Owns a PID instance, and holds a reference to a ConfigStore instance.
Definition Controller.h:11
double sp
Setpoint.
Definition Controller.h:22
const ConfigStore * getConfigStore()
Get a pointer to the ConfigStore instance.
bool active
Definition Controller.h:19
Controller(const ConfigStore *cs, double Kp, double Ki, double Kd, double Kf, uint16_t dt, double cvMin, double cvMax, double defaultSP, double defaultCV)
Constructor.
Definition Controller.cpp:3
double pv
Process variable.
Definition Controller.h:21
void update()
Run the controller: Typically reads a sensor, runs a cycle of the PID loop and drives some actuator.
const ConfigStore & cs
Definition Controller.h:14
double cv
Control variable.
Definition Controller.h:23
void getTerms(double &pTerm, double &iTerm, double &dTerm) const
Get the three PID terms by reference.
Definition Controller.cpp:7
void updatePIDParameters()
Update the PID parameters from the configStore.
unsigned long sensorLastRead
Definition Controller.h:16
PID controller in parallel form implemented in floating-point arithmetic. Features Derivative-on-Meas...
Definition PID.h:8
Config store containing variables, which can be stored in EEPROM.
Definition EEPROMConfig.h:7