بچه های کامپیوتر همدان - ورودی ۸۴

این وبلاگ به تمام برو بچز باحال کامپیوتر همدان تعلق داره ..

بچه های کامپیوتر همدان - ورودی ۸۴

این وبلاگ به تمام برو بچز باحال کامپیوتر همدان تعلق داره ..

کلیه مثالهای سایت ‌ MinutemanSoftware

1. TURNSTIL.GPS

Simulation of a turnstile at a football stadium.

Problem Statement

Spectators arrive at a turnstile of a football stadium every 7±7 seconds and queue for admittance. The time to pass through is evenly distributed at 5±3 seconds.A model is required to determine the time taken by 300 people to pass through the turnstile.

Listing
In_use EQU 5 ;Mean time
Range EQU 3 ;Half range

        GENERATE  7,7           ;People arrive
        QUEUE     Turn          ;Enter queue
        SEIZE     Turn          ;Acquire turnstile
        DEPART    Turn          ;Depart the queue
        ADVANCE   In_use,Range  ;Use turnstile
        RELEASE   Turn          ;Leave turnstile
        TERMINATE 1             ;One spectator enters

**************************************************************

2. TELEPHON.GPS

Simulation of a simple telephone system.

A simple telephone system has two external lines. Calls, which originate externally, arrive every 100±60 seconds. When the line is occupied, the caller redials after 5±1 minutes have elapsed. Call duration is 3±1 minutes. A tabulation of the distribution of the time each caller takes to make a successful call is required. How long will it take for 200 calls to be completed?

Listing

* Simple Telephone Simulation 
* Time Unit is one minute 
Sets STORAGE 2
Transit TABLE M1,.5,1,20 ;Transit times
GENERATE 1.667,1 ;Calls arrive
Again GATE SNF Sets,Occupied ;Try for a line
ENTER Sets ;Connect call
ADVANCE 3,1 ;Speak for 3+/-1 min
LEAVE Sets ;Free a line
TABULATE Transit ;Tabulate transit time
TERMINATE 1 ;Remove a Transaction
Occupied ADVANCE 5,1 ;Wait 5 minutes
TRANSFER ,Again ;Try again
**************************************************************

3. PERIODIC.GPS

Simulation of inventory with periodic review.A finished product inventory is controlled by means of a weekly periodic review system. The initial stock is 1000 units. The daily demand varies between 40 and 63 units with equal probability. The target inventory is 1000 units, that is, the order is placed for the difference between the current stock and 1000 units. If the current stock is 800 or more, no order is placed for that week. The company operates a five-day week. The lead time for delivery of an order is one week.

Simulate the inventory system for 200 days and determine if any stockouts occur.

Listing

* Definitions of non Block entities
RMULT 39941
Stock STORAGE 10000 ;Warehouse can hold 10000
Stock TABLE S$Stock,100,100,20 ;Table for inventory amts
Orderqty VARIABLE Target-S$Stock ;Order quantity
Demand VARIABLE RN1@24+40 ;Daily demand
Target EQU 1000 ;Initial stock level
Reorder EQU 800 ;Reorder point
***********************************************************************
* The reorder process
        GENERATE  5,,,,1       ;Review xact, Priority=1
        TEST L    S$Stock,Reorder,Skip ;Is stock < Reorderpt
        ASSIGN    2,V$Orderqty ;Parameter 2=Order quantity
Custwait ADVANCE  5            ;Lead time is 5 days
        ENTER     Stock,P2     ;Stock increases by P2
Skip    TERMINATE              ;Ordering xact is finished
***********************************************************************
* The daily demand decrements quantity on hand
        GENERATE  1            ;Daily demand Transaction
        ASSIGN 1,V$Demand      ;Parameter 1(P1)=daily demand
        TABULATE  Stock        ;Record daily stock
        TEST GE   S$Stock,P1,Stockout ;Can order be filled
        LEAVE     Stock,P1     ;Remove demand from stock
        TERMINATE 1            ;Daily timer
Stockout TERMINATE 1           ;Daily timer
***********************************************************************
* Initialize the inventory
        GENERATE ,,,1,10       ;Set initial stock
        ENTER     Stock,Target ;Set init stock level=target
        TERMINATE              ;Xact is terminated
*********************************************************************

4. TVREPAIR.GPS

Simulation of a television repair shop.

A television shop employs a single repairman to overhaul its rented television sets, service customers’ sets and do on-the-spot repairs. Overhaul of company owned television sets commences every 40±8 hours and takes 10±1 hours to complete. On-the-spot repairs, such as fuse replacement, tuning and adjustments are done immediately. These arrive every 90±10 minutes and take 15±5 minutes. Customers’ television sets requiring normal service arrive every 5±1 hours and take 120±30 minutes to complete. Normal service of television sets has a higher priority than the overhaul of company owned, rented sets.

1. Simulate the operation of the repair department for 50 days.

2. Determine the utilization of the repairman and the delays in the service to customers.

Listing

; GPSS World Sample File - TVREPAIR.GPS, by Gerard F. Cummings
*****************************************************************
* Television Maintenance Man Model *
*****************************************************************
* Repair of rented sets, one each week *
* Time unit is one minute *
*****************************************************************
        GENERATE  2400,480,,,1 ;Overhaul of a rented set
        QUEUE     Overhaul     ;Queue for service
        QUEUE     Alljobs      ;Collect global statistics
        SEIZE     Maintenance  ;Obtain TV repairman
        DEPART    Overhaul     ;Leave queue for man
        DEPART    Alljobs      ;Collect global statistics
        ADVANCE   600,60       ;Complete job 10+/-1 hours
        RELEASE   Maintenance  ;Free repairman
        TERMINATE              ;Remove one Transaction
*****************************************************************
* On the spot repairs
        GENERATE  90,10,,,3    ;On-the-spot repairs
        QUEUE     Spot         ;Queue for spot repairs
        QUEUE     Alljobs      ;Collect global statistics
        PREEMPT   Maintenance,PR ;Get the TV repairman
        DEPART    Spot         ;Depart the ‘spot’ queue
        DEPART    Alljobs      ;Collect global statistics
        ADVANCE   15,5         ;Time for tuning/fuse/fault
        RETURN    Maintenance  ;Free maintenance man
        TERMINATE
****************************************************************
* Normal repairs on customer owned sets
        GENERATE  300,60,,,2   ;Normal TV Repairs
        QUEUE     Service      ;Queue for service
        QUEUE     Alljobs      ;Collect global statistics
        PREEMPT   Maintenance,PR ;Preempt maintenance man
        DEPART    Service      ;Depart the ‘service’ queue
        DEPART    Alljobs      ;Collect global statistics
        ADVANCE   120,30       ;Normal service time
        RETURN    Maintenance  ;Release the man
        TERMINATE
*****************************************************************
        GENERATE  480          ;One xact each 8 hr. day
        TERMINATE 1            
* Day counter
*****************************************************************
* Tables of queue statistics
Overhaul QTABLE Overhaul,10,10,20
Spot QTABLE Spot,10,10,20
Service QTABLE Service,10,10,20
Alljobs QTABLE Alljobs,10,10,20
****************************************************************

5. QCONTROL.GPS

Simulation of a quality control system.

Problem Statement

A component is manufactured by a sequence of three processes, each followed by a short two minute inspection. The first process requires 20% of components to be reworked. The second and third processes require 15% and 5% of components reworked, respectively. Sixty percent of components reworked are scrapped and the remaining forty percent need reprocessing on the process from which they were rejected.

Manufacturing of a new component commences on average, every 30 minutes, exponentially distributed. The time for the first process is given by the following table.

Time For First Process

Frequency         .05     .13     .16     .22     .29     .15
Process time       10     14      21   32     38    45

The second process takes 15±6 minutes and the final process time is normally distributed with a mean of 24 minutes and a standard deviation of 4 minutes.

1. Simulate the manufacturing processes for 100 completed components.

2. Determine the time taken, and the number of components rejected.

Listing

*****************************************************************
RMULT 93211
* Definitions
Transit TABLE M1,100,100,20 ;Transit Time
Process FUNCTION RN1,D7
0,0/.05,10/.18,14/.34,21/.56,32/.85,38/1.0,45
*****************************************************************
        GENERATE  (Exponential(1,0,30))
        ASSIGN    1,FN$Process    ;Process time in P1
Stage1  SEIZE     Machine1
        ADVANCE   P1              ;Process 1
        RELEASE   Machine1
        ADVANCE   2               ;Inspection
        TRANSFER  .200,,Rework1   ;20% Need rework
*****************************************************************
Stage2  SEIZE     Machine2
        ADVANCE   15,6            ;Process 2
        RELEASE   Machine2
        ADVANCE   2               ;Inspection
        TRANSFER  .150,,Rework2   ;15% Need rework
*****************************************************************
Stage3  SEIZE     Machine3
        ADVANCE   (Normal(1,24,4)) ;Process 3
        RELEASE   Machine3
        ADVANCE   2               ;Inspection 3
        TRANSFER  .050,,Rework3   ;5% need rework
        TABULATE  Transit         ;Record transit time
        TERMINATE 1
*****************************************************************
Rework1 TRANSFER  .400,,Stage1
        TERMINATE
Rework2 TRANSFER  .400,,Stage2
        TERMINATE
Rework3 TRANSFER  .400,,Stage3
        TERMINATE

6. ORDERPNT.GPS
Simulation of an order point inventory system.

An inventory system is controlled by an order point, set at 600 units, and an economic order quantity of 500 units. The initial stock quantity is 700. Daily demand is in the range 40 to 63 units, evenly distributed. The lead-time from ordering to delivery of goods is one week (5 days)Simulate the inventory system for a period of 100 days.Determine the distribution of inventory and the actual daily sales.

Listing

* Initialize and define
INITIAL X$EOQ,500 ;Economic order qty.
INITIAL X$Point,600 ;Order point
INITIAL X$Stock,700 ;Set initial stock=700
Inventory TABLE X$Stock,0,50,20 ;Table of stock levels
Sales TABLE P$Demand,38,2,20 ;Table of sales levels
Var2 VARIABLE RN1@24+40
*********************************************************************
GENERATE ,,,1
Again TEST L X$Stock,X$Point ;Order placed on successful test
ADVANCE 5 ;Lead time = 1 week
SAVEVALUE Stock+,X$EOQ ;Economic order
TRANSFER ,Again ;Cycle transaction again
*********************************************************************
        GENERATE  1             ;Daily demand xact
        ASSIGN    Demand,V$Var2 ;Assign daily demand
        TABULATE  Inventory     ;Record inventory
        TEST GE   X$Stock,P$Demand ;Make sure order can be filled
        SAVEVALUE Stock-,P$Demand ;Remove demand from stock
        SAVEVALUE Sold,P$Demand ;X$Sold=Daily demand
        TABULATE  Sales         ;Record daily sales
        TERMINATE 1             ;Daily timer
*********************************************************************

7. MANUFACT.GPS

Simulation of an electronics manufacturing system.

A manufacturing department of an electronics company makes digital watches. In the dispatch department, the watches are packed by an automatic packing machine, in display packets, in the quantities ordered by retailers. The order size is given by the following function.

Order Size

Frequency         .10      .25      .30      .15      .12      .05      .03
Order Size          6        12       18       24       30       36       48

The mean time between order arrivals is 15 minutes, exponentially distributed. The packing time per order is 120 seconds plus 10 seconds per watch packed in the order. The manufacturing department produces the digital watches in lot sizes of 60 units, in 455 minutes.

Simulate 5 days of the company operation to provide the following information:

1. The average number of orders waiting in the packing department.

2. The quantity of watches dispatched each day.

3. The distribution of transit times of orders.

Listing

