A. Virtual Instruments (VIs)

Slides:



Advertisements
Similar presentations
Gruppo di Misure Meccaniche e Termiche UNIBS - DIMI A. File Formats At their lowest level, all files written to your computers hard drive are a series.
Advertisements

Previously… We created a simulated temperature reader which alerts if too hot or too cold… Download the solved practice to keep in sync: Thermostat.vi.
LabVIEW is a graphical programming development environment for data acquisition and control, data analysis, and data presentation. With LabVIEW you can.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
LabView Academy 5. óra. Témakörök SubVI Modularitás Icon Connector Pane.
Lesson 2 Navigating LabVIEW
Exercise 1: Install PC Software & NXT Firmware
Based on LabVIEW 2011 Student Edition
LabVIEW and G Graphical Programming Language By: Ramtin Raji Kermani.
Diego Torres LabVIEW Student Ambassador Fall 2011 ITESM CQ
TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.
Workshop 1 of 7 Welcome!. Who am I? Dilim Nwobu Computer Engineering ‘12 Fall 2011 Software Developer for NI LabVIEW Student Ambassador for Texas A&M.
Introduction to LabVIEW
Introduction to LabVIEW 8.5
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Build.
PC Applications Course LabVIEW: Laboratory Virtual Instrument Engineering Workbench Graphical Programming Easy to use Faster Development Time.
1 Lesson 5 Clusters TOPICS Introduction to Clusters Cluster Functions Error Clusters.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
Virtual Instrumentation With LabVIEW
Lecture 13LabVIEW and GPIB LabVIEW (National Instruments) –Graphical program language –Widely used in academia (lab) and industry (R&D) General Purpose.
Infinity-project.org Engineering education for today’s classroom The Infinity Project SM LabVIEW for The Infinity Project.
How to use LabVIEW Ihor Korolov February 2011.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Build.
Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.
V1: HMFR, V2: MFNB, 2007 LabView Seminar University of Puerto Rico Mayagüez Campus.
Virtual Instrumentation With LabVIEW. Section I LabVIEW terms Components of a LabVIEW application LabVIEW programming tools Creating an application in.
Design of Bio-Medical Virtual Instrumentation Tutorial 1.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Create.
MCEN 371 – Mechanical Engineering Lab Chapter 6: LabVIEW Part 1: Introduction.
Chapter 1 LabVIEW Basics. Features > Uses Graphic Symbols > Created by National Instruments > Virtual Instruments (VIs) > Extensive Library of VIs.
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs LabVIEW Programs Are Called Virtual Instruments (VIs) Block Diagram.
LabVIEW an Introduction
Introduction to LabVIEW
Each VI has 2 Windows Front Panel User Interface (UI) –Controls = Inputs –Indicators = Outputs Block Diagram Graphical Code –Data travels on wires from.
Design of Bio-Medical Virtual Instrumentation Tutorial 3.
Part I MVRT 2011 – 2012 Season Introduction to LabVIEW.
LabView instrumentoinnissa, 55492, 3op Labview in instrumentation Lecturer: Heikki Ojala, room C204a
Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Tlf:
EET 2259 Unit 7 Case Structures; Sequence Structures  Read Bishop, Sections 5.4 and 5.5.  Lab #7 and Homework #7 due next week.  Quiz #3 next week.
1. 2 LabVIEW Intro, Basics, Tips, Tricks Doug Norman & Stephanie Brierty National Instruments January 8, 2010.
Creating, Editing, & Debugging a VI A.How to Create VIs B.How to Edit VIs C.How to Debug VIs You Will Learn:
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 3 Editing and Debugging VIs  Read Bishop, Chapter 3.  Lab #3 and Homework #3 due next week.  Quiz.
Digital Electronics and Computer Interfacing Tim Mewes 4. LabVIEW - Advanced.
Introduction to LabVIEW 8.5
Virtual Instrumentation With LabVIEW. Front Panel Controls = Inputs Indicators = Outputs Block Diagram Accompanying “program” for front panel Components.
CS320n –Visual Programming More LabVIEW Foundations.
Workshop 2 of 4 Welcome!. Survey While You Wait ni.com/duke >> Recent Documents >> LabVIEW Workshop Participation Survey.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Introduction to LabVIEW. Overview Objectives Background Materials Procedure Report/Presentation Closing.
Week 3 Data Structures and Common Tools. Common Tools in Labview Automatic Tool Selector Using the Operating Tool Using the Positioning Tool to Select.
Week 3 Labview exercises
Quiz Which types of folders are available in a LabVIEW Project?
EET 2259 Unit 4 SubVIs Read Bishop, Chapter 4.
LabVIEW Core 1 Key messages for the instructor:
Getting Started with LabVIEW Virtual Instruments
EET 2259 Unit 3 Editing and Debugging VIs
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
Introduction to LabVIEW
הודעות-שיעור1 שי שרעבי חדר 201
Chapter 1 LabVIEW Basics
Chapter 5 SubVIs.
Structures- case, sequence, formula node
Introduction to LabVIEW
Introduction to LabVIEW
EET 2259 Unit 7 Case Structures; Sequence Structures
EET 2259 Unit 2 Virtual Instruments
EET 2259 Unit 4 SubVIs Read Bishop, Chapter 4.
EET 2259 Unit 3 Editing and Debugging VIs
Presentation transcript:

