10-12-2013 04:36 AM
Dear all,
The DAQ input data is dynamic type data. However, after processed by the PID module, the output is a float type data and was then given to DAQ output pin, like the picture attached.
The problem is: there are 10 data acquired in each loop(100 sample to read and 1K sample rate) but only 1 data generated (the other 9 data are treat as 0), this made the output not continuous. How to solve this kind of problem?
Thanks
best
10-13-2013 04:43 AM
Can you try using convert dynamic data type to make sure that it converts data correctly?
10-13-2013 08:21 AM
I tried to convert the float type data to dynamic data and I checked the result, the becomes 1 normal data followed by 9 zeros, just like the picture I attached above.
10-14-2013 06:26 PM
Hello iyearning,
If you trace where the setpoint input on the PID function you are using goes within the PID functions, you will notice that the capabilities of the function will only allow for a double. Because of this, I believe only one of the 10 values you are passing in every time is getting used. The red coercion dot on the input of the PID Advanced function for the setpoint shows that the dynamic data type has been coerced to meet the criteria for the function.
We generally recommend the use of the Dynamic Data Type for simple functions, but more advanced functions (such as a PID) require specific types of data to be used. I would recommend converting from a Dynamic Data Type as soon as possible in your code to perhaps an array of 1D Doubles that you could index into the PID function (using a for loop?) and generate an array of matching output values. Something similar to what is shown below:
If you have any questions, please feel free to ask!
10-15-2013 02:26 AM
Dear BluesKnight,
Thank you so much for your suggestion!
I changed the usage of the dynamic data and add the for loop in the program, like you suggested. However, there is still something wrong.
For each arry being processed by PID, it has 10 elements and I want to add this array with another I D array. However, the probes(15,16, and 17) show that the result is always 0, why it can not get the desired results?
Thanks
best
10-16-2013 10:22 AM
Hi iyearning,
The size of the initialized array that you are working with on the 16th probe and the one below it are zero. If you add two arrays together in LabVIEW, the resulting array is the size of the smallest array in the operation. You should initialize an array of size 10 with zero as the default value instead of an array constant, similar to what I have shown in the snippet below. Let me know if this helps!
10-16-2013 11:58 PM
Dear BluesKnight,
That's really helpful! Now it works much better!
Thank you so much!
best
11-08-2013 01:59 AM
Dear BluesKnight,
I met a new problem. When I connect the array to a for loop, the program seems not execute into the for loop, as I use the probe to check. What is wrong with it?
Thanks
best
11-10-2013 02:45 AM
Dear BluesKnight,
Finally, I got clear about this problem and know how to use the array correctly.
Thank you so much for your instruction.
best