/******************************************************************************/
// @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-17 09:01:56 +0200 (Fri, 17 Sep 2010) $
// $Rev: 3947 $
/******************************************************************************/

module RRC_Measurement
{

/////////////////
// Import Part //
/////////////////

  import from EUTRA_RRC_ASN1_Definitions language "ASN.1:1997" all;
  import from EUTRA_Component all;
  import from Parameters all;
  import from CommonDefs all;
  import from EUTRA_CommonDefs all;
  import from CommonIratDefs all;
  import from EUTRA_RRC_Templates all;
  import from EUTRA_SRB_Templates all;
  import from EUTRA_AspCommon_Templates all;
  import from EUTRA_CellInfo all;
  import from EUTRA_CommonProcedures all;
  import from EUTRA_ConfigurationSteps all;
  import from EUTRA_Measurement_Templates all;
  import from EUTRA_Measurement_Specific_Templates all;
  import from EUTRA_Timing all;
  import from UTRAN_CellInfo all;
  import from EUTRA_RRCSteps all;
  import from EUTRA_CellCfg_Templates all;
  import from EUTRA_SecuritySteps all;
  import from EUTRA_SecurityFunctions all;
  import from EUTRA_ASP_TypeDefs all;
  import from EUTRA_ASP_SrbDefs all;
  ////////////////////
  // Functions Part //
  ////////////////////
  
  //****************************************************************
  //Common used functions
  //****************************************************************
  
