# The file includes KPI formulas for MOs within Equipment ECIM branch with prefixes Req & Res as well as formulas related to Licensing
# The general syntax for the formulas is a follows:
#  Env_UnitObjectModification_Unit or Cat_UnitObjectModification_Unit
#  where:
#    Env_ - for all Power & Temperature related counters
#    Cat_ - for all other counters related to SFPs, RiPorts & RiLinks
#    Utl_ - for all Resource utilization counters
#    Unit - Voltage, Power, Energy, Current, Temperature, ReturnLoss, VSWR, etc
#    Object - Battery, FRU, Delay, Tx/Rx Power, etc
#    Modification - Avg, Max, Min, etc
#    Unit - Volt, Amp, mAmp, Ah, Watt, Wh, kWh, C, fps, Kbps, Mbps, Mbps, min, s, h, ns, ms, dB, dBm, RL (Return Loss), VSWR, PRB (Phy. Res. Blocks) Pct, etc a:b (Ratio), # (No of occurrences), s-1 (occurrences per second)

#The following KPI groups are used:
# Accessibility      Acc_    ERAB Setup Success Rate, RACH and Paging, etc.
# Availability       Av_     eg. system downtime (RBS Restart time measurements)
# Integrity          Int_    DL and UL throughput, packet loss, latency, packet delay, etc.
# Mobility           Mob_    eg. handover success rate
# Retainability      Ret_    eg. session drop rate
# Transport Network  Tn_
# Equipment          Cat_, Env_
# Utilization        Utl_    hw utilization, background CPU load, interface utilization, memory usage and Radio Utilization

# v 2.00 10/12/2024 T. Malkiewicz New revision to include KPIs for counters for Req.. & Res... MOM fragments for Baseband & CC6610
# v 2.01 16/03/2025 T. Malkiewicz Update to 25 release: New KPIs for NEW MOs BasicPeakEnergyControl, EnergyStorage, PowerConfiguredPeakShaving, TimeConfiguredPeakLoadShifting  
                                                        Additional KPIs for Battery, BatteryBackup, PowerProfile & SolarConverter with PM Counters pmChargingEnergy, pmBatteryCurrent, pmDischargingEnergy, pmBatteryPower, pmBatteryVoltage, pmSolarConvertersUtilization, pmInputCurrentDeci
                                                        Min/Max counters moved from FORMULA_CC.txt
#--------------------------------------------------------------------------------------------------------------------------------


#########################################################
#  Power, Current, Voltage, Temperature, Batteries etc  #
#########################################################
#################
#EnergyMeter
# Sum of energy consumption of all consumer units having an EnergyMeter during a ROP. [Wh] 
Env_EnergyConsumed_Wh      = pmConsumedEnergy

# Sum of accumulated energy consumption from start for all consumer units with an EnergyMeter. [kWh]
Env_EnergyConsumedAccumulated_kWh = pmConsumedEnergyAccumulated / 1000

# Average power consumption. [W]
Env_PowerConsumptionAvg_W  = Average(pmPowerConsumption)     / NR_ROP

# Maximum power consumption during a ROP. [W]
Env_PowerConsumptionMax_W    = Max(pmPowerConsumption)       / NR_ROP

# Minimum power consumption during a ROP. [W]
Env_PowerConsumptionMin_W    = Min(pmPowerConsumption)       / NR_ROP

# Standard Deviation of power consumption. [W]
Env_PowerConsumptionStdDev_W  = StdDev(pmPowerConsumption)   / NR_ROP

# Maximum power consumption during a ROP for EnergyMeter. [W]
Env_PowerConsumptionEMMax_W    = pmMaxPowerConsumption / NR_ROP

# Minimum power consumption during a ROP for EnergyMeter. [W]
Env_PowerConsumptionEMMin_W    = pmMinPowerConsumption / NR_ROP

# Average voltage during a ROP on EnergyMeter. [V]
Env_VoltageAvg_V  = Average(pmVoltage)              / NR_ROP

# Maximum voltage during a ROP on EnergyMeter [V]
Env_VoltageMax_V = Max(pmVoltage)                  / NR_ROP

# Minimum voltage during a ROP on EnergyMeter [V]
Env_VoltageMin_V = Min(pmVoltage)                  / NR_ROP

# Average current on first power feed in 6 second periods. [A]
Env_CurrentFeed1Avg_A = 0.01 * Average(pmCurrent1) / NR_ROP

# Average current on second power feed in 6 second periods. [A]
Env_CurrentFeed2Avg_A = 0.01 * Average(pmCurrent2) / NR_ROP

# Average voltage on first power feed in 6 second periods. [V]
Env_VoltageFeed1Avg_V = 0.01 * Average(pmVoltage1) / NR_ROP

# Average voltage on second power feed in 6 second periods. [V]
Env_VoltageFeed2Avg_V = 0.01 * Average(pmVoltage2) / NR_ROP

#####################
#FieldReplaceableUnit
# Sum of all power failures during 15 minute ROP [#]
Env_PowerFailuresSum = pmPowerFailure

#Average Temperature where:\n  0 - Temperature too low, Service unavailable\n  1 - Temperature very low\n  2 - Temperature low\n  3 - Temperature OK, slightly low\n  4 - Temperature OK\n  5 - Temperature OK, slightly high\n  6 - Temperature high\n  7 - Temperature very high\n  8 - Temperature too high, Service unavailable\n  9 - Temperature too high, Service unavailable
Env_TemperatureAvg = Average(pmUnitTemperatureLevel) / NR_ROP

# Average temperature level, where the coldest temperature from temperature sensor or sensors in unit is aggregated. \n Level 25 = 0 degrees Celsius or higher. \n Level 0 = close to or below the equipment cold shutdown threshold.
Env_TemperatureExtremeColdAvg = Average(pmUnitTemperatureLevelExtremeCold) / NR_ROP

# Number of minutes FRU spent in Deep Sleep state. [min]
Env_TimeFRUDeepSleep_min = pmFruDeepSleepTime / 60

#################
#SupportUnit
# Average fan tray unit fan speed [% of max speed]
Env_SpeedFan_pct = Average(pmFanSpeed) / NR_ROP

#################
#BatteryBackup
# Total capacity delivered by battery backup system. [Ah]
Env_CapacityBatteryTotalDelivered_Ah = pmBatteryCapacityTotalDelivered

# Average battery Depth of Discharge (DoD). [V]
Env_DischargeDepthBatteryAvg_V = WeightedAverage(pmBatteryDepthOfDischargeDistr, [39.6,41.35,42.55,43.75,44.95,46.15,47.35])

