Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

ADC acquisition not happening in onboard program

Hi all,
 
I have a PCI 7342 motion controller configured as open loop stepper. I have a Servo drive and motor connected to it. The ADC on the PCI-7342 is a 12-bit one. So 10V means 4096 ADC counts. I have a pot which gives 0-10V on rotation. I have configured my drive such that it takes in 4096 steps for one rotation of motor. I checked it by going to Max 1D interactive and giving 4096 steps. I'm trying to make the motor follow the pot. So I wrote a VI where I acquire ADC data in terms of counts and directly feed as steps to the 'load target position vi'. It works fine. I have attached the VI. Now I tried to convert this VI into an onboard program, but it doesn't work. I have a doubt that the ADC acquisition is not happening onboard. I need help converting this attached VI into onboard
 
Regards,
Giridhar Rajan
0 Kudos
Message 1 of 7
(4,249 Views)
Giridhar,

reading the ADC works fine in an onboard program but you can't use real dataflow programming in an onboard program to pass dynamical data from one vi to another. Instead of that you will have to use the return vector input to store the value in an onboard variable and use the Input vector of the Load Target Position vi to get the target position from the onboard variable where you have stored the ADC value before.

On the other hand I think for this application you shouldn't need to use an onboard program at all. A much better and easier approach would be to use Electronic Gearing with the ADC as gear master. You should use the shipping example "Master Encode - Slave Axis Gearing.vi" and delete the Master Encoder control on the front panel. Create a new control for the Master Axis Encoder or ADC input of the Configure Gear Master.flx vi to be able to select the ADC channel as gear master. Note that you need NI-Motion 7.3 to be able to use an ADC as gear master.

With electronic gearing everything is done by the DSP on the board so you will see much smoother motion compared to the onboard programming approach.

I hope that helps,

Jochen Klier
National Instruments Germany


Message 2 of 7
(4,246 Views)

Jochen,

Thanks a lot. My onboard program worked. Regarding gearing, my actual application is something else, while this pot arrangement is just a trial. In my application I'll will have an LVDT with analog o/p and I have to implement a PID algorithm for taking f/b from it. Any tips on PID will be helpful as I have never tried one.

Regards,

Giridhar Rajan

0 Kudos
Message 3 of 7
(4,240 Views)

I found some good documents on PID. They should give you an idea of how the algorithm works.

PID Theory Explained:

https://www.ni.com/en/shop/labview/pid-theory-explained.html

Understanding Servo Tune (look at the manually tuning motors section):

https://www.ni.com/en/support/documentation/supplemental/12/understanding-servo-tune.html

Advanced Features of PID Tuning:

https://www.ni.com/en/shop/labview/advanced-features-in-pid-tuning.html

 

When using PID we generally apply the following method:

1. Start by setting the PID constants as follows...

Kp=1, Kd=0, Ki=0

2. Increase Kp slowly each time running a step response. Increase Kp until the step response has a maximum oscillation without becoming unstable.

3. Slowly increase Kd until all of the oscillations disappear.

4. Slowly increase Ki until the steady state error of system goes to 0.

 

Good luck with your application.

Christopher W.

0 Kudos
Message 4 of 7
(4,222 Views)

Giridhar,

the idea of using onboard programming for implementing a PID loop doesn't sound very promising. Onboard programs don't run deterministically as they run wihth lower priority than other critical tasks that run on the same CPU. Thus you will see a considerable amount of jitter that will make it quite hard or even impossible to tune the system properly.

A much better approach would be to use the NI SoftMotion Development Module and a real-time target. Please refer to these links for more information:

Creating Custom Motion Control and Drive Electronics with an FPGA_based COTS System
Can i use NI-7358 to implement a hybrid position force/torque control system?

Best regards,

Jochen Klier
National Instruments Germany

 
0 Kudos
Message 5 of 7
(4,216 Views)
Thanks Christopher W and Jochen for your reply. It was helpful. Now since I have already purchased the hardware, I have to make this work somehow with this hardware. But it cleared a major doubt as I used to think that onboard timing is deterministic.
Thanks again for both of you.
 
Regards,
Giridhar Rajan
0 Kudos
Message 6 of 7
(4,198 Views)

Dear  Giridhar , Please try  using PI controller . This will  help  you. I will ask manish to send you the VI. This we have done on AGIE machine.

 

REgards

 

 

Sudhir Sawant

0 Kudos
Message 7 of 7
(4,182 Views)