1#ifndef HUMIDISTAT_PID_H
2#define HUMIDISTAT_PID_H
30 double clip(
double value)
const;
48 PID(
const double *
pv,
double *
cv,
const double *
sp,
double Kp,
double Ki,
double Kd,
double Kf, uint16_t
dt,
PID controller in parallel form implemented in floating-point arithmetic. Features Derivative-on-Meas...
double & cv
Control variable.
void setAuto(bool inAuto)
Set the mode of the controller.
void init()
Method to be called when the controller goes from manual to auto mode for proper bumpless transfer.
double clip(double value) const
Clip value to [cvMin, cvMax].
const double & sp
Setpoint.
double a
Smoothing factor for EWA filter for derivative.
double lastE
Last value of error.
PID(const double *pv, double *cv, const double *sp, double Kp, double Ki, double Kd, double Kf, uint16_t dt, double cvMin, double cvMax, double a)
Constructor.
bool compute()
Run a cycle of the PID loop.
double integral
Integral of pv.
double lastPv
Last value of pv.
double lastDPV
Last value of derivative term.
double cvMax
Lower/upper limits for cv.
const double & pv
Process variable.
void setGains(double Kp, double Ki, double Kd, double Kf, uint16_t dt)
Set the gains and timestep.