####################################
## SCFD file version: 0.10         ##
## PDDB version: TL16_1507_001    ##
####################################

#General checking for rule file execution
check_version minor TL16A
check_param minor LNBTS actSatBackhaul

###########
# COMMON: #
###########

################################################################################################
#LTE1068 S1/X2 satellite connection (CRL0916)
################################################################################################

add_param minor LNBTS actSatBackhaul false

################################################################################################
#LTE2114  N FSIP/FBIP, FSMr4
################################################################################################
#no impact

################################################################################################
#LTE2184  Flexible Sync Input Priority	- 
################################################################################################
#v0.5, Several changes to LTE2184 migration, PR079020, PR077422, PR077951

#v0.4
#1. addition of new parameters based on migration requirements

#1.1 Add and initialize temporary parameters need
# (from e-mail) If syncMaster is false or ownedByThisBts is false the coreModuleSyncInputList is not needed and may not exist.
add_param minor SMOD tempMigrationEnabled true
dependence_mod_param_conditional_expression_relative minor PARAM MRBTS/SMOD tempMigrationEnabled = PARAM MRBTS-${MRBTS}/SMOD-${SMOD} syncMaster == CONST "false" || PARAM MRBTS-${MRBTS}/SMOD-${SMOD} ownedByThisBts == CONST "false" ? CONST "false" :

#1.2 coreModuleSyncInputList
#1.2.1 Add coreModuleSyncInputList with all items
add_list minor SMOD coreModuleSyncInputList
add_list_item minor SMOD coreModuleSyncInputList
add_list_item minor SMOD coreModuleSyncInputList
add_list_item minor SMOD coreModuleSyncInputList
add_list_param minor SMOD coreModuleSyncInputList * syncInputType new
add_list_param minor SMOD coreModuleSyncInputList * syncInputPrio 0

#1.2.2 Modify syncInputType based on old parameters
# Set type, item 0
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 0 syncInputType = PARAM MRBTS-${MRBTS}/SMOD-${SMOD} tempMigrationEnabled == CONST "true" && PARAM MRBTS-${MRBTS}/BTSSCL-1 gpsCtrlBlockForCoLocatedBts == CONST "true" ? CONST "1pps/ToD from Sync Hub Master" :
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 0 syncInputType = PARAM MRBTS-${MRBTS}/SMOD-${SMOD} tempMigrationEnabled == CONST "true" && PARAM MRBTS-${MRBTS}/BTSSCL-1 gpsInUse == CONST "true" ? CONST "1pps/ToD from external GNSS receiver" :
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 0 syncInputType = PARAM MRBTS-${MRBTS}/SMOD-${SMOD} tempMigrationEnabled == CONST "true" && PARAM MRBTS-${MRBTS}/BTSSCL-1 intGpsInUse == CONST "true" ? CONST "internal GNSS receiver" :
# Set type, item 1
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 1 syncInputType = PARAM MRBTS-${MRBTS}/SMOD-${SMOD} tempMigrationEnabled == CONST "true" && PARAM MRBTS-${MRBTS}/BTSSCL-1 ext2M048ClkInUse == CONST "true" ? CONST "2.048MHz input" :
# Set type, item 2
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 2 syncInputType = PARAM MRBTS-${MRBTS}/SMOD-${SMOD} tempMigrationEnabled == CONST "true" && PARAM MRBTS-${MRBTS}/BTSSCL-1 tdmSyncInUse == CONST "true" ? CONST "transport reference source" :

#1.2.3 Delete items type not set 
# was it so that this doesn't work because list is messed when items deleted? Seems to be working by tests.
dependence_del_target_relative minor LISTITEM MRBTS/SMOD coreModuleSyncInputList * ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "new"
#if so, we have to do like this... ?
#dependence_del_target_relative minor LISTITEM MRBTS/SMOD coreModuleSyncInputList 2 ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "new"
#dependence_del_target_relative minor LISTITEM MRBTS/SMOD coreModuleSyncInputList 1 ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "new"
#dependence_del_target_relative minor LISTITEM MRBTS/SMOD coreModuleSyncInputList 0 ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "new"

#1.2.4 Set priorities 
# this was not okay with BTSSM (priorities shall start from 1)...
#v0.7
#dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList * syncInputPrio = LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "1pps/ToD from Sync Hub Master" && LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "1pps/ToD from external GNSS receiver" ? CONST 1 :
#dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList * syncInputPrio = LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "internal GNSS receiver" ? CONST 2 :
#dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList * syncInputPrio = LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "2.048MHz input" ? CONST 3 :
#dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList * syncInputPrio = LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList ${coreModuleSyncInputList} syncInputType == CONST "transport reference source" ? CONST 4 :
#v0.7 end
# ...thus, we have to it this way... (also, priority range is 1...3)
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 0 syncInputPrio = CONST 1
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 1 syncInputPrio = CONST 2
dependence_mod_param_conditional_expression_relative minor LISTPARAM MRBTS/SMOD coreModuleSyncInputList 2 syncInputPrio = CONST 3

#1.3 GNSSI / GNSSE related
#1.3.1 Add MOCs
# This adds MOs with instance 1
add_cls minor SMOD/GNSSE
add_cls minor SMOD/GNSSI
set_operation minor GNSSI create
set_operation minor GNSSE create

#v0.6 wrong parameter names corrected
#1.3.2.1 actGnssOutputLnaPowerSupply
copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSE-1 actExtGpsOutputLnaPowerSupply actGnssOutputLnaPowerSupply
copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSI-1 actIntGpsOutputLnaPowerSupply actGpsOutputLnaPowerSupply
#v0.7, PR077422
#copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSI-1 actIntGpsOutputLnaPowerSupply actGnssOutputLnaPowerSupply
#v0.7 end
#v0.6 end

#1.3.2.2 gnssReceiverHoldoverMode
copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSE-1 extGpsReceiverHoldoverMode gnssReceiverHoldoverMode
dependence_mod_param_conditional_expression_relative minor PARAM MRBTS/SMOD/GNSSE gnssReceiverHoldoverMode = PARAM MRBTS-${MRBTS}/BTSSCL-1 btsSyncMode != CONST "PhaseSync" ? CONST "false" :

#1.3.2.3 gnssCableLength and gnssLineDelay
copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSE-1 gpsCableLength gnssCableLength
copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSE-1 gpsTotalAntennaLineDelay gnssLineDelay
#dependence_del_target_relative minor PARAM MRBTS/SMOD/GNSSE gnssCableLength ? PARAM MRBTS-${MRBTS}/BTSSCL-1 btsSyncMode == CONST "PhaseSync"
copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-*/GNSSI-1 gpsTotalAntennaLineDelay gnssLineDelay

#1.3.2.3 gnssAntennaLongitudeConf, gnssAntennaAltitudeConf, gnssAntennaLatitudeConf, locationMode
# MRBTS parameters are deleted in xL15A. No migration possible.
#copy_param minor MRBTS GNSSI longitudeConf gnssAntennaLongitudeConf
#copy_param minor MRBTS GNSSI altitudeConf gnssAntennaAltitudeConf
#copy_param minor MRBTS GNSSI latitudeConf gnssAntennaLatitudeConf
#copy_param minor MRBTS GNSSI locationMode locationMode
add_param minor GNSSI locationMode navigated

#v0.9 PR086208: [FL16] GNSSE and GNSSI objects created after FL15A to FL16 upgrad
#1.3.3 Remove GNSSE or/and GNSSI when no related sync input configured
#1.3.3.1 Remove GNSSE if "1pps/ToD from external GNSS receiver  is NOT configured on coreModuleSyncInputList
dependence_del_target_relative minor MOC MRBTS/SMOD/GNSSE ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList 0 syncInputType != CONST "1pps/ToD from external GNSS receiver"
#1.3.3.2 Remove GNSSI if "1pps/ToD from internal GNSS receiver  is NOT configured on coreModuleSyncInputList
dependence_del_target_relative minor MOC MRBTS/SMOD/GNSSI ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList 0 syncInputType != CONST "internal GNSS receiver"
#v0.9 end
#1.4 totalDelayFromSHM

# v0.10 correction for NA05874383: NPI TL16 pilot: Parameter error:"totalDelayFromSHM" is empty after upgrade from RL55 to TL16 
#dependence_add_param (severity, className, keyParamName, keyParValue , slaveParamName, slaveParValue)
dependence_add_param minor BTSSCL gpsCableLength 30m gpsTotalAntennaLineDelay 147
dependence_add_param minor BTSSCL gpsCableLength 100m gpsTotalAntennaLineDelay 490
dependence_add_param minor BTSSCL gpsCableLength 300m gpsTotalAntennaLineDelay 1470
# v0.10 correction for NA05874383: NPI TL16 pilot: Parameter error:"totalDelayFromSHM" is empty after upgrade from RL55 to TL16 END

copy_param_relative minor MRBTS/BTSSCL MRBTS-${MRBTS}/SMOD-* gpsTotalAntennaLineDelay totalDelayFromSHM
#v0.8 PR094033: LTE2184 Cable delay for external GPS is shown also in Total delay from SHM, change corresponding to PDDB FL16_1509_009
dependence_del_target_relative minor PARAM MRBTS/SMOD totalDelayFromSHM ? LISTPARAM MRBTS-${MRBTS}/SMOD-${SMOD} coreModuleSyncInputList 0 syncInputType != CONST "1pps/ToD from Sync Hub Master"
#v0.8 end

#1.5 gnssControlMode
add_param minor GNSSE gnssControlMode All-in-view
add_param minor GNSSI gnssControlMode All-in-view

#1.6 Delete temporary parameters
del_param minor SMOD tempMigrationEnabled

#v0.4 end
# These parameters were added back in PDDB 1507_003
# These parameters were again removed in PDDB 1508_001

del_param minor BTSSCL actExtGpsOutputLnaPowerSupply
del_param minor BTSSCL actIntGpsOutputLnaPowerSupply
del_param minor BTSSCL extGpsReceiverHoldoverMode
del_param minor BTSSCL gpsCableLength
del_param minor BTSSCL gpsCtrlBlockForCoLocatedBts
del_param minor BTSSCL gpsInUse
del_param minor BTSSCL gpsTotalAntennaLineDelay
del_param minor BTSSCL intGpsInUse
del_param minor BTSSCL tdmSyncInUse
#v0.4
del_param minor BTSSCL ext2M048ClkInUse
#v0.4 end
#v0.5 end

#If BTSSCL.btsSyncMode  is set to 'PhaseSync',  SMOD totalDelayFromSHM shall be configured. NO DEFAULT, no migration.

################################################################################################
#LTE1469
################################################################################################

del_param minor LNCEL a2TimeToTriggerActHrpdMeas
del_param minor LNCEL hysThreshold2Hrpd

#v0.4 additions of below parameters is moved above before deleting BTSSL parameters
################################################################################################
#LTE2438 GNSS - Operation Mode and tracking - addition
################################################################################################

#add_param minor GNSSE actGnssOutputLnaPowerSupply true
#add_param minor GNSSE gnssReceiverHoldoverMode false

#add_param minor GNSSI actGpsOutputLnaPowerSupply false
#add_param minor GNSSI locationMode navigated
#v0.4 end

###########
# TDD:    #
###########


#version
set_version major TL16

#history:
add_log minor "Conversion from TL16 FB15.06 to TL16 FB15.07"