10-04-2006 04:26 AM
10-04-2006 09:32 AM
Hello Soeren,
Please also attach your Shared Variables file which is needed to open the project.
Based on your description I don't think that the problem is related to the communication between LabVIEW RT and the FPGA, but related to the use of the shared variables. The configuration that you have used for each of the variables will affect the performance of the accesses to the shared variables.
10-04-2006 10:51 AM
Ok, i forgot, here are they, I attached the project file also.
10-05-2006 11:48 AM
Hello Soeren,
The short answer is that you are trying to do too much in each of those loops which is loading up the processor to 100% load.
I did a quick benchmark of the network shared variables with RT FIFO and they take about 60-70 us (microseconds) per read or write operation on the cRIO controller. This also depends on your network configuration between the cRIO system and the machine that is hosting the Network Shared Variables.
Local (single process) shared variables with RT FIFOs take about the same amount of time, while local shared variables without the RT FIFO take about 20 us.
In summary you should reduce the amount of shared variables that you use in your loops. One alternative to using so many individual shared variables to transfer data to the host, is to collect all the individual data points into one array and pass the array using a single array type shared variable. On the host you can separate the array back into the individual data points. This will significantly reduce the overhead. another option would be to collecte the data in an array and use TCP/IP communication to transfer the data to the host.
In your bottom loop where you are logging data to disc, you are opening and closing the file for every write operation. This will take up significant amounts of time. You should open the file once at the beginning of the
In the top loop as part of your FPGA communication your are reading and writing several values that never change during the execution of the application. These include AI Channel Settings, AI Calibration, and Loop Rate TC (ms). You should only access these values once on the FPGA before you start the loop and then use the local values inside the loop rather than reading/writing them from the FPGA every time.
One of the terminals on the inside left side of the Timed Loop allows you to retrieve the duration of the previous run of the Timed Loop. Use this information to further identify which of your two loops is taking up more time and needs to be further optimized.
10-20-2006 07:01 AM
Hi again
Thanks for the feedback, it was helpfull.
I tried the "use less shared variables, and put them in arrays" strategy and the reduced the number of shared variables significantly, although there are still room for improvement. Although things are working a bit better than before, I don't see a significant improvement, and I can't raise the Deterministic loop frequency very much :(, maeby I'm just trying to do too much at once. Is there anyway to find out which steps in the loops are the time critical ones?
I have attached the changes, the FPGA vi used is the same.
Hope you can help me
Soeren
10-20-2006 07:02 AM
10-23-2006 10:44 AM
Soeren,
I did some more looking at your code, and noticed the Configure Formula Express VIs that you are using. These VIs are not as efficient as the Formula Node or implementing the same code using LabVIEW math functions.
Please replace these Express VIs with the Formula Node, which is located on the Structures functions palette, and you should see a significant improvement. I have attached a basic example comparing the performance (benchmark) of the ExpressVI against the Formula Node and basic LV math functions.
In addition to using basic benchmark techniques like I have shown in the attached example to determine how fast different functions run in LabVIEW, you can use the LabVIEW Execution Trace Toolkit to look at the detailed timing performance of LabVIEW code. This tool will give you a graphical representation of different pieces in your loop and how long they take to run.
10-24-2006 01:45 AM
Hi, thanks for the fast reply
I sort of expected the Formulas being slow, so I have already started removing them. Looking forward to see if the changes you suggest increase the program speed.
Regards
Soeren
11-10-2006 04:40 AM
11-10-2006 04:40 AM