6 :
Controller(cs, cs->FC_Kp, cs->FC_Ki, cs->FC_Kd, cs->FC_Kf, cs->FC_dt, cs->S_lowValue, 1, 0, cs->S_lowValue),
Base class for a controller. Owns a PID instance, and holds a reference to a ConfigStore instance.
double pv
Process variable.
double cv
Control variable.
unsigned long sensorLastRead
void updatePIDParameters()
FlowController(const FlowSensor *fs, const ConfigStore *cs, uint8_t solenoidPin, uint8_t pwmRes)
Constructor.
const uint8_t solenoidPin
Read flow rate using a Omron D6F-P0010 MEMS flow sensor.
double readFlowrate() const
Read the flow rate.
void setAuto(bool inAuto)
Set the mode of the controller.
bool compute()
Run a cycle of the PID loop.
void setGains(double Kp, double Ki, double Kd, double Kf, uint16_t dt)
Set the gains and timestep.
constexpr T ipow(T base, unsigned int pow)
Constexpr function for computing integer power.
Config store containing variables, which can be stored in EEPROM.
double FC_Kp
Flow controller PID parameters.
double S_lowValue
Minimum solenoid duty cycle (deadband)
uint16_t dt
Global interval for PID/logger (based on polling rate of sensor, in millis)