from abc import ABC import tensorflow as tf import numpy as np class Mapping(ABC): @tf.function def map(x): pass class Active_UEs_from_Connected(Mapping): def __init__(self, demand = "medium"): #Linear mapping from monitoring data with different scaling factors depending on demand if demand == "high": self.k = 0.032709253358325543 elif demand == "medium": self.k = 0.018575757575757582 elif demand == "low": self.k = 0.007832927210246799 @tf.function def map(self, x): return tf.cast(self.k * x, tf.float32) class Cell_Load_from_Active_UEs(Mapping): def __init__(self): #Exponential fit from monitoring data self._w_0 = 0.92972595 self._w_1 = 2.25275329 @tf.function def map(self, x): return tf.cast(self._w_0 * (1 - tf.exp(-(x) / self._w_1)), tf.float32) class Spectral_Efficiency_from_CQI(Mapping): def __init__(self, T=1/10): #Temperature for the sigmoid function to control smoothness self._T = T @tf.function def map(self, x): efficiency = np.array( [0.1523, 0.377 , 0.877 , 1.4766, 1.9141, 2.4063, 2.7305, 3.3223, 3.9023, 4.5234, 5.1152, 5.5547, 6.2266, 6.9141, 7.4063] ) mapping_soft = 0 current_sum = 0 for ankerpoint in range(1, 16): spec_eff = efficiency[ankerpoint-1] delta = spec_eff - current_sum mapping_soft += delta * (tf.math.sigmoid((x - ((ankerpoint-1) + 0.5))/self._T)) current_sum += delta return tf.cast(mapping_soft, tf.float32) class CQI_from_SINR(Mapping): def __init__(self): #Linear fit with softplus squasing from MDT data self._w_0 = 0.41238472 self._w_1 = 7.73600132 lambda x: 15 - tf.math.softplus( -(tf.math.softplus(0.41238472 * x + 7.73600132) - 15) ) @tf.function def map(self, x): return tf.cast(15 - tf.math.softplus( -(tf.math.softplus(self._w_0 * x + self._w_1) - 15) ), tf.float32)