/******************************************************************************/
// @copyright   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.
//   Trademark 2010, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC).
//   All rights reserved.
// @version: IWD_10wk37
// $Date: 2010-09-14 15:22:42 +0200 (Tue, 14 Sep 2010) $
// $Rev: 3872 $
/******************************************************************************/

module RRC_Measurement_GERAN
{
  import from CommonIratDefs all;
  //import from GERAN_CellInfo all;
  import from GERAN_CommonFunctions all;
  import from GERAN_Component all;
  import from GERAN_TypeDefs all;
  import from GERAN_Templates all;

  //================================================================
  //testcase 8.3.2.1:
  //Measurement configuration control and reporting / inter RAT measurements: event B2 (measurement of GERAN cells)
  function f_TC_8_3_2_1_GERAN () runs on GERAN_PTC
  {
    var boolean v_TriggerRxd := false;
    var integer v_T0_RSSI_Cell24 := -85;
    var integer v_T1_RSSI_Cell24 := -65;
    var integer v_T2_RSSI_Cell24 := -85;

    //Initialise test case
    f_GERAN_Init ( EUTRA_GERAN );

    //Create GERAN cell and broadcast System Infomation
    f_GERAN_CreateCell ( geran_Cell24 );

    //Set GERAN cell's power level for T0
    f_GERAN_SetCellPowerLevel( geran_Cell24, v_T0_RSSI_Cell24 );

    f_GERAN_Send_IR_SysInfoToEUTRA ( geran_Cell24 );
    
    f_GERAN_TestBody_Set( true );
    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 4" siclog@
    //First Trigger: Change cell power according to T1
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    f_GERAN_SetChPwrLevel ( geran_Cell24, tsc_PhyCh0, v_T1_RSSI_Cell24 );
    
    //@siclog "Step 6" siclog@
    //Second Trigger: Change cell power according to T2
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    f_GERAN_SetChPwrLevel ( geran_Cell24, tsc_PhyCh0, v_T2_RSSI_Cell24 );

    //Wait for the end of the test
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    
    //End TestBody
    //------------------------------------------------
    f_GERAN_TestBody_Set ( false );
    
    f_GERAN_SS_CellRelease ( geran_Cell24 );
    
  }; //end of testcase 8.3.2.1

  //================================================================
  //testcase 8.3.2.2:
  //Measurement configuration control and reporting / Inter-RAT measurements / Periodic reporting / Measurement of GERAN cells
  function f_TC_8_3_2_2_GERAN () runs on GERAN_PTC
  {
    var boolean v_TriggerRxd := false;
    var integer v_T0_RSSI_Cell25 := tsc_GERAN_ChPwrLvl_Off;
    var integer v_T1_RSSI_Cell25 := -70;
    var integer v_T2_RSSI_Cell25 := tsc_GERAN_ChPwrLvl_Off;
    var integer v_T0_RSSI_Cell26 := tsc_GERAN_ChPwrLvl_Off;
    var integer v_T1_RSSI_Cell26 := tsc_GERAN_ChPwrLvl_Off;
    var integer v_T2_RSSI_Cell26 := -70;

    //Initialise test case
    f_GERAN_Init ( EUTRA_GERAN );

    //Create GERAN cell and broadcast System Infomation
    f_GERAN_CreateCell ( geran_Cell25 );
    f_GERAN_CreateCell ( geran_Cell26 );

    //Set GERAN cell's power level for T0
    f_GERAN_SetCellPowerLevel( geran_Cell25, v_T0_RSSI_Cell25 );
    f_GERAN_SetCellPowerLevel( geran_Cell26, v_T0_RSSI_Cell26 );

    f_GERAN_Send_IR_SysInfoToEUTRA ( geran_Cell25 );
    f_GERAN_Send_IR_SysInfoToEUTRA ( geran_Cell26 );
    
    f_GERAN_TestBody_Set( true );
    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 3" siclog@
    //First Trigger: Change cell power according to T1
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    f_GERAN_SetChPwrLevel ( geran_Cell25, tsc_PhyCh0, v_T1_RSSI_Cell25 );
    f_GERAN_SetChPwrLevel ( geran_Cell26, tsc_PhyCh0, v_T1_RSSI_Cell26 );
    
    //@siclog "Step 6" siclog@
    //Second Trigger: Change cell power according to T2
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    f_GERAN_SetChPwrLevel ( geran_Cell25, tsc_PhyCh0, v_T2_RSSI_Cell25 );
    f_GERAN_SetChPwrLevel ( geran_Cell26, tsc_PhyCh0, v_T2_RSSI_Cell26 );

    //Wait for the end of the test
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    
    //End TestBody
    //------------------------------------------------
    f_GERAN_TestBody_Set ( false );
    
    f_GERAN_SS_CellRelease ( geran_Cell25 );
    f_GERAN_SS_CellRelease ( geran_Cell26 );
    
  }; //end of testcase 8.3.2.2
  
