Power Electronics Development Center

cancel
Showing results for 
Search instead for 
Did you mean: 

matrix Manipulation in FPGA

Hey everyone

I’m trying to do a 5 by 5 matrix inverse in labview FPGA. However I can’t find a existing function or library can do the job.  I wonder if anyone has some experience on this kind of program? Or if NI has some already build library for this.

Thank you

Regards

Jia 

0 Kudos
Message 1 of 4
(4,824 Views)

Good idea to move this topic to it's own thread. Let me do the same with my reply. . .

Primarily, I recommend that you take a look at reformulating the problem mathematically to eliminate the need for matrix inversion altogether (i.e. using a direct form solver). Matrix inversion can be numerically problematic.

If inversion is required, I recommend you perform the matrix inverse on the real-time processor and pass the inverted matrix to LabVIEW FPGA. Matrix inversions, even for a relatively small matrix like a 5x5, can be problematic in single-precision math because a single coefficient is multiplied by other coefficients many times resulting in accumulation of numerical error. Therefore, double precision math is strongly recommended for matrix inversions.

Here is a screenshot showing an example (from the open source Multisim circuit netlist to LabVIEW FPGA real-time SMPS circuit simulator project.) You can find the Inverse Matrix VI in LabVIEW RT/Windows by right-clicking on the block diagram and going to the Mathematics>Linear Algebra palette.

10-29-2015 9-54-25 AM.jpg

If you do have to perform the matrix inversion at FPGA speeds, the most likely way to implement it would be to do the 5x5 matrix inverse symbollically (using a computer algebra system such as Mathematica) and then implement the equations graphically in LabVIEW FPGA (using non-reentrant subVIs from the floating point algorithm engineering toolkit to share resources). Use IP Builder (a high level synthesis tool that's included with LabVIEW FPGA) to create an efficient FPGA implementation that meets your latency constraints. (See my post here for IP Builder examples by Brian_K.) Even then, you'll need to validate each solution against a double-precision floating point version executed on Windows or RT.

I hope this is helpful! Please keep us posted on your developments.

0 Kudos
Message 2 of 4
(3,971 Views)

Thank you

Another question is I have a piece of VHDL code which can do 5 by 5 matrix inverse. Is there a way that I can bring that piece of code in to labview to create some kind of VI so I can use it in labview?

regards

jia

0 Kudos
Message 3 of 4
(3,971 Views)

You bet. Yes, you can absolutely incorporate VHDL and Verilog code. See here for tutorials:

http://www.ni.com/tutorial/7444/en/

0 Kudos
Message 4 of 4
(3,971 Views)