05-23-2024 09:38 AM
Hello,
I am trying to read the output of two encoders at high speed in parallel (rotating at up to 300 & 75 Hz respectively). I would like to measure the speed and acceleration of these encoders.
The current VI (attached) that I am using measures the position data from both encoders as I would like. However, I need the time of each position measurement to calculate the speed and acceleration. (I also need the time for other things afterwards too).
I am currently using a producer-consumer loop to save data to .TDMS file with the Z pulse on the disc encoder being used to release the queue of data acquired, so the acquisition rate is not constant.
I have tried using the high-resolution seconds VI in the producer loop the output in the VI main window appears to read the time as I would like it, but this saving into the TDMS file, I may be wrong on this (screenshot attached).
I have tried initialising the array to the correct length in the producer loop, but this doesn't work (screenshot attached).
Is there a simple way to acquire the time data at the same rates as the encoder position data?
(Using LabVIEW 24 (64bit) CRio 9055 with a NI-9401 Digital input module)
Solved! Go to Solution.
05-23-2024 10:14 AM
Many of us can't open brand new 2024 LabVIEW code. You will get more help if you back save (File > Save for Previous...) and choose 2019 or so. 😉
05-23-2024 10:55 AM
Updated VI attatched, thanks for letting me know 👍
05-23-2024 07:20 PM
Since you are using the Z-signal as the sample clock source, unfortunately there is no way to determine the timing accurately since it is not captured in the first place. You should use a sample clock source with a known timing, usually this can be generated using another counter.
05-24-2024 04:32 AM - edited 05-24-2024 04:51 AM
By another counter do you mean the output of another encoder rotating at a known speed?
I have tried using the A pulse but the acquisition can't keep up with the hardware (see attached screenshot), I have also tried using the internal 20MHz clock, but this doesn't seem to work for me (I'm not entirely sure why) - this would solve my issues if the data was acquired at a constant rate.
05-24-2024 09:41 PM
No, you can use another of the counters built into your 9055 chassis to generate a pulse train at a known and constant rate. Your chassis has 4 and you're only using 2 of them so far.
You'd probably refer to it as something like "ChassisName/_ctr2" when configuring the continuous pulse train. Note the leading underscore character when using a chassis counter internally rather than accessing it via a DIO terminal on a module. Then also your encoder tasks would specify their sample clock source to be something like "/ChassisName/_ctr2InternalOutput". Finally, you should make sure to start the encoder sampling tasks *before* starting the pulse train task.
-Kevin P
05-28-2024 08:41 AM
Thanks, Kevin
I have updated my VI (attached) to use the internal pulse source.
For anyone looking to replicate this, you need to include internal channels, under the "I/O name filtering option" for the internal counter source and include advanced terminals for the encoder clock source.
This appears to work broadly as I would like it to!