.\" @(#)statistics	1.3	12/16/92
.NA statistics
.SD
Demonstrates how to obtain the statistics of the input data
.DE
.LO "~ptolemy/src/domains/de/demo"
.SV 1.3 12/16/92
.AL "S. Ha"
.LD
.IE Statistics
.IE StopTimer
.IE "Printer, de"
.IE RanGen
This demo illustrates how to collect statistics on random data.
A sequence of random numbers is generated by the
.c RanGen
block.
The time interval between random numbers is exponential and independent,
making this a Poisson process with random event values.
The distribution of the random number can be chosen among
uniform, exponential, and normal by setting the parameters of the
.c RanGen
block.
The sample mean and variance are sent to the
.c Printer
star when an event is sent to the demand input of the
.c Statistics
star.
The
.c Printer
can write the data to a file, or send it to the standard output.
The latter is the default.
In this demo, these statistics are printed only at the
end of the simulation run.  The
.c StopTimer
star generates an event at the stop time of the DE Scheduler,
which corresponds to the end of the simulation.
A null signal (no events) is generated by the
.c Null
star and sent to the reset input of the
.c Statistics
block, so the calculations of the statistics are never restarted.
.pp
This explains several blocks in DE domain :
.c Null ,
.c StopTimer ,
.c RanGen ,
.c Statistics ,
and
.c Printer .
The
.c Null 
block can be connected to any unused input port of a block.
We can use the
.c Statistics
block to obtain the statistics of the queue size in a queueing system.
The
.c StopTimer 
block might be used to specify when to
sample the output data of the DE domain if the DE domain
resides in a 
.c Wormhole
of a untimed domain like SDF.
.IE StopTimer
.SA
Null,
Printer,
RanGen,
Statistics,
StopTimer.
.ES
