Technological Institute of The Philippines

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

Technological Institute of the Philippines

938 Aurora Blvd., Cubao, Quezon City

LabVIEW Programming
Activity No. 8

(1311860) MARTIN, Irish Joy C.


Student

Engr. Dennis Jefferson A. Amora


Instructor

Date Perfomed: March 11, 2015


Date Submitted: March 20, 2015

Table of Contents
I. Introduction

II. Results
Waveform Graph
Waveform Chart
Formula Node

2
2
4

Cluster Functions
Cluster Constant
Bundle
Bundle by Name
Unbundle
Unbundle by Name

5
5
6
7
8

String Functions
String length
Concatenate Strings
String subset
Replace Substring
Search and Replace Substring
Match Pattern
Spreadsheet String to array

9
9
10
10
11
14
15

III. Conclusion

16

I. Introduction
This activity is to introduce students the basic yet frequently used functions in the
LabVIEW software by creating a new virtual instrument. This activity will use different
functions and controls to create different programs. Such programs will have to use
numeric controls to accept data and numeric indicators to display the results.
This aims to provide students' knowledge and skills on command manipulation
using the LabVIEW software. The objective is for the students to be able to accomplish
their own program and adopt basic techniques in working with the programming
software. This experiment will also enhance the ability of the students to follow
instructions and use their critical thinking ability.
This will show students the difference between Waveform chart and waveform
graph. This will also introduce new functions such as clusters, bundle, Formula node
and different types of string functions.

II. Results

Figure 1.1 Waveform Graph


The figure above shows a basic single-plot waveform graph plotting the random
numbers. The waveform graph plots only single-valued functions, as in y = f(x), with
points evenly distributed along the x-axis, such as acquired time-varying waveforms. A
Waveform Graph accepts arrays of data in various forms, e.g. array, waveform, or
dynamic data. It then plots all the received points at once. It does not accept single point
values. Basic single-plot graphs can skip the Bundle function and pass Y array values to
the graph. Without the bundle function, the default values are Zero and One for the X
and Delta X values respectively.

Figure 1.2 Waveform Chart


The figure above shows a basic single-plot waveform chart.Waveform charts are
one of the most effective ways of displaying data within LabVIEW, especially in the case
of experiments and a constant feed of data. The input of waveform charts is scalar
numeric, and it also has a fixed history length. There are multiple data modes and also
different types of displays and customizable options to allow a chart to conform to a
users needs. The waveform chart is a special type of numeric indicator that displays
one or more plots of data typically acquired at a constant rate.

The Difference between a Waveform Graph and a Waveform Chart


Waveform graphs and Waveform charts differ in the way they display and update
data. The waveform data type is essentially an array of points that also
contains t0 and dt information. In this case, the waveform graph receives
the t0 and dt contained within the waveform and displays the data accordingly. You can
build your own waveform with data points, t0, and dt specified. You can also display
multiple plots on the same waveform graph by wiring a 2D array to the graph.
A Waveform Graph accepts arrays of data in various forms, e.g. array, waveform,
or dynamic data. It then plots all the received points at once. It does not accept single
point values. When an array of points is wired to a waveform graph, it assumes the
points are equally spaced out. By default, the starting X value and step size (t0 and dt)
are 0 and 1 respectively. This can be changed in the properties of the graph or using
property nodes.
A Waveform Chart remembers and displays a certain number of points by storing
them in a buffer. When the buffer gets full, the chart starts overwriting the oldest points
with new ones. As the data points become available, the chart displays received data in
addition to already existing points. You can write single or multiple data points to it at
once. If we wire an array of points to the chart, it will append those points to the existing
ones. You can display multiple plots on the same chart by wiring in a cluster or a 2D
array containing data for each plot.

Formula Node

Figure 2.1 Formula Node


Formula node is a simple structure that looks like a box. You can add input to it by rightclicking and selecting add input. You can add output by right-clicking and selecting add
output. After that, you can type your formula inside the box and put a semi-colon at the
end. It enables us to create formulas in a very simple way. It is most useful for
equations that have many variables or are otherwise complicated. The text-based code
simplifies the block diagram and increases its readability.

Clusters
A cluster is a LabVIEW data type that groups data elements of mixed types. A cluster is
similar to a record or a struct in text-based programming languages. Clusters can be
stored solitarely in a ctl.
Bundling several data elements into clusters eliminates wire clutter on the block
diagram and reduces the number of connector pane terminals that subVIs need. The
connector pane has, at most, 28 terminals. If a front panel contains more than 28
controls and indicators that you want to use programmatically, you can group some of
them into a cluster and assign the cluster to a terminal on the connector pane. Like an
array, a cluster is either a control or an indicator. A cluster cannot contain a mixture of
controls and indicators.
Creating Cluster Constants

