You are on page 1of 20

PRACTICAL FILE

OF

SOFT COMPUTING

Submitted by: Submitted to: Dr. Avinish Verma Vikas Garg Roll no. 200901010-1003 B.tech 5th sem

I N D E X
S. NO.
1

TITLE To study the LabView Components To study Arithmetic operations Exploring LabVIEW environment by creating a VI that generates a signal and displays it on the front panel To create arrays and become familiar with array functions To create cluster on the front panel and use the cluster functions to assemble and disassemble cluster To observe the use of shift register and feedback nodes to hold the data from previous iterations of a For loop To build VI that uses polymorphism with clusters

SIGN

EXPERIMENT 1
AIM: To study the LabView Components. APPARATUS: LabView Software and PC THEORY:
NUMERIC CONTROL: Use the numeric controls and indicators on the numeric palette to simulate slides, knobs, dials and digital displays. The palette also includes color box and color ramp for setting color values and time stamps for setting time and date values. Use numeric controls and indicators to enter and display numeric data. You can set the representation, data range and format and precision for numeric control and indicators. Numeric control and indicators accepts only certain numeric characters. SLIDES: slide controls and indicators, like rotary controls and indicators, and numeric objects with scale. The slide controls and indicators include vertical and horizontal slides, a tank, and a thermometer. Change the value of a slide control or indicator using either of the following methods: Use the Operation tool to click or drag the slider to a new position. Use the Digital Display to enter data just as you do for digital controls and indicators.

You can ass sliders to have one or more additional sliders. You also can customize the scale of a slide control or indicator. COLOR BOX: A color box is a numeric control or indicator that displays a color that corresponds to a specified value. The color value is expressed as a hexadecimal number with the form RRGGBB. The first two digits control the red value. The second two digits control the green color value. The last two digits control the blue color value. DIAL: Rotary controls and indicators like slide control and indicators are numeric objects with scale. The rotary controls and indicators include knobs, dials, gauges, and meters. Change the value of rotary control or indicator using either of the following methods: Use the Operating tool to click or drag the needle to a new position. Use the digital display to enter data just as you do for digital controls and indicators.

You can add needles to have one or more additional needles. You can also customize the scale or color ramp of a rotary control or indicator. BOOLEAN: use the Boolean controls and indicators located on the Boolean and Classic Boolean palettes to simulate buttons, switches and lights. Use Boolean controls and indicators to enter and display Boolean (TRUE/FALSE) values.

STRING AND FILE PATH CONTROL: use the string and file path controls and indicators on the string and path palette to simulate text entry boxes and labels and to enter or return the location of a file or directory. Path controls and indicators work similarly to strings, but LabView formats the path using the standard syntax for a supported platform, Windows. You can also drag a path from Windows Explorer and place it in the path. Use the combo box control to create a list of strings you can cycle through on the front panel. A combo box control is similar to a text or menu ring control. GRAPHS: Complete the following steps to format the X- and Y-axes of a graph or chart. 1. Right click the axis you want to format and select Formatting from the shortcut menu to display the Format and Precision page of the Properties dialog box. 2. Modify the Format and Precision setting to format the graph or chart. 3. Click the OK button to close the Properties dialog box. RING: Use a ring control to select an item from a list without having to know what value that item represents. LabView passes the value associated with the selected item to the block diagram. Select a case from a case structure (conditional code) that carries out the selected item.

PROCEDURE:
1. 2. 3. 4. 5. Click the Start button on the PC Co to National Instruments > LabVIEW 7.1 Open the LabView by clicking LabVIEW Click on Continue > New Select Blank VI

RESULT: The LabView components have been studied.

COMPONENTS ON FRONT PANEL:

COMPONENTS ON BLOCK DIAGRAM:

