| ??? 07/29/02 00:54 Read: times |
#26451 - RE: PID controller with 8051 |
Hello Hemanth,
Below a PID control algorithm non very scientific but functional. Convert to your prog. language and try it. ; LFFMPID ; PID routines for refr/heat ; By Luiz Fernando Mosca ; Ibracon - Brazil ; Inputs: ; ; _VAR= Input Var(Sensor) ; _SPT= Setpoint Adj(Parm) ; _INT= Integer Var(Parm) in RPM repeat per minute time loop depend ; _DIF= Differential Var(Parm) ; _ZMT= Dead Zone (see diag.) ; _BTA= Proportional Heating Band ; _BTR= Proportional Refrigeration Band ; RREF for refrigeration out IF _AQU_OLD = 0 THEN _ISUM=_ISUMR _OLDVAR=_OLDTEMP _PERROR=(_SPT + _ZMT/2) - _VAR IF _BTR<=0 THEN _ERRO=0 ELSE _ERRO=(_PERROR / _BTR) * 100 _INTG=.01 * _ERRO _ISUM=-1 * (_INT / 100) * _INTG + _ISUM IF _ERRO >= 0 THEN _ISUM=0 IF _ISUM < 0 THEN _ISUM=0 ; Anti reset windup function (optional) IF _ISUM > 100 THEN _ISUM=100 _DERIV=_VAR - _OLDVAR :_OLDVAR=_VAR _OUT= -1 * _ERRO + (_DERIV * _DIF) + _ISUM IF _OUT<0 THEN _OUT=0 IF _OUT>100 THEN _OUT=100 _ISUMR=_ISUM _OLDTEMP=_OLDVAR _OUTREF=_OUT ELSE _REF_OLD = 0 _OUTREF = 0 ENDIF ; RCAL for heating out IF _REF_OLD = 0 THEN _ISUM=_ISUMA _OLDVAR=_OLDTEMP _PERROR=_VAR - (_SPT - _ZMT/2) IF _BTA<=0 THEN _ERRO=0 ELSE _ERRO=(_PERROR / _BTA) * 100 _INTG=.01 * _ERRO _ISUM=-1 * (_INT / 100) * _INTG + _ISUM IF _ERRO >= 0 THEN _ISUM=0 IF _ISUM < 0 THEN _ISUM=0 ; Anti reset windup function (optional) IF _ISUM > 100 THEN _ISUM=100 _DERIV=_OLDVAR - _VAR :_OLDVAR=_VAR _OUT= -1 * _ERRO + (_DERIV * _DIF) + _ISUM IF _OUT<0 THEN _OUT=0 IF _OUT>100 THEN _OUT=100 _ISUMA=_ISUM _OLDTEMP=_OLDVAR _OUTAQU=_OUT ELSE _AQU_OLD = 0 _OUTAQU = 0 ENDIF ; Outputs: ; ; _OUTREF= Output to Refrigeration Actuator ; _OUTAQU= Output to Heating Actuator ; Output Diagram: ; ; _SPT ; _OUTAQU | _OUTREF ; ------- | --------- ; | / ; | / ; | / ; | / ; | / ; | / ; | / ; ---------------------------|-----/------------------------->_VAR ; -------|--------------|-----------|---------------|---------- ; _BTA _ZMT _BTR ; USING AND DISTRIBUTING THE LFFMPID PID ROUTINES ; =================================================== ; ;LFFMPID may be used in any way, for any purpose, at no cost. It may be ;distributed by any means, provided that author mention or the original ;files as supplied by the author remain intact and no charge is made other ;than for reasonable distribution costs. ; ;You do not need to register to use LFFMPID, or buy a licence to use it, ;but we would appreciate your feedback. ; ;LFFMPID may not be distributed with any commercial product without a prior ;license agreement with Ibracon Controles Eletronicos Ltda. ;email: ibracon@inf.ufrgs.br ; ; THE INFORMATION AND CODE PROVIDED IS PROVIDED AS IS WITHOUT WARRANTY ; OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ; PURPOSE. IN NO EVENT SHALL IBRACON C.E.LTDA. BE LIABLE FOR ANY DAMAGES ; WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS ; OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF IBRACON C.E.LTDA. HAS ; BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ; ;Author: Luiz Fernando Mosca ; lfmosca@portoweb.com.br ; ;---------------------------------------------------------------------------- Best regards. Luiz Fernando Mosca lfmosca@portoweb.com.br |
| Topic | Author | Date |
| PID controller with 8051 | 01/01/70 00:00 | |
| RE: PID controller with 8051 | 01/01/70 00:00 | |
| RE: PID controller with 8051 | 01/01/70 00:00 | |
| RE: PID controller with 8051 | 01/01/70 00:00 | |
| RE: PID controller with 8051 | 01/01/70 00:00 | |
| RE: PID controller with 8051... A.I. !!! | 01/01/70 00:00 | |
| RE: PID controller with 8051, doable | 01/01/70 00:00 | |
| RE: PID controller with 8051 | 01/01/70 00:00 | |
RE: PID controller with 8051 | 01/01/70 00:00 |



