Skip to content Skip to navigation Skip to collection information

OpenStax-CNX

You are here: Home » Content » LabVIEW Graphical Programming » Temperature Running Average VI

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • National Instruments display tagshide tags

    This module is included in aLens by: National InstrumentsAs a part of collection: "LabVIEW Graphical Programming Course"

    Comments:

    "A full introductory course on programming with LabVIEW."

    Click the "National Instruments" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

  • eScience, eResearch and Computational Problem Solving

    This module is included inLens: eScience, eResearch and Computational Problem Solving
    By: Jan E. OdegardAs a part of collection: "LabVIEW Graphical Programming Course"

    Click the "eScience, eResearch and Computational Problem Solving" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Temperature Running Average VI

Module by: National Instruments. E-mail the author

Summary: Use shift registers to perform a running average.

Exercise 1

Complete the following steps to modify the Temperature Monitor VI to average the last three temperature measurements and display the average on a waveform chart.

1.a) Front Panel

  1. Open the Temperature Monitor VI.
  2. Select File>>Save As and rename the VI Temperature Running Average.vi in the C:\Exercises\LabVIEW Basics I directory.

1.b) Block Diagram

  1. Display the block diagram.
  2. Right-click the right or left border of the While Loop and select Add Shift Register from the shortcut menu to create a shift register.
  3. Right-click the left terminal of the shift register and select Add Element from the shortcut menu to add an element to the shift register.
  4. Modify the block diagram as in Figure 1.
    Figure 1
    Figure 1 (temprunavgbd.png)
    1. tempicon.png Press the <Ctrl> key while you click the Thermometer VI and drag it outside the While Loop to create a copy of the subVI. The Thermometer VI returns one temperature measurement from the temperature sensor and initializes the left shift registers before the loop starts.
    2. compariticon.png Place the Compound Arithmetic function, located on the Functions>>Arithmetic & Comparison>>Express Numeric palette, on the block diagram. This function returns the sum of the current temperature and the two previous temperature readings. Use the Positioning tool to resize the function to have three left terminals.
    3. divicon.png Place the Divide function, located on the Functions>>Arithmetic & Comparison>>Express Numeric palette, on the block diagram. This function returns the average of the last three temperature readings.
    4. divconst.png Right-click the y terminal of the Divide function, select Create>>Constant, type 3 3, and press the <Enter> key.

1.c) Run the VI

  1. Run the VI. During each iteration of the While Loop, the Thermometer VI takes one temperature measurement. The VI adds this value to the last two measurements stored in the left terminals of the shift register. The VI divides the result by three to find the average of the three measurements, the current measurement plus the previous two. The VI displays the average on the waveform chart. Notice that the VI initializes the shift register with a temperature measurement.

1.d) Block Diagram

  1. Modify the block diagram as shown in Figure 2.
    Figure 2
    Figure 2 (temprunavgmultbd.png)
    1. bundleicon.png Place the Bundle function, located on the Functions>>All Functions>>Cluster palette, on the block diagram. This function bundles the average and current temperature for plotting on the waveform chart.
  2. Save the VI. You will use this VI later in the course.

1.e) Run the VI

  1. Run the VI. The VI displays two plots on the waveform chart. The plots are overlaid. That is, they share the same vertical scale.
  2. If time permits, complete the optional steps. Otherwise, close the VI.

1.f) Optional

Customize the waveform chart as shown in Figure 3. You can display a plot legend, a scale legend, a graph palette, a digital display, and a scrollbar. By default, a waveform chart displays the plot legend.

Figure 3
Figure 3 (temprunavgfp.png)
  1. Customize the y-axis.
    1. labeling.png Use the Labeling tool to double-click 70.0 70.0 in the y-axis, type 75.0 75.0, and press the <Enter> key.
    2. b: Use the Labeling tool to double-click the second number from the bottom on the y-axis, type 80.0 80.0, and press the <Enter> key. This number determines the numerical spacing of the y-axis divisions. For example, if the number above 75.0 75.0 is 77.5 77.5, it indicates a y-axis division of 2.5 2.5, changing the 77.5 77.5 to 80.0 80.0 reformats the y-axis to multiples of 5.0 5.0 ( 75.0 75.0, 80.0 80.0, 85.0 85.0, and so on).

    note:

    The waveform chart size has a direct effect on the display of axis scales. Increase the waveform chart size if you encounter problems while customizing the axis.
  2. Right-click the waveform chart and select Visible Items>>Scale Legend from the shortcut menu to display the scale legend, as shown in Figure 4. You can place the scale legend anywhere on the front panel.
    Figure 4: 1. X-axis, 2. Y-axis, 3. Scale Labels, 4. Scale Lock Button, 5. Autoscale Button, 6. Scale Format Button
    Figure 4 (scale.png)
  3. Use the scale legend to customize each axis.
    1. Make sure the Lock Autoscale button appears locked and the Autoscale LED is green so the y-axis adjusts the minimum and maximum values to fit the data in the chart.
    2. Click the Scale Format button to change the format, precision, mapping mode, scale visibility, and grid options for each axis.
  4. Use the plot legend to customize the plots.
    1. Use the Positioning tool to resize the plot legend to include two plots.
    2. Use the Labeling tool to change Temp to Running Avg and to change Plot 1 to Current Temp. If the text does not fit, use the Positioning tool to resize the plot legend.
    3. Right-click the plot in the plot legend to set the line and point styles and the color of the plot background or traces.
  5. Right-click the waveform chart and select Visible Items>>Graph Palette from the shortcut menu to display the graph palette, as shown in Figure 5. You can place the graph palette anywhere on the front panel.
    Figure 5: 1. Cursor Movement Tool, 2. Zoom Button, 3. Panning Tool, 4. Zoom Pull-down Menu
    Figure 5 (graphpal.png)
    Use the Zoom button on the graph palette to zoom in or out of sections of the chart or the whole chart. Use the Panning tool to pick up the plot and move it around on the display. Use the Cursor Movement tool to move the cursor on the graph.
  6. Run the VI. While the VI runs, use the buttons in the scale legend and graph palette to modify the waveform chart.

    note:

    If you modify the axis labels, the display might become larger than the maximum size that the VI can correctly present.
  7. Use the Operating tool to click the Power switch and stop the VI.
  8. Save and close the VI.

Collection Navigation

Content actions

Download:

Collection as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Module as:

PDF | More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks