PID problem...

I don't the F3*Temp is right. Look at my equations on the first page where I have
Pumph*(Temph-PVt)/PV1 and
Pumphc(Tempc-PVt)/PV1

Remember what I have said about getting the steady state right. If you only turned on the hot pump and there was no demand or cold pump running then your model would let the temperature increase.

Another way to look at the problem. If only the demand was active and the pumps were not would the temperature change in the tank?

I don't think the demand should be cooling off of the tank. The heat loss and cold pump do that. The cold demand should not change the temperature directly.

Look at page 7/13 where I have the differential equations written out. There are 3 temperature terms and 3 level terms. To make sure I got my model right I would test 1 term at a time to make sure it made sense. For instance, I would set the pumps and the demand to zero and make sure the mixing tank wlll cool off to ******t temperature or Tempc. If I ignore the cooling and turn on only the hot pump the temperature should rise exponentially toward Temph. I did this term by term to make sure I got each term right because I screwed it too many times before. I find it harder to isolate the terms on your system diagram.

Does anybody understand the graphs for my simulation. Does anybody understand that the last two equations on the bottom of page 6 are all that is necessary to implement in the PLC?

What is interesting is that the fractional method yields this
Errort=(SPt-PVt)
Errorl=(SPl-PVl)
COh=2*Kcf*Errorl*Kct*Errort)
COl=2*Kcf*Errorl*(1-Kct*Errort)

the LQR method will look like this

COh=K00*Errorl+K01*Errort)
COl=K10*Errorl+K11*Errort)

Where:
Errort is the temperature error
Errorl is the level error
COh is the hot control output 0-1
COl is the cold control otuput 0-1
Kcf is the controller flow gain
Kct is the controller temperature gain
K00,K01,K10,K11 are gain to be determined by the LQR calculations.

I think the big difference is that the fraction calculations are multiplies and the LQR is a sum of products.

Pandiani, I always use differential equations when the system is non-linear. As you can see the simulation on the bottom of page 7 is easy after the model is correct. The hard part is going to try to get my differential equations to fit in a state space model so that the A array and state are together and the B arrays doesn't have state terms. You can see I have never needed to use Rytko's linearization technique when using non-linear differential equations.
 
Peter,
I have spent a lot of time and put a lot of effort in building this model, so I must defend it. I think model is correct.
I'd like first to eithere accept or reject this model. I made .pdf file with steady state analysis. Please read it and comment. This is very valuable experience for me and I'm sure many will find it useful.

Looking forward to your comments...
 
Pandiani-


I followed your equations to your model until I got to the little piece that couples the height and temperatire together. This is the multiply between the two paths that consists of:

Temp * A * d(h)/d(t)

I'm not sure where this comes out of the equations, although it is definitely the part that prevents thermal runaway.

F3 = -A*d(h)/d(t)

Keith
 
I did a quick update of my LQR worksheet

I used my non-linear model for starters. I tried to linearize around the operating point where SPl=1 and SPt=40. The iterative LQR algorithm for finding gains didn't work so I relied on my intuition and common sense so pull the four LQR gains out of my a$$. The control output for LQR is defined as

COh=max(min(K00*Errort+K01*Errorl,1),0)
COl=max(min(K10*Errort+K11*Errorl,1),0)

the way I implemented it. This is what should be implmented in the PLC.

If Errort = 0 and there is only a level error then K01 and K11 would need to change the level. The sum of the K01 and K11 would be the same as my flow gain. Therefore K01 is about 10 and K11 is about 10. This provides an equal flow which is not desired because then the temperature goes to 42.5 degrees. I modified K10 and K11 by weighting them by the hot and cold temperature. Therefore K01 or the hot flow gain is 20*(SPt-Tempc)/(Temph-Tempc) and K11 or the cold water flow gain is 20*(Temph-SPt)/(Temph-Tempc). The two gains still add to 20 but now they don't cause a temperature change.

The temperature gain K00 and K01 should be in the same range as my temperature gain. I used 2 for both the hot and cold temperature gain. The cold temperature gain could be a little lower or the hot temperature gain could be a little higher to make up for the heat loss.

