Operation |
Syntax |
---|---|
ADVANCE |
AddBlock(Advance(mean, modifier)) |
GENERATE |
AddBlock(Generate(mean, modifier)) |
LABEL(BLOCK NO) |
AddBlock(Label(name)) |
RELEASE |
AddBlock(Release(self.facilityList[facility No])) |
SEIZE |
AddBlock(Seize(self.facilityList[facility No])) |
TERMINATE |
AddBlock(Terminate(units)) |
TRANSFER |
AddBlock(Transfer(Select factor, Next block A, Next block B)) |
Facility |
AddFacility(Facility(resource)) |
START |
Start(terminate No) |
turnonVerbose |
TurnoffVerbose() |
turnoffVerbose |
TurnoffVerbose() |
When to generate block
GENERATE block will generate next transaction as soon as last generated transaction leaves GENERATE block.
When to terminate simulation
When the terminate counter reaches the number set by START
Name Resolve
It's easy to use name instead of block No. and facility No so the simulator provide name resolve service. After all block is imported from pseudo gpss file, all label name and facility name is translated into block No. and facility No. When name resolve fails, the simulator will report error.
Data structure
Name |
comments |
---|---|
blockList |
List of blocks |
FacilityList |
List of facilities (facility name, free resource, transit time, utility) |
xactList |
List of xacts (createtime, finishtime, movetime, currentposition) |
currentEvnetChain |
List of current event (xact No) |
futureEventChain |
List of future event (xact No) |
Class Diagram
Class Name |
Inherit from |
Method |
comments |
---|---|---|---|
Model |
|
TurnonVerbose()/turnoffVerbose() start(termCount) AddBlock(blk)/AddFacility(f) resolveName() InsertFutureEvent(index) IsAllBlock() Simulation() Report() |
Turn on Verbose to get debug information set termination count and start simulation Add block/facility into block list and facility list translate name into block No. and facility No. insert future event and sort future event list To know whether all blocks in current event chain is blocked output average simulation time, average utility and average transit time of each facility |
Block |
|
Init() setTimeAdvance() getTimeAdvance() getNext() isBlock() isTerminate() |
Set time advance in init method set time advance get time advance get next block No. to know whether this block is blocked to know whether this block is terminate block |
Facility |
|
Increase() Decrease() RecordTransit() isBlock() |
Increase free resource and record utility and transit time Decrease free resource and record utility and transit time record transit time to know whether the facility is blocked |
Generate |
Block |
|
|
Advance |
Block |
|
|
Transfer |
Block |
|
|
Label |
Block |
|
|
Seize |
Block |
|
|
Release |
Block |
|
|
Terminate |
Block |
|
|
Pseudo code of simulation algorithm
Simulation()
{
resolve name;
generate first xact and insert it into current event chain;
while count < termCount
{
while current event chain is not empty and not all blocks in the current event chain are blocked
{
get first xact from current event chain
if xact is in GENERATE block and it can go into next block
generate a new xact and insert into future event chain
if xact is in SEIZE or RELEASE block
record utility and transit time of each facility
let xact go as far as it can until it is blocked or terminated
if xact is terminated
record its finish time to computer average simulation time
}
while future event chain is not empty
{
get first xact from future event chain;
update clock = xact.movetime
insert xact into current event chain
}
}