# PID control using S7 200 PLC

S

#### student

hi

i am a PG student doing a project in PID control using PLC..i am having a siemens S7 200 PLC with me...i want to develop a mathematical model and implement the same using S7 200 PLc..any suggestions please..

J

#### jmG

If you trust yourself about the math background, OK. But your PLC may still be in grade 6 school !!! You see what I mean.
I doubt you can do any modeling in PLC. Unless the model comes from books and the PLC can manipulate and you would need only playing with few coefficients.

J

#### Johan Bengtsson

Search the archives: this, and similar, questions have been discussed several times already. If you, after reading those, still have more specific questions please do ask them.

Some quick notes:
calculate the error as difference between SP and PV
P part = error*gain
I part = integrated value of P part
D part = derivated value of P part (or derivated value of -PV*error)

then you thow in some filters (at input and at D) some antiwindup and possibly other stuff.

Also note: you need an analog input filter before the A/D (one resistor and one capacitor will do, R*C>=1.3*scantime)
Also note: you need the scantime when calculating I and D
check your units so you use the same time unit in all places (Itime, Dtime and scantime)

/Johan Bengtsson

----------------------------------------
P&L, Innovation in training
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/
----------------------------------------

J

#### jmG

For modeling, D & I must be trustable, i.e: the accumulator of size 5 or above. Then I & D are self filtered. I think the person would like to see something based on Laplace models. Matlab is well equipped for PID simulation/modeling.
If in your plant you have found that filtering was helping, the conclusion is that the system does not perform derivative. Not only the derivative is insufficient, it is an adverse tool: in that case, don't use derivative.

J

#### Johan Bengtsson

What?

I might be answering the wrong question, but I answered it as I interpreted it, you are of course free to answer it as you interpret it but the given answer is the one I think suits best and the one I am offering.

I think the one asking the question wanted to implement a PID controller (in this case in a PLC, but it does really not matter) I didn't perhaps answer much of the laplace transform part, but rather about the "how to implement this in reality" part.

You usually put in filters to remove as much noice as possible because you don't want to have noice in your control signal (since it wears out
the equipment, especially if it is a valve).
Putting in a filter before the sampling is also necesary to remove most of the frequencies above half the sampling frequency (read about the
sampling theorem (or repost a question) if you want to know more about why).

Both the P part and especially the D part is amplifying noice, putting in low pass filters att appropriate places don't remove the function of
those parts of the controller, but reduces the amount of noice in the output. This does of course require that the filtering time constant
is correctly selected.

The derivative should never be used when it isn't necesary for the control (since it amplifies noice) but for some processes it isn't only
making the control better by adding a filter and derivative action, it might also be necesary to the control loops performance.

/Johan Bengtsson

Do you need education in the area of automation?
----------------------------------------
P&L, Innovation in training
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/
----------------------------------------