In-depth exploration of LabVIEW's internal and external conditional structures

Publisher:平和宁静Latest update time:2015-08-25 Source: eefocusKeywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
        The conditional structure (CASE) is one of the commonly used structures in LV. The most typical conditional structure is the conditional structure with error handling, which is often used to avoid the use of sequential structures. Different from the conditional structure of C language, for display controls, all CASE branches must pass data (assignment) to the display controls or directly use the default value, and no output is allowed.

        In a conditional structure, there are two completely different ways to handle display controls. Although these two methods seem to be not much different on the surface and may have been used in specific programming, the operating efficiency varies greatly when processing large data, such as large arrays, and may inadvertently cause the program to run slowly and be difficult to detect errors.

Method 1: Display input controls and indicators outside the case structure. In this method, the input controls and indicators are located outside the case structure branch. As shown in the following figure:

        

 

Method 2: Processing controls and indicators in a case structure. In this method, the controls and indicators are placed in the case structure branch. From the flowchart, it seems to be more concise, but it is very wrong, as shown in the following figure.

In method 2, no processing is performed in the error branch, and the input and display controls are placed in the non-error branch.

OUT.VI and IN.VI implement exactly the same functions, but their running efficiency is very different. The larger the array, the more obvious the difference. Of course, the running time will be different on different computers. The following is the test program flowchart.

 

Below are the test results. The running time of the two differs by more than 20,000 times.

Next, we introduce a "top-level flowchart". The top-level flowchart is often seen in articles written by LV enthusiasts, but there is no such concept in LV-related books. In OUT.VI, the input controls are on the left and the display controls are on the right, both outside of all structures. The area outside of all structures is called the "top-level flowchart", which is similar to the formal parameter part in C language.

In the top-level flowchart, the running efficiency is extremely high. This is because before entering the subVI, LV can easily determine that the cache is reusable, so there is no need to copy the array each time in the loop. However, when the input control and indicator are located inside the conditional branch, LV may not be able to determine that the cache is reusable, so the value copy method is used, which sacrifices efficiency but ensures the correct result.

Method 2 seems more reasonable on the surface, but it is wrong. Therefore, we can conclude that the input controls and display controls in the subVI should be located in the top-level program flowchart and should not be located in any structure.

Keywords:LabVIEW Reference address:In-depth exploration of LabVIEW's internal and external conditional structures

Previous article:In-depth exploration of LABVIEW: linked control references and unlinked control references
Next article:In-depth exploration of LabVIEW - double precision number accuracy issues

Recommended ReadingLatest update time:2024-11-16 13:33

Communication simulation based on LabVIEW (Figure)
Introduction ---LabVIEW, launched by NI, is an excellent object-oriented graphical programming language. It uses icons instead of text codes to create applications and has a large number of VI libraries for communicating with other applications. As one of the most widely used data acquisition and control development e
[Test Measurement]
Communication simulation based on LabVIEW (Figure)
LabVIEW 1.0 Programming Environment (Graphics and Text)
LabVIEW 1.0 was born in 1986. Do you want to see what LabVIEW looked like at that time if you have used LabVIEW 7.0 or above? Here are some screenshots of LV 1.0. I forgot where I got them, but they should be quite valuable.
[Test Measurement]
LabVIEW 1.0 Programming Environment (Graphics and Text)
Design of periodic signal and random signal amplitude eigenvalue obtaining system based on LabVIEW
introduction LabVIEW has two basic windows, the front panel window and the flowchart window. The front panel window is used to set control objects and display objects, which is equivalent to the display screen or pointer of a conventional instrument; the flowchart window is used to write and display the graphic
[Test Measurement]
Design of periodic signal and random signal amplitude eigenvalue obtaining system based on LabVIEW
Developing a novel portable smart greenhouse using graphical system design
  A greenhouse in Mexico is about to use a portable smart greenhouse system   author:   Pedro Ponce - Monterrey Institute of Technology   industry:   Life Sciences, Consumer Products, Scientific Research   product:   cRIO-9014, NI 9265, NI 9215, USB-6211, LabVIEW   challenge:   Create a smart system
[Test Measurement]
Developing a novel portable smart greenhouse using graphical system design
Using LabVIEW to simulate and control pulp production in a large paper mill
Industries: Manufacturing, Pipe/Paper Products: Data Acquisition, Data Recording and Monitoring Modules, Labview Challenge: Create a system to monitor the pulp production process in a large paper mill to save energy and reduce costs. Solution: To increase throughput, save energy, and optimize the production p
[Test Measurement]
Using LabVIEW to simulate and control pulp production in a large paper mill
Dynamic Event Modification in LabVIEW
  If you register for events dynamically, you can modify the registration information at run time to change the object for which LabVIEW generates events. To modify an existing registration associated with a refnum instead of creating a new registration, wire the event registration refnum input in the upper left corner
[Test Measurement]
Design of multi-physics field measurement system for marine environment based on LabVIEW
I. Introduction In recent years, with the increase of human efforts in the development of the ocean, the research on the ocean has become more extensive and in-depth. Correspondingly, various environmental physical fields in the ocean have also become the focus of research. Because the understanding of the physical fi
[Test Measurement]
Design of multi-physics field measurement system for marine environment based on LabVIEW
Using LabVIEW and CompactRIO to Automate a Washing Machine Production Line
Conveyor belt with all positions and hand controls marked Author: M. Malovrh - Bosio doo D. Kovacic - Bosio doo A. Romih - Bosio doo K. Martinovic - Bosio doo Industry: Consumer Goods, Industrial Control/Equipment/System Products: NI 9425, PPC-2115, NI 9211, NI 9476,
[Test Measurement]
Using LabVIEW and CompactRIO to Automate a Washing Machine Production Line
Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号