sms btech (it) simulation and modeling pt1

59
Simulation and Modeling - 732 B. Tech. (IT) SEMESTER - VII SEMESTER - VII Part I July - 2013

Upload: divya-singhal

Post on 23-Nov-2015

8 views

Category:

Documents


1 download

DESCRIPTION

SMS-732 BTECH (IT) Simulation and Modeling Pt1

TRANSCRIPT

  • Simulation and Modeling - 732B. Tech. (IT)

    SEMESTER - VIISEMESTER - VII

    Part I

    July - 2013

  • System Simulation

    Introduction

  • Simulation is a very powerful and widely used computational science technique for the analysis and study of complex systems.

    Simulation may be defined as a technique that imitates the operation of a real-world system as it evolves over time. This is normally done by developing a simulation model. A This is normally done by developing a simulation model. A simulation model usually takes the form of a set of assumptions about the operation of the system, expressed as mathematical or logical relations between the objects of interest in the system.

    Simulation has its advantages and disadvantages. We will focus our attention on simulation models and the simulation technique.

  • Simulation

    What is simulation:

    The process of designing a mathematical or

    logical model of a real-system and then logical model of a real-system and then

    conducting computer-based experiments with

    the model to describe, explain, and predict

    the behavior of the real system.

  • Simulation

    Where simulation fits in

    ProgrammingSimulation

    Analysis

    ModelingProbability &Statistics

  • Basic Terminology

    In most simulation studies, we are concerned with

    the simulation of some system.

    Thus, in order to model a system, we must

    understand the concept of a system.

    Definition: A system is a collection of entities that

    act and interact towards the accomplishment of

    some logical end.

    Systems generally tend to be dynamic their status

    changes over time. To describe this status, we use

    the concept of the state of a system.

  • Examples of - Simulation Model

    Nano cars - numbers of cars produced per day

    (throughput)

    Emergency Room (beds, doctors, nurses), (minor,

    moderate, major, critical)moderate, major, critical)

    Missile Ballistic Missile Survivability against Some

    Threat

    Institutes (IIIT A) Parking place

    Power Integration Semiconductor Capacity, and

    random machine down times

  • Value of Simulation

    Empirical Method verses Mathematical model

    Allow you to calculate the extreme values not Allow you to calculate the extreme values not

    just the expected value

  • Simulation

    What is simulation

    Simulation is the actual running of the model system to gain insight into its performance.system to gain insight into its performance.

  • Simulation

    Why use simulation

    Simulation is used to better understand the expected performance of the real system and to expected performance of the real system and to test the effectiveness of the system design.

  • Simulation

    Why use simulation

    Without building them

    experimental system

    new concepts new concepts

    Without disturbing them

    costly experimentation

    unsafe experimentation.

    Without destroying them

    Determine limits of stress

  • Alternative to simulation

    Simulation

    Analytic models

    Physical experimentation Physical experimentation

    Visit other sites

  • Simulation vs. Analytic modeling

    Advantage:

    various performance measures

    greater realism

    easier to understand easier to understand

    model the steady-state as well as the transit

    behavior.

    Disadvantage:

    May not provide you with the optimal

    solution

    time to construct model will be longer.

  • Simulation vs. Physical

    Advantage:

    High Speed

    Not disruptive

    Replication easy Replication easy

    Control variations

    Generally less costly

    Disadvantage:

    Realism

    Validity

  • Simulation vs. Alternatives

    V A S PRealism

    V A

    V A S PCost

  • Representing system

    System:

    a collection of mutually interacting objects

    designed to accomplish a goal (machines

    repair system) repair system)

    Entities:

    denotes an element/object within boundary

    of system (machines, operators, repairman)

    Entity work being performed on object

    Resource performing the work

  • Representing system

    Attribute:

    Characteristic or property or an entity

    (machine ID, Type of breakdown, time that

    machine went down) machine went down)

    Activity:

    transforms the state of an object usually over

    some time (repairman service time, machine

    run time)

  • Representing system

    State of the system:

    Numeric values that contain all the

    information necessary to describe the system

    at any time.at any time.

    Delays:

    Processes that take a conditional length of

    time in the system

  • Representing system

    Events:

    Change the state of the system(end of service

    of machine,machine breaks down)

    Queue:

    it is set, used to model waiting

  • Ex. Elevator systems

    Entities

    Elevators, people

    Sets

    People waiting at each floor

    Attributes

    Elevators capacity, speed, destination,

    current location of each elevator

    People inter-arrival time at each floor,

    destination of each people

  • Ex. Elevator systems

    State of system:

    # of people on each elevator

    # of people in each floor

    Activities Activities

    Load/Unloading passenger

    Travel to next floor (speed and distance)

    Persons travel to elevator

  • Ex. Elevator systems

    Delays:

    Persons waiting for elevator

    Events:

    Elevator arrival

    End unloading

    End Loading

    Person Arrival

  • Simulation types

    Static vs. dynamic

    Deterministic vs. stochastic

    Continuous vs. discrete

    Simulation model system model Simulation model system model

  • Static Simulation vs. Dynamic

    Simulation

    There are two types of simulation models,

    static and dynamic.

    Definition: A static simulation model is a

    representation of a system at a particular representation of a system at a particular

    point in time.

    We usually refer to a static simulation as a

    Monte Carlo simulation.

  • Static Simulation vs. Dynamic

    Simulation

    Definition: A dynamic simulation is a representation of a system as it evolves over time.

    Within these two classifications, a Within these two classifications, a simulation may be deterministic or stochastic.

    A deterministic simulation model is one that contains no random variables; a stochastic simulation model contains one or more random variables.

  • Discrete Event vs. Continuous

    Event Simulation

    Discrete event:

    state of system changes only at discrete points

    in time(events)

    ex. Machine repair problem ex. Machine repair problem

    Programming

    Look at system only when events occur; time is

    advanced from event to event.

  • Discrete Event vs. Continuous

    Event Simulation

    Continuous event:

    state of system changes continuously over

    time

    Ex. Level of fluid in tank Ex. Level of fluid in tank

    Programming:

    Advances time in small intervals. Use differential

    equations to represent flows.

  • An Example of a Discrete-Event

    Simulation

    To simulate a queuing system, we first have to describe it.

    We assume arrivals are drawn from an infinite calling population.

    There is unlimited waiting room capacity, and There is unlimited waiting room capacity, and customers will be serve in the order of their arrival (FCFS).

    Arrivals occur one at a time in a random fashion.

    All arrivals are eventually served with the distribution of service teams as shown in the book.

  • Service times are also assumed to be random. After service, all customers return to the calling population.

    For this example, we use the following variables to define the state of the system: (1) the number of define the state of the system: (1) the number of customers in the system; (2) the status of the server that is, whether the server is busy or idle; and (3)the time of the next arrival.

    An event is defined as a situation that causes the state of the system to change instantaneously.

  • Discrete Event Simulation

    Event scheduling

    Write modules that describe changes in the

    state of the system at each event

    Main program advances time Main program advances time

    One subprogram for each event

    General purpose programming language

  • Discrete Event Simulation

    Process interaction

    Write modules that describe the progress of

    entities through the system

    As entities move the systems changes state As entities move the systems changes state

    Entities are held to represent activities and

    delays

    Promodel programming language

  • Event scheduling

    Time is advanced from event to event

    Future events list ordered list of

    upcoming events

    As events are scheduled, they are added to

    the list

    As events occur they are removed from list

    Activities in event ( one / event type)

  • Event scheduling

    List is required to keep track of entities in a

    set

    Statistics Two types

    Sample statistics average of some values

    (W)

    W = (W1 +W2 + +Wn)/n = Total Wait / # of wait

    Time average statistics time weighted (L)

    L = (0(t1) + 1(t2-t1) + 2(t3-t2) + 1(t4-t3)) / t4

  • Activity scanning

    Activity scanning

    Time is modeled in fixed time increments to

    check if activity occurred

    Small time increments is inefficient Small time increments is inefficient

    Large time increments may miss activity

    describes the activities in which the entities in

    the system engage.

  • Process Oriented

    Process oriented:

    Many simulation models include elements which occur in defined patterns

    The logic associated with such a system or The logic associated with such a system or events can be generalized and defined by a single statement

    A simulation language could then translate such statement into the appropriate sequence of events

    describes the processes through which the entities in the system flow.

  • Process Oriented

    Process oriented:

    These statements, define a sequence of

    events which are automatically executed by

    the simulation language as the entities move the simulation language as the entities move

    through the process

    Create arrival entities every t time units

    However, since we are normally restricted to a

    set of standardized statement, provided by

    the simulation language, our model flexibility

    is not as great as with the event condition

  • Feature provided by a language

    Conceptual framework(entities, attributes, resource, queues)

    Maintenance of event list

    Random variable generation Random variable generation

    Animation

    Debugging function

    Output analysis

    Input analysis

    Report generation

  • The Simulation Modeling Steps

    We now discuss the process for a complete simulation study and present a systematic approach of carrying out a simulation.

    A simulation study normally consists of several distinct stages. distinct stages.

    However, not all simulation studies consist of all these stages or follow the order stated here.

    On the other hand, there may even be considerable overlap between some of these stages.

  • Aircraft Performance Modelan example of Deterministic Systems Modeling

    Lift force (L) = Weight of aircraft (W)Engine Thrust (T) = Drag force (D)

  • Aircraft Performance Model..

    Expressions for lift and drag forces

  • Aircraft Performance Model..

    Rate of decrease of aircraft weight due to fuel consumption

    An empirical relation for drag polar relating CL and CD

    Now the collection model equations

  • Aircraft Performance Model..

    OR

    The air density ratio at an altitude

    T =

    Where = 9296 below 11 Km

  • The Engineering

    Problem Solving

    43

    Process

  • Newtons 2nd law of Motion

    The time rate change of momentum of a body is equal to the resulting force acting on it.

    Formulated as F = m.aF = net force acting on the body m = mass of the object (kg) a 2

    44

    a = its acceleration (m/s2)

    Some complex models may require more sophisticated mathematical techniques than simple algebra

    Example, modeling of a falling parachutist:

    FU = Force due to air resistance = -cv (c = drag coefficient)FD = Force due to gravity = mg

    UD FFF +=

  • cvmgdvcvF

    mgFFFF

    m

    Fdtdv

    U

    D

    UD

    =

    =

    =

    +=

    =

    This is a first order ordinary differential equation.

    We would like to solve for v (velocity).

    It can not be solved using algebraic manipulation

    Analytical Solution:

    If the parachutist is initially at rest (v=0 at t=0),

    using calculus dv/dt can be solved to give the result:mdt

    =

    vm

    cgdtdv

    =

    using calculus dv/dt can be solved to give the result:

    ( )tmcec

    gmtv )/(1)( =

    Independent variableDependent

    variable

    Parameters

    Forcing function

  • **here Analytical Solution

    ( )tmcec

    gmtv )/(1)( =

    t (sec.) V (m/s)0 0

    If v(t) could not be solved analytically, then we need to use a numerical method to solve

    g = 9.8 m/s2 c =12.5 kg/s m = 68.1 kg

    46

    0 02 16.404 27.778 41.1010 44.8712 47.49 53.39

  • )()()(

    lim........)()(

    1

    1

    01

    1

    i

    ii

    ii

    tii

    ii

    tvm

    cgtt

    tvtv

    t

    v

    dtdv

    tt

    tvtv

    t

    v

    dtdv

    =

    =

    =

    +

    +

    +

    +

    c

    This equation can be rearranged to yield

    Numerical Solution

    47

    ))](([)()( 11 iii tttvm

    cgtvtv ii += ++yield

    t = 2 sec

    To minimize the error, use a smaller step size, tNo problem, if you use a computer!

    t (sec.) V (m/s)0 02 19.604 32.008 44.8210 47.9712 49.96 53.39

  • t (sec.) V (m/s)0 0

    2 19.60

    4 32.00

    8 44.82

    t (sec.) V (m/s)0 0

    2 16.40

    4 27.77

    8 41.10

    m=68.1 kg c=12.5 kg/s g=9.8 m/s t = 2 sec

    Analytical

    t (sec.) V (m/s)0 0

    2 17.06

    4 28.67

    8 41.95

    t = 0.5 sec

    t (sec.) V (m/s)0 0

    2 16.41

    4 27.83

    8 41.13

    t = 0.01 sec

    Numerical solutionvs.

    8 44.82

    10 47.97

    12 49.96

    53.39

    8 41.10

    10 44.87

    12 47.49

    53.39

    ( )tmcec

    gmtv )/(1)( = ttv

    m

    cgtvtv iii +=+ )]([)()( 1

    8 41.95

    10 45.60

    12 48.09

    53.39

    8 41.13

    10 44.90

    12 47.51

    53.39

    CONCLUSION: If you want to minimize the error, use a smaller step size, t

  • Manual Simulation Example

    Given the following arrival times for a single server system what will be the average number in the queue, average number in the system, average time in system, average time in queue, the number of completed jobs, number in the queue, number in completed jobs, number in the queue, number in the system, and server utilization at time 15 if the service time is 3 time units for each entity.

    1, 3, 5, 9,13,15,17

  • Distributive Systems

    50

    Distributive Systems

  • The Message Passing ParadigmMessage passing is the most fundamental paradigm for distributed

    applications.

    A process sends a message, often representing a request.

    The message is delivered to a receiver, which processes the message,

    and possibly sending a message in response.

    In turn, the reply may trigger a further request, which leads to a

    subsequent reply, and so forth.

    51

    In turn, the reply may trigger a further request, which leads to a

    subsequent reply, and so forth.

    Process A Process B

    a message

    Message passing

  • The Message Passing Paradigm - 2

    The basic operations required to support the basic message passing paradigm are send, and receive.

    For connection-oriented communication, the operations connect and disconnect are also required.

    With the abstraction provided by this model, the interconnected processes perform input and output to each other, in a manner similar to file I/O. The I/O operations encapsulate the details of network

    52

    to file I/O. The I/O operations encapsulate the details of network communication at the operating-system level.

  • The ClientThe ClientThe ClientThe Client----Server ParadigmServer ParadigmServer ParadigmServer ParadigmBest known paradigm for network applications -- the client-server

    model assigns asymmetric roles to two collaborating processes.

    One process, the server, plays the role of a service provider which

    waits passively for the arrival of requests. The other, the client,

    issues specific requests to the server and awaits its response.

    53

    .

    .

    .

    service request

    a server processa client process

    a service

    The Client-Server Paradigm, conceptual

    Server host

    Client host

  • The ClientThe ClientThe ClientThe Client----Server ParadigmServer ParadigmServer ParadigmServer Paradigm - 2

    Simple in concept, the client-server model provides an efficient

    abstraction for the delivery of services.

    Operations required include those for a server process to listen for

    and to accept requests, and for a client process to issue requests

    and accept responses.

    By assigning asymmetric roles to the two sides, event

    54

    By assigning asymmetric roles to the two sides, event

    synchronization is simplified: the server process waits for requests,

    and the client in turn waits for responses.

    Many Internet services are client-server applications. These

    services are often known by the protocol that the application

    implements. Well known Internet services include HTTP, FTP, DNS,

    finger, gopher, etc.

  • The Peer-to-Peer System Architecturehttp://www.peer-to-peerwg.org/whatis/index.html

    In system architecture and networks, peer-to-peer is an architecture where computer resources and services are directly exchanged between computer systems.

    These resources and services include the exchange of information, processing cycles, cache storage, and disk storage for files

    55

    storage for files

    In such an architecture, computers that have traditionally been used solely as clients communicate directly among themselves and can act as both clients and servers, assuming whatever role is most efficient for the network.

  • The Peer-to-Peer Distributed Computing

    Paradigm

    In the peer-to-peer paradigm, the participating processes play equal

    roles, with equivalent capabilities and responsibilities (hence the

    term peer). Each participant may issue a request to another

    participant and receive a response.

    process 1

    Distributed Software Systems 56

    requestresponse

    request

    response

    process 2

  • Peer-to-Peer distributed

    computingWhereas the client-server paradigm is an ideal model for a

    centralized network service, the peer-to-peer paradigm is more

    appropriate for applications such as instant messaging, peer-to-peer

    file transfers, video conferencing, and collaborative work. It is also

    possible for an application to be based on both the client-server

    model and the peer-to-peer model.

    Distributed Software Systems 57

    model and the peer-to-peer model.

    A well-known example of a peer-to-peer file transfer service is

    Napster.comNapster.comNapster.comNapster.com or similar sites which allow files (primarily audio files)

    to be transmitted among computers on the Internet. It makes use of

    a server for directory in addition to the peer-to-peer computing.

  • Distributed Software Systems 58

  • Peer-to-Peer distributed

    computingThe peer-to-peer paradigm can be implemented with facilities using any tool

    that provide message-passing, or with a higher-level tool such as one that supports the point-to-point model of the Message System paradigm.

    For web applications, the web agent is a protocol promoted by the XNSORG (the XNS Public Trust Organization) for peer-to-peer interprocess communication

    Project JXTA is a set of open, generalized peer-to-peer protocols that allow

    Distributed Software Systems 59

    Project JXTA is a set of open, generalized peer-to-peer protocols that allow any connected device (cell phone, to PDA, PC to server) on the network to communicate and collaborate. JXTA is short for Juxtapose, as in side by side. It is a recognition that peer to peer is juxtapose to client server or Web based computing -- what is considered today's traditional computing model.