LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it important to reinitialize the PID alorithm each time I use it ?

You do not have to use the array_version of the PID vi. The PID vi is reentrant. so if you use the pid vi in several places, each will have its own data space. So you can control pressure, temperature, and flow with the same "reentrant PID.vi" independly, without worrying about interaction of integral values etc...

But I have to use the PID vi in several places and I can't use a loop (for each quantity do PID), is't it?
(for 10 control loops I use 10 PID.vi 😞
0 Kudos
Message 11 of 15
(1,298 Views)
If I understood you correctly, you want to, say control pressure, but you want the pid.vi that controls pressure to be placed in sevral loops, one time, this loop does this, another time, the other loop takes over and does that etc..

Because the vi is reentrant, each call of the PID will have its own data space and there will be no interaction between loops placed in several locations. The above senario will not work.

Just have one loop to do control, and pass data to it from the other loops.
Message 12 of 15
(1,296 Views)
I have a main loop which acquire data (3*64 AI), calculate/control and send commands (64 mux AO) with a period of 100ms.
10 of my AO are the outputs of PID.vi (other ones are only for AI display).
I have an array of clusters like follow in order to define the setpoint profile of the 10 controled AO during time.

Time N° Channel AO=PID out SetPoint N° Channel AI=process variable P I D Output Max Output Min.

At each iteration of the main loop, I look elapsed time, and I want to control the 10 A0 in function of this array of clusters.
Can I use the reentrant PID.vi in a 10 iterations for loop (1 iteration for 1 AO)? Or I have to "wire" 10 differents PID.vi?
0 Kudos
Message 13 of 15
(1,294 Views)
you have 10 AO (assuming they are 10 indepedent analog output control signals). You can use 10 instances of the PID for each AO (10 PID.vis ). Or you can simply use the ARRAYversion of the PID, to be of size 10.
once a PID.vi receives its data (setPoint/measurement value), it will output an AO so that the set point and measuremnt values match, keeps doing that for all iteration, and as long as the PID.vi is called.

Note, each instance of the PID.vi (or each index of the Arrayversion of the PID.vi) shall have its own tuning parameters.
0 Kudos
Message 14 of 15
(1,289 Views)
ok thanks, I will try!
0 Kudos
Message 15 of 15
(1,287 Views)