thermferm/pid.h

changeset 363
468ec0d96cce
parent 362
c92651a54969
child 492
750f2468dec5
equal deleted inserted replaced
362:c92651a54969 363:468ec0d96cce
7 7
8 #define PID_TYPE_HEAT 0 /* PID is used for heating */ 8 #define PID_TYPE_HEAT 0 /* PID is used for heating */
9 #define PID_TYPE_COOL 1 /* PID is used for cooling */ 9 #define PID_TYPE_COOL 1 /* PID is used for cooling */
10 10
11 #define PID_TIMES 60 /* 60 calculations per minute */ 11 #define PID_TIMES 60 /* 60 calculations per minute */
12 #define PID_WINDUP_GUARD 10.0 /* Error windup guard */
12 13
13 14
14 typedef struct _pid_var { 15 typedef struct _pid_var {
15 double iMax; /* Maximum allowable integrator state */ 16 double iMax; /* Maximum allowable integrator state */
16 double iGain; /* Integral gain */ 17 double iGain; /* Integral gain */
17 double pGain; /* Proportional gain */ 18 double pGain; /* Proportional gain */
18 double dGain; /* Derivative gain */ 19 double dGain; /* Derivative gain */
19 double idleRange; /* Idle range */ 20 double idleRange; /* Idle range */
20 21
21 double Input; /* Input value */ 22 double Input; /* Input value */
22 double InputD; /* Process input plus derivative */
23 double InputLast; /* Process input from last pass */
24 double Err; /* Error, diff between input and set point */ 23 double Err; /* Error, diff between input and set point */
25 double ErrLast; /* Error from last pass */ 24 double ErrLast; /* Error from last pass */
26 double ErrLastLast; /* Error from next last pass */ 25 double iState; /* Error from next last pass */
27 double SetP; /* Set point */ 26 double SetP; /* Set point */
28 double OutP; /* Output of PID algorithm */ 27 double OutP; /* Output of PID algorithm */
29 int Mode; /* Value is 'PID_AUTO' if loop is automatic */ 28 int Mode; /* Value is 'PID_AUTO' if loop is automatic */
30 int Type; /* Value is 'HEAT' or 'COOL' */ 29 int Type; /* Value is 'HEAT' or 'COOL' */
31 } pid_var; 30 } pid_var;

mercurial