  //================================================================
  //testcase 8.3.2.6:
  //Measurement configuration control and reporting / inter RAT measurements: Simultaneous A2 and two B2 (measurements of E-UTRAN, UTRAN and GERAN cells)
  function f_TC_8_3_2_6_GERAN () runs on GERAN_PTC
  {
    var boolean v_TriggerRxd := false;
    var integer v_T0_RSSI_Cell24 := -85;
    var integer v_T1_RSSI_Cell24 := -65;
    
    //Initialise test case
    f_GERAN_Init ( EUTRA_UTRAN_GERAN );
    
    //Create GERAN cell and broadcast System Infomation
    f_GERAN_CreateCell ( geran_Cell24 );

    //Set GERAN cell's power level for T0
    f_GERAN_SetCellPowerLevel( geran_Cell24, v_T0_RSSI_Cell24 );
    
    f_GERAN_Send_IR_SysInfoToEUTRA ( geran_Cell24 );
    
    f_GERAN_TestBody_Set( true );
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 4" siclog@
    //First Trigger: Change cell power according to T1
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    f_GERAN_SetChPwrLevel ( geran_Cell24, tsc_PhyCh0, v_T1_RSSI_Cell24 );
    
    //Wait for the end of the test
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    
    //End TestBody
    //------------------------------------------------
    f_GERAN_TestBody_Set ( false );
    
    f_GERAN_SS_CellRelease ( geran_Cell24 );
    
  }; //end of testcase 8.3.2.6
  
  //================================================================
  //testcase 8.3.3.3:
  //Measurement configuration control and reporting / SON / ANR / CGI reporting of GERAN cell
  function f_TC_8_3_3_3_GERAN () runs on GERAN_PTC
  {
    var boolean v_TriggerRxd := false;
    var integer v_T0_RSSI_Cell24 := -85;
    var integer v_T1_RSSI_Cell24 := -65;
    
    //Initialise test case
    f_GERAN_Init ( EUTRA_UTRAN_GERAN );
    
    //Create GERAN cell and broadcast System Infomation
    f_GERAN_CreateCell ( geran_Cell24 );
    
    //Set GERAN cell's power level for T0
    f_GERAN_SetCellPowerLevel( geran_Cell24, v_T0_RSSI_Cell24 );
    
    f_GERAN_Send_IR_SysInfoToEUTRA ( geran_Cell24 );
    
    f_GERAN_TestBody_Set( true );
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 3" siclog@
    //First Trigger: Change cell power according to T1
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    f_GERAN_SetChPwrLevel ( geran_Cell24, tsc_PhyCh0, v_T1_RSSI_Cell24 );
    
    //Wait for the end of the test
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    
    //End TestBody
    //------------------------------------------------
    f_GERAN_TestBody_Set ( false );
    
    f_GERAN_SS_CellRelease ( geran_Cell24 );
    
  }; //end of testcase 8.3.3.3
  
} // end of Module
