Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

data type changed after PID control, and output not continuous. how to solve this problem?

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

Download All
0 Kudos
Message 1 of 9
(4,414 Views)

Can you try using convert dynamic data type to make sure that it converts data correctly?

0 Kudos
Message 2 of 9
(4,402 Views)

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.

0 Kudos
Message 3 of 9
(4,395 Views)

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:

 

Index_PID.png

 

If you have any questions, please feel free to ask!

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 4 of 9
(4,358 Views)

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

0 Kudos
Message 5 of 9
(4,352 Views)

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!

 

InitArray.png

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 6 of 9
(4,323 Views)

Dear BluesKnight,

That's really helpful! Now it works much better!

Thank you so much!

best

 

0 Kudos
Message 7 of 9
(4,311 Views)

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

0 Kudos
Message 8 of 9
(4,235 Views)

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

 

0 Kudos
Message 9 of 9
(4,216 Views)