Vous êtes sur la page 1sur 44

SOFT COMPUTING LAB MANUAL

INDEX
PRACTICAL DETAILS Exp No. 1. 2. 3. 4. 5. 6. Experiment Name To analyse any alternating wave with noise. To perform conditional operations using Case Structure. To interface MATLAB program with LABVIEW. To study second order system using transfer function model. To create and call a SubVI program of a main program using lab view. To convert Sinusoidal Pattern (or any other wave pattern) into Dynamic data type. a) To generate random numbers (0-1) and hence create one-Dimensional array and multi-Dimensional array from it. b) Array Manipulation. To build a Shift Register. To analyse second order system by varying damping ratio and natural frequency. Generation of different patterns of LEDs like ramp, Alternating 1/0s walking 1s etc on Elvis workstation manually Measurement of Electrical Components Using Elvis and see their characteristics. Date of Performance Date of Checking Signature Marks (10)

7.

8. 9.

10.

11.

EXPERIMENT NO. 1
AIM:
To analyze any alternating wave with noise.

THEORY:
LabVIEW is a program development application, much like various commercial C/C++, FORTRAN or BASIC development systems. However, LabVIEW uses graphical programming language, G, to create programs allowing the program to be in a "Block Diagram" form. The programs written in LabVIEW are called "Virtual Instruments" or VIs due to the instrumentation-related origin . The programs created are independent of the type of machine that they are created for so programs can be transferred between different operating systems. Additionally LabVIEW has a large set of built-in mathematical functions and graphical data visualization and data input objects typically found in data acquisition and analysis applications. Simulate signal It simulates a sine wave, square wave, triangle wave, sawtooth wave, or noise signal. Dialog Box Options used Parameter Description Signal Contains the following options:

Signal typeType of waveform to simulate. You can simulate a sine wave, square wave, sawtooth wave, triangle wave, or noise (DC). Frequency (Hz)Frequency in Hertz of the waveform. The default is 10.1. Phase (deg)Initial phase in degrees of the waveform. The default is 0. AmplitudeAmplitude of the waveform. The default is 1. OffsetDC offset of the signal. The default is 0. Duty cycle (%)Percentage of time a square wave remains high versus low over one period. The default is 50. Add noiseAdds noise to the simulated waveform. Noise typeSpecifies the type of noise to add to the waveform. The following noise types: o Uniform White Noise generates a signal that contains a uniformly distributed, pseudorandom pattern whose values are in the range [-a:a], where a is the absolute value of Amplitude. o Gaussian White Noise generates a signal that contains a Gaussian-distributed, pseudorandom pattern whose statistical profile is (,sigma) = (0,s), where s is the absolute value of the specified Standard deviation.

Periodic Random Noise generates a signal that contains periodic random noise (PRN). o Gamma Noise, Poisson Noise, Binomial Noise, Bernoulli Noise, MLS Sequence, Inverse F Noise. Noise amplitudeMaximum absolute value the signal can have. The default is 0.6. This option is available only when you select Uniform White Noise or Inverse F Noise.
o

Standard deviationStandard deviation of the noise you generate. The default is 0.6. This option is available only when you select Gaussian White Noise from the Noise type pull-down menu.

Contains the following options: Signal Name


Use signal type nameUses the default signal name. Signal nameDisplays the default signal name when you place a checkmark in the Use signal type name checkbox.

Block Diagram Inputs used Parameter Reset Signal Description Specifies when to reset the signal. Specifies the percentage of time a square wave remains high versus low Duty Cycle (%) over one period. The default is 50. Offset Specifies the DC offset of the signal. The default is 0. Frequency Specifies the frequency in Hertz of the waveform. The default is 10.1. Amplitude Specifies the amplitude of the signal. The default is 1 Phase Specifies the initial phase in degrees of the signal. The default is 0. Specifies the maximum absolute value the signal can have. The default is Noise amplitude 0.6. Standard Specifies the standard deviation of the noise you generate. The default is deviation 0.6.

