Labview Structures

Introduction of Labview:

LabVIEW stands for Laboratory Virtual Instrument Engineering Workbench. This tool was originally released in the year 1986 for Apple Macintosh. The programming language that is used in LabVIEW is graphical language, which is named as ‘G’. This software is predominantly used for data acquisition, industrial automation, etc.

In contrary to the general text-based programming, LabVIEW is based on graphical programming where the text-based syntax is replaced with graphical symbols and connectors.

If you would like to Enrich your career with an Android certified professional, then visit Mindmajix - A Global online training platform: “LabVIEW training” Course.This course will help you to achieve excellence in this domain.

 

 

Introduction to the structure in LabVIEW:

A structure is defined as a graphical representation of a loop ( i.e., a loop is nothing but a set of code blocks that are executed based on the condition match). In reality, structures have control over the execution flow within a Virtual Instrument (VI).

There are different types of structures available within LabVIEW. We will discuss the types in detail later on in the article.  

[Related Article : Customizing Graphs And Charts In Labview 

 

Where can we find the structure in LabVIEW?

To Access a structure, the developer will have to go through the following steps:

  • To access Functions, the developer has open the Front Panel.
front panel
  • Click on “View” module in the front panel  and select “Functions”.
  • From “functions”, select “programming” option and look for “Structure” option.
  • Clicking on “Structures” will give you in detail options

 

What are the structures that are available within LabVIEW:

In this section of the article, we will discuss the various structures that are available within LabVIEW. The list is as follows:

  • While Loop structure
  • For Loop structure
  • Sequence structure
  • Flat sequence structure
  • Stacked sequence structure
  • Event structure
  • Timed structure
  • Diagram disable structure
  • Conditional disable structure

 

While Loop Structure:

  • The while loop structure is on execution/operational mode until and unless a stop condition is achieved.
  • The while loop structure runs in the background until and unless the user has clicked on a STOP button.

Let’s understand this structure in detail by considering an example, i.e., while loop structure will be stopped after reaching a value which is equal to 50.

Follow the below steps to create a While Loop:

Step 1:

Click on Functions and select Structures.

while loop structure

Step 2:

Within structures, click on Random number generator icon as shown below in the screenshot.

Random number generator icon

Step 3:

Select the option as “Numeric” and then select “Multiply” option as shown in the screen below

Step 4:

Right-click and select Create> Now select the option as “Constant”. Create the constant as 100 in this case.

constant

Step 5:

Now, select the option “Numeric” and then select the option “Round of to Infinity” as displayed in the below screenshot

round of to infinity

 

 

[Related Article: LabVIEW Basics

Step 6:

Now, click on the option “Comparison” and then select the option “Equal."

comparision

At this point, create another constant value as 50.

Step 7:

Create an indicator for the output “ Round of to Infinity”

indicator output

 

Step 8:

Now, join all the different blocks that we have created so far. After connecting the blocks, the entire block will look like the screen below

connecting blocks

Now, execute the program, the while loop structure is in place and random number generator actually generates values. As soon as the random number generates 50, the while loop structure will stop generating the number.
In this case, the condition is met, so the while loop structure has successfully stopped and further it doesn't generate any number.

loop structure

With the use of “wait timer” the values can be generated and seen in the LabVIEW front panel.

The wait time is actually measured in milliseconds. In this example, the wait time is about 200 milliseconds, i.e., for every 200 milliseconds, the while loop structure will generate a number.

 

Frequently Asked LabVIEW Interview Questions

 

For loop structure:

A for loop structure is defined as a program that is executed for a designated number of times. For example, if the For loop structure is set to ‘15’ then the program will be executed for 15 times.

The following block diagram shows the set up for loop structure.

  • Create constant so that the input can be provided to N
  • Create an indicator for output of i.
  • Create a “wait timer” within the while loop.

The below diagram shows the variables that we have created (i.e. Constant as N, output variable as “i”)

variables created

[Related Article: Introduction of Repetition And Loops in LabVIEW]

 

Once the program is executed in LabVIEW, the results will be displayed in the front panel of LabVIEW which keep on increasing till it reaches its threshold point.

In this case, the maximum limit is 14.
The output can be displayed in the front end of the LabVIEW (as shown in the below figure).

 

display in front end

Sequence Structure:

  • A sequence of a structure is used especially when the program needs to be executed in a linear process ( especially in sequential order).
  • Within LabVIEW, it is quite hard to take control of the execution order.If a calculation is happening in a linear fashion, i.e., the next calculation is actually dependant on the current input, then the process will be executed in sequential order.
  • But, if the calculations are happening in parallel, it gets complex and the process cannot be managed in a sequential structure.So, most of the calculations are actually forced to take up a sequential structure approach.

Let’s see the same below in the form diagram:

sequence structure

Now, execute the below logic and the output is displayed in the screen shown below.

 

logics and its output

As per the graphical representation, in order to have the calculation completed, we need to have the values available for the variable “x” and variable “y”.Once the system has both the values, then as per the sequence, the addition calculation will be executed and the output is displayed.

Within Sequence structure, we have two different subtypes available, and they are:

  • Flat sequence structure

In a flat sequence structure, all the frames are available in the block diagram. If there are a lot of frames, then the structure may take a considerable amount of space.

  • Stacked sequence structure

In a stacked sequence structure, all the frames are in sequential order, but they are stacked on top of each other like a case structure.

MindMajix YouTube Channel

Case structure:

Case structures are widely used in the scenarios where the program or the users have to take a decision. The decision is categorized into two options, i.e. True or False.

At any point of execution, only one condition (or case, i.e. True or False) will be executed.

The case structure functionality is explained with a block diagram below:

  • Firstly, draw the cases so that it has a true value and also a false value.
  • This can be selected from the main menu of case structure within LabVIEW.
  • Within this explanation, we will be calculating the log value and we want the case structure to monitor only for positive values.
  • The true condition block diagram is shown below where the user will have an option to enter a value in ‘X’ from the front end of LabVIEW ( which can be seen on the left-hand side of the block diagram).
structure fuctionality

False condition case block diagram is shown below:

false condition

Execute the above program in LabVIEW by entering a positive value from the front end of LabVIEW and after that, enter a negative value from the front end of the LabVIEW.

In this case, the result of a true condition case structure is displayed in the front panel of LabVIEW.

true condition structure

The result shows a negative value within the front panel of LabVIEW.

 

negative value front panel

 

Event Structure:

  • The event structure will be executed and handles an event based on its occurrence.
  • If a specific set of the event is triggered, then the event structure will execute and take appropriate steps to handle that particular event.
  • An event structure has sub-diagrams or event cases, which are primarily responsible for executing the events which are meant to be handled.

Timed Structure:

  • A time structure has one or more subdiagrams or frames which are executed by an internal or external timing source.
  • The execution happens in sequential order. Within the execution process, each frame is only executed once.

 

Diagram Disabled Structure/ Conditional Disable Structure:

  • If the developer wants to execute a certain piece of code within LabVIEW, then this can be achieved by using a diagram disabled structure.
  • By using this structure, the developer will be able to execute a certain part of the code and check the results.
  • Alternatively, if the developer wants to execute a certain part of the code under specific conditions, then this can be achieved using conditional disable structure.

The following are the steps to be followed to use a diagram disable structure:

step 1-Select the diagram disable structure from the structures menu.

step 2-Insert the code which you want to execute within the disable frame of the disabled structure.

step 3-To create additional frames, the developer has to right click on the border of the diagram disable structure.

step 4-Select one of the options from the shortcut menu ( as shown in the below figure).

 

Check out LabVIEW Tutorial

shortcut menu

step 5-Only one frame at a time can be enabled.

step 6-To enable a frame then the developer has to right click on the diagram disable structure and select the option “ Enable this subdiagram” from the shortcut menu ( as shown in the below figure)

subdiagram

Conclusion:

In this article, we have highlighted the different types of structures that are available within LabVIEW for the developer to utilize based on the requirements. Unlike any other software tool, LabVIEW provides features and facilities where the developers can execute the code according to the ad-hoc needs. So, using structures has definitely reduced the burden for developers.

 

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
LabVIEW TrainingNov 19 to Dec 04View Details
LabVIEW TrainingNov 23 to Dec 08View Details
LabVIEW TrainingNov 26 to Dec 11View Details
LabVIEW TrainingNov 30 to Dec 15View Details
Last updated: 27 Jun 2024
About Author

I am Ruchitha, working as a content writer for MindMajix technologies. My writings focus on the latest technical software, tutorials, and innovations. I am also into research about AI and Neuromarketing. I am a media post-graduate from BCU – Birmingham, UK. Before, my writings focused on business articles on digital marketing and social media. You can connect with me on LinkedIn.

read less
  1. Share:
Labview Articles