EXPERIMENT 2
AIM: To study Arithmetic operations using LabView software. APPARATUS: LabView Software and P.C. THEORY:
Various Mathematical Arithmetic operations of addition, subtraction, multiplication and division can be performed using LabView software. This can be done through block diagrams. Various operators like plus, minus, multiplication, division and other operators are provided to perform arithmetic operations on LabView software. In this experiment we have solved the following equations: (X + Y)2 (X Y)3 (X Y)/(X + Y)

1. (X+Y) A. NUMERIC CONTROL: These control the values of the numbers X and Y. B. NUMERIC INDICATOR: These show the value of the output of the result of the arithmetic operation. C. ADD COMPONENT: This components adds the value of X and Y here. D. MULTIPLY COMPONENT: This component multiply the (X+Y) with (X+Y) 2. (X-Y) A. NUMERIC CONTROL: These control the values of the numbers X and Y. B. NUMERIC INDICATOR These show the value of the output of the result of the arithmetic operation. C. SUB COMPONENT: This components subtracts the value of X and Y here. D. MULTIPLY COMPONENT: This component multiply the (X-Y)^2 with (X-Y)

3. (X-Y)/(X+Y) A. NUMERIC CONTROL: These control the values of the numbers X and Y. B. NUMERIC INDICATOR: These show the value of the output of the result of the arithmetic operation. C. ADD COMPONENT: This components adds the value of X and Y here. D. SUB COMPONENT: This components subtracts the value of X and Y here. E. DIVIDE COMPONENT: This component divides the (X-Y) with (X+Y)

PROCEDURE:
1. 2. 3. 4. Open the LabView. Select the required numeric controls. Go to the block diagram using windows. Select the required operators and make the connections as shown in diagram.

RESULT: - Various Arithmetic Operations of Addition, Subtraction, Multiplication and


Division are performed using algebraic equations successfully.

CIRCUIT DIAGRAM: 1. (X+Y)

Front panel 2. (X-Y)3

block diagram

Front panel 3. (X-Y)/(X+Y)

block diagram

Front panel

block diagram

EXPERIMENT 3
AIM: Exploring LabVIEW environment by creating a VI that generates a signal and displays it on the front panel. COMPONENTS: LabVIEW Software, PC THEORY:
Using LabView waveforms can be generated corresponding to different operations and inputs. On performing Integral operations, different inputs give following outputs: INPUT 1. TRIANGULAR WAVE 2. SQUARE 3. SINE 4. SAWTOOTH OUTPUT SINUSOIDAL TRIANGLE COSINE PARABOLIC PULSE

Here we have given the TRIANGULAR in input and description for the components used here are as follows: 1. SIMULATE SIGNAL: Simulates a sine wave, square wave, triangle wave, sawtooth wave, or noise signal. This is configured here as follows: a. Signal type: Triangle b. Frequency: 10.1 Hz c. Amplitude: 1 d. Phase: 0 e. Offset: 0 f. Duty cycle: 50% g. Sampling rate: 1000 h. Number of samples: 100 (automatic) i. Timing: simulate acquisition timing j. Timestamps: relative 2. SCALING AND MAPPING: Changes the amplitude of a signal by scaling or mapping the signal. This is configured here as follows: a. Scaling type: Linear b. m: 1 c. b: 0

3. TIME DOMAIN MATH: Performs one of several math functions on time domain signals This is configured here as follows: a. Math operation: integral b. Calculation mode: continuous calculation 4. MERGE SIGNALS Merges two or more signals into a single output. Resize the function to add inputs. This function appears on the block diagram automatically when you wire a signal output to the wire branch of another signal. 5. WAVEFORM GRAPH Shows the graph of the output and the scaled input.

PROCEDURE:
1. Launch LabView. 2. Click new button. 3. Select VI button from Template >> Tutorial (Getting started) >> Generate and display in the create new list. 4. Go to block diagram via windows. 5. Open control palette. 6. Select simulate signal, Knob, scaling and mapping tool, waveform graph. 7. Make the connections as shown in fig. 8. Run the program.