PROCEDURE:
LABVIEW was launched. For loop was created Programming Structures For loop On the top left corner of the For loop, constant was created. Simulate signal was created inside the For loop. Express signal analysis simulate signal

Double click on it and it was configured to have a Signal Type of Sine. The Add noise box was checked and Uniform White Noise was chosen for the Noise type. Wire the amplitude, frequency (Hz), noise amplitude terminals to corresponding inputs of the Simulate Signal On simulate signal, right click on sine with uniform noise and create graph indicator was selected. Filter was created. At output terminal, Graph indicator was created. Express signal analysis filter. The filtered signal was applied to the FFT Programming waveform analog waveform measurements spectral measurements Now, statistics was created. On double clicking, Arithmetic mean, median, rms was selected. Express signal analysis statistics. For output of statistics, numeric indicator was created. On the front panel, control type for frequency, phase, noise amplitude can changed by right clicking on it and Replace was selected.

EXAMPLE: BLOCK DIAGRAM

RESULT:- FRONT PANEL

EXPERIMENT NO. 2
AIM:
To perform conditional operations using Case Structure.

THEORY:
Common structure encountered in LabVIEW is the case structure. Like in text-based languages, the case structure executes a block of code based on the value of a certain variable. In LabVIEW, a case selector located on the case structure is wired to a data source. The value fed into the case selector determines what case executes. Only one case is shown at a time, but the visible case can be cycled by clicking on the arrows to the left or the right of the case name. Case Structure Data Types The data type wired to the selector terminal can be numeric, Boolean, or string. By default, Case Structures are set to Boolean but automatically adapt to the data type wired to the selector terminal. Below are examples of three Case Structures with the three different data types wired to to the selector terminal. The cases have been separated in this image to better show their structure. A few things to remember about Case Structures and their data types:

If the data type is Boolean, the structure can only have two cases: True or False. If the data type is numeric or string, the structure can have up to 231 - 1 cases. If the data type is numeric or string, the top or first case will have "default" in the menu at the top of the Case Structure. If the data type is numeric, use integer values. All floating-point numbers are converted to integers and negative numbers are converted to zero. If the data type is string, the data values must be in quotes. Each case must have a subdiagram of some kind. If any case outputs data, all cases must output data through the output tunnel.

There is a Boolean Control applied to the selector terminal, so the Case Structure is the Boolean data type. When the Boolan control on the Front Panel is in the up position, it returns a FALSE to the selector terminal which invokes the subtract case. When the Boolean control is put in the down position, it returns a TRUE value to the selector terminal which invokes the add case.

PROCEDURE:
Lab view was launched. Go to Programming Structures Case Structure. Drag an area for the Case Structure to encompass. On the left side, [?] was right clicked and Create Constant was selected. For the true value, Multiply was chosen. Express Arithmetic & Comparison Numeric Multiply Control was taken outside the case structure so as to have common inputs for False condition also. The false was selected in the block diagram and the procedure was repeated for divide.

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL


For FALSE

For TRUE

EXPERIMENT NO. 3
AIM:
To interface MATLAB program with LABVIEW

THEORY:
LabVIEW MathScript adds math-oriented, textual programming to LabVIEW. MathScript joins graphical programming as another means to define the custom software you develop using LabVIEW. Working with LabVIEW, we can choose a textual approach, a graphical approach, or a combination of the two. We can choose the most effective syntax for technical computing, whether we are developing algorithms, exploring signal processing concepts, or analyzing results. The MathScript Node and the LabVIEW MathScript Window can communicate only if they are in the same application instance. To execute Lab VIEW Math Scripts we can use the Math Script Node to evaluate scripts that we create in the Lab VIEW Math Script Window. The Lab VIEW Math Script syntax is similar to the MATLAB language syntax.

Use this node to execute scripts. Enter the script in the node or right-click the node border to import text into the node. Right-click the node border to add input and output variables. Right-click an output variable to set its data type. When we create a Lab VIEW Math Script, we must use supported data types.

PROCEDURE:
Lab view was launched. Go to mathematics->script and formulae->math script MATLAB program was written inside math script Output and inputs variables were given according to the program. The program was run to have result on control panel.

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL

