Lab VIEW Course 1 1 Graphical Programming for

Lab. VIEW Course 1 1

Graphical Programming for Test, Measurement, and Control • Rapid application development and easy-to -use graphical environment • Interactive measurement assistants and powerful redesigned DAQ interface for connecting to all types of I/O Labview 2009 -2010 2

Acquire, Analyze, and Present Nearly all test, measurement, and control applications can be divided into 3 main components: the ability to acquire, analyze, and present data. Lab. VIEW = acquiring, analyzing, and presenting realworld data. Labview 2009 -2010 3

Acquire with Lab. VIEW can acquire data using the following devices and more: • GPIB, Serial, Ethernet, VXI, PXI Instruments • Data Acquisition (DAQ) • PCI e. Xtensions for Instrumentation (PXI) • Image Acquisition (IMAQ) • Motion Control • Real-Time (RT) PXI • PDA • Modular Instruments Labview 2009 -2010 4

Analyze with Lab. VIEW includes the following tools to help you analyze your data: • More than 400 measurement analysis functions for Differential Equations, Optimization, Curve Powerful Fitting, Calculus, Linear Algebra, measurement Statistics, etc. analysis is built in to • 12 new Express VIs specifically the Lab. VIEW designed for measurement analysis, development including filtering and spectral environment. analysis • Signal Processing VIs for Filtering, Windowing, Transforms, Peak Labview 2009 -2010 5 Detection, Harmonic Analysis,

Present with Lab. VIEW includes the following tools to help you present your data: Presentation with Lab. VIEW can be done on your PC or over a network Labview 2009 -2010 • On your machine — Graphs, Charts, Tables, Gauges, Meters, Tanks, 3 D Controls, Picture Control, 3 D Graphs (Windows Only), Report Generation (Windows Only) • Over the Internet — Web Publishing Tools, Datasocket (Windows Only), TCP/IP, VI Server, Remote Panels, Email • Enterprise Connectivity Toolset — SQL Tools (Databases), Internet Tools (FTP, Telnet, HTML) 6

Course Goals • Introduction to graphical programming environment (Front Panel / Block Diagram / Connector/icons) • Presentation of the key points for Labview programming (Vi / Sub Vi / Data types / Structures) • Introduction to debugging techniques Labview 2009 -2010 7

Course evaluation Fields Files organization Quality of user interfaces Quality of programs Behavior during the course Labview 2009 -2010 Weight 20% 30% 20% 8

Course Map Course 1 First steps with Lab. VIEW Course 2 Course 3 Making a decision Controlling property Loops Creation of new VI and customization Arrays Project Modular programming Signal generation Saving data Analyzing and Data acquisition saving data Labview 2009 -2010 Express VI 9

Lesson 1 Introduction to Lab. VIEW TOPICS Lab. VIEW Environment Front Panel Block Diagram Dataflow Programming Customization of VI Labview 2009 -2010 10

To start … … open LV_Getting_Started_Eng_2011. pdf and follow instructions until page 20 ! Labview 2011 -2012 11

Summary • New Dialog Box and Template VIs • Front Panel • Block Diagram • VI, Express Vis, functions, data formats • Front Panel and Block Diagram Tools • Running and Stopping a VI, Toolbars • Lab. VIEW Documentation Resources • Property Dialog Boxes • Shortcuts Labview 2011 -2012 12

How is composed a Virtual Instrument (VI) Front Panel • Controls = Inputs • Indicators = Outputs Block Diagram • Accompanying “program” for front panel • Components wired together Labview 2009 -2010 13

How is composed the Front Panel Window Front Panel Toolbar Free Text Numeric Control Numeric Indicator VI Icon Simple Numeric Indicator Waveform Graph Scale Legend Labview 2009 -2010 14

How is composed the Block Diagram Window Block Diagram Toolbar Sub. VI (VI Express) Numeric Constant Graph Terminal Wire Data Numerical Indicator Terminal While Loop Structure Timing Function Labview 2009 -2010 Boolean Control Terminal 15

Express VIs, VIs and Functions • Express VIs: interactive VIs with configurable dialog page • Standard VIs: modularized VIs customized by wiring • Functions: fundamental operating elements of Lab. VIEW; no front panel or block diagram Labview 2009 -2010 16

Different data formats Scalar 1 D Array 2 D Array Numeric Boolean String Dynamic Labview 2009 -2010 17

