The LabView program development is very much different from conventional programming. Instead of using the traditional coding techniques, it uses a graphical language commonly known as “G” to create any program in block diagram form.
The LabView programming works on many operating systems such as Windows, Mac OS or Linux.
Dataflow refers to the flow of data throughout the runtime of any program. It can also be termed as a Streaming process. Dataflow in LabView programming determines the order of execution, i.e. from right to left or from top to bottom.
Here, in this article, we are going to have a look at what is Dataflow in LabView, how it is implemented in programming and the data types used in LabView.
Dataflow in LabView with Example:
LabView follows the dataflow model for executing programs on its platforms. Dataflow in LabView has been considered as one of the most important aspects in current IT environment. In any dataflow model, the block diagrams are referred as nodes that are connected to each other specifying the flow of data execution.
When the nodes receive all of the desired inputs, it processes the execution of program and produces output data. This Output data is then presented to the next node in the dataflow path as input data. Figure 1 below shows an example of dataflow programming.
Define dataflow programming and how we will implement dataflow programming in LabView with block diagram:
Here, you can work with LabView even if you didn’t know text-based languages i.e. you don’t need to worry about the semicolons or any curly braces. Moreover, as the graphical programming has a simple syntax, it allows you to focus more on the flow of data within your program. For a dataflow programming example, we can take a look at the below-shown figure.
Here a program is created to carry out the task that adds two numbers and then subtracts it from 50.00. The dataflow sequence, as you can see, executes the program from left to right in order. It also specifies that the subtraction method cannot be executed unless the addition of two numbers executes. The result of addition method acts as input for the second function. This shows that a particular node can only be executed when all the input data are available
Now, consider the below mention code segment which denotes dataflow execution of multiple programs simultaneously.
Here, as you can see the there are two programs. You cannot determine which of the function here would execute first. However, the LabView recognizes that there are no dependencies of the first task on another task. It can easily execute both functions in a multiprocessing environment simultaneously.
Define Data types in LabView:
Data types, as the name suggests, denotes the type of variables or data that can be used in LabView. Data types are important to remember as it helps us in determining what kind of data we have used in our program and what else we can use. In LabView, the data types cannot be interconnected i.e. if a variable is of integer type, then its value must also be the type of integer otherwise the LabView will give you an error.
There are some unique colors assigned to different data types, which is focused on ensuring that they are not interconnected to each other. The most common data types are Integer, String, Arrays, Boolean and Float. Every data type has data stored according to its specific type i.e. integer can only store integer value and can only display integer type of data.
Here, we are going to look at some of the most common and used data types in LabView:
Boolean data types consist of only two values i.e. true and false. It is a logical data type providing the output in the form of 0 or 1 specifying false and true respectively. The Boolean data type is indicated by green data wires. LabView stores the Boolean data as 8-bit values.
Subscribe to our youtube channel to get new updates..!
Any LED on a system acts as a Boolean indicator. For instance, in a refrigerator, the food is kept under 20 degrees. The indicator light is off unless the temperature increases. The indicator light glow up to notify us that the temperature is more than required. This light acts as a Boolean indicator.
Numeric data types in LabView are represented as floating point numbers, complex numbers, signed-unsigned integers, and fixed-point numbers. All the Integers either signed or Unsigned are indicated by blue data wires. Double and single precision and complex numbers are represented by orange data wires in LabView. The only difference in the numeric data is determined by the type of their values and the number of bits they store.
Here we have showcased an example of a simple numeric integer. The floating numeric and double are also indicated in the LabView similarly. The only difference between them is the color i.e. orange, used to denote the floating and double numeric data.
Any sequence of displayable and non-displayable ASCII characters in the LabView data is known as Strings data type. It is indicated by Pink data wire on the block diagram.
Here, in the above mention figure, you can see that the string constant is indicated by the pink data wire. Some of the most common application of String data type is:
- Developing simple text messages for the microprocessors and display systems.
- Instructing the users through various dialogue boxes.
- Controlling the instruments by calling commands on the instruments.
Arrays can be distinguished as a group of specific data types. They are determined by thicker data wires. In array, we can store numeric, string, double or even Boolean data types. Given below is an example of an array constant.
You can create an array of any data type in two simple steps:
- For numeric array data type, right click on the array block in the LabView system select numeric constant and drag it in the array block.
- Now, in order to increase the size of the array block just drag the block below as per your requirements of the elements.
This will increase the size of array according to the number of elements. Moreover, to store values in the array you just need to enter the values in respective blocks.
Clusters are the data type which consists different type of data in a single unit i.e. you can combine Boolean, numeric and string in a single value. This data type is indicated by thicker brown color data wire.
Creating a cluster is similar to creating an array. You can add the cluster shell on the front panel. Furthermore, you can add the data objects by simply dragging the elements which can be numeric, Boolean or any other data types.
In the above figure, we can see the cluster containing three data types: a string, a Boolean switch, and a numeric.
Error clusters are a special type of cluster, which are used to provide warnings and error messages. Error clusters are denoted by dark yellow data wire pattern.
Error clusters are constructed from Boolean status, a string source and a numeric error code. By default, the LabView system handles errors by terminating the execution of programs and returning the section where any particular error occurred.
The error cluster has two functions i.e. Error In function – (Used to detect the error in the function) and Error out Function (Used to return the error information to the users and stop execution of the program).
The waveform data type that is used to store and display periodic signal measurements i.e. the waveform creates a graph and charts of the particular data. It provides you with the exact and precise information about your data in charts and graphs form. The waveform data type is also a kind of cluster which consists of the following components:
|T0||This represent the time at which the function starts|
|dt||Double data type indicating the difference in time between each function|
|Y||This is a 1D array containing the value of the particular function|
Enums are the combination of data types mainly consisting of a pair of data values i.e. a string and a numeric value. For example, we create an Enum named as ‘Month’. The value pairs in the fields can be placed as January – 1, or February – 10 and so on. The below mention figure shows an Enum data type with month:
Being a software-based application, LabView programming provides more flexibility than any other conventional techniques. Moreover, LabView programming offers you a platform-independent functionality. This simply means that you can develop a program on any operating system such as Microsoft Windows, macOS, and Linux. LabView enables you to execute programs on any other operating system as well as on Microsoft Pocket PC, Palm OS, and Microprocessors regardless on which system it is created. Furthermore, dataflow programming can execute multiple tasks simultaneously.
The main task of LabView programming is to make your life stress-free by issuing a large number of functionalities to help with programming. All of the essential details and important information related to the dataflow programming and data types in LabView are elaborated in the above-given article. Now, it's all up to you whether to go with this high-end technology in future or not. Choose wisely and do well. All the very best!