LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accurate reversals using encoder

The enclosed VI is for  reversing a Servo Drive based on angle feedback from an Encoder. Being a simple state machine, no elaboration is required.

The problem however  is the accuracy of reversals. Assuming that drive is rotating at 60rpm, it will be  1 revolution or  360 deg per second. Or  0.36 deg per millisecond. My loop timing ( intervals between  each poll of the encoder feedback )  is 25ms. ( I cannot reduce this due to some other issues ).

Thus the maximum delay after which I will capture a reversal match is 25ms or 25 x 0.36 = 9 degrees. And this can vary as it is not synchronous with the timed loop.

I simply want to restrict this reversal error to within +/- 2 degrees.

( Other options like deceleration before reversing, switching over to position control mode of servo drive etc  are` there. But are difficult to bring
in at  this stage of the machine trials )

Any ideas ?

Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 1 of 6
(3,151 Views)
Can you save your vi as 7.0 format?? Are you using separate loops to acquire position data and control motion??
0 Kudos
Message 2 of 6
(3,143 Views)

Hi Raghunathan,

Create a second time loop with higher priority than the time loop which takes 25ms. You can create many such independant time loops. LV gives each loop a unique name which you can change (ensure your custom names are also unique).

Run the counter compare event in the high priority loop. Pass values (or even loop stop and start) from high value to 25ms loop.

If your high priority loop is lean, it can be expected to run with time load of less than 1 ms. Thus, you could control your reversal error to less than 1 degree!!

Hope this helps.

- Gurdas

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 3 of 6
(3,140 Views)
Hi Gurudas,

yoru reply gives me lots of hope and I think  I get what you are getting at. Only problem is to put this new thing into the code that we have - what I posted was a just a sample to highlight the problem. The actual code is a mammoth one with about  5 different  time loops already. Anyway let me work on your idea and get back .

thanks

raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 4 of 6
(3,136 Views)
Hi Raghunathan,
 
My experience with time-loops has been very bad. We practically re-wrote the complete DAQ code of a project because time-loops kept giving problems. The issue was tested and discussed between us, NI-India and NI-USA but finally we could not solve it. NI even changed the PXI controller!
 
When nothing worked, we replaced all time-loops with good old while-loops. Our time-loops were being run by a counter which was receiving  signals coming from an encoder. So, what we did was run a while-loop and kept reading counter value and depending on the value activate the case which was carrying the real meat. This worked flawlessly!
 
Time loops are great but they are also new to LV. So, if you are the cautious kinds, maybe you should consider avoiding them as of now or atleast minimising their usage. 5 different time-loops if running simultaneously does not sound as robust programming (unless the requirement is really for such a code).
 
What is the feedback on time-loops from other members reading this message?
 
Best,
Gurdas
 
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 5 of 6
(3,130 Views)
Dear Gurudas,

Yes I have been forewarned on these Timed loops and I have taken care to prioritize the different loops and there have been no issues. Most of my  I/Os are quite comfortable with even 100ms loops - but this odd one alone needs to be handled like an interrupt.

 I also do extensive assembly and C-Coding for microcontrollers and  there microseconds are a breeze with the multi level prioritized interrupts. As such this limitation of the  LV is driving me nuts. I do agree that there is enormous overhead of the OS and the code itself to be carried out - but then I am talking about 2.6 GHz Pentium -IV motherboard. Most of my microcontrollers run at 12MHz`clock rates ! I am fully aware of both scenarios- just ranting aloud !

I have completed 3 different projects for full machine control and DAS with LV and Timed loops. No problems till date - maybe all of them are at 50ms rates - nothing faster.

Regards

R.raghunathan



Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 6 of 6
(3,115 Views)