Technological Institute of the Philippines.docx

21
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

Transcript of Technological Institute of the Philippines.docx

Technological Institute of the Philippines938 Aurora Blvd., Cubao, Quezon City

LabVIEW ProgrammingActivity No. 8

(1311860) MARTIN, Irish Joy C.Student

Engr. Dennis Jefferson A. AmoraInstructor

Date Perfomed: March 11, 2015

Date Submitted: March 20, 2015

Table of Contents

I. Introduction1

II. ResultsWaveform Graph2Waveform Chart2Formula Node4

Cluster FunctionsCluster Constant5Bundle5Bundle by Name6Unbundle7Unbundle by Name8

String FunctionsString length9Concatenate Strings9String subset10Replace Substring10Search and Replace Substring11Match Pattern14Spreadsheet String to array15

III. Conclusion16

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 GraphThe figure above shows a basic single-plot waveform graph plotting the random numbers. The waveform graph plots only single-valued functions, as iny=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 ChartThe 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 containst0anddtinformation. In this case, the waveform graph receives thet0anddtcontained within the waveform and displays the data accordingly. You can build your own waveform with data points,t0, anddtspecified. 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 (t0anddt) 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 NodeFormula node is a simple structure that looks like a box. You can add input to it by right-clicking 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.

ClustersA cluster is aLabVIEWdata typethat 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 actl.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 ConstantsFigure 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 selectChange to Constantfrom the shortcut menu.

Cluster FunctionsIn 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 BundlesBundleFigure 3.3 Bundle FunctionUse 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 BundleVI 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 NameThe 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 havetheir 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 theUnbundlefunction to disassemble a cluster into its individual elements. Use theUnbundle by Namefunction to return specific cluster elements you specify by name. You can also resize these functions for multiple elements in the same manner as theBundleand Bundle By Namefunctions.

StringsA 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 FunctionString LengthFigure 4.2 String LengthThe 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 Subset4.4 String Subset

It returns thesubstringof the inputstringbeginning atoffsetand containinglengthnumber of characters. The offset refers to the starting point of a string, while the length refers to the length of the string.

Replace SubstringFigure 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 StringSearches 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 forregular expressioninstringbeginning atoffset, and if it finds a match, splitsstringinto 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 expressioninput description in the detailed help.

Spreadsheet String to Array

Figure 4.8 Spreadsheet String to arrayConverts 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.