The point is that any LQR calcuations should compute gains that make sense and follow my reasoning. The LQR gains should be roughly in the same range as mine or at least have the same ratios between the hot and cold flow gains, K01 and K11.

Compare the Tank&Level with the LQR Pandian pdf. The first two pages are the same as mine. You can see my failed attempt at calculating the LQR gains on page 4/8. I will study Rytko's linearization tonight maybe it will help the my failed LQR calculations
ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20LQR-Pandiani.pdf

I did find one problem with the four gain method of control. At 45 minutes the time goes to 0. Since I simulate the heat loss the temperature tries to drop. The controller tries in compensate by adding more hot water but since there is no demand the level keeps increasing. Again this points out there must be a means of recirculating the water in the mixing tank to keep the water at 40 degrees C and the level at 1 meter.
 
This is a really stupid question, but...

Given the coupling matrix, for example, you need to multiply the rows of the control signal vector by the columns of the transition matrix, correct?

Keith
 
Pandiani, I finally studied your model. It looks right

kamenges said:
Given the coupling matrix, for example, you need to multiply the rows of the control signal vector by the columns of the transition matrix, correct?

Keith
Yes, you can see that on page 5/8

Pandiani, what happens if the hot and cold pumps are off and there is only demand.

Since you are ignoring heat loss, what are you using for the A array?
 
Control law that is given from LQR procedure is multiplied with state vector. Matirces are multiplied in the following way: A*B,
each element of row A is multiplied with each element of coulmn B
So C = A*B gives:
cij = sum(aik*bkj)
k

Keith, please read and comment this.
I'm going my way, Peter is going his way. I can't imagine how it is difficult for others to follow this simultaneously...

Please read and comment, so far I didn't find anything that is not logic in my model... This is getting really exciting!!!

Peter, you can see in my "Mixing tank linearization.pdf" file how I made A matrix. There is also comparision of linear and nonlinear model around working point. I made linearization using esentially same procedure as rytko suggested...

Please look at my Defend_model.pdf. I made there that both pumps going instantly off, and level is decreased, but temperature is same as before pumps went off.
 
Last edited:
I see what you are doing now, Pandiani. That does look correct. I didn't perform the equation combinations myself from your initial 'Defend' PDF so I didn't see the intermediate result you show in the second PDF you posted that is the basis of the diagram in the first PDF.


Keith
 
I manage to defend my model heh :), I'm going further. Need to find out what causes oscillations. Since model is correct, probably gains are not calculated correctly, or linearized model is not good starting point for finding LQR gains. I think that linear model is not to blame, because I applied Taylor approximation in same way I used in "linearization model thread".
Hmm, need to dig further...
 
I have computed LQR gains.

I updated this file
ftp://ftp.deltacompsys.com/public/NG/Mathcad%20-%20LQR-Pandiani.pdf

I used the optimizer/minimizer to compute the LQR gains. The optimizer/minimizer works when the Ricatti formulas don't. The LQR gains are a little much more agressive than the ones I calculated myself but the ratios or relationships between the gains seem about right.

Before I calculate the LQR gains I had to change the Demand function so it doesn't saturate the control outputs. This means the demand can't be 0, there need to be recirculation, and the demand can exceed the combine flow of the hot and cold pumps.

Compare my results with the LQR results. I could make my gains a little more aggressive but I think the gains can be anywhere between what I have and the LQR gains and the system will still work once there is a recirculation line.

Pandiani, I know I haven't used the book methods but I don't think they will work for this problem. What are you using for the A and B arrays for input to your LQR gain calculation routine. I think this is where your error are occurring.


leitmotif said:
Lawzee lawzee Mr Nachtway you sure are a demanding man - poor ole plumber runnin them pipes as fast as he can!!!!

I think he merely forgot to draw a line out of mixing tank.
Now where is you contribution?
How big does the recirculation line need to be?
 
Last edited:
Confused, as usual

Peter, it looks like the area under the curve of the hot and cold control outputs is significantly less with the LQR tuned system than the system you tuned even though the demand profile was the same. I would have expected the areas to be nearly equivalent since the levels tracked pretty close to each other. What am I missing?