A. Virtual Instruments (VIs) Virtual Instrument (VI) – A LabVIEW program The appearance and operation of VIs imitate physical instruments, such as oscilloscopes and digital multimeters.

B. Parts of a VI LabVIEW VIs contain three main components: 1. Front Panel 2. Block Diagram 3. Icon/Connector Pane

B. Parts of a VI – Front Panel Front Panel – User interface for the VI You build the front panel with controls (inputs) and indicators (outputs) Just discuss how a front panel is the user interface of the VI and contains controls and indicators. A section following this slide concentrates on the front panel in more depth.

B. Parts of a VI – Block Diagram Block Diagram – Contains the graphical source code Front panel objects appear as terminals on the block diagram

B. Parts of a VI – Icon/Connector Pane Icon: graphical representation of a VI Connector Pane: map of the inputs and outputs of a VI Icons and connector panes are necessary to use a VI as a subVI A subVI is a VI that is inside of another VI Similar to a function in a text-based programming language Icon Connector Pane

E. Front Panel – Controls Palette Contains the controls and indicators you use to create the front panel Access from the front panel by selecting View»Controls Palette

E. Front Panel – Controls & Indicators Knobs, push buttons, dials, and other input devices Simulate instrument input devices and supply data to the block diagram of the VI Indicators Graphs, LEDs, and other displays Simulate instrument output devices and display data the block diagram acquires or generates

E. Front Panel – Numeric Controls/Indicators The numeric data type can represent numbers of various types, such as integer or real Numeric Control Increment/Decrement Buttons In the next few slides, you discuss basic data types: numerics, strings and Booleans. Discuss only front panel information here, such as appearance and what type of data you put in the control/indicator. You will discuss representation, mechanical action, and string display types in the next lesson. Numeric Indicator

E. Front Panel – Boolean Controls/Indicators The Boolean data type represents data that only has two parts, such as True and False or On and Off Use Boolean controls and indicators to enter and display Boolean (True or False) values Boolean objects simulate switches, push buttons, and LEDs You will discuss the use of Booleans later, just talk about what they are here. Boolean Control Boolean Indicator

E. Front Panel – Strings The string data type is a sequence of ASCII characters Use string controls to receive text from the user such as a password or user name Use string indicators to display text to the user Display types covered later. Just cover the basic concept here.

E. Front Panel – Shortcut Menus All LabVIEW objects have associated shortcut menus As you create a VI, use the shortcut menu items to change the look or behavior of front panel and block diagram objects To access the shortcut menu, right-click the object

E. Front Panel – Property Dialog Box Right-click a front panel object and select Properties to display The options available on the property dialog box are similar to the options available on the shortcut menu for that object

E. Front Panel – Configure Multiple Objects Select multiple objects to simultaneously configure shared properties

Configuring Your LabVIEW Environment Functions Palette Tack the Functions palette and select Customize»Change Visible Categories then click Select All Controls Palette Tack the Controls palette and select Customize»Change Visible Categories then click Select All