Tools Palette • Lab. VIEW can automatically select the tool needed • Available on the front panel and the block diagram • A tool is a special operating mode of the mouse cursor • Use the tools to operate and modify front panel and block diagram objects • To show the tools palette, select Window» Show Tools Palette Labview 2009 -2010 18

Front Panel − Controls Palette Contains the most commonly used controls All Controls Palette Shows all controls Labview 2009 -2010 19

Block Diagram − Functions Palette Contains the Express VIs (interactive VIs with configurable dialog page) and the most commonly used functions All Functions Palette Shows all functions Labview 2009 -2010 20

Tools Palette Click pushpin to tack down palette Up to Owning Search Palette Options Palette • Graphical, floating palettes • Subpalettes can be converted to floating palettes • Use Palette Options to change palette view from Express to Advanced Labview 2009 -2010 21

Menu File Edit Operate Tools Browse Window Help Labview 2009 -2010 22

Front Panel and Block Diagram Toolbars Run button Font ring Continuous Run Alignment ring button Distribution ring Abort button Resize ring Pause/Continue button Warning indicator Enter button Broken Run button Reorder ring Additional Buttons on the Block Diagram Context Help Button Toolbar • Execution Highlighting button • Step Into button • Step Over button • Step Out button Labview 2009 -2010 23

Labview help 1. Information about Lab. VIEW programming concepts, step-by-step instructions for using Lab. VIEW, and 2. Reference information about Lab. VIEW VIs, functions, palettes, menus, tools, properties, methods, events, dialog boxes, and so on. Labview 2011 -2012 24

Property Page Right-click a control or indicator on the front panel and select Properties from the shortcut menu to access the property dialog box for that object Labview 2009 -2010 25

Some shortcuts Labview 2011 -2012 26

Lesson 2 Creation of a new VI and customization TOPICS New VI creation Dataflow Programming Customization of VI Labview 2009 -2010 27

Exercise 2. 1 - Convert °K to °F • Goal – Create a simple VI – Topic : convert a Kelvin temperature into Fahrenheit • Concepts – Simple mathematic function, numeric format – Commands and indicators – Dataflow, help, debugging – Displays customized • Homework – Open a new VI – Build a VI that converts °K to °F – Save in « 1_Kto. F. vi » Labview 2009 -2010 28

Step 1 : Creating a new VI • File» New VI to open a blank VI • File» New… to open the New dialog box and configure a VI template, global variable, control, etc… Labview 2009 -2010 29

Composition of a new VI Diagram (D) Front Panel (FP) Labview 2009 -2010 30

Creating a VI Front Panel Build the front panel with controls (inputs) and indicators (outputs) Owned Labels Boolean Control Labview 2009 -2010 Boolean Indicator Increment Buttons Numeric Indicato r Numeric Control 31

Step 2 : Create the Front Panel Create this Front Panel using the Controls Palette Labview 2009 -2010 32

Shortcut Menus for Front Panel Right-click the digital Objects display to access its shortcut menu Right-click the label to access its shortcut menu Labview 2009 -2010 33

Step 3 : Creating a VI Block Diagram Front Panel Indicator Control Block Diagram Control Terminal Labview 2009 -2010 Constant Wires Nodes Indicator Terminal 34

Wiring Techniques Hot Spot • Automatic Wiring • Use Context Help Window when wiring • Right-click wire and select Clean Up Wire • Tip Strips • Automatic wire routing • Right-click terminals and select Visible Items» Terminals View the terminal connections to a function Labview 2009 -2010 35

Block Diagram Terminals • Terminals are entry and exit ports that exchange information between the panel and diagram • Terminals are analogous to parameters and constants in text-based programming languages • Right-click and toggle View As Icon to change the icon view Labview 2009 -2010 36

Context Help • To display the Context Help window, select Help» Show Context Help, press the <Ctrl-H> keys, or press the Show Context Help Window button in the toolbar • Move cursor over object to display help • Connections: Required – bold Recommended – normal Optional - dimmed Simple/Detailed Context Help More Help Labview 2009 -2010 Lock Help 37

Lab. VIEW Help • Click the More Help button in the Context Help window • Select Help» VI, Function, & How-To Help • Click the sentence Click here for more help in the Context Help window. Contains detailed descriptions of most palettes, menus, tools, VIs, and functions, step-by-step instructions for using Lab. VIEW features, links to the Lab. VIEW Tutorial, PDF versions of all the Lab. VIEW manuals and Application Notes, and technical support resources. Labview 2009 -2010 38

