From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

construct a closed loop control VI using a mean value

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

 

0 Kudos
Message 1 of 5
(2,205 Views)

@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.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 5
(2,189 Views)

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

0 Kudos
Message 3 of 5
(2,169 Views)

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.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 4 of 5
(2,159 Views)

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

0 Kudos
Message 5 of 5
(2,137 Views)