# Average battery discharge duration. [min]
Env_DischargeTimeBatteryAvg_min = WeightedAverage(pmBatteryDischargeTimeDistr, [1.5,4.5,19.5,44.5,89.5,179.5,359.5,719])

# Average battery discharge duration when main load is disconnected. [min]
Env_DischargeTimeBatteryMainLoadDiscAvg_min = WeightedAverage(pmBatteryMainLoadUnderVoltDiscTimeDistr, [1.5,4.5,19.5,44.5,89.5,179.5,359.5,719])

# Average battery operating temperature. [C]
Env_TemperatureBatteryBackupAvg_C = WeightedAverage(pmBatteryTemperatureDistr, [-7.5,-3,2,7,12,17,22,27,32,37,42,47,52,57,62,67,80])

### KPIs only on 6610 Controller
# Average Battery current When batteries are charging, current is positive. When batteries are discharging, current is negative. [A]
Env_CurrentBatteryAvg_A = ( Average(pmBatteryCurrent) - NR_ROP * 1000 ) / NR_ROP

# Maximum Battery current When batteries are charging, current is positive. When batteries are discharging, current is negative. [A]
Env_CurrentBatteryMax_A = ( Max(pmBatteryCurrent) - NR_ROP * 1000 ) / NR_ROP

# Minimum Battery current When batteries are charging, current is positive. When batteries are discharging, current is negative. [A]
Env_CurrentBatteryMin_A = ( Min(pmBatteryCurrent) - NR_ROP * 1000 ) / NR_ROP

# Amount of time that 'Battery Discharge Current High' alarm is raised since battery installation. Marked as suspect when attribute installationDate of MO Battery is changed. [min]
Env_TimeBatteryDischargeCurrentHigh_min = pmDischargeCurrentHighTime

# Average Battery state of charge. For lead-acid batteries, value is estimated. For lithium-ion batteries, value is average from state of charge of all batteries. [%]
Env_StateOfChargeAvg_pct = Average(pmStateOfCharge) / NR_ROP 

# Total accumulated battery discharging power over time. Measured every 6 seconds. Counter is not reset after measurement period [kWh]
Env_EnergyDischargedBattery_Total = pmDischargingEnergy

# Battery power in watts.\n Negative value means battery is discharging. Positive value means battery is charging. [W]
Env_PowerChargedBatteryAvg_W = ( Average(pmBatteryPower) - NR_ROP * 100000 ) / NR_ROP 

# Total accumulated battery charging power over time. Measured every 6 seconds. Counter is not reset after measurement period [kWh]
Env_EnergyChargedBattery_Total = pmChargingEnergy

# Total battery current. \nWhen batteries are charging, current is positive. When batteries are discharging, current is negative.\nNot applicable for RBS 6000 systems. [A]
Env_CurrentChargedBatteryAvg_A = ( Average(pmBatteryCurrent)  - NR_ROP * 1000 ) / NR_ROP


#################
#Battery
# Distribution of operating temperatures for each battery. [C]
Env_TemperatureBatteryAvg_C = WeightedAverage(pmBatteryTemp, [-7.5,-3,2,7,12,17,22,27,32,37,42,47,52,57,62,67,80])

# Uptime of the battery in days calculated a pmBatteryTemp counter which is not reset at every ROP. pmBatteryTemp / (60 min * 24h)
Env_UptimeBattery_Days       = Sum(pmBatteryTemp) / 1440

# Average battery cell temperature with +1000 offset. To convert, following formula is used: value reported - 1000 [C]
Env_TemperatureBatteryCellAvg_C = ( Average(pmBatteryTemperature) - NR_ROP * 1000) / NR_ROP

# Connected battery voltage. For lead-acid batteries, value is read from power controller. For lithium-ion batteries, value is average cell pack voltage from all connected batteries. [V]
Env_VoltageBatteryAvg_V = ( Average(pmBatteryVoltage) / 10 ) / NR_ROP

# The number of discharge cycles the battery has performed during its lifetime. (KPI is not reset after measurement period) [cycles]
Env_DischargeCyclesCount = pmFullDischargeCycles

# Average Battery state of health. [%]
Env_StateOfHealthAvg_pct = Average(pmStateOfHealth) 


#################
#PowerMeter
# Average Current measurement.[A]
Env_CurrentAvg_A = Average(pmCurrent) / NR_ROP 

# Maximum Current measurement.[A]
Env_CurrentMax_A = Max(pmCurrent) / NR_ROP 

# Minimum Current measurement.[A]
Env_CurrentMin_A = Min(pmCurrent) / NR_ROP 

# Accumulated power over time. [Wh]
Env_PowerConsumptionTotal_Wh = pmEnergy

# Maximum power during each ROP. [W]
Env_PowerMax_W = pmMaxPower / NR_ROP

# Minimum power during each ROP. [W]
Env_PowerMin_W = pmMinPower / NR_ROP

# Average Output current of DcDcConverter/Rectifier/SolarConverter. [A]
Env_CurrentOutputAvg_A = Average(pmOutputCurrent) / NR_ROP

# Maximum Output current of DcDcConverter/Rectifier/SolarConverter. [A]
Env_CurrentOutputMax_A = Max(pmOutputCurrent) / NR_ROP

# Minimum Output current of DcDcConverter/Rectifier/SolarConverter. [A]
Env_CurrentOutputMin_A = Min(pmOutputCurrent) / NR_ROP

# Average Input current to DcDcConverter/SolarConverter. [A]
Env_CurrentInputAvg_A = Average(pmInputCurrent) / NR_ROP 

# Maximum Input current to DcDcConverter/SolarConverter. [A]
Env_CurrentInputMax_A = Max(pmInputCurrent) / NR_ROP 

# Minimum Input current to DcDcConverter/SolarConverter. [A]
Env_CurrentInputMin_A = Min(pmInputCurrent) / NR_ROP 

# Average Input voltage of DcDcConverter/Rectifier/SolarConverter. [V]
Env_VoltageInputAvg_V = ( Average(pmInputVoltage) / 10 ) / NR_ROP

# Maximum Input voltage of DcDcConverter/Rectifier/SolarConverter. [V]
Env_VoltageInputMax_V = ( Max(pmInputVoltage) / 10 ) / NR_ROP

# Minimum Input voltage of DcDcConverter/Rectifier/SolarConverter. [V]
Env_VoltageInputMin_V = ( Min(pmInputVoltage) / 10 ) / NR_ROP