Dataflow Programming • Block diagram executes dependent on the flow of data; block diagram does NOT execute left to right • Node executes when data is available to ALL input terminals • Nodes supply data to all output terminals when done Labview 2009 -2010 39

Step IV : Save the VI as “ 1_Kto. F. vi” (in a specific folder) Then execute it ! Labview 2009 -2010 40

Customization of displays • Goals – Insert comments for users – Adapt displays to the application • What sort of customization ? – Free text – Models of commands and indicators – Scale –… Labview 2009 -2010 41

1) Free text • Useful to inform user • Authorized on FP et D In example, 1. Add something like : ‘ Temperature conversion ’. 2. Then, change font, size, color … (via FP Toolbar) Labview 2009 -2010 42

2) Customization of displays 1. Shortcut menu of object 2. Choose the right indicator Labview 2009 -2010 43

Exercise 2. 2 - Customization of displays • Goal – Modify a VI – Topic : Customization with specific models of indicator and messages • Concepts – Free text – Customization of displays • Homework – Open « 1_Kto. F. vi » – Replace numerical indicator with temperature indicator – Insert free text in FP and D to legend them – Save in « 2_Kto. F. vi » Labview 2009 -2010 44

Exercise 2. 2 : FP customized Labview 2009 -2010 45

Exercise 2. 2 : D customized Labview 2009 -2010 46

Lesson 3 Modular Programming TOPICS Sub. VIs Icon and Connector Pane Using Sub. VIs Creating a Sub. VI from sections of a VI Labview 2009 -2010 47

Lab. VIEW Hierarchy Sub. VI Labview 2009 -2010 48

Sub. VIs Function Pseudo Code function average (in 1, in 2, out) { out = (in 1 + in 2)/2. 0; } Sub. VI Block Diagram Calling Program Pseudo Code main { average (point 1, point 2, pointavg) } Calling VI Block Diagram Labview 2009 -2010 49

Icon/Connector terminals Icon An icon represents a VI in other block diagrams A connector passes data to and receives data from a sub. VI through terminals Labview 2009 -2010 Connector terminals 50

Sub. VI Example – Conversion temperatur • A VI within another VI is called a sub. VI • To use a VI as a sub. VI, create an icon and a connector pane after building the front panel and block diagram Labview 2009 -2010 51

Steps for creating a Sub. VI • Create the Icon • Create the Connector • Assign Terminals • Save the VI • Insert the VI into a Top Level VI Labview 2009 -2010 52

Creating the Icon • Icon: graphical representation of a VI • Right-click in the icon pane (Panel or Diagram) • Always create a black and white icon Default Icon Labview 2009 -2010 Create a custom icon 53

Creating the Connector Right-click the icon (Front Panel only) Labview 2009 -2010 54

Creating the Connector continued Labview 2009 -2010 Click with wiring tool 55

Assign terminals via the Connector Pane Terminal colors match the data types to which they are connected Click the terminal to see its associated front panel object … and save the VI ! Labview 2009 -2010 56

Using a VI as a Sub. VI All Functions » Select a VI… <OR> Drag icon onto target diagram <OR> Drag file onto target diagram Labview 2009 -2010 57

Help and Classifying Terminals Classify inputs and outputs: • Required — Error if no connection • Recommended — Warning if no connection • Optional — No effect if no connection Labview 2009 -2010 58

Exercise 3. 1 – Generate temperature using Sub. VI • Goal – Create a simple VI – Topic : convert a Kelvin temperature into Fahrenheit • Concepts – Sub. VI • Homework – Create icon and connector of « 1_Kto. F. vi » , save it and close – Create a new VI in order to generate a randomly temperature between T 0–DT et T 0+DT : • 2 inputs T 0(°K) and DTmax(°K) • 2 outputs T(°K) and T(°F) – You have to use the VI « 1_Kto. F. vi » – Save in « 3_Gen_temp_conv. vi » Labview 2009 -2010 59

Searching for Controls, VIs, and Functions • Press the search button to perform text searches of the palettes • Click and drag an item from the search window to the block diagram or double-click an item to open the owning palette For the exercise, search for “Random number” Labview 2009 -2010 60

Exercise 3. 1 : D Labview 2009 -2010 61

Exercise 3. 2 : FP Labview 2009 -2010 62

