Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

what is the control frequency in a PID controller?

Hi all,

I am using a PID controller to control the position of a linear stage. I have problem understand the frequency of the controller.

The PID module locates in a while loop. Is the frequency of the controller the same with the frequency of the while loop? As the frequency of the while loop is "sampling rate"/"samples to read", I need to decrease the value of "samples to read" and increase the "sampling rate" to acheive high frequency control, right?

Thanks

best

0 Kudos
Message 1 of 4
(4,015 Views)

Hello iyearning

 

You are right about how often the DAQ assistant is going to execute. It is going to hold the acquisition until it reaches the number of samples to read you defined. So yes, you get frequency dividing rate/samplesToRead, however you need to add the time required by the processor to execute all your logic. So you need to take into account this delay. You are right when you say you need to decrease the value of samples to read and increase the sampling rate to increase the loop execution frequency (however there are some limits here with the values you can use).

If you want to increase the performance of your code, you can also consider the DAQmx low level VIs.

 

Regards

Frank R.

0 Kudos
Message 2 of 4
(4,002 Views)

Dear Frank,

I changed my VI with DAQ low level modules. How could I estimate the time delay for eexecuting the logic? How could I know the controller's frequency?

I want to set exact frequency of the controller, for example 1KHz, what should I do? Would it help if I place a time delay module in the while loop?

Thanks

best

0 Kudos
Message 3 of 4
(3,987 Views)

Hello iyearning

 

You can use this method to benchmark loop iteration time:

Benchmark Loop Iteration Time with Tick Count Timer

 

Regards

Frank R.

0 Kudos
Message 4 of 4
(3,967 Views)