11-27-2008 06:37 AM
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:
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
Solved! Go to Solution.
11-28-2008 06:49 AM
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,
11-28-2008 06:54 AM
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