LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using 2 PID Loops ?

I need to use two independent PID loops in one program. I have one 6024E multifunction card. Is it possible to have two PID loops running at the same time? Does anyone have some sample code?

Would it be easier if I use two seperate cards?

Thanks in advance
0 Kudos
Message 1 of 4
(3,326 Views)
It should be possible to run two loops simultaneously. Whether you can do everything fast enough depends on your application. Two cards may simplify things, but if the card has sufficient numbers of inputs and outputs, you could probably use just one.

Look very carefully at your timing requirements. Can you read all the required inputs, do the calculations, and generate the outputs before the next loop iteration must start?

I would set up a DAQ loop which ran indpendently from the processing loops and communicate between the loops with queues or functional globals.

Lynn
0 Kudos
Message 2 of 4
(3,326 Views)
Yes, it is very straightforward to have two PID loops running at the same time. There is one example that ships with the PID Toolkit named "Multi-loop PID - Hardware Timed DAQ.vi". It uses the traditional DAQ VIs. Another example using DAQmx is "PID Control-Multi Channel.vi"
0 Kudos
Message 3 of 4
(3,326 Views)
Hello,
There should be no problem running 2 PID loops at once. However, depending on your hardware, you might be limited by the rates that your PID loops will get data.
For example, if you are using an E-series board, you will have to acquire all your data for both PID loops at the same rate. The PID loops themselves could be running at different rates but, the data acquisition rate has to be the same because there is only 1 analog to digital converter on E-series boards.
If all your inputs to both PID loops can be done at the same rate, then you are good to go!

Nicholas C
National Instruments
Applications Engineering
0 Kudos
Message 4 of 4
(3,326 Views)