velocity estimation from position measurement for speed control

Hi, Could somebody help and advice how I estimate the velocity from the position output of an incremental shaft encoder (two outputs, 90 deg.
shifted). I use Simulink and xPC target to control an actuator with DC motor. The easiest way would be to take the difference between the last two sampled positions divided by the sampling period. But I don't know where I should get the sampling period from? Is there another way which I could try to perform speed control?
Thanks Dan
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
snipped-for-privacy@bris.ac.uk wrote:

Surely you know the sampling rate?
A bare first difference, such as you propose, will work far better than nothing -- good enough, perhaps, that you don't need more.
If you have noise problems, consider making a band-limited differentiator, though.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Tim Wescott wrote:

Fine, but that doesn't answer his sample-period question. The period is the reciprocal of the sample rate. Surely, that is a constant?
Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Thanks Jerry and Tim for your discussion. I managed to create a model which simulates a DC motor with encoder feedback. The reference speed changes at a predefined time interval (e.g. 0.5 sec). A counter counts the pulses coming from the shaft encoder to get the position of the actuator. This counter is then reset to obtain the position at the end of the predefined time interval. Multiplying the final counter content with a constant should give me then the exact position at the end of the time interval (0.5 sec.). This value is then divided by the time interval to get the average speed of the actuator for the predefined time interval.
My problem is now how to get only the final content out of the counter at the end of predefined time interval?
At the moment, I subtract the counter content from the previous time step from the current content to get the position. By the end of the time interval, the counter is reset and this gives me then the final counter content for the particular time step. However, this is done always based on the sampling rate of the simulation (0.001 sec) and not only at the end of the time interval (0.5 sec). To send only the final speed at the end of the time interval to the comperator, I use a zero order hold but I'm not sure if this is the right solution.
Thanks Dan
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.