# Average Power measurement. [W]
Env_PowerAvg_W = Average(pmPower) / NR_ROP

# Maximum Power measurement. [W]
Env_PowerMax_W = Max(pmPower) / NR_ROP

# Minimum Power measurement. [W]
Env_PowerMin_W = Min(pmPower) / NR_ROP


#################
#DcDcConverter
# Number of minutes when Output overcurrent state is active. [min]
Env_MinutesOutputOverCurrentActive = pmDcDcConverterState[0]

# Number of minutes when Output overvoltage state is active. [min]
Env_MinutesOutputOverVoltageActive = pmDcDcConverterState[1]

# Number of minutes when Output undervoltage state is active. [min]
Env_MinutesOutputUnderVoltageActive = pmDcDcConverterState[2]

# Number of minutes when Input undervoltage state is active. [min]
Env_MinutesInputUnderVoltageActive = pmDcDcConverterState[3]

# Number of minutes when Input overvoltage state is active. [min]
Env_MinutesInputOverVoltageActive = pmDcDcConverterState[4]

# Number of minutes when Temperature too high state is active. [min]
Env_MinutesTemperatureTooHighActive = pmDcDcConverterState[5]

# Average Output voltage of DcDcConverter/Rectifier/SolarConverter [V]
Env_VoltageOutputAvg_V = ( Average(pmOutputVoltage) / 10 ) / NR_ROP

# Maximum Output voltage of DcDcConverter/Rectifier/SolarConverter [V]
Env_VoltageOutputMax_V = ( Max(pmOutputVoltage) / 10 ) / NR_ROP

# Minimum Output voltage of DcDcConverter/Rectifier/SolarConverter [V]
Env_VoltageOutputMin_V = ( Min(pmOutputVoltage) / 10 ) / NR_ROP

#################
#SolarConverter
# Energy supplied from solar converter to load. [kWh]
Env_EnergySuppliedToLoad_kWh = pmOutputEnergy /100

# Number of minutes solar converter overvoltage is detected. (KPI is not reset after measurement period) [min]
Env_OverVoltageOnSolarConverterCount_min = Sum(pmOutputOverVoltageTime)

# Power supplied from  solar converter to load. [W]
Env_PowerSuppliedToLoad_W = Average(pmOutputPower) / NR_ROP

# Total number of minutes solar converter is shut off (KPI is not reset after measurement period) [min]
Env_MinutesSolarConverterOff = Sum(pmProtectionShutOffTime)

# Average Input current to solar converter measured in 6s periods. [A]
Env_CurrentToSolarConverterAvg_A = Average(pmInputCurrentDeci) / 10 / NR_ROP

# Maximum Input current to solar converter measured in 6s periods. [A]
Env_CurrentToSolarConverterMax_A = Max(pmInputCurrentDeci) / 10 / NR_ROP


#################
#PeakEnergyControl
#### NOTE: The counters used in these formulas are discontinued since rel 25.

# Total discharge energy supplied from battery to load since installation. [kWh]
Env_EnergyDischargedSuppliedToLoad_kWh = pmPecBatteryDischargedEnergyAccumulated / 1000

# Battery discharge power supplied from the battery to the load. [W]
Env_PowerDischargedToLoad_W = Average(pmPecBatteryDischargePower) / NR_ROP

# Total charge energy supplied to battery in one ROP during with feature Peak Load Shifting. [Wh]
Env_EnergySuppliedToBatteryAtPLS_Wh = pmPlsBatteryChargedEnergy

# Total charging energy supplied to battery during Peak Load Shifting. (KPI is not reset after measurement period) [Wh]
Env_EnergySuppliedToBatteryAtPLSTotal_Wh = pmPlsBatteryChargeEnergyAccumulated

# Average Battery charge power supplied to battery when feature Peak Load Shifting is active. [W]
Env_PowerSuppliedToBatteryAtPLSAvg_W = Average(pmPlsBatteryChargePower) / NR_ROP

# Total discharge energy supplied from battery to load in one ROP during with feature Peak Load Shifting. [Wh]
Env_EnergyDischargedSuppliedToLoadAtPLS_Wh = pmPlsBatteryDischargedEnergy

# Total discharge energy supplied from battery to load during Peak Load Shifting. (KPI is not reset after measurement period) [Wh]
Env_EnergyDischargedSuppliedToLoadAtPLSTotal_Wh = pmPlsBatteryDischargedEnergyAccumulated

# Time during each ROP when battery discharge during configured windows stops. Cause can be fault or too low battery State Of Charge. [min]
Env_TimeBatteryDischargeStoppedAtPLS_min = pmPlsBatteryDischargeDisabled

# Battery discharge power supplied from battery to load when feature Peak Load Shifting is active. [W]
Env_PowerDischargedToLoadAtPLS_W = Average(pmPlsBatteryDischargePower) / NR_ROP

# Number of incomplete discharges, that is, stopped before configured time passes. [#]
Env_CountIncompleteDischargesPls = pmPlsIncompleteDischarges[0]

# Number of successful discharges, that is, lasting through entire configured time. [#]
Env_CountSuccessfulDischargesPls = pmPlsIncompleteDischarges[1]

# StateOfCharge reached with last battery discharge during configured time window. [%]
Env_StateOfChargeReachedRatio_pct = pmPlsSOCAtDischargeEnd

# Voltage reached with last battery discharge during configured time window. [V]
Env_VoltageReachedAtLastBatteryDischargePLS_V = pmPlsVoltageAtDischargeEnd / 10


#################
#BasicPeakEnergyControl
# Average Power supplied from energy storage to load during basic peak energy control. [W]
Env_PECPowerSuppliedToLoadAvg_W = Average(pmBasicPecDischargePower) / NR_ROP

# Total energy supplied from energy storage to load since installation during basic peak energy control. Measured from creation of MO. If ROP is incomplete, discharge energy is still accumulated. [kWh]
Env_PECEnergySuppliedToLoadTotal_kWh = pmBasicPecDischargeEnergyAccumulated


#################
#EnergyStorage
# Total energy supplied to energy storage. Energy is accumulated for battery charges. [kWh]
Env_EnergySuppliedToEnergyStorageTotal_kWh = pmEnergyStorageEnergyAccumulated

# Average Energy storage charge power. Measured every 6 seconds. [W]
Env_PowerChargedEnergyStorageAvg_W = Average(pmEnergyStoragePower) / NR_ROP

# Total energy supplied to energy storage in one ROP. Energy is accumulated during whole ROP. [Wh]
Env_EnergySuppliedToEnergyStorage_Wh = pmEnergyStorageChargeEnergy