Figure 3.1 Cluster Constants


Similar to array constants, you can use cluster constants to store constant data
or as a basis for comparison with another cluster. If you already have a cluster control or
indicator and want to make a cluster constant that contains the same data types, make
a copy of the cluster control or indicator on the block diagram and then right-click on the
copy and select Change to Constant from the shortcut menu.

Cluster Functions
In the Cluster, Class & Variant subpalette on the Block Diagram we have the following
Cluster functions we may use to manipulate and get data in or out of a cluster. In this
example we will create clusters and use these functions.

Figure 3.2 Bundles


Bundle

Figure 3.3 Bundle Function


Use the Bundle function to assemble a cluster from individual elements. To wire
elements into the Bundle function, use your mouse to resize the function. The Bundle VI
is used to assemble a cluster from individual elements or replace elements in an
existing cluster. The Bundle function refers to cluster elements by their position in the
cluster. For this reason, using the Bundle function to replace existing cluster elements
requires that the number of input terminals must match the number of elements in the
input cluster and that you know the order of elements in that cluster.
Bundle by Name

Figure 3.4 Bundle by Name


The Bundle by Name function is also used to replace one or more elements in an
existing cluster. However, it cannot be used to assemble a cluster. This function refers
to cluster elements by name instead of by their position in the cluster. As a result, this
function can only access cluster elements that have their own label attached to them.
Additionally, the number of input terminals does not need to match the number or order
of elements in the input cluster. The Bundle by Name function is useful when working
with data structures that may change during the development process because
rewiring/resizing the cluster is unnecessary when a new component is added or the
cluster is modified.

Unbundle/Unbundle by Name

Figure 3.5 Unbundle/ Unbundle by Name


Use the Unbundle function to disassemble a cluster into its individual elements.
Use the Unbundle by Name function to return specific cluster elements you specify by
name. You can also resize these functions for multiple elements in the same manner as
the Bundle and Bundle By Name functions.

Strings
A string is a sequence of displayable or nondisplayable ASCII characters. Strings
provide a platform-independent format for information and data. Some of the more
common applications of strings include creating simple text messages, Controlling
instruments by sending text commands to the instrument and returning data values in
the form of either ASCII or binary strings, which you then convert to numeric values.
Storing numeric data to disk. To store numeric data in an ASCII file, you must first
convert numeric data to strings before writing the data to a disk file. Instructing or
prompting the user with dialog boxes. On the front panel, strings appear as tables, text
entry boxes, and labels. LabVIEW includes built-in VIs and functions you can use to
manipulate strings, including formatting strings, parsing strings, and other
editing. LabVIEW represents string data with the color pink.

Figure 4.1 Strings Function


String Length

Figure 4.2 String Length


The figure above shows how String length functions. It returns the length of a string, the
length refers to the number of characters in a string.

Concatenate Strings

Figure 4.3 Concatenate Strings


It joins two or more strings together in a single string. For array inputs, this function
concatenates each element of the array.
String Subset

4.4 String Subset


It returns the substring of the input string beginning at offset and
containing length number of characters. The offset refers to the starting point of a string,
while the length refers to the length of the string.

Replace Substring

Figure 4.5 Replace Substring


Concatenates two strings and deletes selected characters and the deleted characters
are then displayed at the result string.
Search and Replace String

Figure 4.6 Search and Replace String

Searches for single or more character and replaces it with a new one, this function has
two Booleans one for replacing all searched characters and the other is for switching
case sensitivity.
Match Pattern

Figure 4.7 Match Pattern


Searches for regular expression in string beginning at offset, and if it finds a match,
splits string into three substrings. A regular expression requires a specific combination
of characters for pattern matching. For more information about special characters in
regular expressions, refer to the regular expression input description in the detailed
help.
Spreadsheet String to Array

Figure 4.8 Spreadsheet String to array


Converts spreadsheet string to an array, depending on the dimension and
representation. This function works for both arrays made up of strings and numbers.

III. Conclusion
I can conclude from the experiment that every function in labVIEW library is very
important and it can be used simultaneously as in the feature of Labview. Each function
can be used in different program structure. Each of this function has different uses and
we should not forget each function in creating this new functions from National
Instruments.
I have also learned how each of them separately works and how different they
are from each other. One example is the waveform Chart and Waveform Graph which
looks very identical and it might be very confusing for us which to use. But if we know
each function and each data type is about, we can pick on the differences in using it and
yield good results in programming what we want to make.
This activity also added to the knowledge that I know about strings, clusters,
charts and graphs, and formula node. This enhanced our critical thinking ability test and
our readiness and the problem solving skills.

You might also like