LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setup data on controller

Hello,

 

I am looking at getting the R-Series NI-7853R. I am not sure exactly which controller or chasis yet.

 

We are going to be using it for closed loop control. This means that we will read in an analog value, run it through our control algorithm, do a digital output based on the resluts from that control algorithm, and then the next reading we take will have been affected by our digital output and we will repeat these steps for 1000 iterations.

 

We have already written our program using LabVIEW Real-Time module, and now we must convert it to be LabVIEW FPGA module compliant. I have a few questions.

 

1.) We pre-compute 12 arrays of about 1000 elements each and about 10 different fixed-point values that remain constant throughout the program (but can be changed each time we run the program again, as we may need to tweak our algorithm).  The math involved in this is somewhat intensive and long. Also, this math only needs to execute at the very beginning of the code and we just need the final outputted arrays and constants to be used for our control loop. Each array will be indexed at every iteration of our control loop (i.e. we will index the 0th element of every array at iteration 1, the 1st element of every array at iteration 2, and so on). This said, it would not make sense to take up room on the FPGA with these math computations that are used to compute the arrays and constants. These computations also use a lot of the built in math functions (such as sin, cos, atan2, etc). We also have a lot of formula nodes in place for these computations. Is there anyway that I can have these computations execute on the controller (or wherever it needs to) and transfer the 12 computed arrays and 10 constants to the FPGA Board and then run our control program on the FPGA? This would save a tremendous amount of conversion time, as well as space on the FPGA.

 

2.) I was told I could use lookup tables instead of arrays. But when I try to use the 1-D Look-up Table in the FPGA module, it tells me I can only use signed and unsigned integers. I need these to be fixed-point. Do I have to use Look-Up Tables? If I use arrays instead, will it actually use up gates on the FPGA or will it just use the onboard memory (the 384 KB that are specified for the 7853-R)? If it just uses that onboard memory space then I don't see a problem, as 12 arrays of 1000 32bit fixed-point elements is only 48KB which leaves plenty of space on the 7853-R for the rest of our program (which really isn't all that much). If it is the case that is uses the onboard and we need a little extra, we can always get the 7854-R as well. But if it does not use the onboard memory and for some reason takes up an unreasonable amount of gates, how do I correctly represent arrays of fixed-point elements on the FPGA board?

 

I should mention that we ultimately want everything that we need loaded onto the FPGA board, that way it does not need to communicate with the controller during execution. The only time we want to communicate back to the controller is after the program is done executing. At that point, we will want to pass back some arrays to our host computer so that it may graph the data and we can see what happened. That means we will also need to fill a few arrays, just 3 or 4 of 1000 elements, during our program execution. So the only communication we want with the controller is to transfer over all of the data needed for our program to run, and then to transfer back 3 or 4 arrays that contain the data we want to graph. We DO NOT want to communicate with the controller DURING execution, as we feel this will greatly reduce our speeds and determinism and we will end up with the same problem that we are having now using a Desktop-PC as a Real-Time target. So we want to avoid that at all costs. Once again, we just want the controller to send data before the control loop execution, and recieve data back after execution is finished. Absolutely no communication during execution (essentially a %100 embedded program).

 

Thank you very much.

 

Brian Fehrman

Software Engineer

SDSM&T Advanced Dynamics Lab

0 Kudos
Message 1 of 2
(2,529 Views)

Hi Brian,

 

1)  You can use a DMA FIFO to quickly transfer the data from the host to the FPGA target.  I would store the data in RAM rather than as arrays, as arrays will use a large amount of FPGA fabric.  You can then use a boolean flag to tell the FPGA program when to begin its work after receiving the data.

 

2)  The Lookup Table VI is limited to signed and unsigned integers.  You can use the block memory as a look up table, and it can hold most data types, including fixed point.  If you want to use the Lookup Table VI, depending on the width you need for your fixed point data, you can store the data as a 32 bit integer and convert it back to fixed point after indexing it out of the table. Ultimately, with the amount of data you have, I would use the RAM rather than an LUT.

 

Note that you can perform DMA transfers during program execution without harming the determinism of your application.  The FPGA can load the DMA FIFO as it processes data, and the host can read the data at its leisure.  You can configure the FIFO write so that the FPGA doesn't need to wait for space to be available in the FIFO.  This is commonly done in realtime DAQ and control applications with FPGAs where constant communication from the FPGA to a host controller is required.

 

 

Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,496 Views)