Engineering Workbench A LabVIEW is a datagraph type programming language. The direction of the data between two operations can be represented by a directed graph.
is modeled as a series of operations happening in a specific order. • The program focuses on commands: “how” to operate • Dataflow • Dataflow programming emphasizes the movement of data and models programs as a series of connections (“what to do”) • Explicitly defined inputs and outputs connect operations, which function like black boxes. • An operation runs as soon as all of its inputs become valid. Thus, dataflow languages are inherently parallel
edges (:=wires) • Each edge is directed, data flows always from node’s output (source) to another node’s input (drain) • One source may be connected to more drains • Any drain must be connected to exactly one source Operation Data
edges (:=wires) • Each edge is directed, data flows always from node’s output (source) to another node’s input (drain) • One source may be connected to more drains • Any drain must be connected to exactly one source Operation modifies data New Data
edges (:=wires) • Each edge is directed, data flows always from node’s output (source) to another node’s input (drain) • One source may be connected to more drains • Any drain must be connected to exactly one source
edges (:=wires) • Each edge is directed, data flows always from node’s output (source) to another node’s input (drain) • One source may be connected to more drains • Any drain must be connected to exactly one source Subnoding
= 0:pi/20:2*pi; k=0; y = sin(t); h = plot(t,y,'YDataSource','y'); while (get(handles.ck_run,'Value')) k=k+0.1; f=get(handles.sl_freq,'Value'); y = sin(t.*f+k); refreshdata(h,'caller'); drawnow; pause(.1); end
= 0:pi/20:2*pi; k=0; y = sin(t); h = plot(t,y,'YDataSource','y'); while (get(handles.ck_run,'Value')) k=k+0.1; f=get(handles.sl_freq,'Value'); y = sin(t.*f+k); refreshdata(h,'caller'); drawnow; pause(.1); end HOW: Allocate memory for the variable “k”, and store a numeric value “0” in this variable HOW: Load the variable “k”, and add 0.1 to its original value, and store the new value in “k”
Different sensors and bus protocols • Signal analysis, log/generate reports • Instrument control • Automate data collection, control multiple instruments • Automating test and validation systems • Control multiple instruments, analyze and display test data • Embedded monitoring and control systems • Integrate off-the-shelf hardware, prototype with FPGA technology • Wireless system prototyping • LTE, 802.11 development frameworks
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 18
Virtual Instruments are LabVIEW programmes. VIs are linked to each other in a given hierarchy • Custom controls (Type definitions): User defined LabVIEW data types • Global and shared variables: sockets what are able to transfer data between LabVIEW programs • Libraries: Collection of LabVIEW programs • Build specifications: Directions for LabVIEW to dstribute LabVIEW programs 21
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 28
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 30 Boolean Control Boolean Indicator
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 31
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 32
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 33
appearance of front panel objects • Entry and exit ports that exchange information between the front panel and block diagram Change the view type of a terminal by toggling the View as Icon selection from the context menu 36
Block diagram appearance of front panel objects • Control terminals: Provide INPUT for subVIs • Indicator terminals: Provide OUTPUT for subVIs Constants are: • Fixed value entries (inputs) for subVIs • Objects with NO front panel appearance Any object can be transformed into constant, control or indicator 37
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 39 Nodes
of LabVIEW – atomic, no further details • Do not have front panels or block diagrams, but do have connector panes • Has a pale yellow background on its icon 40
built 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 41
special type of subVI Require minimal wiring because you configure them with dialog boxes Save the configuration of an Express VI as a subVI Icons for Express VIs appear on the block diagram as icons surrounded by a blue field 42
other nodes. Structures have input and output terminals just like subVI nodes and functional nodes. 43 Input terminals Function node inside Another structure inside Output terminals
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 44 Scalar 1D Array 2D Array DBL Numeric Integer Numeric String Boolean
a function, the inputs are converted in accordance to the output This is indicated by the “coercion dot” E. For Loops – Numeric Conversion Coercion Dot
Diagram tool to reroute multiple wires and objects to improve readability 1. Select a section of your block diagram 2. Click the Clean Up Diagram button on the block diagram toolbar 57
Mac OS X Open and arrange block diagram or/and front panel CTRL + T ⌘ + T Open context help CTRL + H ⌘ + H Remove broken wires CTRL + B ⌘ + B Quick drop CTRL + Space ⌘ + CTRL + Space Find object CTRL + F ⌘ + F Run VI CTRL + R ⌘ + R Stop VI CTRL + . ⌘ + .
and out of structures • The tunnel adopts the color of the data type wired to the tunnel • Data pass out of a loop after the loop terminates • When a tunnel passes data into a loop, the loop executes only after data arrive at the tunnel
way you create a While Loop • If you need to replace an existing While Loop with a For Loop, right-click the border of the While Loop, and select Replace with For Loop from the shortcut menu • The value in the count terminal (an input terminal) indicates how many times to repeat the subdiagram
set number of times unless a conditional terminal is added • Can execute zero times • Tunnels automatically output an array of data While Loop • Stops executing only if the value at the conditional terminal meets the condition • Must execute at least once • Tunnels automatically output the last value
while loop terminates, if a random generated number is greater or equal to a constant provided through an input tunnel. Display the iteration number once the loop has been terminated.
border and select Add Shift Register from the shortcut menu • Right shift register stores data on completion of an iteration • Left shift register provides stored data at beginning of the next iteration Initial values
shift registers remember values from multiple previous iterations and carry those values to the next iterations • Right-click the left shift register and select Add Element from the shortcut menu
of elements and dimensions • Elements: data that make up the array • Dimension: the length, height, or depth of an array • An array can have one or more dimensions and as many as (231)–1 elements per dimension, memory permitting • Consider using arrays when you work with a collection of similar data and when you perform repetitive computations • Arrays are 0 indexed 87
or from a For Loop or While Loop, you can link each iteration of the loop to an element in that array by enabling auto- indexing on tunnel • The tunnel changes from a solid square to the image shown above to indicate auto-indexing 92
output tunnel, the output array receives a new element from every iteration of the loop • Auto-indexed output arrays are always equal in size to the number of iterations 94
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
False state to change to True when you click it and stay True until you release it and LabVIEW has read the value? a) Switch Until Released b) Switch When Released c) Latch Until Released d) Latch When Released
the False state to change to True when you click it and stay True until you release it and LabVIEW has read the value? a) Switch Until Released b) Switch When Released c) Latch Until Released d) Latch When Released
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 115