brewco/pid.h

changeset 434
eb724767860d
child 435
4b1ed6897d80
equal deleted inserted replaced
433:1421ece29197 434:eb724767860d
1 #ifndef PID_H
2 #define PID_H
3
4 #define PID_MODE_NONE 0 /* Process control off */
5 #define PID_MODE_AUTO 1 /* Process control auto */
6 #define PID_MODE_BOO 2 /* Process control Bang On/Off */
7
8 #define PID_TIMES 60 /* 60 calculations per minute */
9 #define PID_WINDUP_GUARD 10.0 /* Error windup guard */
10
11
12 typedef struct _pid_var {
13 double iMax; /* Maximum allowable integrator state */
14 double iGain; /* Integral gain */
15 double pGain; /* Proportional gain */
16 double dGain; /* Derivative gain */
17
18 double Input; /* Input value */
19 double Err; /* Error, diff between input and set point */
20 double ErrLast; /* Error from last pass */
21 double iState; /* Error from next last pass */
22 double SetP; /* Set point */
23 double OutP; /* Output of PID algorithm */
24 int Mode; /* Value is 'PID_AUTO' if loop is automatic */
25 } pid_var;
26
27
28 void InitPID( pid_var *);
29 void UpdatePID( pid_var *);
30
31 #endif

mercurial