Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

pci-7342, onboard dsp and pid

Hi
 
I am currently working on a system where we use the PWM capability of the pci-7342 board to set the speed of a motor.
 
In theory it is fairly simple, I sample the encoder position every n ms, compare the speed to the setpoint value, and feeds it to a PID controller (home-made in labview). This gives me a PWM duty cycle, and it works ok.
 
The problem is that, using labview, I use a timed loop and it is hooked to the standard 1 kHz timer. That gives me a minimum loop time of 1 ms, and I would like it to be faster.
 
The pci-7342 board has several axes, which may be programmed and tuned using the onboard dsp. For the axes the are posibilities of doing profiles and controling the movement using a PID controler. I would like to know if it is possible to use these controller to output something else than the signals for the servo/stepper channels.
 
It seems that I could build my own pid-loop using register and basic arithmetics. Does anyone have a link to an example program for an onboard pid controller?
 
Also, I have been unable to find the clockfrequency of the internal dsp. Is it fixed or does it just run as fast as possible?
 
Links, comments or code samples would be appriciated.
 
Regards
Morten
0 Kudos
Message 1 of 3
(4,169 Views)

Morten,

it looks like you are a little bit on the wrong track here. The 73xx boards run the trajectory generation and the PID loops on the DSP. This ensures deterministic and stable system behavior, as the DSP has direct access to the IOs.

In your case you are using the motion board as a simple I/O-board, bypassing all the onboard intelligence. This is not the intended use case for these boards and the system behavior will be everything but fast and deterministic, as all the I/O operations need to run through a low priority process on the onboard CPU. With a timed loop running at 1 kHz you will get a jitter that is in the millisecond range, destroying the deterministic behavior that is required for a stable PID loop.

 

I understand that you are doing this because you need to generate a PWM signal instead of a +/-10 V DC signal, but this approach won't work.
Unfortunately onboard programming will not result in better behavior, as onboard programs run also in a low priority thread on the onboard CPU without direct access to the IOs. In terms of jitter onboard programs don't perform better than host PC applications and loop rates may be even slower.

So here are some alternative approaches:

  1. For the case that you are working with motors from PI (Physikinstrumente), there is a drive available from PI, that converts the +/- 10 V signals of a NI motion control board to PWM signals required by PI motors. Here is the link.

  2. Use an NI multifiunction board, like a PCI-6221 instead of a motion control board. Even if you use this board under Windows, you will get much better I/O performance, as you can access the I/Os directly through the NI-DAQmx driver interface. Still this is not a really good option, as Windows introduces a significant amount of jitter to your control loop, which will make your system unreliable.

  3. Same idea as in 2.) but run the system in a real time environment (LabVIEW RT). This will greatly improve the performance (timed loop with µs-resolution timer or hardware timing) and system reliability (jitter in the lower µs range). Additionally you could use the NI softmotion development module, that provides all the functionality of a motion board (e. g. trajectory generation, advanced PID algorithms, spline engine,...) in a convenient LabVIEW library.

  4. As a very high performance option you could consider using an NI CompactRIO system, that allows you to run the motion control on a combination of a LV RT controller and an FPGA, both programmed with LabVIEW.

I hope this helps,

Jochen Klier
National Instruments

0 Kudos
Message 2 of 3
(4,164 Views)
Jochen,
 
Please forgive us of little faith 🙂
 
I have spend some time on it now and must conclude, that you are correct. I tried to loop the analog output to a vacant analog input, and tried to make an onboard program that converted the value to PWM. It is a viable solution except that it turned out to be slower than timed loops in labview 😞
Also, as you mentioned, the loop times for the onboard program are irratic, changing from 7 to 14 ms. So I decided that it was not possible do a predictable and 10-20 times faster implementation of the onboard program.
 
We are now looking into other hardware solutions, that will permit us to use the +/-10V output.
 
Thank you for the detailed reply.
 
morten.
0 Kudos
Message 3 of 3
(4,112 Views)