E_CYCLE Test Notes

The spreadsheet workbook below shows the results of using the JUnit3 test method testStatistics() to collect measured periods between occurrences of the EO output of an instance of the E_CYCLE function block type over a period of 3 seconds for a DT (Delay Time) value of t#33.33ms on various operating systems and hardware platforms. Due to the "run to completion" semantics of the Java™-based FBRT runtime, the actual measured interval is (DT+tEO+tMT), where tEO is the time required for EO to fire and process the serviceEvent() method of the internal EventServer in the testStatistics() method, and tMT is the overhead associated with the multi-tasking operating system.

public synchronized void testStatistics() throws Exception {
   fixture.DT.initialize("t#33.33ms");
   fixture.EO.deleteConnection(logger);
   fixture.EO.deleteConnection(this);
   count = 0;
   EventServer server = new AbstractEvent() {
      @Override
      public void serviceEvent(EventServer e) {
         t[++count] = System.nanoTime();}};
   fixture.EO.connectTo(server);
   t[0] = System.nanoTime();
   fixture.START.serviceEvent(this);
   wait(3000);
   fixture.STOP.serviceEvent(this);
   fixture.EO.deleteConnection(server);
   float x;
   float sumx = 0;
   float sumx2 = 0;
   float xmax = 0;
   float xmin = 1000;
   for (int i = 0; i < count; i++) {
      x = (float) ((t[i + 1] - t[i]) * 1e-6);
      System.out.println(x);
      sumx += x;
      sumx2 += x * x;
      xmin = Math.min(xmin, x);
      xmax = Math.max(xmax, x);}
   float mean = sumx / count;
   float sd = (float) Math.sqrt((sumx2 - mean * sumx) / (count - 1));
   System.out.println(count);
   System.out.println(mean);
   System.out.println(sd);
   System.out.println(xmin);
   System.out.println(xmax);
}