+ All Categories
Home > Documents > (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

Date post: 17-Jan-2018
Category:
Upload: shon-mills
View: 221 times
Download: 0 times
Share this document with a friend
Description:
(C) J. M. Garrido3 Resource Allocation and Deallocation Every process follows the sequence: l Request a number of resource items from a resource pool, wait until these become available l Acquire a number of items from a resource pool l Use the resource items for a finite period l Release the some or all resource items acquired
32
(C) J. M. Garrido 1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015
Transcript
Page 1: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 1

Object Oriented Simulationwith OOSimL

Detachable ResourcesFall 2015

Page 2: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 2

Review Standard Resources

A system can include zero or more resource pools

Each resource pool has a number of resource items

A number of these resource items can be acquired by one or more processes

Page 3: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 3

Resource Allocation and Deallocation

Every process follows the sequence: Request a number of resource items from a

resource pool, wait until these become available

Acquire a number of items from a resource pool

Use the resource items for a finite period Release the some or all resource items

acquired

Page 4: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 4

Standard Resources

A resource pool is an passive object A simulation model must declare a

resource pool and create the resource pool object with a number of resource items

A specific number of items of a resource pool can be used by at most one process

Page 5: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 5

Resource Contention Mechanism

Processes compete for a limited number of resource items.

When there are not sufficient resource items for a request, the requesting process is suspended and placed in an internal queue by priority.

The processes waiting for resource items are reactivated when another process releases sufficient items.

Page 6: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 6

Resource Classes in OOSimL

A standard resource pool is an object of class Res

The resource pool object is created with a number of resource items

The resource pool object includes mechanism for processes to compete in a mutual exclusive manner for resources

Page 7: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 7

Using Resources in OOSimL

For example, to declare and create a resource with 50 chairs:

define chairs of class Res // chairs as a resource pool....

create chairs of class Res using “Wood chairs”, 50

A process acquires 15 chairs then releases 10: acquire 15 from chairs // acquire 15 chairs … release 10 of chairs // release 10 chairs

Page 8: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 8

Page 9: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 9

Detachable Resource Container

A detachable resource is an infinite container and behaves in a different manner as the standard resource

Usually a process either deposits items into the container or removes items from the container

Page 10: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 10

Producer-Consumer Cooperation

There is also synchronization among producer processes and consumer processes

An infinite container stores items and allows cooperation of producer and consumer processes

Producer processes place items in the container Consumer processes take items from the

container.

Page 11: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 11

Resource Manipulation

This type of resource manipulation involves: An infinite container object with an initial

number of items One or more producer processes that place

a number of items into the container object One or more consumer processes that take

a number of items from the container object

Page 12: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 12

Producer/Consumer Synchronization

If the container object has fewer items than the number requested by a consumer process, the process is suspended and moved to a resource queue to wait for resources.

When a producer process places items into the container object, the container object reactivates the waiting consumer process

Page 13: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 13

Producer and Consumer Objects

A Producer object takes a finite time interval to produce one or more items

It then places (gives) the items in the container

A consumer object takes items (if available) from the container then spends a finite time interval consuming these items.

Page 14: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 14

Simplified Activity Diagram of a Producer Process

Page 15: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 15

Simplified Activity Diagram of a Consumer Process

Page 16: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 16

Declaring and Creating Detachable Resources in OOSimL

To declare and create a container object, the Bin library class is used. For example, to declare and create a container object called messages of initially 15 items:

define messages of class Bin // declare . . . .create messages of class Bin using “My_messages”, 15

Page 17: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 17

A Producer Using Resource Objects

A producer process spends a time interval, prod_int, producing items then places 15 messages items in the container (Bin object)

hold for prod_int // interval producing items

give 15 units of messages // place 15 items // container now has total now 30

Page 18: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 18

Producer Process

Page 19: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 19

A Consumer Using Resource Objects

A consumer process requests and takes 20 items from the container, then spends a finite interval, cons_int, consuming these items

take 20 units from messageshold for cons_int // consume items

Page 20: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 20

Consumer Process

Page 21: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 21

Available Units in a Resource Container

The assign available statement gets the number of available resource units in a detachable resource object, and assigns this number to the specified integer variable.

assign available units of < ref_variable > to < var_name >

Page 22: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 22

Example of Available Units

The following example gets the current number of available resource units in the resource container cust_cont and assigns this number to the integer variable num_units

define num_units of type integer...assign available units of cust_cont to num_units

Page 23: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 23

Machine Parts-Replacement Model

There are several machines in a shop. Each machine has parts have fail

periodically. When a part fails, it needs to be replaced for

a replacement part by the operator. A repairman repairs the faulty parts

Page 24: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 24

Processes in the Model

The shop has several machines and a single repairman.

Several objects of class Machine are created

Only one object of class Repairman is created

Page 25: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 25

Resource Containers in the Model

Two container objects are defined and created

A container for the parts that failed, called fault_parts

A container for the repaired parts (replacement parts), called rep_parts

Page 26: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 26

Machine Behavior

A machine operates normally for a finite time interval until a part fails

An operator removes the damaged part, places it in the fault_parts container

The operator takes a replacement part from the rep_parts container and installs the part on the machine

Page 27: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 27

Simplified Machine Operation

Page 28: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 28

Repairman Behavior

1. The repairman takes a damaged part from the fault_parts container

2. After repairing the part during finite period, the repairman places it in the rep_parts container

3. The repairman carries out background jobs when the fault_parts container is empty

Page 29: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 29

Simplified Repairman Operation

Page 30: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 30

Page 31: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

(C) J. M. Garrido 31

Simulation Results

Average machine down period (not operational)

Average machine up period (operational) Average machine utilization Repairman utilization (?)

Page 32: (C) J. M. Garrido1 Object Oriented Simulation with OOSimL Detachable Resources Fall 2015.

Partial Output of a Simulation Run

End Simulation of Machine Parts Replacement System

date: 11/28/2014 time: 11:34 Total machines serviced: 3Average down period: 15.29999Average up period: 2782.1547Average machine utilization: 0.7273

(C) J. M. Garrido 32


Recommended