From:	SCOVCB::GALVIN_FX    31-JAN-1989 09:04
To:	ARISIA::EVERHART
Subj:	

with text_io;    use text_io;
with UTILITY;    
with SIMULATION; 
with RANDOM;     
with STATISTICS; 

procedure EXAMPLE1 is

   JOB  : SIMULATION.PROCESS;

   task type STAT_JOB;
   package STAT_PACKAGE is new SIMULATION.PROCESS_CREATOR ("EXAMPLE1", 
      STAT_JOB, integer);

   task body STAT_JOB is
      COUN   : STATISTICS.COUNT_STATISTIC;
      TALL   : STATISTICS.TALLY_STATISTIC;
      ACCU   : STATISTICS.ACCUMULATE_STATISTIC;
      HIST   : STATISTICS.HISTOGRAM_STATISTIC;
      PLOT   : STATISTICS.PLOT_STATISTIC;
      X, Y   : float := 0.0;
      UFLOAT : RANDOM.UNIFORM_FLOAT_RANDOM;
   begin
      STATISTICS.CREATE_COUNT (COUN, "Count Statistic Example");
      STATISTICS.CREATE_TALLY (TALL, "Tally Statistic Example");
      STATISTICS.CREATE_ACCUMULATE (ACCU, "Accumulate Statistic Example");
      STATISTICS.CREATE_HISTOGRAM (HIST, "Histogram Statistic Example", 
         10, 0, 10);
      STATISTICS.CREATE_PLOT (PLOT, "X-Y Plot Statistic Example", 
         "X-axis", "Y-axis", 0.5);
      RANDOM.CREATE_UNIFORM_FLOAT (UFLOAT, "Unfrm Fl", 0.0, 10.0);

      for i in 1..20 loop
         SIMULATION.DELAY_PROCESS (2.0);
         STATISTICS.COLLECT_COUNT (COUN);
         STATISTICS.COLLECT_HISTOGRAM (HIST, RANDOM.UNIFORM_FLOAT (UFLOAT));
         X := float(i) * 0.5;
         if X < 5.0 then
            Y := 2.0 * X;
         else
            Y := -2.0 * X + 20.0;
         end if;
         STATISTICS.COLLECT_TALLY (TALL, Y);
         STATISTICS.COLLECT_ACCUMULATE (ACCU, Y);
         STATISTICS.COLLECT_PLOT (PLOT, X, Y);
      end loop;
      STAT_PACKAGE.DESTROY_PROCESS;
   end STAT_JOB;

begin
   put_line ("EXAMPLE1 ADASIM MODEL - STATISTICS OUTPUTS");  new_line;
   STAT_PACKAGE.CREATE_PROCESS (JOB, "STAT JOB", 0.0, 0.0, 0);
   SIMULATION.START_SIMULATION (100.0);
   STATISTICS.REPORT_STATISTICS;
end EXAMPLE1;
