/******************************************************************************/
// @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 11:02:33 +0200 (Fri, 17 Sep 2010) $
// $Rev: 3952 $
/******************************************************************************/

module UTRAN_CellInfo {
  
  import from CommonDefs all;
  import from NAS_CommonTypeDefs all;
  import from UTRAN_RRC_ASN1_Definitions language "ASN.1:1997" all;
  import from UTRAN_ASP_Definitions language "ASN.1:1997" all;
  import from UTRAN_ASN1_Templates all;
  import from UTRAN_Templates all;
  import from UTRAN_Parameters all;
  import from Parameters all;
  import from CommonIratDefs all;
  import from NAS_AuxiliaryDefsAndFunctions all;
  import from UTRANGERAN_CommonFunctions all;
  
  /****************************************************************************/
  // global types for control of the UTRAN:
  
  group UtranCommonDeclarations {
  //    const float UTRAN_t_WaitMS_Value := 13.5;
  const integer tsc_UTRAN_NumberOfCells := 4;                         /* @status    APPROVED */
  const AvailableSubChannelNumbers tsc_SubChNum := '111111111111'B;   /* has been a TCV;
                                                                         Available subchannel numbers for PRACH, this initial value is for ts_SS_CreateCellFACH.
                                                                         (from 34.108  cl. 6.1 (SIB5)) */
  } // END GROUP UtranCommonDeclarations
  //--------------------------------------------------------------------------
  type enumerated COMMON_TestConfig_Enum   {utran_only, utran_geran};
  type enumerated UTRAN_FDD_TDD  {UTRAN_FDD, UTRAN_TDD};              /* @status    APPROVED */
  
  //--------------------------------------------------------------------------
  type record DRX_CycleLengthStructure {                              /* @status    APPROVED */
    // Structure that contains CN DRX cycle length (CS and PS) and the UTRAN DRX Cycle length.
    // This type is to be used in the CellInfoCfg in order to keep all DRX values.
    CN_DRX_CycleLengthCoefficient cN_CS_DRX_CycleLength  optional,
    CN_DRX_CycleLengthCoefficient cN_PS_DRX_CycleLength  optional,
    UTRAN_DRX_CycleLengthCoefficient uTRAN_DRX_CycleLength  optional
  };
  //--------------------------------------------------------------------------
  type record RlcCtrl_Type {                                          /* @status    APPROVED */
    TimerPoll          timerPoll,         // value for polling timer, this initial value is for ts_SS_CreateCellFACH. (from 34.123-1). used in RB2, RB3, RB4
    TimerPollProhibit  timerPollProhibit, // minimum time between polls,  this initial value is for ts_SS_CreateCellFACH. (from 34.123-1). used in RB2, RB3, RB4
    Poll_SDU           pollSDU,           // number of SDU's between pollings, this initial value is for ts_SS_CreateCellFACH. (from 34.123-1). used in RB2, RB3, RB4.
    PollWindow         pollWindow         // percentage of transmission window,threshold for polling, this initial value is for ts_SS_CreateCellFACH. (from 34.123-1). used in RB2, RB3, RB4.
  };
  //--------------------------------------------------------------------------
  type record UTRAN_SecurityInfo_Type {                               /* @status    APPROVED */
    // This structure contains relevant information independant from the cell
    boolean         cs_cipheringStarted,   // Set to TRUE when ciphering is started, to be initiated in Security Steps and used in RAB establishment Steps
    boolean         ps_cipheringStarted,   // Set to TRUE when ciphering is started, to be initiated in Security Steps and used in RAB establishment Steps
    CN_DomainIdentity recentSecureDomain,  // the domain on which security was recently started, and hence the SRB are ciphered and Integrit protected with this domain.
    CipheringModeCommand_r7 dL_CipherMode,             // To hold the DL cipher mode to be used in RAB Steps.
    RB_ActivationTimeInfoList uL_CipherMode optional,  // To hold the UL cipher mode to be used in RAB Steps.
    bitstring       cipheringAlgorithmCapability,      // BITSTRING thats hold the ciphering algorithm capability supported by UE
    boolean         integrityStarted,                  // Set to TRUE when integrity is started
    IntegrityProtectionModeInfo_r7 dL_Integrity,       // To hold the DL integrity protection active during a test case
    IntegrityProtActivationInfo uL_Integrity optional, // To hold the UL integrity protection active during a test case
    B16_Type        integrProtAlgCap,                  // To hold the integrity protection algorithm capability
    IntegrityCheckInfo dl_IntegrityCheckInfo optional, // To hold the integrity information to be sent
    START_Value     start_CS,                          // To hold the START value for CS Domain
    START_Value     start_PS,                          // To hold the START value for PS Domain
    //      boolean         cipheringOnOff,                    // To indicate if Ciphering needs to be enabled or not
    SecurityCtrl_Type authKeys                         // Containing the latest authentication keys
  };
  //--------------------------------------------------------------------------
  type record UTRAN_CellInfo_Type_FDD {                               /* @status    APPROVED */
    // This structure contains relevant information describing a cell configuration as needed for basic test Steps like ts_CreateCell and ts_IdleUpdated.
    // NOTE: this information is not related to any PDUs, IEs or ASPs
    
    PrimaryScramblingCode priScrmCode,     // Primary Scrambling Code
    DL_TxPower_PCPICH powerpCPICH,         // Absolute Tx Power of (primary) CPICH
    DL_TxPower        powerpCCPCH,         // Tx power level of primary CCPCH relative to CPICH
    DL_TxPower        powerpSCH,           // Tx power level of primary SCH relative to CPICH
    DL_TxPower        powersSCH,           // Tx power level of secondary SCH relative to CPICH
    
    integer           timingsCCPCH1,       // Timing offset for secondary CCPCH1
    AICH_PowerOffset  powerAICH,           // Tx power level of AICH relative to CPICH
    SCCPCHSlotFormat  slotFormatsCCPCH1,   // Slot format for secondary CCPCH1
    UL_ScramblingCode uL_ScramblingCode,   // To hold the UL scrambling to be used in the cell
    FrequencyBandFDD  operationBand,
    
    //      boolean         isServingCell,
    integer           band                 // Operation Band used in the cell
  };
  //--------------------------------------------------------------------------
  type record UTRAN_CellInfo_Type_TDD {                               /* @status    APPROVED */
    // This structure contains relevant information describing a cell configuration as needed for basic test Steps like ts_CreateCell and ts_IdleUpdated.
    // NOTE: this information is not related to any PDUs, IEs or ASPs
    
    FrequencyInfo               frequencyInfo_S1,         // Frequency information for N-Frequency cell
    FrequencyInfo               frequencyInfo_S2,         // Frequency information for N-Frequency cell
    UpPCHposition_LCR           upPCHposition,
    UpPCHposition_LCR           upPCHposition_S1,
    UpPCHposition_LCR           upPCHposition_S2,
    
    integer                     attenuationLevel_S1,      // Value of RF attenuator
    integer                     attenuationLevel_S2,      // Value of RF attenuator
    CellParametersID            cellParametersID,         // Cell Parameters ID
    DL_TxPower_PCCPCH           powerpCCPCH,
    
    DL_TxPower                  powerFPACH,
    
    TimeSlotConfigurationList_LCR timeSlotConfigurationList_LCR,   //
    TransmissionDiversityApplied  transmissionDiversityApplied,           //
    DwPCHInfo                     dwPCHInfo           //
    
  };
  //--------------------------------------------------------------------------
  type record UTRAN_CellInfo_Type {                  /* @status    APPROVED */
    // This structure contains relevant information describing a cell configuration as needed for basic test Steps like ts_CreateCell and ts_IdleUpdated.
    // NOTE: this information is not related to any PDUs, IEs or ASPs
    UTRAN_CellId_Type         cellId,                // Cell Id
    UTRAN_FDD_TDD             fdd_tdd,               // whether cell is FDD or TDD
    FrequencyInfo             frequencyInfo,         // Frequency information for current cell
    integer                   attenuationLevel,      // Value of RF attenuator
    DL_TxPower                powersCCPCH,           // Tx power level of secondary CCPCH relative to CPICH
    DL_TxPower                powersCCPCH1,          // Tx power level of secondary CCPCH1 relative to CPICH
    PICH_PowerOffset          powerPICH,             // Tx power level of PICH relative to CPICH
    CellTxPowerLevel          cellTxPowerLevel,      // Total cell power level (>= sum of all configured physical channels)
    integer                   sfnOffset,             // SFN offset (in frames)
    PuncturingLimit           puncLimit,             // Puncturing limit for PRACH
    SF_PRACH                  sf_PRACH,              // Spreading factor for PRACH
    PLMN_Identity             plmnId,                // even though this is the same definition as EUTRA, will probably be treated differently
    octetstring               lac,                   // LAC
    octetstring               rac,                   // RAC
    integer                   attFlag,               // Attach flag (as  broadcasted in BCCH)
    octetstring               nmo,                   // Network mode of operation
    bitstring                 ura_Identity,          // URA Identity (3GPP 25.331 clause 10.3.2.6)
    octetstring               t3212,                 // T3212 value
    C_RNTI                    cRNTI,                 // cell radio network temporary identity assigned to the UE under test, this initial value is for ts_SS_CreateCellFACH. ( from 34.123-1)
    U_RNTI                    uRNTI,                 // srnc_Identity and   s_RNTI
    RB_ConfigType             cellConfig,            // Current configuration of the cell
    RlcCtrl_Type              rlcParams,             // RLC parameters
    DRX_CycleLengthStructure  dRX_CycleLength,       // To hold the 3 dRX_CycleLength
    integer                   nodeB_Id,
    UTRAN_CellInfo_Type_TDD   cellInfo_Specific_TDD    optional,
    UTRAN_CellInfo_Type_FDD   cellInfo_Specific_FDD    optional,
    UTRAN_CellSysInfo_Type    sysInfo                // SysInfo Structure
  };
  type record length (tsc_UTRAN_NumberOfCells) of UTRAN_CellInfo_Type UTRAN_CellInfoList_Type; /* @status    APPROVED */
  