EXPERIMENT NO. 4
AIM:
To study second order system using transfer function model.

THEORY:
A second order control system is one wherein the highest power of s in the denominator of its transfer function is 2. A general expression for the transfer function of a second order control system is given by

The block diagram representation is given by

Bode plot is the representation of the magnitude and phase of G(j*w) (where the frequency vector w contains only positive frequencies). Nyquist plot is used in automatic control and signal processing for assessing the stability of a system with feedback. It is represented by a graph in polar coordinates in which the gain and phase of a frequency response are plotted. The step response of a system in a given initial state consists of the time evolution of its outputs when its control inputs are Heaviside step functions. In electronic engineering and control theory, step response is the time behaviour of the outputs of a general system when its inputs change from zero to one in a very short time. The impulse response of a system is its output when presented with a very brief input signal, an impulse. Mathematically, an impulse can be modeled as a Dirac delta function for continuous-time systems, or as the Kronecker delta for discrete-time systems.

PROCEDURE:
Lab view was launched. In Block diagram window, control design and simulation function was selected and get a transfer function from the Model Construction Sub-Palette. Control Design and Simulation Control Design Model Construction CD Construct Transfer Function On this transfer function, select Single-Input, Single-Output (Symbolic). Now numerator and denominator values were given. Obtain the step response, bode plot (both magnitude and phase), impulse response and nyquist response on suitable scopes. Control Design and Simulation Control Design Dynamics Characteristics CD Root Locus. Control Design and Simulation Control Design Frequency CD Bode. Control Design and Simulation Control Design Frequency CD Nyquist Control Design and Simulation Control Time Response CD Step Response.

The stability of the system was checked by connecting stability block to the output of model.

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL

EXPERIMENT NO. 5
AIM:
To create and call a SubVI program of a main program using lab view.

THEORY:
SubVIs are an important introductory concept in LabView. A VI is a "Virtual Instrument" which is just the basic labview program, contained in a .VI file, which is represented by a front panel and block diagram. However, every VI can also be a SubVI. The third component of a VI consists of its icon and connector pane. These two pieces make every VI capable of becoming a SubVI. After building a VI front panel and block diagram, one needs to build the icon and the connector pane so that this VI could be used as a sub-VI. Every VI displays an icon, in the upper right corner of the front panel and block diagram windows. An icon is a graphical representation of a VI. It can contain text, images, or a combination of both. If one uses a VI as a sub-VI, the icon identifies the sub-VI on the block diagram of the VI. A connector pane is build up to use the VI as a sub-VI. The connector pane is a set of terminals that correspond to the controls and indicators of that VI, similar to the parameter list of a function-call in text-based programming languages. The connector pane defines the inputs and outputs one can wire to the VI so that it could be used as a sub-VI. A connector pane receives data at its input terminals and passes the data to the block diagram code through the front panel controls and receives the results at its output terminals from the front panel indicators. When the connector pane is viewed for the first time, one can see a connector pattern. A different pattern could be selected if necessary. The connector pane generally has one terminal for each control or indicator on the front panel. Upto 28 terminals could be assigned to a connector pane. If any changes are anticipated to the VI that would require a new input or output, one can leave extra terminals unassigned. After building a VI and creating its icon and connector pane, one can use it as a sub-VI. One can save VIs as individual files, or group several VIs together and save them in a VI library. One can customize the appearance and behavior of a VI and also create custom menus for every VI that is built.

PROCEDURE:
Open any main program . Select any desired portion of it for creating SUB-VI using it. Then edit-> create subVI. On Block Diagram window double-click the icon editor(on the top right corner) to customize or edit it using the available tools. On the front panel window click the Icon and select Show Connector. Pattern can be changed according to input and output by selecting patterns. Associate the pattern terminals with the respective inputs and outputs. Save as the program with another name say SUB-VI.(SUB-VI of main program)

How to call SUB-VI Go to new file. On block diagram right click and select sub VI. Give input and outputs by create control and do further operations.

EXAMPLE: BLOCK DIAGRAM

