Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

real time performance LV 8.2

Hi All, I'm using LV 8.2 Real Time Module with a cRIO chasis.  I have attached some code and I'm asking for advice as to how to speed up this execution.  junk(RT) calls the Process Data subVI, which is prioritized at the subroutine level.  Are there any tricks to speed up this execution? Or is this the best I can do?

Regards,

Ndo
Download All
0 Kudos
Message 1 of 5
(6,538 Views)
Hey ndo,
 
We have some great documents on the web that offer tips and tricks to optimize your real time code.
 
 
 
Take a look at those links, and see if that can be applied for anything you are doing.
 
Regards,
 
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer
0 Kudos
Message 2 of 5
(6,514 Views)
Kevin,

Thanks for the links.  I've already tried everything that those links suggest.  I have not been able to figure out how labview handle loops, subVI's and arrays, although the overhead seems to be quite substantial.  I have built a DLL that seems to do the same operations in 1/4 the time. 

Regards,

NDo
0 Kudos
Message 3 of 5
(6,455 Views)

Hey ndo,

After speaking with an engineer from R&D, I believe I have some relevant information to pass along.

1) RTJunk.vi appears to be a benchmarking VI. While this is a very good start, we do offer a benchmarking VI that ships with LabVIEW, and provides an easy way to benchmark your code.  You can find this project file by opening LabVIEW, and going to Help >> Find Examples.  Once you are in the NI Example Finder, select the Toolkits and Modules >> Real Time >> Benchmarking folder.  You can place your code in that VI, and get benchmarks from that.

2) Try changing the Process Data VI from a sub routine to a Time Critical VI. That could increase your performace.

3) Your Process Data VI could use some memory improvement. Currently every time you call the VI, you are having to allocate new memory for the arrays you are using.  First, I would suggest passing the input array into the Process Data VI. Second, I would recommend that instead of using Array Subset VI, I would first use Initialize Array to create the memory space, then use Replace Array Subset to put that data into that Array.  I have included a picture below of an example of how to preallocate array memory, and fill it using the Replace Array Subset.

Some other points about Memory Management:

  • The LabVIEW Real-Time Module memory manager is a shared resource
  • It is recommended that all memory allocations be removed from a time-critical loop
  • It is a good idea to preallocate arrays outside of the time-critical loop

Also, many of these topics are covered in our LabVIEW Real Time Customer Education class.  If you are interested in learning more about that, I can get you that information as well.

 

Regards,

Kevin H



Message Edited by Kevin_H on 01-16-2008 03:43 PM
National Instruments
WSN/Wireless DAQ Product Support Engineer
0 Kudos
Message 4 of 5
(6,152 Views)

Ndo,

It is worth noting much of the information Kevin has presented is available in our LabVIEW Module Training self-paced course. This subset of the instructor-led Customer Education class is a great resource for anyone with general questions about LabVIEW Real-Time (or LabVIEW DSC or LabVIEW FPGA, for that matter). If you find the information useful and want to program larger applications in LabVIEW Real-Time, I highly recommend the LabVIEW Real-Time Customer Education course.

Please pay particular attention to Chapter 3 and Chapter 6, since they discuss your memory questions in-depth.

Cheers.

 

| Michael K | Project Manager | LabVIEW R&D | National Instruments |

0 Kudos
Message 5 of 5
(6,133 Views)