|
For each facility, CSIM
automatically gathers and reports the
following statistics:
- mean
service time
- mean queue length
- utilization
- mean response time
- throughput
- number of completions
Meters and boxes can
easily be used to gather more detailed
statistics. The following statements show
the declaration of the needed variables:
facility
*f;
meter *arrivals;
meter *departures;
box *queue_box;
box *service_box;
The following statements, which would
appear in the sim
function, show the initialization of the
variables:
f = new facility("center");
arrivals = new meter("arrivals");
departures = new meter("completions");
queue_box = new box("queue");
service_box = new box("in service");
The following code shows the instrumentation
of the facility:
customer()
{
double timestamp1;
double timestamp2;
create("customer");
arrivals->note_passage();
timestamp1 = queue_box->enter();
f->reserve();
timestamp2 = service_box->enter();
hold (exponential(0.8));
f release();
service_box->exit(timestamp2);
queue_box->exit(timestamp1);
departures->note_passage();
}
The report for
box "queue_box"
would give statistics on response times
(under the heading "statistics on
elapsed times") and queue lengths
(under the heading "statistics on
population"). The report for box
"service_box"
would give statistics on service times
(under the heading "statistics on
elapsed times") and utilization (under
the heading "statistics on population").
The report for meter "arrivals"
would give statistics on the arrival rate
and inter-arrival times. The report for
meter "departures"
would give statistics on the completion
rate and inter-completion times. If the
arrival and completion rates were sufficiently
similar, this quantity would be called
the throughput.
Obviously, histograms
could be added to any of these meters
and boxes to obtain information on the
various distributions.
Although reports
can be produced at any time for individual
statistics gathering tools, it is most
common to generate reports for all tools
at the same time, usually when the simulation
has converged. This can be done by calling
the report
function.
Prototype:
void report(void)
Example:
report();
The report
function produces reports for all facilities,
storages, and classes, followed by reports
for all tables, qtables, meters, and boxes.
The sequence of reports begins with a
header that includes the model name, the
date and time, the current simulation
time, and the cpu time used.
CSIM provides
a single function that will clear all
accumulated statistics without affecting
the state of the system being modeled
in any way. This reset
function is most often used when warming
up a simulation. The simulation is begun
with the system in an empty state, simply
as a matter of convenience. A small number
of customers are allowed to pass through
the system, hopefully taking the system
closer to its equilibrium state. Then,
the statistics are reset and the simulation
is run until convergence is achieved.
The reset
function has a simple interface.
Prototype:
void reset(void)
Example:
reset();
Reset
clears the statistics that are automatically
gathered for facilities, storages, events,
and process classes. It also resets the
statistics in all non-permanent tables,
qtables, meters, and boxes being used
in the program. Permanent tables are not
affected by calling reset.
In general, resetting
statistics returns all the statistical
counters and timers maintained by CSIM
to their initial values, which are usually
zero. But, there are a few subtle and
important exceptions to this rule. When
a qtable is reset, it remembers the current
value for use in computing future values
from the relative changes specified by
note_entry
and note_exit.
When a meter is reset, it remembers the
time of the last passage for use in computing
the next interpassage time. When a box
is reset, it remembers the number present
for use in computing future populations.
Calling reset
in no way changes the state of the system
being modeled. It does not change the
simulation clock; it does not affect the
streams of random numbers being used in
the simulation; and it does not affect
the states of processes, facilities, storages,
events, and mailboxes. The reset
function is normally called during a simulation
run, whereas the rerun
function (see section
21.4.1, "To rerun a CSIM model")
is called between successive runs.
Next
Section
|