preamble
''
'' 				SIMFOOD
''
'' AUTHOR: Steve Bailey
'' CREATED: 7-25-90
'' DESCRIPTION:
''     This simulation models a simple fast food restaurant.  The restaurant
''     makes burgers, shakes, and fries (from raw materials).  Burgers are made 
''     from scratch by being sent through the broiler and put into the bun
''     steamer then later taken from the steamer and put together.
''     Fries are made by dropping a fry basket into the grease and upon being
''     cooked are dumped into the fry vat from where they will be scooped into
''     the fry boxes. Shakes are made when requested.  Resources include
''     knaves which rove between the broiler, meat catcher, sandwich boards,
''     shake machine and friers, and order takers which rove between the 
''     ordering area, the bagging area, and the pickup area.
''

processes include
    DUMM,
    BROIL.BURGER,	'' broils burger, puts in steamer
    MAKE.BURGER,	'' put vegtables and condoments on burger, put on rack
    MAKE.SHAKE,         '' make a shake and put in pickup area
    MAKE.FRY,           '' make a french fry and put on counter
    CALL.ORDERS,	'' bag burgers and hand to customer
    CUSTOMER,           '' places order with order taker
    GENERATOR and	'' generates customers
    STOP.SIM		'' invoked at end of simulation

    every TAKE.ORDER has
        a CUSTOMER.ORDER

    define CUSTOMER.ORDER as a pointer variable

resources 

    every ORDER.TAKER has	'' takes customer order, gives custormer food
        a ORDER.STATION, and
        a ORDER.TAKER.ICON

        define ORDER.STATION as an integer variable
        define ORDER.TAKER.ICON as a pointer variable

    every KNAVE has	        '' operates equipment to make food
        a KITCHEN.STATION, and	'' station knave is currently at
        a KNAVE.ICON

        define KITCHEN.STATION as a integer variable
        define KNAVE.ICON as a pointer variable

    every WORKSTATION has 
        a OCCUPIER,		'' knave or order taker that is occupying sta.
        a SIDE.OF.BROILER,	'' which side of the equipment is the station
        a XLOC,			'' x position in feet from ll corner of site
        a YLOC			'' y position of station

        define XLOC, YLOC as real variables
        define OCCUPIER as an integer variable monitored on the left
        define SIDE.OF.BROILER as an integer variable
            define .MIDDLE	to mean 0	'' not separeted by equipment
            define .RIGHT.SIDE 	to mean 1
            define .LEFT.SIDE 	to mean 2
    
temporary entities 

    every BURGER may belong to 
        a STEAMER,
        a HEAT.RACK		

    every SHAKE may belong to
        a SHAKE.COUNTER

    every FRY may belong to
        a FRY.COUNTER

    every ORDER has 
        a NUM.BURGERS,
        a NUM.SHAKES,
        a NUM.FRIES and
        a CUSTOMER.WAITING
        and may belong to an ORDER.RACK and a BAG.COUNTER 

        define NUM.BURGERS as an integer variable
        define NUM.SHAKES as an integer variable
        define NUM.FRIES as an integer variable
        define CUSTOMER.WAITING as a pointer variable

Dynamic graphic entities include ICON, CUSTOMER, BURGER, ORDER, SHAKE, FRY

the system owns
    the STEAMER,		'' holds unmade burgers and buns
    the HEAT.RACK,		'' holds completed burgers awaiting pick-up
    the SHAKE.COUNTER,	        '' holds completed shakes for pickup
    the FRY.COUNTER,            '' holds completed fries for pickup
    the BAG.COUNTER and		'' holds completed customer orders
    the ORDER.RACK 		'' holds uncompleted customer orders 

define STEAMER, HEAT.RACK, SHAKE.COUNTER, FRY.COUNTER and BAG.COUNTER 
    as lifo sets

'' global variables
define STOP.TIME as an integer variable  
define WAITING.TIME as a real variable
define BURGER.PRICE as a real variable
define SHAKE.PRICE as a real variable
define FRY.PRICE as a real variable
define BURGERS.SOLD as an integer variable 
define SHAKES.SOLD as an integer variable 
define FRIES.SOLD as an integer variable 
define TIMESCALE as an integer variable
define COMPRESS.TIME as an integer variable
define CLOCK.TIME as a double variable

'' statistic gathering 
accumulate 
    KNAVE.UTILIZATION as the average of N.X.KNAVE

accumulate 
    ORDER.TAKER.UTILIZATION as the average of N.X.ORDER.TAKER

accumulate 
    WORKSTATION.UTILIZATION as the average of N.X.WORKSTATION

accumulate 
    AVE.KNAVE.JOBS as the average, 
    MAX.KNAVE.JOBS as the maximum of N.Q.KNAVE

accumulate 
    AVE.ORDER.TAKER.JOBS as the average, 
    MAX.ORDER.TAKER.JOBS as the maximum of N.Q.ORDER.TAKER

accumulate 
    AVE.WORKSTATION.JOBS as the average, 
    MAX.WORKSTATION.JOBS as the maximum of N.Q.WORKSTATION