#################
#PowerConfiguredPeakShaving
# Power supplied from energy storage to load during power configured peak shaving. Measured every 6 seconds. [W]
Env_PCPSPowerSuppliedToLoad_W = Average(pmPcpsDischargePower) / NR_ROP 

# Total energy supplied from energy storage to load during power configured peak shaving. Energy is accumulated for feature related discharges. [kWh]
Env_PCPSEnergySuppliedToLoadTotal_kWh = pmPcpsDischargeEnergyAccumulated

# Total energy supplied from energy storage to load in one ROP. Energy is accumulated during whole ROP. [Wh]
Env_PCPSEnergySuppliedToLoad_kWh = pmPcpsDischargeEnergy


#################
#TimeConfiguredPeakLoadShifting
# Power supplied from energy storage to load during time configured peak load shifting. Measured every 6 seconds. [W]
Env_TCPLSPowerSuppliedToLoad_W = Average(pmTcplsDischargePower) / NR_ROP 

# Total energy supplied from energy storage to load in one ROP. Energy is accumulated during whole ROP. [Wh]
Env_TCPLSEnergySuppliedToLoad_kWh = pmTcplsDischargeEnergy

# Total energy supplied from energy storage to load during time configured peak load shifting. Energy is accumulated for feature related discharges. [kWh]
Env_TCPLSEnergySuppliedToLoadTotal_kWh = pmTcplsDischargeEnergyAccumulated


#################
#PowerProfile
# Percentage of time power system running on ECO mode. If 0, system not running in ECO mode. If 100, system running in ECO mode all time. [%]
Env_PowerSystemInEcoMode_pct = 100 * Sum(pmPowerSystemEcoModeStatus) / ( 15 * NR_ROP )

# Average Output load of all rectifiers. [%]
Env_UtilizationAllRectifiersAvg_pct = Average(pmRectifiersUtilization) / NR_ROP

# Average Sum of all DC sources current not including battery discharge current (e.g. from power grid and later converted by rectifiers, from solar converter etc.). [A]
Env_CurrentFromAllDCSourcesAvg_A = Average(pmSystemCurrent) / NR_ROP

# Sum of all contribution of DC power sources excluding battery. [W]
Env_PowerConsumptionAllDCSourcesAvg_W = Average(pmSystemPowerConsumption) / NR_ROP

# Total energy supplied to load since installation. (KPI is not reset after measurement period) [kWh]
Env_EnergySuppliedToLoadTotal_kWh = pmTotalEnergyConsumption / 1000

# Average Combined output power load of installed solar converters measured in 6s periods. [%]
Env_OutputPowerLoadAvg_pct = Average(pmSolarConvertersUtilization)

# Maximum Combined output power load of installed solar converters measured in 6s periods. [%]
Env_OutputPowerLoadMax_pct = Max(pmSolarConvertersUtilization)


#################
#Rectifier
# Rectifier, Solar Converter runtime. Uptime of the Rectifier or Solar Converter in days calculated a pmTotalRunningHours counter which is not reset at every ROP. pmTotalRunningHours / (24h) [Days]
Env_Uptime_Days = pmTotalRunningHours / 24

# Average Output load of rectifier, Solar Converter. [%]
Env_LoadOutputAvg_pct = Average(pmUtilization) / NR_ROP

# Maximum Output load of rectifier, Solar Converter. [%]
Env_LoadOutputMax_pct = Max(pmUtilization) / NR_ROP

# Minimum Output load of rectifier, Solar Converter. [%]
Env_LoadOutputMin_pct = Min(pmUtilization) / NR_ROP

# Average Temperature of rectifier/Solar Converter [C]
Env_TemperatureRectAvg_C = Average(pmTemperature) / NR_ROP

# Maximum Temperature of rectifier/Solar Converter [C]
Env_TemperatureRectMax_C = Max(pmTemperature) / NR_ROP

# Minimum Temperature of rectifier/Solar Converter [C]
Env_TemperatureRectMin_C = Min(pmTemperature) / NR_ROP


#################
#Sensor
# Sensor value. Reported dependent on its type. \nFor sensorType = AMBIENT_TEMPERATURE, BATTERY_TEMPERATURE, and TEMPERATURE with +1000 offset, formula is used to convert to Celsius. [C]
Env_TemperatureSensor_C = (pmSensorValue - 1000) / NR_ROP


##################################
#For older RBS 62xx 61xx cabinets#
##################################
#################
#Climate
# Average internal Cabinet fan speed. [% of max speed]
Env_SpeedFanInternal_pct = Average(pmCabinetFanSpeed) / NR_ROP

# Average external Cabinet fan speed. [% of max speed]
Env_SpeedFanExternal_pct = Average(pmCabinetFanSpeedExternal) / NR_ROP

# Average cabinet temperature. [C]
Env_TemperatureCabinet_C = ( Average(pmCabinetTemperature) - NR_ROP * 1000 ) / NR_ROP

# Average differential air pressure. [kPa]
Env_AirPressureBarometricCabinet_kPa = pmSpmBarometricAirPressure / NR_ROP

# Average differential air pressure. [Pa]
Env_AirPressureDifferentialCabinet_Pa = pmSpmDifferentialAirPressure / NR_ROP

#################
#EnergyMeasurement
# Accumulated energy consumption from start of EnergyMeasurement. [kWh]
Env_EnergyConsumptionAccumulated_kWh = pmAccumulatedEnergyConsumption

# Energy consumed during each ROP. [kWh]
Env_EnergyConsumption_kWh = pmEnergyConsumption

#################
#ConsumedEnergyMeasurement
# Average power consumption in 6 second periods averaged from one sample for each second. [W]
Env_PowerConsumptionAvg_W = Average(pmPowerConsumption) / NR_ROP

#################
#PowerDistribution
# Average values of DC system voltage measured in 60 second periods. As DC system voltage is reported with negative values, this counter uses absolute values. [V]
Env_VoltageSystemAvg_V = ( Average(pmSystemVoltage) / 10 ) / NR_ROP

# Maximum values of DC system voltage measured in 60 second periods. As DC system voltage is reported with negative values, this counter uses absolute values. [V]
Env_VoltageSystemMax_V = ( Max(pmSystemVoltage) / 10 ) / NR_ROP

# Minimum values of DC system voltage measured in 60 second periods. As DC system voltage is reported with negative values, this counter uses absolute values. [V]
Env_VoltageSystemMin_V = ( Min(pmSystemVoltage) / 10 ) / NR_ROP

#################
#PowerSupply
# Average AC power supply interruptions due to loss of mains. [min]
Env_InterruptionsPsuAcInputVoltageAvg_min = WeightedAverage(pmPsuAcInputVoltageInterruption, [0.167,0.667,2,6.5,20,45,90,210,450,900])

# Average of power loads measured for every PSU in 60 second periods. [%]
Env_PowerLoadPsuAvg_pct = Average(pmPsuPowerLoad) / NR_ROP

#################
#BatteryUnit
# Averaged voltage differences between highest and lowest cell voltage for a battery unit. [V]
Env_VoltageBatteryCellDelta_V = WeightedAverage(pmBatteryCellVoltageDelta, [0,0.075,0.15,0.25,0.35,0.45,0.55,0.65,0.75,0.85,0.95,1.05])

# Averaged maximum cell voltage for battery unit. [V]
Env_VoltageBatteryCellMax_V = WeightedAverage(pmBatteryCellVoltageMax,[2.65,2.75,2.85,2.95,3.05,3.15,3.25,3.35,3.45,3.55,3.65,3.75,3.85,3.95,4.05,4.15,4.25,4.35])

# Averaged minimum cell voltage for battery unit. [V]
Env_VoltageBatteryCellMin_V = WeightedAverage(pmBatteryCellVoltageMin,[2.65,2.75,2.85,2.95,3.05,3.15,3.25,3.35,3.45,3.55,3.65,3.75,3.85,3.95,4.05,4.15,4.25,4.35])

# Average operating temperatures for each battery unit [C]
Env_TemperatureBatteryUnitAvg_C = WeightedAverage(pmBatteryUnitTemp,[-7.5,-2.5,2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5])

# Uptime of the battery in days calculated a pmBatteryUnitTemp counter which is not reset at every ROP. pmBatteryUnitTemp / (60 min * 24h)
Env_UptimeBatteryUnit_Days   = Sum(pmBatteryUnitTemp) / 1440

# Number of times when battery unit disconnects due to over current at charging. [#]
Env_DisconnectAtOverChargeBatteryCount = pmDisconnectsAtCharge

# Number of times when an overtemp alarm is raised within a battery since installation. [#]
Env_OverTempAlarmBatteryCount = pmOverTempAlarms

# Number of times when an undertemp alarm is raised within a battery since installation. [#]
Env_UnderTempAlarmBatteryCount = pmUnderTempAlarms



###################################
#  SFP, RiLinks, CPRIs & RiPorts  #
###################################
#################
#RfPort, FreqBandData
# Average Return Loss. [RL]
Cat_ReturnLossAvg = pmReturnLossAvg / NR_ROP

# Average Return Loss in VSWR units. [VSWR]
Cat_VSWRAvg = (1 + Pwr(10, -pmReturnLossAvg/(20*NR_ROP)) ) / (1 - Pwr(10, -pmReturnLossAvg/(20*NR_ROP)) ) 

# Average Return Loss in VSWR units. [VSWR]
Cat_VSWRMax = (1 + Pwr(10, -pmReturnLossMin/(20*NR_ROP)) ) / (1 - Pwr(10, -pmReturnLossMin/(20*NR_ROP)) ) 

#Percentage of time transmission power is off for single band RfPort instance. Average relative time transmission power off for multi-band RfPort instance. [%]
Cat_RatioTxPowerOff_pct  = Average(pmTxOffRatio)  / NR_ROP

# Time transmission power is off for single band RfPort or FreqBandData instance. Average time transmission power off for multi-band RfPort instance. [s]
Cat_TimePowerTxOff_s = pmTxOffTime / 1000 

#################
#RiLink
# Maximum delay of highest delays in the link between the two ports. Only valid for CPRI link. [ns]
Cat_DelayLinkMax_ns = pmLinkDelayHigh / NR_ROP

# Minimum delay of lowest delays in the link between the two ports. Only valid for CPRI link. [ns]
Cat_DelayLinkMin_ns = pmLinkDelayLow / NR_ROP

# Delta between highest & lowest delays in the link between the two ports. Only valid for CPRI link. [ns]
Cat_DelayLinkDelta_ns = ( Cat_DelayLinkMax_ns - Cat_DelayLinkMin_ns ) / NR_ROP

# Maximum delay of highest delays in the Cable between the two ports. [ns]
Cat_DelayCableMax_ns = pmCableDelayHigh / NR_ROP

# Minimum delay of lowest delays in the Cable between the two ports. [ns]
Cat_DelayCableMin_ns = pmCableDelayLow / NR_ROP

# Delta between highest & lowest delays in the Cable between the two ports. [ns]
Cat_DelayCableDelta_ns = ( Cat_DelayCableMax_ns - Cat_DelayCableMin_ns ) / NR_ROP

# The total number of L1 reset requests on the link. Only valid for C1 (CPRI) link.
Cat_CountLinkRestart =  pmLinkRestart

# The total number of link stability related errors on the link. Only valid for C1 (CPRI) link. [#]
Cat_CountLinkStabilityError = pmLinkStabilityError

#################
#RiPort
# Average bit error rate 10^-9 [nanobits]
Cat_BitErrorRate_nanobits = 1000000000 * WeightedAverage(pmBitError, [0.00000001, 0.0000001, 0.000001, 0.00001, 0.0001, 0.001])

# The total number of Loss of Frame (LOF) errors detected on the port. Only valid for C1 (CPRI) link. [#]
Cat_CountLossOfFrame = pmLossOfFrame

# The total number of Loss of Signal (LOS) errors detected on the port. Only valid for C1 (CPRI) link. [#]
Cat_CountLossOfSignal = pmLossOfSignal

#################
#SfpChannel
# Measured RX input power for the SFP Channel [dBm]
Cat_PowerRx_dBm = ( pmChannelRxPower - NR_ROP * 3000 ) / 100 / NR_ROP

# Measured TX input power for the SFP Channel [dBm]
Cat_PowerTx_dBm = ( pmChannelTxPower - NR_ROP * 3000 ) / 100  / NR_ROP

# Measured TX bias current for the SFP Channel [mA]
Cat_BiasTx_mA =  pmChannelTxBias / 100  / NR_ROP

#################
#SfpModule
# Measured temperature for SFP value [C]
Cat_TemperatureSfp_C = ( pmSfpTemperature - NR_ROP * 1000) / 10 / NR_ROP 

# Measured voltage for the SFP. [V]
Cat_VoltageSfp_V = pmSfpVoltage / 10000 / NR_ROP

#################
#Transceiver
# Percentage of time transmission power is off in lowest supported band displayed in dlFrequencyRanges. [%]
Cat_RatioTxPowerOff1_pct = Average(pmTxOffRatio1) / NR_ROP

# Percentage of time transmission power is off in highest or next ascending supported band displayed in dlFrequencyRanges. [%]
Cat_RatioTxPowerOff2_pct = Average(pmTxOffRatio2) / NR_ROP

#Percentage of time transmission power is off in highest or next ascending supported band displayed in dlFrequencyRanges. [%]
Cat_RatioTxPowerOff3_pct = Average(pmTxOffRatio3) / NR_ROP

#Percentage of time transmission power is off in highest or next ascending supported band displayed in dlFrequencyRanges. [%]
Cat_RatioTxPowerOff4_pct = Average(pmTxOffRatio4) / NR_ROP

# Time transmission power is off in lowest supported band displayed in dlFrequencyRanges. [s]
Cat_TimePowerTxOff1_pct = pmTxOffTime1 / 1000

# Time transmission power is off in highest or next ascending supported band displayed in dlFrequencyRanges. [s]
Cat_TimePowerTxOff2_pct = pmTxOffTime2 / 1000

# Time transmission power is off in highest or next ascending supported band displayed in dlFrequencyRanges. [s]
Cat_TimePowerTxOff3_pct = pmTxOffTime3 / 1000

# Time transmission power is off in highest or next ascending supported band displayed in dlFrequencyRanges. [s]
Cat_TimePowerTxOff4_pct = pmTxOffTime4 / 1000


###################################
#  Load, Licensing & Utilization  #
###################################
#################
#MpProcessingResource
# Connection Intensity Control for new RRC Connection Establishment, RRC Connection Resume and Handover accesses. [%]
Utl_ConnectionSigIntensityControlForConnEstabRrcConnResReqHOAccess_pct = WeightedAverage(pmAdjustAccessMpLoadCtrlDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,100])

# Signaling Intensity Ratio: Handover request compared to connection intensity control limit in the Baseband. [%]
Utl_HOReqToConnectionSigIntensity_pct = WeightedAverage(pmDuIntensHoReqDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,105,130,175])

# Signaling Intensity Ratio: Sum of handovers, and RRC Connection request compared to the connection intensity control limit in the Baseband [%]
Utl_HOReqRrcConnReqToConnectionSigIntensity_pct = WeightedAverage(pmDuIntensHoRrcConnReqDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,105,130,175])

# Signaling Intensity Ratio: Sum of Handover, RRC Connection Resume and RRC Connection request signal intensity compared to the Connection Intensity Control limit in the Baseband. [%]
Utl_HOReqRrcConnResReqRRCConnReqToConnectionSigIntensity_pct = WeightedAverage(pmDuIntensHoRrcConnReqResumeReqDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,105,130,175])

# Signaling Intensity Ratio: RRC connection request compared to the connection intensity control limit in the Baseband [%].
Utl_RrcConnReqToConnectionSigIntensity_pct = WeightedAverage(pmDuIntensRrcConnReqDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,105,130,175])

# Signaling Intensity Ratio: RRC Connection Resume Request compared to Connection Intensity Control limit in the Baseband [%].
Utl_RrcConnResReqToConnectionSigIntensity_pct = WeightedAverage(pmDuIntensRrcConnResumeReqDistr,[2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5,105,130,175])

# Average MP memory usage. [%]
Utl_MPMemoryUsage_pct = WeightedAverage(pmMpMemUsageDistr, [15,35,45,55,65,72.5,77.5,82.5,87.5,92.5,97.5])

# Average MP Load used by MP Load Control. Moving average of CPU load measurements with max number of CPU cores. [%]
Utl_MPLoadMaxCoresAvg_pct = WeightedAverage(pmProcessorLoadLcDistr, [10,25,35,45,55,65,75,82.5,87.5,92.5,97.5])

# Average MP Load used by MP Load Control. Moving average of CPU load measurements with current number of CPU cores. [%]
Utl_MPLoadCurrentCoresAvg_pct = WeightedAverage(pmProcessorLoadLcDynDistr, [10,25,35,45,55,65,75,82.5,87.5,92.5,97.5])

#################
#BbProcessingResource
# Average filtered DL Baseband capacity utilization and reservation level for each Baseband module. \nCorresponds to following formula: (reservation for DL PTT in Baseband capacity) + (DL Baseband capacity utilization). [%]
Utl_BbModuleDlBbCapacityPttReservation_pct = WeightedAverage(pmBbmDlBbCapacityPttReservation, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average filtered DL Baseband capacity utilization level for each Baseband module.  [%]
Utl_BbModuleDlBbCapacityUtilization_pct = WeightedAverage(pmBbmDlBbCapacityUtilization, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average filtered DL Physical Resource Block (PRB) utilization and reservation level for each Baseband module. Corresponds to following formula: (reservation for DL PRB PTT) + (DL PRB utilization). [%]
Utl_BbModuleDlPrbPttReservation_pct = WeightedAverage(pmBbmDlPrbPttReservation, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average DL PRB utilization level for each Baseband module. [%]
Utl_BbModuleDlPrbUtilization_pct = WeightedAverage(pmBbmDlPrbUtilization, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average DL Scheduling Entity (SE) utilization and reservation level for each Baseband module. Corresponds to following formula: (reservation for DL SE PTT) + (DL SE utilization). [%]
Utl_BbModuleDlSePttReservation_pct = WeightedAverage(pmBbmDlSePttReservation, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average DL SE utilization level for each Baseband module. [%]
Utl_BbModuleDlSeUtilization_pct = WeightedAverage(pmBbmDlSeUtilization, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average Average hardware resource utilization level for each Baseband unit. \nHardware resource utilization level corresponds to 100 * (Total number of connected UEs + Total number of configured SCells) / Maximum RRC Connected Users. [%]
Utl_BbModuleHwResUtilization_pct = WeightedAverage(pmBbmHwResUtilDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average filtered UL Baseband capacity utilization level for each Baseband module. [%]
Utl_BbModuleUlCapacityUtilization_pct  = WeightedAverage(pmBbmUlBbCapacityUtilization, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average filtered UL PRB utilization level for each Baseband module. [%]
Utl_BbModuleUlPrbUtilization_pct = WeightedAverage(pmBbmUlPrbUtilization, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average filtered UL SE utilization level for each Baseband module. [%]
Utl_BbModuleUlSeUtilization_pct = WeightedAverage(pmBbmUlSeUtilization, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# The ENodeBFunction.licDlBbPercentileConf percentile of the utilization for DL Baseband capacity during a measurement period. [percentile]
Utl_BbDlCapacityUtilization_pctile = pmLicDlCapActual

# Average utilization of DL Baseband capacity relative to the minimum of installed license for DL Baseband Capacity or hardware capacity limit. [%]
Utl_BbDlCapacityUtilizationToLicenseLimit_pct =  WeightedAverage(pmLicDlCapDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Maximum (high-water mark) value of DL Baseband capacity usage. [Mbps]
Utl_BbDlCapacityUsedMax_Mbps = pmLicDlCapUsedMax / 1000

# Average value of DL Baseband capacity usage. [Mbps]
Utl_BbDlCapacityUsedAvg_Mbps = pmLicDlCapUsedSum / pmLicDlCapUsedSamp / 1000

# The ENodeBFunction.pmLicDlPrbCapDistr percentile of the utilization for DL Baseband capacity during a measurement period. [percentile]
Utl_BbDlPrbCapacityUtilization_pctile = pmLicDlPrbCapActual

# Average utilization of DL PRB capacity relative to the minimum of installed license for DL PRB Capacity or hardware PRB capacity limit. [%]
Utl_BbDlPrbCapacityUtilizationToLicenseLimit_pct = WeightedAverage(pmLicDlPrbCapDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average DL PRB capacity usage. [PRB]
Utl_BbDlPrbCapacityUsedAvgDistr_prb = WeightedAverage(pmLicDlPrbUsedDistr, [0.5*pmLicPrbUnit,1*pmLicPrbUnit +0.5*pmLicPrbUnit,2*pmLicPrbUnit +0.5*pmLicPrbUnit,3*pmLicPrbUnit +0.5*pmLicPrbUnit,4*pmLicPrbUnit +0.5*pmLicPrbUnit,5*pmLicPrbUnit +0.5*pmLicPrbUnit,6*pmLicPrbUnit +0.5*pmLicPrbUnit,7*pmLicPrbUnit +0.5*pmLicPrbUnit,8*pmLicPrbUnit +0.5*pmLicPrbUnit,9*pmLicPrbUnit +0.5*pmLicPrbUnit,10*pmLicPrbUnit+0.5*pmLicPrbUnit,11*pmLicPrbUnit+0.5*pmLicPrbUnit,12*pmLicPrbUnit+0.5*pmLicPrbUnit,13*pmLicPrbUnit+0.5*pmLicPrbUnit,14*pmLicPrbUnit+0.5*pmLicPrbUnit,15*pmLicPrbUnit+0.5*pmLicPrbUnit,16*pmLicPrbUnit+0.5*pmLicPrbUnit,17*pmLicPrbUnit+0.5*pmLicPrbUnit,18*pmLicPrbUnit+0.5*pmLicPrbUnit,19*pmLicPrbUnit+0.5*pmLicPrbUnit,20*pmLicPrbUnit+0.5*pmLicPrbUnit,21*pmLicPrbUnit+0.5*pmLicPrbUnit,22*pmLicPrbUnit+0.5*pmLicPrbUnit,23*pmLicPrbUnit+0.5*pmLicPrbUnit,24*pmLicPrbUnit+0.5*pmLicPrbUnit,25*pmLicPrbUnit+0.5*pmLicPrbUnit,26*pmLicPrbUnit+0.5*pmLicPrbUnit,27*pmLicPrbUnit+0.5*pmLicPrbUnit,28*pmLicPrbUnit+0.5*pmLicPrbUnit,29*pmLicPrbUnit+0.5*pmLicPrbUnit,30*pmLicPrbUnit+0.5*pmLicPrbUnit,31*pmLicPrbUnit+0.5*pmLicPrbUnit,32*pmLicPrbUnit+0.5*pmLicPrbUnit,33*pmLicPrbUnit+0.5*pmLicPrbUnit,34*pmLicPrbUnit+0.5*pmLicPrbUnit,35*pmLicPrbUnit+0.5*pmLicPrbUnit,36*pmLicPrbUnit+0.5*pmLicPrbUnit,37*pmLicPrbUnit+0.5*pmLicPrbUnit,38*pmLicPrbUnit+0.5*pmLicPrbUnit,39*pmLicPrbUnit+0.5*pmLicPrbUnit,40*pmLicPrbUnit+0.5*pmLicPrbUnit,41*pmLicPrbUnit+0.5*pmLicPrbUnit,42*pmLicPrbUnit+0.5*pmLicPrbUnit,43*pmLicPrbUnit+0.5*pmLicPrbUnit,44*pmLicPrbUnit+0.5*pmLicPrbUnit,45*pmLicPrbUnit+0.5*pmLicPrbUnit,46*pmLicPrbUnit+0.5*pmLicPrbUnit,47*pmLicPrbUnit+0.5*pmLicPrbUnit])

# Maximum (high-water mark) value of DL PRB capacity use for LTE traffic. NB-IoT inband usage is not included. [PRB]
Utl_BbDlPrbCapacityUsedMax_prb = pmLicDlPrbUsedMax

# Average value of DL Baseband PRB capacity usage. [PRB]
Utl_BbDlPrbCapacityUsedAvg_prb = pmLicDlPrbUsedSum / pmLicDlPrbUsedSamp

# The ENodeBFunction.licUlBbPercentileConf percentile of the utilization for UL Baseband capacity during a measurement period. [percentile]
Utl_BbUlCapacityUtilization_pctile = pmLicUlCapActual

# Average utilization of UL Baseband capacity relative to the minimum of installed license for UL Baseband Capacity or hardware capacity limit. [%]
Utl_BbUlCapacityUtilizationToLicenseLimit_pct =  WeightedAverage(pmLicUlCapDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Maximum (high-water mark) value of UL Baseband capacity usage. [Mbps]
Utl_BbUlCapacityUsedMax_Mbps = pmLicUlCapUsedMax / 1000

# Average value of UL Baseband capacity usage. [Mbps]
Utl_BbUlCapacityUsedAvg_Mbps = pmLicUlCapUsedSum / pmLicUlCapUsedSamp / 1000

# The ENodeBFunction.pmLicUlPrbCapDistr percentile of the utilization for UL Baseband capacity during a measurement period. [percentile]
Utl_BbUlPrbCapacityUtilization_pctile = pmLicUlPrbCapActual

# Average utilization of UL PRB capacity relative to the minimum of installed license for UL PRB Capacity or hardware PRB capacity limit. [%]
Utl_BbUlPrbCapacityUtilizationToLicenseLimit_pct = WeightedAverage(pmLicUlPrbCapDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average UL PRB capacity usage  [PRB]
Utl_BbUlPrbCapacityUsedAvgDistr_prb = WeightedAverage(pmLicUlPrbUsedDistr, [0.5*pmLicPrbUnit,1*pmLicPrbUnit +0.5*pmLicPrbUnit,2*pmLicPrbUnit +0.5*pmLicPrbUnit,3*pmLicPrbUnit +0.5*pmLicPrbUnit,4*pmLicPrbUnit +0.5*pmLicPrbUnit,5*pmLicPrbUnit +0.5*pmLicPrbUnit,6*pmLicPrbUnit +0.5*pmLicPrbUnit,7*pmLicPrbUnit +0.5*pmLicPrbUnit,8*pmLicPrbUnit +0.5*pmLicPrbUnit,9*pmLicPrbUnit +0.5*pmLicPrbUnit,10*pmLicPrbUnit+0.5*pmLicPrbUnit,11*pmLicPrbUnit+0.5*pmLicPrbUnit,12*pmLicPrbUnit+0.5*pmLicPrbUnit,13*pmLicPrbUnit+0.5*pmLicPrbUnit,14*pmLicPrbUnit+0.5*pmLicPrbUnit,15*pmLicPrbUnit+0.5*pmLicPrbUnit,16*pmLicPrbUnit+0.5*pmLicPrbUnit,17*pmLicPrbUnit+0.5*pmLicPrbUnit,18*pmLicPrbUnit+0.5*pmLicPrbUnit,19*pmLicPrbUnit+0.5*pmLicPrbUnit,20*pmLicPrbUnit+0.5*pmLicPrbUnit,21*pmLicPrbUnit+0.5*pmLicPrbUnit,22*pmLicPrbUnit+0.5*pmLicPrbUnit,23*pmLicPrbUnit+0.5*pmLicPrbUnit,24*pmLicPrbUnit+0.5*pmLicPrbUnit,25*pmLicPrbUnit+0.5*pmLicPrbUnit,26*pmLicPrbUnit+0.5*pmLicPrbUnit,27*pmLicPrbUnit+0.5*pmLicPrbUnit,28*pmLicPrbUnit+0.5*pmLicPrbUnit,29*pmLicPrbUnit+0.5*pmLicPrbUnit,30*pmLicPrbUnit+0.5*pmLicPrbUnit,31*pmLicPrbUnit+0.5*pmLicPrbUnit,32*pmLicPrbUnit+0.5*pmLicPrbUnit,33*pmLicPrbUnit+0.5*pmLicPrbUnit,34*pmLicPrbUnit+0.5*pmLicPrbUnit,35*pmLicPrbUnit+0.5*pmLicPrbUnit,36*pmLicPrbUnit+0.5*pmLicPrbUnit,37*pmLicPrbUnit+0.5*pmLicPrbUnit,38*pmLicPrbUnit+0.5*pmLicPrbUnit,39*pmLicPrbUnit+0.5*pmLicPrbUnit,40*pmLicPrbUnit+0.5*pmLicPrbUnit,41*pmLicPrbUnit+0.5*pmLicPrbUnit,42*pmLicPrbUnit+0.5*pmLicPrbUnit,43*pmLicPrbUnit+0.5*pmLicPrbUnit,44*pmLicPrbUnit+0.5*pmLicPrbUnit,45*pmLicPrbUnit+0.5*pmLicPrbUnit,46*pmLicPrbUnit+0.5*pmLicPrbUnit,47*pmLicPrbUnit+0.5*pmLicPrbUnit])

# Maximum (high-water mark) value of UL PRB capacity use for LTE traffic. NB-IoT inband usage is not included. [PRB]
Utl_BbUlPrbCapacityUsedMax_prb = pmLicUlPrbUsedMax

# Average value of UL Baseband PRB capacity usage [PRB]
Utl_BbUlPrbCapacityUsedAvg_prb = pmLicUlPrbUsedSum / pmLicUlPrbUsedSamp

# Maximum utilization of CQI resources in the BbProcessingResource. [%]
Utl_CqiResourceUtilizationMax_pct = pmPucchCqiResUtilBbm / NR_ROP

# Maximum utilization of SR resources in the BbProcessingResource. [%]
Utl_SrResourceUtilizationMax_pct = pmPucchSrResUtilBbm / NR_ROP

# Average congestion level of UL RLC PDU buffer. [Congestion Level]
Utl_RlcPduBufferCongestionAvg_lvl = WeightedAverage(pmRlcPduBufferCongStatusUlDistr, [0,1,2,3,4,5,6,7])

# Average UL RLC PDU buffer utilization. [%]
Utl_RlcPduBufferUlUtilizationAvg_pct = WeightedAverage(pmRlcPduBufferUtilUlDistr, [2.5,7.5,12.5,17.5,22.5,27.5,32.5,37.5,42.5,47.5,52.5,57.5,62.5,67.5,72.5,77.5,82.5,87.5,92.5,97.5])

# Average number of ROHC (Robust Header Compression) Context Ids [#]
Utl_RohcCidAvg = pmRohcCidSum / pmRohcCidSamp 

#################
#GNBDUFunction
# Aggregated number of DL slots with data to be scheduled per second. Slot duration dependent on SCS (subCarrierSpacing) from 1ms for 15kHz to 0.125ms for 120kHz [slots/sec]
Utl_DataSlotsDl = pmLicDlSlotsData / 900

# Aggregated number of DL slots in which throughput HWAC limits scheduled data per second. Slot duration dependent on SCS (subCarrierSpacing) from 1ms for 15kHz to 0.125ms for 120kHz [slots/sec]
Utl_DataSlotsDlHwacLimit = pmLicDlSlotsHwacLimit / 900

# Aggregated number of UL slots with data to be scheduled per second. Slot duration dependent on SCS (subCarrierSpacing) from 1ms for 15kHz to 0.125ms for 120kHz [slots/sec]
Utl_DataSlotsUl = pmLicUlSlotsData / 900

# Aggregated number of UL slots in which throughput HWAC limits scheduled data per second. Slot duration dependent on SCS (subCarrierSpacing) from 1ms for 15kHz to 0.125ms for 120kHz [slots/sec]
Utl_DataSlotsUlHwacLimit = pmLicUlSlotsHwacLimit / 900

#######ATTN -- can we get this to work?
###Utl_OutputPowerHwacUsage_pct = pmLicOutputPowerHwac / CapacityState=CXC4012338.grantedCapacityLevel * 100
#######


