7 Pages • 1,439 Words • PDF • 71.1 KB
Uploaded at 2021-09-24 13:56
This document was submitted by our user and they confirm that they have the consent to share it. Assuming that you are writer or own the copyright of this document, report to us by using this DMCA report button.
Graph Waveform Array VI
Graph Waveform Array VI By: National Instruments > Summary: To create an array by auto-indexing a For Loop and to plot the array on a waveform graph. Problem 1 Complete the following steps to build a VI that generates and plots an array on a waveform graph and modify the VI to graph multiple plots.
1.a) Front Panel 1. Open a blank VI and build the front panel shown in Figure 1.
Figure 1 1. Place an array, located on the Controls>>All Controls>>Array &Cluster palette, on the front panel. 2. Label the array Waveform Array. 3. Place a numeric indicator, located on the Controls>>Numeric Indicators palette, in the array shell. file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (1 of 7)3/13/2007 1:21:41 PM
Graph Waveform Array VI
4. Place a waveform graph, located on the Controls>>Graph Indicators palette, on the front panel.
1.b) Block Diagram 1. Build the block diagram shown in Figure 2.
Figure 2 1.
Place the Thermometer VI on the block diagram. Select Functions>>All Functions>>Select a VI and navigate to C:\Exercises\ LabVIEW Basics I\Thermometer.vi. This subVI returns one temperature reading during each For Loop iteration. Note: Use the (Demo) Thermometer VI if you do not have a DAQ device available.
Place a For Loop, located on the Functions>>All Functions>>Structures palette, on the block diagram. In this exercise, each For Loop iteration generates a temperature value and stores it in the indexed tunnel. Create a constant of 100 for the count terminal. 3. Wire the block diagram as shown in Figure 2. Note: When you wire data to charts and graphs, refer to the Context Help window for more information about wiring the objects, including whether to use a Build Array or Bundle function, the order of the input terminals, and so on. In general, use a waveform chart for single scalar points, a waveform graph for an array of y values, and an XY graph for an array of xx values and an array of yy values. For example, if you move the cursor over a waveform graph terminal on the block diagram, the information shown in Figure 3 appears in the Context Help window. Select Help>>Find Examples to launch the NI Example Finder, double-click Fundamentals, double-click Graphs and Charts, and double-click the Waveform Graph VI to open the example. Refer to the lesson on Data Acquisition and Waveforms for more information about the waveform data type. 2.
file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (2 of 7)3/13/2007 1:21:41 PM
Graph Waveform Array VI
Figure 3 Save the VI as Graph Waveform Array.vi in the C:\Exercises\LabVIEW Basics I directory.
●
1.c) Run the VI 1. Display the front panel and run the VI. The VI plots the auto-indexed waveform array on the waveform graph. 2. Enter the index of any element in the Waveform Array index display to view the value of that element. If you enter a number greater than the array size of 100, the display dims. 3. Use the Positioning tool to resize Waveform Array to view more than one element. The indicator displays elements in ascending index order, beginning with the index you entered.
1.d) Block Diagram In this block diagram, you use the default value of the initial xx and ∆x ∆ x value for the waveform. In cases where the initial xx and ∆x ∆ x value are a specific value, use the Bundle function to specify an initial xx and ∆x ∆ x value for a waveform array. 1. Modify the block diagram as shown in Figure 4.
file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (3 of 7)3/13/2007 1:21:41 PM
Graph Waveform Array VI
Figure 4 Place the Bundle function, located on the Functions>>All Functions>>Cluster palette, on the block diagram. This function assembles the plot elements into a single cluster. The elements include the initial xx value (2020), the ∆x ∆ x value (0.50.5), and the yy array of waveform data. 2. Create two numeric constants for the initial xx value and ∆x ∆ x value. 3. Label the ∆x ∆ x constant by typing Dx. Use the Labeling tool to select the D and select the Symbol font from the Text Settings pull-down menu on the toolbar. D converts to the delta symbol (∆). 4. Wire the block diagram as shown in Figure 4. 2. Save the VI. 1.
1.e) Run the VI 1. Display the front panel and run the VI. The graph displays the same 100100 points of data with a starting value of 2020 and a ∆x ∆ x of 0.50.5 for each point on the x-axis. In a timed test, this graph would correspond to 5050 seconds worth of data starting at 2020 seconds. Note: Change the initial xx and ∆x ∆ x values in only one location, either the Bundle function or in the Waveform Graph Properties dialog box. 2. If time permits, complete the optional steps. Otherwise, close the VI.
1.f) Optional 1. Right-click the waveform graph and select Visible Items>>Graph Palette from the shortcut menu to display the graph palette. Click the Zoom button to see the data on the graph in more detail. 2. Right-click the graph and select Visible Items>>Scale Legend from the shortcut menu to display the scale legend. 3. Return to the block diagram. Create a multiple-plot waveform graph by building a 2D array of file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (4 of 7)3/13/2007 1:21:41 PM
Graph Waveform Array VI
the data type normally passed to a single-plot graph. Modify the block diagram as shown in Figure 5.
Figure 5 1.
Place the Sine function, located on the Functions>>Arithmetic & Comparison>>Express Numeric>>Express Trigonometric palette, on the block diagram. Use this function to build an array of points that represents one cycle of a sine wave.
2.
4. 5. 6. 7.
8. 9. 10.
Place the Build Array function, located on the Functions>>All Functions>>Array palette, on the block diagram. This function creates the data structure to plot two arrays on a waveform graph. Place the pi constant, located on the Functions>>Arithmetic & 3. Comparison>>Express Numeric>>Express Numeric Constants palette, on the block diagram. 4. Wire the block diagram as shown Figure 5. Save the VI. Display the front panel and run the VI. The two waveforms plot on the same waveform graph. Display the block diagram. Right-click the wire to Waveform Array , select Custom Probes>>Controls>>Graph Indicators from the shortcut menu, and select a waveform graph to place a graph probe on the wire. Display the front panel and run the VI. The probe shows only the data array. The sine wave is not present because you did not place the probe on the wire to which the sine wave is bundled. Close the Probe window. Zoom in on a portion of the graph. Click the Zoom button on the graph palette, shown in 12, to display the Zoom pulldown menu. 2. Select Zoom by X Rectangle, as shown in Figure 6.
1.
file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (5 of 7)3/13/2007 1:21:41 PM
Graph Waveform Array VI
Figure 6 3. Click and drag a selection rectangle on the graph. When you release the mouse button, the graph display zooms in on the selected area. 4. You also can select Zoom by Y Rectangle or Zoom by Selected Area. Experiment with these options. 5.
11.
Select Undo Zoom from the lower left corner of the pull-down menu to undo a zoom or click the x-axis single fit button and the y-axis single fit button on the scale legend, shown in 14 and 15.
Use the Panning tool, shown in 16, to click and drag the graph display. Click the x-axis and y-axis single fit buttons again to restore the display to its original position.
12. Use the Cursor Movement tool, shown in 17, to return the cursor to standard mode. 13. Save and close the VI. > Comments, questions, feedback, criticisms? Discussion forum ●
Join the discussion »
Send feedback ● ●
E-mail the author E-mail Connexions
Related material Similar content ● ● ● ●
Array Functions Waveform Example VI Summary, Tips, and Tricks on Customizing VIs More »
file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (6 of 7)3/13/2007 1:21:41 PM
Graph Waveform Array VI
Courses using this content ●
LabVIEW Graphical Programming Course
Personalize Choose a style ● ● ● ●
Summer Sky Desert Scape Charcoal Playland
Edit-In-Place ●
Edit this content (login required)
Print (PDF)
More about this content | Cite this content | Version history This work is licensed by National Instruments under a Creative Commons License. Last edited by Elizabeth Gregory on Aug 12, 2004 11:13 pm GMT-5. Connexions Search Home | About us | Browse all content | Help
file:///D|/Agus/New%20Folder/Graph%20Waveform%20Array%20VI.html (7 of 7)3/13/2007 1:21:41 PM