RESULT: BLOCK DIAGRAM

FRONT PANEL

EXPERIMENT NO. 6
AIM:
To convert Sinusoidal Pattern (or any other wave pattern) into Dynamic data type.

THEORY:
The numeric, Boolean, waveform and array data types can be converted to the dynamic data type for use with Express VIs. Parameter Description Contains the following options:

Conversion

Input data typeSpecifies the data type that you want to convert to the dynamic data type. Floating point numbers (double)Specifies that numeric values are double-precision, floating-point numbers. Boolean (TRUE and FALSE)Specifies that numeric values are Boolean values.

Inputs

Displays the input signal. If you wire data to the Express VI and run it, Inputs displays real data. If you close and reopen the Express VI, Inputs displays sample data until you run the VI again. Displays a preview of the measurement. The Results Preview plot indicates the value of the selected measurement with a dotted line. If you wire data to the Express VI and run the VI, Results Preview displays real data. If you close and reopen the Express VI, Results Preview displays sample data until you run the VI again. If the cutoff frequency values are invalid, Results Preview does not display valid data. Contains the following options:

Results Preview

Start Time

ZeroSets the t0 of the input signal to zero. NowSets the t0 of the input signal to the current system time.

Block Diagram Inputs

Parameter Description Contains the input waveform or array of numbers or Boolean values. You also can configure the Convert to Dynamic Data Express VI to accept the following outputs:

Array

2D ArrayContains the input signal formatted as a 2D array of numbers. WaveformContains the input signal formatted as a waveform. Array of WaveformsContains the input signal formatted as a 2D array of waveforms. DoubleContains the input signal formatted as a double-precision, floating-point number. BooleanContains the input signal formatted as a single Boolean value.

Block Diagram Outputs Parameter Description

Dynamic Data Type Returns a dynamic data type with the values you entered in the Array input. Samples: It is the no. of samples of the sinusoidal pattern. Samples must be greater tan or equal to zero and by default it is 128.Generates an array containing a sinusoidal pattern.

PROCEDURE:
Labview was launched. On Block Diagram window go to SignalProcessing Signal generation Sine Pattern Samples, Amplitude, Phase and cycles were given as inputs to sine pattern. An indicator was created at the output of the sine pattern. To convert sine pattern into dynamic data on block diagram window go to Express Signal manipulation To DDT An indicator was created at DDT to see the results on front panel.

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL

EXPERIMENT NO. 7
AIM:
a) To generate random numbers (0-1) and hence create one-Dimensional array and multiDimensional array from it. b) Array Manipulation.

THEORY:
In computer science an array is a data structure consisting of a group of elements that are accessed by indexing. In most programming languages each element has the same data type and the array occupies a contiguous area of storage. 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 230 elements per dimension, memory permitting. One can build arrays of numeric, Boolean, string, waveform, and cluster data types. One should consider using arrays when working with a collection of similar data or when one performs repetitive computations. Arrays are ideal for storing data collected from waveforms or data generated in loops, where each iterations of a loop produces one element of the array. One cannot create arrays of arrays. However, one can use a multidimensional array or create an array of clusters, where each cluster contains one or more arrays. To create a multidimensional array on the front panel, one would right-click the index display and select Add Dimension from the shortcut menu. One also can resize the index display until one has as many dimensions as needed. To delete dimensions one at a time, the user would right-click the index display and select Remove Dimension from the shortcut menu. One also can resize the index display to delete dimensions. To display a particular element on the front panel, the user can either type the index number in the index display or use the arrows on the index display to navigate to that number. Array functions can be used to create and manipulate arrays, such as in the following tasks: Extract individual data elements from an array. Insert, delete, or replace data elements in an array. Split arrays.

PROCEDURE:
Lab View was launched. On Front Panel go to functions Mathematics Numeric Select Random No. An indicator was created to display random no. For loop was used to generate more numbers. Programming Structures For loop To generate an array an indicator was created outside the loop and do further manipulation on it (like addition, multiplication etc) To generate a two-Dimensional array take double loop (another For loop outside the above For loop) and create an indicator to display it. Further manipulation was done on it. Delay was added to see how numbers has been generated. Programming Timing Wait (ms)

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL

