diff --git a/src/propagation/model/three-gpp-propagation-loss-model.cc b/src/propagation/model/three-gpp-propagation-loss-model.cc index 2ed836356..fc6243906 100644 --- a/src/propagation/model/three-gpp-propagation-loss-model.cc +++ b/src/propagation/model/three-gpp-propagation-loss-model.cc @@ -263,6 +263,9 @@ NS_LOG_COMPONENT_DEFINE("ThreeGppPropagationLossModel"); NS_OBJECT_ENSURE_REGISTERED(ThreeGppPropagationLossModel); +std::function(Ptr, Ptr)> + ThreeGppPropagationLossModel::m_doCalcRxPowerPrologueFunction; + TypeId ThreeGppPropagationLossModel::GetTypeId() { @@ -375,11 +378,19 @@ ThreeGppPropagationLossModel::IsO2iLowPenetrationLoss(Ptr a, + Ptr c, Ptr b) const { NS_LOG_FUNCTION(this); + // if there is a prologue function installed, call it and replace the transmitter mobility model + auto a = m_doCalcRxPowerPrologueFunction ? m_doCalcRxPowerPrologueFunction(b, c) : c; + if (a->GetPosition() != c->GetPosition()) + { + NS_LOG_DEBUG("Prologue function replaced source position " + << c->GetPosition() << " with position " << a->GetPosition()); + } + // check if the model is initialized NS_ASSERT_MSG(m_frequency != 0.0, "First set the centre frequency"); diff --git a/src/propagation/model/three-gpp-propagation-loss-model.h b/src/propagation/model/three-gpp-propagation-loss-model.h index 3a19cf46a..0b16f7d3c 100644 --- a/src/propagation/model/three-gpp-propagation-loss-model.h +++ b/src/propagation/model/three-gpp-propagation-loss-model.h @@ -75,6 +75,26 @@ class ThreeGppPropagationLossModel : public PropagationLossModel */ bool IsO2iLowPenetrationLoss(Ptr cond) const; + /** + * @brief Stop-gap solution for wraparound model + * + * Stop-gap solution for support of wraparound model in the 5G NR module. This + * method was introduced for ns-3.45 but will be removed in a future release once + * a more general solution is added elsewhere (most likely in the spectrum channel). The + * callback method registered here will be executed at the beginning of DoCalcRxPower, and the + * returned pointer to a mobility model will be subsequently used as the (replacement) source + * mobility model for the rest of DoCalcRxPower() processing. + * + * @param prologueFunction Function that receives two mobility models and compute a third, based + * on the wrapped position of the second model in respect to the first + */ + static void InstallDoCalcRxPowerPrologueFunction( + std::function(Ptr, Ptr)> + prologueFunction) + { + m_doCalcRxPowerPrologueFunction = prologueFunction; + } + private: /** * Computes the received power by applying the pathloss model described in @@ -300,6 +320,10 @@ class ThreeGppPropagationLossModel : public PropagationLossModel Ptr m_normalO2iHighLossVar; //!< a normal random variable for the calculation of 02i high loss, //!< see TR38.901 Table 7.4.3-2 + + /// Optional prologue function that can be used to implement wraparound models + static std::function(Ptr, Ptr)> + m_doCalcRxPowerPrologueFunction; }; /**