PID simulation

GEOFRA

Member
Join Date
Jul 2002
Location
Nicosia
Posts
99
Hi everybody!

I have some experience with PLC and I would like to know if there
is a way of experimenting with PID .Is there an easy setup to help me understand PID in real and experiment by changing various parameters so as to see their effect on the process?
 
I think the biggest deterent to using the plc PID instruction is system modelling. Unless we can hook it up to a true external process the output of the PID instruction won't do us much. We could develop a reasonably simple system model in the plc. But we wouldn't be able to handle anything real complex.

Now, if you could tie the output into something running VisSim or something like that...

Keith
 
Start Simple

kamenges said:
I think the biggest deterent to using the plc PID instruction is system modelling. Unless we can hook it up to a true external process the output of the PID instruction won't do us much. We could develop a reasonably simple system model in the plc. But we wouldn't be able to handle anything real complex.

Now, if you could tie the output into something running VisSim or something like that...

Keith

How complex do you think those web PID simulations are? We have no idea how they implemented their plant, but what is worse is that we can't change the plant. We can only change the PID gains. We can make our own plant equation and as long as it is kept simple we should be able to implement it in one compute block. Do to this we should review the simple first order filter. To make a simple 'plant' with this simple filter, one only needs to do this:

PV(n) = PV(n-1)*(1-K) + CV(n)*(K)

Where K is a fraction close to 0.0 like 0.001.

My documentation says that the CV on a SLC PID only goes to 16383 so we should probably multiply CV(n) by two if we want the PV to cover the full range of -32768 to 32767.

Here is something to think about....

We might have a plant where we are measuring the temperature but there might be ( almost certainly ) a time constant between the true temperature and measuring device. In this case we need two equations.

True Temp(n) = True Temp(n-1)*(1-K1) + CV(n)*K1
Meassured Temp(n) = Measured Temp(n-1)*(1-K2) + True Temp(n)*K2
PV(n) = Meassured Temp(n)

K2 and K1 are small constants close to 0.

More to think about..

We are assuming the heat added to the system is CV(n)*K1. However, this certainly will not be true as the plant temperature reaches the heater temperature. The heat flow will slow down as the temperature gradient decreases. Another equation is required to compute the true heat transfered from the heating elements to the plant. I will leave this to later if anyoneis interested. Some of my other posts have info on computing the coefficients K1 and K2 given you know the time constants.

Other items we can add are heat transfers due to product entering and leaving the plant. OK, so we are up to 5 equations now. No big deal.
 
Peter is correct. If your intent is to see how a PID function works as you play with the settings, which is what the original intent of the post is) then starting with a simple first order equation will provide a plant model that responds to the PID output. My mind started going down the path of a full system model. Like Peter stated the web simulations most likely don't have significant detail to their plant models either. So building a model in the plc is not a bad way to go.

A side benefit of this may be that, in building a model (if you choose to go more complex) you would end up with a better understanding of your actual physical plant. This is invaluable in actual tuning as it provides some insight into how PID adjustments will affect the process variable. It is also very helpful in understanding the source of any problems that may arise.

Peter, it sounds like you do a fair amount of temp control stuff. I do mostly tension and position control but sooner or later I will end up doing temperature applications also. Do you ever see the need to use a variable gain structure based on the temperature setpoint? As you said in your post heat transfer slows down as the plant temp reaches the heater temp. This seems to me to mean you would need higher gains to maintain the same system response. Is this needed or am I overthinking this?

Keith
 
Actually...

kamenges said:
Peter is correct. If your intent is to see how a PID function works as you play with the settings, which is what the original intent of the post is) then starting with a simple first order equation will provide a plant model that responds to the PID output. My mind started going down the path of a full system model. Like Peter stated the web simulations most likely don't have significant detail to their plant models either. So building a model in the plc is not a bad way to go.

:)

kamenges said:

A side benefit of this may be that, in building a model (if you choose to go more complex) you would end up with a better understanding of your actual physical plant. This is invaluable in actual tuning as it provides some insight into how PID adjustments will affect the process variable. It is also very helpful in understanding the source of any problems that may arise.

:) :)

kamenges said:

Peter, it sounds like you do a fair amount of temp control stuff.

No, I am a motion person. I also do simulations because I can't afford to buy all those $5 dollars valves at Radio Shack. I used temperature as an example because it is simple and slow compared to hydraulic cylinders.

A motion PID simulator using an excel spread sheet.

kamenges said:

I do mostly tension and position control but sooner or later I will end up doing temperature applications also. Do you ever see the need to use a variable gain structure based on the temperature setpoint?

I think the gain stays constant. Think of the material being heated as a capacitor, an the heat source as a voltage supply. As the voltage(temperature) on the capacitor(mass) rises, the voltage(temperature) difference decreases which results in less current(heat or energy) flow. Sort of like a RC circuit. I posted something on that a couples months a go.

kamenges said:

As you said in your post heat transfer slows down as the plant temp reaches the heater temp. This seems to me to mean you would need higher gains to maintain the same system response. Is this needed or am I overthinking this?

Keith

I think you understand the problem. The question is how do we model the heaters? Certainly they can't get hotter and hotter without limit. And even with a huge temperature difference they can supply a infinite amount of heat. In otherwords, a heater can be a perfect temperature(voltage) source or heat(current) source. For linear operation, stay away from the limits.

Terry, said he could tune up the spreadsheet system almost perfectly. That is because there are few limits in the spreadsheet system and it assumes a perfect system. Reality is a b!tch and full of limits and inperfections. That is what makes tuning real system such a challenge.
 

Similar Topics

Hi, I would like to assemble a simulator/practice booster pump system that uses PID to maintain steady water pressure under various outlet demands...
Replies
0
Views
80
There has been quite a lot about PID programming & simulation recently & I thought some people might like this idea, it is a bit Heath Robinson...
Replies
0
Views
999
Hello, I have been developing a library of function blocks. One of the developed function blocks is the PID controller. I have created a Simulink...
Replies
7
Views
2,989
Would anybody know how I can simulate the PV of a PID function using the output of the PID itself? I have seen it done before using an integrator...
Replies
3
Views
2,597
Hello, I am learning Honeywell PKS on a PKS R311 virtual machine. I built a PID CM and loaded to the simulation. Does anybody know how to make...
Replies
2
Views
2,198
Back
Top Bottom