Download SIMSCRIPT III Language Manual

Transcript
6.04 Example 4 - A Harbor Model
This example models the unloading of ships in a harbor using two cranes mounted on a
track. There is room at dockside for two ships. When two ships are there, each crane
unloads one of them. If only one ship is there, both cranes work on it, reducing its
unloading time by a factor of two. If another ship arrives while both cranes are serving one
ship, one crane will immediately begin to serve the new ship. Waiting ships are unloaded
first-come-first-served.
Assume that ships arrive on the average of three in every four days, but inter-arrival times
are exponentially distributed (the mean is thus 4/3 days). The unloading time is uniformly
distributed between 0.5 and 1.5 days.
The desired results are the maximum and average queue length and the cycle times of ships
(queuing plus unloading)—minimum, maximum and average. These results should be
reported after 80 days of continuous operation.
This comprehensive example will illustrate the concepts of process methods interactions
and sets.
The ship will be modeled as an object with UNLOAD process method, method for
RESCHEDULE.UNLOAD and DONE.WAITING, to model the interactions between
ships by allocating the cranes and adjusting unloading times from ships.
A separate GENERATOR process method will model the arrival of ships. At first
glance, it might seem natural to model the cranes as a single resource with one subgroup
and two units. However, the rules for operating cranes do not readily translate into the
simple operations of the resources (request/ relinquish. Two sets are introduced, a
set called DOCK to contain ships being unloaded. There can be a maximum of two and a
set called QUEUE to contain ships waiting for the DOCK.
preamble for the HARBOR system ''Example 4
begin class SHIP
every SHIP
has an UNLOAD process method and
a DONE.WAITING method, and
a RESCHEDULE.UNLOAD method, and
belongs to a QUEUE and a DOCK
define RESCHEDULE.UNLOAD as a method
given a real argument ''time scale factor
89