From - Thu May 8 18:50:36 1997 Path: news.fe.up.pt!ciup2.ncc.up.pt!news.rccn.net!Portugal.EU.net!mcvax!EU.net!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!news.apfel.de!fu-berlin.de!unlisys!not-for-mail From: Klaus Moellmann Newsgroups: sci.engr.control Subject: Re: PID Algorithms Date: Sat, 03 May 1997 07:58:16 -0100 Organization: Unlimited Surprise Systems, Berlin Lines: 152 Message-ID: <336AFE28.34B4@berlin.snafu.de> References: <5kdvf1$r27@camel1.mindspring.com> NNTP-Posting-Host: n243-168.berlin.snafu.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailer: Mozilla 2.02 [de] (Win16; I) Brian & Amy Kuhnel wrote: > = > I was hoping someone may be able to provide mathematical equations or > functions which perform PID control. Information on books or other > references containing such information would also be helpful. Thanks > in advance, Brian. Try this PI controller. PI is enough for most purposes. It uses speed = algorithm for several reasons. It has a sophisticated feed forward input = Z. There is a bumbless switch-over manual to automatic. You have to = realize a bumbless automatic-manual yourself. ---------------------------------------------------------------------- /* RESET */ if (IR) { if (errors at input) goto 'error handling'; Y =3D YR; if (YR > UL) Y =3D UL; if (YR < LL) Y =3D LL; E_old =3D 0; = Z_old =3D Z; = goto 'error handling'; }; /* 'No module-enable' or 'first run' */ if ('No module-enable' or 'first run') { E_old =3D E; = Z_old =3D Z; = goto End; }; /* manual/automatic */ if (errors at input) goto 'error handling'; if (TN =3D 0) { 'error handling'; goto End; }; /* manual */ if (IM) { Y =3D YM; E_old =3D E; = Z_old =3D Z; = goto 'error handling'; }; /* automatic */ /* limit was active */ if (LIAC) { LIAC =3D 0; E_old =3D E; = Z_old =3D Z; = goto 'error handling'; }; = /* upper limit */ if (Y =3D UL) und (Z_old <> UL) { Y =3D Y + KP * (E - E_old + dt / TN * (E + E_old) / 2); goto Algo_End; }; /* lower limit */ if (Y =3D LL) und (Z_old <> LL) { Y =3D Y + KP * (E - E_old + dt / TN * (E + E_old) / 2); goto Algo_End; }; Y =3D Y + KP * (E - E_old + dt / TN * (E + E_old) / 2) + Z - Z_old; Algo_End: E_old =3D E; = Z_old =3D Z; = if (Y < LL) = { Y =3D LL; LIAC =3D 1; }; if (Y > UL) { Y =3D UL; LIAC =3D 1; }; 'error handling': if (error) error message; ---------------------------------------------------------------------- The floating point signals are as follows: E errors signal (setpoint - actual value) Z feed forward input YR reset value for controller output YM manual value for controller output Y controller output KP controller gain TN reset time dt sample time UL upper limit for output LL lower limit for output The binary signals: IR module reset IM switch to manual LIAC limit indicator The following books were quite useful to me: [1] Regelungstechnik; Otto F=F6llinger; 6.Aufl. 1990; ISBN 3-7785-1808-9; = H=FCthig Buch Verlag GmbH, Heidelberg; Seite 237 [2] Grundlagen der linearen Regelungstechnik I; Irmfried Hartmann, = Christian Landgraf; Skript zur Vorlesung Regelungstechnik 1979; = Technische Universit=E4t Berlin; Seite 202 [3] Principles and Practice of Automatic Process Control; Carlos A. = Smith, Armando B. Corripio; 1985; ISBN 0-471-61633-8; John Wiley & Sons, = Inc., New York, New York 10158; page 253 [4] La r=E9gulation industrielle; Jean-Marie Flaus; 1994; ISBN = 2-86601-441-3; Herm=E8s, Paris; chapitre 1 -- = Klaus Moellmann Moelli@t-online.de Heimstr.21 10965 Berlin