  /*
   * @desc      Wait for the given time and ignore measurement reports
   * @param     p_CellId
   * @param     p_Timer
   * @param     p_MeasurementReport
   * @status    APPROVED
   */
  function fl_WaitAndIgnoreMeasurementReport(CellId_Type p_CellId,
                                             float p_Timer,
                                             template (present) UL_DCCH_Message p_MeasurementReport) runs on EUTRA_PTC
  {
    timer t_Wait;
    t_Wait.start(p_Timer);
    alt {
      [] t_Wait.timeout
        {
        }
      [] SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport ) )
        {
          repeat;
        }
    }
  } // end of function fl_WaitAndIgnoreMeasurementReport
  
  /*
   * @desc      Check that Measurement report is received within a certain time and assign verdicts
   * @param     p_CellId
   * @param     p_Timer
   * @param     p_MeasurementReport
   * @status    APPROVED
   */
  function fl_Check_Timer_MeasurementReport(CellId_Type p_CellId,
                                            float p_Timer,
                                            template (present) UL_DCCH_Message p_MeasurementReport ) runs on EUTRA_PTC
  {
    timer t_Wait;
    t_Wait.start(p_Timer);
    alt {
      [] t_Wait.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Check failed: No MeasurementReport message received within certain time" );
        }
      [] SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport ) )
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Preliminary pass: MeasurementReport message received within a certain time" );
        }
    }
  } // end of function fl_Check_Timer_MeasurementReport
  
  /*
   * @desc      Check that no uplink message is received within certain time
   * @param     p_Timer
   * @status    APPROVED
   */
  function fl_NoUplinkMessage( float p_Timer ) runs on EUTRA_PTC
  {
    timer t_Wait;
    t_Wait.start(p_Timer);
    alt {
      [] t_Wait.timeout
        {
        }
      [] SRB.receive
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Check failed: Uplink message received within a certain time" );
        }
    }
  } // end of function fl_NoUplinkMessage
  
  //----------------------------------------------------------------------------
  /*
   * @desc      Check that no measurement report is received within certain time1
   * @param     p_CellId
   * @param     p_Timer
   * @param     p_MeasurementReport
   * @status    APPROVED
   */
  function fl_NoMeasurementReport(CellId_Type p_CellId,
                                  float p_Timer,
                                  template (present) UL_DCCH_Message p_MeasurementReport) runs on EUTRA_PTC
  {
    timer t_Wait;
    t_Wait.start(p_Timer);
    alt {
      [] t_Wait.timeout
        {
        }
      [] SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport ) )
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Check failed: MeasurementReport message received within certain time" );
        }
    }
  } // end of function fl_NoMeasurementReport

  //----------------------------------------------------------------------------
  /*
   * @desc      Receive periodical measurement report and check every report interval within a certain period
                ( Only applicable to high frequency report ( report interval less than or equal to ms1024 ) )
   * @param     p_CellId
   * @param     p_MeasurementReport
   * @param     p_ReportInterval
   * @status    p_TimeoutTimer
   */
  function f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport( CellId_Type p_CellId,
                                                              template (present) UL_DCCH_Message p_MeasurementReport,
                                                              float p_TotalTimer,
                                                              float p_ReportInterval,
                                                              float p_TimeoutTimer ) runs on EUTRA_PTC
  {
    var SRB_COMMON_IND v_ReceivedAsp;
    var integer v_PreviousSFN;
    var integer v_CurrentSFN;
    var integer v_SFNLapse;

    timer t_TimeoutTimer;
    timer t_TotalTimer;

    t_TotalTimer.start( p_TotalTimer );

    //receive the 1st MeasurementReport message.
    t_TimeoutTimer.start( p_TimeoutTimer );
    alt {
      []t_TotalTimer.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "No MeasurementReport message received!" );
        }
      []t_TimeoutTimer.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "No MeasurementReport message received!" );
        }
      []SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport ) )
          -> value v_ReceivedAsp
        {
          t_TimeoutTimer.stop;
          t_TimeoutTimer.start( p_TimeoutTimer );

          v_PreviousSFN := v_ReceivedAsp.Common.TimingInfo.SubFrame.SFN.Number;
        }
    }

    //receive and check the subsequent MeasurementReport messages.
    alt {
      []t_TimeoutTimer.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Timeout when receiving periodical MeasurementReport message!" );
        }
      []SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport ) )
          -> value v_ReceivedAsp
        {
          t_TimeoutTimer.stop;
          t_TimeoutTimer.start( p_TimeoutTimer );

          v_CurrentSFN := v_ReceivedAsp.Common.TimingInfo.SubFrame.SFN.Number;
          v_SFNLapse := ( v_CurrentSFN - v_PreviousSFN ) mod 1024;

          if( ( int2float( v_SFNLapse ) > p_ReportInterval * 110.0 ) or //v_SFNLapse * 10 > p_ReportInterval * 110% * 1000
              ( int2float( v_SFNLapse ) < p_ReportInterval * 90.0 ) )   //v_SFNLapse * 10 < p_ReportInterval * 90% * 1000
          {
            f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Abnormal report interval!" );
          }
          else
          {
            f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Preliminary pass: periodical MeasurementReport message received" );
          }

          v_PreviousSFN := v_CurrentSFN;
          repeat;
        }
      []t_TotalTimer.timeout
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Periodical MeasurementReport test pass!" );
        }
    }
  } //end of f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport

  // --- fl_Check_PeriodicalReporting_2Measurements: Check that two kind of periodical MeasurementReports is received within a certain time and assign verdicts ---
  function fl_Check_PeriodicalReporting_2Measurements(CellId_Type p_CellId,
                                                      float p_TotalTimer,
                                                      float p_CheckTimer_1,
                                                      template(present) UL_DCCH_Message p_MeasurementReport_1,
                                                      float p_CheckTimer_2,
                                                      template(present) UL_DCCH_Message p_MeasurementReport_2 ) runs on EUTRA_PTC
  {
    timer t_TotalTimer;
    timer t_CheckTimer_1;
    timer t_CheckTimer_2;
    t_TotalTimer.start( p_TotalTimer );
    t_CheckTimer_1.start( p_CheckTimer_1 );
    t_CheckTimer_2.start( p_CheckTimer_2 );
    alt {
      [] t_TotalTimer.timeout{}
      [] t_CheckTimer_1.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Check failed when trying to receive two kind of periodical MeasurementReport message" );
        }
      [] t_CheckTimer_2.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Check failed when trying to receive two kind of periodical MeasurementReport message" );
        }
      [] SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport_1 ) )
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Preliminary pass: periodical MeasurementReport message received" );
          t_CheckTimer_1.stop;
          t_CheckTimer_1.start( p_CheckTimer_1 );
          repeat;
        }
      [] SRB.receive( car_SRB1_RrcPdu_IND( p_CellId, p_MeasurementReport_2 ) )
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Preliminary pass: periodical MeasurementReport message received" );
          t_CheckTimer_2.stop;
          t_CheckTimer_2.start( p_CheckTimer_2 );
          repeat;
        }
    }
  } // end of function fl_Check_PeriodicalReporting_2Measurements
  
  //****************************************************************
  //Testcases
  //****************************************************************
  
  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.1
   * @status    APPROVED
   */
  function f_TC_8_3_1_1_EUTRA() runs on EUTRA_PTC
  { // Measurement configuration control and reporting / Intra E-UTRAN measurements / Event A1  //Changed title, CR R5-101186
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var integer v_T0_RS_EPRE := -85;
    var integer v_T1_RS_EPRE := -59;
    var integer v_T2_RS_EPRE := -85;
    
    var PhysCellId v_PhysCellId_Cell1;
    var Frequency_IE_Type v_Frequency_IE_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_Cell1;
    
    var float v_TimerValue1;
    var float v_TimerValue2;
    
    //Initialize testcase
    f_EUTRA_Init( c1 );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_Cell1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_Cell1 := f_EUTRA_BandDependentParam( v_Frequency_IE_Cell1.DL_ChBandwidth, v_Frequency_IE_Cell1.UL_ChBandwidth );
    
    v_TimerValue1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    v_TimerValue2 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T1_RS_EPRE );
    
    //Create and configure Cell 1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble(eutra_Cell1, STATE2_IDLEUPDATE);
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measurementConfiguration to setup intra LTE measurement and reporting for event A1. */
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_1_Step1(tsc_RRC_TI_Def,
                                                                                 v_Frequency_IE_Cell1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_Cell1.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T1" in table 8.3.1.1.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A1 with the measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.1 Step 4" );
    
    //EXCEPTION: Step 5 below is repeated until 3 MeasurementReport messages are received from the UE
    
    //@siclog "Step 5" siclog@
    //Repeat 1: Check: does the UE transmit a MeasurementReport message, with a measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    
    //@siclog "Step 5" siclog@
    //Repeat 2: Check: does the UE transmit a MeasurementReport message, with a measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    
    //@siclog "Step 5" siclog@
    //Repeat 3: Check: does the UE transmit a MeasurementReport message, with a measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.1 Step 5" );
    
    //@siclog "Step 6" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T2" in table 8.3.1.1.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE, cs_TimingInfo_Now );
    
    //@siclog "Step 7" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow change of power levels for Cell 1
    fl_WaitAndIgnoreMeasurementReport( eutra_Cell1, v_TimerValue1, cr_MeasurementReport( 1, ?, ?, omit ) );
    
    //@siclog "Step 8" siclog@
    //Check: does the UE attempt to transmit an uplink message within the next 10s?
    fl_NoUplinkMessage( v_TimerValue2 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.1.1
  
  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.2
   * @status    APPROVED
   */
  function f_TC_8_3_1_2_EUTRA() runs on EUTRA_PTC
  { // Measurement configuration control and reporting / Intra E-UTRAN measurements / Event A2  //Changed title, CR R5-101186
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var integer v_T0_RS_EPRE := -70;
    var integer v_T1_RS_EPRE := -96;
    var integer v_T2_RS_EPRE := -70;
    
    var PhysCellId v_PhysCellId_Cell1;
    var Frequency_IE_Type v_Frequency_IE_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_Cell1;
    
    var float v_TimerValue1;
    var float v_TimerValue2;
    
    //Initialize testcase
    f_EUTRA_Init( c1 );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_Cell1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_Cell1 := f_EUTRA_BandDependentParam( v_Frequency_IE_Cell1.DL_ChBandwidth, v_Frequency_IE_Cell1.UL_ChBandwidth );
    
    v_TimerValue1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    v_TimerValue2 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE ); //@sic R5s100176, Change 1: Initialize maximum reference power for cell1
    
    //Create and configure Cell 1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble(eutra_Cell1, STATE2_IDLEUPDATE);
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measurementConfiguration to setup intra LTE measurement and reporting for event A2.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_2_Step1(tsc_RRC_TI_Def,
                                                                                 v_Frequency_IE_Cell1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_Cell1.AllowedMeasBandwidth)));
    
    //@siclog "Step 2" siclog@
    //The UE transmit an RCConnectionReconfigurationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T1" in table 8.3.1.2.3.2.-1.
    f_EUTRA_SetCellPower(eutra_Cell1, v_T1_RS_EPRE, cs_TimingInfo_Now);
    
    //@siclog "Step 4" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A2 with the measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.2 Step 4" );

    //EXCEPTION: Step 5 below is repeated until 3 MeasurementReport messages are received from the UE
    
    //@siclog "Step 5" siclog@
    //Repeat 1: Check: does the UE transmit a MeasurementReport message, with a measured RSRP value for Cell 1? [ask NEC!!! 086301]
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    
    //@siclog "Step 5" siclog@
    //Repeat 2: Check: does the UE transmit a MeasurementReport message, with a measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );
    
    //@siclog "Step 5" siclog@
    //Repeat 3: Check: does the UE transmit a MeasurementReport message, with a measured RSRP value for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) );

    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.2 Step 5" );
    
    //@siclog "Step 6" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T2" in table 8.3.1.2.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE, cs_TimingInfo_Now );
    
    //@siclog "Step 7" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow change of power levels for Cell 1.
    fl_WaitAndIgnoreMeasurementReport( eutra_Cell1, v_TimerValue1, cr_MeasurementReport( 1, ?, ?, omit ) );
    
    //@siclog "Step 8" siclog@
    //Check: does the UE attempt to transmit an uplink message within the next 10s?
    fl_NoUplinkMessage( v_TimerValue2 );
    
    //End TestBody
    //------------------------------------------------

    //@sic R5s100176, Change 2: send and receive UE capability enquiry is removed in test procedure before postamble

    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@

  } //end of testcase 8.3.1.2

  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.3
   * @status    APPROVED
   */
  function f_TC_8_3_1_3_EUTRA() runs on EUTRA_PTC
  { //Measurement configuration control and reporting / Intra E-UTRAN measurements / 2 Two simultaneous events A3(intra and inter-frequency measurements)
    
    var integer v_T0_T1_T2_RS_EPRE_Cell1 := -85;  // Changed from -80 to -85, CR R5-101032r2
    var integer v_T0_RS_EPRE_Cell2 := -91;  // Changed from -110 to -91, CR R5-101032r2
    var integer v_T1_RS_EPRE_Cell2 := -79;  // Changed from -59 to -79, CR R5-101032r2
    var integer v_T2_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;  // Changed from -110 to Off, CR R5-101032r2
    var integer v_T0_T1_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE;  // Changed from -110 to Off, CR R5-101032r2
    var integer v_T2_RS_EPRE_Cell3 := -73;  // Changed from -51 to -73, CR R5-101032r2
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    
    var PhysCellId v_PhysCellId_Cell2;
    var PhysCellId v_PhysCellId_Cell3;
    var Frequency_IE_Type v_Frequency_IE_Cell2;
    var Frequency_IE_Type v_Frequency_IE_Cell3;
    var ChannelBandwidthDependency_Type v_ChBandDependency_Cell2;
    var ChannelBandwidthDependency_Type v_ChBandDependency_Cell3;
    
    var float v_TimerValue1;
    var float v_TimerValue2;
    
    var template(value) CellPowerList_Type v_CellPowerList;
    
    //Initialize testcase
    f_EUTRA_Init( c3 );
    
    v_TimerValue1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    v_TimerValue2 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    
    v_PhysCellId_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_Frequency_IE_Cell2 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell2 );
    v_ChBandDependency_Cell2 := f_EUTRA_BandDependentParam( v_Frequency_IE_Cell2.DL_ChBandwidth, v_Frequency_IE_Cell2.UL_ChBandwidth );
    
    v_PhysCellId_Cell3 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell3 );
    v_Frequency_IE_Cell3 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell3 );
    v_ChBandDependency_Cell3 := f_EUTRA_BandDependentParam( v_Frequency_IE_Cell3.DL_ChBandwidth, v_Frequency_IE_Cell3.UL_ChBandwidth );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_T1_T2_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T1_RS_EPRE_Cell2 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell3, v_T2_RS_EPRE_Cell3 );
    
    //Create and configure Cell1, Cell2, Cell3
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    f_EUTRA_SetCellConfigCapability( eutra_Cell2, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell2 ); //@sic R5-103077 sic@
    
    f_EUTRA_SetCellConfigCapability( eutra_Cell3, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell3 ); //@sic R5-103077 sic@
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_T1_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T0_T1_RS_EPRE_Cell3, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );

    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measConfig to setup intra LTE E-UTRAN measurement and reporting for two event A3(measId 1 and measId 2)(intra and inter frequency measurement).
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_3_Step1(v_RRC_TI,
                                                                                 v_Frequency_IE_Cell2.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_Cell2.AllowedMeasBandwidth,
                                                                                 v_Frequency_IE_Cell3.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_Cell3.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //Check: does the UE transmit a MeasurementReport message within the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue1, cr_MeasurementReport_CheckAny );

    //@siclog "Step 4" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T1" in table 8.3.1.3.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A3(measId 1) with the measured RSRP value for Cell 2?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_rsrp( 1, v_PhysCellId_Cell2 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.3 Step 5" );
    
    //@siclog "Step 6" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T2" in table 8.3.1.3.3.2.-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell2, v_T2_RS_EPRE_Cell2 ),  // Changed from v_T0_T2_RS_EPRE_Cell2 to v_T2_RS_EPRE_Cell2, CR R5-101032r2
      cs_CellPower( eutra_Cell3, v_T2_RS_EPRE_Cell3 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 7" siclog@
    //Void //@sic "changed to void according to CR R5-105011" @sic
    
    //@siclog "Step 8" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A3(measId 2) with the measured RSRP value for Cell 3?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_rsrp( 2, v_PhysCellId_Cell3 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.3 Step 8" );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.1.3
  
  //================================================================
  //testcase 8.3.1.4:
  //Measurement configuration control and reporting / Intra E-UTRAN measurements / Periodic reporting(intra and inter-frequency measurements)  //Changed title, CR R5-101186
  function f_TC_8_3_1_4_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := -91; //@sic R5-103498 sic@
    var integer v_T0_RS_EPRE_Cell3 := -85; //@sic R5-103498 sic@
    var integer v_T0_RS_EPRE_Cell4 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T0_RS_EPRE_Cell6 := tsc_NonSuitableOffCellRS_EPRE;
    
    var integer v_T1_RS_EPRE_Cell1 := -85;
    var integer v_T1_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T1_RS_EPRE_Cell3 := -85; //@sic R5-103498 sic@
    var integer v_T1_RS_EPRE_Cell4 := -91; //@sic R5-103498 sic@
    var integer v_T1_RS_EPRE_Cell6 := tsc_NonSuitableOffCellRS_EPRE;
    
    var integer v_T2_RS_EPRE_Cell1 := -85;
    var integer v_T2_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T2_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T2_RS_EPRE_Cell4 := -91; //@sic R5-103498 sic@
    var integer v_T2_RS_EPRE_Cell6 := -85; //@sic R5-103498 sic@

    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    
    var PhysCellId v_PhysCellId_Cell1;
    var PhysCellId v_PhysCellId_Cell2;
    var PhysCellId v_PhysCellId_Cell3;
    var PhysCellId v_PhysCellId_Cell4;
    var PhysCellId v_PhysCellId_Cell6;
    
    var Frequency_IE_Type v_Frequency_IE_f1;
    var Frequency_IE_Type v_Frequency_IE_f2;
    var Frequency_IE_Type v_Frequency_IE_f3;
    
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f2;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f3;
    
    var float v_TimerValue_30s;
    var float v_TimerValue_5s;
    var float v_TimerValue_10s;
    
    var default v_DefaultRef;
    
    //Initialize testcase
    f_EUTRA_Init( c3 );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_PhysCellId_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_PhysCellId_Cell3 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell3 );
    v_PhysCellId_Cell4 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell4 );
    v_PhysCellId_Cell6 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell6 );
    
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_Frequency_IE_f2 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell3 );
    v_Frequency_IE_f3 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell6 );
    
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    v_ChBandDependency_f2 := f_EUTRA_BandDependentParam( v_Frequency_IE_f2.DL_ChBandwidth, v_Frequency_IE_f2.UL_ChBandwidth );
    v_ChBandDependency_f3 := f_EUTRA_BandDependentParam( v_Frequency_IE_f3.DL_ChBandwidth, v_Frequency_IE_f3.UL_ChBandwidth );

    v_TimerValue_30s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 30.0 );
    v_TimerValue_5s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    v_TimerValue_10s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T0_RS_EPRE_Cell2 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell3, v_T0_RS_EPRE_Cell3 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell4, v_T1_RS_EPRE_Cell4 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell6, v_T2_RS_EPRE_Cell6 );

    //Create and configure Cell1, Cell2, Cell3, Cell4, Cell6
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    f_EUTRA_SetCellConfigCapability( eutra_Cell2, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell2 ); //@sic R5-103077 sic@

    f_EUTRA_SetCellConfigCapability( eutra_Cell3, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell3 ); //@sic R5-103077 sic@

    f_EUTRA_SetCellConfigCapability( eutra_Cell4, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell4 ); //@sic R5-103077 sic@

    f_EUTRA_SetCellConfigCapability( eutra_Cell6, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell6 ); //@sic R5-103077 sic@
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T0_RS_EPRE_Cell3, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell4, v_T0_RS_EPRE_Cell4, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell6, v_T0_RS_EPRE_Cell6, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble(eutra_Cell1, STATE2_IDLEUPDATE);
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measurementConfiguration to setup intra LTE measurements and periodical reporting for intra and inter frequency cells.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_4_Step1(v_RRC_TI,
                                                                                 v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_f1.AllowedMeasBandwidth,
                                                                                 v_Frequency_IE_f2.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_f2.AllowedMeasBandwidth,
                                                                                 v_Frequency_IE_f3.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_f3.AllowedMeasBandwidth ) ) ); //@sic R5-103829r2 sic@
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //EXCEPTION: In parallel to events described in step 3 the steps specified in table 8.3.1.4.3.2-3 and table 8.3.1.4.3.2-4 shall take place
    
    //@siclog "Step 3" siclog@
    //Wait for 30 s to ensure that the UE performs a periodical intra frequency reporting and a periodical inter frequency reporting.
    fl_Check_PeriodicalReporting_2Measurements( eutra_Cell1,
                                                v_TimerValue_30s,
                                                v_TimerValue_5s,
                                                cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell2 ),
                                                v_TimerValue_5s,
                                                cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) );
    //Activate the default to receive periodical reports.
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1, cr_MeasurementReport_CheckAny ) );
    
    //@siclog "Step 4" siclog@
    //SS sets the cell-specific reference signal levels and switches Cell 4 and Cell 6 on according to row "T1" in table 8.3.1.4.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T1_RS_EPRE_Cell3, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell4, v_T1_RS_EPRE_Cell4, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell6, v_T1_RS_EPRE_Cell6, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow for the switching of cells.
    f_Delay(v_TimerValue_5s);

    //Deactivate the default.
    deactivate( v_DefaultRef );
    
    //EXCEPTION: In parallel to events described in steps 6 to 7 the steps specified in table 8.3.1.4.3.2-4 and table 8.3.1.4.3.2-5 shall take place
    
    //@siclog "Step 6" siclog@
    //Wait for 30 s to ensure that the UE performs a periodical intra frequency reporting and a periodical inter frequency reporting.
    fl_Check_PeriodicalReporting_2Measurements( eutra_Cell1,
                                                v_TimerValue_30s,
                                                v_TimerValue_5s,
                                                cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ),
                                                v_TimerValue_5s,
                                                cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell4 ) );
    
    //Activate the default to receive periodical reports.
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1, cr_MeasurementReport_CheckAny ) );
    
    //@siclog "Step 7" siclog@
    //SS sets the cell-specific reference signal levels and switches Cell 2 and Cell 3 off according to row "T2" in table 8.3.1.4.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T2_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T2_RS_EPRE_Cell3, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell4, v_T2_RS_EPRE_Cell4, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell6, v_T2_RS_EPRE_Cell6, cs_TimingInfo_Now );
    
    //@siclog "Step 8" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow for the switching of cells.
    f_Delay(v_TimerValue_5s);
    
    //Deactivate the default.
    deactivate( v_DefaultRef );
    
    //EXCEPTION: In parallel to events described in steps 9 to 10 the steps specified in table 8.3.1.4.3.2-5 and table 8.3.1.4.3.2-6 shall take place
    
    //@siclog "Step 9" siclog@
    //Wait for 30 s to ensure that the UE performs a periodical intra frequency reporting and a periodical inter frequency reporting.
    fl_Check_PeriodicalReporting_2Measurements( eutra_Cell1,
                                                v_TimerValue_30s,
                                                v_TimerValue_5s,
                                                cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell4 ),
                                                v_TimerValue_5s,
                                                cr_MeasurementReport_Eutra_1Entry_both( 3, v_PhysCellId_Cell6 ) ); //@sic R5-103829r2 sic@

    //Activate the default to receive periodical reports.
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1, cr_MeasurementReport_CheckAny ) );
    
    //@siclog "Step 10" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measurementConfiguration to remove measIds for periodical reporting.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_4_Step10( v_RRC_TI ) ) );
    
    //@siclog "Step 11" siclog@
    //The UE transmits an RRCConnectionReconfigrationComplete message
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //Deactivate the default.
    deactivate( v_DefaultRef );
    
    //@siclog "Step 12" siclog@
    //Check: does the UE attempt to transmit an uplink message for the next 10s?
    fl_NoUplinkMessage( v_TimerValue_10s );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
    /* Deactivate the default to stop receiving periodical Measurement Report */
    deactivate( v_DefaultRef );

  } //end of testcase 8.3.1.4
  
  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.5
   * @status    APPROVED
   */
  function f_TC_8_3_1_5_EUTRA() runs on EUTRA_PTC
  { //M easurement configuration control and reporting / Intra E-UTRAN measurements / Two simultaneous event A3(intra-frequency measurements)
    var integer v_T0_T1_T2_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5s100187, Change 1: 1)    Setting UE power as per prose 36.523-1
                                                                     //@sic R5-105041r2 "from -91 to Off" sic@
    var integer v_T1_RS_EPRE_Cell2 := -91; //@sic R5-105041r2 "from -79 to -91" sic@
    var integer v_T2_RS_EPRE_Cell2 := -79; //@sic R5s100187, Change 1: 1)    Setting UE power as per prose 36.523-1
                                           //
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    
    var float v_TimerValue;
    var PhysCellId v_PhysCellId;
    var Frequency_IE_Type v_Frequency_IE;
    var ChannelBandwidthDependency_Type v_ChBandDependency;
    
    //Initialize testcase
    f_EUTRA_Init( c2 );
    
    v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );

    v_PhysCellId := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_Frequency_IE := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell2 );
    v_ChBandDependency := f_EUTRA_BandDependentParam( v_Frequency_IE.DL_ChBandwidth, v_Frequency_IE.UL_ChBandwidth );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_T1_T2_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T1_RS_EPRE_Cell2 ); //@sic R5s100187, Change 1: 2)   Init the max reference power to maximum power level

    //Create and configure Cell1, Cell2
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    f_EUTRA_SetCellConfigCapability( eutra_Cell2, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell2 ); //@sic R5-103077 sic@

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_T1_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now ); //@sic R5s100187, Change 1: 3)  3)  Set the power level as per Table 8.3.1.5.3.2-1 of prose 36.523-1
    
    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measConfig to setup intra LTE E-UTRAN measurement and reporting for two event A3(measId 1 and measId 2) with different parameters.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_5_Step1(v_RRC_TI,
                                                                                 v_Frequency_IE.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RCConnectionReconfigurationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //Check: does the UE transmit a MeasurementReport message within the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue, cr_MeasurementReport_CheckAny );
    
    //@siclog "Step 4" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T1" in table 8.3.1.5.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A3(measId 1) with the measured RSRP value for Cell 2?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_rsrp( 1, v_PhysCellId ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.5 Step 5" );
    
    //@siclog "Step 6" siclog@
    //SS re-adjusts the cell-specific reference signal level according to row "T2" in table 8.3.1.5.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell2, v_T2_RS_EPRE_Cell2, cs_TimingInfo_Now );
    
    //@siclog "Step 7" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A3(measId 2) with the measured RSRP value for Cell 2?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_rsrp( 2, v_PhysCellId ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.5 Step 7" );
    
    //End TestBody
    //------------------------------------------------

    //@sic R5s100187, Change 1: 4)  Send and receive UE capability enquiry is removed in test procedure before postamble
    
    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.1.5

  //================================================================
  //testcase 8.3.1.7:
  //Measurement configuration control and reporting / Intra E-UTRAN measurements / Blacklisting  //Changed title, CR R5-101186
  function f_TC_8_3_1_7_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_T1_T2_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := -97;
    var integer v_T1_T2_RS_EPRE_Cell2 := -79;  // Changed from -70 to -79, CR R5-101033r1
    var integer v_T0_T1_RS_EPRE_Cell4 := -97;
    var integer v_T2_RS_EPRE_Cell4 := -79;  // Changed from -71 to -79, CR R5-101033r1
    //var integer v_T0_ATTENUATION := 0;
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    
    var float v_TimerValue;
    //var EUTRA_FDD_TDD_Mode_Type v_EUTRA_FDD_TDD_Mode;
    var PhysCellId v_PhysicalCellIdentity_Cell2;
    var PhysCellId v_PhysicalCellIdentity_Cell4;
    var Frequency_IE_Type v_Frequency_IE;
    var ChannelBandwidthDependency_Type v_ChBandDependency;
    
    f_EUTRA_Init( c3 ); // to be checked
    
    v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    
    v_PhysicalCellIdentity_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_PhysicalCellIdentity_Cell4 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell4 );
    v_Frequency_IE := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell2 );
    
    v_ChBandDependency := f_EUTRA_BandDependentParam( v_Frequency_IE.DL_ChBandwidth, v_Frequency_IE.UL_ChBandwidth );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_T1_T2_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T1_T2_RS_EPRE_Cell2 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell4, v_T2_RS_EPRE_Cell4 );

    //Create and configure Cell1, Cell2, Cell4
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    f_EUTRA_SetCellConfigCapability( eutra_Cell2, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell2 ); //@sic R5-103077 sic@

    f_EUTRA_SetCellConfigCapability( eutra_Cell4, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell4 ); //@sic R5-103077 sic@
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_T1_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell4, v_T0_T1_RS_EPRE_Cell4, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def( eutra_Cell1 );
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measurementConfiguration to setup intraLTE measurement and reporting for event A3.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_7_Step1(v_RRC_TI,
                                                                                 v_Frequency_IE.UL_DL_Earfcn.dl_CarrierFreq, //v_Frequency_IE.UL_DL_Earfcn.dl_CarrierFreq
                                                                                 v_ChBandDependency.AllowedMeasBandwidth,
                                                                                 v_PhysicalCellIdentity_Cell2 ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //SS re-adjusts the cell-specific reference signal levels according to row "T1" in table 8.3.1.7.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell2, v_T1_T2_RS_EPRE_Cell2, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //Check: does the UE transmit a MeasurementReport messages within the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue, cr_MeasurementReport_CheckAny );
    
    //@siclog "Step 5" siclog@
    //SS re-adjusts the cell-specific reference signal levels according to row "T2" in table 8.3.1.7.3.2.-1.
    f_EUTRA_SetCellPower( eutra_Cell4, v_T2_RS_EPRE_Cell4, cs_TimingInfo_Now );

    //@siclog "Step 6" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A3 with the measured RSRP values for Cell 1and Cell 4 without Cell 2 results?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_8_3_1_7_Step6( v_PhysicalCellIdentity_Cell4 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.7 Step 6" );

    //@siclog "Step 7" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measurementConfiguration to remove Cell 2 from the blacklisted cell list.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_7_Step7(v_RRC_TI,
                                                                                 v_Frequency_IE.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 8" siclog@
    //The UE transmits an RCConnectionReconfigrationComplete message
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );

    //@siclog "Step 9" siclog@
    //Check: does the UE transmit a MeasurementReport message to report event A3 with the measured RSRP values for Cell 1, Cell 2 and Cell 4?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_8_3_1_7_Step9(v_PhysicalCellIdentity_Cell2,
                                                                         v_PhysicalCellIdentity_Cell4 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.7 Step 9" );
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
  } //end of testcase 8.3.1.7
  
  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.8
   * @status    APPROVED
   */
  
  function f_TC_8_3_1_8_EUTRA() runs on EUTRA_PTC
  { // Measurement configuration control and reporting / Intra E-UTRAN measurements / Handover / IE measurement configuration present
    var integer v_T0_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := -91;
    var integer v_T1_RS_EPRE_Cell1 := -85;
    var integer v_T1_RS_EPRE_Cell2 := -79;
    
    var float v_TimerValue;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var template(value) CellPowerList_Type v_CellPowerList;
    
    var PhysCellId v_PhysCellId_Cell2;
    var Frequency_IE_Type v_Frequency_IE_Cell2;
    var ChannelBandwidthDependency_Type v_ChBandDependency_Cell2;

    //Initialize testcase
    f_EUTRA_Init( c2 );
    
    v_PhysCellId_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_Frequency_IE_Cell2 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell2 );
    v_ChBandDependency_Cell2 := f_EUTRA_BandDependentParam( v_Frequency_IE_Cell2.DL_ChBandwidth, v_Frequency_IE_Cell2.UL_ChBandwidth );

    v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell2, 30.0 );
   
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T1_RS_EPRE_Cell2 );
    
    //Create and configure Cell1, Cell2
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    f_EUTRA_CellConfig_Def( eutra_Cell2 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message on Cell 1 to setup intra frequency measurement.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_8_Step1(v_RRC_TI,
                                                                                 v_Frequency_IE_Cell2.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency_Cell2.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message on Cell 1 to confirm the setup of intra frequency measurement.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //The SS changes Cell 1 and Cell 2 parameters according to the row T1 in table 8.3.1.8.3.2-0.
    
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //The UE transmits a MeasurementReport message on Cell 1 to report event A3.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_8_3_1_8_Step4( v_PhysCellId_Cell2 ) ) );

    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    ////Activate the default to receive periodical reports for Cell2.
    //v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1,
    //                                                                         cr_MeasurementReport_8_3_1_8_Step4( v_PhysCellId_Cell2 ) ) );
    
    //@siclog "Step 5 - 6" siclog@
    //The SS transmits an RRCConnectionReconfiguration message with a measConfig on Cell 1 for removing event A3 reporting, to order the UE to perform intra frequency handover to Cell 2.
    //Check: Does the UE transmit an RRCConnectionReconfigurationComplete message on Cell 2
    f_EUTRA_508RRC_IntraLTE_HO_InterCell( eutra_Cell1, eutra_Cell2, -, -, cs_MeasConfig_8_3_1_8_Step5 ); //@sic R5s100491 change 1 sic@; @sic R5s100524 sic@
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.8 Step 6" );

    // f_EUTRA_StartDefULGrantTransmission( eutra_Cell2, cs_TimingInfo_Now ); //@sic R5s100491 Change 1 sic@; @sic R5s100524 clause 3.5.2.2 sic@

    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    ////Deactivate the default to stop receiving periodical Measurement Report
    //deactivate( v_DefaultRef );

    //@siclog "Step 7" siclog@
    //The SS changes Cell 1 and Cell 2 parameters according to the row "T0" in table 8.3.1.8.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 8" siclog@
    //Check: Does the UE transmit a MeasurementReport message on Cell 2 to perform event A3 reporting during the next 30s?
    fl_NoMeasurementReport( eutra_Cell2, v_TimerValue, cr_MeasurementReport_CheckAny );

    //@siclog "Step 9" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.3 indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 2?
    f_EUTRA_508Check_ConnectedState( eutra_Cell2 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell2, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.1.8
  
  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.9
   * @status    APPROVED
   */
  function f_TC_8_3_1_9_EUTRA() runs on EUTRA_PTC
  { // Measurement configuration control and reporting / Intra E-UTRAN measurements / Intra-frequency handover / IE measurement configuration not present
    var integer v_T0_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T0_RS_EPRE_Cell3 := -97;
    
    var integer v_T1_RS_EPRE_Cell1 := -85;
    var integer v_T1_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T1_RS_EPRE_Cell3 := -73;
    
    var integer v_T2_RS_EPRE_Cell1 := -85;
    var integer v_T2_RS_EPRE_Cell2 := -79;
    var integer v_T2_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE;
    
    var integer v_T3_RS_EPRE_Cell1 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T3_RS_EPRE_Cell2 := -85;
    var integer v_T3_RS_EPRE_Cell3 := -73;
    
    var integer v_T4_RS_EPRE_Cell1 := -79;
    var integer v_T4_RS_EPRE_Cell2 := -85;
    var integer v_T4_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE;

    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var template(value) CellPowerList_Type v_CellPowerList;
    
    var PhysCellId v_PhysCellId_Cell1;
    var PhysCellId v_PhysCellId_Cell2;
    var PhysCellId v_PhysCellId_Cell3;

    var Frequency_IE_Type v_Frequency_IE_f1;
    var Frequency_IE_Type v_Frequency_IE_f2;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f2;

    var float v_TimerValue;
    
    //Initialize testcase
    f_EUTRA_Init( c3 );

    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_PhysCellId_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_PhysCellId_Cell3 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell3 );
    
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_Frequency_IE_f2 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell3 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    v_ChBandDependency_f2 := f_EUTRA_BandDependentParam( v_Frequency_IE_f2.DL_ChBandwidth, v_Frequency_IE_f2.UL_ChBandwidth );

    v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 30.0 );

    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T4_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T2_RS_EPRE_Cell2 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell3, v_T1_RS_EPRE_Cell3 );

    //Create and configure Cell1, Cell2, Cell3
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    f_EUTRA_CellConfig_Def( eutra_Cell2 );
    f_EUTRA_CellConfig_Def( eutra_Cell3 );

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T0_RS_EPRE_Cell3, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );

    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to setup intra and inter frequency measurements on Cell 1.
    if( pc_FeatrGrp_25 )
      {
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_8_3_1_9_Step1_pc25(v_RRC_TI,
                                                                                          v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                          v_ChBandDependency_f1.AllowedMeasBandwidth,
                                                                                          v_Frequency_IE_f2.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                          v_ChBandDependency_f2.AllowedMeasBandwidth ) ) );
      }
    else
      {
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_8_3_1_9_Step1_notpc25(v_RRC_TI,
                                                                                             v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                             v_ChBandDependency_f1.AllowedMeasBandwidth ) ) );
      }
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the setup of intra and inter frequency measurements on Cell 1.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //EXCEPTION: Steps 3a1 to 3a2 describe behaviour that depends on the UE capability; the "lower case letter" identifies a step sequence that take place if a capability is supported.
    if (pc_FeatrGrp_25)
      {
        //@siclog "Step 3a1" siclog@
        //IF pc_FeatrGrp_25 THEN the SS changes Cell 1, Cell 2 and Cell 3 parameters according to the row "T1" in table 8.3.1.9.3.2-1.
        v_CellPowerList := {
          cs_CellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1 ),
          cs_CellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2 ),
          cs_CellPower( eutra_Cell3, v_T1_RS_EPRE_Cell3 )
        };
        f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
        
        //@siclog "Step 3a2" siclog@
        //The UE transmits a MeasurementReport message on Cell 1 to report event A3 for Cell 3.
        SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                          cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) ) );
        
        //@sic no more periodical mp received since the reportAmount is set to r1 sic@
        ////Activate the default to receive periodical reports for Cell3.
        //v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1,
        //                                                                         cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) ) );
      }
    
    //@siclog "Step 4" siclog@
    //The SS changes Cell 1, Cell 2 and Cell 3 parameters according to the row "T2" in table 8.3.1.9.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T2_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T2_RS_EPRE_Cell3 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //The UE transmits a MeasurementReport message on Cell 1 to report event A3 for Cell 2.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell2 ) ) );
    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    //if (pc_FeatrGrp_25)
    //  {
    //    //Deactivate the default to stop receiving periodical Measurement Report
    //    deactivate( v_DefaultRef );
    //  }
    
    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    ////Activate the default to receive periodical reports for Cell2.
    //v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1,
    //                                                                         cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell2 ) ) );
    
    //@siclog "Step 6 - 7" siclog@
    //The SS transmits an RRCConnectionReconfiguration message without a measConfig message on Cell 1, to order the UE to perform intra frequency handover to Cell 2.
    //Check: Does the UE transmit an RRCConnectionReconfigurationComplete message on Cell 2?
    f_EUTRA_508RRC_IntraLTE_HO_InterCell( eutra_Cell1, eutra_Cell2 ); // @sic R5s100430 change 2 sic@; @sic R5s100524 sic@
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.9 Step 7" );

    // f_EUTRA_StartDefULGrantTransmission( eutra_Cell2, cs_TimingInfo_Now ); //@sic R5s100524 clause 3.5.2.2 sic@
    
    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    ////Deactivate the default to stop receiving periodical Measurement Report
    //deactivate( v_DefaultRef );
    
    //EXCEPTION: Steps 8a1 to 8a4 describe behaviour that depends on the UE capability; the "lower case letter" identifies a step sequence that take place if a capability is supported.
    if (pc_FeatrGrp_25)
      {
        //@siclog "Step 8a1" siclog@
        //IF pc_FeatrGrp_25 THEN the SS transmits an RRCConnectionReconfiguration message to activate the measurement gaps on Cell 2.
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell2,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_ResumeInterFreqMeas( v_RRC_TI ) ) );
        
        //@siclog "Step 8a2" siclog@
        //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the activation of the measurement gaps on Cell 2.
        SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
        
        //@siclog "Step 8a3" siclog@
        //The SS changes Cell 1, Cell 2 and Cell 3 parameters according to the row "T3" in table 8.3.1.9.3.2-1.
        v_CellPowerList := {
          cs_CellPower( eutra_Cell1, v_T3_RS_EPRE_Cell1 ),
          cs_CellPower( eutra_Cell2, v_T3_RS_EPRE_Cell2 ),
          cs_CellPower( eutra_Cell3, v_T3_RS_EPRE_Cell3 )
        };
        f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
        
        //@siclog "Step 8a4" siclog@
        //Check: Does the UE transmit a MeasurementReport message on Cell 2 to report event A3 for Cell 3?
        SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2,
                                          cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) ) );
        f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.9 Step 8a4" );
        
        //@sic no more periodical mp received since the reportAmount is set to r1 sic@
        ////Activate the default to receive periodical reports for Cell3.
        //v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell2,
        //                                                                         cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) ) );
      }
    
    //@siclog "Step 9" siclog@
    //The SS changes Cell 1, Cell 2 and Cell 3 parameters according to the row "T4" in table 8.3.1.9.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T4_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T4_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T4_RS_EPRE_Cell3 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 10" siclog@
    //Check: Does the UE transmit a MeasurementReport message on Cell 2 to report event A3 for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2,
                                      cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell1 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.9 Step 10" );
    
    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    //if (pc_FeatrGrp_25)
    //{
    //  //Deactivate the default to stop receiving periodical Measurement Report
    //  deactivate( v_DefaultRef );
    //}

    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    ////Activate the default to receive periodical reports for Cell1.
    //v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell2,
    //                                                                         cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell1 ) ) );
    
    //@siclog "Step 11" siclog@
    //Check: Does the test result of CALL generic procedure indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 2?
    f_EUTRA_508Check_ConnectedState( eutra_Cell2 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell2, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
    //@sic no more periodical mp received since the reportAmount is set to r1 sic@
    ////Deactivate the default to stop receiving periodical Measurement Report
    //deactivate( v_DefaultRef );
    
  } //end of testcase 8.3.1.9
  
  //================================================================
  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.3.1.10
   * @status    APPROVED
   */
  function f_TC_8_3_1_10_EUTRA() runs on EUTRA_PTC
  { //Measurement configuration control and reporting / Intra E-UTRAN measurements / Inter-frequency handover / IE measurement configuration not present
    var integer v_T0_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := -91;
    var integer v_T0_RS_EPRE_Cell3 := -97; //@sic R5-103498 sic@
    var integer v_T0_RS_EPRE_Cell12 := tsc_NonSuitableOffCellRS_EPRE;
    
    var integer v_T1_RS_EPRE_Cell1 := -85;
    var integer v_T1_RS_EPRE_Cell2 := -79;
    var integer v_T1_RS_EPRE_Cell3 := -97; //@sic R5-103498 sic@
    var integer v_T1_RS_EPRE_Cell12 := tsc_NonSuitableOffCellRS_EPRE;

    var integer v_T2_RS_EPRE_Cell1 := -85;
    var integer v_T2_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T2_RS_EPRE_Cell3 := -73;
    var integer v_T2_RS_EPRE_Cell12 := tsc_NonSuitableOffCellRS_EPRE;

    var integer v_T3_RS_EPRE_Cell1 := -97;
    var integer v_T3_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T3_RS_EPRE_Cell3 := -85;
    var integer v_T3_RS_EPRE_Cell12 := -79;

    var integer v_T4_RS_EPRE_Cell1 := -73;
    var integer v_T4_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE;
    var integer v_T4_RS_EPRE_Cell3 := -85;
    var integer v_T4_RS_EPRE_Cell12 := tsc_NonSuitableOffCellRS_EPRE;

    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var template(value) CellPowerList_Type v_CellPowerList;

    var PhysCellId v_PhysCellId_Cell1;
    var PhysCellId v_PhysCellId_Cell2;
    var PhysCellId v_PhysCellId_Cell3;
    var PhysCellId v_PhysCellId_Cell12;
    
    var Frequency_IE_Type v_Frequency_IE_f1;
    var Frequency_IE_Type v_Frequency_IE_f2;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f2;

    var float v_TimerValue;
    
    //Initialize testcase
    f_EUTRA_Init( c3 );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_PhysCellId_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_PhysCellId_Cell3 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell3 );
    v_PhysCellId_Cell12 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell12 );

    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_Frequency_IE_f2 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell3 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    v_ChBandDependency_f2 := f_EUTRA_BandDependentParam( v_Frequency_IE_f2.DL_ChBandwidth, v_Frequency_IE_f2.UL_ChBandwidth );

    v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 30.0 );

    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T4_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T1_RS_EPRE_Cell2 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell3, v_T2_RS_EPRE_Cell3 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell12, v_T3_RS_EPRE_Cell12 );
    
    //Create and configure Cell1, Cell2, Cell3, Cell12
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    f_EUTRA_CellConfig_Def( eutra_Cell2 );
    f_EUTRA_CellConfig_Def( eutra_Cell3 );
    f_EUTRA_CellConfig_Def( eutra_Cell12 );

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T0_RS_EPRE_Cell3, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell12, v_T0_RS_EPRE_Cell12, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to setup intra and inter frequency measurements on Cell 1.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_1_10_Step1(v_RRC_TI,
                                                                                  v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                  v_ChBandDependency_f1.AllowedMeasBandwidth,
                                                                                  v_Frequency_IE_f2.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                  v_ChBandDependency_f2.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the setup of intra and inter frequency measurements on Cell 1.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //The SS changes Cell 1, Cell 2 and Cell 3 parameters according to the row "T1" in table 8.3.1.10.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T1_RS_EPRE_Cell3 ),
      cs_CellPower( eutra_Cell12, v_T1_RS_EPRE_Cell12 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //The UE transmits a MeasurementReport message on Cell 1 to perform event A3 intra frequency reporting for Cell 2 during the next 30 s.
    fl_Check_Timer_MeasurementReport( eutra_Cell1,
                                      v_TimerValue,
                                      cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell2 ) );
    
    //@siclog "Step 5" siclog@
    //The SS changes Cell 1 and Cell 3 parameters, sets the cell-specific reference signal levels and switches Cell 12 on and Cell 2 off according to row "T2" in table 8.3.1.10.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T2_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T2_RS_EPRE_Cell3 ),
      cs_CellPower( eutra_Cell12, v_T2_RS_EPRE_Cell12 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 6" siclog@
    //The UE transmits a MeasurementReport message on Cell 1 to perform event A3 inter frequency reporting for Cell 3 during the next 30 s.
    fl_Check_Timer_MeasurementReport( eutra_Cell1,
                                      v_TimerValue,
                                      cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) );
    
    //@siclog "Step 7 - 8" siclog@
    //The SS transmits an RRCConnectionReconfiguration message without a measurementConfig, to order the UE to perform inter frequency handover to Cell 3.
    //Check: Does the UE transmit an RRCConnectionReconfigurationComplete message to Cell 3?
    f_EUTRA_508RRC_IntraLTE_HO_InterCell( eutra_Cell1, eutra_Cell3, -, tsc_C_RNTI_Def3 );  //@sic R5s100430 change 2 sic@; @sic R5s100524 sic@
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.10 Step 8" );
    
    //@siclog "Step 9" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to activate the measurement gaps on Cell 3.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell3, //@sic R5s100516 Change 1 sic@
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_ResumeInterFreqMeas( v_RRC_TI ) ) );
    
    //@siclog "Step 10" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the activation of the measurement gaps on Cell 3.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell3, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 11" siclog@
    //The SS changes Cell 1, Cell 3, and Cell 12 parameters according to the row "T3" in table 8.3.1.10.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T3_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T3_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T3_RS_EPRE_Cell3 ),
      cs_CellPower( eutra_Cell12, v_T3_RS_EPRE_Cell12 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 12" siclog@
    //Check: Does the UE transmit a MeasurementReport message on Cell 3 to perform event A3 intra frequency reporting for Cell 12 during the next 30 s?
    fl_Check_Timer_MeasurementReport( eutra_Cell3,
                                      v_TimerValue,
                                      cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell12 ) );
    
    //@siclog "Step 13" siclog@
    //The SS changes Cell 1 and Cell 3 parameters, sets the cell-specific reference signal levels and switches Cell 2 on and Cell 12 off according to row "T4" in table 8.3.1.10.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T4_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T4_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T4_RS_EPRE_Cell3 ),
      cs_CellPower( eutra_Cell12, v_T4_RS_EPRE_Cell12 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 14" siclog@
    //Check: Does the UE transmit a MeasurementReport message on Cell 3 to perform event A3 inter frequency reporting for Cell 1 during the next 30 s?
    fl_Check_Timer_MeasurementReport( eutra_Cell3,
                                      v_TimerValue,
                                      cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell1 ) );
    
    //@siclog "Step 15" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.3 indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 3?
    f_EUTRA_508Check_ConnectedState( eutra_Cell3 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );

    f_EUTRA_Postamble( eutra_Cell3, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.1.10
  
  //================================================================
  //testcase 8.3.1.11:
  //Measurement configuration control and reporting / intra E-UTRAN measurements: continuation of the measurements after RRC Connection Re-establishment
  function f_TC_8_3_1_11_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -85;
    var integer v_T0_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    var integer v_T0_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    
    var integer v_T1_RS_EPRE_Cell1 := -85;
    var integer v_T1_RS_EPRE_Cell2 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    var integer v_T1_RS_EPRE_Cell3 := -73;
    
    var integer v_T2_RS_EPRE_Cell1 := -85;
    var integer v_T2_RS_EPRE_Cell2 := -79;
    var integer v_T2_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    
    var integer v_T3_RS_EPRE_Cell1 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    var integer v_T3_RS_EPRE_Cell2 := -79;
    var integer v_T3_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    
    var integer v_T4_RS_EPRE_Cell1 := -79;
    var integer v_T4_RS_EPRE_Cell2 := -85;
    var integer v_T4_RS_EPRE_Cell3 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    
    var integer v_T5_RS_EPRE_Cell1 := tsc_NonSuitableOffCellRS_EPRE; //@sic R5-103498 sic@
    var integer v_T5_RS_EPRE_Cell2 := -85;
    var integer v_T5_RS_EPRE_Cell3 := -73;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var template(value) CellPowerList_Type v_CellPowerList;
    
    var PhysCellId v_PhysCellId_Cell1;
    var PhysCellId v_PhysCellId_Cell2;
    var PhysCellId v_PhysCellId_Cell3;
    
    var Frequency_IE_Type v_Frequency_IE_f1;
    var Frequency_IE_Type v_Frequency_IE_f2;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f2;
    
    var template(value) EUTRA_FDD_TDD_CellInfo_Type v_EUTRA_FDD_TDD_CellInfo_Cell2;
    var template (value) PhysicalConfigDedicated_AntennaInfo_Type v_AntennaInfo_Cell2;
    var SR_PUCCH_ResourceIndex_Type v_SR_PUCCH_ResourceIndex_Cell2;
    var SR_ConfigIndex_Type v_SR_ConfigIndex_Cell2; //@sic R5-102177 sic@
    var ShortMAC_I v_ShortMAC_I;
    var EUTRA_SecurityParams_Type v_Auth_Params;

    var float v_T304;
    
    //Initialize testcase
    f_EUTRA_Init( c3 );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_PhysCellId_Cell2 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_PhysCellId_Cell3 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell3 );
    
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_Frequency_IE_f2 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell3 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    v_ChBandDependency_f2 := f_EUTRA_BandDependentParam( v_Frequency_IE_f2.DL_ChBandwidth, v_Frequency_IE_f2.UL_ChBandwidth );
    
    v_EUTRA_FDD_TDD_CellInfo_Cell2 := f_EUTRA_CellInfo_GetFDD_TDD_Info( eutra_Cell2 );
    v_AntennaInfo_Cell2 := f_EUTRA_CellInfo_GetAntennaInfoDedicated (eutra_Cell2);
    v_SR_PUCCH_ResourceIndex_Cell2 := f_EUTRA_CellInfo_GetSR_PUCCH_ResourceIndex ( eutra_Cell2 );
    v_SR_ConfigIndex_Cell2 := f_EUTRA_CellInfo_GetSR_ConfigIndex (eutra_Cell2); //@sic R5-102177 sic@
    
    //v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 30.0 );
    v_T304 := f_EUTRA_SetTimerToleranceMax( eutra_Cell2, 1.0 ); //According to 36.508 cl. 4.6.5 Table 4.6.5-1

    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T4_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T2_RS_EPRE_Cell2 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell3, v_T1_RS_EPRE_Cell3 );
    
    //Create and configure Cell 1, Cell 2, Cell 3
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    f_EUTRA_CellConfig_Def( eutra_Cell2 );
    f_EUTRA_CellConfig_Def( eutra_Cell3 );

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell3, v_T0_RS_EPRE_Cell3, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );

    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to setup intra and inter frequency measurements on Cell 1.
    if (pc_FeatrGrp_25)
      {
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_8_3_1_11_Step1_pc25(v_RRC_TI,
                                                                                           v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                           v_ChBandDependency_f1.AllowedMeasBandwidth,
                                                                                           v_Frequency_IE_f2.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                           v_ChBandDependency_f2.AllowedMeasBandwidth ) ) );
      }
    else
      {
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_8_3_1_11_Step1_notpc25(v_RRC_TI,
                                                                                              v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                              v_ChBandDependency_f1.AllowedMeasBandwidth ) ) );
      }
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the setup of intra and inter frequency measurements on Cell 1.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //EXCEPTION: Steps 3a1 to 3a2 describe behaviour that depends on the UE capability; the "lower case letter" identifies a step sequence that take place if a capability is supported.
    if (pc_FeatrGrp_25)
      {
        //@siclog "Step 3a1" siclog@
        //IF pc_FeatrGrp_25 THEN the SS changes Cell 1, Cell 2 and Cell 3 power levels according to the row "T1" in Table 8.3.1.11.3.2-1.
        v_CellPowerList := {
          cs_CellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1 ),
          cs_CellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2 ),
          cs_CellPower( eutra_Cell3, v_T1_RS_EPRE_Cell3 )
        };
        f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
        
        //@siclog "Step 3a2" siclog@
        //The UE transmits a MeasurementReport message on Cell 1 to report event A3 for Cell 3.
        SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                          cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) ) );
      }
    
    //@siclog "Step 4" siclog@
    //The SS changes Cell 2 and Cell 3 power levels according to the row "T2" in Table 8.3.1.11.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T2_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T2_RS_EPRE_Cell3 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //The UE transmits a MeasurementReport message on Cell 1 to perform event A3 intra frequency reporting for Cell 2.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell2 ) ) );
    
    //Configure Cell2 to not send response on RACH preamble reception on Cell 2
    f_EUTRA_SS_ConfigRachProcedure( eutra_Cell2,
                                    omit,
                                    cs_RachProcedureConfig_NoResponse(
                                      f_EUTRA_CellInfo_GetDL_ChBandwidth ( eutra_Cell2 ) ) );
    
    //@siclog "Step 6" siclog@
    //The SS transmits an RRCConnectionReconfiguration message including a mobilityControlInfo, to order the UE to perform intra frequency handover to Cell 2.
    f_EUTRA_RRC_ConnReconfigHO_IntraLTE_MobilitySecurity( eutra_Cell1,
                                                          eutra_Cell2,
                                                          f_Generate_cs_MobilityControlInfo_HO( eutra_Cell2, omit, omit ),
                                                          cs_508SecurityConfigHO_IntraLTE );

    //EXCEPTION: In parallel to the events described in step 7 the steps specified in Table 8.3.1.11.3.2-3 should take place.
    
    //EXCEPTION: The steps 1 and 2 below are repeated for the duration of T304.
    //1. The UE attempts to perform the intra frequency handover using MAC Random Access Preamble on Cell 2.
    //2. The SS does not respond.
    f_Delay( v_T304 );

    //@siclog "Step 7" siclog@
    //The SS changes Cell 1 and Cell 3 power levels according to the row "T3" in Table 8.3.1.11.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T3_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T3_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T3_RS_EPRE_Cell3 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //Configure Cell2 to normal PRACH operation mode
    f_EUTRA_SS_ConfigRachProcedure( eutra_Cell2,
                                    tsc_C_RNTI_Def,
                                    cs_RachProcedureConfig_Def(
                                       omit,
                                       f_EUTRA_CellInfo_GetRAR_TA( eutra_Cell2 ),
                                       f_EUTRA_CellInfo_GetDL_ChBandwidth ( eutra_Cell2 ) ) );
    
    //Calculate ShortMAC-I to be received in RRCConnectionReestablishment Request from UE in Step 8
    v_ShortMAC_I := f_Calculate_ShortMAC( eutra_Cell1, eutra_Cell2 );
    
    //@siclog "Step 8" siclog@
    //Check: Does the UE transmit an RRCConnectionReestablishmentRequest message on Cell 2?
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell2,
                                      cr_508_RRCConnectionReestablishmentRequest(tsc_C_RNTI_Def,
                                                                                 v_PhysCellId_Cell1, //TBD!!!! "PhysicalCellIdentity of Cell 2" according to prose, but it is explicitly wrong!
                                                                                 handoverFailure,
                                                                                 v_ShortMAC_I ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.11 Step 8" );
    
    //Start UL grant transmission in Cell 2
    f_EUTRA_StartDefULGrantTransmission( eutra_Cell2, cs_TimingInfo_Now );
    
    //@siclog "Step 9" siclog@
    //The SS transmits an RRCConnectionReestablishment message to resume SRB1 operation and re-activate security on Cell 2.
    SRB.send( cas_SRB0_RrcPdu_REQ( eutra_Cell2,
                                   cs_TimingInfo_Now,
                                   cs_508_RRCConnectionReestablishment(v_RRC_TI,
                                                                       v_EUTRA_FDD_TDD_CellInfo_Cell2.pucch_Config,
                                                                       v_SR_PUCCH_ResourceIndex_Cell2,
                                                                       v_AntennaInfo_Cell2,
                                                                       v_SR_ConfigIndex_Cell2 //@sic R5-102177 sic@
                                                                       ) ) );
    
    //Activate RRC security in Cell 2(SRB 1,2 and DRB 1)
    v_Auth_Params := f_EUTRA_SS_AS_ActivateSecurity_HO_Reest( eutra_Cell2, f_EUTRA_Security_Get(), 0 );
    f_EUTRA_Security_Set( v_Auth_Params );
    
    //@siclog "Step 10" siclog@
    //The UE transmits an RRCConnectionReestablishmentComplete message on Cell 2.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2, cr_508_RRCConnectionReestablishmentComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 11" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to resume existing radio bearer on Cell 2.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell2,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnReconfig_Resume_SRB2_DRBs(v_RRC_TI,
                                                                       v_EUTRA_FDD_TDD_CellInfo_Cell2.cqi_ReportConfig,
                                                                       v_EUTRA_FDD_TDD_CellInfo_Cell2.soundingRS_UL_Config,
                                                                       v_AntennaInfo_Cell2,
                                                                       v_SR_PUCCH_ResourceIndex_Cell2,
                                                                       v_SR_ConfigIndex_Cell2) ) );
    
    //@siclog "Step 12" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message on Cell 2.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 13" siclog@
    //The SS changes Cell 1, Cell 2 and Cell 3 power levels according to the row "T4" in Table 8.3.1.11.3.2-1.
    v_CellPowerList := {
      cs_CellPower( eutra_Cell1, v_T4_RS_EPRE_Cell1 ),
      cs_CellPower( eutra_Cell2, v_T4_RS_EPRE_Cell2 ),
      cs_CellPower( eutra_Cell3, v_T4_RS_EPRE_Cell3 )
    };
    f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
    
    //@siclog "Step 14" siclog@
    //Check: Does the UE transmit a MeasurementReport message on Cell 2 to perform event A3 intra frequency reporting for Cell 1?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2,
                                      cr_MeasurementReport_Eutra_1Entry_both( 1, v_PhysCellId_Cell1 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.11 Step 14" );

    //EXCEPTION: Steps 15a1 to 15a4 describe behaviour that depends on the UE capability; the "lower case letter" identifies a step sequence that takes place if a capability is supported.
    if (pc_FeatrGrp_25)
      {
        //@siclog "Step 15a1" siclog@
        //IF pc_FeatrGrp_25 THEN the SS transmits an RRCConnectionReconfiguration message to activate the measurement gaps on Cell 2.
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell2,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_ResumeInterFreqMeas( v_RRC_TI ) ) );
        
        //@siclog "Step 15a2" siclog@
        //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the activation of the measurement gaps on Cell 2.
        SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
        
        //@siclog "Step 15a3" siclog@
        //The SS changes Cell 1, Cell 2 and Cell 3 power levels according to the row "T5" in Table 8.3.1.11.3.2-1.
        v_CellPowerList := {
          cs_CellPower( eutra_Cell1, v_T5_RS_EPRE_Cell1 ),
          cs_CellPower( eutra_Cell2, v_T5_RS_EPRE_Cell2 ),
          cs_CellPower( eutra_Cell3, v_T5_RS_EPRE_Cell3 )
        };
        f_EUTRA_SetCellPowerList( v_CellPowerList, cs_TimingInfo_Now );
        
        //@siclog "Step 15a4" siclog@
        //Check: Does the UE transmit a MeasurementReport message on Cell 2 to report event A3 for Cell 3?
        SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell2,
                                          cr_MeasurementReport_Eutra_1Entry_both( 2, v_PhysCellId_Cell3 ) ) );
        f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.1.11 Step 15a4" );
      }
    
    //@siclog "Step 16" siclog@
    //Check: Does the test result of CALL generic test procedure in 36.508 subclause 6.2,4.3  indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 2?
    f_EUTRA_508Check_ConnectedState( eutra_Cell2 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    f_EUTRA_Postamble( eutra_Cell2, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.1.11
  
  //================================================================
  //testcase 8.3.2.1 (EUTRA part):
  //Measurement configuration control and reporting / Inter-RAT measurements / Event B2 / Measurement of GERAN cells  //Changed title, CR R5-101186
  function f_TC_8_3_2_1_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -60;
    var integer v_T1_RS_EPRE_Cell1 := -80;
    var integer v_T2_RS_EPRE_Cell1 := -60;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var PhysCellId v_PhysCellId_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    
    var IRAT_CoOrd_SysInfo_Type v_GERANSysInfo;
    var ARFCN_ValueGERAN v_GERAN_ARFCN_Cell24;
    var CoOrd_GERANNeighCell_Type v_CoOrd_GERANNeighCell_Type;
    var ExplicitListOfARFCNs v_ExplicitListOfARFCNs;
    var PhysCellIdGERAN v_GERAN_PhysChId_Cell24;
    var BandIndicatorGERAN v_BandIndicatorGERAN_Cell24;
    
    var float v_TimerValue_1;
    var float v_TimerValue_2;
    
    var default v_DefaultRef;
    
    var integer i;
    var integer v_NumberOf_NeighCells;
    
    //Initialize testcase
    f_EUTRA_Init( c5 );

    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    
    v_TimerValue_1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    v_TimerValue_2 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );
    
    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    
    // Get Cell Parameters for GERAN cell
    v_GERANSysInfo := f_WaitForIRATCoOrd_SysInfo( GERAN );
    
    v_GERAN_ARFCN_Cell24 := v_GERANSysInfo.Geran[0].Arfcn;

    v_CoOrd_GERANNeighCell_Type := v_GERANSysInfo.Geran[0].NeighCells;
    v_NumberOf_NeighCells := lengthof( v_CoOrd_GERANNeighCell_Type );
    for( i := 0; i < v_NumberOf_NeighCells; i := i + 1 ) {
      v_ExplicitListOfARFCNs[i] :=  v_CoOrd_GERANNeighCell_Type[i];
    }
    
    v_GERAN_PhysChId_Cell24 := {
      networkColourCode := v_GERANSysInfo.Geran[0].Ncc,
      baseStationColourCode := v_GERANSysInfo.Geran[0].Bcc
    }
    
    if( v_GERANSysInfo.Geran[0].BandIndicator == '0'B ) {
      v_BandIndicatorGERAN_Cell24 := dcs1800;
    }
    else {
      v_BandIndicatorGERAN_Cell24 := pcs1900;
    }
    
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to setup inter RAT measurement on Cell 1.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_2_1_Step1(v_RRC_TI,
                                                                                 v_GERAN_ARFCN_Cell24,
                                                                                 v_BandIndicatorGERAN_Cell24,
                                                                                 v_ExplicitListOfARFCNs ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the setup of inter RAT measurement on Cell 1.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //Check: Does the UE transmit a MeasurementReport message to report the event B2 during the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue_1, cr_MeasurementReport_CheckAny);
    
    //@siclog "Step 4" siclog@
    //The SS changes Cell 1and Cell 24 parameters according to the row "T1" in table 8.3.2.1.3.2-1.
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //Check: Does the UE transmit a MeasurementReport message to report the event B2 for Cell 24?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Geran_1Entry( 1, v_GERAN_PhysChId_Cell24 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.2.1 Step 5" );
    
    //Activate the default to receive measurement reports for Cell 24
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1,
                                                                             cr_MeasurementReport_CheckAny ) );
    
    //@siclog "Step 6" siclog@
    //The SS changes Cell 1 and Cell 24 parameters according to the row "T2" in table 8.3.2.1.3.2-1.
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger);
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 7" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow change of power levels for Cells 1 and Cell 24.
    f_Delay(v_TimerValue_2);
    deactivate( v_DefaultRef );
    
    //@siclog "Step 8" siclog@
    //Check: Does the UE transmit a MeasurementReport message to report the event B2 during the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue_1, cr_MeasurementReport_CheckAny );
    
    //@siclog "Step 9" siclog@
    //Check: Does the test result of CALL generic procedure indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 1?
    f_EUTRA_508Check_ConnectedState( eutra_Cell1 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    //tell the GERAN component that the test is over
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.2.1
  
  //================================================================
  //testcase 8.3.2.2 (EUTRA part):
  //Measurement configuration control and reporting / Inter-RAT measurements / Periodic reporting / Measurement of GERAN cells
  function f_TC_8_3_2_2_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -60;
    var integer v_T1_RS_EPRE_Cell1 := -60;
    var integer v_T2_RS_EPRE_Cell1 := -60;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var PhysCellId v_PhysCellId_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    
    var IRAT_CoOrd_SysInfo_Type v_GERANSysInfo;
    var ARFCN_ValueGERAN v_GERAN_ARFCN_Cell25;
    var ARFCN_ValueGERAN v_GERAN_ARFCN_Cell26;
    var CoOrd_GERANNeighCell_Type v_CoOrd_GERANNeighCell_Type;
    var ExplicitListOfARFCNs v_ExplicitListOfARFCNs_Cell25;
    var ExplicitListOfARFCNs v_ExplicitListOfARFCNs_Cell26;
    var PhysCellIdGERAN v_GERAN_PhysChId_Cell25;
    var PhysCellIdGERAN v_GERAN_PhysChId_Cell26;
    var BandIndicatorGERAN v_BandIndicatorGERAN_Cell25;
    var BandIndicatorGERAN v_BandIndicatorGERAN_Cell26;
    
    var float v_TimerValue_5s;
    var float v_TimerValue_10s;
    var float v_TimerValue_30s;
    
    var default v_DefaultRef;
    
    var integer i;
    var integer v_NumberOf_NeighCells;
    
    //Initialize testcase
    f_EUTRA_Init( c5 );

    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    
    v_TimerValue_5s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    v_TimerValue_10s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    v_TimerValue_30s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 30.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );
    
    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    
    // Get Cell Parameters for GERAN cell25
    v_GERANSysInfo := f_WaitForIRATCoOrd_SysInfo( GERAN );
    
    v_GERAN_ARFCN_Cell25 := v_GERANSysInfo.Geran[0].Arfcn;

    v_CoOrd_GERANNeighCell_Type := v_GERANSysInfo.Geran[0].NeighCells;
    v_NumberOf_NeighCells := lengthof( v_CoOrd_GERANNeighCell_Type );
    for( i := 0; i < v_NumberOf_NeighCells; i := i + 1 ) {
      v_ExplicitListOfARFCNs_Cell25[i] :=  v_CoOrd_GERANNeighCell_Type[i];
    }
    
    v_GERAN_PhysChId_Cell25 := {
      networkColourCode := v_GERANSysInfo.Geran[0].Ncc,
      baseStationColourCode := v_GERANSysInfo.Geran[0].Bcc
    }
    
    if( v_GERANSysInfo.Geran[0].BandIndicator == '0'B ) {
      v_BandIndicatorGERAN_Cell25 := dcs1800;
    }
    else {
      v_BandIndicatorGERAN_Cell25 := pcs1900;
    }
    
    // Get Cell Parameters for GERAN cell26
    v_GERANSysInfo := f_WaitForIRATCoOrd_SysInfo( GERAN );
    
    v_GERAN_ARFCN_Cell26 := v_GERANSysInfo.Geran[0].Arfcn;

    v_CoOrd_GERANNeighCell_Type := v_GERANSysInfo.Geran[0].NeighCells;
    v_NumberOf_NeighCells := lengthof( v_CoOrd_GERANNeighCell_Type );
    for( i := 0; i < v_NumberOf_NeighCells; i := i + 1 ) {
      v_ExplicitListOfARFCNs_Cell26[i] :=  v_CoOrd_GERANNeighCell_Type[i];
    }
    
    v_GERAN_PhysChId_Cell26 := {
      networkColourCode := v_GERANSysInfo.Geran[0].Ncc,
      baseStationColourCode := v_GERANSysInfo.Geran[0].Bcc
    }
    
    if( v_GERANSysInfo.Geran[0].BandIndicator == '0'B ) {
      v_BandIndicatorGERAN_Cell26 := dcs1800;
    }
    else {
      v_BandIndicatorGERAN_Cell26 := pcs1900;
    }
    
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to setup inter-RAT measurement.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_2_2_Step1(v_RRC_TI,
                                                                                 v_GERAN_ARFCN_Cell25,
                                                                                 v_BandIndicatorGERAN_Cell25,
                                                                                 v_ExplicitListOfARFCNs_Cell25,
                                                                                 v_GERAN_ARFCN_Cell26,
                                                                                 v_BandIndicatorGERAN_Cell26,
                                                                                 v_ExplicitListOfARFCNs_Cell26 ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the setup of inter-RAT measurement.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //The SS power "On" Cell 25 according to the row "T1" in table 8.3.2.2.3.2-1.
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //@siclog "Step 4" siclog@
    //Wait and ignore MeasurementReport messages for 5s to allow power "On" for Cell 25.
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1,
                                                                             cr_MeasurementReport_CheckAny ) );
    f_Delay( v_TimerValue_5s );

    //EXCEPTION: In parallel to events described in steps 5 to 6 the steps specified in table 8.3.2.2.3.2-3 shall take place
    
    //@siclog "Step 5" siclog@
    //Wait for 30 s to ensure that the UE performs a inter-RAT periodical reporting.
    f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport( eutra_Cell1,
                                                       cr_MeasurementReport_Geran_1Entry( 1, v_GERAN_PhysChId_Cell25 ),
                                                       v_TimerValue_30s,
                                                       1.024,
                                                       5.0 );
    
    //@siclog "Step 6" siclog@
    //The SS power "Off" Cell 25 and power "On" Cell 26 according to the row "T2" in table 8.3.2.2.3.2-1.
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger);
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 7" siclog@
    //Wait and ignore MeasurementReport messages for 5s to allow power "Off" and power "On" for Cell 25 and Cell 26 respectively.
    f_Delay( v_TimerValue_5s );

    //EXCEPTION: In parallel to events described in steps 8 to 9 the steps specified in table 8.3.2.2.3.2-4 shall take place
    
    //@siclog "Step 8" siclog@
    //Wait for 30 s to ensure that the UE performs a inter-RAT periodical reporting.
    f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport( eutra_Cell1,
                                                       cr_MeasurementReport_Geran_1Entry( 2, v_GERAN_PhysChId_Cell26 ),
                                                       v_TimerValue_30s,
                                                       1.024,
                                                       5.0 );

    //@siclog "Step 9" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to remove inter-RAT measurement.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_RemoveMeasId_2Entries( v_RRC_TI, 1, 2 ) ) );

    //@siclog "Step 10" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the remove of inter-RAT measurement.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );

    deactivate( v_DefaultRef );

    //@siclog "Step 11" siclog@
    //Check: Does the UE attempt to transmit an uplink message for the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue_10s, cr_MeasurementReport_CheckAny );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    //tell the GERAN component that the test is over
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  } //end of testcase 8.3.2.2

  //================================================================
  //testcase 8.3.2.3 (EUTRA part):
  //Measurement configuration control and reporting / Inter-RAT measurements / Event B2 / Measurement of UTRAN cells  //Changed title, CR R5-101186
  function f_TC_8_3_2_3_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -60;
    var integer v_T1_RS_EPRE_Cell1 := -80;
    var integer v_T2_RS_EPRE_Cell1 := -60;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var PhysCellId v_PhysCellId_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;

    var IRAT_CoOrd_SysInfo_Type v_UTRANSysInfo;
    var UTRAN_FDD_TDD v_UTRAN_FDD_TDD_Cell7;
    var integer v_UTRAN_ARFCN_Cell7, v_UTRAN_PhysChId_FDD_Cell7, v_UTRAN_PhysChId_TDD_Cell7;
    var template(present) UL_DCCH_Message v_MeasRpt;
    
    var float v_TimerValue_1;
    var default v_DefaultRef;
    
    //Initialize testcase
    f_EUTRA_Init( c4 );
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    
    v_TimerValue_1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );

    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );

    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    
    // Get Cell Parameters for UTRAN cell
    v_UTRANSysInfo := f_WaitForIRATCoOrd_SysInfo(UTRAN);
    if(ischosen(v_UTRANSysInfo.Utran[0].FDD)) {
      v_UTRAN_FDD_TDD_Cell7 := UTRAN_FDD;
      v_UTRAN_ARFCN_Cell7 := v_UTRANSysInfo.Utran[0].FDD.Freq;
      v_UTRAN_PhysChId_FDD_Cell7 := v_UTRANSysInfo.Utran[0].FDD.ScramblingCode;
    }
    else {
      v_UTRAN_FDD_TDD_Cell7 := UTRAN_TDD;
      v_UTRAN_ARFCN_Cell7 := v_UTRANSysInfo.Utran[0].TDD.Freq;
      v_UTRAN_PhysChId_TDD_Cell7 := v_UTRANSysInfo.Utran[0].TDD.CellParametersID;
    }
    
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 1" siclog@
    //Send RRC Connection Reconfiguration for setting up inter RAT measurement on Cell 1
    if( v_UTRAN_FDD_TDD_Cell7 == UTRAN_FDD ) {
      SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReconfiguration_8_3_2_3_Step1_FDD(v_RRC_TI,
                                                                                       v_UTRAN_ARFCN_Cell7) ) );
    }
    else {
      SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReconfiguration_8_3_2_3_Step1_TDD(v_RRC_TI,
                                                                                       v_UTRAN_ARFCN_Cell7) ) );
    }
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message to confirm the setup of inter RAT measurement on Cell 1
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //Check: Does the UEtransmit a Measurement Report message on Cell 1 to report the event B2 during the next 10s?
    fl_NoMeasurementReport(eutra_Cell1, v_TimerValue_1, cr_MeasurementReport_CheckAny);
    
    //@siclog "Step 4" siclog@
    //The SS changes Cell 1 and Cell 7 parameters according to the row "T1" in table 8.3.2.3.3.2-1
    f_SendIRATCoOrd(UTRAN, cms_IRAT_Trigger);
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //Check: Does the UE transmit a MeasurementReport message to report the event B2 for Cell 7?
    if( v_UTRAN_FDD_TDD_Cell7 == UTRAN_FDD ) {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_FDD( 1, v_UTRAN_PhysChId_FDD_Cell7 );
    }
    else {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_TDD( 1, v_UTRAN_PhysChId_TDD_Cell7 );
    }
    
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, v_MeasRpt ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.2.3 Step 5" );
    
    //Activate the default to receive periodical reports for Cell 7
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1,
                                                                             cr_MeasurementReport_CheckAny ) );
    
    //@siclog "Step 6" siclog@
    //The SS changes Cell 1 and Cell 7 parameters according to the row "T2" in table 8.3.2.3.3.2-1
    f_SendIRATCoOrd(UTRAN, cms_IRAT_Trigger);
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //Deactivate the deault to stop receiving periodical Measurement Reports
    deactivate(v_DefaultRef);
    
    //@siclog "Step 7" siclog@
    //Check: Does the UE transmit a Measurement Report message on Cell 1 to report the event B2 during the next 10s?
    fl_NoMeasurementReport(eutra_Cell1, v_TimerValue_1, cr_MeasurementReport_CheckAny);
    
    //@siclog "Step 8" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.3 indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 1?
    f_EUTRA_508Check_ConnectedState( eutra_Cell1 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    //tell the UTRAN component that the test is over
    f_SendIRATCoOrd(UTRAN, cms_IRAT_Trigger);

    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  }; //end of testcase 8.3.2.3

  //================================================================
  //testcase 8.3.2.4 (EUTRA part):
  //Measurement configuration control and reporting / Inter-RAT measurements / Periodic reporting / Measurement of UTRAN cells
  function f_TC_8_3_2_4_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -75;
    var integer v_T1_RS_EPRE_Cell1 := -75;
    var integer v_T2_RS_EPRE_Cell1 := -75;

    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var PhysCellId v_PhysCellId_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;

    var IRAT_CoOrd_SysInfo_Type v_UTRANSysInfo;
    var UTRAN_FDD_TDD v_UTRAN_FDD_TDD;
    var integer v_UTRAN_ARFCN_f8;
    var integer v_UTRAN_PhysChId_FDD_Cell5, v_UTRAN_PhysChId_TDD_Cell5;
    var integer v_UTRAN_PhysChId_FDD_Cell7, v_UTRAN_PhysChId_TDD_Cell7;

    var template (present) UL_DCCH_Message v_MeasRpt;
    var template (value) DL_DCCH_Message v_RRCConnRecfg;

    var float v_TimerValue_5s;
    var float v_TimerValue_10s;
    var float v_TimerValue_30s;

    var default v_DefaultRef;

    //Initialize testcase
    f_EUTRA_Init( c4 );
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );

    v_TimerValue_5s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 5.0 );
    v_TimerValue_10s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    v_TimerValue_30s := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 30.0 );

    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );

    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);

    // Get Cell Parameters for UTRAN cell5
    v_UTRANSysInfo := f_WaitForIRATCoOrd_SysInfo(UTRAN);
    if(ischosen(v_UTRANSysInfo.Utran[0].FDD)) {
      v_UTRAN_FDD_TDD := UTRAN_FDD;
      v_UTRAN_ARFCN_f8 := v_UTRANSysInfo.Utran[0].FDD.Freq;
      v_UTRAN_PhysChId_FDD_Cell5 := v_UTRANSysInfo.Utran[0].FDD.ScramblingCode;
    }
    else {
      v_UTRAN_FDD_TDD := UTRAN_TDD;
      v_UTRAN_ARFCN_f8 := v_UTRANSysInfo.Utran[0].TDD.Freq;
      v_UTRAN_PhysChId_TDD_Cell5 := v_UTRANSysInfo.Utran[0].TDD.CellParametersID;
    }

    // Get Cell Parameters for UTRAN cell7
    v_UTRANSysInfo := f_WaitForIRATCoOrd_SysInfo(UTRAN);
    if(ischosen(v_UTRANSysInfo.Utran[0].FDD)) {
      v_UTRAN_PhysChId_FDD_Cell7 := v_UTRANSysInfo.Utran[0].FDD.ScramblingCode;
    }
    else {

      v_UTRAN_PhysChId_TDD_Cell7 := v_UTRANSysInfo.Utran[0].TDD.CellParametersID;
    }
    
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody

    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message including measConfig to setup measurements and periodical reporting for UTRA cells.
    if( v_UTRAN_FDD_TDD == UTRAN_FDD )
    {
      v_RRCConnRecfg := cs_RRCConnectionReconfiguration_8_3_2_4_Step1_FDD(v_RRC_TI,
                                                                          v_UTRAN_ARFCN_f8,
                                                                          v_UTRAN_PhysChId_FDD_Cell5,
                                                                          v_UTRAN_PhysChId_FDD_Cell7 )
    }
    else
    {
      v_RRCConnRecfg := cs_RRCConnectionReconfiguration_8_3_2_4_Step1_TDD(v_RRC_TI,
                                                                          v_UTRAN_ARFCN_f8,
                                                                          v_UTRAN_PhysChId_TDD_Cell5,
                                                                          v_UTRAN_PhysChId_TDD_Cell7 )
    }
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   v_RRCConnRecfg ) );

    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );

    //EXCEPTION: In parallel to events described in steps 3 to 4 the steps specified in table 8.3.2.4.3.2-3 shall take place
    v_DefaultRef := activate( a_EUTRA_AddDefault_PeriodicalMeasurmentReport( eutra_Cell1, cr_MeasurementReport_CheckAny ) );

    //@siclog "Step 3" siclog@
    //Wait for 30 s to ensure that the UE performs a periodical reporting of UTRA cells.
    if( v_UTRAN_FDD_TDD == UTRAN_FDD )
    {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_FDD( 1, v_UTRAN_PhysChId_FDD_Cell5 );
    }
    else
    {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_TDD( 1, v_UTRAN_PhysChId_TDD_Cell5 );
    }
    f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport( eutra_Cell1,
                                                       v_MeasRpt,
                                                       v_TimerValue_30s,
                                                       1.024,
                                                       5.0 );

    //@siclog "Step 4" siclog@
    //The SS sets the cell-specific reference signal levels and switches Cell 7 on according to row "T1" in table 8.3.2.4.3.2-1.
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //@siclog "Step 5" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow for the switching of cells.
    f_Delay( v_TimerValue_5s );

    //EXCEPTION: In parallel to events described in steps 6 to 7 the steps specified in table 8.3.2.4.3.2-4 shall take place

    //@siclog "Step 6" siclog@
    //Wait for 30 s to ensure that the UE performs a periodical reporting of UTRA cells.
    if( v_UTRAN_FDD_TDD == UTRAN_FDD )
    {
      v_MeasRpt := cr_MeasurementReport_Utran_2Entries_FDD( 1, v_UTRAN_PhysChId_FDD_Cell5, v_UTRAN_PhysChId_FDD_Cell7 );
    }
    else
    {
      v_MeasRpt := cr_MeasurementReport_Utran_2Entries_TDD( 1, v_UTRAN_PhysChId_TDD_Cell5, v_UTRAN_PhysChId_TDD_Cell7 );
    }
    f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport( eutra_Cell1,
                                                       v_MeasRpt,
                                                       v_TimerValue_30s,
                                                       1.024,
                                                       5.0 );

    //@siclog "Step 7" siclog@
    //The SS sets the cell-specific reference signal levels and switches Cell 5 "Off" according to row "T2" in table 8.3.2.4.3.2-1.
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T2_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //@siclog "Step 8" siclog@
    //Wait and ignore MeasurementReport messages for 5 s to allow for the switching of cells.
    f_Delay( v_TimerValue_5s );

    //EXCEPTION: In parallel to events described in steps 9 to 10 the steps specified in table 8.3.2.4.3.2-5 shall take place

    //@siclog "Step 9" siclog@
    //Wait for 30 s to ensure that the UE performs a periodical reporting of UTRA cells.
    if( v_UTRAN_FDD_TDD == UTRAN_FDD )
    {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_FDD( 1, v_UTRAN_PhysChId_FDD_Cell7 );
    }
    else
    {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_TDD( 1, v_UTRAN_PhysChId_TDD_Cell7 );
    }
    f_Check_EUTRA_HighFreq_PeriodicalMeasurmentReport( eutra_Cell1,
                                                       v_MeasRpt,
                                                       v_TimerValue_30s,
                                                       1.024,
                                                       5.0 );

    //@siclog "Step 10" siclog@
    //The SS transmits an RRCConnectionReconfiguration message including measConfig to remove measId for periodic reporting.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_RemoveMeasId_1Entry( v_RRC_TI, 1 ) ) );

    //@siclog "Step 11" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );

    //@siclog "Step 12" siclog@
    //Check: Does the UE attempt to transmit an uplink message for the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue_10s, cr_MeasurementReport_CheckAny );

    //End TestBody
    //------------------------------------------------

    f_EUTRA_TestBody_Set( false );

    //tell the UTRAN component that the test is over
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger );

    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  }; //end of testcase 8.3.2.4
  
  //================================================================
  //testcase 8.3.2.6 (EUTRA part):
  //Measurement configuration control and reporting / Inter-RAT measurements / Simultaneous A2 and two B2 / Measurements of E-UTRAN, UTRAN and GERAN cells  //Changed title, CR R5-101186
  function f_TC_8_3_2_6_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -85;
    var integer v_T1_RS_EPRE_Cell1 := -105;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var PhysCellId v_PhysCellId_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;

    var IRAT_CoOrd_SysInfo_Type v_UTRANSysInfo;
    var UTRAN_FDD_TDD v_UTRAN_FDD_TDD_Cell5;
    var integer v_UTRAN_ARFCN_Cell5;
    var integer v_UTRAN_PhysChId_FDD_Cell5;
    var integer v_UTRAN_PhysChId_TDD_Cell5;
    var template(present) UL_DCCH_Message v_MeasRpt;
    
    var IRAT_CoOrd_SysInfo_Type v_GERANSysInfo;
    var ARFCN_ValueGERAN v_GERAN_ARFCN_Cell24;
    var CoOrd_GERANNeighCell_Type v_CoOrd_GERANNeighCell_Type;
    var ExplicitListOfARFCNs v_ExplicitListOfARFCNs;
    var PhysCellIdGERAN v_GERAN_PhysChId_Cell24;
    var BandIndicatorGERAN v_BandIndicatorGERAN_Cell24;

    var float v_TimerValue_1;
    
    //var default v_DefaultRef;
    
    var integer i;
    var integer v_NumberOf_NeighCells;
    var boolean v_MeasRep1_Received := false;
    var boolean v_MeasRep2_Received := false;
    var boolean v_MeasRep3_Received := false;
    
    timer t_WaitTimer;
    
    //Initialize testcase
    f_EUTRA_Init( c10 );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    
    v_TimerValue_1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );
    
    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    
    // Get Cell Parameters for UTRAN cell
    v_UTRANSysInfo := f_WaitForIRATCoOrd_SysInfo( UTRAN );
    if( ischosen( v_UTRANSysInfo.Utran[0].FDD ) ) {
      v_UTRAN_FDD_TDD_Cell5 := UTRAN_FDD;
      v_UTRAN_ARFCN_Cell5 := v_UTRANSysInfo.Utran[0].FDD.Freq;
      v_UTRAN_PhysChId_FDD_Cell5 := v_UTRANSysInfo.Utran[0].FDD.ScramblingCode;
    }
    else {
      v_UTRAN_FDD_TDD_Cell5 := UTRAN_FDD;
      v_UTRAN_ARFCN_Cell5 := v_UTRANSysInfo.Utran[0].TDD.Freq;
      v_UTRAN_PhysChId_TDD_Cell5 := v_UTRANSysInfo.Utran[0].TDD.CellParametersID;
    }
    
    // Get Cell Parameters for GERAN cell
    v_GERANSysInfo := f_WaitForIRATCoOrd_SysInfo( GERAN );
    
    v_GERAN_ARFCN_Cell24 := v_GERANSysInfo.Geran[0].Arfcn;
    
    v_CoOrd_GERANNeighCell_Type := v_GERANSysInfo.Geran[0].NeighCells;
    v_NumberOf_NeighCells := lengthof( v_CoOrd_GERANNeighCell_Type );
    for( i := 0; i < v_NumberOf_NeighCells; i := i + 1 ) {
      v_ExplicitListOfARFCNs[i] :=  v_CoOrd_GERANNeighCell_Type[i];
    }
    
    v_GERAN_PhysChId_Cell24 := {
      networkColourCode := v_GERANSysInfo.Geran[0].Ncc,
      baseStationColourCode := v_GERANSysInfo.Geran[0].Bcc
    }
    
    if( v_GERANSysInfo.Geran[0].BandIndicator == '0'B ) {
      v_BandIndicatorGERAN_Cell24 := dcs1800;
    }
    else {
      v_BandIndicatorGERAN_Cell24 := pcs1900;
    }

    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message to setup intra and inter RAT measurements on Cell 1.
    if( v_UTRAN_FDD_TDD_Cell5 == UTRAN_FDD ) {
      SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReconfiguration_8_3_2_6_Step1_FDD(v_RRC_TI,
                                                                                       v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                       v_ChBandDependency_f1.AllowedMeasBandwidth,
                                                                                       v_UTRAN_ARFCN_Cell5,
                                                                                       v_GERAN_ARFCN_Cell24,
                                                                                       v_BandIndicatorGERAN_Cell24,
                                                                                       v_ExplicitListOfARFCNs ) ) );
    }
    else {
      SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReconfiguration_8_3_2_6_Step1_TDD(v_RRC_TI,
                                                                                       v_Frequency_IE_f1.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                       v_ChBandDependency_f1.AllowedMeasBandwidth,
                                                                                       v_UTRAN_ARFCN_Cell5,
                                                                                       v_GERAN_ARFCN_Cell24,
                                                                                       v_BandIndicatorGERAN_Cell24,
                                                                                       v_ExplicitListOfARFCNs ) ) );
    }
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //Check: Does the UE transmit any MeasurementReport messages during the next 10s?
    fl_NoMeasurementReport( eutra_Cell1, v_TimerValue_1, cr_MeasurementReport_CheckAny );
    
    //@siclog "Step 4" siclog@
    //The SS changes Cell 1, Cell 5 and Cell 24 parameters according to row "T1" in table 8.3.2.6.3.2-1.
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger );
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 5" siclog@
    //The SS waits for 10s.
    //EXCEPTION: In parallel to step 5 the steps specified in Table 8.3.2.6.3.2-3 shall take place.
    if( v_UTRAN_FDD_TDD_Cell5 == UTRAN_FDD ) {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_FDD( 2, v_UTRAN_PhysChId_FDD_Cell5 );
    }
    else {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_TDD( 2, v_UTRAN_PhysChId_TDD_Cell5 );
    }
    t_WaitTimer.start( v_TimerValue_1 );
    //label Label_01;
    alt {
      [] t_WaitTimer.timeout
        {
          f_EUTRA_SetVerdictFailOrInconc( __FILE__, __LINE__, "Test Case 8.3.2.6 Step 5" );
        }
      //Parallel behaviour Step 1: Check: Does the UE transmit a MeasurementReport message to report event A2 for Cell 1.
      [] SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport( 1, ?, ?, omit ) ) )
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.2.6 Step 5 Parallel behaviour Step 1" );
          v_MeasRep1_Received := true;
          if( v_MeasRep1_Received == true and v_MeasRep2_Received == true and v_MeasRep3_Received == true ) {
            t_WaitTimer.timeout;
          }
          else { repeat }
        }
      //Parallel behaviour Step 2: Check: Does the UE transmit a MeasurementReport message to report event B2 for Cell 5.
      [] SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, v_MeasRpt ) )
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.2.6 Step 5 Parallel behaviour Step 2" );
          v_MeasRep2_Received := true;
          if( v_MeasRep1_Received == true and v_MeasRep2_Received == true and v_MeasRep3_Received == true ) {
            t_WaitTimer.timeout;
          }
          else { repeat }
        }
      //Parallel behaviour Step 3: Check: Does the UE transmit a MeasurementReport message to report event B2 for Cell 24.
      [] SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_MeasurementReport_Geran_1Entry( 3, v_GERAN_PhysChId_Cell24 ) ) )
        {
          f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.2.6 Step 5 Parallel behaviour Step 3" );
         v_MeasRep3_Received := true;
          if( v_MeasRep1_Received == true and v_MeasRep2_Received == true and v_MeasRep3_Received == true ) {
            t_WaitTimer.timeout;
          }
          else { repeat }
        }
    }
    
    //@siclog "Step 6" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.3 indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 1?
    f_EUTRA_508Check_ConnectedState( eutra_Cell1 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    //tell the UTRAN component that the test is over
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger );

    //tell the GERAN component that the test is over
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  }; //end of testcase 8.3.2.6
  
  //================================================================
  //testcase 8.3.3.1 (EUTRA part):
  //Measurement configuration control and reporting / SON / ANR / CGI reporting of E-UTRAN cell  //Changed title, CR R5-101186
  function f_TC_8_3_3_1_EUTRA() runs on EUTRA_PTC
  {
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE;
    var PhysCellId v_PhysCellId;
    var ChannelBandwidthDependency_Type v_ChBandDependency;
    var DefaultPagingCycle_Type v_PagingCycleType:= rf256;
    var integer v_T0_T1_RS_EPRE_Cell1 := -85;  // Changed from -80 to -85, CR R5-101130
    var integer v_T0_RS_EPRE_Cell2 := -91;  // Changed from -110 to -91, CR R5-101130
    var integer v_T1_RS_EPRE_Cell2 := -79;  // Changed from -59 to -79, CR R5-101130
    
    var float v_TimerValue;
    
    var EUTRA_CellInfo_Type v_CellInfo;
    var CellIdentity v_CellIdentity; // := int2bit(1, 20) & int2bit(2,8);
    //var GutiParameters_Type v_GutiParameters;
    var PLMN_Identity v_PLMN_Identity;
    var TrackingAreaCode v_TrackingAreaCode; //@sic R5-105002 sic@
    var template PLMN_IdentityList2 v_PLMN_IdentityList2; //@sic R5-105002 sic@
    
    //Initialize testcase
    f_EUTRA_Init( c2 );
    
    v_TimerValue := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 1.0 );
    
    f_EUTRA_CellInfo_SetSysInfo_DefaultPagingCycle( eutra_Cell1, v_PagingCycleType );
    f_EUTRA_CellInfo_SetPLMN_2Entries( eutra_Cell2, cs_HPLMN_Def, cs_HPLMN_001_02 ); //@sic R5-105002 sic@
    
    v_PhysCellId := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell2 );
    v_Frequency_IE := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell2 );
    v_ChBandDependency := f_EUTRA_BandDependentParam( v_Frequency_IE.DL_ChBandwidth, v_Frequency_IE.UL_ChBandwidth );

    //v_GutiParameters := f_EUTRA_CellInfo_GetGuti( eutra_Cell2 );
    v_CellInfo := f_EUTRA_CellInfo_Get( eutra_Cell2 );
    v_CellIdentity := v_CellInfo.CellIds.CellIdentity;
    v_PLMN_Identity := v_CellInfo.NAS_Parameters.Guti_Parameters.PLMN_Identity;
    v_TrackingAreaCode := f_EUTRA_CellInfo_GetTAC( eutra_Cell2 ); //@sic R5-105002 sic@
    v_PLMN_IdentityList2 := { cs_HPLMN_001_02 }; //@sic R5-105002 sic@
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_T1_RS_EPRE_Cell1 );
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell2, v_T1_RS_EPRE_Cell2 );

    //Create and configure Cell1, Cell2
    f_EUTRA_CellConfig_Def( eutra_Cell1 );

    f_EUTRA_SetCellConfigCapability( eutra_Cell2, broadcastOnlyCell ); //@sic R5-103077 sic@
    f_EUTRA_CellConfig_SRBs_Only( eutra_Cell2 ); //@sic R5-103077 sic@

    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    f_EUTRA_SetCellPower( eutra_Cell2, v_T0_RS_EPRE_Cell2, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //Send RRC Connection Reconfiguration for setting up intra LTE measurement for event A3
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_3_1_Step1(tsc_RRC_TI_Def,
                                                                                 v_Frequency_IE.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency.AllowedMeasBandwidth ) ) );
    
    //@siclog "Step 2" siclog@
    //Receive RRC Reconfiguration Complete
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //Set EPRE for T1
    f_EUTRA_SetCellPower( eutra_Cell2, v_T1_RS_EPRE_Cell2, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //Receive Measurement Report
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_Eutra_1Entry_rsrp( 1, v_PhysCellId ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.3.1 Step 4" );
    
    //@siclog "Step 5" siclog@
    //Send RRC Connection Reconfiguration with reportCGI for Cell 2
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_3_1_Step5(tsc_RRC_TI_Def,
                                                                                 v_Frequency_IE.UL_DL_Earfcn.dl_CarrierFreq,
                                                                                 v_ChBandDependency.AllowedMeasBandwidth,
                                                                                 v_PhysCellId) ) );
    
    //@siclog "Step 6" siclog@
    //Receive RRC Reconfiguration Complete
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 7" siclog@
    //Check that Measurement Report is received within a certain time
    fl_Check_Timer_MeasurementReport( eutra_Cell1,
                                      v_TimerValue,
                                      cr_MeasurementReport_8_3_3_1_Step7(v_PhysCellId,
                                                                         v_PLMN_Identity,
                                                                         v_CellIdentity,
                                                                         v_TrackingAreaCode, //@sic R5-105002 sic@
                                                                         v_PLMN_IdentityList2 ) ); //@sic R5-105002 sic@
    f_EUTRA_508Check_ConnectedState( eutra_Cell1 );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  }; //end of testcase 8.3.3.1
  
  //================================================================
  //testcase 8.3.3.2 (EUTRA part):
  //Measurement configuration control and reporting / SON / ANR: CGI reporting of UTRAN cell
  function f_TC_8_3_3_2_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -80;
    var integer v_T1_RS_EPRE_Cell1 := -60;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    
    var PhysCellId v_PhysCellId_Cell1;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    var DefaultPagingCycle_Type v_PagingCycleType:= rf256;
    
    var IRAT_CoOrd_SysInfo_Type v_UTRANSysInfo;
    var UTRAN_FDD_TDD v_UTRAN_FDD_TDD_Cell5;
    var integer v_UTRAN_ARFCN_Cell5, v_UTRAN_PhysChId_FDD_Cell5, v_UTRAN_PhysChId_TDD_Cell5;
    
    var template(present) UL_DCCH_Message v_MeasRpt;
    
    var float v_TimerValue_1;
    
    //Initialize testcase
    f_EUTRA_Init( c4 );
    f_EUTRA_CellInfo_SetSysInfo_DefaultPagingCycle( eutra_Cell1, v_PagingCycleType );
    
    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    
    v_TimerValue_1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 8.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T1_RS_EPRE_Cell1 );
    
    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def( eutra_Cell1 );
    
    //Get Cell Parameters for UTRAN cell
    v_UTRANSysInfo := f_WaitForIRATCoOrd_SysInfo( UTRAN );
    if( ischosen( v_UTRANSysInfo.Utran[0].FDD ) )
      {
        v_UTRAN_FDD_TDD_Cell5 := UTRAN_FDD;
        v_UTRAN_ARFCN_Cell5 := v_UTRANSysInfo.Utran[0].FDD.Freq;
        v_UTRAN_PhysChId_FDD_Cell5 := v_UTRANSysInfo.Utran[0].FDD.ScramblingCode;
      }
    else
    {
      v_UTRAN_FDD_TDD_Cell5 := UTRAN_TDD;
      v_UTRAN_ARFCN_Cell5 := v_UTRANSysInfo.Utran[0].TDD.Freq;
      v_UTRAN_PhysChId_TDD_Cell5 := v_UTRANSysInfo.Utran[0].TDD.CellParametersID;
    }
    
    f_EUTRA_TestBody_Set( true );
    
    //------------------------------------------------
    //Start TestBody
    
    //@siclog "Step 1" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measConfig to setup inter RAT measurement for the purpose of SON .
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_3_2_Step1(v_RRC_TI,
                                                                                 v_UTRAN_ARFCN_Cell5 ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );

    //@siclog "Step 3" siclog@
    //The SS changes Cell 5 power level according to the row "T1" in table 8.3.3.2.3.2-1.
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //Check: Does the UE transmit a MeasurementReport message to report the measured result for Cell 5?
    if( v_UTRAN_FDD_TDD_Cell5 == UTRAN_FDD )
    {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_FDD( 1, v_UTRAN_PhysChId_FDD_Cell5 );
    }
    else
    {
      v_MeasRpt := cr_MeasurementReport_Utran_1Entry_TDD( 1, v_UTRAN_PhysChId_TDD_Cell5 );
    }
    
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, v_MeasRpt ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.3.2 Step 4" );

    //@siclog "Step 5" siclog@
    //SS transmits an RRCConnectionReconfiguration message including measConfig including reportCGI for Cell 5 and sufficient idle periods for UE to acquire the relevant system information from Cell 5.
    if( v_UTRAN_FDD_TDD_Cell5 == UTRAN_FDD )
      {
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_8_3_3_2_Step5_FDD(v_RRC_TI,
                                                                                         v_UTRAN_ARFCN_Cell5,
                                                                                         v_UTRAN_PhysChId_FDD_Cell5 ) ) );
      }
    else
      {
        SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                       cs_TimingInfo_Now,
                                       cs_RRCConnectionReconfiguration_8_3_3_2_Step5_TDD(v_RRC_TI,
                                                                                         v_UTRAN_ARFCN_Cell5,
                                                                                         v_UTRAN_PhysChId_TDD_Cell5 ) ) );
      }
    
    //@siclog "Step 6" siclog@
    //The UE transmits an RRCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 7" siclog@
    //Check: Does the UE transmit a MeasurementReport message with globalCellIdentity of Cell 5 within 8 sec?
    if( v_UTRAN_FDD_TDD_Cell5 == UTRAN_FDD )
      {
        v_MeasRpt := cr_MeasurementReport_8_3_3_2_Step7_FDD( v_UTRAN_PhysChId_FDD_Cell5,
                                                             ?,   //TBD!!!! How to get the PLMN of a UTRAN cell?
                                                             ? ); //TBD!!!! How to get the CellIdentity of a UTRAN cell?
      }
    else
      {
        v_MeasRpt := cr_MeasurementReport_8_3_3_2_Step7_TDD( v_UTRAN_PhysChId_TDD_Cell5,
                                                             ?,   //TBD!!!! How to get the PLMN of a UTRAN cell?
                                                             ? ); //TBD!!!! How to get the CellIdentity of a UTRAN cell?
      }
    
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, v_MeasRpt ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.3.2 Step 7" );
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    //tell the UTRAN component that the test is over
    f_SendIRATCoOrd( UTRAN, cms_IRAT_Trigger);
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  }; //end of testcase 8.3.3.2

  //================================================================
  //testcase 8.3.3.3 (EUTRA part):
  //Measurement configuration control and reporting / SON / ANR / CGI reporting of GERAN cell
  function f_TC_8_3_3_3_EUTRA() runs on EUTRA_PTC
  {
    var integer v_T0_RS_EPRE_Cell1 := -60;
    var integer v_T1_RS_EPRE_Cell1 := -80;
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var Frequency_IE_Type v_Frequency_IE_f1;
    var PhysCellId v_PhysCellId_Cell1;
    var ChannelBandwidthDependency_Type v_ChBandDependency_f1;
    var DefaultPagingCycle_Type v_PagingCycleType:= rf256;
    
    var IRAT_CoOrd_SysInfo_Type v_GERANSysInfo;
    var ARFCN_ValueGERAN v_GERAN_ARFCN_Cell24;
    var CoOrd_GERANNeighCell_Type v_CoOrd_GERANNeighCell_Type;
    var ExplicitListOfARFCNs v_ExplicitListOfARFCNs;
    var PhysCellIdGERAN v_GERAN_PhysChId_Cell24;
    var O2_Type v_GERAN_Cell_Identity_Cell24;
    var BandIndicatorGERAN v_BandIndicatorGERAN_Cell24;
    
    var float v_TimerValue_1;
    
    //var default v_DefaultRef;
    
    var integer i;
    var integer v_NumberOf_NeighCells;
    
    //timer t_Wait;
    
    //Initialize testcase
    f_EUTRA_Init( c5 );
    f_EUTRA_CellInfo_SetSysInfo_DefaultPagingCycle( eutra_Cell1, v_PagingCycleType );

    v_PhysCellId_Cell1 := f_EUTRA_CellInfo_GetPhyCellId( eutra_Cell1 );
    v_Frequency_IE_f1 := f_EUTRA_CellInfo_GetFrequencyIEs( eutra_Cell1 );
    v_ChBandDependency_f1 := f_EUTRA_BandDependentParam( v_Frequency_IE_f1.DL_ChBandwidth, v_Frequency_IE_f1.UL_ChBandwidth );
    
    v_TimerValue_1 := f_EUTRA_SetTimerToleranceMax( eutra_Cell1, 10.0 );
    
    //Set EPRE for RF Initial
    f_EUTRA_CellInfo_InitMaxReferencePower( eutra_Cell1, v_T0_RS_EPRE_Cell1 );
    
    //Create and configure Cell1
    f_EUTRA_CellConfig_Def( eutra_Cell1 );
    
    //Set EPRE for T0
    f_EUTRA_SetCellPower( eutra_Cell1, v_T0_RS_EPRE_Cell1, cs_TimingInfo_Now );

    //Preamble
    f_EUTRA_Preamble( eutra_Cell1, STATE2_IDLEUPDATE );
    f_EUTRA_RbEst_Def(eutra_Cell1);
    
    // Get Cell Parameters for GERAN cell
    v_GERANSysInfo := f_WaitForIRATCoOrd_SysInfo( GERAN );
    
    v_GERAN_ARFCN_Cell24 := v_GERANSysInfo.Geran[0].Arfcn;

    v_CoOrd_GERANNeighCell_Type := v_GERANSysInfo.Geran[0].NeighCells;
    v_NumberOf_NeighCells := lengthof( v_CoOrd_GERANNeighCell_Type );
    for( i := 0; i < v_NumberOf_NeighCells; i := i + 1 ) {
      v_ExplicitListOfARFCNs[i] :=  v_CoOrd_GERANNeighCell_Type[i];
    }
    
    v_GERAN_PhysChId_Cell24 := {
      networkColourCode := v_GERANSysInfo.Geran[0].Ncc,
      baseStationColourCode := v_GERANSysInfo.Geran[0].Bcc
    }

    v_GERAN_Cell_Identity_Cell24 := v_GERANSysInfo.Geran[0].Cell_Identity;
    
    if( v_GERANSysInfo.Geran[0].BandIndicator == '0'B ) {
      v_BandIndicatorGERAN_Cell24 := dcs1800;
    }
    else {
      v_BandIndicatorGERAN_Cell24 := pcs1900;
    }
    
    //------------------------------------------------
    //Start TestBody
    
    f_EUTRA_TestBody_Set( true );
    
    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionReconfiguration message including measConfig to setup inter-RAT measurements and reporting for event B2.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_3_3_Step1(v_RRC_TI,
                                                                                 v_GERAN_ARFCN_Cell24,
                                                                                 v_BandIndicatorGERAN_Cell24,
                                                                                 v_ExplicitListOfARFCNs ) ) );
    
    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 3" siclog@
    //The SS re-adjusts the cell-specific reference signal level according to row "T1" in table 8.3.3.3.3.2-1.
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    f_EUTRA_SetCellPower( eutra_Cell1, v_T1_RS_EPRE_Cell1, cs_TimingInfo_Now );
    
    //@siclog "Step 4" siclog@
    //Check: Does the UE transmit a MeasurementReport message to report event B2 for Cell 24?
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1,
                                      cr_MeasurementReport_8_3_3_3_Step4( v_GERAN_ARFCN_Cell24,
                                                                          v_BandIndicatorGERAN_Cell24,
                                                                          v_GERAN_PhysChId_Cell24 ) ) );
    f_EUTRA_PreliminaryPass( __FILE__, __LINE__, "Test Case 8.3.3.3 Step 4" );
    
    //@siclog "Step 5" siclog@
    //The SS transmits an RRCConnectionReconfiguration message including measConfig including reportCGI for Cell 24 and sufficient idle periods for UE to acquire the relevant system information from Cell 24.
    SRB.send( cas_SRB1_RrcPdu_REQ( eutra_Cell1,
                                   cs_TimingInfo_Now,
                                   cs_RRCConnectionReconfiguration_8_3_3_3_Step5(v_RRC_TI,
                                                                                 v_GERAN_ARFCN_Cell24,
                                                                                 v_BandIndicatorGERAN_Cell24,
                                                                                 v_ExplicitListOfARFCNs ) ) );

    //@siclog "Step 6" siclog@
    //The UE transmits an RRCConnectionReconfigrationComplete message.
    SRB.receive( car_SRB1_RrcPdu_IND( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete( v_RRC_TI ) ) );
    
    //@siclog "Step 7" siclog@
    //Check: Does the UE transmit a MeasurementReport message with cellGlobalId of Cell 24 within 8 sec?
    fl_Check_Timer_MeasurementReport( eutra_Cell1,
                                      v_TimerValue_1,
                                      cr_MeasurementReport_8_3_3_3_Step7( v_GERAN_ARFCN_Cell24,
                                                                          v_BandIndicatorGERAN_Cell24,
                                                                          v_GERAN_PhysChId_Cell24,
                                                                          ?, //TBD!!!! How to get the PLMN_Identity of a GERAN cell?
                                                                          ?, //TBD!!!! How to get the LocationAreaCode of a GERAN cell?
                                                                          oct2bit( v_GERAN_Cell_Identity_Cell24 ),
                                                                          ? ) ); //TBD!!!! How to get the RoutingAreaCode of a GERAN cell?
    
    //End TestBody
    //------------------------------------------------
    
    f_EUTRA_TestBody_Set( false );
    
    //tell the GERAN component that the test is over
    f_SendIRATCoOrd( GERAN, cms_IRAT_Trigger );
    
    f_EUTRA_Postamble( eutra_Cell1, E2_CONNECTED, v_RRC_TI ); //@sic R5-103875 sic@
    
  }; //end of testcase 8.3.3.3
  
} // end of Module
