LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID controller vi doesn't do what is expected

Solved!
Go to solution

I'm writing a multi-channel PI controller using the PID vi (in the PID toolkit). All channels will have the same setpoint, output range and PID tuning values. In the help file for the PID vi it say:

 

"The DBL Array instance of this polymorphic VI can be used in multi-loop PID control applications. In this case, the length of the primary input array will determine the length of the output array. Other input arrays do not necessarily need to be the same length as the primary input array. Other input arrays will be resized by this function to the same length as the primary input array as follows:

  • If the input array is longer than the primary input array, the input array will be truncated to the length of the primary input array. Additional values in the array are not used.
  • If the input array is shorter than the primary input array, the last value of the input array will be repeated until the size matches that of the primary input array.

In this manner an input value that should be used for each output calculation does not need to be specified repeatedly in the array passed into this function. Instead, the array can consist of a single value which will be used for each output calculation."

 

>>I take this to mean that I don't have to laboriously repeat the same data for every channel; ie. I can wire a 14-way array to the 'process variable' input of PID.vi but only eg 1 number to the temperature setpoint etc. In practice, however, this doesn't work. See attached vi (NB this is not yet complete so you can't run it!) and note the broken wires!

 

Dave

0 Kudos
Message 1 of 3
(3,211 Views)
Solution
Accepted by topic author oilyfingers

Hi,

The reason that it has a broken wire is because on some inputs you have only a single value where as the array type needs an array on all inputs, even if the array has only one element! You will see in the code I have returned that all I have done is but a build array block in to effectively convert the type from a single variable to an array with only one data type. I have also had to change the analog write for multichannel and change the datatype of the shift register, I presumed this would be required.


Regards,

James Mc
========
Ask me about Rust & NI Hardware
My writings are at https://www.wiresmithtech.com/devs/
0 Kudos
Message 2 of 3
(3,191 Views)

Thanks James, makes sense to me - I thought the problem was that the VI wasn't doing what it said it should do in the help. Good point about the shift register and analog write.

I will try this with the hardware this afternoon; fingers crossed!

Dave

0 Kudos
Message 3 of 3
(3,188 Views)