Keith

EDIT:

I stand corrected. After looking more closely the LQR tuned system tracks level much closer to setpoint. However, it still seems to do it with much less total flow given equivalent demands, which seems completely counter-intuitive.
 
Last edited:
Peter Nachtwey said:
Pandiani, I know I haven't used the book methods but I don't think they will work for this problem. What are you using for the A and B arrays for input to your LQR gain calculation routine. I think this is where your error are occurring.

It is possible. If you read my "Mixing tank linearization.pdf" which is on page 4, you can see how I calculated state space matrices that describe model behavior near operational point (40C, 1m). I have compared responses on little step and both models were doing fine.
These are my state-space matrices:
Code:
[font=Courier New][size=2]F10 = 0.4*0.0042;
F20 = 0.5*0.0042;
T0 = 40;
T1 = 65;
T2 = 20;
Ar = 1;
L0 = 1;
 
A = (1/(Ar*L0^2))*[-(F10+F20), F10*(T0-T1)+F20*(T0-T2); 0, 0];
B = (1/Ar)*[(T1-T0)/L0, (T2-T0)/L0; 1, 1];
C = [1, 0; 0, 1];
D = [0, 0; 0, 0];[/size][/font]

Unfortunately, I don't have your experience and "gut feelling", so I was acting strictly according to the book. I'd like if it could be posssible that someone from academia world interfere.

However, Peter, do you agree with the structure of controller (i.e. how gains are connected after computed)? Maybe I made mistake by connecting them. You have pictures with structure and responses. Can you agree with that?
If this proves to be right, we're on a good track to prove how theory will not work in this practical case.
 
Last edited:
kamenges said:
Peter, it looks like the area under the curve of the hot and cold control outputs is significantly less with the LQR tuned system than the system you tuned even though the demand profile was the same. I would have expected the areas to be nearly equivalent since the levels tracked pretty close to each other. What am I missing?

Keith

EDIT:

I stand corrected. After looking more closely the LQR tuned system tracks level much closer to setpoint. However, it still seems to do it with much less total flow given equivalent demands, which seems completely counter-intuitive.
I will check again but the model is the same between the two sets of gains. I increase my gains and see if they roughly match the LQR gains but that will have to wait till tomorrow.
 
Just to put some numbers to this...

I'm doing this completely visually based on the graphs in the pdf. Isolating the 15 - 30 second area (demand = 0.4 m3/min):

on page 7 it looks like the Hot CO is about 0.75 and the cold CO is about 0.85. The pump gains are both set to 0.252 m3/min. This should give us:

0.252 * (0.75 + 0.85) = 0.403 m3/min

which is what we would expect since the level is holding.

Looking at page 12 during the same period the Hot CO looks to be about 0.2 and the Cold CO looks to be about 0.15. This gives us:

0.252 * (0.2 + 0.15) = 0.088 m3/min, which seems way too low since the level is holding.

Keith
 
Good eyes and intuitive feel, Keith

My COh(PVt,PVl) and COc(PVt,PVl) where using my gains. I had to redefine the COh(PVt,PVl) and COc(PVt,PVl) below were the LQR gains are defined so they use the LQR gains.

Now the COh and COl look right.

Good eyes. I updated the LQR-Pandian .pdf to reflect the changes.
 

Similar Topics

Dear all . I made a program for boiler tank using TIA V15 , the program consists of 2 PID blocks in OB30 . but the PID didn’t work automatically...
Replies
3
Views
2,731
Dear all . I made a program for boiler tank using TIA V15 , the program consists of 2 PID blocks in OB30 . but the PID didn’t work...
Replies
1
Views
1,140
Hello Friends; I am working on a GE Funac LM 90-30 software. I face the problem to set the CV value when PID in auto mode. The parameters are set...
Replies
13
Views
3,080
I had a problem on a hydraulic servo controlled cylinder, which I believe was caused by the PID loop and the cylinder reaching a hard stop at one...
Replies
10
Views
2,488
We have a machine we're trying to commission. It's a web converting machine. It takes webs of foil, wicking paper & a label and creates a chemical...
Replies
1
Views
1,321
Back
Top Bottom