0% found this document useful (0 votes)
18 views12 pages

Chapter 2

The document discusses simulation of continuous and discrete systems. It describes continuous system models using differential equations and how continuous systems are simulated. It also discusses analog computers, hybrid computers, digital analog simulators, and feedback systems including an example of modeling an autopilot system using differential equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views12 pages

Chapter 2

The document discusses simulation of continuous and discrete systems. It describes continuous system models using differential equations and how continuous systems are simulated. It also discusses analog computers, hybrid computers, digital analog simulators, and feedback systems including an example of modeling an autopilot system using differential equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Chapter 2

Simulation of Continuous and Discrete Systems


2.1. Continuous System Models
When continuous system is modeled mathematically, the variables of model representing the attribute of
system are controlled by continuous functions. The distributed lag model is an example of a continuous
model. Since in continuous system, the relationship between variables describe the rate at which the value
of variable change, these system consist of differential equations.

Continuous system simulation uses the notation of differential equation to represent the change on the basic
parameter of the system with respect to time. Hence the Mathematical model for continuous system
simulation is usually represented by differential and partial differential equations.

2.1.1. Differential Equations


An example of a linear differential equation with constant coefficients to describe the wheel suspension
system of an automobile can be given as:

K D
Here the dependent variable x appears together with first and second derivatives single dot and double dot
respectively.
The simple differential equation can model the simplest continuous system and they can have one or more
linear differential equation with constant coefficients. It is then often possible to solve the model without
using simulation technique i.e. we can solve such equations using analytical methods as (we have done in
Numerical methods)
However when non linearity involves into the model, it may be impossible or at least very difficult to solve
such model without simulation.

2.1.2. Partial Differential Equations


When more than one independent variable occurs in a differential equation the equation is said to be partial
differential equations. It can involve the derivatives of the same dependent variable with respect to each of
the independent variable.
Differential equations both linear and nonlinear occur frequently in scientific and engineering studies. The
reason for this is that most physical and chemical process involves rates of change, which require
differential equation to represent their mathematical descriptions. Since partial deferential equation can also
represent a growth rate, continuous model can also be applied to the problems of a social or economic
nature.

Example 1: Laplace Equation

Dadhi R. Ghimire ([email protected]) Page 1


2.2. Analog Computers
Before the general availability of digital computers, analog computers were used for the simulation of the
discrete system simulation as well continuous system simulation.
There existed devices whose behavior is equivalent to a mathematical operation such as addition, integration,
etc and putting together combinations of such devices in a manner specified by a mathematical model of a
system allowed the system to be simulated.
These computers were primarily used for solving differential equation and most used version of the
computes was the direct current amplifiers.
Voltage in computers is equated to mathematical variables.
Accuracy of these computers is low fluctuations in the voltage level cannot be controlled beyond a limit:
Some of the components used in the analog computers are:
Summers

Integrator

Inverter
_

Scalar C

Example: Simulation of wheel suspension system


Mx”+Dx’+Kx=KF(t)
Mx”=KF(t)-Dx’-kx

Figure: Analog computer representing Automobile Suspension System

Dadhi R. Ghimire ([email protected]) Page 2


2.3. Hybrid Computers
The scope of analog computers has been considerably extended by developments in solid-logic electronic
devices. Analog computers always used a few non-linear elements such as multipliers or function generators.
Originally, such devices were expensive to make. Solid logic devices, in addition to improving the design
and performance of operational amplifiers, have made such nonlinear devices cheaper and easier to obtain.
They have also extended the range of devices. Among the elements that can easily be associated with analog
computers are circuits that carry out the logical operations of Boolean algebra, store values for later use,
compare values, and operate switches for controlling runs.
The term hybrid computer has come to describe combinations of traditional analog-computer elements,
giving smooth, continuous outputs, and elements carrying out such nonlinear, digital operations as storing
values, switching, and performing logical operations. Originally, the term had the connotation of extending
analog-computer capabilities, usually by the addition of special-purpose, and often specially constructed
devices. More recently, few purely analog computers are built. Instead, computers with large numbers of
standard, nonlinear elements are readily available.
Hybrid computers may be used to simulate systems that are mainly continuous, but do, in fact, have some
digital elements-for example, an artificial satellite for which both the continuous equations of motion, and
the digital control signals must be simulated. Hybrid computers are also useful when a system that can be
adequately represented by an analog computer model is the subject of a repetitive study.

