LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

merging 2 while loops for 2 devices and PID control

Solved!
Go to solution

Hello Dear LabVIEW Experts.

As a Beginner i am working on a Project with real Hardware now, where i have a Flowmeter measuring Flow and a Pressure controlled valve that can regulate the flow. when i give the device a value of 0 it keeps the flow at the same point fluctuating 0.1 l/min around that point.

if i give a value between 0-250 it opens the valve further and if i set it back to 0 it keeps it at that point same goes for 0- minus 250 where it takes of pressure and closes the valve a bit reducing the flow.

So far so good i have that Part in a While loop and now i want to PID controll it therefore i wanted to use the LabVIEW example Advanced autotuning PID control loop. where the Flow is my Process Vaiable(PV) and the pressure is the manipulated variable(MV).

 

And here is my Problem the PID VI is in a seperate while loop and its a simulation loop with a simulated plant.

Tomlab_0-1643018851229.png

i wanna replace the "fake plant" with my plant that gets the MV and measures the PV and gives it back to the loop.

 

Id love to hear your ideas guys thanks in advance and sorry for my english im non native.^^

0 Kudos
Message 1 of 7
(872 Views)

PS: If you need any further context or have questions feel free to ask 😃

0 Kudos
Message 2 of 7
(869 Views)

Hi Tom,

 


@Tomlab wrote:

i wanna replace the "fake plant" with my plant that gets the MV and measures the PV and gives it back to the loop.


No, you don't want to replace that "Plant.vi" in a 2nd loop.

You want to place the PID function inside your DAQ loop!

 

  1. Place the PID inside the DAQ loop.
  2. Use the sample from DAQmxRead as input (process value, pv).
  3. Have the PID calculate a new output value.
  4. Output that value using the current DAQmxWrite function (or whatever you use to output the setpoint to your Pressure-regulating valve).

That's it…

 

Have you taken over that project from your collegue? There was a very similar question some days ago…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(866 Views)

Hello Gerd,

thank you for your help on this topic it "worked" so far programmatically.

 

Now i find myself with the autocontrol algorithm and i see, that it jumps between 10l/min and 0 max and min so i plan on doing a ziegler nichols i hoped the program may be able to find optimal values on its own but that seems to not be the case here. 

 

Also the post you refered to was in the other labview forum where you told me about the examples thank you for that aswell the problem here is that from my workplace i cant access that forum because we have a work vpn and it flagged the whole copany as spam apparently thats why i am now here.

 

As i know you are german aswell 

Liebe Grüße aus Berlin

Tomlab

 

PS: sorry for not answering yesterday but as a new account i had uses all my messages for the day.

0 Kudos
Message 4 of 7
(793 Views)

Hi Tom/Laborbesichtigungsanfänger,

 

 


@Tomlab wrote:

Now i find myself with the autocontrol algorithm and i see, that it jumps between 10l/min and 0 max and min so i plan on doing a ziegler nichols i hoped the program may be able to find optimal values on its own but that seems to not be the case here. 

 

Also the post you refered to was in the other labview forum where you told me about the examples thank you for that


I never used those autotuning routines from NI, I always made a small measurement campaign and calculated PID gains "manually".

Most often a simple "jump" measurement is sufficient: switch off the PID, change control output value from 10% to 40% and measure the resulting pv behaviour. Use that measurement to determine PID gains…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(786 Views)

Hi Gerd,

today i tried to get the First measurements for Kp by obtaining a closed loop jump Response on the real hardware.

the problem that occured is that for a flow of 4 liter/min the Kp is different from the Kp for 1 liter/min but i am supposed to find an option for all flows from 1-12 liter/min are there tricks to achieve that or is that impossible?

 

if its important for 4 liter/min i got a P=1,27 and for 1 liter/min i got P=4,3 wich to me seems pretty weird.

I need a good Kp for the Ziegler-Nichols but i dont think i should do it 12 times right?

 

Thank you for your help

Best regards,

Tomlab

 

0 Kudos
Message 6 of 7
(766 Views)
Solution
Accepted by topic author Tomlab

Hi Tom,

 


@Tomlab wrote:

the problem that occured is that for a flow of 4 liter/min the Kp is different from the Kp for 1 liter/min but i am supposed to find an option for all flows from 1-12 liter/min are there tricks to achieve that or is that impossible?

 

if its important for 4 liter/min i got a P=1,27 and for 1 liter/min i got P=4,3 wich to me seems pretty weird.

I need a good Kp for the Ziegler-Nichols but i dont think i should do it 12 times right?


Some general thoughts:

  • Getting exactly the same PID gains when testing for the full working range is hard. Most often there will be some variations…
  • Depending on the type of actuator/system getting a factor of 3 for P gain at 8% and 33% working range might be reasonable…
  • PID control loops are made for linear systems. Getting such different PID gains at different working points suggests your system behaves (very?) non-linear.
  • You can improve PID controllers by using gain scheduling (there's a function in the PID toolkit) or by adding feed-forward calculations

In general I started with a simple PID with average PID gains for systems with different PID gains for different working points…

 

What's the problem to determine the PID gain for several working points? That's a one-time measurement!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(755 Views)