View Single Post February 22nd, 2003, 10:57 AM   #12
Peter Nachtwey
Member  Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 6,836
Virtual System using magic math.

Quote:
 Originally posted by Deer Gentleman, After I read your post in here, I would like to learn about PID control.I have some "tools" as I was describe in below: 1) RSLogix 500 software 2) Processor SLC 5/04 3) 1746-NIO4V (2 chanel input, 2 channel output voltage) 4) 1746- IB16 5) 1746- OB16 6) Voltage regulator (0 - 10 VDC) 7) Voltmeter 0 - 10 VDC 8) Switches ON/OFF 9) Pilot lamp, etc. Since I don't have the " real world" (like a valve, temperature source,etc)to practical the PID control, so that I would like to try with what I have. Where I should start to learn about PID, anyone can help? My apologize if my question is very basic for you. Thanks in advance Deer
All you need is the PLC with the PID. Items 3+ are not required. One can easily simulate the single pole heater system in software. Use this formula to calculate the the virtual SP in response to the CV.

SP = SP*(T/(t+T)) + K*(t/(t+T))*CV

Where:

t is the update or scan time of the simulator.
T is the time constant of the system you want to simulated.
K is the system gain which should be set to 1 when getting started.

It takes 5 time constants for a system to reach within 1 percent of a step jump change. Therefore, if you want to simulate a system that takes 5 minutes to reach steady state, you would have a system that has a time constant of 1 minute or 60 seconds. If the simulator gets updated every .1 seconds then the equation above would be:

SP = SP*(60/(.1+60)) + K*(.1/(.1+60))*CV

Simplifying

SP = SP * .9983361 + K * .0016639 * CV

Use a CPT block activated by a timer. Remeber, K should be left at one for starters, one can adjust this to convert CV units to temperature so that a CV of 0-16383 equates to 0 to 900 degrees.

In this case K = 900/16384 = .05493
This will make the system more realistic.

The equation for our virtual system is
SP = SP * .9983361 + .0000916 * CV

The PID should not update faster than the virtual system and ideally the PID should update much slower.

To simulate dead time one would need to put the CV in a FIFO. The current CV from the PID would be put into the FIFO. The above formula would use the delayed CV. In our example the virual update rate is .1 seconds so we would require 10 delay elements to simulate a dead time of 1 second. This could a problem on the SLC as its register files are only 256 elements long so it simulate a dead time longer than ~25 seconds unless the virtual systems updates is reduced to 1 every .2 or .5 seconds.

Now you will be doing the same thing I do with my spread sheets. 