RESULT:
The waveform has been generated and following results are obtained: On applying Triangular wave as input a sinusoidal output is obtained.

CIRCUIT DIAGRAM:

BLOCK DIAGRAM:

EXPERIMENT 4
AIM: To create arrays and become familiar with array functions. COMPONENTS: LABVIEW software, PC THEORY:
In this experiment ten numbers are generated randomly by computer and are sorted in the random array. They will be multiplied by a user defined scaling factor and are stored in Final array. Then user will define the starting position from where elements are to be extracted and number of elements to be extracted by using array subset function. The selected elements will store in the subset array. The components used here are described as follows: 1. FOR LOOP: Executes its subdiagram n times, where n is the value wired to the count (N) terminal. The iteration (I) terminal provides the current loop iteration count, which ranges from 0 to n-1. 2. RANDOM NUMBER: Produces a double-precision, floating-point number between 0 and 1, exclusively. The distribution is uniform. 3. MULTIPLY: Returns the product of the inputs. 4. ARRAY: Arrays group data elements of the same type. An array consists of elements and dimensions. Elements are the data that make up the array. A dimension is 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.

PROCEDURE:
1. Open a blank VI in LabView. 2. Make three arrays one by one from Controls >> All controls >> Array and Cluster palette. 3. Place numeric indicators inside arrays from Control >> Numeric control palette. 4. Position array shells such that ten numeric indicators appear in each array shell. 5. Place three numeric controls from Control >> Numeric Control palette and label them scaling factor, start subset, # of elements. 6. Make start subset and # of elements long type variables. 7. Go to block diagram. 8. Place random number function and multiply operation from Functions >> Arithmetic & Comparison >> Express Numeric Palette. 9. Place random number function in the FOR loop from Functions >> All functions >> Structures palette. 10. Place array subset function from Functions >> All functions >> Array palette. 11. Make the connections in Block Diagram as shown in Fig.

RESULT: An array of desired number of elements has been generated.

CIRCUIT DIAGRAM:

BLOCK DIAGRAM:

EXPERIMENT-5
AIM: To create cluster on the front panel and use the cluster functions to assemble and disassemble cluster. COMPONENTS: LAB view software, pc. THEORY: On running the program the numeric value in cluster will be incremented and
appear in numeric indicator of modified cluster. The value in numeric of cluster will appear on numeric outside the clusters. The value on slide cluster will appear on the slide value. Bolean2 in modified cluster is not of Boolean 2 in cluster. Bolean3 will glow led. The descriptions of the components used are as follows: 1. UNBUNDLE BY NAME: Returns the cluster elements whose names you specify. You do not have to keep track of the order of the elements within the cluster. This function does not require the number of elements to match the number in the cluster. After you wire a cluster to this function, you can select an individual element from the function. 2. UNBUNDLE: Splits a cluster into each of its individual elements. When you wire a cluster to this function, the function resizes automatically to display outputs for each element in the cluster you wired. This function produces as an output these elements in the same order they appear in the cluster. The number of outputs for this function must match the number of elements in the cluster. When you have two or more elements of the same type, keep track of their order in the cluster. If you access the wrong element by mistake, LabVIEW does not report this as an error. 3. BUNDLE: Assembles a cluster from individual elements. You also can use this function to change the values of individual elements in an existing cluster without having to specify new values for all elements. Resize this function to indicate the number of elements in the cluster. You cannot resize this function when a cluster is wired to the cluster input. When you create a new cluster, you must wire all inputs. The elements in the output cluster must appear in the same order as the input elements. When you replace a cluster wired to the middle terminal of this function, the inputs are optional. LabVIEW replaces only those you wire in the cluster. 4. BUNDLE BY NAME: Replaces one or more cluster elements. This function refers to cluster elements by name instead of by their position in the cluster. 5. NOT: Computes the logical negation of the input. If X is FALSE, the function returns TRUE. If X is TRUE, the function returns FALSE. 6. INCREMENT: Adds 1 to the input value 7. CLUSTER: Clusters group data elements of mixed types, such as a bundle of wires in a telephone cable, where each wire in the cable represents a different element of the cluster.