Pratice Replicate the following front panel

F. Block Diagram Terminals SubVIs Functions Constants Structures Wires Block diagram objects include the following: Terminals SubVIs Functions Constants Structures Wires

F. Block Diagram – Terminals Terminals are: Block diagram appearance of front panel objects Entry and exit ports that exchange information between the front panel and block diagram Analogous to parameters and constants in text-based programming languages Change the view type of a terminal by toggling the View as Icon selection from the context menu If you would like to, this is an excellent place to have your students change the view type of the terminal.

F. Block Diagram Terminals Discuss the visual difference between controls and indicators on the block diagram, and discuss the difference in operation between controls, constants and indicators. Especially that constants are only available on the block diagram. Right-click to change...

B. LabVIEW Data Types – Terminals Terminals visually communicate information about the data type represented Show that datatype is represented by the color, orange here, and the text on the terminal, DBL here.

F. Block Diagram – Wires Transfer data between block diagram objects through wires Wires are different colors, styles, and thicknesses, depending on their data types A broken wire appears as a dashed black line with a red X in the middle DBL Numeric Integer Numeric String Scalar 1D Array 2D Array

F. Block Diagram – Nodes Objects on the block diagram that have inputs and/or outputs and perform operations when a VI runs Analogous to statements, operators, functions, and subroutines in text-based programming languages Nodes can be functions, subVIs, or structures Nodes

H. Selecting A Tool Create, modify, and debug VIs using the tools provided by LabVIEW A tool is a special operating mode of the mouse cursor The operating mode of the cursor corresponds to the icon of the tool selected When using the Automatic Tool Selection, LabVIEW chooses which tool to select based on the current location of the mouse

Practice Look and the block diagram of the previous practice and add the following nodes: Add Multiply Random number Greater than Less than Get date/time in seconds Then use wires to connect all the elements of the block diagram leaving no terminal unconnected. Target: Simulate a given temperature value, add a random noise of given amplitude, then light up an alert when such a temperature is greater than setpoint and another if is less than setpoint .

Practice solution

F. Block Diagram – Function Nodes Fundamental operating elements of LabVIEW Do not have front panels or block diagrams, but do have connector panes Double-clicking a function only selects the function – does not open it like a VI Has a pale yellow background on its icon

F. Block Diagram – SubVI Nodes SubVI: VIs that you build to use inside of another VI Any VI has the potential to be used as a subVI When you double-click a subVI on the block diagram, you can view the front panel and block diagram of the subVI The upper right corner of the front panel and block diagram displays the icon for the current VI This is the icon that appears when you place the VI on a block diagram as a subVI This is where you describe what a subVI is. In lesson 7, the student will learn how to build a subVI, but should already be very familiar with what they are, and how to use them.

F. Block Diagram – Wires Transfer data between block diagram objects through wires Wires are different colors, styles, and thicknesses, depending on their data types A broken wire appears as a dashed black line with a red X in the middle DBL Numeric Integer Numeric String Scalar 1D Array 2D Array

B. LabVIEW Data Types – Terminals Terminals visually communicate information about the data type represented Show that datatype is represented by the color, orange here, and the text on the terminal, DBL here.

B. LabVIEW Data Types – Numerics The numeric data type represents numbers of various types To change the representation of a numeric, right-click the control, indicator, or constant, and select Representation from the shortcut menu Students learned about the numeric, Boolean and string datatype in Lesson 2. Now, they learn about implementing these datatypes, such as representation, Boolean action, and string display type. They will also learn a couple new datatypes: Enum and dynamic. Here, talk about the difference between integers, floating point, etc...

B. LabVIEW Data Types – Boolean Behavior of Boolean controls is specified by the mechanical action In LabVIEW, the Boolean data type is represented with the color green

Mechanical Action of Booleans Use the Mechanical Action of Booleans VI located in the NI Example Finder to learn about the different switch and latch actions. Have all students open this example program and experiment with it as you demonstrate.

B. Data Types – String A sequence of displayable or non-displayable ASCII characters On the front panel, strings appear as tables, text entry boxes, and labels Change the display type from the short-cut menu: Normal, ‘\’ Codes, Password and Hex Edit and manipulate strings with the String functions on the block diagram In LabVIEW, the string data type is represented with the color pink

