LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control

HI,
I am trying to control pressure of a system in which I change the control the flow control valve and keeping pressure control valve constant.
In the VI attached I am entering the rate of pressurization (whose values changes as per the iteration value of loop) which I keep comparing with my actual pressure but the problem is that when I acquire the pressure it takes some time 8-10 sec. to reach at the stable value so my error becomes very large and as soon as I start VI set point arises so quickly independent of my pressurization rate.
Here I also want to ask that as I just want my loop to be run only (Set Point)/(Rate) times but it runs so quickly and if I put any delay it becomes very slow and then my pressure also takes larger time to reach at the stable value...thus again increasing my error and it writes 10volts in its 1st run.
I hope you understand my problem.
Regards
0 Kudos
Message 1 of 6
(3,070 Views)
James,

One reason your error jumps up is that your loops are executing as fast as possible. Put a Wait (ms) function in the loop to slow it down. Any control system with large delays between the controller command output (the valve actuation in your case) and the measured response (the pressure) is difficult to control. You will have to determine, probably experimentally, how much loop delay will be needed to avoid saturating the control output and still regulate the pressure (along with values for your PID parameters).

I cleaned up your VI a bit; removed the local variables and the sequence structure. Also, the Kd component will always be zero because the Err value is fixed and prev.Error is set to Err. Kd is the product of their difference (=0) and the D parameter. The inner looop does not appear to do anything that moving the shift registers to the outer loop would not do. I do not have your hardware, of course, so thes changes are completely untested.

Lynn
0 Kudos
Message 2 of 6
(3,045 Views)

Thanks Johnsold,charlie..and others,

I have made few changes also in my program and what I am doing in my code is that as I have to increase the pressure at a desired rate , which is "Rate(Kgf/Sec)" specified in the code which I am calculating at every 10msec. point by increasing a counter...and comparing it with current pressure value to calculate error for PID loop...but now I have some issues....

  • The value "dT" I m taking in PID loop is 10mSec. because I am calculating desired pressure at 10mSec....is this correct???or what should I take ???
  • As the user can change the Rate so my desired pressure slope changes according to that and the points which I will be getting corresponding to that wud change....e.g. if I my " Rate(Kgf/Sec)" becomes 1 so in 1 sec. the desired should reach at 1 and at t= 2sec it should become 2....and if if set Rate to 0.5 Kgf/Sec so at t=1sec. it should become 0.5..and so on.....but it is not happening..the rate does not have any relationship with timing which is missing in the code...so how can I get  my timing right???
  • Is there anything to do with the samping rate at which I am acquiring the pressure.
  • Also How can I reset the counter value to 0 ....even when I make reinitialise to default it starts with previous value.
  • How Can I better my PID control response...shown in fig. attached.

Regards

Message Edited by james p martin on 08-05-2006 03:30 AM

Download All
0 Kudos
Message 3 of 6
(3,013 Views)

Check this code too.

It's good to let the controller has a scan time which is comparable with the measurement sampling time.

Derivative mode is also modified in a common way.

0 Kudos
Message 4 of 6
(2,995 Views)

Hi Soroush,

I am not able to understnad why you have given those two delays outside the loop???.....actually what I need to do is that I have to generate the desired pressure points as per the rate specified and that should increse as per the specified time.....e.g. 1Kg/Sec........so my values in the chart for desired pressure(green one) should increase with the rate of 1 per second....which I am not able to do......and now I am confsed about the time delays how to use them in differentt cases.

 

Regards

0 Kudos
Message 5 of 6
(2,949 Views)

Hi James,

Those delays outside the loop are for two reasons:

1- Making sure that every iteration (including the first one) takes as long as defined ms delay.

Note that when "Wait until multiple next MS" is used the first iteration may take shorter time to execute, because it diffres from "Wait" function.

2- For synchronization between parallel loops so that there is a constant phase shift between two loops everytime the program runs (Repeatability of using the program)

Measuring actual pressure is done with a sampling time equal to "Measurement Sampling Time(ms)". Also Changing control signal is being done every "Scan Time" mili seconds. these two loops are completely independent. If you need to build your setpoint profile with another sampling time (A third one) then it is possible. just add another parallel while loop and make your setpoint there. Put the chart in the fastet loop (or if synchronization problem arouse, put it in a fourth paralellel loop.)

I hope it helps.

0 Kudos
Message 6 of 6
(2,933 Views)