Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

LabView Programming Manual

LabView programming manual

Uploaded by

prashantmeni2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
17 views

LabView Programming Manual

LabView programming manual

Uploaded by

prashantmeni2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 39
AIM: To perform basic arithmetic operations using LabVIEW. Addition, Subtraction, Multiplication and division. THEORY: To give the 2 inputs numeric controls are selected in Front panel .And all arithmetic operators can be selected from Functions palette. Addition, subtraction, multiplication and division are the basic arithmetic operations. PROCEDUR Step 1: Start the LabVIEW and select the blank VI. Step 2: Create front and block diagram panel. Step 3: Numeric controls are given as inputs and numeric are selected by right clic indicators are given as output they ing on the front panel. Step 4: Different arithmetic operators such as addition, subtraction, multiplication and division are generated in block diagram panel. Step 5: Using wiring operation inputs and outputs are connected to the respective operators in the block diagram panel. Step 6: Input values are given in the front panel and the program is executed. Hence the output is generated. BLOCK DIAGRAM: The block diagram for basic arithmetic operations using LabVIEW is shown below in Fig.1.1. Number 1 a Addition {| i] Subtraction Number 2 plication Division > Fig:1.1:Block diagram of basic arithmetic operations OUTPUT/FRONT PANEL: Output of basic arithmetic operations is shown in below fig 1.2. Addition s Number 1 a v Subtraction 4 Number 2 Multiplication a gr 2 Division Fig:1.2:output of basic arithmetic operations RESULT: The arithmetic operations were performed and the result is verified using LabVIEW. Viva questions: 1. What are the advantages of LabVIEW? 2.What are the two panels used in LabVIEW programming? 3.What is the difference between local variable and global variable in LabVIEW? EXPERIMENT 2 BOOLEAN OPERATIONS AIM: To perform Boolean operations using LabVIEW. AND,OR.NOT,.XOR , NAND. THEORY: The truth table of Boolean operations like AND, OR,NOT,XOR ,and NAND is shown below in Fig 2.1. The Boolean inputs are given by push buttons in the control palette .All the Boolean operators can be taken from the functions palette, Logic Gates Name | NOT AND. NAND | OR NOR NOR Alg. Expr. 4 AB aB AoB AaB AOB went |e > |=>- D> ‘Truth A|x |e ajx | we alx |e alx |p alx] @ ax Table d,s |o ofe |o oli |o o|0 | 0 6 7 |o ofe rfo |o tle |o aja }orlaforle}o ifr rofo|1 oft }a eja]s ole }a oft vata ]a afofa ata fa ales afte Fig2.1:Truth table of all the logic gates PROCEDURE: Step |: Start the LabVIEW and select the blank VI. Step 2: Create front and block diagram panel Step 3: To perform Boolean operation push buttons are taken as inputs and round LED as output. Step 4: Different Boolean operations such as AND, OR, XOR, NOT, NAND are selected from the block diagram panel. Step 5: Boolean inputs and outputs are wired in the block diagram panel. Step 6: Logic values 0 & 1 are given in the front panel and the program is executed. BLOCK DIAGRAM: The block diagram of Boolean operations is shown below in Fig.2.2. a Ano : Fst fe] or . £ D> Not + L s Not And ay Fig 2.2:Block diagram of Boolean operations OUTPUT/FRONT PANEL: The output of Boolean operations is shown below in Fig.2.3. NAND s 3: output of Boolean operations RESULT: The Boolean operation using LabVIEW is performed. VIVA QUESTIONS: 1.Is LabVIEW a compiled programming language? 2. Can LabVIEW be integrated into existing software engineering practices? 3.What is LabVIEW? EXPERIMENT 3 SUM OF N NUMBERS USING FOR LOOP AIM: To find the sum of ‘n’ numbers using FOR loop. THEORY: Iculate sum of n Then as per the equation ly sum of n numbers, we take for natural numbers.The eq) numbers is n(n+1)/2.So we want to take sum of first 3 numbers, it becomes 3(4)/2: 342+1=6. FOR loop in LabVIEW is shown below in Fig 3.1 sa eer ee y Fig 3.1:Structure of FOR loop In FOR loop, shift registers are used if we make use of previous results.N is the count and I is the iteration terminal and initial value is zero. PROEDURE: Step 1: Create blank VI. Step 2: First of all move to the front panel and press right then control palette and choose numeric option place in the front panel and its correspondent will shown block diagram. Step 3:Right click on the block diagram panel, select program , go to structures and select a FOR loop. Step 4: Right click on the border of the FOR loop and select add shift register, borders are converted into shift register. Step 5: In block diagrams select the numeric button and choose constant and connect it to register. Step 6: Select the add button from the numeric tab. Then select the increment option from the numeric tab Connect the output of this increment block to the remaining input of the add block. Step 7: At the right shift register click right and from the drop down select create and then select indicator Step 8:Inputs are given in the front panel and the program is executed BLOCK DIAGRAM: The block diagram of sum of n numbers using FOR loop is shown in Fig 3.2 below. Enter the number N ‘Sum of N numbers Fig 3.2: Block diagram of sum of n numbers using FOR loop OUTPUT/FRONT PANEL: The output or the front panel view of sum of'n numbers using FOR loop is shown below in Fig 3.3. Enter the number N ‘Sum of N numbers ho 5 : result of sum of n numbers using FOR loop RESULT: Thus the sum of ‘n’ natural numbers using FOR loop is performed in LabVIEW. VIVA QUESTIONS: |. What is shift register How is it implemented in Lab VIEW? 2.Can LabVIEW Vis be merged? 3.What is LabVIEW signal express? 4.What is Formula node in LabVIEW? 5.In which palette, FOR loop is available? EXPERIMENT 4 ACTORIAL OF A NUMBER AIM: To perform the factorial of a given number using FOR loop. THEORY: Factorial is an important function, which is used to find how many ways things can be arranged or the ordered set of numbers. The factorial concept is used in many mathematical concepts such as probability, permutations and combinations, sequences and series, etc. In short, a factorial is a function that multiplies a number by every number below it till 1. For example, the factorial of 3 represents the multiplication of numbers 3, 2, 1, i.c.3!—3 x2 * 1 and is equal to 6. A For Loop is a structure you use to execute a block of code a set number of times. When the VI runs, the iteration count is evaluated, and then the code is executed.A For Loop can be configured to conditionally stop code execution in addition to its iteration-based exit. In these cases, the code will execute until the count terminal setting is reached or the condition is met — whichever happens first. The structure of FOR loop in LabVIEW is shown below in Fig.4.1. Count re =o Fig:4.1 Structure of FOR loop In FOR loop structure , N is the count and | is the iteration value. Initial value of I is zero. PROCEDURE Step 1: Create blank V1. Step 2: Click right on the front panel from the control palette selects numeric and then selects control . Step 3: Right click on the block diagram panel , select program , go to structures and select a FOR loop. Step 4: Connect the numeric control in which the user input will be stored to the N. Right click on the border of the FOR loop and select add shift register, borders are converted into shift register. Step 5: To initialize the shift register, from the function palette select numeric and then select constant. Place this numeric with the shift register and set its value to 1 Step 6: For the multiplication task place a multiply block, from the function palette select numeric and then select multiply. At one of the two inputs of the multiply block connect the right shift register, and the output of this block connect the right shift register. Step 7; On the other input of the multiply block we have to connect the incremented iteration because the number of iterations start from 0 but we want the factorial from | onwards, because the factorial will turn out to be zero otherwise. From the function palette select numeric and then select increment. Step 8: At the input of this increment block connect the iterative index of the for loop, and connect the output of this increment block to the remaining input of the multiply block. Step 9: At the right shift register click right and from the drop down select create and then select indicator. Step 10:Inputs are given in the front panel and the program is executed. BLOCK DIAGRAM: Block diagram of factorial of a number using FOR loop is given below in Fig.4.2. Enter the number N — For Loop Factorial of N Multiply a 7 Increment Fig.4.2: Block diagram of Factorial of a number using FOR loop OUTPUT/FRONT PANEL: The output of factorial of a number using FOR loop is shown below in Fig.4.3. Enter value of N Factorial of number N @> 120 Fig:4.3: Output of factorial of a number using FOR loop RESULT: The factorial of a given number is using FOR loop is performed in LabVIEW. VIVA QUESTIONS: 1. How mixed data types are combined and passed from one file or place to the other in LabVIEW? What is the initial value of iteration count? . What is subVI? . What is block diagram panel? . What is front panel? ween EXPERIMENT 5 DETERMINE SQUARE OF A GIVEN NUMBER AIM: To determine Square of a given number using LabVIEW. THEORY: The Square root VI computes the square root of the input value. If x is negative, the square root is NaN unless X is complex. IfX is a matrix, this function takes the matrix square root of X. The connector pane displays the default data types for this polymorphic function. x can be a scalar number, array or cluster of numbers and array of clusters of numbers. Sqrt(X) is a double-precision, floating-point number if X is an integer. If x is less than 0, sqrt(x) is not a number (NaN). PROCEDURE: Step |: Create blank VI Step 2: Right click on the block diagram window, select numeric, add numeric constant to represent the input. Step 3: Right click on the block diagram window, select numeric, add numeric constant to represent the output. Change the control to indicator Step 3: Right Click on the block diagram window, select numeric, add the square root block. Step 4: Using wiring operations required connections are given in the block diagram. Step 5: Inputs are given in the front panel and the program is executed BLOCK DIAGRAM: Block diagram to calculate square and square root of a number is shown below in fig 5.1. Enter the number coun ‘Square of number > Fig.5.1: To find square root of a number (additionally factorial and square of number is also shown) OUTPUT/FRONT PANEL: Square of number 81 Enter the number a Cube of number o 9 729 sqrt(x) 3 Fig.5.2:Output of square ofa given number RESULT: Square of a given number is determined using LabVIEW. VIVA QUESTIONS: What is the output of square root block if input is negative number? What is the default data type for input for square root block? Can square root block help in finding roots of a complex number? 1 2. 3. 4, What is the datatype for integer or floating-point number? EXPERIMENT 6 FACTORIAL OF A NUMBER USING WHILE LOOP AIM: To find factorial of a number using while Loop in LabVIEW. THEORY: Use shift registers when you want to pass values from previous iterations through a loop to the next iteration. A shift register appears as a pair of terminals, shown as follows, directly opposite each other on the vertical sides of the loop border. The terminal on the right side of the loop contains an up arrow and stores data on the completion of an iteration. LabVIEW transfers the data stored in the right terminal of the shifi register to the left terminal. The loop then uses the data from the left terminal as the initial values for the next iteration. This process continues until all iterations of the loop execute. After the loop executes, the terminal on the right side of the loop returns the last value stored in the shift register. A shift register transfers any data type and automatically changes to the data type of the first object wired to the shift register. The data you wire to the terminals of each shift register must be the same type. If you have multiple operations that use previous iteration values within a loop, use multiple shift registers to store the data values from those different processes in the structure, as shown in the following block diagram in Fig 6.1 and 6.2. PROCEDURE: Step 1: Create blank VI. Step 2: Right click on the block diagram panel , select program , go to structures and select a WHILE loop. Step 3: Right click on the border of the WHILE loop and select add shift register,borders are converted into shift register. Step 4: Using wiring operations required connections are given in the block diagram. Step 5: Inputs are given in the front panel and the program is executed. BLOCK DIAGRAM: Factorial of number N Enter value of N Fig 6.1 Block diagram using while loop OUTPUT/FRONT PANEL: The output or the front panel window view is shown below in fig 6.2. Enter walue of N Factorial of number N e 120 Fig.6.2 output RESULT: Factorial of a number is determined using while loop in LabVIEW. VIVA QUESTIONS: What is the role of shift register in the while loop? What is the default data type for factorial block? How to find factorial of integer numbers? Differentiate for loop and while loop. Reps EXPERIMENT 7 SORTING EVEN NUMBERS USING WHILE LOOP IN AN ARRAY AIM: To sort even numbers using WHILE loop in an array. THEORY: Loops are used for controlling the iteration and execution flow of programs. Charts display the recent data and update periodically by maintaining a history of the past data While Loop While Loop executes a subdiagram until a condition is met. The While Loop executes the subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value. The default behavior and appearance of the conditional terminal is Continue If True. When a conditional terminal is Continue If True, the While Loop executes its subdiagram until the conditional terminal receives a FALSE value. To change the behavior and appearance of the conditional terminal, right-click on the terminal and select Stop If True. When a conditional terminal is Stop If True, the While Loop executes its subdiagram until the conditional terminal receives a TRUE value. Because the VI checks the conditional terminal at the end of each iteration, the While Loop always executes at least one time. The VI is broken if the conditional terminal is not wired. Fig 7.1 shows example of while loop structure Basic error handling can be performed using the conditional terminal of a While Loop. When an error cluster s wired to the conditional terminal, only the TRUE or FALSE value of the status parameter of the error cluster passes to the terminal. Also, the Stop If True and Continue If True shortcut menu items change to Stop If Error and Continue while Error. The iteration terminal (an output terminal) contains the number of completed iterations. The iteration count always starts at zero. During the first iteration, the iteration terminal returns 0. Wat (ms) (| Feedback Node Fig.7.1. While Loop structure * A While Loop executes a subdiagram until a condition is met. © The While Loop is like a Do Loop or a Repeat-Until Loop in text-based programming languages. © The While Loop always executes at least once. © The For Loop differs from the While Loop in that the For Loop executes a set number of times. * A While Loop stops executing the subdiagram, only if the expected value at the conditional terminal exists. * In LabVIEW, the WHILE Loop is located on the Functions » Programming » Structures palette. You also can place a For Loop on the block diagram, right-click the border of the For Loop, and select Replace with While Loop from the shortcut menu to change a For Loop to a While Loop. The While Loop contains two terminals, namely Conditional Terminal and Iteration Terminal. ¢ The Conditional Terminal is used to control the execution of the loop, whereas the Iteration Terminal is used to know the number of completed iterations. PROCEDURE: Step 1: Create blank VI Step 2: Right click on the Block diagram panel —structures— while loop Step 3: Right click on the Block diagram panel (inside while loop) — array— index array Step 4: Right click on the index array (input side) create control Step 5: Right click on the Block diagram panel array array size Step 6: Right click on the Block diagram panel numeric Quotient & Remainder Step 7: Right click on the Block diagram panel + Comparison— Equal to 0? Step 8: Right click on the Block diagram panel —>numeric— numeric constant Step 9: Right click on the Block diagram panel numeric decrement Step 10: Right click on the Block diagram panel —*numeric—> numeric constant Step 11: Right click on the Block diagram panel > Comparison— Equal ? Step 12: Using wiring operations required connections are made as given in the block diagram inside loop. Step 13: Make a connection to while loop from index array Step 14: Right click step 13 connection (on loop) Tunnel mode— Indexing Step 15: Right click step 14 connection (on loop) Tunnel mode—Conditional Step 16: Right click on the Block diagram panel —sarray— sort 1D array Step 17: Right click on the sort ID array (input side) —+create— control [Even array] Step 18: Right click on the sort 1D array (output side) ereate— control [Sorted array] Step 19: Using wiring operations required connections are made as given in the block diagram outside loop. BLOCK DIAGRAM: Fig 7.2 shows the block diagram of sorting even numbers using while loop. The array takes the input values. Using indexing values are accessed, and checked for even or not. To check for even number the element value is divided by two and resulting remainder if zero considered as even. This data is stored in output array. Using sort function, array is sorted. While Loop EVEN NUMBERS ARRAY ORIGINAL ARRAY Index Array Quotient & Remainder Equal? a Array Size — Fig7.2.Block diagram Sorting even Number in LabVIEW OUTPUT/ FRONT PANEL : EVEN NUMBERS ARRAY E sortec array E Fig.7.3.Input and output of sorted even numbers RESULT: Fig 7.3 shows the input array and sorted array. Even numbers are sorted using while loop in an array VIVA QUESTIONS: 1, What are the different loops available in LabVIEW? 2. Distinguish between for and while loop. 3. What is loop iteration control? 4, What is Multitracing? EXPERIMENT 8 FINDING ARRAY MAXIMUM AND ARRAY MINIMUM AIM: To find the maximum and minimum variable from an array. THEORY: Arrays © A group of homogeneous elements of'a specific data type is known as an array. « Arrays hold a sequence of data elements,usually of the same size and same data type placed in contiguous memory locations. © Individual elements are accessed by their position in the array. © The position is given by an index, which is also called as subscript © Some arrays are multi-dimensional, generally one -and two- dimensional arrays are the most common. You can build arrays of numeric, boolean, path, string and cluster data types. © You cannot create arrays of arrays 1D Array Controls, Indicators and Constants The index ranges from 0 to 3. The first element in the array is at index 0, the second element is at index 1, ete, © Inan array the clement selected in the index display always refer to the element shown in the upper left corner of the element display. © The clement (9) at index 0 is not shown in the array, because index | is selected in the index display © Steps for creating an array constant © Select an array constant from Functions » Programming » Arrays, Array shell appears with an index display on the left, an empty element display on the right. © Place a constant in the array shell. © The array shell automatically resizes to accommodate the object place in the array shell Alternative method is to copy an existing array on the front panel to the block diagram to create a constant of same data type. Initializing Arrays ¢ When an array is initialized, define the number of elements in each dimension and contents of each element, * Anuninitialized array has a dimension but no elements. An uninitialized array control with all the elements are dimmed indicating that the array is uninitialized. Inserting Elements within Arrays One can insert an element into a 1D array and a row or column into a 2D array. e Toadd an element 1D, right click the array on the front panel and select Data Operation » Insert Element Before. © Toadd a row or column to a 2D array, right click the array on the front panel and select Data Operations » Insert Row Before or Insert Column Before. One can insert elements, rows, column into arrays using the Insert Into Array function. Place an Insert Into Array function on the block diagram. The index input specifies the element, row, column where to insert the element or array with 0 being the first. e Elements are added before the value wire to index. 2D Arrays © A 2D arrays stores elements in a grid. © Itrequires a column index and a row index to locate an element both of which are zero- based. © To create a 2D array on the front panel, right click the index display of the array and select Add Dimension from the shortcut menu. Deleting Elements within Arrays © One can delete an element within a 1D array and a row or column within a 2D. To delete an clement in a LD array, right-click the array clement on the front panel and select Data Operations » Delete Element. © To delete a row or column in a 2D array, right-click the array row or column on the front panel and select Data Operations » Delete Row or Delete Column * Can delete elements, rows, columns and pages within array using the Delete From Array function. Replacing Elements within Array © Place the Replace Array Subset function on the block diagram Wire an array of any dimension to the n-dimension array input of the Replace Array Subset function. The function automatically resizes based on the dimensions of the array. The index input specifies which element, row, column to replace. The new element/subarray input specifies the value you want to replace an element. Resize the Replace Array Subset function to replace another element, row, column within an array ¢ Run the VI eee eee Deleting Elements within Arrays One can delete an element within a 1D array and a row or column within a 2D. To delete an element in a 1D array, right-click the array element on the front panel and select Data Operations » Delete Element. To delete a row or column in a 2D array. right-click the array row or column on the front panel and select Data Operations » Delete Row or Delete Column Can delete elements, rows, columns and pages within array using the Delete From Array function. PROCEDURE: Step 1: Create blank VI. Step 2: Right click on the Block diagram panel —-array— max & min. Step 3: Right click on the max & min (input side) create control. Step 4: Create four numeric indicators in the front panel for maximum variable, index, minimum variable, and index by right clicking on output side of max & min. Step 5: Using wiring operations required connections are made as given in the block diagram. Step 6: Inputs are given in the front panel and the program is executed. BLOCK DIAGRAM: Max element in_array Array Max & Min Min el b (723) rm} lement in array Array Size cl size of array Fig 8.1; Block diagram of array maximum and minimum in LabVIEW OUTPUT /FRONT PANEL : Max element in array max index ° 4673 1 Min element in array min index 24 a size of array 5 Fig 8.2: Input and output of array maximum and minimum RESULT: Fig 8.2 shows the maximum and minimum of given input array. The array maximum and minimum is determined using LabVIEW and also its index. VIVA QUESTIONS: 1. What is array? How it can be assigned? 2. Distinguish Array and Clusters. 3. How do graphs are made in VI? 4. Mention the difference between graph and charts. DEMONSTRATION EXPERIMENTS EXPERIMENT 9 BUILD A VI THAT SIMULATES A HEATING AND COOLING SYSTEM.THE SYSTEM MUST BE ABLE TO BE CONTROLLED MANUALLY OR AUTOMATICALLY. AIM: To build a vi that simulates a heating and cooling system.The system must be able to be controlled manually or automatically. The VI’s specifications are listed below. Must be able to be controlled automatically or manually In manual mode, the heater and air conditioning (AC) can be switched on/off by the user In automatic mode, the heater and AC turn on/off based on the following conditions: o The air conditioner is turned on when the temperature is above 80°F © The heater is turned on when the temperature is below 60°F © The heater and the air conditioner are turned off when the temperature is between 60°F and 80°F THEORY: Structures are process control elements, such as while loops and for loops. The structure to be used in this experiment is the case structure which is essentially multiple if-statements. A case structure contains multiple subdiagrams (or cases), and a case will be executed depending on the input to the case structure PROCEDURE: . In the front panel, drag and drop three Round LEDs and three Slide Switches by going to the Controls palette > Modern tab > Boolean, Each round LED and each slide switch will represent the AC, heater, and manual mode. The round LEDs will indicate if the item is on, and the slide switches will toggle the items on/off N . Rename the LEDs and their corresponding switches "Manual," "AC," and "Heater" to make building the system clearer. This can be done by using the editing text tool in the Tools palette. . Drag and drop a thermometer into the front panel (Controls palette > Modern tab > Numeric > Thermometer). 4, In the back panel, right click the thermometer terminal and select Change to Control, and observe how the arrow switches from the left side to the right side. This makes the thermometer a control that will give an input to the program, which in this case is temperature. 5. In the back panel, insert a case structure to control the manual and automatic operation of the heating and cooling system (Functions palette > Structures > Case Structure). To place the case structure, click once to place one corner of the case structure, and once more to place the other corner of the case structure, 6. Wire the slide switch designated as Manual to the case selector on the case structure. This should automatically change the selector label values to True and False, if they were not already, because the slide switch is a Boolean data type. The true value corresponds to manual mode being on (where the user can directly toggle the heater and AC), while the false value corresponds to manual mode being off (where the heater and AC are automatically toggled by the system). 7. Because the temperature of the room is input into the system only when the system is not in manual mode (the false case), the thermometer terminal should be moved into the false sub- diagram. 8. In the true sub-diagram, wire the AC and heater switches directly to their corresponding LEDs. This allows the switches to directly toggle their corresponding LEDs. 9, Staying in the true sub diagram, insert a True Constant (Functions palette > Programming tab > Boolean > True Constant). Wire the true constant to the manual LED to turn the manual LED on and indicate that the system is in manual mode. 10. In the false sub diagram, insert two Numeric Constants (Functions palette > Programming > Numeric > Numeric Constant), one Greater? function and one Less? function (Functions palette > Programming > Comparison). These will be used to build the program for the heating and cooling system in automatic mode. 11. The less and greater functions compare what is wired to the upper input terminal to what is wired to the lower input terminal. Wire the thermometer to the upper input terminals of the less and greater functions. Set a numeric constant to 60 and the other to 80. Wire the 60 numeric constant to the lower input terminal of the less function and the 80 numeric constant to the lower input terminal of the greater function. Wire the output terminal of the greater function to the AC LED and wire the output of the less function to the heater LED. 12. In the false sub diagram, Insert a False Constant (Functions palette > Programming > Boolean > False Constant) and wire it to the manual LED. This is to turn off the manual LED and indicate that the system is in automatic mode. 13. The system is now complete. Click the continuously run button to control and test the VL. If the continuously run button is faded out, that means the system is wired completely. When successfully running the system, the gridlines in the background of the front panel should disappear. Click the switches and thermometer on the front panel to test the system, BLOCK DIAGRAM: Fig 9.1 and 9.2 shows the block diagram for true case and false case respectively. Case Structure Manual 2 Fig 9.1 Block Diagram ~ For True Case Case Structure Greater? Fig 9.2. Block Diagram — For False Case OUTPUT/FRONT PANEL: The output for VI simulating a heating and cooling system is shown in Fig 9.3. Temoweter Manuel oa ace me o> e Hees? @ Manual? ° Fig 9.3.output RESULT: A virtual instrument that simulates a heating and cooling system is built. VIVA QUESTIONS: Design a temperature-controlled kettle for heating water and freezing water 1 2. What are the temperature indicators in LabView? 3. 4, What is a if Block in LabView ? What are True and False constant in LabView? EXPERIMENT 10 BUILD A VIRTUAL INSTRUMENT THAT SIMULATES BASIC CALCULATOR USING FORMULA MODE AIM: To build a Virtual Instrument that simulates basic Calculator Using Formula Mode. THEORY: The Formula Node in LabVIEW software is a convenient, text-based node you can use to perform complicated mathematical operations on a block diagram using the C- syntax structure. It is most useful for equations that have many variables or are otherwise complicated. The text- based code simplifies the block diagram and increases its readability. Furthermore, you can copy and paste existing code directly into the Formula Node rather than recreating it graphically. The Formula Node is available in all development versions of LabVIEW and docs not require an additional toolkit or add-on. PROCEDURE: The Formula Node in LabVIEW software is a convenient, text-based node you can use to perform complicated mathematical operations on a block diagram using the C- syntax structure. It is most useful for equations that have many variables or are otherwise complicated. The text-based code simplifies the block diagram and increases its readability. Furthermore, you can copy and paste existing code directly into the Formula Node rather than recreating it graphically. The Formula Node is available in all development versions of LabVIEW and does not require an additional toolkit or add-on, This tutorial is useful for familiarizing yourself with the Formula Node. Follow the steps to create a simple structure to compute different formulas depending on input values. Then, compare the simplicity of your block diagram using a formula node to its counterpart using graphical programming. The Formula Node is a tool that allows the benefits of text-based code within the easy-to-use graphical LabVIEW architecture. 1. Selecting File»New VI to open a blank VI 2. Place a Formula Node on the block diagram. lL. Right-click on the diagram and navigate to Programming» Structures»Formula Node. 2. Left-click to select the Formula Node. 3. Place the Formula Node on the block diagram by left-clicking, dragging, and releasing the mouse. 3. Right-click the border of the Formula Node and select Add Input from the shortcut menu. 4, Label the input variable x. 5. Repeat steps 3 and 4 to add another input and label it y as in fig 10.1. Fig.10.1 add input 5. Right-click the border of the Formula Node and select Add Output from the shortcut menuas in fig 10.2. Fig.10.2. add output 6. Label the output SI 7. Repeat step 5 to create another output, and label this output D1 Fig.10.3 create output and label Note: It is considered good programming practice to keep the inputs on the left border and the outputs on the right border of the Formula Node. This helps you follow the data flow in your VI and keep your code organized. 8. Enter the expressions below in the Formula Node. + Make sure that you complete each command with a semicolon. Notice, however, that the if-statement does not require a semicolon on the first line. 1. Right-click on each input and select Create»Control from the shortcut menu. 2. Right-click on cach output and select Create» Indicator from the shortcut menu. Fig 10.6 Block diagram OUTPUT/FRONT PANEL: The front panel view is shown in following fig 10.7. x Ring Reult is — _aner 6 v Add e rs Sub Div # Mal Fig 10,7 output RESUL’ A virtual instrument that simulates a basic calculator is built. VIVA QUESTIONS: What is the formula node? 1. 2. Use formula node for finding area of circle, circumference of cirele and are of a circle 3. Whatis the advantage of using formula node? Is formula node text based or block (graphical) based? > EXPERIMENT 11 WATER LEVEL INDICATOR AIM: To create and demonstrate water level indicator. Description: If No water is in tank then motor must be ON. If water level crosses 8 then Motor must be OFF. THEORY: ‘The water level indicator circuits are used in factories, chemical plants, and electrical substations and in other liquid storage systems. There are many possible uses for this simple system, examples include monitoring a sump pit (to control pump activation), rainfall detection, and leakage detection. Electronic water level circuits have the capability of alerting if there is a water leak somewhere in the factory When the water level is too high or too low or exceeds the higher limit, it ean detect the water level easily by hearing an alarm sound or from different colors of a light bulb, We can also measure the fuel evel in motor vehicles and the liquid level containers which are huge in the companies. The circuit is designed to indicate three levels of water stored in the tank: empty, half and full but not overflowing. When there is no water in the tank, all the LEDs are off as an indication that the tank is completely empty. Then, manually control the knob to turn ON LED, When water level increases and touches the maximum limit, the OFF LED will glow indicating that there is water within the tank. As ues to rise and reaches half the tank, ON LED will still glow indicating tank is the water level cont filling The important LabVIEW components or tools, required to design a water level detector, list of these components below: + Tank + Round Knob + Upper Level Indicator + Lower Level Indicator + Numerical Indicator * Graph to observe the results Vertical pointer is used to control the level of the water in the tank. Upper level indicator shows when the tank is about to completely fill. Lower level indicator shows indication by tuning "ON" the LED when the level of the water in the tank is too low and we need to fill it. Graphs shows the graphical visualization as the vertical pointer moves up ow down. PROCEDURE: Step 1: Create blank VI. Step 2: Right click on the front panel —numeric— knob. Step 3: Right click on the knob —»Properties—> scale—> Set maximum 10 and minimum 0 Step 4: Right click on the front panel +Boolean— Round LED (Name it ON). Step 5: Right click on the front panel >Boolean—> Round LED (Name it OFF). Step 6: Right click on the front panel +-numeric— Numeric control Step 7: Right click on the front panel numeric Tank Step 8: Right click on the Block diagram panel —>comparison—> greater or equal? Step 9: Right click on the Block diagram panel +comparison— less? Step 10: Right click on the Block diagram panel — numeric— Numeric constant (set 8) [twice] Step 11: Using wiring operations required connections are made as given in the block diagram. Step 5: Execute- give inputs in the front panel by rotating knob and observe tank filling and switches ON & OFF. BLOCK DIAGRAM: Fig 11.1 shows the block diagram water level indicator in LabVIEW. A round control knob is used to switch on the motor and off. Numeric indicator display water level in tank. venti fal Knob Tank Water level is More Greater Or Equal? fel] a Less Or Equal? Water level is tess te] Fig. 1.1 block diagram OUTPUT /FRONT PANEL : RESULT: Water level is 8.50911 Water level is More Water level is less Fig 11.2 (a), (b) and (c) shows Motor on with no water and filling and reached upper limit and off. A VI that indicates water level is built. VIVA QUESTIONS: How to create vertical indicators? 1 2. Is it possible to change the settings of LED? 3. Is it possible to implement this using While loop? 4. . Comparator functions are present in which palette? EXPERIMENT 12 CALCULATION OF AREA AND PERIMETER OF CIRCLE AIM: To calculate area and perimeter of a circle. Description: Area of circle = mr? Perimeter/circumference of cirele = 277 r- radius of circle if 10 then indicate to reduce radius. THEORY: The area sl Je an object having two dimensions. Where as, circumference is the parameter which shows the boundary of the object. Area is usually measured in m? and circumfe sured in m according to thei ional (SI) units, In this area and area and circumference calculation of circle i LabVIEW program, which will take radius as an input and calculates the nce of circle, You can also ct the maximum limit of the radius. When the radius approaches its maximum limit an LED will glow showing the notification reduce the radiu PROCEDURE: Step 1: Create blank VI Step 2: Right click on the front panel —+ numeric—> Numeric control Step 3: Right click on the front panel + numeric Numeric indicator [Name Area] Step 4: Right click on the front panel —> numeric—> Numeric indicator [Name Circumference] Step 5: Right click on the front panel + Boolean— Square LED Step 6: Right click on the Block diagram panel —Numeric—> multiply (thrice) Step 7: Right click on the Block diagram panel —structures— while loop Step 8: Right click on the Block diagram panel —-numeric— numeric constant [set value 10] Step 9: Right click on the Block diagram panel —-numeric— numeric constant [set value 2] Step 10: Right click on the Block diagram panel numeric math constants—pi Step 11: Using wiring operations required connections are made as given in the block diagram BLOCK DIAGRAM: Fig 12.1 shows the block diagram of area and circumference of circle in LabVIEW. Area and circumference is calculated using formulas, An upper limit to radius is also kept here. enter the value of radius - r Area of the circle >— pf Square Perimeter _ - = Fig. 12.1 block diargram OUTPUT /FRONT PANEL : enter the value of radius - r Area of the circle a4 50.2655 Perimeter 25.1327 RESULT: VIVA QUESTIONS: 1. What are the units of area and perimeter? 2. Where to select pi function? 3. What is the difference between continuous run and run? 4,How to indicate broken wire in LabVIEW?

You might also like