From d2294f4522223e0224ce2f22cea8dd9ed66dcc28 Mon Sep 17 00:00:00 2001 From: Katerina Koutlia Date: Wed, 28 Sep 2022 14:46:49 +0200 Subject: [PATCH] propagation: Address review comments --- CHANGES.md | 2 + src/propagation/doc/propagation.rst | 25 ++++++- .../model/channel-condition-model.cc | 9 ++- .../model/channel-condition-model.h | 14 ++-- .../model/three-gpp-propagation-loss-model.cc | 23 ++++--- .../model/three-gpp-propagation-loss-model.h | 65 +++++++++++-------- .../three-gpp-v2v-propagation-loss-model.cc | 7 +- .../three-gpp-v2v-propagation-loss-model.h | 12 ++-- 8 files changed, 98 insertions(+), 59 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 413451673..e13dbf9d6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -48,6 +48,7 @@ Changes from ns-3.36 to ns-3.37 * The **Assoc** and **DeAssoc** trace sources of `StaWifiMac` provide the AP MLD address in case (de)association takes place between a non-AP MLD and an AP MLD. * Adds support for **LrWpanMac** devices association. * Pan Id compression is now possible in **LrWpanMac** when transmitting data frames. i.e. When src and dst pan ID are the same, only one PanId is used, making the MAC header 2 bytes smaller. See IEEE 802.15.4-2006 (7.5.6.1). +* Add O2I Low/High Building Penetration Losses in 3GPP propagation loss model (`ThreeGppPropagationLossModel`) according to **3GPP TR 38.901 7.4.3.1**. Currently, UMa, UMi and RMa scenarios are supported. ### Changes to build system @@ -66,6 +67,7 @@ Changes from ns-3.36 to ns-3.37 * Lr-wpan: **LrWpanPhy** now change to TRX_OFF after a CSMA-CA failure when the RxOnWhenIdle flag is set to false in the **LrWpanMac**. * The **Channel** attribute of `WifiNetDevice` is deprecated because it became ambiguous with the introduction of multiple links per device. The **Channel** attribute of `WifiPhy` can be used instead. +* The O2I Low/High Building Penetration Losses will add losses in the pathloss calculation when buildings are present and a UE results to be in O2I state. In order to not consider these losses, they can be disabled by setting BuildingPenetrationLossesEnabled to false. Changes from ns-3.36 to ns-3.36.1 --------------------------------- diff --git a/src/propagation/doc/propagation.rst b/src/propagation/doc/propagation.rst index 0f8def309..a57b35a29 100644 --- a/src/propagation/doc/propagation.rst +++ b/src/propagation/doc/propagation.rst @@ -599,10 +599,33 @@ environments, i.e., indoor, outdoor urban and rural, for frequencies between * Path loss and shadowing models (3GPP TR 38.901, Sec. 7.4.1) * Autocorrelation of shadow fading (3GPP TR 38.901, Sec. 7.4.4) * `Channel condition models `_ (3GPP TR 38.901, Sec. 7.4.2) + * O2I Low/High Building penetration losses (3GPP TR 38.901, Sec. 7.4.3.1). + The Low/High Building penetration losses can be enabled for UEs that are in + O2I channel condition state. + For determining the O2O/O2I state in ns-3 there are two possible scenario setups: + 1) ns-3 buildings and :cpp:class:`BuildingsChannelConditionModel` are used. + Then the O2I condition is calculated based on the buildings in the scenario. + In this case losses are considered by default, however there is the option + to disable them by setting the :cpp:class:`ThreeGppPropagationLossModel` + attribute BuildingPenetrationLossesEnabled to false. + 2) ns-3 buildings are not used, instead one of the 3GPP stochastic channel condition + models is used, such as: :cpp:class:`ThreeGppRmaChannelConditionModel`, + :cpp:class:`ThreeGppUmaChannelConditionModel`, :cpp:class:`ThreeGppUmiStreetCanyonChannelConditionModel`. + These models are extended to calculate the O2O/O2I state probabilistically. + Additionally, it is possible to configure to calculate O2I condition + deterministically based on the UE height. In both cases, the O2O/O2I is updated + at the same time as LOS/nLOS, i.e. with the same periodicity. + For other 3GPP channel condition models in ns-3 there are no O2I losses because + both TX and RX, are either indoor or outdoor, such as in the case of indoor or + V2V scenarios. + For this case, to consider O2I Low/High Losses, the attribute of the + :cpp:class:`ChannelCondition` O2iThreshold (that indicates the ratio between + O2O and O2I states) must be set to a value different from 0. Possible values + are from 0 to 1, with 1 corresponding to 100% O2I conditions. *To be implemented:* - * O2I penetration loss (3GPP TR 38.901, Sec. 7.4.3) + * O2I Car penetration losses (3GPP TR 38.901, Sec. 7.4.3.2). * Spatial consistent update of the channel states (3GPP TR 38.901 Sec. 7.6.3.3) **Configuration** diff --git a/src/propagation/model/channel-condition-model.cc b/src/propagation/model/channel-condition-model.cc index 1e2cd43cb..aa7fc8797 100644 --- a/src/propagation/model/channel-condition-model.cc +++ b/src/propagation/model/channel-condition-model.cc @@ -393,9 +393,6 @@ ChannelCondition::O2iConditionValue ThreeGppChannelConditionModel::ComputeO2i ([[maybe_unused]] Ptr a, [[maybe_unused]] Ptr b) const { - // TODO this code should be changed to determine based on a and b positions, - // whether they are indoor or outdoor the o2i condition - // currently we just parametrize it double o2iProb = m_uniformVarO2i->GetValue (0, 1); if (m_linkO2iConditionToAntennaHeight) @@ -411,7 +408,6 @@ ThreeGppChannelConditionModel::ComputeO2i ([[maybe_unused]] PtrSetStream (stream); - return 1; + m_uniformVarO2i->SetStream (stream + 1); + m_uniformO2iLowHighLossVar->SetStream (stream + 2); + + return 3; } double diff --git a/src/propagation/model/channel-condition-model.h b/src/propagation/model/channel-condition-model.h index e2a6648a7..c477433fc 100644 --- a/src/propagation/model/channel-condition-model.h +++ b/src/propagation/model/channel-condition-model.h @@ -90,7 +90,7 @@ public: * Constructor for the ChannelCondition class * \param losCondition the LOS condition value * \param o2iCondition the O2I condition value (by default is set to O2O) - * \param o2iLowHighCondition the O2I Low-High Penetration loss condition value (by default is set to LOW) + * \param o2iLowHighCondition the O2I Low-High Building Penetration loss condition value (by default is set to LOW) */ ChannelCondition (LosConditionValue losCondition, O2iConditionValue o2iCondition = O2O, @@ -135,7 +135,7 @@ public: /** * Get the O2iLowHighConditionValue contaning the information about the O2I - * penetration losses (low or high) + * building penetration losses (low or high) * * \return the O2iLowHighConditionValue */ @@ -143,7 +143,7 @@ public: /** * Set the O2iLowHighConditionValue contaning the information about the O2I - * penetration losses (low or high) + * building penetration losses (low or high) * * \param o2iLowHighCondition the O2iLowHighConditionValue */ @@ -207,7 +207,7 @@ public: private: LosConditionValue m_losCondition; //!< contains the information about the LOS state of the channel O2iConditionValue m_o2iCondition; //!< contains the information about the O2I state of the channel - O2iLowHighConditionValue m_o2iLowHighCondition; //!< contains the information about the O2I low-high penetration losses + O2iLowHighConditionValue m_o2iLowHighCondition; //!< contains the information about the O2I low-high building penetration losses /** * Prints a LosConditionValue to output @@ -497,7 +497,6 @@ protected: Ptr m_uniformVar; //!< uniform random variable - private: /** * This method computes the channel condition based on a probabilistic model @@ -518,9 +517,8 @@ private: */ virtual double ComputePlos (Ptr a, Ptr b) const = 0; - // TODO make this purely abstract function and all child classes should implement this /** - * Compute the O2I Penetration Loss + * Determines whether the channel condition is O2I or O2O * * \param a tx mobility model * \param b rx mobility model @@ -558,7 +556,7 @@ private: Time m_updatePeriod; //!< the update period for the channel condition double m_o2iThreshold {0}; //!< the threshold for determing what is the ratio of channels with O2I - double m_o2iLowLossThreshold {0}; //!< the threshold for determing what is the ratio of low - high O2I penetration losses + double m_o2iLowLossThreshold {0}; //!< the threshold for determing what is the ratio of low - high O2I building penetration losses double m_linkO2iConditionToAntennaHeight {false}; //!< the indicator that determines whether the O2I/O2O condition is determined based on the UE height Ptr m_uniformVarO2i; //!< uniform random variable that is used for the generation of the O2i conditions Ptr m_uniformO2iLowHighLossVar; //!< a uniform random variable for the calculation of the low/high losses, see TR38.901 Table 7.4.3-2 diff --git a/src/propagation/model/three-gpp-propagation-loss-model.cc b/src/propagation/model/three-gpp-propagation-loss-model.cc index 503717823..235626bc4 100644 --- a/src/propagation/model/three-gpp-propagation-loss-model.cc +++ b/src/propagation/model/three-gpp-propagation-loss-model.cc @@ -254,7 +254,7 @@ ThreeGppPropagationLossModel::GetO2iLowPenetrationLoss (Ptr a, // 10 m for RMa. 2D−in d shall be UT-specifically generated. double distance2dIn = GetO2iDistance2dIn (); - // calculate material penetration losses, see TR38.901 Table 7.4.3-1 + // calculate material penetration losses, see TR 38.901 Table 7.4.3-1 lGlass = 2 + 0.2 * m_frequency / 1e9; // m_frequency is operation frequency in Hz lConcrete = 5 + 4 * m_frequency / 1e9; @@ -325,7 +325,7 @@ ThreeGppPropagationLossModel::GetO2iHighPenetrationLoss (Ptr a, // 10 m for RMa. 2D−in d shall be UT-specifically generated. double distance2dIn = GetO2iDistance2dIn (); - // calculate material penetration losses, see TR38.901 Table 7.4.3-1 + // calculate material penetration losses, see TR 38.901 Table 7.4.3-1 lIIRGlass = 23 + 0.3 * m_frequency / 1e9; lConcrete = 5 + 4 * m_frequency / 1e9; @@ -428,7 +428,12 @@ ThreeGppPropagationLossModel::DoAssignStreams (int64_t stream) NS_LOG_FUNCTION (this); m_normRandomVariable->SetStream (stream); - return 1; + m_randomO2iVar1->SetStream (stream + 1); + m_randomO2iVar2->SetStream (stream + 2); + m_normalO2iLowLossVar->SetStream (stream + 3); + m_normalO2iHighLossVar->SetStream (stream + 4); + + return 5; } double @@ -512,8 +517,8 @@ ThreeGppRmaPropagationLossModel::~ThreeGppRmaPropagationLossModel () double ThreeGppRmaPropagationLossModel::GetO2iDistance2dIn () const { - // distance2dIn is minimum of two independently generated uniformly distributed variables between 0 and 25 m for UMa and - // UMi-Street Canyon, and between 0 and 10 m for RMa. 2D−in d shall be UT-specifically generated. + // distance2dIn is minimum of two independently generated uniformly distributed variables + // between 0 and 10 m for RMa. 2D−in d shall be UT-specifically generated. return std::min ( m_randomO2iVar1->GetValue (0, 10), m_randomO2iVar2->GetValue (0, 10)); } @@ -811,8 +816,8 @@ ThreeGppUmaPropagationLossModel::GetLossLos (double distance2D, double distance3 double ThreeGppUmaPropagationLossModel::GetO2iDistance2dIn () const { - // distance2dIn is minimum of two independently generated uniformly distributed variables between 0 and 25 m for UMa and - // UMi-Street Canyon, and between 0 and 10 m for RMa. 2D−in d shall be UT-specifically generated. + // distance2dIn is minimum of two independently generated uniformly distributed variables + // between 0 and 25 m for UMa and UMi-Street Canyon. 2D−in d shall be UT-specifically generated. return std::min ( m_randomO2iVar1->GetValue (0, 25), m_randomO2iVar2->GetValue (0, 25)); } @@ -960,8 +965,8 @@ ThreeGppUmiStreetCanyonPropagationLossModel::GetBpDistance (double hUt, double h double ThreeGppUmiStreetCanyonPropagationLossModel::GetO2iDistance2dIn () const { - // distance2dIn is minimum of two independently generated uniformly distributed variables between 0 and 25 m for UMa and - // UMi-Street Canyon, and between 0 and 10 m for RMa. 2D−in d shall be UT-specifically generated. + // distance2dIn is minimum of two independently generated uniformly distributed variables + // between 0 and 25 m for UMa and UMi-Street Canyon. 2D−in d shall be UT-specifically generated. return std::min ( m_randomO2iVar1->GetValue (0, 25), m_randomO2iVar2->GetValue (0, 25)); } diff --git a/src/propagation/model/three-gpp-propagation-loss-model.h b/src/propagation/model/three-gpp-propagation-loss-model.h index 1d6099ac7..28fc58072 100644 --- a/src/propagation/model/three-gpp-propagation-loss-model.h +++ b/src/propagation/model/three-gpp-propagation-loss-model.h @@ -122,19 +122,23 @@ private: * value depending on the specific 3GPP scenario (UMa, UMi-Street Canyon, RMa), * i.e., between 0 and 25 m for UMa and UMi-Street Canyon, and between 0 and 10 m * for RMa. - * According to 3GPP R38.091 this 2D−in distance shall be UT-specifically - * generated. 2D−in distance is used for the low penetration losses - * calculation according to 3GPP TR38.091 7.4.3. - * \return the distance in m + * According to 3GPP TR 38.901 this 2D−in distance shall be UT-specifically + * generated. 2D−in distance is used for the O2I penetration losses + * calculation according to 3GPP TR 38.901 7.4.3. + * See GetO2iLowPenetrationLoss/GetO2iHighPenetrationLoss functions. + * \return Returns 02i 2D distance (in meters) used to calculate low/high losses. */ virtual double GetO2iDistance2dIn () const = 0; - // TODO all child classes should implement this function and this function should be purely virtual /** - * \brief Retrieves the o2i Loss value by looking at m_o2iLossMap. + * \brief Retrieves the o2i building penetration loss value by looking at m_o2iLossMap. * If not found or if the channel condition changed it generates a new * independent realization and stores it in the map, otherwise it calculates - * a new value as defined in 3GPP TR38.901 7.4.3. + * a new value as defined in 3GPP TR 38.901 7.4.3.1. + * + * Note that all child classes should implement this function to support + * low losses calculation. As such, this function should be purely virtual. + * * \param a tx mobility model (used for the key calculation) * \param b rx mobility model (used for the key calculation) * \param cond the LOS/NLOS channel condition @@ -144,10 +148,14 @@ private: ChannelCondition::LosConditionValue cond) const; /** - * \brief Retrieves the o2i Loss value by looking at m_o2iLossMap. + * \brief Retrieves the o2i building penetration loss value by looking at m_o2iLossMap. * If not found or if the channel condition changed it generates a new * independent realization and stores it in the map, otherwise it calculates - * a new value as defined in 3GPP TR38.901 7.4.3. + * a new value as defined in 3GPP TR 38.901 7.4.3.1. + * + * Note that all child classes should implement this function to support + * high losses calculation. As such, this function should be purely virtual. + * * \param a tx mobility model (used for the key calculation) * \param b rx mobility model (used for the key calculation) * \param cond the LOS/NLOS channel condition @@ -328,17 +336,17 @@ private: */ virtual double GetLossLos (double distance2D, double distance3D, double hUt, double hBs) const override; - /** * \brief Returns the minimum of the two independently generated distances * according to the uniform distribution between the minimum and the maximum * value depending on the specific 3GPP scenario (UMa, UMi-Street Canyon, RMa), * i.e., between 0 and 25 m for UMa and UMi-Street Canyon, and between 0 and 10 m * for RMa. - * According to 3GPP R38.091 this 2D−in distance shall be UT-specifically - * generated. 2D−in distance is used for the low penetration losses - * calculation according to 3GPP TR38.091 7.4.3. - * \return the distance in m + * According to 3GPP TR 38.901 this 2D−in distance shall be UT-specifically + * generated. 2D−in distance is used for the O2I penetration losses + * calculation according to 3GPP TR 38.901 7.4.3. + * See GetO2iLowPenetrationLoss/GetO2iHighPenetrationLoss functions. + * \return Returns 02i 2D distance (in meters) used to calculate low/high losses. */ virtual double GetO2iDistance2dIn () const override; @@ -435,17 +443,17 @@ private: */ double GetLossLos (double distance2D, double distance3D, double hUt, double hBs) const override; - /** * \brief Returns the minimum of the two independently generated distances * according to the uniform distribution between the minimum and the maximum * value depending on the specific 3GPP scenario (UMa, UMi-Street Canyon, RMa), * i.e., between 0 and 25 m for UMa and UMi-Street Canyon, and between 0 and 10 m * for RMa. - * According to 3GPP R38.091 this 2D−in distance shall be UT-specifically - * generated. 2D−in distance is used for the low penetration losses - * calculation according to 3GPP TR38.091 7.4.3. - * \return the distance in m + * According to 3GPP TR 38.901 this 2D−in distance shall be UT-specifically + * generated. 2D−in distance is used for the O2I penetration losses + * calculation according to 3GPP TR 38.901 7.4.3. + * See GetO2iLowPenetrationLoss/GetO2iHighPenetrationLoss functions. + * \return Returns 02i 2D distance (in meters) used to calculate low/high losses. */ double GetO2iDistance2dIn () const override; @@ -535,10 +543,11 @@ private: * value depending on the specific 3GPP scenario (UMa, UMi-Street Canyon, RMa), * i.e., between 0 and 25 m for UMa and UMi-Street Canyon, and between 0 and 10 m * for RMa. - * According to 3GPP R38.091 this 2D−in distance shall be UT-specifically - * generated. 2D−in distance is used for the low penetration losses - * calculation according to 3GPP TR38.091 7.4.3. - * \return the distance in m + * According to 3GPP TR 38.901 this 2D−in distance shall be UT-specifically + * generated. 2D−in distance is used for the O2I penetration losses + * calculation according to 3GPP TR 38.901 7.4.3. + * See GetO2iLowPenetrationLoss/GetO2iHighPenetrationLoss functions. + * \return Returns 02i 2D distance (in meters) used to calculate low/high losses. */ virtual double GetO2iDistance2dIn () const override; @@ -634,14 +643,14 @@ private: * value depending on the specific 3GPP scenario (UMa, UMi-Street Canyon, RMa), * i.e., between 0 and 25 m for UMa and UMi-Street Canyon, and between 0 and 10 m * for RMa. - * According to 3GPP R38.091 this 2D−in distance shall be UT-specifically - * generated. 2D−in distance is used for the low penetration losses - * calculation according to 3GPP TR38.091 7.4.3. - * \return the distance in m + * According to 3GPP TR 38.901 this 2D−in distance shall be UT-specifically + * generated. 2D−in distance is used for the O2I penetration losses + * calculation according to 3GPP TR 38.901 7.4.3. + * See GetO2iLowPenetrationLoss/GetO2iHighPenetrationLoss functions. + * \return Returns 02i 2D distance (in meters) used to calculate low/high losses. */ virtual double GetO2iDistance2dIn () const override; - /** * \brief Computes the pathloss between a and b considering that the line of * sight is obstructed diff --git a/src/propagation/model/three-gpp-v2v-propagation-loss-model.cc b/src/propagation/model/three-gpp-v2v-propagation-loss-model.cc index dd4aed2b9..4aaaf4d42 100644 --- a/src/propagation/model/three-gpp-v2v-propagation-loss-model.cc +++ b/src/propagation/model/three-gpp-v2v-propagation-loss-model.cc @@ -74,14 +74,13 @@ ThreeGppV2vUrbanPropagationLossModel::GetLossLos (double /* distance2D */, doubl return loss; } - - double ThreeGppV2vUrbanPropagationLossModel::GetO2iDistance2dIn () const { + // TODO O2I car penetration loss (TR 38.901 7.4.3.2) not considered + NS_LOG_WARN ("O2I car penetration loss not yet implemented"); return 0; -}; - +} double ThreeGppV2vUrbanPropagationLossModel::GetLossNlosv (double distance2D, double distance3D, double hUt, double hBs) const diff --git a/src/propagation/model/three-gpp-v2v-propagation-loss-model.h b/src/propagation/model/three-gpp-v2v-propagation-loss-model.h index 077dfd732..ded660f44 100644 --- a/src/propagation/model/three-gpp-v2v-propagation-loss-model.h +++ b/src/propagation/model/three-gpp-v2v-propagation-loss-model.h @@ -71,10 +71,14 @@ private: * value depending on the specific 3GPP scenario (UMa, UMi-Street Canyon, RMa), * i.e., between 0 and 25 m for UMa and UMi-Street Canyon, and between 0 and 10 m * for RMa. - * According to 3GPP R38.091 this 2D−in distance shall be UT-specifically - * generated. 2D−in distance is used for the low penetration losses - * calculation according to 3GPP TR38.091 7.4.3. - * \return the distance in m + * According to 3GPP TR 38.901 this 2D−in distance shall be UT-specifically + * generated. 2D−in distance is used for the O2I penetration losses + * calculation according to 3GPP TR 38.901 7.4.3. + * See GetO2iLowPenetrationLoss/GetO2iHighPenetrationLoss functions. + * + * TODO O2I car penetration loss (TR 38.901 7.4.3.2) not considered + * + * \return Returns 02i 2D distance (in meters) used to calculate low/high losses. */ virtual double GetO2iDistance2dIn () const override;