2.4. Digital analog simulators


To avoid the disadvantages of analog computers, many digital computer programming language have been
written to produce digital-analog simulators. They allow or facilitate a continuous model to be programmed
on a digital computer in essentially the same way as it is solved on analog computer. The language contains
micro instructions that carry the action of addition, integration and sign changer. A program is written to
link together these micro instructions in the same way as operational amplifiers are connected in analog
computer. Since more powerful digital computer and programming language have been developed for this
purpose of simulating continuous system on digital computer, the digital-analog simulators are now in
extensive use.

2.5 Feedback Systems


A significant factor in the performance of many systems is that a coupling occurs between the input and
output of the system. The term feedback is used to describe the phenomenon. A home heating system
controlled by a thermostat is a simple example of a feedback system. The system has a furnace whose
purpose is to heat a room, and the output of the system can be measured as room temperature. Depending
upon whether the temperature is below or above the thermostat setting, the furnace will be turned on or off,
so that information is being fed back from the output to the input. In this case, there are only two state, either
the furnace is on or off.
An example of a feedback system in which there is continuous control is the aircraft system. Here, the input
is a desired aircraft heading and the output is the actual heading. The gyroscope of the autopilot is able to
detect the difference between the two headings. A feedback is established by using the difference to operate
the control surface, since change of heading will then affect the signal being used to the heading. The
difference between the desired heading and actual heading is called the error signal, since it is a
measure of the extent to which the system deviates from the desired condition. It is denoted by .
The feedback in the autopilot is said to be negative feedback. The more the system output deviates from the
desired from value stronger is the force to drive it back.

Dadhi R. Ghimire ([email protected]) Page 3


Feedback System Example: Autopilot System
Autopilot is an automatic aircraft control system. A gyroscope in the autopilot detects the difference between
the actual heading (Heading is the relative horizontal orientation of the aircraft relative to magnetic North)
and the desired heading. It sends a signal to move the control surfaces. In response to the control surface
movement, the airframe steers towards the desired heading.

Fig: Autopilot system


In order to simulate the action of autopilot, we first construct a mathematical model of the aircraft system.
The error signal, , has been defined as the difference between the desired heading, or output, , and the
actual heading, . We therefore have the following identity:
= (1)
We assume the rudder (a flat, movable piece usually of wood or metal that is attached to a ship, boat,
airplane, etc., and is used in steering) is turned to an angle proportional to the error signal, so that the force
changing the aircraft heading is proportional to the error signal. Instead of moving the aircraft sideways, the
force applies a torque which will turn the aircraft.

Torque = (2)
Where K and D, are constants, the first term on the right hand side is the torque produced by the rudder, and
the second is the viscous drag.
The torque is also given by the product of inertia on body of aircraft and second derivative of the heading,

Torque = (3)
From equation (1), (2), and (3) we get,

(4)
Dividing both sides by I, and making the following substitutions in equation (4)
2 = D/I, = k/I

(5) ( is damping factor)


This is a second order differential equation.

Dadhi R. Ghimire ([email protected]) Page 4


Fig: Aircraft response to autopilot system

2.6. Discrete System Simulation

In discrete systems the changes in the systems state are discontinuous. Each change in the state
of the system is called an event. For example, the arrival or departure of a customer in a queue is
an event. That contrasts to continuous systems in which the state changes smoothly with time.
Simulation is the representation or imitation of a system by a computer for the purpose of
predicting the behaviour of that system under certain conditions.

Discrete-event simulation is commonly used in research to study large, complex systems which
are not suitable for conventional analytic approach. Some examples are the study of sea and
airports, & telephone exchanges. Another use of simulation is for tuning a design, an example is
network design.

2.6.1. Representation of time in Discrete Event Simulation


Fixed time-step versus next-event model:
In a fixed time-step (interval Oriented) model a timer is simulated by the computer, this timer
is updated by a fixed time interval τ, and the system is examined to see if any event has taken
place during this time interval, all events that take place during that interval are treated as if they
occurred simultaneously at the end of this interval.

