--- a/thermferm/pid.h Sat May 16 17:39:30 2015 +0200 +++ b/thermferm/pid.h Sun May 17 19:34:55 2015 +0200 @@ -9,6 +9,7 @@ #define PID_TYPE_COOL 1 /* PID is used for cooling */ #define PID_TIMES 60 /* 60 calculations per minute */ +#define PID_WINDUP_GUARD 10.0 /* Error windup guard */ typedef struct _pid_var { @@ -19,11 +20,9 @@ double idleRange; /* Idle range */ double Input; /* Input value */ - double InputD; /* Process input plus derivative */ - double InputLast; /* Process input from last pass */ double Err; /* Error, diff between input and set point */ double ErrLast; /* Error from last pass */ - double ErrLastLast; /* Error from next last pass */ + double iState; /* Error from next last pass */ double SetP; /* Set point */ double OutP; /* Output of PID algorithm */ int Mode; /* Value is 'PID_AUTO' if loop is automatic */