EXPERIMENT NO. 8
AIM:
To build a Shift Register.

THEORY:
Shift Register is a Optional mechanism in loop structures to pass the value of a variable from one iteration of a loop to a subsequent iteration. Use shift registers on For Loops and While Loops to transfer values from one loop iteration to the next. A shift register appears as a pair of terminals, directly opposite each other on the vertical sides of the loop border. The right terminal contains an up arrow and stores data on the completion of an iteration. LabVIEW transfers the data connected to the right side of the register to the next iteration. Create a shift register by right-clicking the left or right border of a loop and selecting Add Shift Register from the shortcut menu. 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. To initialize a shift register, wire any value from outside the loop to the left terminal. If you do not initialize the shift register, the loop uses the value written to the shift register when the loop last executed or the default value for the data type if the loop has never executed. Use a loop with an uninitialized shift register to run a VI repeatedly so that each time the VI runs, the initial output of the shift register is the last value from the previous execution. Use an uninitialized shift register to preserve state information between subsequent executions of a VI. After the loop executes, the last value stored in the shift register remains at the right terminal. If you wire the right terminal outside the loop, the wire transfers the last value stored in the shift register. We can add more than one shift register to a loop. If you have multiple operations within a loop, use multiple shift registers to store the data values from those different processes in the structure.

PROCEDURE:
Lab view was launched. While loop was created on a Block diagram window by using (Programming Structure While Loop) Go to Express Airth & Compar Numeric Select a Adder An indicator was created at the output terminal of adder. Now right click on the loop and add a shift register to it. Output of the adder is wired to the shift register. A constant at one input terminal of adder was created and other terminal was connected to the shift register. Create a constant outside the loop and add it to shift register. The delay was introduced in the loop. (Programming Timing Delay.)

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL

EXPERIMENT NO. 9
AIM:
To analyze second order system by varying damping ratio and natural frequency.

THEORY:
A second order control system is one wherein the highest power of s in the denominator of its transfer function is 2. A general expression for the transfer function of a second order control system is given by

where wn is the natural frequency and z is the damping ratio. Gain is the transfer function or pole-zero gain of the system model you want to build. The default is 1. Damping Ratio specifies the damping ratio, which reflects the damping level as a fraction of the critical damping value where the poles become real, of the second-order transfer function model. The default is zero. Natural Frequency (rad/s) specifies the natural frequency, in radians/seconds, of the second-order transfer function model. The default is zero. The block diagram representation is given by

PROCEDURE:
Lab view was launched. In Block diagram window, control design and simulation function was selected. Go to model construction Special transfer function model Change the block to second order system. Control for the inputs of second order systems and indicators were created to show the desired outputs like pole-zero plot, bode-plot etc as shown in block diagram.

EXAMPLE: BLOCK DIAGRAM

RESULT: FRONT PANEL

EXPERIMENT NO. 10
AIM:
Measurement of Electrical Components Using Elvis and see their characteristics.

THEORY:
The National Instruments Educational Laboratory Virtual Instrumentation Suite (NI ELVIS) Based on National Instruments LabVIEW software features 12 integrated instruments that are completely customizable using LabVIEW including an oscilloscope, a digital multimeter, a power supply, and a function generator.

One note is that the measurement ranges of these instruments are based on the DAQ board, with the exception of the built-in Variable Power Supply and Function Generator. Therefore, the NI ELVIS Oscilloscope has a max sampling rate of 500kS/sec/channel; the NI ELVIS DMM has a max voltage range of 20VDC. DMM Both the CURRENT and VOLTAGE inputs are available on the prototyping board along with an additional terminal for three-wire transistor measurements. The differential voltmeter inputs are labeled VOLTAGE HI and VOLTAGE LO. The rest of the functionality of the DMM is available through the CURRENT HI and CURRENT LO pins. The 3-WIRE pin is used for three-terminal device measurements in conjunction with the CURRENT HI and CURRENT LO pins.

