1 / 13

Speeding Up Your VIs

Speeding Up Your VIs. 參考 NI 官方教材: LabVIEW Intermediate II for 7. Speeding Up Your VIs. Improve memory use Use efficient array functions Carefully manipulate strings and arrays Avoid unnecessarily complex data structures. Reduce I/O overhead GPIB Data Acquisition File I/O Networking

Download Presentation

Speeding Up Your VIs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Speeding Up Your VIs 參考NI官方教材: LabVIEW Intermediate II for 7

  2. Speeding Up Your VIs • Improve memory use • Use efficient array functions • Carefully manipulate strings and arrays • Avoid unnecessarily complex data structures • Reduce I/O overhead • GPIB • Data Acquisition • File I/O • Networking • Reduce screen updates • Use efficient indicators (graphs and charts) • Eliminate unnecessary controls/indicators

  3. Reduce Number of I/O Operations • File I/O, GPIB, DAQ, Networking VIs • I/O VIs take much more time than computational operation • Minimize the number of I/O calls • Transfer a lot of data in each call • Use multiple-point DAQ VIs instead of single-point VIs Slow Method(many I/O calls) Fast Method(One I/O call)

  4. Reduce Opening and Closing of Resources • Use low-level VIs to reduce the number of times a resource is opened and closed. • In Slow Method, the file is opened and closed 100 times. • In Fast Method, the file is opened and closed only once. Slow Method Fast Method

  5. Reduce Screen Display Updates • Updating front panel objects can be time consuming • Use efficient controls and indicators • Graphs and charts redraw when they receive new data and therefore affect execution speed • Minimize display overhead by designing subVI’s with front panels closed during execution • Use multiple-update plotting methods • Minimizes the number of chart updates • Get highest data display rates

  6. Screen Display Example Slow Method(updates chart 1 point at a time) Fast Method(updates chart 100 points at a time)

  7. Reduce SubVI Overhead • Each subVI call involves certain overhead (tens of µs); not significant, but this can add up if the subVI is placed inside a looping structure. • Do not display the front panels of subVIs called in a loop running at high speed. • If possible, place the looping structure inside the subVI instead.

  8. Reduce Unnecessary Computation in Loops • Avoid putting calculation in loops that produce same value each iteration • Avoid unnecessarily accessing global variables in loops

  9. Global and Local Variables • Each read of a variable creates a new data buffer for the data • Can add up significantly if using large arrays, strings or complex data structures • Using a wire is always more efficient, both in memory and execution time

  10. Property Nodes and Control References • Runs in the user interface thread • Using a property node or control reference results in a thread swap which causes a loss in efficiency • Do not use a property node or a control reference only to update the value of a control • If changing other properties, adding a value update does not cause a further loss since thread swap is already occurring

  11. Updating the Value of a Front Panel Object Good Better Best

  12. Updating the Value of a Front Panel Object Bad Good

  13. Create Efficient Parallel Diagrams • LabVIEW periodically switches between parallel loops • Use the Wait (ms) function - this ensures that less important loops use less processor time • A wait of 0 will also free the processor for other tasks!

More Related