LibCommon_Time.ttcn 3 KB
Newer Older
1 2
/**
 *  @author   ETSI
3
 *  @version  $URL: https://oldforge.etsi.org/svn/LibCommon/tags/v1.4.0/ttcn/LibCommon_Time.ttcn $
4
 *            $Id: LibCommon_Time.ttcn 64 2016-12-14 15:09:43Z berge $
5 6 7 8 9 10 11
 *  @desc     A collection of time handling functions which may be useful in
 *            the implementation of any TTCN-3 test suite.
 *  @remark   End users should be aware that any changes made to the  in
 *            definitions this module may be overwritten in future releases.
 *            End users are encouraged to contact the distributers of this
 *            module regarding their modifications or additions so that future
 *            updates will include your changes.
12 13 14 15 16
 *  @copyright  ETSI Copyright Notification
 *                No part may be reproduced except as authorized by written permission.
 *                The copyright and the foregoing restriction extend to reproduction in all media.
 *                All rights reserved.
 *
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
 */
module LibCommon_Time {

  group timeLibModuleParameters {

    /**
     * @desc    Time to control PTC.stop
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar float PX_TDONE := 120.0;

    /**
     * @desc    Time to control the reception of a message
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar float PX_TAC := 30.0;

    /**
     * @desc    Time to control that IUT sends nothing
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar float PX_TNOAC := 10.0;

    /**
     * @desc    Time to control that IUT reacts prior to Upper Tester action
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar float PX_TWAIT := 120.0;

    /**
     * @desc    Time to control sending in loops
     * @remark  PICS/PIXIT Reference: XXX
    */
    modulepar float PX_LOOP := 1.0;

  } // end group timeLibModuleParameters

  group sleeping {

    /**
     * @desc  The invocation of this function will cause a test component
     *        to sleep (or wait) for a specified amount of time.
     *        Defaults may interrupt this sleep if activated.
     * @see   LibCommon_Time.f_sleepIgnoreDef
     * @param p_duration Amount of time that the test component should wait.
     */
    function f_sleep ( in float p_duration ) {
      timer t;
      if (p_duration <= 0.0) {return}
      t.start( p_duration );
      t.timeout;
    }

    /**
     * @desc  The invocation of this function will cause a test component
     *        to sleep (or wait) for a specified amount of time.
     *        This function ignores any active defaults, i.e., the function
     *        will always wait the specified amount of time.
     * @param p_duration Amount of time that the test component should wait.
     */
    function f_sleepIgnoreDef ( in float p_duration ) {
      timer t;
      if (p_duration <= 0.0) {return}
      t.start( p_duration );
      alt {
        [] t.timeout {}
        [else] {repeat}
      } // end alt
    }

  } // end group sleeping

} // end module LibCommon_Time