  //--------------------------------------------------------------------------
  type record AuthCSKeys_Type {        /* @status    APPROVED */
    bitstring CKey,                    // Ciphering Key; 128 bits (TS 33.102 cl. 6.3.7, TS 34.108 cl. 8.1.2)
    bitstring IKey,                    // Integrity Key; 128 bits (TS 33.102 cl. 6.3.7, TS 34.108 cl. 8.1.2)
    KeySeq CKeySeq                     // Ciphering key sequence number
  }
  //--------------------------------------------------------------------------
  type record SecurityCtrl_Type {      /* @status    APPROVED */
    AuthCSKeys_Type AuthCS,
    Common_AuthenticationParams_Type AuthPS,
    B20_Type HFN                             // Hyper Frame Number for CS or PS  domain - to be used in security steps
  }
  //--------------------------------------------------------------------------
  /*   Defined for Benchmark ATS, but can probably be removed
    type record NasCtrl_Type {
      charstring          PDP_Type,       /// This variable will be used to hold the PDP type
      boolean             IPv4_Flag,      /// This variable is set to TRUE for IPv4 and FALSE for IPv6.
      PDP_TypeNo          IP_TypeNo,      // This variable is used to indicate wich version of IP is used: IP v4 or IP v6;
                                          //   Default is  IPv4 (0 0 1 0 0 0 0 1).
      B2                  bcapCE,         /// To hold the connection element value that shall be used in setup MO pdu.
      RB_ConfigType       ccRbConfigType, // To hold the CC RAB to be used. This variable is used by CC test steps and test cases only.
      Services            activeService,  // Service that is currently used in a test case
      B8                  RAB_Id,         // to hold the RABId received in a SETUP or a CALL CONFIRMED message
      PagingCause         pagingCause,    // To hold the paging cause corresponding to the CC service - this tcv is assigned in ts_CC_InitTCVMT
      EstablishmentCause  estCause,       // Establishment cause used to setup the RRC connection.
                                             This variable is assigned in the steps:  ts_CC_BasicServiceMO or ts_CC_BasicServiceMT
      Bcap                bcapMmedia,
      TI                  TI_R,           // Transaction Identifier  value used to receive CC PDU
      TI                  TI_S,           // Transaction Identifier  value used to send CC PDU
      SETUPdl             setupMT,        // to hold the SETUP MT pdu prepared in the ts_BasicSrvMT step
      boolean             staticPDP_AddressReceived,  // used to flag if in the PDP Context Req message UE has requested for Static PDP context address,
                                                         so that PDP address will not be re allocated in PDP context Accept.
      B3                  dlyClass,
      B3                  trafficClass,
      boolean             RB_TestModeActivated        // Set to TRUE if RB test mode is activated. To be used in the postamble:
                                                      //   when RB test mode has been used then NAS do not need to be released.
    };*/
  //--------------------------------------------------------------------------
  type record UTRAN_CellSysInfo_Type {   /* @status    APPROVED */
    MasterInformationBlock MIB,
    SysInfoTypeSB1  SB1,
    SysInfoType1    SIB1,
    SysInfoType2    SIB2,
    SysInfoType3    SIB3,
    SysInfoType4    SIB4,
    SysInfoType5    SIB5,
    SIB_Type        SIB5_Type,           // holding the SIB5 type, for band 4 and 9 it shall be assigned to systemInformationBlockType5bis
    SysInfoType6    SIB6,
    SysInfoType7    SIB7,
    SysInfoType11   SIB11   optional,    // This is not optional, but it has to be set to omit until data from all the cells is present
    SysInfoType12   SIB12,
    SysInfoType16   SIB16,
    SysInfoType18   SIB18,
    SysInfoType19   SIB19,
    boolean         MIB_ValueTagChanged, // set to TRUE after MIBValueTag changed, set to FALSE after MIB delivered to SS.
    boolean         SB1_ValueTagChanged  // set to TRUE after SB1ValueTag changed, set to FALSE after SB1 delivered to SS.
  };

  //--------------------------------------------------------------------------
  // UTRAN cell info templates
  //--------------------------------------------------------------------------

  template (value) CN_InformationInfoFull cs_CNInfo (  PLMN_Identity            p_PLMN_Identity,
                                                       octetstring              p_LAC,
                                                       DRX_CycleLengthStructure p_DRX_CycleLengthStructure,
                                                       octetstring              p_DomainSpecificNAS_Info ) := {
    plmn_Identity := p_PLMN_Identity,
    cn_CommonGSM_MAP_NAS_SysInfo := p_LAC,
    cn_DomainInformationListFull := { {
                                        cn_DomainIdentity := ps_domain,
                                        cn_DomainSpecificNAS_Info := p_DomainSpecificNAS_Info,
                                        cn_DRX_CycleLengthCoeff := p_DRX_CycleLengthStructure.cN_PS_DRX_CycleLength
                                      }
                                    }
  };
  //--------------------------------------------------------------------------
  // End of UTRAN cell info templates
  //--------------------------------------------------------------------------

