Objects in a Simulation Model - PowerPoint PPT Presentation

1 / 60
About This Presentation
Title:

Objects in a Simulation Model

Description:

To compare two models with different servers, is equivalent to changing the ... In the model of the simple car-wash system, the system changes state when a ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 61
Provided by: ITS2
Category:

less

Transcript and Presenter's Notes

Title: Objects in a Simulation Model


1
Objects in a Simulation Model
  • Activate objects, which are instances of the
    classes that inherit the library class Process
  • Passive objects, which are instances of any other
    class, including some of the library classes
    (e.g., queue classes)

2
Single-Server Models
  • There is only one server object that provides
    service to customer objects
  • Arriving customer objects join a queue to wait
    for service
  • The random events are
  • customer arrival
  • start service
  • service completion

3
Simple Queue
  • A waiting line for arriving customers (or other
    objects). A passive entity in the model, used as
    global shared resource.
  • An arriving customer can only enter the queue at
    the tail
  • The server removes the customer at the head of
    the queue
  • The usual order of customers is FIFO.

4
A Simple (FIFO) Queue
5
The Car-Wash Model
  • Arriving cars join a line (queue) to wait for
    service
  • There is only one car-wash machine that can
    service one car at a time
  • After the service for a car is complete, the car
    leaves the system

6
Components in the Model
  • A set of customer processes, the cars
  • One server process, the wash-machine
  • One process represents the environment that
    generates arrivals
  • One global shared resource, the queue

7
Events
  • customer arrival
  • start of service
  • end of service and departure of a customer

8
Single Server System Model
9
Modeling Diagrams
  • The UML diagram shows the main entities in the
    model
  • The UML static modeling diagrams show the basic
    structure of the classes and their relationships
  • The dynamic modeling diagrams show all the
    process interactions and the use of resources for
    every model.

10
UML class diagrams
11
UML Class Diagram
12
UML Collaboration Diagram
13
UML Sequence Diagram
14
UML State Diagram Car Object
15
Results of a Simulation Run
  • The trace, which is a sequence of all relevant
    events with time of occurrence
  • The summary statistics with the values of the
    performance metrics of the model for the current
    run

16
Performance Measures to be Computed
  • The average number of customers in the system
  • The average number of customers in the queue(s)
    (i.e., that are waiting)
  • The average time that a customer spends in the
    system
  • The average time that a customer spends in the
    queue(s)
  • The server (wash-machine) utilization.

17
Performance and Workload Characterization
  • The usual objective for determining the
    performance measures in a queuing system is to
    achieve the following criteria
  • Reduce the customer waiting periods
  • Improve the server utilization
  • Maximize throughput (the number of customers
    served) for a given workload.

18
Workload Parameters
  • The performance of the system depends on the
    workload submitted, and for this queuing model it
    consists of the following parameters
  • The average customer arrival rate, ?
  • The average customer service rate, ?
  • The resource demand for the customers

19
System Parameters
  • The queue size
  • The resource capacity of the system
  • The speed of the server

20
Performance Measures Depend on Workload
  • The performance metrics computed in the
    single-server model, depend on the workload
    submitted, and on the system parameters.
  • Modifying the workload on a model and/or the
    system parameters changes the behavior of the
    model.

21
Examples of Performance and Workload
  • To compare two models with different servers, is
    equivalent to changing the workload by providing
    two different values for the average service time
    demands of the customers.
  • If the system workload increases, the server
    utilization will also increase

22
Bottleneck
  • The bottleneck of the system at capacity will be
    localized in the server or resource with a
    utilization of 1, while the other servers or
    resources each have utilization significantly
    below 1.
  • The bottleneck can be localized at the server,
    the queue, or at the resources.

23
Studying System Behavior
  • All the changes that occur in the system are
    analyzed
  • In the model of the simple car-wash system, the
    system changes state when a customer arrives,
    when a customer starts service, when a customer
    completes service, etc.
  • These changes are instantaneous occurrences and
    are called events.

24
Random Variables in the Model
  • In the Car-wash model, the following random
    variables are defined
  • The inter-arrival period for the car objects
  • The service period for each car object.

25
Generation of Random Variables
  • To facilitate the simulation of random events,
    PsimJ provides random number generators using
    several probability distributions
  • Some of the distributions return an integer
    (long) value, others return a real (double) value

26
Probability Distributions in PsimJ
  • Uniform
  • Exponential
  • Poisson
  • Normal
  • Erlang
  • Geometric
  • Hyper-exponential

27
Random Events in the Carwash Model
  • Two random events
  • customer arrivals
  • end of a customer service
  • Two random variables are modeled
  • inter-arrival periods
  • service periods
  • Both random variables follow an exponential
    distribution.

28
Distributions Provided by PsimJ
  • The sample models included in the Psim Web page
  • http//science.kennesaw.edu/jgarrido/psim.html

29
Using PsimJ with Java
  • All processes (active objects) are created from a
    user-defined class that inherits the library
    class Process.
  • All non-process objects (passive objects) are
    created directly from the corresponding library
    class (e.g., class Squeue), or other classes.

30
The Structure of a Model in Java
  • Define all classes for the models processes, and
    inherit from the library class Process.
  • Define one class (main class) that includes
    method main.
  • In method Main_body of the main class, start the
    simulation by invoking method start_sim, then
    calculate summary statistics.

