Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Filling an array with velocity data

Hi everybody

I need to acquire the velocity of a shaft, with a TTL quadrature encoder using a PCI-FlexMotion-6C board, every 5.4253E-2 seconds and then fill an array with the data, but it didn’t work. I think I am acquiring noise.
My hope is to acquire a number of scans (the velocity) with a motion controller in a similar way as acquiring analog data with a DAQ Board.

Please help me, I really appreciate it.

Attached is an image of the program.
I am using LV 6.i, PCI-FlexMotion-6C, NI-FlexMotion 5.0.1, MAX 2.0.
0 Kudos
Message 1 of 7
(4,518 Views)
First of all you won't be able to acquire the velocity data with this approach with the desired timing. There are three reasons:

  1. The lowest resolution of the LabVIEW timer is 1 ms. So the closest to 5.4253E-2 s you could reach is 54 ms.

  2. The FlexMotion board is working asynchronously. Thus it won't return the velocity value at the exact time you send the read velocity command.

  3. Windows is not a real-time OS and will add some more jitter to your measurement.
.

For better results you should use a hardware based approach. The FlexMotion board provides a feature called High Speed Capturing (HSC). Provide an external TTL clock signal with the desired frequency and connect it to the trigger input. Use this example to capture positions based on this hardware clock. The clock signal should be significantly faster than 18.41 Hz (=1/5.4253E-2) as you will need to calculate the velocity from this signal and the timing of the hardware clock.
Please note that for FlexMotion-6C boards the frequency is limited to about 100 Hz as you will have to reenable the HSC circuitry after each occurrence in software. By the way this is not the case with the new PCI-735x motion control boards that support HSC rates of 2 kHz.

Best regards,

Jochen Klier
National Instruments Germany
0 Kudos
Message 2 of 7
(4,512 Views)
Thanks a lot for your answer, unfortunately I am not able to open the link.
If you don't mind, please send me the atacched link again.

Best regards,
chia
0 Kudos
Message 3 of 7
(4,503 Views)
Hello Chia,

here's the link Jochen referred to:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=C04F7F32E01F0274E034080020E74861&p_node=DZ52480&p_source=External

Regards,

Jorge M.
0 Kudos
Message 4 of 7
(4,498 Views)
Thanks Jorge for your answer.

I have to say that I am new using Motion VIs and I don't understand how these VIs work.
I tried to use the above example but there were two error messages: 70078 and 70072. So my questions are:
-what do these error mean
-how can I use the above example to read the rotational speed of a shaft with an encoder and fill an array with that data? I have no idea how to relate that example with my problem.

Thank you for your help.
0 Kudos
Message 5 of 7
(4,486 Views)
Hello,

which version of NI-Motion are you using? The example needs 5.2 or later.

The idea is to use this example to record (in an array) the position of the motor at regular intervals. Once you have these values, it's simple to make calculations to get the speed.
Example: if you have in the array the positions (40, 50, 70, 100), and those values are captured every millisecond, then the speed would be:
(50-40)/0.001 counts/second = 10000 counts/sec
(70-50)/0.001 counts/second = 20000 counts/sec
(100-70)/0.001 counts/second = 30000 counts/sec
Finally, the counts will relate to position in cm or meters, so the speed calculation (m/sec) will be trivial.

On the Help file for NI-Motion, you can check the errors (Start->Programs->National Instruments->NI-Motion->Documentation.

–70072
NIMC_boardInPowerUpResetStateError
The FlexMotion controller is in power up reset state. Please execute the Clear Power Up Status VI before sending any commands to the controller.
Please let me know


–70078
NIMC_invalidFunctionDataError
Invalid data in the VI.

I would use the Clear Power Up Status VI to see if it solves the issue.
Also, have you been able to run successfully any of the examples that are installed with the driver?

Regards,

Jorge M.
0 Kudos
Message 6 of 7
(4,483 Views)
Clearing the PU state ist automatically done when you initialize the controller. Thus this error means that you haven't initialized your controller.
We don't initialize the board in any of our examples as this could potentially result in hazardeous behavior. Think of a situation when you initialize the controller to work with huge servo motors but you haven't tuned the PID parameters appropriately in MAX...

I hope this helps,

Jochen Klier
National Instruments Germany
0 Kudos
Message 7 of 7
(4,470 Views)