PID Implementation
From ECCWiki
The BCS-460 implements six independent fully programmable PID control algorithms. Generally, each PID loop is used to control its respective Output, using an associated temperature input for process feedback.
Contents |
[edit] Algorithm
The PID control scheme is named after its three correcting terms, whose sum constitutes the PID output, a number from 0-100%.
pid_output = pTerm + iTerm - dTerm;
where
pTerm = pGain * err;
iTerm = iGain * iState;
dTerm = dGain * (curr_temp - previous_temp);
This algorithm updates the pid_output every 'PID Sample Period' seconds. Minimum value is 0.1sec. Systems with slower response times will want longer settings to avoid "windup", where systems with faster response times will want faster settings to improve performance.
Gains are programmed in the System Settings page. The resulting terms can be monitored in the PID Output Display section of the Datalog page. The iState can be capped using the Maximum and Minimum Integral settings to avoid the effects of windup.
For additional information see http://en.wikipedia.org/w/index.php?title=PID_controller
[edit] Firmware v2.0 and newer
Firmware v2.0 introduced true pulse width modulation (PWM) control of the outputs. Each PID algorithm is updated every 'PID Sample Period'. Each output has its own unique PWM period, set by the 'Output Period' parameter. The PID output directly controls the percentage of the pulse within the output period. This allows the user to set the PID Sample period to align with the physical time constant of the system, and separately adjust the Output Period to be optimal for the heating (or cooling) device controlled.
Users may also switch PID parameters on a state-by-state basis, by applying one PID algorithm's settings to a different output.
[edit] Firmware v1.3 and older
For versions v1.3 and older, a simpler (but extremely effective) way of asserting the PID output was implemented. The PID sample period and the Output period are controlled by the same parameter.
The Output is switched on whenever the algorithm is above 50%, and off when its below 50%. This is a somewhat unconventional way to use a PID, since an algorithm result of 20% will be off (not on 20% of the time). But in practice it works quite well. The PID output quickly climbs above 50 when heat is needed, and then quickly falls off when it approaches the setpoint, regulated by the PID coefficients. So if 20% power is needed to hold a setpoint, the algorithm will cross the 50 switch point on average 20% of the time.
This method has the benefit of simplifying the PID tuning process. It also usually results in less Output switching, which can be desirable in certain systems. For this reason, a backward compatibility setting is available that forces PIDs to revert to this behavior.
Keep in mind, in this mode the PID Sample Period will also affect the other output modes like Duty Cycle and Differential. Duty Cycle (in this mode) runs on an independent 10 second fixed timer. Rates longer than 1sec don't fit properly into the 10sec window. When set at 1sec, the minimum granularity of the Duty Cycle is 10%. Faster settings give better Duty Cycle granularity.
