A. Test block 1. Customers arrive at Starbucks ever 2 +/- 1 minute and queue up for service. There are two servers. 60% of all customers want a special cafe, which takes 5 +/- 1 minute to prepare. The remaining customers just want a regular coffee, which takes 2 minutes to prepare. Simulate for an 8 hour day. SIMULATE SERVER STORAGE 2 GENERATE 2,1 QUEUE LINEUP ENTER SERVER DEPART LINEUP TRANSFER .60,COFFEE,CAFE COFFEE ADVANCE 2 LEAVE SERVER TERMINATE CAFE ADVANCE 5,1 LEAVE SERVER TERMINATE GENERATE 480 TERMINATE 1 START 1 END 2. Same scenario, only if the queue has five or more people in it, then new arrivals go away and 50% come back in two minutes. How can we model this? Instead of a queue, use a storage. SIMULATE SERVER STORAGE 2 LINEUP STORAGE 5 GENERATE 2,1 ENTRY TRANSFER BOTH,,GOAWAY ENTER LINEUP ENTER SERVER LEAVE LINEUP TRANSFER .60,COFFEE,CAFE COFFEE ADVANCE 2 LEAVE SERVER TERMINATE CAFE ADVANCE 5,1 LEAVE SERVER EXIT TERMINATE GOAWAY TRANSFER .50,,EXIT ADVANCE 2 TRANSFER ,ENTRY GENERATE 480 TERMINATE 1 START 1 END 3. Same scenario, only now 20% of new arrivals will go away if the queue has five or more people, the rest join the queue. Now we must allow the queue to have an arbitrary length, but still transfer away from it if it is too long. Solution: use a TEST block. syntax: TEST A,B,C auxiliary operation: L LE G GE E NE A,B: SNA C: Destination block if test if "false" SIMULATE SERVER STORAGE 2 GENERATE 2,1 ENTRY TEST L Q(LINEUP),5,GOAWAY STAY QUEUE LINEUP ENTER SERVER DEPART LINEUP TRANSFER .60,COFFEE,CAFE COFFEE ADVANCE 2 LEAVE SERVER TERMINATE CAFE ADVANCE 5,1 LEAVE SERVER EXIT TERMINATE GOAWAY TRANSFER .80,,STAY TRANSFER .50,,EXIT ADVANCE 2 TRANSFER ,ENTRY GENERATE 480 TERMINATE 1 START 1 END B. SNAs The basic elements of a GPSS simulation model are transactions, resources, blocks, control statements, compiler directives, standard numerical attributes transactions are the dynamic entities (generated). resources are static entities (facilities, storages). blocks are actions taken by transactions. standard numerical attributes are functions that provide information about entities, built-in or user-defined. transaction attributes: built-in: M1 - transit time (or mark time) PR - priority Pnumber - parameter some built-ins are inaccessible, like current block where a transaction resides. block attributes: N(name or number) - total entry count W(name or number) - current entry count facility attributes: F(name or number) - status (0=idle,1=busy) FT(name or number) - average time per transaction FR() - utilisation (parts/1000) queue attributes: Q(name or number) - current length QA() - average contents QM() - maximum contents QT() - average time per transaction (all transactions) QX() - average time for those without zero delay QZ() - how many zero delays Standard numerical attributes in GPSS are C. CLEAR control statement Rerun the simulation for seven days. Not seven "identical" days, but seven days with the same characteristics. How? Can't just rerun the model seven times as it will generate the same results seven times. Use the CLEAR statement, which clears all statistics and removes all transactions. Statistics for each separate run are generated in the listing file. SIMULATE SERVER STORAGE 2 GENERATE 2,1 ENTRY TEST L Q(LINEUP),5,GOAWAY STAY QUEUE LINEUP ENTER SERVER DEPART LINEUP TRANSFER .60,COFFEE,CAFE COFFEE ADVANCE 2 LEAVE SERVER TERMINATE CAFE ADVANCE 5,1 LEAVE SERVER EXIT TERMINATE GOAWAY TRANSFER .80,,STAY TRANSFER .50,,EXIT ADVANCE 2 TRANSFER ,ENTRY GENERATE 480 TERMINATE 1 START 1 CLEAR START 1 CLEAR START 1 CLEAR START 1 CLEAR START 1 CLEAR START 1 CLEAR START 1 END - - - - - D. RESET control statement The coffee shop simulation starts from an empty shop. Simulate for just the last hour of business. RESET clears statistics but leaves transactions in place.