In a next-event (or event-to-event) model the computer advances time to the occurrence of the
next event, thus it shifts from one event to the next; the system state does not change in between.
When something of interest happens to the system, the current time is kept track of.

The flowcharts for both models are shown below.

Dadhi R. Ghimire ([email protected]) Page 5


2.7. Arrival Process or patterns
Any queuing system must work on something − customers, parts, patients, orders, etc. We generally called
them as entities or customers. Before entities can be processed or subjected to waiting, they must first enter
the system. Depending on the environment, entities can arrive smoothly or in an unpredictable fashion.
They can arrive one at a time or in clumps (e.g., bus loads or batches). They can arrive independently or
according to some kind of correlation. A special arrival process, which is highly useful for modeling
purposes, is the Markov arrival process. Both of these names refer to the situation where entities arrive one
at a time and the times between arrivals are exponential random variables. This type of arrival process is
memory-less, which means that the likelihood of an arrival within the next t minutes is the same no matter
how long it has been since the last arrival. Examples are phone calls arriving at an exchange, customers
arriving at a fast food restaurant, hits on a web site, and many others.

Dadhi R. Ghimire ([email protected]) Page 6


2.7.1. Poison Process (Stationary)

This is equivalent to saying that the number of arrivals per unit time is a random variable with a Poisson’s
distribution. This distribution is used when chances of occurrence of an event out of a large sample is small.

That is if X = number of arrivals per unit time, then, probability distribution function of arrival is given as

Where λ. is the average number of arrivals per unit time (1/ τ), E(X) is the expected number, and x is the
number of customers per unit time. This pattern of arrival is called Poisson’s arrival pattern. τ is inter arrival
time.

Illustrative example
In a single pump service station, vehicles arrive for fueling with an average of 5 minutes between arrivals. If
an hour is taken as unit of time, cars arrive according to Poison’s process with an average of
λ= 12 cars/hr.
The distribution of the number of arrivals per hour is,

Dadhi R. Ghimire ([email protected]) Page 7


Illustrative example
In a single pump service station, vehicles arrive for fueling with an average of 5 minutes between arrivals. If
an hour is taken as unit of time, cars arrive according to Poison’s process with an average of
λ= 12 cars/hr.
The distribution of the number of arrivals per hour is,

2.7.2Non-stationary Poisson Process


Non-stationary Poisson process (NSPP), is characterized by λ(t), the arrival rate at time t. The NSPP is
useful for situations in which the arrival rate varies during the period of interest, including meal times for
restaurants, phone calls during business hours, and orders for pizza delivery around 6 P. M. The key to
working with an NSPP is the expected number of arrivals by time t, denoted by:

Example

Dadhi R. Ghimire ([email protected]) Page 8


2.7.3. Batch/Bulk Arrivals

Dadhi R. Ghimire ([email protected]) Page 9


2.8. Gathering Statistics

2.9 Monte Carlo Method/ Simulation

Dadhi R. Ghimire ([email protected]) Page 10


It is a numerical computation method that consists of extensive experimental sampling with random
numbers. For Example, the integral of a single variable over a given range corresponds to finding the area
under the graph representing the function. Suppose the function, f(x) is positive and has lower and upper
bounds a and b, respectively. Suppose, also, the function is bounded above by the value c.

As shown in the figure above, the graph of the function is then contained within a rectangle with sides of
length c, and b-a. If we pick points at random within the rectangle, and determine whether they lie beneath
the curve or not, it is apparent that, providing the distribution of selected points is uniformly spread over the
rectangle. The fraction of the points falling on or below the curve should be approximately the ratio of the
area under the curve to the area of the rectangle. If N points are used and n of them fall under the curve, then,
approximately,

The accuracy improves as the number of N increases. When it is decided that the sufficient poits has been
taken, the value of integral is estimated by multiying n/N with the area of rectangle, c(b-a).

Estimating the value of Pi using Monte Carlo


The idea is to simulate random (x, y) points in a 2-D plane with domain as a square of side 1 unit. Imagine a
circle inside the same domain with same diameter and inscribed into the square. We then calculate the ratio
of number points that lied inside the circle and total number of generated points. Refer to the image below:

Dadhi R. Ghimire ([email protected]) Page 11


Dadhi R. Ghimire ([email protected]) Page 12

You might also like