Learning LabVIEW (Part 3) - A change in concepts

Publisher:JoyfulJourneyLatest update time:2015-08-20 Source: eefocusKeywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
   The code given in "Learning LabVIEW (II) - Operating .NET Generic Classes"  yesterday is actually wrong. According to our assumption, Add is called first to put the Key-Value pair "eleven"-11 into the Dictionary, and then TryGetValue is called to find the Value corresponding to Key: "eleven". So the query must be successful. However, when executing yesterday's code repeatedly, the query fails occasionally, as shown in the figure below: Key: "eleven" has been added using Add, why does the query fail sometimes? The reason is that we use the wrong concept to write LabVIEW programs.  Traditional computer languages ​​are essentially written with the flow of instructions as the core, and the written codes are executed one by one in sequence. However, graphical programming languages ​​such as LabVIEW and Simulink construct programs with the flow of data as the core. When the program is constructed with the flow of data as the core, sometimes the execution order of instructions is not so obvious, and some instructions are even automatically executed in parallel without knowing it. I have consulted NI's customer service about this point, and they have clearly stated that the LabVIEW runtime will automatically use multi-threading to process functions that can be executed in parallel without user intervention. This is a very good feature, and it is also very consistent with the characteristics of graphical programming, which is centered on data flow.  However, when we draw LabVIEW programs with the previous concept of programming centered on instructions, we will make mistakes unconsciously. The code segment for writing and querying Dictionary yesterday is shown in the figure below: It seems that Add is executed before TryGetValue if it is executed from left to right. This is actually because the way the graphics are drawn confuses us. If we simply adjust the position of each node, as shown in the figure below: LabVIEW, which is centered on data flow, will not necessarily execute which function first. If TryGetValue is executed first, the query will fail.  How should this problem be solved now? LabVIEW's programming concept centered on data flow makes automated parallel programming possible on the one hand, and on the other hand, makes "sequential execution" a structure that requires explicit declarations; this is very different from traditional languages. Traditional languages ​​write code line by line, and are executed line by line, which is naturally a sequential structure.  We found the tool for representing sequential structures in the Programming column of the toolbox: use this flat sequential structure to frame the part that needs to precede the TryGetValue call, as shown in the figure below: In this way, the data will continue to flow down only after all the actions in the box are executed, so there will be no more query failures.
Learning LabVIEW (Part 3) - A change in concepts


   
   
Learning LabVIEW (Part 3) - A change in concepts


Learning LabVIEW (Part 3) - A change in concepts


    
   
Learning LabVIEW (Part 3) - A change in concepts


Learning LabVIEW (Part 3) - A change in concepts

Keywords:LabVIEW Reference address:Learning LabVIEW (Part 3) - A change in concepts

Previous article:Learning LabVIEW (IV) - MATLAB script node
Next article:Learning LabVIEW (II) - Operating .NET Generic Classes

Recommended ReadingLatest update time:2024-11-16 03:27

LabVIEW Robotics Module - Special Algorithms and APIs in the Robotics Palette
Overview This tutorial introduces the robotics algorithms that come with the LabVIEW Robotics Module software. From sensors to path planning, you can use this product to design the next generation of complex automation systems. The LabVIEW Robotics Module comes with a new, fully functional Robotics palette that co
[Test Measurement]
LabVIEW Robotics Module - Special Algorithms and APIs in the Robotics Palette
LabVIEW - Event Structure
Event Structure           Event Structure is also a selection structure. The program decides which page to execute based on the event that occurs. At this time, the interface programming of LabVIEW is somewhat similar to the interface programming of Visual Basic. 1. Differentiate between types of events accor
[Test Measurement]
Rapidly Prototype Measurement Systems Using LabVIEW and CompactRIO
Industry: Energy/Electricity Products: cRIO-9014, Real-Time Modules, FPGA Modules, NI 9239, LabVIEW Challenge: Develop a communications-flexible portable measurement device that can record high-frequency transients in power systems and display the data online to multiple users. Solution: A highly flexible measur
[Test Measurement]
Rapidly Prototype Measurement Systems Using LabVIEW and CompactRIO
Introduction to Designing RF Instruments with LabVIEW FPGA and Software
Overview The number of wireless devices, the diversity of communication standards, and the complexity of modulation schemes continue to increase every year. With the birth of each new generation of technology, the cost of testing wireless devices using traditional technology requires a large amount of more complex t
[Test Measurement]
Introduction to Designing RF Instruments with LabVIEW FPGA and Software
The world's first RF vector signal transceiver redefines RF testing
Based on the latest version of NI LabVIEW graphical system design software, the LabVIEW Robotics environment continues to provide the capabilities of industrial-grade system design software. Combining LabVIEW Robotics with LabVIEW 2010, new compiler technology and optimizations are implemented, and you can automatical
[Test Measurement]
The world's first RF vector signal transceiver redefines RF testing
Methods of realizing remote data acquisition based on C/S structure in LabVIEW
  Method 1: Use the Connect to Remote Panels tool in the LabVIEW environment to directly operate Remote Panels.   Method 2: Use a web browser to directly operate Remote Panels on a web page. If you enter the server's URL in the address bar of the client's web browser, you can directly operate Remote Panels on the web
[Test Measurement]
Methods of realizing remote data acquisition based on C/S structure in LabVIEW
RF/communication physical layer research based on LabVIEW and NI USRP
   Figure 1: Overview of symbol, BER, SNR, current estimate, and transmission status information displayed on the detector before and after suppression.   "LabVIEW system design software is really good at parallel programming, and it is a great helper for developing signal processing and communication algorithms in
[Test Measurement]
RF/communication physical layer research based on LabVIEW and NI USRP
Smart Debugging Tips for Every LabVIEW Developer
Become a LabVIEW Vulnerability Fixer If you use NI LabVIEW software regularly, you probably have a toolbox of debugging tips and techniques for when the software does not behave as expected. Some of these tips and techniques are common, while others are something you may have developed on your own. Figure 1. Sm
[Test Measurement]
Smart Debugging Tips for Every LabVIEW Developer
Latest Test Measurement Articles
Change More Related Popular Components
Guess you like

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号