31
Method main
  • In method main
  • Define a simulation object of the library class
    Simulation give a name to the model.
  • Create all the objects used in the model.
  • Start the active objects.

32
Using GUI with Models
  • Java facilitates the implementation of graphical
    interfaces for simulation models
  • A general GUI framework is included with PsimJ.
    The package name is gui
  • To run the carwash model with GUI, run the
    CarwashGUI class, instead of the Carwash class

33
Carwash Simulation Run
34
Carwash Simulation Run (2)
35
Queuing Models
  • Models that include at least one queue
  • From the software point of view, the queue is a
    data structure that stores waiting customers
  • The server removes from the queue the next
    customer to service

36
Basic Categories of Queuing Models
  • Single-server models
  • Multi-server models
  • Queuing networks

37
Examples of Queuing Models
  • Computer systems
  • Communication systems, networks
  • Teller facilities in a bank
  • Production systems
  • Transport and materials handling
  • Repair and maintenance systems

38
Service Stations
  • A queuing model consists of a number of
    facilities and interconnecting queues. Each
    facility, or service station, consists of one or
    more servers.
  • For these types of systems, it is very common in
    practice to use exponentially distribution for
    inter-arrival periods and for service periods.

39
Types of Queuing Models
  • Single-server, single-queue
  • Multi-server, single-queue
  • Multi-server, multi-queue
  • Multi-server, multi-queue with priorities
  • Multi-server, multi-queue with priorities and
    preemption.

40
Multiple Servers Single Queue
  • Any of the servers available can provide service
    demanded by a customer
  • A server removes the next customer from the head
    of the customer queue
  • One or more servers can be idle, waiting for
    customers to arrive

41
Carwash Model With Multiple Machines
42
General Description of the Model
  • This model has K machines (servers)
  • A customer can receive service from any machine
    (any server)
  • A customer waits in the customer queue until it
    is at the head of the queue and a machine becomes
    available
  • The machine removes the customer from the head of
    the queue and starts to service it

43
Idle Servers
  • Idle servers are organized in a server queue
  • A server joins a queue of idle servers if there
    are no customers
  • An arriving customer enters the input queue and
    reactivates the server at the head of the server
    queue. If there are no servers available, the
    customer just waits

44
Models With Multiple Servers and Multiple Queues
45
Multi-Server Multi-Queue Model
  • Every server has its own queue of customers
  • An arriving customer selects the server with the
    smallest queue
  • Alternatively, an arriving customer randomly
    selects a server.

46
Multi-Server Multi-Queue Model with Preemption
  • Every customer has a priority
  • An arriving customer can interrupt the service of
    another customer with a lower priority
  • the interrupted customer is returned to the head
    of his queue, this customer is the one with the
    lowest priority and that started most recently.

47
Performance Measures
  • The average number of customers in the system
  • The average number of customers in the queue(s)
    (i.e., that are waiting)
  • The average period that a customer spends in the
    system
  • The average period that a customer spends in the
    customer queue waiting
  • The server utilization

48
Queuing Networks
  • Consists of two or more interconnected stations
  • The output from a station are connected to input
    of another station
  • Each station has one or more servers and its
    queues
  • Each station provides a different service

49
Service in a Queuing Network
  • Customers enter the network at any of several
    entry stations
  • Customers are routed through the network
    demanding service from different stations
  • Customers can exit from any of several exit
    stations

50
A Queuing Network
51
Models With Priorities
  • Customers are grouped into classes or types
  • Each customer class has its own priority, and
    workload parameters (e.g., arrival rate and a
    service demand)
  • The customers wait in a priority queue, with
    highest priority closest to the head
  • A server removes the customer with the highest
    priority from the queue

52
Examples
  • Medical service systems
  • Computer communication networks
  • Operating systems
  • Car-wash systems for different types of vehicles

53
Priority Queue
  • A queue that holds customers by priority
  • The queue discipline is ordering of the customers
    by priority
  • Customers with the highest priority are always at
    the head of the queue

54
Model With Priorities
55
Priority Queues in PsimJ
  • To declare a priority queue, use class Pqueue
  • public static Pqueue car_queue // for car
    objects
  • To create object car_queue (passive object) with
    K different priorities
  • car_queue new Pqueue (CarQ, K)
  • In PsimJ, the highest priority is 0

56
Priorities For the Car Objects
  • There is an arrivals object for every customer
    class
  • Each arrivals object creates car objects for the
    corresponding priority
  • A car object gets its priority when created (in
    the constructor)
  • A car object joins the corresponding priority
    queue to wait for service

57
Defining and Using Car Priority
The constructor in class Car public Car(String
name, int type, double dur)
... int my_priority type // type (priority)
of car set_prio (my_priority) // assigns its
priority
In the Main_body of class Car // this object
joins the priority queue car_queue.into(this)
58
Results of a Simulation Run
  • The trace, which is the sequence of events that
    occur during the simulation run
  • Performance measures for every priority
  • Throughput
  • Average wait period
  • other measures

59
Multi-Server Model with Priorities
  • Every customer has a priority and joins the
    priority queue
  • An server gets the customer from the queue with
    highest priority
  • If there are no customers, and server joins a
    server queue and becomes idle

60
Multiple Servers With Priority
Write a Comment
User Comments (0)
About PowerShow.com