B. Data Types – Enum An enum represents a pair of values, a string and a numeric, where the enum can be one of a defined list of values

B. Data Types – Enum Enum: enumerated control, constant, or indicator Enums are useful because it is easier to manipulate numbers than strings on the block diagram Point out that the datatype of the terminal is blue, showing that it is passing an integer

B. Data Types – Dynamic Stores the information generated or acquired by an Express VI Non-Express VIs do not accept the dynamic data type To use a built-in VI or function to analyze or process the dynamic data type, you must convert the data type Numeric, waveform, or Boolean data indicators or inputs automatically convert the dynamic data type when wired In LabVIEW, the dynamic data type is represented with the color dark blue

F. Block Diagram – Wiring Tips Press <Ctrl>-B to delete all broken wires Right-click and select Clean Up Wire to reroute the wire

F. Block Diagram – Wiring Tips Use the Clean Up Diagram tool to reroute multiple wires and objects to improve readability Select a section of your block diagram Click the Clean Up Diagram button on the block diagram toolbar

I. Dataflow LabVIEW follows a dataflow model for running VIs A node executes only when data are available at all of its input terminals A node supplies data to the output terminals only when the node finishes execution Notes for instructing: LabVIEW is NOT control flow. Visual Basic, C++, JAVA, and most other text-based programming languages follow a control flow model of program execution. Sequential order of program elements determines execution order. LabVIEW follows a dataflow model for running VIs. A block diagram node executes when it receives all required inputs. When a node executes, it produces output data and passes the data to the next node in the dataflow path. The movement of data through the nodes determines the execution order of the VIs and functions on the block diagram.

I. Dataflow – Quiz Which node executes first? Add Subtract Random Number Divide Sine There is no right answer to this quiz, but there are some wrong answers. This quiz is intended to encourage students to think about dataflow and its implications...

I. Dataflow – Quiz Answers NO CORRECT ANSWER Which node executes first? Add – possibly Subtract – definitely not Random Number – possibly Divide – possibly Sine – definitely not

Summary—Quiz Which function executes first: Add or Subtract? Add Unknown The answer is a.

Summary—Quiz Answer Which function executes first: Add or Subtract? Unknown The answer is a.

I. Case Structures Have two or more subdiagrams or cases Execute and displays only one case at a time An input value determines which subdiagram to execute Similar to case statements or if...then...else statements in text-based programming languages

I. Case Structures Case Selector Label: contains the name of the current case and decrement and increment buttons on each side Selector Terminal: Wire an input value, or selector, to determine which case executes

Practice Add to the previous practice a button in order to update the string label ONLY if the button is pressed. Then run. Change its mechanical action and run again. Create a enum control with items “Heating”, “Cooling”, “Conditioning” and use its values to turn on label “too hot” only, label “too cold” only, or both, according to the case selected. Make the string indicator display “Hi there!” if the user inputs “Hello”, or the same input string if otherwise.

I. Case Structures – Default Case You can specify a default case for the Case structure If you specified cases for 1, 2, and 3, but you get an input of 4, the Case structure executes the default case Right-click the Case structure border to add, duplicate, remove, or rearrange cases and to select a default case

I. Case Structures – Input & Output Tunnels You can create multiple input and output tunnels Inputs are available to all cases if needed You must define each output tunnel for each case Point out difference between tunnels that have been wired for all cases, and tunnels that have not.

I. Case Structures – Use Default if Unwired Default values are: Avoid using the Use Default If Unwired option on Case structure tunnels Adds a level of complexity to your code Complicates debugging your code Data Type Default Value Numeric Boolean FALSE String Empty

I. Case Structures – Boolean Boolean input creates two cases: True and False

I. Case Structures – Integer Add a case for each integer as necessary Integers without a defined case use the default case

I. Case Structures – String Add a case for each string as necessary Strings without a defined case use the default case

I. Case Structures – Enum Gives users a list of items from which to select The case selector displays a case for each item in the enumerated type control

I. Case Structures - Error Checking and Error Handling Use Case Structures inside VIs to execute the code if there is no error and skip the code if there is an error