The PID algorithmn in basic code suitable for implementation in Visual Basic or convertable to any programming language.
Buy and download my eBook: The
PID Control Algorithm: How It Works, How To Tune It, and How to Use It. 2nd ed.
62pp |
Get more details, buy, and download |
| ControlSim The PID controller and process simulator based on MS Excel spread sheets. $45.00 | Click here to get more details, buy, and download |
Improved PID codeThe method of implementing automatic reset described in using a positive feedback loop was first used with pneumatic analog controllers. It can easily be implemented digitally. There are several advantages of this algorithm implementation. Most important, it eliminates the problems that cause the output to pull away from a limit inappropriately. It also allows the use of external feedback when required. Variables: The PID emulation code: |
|
| 1.
IF Mode = AUTO
THEN 2.
InputD=Input+(Input-InputLast)*Derivative *60 derivative. 3.
InputLast
= Input 4.
Err=SetP-InputD
Error based
on reverse action. 5.
IF Action = DIRECT THEN Err=0 Err Change sign if direct. 6.
ENDIF 7.
OutPutTemp = Err*Gain+Feedback Calculate the gain time the error and add the feedback. 8.
IF OutPutTemp > 100 THEN OutPutTemp =100 Limit output
to between 9.
IF OutPutTemp < 0 THEN OutPutTemp =0
0 and 100 percent. 10.
OutP = OutPutTemp
The final
output of the controller. 11.
Feedback=Feedback+(OutP - Feedback)*ResetRate/60 12.
ELSE 13.
InputLast=Input While loop in
manual, stay ready for bumpless switch to Auto. 14.
Feedback=OutP 15.
ENDIF If external feedback is used, the variable OutP in line 11 is replaced with the variable containing the external feedback. |
|
Updated February 09, 2006 09:07:46 PM.
Privacy Policy
Provided by John Shaw.
Process Control Solutions