For each facility, CSIM automatically
gathers and reports the following statistics:
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 = facility
("center");
arrivals = meter ("arrivals");
departures = meter ("completions");
queue_box = box ("queue");
service_box = box ("in service");
The following code shows the instrumentation
of the facility:
customer()
{
}
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 is 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 19.4.1, "To rerun a
CSIM model") is called between
successive runs.