PID Specification

C

Thread Starter

Chothani, Chetan

All,

Attached please find a text file detailing the proposed implementation of the PID block.

Issues at large:
1) Derivative Filtering: Any ideas are welcome on this subject. Please
include discrete Time-Domain
form in your comments. Note that if input filtering is enabled Derivative
filtering will not be required.

2) Dead-Time compensation: Any ideas are welcome on this subject. Please
include discrete Time-Domain
form in your comments.

Please review the spec and send your comments.

I'll be out for most of this week. I'll reconcile the comments in the final
spec and then we can include it in the
documents directory in the CVS.

Once this is done I'll collaborate with Mario to implement the code. He has
a prototype coded and we'll build
on this prototype.

chetan

<<PID Spec for LPlc.TXT>>

======================================================
Chetan Chothani Tel : 724-746-4969 x2118
Adaptive Resources Fax: 724-746-9260
P.O.Box 62245 E-mail: [email protected]
Pittsburgh, PA 15241 Internet: www.adaptiveresources.com
======================================================

_______________________________________________
LinuxPLC mailing list
[email protected]c.org
http://linuxplc.org/mailman/listinfo/linuxplc
 
J

Johan Bengtsson

Derivate filtering:

Here is one implementation that works, theoretically it is just a first order lowpass filter put before (or after) the derivate part but anyway...

//inputs:
double lead; //the ratio between derivate time and derivate
//filter time constant, usually kept at a value
//in the range 5-15 (no unit)
double Kc; //proportional gain
double Td; //derivate rime (seconds)
double deltaT; //time since last update (seconds)
double currVal;//current value (control error or process value)
double lastVal;//previous value (same as above)


//output, the value should be retained between updates:
double dDel;


//local temporary variables:
double beta,gamma;

//if deltaT always is the same it is possible to calculate
//the above variables once, otherwise they have to be
//calculated each run

//the code assumes deltaT>0, if that is not the case (due to
//timer resolution) the entire part should be skipped and
//lastVal NOT be changed
//the code will probably not work good if deltaT>Td/lead
//and should preferably be kept less than half this value


if (lead==0 || Td==0) //failback if no derivate or
{ // no filter
beta=Td/deltaT;
gamma=0;
}
else //normal case, derivate action with filter
{
beta=Td/(Td/lead+deltaT);
gamma=beta/lead;
}

dDel=dDel*gamma+beta*(lastVal-currVal)*Kc;



/Johan Bengtsson


----------------------------------------
P&L, the Academy of Automation
Box 252, S-281 23 H{ssleholm SWEDEN
Tel: +46 451 49 460, Fax: +46 451 89 833
E-mail: [email protected]
Internet: http://www.pol.se/
----------------------------------------


_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
 
Mario, Chetan:
If you could access the Bailey configuration blocks, most of your project would done and well.
I don't want to get involved too deeply.
In the analog controller, it was catastrophic mistake to use derivative on flow loops (SQRT).
How can you think of that in numerical maths ?
The signal is finaly scaled 0-1.
For mid scale reading a simple conversion on the output will convert to -1..0..+1
SQRT on very low signal will nearly output infinite relative error. Filtering should be performed on the input. Numerical processing of the PID performs filtering by itself. Filtering is reserved for readings.
Numerical filtering goes in pair with the "Gramm polynomial" approximation of the discrete data.
Dead time and time delay are not synonymous.
Integral mode provides substantial amount of
time lag (delay).

Time domain ?
Probably you mean the composite relation
loop scan and number of samples ?

The PID on that forum apparents with similar questions on other maths forums about "Special Functions".
There exists an immense compendium of "Special Functions". What are they ?

They are general or particular solutions of the
Generalised Second Order Differetial Equation involving parameters. After all, it's what a closed loop is. Good luck, the list, if you manage to swin in that.
Yet, I have found only some of the most common Special Functions (see Mathcad Professional 8).
However, all the algorythims are available (in Fortran) from ACM (American Computing Machinery)
One must purchase.
[email protected]
 
Top