Complement : another way for creating a sub. VI It exists an other way to simply create Sub. Vi. Indeed, just by selecting the part of the program in which you're interested in creating a Sub. Vi you can achieve it. But this method performs some automatic assignments and you will have to be careful when you use it… Labview 2009 -2010 63

Selection of the program part Labview 2009 -2010 64

Creation of the Sub Vi Labview 2009 -2010 65

Terminal assignment & icon Once the creation is achieved, the selected program part becomes an icon. You can edit it to customize its appearance. Moreover, if you look at the terminal assignment, it has automatically be generated. However, you can change it with the method studied in lesson 2. Labview 2009 -2010 66

Exercise 3. 2 • Goal – Sub. VI creation • Homework – Open "3_Gen_temp_conv. vi". – Replace the generation part by a sub. VI. – Customize the Sub. VI icon. – Suppress the automatic assignment of "T 0" and "d. Tmax" – Save the Sub. VI as "3 Compl 1_Gen_temp_conv. vi" Labview 2009 -2010 67

Summary • VIs can be used as sub. VIs after you make the icon and connector • Icon created using Icon Editor • Connector defined by choosing number of terminals • Load sub. VIs using the Select a VI option in the All Functions palette or dragging the icon onto a new diagram • Online help for sub. VIs using the Show Context Help option • Descriptions document functionality • Use Create Sub. VI feature to easily modularize the block diagram Labview 2009 -2010 68

Lesson 4 Simple acquisition TOPICS Replacing simulation by acquisition Data acquisition, acquisition of 1 point Labview 2009 -2010 69

Data Acquisition Hardware (1/2) • Data acquisition (DAQ) basics • Connecting Signals • Simple DAQ application DAQ Device Computer Sensors Cable Terminal Block Labview 2009 -2010 70

Data Acquisition Hardware (2/2) Channel names Signals ai 0 ai 1 ai 2 Sine Wave 1 Sine Wave 2 Sine Wave 3 Tasks Timing and Triggering Labview 2009 -2010 71

Data Acquisition in Lab. VIEW Traditional NIDAQ Specific VIs for performing: • Analog Input • Analog Output • Digital I/O • Counter operations Labview 2009 -2010 NI-DAQmx Next generation driver: • VIs for performing a task • One set of VIs for all measurement types 72

Steps for creating and acquisition task How to create a task to acquire an analogous tension ? • In Diagram, open Palette de fonction – Express > Entrées > Assistant DAQ – Acquérir un signal > Entrée analogique > Tension • Parameters : – Configuration du terminal : RSE (ground ref. ) – Paramètres de cadencement / Mode d’acquisition 73 Labview 2009 -2010

Exercise 4. 1 – Simple Data Acquisition • Goal – Acquire analog signal – Topic : acquire voltage from thermistor • Concepts – Assistant acquisition data and hardware – Formula node • Homework – Step 1 : In a blank vi, create an acquisition task, 1 point, tension, -10/+10, RSE – Step 2 : Convert the measured voltage into temperature with formula node or express. Save it as “Acq_Temp. vi” – Step 3 : Open the vi “Sim_temp_conv 2. vi” and replace the simulation part (“specifications and generation”) by the acquisition part and save it in “Acq_Temp_conv. vi” Labview 2009 -2010 74

Electronic system Rth = f(Uth) ? Vcc R 0 Labview 2009 -2010 = +10 V = 10 500 Ohms 75

Ref thermistor : Labview 2009 -2010 76

Exercise 4. 1 – D Labview 2009 -2010 77

Exercise 4. 1 – FP Labview 2009 -2010 78

Exercise 4. 1 – D With express VIs With sub. VI Labview 2009 -2010 79

Exercise 4. 1 : Front Panel (FP) Labview 2009 -2010 80

Complement : another way for implementing mathematical function For sure, basic mathematical functions for huge calculus won't be very practical nor very efficient. They lead to complicated programs, and Labview propose the use of higher level functions like "expression node" or "formula node"… Labview 2009 -2010 81

Exercise 4. 2 • Goal – Use of higher level function for mathematical calculus – Creation of Sub. VI • Homework – Open "4_Acq_Temp_conv. vi" – Replace the Calculus part by a "formula node" or an "expression node" – Create a Sub. VI performing the acquisition and the conversion. This Sub. VI won't have any input terminal and just one output terminal. – Save as "4 Compl 2_Acq_Temp_conv. vi" Labview 2009 -2010 82
- Slides: 82