07-09-2013 04:25 AM
Dear all
I want to use a mean value of 20000 samples as a feedback signal to construct a PID controller. That means I will acquire 20000 samples in each loop, and the difference between the mean value of these samples and the set point is used as the input of the pid controller, the output of the pid controller is used as the amplitude of a sinewave signal. The example VI is in the attachment.
The question is :
(1) All the examples in the NI samples related to closed loop control are one channel ONE sample (read), so is the write part, can I use a one channel N samples in the loop for the read and write?
(2) If the I use "one channel N samples" in the read and write module, what is the loop time for this VI, does the loop time equal to the time consuming of data aquire and data generation?
Thanks for your attention!
Mr. Wu
07-09-2013 05:26 AM
@old_boy wrote:
The question is :
(1) All the examples in the NI samples related to closed loop control are one channel ONE sample (read), so is the write part, can I use a one channel N samples in the loop for the read and write?
Basically you're also using one sample to calculate the PROCESS VARIABLE, after calculating the mean (of 20000 samples), it becomes a single sample. And this approach is similar to all (or most of the) examples given in LabVIEW.
@old_boy wrote:
The question is :
(2) If the I use "one channel N samples" in the read and write module, what is the loop time for this VI, does the loop time equal to the time consuming of data aquire and data generation?
Minimum loop time has to be equal to the time taken in collecting (acquiring) 20000 samples, as you need these many samples to calculate the mean. Now if you want the loop rate to be faster, then probably you may want to increase the data acquisition rate.
07-09-2013 08:22 PM
Dear sir
Do you mean my designed program in the attachment should be OK? If so, I will try to test the program in an experiment.
Sincerely yours
Mr. Wu
07-09-2013 08:53 PM
Yeah, your code looks good to go with... You should run/test your code and in case if any issues you face, let us know.
07-10-2013 10:00 PM
Dear Sir"
I have tested this VI. However, each time I run this VI, it will stop after few milliseconds, and the "Simulation Parameters Function" indicates "finished late". I don't konw where is wrong. The step size is 0.4s which is equal to the data collection time for each loop.
Thanks for your kind assistant!
Sincerely yours
Mr. Wu