40
IV ME 241 Spring 2014

Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

IV

ME 241 Spring 2014

Page 2: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Charts and Graphs

Collecting data using a While loop

Collecting data using DAQ to control number and frequency

ME 241 Spring 2014

Combined system image from: bigriveradvertising.com

Page 3: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Page 4: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Calibrator collected data one pair of points (independent and dependent variables) at a time.

Next step is to build a system to collect a series of data points over time.

That is, we want data pairs (t, y)

Begin by looking at graphical means of

displaying this kind of data in LabVIEW.

ME 241 Spring 2014

Page 6: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Duplicate the demonstration from the video.

Build a system that takes in slider data (-50 to +100)

Displays the last 100 data points on a chart while running.

Displays the complete data set on a graph when stop is pressed.

Put a 100 ms time delay into your While loop to slow the data collection rate

ME 241 Spring 2014

Page 7: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

What happens if auto indexing is not enabled at the loop tunnel?

Page 8: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Trying changing the value of the delay timer

◦ How does it affect your ability to see rapid changes?

◦ How does it affect your ability to see longer term trends?

◦ How fast does the While loop collect data if the delay is set to zero?

Page 9: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Page 10: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

First build a very simple system to collect data using a While loop. ◦ Just collect and display the data

Only a few components ◦ DAQ ◦ Waveform Chart ◦ While loop ◦ Stop button for the loop

Will then collect some data provided by a signal generator.

ME 241 Spring 2014

Page 11: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

In order for the DAQ Assistant to configure properly, it must be able to look at your ADC.

Plug the 6009 into your computer using the USB.

ME 241 Spring 2014

Page 12: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Key is to set the acquisition mode to “1 Sample (on demand)”

Each iteration of the loop will cause the DAQ to collect a data point.

key to the use of the While loop

ME 241 Spring 2014

Page 13: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Page 14: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Finally need to connect the output of the measuring device to the desired channel on the 6009 ADC.

We are using differential channel 0 (AI0, AI4), so we want to connect our two wires there.

For the workshop: ◦ Have already connected wires to AI0, AI4 channel 0.

[may also be wired for channel 2 (AI2, AI6)] ◦ Just connect the matching BNC connector to “A” on the

desktop (this will connect the two wires into the signal generator at the front of the classroom)

ME 241 Spring 2014

Page 15: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

We will supply a signal(s) from the signal generator. Try manipulating the settings of your system and observe what happens.

◦ Add a wait timer to the loop. What happens if you

use a large wait time (e.g. 1000s of ms)?

◦ Play with the settings on the Chart.

ME 241 Spring 2014

Page 16: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Make sure you save this VI for use later in the workshop.

ME 241 Spring 2014

Page 17: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Page 18: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Build a simple system in which the DAQ controls the frequency of data point collection and the number of points collected. ◦ Collect and display the data ◦ Send it to a Write to Measurement File

Again a few components ◦ DAQ (and two associated controls) ◦ Waveform Graph ◦ Write to Measurement File (and two associated controls)

Will then collect some data provided by a signal generator.

ME 241 Spring 2014

Page 19: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

In order for the DAQ Assistant to configure properly, it must be able to look at your ADC.

Make sure the 6009 is still plugged into your computer using the USB.

ME 241 Spring 2014

Page 20: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

The important change

Create these on the block diagram. They also appear

on the front panel

Open a new blank VI

Key is to set the acquisition mode to “N Samples”

DAQ will collect N samples at the rate specified ◦ Add 2 controls so I can

adjust N and the rate from the Front Panel

ME 241 Spring 2014

Page 21: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Must add on the Front Panel

Make sure it is a Graph (not a Chart)

ME 241 Spring 2014

Page 22: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Note the “new” settings

◦ One column only

Also add 2 controls so (from the Front Panel) you can ◦ select enable/disable

◦ select a file name

ME 241 Spring 2014

Page 23: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Wire the Block Diagram Arrange the Front Panel Customize labels, etc. if you wish

Page 24: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Default labeling can be confusing.

Worthwhile spending a few seconds to make sure the VI is clear, especially if you will be using it again.

Same is true for making the layout, wiring, etc. clear.

ME 241 Spring 2014

Enabled right now, or do I need to push the button to enable it?

Page 25: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Output of the measuring device connected to the desired channel on the 6009 ADC.

We are using differential channel 0 (AI0, AI4), so we want to connect our two wires there.

For the workshop: ◦ Have already connected wires to AI0, AI4 channel 0.

[may also be wired for channel 2 (AI2, AI6)] ◦ Just connect the matching BNC connector to “A” on the

desktop (this will connect the two wires into the signal generator at the front of the classroom)

ME 241 Spring 2014

Page 26: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

We will supply a signal(s) from the signal generator.

Run the system with the Write to Measurement File button in the Disabled setting.

System will run until it collects the specified number of data points. The data will then be passed to the Graph and plotted.

No data is saved.

ME 241 Spring 2014

Page 27: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Run the system with the Write to Measurement File button in the Enabled setting.

System will run until it collects the specified number of data points. The data will then be passed to the Graph and plotted.

Data is saved to a File. ◦ Because we selected the “Use next available file name”

setting in the Write to Measurement File, you will get a new file each time you collect data (test.lvm, test2.lvm, test3.lvm, etc.)

◦ Use Excel to check this and open one of the Files.

ME 241 Spring 2014

Page 28: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

New file every time.

In this example the DAQ was configured to collect 1000 data points at a rate of 1000/sec.

File contains 1000 data points.

X value (time) increases 0.001 between data points.

Page 29: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Make sure you save this VI for use later in the workshop.

ME 241 Spring 2014

Page 30: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

image from: www.geocities.jp

Page 31: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

The While loop timed system you built is convenient for looking at data as it is being collected.

The DAQ timed system you built is convenient for looking at complete blocks of data. ◦ Control/adjust the number of data points collected.

◦ View complete set of data on the Graph.

◦ Save data to a file for latter analysis.

ME 241 Spring 2014

Page 32: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Open a new blank VI

Open a Case Structure on the Block Diagram ◦ Make it large ◦ Make sure it is set to the “True” case

Enclose and copy the entire

contents of the Block Diagram of your While loop timed VI

Paste this inside the True case structure

Note: the contents of the front panel will also copy over

ME 241 Spring 2014

Page 33: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Switch the case structure on the Block Diagram to False

Enclose and copy the entire contents of the Block Diagram of your DAQ timed VI

Paste this inside the False case structure

Note: the contents of the front panel will also copy over. It may be messy (two sets of controls/indicators on top of each other spend a few seconds to sort them out

ME 241 Spring 2014

Page 34: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Clean up controls for two systems ◦ Chart on top ◦ Graph on bottom

Need a control to switch from True (While loop timed) to False (DAQ timed)*

We’ll also add a couple of lights to indicate which is on…

*Note: switch is only effective if you switch before you run (can’t change in the middle of running).

ME 241 Spring 2014

Page 35: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Page 36: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

ME 241 Spring 2014

Page 37: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Make sure you save this VI for possible use later.

ME 241 Spring 2014

Page 38: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Test out the various features on your VI.

Experiment with changing the scales, number of data points collected, collection rate, etc.

ME 241 Spring 2014

Enable

Page 39: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

Make sure you save this VI for possible use later.

ME 241 Spring 2014

Page 40: Introduction to Labvie · Output of the measuring device connected to the desired channel on the 6009 ADC. We are using differential channel 0 (AI0, AI4), so we want to connect our

You can now program in LabVIEW.

ME 241 - Level IV

ME 241 Spring 2014