Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

two encoder data and feedback pid control real time

Hi,

 

iam trying to do feedback pid control..

 i have two rotary encoders which provide me with the speed data at two ends of a string.

i have a program which gives me the speed data..

but when i try to include the pid feedback in the loop , i get wrong speed data.. (very high values)

but it works well when its simply reading the speed data without the pid feedbacks included in the program..

 

i have attached my vi, pls any suggestions?

 

the rotary encoder data is obtained through bnc 2120...

 

thanks ,

 

regards,

 

ruser.

0 Kudos
Message 1 of 5
(3,717 Views)

Hi ruser,

 

I would first recommend that if you are trying to take speed data that you do a frequency measurement instead of an edge counting.  It will give you a much more accurate speed data and it will take less conversion to get the data you need.  Let me know how that goes and if you have more questions!

 

Regards,
Dustin D

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

hi,

 

thanks for the response,

 

could u explain how to convert it into velocity once i get the frequency ? and how do i connect the encoder to the bnc 2120? now i have the encoder connected to counter 0 with counter 1 internal ouput as the clock generation source for it..

hence i now have two bnc 2120 to connect the two encoders...

 

concerning the past vi which i posted,

i have a question.....

why is it that when i am taking the speed data from inside the while loop and performing calculations on it  that i get wrong values for the speed readings itself??

is it due to the fact that when i doit so ,

1.the entire while loop is being slowed down

2. or that the clear daq task (outside the while loop) is not occuring hence wrong speed data is got?

3.what can i do to access the speed values continuously and perform calculations using it , while the vi is reading the accurate speed data ??

 

regards

 

ruser.

 

  
 
Message Edited by ruser on 02-28-2010 01:17 AM
0 Kudos
Message 3 of 5
(3,678 Views)

Hi ruser,

 

I'm going to start by answering your third question, the rest will probably make sense after I explain this.

 

First off, a frequency measurement will give you instantaneous speed data, which I think is what you want.  For instance if the frequency of your square wave pulse is 100Hz and your encoder is 10 ticks per/rev, which is 10 rev/s or 600 RPM.

 

I'd recommend that you start with an example like Meas Dig Frequency-Low Freq 1 Ctr.vi search in the Help»Find Examples.  Also keep in mind that everything that you put inside of your while loop has to execute before it will iterate again.  Therefore, you may run into problems running the DAQ Assistants.  They run slightly slower than the DAQmx VIs due to some extra overhead.  For this reason it is very hard to tell where you are running into a problem with your code.  Try to rewrite a simpler version using a frequency measurement, it should be easier to debug. Good luck!

Regards,
Dustin D

0 Kudos
Message 4 of 5
(3,662 Views)

Hello,

 

I am working a similar situation, try to establish a PID control for encoder.  I am wondering if you could share your latest working project.  That will help a lot of user to start quicker.  Thanks.

 

Huiwen

0 Kudos
Message 5 of 5
(3,266 Views)