PROCEDURE:
1. 2. 3. 4. 5. 6. 7. 8. 9. Place a stop button from Controls >> Buttons & Switches palette. A numeric Indicator from Controls >> Numeric Indicators palette. Round LED from Controls >> LED palette. Place a cluster from Controls >> All controls >> Array & Cluster palette. Place a numeric control in cluster. Two vertical toggle Switches from Controls >> Numeric control palette in cluster. Duplicate this cluster and name it as Modified Cluster and change it to indicator. In block Diagram make the connection as shown in fig. Use unbundle, bundle, Unbundle by name, bundle by name from Functions >> all functions >> Cluster palette. 10. Use Increment, Not from Functions >> All Functions >> Numeric palette. 11. Place the whole connection in while loop from Functions >> All Functions >> Structures. 12. Run the Program.

RESULT:
Use of Clusters is understood.

CIRCUIT DIAGRAM:

BLOCK DIAGRAM:

EXPERIMENT-6
Aim: To observe the use of shift register and feedback nodes to hold data from previous
iteration of a for loop.

Apparatus: LabView software, pc Procedure:


1. Take necessary components in front panel and make the necessary connections in block diagram as shown in figure. The 1 wired to left terminal on the For loop initialize the feedback node to 1. 2. The wait until next ms timr shows the operation of the code. You also see highlight execution instead of the wait function to slow the operation. Yhe same code is used twice in block diagram with feedback node in a different portion of the wire. 3. Run the VI The top section of code reads the initialized feedback node and passes this value to multiply function. The bottom section of the code reads the initialized feedback node and passes this value to indicator. This multiply function does not execute until iteration of loop lighting. 4. Click the highlight execution button, show at left, to enable execution highlighting. Run the VI again to observe the order of execution. Turn off execution highlighting when you understand the execution order. The VI continues executing at normal speed. 5. Replace the bottom feedback node with a shift register, as shown in the following block diagram. A. Select the bottom feedback node and press the <delete> key to delete it. B. Right- click the order of the For loop and select ADD shift register. C. Initialize the shift register by wiring 1 to the left shift register. D. Changes the label of the bottom indicator to shift register and the top indicator to feedback node. 6. Run the VI. Notice that both the feedback node and the shift register portions of the block diagram have the some functionality. 7. If time permits, complete the following the operation step. Otherwise close the VI and do not save changes. Result: The desired result has been achieved.

CIRCUIT DIAGRAM:

BLOCK DIAGRAM:

EXPERIMENT-7
AIM: To build VI that uses polymorphism with clusters. COMPONENTS: LabView Software and P.C. THEORY: On running the program the values in the raw data will be multiplied through the
values of Scaling factors. Correspondingly these values will change the readings on thermometer, Tank and gauge as these are the indicators of the result.

PROCEDURE:
1. 2. 3. 4. 5. 6. In the front panel create a cluster having three numeric controls in it. Rename these controls as V (temperature), V (flow rate), and V (pressure). Go to Block diagram. Select cluster constant from Functions >> All Functions >> Clusters. Rename it as scaled factors. Place Numeric constant inside Cluster constant from Functions >> Arithmetic & Numeric >> Numeric palette. 7. Enter the scaling factor inside these constants. 8. Multiply scaled factors with raw data. 9. Create indicator from multiply function by right clicking it. 10. Rename the Output Cluster as Scaled Data 11. Go to front panel. 12. Replace numeric indicators in scaled data with Thermometer, Tank and Gauge. 13. View three digital displays. 14. Run the Program

RESULT:
The study of clusters is understood.

CIRCUIT DIAGRAM:

BLOCK DIAGRAM: