LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID controller/control loop slows down main program

Hi everybody,

I already have a very complex LabVIEW program with several loops running at the same time and I now want to include a cascade control in it.
I created the cascade control itself first (see attached VI) and it works fine itself.
But when I implement it in my main program (where I need it) it slows down the whole program: ( Maybe it's because of the local variables? But I don't know any other other solution. I'm new to this, so I would be very happy if anybody can help me!
The VI which I attached is a little bit confusing (SORRY!), but basically you only need to look at the two while loops on the bottom and at the PID controller in case "F" of the case structure.

The PID controller in case "F" is the controller of the outer loop of the cascade control. It's output ("setpoint") enters the inner loop (see while loop on the left/bottom), which consists of a second PID controller with a filter and (in the feedback) a modell for a PT1 + delay time. So the inner loop should work as a smith predictor. The output of the inner loop (FiO2) enters the modell "lunge" (see while loop at the right/bottom), which consists also of a PT1 + time delay. Finally the ouput of the modell "lunge" will be subtracted from the input of the first PID controller in case "F" (closed loop).

Maybe I will post a draw of it later for better understanding.

I'm looking forward to your suggestions how to make the control loop faster.
Thanks in advance!

Steffi
0 Kudos
Message 1 of 11
(4,115 Views)
Maybe this draft helps to understand the VI better.

Oh, and I forgot to mention that I work with LV 7.1 in case someone wants to help me.

THANK YOU!
0 Kudos
Message 2 of 11
(4,111 Views)

Doesn't anybody has a hint for me why this program slows down my main program?

I really would appreciate someone's help!

Thanks.

Steffi

0 Kudos
Message 3 of 11
(4,055 Views)
It is hard to tell.  There are 2 sub-vi's missing.  "PID Control" and "Prozess-simulation", so we don't know what is happening inside of those one.  You can the profile tools to see where the memory and/or processor time is being taken up.
0 Kudos
Message 4 of 11
(4,030 Views)
Hi Brain,

thanks for your hint! I didn't know of that tool. Thank you very much.
Do you know what is meant by "locals" in the profile window? Is it the time for local variables?

Steffi

0 Kudos
Message 5 of 11
(3,997 Views)

Hi steffi,

your two loops have both a "Wait until next ms multiple" with 500 ms connected. Why do you need this two extra loops? Avoid using local variables.

Mike

0 Kudos
Message 6 of 11
(3,990 Views)
Hi Mike,

thank you for your suggestions. But how can I avoid local variables? Is there a better opportunity which results in the same?

Thanks! Steffi
0 Kudos
Message 7 of 11
(3,984 Views)

Hi steffi,

try to use shift register instead of local variables. If you have a control you can connect it directly to your calculation. The 2D Array is only an input and you never change a value in it, so use the input directly. I´ve removed some locals and think it should have the same functionallity as before (see the attachment). What do you make in the two parallel loops? Can you integrate them in the main loop? Which timing do you need there? You could use Queues to tranfer data between the loops.

Mike

0 Kudos
Message 8 of 11
(3,977 Views)
Hi Mike,

sorry for my late reply and thanks for your answer.
May you send the VI in LV 7.0 again ... as I don't have any other version.

Thanks a lot!

Yes, I integrate the two while loops in the main program. But maybe I can make one loop of the two... I will think about it. Thanks.

Steffi
0 Kudos
Message 9 of 11
(3,915 Views)
Hi Mike,

may you sent me a picture of your VI (as I can't open it with LV 7)? That would be great! Maybe then I get an idea how it works with the shift register.
I also post the two missing VI's "PID control" and "Prozess-simulation". Maybe there is an mistake?

I integrated the while loop down left in the upper loop, so I also post the new control loop. Maybe you can have one more look at it.

Thank you very much.

Steffi
0 Kudos
Message 10 of 11
(3,828 Views)