  //--------------------------------------------------------------------------
  group UTRAN_SYSTEM_INFORMATION_STEPS {
  //----------------------------------------------------------------------------
  function fl_InitializeSIB5_SIB5Bis(integer p_Band,
                                     PICH_PowerOffset p_PowerPICH,
                                     AICH_PowerOffset p_PowerAICH) return SysInfoType5 {
    // TTCN-2: covers most of ts_InitializeSIB5_SIB5Bis with the following exceptions:
    // - does not set scheduling in MIB (p_CellInfoCfg.MIB.sibSb_ReferenceList)
    //   -> this is / shall be done in ts_SendSIB5
    // - does not set p_CellInfoCfg.SIB_Type5; this is done outside this function in LOCAL_InitSystemInformation
    // => covers also ts_InitializeSIB5_SIB5Bis_LongNeighCellInfo
    
    var template (value) SysInfoType5 v_SIB5;
    
    select  (p_Band)
    {
      case (1, 2, 3){
        v_SIB5 := cs_SIB5_Def(p_PowerPICH, p_PowerAICH);
      } case (4) {
        v_SIB5 := cds_SIB5bis_Band4(p_PowerPICH, p_PowerAICH);
      } case (5) {
        v_SIB5 := cds_SIB5_Band5(p_PowerPICH, p_PowerAICH);
      } case (6) {
        v_SIB5 := cds_SIB5_Band6(p_PowerPICH, p_PowerAICH);
      } case (7) {
        v_SIB5 := cds_SIB5_Band7(p_PowerPICH, p_PowerAICH);
      } case (8) {
        v_SIB5 := cds_SIB5_Band8(p_PowerPICH, p_PowerAICH);
      } case (9) {
        v_SIB5 := cds_SIB5bis_Band9(p_PowerPICH, p_PowerAICH);
      } case (10) {
        v_SIB5 := cds_SIB5bis_Band10(p_PowerPICH, p_PowerAICH);
      } case (11) {
        v_SIB5 := cds_SIB5_Band11(p_PowerPICH, p_PowerAICH);
      } case (12) {
        v_SIB5 := cds_SIB5_Band12(p_PowerPICH, p_PowerAICH);
      } case (13) {
        v_SIB5 := cds_SIB5_Band13(p_PowerPICH, p_PowerAICH);
      } case (14) {
        v_SIB5 := cds_SIB5_Band14(p_PowerPICH, p_PowerAICH);
      } case (15) {
        v_SIB5 := cds_SIB5_Band15(p_PowerPICH, p_PowerAICH);
      } case (16) {
        v_SIB5 := cds_SIB5_Band16(p_PowerPICH, p_PowerAICH);
      } case (17) {
        v_SIB5 := cds_SIB5_Band17(p_PowerPICH, p_PowerAICH);
      } case (18) {
        v_SIB5 := cds_SIB5_Band18(p_PowerPICH, p_PowerAICH);
      } case (19) {
        v_SIB5 := cds_SIB5_Band19(p_PowerPICH, p_PowerAICH);
      } case (20) {
        v_SIB5 := cds_SIB5_Band20(p_PowerPICH, p_PowerAICH);
      } case else  {
        FatalError(__FILE__, __LINE__, "invalid frequency band");
      }
    }
    return valueof(v_SIB5);
  }
  //----------------------------------------------------------------------------
  function fl_InitializeSIB11(UTRAN_CellInfoList_Type p_CellList) return UTRAN_CellInfoList_Type
  {
    var template (value) SysInfoType11 v_SysInfoType11;
    var template (value) UTRAN_CellInfoList_Type v_CellList := p_CellList;
    var integer v_Index_Cell5 := f_UTRAN_CellInfo_GetIndex (utran_Cell5);
    var integer v_Index_Cell7 := f_UTRAN_CellInfo_GetIndex (utran_Cell7);
    var integer v_Index_Cell8 := f_UTRAN_CellInfo_GetIndex (utran_Cell8);
    var integer v_Index_Cell9 := f_UTRAN_CellInfo_GetIndex (utran_Cell9);
    
    
    //if ((p_NoOfPLMNs == onePLMN) or (p_NoOfPLMNs == twoPLMNs)) {
    v_SysInfoType11 := cs_SIB11_Def_FDD(5,
                                        p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                        7,
                                        p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                        8,
                                        p_CellList[v_Index_Cell8].frequencyInfo,
                                        p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                        9,
                                        p_CellList[v_Index_Cell9].frequencyInfo,
                                        p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode);
    v_CellList[v_Index_Cell5].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cs_SIB11_Def_FDD(7,
                                        p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                        5,
                                        p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                        8,
                                        p_CellList[v_Index_Cell8].frequencyInfo,
                                        p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                        9,
                                        p_CellList[v_Index_Cell9].frequencyInfo,
                                        p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode);
    v_CellList[v_Index_Cell7].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cs_SIB11_Freq2_FDD(8,
                                          p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                          5,
                                          p_CellList[v_Index_Cell5].frequencyInfo,
                                          p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                          7,
                                          p_CellList[v_Index_Cell7].frequencyInfo,
                                          p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                          9,
                                          p_CellList[v_Index_Cell9].frequencyInfo,
                                          p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode);
    v_CellList[v_Index_Cell8].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cs_SIB11_Freq2_FDD(9,
                                          p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode,
                                          5,
                                          p_CellList[v_Index_Cell5].frequencyInfo,
                                          p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                          7,
                                          p_CellList[v_Index_Cell7].frequencyInfo,
                                          p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                          8,
                                          p_CellList[v_Index_Cell8].frequencyInfo,
                                          p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode);
    v_CellList[v_Index_Cell9].sysInfo.SIB11 := v_SysInfoType11;
    
    return valueof(v_CellList);
  }
  //----------------------------------------------------------------------------
  function fl_InitializeSIB11_TDD(UTRAN_CellInfoList_Type p_CellList) return UTRAN_CellInfoList_Type
  {
    var template (value) SysInfoType11 v_SysInfoType11;
    var template (value) UTRAN_CellInfoList_Type v_CellList := p_CellList;
    var integer v_Index_Cell5 := f_UTRAN_CellInfo_GetIndex (utran_Cell5);
    var integer v_Index_Cell7 := f_UTRAN_CellInfo_GetIndex (utran_Cell7);
    var integer v_Index_Cell8 := f_UTRAN_CellInfo_GetIndex (utran_Cell8);
    var integer v_Index_Cell9 := f_UTRAN_CellInfo_GetIndex (utran_Cell9);
    
    
    //if ((p_NoOfPLMNs == onePLMN) or (p_NoOfPLMNs == twoPLMNs)) {
    v_SysInfoType11 := cs_SIB11_Def_TDD(5,
                                        p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                        7,
                                        p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                        8,
                                        p_CellList[v_Index_Cell8].frequencyInfo,
                                        p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                        9,
                                        p_CellList[v_Index_Cell9].frequencyInfo,
                                        p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID);
    v_CellList[v_Index_Cell5].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cs_SIB11_Def_TDD(7,
                                        p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                        5,
                                        p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                        8,
                                        p_CellList[v_Index_Cell8].frequencyInfo,
                                        p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                        9,
                                        p_CellList[v_Index_Cell9].frequencyInfo,
                                        p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID);
    v_CellList[v_Index_Cell7].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cs_SIB11_Freq2_TDD(8,
                                          p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                          5,
                                          p_CellList[v_Index_Cell5].frequencyInfo,
                                          p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                          7,
                                          p_CellList[v_Index_Cell7].frequencyInfo,
                                          p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                          9,
                                          p_CellList[v_Index_Cell9].frequencyInfo,
                                          p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID);
    v_CellList[v_Index_Cell8].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cs_SIB11_Freq2_TDD(9,
                                          p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID,
                                          5,
                                          p_CellList[v_Index_Cell5].frequencyInfo,
                                          p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                          7,
                                          p_CellList[v_Index_Cell7].frequencyInfo,
                                          p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                          8,
                                          p_CellList[v_Index_Cell8].frequencyInfo,
                                          p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID);
    v_CellList[v_Index_Cell9].sysInfo.SIB11 := v_SysInfoType11;
 // }
  /*else if (p_NoOfPLMNs = threePLMNs) {
    if (p_CellId = tsc_CellIdCell5) {
     v_SysInfoType11 := cs_SIB11_Freq3_PLMN3_TDD(UTRAN_CellInfo_Get(tsc_CellIdCell5),
                       UTRAN_CellInfo_Get(tsc_CellIdCell7),
                       UTRAN_CellInfo_Get(tsc_CellIdCell8),
                       UTRAN_CellInfo_Get(tsc_CellIdCell9));
  } else if (p_CellId = tsc_CellIdCell7) {
     v_SysInfoType11 := cs_SIB11_Freq3_PLMN3_TDD(UTRAN_CellInfo_Get(tsc_CellIdCell7),
                       UTRAN_CellInfo_Get(tsc_CellIdCell5),
                       UTRAN_CellInfo_Get(tsc_CellIdCell8),
                       UTRAN_CellInfo_Get(tsc_CellIdCell9));
  } else if (p_CellId = tsc_CellIdCell8) {
     v_SysInfoType11 := cs_SIB11_Freq3_PLMN3_TDD(UTRAN_CellInfo_Get(tsc_CellIdCell8),
                       UTRAN_CellInfo_Get(tsc_CellIdCell5),
                       UTRAN_CellInfo_Get(tsc_CellIdCell7),
                       UTRAN_CellInfo_Get(tsc_CellIdCell9));
  } else if (p_CellId = tsc_CellIdCell9) {
     v_SysInfoType11 := cs_SIB11_Freq3_PLMN3_TDD(UTRAN_CellInfo_Get(tsc_CellIdCell9),
                       UTRAN_CellInfo_Get(tsc_CellIdCell5),
                       UTRAN_CellInfo_Get(tsc_CellIdCell7),
                       UTRAN_CellInfo_Get(tsc_CellIdCell8));
     }
  }*/
    return valueof(v_CellList);
  }
  //----------------------------------------------------------------------------
  function fl_InitializeSIB11_ForGERAN (UTRAN_CellInfoList_Type p_CellList, CoOrd_GERANSysInfo_List_Type p_GERANSysInfo) return UTRAN_CellInfoList_Type
  {
    var UTRAN_CellInfoList_Type v_CellList := p_CellList;
    // if the first cell is FDD, then they all are
    if (v_CellList[0].fdd_tdd == UTRAN_FDD)
      {
        v_CellList := fl_InitializeSIB11_UG_FDD (v_CellList, p_GERANSysInfo);
      } else {
      v_CellList := fl_InitializeSIB11_UG_TDD (v_CellList, p_GERANSysInfo);
    }
    return(v_CellList)
      }
  //----------------------------------------------------------------------------
  function fl_UTRAN_GetGeranBandIndicator(B1_Type p_BandInd) return Frequency_Band
  {
    var Frequency_Band v_ASN1Band:= dcs1800BandUsed;
    
    if (p_BandInd == '1'B) {
      v_ASN1Band := pcs1900BandUsed;
    }
    return (v_ASN1Band);
  }
  //----------------------------------------------------------------------------
  function fl_InitializeSIB11_UG_FDD(UTRAN_CellInfoList_Type p_CellList, CoOrd_GERANSysInfo_List_Type p_GERANSysInfo) return UTRAN_CellInfoList_Type
  {
    var template (value) SysInfoType11 v_SysInfoType11;
    var template (value) UTRAN_CellInfoList_Type v_CellList := p_CellList;
    var integer v_Index_Cell5 := f_UTRAN_CellInfo_GetIndex (utran_Cell5);
    var integer v_Index_Cell7 := f_UTRAN_CellInfo_GetIndex (utran_Cell7);
    var integer v_Index_Cell8 := f_UTRAN_CellInfo_GetIndex (utran_Cell8);
    var integer v_Index_Cell9 := f_UTRAN_CellInfo_GetIndex (utran_Cell9);
    
    v_SysInfoType11 := cds_SIB11_Def_UG_FDD(5,
                                            p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                            7,
                                            p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                            8,
                                            p_CellList[v_Index_Cell8].frequencyInfo,
                                            p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                            9,
                                            p_CellList[v_Index_Cell9].frequencyInfo,
                                            p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode,
                                            oct2int(p_GERANSysInfo[0].Cell_Identity),
                                            bit2int(p_GERANSysInfo[0].Ncc),
                                            bit2int(p_GERANSysInfo[0].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                            p_GERANSysInfo[0].Arfcn,
                                            oct2int(p_GERANSysInfo[1].Cell_Identity),
                                            bit2int(p_GERANSysInfo[1].Ncc),
                                            bit2int(p_GERANSysInfo[1].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                            p_GERANSysInfo[1].Arfcn,
                                            oct2int(p_GERANSysInfo[2].Cell_Identity),
                                            bit2int(p_GERANSysInfo[2].Ncc),
                                            bit2int(p_GERANSysInfo[2].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                            p_GERANSysInfo[2].Arfcn);
    
    v_CellList[v_Index_Cell5].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cds_SIB11_Def_UG_FDD(7,
                                            p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                            5,
                                            p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                            8,
                                            p_CellList[v_Index_Cell8].frequencyInfo,
                                            p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                            9,
                                            p_CellList[v_Index_Cell9].frequencyInfo,
                                            p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode,
                                            oct2int(p_GERANSysInfo[0].Cell_Identity),
                                            bit2int(p_GERANSysInfo[0].Ncc),
                                            bit2int(p_GERANSysInfo[0].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                            p_GERANSysInfo[0].Arfcn,
                                            oct2int(p_GERANSysInfo[1].Cell_Identity),
                                            bit2int(p_GERANSysInfo[1].Ncc),
                                            bit2int(p_GERANSysInfo[1].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                            p_GERANSysInfo[1].Arfcn,
                                            oct2int(p_GERANSysInfo[2].Cell_Identity),
                                            bit2int(p_GERANSysInfo[2].Ncc),
                                            bit2int(p_GERANSysInfo[2].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                            p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell7].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cds_SIB11_Freq2_UG_FDD(8,
                                              p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                              5,
                                              p_CellList[v_Index_Cell5].frequencyInfo,
                                              p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                              7,
                                              p_CellList[v_Index_Cell7].frequencyInfo,
                                              p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                              9,
                                              p_CellList[v_Index_Cell9].frequencyInfo,
                                              p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode,
                                              oct2int(p_GERANSysInfo[0].Cell_Identity),
                                              bit2int(p_GERANSysInfo[0].Ncc),
                                              bit2int(p_GERANSysInfo[0].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                              p_GERANSysInfo[0].Arfcn,
                                              oct2int(p_GERANSysInfo[1].Cell_Identity),
                                              bit2int(p_GERANSysInfo[1].Ncc),
                                              bit2int(p_GERANSysInfo[1].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                              p_GERANSysInfo[1].Arfcn,
                                              oct2int(p_GERANSysInfo[2].Cell_Identity),
                                              bit2int(p_GERANSysInfo[2].Ncc),
                                              bit2int(p_GERANSysInfo[2].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                              p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell8].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cds_SIB11_Freq2_UG_FDD(9,
                                              p_CellList[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode,
                                              5,
                                              p_CellList[v_Index_Cell5].frequencyInfo,
                                              p_CellList[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                              7,
                                              p_CellList[v_Index_Cell7].frequencyInfo,
                                              p_CellList[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                              8,
                                              p_CellList[v_Index_Cell8].frequencyInfo,
                                              p_CellList[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                              oct2int(p_GERANSysInfo[0].Cell_Identity),
                                              bit2int(p_GERANSysInfo[0].Ncc),
                                              bit2int(p_GERANSysInfo[0].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                              p_GERANSysInfo[0].Arfcn,
                                              oct2int(p_GERANSysInfo[1].Cell_Identity),
                                              bit2int(p_GERANSysInfo[1].Ncc),
                                              bit2int(p_GERANSysInfo[1].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                              p_GERANSysInfo[1].Arfcn,
                                              oct2int(p_GERANSysInfo[2].Cell_Identity),
                                              bit2int(p_GERANSysInfo[2].Ncc),
                                              bit2int(p_GERANSysInfo[2].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                              p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell9].sysInfo.SIB11 := v_SysInfoType11;
    
    return valueof(v_CellList);
  }
  //----------------------------------------------------------------------------
  function fl_InitializeSIB11_UG_TDD(UTRAN_CellInfoList_Type p_CellList, CoOrd_GERANSysInfo_List_Type p_GERANSysInfo) return UTRAN_CellInfoList_Type
  {
    var template (value) SysInfoType11 v_SysInfoType11;
    var template (value) UTRAN_CellInfoList_Type v_CellList := p_CellList;
    var integer v_Index_Cell5 := f_UTRAN_CellInfo_GetIndex (utran_Cell5);
    var integer v_Index_Cell7 := f_UTRAN_CellInfo_GetIndex (utran_Cell7);
    var integer v_Index_Cell8 := f_UTRAN_CellInfo_GetIndex (utran_Cell8);
    var integer v_Index_Cell9 := f_UTRAN_CellInfo_GetIndex (utran_Cell9);
    
    //if ((p_NoOfPLMNs == onePLMN) or (p_NoOfPLMNs == twoPLMNs)) {
    v_SysInfoType11 := cds_SIB11_Def_UG_TDD(5,
                                            p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                            7,
                                            p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                            8,
                                            p_CellList[v_Index_Cell8].frequencyInfo,
                                            p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                            9,
                                            p_CellList[v_Index_Cell9].frequencyInfo,
                                            p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID,
                                            oct2int(p_GERANSysInfo[0].Cell_Identity),
                                            bit2int(p_GERANSysInfo[0].Ncc),
                                            bit2int(p_GERANSysInfo[0].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                            p_GERANSysInfo[0].Arfcn,
                                            oct2int(p_GERANSysInfo[1].Cell_Identity),
                                            bit2int(p_GERANSysInfo[1].Ncc),
                                            bit2int(p_GERANSysInfo[1].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                            p_GERANSysInfo[1].Arfcn,
                                            oct2int(p_GERANSysInfo[2].Cell_Identity),
                                            bit2int(p_GERANSysInfo[2].Ncc),
                                            bit2int(p_GERANSysInfo[2].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                            p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell5].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cds_SIB11_Def_UG_TDD(7,
                                            p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                            5,
                                            p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                            8,
                                            p_CellList[v_Index_Cell8].frequencyInfo,
                                            p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                            9,
                                            p_CellList[v_Index_Cell9].frequencyInfo,
                                            p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID,
                                            oct2int(p_GERANSysInfo[0].Cell_Identity),
                                            bit2int(p_GERANSysInfo[0].Ncc),
                                            bit2int(p_GERANSysInfo[0].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                            p_GERANSysInfo[0].Arfcn,
                                            oct2int(p_GERANSysInfo[1].Cell_Identity),
                                            bit2int(p_GERANSysInfo[1].Ncc),
                                            bit2int(p_GERANSysInfo[1].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                            p_GERANSysInfo[1].Arfcn,
                                            oct2int(p_GERANSysInfo[2].Cell_Identity),
                                            bit2int(p_GERANSysInfo[2].Ncc),
                                            bit2int(p_GERANSysInfo[2].Bcc),
                                            fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                            p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell7].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cds_SIB11_Freq2_UG_TDD(8,
                                              p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                              5,
                                              p_CellList[v_Index_Cell5].frequencyInfo,
                                              p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                              7,
                                              p_CellList[v_Index_Cell7].frequencyInfo,
                                              p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                              9,
                                              p_CellList[v_Index_Cell9].frequencyInfo,
                                              p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID,
                                              oct2int(p_GERANSysInfo[0].Cell_Identity),
                                              bit2int(p_GERANSysInfo[0].Ncc),
                                              bit2int(p_GERANSysInfo[0].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                              p_GERANSysInfo[0].Arfcn,
                                              oct2int(p_GERANSysInfo[1].Cell_Identity),
                                              bit2int(p_GERANSysInfo[1].Ncc),
                                              bit2int(p_GERANSysInfo[1].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                              p_GERANSysInfo[1].Arfcn,
                                              oct2int(p_GERANSysInfo[2].Cell_Identity),
                                              bit2int(p_GERANSysInfo[2].Ncc),
                                              bit2int(p_GERANSysInfo[2].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                              p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell8].sysInfo.SIB11 := v_SysInfoType11;
    
    v_SysInfoType11 := cds_SIB11_Freq2_UG_TDD(9,
                                              p_CellList[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID,
                                              5,
                                              p_CellList[v_Index_Cell5].frequencyInfo,
                                              p_CellList[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                              7,
                                              p_CellList[v_Index_Cell7].frequencyInfo,
                                              p_CellList[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                              8,
                                              p_CellList[v_Index_Cell8].frequencyInfo,
                                              p_CellList[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                              oct2int(p_GERANSysInfo[0].Cell_Identity),
                                              bit2int(p_GERANSysInfo[0].Ncc),
                                              bit2int(p_GERANSysInfo[0].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[0].BandIndicator),
                                              p_GERANSysInfo[0].Arfcn,
                                              oct2int(p_GERANSysInfo[1].Cell_Identity),
                                              bit2int(p_GERANSysInfo[1].Ncc),
                                              bit2int(p_GERANSysInfo[1].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[1].BandIndicator),
                                              p_GERANSysInfo[1].Arfcn,
                                              oct2int(p_GERANSysInfo[2].Cell_Identity),
                                              bit2int(p_GERANSysInfo[2].Ncc),
                                              bit2int(p_GERANSysInfo[2].Bcc),
                                              fl_UTRAN_GetGeranBandIndicator(p_GERANSysInfo[2].BandIndicator),
                                              p_GERANSysInfo[2].Arfcn);
    v_CellList[v_Index_Cell9].sysInfo.SIB11 := v_SysInfoType11;
    return valueof(v_CellList);
  }
  //----------------------------------------------------------------------------
  function f_UTRAN_UpdateSIB19AllCells (UTRAN_CellInfoList_Type p_CellInfoList, IRAT_CoOrd_SysInfo_Type p_EUTRA_CoOrd) return UTRAN_CellInfoList_Type
  {
    // var integer v_Index_Cell5 := f_UTRAN_CellInfo_GetIndex(utran_Cell5);
    // var integer v_Index_Cell8 := f_UTRAN_CellInfo_GetIndex(utran_Cell8);
    // var integer v_Index_Cell9 := f_UTRAN_CellInfo_GetIndex(utran_Cell9);
    var integer I;
    
    for (I := 0; I < tsc_UTRAN_NumberOfCells; I := I + 1)
      {
        p_CellInfoList[I].sysInfo.SIB19 := valueof(cs_SIB19_Def(p_EUTRA_CoOrd.Eutra[0].Arfcn, p_EUTRA_CoOrd.Eutra[1].Arfcn, p_EUTRA_CoOrd.Eutra[2].Arfcn, p_EUTRA_CoOrd.Eutra[3].Arfcn, p_EUTRA_CoOrd.Eutra[4].Arfcn));
      }
    return (p_CellInfoList);
  }
  //----------------------------------------------------------------------------
  function fl_UTRAN_SystemInformation_Init(UTRAN_CellId_Type p_CellId,
                                           integer p_Band,
                                           PLMN_Identity p_PLMNId,
                                           PICH_PowerOffset p_PowerPICH,
                                           AICH_PowerOffset p_PowerAICH,
                                           octetstring p_Lac,
                                           octetstring p_Rac,
                                           octetstring p_NMO,
                                           octetstring p_T3212,
                                           integer p_AttFlag,
                                           bitstring p_URAId,
                                           DRX_CycleLengthStructure p_DRX,
                                           COMMON_TestConfig_Enum p_TestConfig) return UTRAN_CellSysInfo_Type
  {
    //   To assign system information for a cell.
    //   For Band 4 and 9, tcv SIB5 is assigned with SIB5bis and scheduling information list is updated in the MIB.
    var B28_Type v_CellIdentity := f_UTRAN_GetCellIndentity(p_CellId);
    var template (value) UTRAN_CellSysInfo_Type v_CellSysInfo;
    
    v_CellSysInfo.MIB_ValueTagChanged := false;
    v_CellSysInfo.SB1_ValueTagChanged := false;
    
    v_CellSysInfo.MIB  := cs_MIB_Def(p_PLMNId);                         // MIB: default scheduling (will be modified when sending out the SIBs)
    v_CellSysInfo.SB1  := cs_SB1_Def;         // SB1: default scheduling (will be modified when sending out the SIBs)
    
    v_CellSysInfo.SIB1 := cs_SIB1_Def(p_Lac, p_Rac, p_NMO, p_T3212, p_AttFlag, p_DRX.cN_PS_DRX_CycleLength,p_DRX.cN_CS_DRX_CycleLength);                         // SIB1
    v_CellSysInfo.SIB2 := cs_SIB2_Def(p_URAId);                          // SIB2
    if (p_TestConfig == utran_only) {
      v_CellSysInfo.SIB3 := cs_SIB3_DefUTRAN(v_CellIdentity);                  // SIB3
      v_CellSysInfo.SIB4 := cs_SIB4_DefUTRAN(v_CellIdentity);                  // SIB4
    } else {
      v_CellSysInfo.SIB3 := cs_SIB3_DefUTRAN_GERAN(v_CellIdentity);            // SIB3
      v_CellSysInfo.SIB4 := cs_SIB4_DefUTRAN_GERAN(v_CellIdentity);            // SIB4
    }
    
    v_CellSysInfo.SIB5 := fl_InitializeSIB5_SIB5Bis(p_Band, p_PowerPICH, p_PowerAICH);  // SIB5
    v_CellSysInfo.SIB6 := cs_SIB6_Def(p_PowerPICH, p_PowerAICH);                         // SIB6
    v_CellSysInfo.SIB7 := cs_SIB7_Def;                                           // SIB7
    
    v_CellSysInfo.SIB11 := omit;                                                 // SIB11 is initialized later
    v_CellSysInfo.SIB12 := cs_SIB12_Def;                                                 // SIB12
    v_CellSysInfo.SIB16 := cs_SIB16_Def(tsc_DL_DPCH1_SFP_SRB);                           // SIB16
    v_CellSysInfo.SIB18 := cs_SIB18_Def;     // only one default PLMN, so don't need an intialization function
    v_CellSysInfo.SIB19 := cs_SIB19_Def(1, 1, 1, 1, 1); // Dummy data for now, to be replaced later with proper data from co-ord msg
    // SIB5 or SIB5bis
    if ((p_Band == 4) or (p_Band == 9) or (p_Band == 10)) {
      v_CellSysInfo.MIB.sibSb_ReferenceList[5].sibSb_Type := {sysInfoType5bis := 1};
      // TTCN-2: the whole reference list is assigned (c_SchedulingListSIB5bis, c_SchedulingListSIB5bis_LongNeighCellInfo)
      //         that seems not to be necessary
      v_CellSysInfo.SIB5_Type := systemInformationBlockType5bis;
    } else {
      v_CellSysInfo.SIB5_Type := systemInformationBlockType5;
    }
    return valueof(v_CellSysInfo);
  }
  //----------------------------------------------------------------------------.
  function fl_UTRAN_SystemInformation_Init_TDD(UTRAN_CellId_Type p_CellId,
                                               PLMN_Identity p_PLMNId,
                                               PICH_PowerOffset p_PowerPICH,
                                               octetstring p_Lac,
                                               octetstring p_Rac,
                                               octetstring p_NMO,
                                               octetstring p_T3212,
                                               integer p_AttFlag,
                                               bitstring p_URAId,
                                               DRX_CycleLengthStructure p_DRX,
                                               CellParametersID p_CellParametersID,
                                               COMMON_TestConfig_Enum p_TestConfig) return UTRAN_CellSysInfo_Type
  {
    //   To assign system information for a cell
    //   For Band 4 and 9, tcv SIB5 is assigned with SIB5bis and scheduling information list is updated in the MIB
    var B28_Type v_CellIdentity := f_UTRAN_GetCellIndentity(p_CellId);
    var template (value) UTRAN_CellSysInfo_Type v_CellSysInfo;
    
    v_CellSysInfo.MIB_ValueTagChanged := false;
    v_CellSysInfo.SB1_ValueTagChanged := false;
    v_CellSysInfo.MIB  := cs_MIB_Def_TDD(p_PLMNId);
    // MIB: default scheduling (will be modified when sending out the SIBs)
    v_CellSysInfo.SB1  := cs_SB1_Def;
    // SB1: default scheduling (will be modified when sending out the SIBs)
    v_CellSysInfo.SIB1 := cs_SIB1_Def(p_Lac, p_Rac, p_NMO, p_T3212, p_AttFlag, p_DRX.cN_PS_DRX_CycleLength,p_DRX.cN_CS_DRX_CycleLength);    // SIB1
    v_CellSysInfo.SIB2 := cs_SIB2_Def(p_URAId);    // SIB2
    if (p_TestConfig == utran_only)
      {
        v_CellSysInfo.SIB3 := cs_SIB3_DefUTRAN_TDD(v_CellIdentity);// SIB3
        v_CellSysInfo.SIB4 := cs_SIB4_DefUTRAN_TDD(v_CellIdentity);    // SIB4
      } else {
      v_CellSysInfo.SIB3 := cs_SIB3_DefUTRAN_GERAN_TDD(v_CellIdentity);            // SIB3
      v_CellSysInfo.SIB4 := cs_SIB4_DefUTRAN_GERAN_TDD(v_CellIdentity);            // SIB4
    }
    v_CellSysInfo.SIB5 := cs_SIB5_Def_TDD(p_PowerPICH, p_CellParametersID);                  // SIB5
    v_CellSysInfo.SIB6 := cs_SIB6_Def_TDD(p_PowerPICH);                         // SIB6
    v_CellSysInfo.SIB7 := cs_SIB7_Def_TDD;                                           // SIB7
    v_CellSysInfo.SIB11 := omit;                                                // SIB11 is initialized later
    v_CellSysInfo.SIB12 := cs_SIB12_Def;                                                 // SIB12
    v_CellSysInfo.SIB18 := cs_SIB18_Def;     // only one default PLMN, so don't need an intialization function
    v_CellSysInfo.SIB19 := cs_SIB19_Def(1, 1, 1, 1, 1);
    return valueof(v_CellSysInfo);
  }
  
  } // end of sysInfo group
  
  
  group Functions {
  function f_UTRAN_CellInfo_GetIndex(UTRAN_CellId_Type p_CellId) return integer
  {
    select (p_CellId) {
      case (utran_Cell5) {
        return 0;
      }
      case (utran_Cell7) {
        return 1;
      }
      case (utran_Cell8) {
        return 2;
      }
      case (utran_Cell9) {
        return 3;
      }
      case else {
        FatalError(__FILE__, __LINE__, "Invalid CellId");
        return 0;
      }
    }
  }
  
  //----------------------------------------------------------------------------------------------------------
  function f_UTRAN_CellArray_Init () return UTRAN_CellInfoList_Type
  {
    // Initialise all UTRAN cell info
    
    var UTRAN_CellInfoList_Type v_UTRAN_Cells;
    var integer v_Index;
    
    // Have to check the EUTRA freq band to determine if FDD or TDD, as we have to configure the same
    if (px_ePrimaryFrequencyBand < 33)   {            // Bands below 33 are reserved for FDD
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell5);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_FDD(utran_Cell5);
      
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell7);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_FDD(utran_Cell7);
      
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell8);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_FDD(utran_Cell8);
      
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell9);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_FDD(utran_Cell9);
      
      v_UTRAN_Cells := fl_InitializeSIB11(v_UTRAN_Cells); // Have to pass the whole array to intialize SIB11 as it uses info from all other cells
    } else {                                 // Bands above 33 are reserved for TDD
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell5);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_TDD(utran_Cell5);
      
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell7);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_TDD(utran_Cell7);
      
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell8);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_TDD(utran_Cell8);
      
      v_Index := f_UTRAN_CellInfo_GetIndex (utran_Cell9);
      v_UTRAN_Cells[v_Index] := f_UTRAN_CellInfo_Init_TDD(utran_Cell9);
      
      v_UTRAN_Cells := fl_InitializeSIB11_TDD(v_UTRAN_Cells); // Have to pass the whole array to intialize SIB11 as it uses info from all other cells
    }
    return (v_UTRAN_Cells);
  };
  
  //----------------------------------------------------------------------------
  function f_UTRAN_GetCellIndentity(UTRAN_CellId_Type p_CellId) return B28_Type
  {
    select (p_CellId) {
      case (utran_Cell5) {
        return tsc_CellIdCell5;
      }
      case (utran_Cell7) {
        return tsc_CellIdCell7;
      }
      case (utran_Cell8) {
        return tsc_CellIdCell8;
      }
      case (utran_Cell9) {
        return tsc_CellIdCell9;
      }
      case else {
        FatalError(__FILE__, __LINE__, "invalid cellId");
        return int2bit(0, 28);
      }
    }
  }

  //----------------------------------------------------------------------------
  function f_UTRAN_IR_SysInfoInit (UTRAN_CellInfoList_Type p_CellInfo)
    return template (value) IRAT_CoOrd_SysInfo_Type
  {
    var template (value) CoOrd_UTRANSysInfo_Type v_Cell5;
    var template (value) CoOrd_UTRANSysInfo_Type v_Cell7;
    var template (value) CoOrd_UTRANSysInfo_Type v_Cell8;
    var template (value) CoOrd_UTRANSysInfo_Type v_Cell9;
    var B1_Type v_Diversity := '0'B;
    var B1_Type v_Tstd := '0'B;
    var integer v_Index_Cell5 := f_UTRAN_CellInfo_GetIndex(utran_Cell5);
    var integer v_Index_Cell7 := f_UTRAN_CellInfo_GetIndex(utran_Cell7);
    var integer v_Index_Cell8 := f_UTRAN_CellInfo_GetIndex(utran_Cell8);
    var integer v_Index_Cell9 := f_UTRAN_CellInfo_GetIndex(utran_Cell9);
    
    // if the first cell is FDD, then they all are
    if (p_CellInfo[v_Index_Cell5].fdd_tdd == UTRAN_FDD)
      {
        v_Cell5 := {FDD := cs_CoOrdUTRANSysInfo_FDD (p_CellInfo[v_Index_Cell5].frequencyInfo.modeSpecificInfo.fdd.uarfcn_DL,
                                                      p_CellInfo[v_Index_Cell5].cellInfo_Specific_FDD.priScrmCode,
                                                      f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell5].plmnId),
                                                      f_UTRAN_GetCellIndentity(utran_Cell5))};
        v_Cell7 := {FDD := cs_CoOrdUTRANSysInfo_FDD (p_CellInfo[v_Index_Cell7].frequencyInfo.modeSpecificInfo.fdd.uarfcn_DL,
                                                     p_CellInfo[v_Index_Cell7].cellInfo_Specific_FDD.priScrmCode,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell7].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell7))};
        v_Cell8 := {FDD := cs_CoOrdUTRANSysInfo_FDD (p_CellInfo[v_Index_Cell8].frequencyInfo.modeSpecificInfo.fdd.uarfcn_DL,
                                                     p_CellInfo[v_Index_Cell8].cellInfo_Specific_FDD.priScrmCode,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell8].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell8))};
        v_Cell9 := {FDD := cs_CoOrdUTRANSysInfo_FDD (p_CellInfo[v_Index_Cell9].frequencyInfo.modeSpecificInfo.fdd.uarfcn_DL,
                                                     p_CellInfo[v_Index_Cell9].cellInfo_Specific_FDD.priScrmCode,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell9].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell9))};
      }
    else // TDD
      {
        if (p_CellInfo[v_Index_Cell5].cellInfo_Specific_TDD.transmissionDiversityApplied == applied)
          {
            v_Diversity := '1'B;
          }
        if (p_CellInfo[v_Index_Cell5].cellInfo_Specific_TDD.dwPCHInfo.tstd_Indicator == applied)
          {
            v_Tstd := '1'B;
          }
        v_Cell5 := {TDD := cs_CoOrdUTRANSysInfo_TDD (p_CellInfo[v_Index_Cell5].frequencyInfo.modeSpecificInfo.tdd.uarfcn_Nt,
                                                     p_CellInfo[v_Index_Cell5].cellInfo_Specific_TDD.cellParametersID,
                                                     v_Diversity,
                                                     v_Tstd,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell5].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell5))};
        if (p_CellInfo[v_Index_Cell7].cellInfo_Specific_TDD.transmissionDiversityApplied == applied)
          {
            v_Diversity := '1'B;
          }
        if (p_CellInfo[v_Index_Cell7].cellInfo_Specific_TDD.dwPCHInfo.tstd_Indicator == applied)
          {
            v_Tstd := '1'B;
          }
        v_Cell7 := {TDD := cs_CoOrdUTRANSysInfo_TDD (p_CellInfo[v_Index_Cell7].frequencyInfo.modeSpecificInfo.tdd.uarfcn_Nt,
                                                     p_CellInfo[v_Index_Cell7].cellInfo_Specific_TDD.cellParametersID,
                                                     v_Diversity,
                                                     v_Tstd,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell7].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell7))};
        if (p_CellInfo[v_Index_Cell8].cellInfo_Specific_TDD.transmissionDiversityApplied == applied)
          {
            v_Diversity := '1'B;
          }
        if (p_CellInfo[v_Index_Cell8].cellInfo_Specific_TDD.dwPCHInfo.tstd_Indicator == applied)
          {
            v_Tstd := '1'B;
          }
        v_Cell8 := {TDD := cs_CoOrdUTRANSysInfo_TDD (p_CellInfo[v_Index_Cell8].frequencyInfo.modeSpecificInfo.tdd.uarfcn_Nt,
                                                     p_CellInfo[v_Index_Cell8].cellInfo_Specific_TDD.cellParametersID,
                                                     v_Diversity,
                                                     v_Tstd,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell8].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell8))};
        if (p_CellInfo[v_Index_Cell9].cellInfo_Specific_TDD.transmissionDiversityApplied == applied)
          {
            v_Diversity := '1'B;
          }
        if (p_CellInfo[v_Index_Cell9].cellInfo_Specific_TDD.dwPCHInfo.tstd_Indicator == applied)
          {
            v_Tstd := '1'B;
          }
        v_Cell9 := {TDD := cs_CoOrdUTRANSysInfo_TDD (p_CellInfo[v_Index_Cell9].frequencyInfo.modeSpecificInfo.tdd.uarfcn_Nt,
                                                     p_CellInfo[v_Index_Cell9].cellInfo_Specific_TDD.cellParametersID,
                                                     v_Diversity,
                                                     v_Tstd,
                                                     f_U_Asn2Nas_PlmnId(p_CellInfo[v_Index_Cell9].plmnId),
                                                     f_UTRAN_GetCellIndentity(utran_Cell9))};
      }
    
    return cs_CoOrdUTRAN_SysInfo(v_Cell5, v_Cell7, v_Cell8, v_Cell9);
  }
  //----------------------------------------------------------------------------
  function f_UTRAN_IR_SIB19_Init (UTRAN_CellInfoList_Type p_CellInfoList, IRAT_CoOrd_SysInfo_Type p_EUTRAInfo)
    return UTRAN_CellInfoList_Type
  {
    var integer I;
    
    for (I := 0; I < tsc_UTRAN_NumberOfCells; I := I + 1)
      {
        p_CellInfoList[I].sysInfo.SIB19 := valueof(cs_SIB19_Def(p_EUTRAInfo.Eutra[0].Arfcn,
                                                                p_EUTRAInfo.Eutra[1].Arfcn,
                                                                p_EUTRAInfo.Eutra[2].Arfcn,
                                                                p_EUTRAInfo.Eutra[3].Arfcn,
                                                                p_EUTRAInfo.Eutra[4].Arfcn));
      }
    return (p_CellInfoList);
  }
  //----------------------------------------------------------------------------
  function f_UTRAN_IR_SIB11And19_Init (UTRAN_CellInfoList_Type p_CellInfoList, IRAT_CoOrd_SysInfo_List_Type p_SysInfoList)
    return UTRAN_CellInfoList_Type
  {
    var IRAT_CoOrd_SysInfo_Type v_EUTRA_SysInfo;
    var IRAT_CoOrd_SysInfo_Type v_GERAN_SysInfo;
    var integer v_NoOfPTCs := sizeof( p_SysInfoList);
    
    select (v_NoOfPTCs) {
      case (1) {
        v_EUTRA_SysInfo := p_SysInfoList[0];
      }
      case (2) {
        if(ischosen(p_SysInfoList[0].Eutra)) {
          v_EUTRA_SysInfo := p_SysInfoList[0];
          v_GERAN_SysInfo := p_SysInfoList[1];
        } else {
          v_GERAN_SysInfo := p_SysInfoList[0];
          v_EUTRA_SysInfo := p_SysInfoList[1];
        }
        p_CellInfoList := fl_InitializeSIB11_ForGERAN (p_CellInfoList, v_GERAN_SysInfo.Geran);
      }
      case else {
        FatalError (__FILE__, __LINE__, "wrong PTC configuration specified in test case");
      }
    }
    p_CellInfoList:= f_UTRAN_IR_SIB19_Init (p_CellInfoList, v_EUTRA_SysInfo);
    
    return (p_CellInfoList);
  }
  //----------------------------------------------------------------------------
  function f_UTRAN_CellInfo_Init_FDD(UTRAN_CellId_Type p_CellId) return UTRAN_CellInfo_Type
  {
    // Initialise Cell Info for one cell
    
    var UTRAN_CellInfo_Type v_CellInfo; // Hellen>> changed this from template (value) to avoid doing valueof on a not completely initialized template
    
    var PrimaryScramblingCode v_PriScrmCode;
    var bitstring             v_URA_IdCell;
    var template (value) FrequencyInfo         v_FreqInfo;
    var UL_ScramblingCode     v_UL_ScramblingCode;
    
    var template (value) FrequencyInfo v_FreqInfoLow  := cs_FreqInfo_FDD(px_UARFCN_D_Low);
    var template (value) FrequencyInfo v_FreqInfoMid  := cs_FreqInfo_FDD(px_UARFCN_D_Mid);
    var template (value) FrequencyInfo v_FreqInfoHigh := cs_FreqInfo_FDD(px_UARFCN_D_High);
    
    if (px_FDD_OperationBand == 6) {
      // For Band 6, the frequency difference  between tcv_FreqInfoLow, Mid and High is very short. Then tcv_FreqInfoMid  is assigned to the px_UARFCN_D_Low value.
      v_FreqInfoMid := cs_FreqInfo_FDD(px_UARFCN_D_Low);
    }
    
    select (p_CellId) {
      case (utran_Cell5) {
        v_PriScrmCode       := 100;
        v_URA_IdCell        := tsc_URA_IdCell5;
        v_FreqInfo          := v_FreqInfoMid;//According to 36.508 cl. 4.4.2 Table 4.4.2-1
        v_UL_ScramblingCode := 0;
      }
      case (utran_Cell7) {
        v_PriScrmCode       := (100 + 50) mod 512;
        v_URA_IdCell        := tsc_URA_IdCell7;
        v_FreqInfo          := v_FreqInfoMid;//According to 36.508 cl. 4.4.2 Table 4.4.2-1
        v_UL_ScramblingCode := 1000 mod 16777216;
      }
      case (utran_Cell8) {
        v_PriScrmCode       := (100 + 100) mod 512;
        v_URA_IdCell        := tsc_URA_IdCell8;
        v_FreqInfo          := v_FreqInfoHigh;//According to 36.508 cl. 4.4.2 Table 4.4.2-1
        v_UL_ScramblingCode := 2000 mod 16777216;
      }
      case (utran_Cell9) {
        v_PriScrmCode       := (100 + 150) mod 512;
        v_URA_IdCell        := tsc_URA_IdCell9;
        v_FreqInfo          := v_FreqInfoLow;//According to 36.508 cl. 4.4.2 Table 4.4.2-1
        v_UL_ScramblingCode := 3000 mod 16777216;
      }
      case else {
        FatalError(__FILE__, __LINE__, "Invalid CellId");
      }
    }
    // initialisation of v_CellInfo
    v_CellInfo.cellId          := p_CellId;
    v_CellInfo.fdd_tdd          := UTRAN_FDD;
    v_CellInfo.frequencyInfo   := valueof(v_FreqInfo);
    v_CellInfo.attenuationLevel := tsc_AttenuationCellOFF;
    v_CellInfo.cellInfo_Specific_TDD := omit;
    v_CellInfo.cellInfo_Specific_FDD.priScrmCode     := v_PriScrmCode;
    v_CellInfo.cellInfo_Specific_FDD.powerpCPICH     := tsc_PowerpCPICH;
    v_CellInfo.cellInfo_Specific_FDD.powerpSCH       := tsc_PowerpSCH;
    v_CellInfo.cellInfo_Specific_FDD.powersSCH       := tsc_PowersSCH;
    v_CellInfo.cellInfo_Specific_FDD.powerpCCPCH     := tsc_PowerpCCPCH_FDD;
    v_CellInfo.powersCCPCH     := tsc_PowersCCPCH1;
    v_CellInfo.powersCCPCH1    := tsc_PowersCCPCH1;
    v_CellInfo.cellInfo_Specific_FDD.timingsCCPCH1   := tsc_TimingsCCPCH1;
    v_CellInfo.cellInfo_Specific_FDD.powerAICH       := tsc_PowerAICH;
    v_CellInfo.powerPICH       := tsc_PowerPICH;
    v_CellInfo.cellTxPowerLevel := { defaultCellTxPowerLvl := NULL };
    v_CellInfo.sfnOffset       := tsc_SFN_Offset;
    v_CellInfo.puncLimit       := tsc_PuncLimit;
    v_CellInfo.sf_PRACH        := tsc_PRACH1_SF;
    v_CellInfo.cellInfo_Specific_FDD.slotFormatsCCPCH1 := tsc_SlotFormatsCCPCH1;
    v_CellInfo.plmnId          := valueof(cs_UTRAN_HPLMN_Def);
    v_CellInfo.lac             := tsc_LAC_Def;
    v_CellInfo.rac             := tsc_RAC_Def;
    v_CellInfo.attFlag         := tsc_AttOn;
    v_CellInfo.nmo             := tsc_NMO_I;
    v_CellInfo.ura_Identity    := v_URA_IdCell;
    v_CellInfo.t3212           := tsc_T3212_Def;
    v_CellInfo.cRNTI           := tsc_CRNTI;
    v_CellInfo.uRNTI           := valueof(cs_U_RNTI_Def);
    v_CellInfo.cellConfig      := cell_NotConfigured;
    // v_CellInfo.dRX_CycleLength := valueof(c_DRX_CycleLengthStrucDef);
    v_CellInfo.dRX_CycleLength.cN_CS_DRX_CycleLength := 7;  // TTCN-2: c_DRX_CycleLengthStrucDef
    v_CellInfo.dRX_CycleLength.cN_PS_DRX_CycleLength := 7;  // TTCN-2: c_DRX_CycleLengthStrucDef
    v_CellInfo.dRX_CycleLength.uTRAN_DRX_CycleLength := 9;  // TTCN-2: c_DRX_CycleLengthStrucDef
    v_CellInfo.cellInfo_Specific_FDD.uL_ScramblingCode := v_UL_ScramblingCode;
    v_CellInfo.rlcParams.timerPoll := tp400;
    v_CellInfo.rlcParams.timerPollProhibit := tpp200;
    v_CellInfo.rlcParams.pollSDU := sdu1;
    v_CellInfo.rlcParams.pollWindow := pw99;
    v_CellInfo.cellInfo_Specific_FDD.operationBand   := fl_UTRAN_FrequencyBandFDD(px_FDD_OperationBand);
    v_CellInfo.nodeB_Id        := 1;
    //   v_CellInfo.cellInfo_Specific_FDD.isServingCell   := true;
    v_CellInfo.cellInfo_Specific_FDD.band            := px_FDD_OperationBand;
    
    if (px_FDD_OperationBand == 6) {
      // ts_InitJapanMCC_Band6: For each Band 6 cell, set the MCC to the Japan MCC value.
      v_CellInfo.plmnId.mcc := f_ConvertMCC_Nas2Asn(px_eJapanMCC_Band6);
    }

    v_CellInfo.sysInfo := fl_UTRAN_SystemInformation_Init (v_CellInfo.cellId,
                                                           v_CellInfo.cellInfo_Specific_FDD.band,
                                                           v_CellInfo.plmnId,
                                                           v_CellInfo.powerPICH,
                                                           v_CellInfo.cellInfo_Specific_FDD.powerAICH,
                                                           v_CellInfo.lac,
                                                           v_CellInfo.rac,
                                                           v_CellInfo.nmo,
                                                           v_CellInfo.t3212,
                                                           v_CellInfo.attFlag,
                                                           v_CellInfo.ura_Identity,
                                                           v_CellInfo.dRX_CycleLength,
                                                           utran_only);
    return (v_CellInfo);
  }
  //----------------------------------------------------------------------------
  function f_UTRAN_CellInfo_Init_TDD(UTRAN_CellId_Type p_CellId) return UTRAN_CellInfo_Type
  {
    // Initialise Cell Info for one cell
    
    var UTRAN_CellInfo_Type v_CellInfo;  // Hellen>> changed this from template (value) to avoid doing valueof on a not completely initialized template
    
    var CellParametersID v_CellParametersID;
    var bitstring             v_URA_IdCell;
    var template (value) FrequencyInfo         v_FreqInfo;
    
    var template (value) FrequencyInfo v_FreqInfoLow  := cs_FreqInfo_TDD(px_UARFCN_Low);
    var template (value) FrequencyInfo v_FreqInfoMid  := cs_FreqInfo_TDD(px_UARFCN_Mid);
    var template (value) FrequencyInfo v_FreqInfoHigh := cs_FreqInfo_TDD(px_UARFCN_High);
    
    
    select (p_CellId) {
      case (utran_Cell5) {
        v_CellParametersID  := tsc_CellParametersID_Cell5;
        v_URA_IdCell        := tsc_URA_IdCell5;
        v_FreqInfo          := v_FreqInfoMid;
      }
      case (utran_Cell7) {
        v_CellParametersID  := tsc_CellParametersID_Cell7;
        v_URA_IdCell        := tsc_URA_IdCell7;
        v_FreqInfo          := v_FreqInfoMid;
      }
      case (utran_Cell8) {
        v_CellParametersID  := tsc_CellParametersID_Cell8;
        v_URA_IdCell        := tsc_URA_IdCell8;
          v_FreqInfo          := v_FreqInfoHigh;
      }
      case (utran_Cell9) {
          v_CellParametersID  := tsc_CellParametersID_Cell9;
        v_URA_IdCell        := tsc_URA_IdCell9;
          v_FreqInfo          := v_FreqInfoLow;
      }
      case else {
        FatalError(__FILE__, __LINE__, "Invalid CellId");
      }
    }
    // initialisation of v_CellInfo
    v_CellInfo.cellId          := p_CellId;
    v_CellInfo.fdd_tdd          := UTRAN_TDD;
    v_CellInfo.frequencyInfo   := valueof(v_FreqInfoMid);
    v_CellInfo.cellInfo_Specific_TDD.upPCHposition   := 22;
    v_CellInfo.attenuationLevel := tsc_AttenuationCellOFF;
    v_CellInfo.cellInfo_Specific_FDD := omit;
    v_CellInfo.cellInfo_Specific_TDD.attenuationLevel_S1 := tsc_AttenuationCellOFF;
    v_CellInfo.cellInfo_Specific_TDD.attenuationLevel_S2 := tsc_AttenuationCellOFF;
    v_CellInfo.cellInfo_Specific_TDD.cellParametersID     := v_CellParametersID;
    v_CellInfo.cellInfo_Specific_TDD.powerpCCPCH     := tsc_PowerpCCPCH_TDD;
    v_CellInfo.powersCCPCH     := tsc_PowersCCPCH1;
    v_CellInfo.powersCCPCH1    := tsc_PowersCCPCH1;
    v_CellInfo.powerPICH       := tsc_PowerPICH;
    v_CellInfo.cellInfo_Specific_TDD.powerFPACH       := tsc_PowerFPACH;
    v_CellInfo.cellTxPowerLevel := { defaultCellTxPowerLvl := NULL };
    v_CellInfo.sfnOffset       := tsc_SFN_Offset;
    v_CellInfo.puncLimit       := tsc_PuncLimit;
    v_CellInfo.plmnId          := valueof(cs_UTRAN_HPLMN_Def);
    v_CellInfo.lac             := tsc_LAC_Def;
    v_CellInfo.rac             := tsc_RAC_Def;
    v_CellInfo.attFlag         := tsc_AttOn;
    v_CellInfo.nmo             := tsc_NMO_I;
    v_CellInfo.ura_Identity    := v_URA_IdCell;
    v_CellInfo.t3212           := tsc_T3212_Def;
    v_CellInfo.cRNTI           := tsc_CRNTI;
    v_CellInfo.uRNTI           := valueof(cs_U_RNTI_Def);
    v_CellInfo.cellConfig      := cell_NotConfigured;
    // v_CellInfo.dRX_CycleLength := c_DRX_CycleLengthStrucDef;
    v_CellInfo.dRX_CycleLength.cN_CS_DRX_CycleLength := 7;  // TTCN-2: c_DRX_CycleLengthStrucDef
    v_CellInfo.dRX_CycleLength.cN_PS_DRX_CycleLength := 7;  // TTCN-2: c_DRX_CycleLengthStrucDef
    v_CellInfo.dRX_CycleLength.uTRAN_DRX_CycleLength := 9;  // TTCN-2: c_DRX_CycleLengthStrucDef
    
    v_CellInfo.cellInfo_Specific_TDD.timeSlotConfigurationList_LCR := valueof(cs_Default_TimeSlot_Config_List);
    v_CellInfo.cellInfo_Specific_TDD.transmissionDiversityApplied   := notApplied;
    v_CellInfo.cellInfo_Specific_TDD.dwPCHInfo       := {   tstd_Indicator  := notApplied,   dwPCH_Power  :=  tsc_DwPCH_power};
    v_CellInfo.nodeB_Id        := 1;
      
    v_CellInfo.sysInfo := fl_UTRAN_SystemInformation_Init_TDD (v_CellInfo.cellId,
                                                               v_CellInfo.plmnId,
                                                               v_CellInfo.powerPICH,
                                                               v_CellInfo.lac,
                                                               v_CellInfo.rac,
                                                               v_CellInfo.nmo,
                                                               v_CellInfo.t3212,
                                                               v_CellInfo.attFlag,
                                                               v_CellInfo.ura_Identity,
                                                               v_CellInfo.dRX_CycleLength,
                                                               v_CellInfo.cellInfo_Specific_TDD.cellParametersID,
                                                               utran_only);
    return (v_CellInfo);
  }
  
  //------------------------------------------------------------------------------------------
  function fl_UTRAN_FrequencyBandFDD(integer p_OperationBand) return FrequencyBandFDD {
    var template (value) FrequencyBandFDD v_FrequencyBandFDD;
    
    if ((p_OperationBand == 1) and pc_Band1_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_1;
    } else if ((p_OperationBand == 2) and pc_Band2_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_2;
    } else if ((p_OperationBand == 3) and pc_Band3_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_3;
    } else if ((p_OperationBand == 4) and pc_Band4_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_4;
    } else if ((p_OperationBand == 5) and pc_Band5_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_5;
    } else if ((p_OperationBand == 6) and pc_Band6_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_6;
    } else if ((p_OperationBand == 7) and pc_Band7_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_7;
    } else if ((p_OperationBand == 8) and pc_Band8_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_8;
    } else if ((p_OperationBand == 9) and pc_Band9_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_9;
    } else if ((p_OperationBand == 10) and pc_Band10_Supp) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_10;
    } else if ((p_OperationBand == 11) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_11;
    } else if ((p_OperationBand == 12) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_12;
    } else if ((p_OperationBand == 13) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_13;
    } else if ((p_OperationBand == 14) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_14;
    } else if ((p_OperationBand == 15) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_15;
    } else if ((p_OperationBand == 16) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_16;
    } else if ((p_OperationBand == 17) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_17;
    } else if ((p_OperationBand == 18) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_18;
    } else if ((p_OperationBand == 19) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_19;
    } else if ((p_OperationBand == 20) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_20;
    } else if ((p_OperationBand == 21) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_21;
    } else if ((p_OperationBand == 22) and false) {
      v_FrequencyBandFDD := cs_RadioFrequencyBandFDD_22;
    } else {
      FatalError(__FILE__, __LINE__, "unknown operation band");
    }
    return valueof(v_FrequencyBandFDD);
  }
  //------------------------------------------------------------------------------------------
  function f_ConvertMCC_Nas2Asn(hexstring p_MCC) return MCC
  {     // This is a copy of the EUTRAN function, but this version will use the UTRAN ASN
        // This is in here because I don't know where else to put it
    
    /* @desc    Converts between NAS internal representation of MCC to the MCC ASN.1 type
     * @param   p_MCC MCC as plain string of 3 decimal digits
     * @return  MCC as ASN.1 type (defined as array of 3 integers) */
    return { hex2int(p_MCC[2]), hex2int(p_MCC[1]), hex2int(p_MCC[0]) };
  }
  //----------------------------------------------------------------------------
  function f_UTRAN_SecurityInfo_Init() return  UTRAN_SecurityInfo_Type
  {
    var template (value) UTRAN_SecurityInfo_Type v_SecurityInfo;
    
    v_SecurityInfo.cs_cipheringStarted := false;
    v_SecurityInfo.ps_cipheringStarted := false;
    v_SecurityInfo.recentSecureDomain := ps_domain;  // the domain on which security was recently started, and hence the SRB are ciphered and Integrit protected with this domain.
    v_SecurityInfo.dL_CipherMode   := cs_CipheringModeCmdOn ( uea2 );
    v_SecurityInfo.uL_CipherMode   := omit;
    v_SecurityInfo.cipheringAlgorithmCapability := '0000000000000111'B;
    v_SecurityInfo.integrityStarted := false;
    v_SecurityInfo.dL_Integrity    := cs_IntegrityProtectStart( px_FRESH, uia2 );
    v_SecurityInfo.uL_Integrity    := omit;
    v_SecurityInfo.dl_IntegrityCheckInfo := omit;
    v_SecurityInfo.integrProtAlgCap := '0000000000000010'B;
    v_SecurityInfo.start_CS        := '00000000000000000000'B;      // Default new key
    v_SecurityInfo.start_PS        := '00000000000000000000'B;      // Default new key
    //  v_SecurityInfo.cipheringOnOff  := px_CipheringOnOff;             TO DO - DO WE NEED THIS???
    v_SecurityInfo.authKeys.AuthPS := cs_CommonAuthParams_Init(px_eAuthRAND);
    v_SecurityInfo.authKeys.HFN := int2bit (0, 20);
    v_SecurityInfo.authKeys.AuthCS.CKey := tsc_AuthUndefinedB128;
    v_SecurityInfo.authKeys.AuthCS.IKey := tsc_AuthUndefinedB128;
    v_SecurityInfo.authKeys.AuthCS.CKeySeq := '111'B;
    
    return (valueof(v_SecurityInfo));
  }
  
  }// end group Functions

} // end module