* Time Unit is one hour *
Sizeorder FUNCTION RN1,D7               ;Order size
.10,6/.35,12/.65,18/.80,24/.92,30/.97,36/1.0,48
Transit TABLE    M1,.015,.015,20        ;Transit time
Numbe r TABLE    X1,100,100,20          ;No. packed each day
Ptime   VARIABLE .0028#P1+0.0334        ;Packing time
Amount  EQU      1000                   ;Initial stock amount
Stock   STORAGE  4000                   ;Warehouse holds
                                        ; 4000 units
***********************************************************************
        GENERATE (Exponential(1,0,0.25)) ;Order arrives
        ASSIGN   1,1,Sizeorder          ;P1=order size
        TEST GE  S$Stock,P1,Stockout    ;Is stock sufficient?
        LEAVE    Stock,P1               ;Remove P1 from stock
        QUEUE    Packing
        SEIZE    Machine                ;Get a machine
        DEPART   Packing
        ADVANCE  V$Ptime                ;Packing time
        RELEASE  Machine                ;Free the machine
        SAVEVALUE 1+,P1                ;Accumulate no. packed
        TABULATE Transit               ;Record transit time
        TERMINATE
Stockout TERMINATE
***********************************************************************
        GENERATE  0.75,0.08334,1       ;Xact every 40+/-5 mins
        ENTER     Stock,60             ;Make 60, Stock
                                       ; increased by 60
Stockad TERMINATE
***********************************************************************
        GENERATE  8                   ;Xact every day
        TABULATE  Number
        SAVEVALUE 1,0
        TERMINATE 1
*********************************************************************
        GENERATE  ,,,1,10             ;Initial stock xact
        ENTER     Stock,Amount        ;Set initial stock
        TERMINATE
***********************************************************************

8. TEXTILE.GPS

Simulation of a textile factory.

A textile factory produces fine mohair yarn in three departments. The first department draws and blends the raw material, in sliver form, and reduces it to a suitable thickness for spinning, in 5 reducer frames. The second department spins the yarn in one of 40 spinning frames. The final process is in the winding department, where the yarn is wound from spinning bobbins onto cones for dispatch. There are 8 winding frames, to perform the winding operation.The factory works 8 hours per day. The unit of production is 10 kilograms of yarn. Reducing frames produce one unit every 38±2 minutes, while the spinning frames and winding frames produce one unit in 320±20 minutes and 64±4 minutes, respectively.The initial inventory of reduced material is 50 units (in Savevalue Reduced), spun material is 25 units (in Savevalue Spun) and finished yarn is 25 units (in Savevalue Wound). The finished material is dispatched, in a container of capacity 200 units, every two days.

1. Simulate the production process in the textile factory for 5 days

2. Find the distribution of the in-process inventories.

3. Determine the utilization of each of the three types of machines.

Listing

Reducers STORAGE 5 ;Represents 5 reducer frames
Spinners STORAGE 40 ;Represents 40 spinning frames
Winders STORAGE 8 ;Represents 8 winding frames
Reducing TABLE X$Reduced,20,20,20 ;Inventory reduced material
Spinning TABLE X$Spun,20,20,20 ;Inventory spun material
Winding TABLE X$Wound,20,20,20 ;Inventory wound material
INITIAL X$Reduced,50
INITIAL X$Spun,25
INITIAL X$Wound,25
**********************************************************************
        GENERATE  0.334,,1    ;Time unit is one hour
        QUEUE     One         ;Enter queue for reducing
        ENTER     Reducers    ;Get a machine
        DEPART    One         ;Depart the queue
        ADVANCE   0.634,0.334 ;Process time
        LEAVE     Reducers    ;Leave the machine
*********************************************************************
        SAVEVALUE Reduced+,1  ;Reduced inventory up by 1
        QUEUE     Two         ;Queue for spinning process
        ENTER     Spinners    ;Get a spinning machine
        DEPART    Two         ;Depart the queue
        ADVANCE   5.334,0.334 ;Process time
        LEAVE     Spinners    ;Free a machine
        SAVEVALUE Reduced-,1  ;Reduced inventory down 1
*********************************************************************
        SAVEVALUE Spun+,1     ;Spun inventory up by one
        QUEUE     Three       ;Queue for winding process
        ENTER     Winders     ;Get a winding machine
        DEPART    Three       ;Depart the queue
        ADVANCE   1.067,0.067 ;Process time
        LEAVE     Winders     ;Free a winding machine
        SAVEVALUE Spun-,1     ;Spun inventory down by 1
*********************************************************************
        SAVEVALUE Wound+,1    ;Wound inventory up by 1
        TERMINATE             ;Xact is finished
*********************************************************************
        GENERATE  8           ;One xact every day
        TABULATE  Reducing    ;Record inventory of
                              ; process
        TABULATE  Spinning    ;Record inventory of spun
                              ; material
        TABULATE  Winding     ;Record inventory of wound
                              ; material
        TERMINATE 1           ;One day has passed
***********************************************************************
        GENERATE 16           ;A xact every 2 days
        TEST GE   X$Wound,200,Notthere ;If not done don’t dispatch
        SAVEVALUE Wound-,200  ;200 Kgs produce delivered
        TERMINATE             ;Xact is finished
Notthere TERMINATE            ;Xact is finished
*********************************************************************
 

9. OILDEPOT.GPS

Simulation of an Oil Storage Depot.

An oil storage depot distributes three grades of fuel, a) home heating oil, b) light industrial fuel oil, and c) diesel fuel for road vehicles. There is one pump for each grade of fuel, and the demand for each is the same. Orders for fuel oil vary between 3000 and 5000 gallons, in increments of 10 gallons, evenly distributed. The time required to fill fuel trucks is a function of the following.

1. The pumping rate (6, 5 and 7 minutes per 1000 gallons respectively).

2. The order size.

3. The number of vehicles in the depot (30 seconds extra per vehicle).

4. Setup time, a fixed time of two minutes.

The depot can hold a maximum of twelve trucks. The mean arrival rate of trucks is 18 minutes, modified by the following function.

Truck Arrival Rates

Frequency        .20   .40   .25   .15
Ratio to mean    .45   .60   1.5   2.0

1. Simulate the operation of the oil storage depot for 5 days.

2. Find the distribution of transit times of trucks.

3. What is the total quantity of fuel sold each day?

Listing

