03-01-2009 01:24 PM
HI all,
I want to implement a general open loop VF control using space vector modulation. The desired switching frequency is 20khz,so every 50us I need to calculate the duty cycle based on magnitude and angle of the vector(which are related to frequency). Since these calculations are in floating-point, I put them in an RT vi and use the FPGA interface to write the results to an FPGA-based single-cycle timed loop which generates 20khz PWM pulses. But the resulting pulses are not right: the fundamental frequency is less than the desired frequency(50hz) and there seems to have a very low frequency(less than 1hz) modulation. I wondered whether it's the synchronization problem between RT vi and FPGA vi since I put floating-point caculation in RT vi(and the results need to be read every 50us). If so, how can I get rid of this problem?
Is it not possible to use simillar structure in Labview envirenment as in the DSP-FPGA based control such that DSP performs fast floating point caculation while FPGA simply generate pulses?
I'm considering to put the SVM calculation into FPGA vi. But I'm not sure the results will still be accurate as FPGA only performs integer and fixed-point operation.
I'm using crio9014 controller, and ni 9401 for digital output.
Regards,
Jiang
03-04-2009 06:35 AM
Hi,
Welcome to the National Instruments forum! I have been looking into your issues and found some links about doing PWM on FPGA which I believe will be useful:
http://zone.ni.com/devzone/cda/tut/p/id/3254
http://forums.ni.com/ni/board/message?board.id=170&message.id=368712&requireLogin=False
http://zone.ni.com/devzone/cda/tut/p/id/5963
How accurate does your application need to be? Do you have to use floating point, or would you be able to get away with integers or fixed point?
03-04-2009 09:39 AM
Hi Jiang,
You mentioned that it may be a synchronization problem between RT and FPGA.
Are you using any synchronization methods? You will need to use the Wait on IRQ function to synchronize your calculated values with the PWM updates.
If you don't use any synchronization methods, then your FPGA and RT VI run completely asynchronously.
Here is the online help for Wait on IRQ:
http://zone.ni.com/reference/en-XX/help/371599D-01/lvfpga/interrupt/
You can also find examples of using it in the Example Finder.
Kurt
03-04-2009 11:01 AM
Hi Kurt,
Thanks for replying me. I've also noticed some of the syn methods provided by labview. I found one of the on-line tutorials about using interrupt to syn FPGA and RT vi.
http://zone.ni.com/devzone/cda/tut/p/id/3555#toc6 -- in lesson 7 they disscussed using IRQ as one possible solution
But it was also mentioned that an IRQ takes at least 250us and suggested not going faster than 1khz, while in my case I need a syn rate of 20khz. I'm not sure if I made it wrong or there's an updated version now providing high rate interrupt. If not, I wonder is there any other way of dealing with this syn problem?
Cheers,
Jiang
03-04-2009 11:11 AM
mickeyw wrote:Hi,
Welcome to the National Instruments forum! I have been looking into your issues and found some links about doing PWM on FPGA which I believe will be useful:
http://zone.ni.com/devzone/cda/tut/p/id/3254
http://forums.ni.com/ni/board/message?board.id=170&message.id=368712&requireLogin=False
http://zone.ni.com/devzone/cda/tut/p/id/5963
How accurate does your application need to be? Do you have to use floating point, or would you be able to get away with integers or fixed point?
Hi,
Thanks for replying. I'll have a look at these links. Now I'm thinking of using fixed point rather than floasting point so that it will avoid the tricky thing of syn RT and FPGA in such high rate motor control. Thanks for advice.
Jiang
03-04-2009 04:11 PM
Take a look at some of Ben.B's stuff on ni.com/community
http://decibel.ni.com/content/people/Ben_B?view=overview
There is IP for space vector modulation, V/F control and others for brushless motors. Probably find something applicable to your needs.
Marcus