TOF time FB

This test case it part of the test suite proposed for new devices.

Test case ID: R1024
Language: ST

Code:
tests2/t1024.st
(* TOF test - this should be called several 18 times with deltaTime=100msecs  (~ 1.8 segs)  *)

(*

   cycle = 100msecs    TOF: extends 250msec

          +---------+        +---+   +------+
IN        |         |        |   |   |      |
        --+         +--------+   +---+      +-------------
          1         4        8   10  12     14    
          +--------------+   +-------------------+
Q         |              |   |                   |
       ---+              +---+                   +-------------
                        6.5  8                  16.5
      PT                 +---+                   +------
       :                /    |       +          /   
ET     :               /     |      /|         /    
       :              /      |     / |        /     
       :             /       |    /  |       /      
       0------------+        +---+   +------+       
*)

PROGRAM T1024
   VAR 
    cycle : INT := -1; // cicles are counted started from 0, so time ~ 100msec x cycle
    tof1: TOF;   // delays start by 350
    dt1 : DATE_AND_TIME; // timestamp
  END_VAR

  VAR_TEMP
   input : BOOL ; 
   msecs : DINT :=0;
  END_VAR 

  cycle := cycle + 1;

  IF cycle = 0 THEN // at cycle 1 we produce a rising edge at TP1 input
        dt1:= _GEB_NOW_TIMESTAMP(1); // record start of exec
  END_IF;
  msecs := TIME_TO_DINT(_GEB_ELAPSED_TIME(dt1));

  input := (cycle >=1 AND  cycle <4) OR (cycle >=8 AND cycle <10) OR (cycle >=12 AND cycle <14);

  tof1( IN := input , PT := T#250ms);

  IF NOT(tof1.Q) THEN
         _GEB_ASSERT_(cycle = 0 OR cycle = 7 OR cycle >= 17);
  ELSE  
         _GEB_ASSERT_(NOT(cycle = 0 OR cycle = 7 OR cycle >= 17));
  END_IF;

  IF input THEN
    _GEB_ASSERT_(tof1.Q);
  END_IF;

 // _GEB_MSG_(INT_TO_STRING(cycle));      
  // _GEB_MSG_(DINT_TO_STRING(TIME_TO_DINT(tof1.ET)));      

 // IF (NOT (ton1.Q )) AND  (cycle = 4 OR cycle =5 OR cycle = 14) THEN
  //       _GEB_MSG_(INT_TO_STRING(cycle));      
  //       _GEB_MSG_(INT_TO_STRING(msecs));      
  //       _GEB_MSG_(TIME_TO_STRING(ton1.ET));  
  //END_IF;

  

END_PROGRAM