# King fahd university of petroleum & minerals college of computer sciences & engineering

 Page 1/7 Date conversion 13.06.2017 Size 184.48 Kb.
K

KING FAHD UNIVERSITY OF PETROLEUM & MINERALS

COLLEGE OF COMPUTER SCIENCES & ENGINEERING

Department of Systems Engineering

### MODELLING AND SIMULATION

LAB MANUAL

Term 061

ING FAHD UNIVERSITY OF PETROLEUM & MINERALS

Systems Engineering Department

SE 207 MODELLING AND SIMULATION

## Laboratory Objective

Emphasize the practical aspects of the course and enable each student to:

• Comdyna GP6 analog computers

• To simulate and observe behavior of first and second order systems.

MODELLING AND SIMULATION 1

Laboratory Objective 2

EXPERIMENT #1: Introduction to Analog Computers 4

Review of Solutions of Linear Ordinary Differential Equations 11

EXPERIMENT # 2: Basic Operations of the Analog Computer 13

EXPERIMENT # 3: Analog Simulation of a First Order System (RC Circuit) 16

EXPERIMENT # 4: Analog Simulation of a Second Order Mass-Spring Mechanical System 18

Experiment #5: Function Generation Using the Analog Computer 20

Experiment #6: Analog Simulation of a System of Coupled Masses 22

Experiment 7 : Introduction to Digital Computer Simulation (MATLAB & SIMULINK) 24

Experiment 8: MATLAB m-files and their use in system simulation. 31

Experiment # 9: Simulation of systems having relative displacements with other moving body 34

Experiment # 10: Simulation of systems represented by state variable model 36

Introduction 38

Part 1: 38

Part 2: 38

Part 3: 38

## EXPERIMENT #1: Introduction to Analog Computers

Objective: Introduction to Analog Computers and its operation
Introduction
The analog computers were the first computer devices invented. They were heavily used during the Second World War to predict the trajectories of bombs and shells and to solve stiff differential equations. They are still used today in instrumentation, A/D-D/A converters, navigation systems and other areas where they offer advantages over the digital computer. An analog computer is nothing but an electric circuit that is configured to mimic the behavior of a differential equation. The computer solves the problem by solving a corresponding problem patched on the computer. Most general purpose analog computers use an active electrical circuit as the analogous system because it has no moving parts, a high speed of operation, good accuracy, and a high degree of versatility. Active electrical networks consisting of resistors, capacitors, and operational amplifiers (OP amps) connected together are capable of simulating any linear system since the forward voltage transfer characteristics of these networks are analogous to the basic linear mathematical operations that are applied in the system’s model. Also, by using diode function generators and special circuits which have nonlinear voltage transfer characteristics, it is possible to simulate nonlinear systems. The mathematical model of an analog computer programmed to simulate a specific system is identical to the mathematical model of the system. The voltage transfer characteristics of the electrical networks are analogous to the desired mathematical operations. The input and output voltages (computer variables) are equivalent to the corresponding mathematical variables (problem variables) of the problem. Because of limitations of the computer or its associated input/output equipment, it is usually necessary to change the scale of the computer variables, thus forcing the values of a computer variable to differ from the corresponding problem variable values. It is important to understand that an analog computer solution is simply a voltage waveform whose time dependency is the same as that of the desired variable.
The normal procedure for simulating a system starts with determining the mathematical model describing the physical quantities of interest. An analog block diagram is made to relate the sequence of mathematical operations and to aid in scaling the variables. From the analog block diagram, the electrical components are connected together (patched). The computer is operated and the computer variables observed on a recorder or oscilloscope. Since the output is a computer variable (voltage waveform) it is necessary to convert the output variable back to the original problem variable.

The COMDYNA, GP-6 Analog Computer

In this laboratory course, we will be using the COMDYNA, GP-6 Analog computers that are available in the Systems Engineering Department. The GP-6 is a general purpose analog computer. It contains linear and .nonlinear components. The linear part contains panels for summers, integrators, inverters and attenuators; while the nonlinear part contains multipliers, square-root generators and other components. The GP-6 has a linear range of +10 to -10 volts shown as +1 to -1 unit on the display panel.

The GP-6 offers hands-on analog experiments to introduce the concepts of systems, mathematical modeling and simulation, the application of and programming of linear circuit device; Instrumentation/ Control circuitry and scaling of measured and control variables. Each GP-6 can simulate mathematical models of up to four, state variables. The following are some of the important features of the GP-6
Internal Components

1. Operational Amplifiers

2. Summer Resistor Network

3. Inverter Networks

4. Electronic Switch Networks

5. Integrator Capacitor sets

6. Coefficient potentiometers

7. Multipliers/divider Boards

Patch Panel
The traditional analog computer patch panel is the only means to program linear circuit devices. The GP-6 color coded panel is large and readily understood. Analog programming symbols clearly indicate the active devices and associated networks. Internal summing resistors, integrating capacitors, and active auxiliary circuits reduce patching connections without sacrificing flexibility. Standard banana jacks and plugs allow easy connection of external accessories, amplifiers, readout instrumentation, etc.
Interconnections
The GP-6 directly interconnects with all forms of analog, analog/digital and digital/analog instrumentation. Front panel banana jacks on the standard 3/4 inch spacing encourage patch cord connections as inputs and outputs.
The system positive/negative volts offers a precision reference available for external transducers, position potentiometers, etc.
Extras
Many extras aid operator convenience and laboratory usability. Extras include: time scales per integrator, time base ramp, compute-time readout, slavability.
Let us look more closely at the patch panel of the GP-6 and describe the function of each button and knob. A typical GP-6 has the following:

Control Switches
IC: Initial condition mode (push button type); is used to set the output of the integrators to the required initial condition.

Hd: Hold mode (push button type); is used to hold the variables to their current values.

Op: Operate mode (push button type); is used to start the operation of the analog computer (integrators).

RQ: Repetitive mode (push button type); is used to periodically set the mode into IC and OP. Coefficient Potentiometers l-8) (Rotary type); used to divide voltages for analog operation.

Y/Pot address (Rotary type); used to set the potentiometer attenuation and to read the potentiometer voltage in the OP mode.

X address (Rotary type); used to read and plot the Op amp. outputs.

Mode selector (Rotary type); used to read potentiometer voltage, OP amp. output or external voltage.

Compute time (Rotary type); used to generate ramp signals for the x-axis of the plotter. It contains the power switch.

Overload Indicator used to indicate over voltage when an amplifier output exceeds 10.5 volts. It lights to indicate this, and will remain lit until the cause of the over voltage is removed.
MODES OF OPERATION
Manual operation: Press the push buttons IC for initial condition, Hd for holding the solution and OP to start a solution.
Repetitive operation: (RO): In this mode, the timer of the analog computer produces repetitive control signal that repetitively sets the integrators to initial condition and then in the operation mode.
COMPUTING COMPONENTS
Summers Two summers are available on the GP-6 analog computers. Each one consists of an operational amplifier and five resistors (three l unit resistors and two 0.1 unit resistors). In addition, any of the four integrators may also be used as summers.