tally 
    TOTAL.CUSTOMERS as the number, 
    MEAN.WAITING.TIME as the average,
    MAX.WAITING.TIME as the maximum of WAITING.TIME

'' display variables
display variables include CLOCK.TIME

'' functions
define CHOICE.KNAVE as an integer function given 1 argument
define CHOICE.ORDER.TAKER as an integer function given 1 argument
define CHOICE.WORKSTATION as an integer function given 3 argument

'' codes for workstations
define .RBROILER	to mean 1
define .LBROILER	to mean 2
define .RSTEAMER	to mean 3
define .RBOARD1		to mean 4
define .RBOARD2		to mean 5
define .RBOARD3		to mean 6
define .RBOARD4		to mean 7
define .LSTEAMER	to mean 8
define .LBOARD1		to mean 9
define .LBOARD2		to mean 10
define .LBOARD3		to mean 11
define .LBOARD4		to mean 12
define .SHAKE 		to mean 13
define .FRY             to mean 14
define .PICKUP1		to mean 15
define .PICKUP2		to mean 16
define .PICKUP3		to mean 17
define .ORDER1		to mean 18
define .ORDER2		to mean 19
define .ORDER3		to mean 20
define .GIVE.ORDER      to mean 21
define .NUM.STATIONS	to mean 21

'' absolute and mean work times (in seconds) they do NOT include times to move
'' between stations
define .SEND.TIME	to mean 10  
define .BROIL.TIME	to mean 120	'' time to broil a burger
define .CATCH.TIME 	to mean 8	'' time to put meat in into steamer
define .MAKE1.TIME	to mean 5	'' time to put pickles and onions 	
define .MAKE2.TIME	to mean 3	'' time to put on ketsup and mustard
define .MAKE3.TIME	to mean 8	'' time to put mayo, lettuce and tomatoe
define .MAKE4.TIME      to mean 8	'' time to microwave, and wrap
define .BAG.ORDER.TIME  to mean 10	'' time to bag and call order
define .CHECK.ORDER.TIME to mean 3      '' time to look at order and food avail.
define .SHAKE.TIME	to mean 15      '' time to make a shake
define .FRY.TIME 	to mean 8	'' time to put fries in container
define .FRY.DROP.TIME	to mean 10      '' time to put fries into deep frier
define .FRY.COOK.TIME   to mean 120	'' time to cook fries in deep frier
define .FRY.DUMP.TIME	to mean 4       '' time to dump cooked fries into vat
define .MEAN.INTERARRIVAL.TIME 	to mean 120   '' customer interarrival
define .MEAN.ORDER.TIME 	to mean 30    '' time for a customer to order
define .CALL.ORDER.TIME		to mean 4     '' time to call order to knaves
define .GIVE.ORDER.TIME         to mean 4     '' time to give order to customer

'' costs, nominal prices, and average order
define .MEAN.BURGERS.ORDER 	to mean 2.2   '' ave. num shakes/order
define .MEAN.SHAKES.ORDER	to mean 1     '' ave. number of shakes in ord.
define .MEAN.FRIES.ORDER	to mean 1.5   '' ave. number of fries in ord.
define .EMPLOYEE.SPEED		to mean 4     '' walking speed (ft/sec) of emp.
define .BURGER.PRICE		to mean 1.99  '' burger price at mean int. time
define .SHAKE.PRICE		to mean .99  '' shake price at mean int. time
define .FRY.PRICE		to mean .99  '' shake price at mean int. time
define .BURGER.COST		to mean .65   '' cost (to us) of a burger
define .SHAKE.COST		to mean .33   '' cost (to us) of a shake
define .FRY.COST		to mean .23   '' cost (to us) of a fry
define .EMPLOYEE.WAGE		to mean 4.35  '' hourly wage of an employee

'' positions of queues and misc. equipment
define .HEAT.RACKX		to mean 8.0   '' start of heat rack queue
define .HEAT.RACKY		to mean 5.5   
define .STEAMERX		to mean 9.0   '' start of steamer queue
define .STEAMERY		to mean 14.5
define .ORDER.RACKX		to mean 8     '' start of order rack
define .ORDER.RACKY		to mean 5
define .BAG.COUNTERX		to mean 12
define .BAG.COUNTERY		to mean 0.5
define .SHAKE.COUNTERX		to mean 8.0   '' start of counter
define .SHAKE.COUNTERY		to mean 5.5
define .FRY.COUNTERX		to mean 12.0  '' start of where fries are kept
define .FRY.COUNTERY		to mean 5.5
define .FRY.BASKET1X		to mean 16.5  '' fry cooking oil
define .FRY.BASKET1Y		to mean 6.5
define .FRY.BASKET2X		to mean 17.5
define .FRY.BASKET2Y		to mean 6.5
define .FRYVATX			to mean 15    '' cooked fries holder
define .FRYVATY			to mean 6.5
define .WAITX			to mean 15    '' customer waiting area
define .WAITY			to mean -1

'' misc define to means
define .SELF 			to mean PROCESS.V
define .NOW			to mean TIME.V
define .END.SIMULATION 		to mean .NOW ge STOP.TIME
define .SECONDS			to mean units

end