; GPSS World Sample File - OILDEPOT.GPS, by Gerard F. Cummings
****************************************************************
* Oil Storage and Distribution Depot 
* Time Unit Is One Minute 
****************************************************************
RMULT 5631,39941
Arr FUNCTION RN2,C5             ;Arrivals frequency
0,0/0.2,.45/.6,1/.85,1.5/1.0,2
Pumprate FUNCTION P$Type,L3 ;Mins to pump 1000 gals
1,6/2,5/3,7
Gals VARIABLE (RN1@201+300)#10
Type VARIABLE RN1@3+1
Pump VARIABLE (FN$Pumprate#P$Gals)/1000+S$Depot/2+2
Depot   STORAGE   12            ;Room for 12 trucks max
Transit TABLE M1,10,10,20       ;Time of truck in depot
Qty TABLE X$Gals,20000,20000,9  ;Qty of oil sold per day
****************************************************************
        GENERATE  18,FN$Arr     ;Truck arrivals
        ASSIGN    Gals,V$Gals   ;P$Gals=Number of gals
        ASSIGN    Type,V$Type   ;P$Type=Type of oil
        ENTER     Depot         ;Truck enters depot
        QUEUE     P$Type        ;Queue for type of oil
        SEIZE     P$Type        ;Get a pump
        DEPART    P$Type        ;Depart the queue
        ADVANCE   V$Pump        ;Service time pumping
        RELEASE   P$Type        ;Release the pump
        LEAVE     Depot         ;Truck leaves the depot
        SAVEVALUE Gals+,P$Gals  ;Tally no. of gals sold
        TABULATE  Transit       ;Table of transit times
        TERMINATE               ;Truck departs
****************************************************************
        GENERATE  480           ;One transaction per day
        TABULATE  Qty           ;Record no. of gals sold
        SAVEVALUE Sold+,X$Gals  ;Record total oil sold
        SAVEVALUE Gals,0        ;Savevalue set to 0
        TERMINATE 1             ;One day has passed
****************************************************************

10. ASSEMBLY.GPS

Simulation of a pump assembly process.

A manufacturer makes centrifugal pump units which are assembled to customer orders. The orders arrive on average, every 5 hours, exponentially distributed. When the order arrives, two copies are made. The original order is used to obtain a motor from stock and prepare it for assembly (200±100 minutes). The first copy is used to order and adapt a pump (180±120 minutes), and the second copy is used to initiate the manufacture of the baseplate (80±20 minutes).

When the pump and the baseplate are ready, a test fitting is carried out (50±10 minutes). All three components are assembled, when they are available. The unit is then dismantled, and the pump and motor are painted, and the baseplate is galvanized. Final assembly then takes place (150±30 minutes).

1. Investigate the utilization of the manufacturing facilities.

2. Determine the transit times and delays, of customers’ orders.

3. What Facility will be a bottleneck, if orders increase significantly?

4. Simulate the assembly of 50 motor-pump units.

Listing

; GPSS World Sample File - ASSEMBLY.GPS, by Gerard F. Cummings
***********************************************************************
* Assembly of Motor Pump and Baseplate 
***********************************************************************
Transit TABLE M1,200,200,20
***********************************************************************
        GENERATE  (Exponential(1,0,300)) ;New order arrives
        SPLIT     2,Factory,1   ;Make 2 copies of order
***********************************************************************
* Purchase Motor Original Transaction Goes Here, P1=1
        QUEUE     Motor         ;Queue for motor
        SEIZE     Motor         ;Get a Facility
        DEPART    Motor         ;Depart the queue
        ADVANCE   200,100       ;Take motor from stock
        RELEASE   Motor         ;Free the Facility
        TRANSFER  ,Tryout       ;Send to trial assembly
***********************************************************************
Factory TEST E    P1,2,Baseplate ;Is P1=2 ?
        QUEUE     Pumps         ;Join the Queue (P1=2)
        SEIZE     Pumps         ;Get a Facility
        DEPART    Pumps         ;Depart the Queue
        ADVANCE   180,120       ;Prepare the Pump
Pump    MATCH     Plate         ;Wait for baseplate
        ADVANCE   50,10         ;Check pump on baseplate
        RELEASE   Pumps         ;Free the Facility
        TRANSFER  ,Tryout       ;Send for a tryout
***********************************************************************
Baseplate QUEUE   Base          ;Join Queue P1 must=3
        SEIZE     Base          ;Get a Facility
        DEPART    Base          ;Depart the Queue
        ADVANCE   80,20         ;Make the baseplate
Plate   MATCH     Pump          ;Wait for the pump unit
        ADVANCE   50,10         ;Check the pump on baseplate
        RELEASE   Base          ;Free the Facility
***********************************************************************
Tryout  GATHER    3             ;Gather 3 units to tryout
        ADVANCE   60            ;Trial assembly
        TEST E    P1,1,Finish   ;Is it the motor?(P1=1)
***********************************************************************
        SEIZE     Paint1        ;Get first paint Facility
        ADVANCE   100,20        ;Paint the motor
        RELEASE   Paint1        ;Free paint Facility 1
        TRANSFER  ,Build        ;Send for assembly
***********************************************************************
Finish  TEST E    P1,2,Basplate ;Is it the pump?(P1=2)
        SEIZE     Paint2        ;Get paint Facility 2
        ADVANCE   120,30        ;Paint the Pump
        RELEASE   Paint2        ;Free paint Facility 2
        TRANSFER  ,Build        ;Send for assembly
Basplate SEIZE    Galvanize     ;Get a Facility
        ADVANCE   120,30        ;Galvanize baseplate
        RELEASE   Galvanize     ;Free the Facility
***********************************************************************
Build   ASSEMBLE  3             ;Collect 3 units
        ADVANCE   150,30        ;Assemble unit
        TABULATE  Transit       ;Record transit time
        TERMINATE 1             ;One unit completed

11. ROBOTFMS.GPS

Simulation of a robot operated FMS.

An experimental, robot operated, flexible manufacturing system has two computer numerical control machine tools, an arrival area, and a finished parts area. Components arrive every 150 seconds, exponentially distributed, and are machined on both machines in sequence. The robot takes 8±1 seconds to grip or release components, and 6 seconds to move components from the arrival area to the first machine. Processing time, on the first machine is normally distributed, with a mean of 60 seconds and a standard deviation of 10 seconds. The robot takes 7 seconds, to move from the first machine to the second machine. Machining time on the second machine is 100 seconds, exponentially distributed. Finally, the robot takes 5 seconds, to move components from the second machine, to the finished parts storage area.

Simulate the manufacturing cell operation, for 75 completed parts.

1. Find the distribution of transit times of jobs.

2. Find the utilization of the robot, and the machine tools.

3. Find the maximum storage areas required, in the cell.

Listing

; GPSS World Sample File - ROBOTFMS.GPS, by Gerard F. Cummings
* Experimental Manufacturing Cell 
* Two CNC machines and one Robot
* One arrival area and one finished parts area
*******************************************************************
RMULT 78863
Transit TABLE M1,100,100,20 ;Record lead time
*******************************************************************
        GENERATE (Exponential(1,0,150)) ;A job arrives
        QUEUE     One           ;Arrival queue
        SEIZE     Robot         ;Get the robot
        DEPART    One           ;Depart the queue
        ADVANCE   8,1           ;Robot grips the job
        ADVANCE   6             ;Robot moves to machine 1
        ADVANCE   8,1           ;Robot place the job
        RELEASE   Robot         ;Free the robot
        QUEUE     Two           ;Wait in next queue
        SEIZE     Machine1      ;Get first machine
        DEPART    Two           ;Depart the queue
        ADVANCE   (Normal(1,60,10)) ;Process time
        RELEASE   Machine1      ;Free machine 1
        QUEUE     Three         ;Join queue for machine 2
        SEIZE     Robot         ;Get the robot
        DEPART    Three         ;Depart the queue
        ADVANCE   8,1           ;Robot grips part
        ADVANCE   7             ;Robot moves to machine 2
        ADVANCE   8,1           ;Robot places the part
        RELEASE   Robot         ;Free the robot
        QUEUE     Four          ;Join queue machine 2
        SEIZE     Machine2      ;Get machine 2
        DEPART    Four          ;Depart the queue
        ADVANCE   (Exponential(1,0,100)) ;Process 2
        RELEASE   Machine2      ;Free machine 2
        QUEUE     Five          ;Queue for exit station
        SEIZE     Robot         ;Get the robot
        DEPART    Five          ;Depart the queue
        ADVANCE   8,1           ;Robot grips the part
        ADVANCE   5             ;Robot moves to exit
        ADVANCE   8,1           ;Robot places the part
        RELEASE   Robot         ;Free the robot
        TABULATE  Transit       ;Transit time
        TERMINATE 1             ;Job is completed
*******************************************************************

12. BICYCLE.GPS

Simulation of a bicycle factory.

A factory assembles bicycles, employing the following staff, 2 clerks, 3 framers, 1 saddler, 1 handler, 1 wheeler, 1 pedaler, 4 assemblers, and 3 packers. The company commences to assemble a bicycle, every 50±10 minutes. The clerical department prepares the delivery documents, instructions, tool kit and invoice.

Each department withdraws the component required for a particular order from stock, inspects (3±1 minutes) and prepares it for assembly. The frame is manufactured and takes 65 minutes, exponentially distributed. When the components are available, they are assembled. This takes on average 90 minutes, with a standard deviation of 10 minutes. When the delivery documents, tool kit, and the assembled bicycle, are ready, they are packed (40±5 minutes), in preparation for delivery.

1. Find the utilization of the staff in each department.

2. Determine the transit times of customers’ orders.

3. Should the number of staff be changed in any department?

4. Simulate the bicycle factory assembly operation, for 5 days.

 Listing

* Bicycle Assembly Model 
*********************************************************************
Orders FUNCTION P$Department,L6
1,Order/2,Frame/3,Saddle/4,Handlebars/5,Wheels/6,Pedals
*********************************************************************
Transit TABLE M1,100,100,20
*********************************************************************
Clerks STORAGE 2
Framers STORAGE 3
Saddlers STORAGE 1
Handlers STORAGE 1
Wheelers STORAGE 1
Pedalers STORAGE 1
Builders STORAGE 4
Packers STORAGE 3
*********************************************************************
        GENERATE  50,10         ;Order arrives for bicycle
        SPLIT     5,Factory,Department ;Make 5 copies of order
Order   ENTER     Clerks
        ADVANCE   80,10         ;Prepare invoice
        LEAVE     Clerks
Invoice MATCH     Bicycle       ;Synchronize with bicycle
        TERMINATE               ;Transaction finished
*********************************************************************
Factory TRANSFER  FN,Orders     ;Route to correct dept.
*********************************************************************
Frame   ENTER     Framers
        ADVANCE   (Exponential(1,0,65)) ;Make frame
        ADVANCE   12,2          ;Inspect frame
        LEAVE     Framers
        TRANSFER  ,Build        ;Send for assembly
*********************************************************************
Saddle  ENTER     Saddlers
        ADVANCE   6,3           ;Get a saddle
        ADVANCE   3,1           ;Inspect the saddle
        LEAVE     Saddlers
        TRANSFER  ,Build        ;Send for assembly
*********************************************************************
Handlebars ENTER Handlers
        ADVANCE   4,2           ;Get handlebars
        ADVANCE   3,1           ;Inspect handlebars
        LEAVE     Handlers
        TRANSFER  ,Build        ;Send for assembly
*********************************************************************
Wheels  ENTER     Wheelers
        ADVANCE   3,1           ;Get wheels
        ADVANCE   3,1           ;Inspect wheels
        LEAVE     Wheelers
        TRANSFER  ,Build        ;Send for assembly
*********************************************************************
Pedals  ENTER     Pedalers
        ADVANCE   5,1           ;Get pedals
        ADVANCE   3,1           ;Inspect pedals
        LEAVE     Pedalers
        TRANSFER  ,Build        ;Send for assembly
*********************************************************************
Build   ASSEMBLE  5             ;Assemble
        ENTER     Builders
        ADVANCE   (Normal(1,90,10)) ;Time for assembling
        ADVANCE   35,5          ;Inspect
        LEAVE     Builders
Bicycle MATCH     Invoice       ;Wait for paperwork
        ENTER     Packers
        ADVANCE   40,5          ;Pack for dispatch
        LEAVE     Packers
        TABULATE  Transit
        TERMINATE               ;Transaction finished
*********************************************************************
        GENERATE  480           ;Timer every day
        TERMINATE 1             ;Timer xact finished
*********************************************************************

13. STOCKCTL.GPS

Simulation of a warehouse and branch inventories.

A manufacturing company makes waste disposal units, which it sells for $200 each. Total annual demand is for 20,000 units. Distribution is through three branches, from a factory warehouse. The lead-time for delivery of an order, from the manufacturing plant to the factory warehouse, is 4 weeks. The lead-time for delivery of an order, from the factory warehouse to the branches is 1 week.

The proposed inventory control method is by an economic order quantity and order point system. The initial stocks, order points, economic order quantities, weekly demand and standard deviation, are shown in the table below, for the factory warehouse and each of the branches.

Inventory Control Parameters

Location   Initial    Order  Economic   Weekly   Weekly
            Stock     Point  Quantity   Demand   Std Dev

Warehouse    3400     2100     2300
Branch 1      430      240      115       64       24
Branch 2      600      430      165      128       32
Branch 3     1000      630      200      192       48

Simulate the inventory control system for 75 weeks.

1. Determine the distribution of inventories at the three branches and the factory warehouse.

2. Tabulate the distribution of actual monthly sales.

3. Calculate the average value of the inventories at the branches, and at the factory warehouse.

4. Does the system meet the company’s service policy of one stockout, in eight years?

Listing

; GPSS World Sample File - STOCKCTL.GPS, by Gerard F. Cummings
****************************************************************
* Factory Warehouse and Distributors Inventory 
* Time unit is one week 
****************************************************************
INITIAL X1,3400 ;Fact warehouse inventory
INITIAL X2,2100 ;Fact warehouse order pnt
INITIAL X3,2300 ;Fact warehouse order qty
INITIAL X$Stock1,430 ;Dist 1 stock initial
INITIAL X$Stock2,600 ;Dist 2 stock initial
INITIAL X$Stock3,1000 ;Dist 3 stock initial
INITIAL X$EOQ1,115 ;Economic order qty 1
INITIAL X$EOQ2,165 ;Economic order qty 2
INITIAL X$EOQ3,200 ;Economic order qty 3
INITIAL X$Point1,240 ;Order point 1
INITIAL X$Point2,430 ;Order point 2
INITIAL X$Point3,630 ;Order point 3
Demand1 VARIABLE (Normal(2,64,24))
Demand2 VARIABLE (Normal(3,128,32))
Demand3 VARIABLE (Normal(4,192,48))
Total VARIABLE P1+P2+P3
Sales TABLE X5,200,200,20
Region_1 TABLE X$Stock1,0,40,20
Region_2 TABLE X$Stock2,0,40,20
Region_3 TABLE X$Stock3,0,40,20
Factory TABLE X1,0,200,20
****************************************************************
* Reordering by Factory Warehouse
        GENERATE  ,,,1,2      ;Order point xact
Backhere TEST LE  X1,X2       ;Factory order point?
        ADVANCE   4           ;Lead time is 4 weeks
        SAVEVALUE 1+,X3       ;Inv increase by order qty
        TRANSFER  ,Backhere   ;Cycle xact around
****************************************************************
* Reordering at Each of the Distributors
        GENERATE  1,,,1       ;First distributor
Distr1  TEST L    X$Stock1,X$Point1 ;Order point reached?
        ADVANCE   1           ;Lead time = 1 week
        SAVEVALUE 1-,X$EOQ1   ;Warehouse supplies
        SAVEVALUE Stock1+,X$EOQ1 ;Distr invent increased
        TRANSFER  ,Distr1     ;Xact finished
        GENERATE  1,,,1       ;Second distributor
Distr2  TEST L    X$Stock2,X$Point2 ;Order point reached
        ADVANCE   1           ;Lead time = 1 week
        SAVEVALUE 1-,X$EOQ2   ;Warehouse supplies
        SAVEVALUE Stock2+,X$EOQ2 ;Inventory increased
        TRANSFER  ,Distr2     ;Cycle xact around
        GENERATE  1,,,1       ;Third distributor
Distr3  TEST L    X$Stock3,X$Point3 ;Order point reached?
        ADVANCE   1           ;Lead time = 1 week
        SAVEVALUE 1-,X$EOQ3   ;Warehouse supplies EOQ
        SAVEVALUE Stock3+,X$EOQ3 ;Distr invent increased
        TRANSFER  ,Distr3     ;Cycle xact around
****************************************************************
* Weekly Demand at Each Distributor
        GENERATE  1,,,,3      ;Priority weekly demand
        ASSIGN    1,V$Demand1 ;P1 = Demand distr one
        ASSIGN    2,V$Demand2 ;P2 = Demand distr two
        ASSIGN    3,V$Demand3 ;P3 = Demand distr three
        SAVEVALUE Stock1-,P1  ;Distr 1 Weekly demand
        SAVEVALUE Stock2-,P2  ;Distr 2 Weekly demand
        SAVEVALUE Stock3-,P3  ;Distr 3 Weekly demand
        SAVEVALUE 5+,V$Total  ;Accumulate total demand
        TABULATE  Region_1    ;Record invent distr 1
        TABULATE  Region_2    ;Record invent distr 2
        TABULATE  Region_3    ;Record invent distr 3
        TABULATE  Factory     ;Factory warehouse invent
        TERMINATE 1
****************************************************************
* Monthly Recording of Sales
        GENERATE  4,,,,1      ;Low priority xact monthly
        TABULATE  Sales
        SAVEVALUE 5,0         ;Reset sales=0 each month
        TERMINATE             ;Xact finished
****************************************************************

14. LOCKSIMN.GPS

Lock and Canal Simulation.

A single lock and narrow canal system joins two navigable waterways. The barge traffic is heavy between the two waterways, and the canal system can take only one barge at a time. The first barge in a particular direction takes 58 minutes, and subsequent barges in the same direction take 46 minutes.

The lock operator has a policy of one-up barge followed by one-down barge.

It has been suggested that a policy of up to six up, followed by up to six down might be more efficient.

Simulate the operation of the lock and canal with the new policy.

Listing

; GPSS World Sample File - LOCKSIMN.GPS, by Gerard F. Cummings
**********************************************************************
* Lock Simulation *
* Time in Hours *
**********************************************************************
* X$Uplimit = Number of barges to go up
* X$Downlimit = Number of barges to go down
* X$Upcount = Number of barges which have passed up
* X$Downcount = Number of barges which have passed down
*
RMULT 94521
Upbarge FUNCTION X$Upcount,D6
1,.967/2,.767/3,.767/4,.767/5,.767/6,.767
Downbarge FUNCTION X$Downcount,D6
1,.967/2,.767/3,.767/4,.767/5,.767/6,.767
Upq QTABLE Upq,.25,.25,20
Downq QTABLE Dnq,.25,.25,20
Upcount TABLE X$Upcount,2,2,20
Dncount TABLE X$Downcount,2,2,20
INITIAL X$Uplimit,6 ;No. of barges to go up
INITIAL X$Downlimit,6 ;No. of barges to go down
**********************************************************************
        GENERATE  1.67,.5,.67     ;Up barge arrives
        QUEUE     Upq             ;Join queue
        GATE LR   Lock            ;Gate for the lock
        SEIZE     Lock            ;Get the lock
        SAVEVALUE Upcount+,1      ;Accumulate up number
        DEPART    Upq             ;Depart the queue
        ADVANCE   FN$Upbarge      ;Time to service barge
        TEST GE   X$Uplimit,X$Upcount,Swh1 ;Have enough passed?
        TEST NE   Q$Upq,0,Swh1    ;Check if Upq is zero
        RELEASE   Lock            ;Free the lock
        TERMINATE
**********************************************************************
Swh1    LOGIC S   Lock            ;Set lock the other way
        RELEASE   Lock            ;Free the lock
        TABULATE  Upcount         ;Record no. passed up
        SAVEVALUE Upcount,0       ;Set count to zero
        TERMINATE
**********************************************************************
        GENERATE  1.67,.5,1       ;Arrival of down barge
        QUEUE     Dnq             ;Enter queue
        GATE LS   Lock            ;Is lock set?
        SEIZE     Lock            ;Get the lock
        SAVEVALUE Downcount+,1    ;Accumulate down count
        DEPART    Dnq             ;Depart the queue
        ADVANCE   FN$Downbarge    ;Time for down barge
        TEST GE   X$Downlimit,X$Downcount,Swh2 ;Down count reached?
        TEST NE   Q$Dnq,0,Swh2    ;Any down barges left?
        RELEASE   Lock            ;Free the lock
        TERMINATE
**********************************************************************
Swh2    LOGIC R   Lock           ;Set lock for other way
        RELEASE   Lock           ;Free the lock
        TABULATE  Dncount        ;Record down count

15. FOUNDRY.GPS

Foundry Simulation

A foundry employs 18 molders to process incoming orders which arrive on average every hour, exponentially distributed. The foundry runs on an eight hour day, five day week schedule. Thirty percent of incoming orders are new and seventy percent are repeat orders. New orders require a pattern, which is made in the pattern shop taking 72±24 hours, uniformly distributed. Patterns for repeat orders must be located and cleaned and take 5±3 hours.

Orders vary in size from 6 to 24 components, uniformly distributed. The weight of the individual components varies according to the following table.

Weight Distribution

Frequency       .05  .08  .12  .25  .20  .15  .10  .05

Weight of Part    3    6   11   20   28   35   42   50

Molding time is 2 minutes per kilogram weight of component. The due date for orders is determined by the total molding time plus a variable flowtime which typically ranges from 40 to 160 hours, uniformly distributed.

The foreman waits until the pattern is available for an order. Then he releases one job at a time according to due-date. One individual molder completes the entire order.

Casting takes place once a day, one hour before finishing time. When casting commences all molders cease molding and assist in the casting process.

1. Write a GPSS World model to simulate the operation of the foundry.

2. Run the simulation for 10 days.

3. Find the distribution of transit times of all jobs.

4. Tabulate the total weight cast each day.

Listing

; GPSS World Sample File - FOUNDRY.GPS, by Gerard F. Cummings
***********************************************************************
*
* Foundry Simulation Model
* Time Unit Is One Minute 
*
***********************************************************************
* P1 = Type of Job
* P2 = Number in the Order
* P3 = Weight of a Component
* P4 = Molding Time per Component
* P5 = Due Date
* P6 = Total Weight per Order
* P7 = Index for Looping
Weight FUNCTION RN1,C8 ;Weight per component in Kgs
0.0,3/.13,6/.25,11/.50,20/.70,28/.85,35/.95,42/1.0,50
Ordertype FUNCTION RN1,D2 ;New order P1=1: Repeat P1=2
0.3,1/1.0,2
Size VARIABLE RN1@19+6 ;Size of order
Ddate VARIABLE V$Mtime#P2+RN1@121+40+C1 ;Due date
Mtime VARIABLE (P3#2) ;Mold time per component
Day VARIABLE (C1/480) ;Day indicator
Total VARIABLE P3#P2 ;Weight per order
Times TABLE M1,400,400,20 ;Transit time
Cast TABLE X$Wtmold,400,400,20 ;Weight cast
Molders STORAGE 18 ;Molders employed
***********************************************************************
        GENERATE  (Exponential(1,0,60)) ;Jobs arrive every hour
        ASSIGN    1,FN$Ordertype ;Type of job
        TEST E    P1,2,Newjob   ;Is it a repeat order?
        ADVANCE   300,180       ;Locate pattern
Commence ASSIGN   2,V$Size      ;Size of order
        ASSIGN    3,FN$Weight   ;Weight of component
        ASSIGN    4,V$Mtime     ;Molding time per component
        ASSIGN    5,V$Ddate     ;Due date
        ASSIGN    6,V$Total     ;Total weight of order
        GATE SNF  Molders,Wait  ;Any molders free?
Beg     ENTER     Molders       ;Molder begins order
        ASSIGN    7,P2          ;P7=Number in order
Next    ADVANCE   P4            ;Molding time per component
        LOOP      7,Next        ;Loop for every component
        LEAVE     Molders       ;Free molder, order complete
        SAVEVALUE Wtmold+,P6    ;Sum weight molded each order
        UNLINK    1,Beg,1       ;Release next order
        TABULATE  Times         ;Tabulate transit time
        TERMINATE               ;Destroy xact
*
Newjob  ADVANCE   4320,1440     ;Time to make new pattern
        TRANSFER  ,Commence     ;Transfer to commence order
*
Wait    LINK      1,P5          ;Link waiting orders in chain 1
*
***********************************************************************
        GENERATE  420,,,1,2     ;Start casting operation cycle
Again   SUNAVAIL  Molders       ;Marks start of casting cycle
        ADVANCE   60            ;Casting cycle lasts 60 mins
        SAVAIL    Molders       ;Molders free for molding
        ADVANCE   420           ;420 mins elapse before casting
        TABULATE  Cast          ;Record total weight cast
        SAVEVALUE Totcast+,X$Wtmold ;Accumulate total cast so far
        SAVEVALUE Wtmold,0      ;Reset to zero each day
        TRANSFER  ,Again        ;Return xact to start again
**************Timer****************************************************
        GENERATE  4800,,,,4     ;Xact every ten days
        SAVEVALUE V$Day,X$Totcast ;Records total weight cast
        TERMINATE 1             ;Destroy xact
*********************************************************************
 

16. TAPEPREP.GPS

Simulation of NC tape preparation.

A computer services company prepares computer numerical control part program tapes for metal-cutting manufacturing industries. Drawings of components are supplied by the manufacturers. A part programmer studies the drawings, and writes a part program manuscript to control the machine tool in cutting the workpiece. The programming takes 90 minutes, exponentially distributed. The manuscript is then typed onto a computer file, processed, and a tape is punched for the computer numerical control machine tool. This process takes 60 minutes on average, exponentially distributed. The tape is then loaded onto an appropriate machine tool for testing and editing. This process takes 70 minutes, exponentially distributed.

The computer services company’s policy is to provide a fast, reliable service to industry. The company wishes to test several queuing disciplines for the processing of orders for the best overall service to customers.

Three possible disciplines of processing waiting jobs have been proposed.

1. First, process those jobs which have the shortest overall processing time.

2. First, process those jobs which have the longest overall processing time.

3. First, process the jobs which have the shortest due-date i.e. those jobs which are required soonest.

The flowtime for jobs is the total processing times (P4=P1+P2+P3), plus 3±1 days. The due-date is the relative clock time when the job arrives plus the allowed flow-time. Lateness is defined as the relative clock time when the job is completed, minus the due-date.

Simulate the processing of 100 orders by the computer services company.

1. Investigate the shortest processing time queue discipline.

2. Find the utilization of the facilities of manuscript writing, tape preparation, and editing.

3. Tabulate the lateness of orders and their transit times. 

Listing

* Computer Numerical Control *
* Tape Programming, Loading and Editing *
*********************************************************************
* Queue Discipline — Shortest Processing Time (SPT)
*********************************************************************
* P1 = Process Time for Programming
* P2 = " " " Punching
* P3 = " " " Editing
* P4 = Shortest Processing Time
* P5 = Due Date
* P6 = Longest Processing Time
*********************************************************************
RMULT 66753
Schedparm EQU 4 ;Start with short time
; process first
Var1 VARIABLE P1+P2+P3
Var2 VARIABLE P4+AC1+RN1@160+80
Var3 VARIABLE 10000-P4
Lateness VARIABLE AC1-P5
Transit TABLE M1,100,100,20 ;Tabulate flow times
Late TABLE V$Lateness,-1000,200,20 ;Lateness
*********************************************************************
        GENERATE  (Exponential(2,0,120)) ;Create new arrivals
        ASSIGN    1,(Exponential(3,0,90) ;Programming time
        ASSIGN    2,(Exponential(4,0,60)) ;Tape punching time
        ASSIGN    3,(Exponential(5,0,70)) ;Tape load and edit time
        ASSIGN    4,V$Var1      ;Total processing time
        ASSIGN    5,V$Var2      ;Due date time in P5
        ASSIGN    6,V$Var3      ;Longest processing time
        LINK      Program,P$Schedparm,Wrte ;Overall Shortest
Wrte    SEIZE     Manuscript
        ADVANCE   P1            ;Part program time
        RELEASE   Manuscript
        UNLINK    Program,Wrte,1 ;Unlink one xact
        LINK      Tape,P$Schedparm,Punch ;Link into chain
Punch   SEIZE     Tapepunch
        ADVANCE   P2            ;Punching time
        RELEASE   Tapepunch
        UNLINK    Tape,Punch,1  ;Unlink one xact
        LINK      Edit,P$Schedparm,Loadedit ;Link into chain
Loadedit SEIZE    Edit
        ADVANCE   P3            ;Load and edit time
        RELEASE   Edit
        UNLINK    Edit,Loadedit,1 ;Unlink one xact
**********************************************************************
        TABULATE  Late
        TABULATE  Transit
        TERMINATE 1             ;Job leaves the shop
**********************************************************************

17. TRAFFIC.GPS

Simulation of traffic at a T-junction.

Cars arrive at a T-junction every 6.28 seconds hyperexponentially distributed (standard deviation = 8.40 seconds). The cars then make a left turn northbound onto a highway. When cars cross the southbound lanes, they must wait in a center aisle which can accommodate a maximum of 8 cars. Each car takes 3.6 seconds (Erlang k=4 ) to cross the traffic lanes. It takes 4 seconds (Erlang k=5 ) to merge with northbound traffic. Southbound traffic arrives every 55±5 seconds and takes 15±5 seconds to pass the T-junction. Northbound traffic arrives every 60±5 seconds and takes 15±5 seconds to pass.

Simulate the traffic at the T-junction for 10 minutes.

1. Determine the transit time of northbound cars turning at the T-junction.

2. Tabulate the actual Erlang service times.

3. Find the maximum number of cars queuing in the lane, waiting to make a left turn.

Listing

; GPSS World Sample File - TRAFFIC.GPS, by Gerard F. Cummings
***********************************************************************
* *
* Traffic at a T-Junction *
***********************************************************************
* Erlang Service Times ...Hyperexponential Arrivals *
* Time Unit is 1/100 Second *
***********************************************************************
* A Hyperexponential Probability Distribution Follows
Hyper FVARIABLE (410+((RN2’L’234)#(1343-410)))#(Exponential(2,0,1))
* f(t) = .234(1/4.10) exp(-t/4.1) + .766(1/13.43) exp(-t/13.43)
***********************************************************************
Aisle STORAGE 8
Mergetime TABLE MP2,100,100,20
Crosstime TABLE MP1,100,100,20
Transit TABLE M1,1000,1000,9
Arrivals TABLE V$Hyper,200,200,20
***********************************************************************
        GENERATE V$Hyper,,300   ;Hyperexponential
        QUEUE    First
        GATE SNF Aisle          ;Is there room in the aisle?
        SEIZE    Southlane      ;Crosses highway
        DEPART   First
        MARK     1
*———Erlang Distribution——————————————————————
        ADVANCE  (Gamma(3,0,4,90)) ;Erlang K=4 waiting time
*                                  ;Mean = 360 time units
*———————————————————————————————————
        TABULATE Crosstime      ;Record crossing time
        ENTER    Aisle          ;Stand in center aisle
        RELEASE  Southlane
        QUEUE    Two            ;Queue for northlane
        SEIZE    Northlane
        DEPART   Two
        LEAVE    Aisle
        MARK     2
* ————Erlang Distribution————————————————————
        ADVANCE  (Gamma(4,0,5,80)) ;Erlang K=5 waiting time
*                                  ;Mean = 400 time units
* ——————————————————————————————————
        RELEASE   Northlane
        TABULATE  Mergetime     ;Merge time to north flow
        TABULATE  Transit
        TABULATE  Arrivals
        TERMINATE
***********************************************************************
        GENERATE  5000,500,,,10 ;Southbound traffic
        SEIZE     Southlane
        ADVANCE   1200,300 ;Time to pass junction
        RELEASE   Southlane
        TERMINATE
***********************************************************************
        GENERATE  6000,500,,,10 ;Northbound traffic
        SEIZE     Northlane
        ADVANCE   1200,300      ;Time to pass junction
        RELEASE   Northlane
        TERMINATE
***********************************************************************
        GENERATE  6000          ;Xact every minute
        TERMINATE 1
*********************************************************************

18. POWDER.GPS

Simulation of customer brand loyalty.

A survey was carried out to assess the brand loyalty of customers to 7 brands of soap powder. The probability of change from one type of powder to another, is given in the table below. It is assumed that the customer will purchase either the same brand of powder again (most likely), or change to some other powder (less likely). Therefore the sum of the probabilities in each row of the matrix is equal to 1. The probability of the market share distribution depends on the number of transitions which have taken place (i.e. the number of successive purchases) and the initial market share of each product.

The purpose of the model is to estimate the market share each powder will achieve, in the long term, assuming that the transition probability matrix will remain the same, and assuming that initially all powders have an equal share of the market.

This process of system changes occurring in sequence is called a Markov Chain.

 

                    Probability of Customer Changing From Row to Column

            SUDS      BUBBLES     CLEANPLUS    SOAPY
    
                         BRANDX     CLEARSHINE    MARVEL       TOTAL

SUDS        .39   .12   .17   .13   .10   .04   .05   1.0

BRANDX      .13   .32   .10   .15   .12   .09   .09   1.0

BUBBLES     .15   .14   .25   .14   .17   .08   .07   1.0

CLEARSHINE  .11   .10   .09   .40   .08   .09   .13   1.0

CLEANPLUS   .05   .12   .16   .09   .37   .14   .07   1.0

MARVEL      .16   .13   .08   .05   .16   .28   .14   1.0

SOAPY       .08   .10   .09   .10   .07   .13   .43   1.0

 

Since the table of transition probabilities has no zeroes, we know that all states are in a single chain, and are aperiodic. This assures the convergence of state probabilities in the theoretical Markov Chain, and assures that the simulation will not be trapped in a proper subset of states.

1) Run the model for 500 Transactions.

2) Determine the market share achieved by each product.

 Listing

***********************************************************************
RMULT 98851
Check TABLE X$Brand,1,1,8
*
Transitions MATRIX ,7,7 ;State transition table
*
Powder FUNCTION X$Brand,M7 ;Pick brand transition
1,FN$Suds/2,FN$BrandX/3,FN$Bubbles/4,FN$Clearshine
5,FN$Cleanplus/6,FN$Marvel/7,FN$Soapy
*
*
Suds FUNCTION RN1,D7 ;Transition from Suds

0.390,1/.510,2/.680,3/.810,4/.910,5/.950,6/1.0,7
*
BrandX FUNCTION RN1,D7 ;Transition from BrandX
0.130,1/.450,2/.550,3/.700,4/.820,5/.910,6/1.0,7
*
Bubbles FUNCTION RN1,D7 ;Transition from Bubbles
0.150,1/.290,2/.540,3/.680,4/.850,5/.930,6/1.0,7
*
Clearshine FUNCTION RN1,D7 ;Trans from Clearshine
0.110,1/.210,2/.300,3/.700,4/.780,5/.870,6/1.0,7
*
Cleanplus FUNCTION RN1,D7 ;Transition from Cleanplus
0.050,1/.170,2/.330,3/.420,4/.790,5/.930,6/1.0,7
*
Marvel FUNCTION RN1,D7 ;Transition from Marvel
0.160,1/.290,2/.370,3/.420,4/.580,5/.860,6/1.0,7
*
Soapy FUNCTION RN1,D7 ;Transition from Soapy
0.080,1/.180,2/.270,3/.370,4/.440,5/.570,6/1.0,7
*
Record FUNCTION X$Brand,L7 ;Records numbers
1,Suds/2,BrandX/3,Bubbles/4,Clearshine/5,Cleanplus/6,Marvel/7,Soapy
***********************************************************************
INITIAL X$Brand,1

        GENERATE   1,,,,2      ;One xact every minute
        TABULATE   Check
        SAVEVALUE  Oldbrand,X$Brand ;Save old brand
        SAVEVALUE  Brand,FN$Powder ;Find new brand
        SAVEVALUE  FN$Record+,1 ;Savevalue of chosen brand
                                ; up by one
        MSAVEVALUE Transitions+,X$Oldbrand,X$Brand,1 ;Update
        TERMINATE  1

19. QTHEORY.GPS

Simulation of a solvable queuing network.

When feasible, an analytical solution to queuing systems provides a useful means of estimating the performance of simple systems.This program simulates a system for which the queuing parameters are calculated using the appropriate Pollaczek and Khintchin (P-K) equations. The objective is to verify the results obtained by simulation using GPSS World.The program simulates an interarrival time of 5 seconds( 500 time units), exponentially distributed, and a single service channel. The mean service time is 3 seconds( 300 time units). The average utilization of the server is consequently 60%.

Three modes of service times are investigated.

1. Constant service time.

2. Exponentially distributed service time.

3. Erlang (k=2) service time.

1. Run the simulation for 500 minutes.

2. Determine the queue statistics for each type of service.

3. Compare the simulation results with the predictions of queuing theory.

Listing


* Queuing Theory Verification *
* Time Unit Is 1/100 Of a Second *
**********************************************************************
Transit TABLE M1,250,250,20
Number TABLE Q$Expon,0,1,20
Qconstant QTABLE Constant,200,200,20
Qexpon QTABLE Expon,200,200,20
Qerlang QTABLE Erlang,200,200,20
**********************************************************************
        GENERATE  (Exponential(1,0,500)) ;Interarrival 5 seconds
        QUEUE     Constant
        SEIZE     Facility1
        ADVANCE   300                    ;Service constant 3 secs
        RELEASE   Facility1
        DEPART    Constant
        TERMINATE
**********************************************************************
        GENERATE  (Exponential(1,0,500)) ;Interarrival 5 seconds
        QUEUE     Expon
        SEIZE     Facility2
        ADVANCE   (Exponential(1,0,300)) ;Service time 3 secs Expon
        RELEASE   Facility2
        DEPART    Expon
        TABULATE  Transit
        TERMINATE
***********************************************************************
        GENERATE  (Exponential(1,0,500)) ;Interarrival time 5 secs
        QUEUE     Erlang
        SEIZE     Facility3
        ADVANCE   (Exponential(1,0,150)) ;Erlang K=2 Service 3 secs
        ADVANCE   (Exponential(1,0,150))
        RELEASE   Facility3
        DEPART    Erlang
        TERMINATE
***********************************************************************
        GENERATE  (Exponential(1,0,6000)) ;Random sample,
                                          ; Ave. 1 per minute
        TABULATE  Number
        TERMINATE 1
*********************************************************************

20. SUPERMRK.GPS

Simulation of a supermarket.

Customers arrive by car to shop at a supermarket. The parking lot has space for 650 parked cars. If a customer fails to find a parking space, that customer leaves immediately without shopping. On average a customer can walk to the supermarket from the parking lot in 60 seconds. Shoppers purchase between 5 and 100 items, uniformly distributed. A customer buying 10 items or less, will generally use a basket (70 provided). A customer buying more than 10 items will generally use a cart (650 provided).

Shopping time per customer depends on the number of items purchased (10 seconds per item). Customers select items and then join the shortest queue at one of 17 checkouts. Customers purchasing less than 10 items may choose the express checkout. Checkout time takes 2 seconds per item purchased, plus a time of 25, 30, or 35 seconds. This time depends on the method of payment (cash, check or credit card which are assumed equally likely or probable). After checking out a customer walks to the car (60 seconds), loads goods and leaves the parking lot.

The arrival rate of customers is exponentially distributed, starting at 600 per hour for half an hour, 900 per hour for one hour, 450 per hour for one hour and 300 per hour thereafter.

1. Run the simulation for 3 hours.

2. Determine the transit time of customers.

3. Determine the utilization of the parking lot, carts, baskets and checkouts.

4. Tabulate the number of customers in the supermarket at one minute intervals.

Listing

* Supermarket Simulation Model *
* Time Unit = 1/10 Of a Second *
***********************************************************************
RMULT 1187
First EQU 2
Last EQU 18
Qty VARIABLE (RN1@96+5)
Finance VARIABLE (RN1@3+1)#50+200
Transit TABLE M1,10000,10000,7 ;Time in system
Items TABLE P$Quantity,10,10,10 ;No. of items bought
Shoppers TABLE X$Customers,100,50,12 ;No. of shoppers
Baskt STORAGE 70
Cart STORAGE 650
Park STORAGE 650
Checkout VARIABLE (P$Quantity)#20+P$Payment
Tshop VARIABLE P$Quantity#100
INITIAL X$Customers,0
***********************************************************************
Beg     TRANSFER  Both,,Los   ;Tries to park or leaves
        ENTER     Park        ;Park in parking lot
        ADVANCE   600         ;Time to walk from car
        SAVEVALUE Customers+,1 ;One more customer
        ASSIGN    Quantity,V$Qty ;Param quantity = No. items bought
        ASSIGN    Payment,V$Finance ;Param payment = Method
        TEST LE   P$Quantity,10,Qcart ;Items >10 Get cart
        GATE SNF  Baskt,Qcart ;Check basket available
        QUEUE     Basket      ;Queue for a basket
        ENTER     Baskt       ;Get a basket
        DEPART    Basket      ;Leave queue
        ASSIGN    Carrier,Baskt ;Param carrier assigned baskt
        TRANSFER  ,Shop       ;OK to shop
***********************************************************************
Qcart   QUEUE     Carts       ;Queue for a cart
        ENTER     Cart        ;Get a cart
        DEPART    Carts       ;Depart carts queue
        ASSIGN    Carrier,Cart ;Param carrier assigned cart
Shop    ADVANCE   V$Tshop     ;Shopping time elapses
        TEST LE   P$Quantity,10,Norm ;Items < 10 go to express
        COUNT L   Where,First,Last,1,Q ;Any empty checkouts?
        TEST E    P$Where,0,Norm ;Some empty checkouts?
        QUEUE     Xpress      ;Queue at express
        SEIZE     Xpres       ;Get express checkout
        DEPART    Xpress      ;Depart express queue
        ADVANCE   V$Checkout  ;Checkout time
        RELEASE   Xpres       ;Free express checkout
        LEAVE     P$Carrier   ;Leave the basket
        TRANSFER  ,Fin
***********************************************************************
Norm    SELECT MIN Minque,First,Last,,Q ;Find minimum queue
        QUEUE     P$Minque    ;Join the min queue
        SEIZE     P$Minque    ;Get the checkout
        DEPART    P$Minque    ;Depart the queue
        ADVANCE   V$Checkout  ;Checkout time
        RELEASE   P$Minque    ;Free the checkout
        LEAVE     P$Carrier   ;Leave the cart
Fin     TABULATE  Transit     ;Record transit time
        TABULATE  Items       ;Record items bought
        SAVEVALUE Customers-,1 ;One customer leaves
        ADVANCE   600         ;Walk to the car
        LEAVE     Park        ;Leave the car park
        TERMINATE
Lost    TERMINATE             ;One customer lost
***********************************************************************
* Arrivals for 0 - 30 min.
        GENERATE  (Exponential(1,0,60)),,,300 ;A Customer arrives
        TRANSFER  ,Beg  * Arrivals for 30 - 90 min.
        GENERATE  (Exponential(1,0,40)),,18000,900 ;Arrival rate after .5 hours
        TRANSFER  ,Beg * Arrivals for 90 - 150 min.
        GENERATE  (Exponential(1,0,80)),,54000,450 ;Arrival rate  after 1.5 hrs
        TRANSFER  ,Beg * Arrivals for 150 min +
        GENERATE  (Exponential(1,0,120)),,90000 ;Arrival after2.5 hours
        TRANSFER  ,Beg
***********************************************************************
        GENERATE  600              ;Xact each minute
        TABULATE  Shoppers         ;Record number of customers
        TERMINATE 1
********************************************************************* 

21. SHIPPORT.GPS

Simulation of a port.

A harbor port has three berths 1, 2 and 3. At any given time Berth1 can accommodate two small ships, or one medium ship. Berth2 and Berth3 can each handle one large ship, two medium ships or four small ships.The interarrival time of ships is 26 hours, exponentially distributed, and small, medium, and large ships are in the proportions 5:3:2 respectively. Queuing for berths is on a first come first served basis, except that no medium or small ship may go to a berth for which a large ship is waiting, and medium ships have a higher priority than small ships.Unloading times for ships are exponentially distributed with mean times as follows: small ships, 15 hours; medium ships, 30 hours; and large ships, 45 hours. The loading times are as follows:

· Small ships 24±6 hours uniformly distributed.

· Medium ships 36±10 hours uniformly distributed.

· Large ships 56±12 hours uniformly distributed.

The tide must be high for large ships to enter or leave Berths 2 and 3. Low tide lasts 3 hours, high tide, 10 hours.

1. Run the simulation for 500 days.

2. Determine the distribution of transit times of each type of ship.

3. Determine the utilization of the three berths.

Listing

* Ship and Port Simulation *
* Time in in Hours *
**********************************************************************
Berth1 EQU 1
Berth2 EQU 2
Berth3 EQU 3
Tide EQU 1
Tsmall EQU 1
Tmedium EQU 2
Tlarge EQU 3
*
*———Boolean Variables———————————————————————
Var1 BVARIABLE (R$Berth2’GE’1+R$Berth3’GE’1)#Q3’E’0
Var2 BVARIABLE R$Berth2’GE’1
Var3 BVARIABLE R$Berth3’GE’1
Var4 BVARIABLE SE$Berth1
Var5 BVARIABLE (R$Berth2’GE’2+R$Berth3’GE’2)#Q3’E’0
Var6 BVARIABLE R$Berth2’GE’2
Var7 BVARIABLE R$Berth3’GE’2
Var8 BVARIABLE SE$Berth3#LS1
Var9 BVARIABLE SE$Berth2#LS1
*
*—Size of Berths in relation to small ships—————————————
Berth1 STORAGE 2
Berth2 STORAGE 4
Berth3 STORAGE 4
*
*————Table Definations——————————————————————
Tsmall TABLE M1,30,10,20 ;Small ship transit time
Tmedium TABLE M1,30,10,20 ;Medium ship transit time
Tlarge TABLE M1,30,10,20 ;Large ship transit time
**********************************************************************
*————Day Timer——————————————————————————
        GENERATE  24            ;One xact each day
        TERMINATE 1             ;Clock operates once/day
**********************************************************************
*————Tide Control————————————————————————
        GENERATE  ,,0,1
Again   LOGIC R   Tide          ;Cycling xact models the tide
        ADVANCE   3             ;Tide is low for 3 hours
        LOGIC S   Tide          ;Tide comes in
        ADVANCE   10            ;Tide is high for 10 hrs
        TRANSFER  ,Again        ;Branch back to ‘Again’
**********************************************************************
        GENERATE  (Exponential(1,0,26)) ;A ship every 26 hrs.
        TRANSFER  500,,Inter    ;50 % are small
*———Characteristics of small ships are assigned to parameters——
        ASSIGN    Size,1        ;Type ship small, size=1
        ASSIGN    Capacity,1    ;Capacity P2=1 Small ship
        ASSIGN    Quenum,1      ;Queue #1 for small ships
        ASSIGN    M_Unload,15   ;Mean unload time
        ASSIGN    M_Load,24     ;Mean load time
        ASSIGN    Loadsp,6      ;Load time spread
        QUEUE     P$Quenum      ;Join queue-small ships
        TRANSFER  Both,Pier1,Pier2
*———Assign Berth 1 When Available————————————————
Pier1   GATE SNF  Berth1
        ASSIGN    Berth_Num,1   ;Berth obtained=Berth1
*———Move into Berth and Unload and Load—————————————
Small   ENTER     P$Berth_num,P$Capacity ;Enter berth using up ; ship capacity
        DEPART    P$Quenum      ;Depart queue
        ADVANCE   P$M_Unload,(Exponential(1,0,1)) ;Unload time
        ADVANCE   P$M_Load,P$Loadsp ;Loading time
        TEST E    P$Size,3,Skipit ;A large ship?
*———When Switch is Set, Tide is High———————————————
        GATE LS   Tide          ;Wait for tide
Skipit  LEAVE     P$Berth_Num,P$Capacity ;Leave berth by
                                ; ship capacity
        TABULATE  P$Quenum      ;Tabulate transit time
                                ; by ship type
        TERMINATE               ;Ship sails
**********************************************************************
*———Assign Berth 2 or Berth 3 when available(dependent——————
* on the ship configuration
Pier2   TEST E    BV$Var1,1     ;Small ship tries 2 or 3
        TRANSFER  Both,Bert2,Bert3 ;Try berth2 or berth3
Bert2   TEST E    BV$VAR2,1     ;Berth2 available?
        ASSIGN    Berth_Num,2   ;Assigned to berth2
        TRANSFER  ,Small
Bert3   TEST E    BV$Var3,1     ;Berth3 available?
        ASSIGN    Berth_Num,3   ;Assigned to berth3
        TRANSFER  ,Small
*
*———Characteristics of medium ships are assigned to parameters——
Inter   TRANSFER  400,,Large    ;20% of all ships
                                ; are large
        PRIORITY  2             ;All medium ships enter here
        ASSIGN    Size,2        ;Type ship medium, Size=2
        ASSIGN    Capacity,2    ;Capacity = 2  Medium ship
        ASSIGN    Quenum,2      ;Queue 2 for med ships
        ASSIGN    M_Unload,30   ;Mean unload time
        ASSIGN    M_Load,36     ;Mean load time
        ASSIGN    Loadsp,10     ;Load time spread
        QUEUE     P$Quenum      ;Join queue for small ships
        TRANSFER  Both,Quay1,Quay2
Quay1   TEST E    BV$Var4,1     ;Try for berth1
        ASSIGN    Berth_Num,1   ;Assigned to berth1
        TRANSFER  ,Small        ;Transfer for processing
Quay2   TEST E    BV$Var5,1     ;Try for berth 2 or 3
        TRANSFER  Both,,Quay3   ;Try berth2 first
        TEST E    BV$Var6,1     ;Is berth2 available?
        ASSIGN    Berth_Num,2   ;Gets berth2
        TRANSFER  ,Small        ;Transfer for processing
Quay3   TEST E    BV$Var7,1     ;Try for berth3
        ASSIGN    Berth_Num,3   ;Assigned to berth3
        TRANSFER  ,Small        ;Transfer for  unload/load
*———Characteristics of large ships are assigned to parameters——
Large   PRIORITY  3             ;All large ships; enter here
        ASSIGN    Size,3        ;Type ship large, Size=3
        ASSIGN    Capacity,4    ;Capacity=4 Large ship
        ASSIGN    Quenum,3      ;Queue number 3 for large ships
        ASSIGN    M_Unload,45   ;Mean unload time
        ASSIGN    M_Load,56     ;Mean load time
        ASSIGN    Loadsp,12     ;Load time spread
        QUEUE     P$Quenum      ;Join queue for large ships
        TRANSFER  Both,First,Second ;Try Berth3 and Berth2
First   TEST E    BV$Var8,1     ;Try Berth3 first
        ASSIGN    Berth_Num,3   ;Berth number=3 Entered Berth3
        TRANSFER  ,Small        ;Transfer for unload/load
Second  TEST E    BV$Var9,1     ;Try berth2 second
        ASSIGN    Berth_Num,2   ;Berth number=2 Entered Berth2
        TRANSFER ,Small ;Transfer for unload/load
**********************************************************************

22. EXCHANGE.GPS

Simulation of a PBX.

A private automatic branch exchange telephone system has 200 extensions, 30 internal lines, and 30 external lines, 8 signaling units and one operator. Telephone calls last 150 seconds on average, normally distributed with a standard deviation of 30 seconds. The interarrival time of external calls varies inversely with the number of extensions (2500/number of extensions ), exponentially distributed. The interarrival time of internal calls is inversely proportional to the number of free extensions (1260/number of free extensions + 1). The destination of these calls may be internal (66.6%) or external (33.3%). The operator is not required for calls which originate internally. A signaling unit, and an internal line is required for internal calls, and an external line for external calls.Fifteen percent of extensions are engaged when tried, and twenty percent are not answered.The time required to signal is 7±2 seconds, and to ring through to an extension is 6±2 seconds. A caller waits 4±1 seconds to check an engaged tone. The service of an operator takes 9±3 seconds.

Simulate the operation of the private branch exchange telephone system for 1 hour.

1. Determine the utilization of the operator, signaling units, internal and external lines, and the extensions.

2. Sample the number of internal and external calls being processed every minute.

3. Are the number of internal and external lines, and signaling units sufficient?

 Listing

; GPSS World Sample File - EXCHANGE.GPS, by Gerard F. Cummings
**********************************************************************
* PBX Telephone System Model 
* Time is in seconds 
**********************************************************************
Transit TABLE M1,20,20,20
**********************************************************************
Extensions STORAGE 200
Extlines STORAGE 30
Intlines STORAGE 30
Signals STORAGE 8
Operator STORAGE 1
**********************************************************************
* Define variables
Internal VARIABLE 1260/(1+R$Extensions)
External VARIABLE 2500/(R$Extensions+S$Extensions)
*
*Tables for number of calls in progress
Callsint TABLE S$Intlines,2,2,20
Callsext TABLE S$Extlines,2,2,20
**********************************************************************
* Generate calls originating internally
        GENERATE  (Exponential(1,0,V$Internal)),0,20 ;Calls origin; internal
        ENTER     Extensions    ;An extension is involved
        QUEUE     Inside        ;Queue for signal unit
        ENTER     Signals       ;Get a signaling unit
        DEPART    Inside        ;Leave the queue
        ADVANCE   7,2           ;Time to signal
        LEAVE     Signals       ;Leave the signal unit
        TRANSFER  .333,,Intout  ;33% are internal to ext*
Intint  TEST GE   R$Intlines,1,Breakoff ;Test int line available
        ENTER     Intlines      ;Get and internal line
        ADVANCE   4,1           ;Check if engaged
        TRANSFER  .15,,Busy     ;Some extensions engaged
Aline   ENTER     Extensions    ;Another extension involved
        ADVANCE   6,2           ;Time to ring extension
        TRANSFER  .2,,Nogood    ;20% not answered
        ADVANCE   (Normal(2,150,30)) ;Call duration
Nogood  LEAVE     Extensions    ;Leave extension
Busy    LEAVE     Intlines      ;Leave internal line
        TRANSFER  ,Breakoff
***********************************************************************
* Model internal to external calls
Intout  TEST GE   R$Extlines,1,Breakoff ;Is an ext line available?
        ENTER     Extlines      ;Get an external line
        ADVANCE   4,1           ;Time to check if engaged
        TRANSFER  .200,,Nobody  ;20% are engaged
        ADVANCE   6,2           ;Time to answer
        TRANSFER  .200,,Nobody  ;20% do not answer
        ADVANCE   (Normal(2,150,30)) ;Call duration
        TABULATE  Transit       ;Record transit time
Nobody  LEAVE     Extlines      ;Leave external line
Breakoff LEAVE    Extensions    ;Free the extension
        TERMINATE
"***********************************************************************
* Process calls originating externally 
        GENERATE (Exponential(1,0,V$External)) ;Calls of external ; origin
        TEST GE   R$Extlines,1,Nonefree ;Ext line available?
        ENTER     Extlines      ;Get an ext line
        QUEUE     Outsider      ;Queue for operator
        ENTER     Operator      ;Get an operator
        DEPART    Outsider      ;Depart the queue
        ADVANCE   9,3           ;Operator service
        LEAVE     Operator      ;Leave the operator
        ADVANCE   4,1           ;Is it engaged?
        TRANSFER  .15,,Engaged  ;Some exts engaged
        ENTER     Extensions    ;Get an extension
        ADVANCE   6,2           ;Time to ring ext
        TRANSFER  .200,,Noperson ;20% No answer
        ADVANCE   (Normal(2,150,30)) ;Call time
        TABULATE  Transit       ;Record transit time
Noperson LEAVE    Extensions    ;Leave extension
Engaged LEAVE     Extlines      ;Leave external line
Nonefree TERMINATE
***********************************************************************
        GENERATE  3600          ;Transaction each hr
        TERMINATE 1             ;Term timer xact
        GENERATE  60            ;One xact every min
        TABULATE  Callsint      ;No. of int calls
        TABULATE  Callsext      ;No. of ext calls
        TERMINATE

23. FMSMODEL.GPS

Simulation of a Flexible Manufacturing System.

Two vertical computer numerical control (CNC) machining centers, one horizontal CNC machining center, and a 3-dimensional inspection machine, are linked to form a flexible manufacturing system (FMS). The machines are served by automatically guided vehicles (AGVs) which follow an inductive wire embedded in the floor.Components, fitted to an appropriate fixture, arrive at the arrival station in random order, equally probable, every 12±1 minutes. Sixteen categories of jobs are processed. Each component takes a different machining and inspection time given by a Function called ‘Product’ defined in the model below and based on the following table.

Machining Time

Job Type     1     2     3     4     5     6     7     8
Time        600   700   800   900   1000  1100  1200  1300

Job Type     9     10    11    12    13    14    15    16
Time        1400  1500  1600  1700  1800  1900  2000  2100

 

One robot loads and unloads components and fixtures to and from the AGVs at the arrival station and finished parts area. A layout of the The robot, machine tools, and automatically guided vehicles are controlled by a central computer.

The robot, machine tools, and automatically guided vehicles are controlled by a central computer.

· Thirty-five percent of components are machined on Machine1.

· Forty-five percent of components are machined on Machine2.

· Twenty percent of components are machined on Machine3.

However, 15% of Machine1 jobs and 10% of Machine2 jobs are subsequently machined on Machine3. Jobs consigned originally to machine 3 are machined solely on that machine. Finally, 4% of all components are inspected at random on Machine4.

The wire in the floor guiding vehicles is divided into fifteen 10-meter sections represented by Facilities 1 to 15. The guided vehicles travel at an average speed of 0.5 meters per second, including loading and unloading times.

1. Simulate the operation of the FMS system for 15 days.

2. Determine the utilization of the machine tools.

3. Find the transit time of components through the production system and the in-process storage.

4. Determine the appropriate number of AGVs for the proposed workload in the FMS.

Listing

; GPSS World Sample File - FMSMODEL.GPS, by Gerard F. Cummings
 AGV Model in FMS Factory *
* Time unit is one second

***********************************************************************
* P1 =1 Means machine 1 is req’d first
* P2 =2 Means " 2 " " "
* P3 =3 Means " 3 " " "
***********************************************************************
RMULT 71143
Transit TABLE M1,4000,4000,8 ;Transit time of jobs
Type VARIABLE RN1@16+1 ;Categories of jobs processed
AGV STORAGE 2
Inspect FUNCTION P4,L16
1,1200/2,1350/3,1500/4,1650/5,1800/6,1950/7,2100/8,2250/9,2400/10,2550
11,2700/12,2850/13,3000/14,3150/15,3300/16,3450
Product FUNCTION P4,L16
1,600/2,700/3,800/4,900/5,1000/6,1100/7,1200/8,1300/9,1400/10,1500
11,1600/12,1700/13,1800/14,1900/15,2000/16,2100
*
Mach1 FUNCTION RN1,D3
.35,1/.80,2/1.0,3
***********************************************************************
        GENERATE  720,60         ;Xacts are jobs
        QUEUE     Arrival        ;Arrival area queue
        ASSIGN    5,FN$Mach1     ;P5 is and index to machines
*——Dummy values are put into parameters 1,2, and 3 so that they
*——will be set up to receive the appropriate value
*——in ASSIGN P5,P5.
*——When P1, P2 or P3 are tested in various test Blocks they must
*——already exist.
        ASSIGN    1,6            ;Dummy value
        ASSIGN    2,6            ;Dummy value
        ASSIGN    3,6            ;Dummy value
*——The contents of parameter 5 is put into the parameter with the
*——same number as the contents value(e.g. If parameter 5 has a
*——value of 3, a 3 is put into parameter 3 indicating processing
*——should start on machine 3.
        ASSIGN    P5,P5          ;P1=1, P2=2, or P3=3
        ASSIGN    4,V$Type       ;P4 = Complexity of job
        ENTER     AGV            ;GET AN AGV
        SEIZE     Robot          ;Get robot
        ADVANCE   60             ;Time to get an AGV
        DEPART    Arrival        ;Depart arrival queue
        ADVANCE   45             ;Robot load job on AGV
        RELEASE   Robot          ;Free the robot
        SEIZE     1              ;Get section 1 of track
        ADVANCE   20             ;20 second to move 10 M
        RELEASE   1              ;Free section 1 of track
        TEST E    P1,1,Skipone   ;Machine 1 req’d?
        TRANSFER  .10,,Next3     ;10% also go to Machine 3
First   SEIZE     3              ;Get section 3 of track
        ADVANCE   20             ;Move 10 meters
        LEAVE     AGV            ;Free AGV
        QUEUE     One            ;Queue for machine 1
        RELEASE   3              ;Free section 3 of track
        SEIZE     Machine1       ;Get machine 1
        DEPART    One            ;Depart the queue
        ADVANCE   FN$Product     ;Machining on vertical CNC
        RELEASE   Machine1       ;Machining center
        QUEUE     Wipone         ;Join work-in-progress
        ENTER     AGV            ;Get an AGV
        ADVANCE   60             ;Time to get an AGV
        DEPART    Wipone         ;Depart work-in-progress
***********************************************************************
Second  SEIZE     4              ;Get section 4 of track
        ADVANCE   20             ;10 section to move 10 M
        RELEASE   4              ;Release section 4
        TEST E    P2,2,Skiptwo   ;Is machine 2 req’d?
        TRANSFER  .15,,Next4     ;15% also go to machine 3
Andthree SEIZE    6              ;Get section 6 of track
        ADVANCE    20            ;Move 10 meters
        LEAVE     AGV            ;Free the AGV
        QUEUE     Two            ;JOIN QUEUE TWO
        RELEASE   6              ;Free section 6 of track
        SEIZE     Machine2       ;Get machine 2
        DEPART    Two            ;Depart queue 2
        ADVANCE   FN$Product     ;Process on horizontal
        RELEASE   Machine2       ;CNC machining center
        QUEUE     Wiptwo         ;Queue work-in-progress
        ENTER     AGV            ;Get an AGV
        ADVANCE   60             ;Time to get an AGV
        DEPART    Wiptwo         ;Depart work-in-progress
***********************************************************************
Third   TEST E    P3,3,Skipthree ;Is machine 3 req’d?
        SEIZE     8              ;Get section 8 of track
        ADVANCE   20             ;Move 10 meters
        LEAVE     AGV            ;Free AGV
        QUEUE     Three          ;Join queue three
        RELEASE   8              ;Free section 8 of track
        SEIZE     Machine3       ;Get machine 3
        DEPART    Three          ;Depart queue three
        ADVANCE   FN$Product     ;Process on CNC lathe
        RELEASE   Machine3       ;Free turning center
        QUEUE     Wipthree       ;Queue work in progress
        ENTER     AGV            ;Get an AGV
        ADVANCE   60             ;Time for AGV to arrive
        DEPART    Wipthree       ;Depart work-in-progress
***********************************************************************
Fourth  SEIZE     9              ;Get section 9 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   9              ;Free section 9 of track
        TRANSFER  .960,,Skipfour  ;4% Of components inspected
        SEIZE     11             ;Get section 11 of track
        ADVANCE   20             ;Move 10 meters
        LEAVE     AGV            ;Free the AGV
        QUEUE     Four           ;Join queue four
        RELEASE   11             ;Free section 11 of track
        SEIZE     Machine4       ;Get Machine 4
        DEPART    Four           ;Depart queue 4
        ADVANCE   FN$Inspect     ;Inspection on 3D machine
        RELEASE   Machine4       ;Release machine 4
        QUEUE     Wipfour        ;Join work-in-progress
        ENTER     AGV            ;Get and AGV
        ADVANCE   60             ;Time for AGV to arrive
        DEPART    Wipfour        ;Depart work-in-progress
***********************************************************************
Fifth   SEIZE     12             ;Get section 12 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   12             ;Free section 12 of track
        SEIZE     Robot          ;Get a robot
        ADVANCE   45             ;Robot unloads job from AGV
        RELEASE   Robot          ;Free the robot
        TABULATE  Transit        ;Record transit time
        SAVEVALUE P4+,1          ;One job finished
        SEIZE     13             ;Get section 13 of track
        ADVANCE   20             ;Recirculate AGV
        RELEASE   13             ;Free section 13 of track
        SEIZE     14             ;Get section 14 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   14             ;Free section 14 of track
        SEIZE     15             ;Get section 15 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   15             ;Free section 15 of track
        LEAVE     AGV            ;Free AGV
        TERMINATE                ;Destroy xact
***********************************************************************
Next3   ASSIGN    3,3            ;10% Use machine 1 and 3
        TRANSFER  First
Next4   ASSIGN    3,3            ;15% Use machine 2 and 3
        TRANSFER  ,Andthree
***********************************************************************
Skipone SEIZE     2              ;Seize section 2 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   2              ;Free section 2 of track
        TRANSFER  ,Second
***********************************************************************
Skiptwo SEIZE     5              ;Get section 5 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   5              ;Free section 5 of track
        TRANSFER  ,Third
***********************************************************************
Skipthree SEIZE   7              ;Get section 7 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   7              ;Free section 7 of track
        TRANSFER  ,Fourth
***********************************************************************
Skipfour SEIZE    10             ;Get section 10 of track
        ADVANCE   20             ;Move 10 meters
        RELEASE   10             ;Free section 10 of track
        TRANSFER     ,Fifth
***********************************************************************
        GENERATE  28800         ;Xact every day
        TERMINATE 1             ;Destroy timer xact

24. ETHERNET.GPS

Simulation of an Ethernet.

A 10 Mbps Ethernet network is currently running satisfactorily with 100 workstations online. It has been determined that network traffic is composed of two classes of messages that are generated with the same proportion at all nodes.The global message arrival pattern in the peak hour can be modeled as a Poisson process, with individual workstations chosen randomly.We are to determine the effect on performance of adding an additional 100 workstations to the network.

Listing

; GPSS World Sample File - ETHERNET.GPS
* Messages arrive exponentially, as one of two types: short
* or long. A Node is selected and held for the duration of
* message transmission and any collision backoffs.
* Each Node on the Ethernet is busy with a single message
* until it is sent, or after some number of collisions (with
* transmission attempts from other nodes) a permanent error
* is declared and the node is released.
* Time is in units of milliseconds. Nodes are presumed
* to be 2.5 m. apart. The node ID numbers are used to
* determine the separation distance when calculating
* the collision window. The propagation delay to an adjacent
* node is 0.01 microsecond. Each bit is transmitted in 0.1
* microsecond. The interframe gap is modelled by having the
* sender hold the Ethernet for an additional delay after it
* has sent its message.
* Messages are represented by GPSS Transactions. Nodes
* and the Ethernet are represented by GPSS Facilities. An
* additional Facility is used during jamming to prevent the
* startup of any new messages.
* A collision results from multiple transmission attempts
* at two or more nodes. The signal propagation delay
* prevents nodes from having simultaneous knowledge of
* each other, thereby leading to this possibility. The time
* interval until the signal from the other node can be
* detected is called the node’s "Collision Window".
* Collisions are represented by removing the transmitting
* Transaction from ownership of the Ethernet and sending it
* to a backoff routine. The new owner jams the Ethernet
* briefly and then goes through the backoff, itself. When a
* Transaction’s message is being sent, the transaction has
* ownership of the Ethernet Facility at priority 0, and can
* be PREEMPTed by Transactions which are at priority 1.
* When a Transaction is jamming, it has ownership of the
* Ethernet Facility at priority 1, and is never itself
* PREEMPTed.
* Arguments:
* 1. Node_Count Number of Nodes 2.5 m. apart
* 2. Min_Msg Bits
* 3. Max_Msg Bits
* 4. Fraction_Short_Msgs Parts per thousand
* 5. Intermessage_Time Global Interarrivals
Node_Count EQU 100 ;Total Ethernet Nodes
Intermessage_Time EQU 1.0 ;Avg. Global Arrival every msec.
Min_Msg EQU 512 ;The Shortest Message in bits
Max_Msg EQU 12144 ;The Longest Message in bits
Fraction_Short_Msgs EQU 600 ;Short Msgs in parts per
thousand
Slot_Time EQU 0.0512 ;512 bit times
Jam_Time EQU 0.0032 ;32 bit times
Backoff_Limit EQU 10 ;No more than 10 backoffs
Interframe_Time EQU 0.0096 ;96 bit times
***********************************************************************
* Definitions of GPSS Functions and Variables.
***********************************************************************
Backoff_Delay VARIABLE Slot_Time#V$Backrandom ;Calc the
Backoff Delay
Backrandom VARIABLE 1+(RN4@((2^V$Backmin)-1))
Backmin VARIABLE
(10#(10’L’P$Retries))+(P$Retries#(10’GE’P$Retries))
Node_Select VARIABLE 1+(RN3@Node_Count)
Collide VARIABLE
ABS((X$Xmit_Node-P$Node_ID)/100000)’GE’(AC1-X$Xmit_Begin)
Msgtime VARIABLE (0.0001)#V$Msgrand
Msgrand VARIABLE
Min_Msg+(RN1’G’Fraction_Short_Msgs)#(Max_Msg-Min_Msg)
***********************************************************************
* The Message Delay Histogram
***********************************************************************
Msg_Delays QTABLE Global_Delays,1,1,20
***********************************************************************
* Main Body of Model
***********************************************************************
* Message Generation
***********************************************************************
        GENERATE  (Exponential(1,0,Intermessage_Time)) ;Single msg generator
        ASSIGN    Node_ID,V$Node_Select ;Acquire a Node ID.
        ASSIGN    Message_Time,V$Msgtime ;Calc and Save XMIT Time.
        ASSIGN    Retries,0       ;No Collisions at start.
***********************************************************************
* Wait for the Node to finish any previous work.
***********************************************************************
        QUEUE     Global_Delays   ;Start timing
        SEIZE     P$Node_ID       ;Wait for, occupy, the Node.
Try_To_Send PRIORITY 1            ;Don’t Lose Control
        SEIZE     Jam             ;Wait for any
        RELEASE   Jam             ;Jam to end.
        TEST E    F$Ethernet,1,Start_Xmit ;If Ethernet Free, jump.
***********************************************************************
* The Ethernet is busy. We check to see if we are in the
* Sender’s "Collision Window". If so, this node would
* start transmitting anyway, since the carrier would not
* yet be sensed. In that case, we must initiate a Collision.
 If Prop Delay to Sender is >= Xmit Time up till now,
* collide.
***********************************************************************
        TEST E    V$Collide,1,Start_Xmit ;No Collision. Go
                                  ;Wait for it.
* * * * * * * * * * * * Collision * * * * * * * * * * * * *
Collision PREEMPT Ethernet,PR,Backoff,,RE ;Remove the old owner.
        SEIZE     Jam             ;Jam the Ethernet.
        ADVANCE   Jam_Time        ;Wait the Jam Time.
        RELEASE   Jam             ;End the Jam.
        RELEASE   Ethernet        ;Give up the Ethernet.
        PRIORITY  0               ;Back to Normal priority.
Backoff ASSIGN Retries+,1 ;Increment the Backoff Ct.
        TEST LE   P$Retries,Backoff_Limit,Xmit_Error ;Limit
                                  ;retries.
        ADVANCE   V$Backoff_Delay ;Wait to initiate retry.
        TRANSFER  ,Try_To_Send    ;Go try again.
***********************************************************************
* Get the Ethernet, and start sending.
***********************************************************************
Start_Xmit SEIZE  Ethernet        ;Get Ethernet, wait if necessary
        SAVEVALUE Xmit_Node,P$Node_ID ;Identify the sender.
        SAVEVALUE Xmit_Begin,AC1  ;Mark the start xmit time.
        PRIORITY  0               ;Ensure we can be PREEMPTed.
        ADVANCE   P$Message_Time  ;Wait until Msg. is sent.
        ADVANCE   Interframe_Time ;Hold the Ethernet for gap.
        RELEASE   Ethernet        ;Give up the Ethernet.
Free_Node RELEASE P$Node_ID       ;Give up the node
        DEPART    Global_Delays   ; to the next msg.
        TERMINATE                 ;Destroy the Message.
***********************************************************************
Xmit_Error SAVEVALUE Error_Count+,1 ;Count the Error.
        TRANSFER  ,Free_Node      ; and get out of the way.
***********************************************************************
* Timer Segment
***********************************************************************
        GENERATE  1000            ;Each Start Unit is 1 Second.
        TERMINATE 1
*********************************************************************
 

25. PREDATOR.GPS

Predator-Prey Model. 

A population of rabbits has grown uncontrollably on a small island. The problem is so severe that local farmers expend considerable effort just to break even financially. They want to introduce a population of foxes to bring the situation under control.The problem is to use the Lotka-Volterra predator prey model in PREDATOR.GPS to simulate the phenomenon. What will happen if a population of 80 foxes is released? How many foxes must be released to eradicate the rabbits?

Listing

* Operation: 
* Plot Foxes and Rabbits: X 12000; Y 0-3000 
* START 1 
******************************************************************
* Don’t forget to parenthesize the ODEs.
******************************************************************
Foxes INTEGRATE (FoxRate())
Rabbits INTEGRATE (RabbitRate())
******************************************************************
* The Initial Values
******************************************************************
Foxes EQU 80
Rabbits EQU 1000
******************************************************************
* The Model Parameters
******************************************************************
K_ EQU 0.2000 ;Predator Efficiency
A_ EQU 0.0080 ;Predator Death Rate
B_ EQU 0.0002 ;Foray (Grazing) Factor
C_ EQU 0.0400 ;Prey Birth Rate
******************************************************************
* Discrete Simulation Control Segment
******************************************************************
GENERATE 10000
TERMINATE 1

PROCEDURE FoxRate() BEGIN
           Growth Rate for the Fox Population
    *******************************************************/
        TEMPORARY BirthRate, DeathRate, TotRate;
        /* Limit the Variable, so we can experiment safely. */
        IF (Foxes < 0) THEN Foxes = 0;
        IF (Foxes > 10e50) THEN Foxes = 10e50 ;
        BirthRate = K_ # B_ # Foxes # Rabbits;
        DeathRate = A_ # Foxes;
        TotRate = BirthRate - DeathRate;
        RETURN TotRate;
END;

PROCEDURE RabbitRate() BEGIN
    /*******************************************************
        Growth Rate for the Rabbit Population
    *******************************************************/
        TEMPORARY BirthRate, DeathRate, TotRate;
        /* Limit the Variable, so we can experiment safely. */
        IF (Rabbits < 0) THEN Rabbits = 0;
        IF (Rabbits > 10e50) THEN Rabbits = 10e50 ;
        BirthRate = C_ # Rabbits;
        DeathRate = B_ # Foxes # Rabbits ;
        TotRate = BirthRate - DeathRate;
        RETURN TotRate;
END;

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد