""" COST-231 Hata model (extension of Okumura-Hata). Valid for: - Frequency: 1500-2000 MHz - Distance: 1-20 km Better for LTE bands than original Okumura-Hata. """ import math from app.propagation.base import PropagationModel, PropagationInput, PropagationOutput class Cost231HataModel(PropagationModel): @property def name(self) -> str: return "COST-231-Hata" @property def frequency_range(self) -> tuple: return (1500, 2000) @property def distance_range(self) -> tuple: return (100, 20000) def calculate(self, input: PropagationInput) -> PropagationOutput: f = input.frequency_mhz d = max(input.distance_m / 1000, 0.1) hb = max(input.tx_height_m, 1.0) hm = max(input.rx_height_m, 1.0) # Mobile antenna correction (medium city) a_hm = (1.1 * math.log10(f) - 0.7) * hm - (1.56 * math.log10(f) - 0.8) # Metropolitan center correction C_m = 3 if input.environment == "urban" else 0 L = ( 46.3 + 33.9 * math.log10(f) - 13.82 * math.log10(hb) - a_hm + (44.9 - 6.55 * math.log10(hb)) * math.log10(d) + C_m ) return PropagationOutput( path_loss_db=L, model_name=self.name, is_los=False, breakdown={ "base_loss": 46.3, "frequency_term": 33.9 * math.log10(f), "height_gain": -13.82 * math.log10(hb), "mobile_correction": -a_hm, "distance_term": (44.9 - 6.55 * math.log10(hb)) * math.log10(d), "metro_correction": C_m, }, )