DMM Connectors Caution- By connecting different signals to both the DMM terminals on the prototyping board and the DMM connectors on the control panel, you are shorting them together, potentially damaging the circuit on the prototyping board. CURRENT Banana Jacks HIThe positive input to all the DMM functionality, except measuring voltage. LOThe negative input to all the DMM functionality, except measuring voltage. VOLTAGE Banana Jacks HIThe positive input for voltage measurements. LOThe negative input for voltage measurements. Oscilloscope (Scope) Connectors Caution- By connecting different signals to the Scope terminals on the prototyping board and the Scope connectors on the control panel, you are shorting them together, potentially damaging the circuit on the prototyping board. CH A BNC ConnectorThe input for channel A of the Oscilloscope. CH B BNC ConnectorThe input for channel B of the Oscilloscope. Trigger BNC ConnectorThe input to the trigger of the Oscilloscope.

PROCEDURE:
Measurement of component value Two banana type leads was connected to the DMM current inputs on the workstation front Panel. The other ends were connected to one of the resistors (or Capacitor). NI ELVIS was launched. After initializing the suite of lab view software instruments pops up on the computer screen. Digital multimeter can be used for a variety of operations. Click on the ohm button to use the Digital Ohmmeter or capacitor button to use Digital capacitor meter etc. Note: for Electrolytic capacitor be sure to connect the positive lead of the capacitor to DMM current + input & click on the Electrolytic button of the DMM(C)

DIGITAL MULTIMETER
Voltage Measurement Current Measurement Resistance Measurement Capacitance Measurement Inductance Measurement Diode Measurement (Resistance measurement)

Capacitance Measurement Characteristics of components 1. Resistor 2. Diode 3. Transistor 4. Thyristor Procedure : To see the characteristics of two terminal devices connect the device to current HI & current LO of DMM and for three terminal

devices connect to 3wire, current HI & current LO of workstation of ELVIS.

RESISTOR CHARACTERISTICS

DIODE CHARACTERISTICS

Current range ........ 10 mA Voltage sweep range...10 V

TRANSISTOR CHARACTERISTICS

Minimum base current increment...15 Maximum collector current ............10 mA Maximum collector voltage............10 V

EXPERIMENT NO. 11
AIM:
Generation of different patterns of LEDs like ramp, Alternating 1/0s, walking 1s etc on Elvis workstation manually

THEORY:
NI ELVIS Prototyping Board The NI ELVIS Prototyping Board connects to the benchtop workstation. The prototyping board provides an area for building electronic circuitry and allows the connections necessary to access signals for common applications. We can use multiple prototyping boards interchangeably with the NI ELVIS Benchtop Workstation.

Connecting Digital I/O Signals This section describes how to connect the DIO signals on the prototyping board. The DIO circuitries of the NI ELVIS consists of an 8-bit read and write bus, four control signals and a 4-bit address bus. The DO <0..7> signals are the digital outputs of digital circuitry. The DI <0..7> signals are the inputs to the digital circuitry. The four control lines, WR_ENABLE, LATCH, GLB_RESET, and RD_ENABLE are all active-low signals. While data is being written to the write bus, WR_ENABLE goes low. While data is being read from the read bus, RD_ENABLE goes low. When data is ready on the write bus, LATCH pulses. GLB_RESET is connected to the internal reset line, so the NI ELVIS internal circuitry can reset the digital circuitry built on the prototyping board.

Prototyping Board Power The prototyping board provides access to a 15 V and a +5 V power supply. We can use these voltage rails to construct many common circuits.

PROCEDURE:
NIELVIS was launched. Supply was given to ELVIS. Digital I/O (DO 0-DO 7) was connected to LED 0 to LED 7 of prototype board with connecting wires. After initializing the suite of lab view software instruments pops up on the computer screen. From suite digital writer option was selected. The desired pattern was selected and write button was clicked on to see the LED pattern on ELVIS. Even the position of LED can be changed manually by using Manual Pattern option.

RESULT:

Vous aimerez peut-être aussi