From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding velocity control on 9505 FPGA VI

Solved!
Go to solution

I was able to quickly use the 9505 Servo Drive example to do closed loop position control on the FPGA but I'm having trouble with figuring out how to modify the code to support velocity control (which I need for a different axis).  I'm trying to make my modifications on the FPGA VI itself rather than on the RT Softmotion side.

 

Here are the issues I'm having:

If I use the PI Velocity Loop with my Velocity and an arbitrary control setpoint velocity, I can see the velocity stabilizes (motor output looks uniform) but I can't correlate it with the velocity setpoint other than a bigger number is faster.  Velocity (from the Encoder loop) seems to readback in values of just 0-2 on my FPGA VI (I don't fully understand the units but I see my position change on my encoder readback in thousands of counts per second).  Why are they so different/how do I scale my encoder velocity correctly?

 

 

Using just the shipping 9505 Servo Drive example (position control), how do I set the velocity of a move from within the FPGA code (in interactive mode)?

0 Kudos
Message 1 of 6
(6,255 Views)

Hello,

 

The Velocity FOC FPGA VI within the Velocity FOC example project contains a velocity control loop that you may want to check out. You can find this example under Toolkits and Modules>>NI Softmotion>> NI 9502. This example was written for the 9502, but I believe that the velocity control loop should be transferrable.

 

-Erik S.

0 Kudos
Message 2 of 6
(6,217 Views)

Hi Eric,

 

I looked at the Velocity FOC VI and it did give me an idea that I'll test once my FPGA VI completes - I may have had my Encoder loop 'calls per sample encoder' at a different value than my velocity control loop rate.  I hope that solves the problem of why my velocity is reporting such a low number.

 

I still don't understand how to set the velocity of a move if I'm using position control (out of the box example) from within the FPGA code (on the 9505 example).  Is the best way to do this just to limit the 'Current Output Range' depending on the max velocity requested?  The NI Softmotion RT VIs and Express VIs are able to set 'Velocity' but I'm really unclear what that is doing in terms of interacting with the FPGA code.  Can you explain how that works?

 

Thanks!

0 Kudos
Message 3 of 6
(6,212 Views)

I was able to get my velocity readings to match my velocity setpoints when using velocity control mode by increasing my Timer Config.Target Period and  Encoder 'calls per sample encoder' from 2000 to 40,000.  Now my velocity readback is +/- 1 of my velocity setpoint for my drive range.  This makes sense to me now - if you read the encoder to quickly it hasn't accumulated enough points to accurately calculate the velocity.  It was in the documentation but I didn't fully understand it.

 

So now I'm down to one question - (from last post):

I still don't understand how to set the velocity of a move if I'm using position control (out of the box example) from within the FPGA code (on the 9505 example).  Is the best way to do this just to limit the 'Current Output Range' depending on the max velocity requested?  The NI Softmotion RT VIs and Express VIs are able to set 'Velocity' but I'm really unclear what that the SoftMotion RT VIs are actually doing in terms of interacting with the FPGA code.  Can you explain how that works?

0 Kudos
Message 4 of 6
(6,205 Views)
Solution
Accepted by topic author Omar_Mussa

Hello,

 

Velocity is set through position setpoints. The velocity control in the RT VIs does not actually send velocity commands to the drive, but sends position setpoints at a known rate. Since the position setpoints are sent at a constant rate, an effective velocity can be calculated. 

 

One method to do this through the FPGA would be to synchronize a loop in your FPGA code to the Scan Engine, which has a known rate. Once this is done, you can calculate the effective velocity of your motor.

 

-Erik S

Message 5 of 6
(6,190 Views)

Thanks Erik, that is really helpful.  It was not obvious for me.

0 Kudos
Message 6 of 6
(6,188 Views)