diff --git a/src/lte/doc/source/lte-design.rst b/src/lte/doc/source/lte-design.rst index b1ec8ce49..9c95f1547 100644 --- a/src/lte/doc/source/lte-design.rst +++ b/src/lte/doc/source/lte-design.rst @@ -1092,12 +1092,19 @@ The physical layer model provided in this LTE simulator is based on the one described in [Piro2011]_, with the following modifications. The model now includes the inter cell intereference calculation and the simulation of uplink traffic, including both packet transmission and CQI generation. + +MAC to Channel delay +^^^^^^^^^^^^^^^^^^^^ + +To model the latency of real MAC and PHY implementations, the PHY model simulates a MAC-to-channel delay in multiples of TTIs (1ms). The transmission of both data and control packets are delayed by this amount. + + CQI feedback ^^^^^^^^^^^^ The generation of CQI feedback is done accordingly to what specified in [FFAPI]_. In detail, we considered the generation of periodic wideband CQI (i.e., a single value of channel state that is deemed representative of all RBs -in use) and inband CQIs (i.e., a set of value representing the channel state for each RB). +in use) and inband CQIs (i.e., a set of value representing the channel state for each RB). Interference Model ^^^^^^^^^^^^^^^^^^ @@ -1174,8 +1181,8 @@ For estimating the :math:`CBLER_i`, the MI evaluation has been implemented accor where :math:`x` is the MI of the TB, :math:`b_{ECR}` represents the "transition center" and :math:`c_{ECR}` is related to the "transition width" of the Gaussian cumulative distribution for each Effective Code Rate (ECR) which is the actual transmission rate according to the channel coding and MCS. For limiting the computational complexity of the model we considered only a subset of the possible ECRs in fact we would have potentially 5076 possible ECRs (i.e., 27 MCSs and 188 CB sizes). On this respect, we will limit the CB sizes to some representative values (i.e., 40, 140, 160, 256, 512, 1024, 2048, 4032, 6144), while for the others the worst one approximating the real one will be used (i.e., the smaller CB size value available respect to the real one). This choice is aligned to the typical performance of turbo codes, where the CB size is not strongly impacting on the BLER. However, it is to be notes that for CB sizes lower than 1000 bits the effect might be relevant (i.e., till 2 dB); therefore, we adopt this unbalanced sampling interval for having more precision where it is necessary. This behaviour is confirmed by the figures presented in the Annes Section. -Link Layer Performance -^^^^^^^^^^^^^^^^^^^^^^ +BLER Curves +^^^^^^^^^^^ On this respect, we reused part of the curves obtained within [PaduaPEM]_. In detail, we introduced the CB size dependency to the CB BLER curves with the support of the developers of [PaduaPEM]_ and of the LTE Vienna Simulator. In fact, the module released provides the link layer performance only for what concerns the MCSs (i.e, with a given fixed ECR). In detail the new error rate curves for each has been evaluated with a simulation campaign with the link layer simulator for a single link with AWGN noise and for CB size of 104, 140, 256, 512, 1024, 2048, 4032 and 6144. These curves has been mapped with the Gaussian cumulative model formula presented above for obtaining the correspondents :math:`b_{ECR}` and :math:`c_{ECR}` parameters. @@ -1259,8 +1266,8 @@ The BLER perfomance of all MCS obtained with the link level simulator are plotte -Simulator Design -^^^^^^^^^^^^^^^^ +Integration of the BLER curves in the ns-3 LTE module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The model implemented uses the curves for the LSM of the recently LTE PHY Error Model released in the ns3 community by the Signet Group [PaduaPEM]_ and the new ones generated for different CB sizes. The ``LteSpectrumPhy`` class is in charge of evaluating the TB BLER thanks to the methods provided by the ``LteMiErrorModel`` class, which is in charge of evaluating the TB BLER according to the vector of the perceived SINR per RB, the MCS and the size in order to proper model the segmentation of the TB in CBs. In order to obtain the vector of the perceived SINR two instances of ``LtePemSinrChunkProcessor`` (child of ``LteSinrChunkProcessor`` dedicated to evaluate the SINR for obtaining physical error performance) have been attached to UE downlink and eNB uplink ``LteSpectrumPhy`` modules for evaluating the error model distribution respectively of PDSCH (UE side) and ULSCH (eNB side). diff --git a/src/lte/examples/lena-dual-stripe.cc b/src/lte/examples/lena-dual-stripe.cc index bae838352..7bf025e76 100644 --- a/src/lte/examples/lena-dual-stripe.cc +++ b/src/lte/examples/lena-dual-stripe.cc @@ -29,7 +29,9 @@ #include #include #include -#include + +// uncomment this to use GtkConfigStore +//#include // The topology of this simulation program is inspired from // 3GPP R4-092042, Section 4.2.1 Dual Stripe Model diff --git a/src/lte/model/ideal-control-messages.h b/src/lte/model/ideal-control-messages.h index fa1fcc99f..836d27879 100644 --- a/src/lte/model/ideal-control-messages.h +++ b/src/lte/model/ideal-control-messages.h @@ -289,7 +289,7 @@ namespace ns3 { class LteNetDevice; /** -* The Fempto forum downlink CqiIdealControlMessage defines an ideal list of +* The downlink CqiIdealControlMessage defines an ideal list of * feedback about the channel quality sent by the UE to the eNodeB. */ class DlCqiIdealControlMessage : public IdealControlMessage @@ -332,7 +332,7 @@ namespace ns3 { class LteNetDevice; /** -* The Fempto forum uplink BsrIdealControlMessage defines the specific +* The uplink BsrIdealControlMessage defines the specific * extension of the CE element for reporting the buffer status report */ class BsrIdealControlMessage : public IdealControlMessage diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 4b2846fc1..3a8270685 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -140,6 +140,12 @@ LteEnbPhy::GetTypeId (void) MakeDoubleAccessor (&LteEnbPhy::SetNoiseFigure, &LteEnbPhy::GetNoiseFigure), MakeDoubleChecker ()) + .AddAttribute ("MacToChannelDelay", + "The delay in TTI units that occurs between a scheduling decision in the MAC and the actual start of the transmission by the PHY. This is intended to be used to model the latency of real PHY and MAC implementations.", + UintegerValue (1), + MakeUintegerAccessor (&LteEnbPhy::SetMacChDelay, + &LteEnbPhy::GetMacChDelay), + MakeUintegerChecker ()) ; return tid; } @@ -208,6 +214,19 @@ LteEnbPhy::GetNoiseFigure () const return m_noiseFigure; } +void +LteEnbPhy::SetMacChDelay (uint8_t delay) +{ + m_macChTtiDelay = delay; + m_packetBurstQueue.resize (delay); +} + +uint8_t +LteEnbPhy::GetMacChDelay (void) const +{ + return (m_macChTtiDelay); +} + bool LteEnbPhy::AddUePhy (uint16_t rnti, Ptr phy) { @@ -447,14 +466,10 @@ LteEnbPhy::EndFrame (void) void -LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr) +LteEnbPhy::GenerateCqiReport (const SpectrumValue& sinr) { NS_LOG_FUNCTION (this << sinr); - Ptr thisDevice = GetDevice ()->GetObject (); - m_enbPhySapUser->UlCqiReport (CreateUlCqiReport (sinr)); - - } diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index 8060c7bab..380fc2cb2 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -85,6 +85,7 @@ public: */ double GetTxPower () const; + /** * \param pw the noise figure in dB */ @@ -95,6 +96,16 @@ public: */ double GetNoiseFigure () const; + /** + * \param delay the TTI delay between MAC and channel + */ + void SetMacChDelay (uint8_t delay); + + /** + * \returns the TTI delay between MAC and channel + */ + uint8_t GetMacChDelay (void) const; + /** * \brief Queue the MAC PDU to be sent * \param p the MAC PDU to sent @@ -165,7 +176,7 @@ public: void PhyPduReceived (Ptr p); // inherited from LtePhy - virtual void GenerateCqiFeedback (const SpectrumValue& sinr); + virtual void GenerateCqiReport (const SpectrumValue& sinr); private: diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index 0b8357b38..5158f9c83 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -232,21 +232,6 @@ LtePhy::GetRbgSize (void) const return m_rbgSize; } - -void -LtePhy::SetMacChDelay (uint8_t delay) -{ - m_macChTtiDelay = delay; - m_packetBurstQueue.resize (delay); -} - - -uint8_t -LtePhy::GetMacChDelay (void) -{ - return (m_macChTtiDelay); -} - void LtePhy::SetMacPdu (Ptr p) { diff --git a/src/lte/model/lte-phy.h b/src/lte/model/lte-phy.h index 0810c22a1..3177d0dac 100644 --- a/src/lte/model/lte-phy.h +++ b/src/lte/model/lte-phy.h @@ -194,14 +194,6 @@ public: */ uint8_t GetRbgSize (void) const; - /** - * \param delay the TTI delay between MAC and channel - */ - void SetMacChDelay (uint8_t delay); - /** - * \returns the TTI delay between MAC and channel - */ - uint8_t GetMacChDelay (void); /** * \param p queue MAC PDU to be sent @@ -214,7 +206,7 @@ public: Ptr GetPacketBurst (void); /** - * \param p queue control message to be sent + * \param m the control message to be sent */ void SetControlMessages (Ptr m); @@ -225,11 +217,11 @@ public: /** - * generate CQI feedback based on the given SINR + * generate a CQI report based on the given SINR * * \param sinr the SINR vs frequency measured by the device */ - virtual void GenerateCqiFeedback (const SpectrumValue& sinr) = 0; + virtual void GenerateCqiReport (const SpectrumValue& sinr) = 0; diff --git a/src/lte/model/lte-radio-bearer-tag.cc b/src/lte/model/lte-radio-bearer-tag.cc index 121e58129..d0ac726fe 100644 --- a/src/lte/model/lte-radio-bearer-tag.cc +++ b/src/lte/model/lte-radio-bearer-tag.cc @@ -109,7 +109,7 @@ LteRadioBearerTag::GetLcid () const void LteRadioBearerTag::Print (std::ostream &os) const { - os << "rnti=" << m_rnti << ", lcid=" << m_lcid; + os << "rnti=" << m_rnti << ", lcid=" << (uint16_t) m_lcid; } } // namespace ns3 diff --git a/src/lte/model/lte-rlc-am.cc b/src/lte/model/lte-rlc-am.cc index 530183a32..812fb3132 100644 --- a/src/lte/model/lte-rlc-am.cc +++ b/src/lte/model/lte-rlc-am.cc @@ -98,7 +98,7 @@ LteRlcAm::GetTypeId (void) void LteRlcAm::DoTransmitPdcpPdu (Ptr p) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << p->GetSize ()); /** Store arrival time */ Time now = Simulator::Now (); @@ -191,11 +191,15 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes) else if ( m_retxBufferSize > 0 ) { NS_LOG_LOGIC ("Sending data from Retransmission Buffer"); - - Ptr packet = m_retxBuffer.at (m_vtA.GetValue ()).m_pdu; + + Ptr packet = m_retxBuffer.at (m_vtA.GetValue ()).m_pdu->Copy (); if ( packet->GetSize () <= bytes ) { + LteRlcAmHeader rlcAmHeader; + packet->PeekHeader (rlcAmHeader); + NS_LOG_LOGIC ("AM RLC header: " << rlcAmHeader); + // Send RLC PDU to MAC layer LteMacSapProvider::TransmitPduParameters params; params.pdu = packet; @@ -205,6 +209,12 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes) m_macSapProvider->TransmitPdu (params); return; } + else + { + NS_LOG_LOGIC ("Tx opportunity too small for retransmission of the packet (" << packet->GetSize () << " bytes)"); + NS_LOG_LOGIC ("Waiting for bigger tx opportunity"); + return; + } } else if ( m_txonBufferSize > 0 ) { @@ -478,7 +488,12 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes) // Store new PDU into the Transmitted PDU Buffer NS_LOG_LOGIC ("Put transmitted PDU in the txedBuffer"); m_txedBufferSize += packet->GetSize (); - m_txedBuffer.at ( rlcAmHeader.GetSequenceNumber ().GetValue () ) = packet; + m_txedBuffer.at ( rlcAmHeader.GetSequenceNumber ().GetValue () ) = packet->Copy (); + + // Sender timestamp + RlcTag rlcTag (Simulator::Now ()); + packet->AddByteTag (rlcTag); + m_txPdu (m_rnti, m_lcid, packet->GetSize ()); // Send RLC PDU to MAC layer LteMacSapProvider::TransmitPduParameters params; @@ -498,11 +513,21 @@ LteRlcAm::DoNotifyHarqDeliveryFailure () void LteRlcAm::DoReceivePdu (Ptr p) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << p->GetSize ()); + + // Receiver timestamp + RlcTag rlcTag; + Time delay; + if (p->FindFirstMatchingByteTag (rlcTag)) + { + delay = Simulator::Now() - rlcTag.GetSenderTimestamp (); + } + m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ()); // Get RLC header parameters LteRlcAmHeader rlcAmHeader; p->PeekHeader (rlcAmHeader); + NS_LOG_LOGIC ("AM RLC header: " << rlcAmHeader); if ( rlcAmHeader.IsDataPdu () ) { @@ -893,7 +918,7 @@ LteRlcAm::DoReceivePdu (Ptr p) if (m_txedBuffer.at (seqNumberValue)) { NS_LOG_INFO ("Move SN = " << seqNumberValue << " to retxBuffer"); - m_retxBuffer.at (seqNumberValue).m_pdu = m_txedBuffer.at (seqNumberValue); + m_retxBuffer.at (seqNumberValue).m_pdu = m_txedBuffer.at (seqNumberValue)->Copy (); m_retxBuffer.at (seqNumberValue).m_retxCount = 0; m_retxBufferSize += m_retxBuffer.at (seqNumberValue).m_pdu->GetSize (); diff --git a/src/lte/model/lte-rlc-um.cc b/src/lte/model/lte-rlc-um.cc index 17757a125..906dc5466 100644 --- a/src/lte/model/lte-rlc-um.cc +++ b/src/lte/model/lte-rlc-um.cc @@ -382,7 +382,7 @@ LteRlcUm::DoReceivePdu (Ptr p) { delay = Simulator::Now() - rlcTag.GetSenderTimestamp (); } - m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ()); + m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ()); // 5.1.2.2 Receive operations diff --git a/src/lte/model/lte-sinr-chunk-processor.cc b/src/lte/model/lte-sinr-chunk-processor.cc index 70b1fac3c..aa29ad62f 100644 --- a/src/lte/model/lte-sinr-chunk-processor.cc +++ b/src/lte/model/lte-sinr-chunk-processor.cc @@ -74,7 +74,7 @@ LteCqiSinrChunkProcessor::End () NS_LOG_FUNCTION (this); if (m_totDuration.GetSeconds () > 0) { - m_phy->GenerateCqiFeedback ((*m_sumSinr) / m_totDuration.GetSeconds ()); + m_phy->GenerateCqiReport ((*m_sumSinr) / m_totDuration.GetSeconds ()); } else { diff --git a/src/lte/model/lte-spectrum-value-helper.cc b/src/lte/model/lte-spectrum-value-helper.cc index 1f7433ce2..a65cccfeb 100644 --- a/src/lte/model/lte-spectrum-value-helper.cc +++ b/src/lte/model/lte-spectrum-value-helper.cc @@ -65,7 +65,7 @@ struct EutraChannelNumbers { 17, 734, 5730, 5730, 5849, 704, 23730, 23730, 23849}, { 18, 860, 5850, 5850, 5999, 815, 23850, 23850, 23999}, { 19, 875, 6000, 6000, 6149, 830, 24000, 24000, 24149}, - { 20, 791, 6150, 6150, 6449, 832, 24150, 24150 - 24449}, + { 20, 791, 6150, 6150, 6449, 832, 24150, 24150, 24449}, { 21, 1495.9, 6450, 6450, 6599, 1447.9, 24450, 24450, 24599}, { 33, 1900, 36000, 36000, 36199, 1900, 36000, 36000, 36199}, { 34, 2010, 36200, 36200, 36349, 2010, 36200, 36200, 36349}, diff --git a/src/lte/model/lte-ue-mac.cc b/src/lte/model/lte-ue-mac.cc index a359bba4d..a457ff3ed 100644 --- a/src/lte/model/lte-ue-mac.cc +++ b/src/lte/model/lte-ue-mac.cc @@ -314,7 +314,7 @@ LteUeMac::DoConfigureUe (uint16_t rnti) void LteUeMac::DoAddLc (uint8_t lcId, LteMacSapUser* msu) { - NS_LOG_FUNCTION (this << " lcId" << lcId); + NS_LOG_FUNCTION (this << " lcId" << (uint16_t) lcId); NS_ASSERT_MSG (m_macSapUserMap.find (lcId) == m_macSapUserMap.end (), "cannot add channel because LCID " << lcId << " is already present"); m_macSapUserMap[lcId] = msu; } diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index aa277f503..269eb694e 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -152,6 +152,12 @@ LteUePhy::GetTypeId (void) MakeDoubleAccessor (&LteUePhy::SetNoiseFigure, &LteUePhy::GetNoiseFigure), MakeDoubleChecker ()) + .AddAttribute ("MacToChannelDelay", + "The delay in TTI units that occurs between a scheduling decision in the MAC and the actual start of the transmission by the PHY. This is intended to be used to model the latency of real PHY and MAC implementations.", + UintegerValue (1), + MakeUintegerAccessor (&LteUePhy::SetMacChDelay, + &LteUePhy::GetMacChDelay), + MakeUintegerChecker ()) ; return tid; } @@ -207,6 +213,19 @@ LteUePhy::GetTxPower () const return m_txPower; } +void +LteUePhy::SetMacChDelay (uint8_t delay) +{ + m_macChTtiDelay = delay; + m_packetBurstQueue.resize (delay); +} + +uint8_t +LteUePhy::GetMacChDelay (void) const +{ + return (m_macChTtiDelay); +} + void LteUePhy::DoSendMacPdu (Ptr p) { @@ -282,7 +301,7 @@ LteUePhy::CreateTxPowerSpectralDensity () } void -LteUePhy::GenerateCqiFeedback (const SpectrumValue& sinr) +LteUePhy::GenerateCqiReport (const SpectrumValue& sinr) { NS_LOG_FUNCTION (this); // check periodic wideband CQI diff --git a/src/lte/model/lte-ue-phy.h b/src/lte/model/lte-ue-phy.h index 9ebfb9f21..a8be19087 100644 --- a/src/lte/model/lte-ue-phy.h +++ b/src/lte/model/lte-ue-phy.h @@ -101,6 +101,16 @@ public: */ double GetNoiseFigure () const; + /** + * \param delay the TTI delay between MAC and channel + */ + void SetMacChDelay (uint8_t delay); + + /** + * \returns the TTI delay between MAC and channel + */ + uint8_t GetMacChDelay (void) const; + /** * \brief Queue the MAC PDU to be sent * \param p the MAC PDU to sent @@ -151,7 +161,7 @@ public: // inherited from LtePhy - virtual void GenerateCqiFeedback (const SpectrumValue& sinr); + virtual void GenerateCqiReport (const SpectrumValue& sinr); virtual void DoSendIdealControlMessage (Ptr msg); virtual void ReceiveIdealControlMessage (Ptr msg); diff --git a/src/lte/test/lte-test-ue-phy.cc b/src/lte/test/lte-test-ue-phy.cc index f93f2d23c..5009e28c0 100644 --- a/src/lte/test/lte-test-ue-phy.cc +++ b/src/lte/test/lte-test-ue-phy.cc @@ -78,7 +78,7 @@ LteTestUePhy::CreateTxPowerSpectralDensity () } void -LteTestUePhy::GenerateCqiFeedback (const SpectrumValue& sinr) +LteTestUePhy::GenerateCqiReport (const SpectrumValue& sinr) { NS_LOG_FUNCTION (this); diff --git a/src/lte/test/lte-test-ue-phy.h b/src/lte/test/lte-test-ue-phy.h index 2711f72c4..f0e96c35b 100644 --- a/src/lte/test/lte-test-ue-phy.h +++ b/src/lte/test/lte-test-ue-phy.h @@ -58,7 +58,7 @@ public: */ virtual Ptr CreateTxPowerSpectralDensity (); - virtual void GenerateCqiFeedback (const SpectrumValue& sinr); + virtual void GenerateCqiReport (const SpectrumValue& sinr); virtual void ReceiveIdealControlMessage (Ptr msg);