diff --git a/src/lte/helper/lte-helper.cc b/src/lte/helper/lte-helper.cc index 80e08127a..36e8f0407 100644 --- a/src/lte/helper/lte-helper.cc +++ b/src/lte/helper/lte-helper.cc @@ -116,6 +116,8 @@ LteHelper::DoStart (void) m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule); m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule); } + m_phyTxStats = CreateObject (); + m_phyRxStats = CreateObject (); m_macStats = CreateObject (); m_rlcStats = CreateObject ("RLC"); m_pdcpStats = CreateObject ("PDCP"); @@ -796,12 +798,16 @@ LteHelper::EnableLogComponents (void) LogComponentEnable ("LteEnbNetDevice", LOG_LEVEL_ALL); LogComponentEnable ("RadioBearerStatsCalculator", LOG_LEVEL_ALL); + LogComponentEnable ("LteStatsCalculator", LOG_LEVEL_ALL); LogComponentEnable ("MacStatsCalculator", LOG_LEVEL_ALL); + LogComponentEnable ("PhyTxStatsCalculator", LOG_LEVEL_ALL); + LogComponentEnable ("PhyRxStatsCalculator", LOG_LEVEL_ALL); } void LteHelper::EnableTraces (void) { + EnablePhyTraces (); EnableMacTraces (); EnableRlcTraces (); EnablePdcpTraces (); @@ -866,6 +872,29 @@ FindImsiFromEnbRlcPath (std::string path) } } + +uint64_t +FindImsiFromLteNetDevice (std::string path) +{ + NS_LOG_FUNCTION (path); + // Sample path input: + // /NodeList/#NodeId/DeviceList/#DeviceId/ + + // We retrieve the Imsi associated to the LteUeNetDevice + Config::MatchContainer match = Config::LookupMatches (path); + + if (match.GetN () != 0) + { + Ptr ueNetDevice = match.Get (0); + NS_LOG_LOGIC ("FindImsiFromLteNetDevice: " << path << ", " << ueNetDevice->GetObject ()->GetImsi ()); + return ueNetDevice->GetObject ()->GetImsi (); + } + else + { + NS_FATAL_ERROR ("Lookup " << path << " got no matches"); + } +} + uint16_t FindCellIdFromEnbRlcPath (std::string path) { @@ -876,7 +905,6 @@ FindCellIdFromEnbRlcPath (std::string path) // We retrieve the CellId associated to the Enb std::string enbNetDevicePath = path.substr (0, path.find ("/LteEnbRrc")); Config::MatchContainer match = Config::LookupMatches (enbNetDevicePath); - if (match.GetN () != 0) { Ptr enbNetDevice = match.Get (0); @@ -893,6 +921,7 @@ uint64_t FindImsiFromEnbMac (std::string path, uint16_t rnti) { NS_LOG_FUNCTION (path << rnti); + // /NodeList/#NodeId/DeviceList/#DeviceId/LteEnbMac/DlScheduling std::ostringstream oss; std::string p = path.substr (0, path.find ("/LteEnbMac")); @@ -918,6 +947,183 @@ FindCellIdFromEnbMac (std::string path, uint16_t rnti) } +uint64_t +FindImsiForEnb (std::string path, uint16_t rnti) +{ + NS_LOG_FUNCTION (path << rnti); + uint64_t imsi; + if (path.find ("/DlPhyTransmission")) + { + // /NodeList/0/DeviceList/0/LteEnbPhy/DlPhyTransmission/LteEnbRrc/UeMap/1 + std::ostringstream oss; + std::string p = path.substr (0, path.find ("/LteEnbPhy")); + oss << rnti; + p += "/LteEnbRrc/UeMap/" + oss.str (); + imsi = FindImsiFromEnbRlcPath (p); + NS_LOG_LOGIC ("FindImsiForEnb[Tx]: " << path << ", " << rnti << ", " << imsi); + } + else if (path.find ("/UIlPhyReception")) + { + std::string p = path.substr (0, path.find ("/LteUePhy")); + imsi = FindImsiFromLteNetDevice (p); + NS_LOG_LOGIC ("FindImsiForEnb[Rx]: " << path << ", " << rnti << ", " << imsi); + } + return imsi; +} + + +uint64_t +FindImsiForUe (std::string path, uint16_t rnti) +{ + NS_LOG_FUNCTION (path << rnti); + uint64_t imsi; + if (path.find ("/UIlPhyTransmission")) + { + std::string p = path.substr (0, path.find ("/LteUePhy")); + imsi = FindImsiFromLteNetDevice (p); + NS_LOG_LOGIC ("FindImsiForUe[Tx]: " << path << ", " << rnti << ", " << imsi); + } + else if (path.find ("/DIlPhyReception")) + { + // /NodeList/0/DeviceList/0/LteEnbPhy/LteSpectrumPhy + std::ostringstream oss; + std::string p = path.substr (0, path.find ("/LteEnbPhy")); + oss << rnti; + p += "/LteEnbRrc/UeMap/" + oss.str (); + imsi = FindImsiFromEnbRlcPath (p); + NS_LOG_LOGIC ("FindImsiForUe[Rx]: " << path << ", " << rnti << ", " << imsi); + } + return imsi; +} + +void +DlPhyTransmissionCallback (Ptr phyTxStats, + std::string path, PhyTransmissionStatParameters params) +{ + NS_LOG_FUNCTION (phyTxStats << path); + uint64_t imsi = 0; + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << params.m_rnti; + if (phyTxStats->ExistsImsiPath (pathAndRnti.str ()) == true) + { + imsi = phyTxStats->GetImsiPath (pathAndRnti.str ()); + } + else + { + imsi = FindImsiForEnb (path, params.m_rnti); + phyTxStats->SetImsiPath (pathAndRnti.str (), imsi); + } + + params.m_imsi = imsi; + phyTxStats->DlPhyTransmission (params); +} + +void +UlPhyTransmissionCallback (Ptr phyTxStats, + std::string path, PhyTransmissionStatParameters params) +{ + NS_LOG_FUNCTION (phyTxStats << path); + uint64_t imsi = 0; + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << params.m_rnti; + if (phyTxStats->ExistsImsiPath (pathAndRnti.str ()) == true) + { + imsi = phyTxStats->GetImsiPath (pathAndRnti.str ()); + } + else + { + imsi = FindImsiForUe (path, params.m_rnti); + phyTxStats->SetImsiPath (pathAndRnti.str (), imsi); + } + + params.m_imsi = imsi; + phyTxStats->UlPhyTransmission (params); +} + + +void +DlPhyReceptionCallback (Ptr phyRxStats, + std::string path, PhyReceptionStatParameters params) +{ + NS_LOG_FUNCTION (phyRxStats << path); + uint64_t imsi = 0; + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << params.m_rnti; + if (phyRxStats->ExistsImsiPath (pathAndRnti.str ()) == true) + { + imsi = phyRxStats->GetImsiPath (pathAndRnti.str ()); + } + else + { + imsi = FindImsiForUe (path, params.m_rnti); + phyRxStats->SetImsiPath (pathAndRnti.str (), imsi); + } + + params.m_imsi = imsi; + phyRxStats->DlPhyReception (params); +} + +void +UlPhyReceptionCallback (Ptr phyRxStats, + std::string path, PhyReceptionStatParameters params) +{ + NS_LOG_FUNCTION (phyRxStats << path); + uint64_t imsi = 0; + std::ostringstream pathAndRnti; + pathAndRnti << path << "/" << params.m_rnti; + if (phyRxStats->ExistsImsiPath (pathAndRnti.str ()) == true) + { + imsi = phyRxStats->GetImsiPath (pathAndRnti.str ()); + } + else + { + imsi = FindImsiForEnb (path, params.m_rnti); + phyRxStats->SetImsiPath (pathAndRnti.str (), imsi); + } + + params.m_imsi = imsi; + phyRxStats->UlPhyReception (params); +} + +void +LteHelper::EnablePhyTraces (void) +{ + EnableDlTxPhyTraces (); + EnableUlTxPhyTraces (); + EnableDlRxPhyTraces (); + EnableUlRxPhyTraces (); +} + +void +LteHelper::EnableDlTxPhyTraces (void) +{ + Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/DlPhyTransmission", + MakeBoundCallback (&DlPhyTransmissionCallback, m_phyTxStats)); +} + +void +LteHelper::EnableUlTxPhyTraces (void) +{ + Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/UlPhyTransmission", + MakeBoundCallback (&UlPhyTransmissionCallback, m_phyTxStats)); +} + +void +LteHelper::EnableDlRxPhyTraces (void) +{ + Config::Connect ("/NodeList/*/DeviceList/*/LteUePhy/DlSpectrumPhy/DlPhyReception", + MakeBoundCallback (&DlPhyReceptionCallback, m_phyRxStats)); +} + +void +LteHelper::EnableUlRxPhyTraces (void) +{ + Config::Connect ("/NodeList/*/DeviceList/*/LteEnbPhy/UlSpectrumPhy/UlPhyReception", + MakeBoundCallback (&UlPhyReceptionCallback, m_phyRxStats)); +} + + + void DlSchedulingCallback (Ptr macStats, std::string path, uint32_t frameNo, uint32_t subframeNo, @@ -952,6 +1158,8 @@ DlSchedulingCallback (Ptr macStats, macStats->DlScheduling (cellId, imsi, frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); } + + void LteHelper::EnableMacTraces (void) { diff --git a/src/lte/helper/lte-helper.h b/src/lte/helper/lte-helper.h index 869ea64d0..c180677d9 100644 --- a/src/lte/helper/lte-helper.h +++ b/src/lte/helper/lte-helper.h @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -292,10 +294,35 @@ public: void EnableLogComponents (void); /** - * Enables trace sinks for MAC, RLC and PDCP + * Enables trace sinks for PHY, MAC, RLC and PDCP */ void EnableTraces (void); + /** + * Enable trace sinks for PHY layer + */ + void EnablePhyTraces (void); + + /** + * Enable trace sinks for DL transmission PHY layer + */ + void EnableDlTxPhyTraces (void); + + /** + * Enable trace sinks for UL transmission PHY layer + */ + void EnableUlTxPhyTraces (void); + + /** + * Enable trace sinks for DL reception PHY layer + */ + void EnableDlRxPhyTraces (void); + + /** + * Enable trace sinks for UL reception PHY layer + */ + void EnableUlRxPhyTraces (void); + /** * Enable trace sinks for MAC layer */ @@ -381,6 +408,8 @@ private: std::string m_fadingModelType; ObjectFactory m_fadingModelFactory; + Ptr m_phyTxStats; + Ptr m_phyRxStats; Ptr m_macStats; Ptr m_rlcStats; Ptr m_pdcpStats; diff --git a/src/lte/helper/phy-rx-stats-calculator.cc b/src/lte/helper/phy-rx-stats-calculator.cc new file mode 100644 index 000000000..7d1656236 --- /dev/null +++ b/src/lte/helper/phy-rx-stats-calculator.cc @@ -0,0 +1,179 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Jaume Nin + * modified by: Marco Miozzo + * Convert MacStatsCalculator in PhyRxStatsCalculator + */ + +#include "phy-rx-stats-calculator.h" +#include "ns3/string.h" +#include +#include + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("PhyRxStatsCalculator"); + +NS_OBJECT_ENSURE_REGISTERED (PhyRxStatsCalculator); + +PhyRxStatsCalculator::PhyRxStatsCalculator () + : m_dlRxFirstWrite (true), + m_ulRxFirstWrite (true) +{ + NS_LOG_FUNCTION (this); + +} + +PhyRxStatsCalculator::~PhyRxStatsCalculator () +{ + NS_LOG_FUNCTION (this); +} + +TypeId +PhyRxStatsCalculator::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::PhyRxStatsCalculator") + .SetParent () + .AddConstructor () + .AddAttribute ("DlRxOutputFilename", + "Name of the file where the downlink results will be saved.", + StringValue ("DlRxPhyStats.txt"), + MakeStringAccessor (&PhyRxStatsCalculator::SetDlRxOutputFilename), + MakeStringChecker ()) + .AddAttribute ("UlRxOutputFilename", + "Name of the file where the uplink results will be saved.", + StringValue ("UlRxPhyStats.txt"), + MakeStringAccessor (&PhyRxStatsCalculator::SetUlRxOutputFilename), + MakeStringChecker ()) + ; + return tid; +} + +void +PhyRxStatsCalculator::SetUlRxOutputFilename (std::string outputFilename) +{ + LteStatsCalculator::SetUlOutputFilename (outputFilename); +} + +std::string +PhyRxStatsCalculator::GetUlRxOutputFilename (void) +{ + return LteStatsCalculator::GetUlOutputFilename (); +} + +void +PhyRxStatsCalculator::SetDlRxOutputFilename (std::string outputFilename) +{ + LteStatsCalculator::SetDlOutputFilename (outputFilename); +} + +std::string +PhyRxStatsCalculator::GetDlRxOutputFilename (void) +{ + return LteStatsCalculator::GetDlOutputFilename (); +} + +void +PhyRxStatsCalculator::DlPhyReception (PhyReceptionStatParameters params) +{ + NS_LOG_FUNCTION (this << params.m_cellId << params.m_imsi << params.m_timestamp << params.m_rnti << params.m_layer << params.m_mcs << params.m_size << params.m_rv << params.m_ndi << params.m_correctness); + NS_LOG_INFO ("Write DL Rx Phy Stats in " << GetDlRxOutputFilename ().c_str ()); + + std::ofstream outFile; + if ( m_dlRxFirstWrite == true ) + { + outFile.open (GetDlRxOutputFilename ().c_str ()); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetDlRxOutputFilename ().c_str ()); + return; + } + m_dlRxFirstWrite = false; + outFile << "% time\tcellId\tIMSI\tRNTI\ttxMode\tlayer\tmcs\tsize\trv\tndi\tcorrect"; + outFile << std::endl; + } + else + { + outFile.open (GetDlRxOutputFilename ().c_str (), std::ios_base::app); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetDlRxOutputFilename ().c_str ()); + return; + } + } + +// outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t"; + outFile << params.m_timestamp << "\t"; + outFile << (uint32_t) params.m_cellId << "\t"; + outFile << params.m_imsi << "\t"; + outFile << params.m_rnti << "\t"; + outFile << (uint32_t) params.m_txMode << "\t"; + outFile << (uint32_t) params.m_layer << "\t"; + outFile << (uint32_t) params.m_mcs << "\t"; + outFile << params.m_size << "\t"; + outFile << (uint32_t) params.m_rv << "\t"; + outFile << (uint32_t) params.m_ndi << "\t"; + outFile << (uint32_t) params.m_correctness << std::endl; + outFile.close (); +} + +void +PhyRxStatsCalculator::UlPhyReception (PhyReceptionStatParameters params) +{ + NS_LOG_FUNCTION (this << params.m_cellId << params.m_imsi << params.m_timestamp << params.m_rnti << params.m_layer << params.m_mcs << params.m_size << params.m_rv << params.m_ndi << params.m_correctness); + NS_LOG_INFO ("Write UL Rx Phy Stats in " << GetUlRxOutputFilename ().c_str ()); + + std::ofstream outFile; + if ( m_ulRxFirstWrite == true ) + { + outFile.open (GetUlRxOutputFilename ().c_str ()); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetUlRxOutputFilename ().c_str ()); + return; + } + m_ulRxFirstWrite = false; + outFile << "% time\tcellId\tIMSI\tRNTI\ttxMode\tlayer\tmcs\tsize\trv\tndi\tcorrect"; + outFile << std::endl; + } + else + { + outFile.open (GetUlRxOutputFilename ().c_str (), std::ios_base::app); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetUlRxOutputFilename ().c_str ()); + return; + } + } + +// outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t"; + outFile << params.m_timestamp << "\t"; + outFile << (uint32_t) params.m_cellId << "\t"; + outFile << params.m_imsi << "\t"; + outFile << params.m_rnti << "\t"; + outFile << (uint32_t) params.m_txMode << "\t"; + outFile << (uint32_t) params.m_layer << "\t"; + outFile << (uint32_t) params.m_mcs << "\t"; + outFile << params.m_size << "\t"; + outFile << (uint32_t) params.m_rv << "\t"; + outFile << (uint32_t) params.m_ndi << "\t"; + outFile << (uint32_t) params.m_correctness << std::endl; + outFile.close (); +} + +} // namespace ns3 diff --git a/src/lte/helper/phy-rx-stats-calculator.h b/src/lte/helper/phy-rx-stats-calculator.h new file mode 100644 index 000000000..3728fc171 --- /dev/null +++ b/src/lte/helper/phy-rx-stats-calculator.h @@ -0,0 +1,134 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Jaume Nin + * modified by: Marco Miozzo + * Convert MacStatsCalculator in PhyRxStatsCalculator + */ + +#ifndef PHY_RX_STATS_CALCULATOR_H_ +#define PHY_RX_STATS_CALCULATOR_H_ + +#include "ns3/lte-stats-calculator.h" +#include "ns3/nstime.h" +#include "ns3/uinteger.h" +#include +#include +#include + +namespace ns3 { + +/** + * Takes care of storing the information generated at PHY layer regarding + * reception. Metrics saved are: + *time\tframe\tsframe\tRNTI\tmcsTb1\tsizeTb1\tmcsTb2\tsizeTb2 + * - Timestamp (in seconds) + * - Frame index + * - Subframe index + * - C-RNTI + * - MCS for transport block 1 + * - Size of transport block 1 + * - MCS for transport block 2 (0 if not used) + * - Size of transport block 2 (0 if not used) + */ +class PhyRxStatsCalculator : public LteStatsCalculator +{ +public: + /** + * Constructor + */ + PhyRxStatsCalculator (); + + /** + * Destructor + */ + virtual ~PhyRxStatsCalculator (); + + /** + * Inherited from ns3::Object + */ + static TypeId GetTypeId (void); + + /** + * Set the name of the file where the UL Rx PHY statistics will be stored. + * + * \param outputFilename string with the name of the file + */ + void SetUlRxOutputFilename (std::string outputFilename); + + /** + * Get the name of the file where the UL RX PHY statistics will be stored. + */ + std::string GetUlRxOutputFilename (void); + + /** + * Set the name of the file where the DL RX PHY statistics will be stored. + * + * @param outputFilename string with the name of the file + */ + void SetDlRxOutputFilename (std::string outputFilename); + + /** + * Get the name of the file where the DL RX PHY statistics will be stored. + */ + std::string GetDlRxOutputFilename (void); + + /** + * Notifies the stats calculator that an downlink reception has occurred. + * @param cellId Cell ID of the attached Enb + * @param imsi IMSI of the scheduled UE + * @param frameNo Frame number + * @param subframeNo Subframe number + * @param rnti C-RNTI scheduled + * @param layer the layer (cw) of the transmission + * @param txMode the transmission Mode + * @param mcs MCS for transport block + * @param size Size of transport block + * @param rv the redundancy version (HARQ) + * @param ndi new data indicator flag + * @param correctness correctness of the TB received + */ + void DlPhyReception (PhyReceptionStatParameters params); + + /** + * Notifies the stats calculator that an uplink reception has occurred. + * @param cellId Cell ID of the attached Enb + * @param imsi IMSI of the scheduled UE + * @param frameNo Frame number + * @param subframeNo Subframe number + * @param rnti C-RNTI scheduled + * @param layer the layer (cw) of the transmission + * @param txMode the transmission Mode + * @param mcs MCS for transport block + * @param size Size of transport block + * @param rv the redundancy version (HARQ) + * @param ndi new data indicator flag + * @param correctness correctness of the TB received + */ + void UlPhyReception (PhyReceptionStatParameters params); + + +private: + + bool m_dlRxFirstWrite; + bool m_ulRxFirstWrite; + +}; + +} // namespace ns3 + +#endif /* PHY_RX_STATS_CALCULATOR_H_ */ diff --git a/src/lte/helper/phy-tx-stats-calculator.cc b/src/lte/helper/phy-tx-stats-calculator.cc new file mode 100644 index 000000000..c1594477f --- /dev/null +++ b/src/lte/helper/phy-tx-stats-calculator.cc @@ -0,0 +1,178 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Jaume Nin + * modified by: Marco Miozzo + * Convert MacStatsCalculator in PhyTxStatsCalculator + */ + +#include "phy-tx-stats-calculator.h" +#include "ns3/string.h" +#include +#include + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("PhyTxStatsCalculator"); + +NS_OBJECT_ENSURE_REGISTERED (PhyTxStatsCalculator); + +PhyTxStatsCalculator::PhyTxStatsCalculator () + : m_dlTxFirstWrite (true), + m_ulTxFirstWrite (true) +{ + NS_LOG_FUNCTION (this); + +} + +PhyTxStatsCalculator::~PhyTxStatsCalculator () +{ + NS_LOG_FUNCTION (this); +} + +TypeId +PhyTxStatsCalculator::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::PhyTxStatsCalculator") + .SetParent () + .AddConstructor () + .AddAttribute ("DlTxOutputFilename", + "Name of the file where the downlink results will be saved.", + StringValue ("DlTxPhyStats.txt"), + MakeStringAccessor (&PhyTxStatsCalculator::SetDlTxOutputFilename), + MakeStringChecker ()) + .AddAttribute ("UlTxOutputFilename", + "Name of the file where the uplink results will be saved.", + StringValue ("UlTxPhyStats.txt"), + MakeStringAccessor (&PhyTxStatsCalculator::SetUlTxOutputFilename), + MakeStringChecker ()) + ; + return tid; +} + +void +PhyTxStatsCalculator::SetUlTxOutputFilename (std::string outputFilename) +{ + LteStatsCalculator::SetUlOutputFilename (outputFilename); +} + +std::string +PhyTxStatsCalculator::GetUlTxOutputFilename (void) +{ + return LteStatsCalculator::GetUlOutputFilename (); +} + +void +PhyTxStatsCalculator::SetDlTxOutputFilename (std::string outputFilename) +{ + LteStatsCalculator::SetDlOutputFilename (outputFilename); +} + +std::string +PhyTxStatsCalculator::GetDlTxOutputFilename (void) +{ + return LteStatsCalculator::GetDlOutputFilename (); +} + +void +PhyTxStatsCalculator::DlPhyTransmission (PhyTransmissionStatParameters params) +{ + NS_LOG_FUNCTION (this << params.m_cellId << params.m_imsi << params.m_timestamp << params.m_rnti << params.m_layer << params.m_mcs << params.m_size << params.m_rv << params.m_ndi); + NS_LOG_INFO ("Write DL Tx Phy Stats in " << GetDlTxOutputFilename ().c_str ()); + + std::ofstream outFile; + if ( m_dlTxFirstWrite == true ) + { + outFile.open (GetDlOutputFilename ().c_str ()); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetDlTxOutputFilename ().c_str ()); + return; + } + m_dlTxFirstWrite = false; + //outFile << "% time\tcellId\tIMSI\tRNTI\tlayer\tmcs\tsize\trv\tndi"; // txMode is not available at dl tx side + outFile << "% time\tcellId\tIMSI\tRNTI\ttxMode\tlayer\tmcs\tsize\trv\tndi"; + outFile << std::endl; + } + else + { + outFile.open (GetDlTxOutputFilename ().c_str (), std::ios_base::app); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetDlTxOutputFilename ().c_str ()); + return; + } + } + +// outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t"; + outFile << params.m_timestamp << "\t"; + outFile << (uint32_t) params.m_cellId << "\t"; + outFile << params.m_imsi << "\t"; + outFile << params.m_rnti << "\t"; + //outFile << (uint32_t) params.m_txMode << "\t"; // txMode is not available at dl tx side + outFile << (uint32_t) params.m_layer << "\t"; + outFile << (uint32_t) params.m_mcs << "\t"; + outFile << params.m_size << "\t"; + outFile << (uint32_t) params.m_rv << "\t"; + outFile << (uint32_t) params.m_ndi << std::endl; + outFile.close (); +} + +void +PhyTxStatsCalculator::UlPhyTransmission (PhyTransmissionStatParameters params) +{ + NS_LOG_FUNCTION (this << params.m_cellId << params.m_imsi << params.m_timestamp << params.m_rnti << params.m_layer << params.m_mcs << params.m_size << params.m_rv << params.m_ndi); + NS_LOG_INFO ("Write UL Tx Phy Stats in " << GetUlTxOutputFilename ().c_str ()); + + std::ofstream outFile; + if ( m_ulTxFirstWrite == true ) + { + outFile.open (GetUlTxOutputFilename ().c_str ()); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetUlTxOutputFilename ().c_str ()); + return; + } + m_ulTxFirstWrite = false; + outFile << "% time\tcellId\tIMSI\tRNTI\ttxMode\tlayer\tmcs\tsize\trv\tndi"; + outFile << std::endl; + } + else + { + outFile.open (GetUlTxOutputFilename ().c_str (), std::ios_base::app); + if (!outFile.is_open ()) + { + NS_LOG_ERROR ("Can't open file " << GetUlTxOutputFilename ().c_str ()); + return; + } + } + +// outFile << Simulator::Now ().GetNanoSeconds () / (double) 1e9 << "\t"; + outFile << params.m_timestamp << "\t"; + outFile << (uint32_t) params.m_cellId << "\t"; + outFile << params.m_imsi << "\t"; + outFile << params.m_rnti << "\t"; + outFile << (uint32_t) params.m_txMode << "\t"; + outFile << (uint32_t) params.m_layer << "\t"; + outFile << (uint32_t) params.m_mcs << "\t"; + outFile << params.m_size << "\t"; + outFile << (uint32_t) params.m_rv << "\t"; + outFile << (uint32_t) params.m_ndi << std::endl; + outFile.close (); +} + +} // namespace ns3 diff --git a/src/lte/helper/phy-tx-stats-calculator.h b/src/lte/helper/phy-tx-stats-calculator.h new file mode 100644 index 000000000..99b3ac633 --- /dev/null +++ b/src/lte/helper/phy-tx-stats-calculator.h @@ -0,0 +1,134 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Jaume Nin + * modified by: Marco Miozzo + * Convert MacStatsCalculator in PhyTxStatsCalculator + */ + +#ifndef PHY_TX_STATS_CALCULATOR_H_ +#define PHY_TX_STATS_CALCULATOR_H_ + +#include "ns3/lte-stats-calculator.h" +#include "ns3/nstime.h" +#include "ns3/uinteger.h" +#include +#include +#include + +namespace ns3 { + + + +/** + * Takes care of storing the information generated at PHY layer regarding + * transmission. Metrics saved are: + *time\tframe\tsframe\tRNTI\tmcsTb1\tsizeTb1\tmcsTb2\tsizeTb2 + * - Timestamp (in seconds) + * - Frame index + * - Subframe index + * - C-RNTI + * - MCS for transport block 1 + * - Size of transport block 1 + * - MCS for transport block 2 (0 if not used) + * - Size of transport block 2 (0 if not used) + */ +class PhyTxStatsCalculator : public LteStatsCalculator +{ +public: + /** + * Constructor + */ + PhyTxStatsCalculator (); + + /** + * Destructor + */ + virtual ~PhyTxStatsCalculator (); + + /** + * Inherited from ns3::Object + */ + static TypeId GetTypeId (void); + + /** + * Set the name of the file where the UL Tx PHY statistics will be stored. + * + * \param outputFilename string with the name of the file + */ + void SetUlTxOutputFilename (std::string outputFilename); + + /** + * Get the name of the file where the UL RX PHY statistics will be stored. + */ + std::string GetUlTxOutputFilename (void); + + /** + * Set the name of the file where the DL TX PHY statistics will be stored. + * + * @param outputFilename string with the name of the file + */ + void SetDlTxOutputFilename (std::string outputFilename); + + /** + * Get the name of the file where the DL TX PHY statistics will be stored. + */ + std::string GetDlTxOutputFilename (void); + + /** + * Notifies the stats calculator that an downlink trasmission has occurred. + * @param cellId Cell ID of the attached Enb + * @param imsi IMSI of the scheduled UE + * @param frameNo Frame number + * @param subframeNo Subframe number + * @param rnti C-RNTI scheduled + * @param layer the layer (cw) of the transmission + * @param txMode the transmission Mode + * @param mcs MCS for transport block + * @param size Size of transport block + * @param rv the redundancy version (HARQ) + * @param ndi new data indicator flag + */ + void DlPhyTransmission (PhyTransmissionStatParameters params); + + /** + * Notifies the stats calculator that an uplink trasmission has occurred. + * @param cellId Cell ID of the attached Enb + * @param imsi IMSI of the scheduled UE + * @param frameNo Frame number + * @param subframeNo Subframe number + * @param rnti C-RNTI scheduled + * @param layer the layer (cw) of the transmission + * @param txMode the transmission Mode + * @param mcs MCS for transport block + * @param size Size of transport block + * @param rv the redundancy version (HARQ) + * @param ndi new data indicator flag + */ + void UlPhyTransmission (PhyTransmissionStatParameters params); + + +private: + + bool m_dlTxFirstWrite; + bool m_ulTxFirstWrite; + +}; + +} // namespace ns3 + +#endif /* PHY_TX_STATS_CALCULATOR_H_ */ diff --git a/src/lte/model/lte-common.h b/src/lte/model/lte-common.h index 1e298924d..1d49a59ad 100644 --- a/src/lte/model/lte-common.h +++ b/src/lte/model/lte-common.h @@ -117,6 +117,37 @@ class TransmissionModesLayers }; +struct PhyTransmissionStatParameters +{ + int64_t m_timestamp; // in millisecond + uint16_t m_cellId; + uint64_t m_imsi; + uint16_t m_rnti; + uint8_t m_txMode; + uint8_t m_layer; + uint8_t m_mcs; + uint16_t m_size; + uint8_t m_rv; + uint8_t m_ndi; +}; + + +struct PhyReceptionStatParameters +{ + int64_t m_timestamp; // in millisecond + uint16_t m_cellId; + uint64_t m_imsi; + uint16_t m_rnti; + uint8_t m_txMode; + uint8_t m_layer; + uint8_t m_mcs; + uint16_t m_size; + uint8_t m_rv; + uint8_t m_ndi; + uint8_t m_correctness; +}; + + }; // namespace ns3 diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 0a5b7364b..f64189e6a 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -42,6 +42,7 @@ #include #include #include +#include NS_LOG_COMPONENT_DEFINE ("LteEnbPhy"); @@ -194,6 +195,21 @@ LteEnbPhy::GetTypeId (void) UintegerValue (1), MakeUintegerAccessor (&LteEnbPhy::m_interferenceSamplePeriod), MakeUintegerChecker ()) + .AddTraceSource ("DlPhyTransmission", + "DL transmission PHY layer statistics.", + MakeTraceSourceAccessor (&LteEnbPhy::m_dlPhyTransmission)) + .AddAttribute ("DlSpectrumPhy", + "The downlink LteSpectrumPhy associated to this LtePhy", + TypeId::ATTR_GET, + PointerValue (), + MakePointerAccessor (&LteEnbPhy::m_downlinkSpectrumPhy), + MakePointerChecker ()) + .AddAttribute ("UlSpectrumPhy", + "The uplink LteSpectrumPhy associated to this LtePhy", + TypeId::ATTR_GET, + PointerValue (), + MakePointerAccessor (&LteEnbPhy::m_uplinkSpectrumPhy), + MakePointerChecker ()) ; return tid; } @@ -500,7 +516,7 @@ LteEnbPhy::StartSubFrame (void) { rbMap.push_back (i); } - m_uplinkSpectrumPhy->AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_ndi, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 /* always SISO*/, 0 /* no HARQ proc id in UL*/, false /* UL*/); + m_uplinkSpectrumPhy->AddExpectedTb ((*dciIt).GetDci ().m_rnti, (*dciIt).GetDci ().m_ndi, (*dciIt).GetDci ().m_tbSize, (*dciIt).GetDci ().m_mcs, rbMap, 0 /* always SISO*/, 0 /* no HARQ proc id in UL*/, 0 /*evaluated by LteSpectrumPhy*/, false /* UL*/); if ((*dciIt).GetDci ().m_ndi==1) { NS_LOG_DEBUG (this << " RNTI " << (*dciIt).GetDci ().m_rnti << " NEW TB"); @@ -525,21 +541,38 @@ LteEnbPhy::StartSubFrame (void) if (msg->GetMessageType () == LteControlMessage::DL_DCI) { Ptr dci = DynamicCast (msg); - // get the tx power spectral density according to DL-DCI(s) - // translate the DCI to Spectrum framework - uint32_t mask = 0x1; - for (int i = 0; i < 32; i++) + // get the tx power spectral density according to DL-DCI(s) + // translate the DCI to Spectrum framework + uint32_t mask = 0x1; + for (int i = 0; i < 32; i++) + { + if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1) { - if (((dci->GetDci ().m_rbBitmap & mask) >> i) == 1) + for (int k = 0; k < GetRbgSize (); k++) { - for (int k = 0; k < GetRbgSize (); k++) - { - m_dlDataRbMap.push_back ((i * GetRbgSize ()) + k); - //NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k); - } + m_dlDataRbMap.push_back ((i * GetRbgSize ()) + k); + //NS_LOG_DEBUG(this << " [enb]DL-DCI allocated PRB " << (i*GetRbgSize()) + k); } - mask = (mask << 1); } + mask = (mask << 1); + } + // fire trace of DL Tx PHY stats + for (uint8_t i = 0; i < dci->GetDci ().m_mcs.size (); i++) + { + PhyTransmissionStatParameters params; + params.m_cellId = m_cellId; + params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper + params.m_timestamp = Simulator::Now ().GetMilliSeconds (); + params.m_rnti = dci->GetDci ().m_rnti; + params.m_txMode = 0; // TBD + params.m_layer = i; + params.m_mcs = dci->GetDci ().m_mcs.at (i); + params.m_size = dci->GetDci ().m_tbsSize.at (i); + params.m_rv = dci->GetDci ().m_rv.at (i); + params.m_ndi = dci->GetDci ().m_ndi.at (i); + m_dlPhyTransmission (params); + } + } else if (msg->GetMessageType () == LteControlMessage::UL_DCI) { diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index ec441cd5f..72f67f4d4 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -307,6 +307,12 @@ private: TracedCallback > m_reportInterferenceTrace; uint16_t m_interferenceSamplePeriod; uint16_t m_interferenceSampleCounter; + + /** + * Trace information regarding PHY stats from UL Tx perspective + * PhyTrasmissionStatParameters see lte-common.h + */ + TracedCallback m_dlPhyTransmission; }; diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index 8c9f15d41..f52afa4b8 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -37,6 +37,7 @@ #include #include #include +#include NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy"); @@ -114,8 +115,7 @@ NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy); LteSpectrumPhy::LteSpectrumPhy () : m_state (IDLE), m_transmissionMode (0), - m_layersNum (1), - errors (0) + m_layersNum (1) { NS_LOG_FUNCTION (this); m_random = CreateObject (); @@ -211,6 +211,12 @@ LteSpectrumPhy::GetTypeId (void) BooleanValue (true), MakeBooleanAccessor (&LteSpectrumPhy::m_ctrlErrorModelEnabled), MakeBooleanChecker ()) + .AddTraceSource ("DlPhyReception", + "DL reception PHY layer statistics.", + MakeTraceSourceAccessor (&LteSpectrumPhy::m_dlPhyReception)) + .AddTraceSource ("UlPhyReception", + "DL reception PHY layer statistics.", + MakeTraceSourceAccessor (&LteSpectrumPhy::m_ulPhyReception)) ; return tid; } @@ -782,9 +788,9 @@ LteSpectrumPhy::UpdateSinrPerceived (const SpectrumValue& sinr) void -LteSpectrumPhy::AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector map, uint8_t layer, uint8_t harqId, bool downlink) +LteSpectrumPhy::AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector map, uint8_t layer, uint8_t harqId,uint8_t rv, bool downlink) { - NS_LOG_FUNCTION (this << " rnti: " << rnti << " NDI " << (uint16_t)ndi << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint16_t)layer); + NS_LOG_FUNCTION (this << " rnti: " << rnti << " NDI " << (uint16_t)ndi << " size " << size << " mcs " << (uint16_t)mcs << " layer " << (uint16_t)layer << " rv " << (uint16_t)rv); TbId_t tbId; tbId.m_rnti = rnti; tbId.m_layer = layer; @@ -796,8 +802,7 @@ LteSpectrumPhy::AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8 m_expectedTbs.erase (it); } // insert new entry - std::vector rv; - tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, 0.0, downlink, false}; + tbInfo_t tbInfo = {ndi, size, mcs, map, harqId, 0.0, rv, downlink, false}; m_expectedTbs.insert (std::pair (tbId,tbInfo)); } @@ -845,6 +850,30 @@ LteSpectrumPhy::EndRxData () (*itTb).second.mi = tbStats.mi; (*itTb).second.corrupt = m_random->GetValue () > tbStats.tbler ? false : true; NS_LOG_DEBUG (this << "RNTI " << (*itTb).first.m_rnti << " size " << (*itTb).second.size << " mcs " << (uint32_t)(*itTb).second.mcs << " bitmap " << (*itTb).second.rbBitmap.size () << " layer " << (uint16_t)(*itTb).first.m_layer << " TBLER " << tbStats.tbler << " corrupted " << (*itTb).second.corrupt); + // fire traces on DL/UL reception PHY stats + PhyReceptionStatParameters params; + params.m_timestamp = Simulator::Now ().GetMilliSeconds (); + params.m_cellId = m_cellId; + params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper + params.m_rnti = (*itTb).first.m_rnti; + params.m_txMode = m_transmissionMode; + params.m_layer = (*itTb).first.m_layer; + params.m_mcs = (*itTb).second.mcs; + params.m_size = (*itTb).second.size; + params.m_rv = (*itTb).second.rv; + params.m_ndi = (*itTb).second.ndi; + params.m_correctness = (uint8_t)!(*itTb).second.corrupt; + if ((*itTb).second.downlink) + { + // DL + m_dlPhyReception (params); + } + else + { + // UL + params.m_rv = harqInfoList.size (); + m_ulPhyReception (params); + } } itTb++; diff --git a/src/lte/model/lte-spectrum-phy.h b/src/lte/model/lte-spectrum-phy.h index 8b5213695..44a149e20 100644 --- a/src/lte/model/lte-spectrum-phy.h +++ b/src/lte/model/lte-spectrum-phy.h @@ -65,6 +65,7 @@ struct tbInfo_t uint8_t mcs; std::vector rbBitmap; uint8_t harqProcessId; + uint8_t rv; double mi; bool downlink; bool corrupt; @@ -338,7 +339,7 @@ public: * \param harqId the id of the HARQ process (valid only for DL) * \param downlink true when the TB is for DL */ - void AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector map, uint8_t layer, uint8_t harqId, bool downlink); + void AddExpectedTb (uint16_t rnti, uint8_t ndi, uint16_t size, uint8_t mcs, std::vector map, uint8_t layer, uint8_t harqId, uint8_t rv, bool downlink); /** @@ -437,7 +438,19 @@ private: LtePhyDlHarqFeedbackCallback m_ltePhyDlHarqFeedbackCallback; LtePhyUlHarqFeedbackCallback m_ltePhyUlHarqFeedbackCallback; - uint16_t errors; // DEBUG + + /** + * Trace information regarding PHY stats from DL Rx perspective + * PhyReceptionStatParameters (see lte-common.h) + */ + TracedCallback m_dlPhyReception; + + + /** + * Trace information regarding PHY stats from UL Rx perspective + * PhyReceptionStatParameters (see lte-common.h) + */ + TracedCallback m_ulPhyReception; }; diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index 569f1b1c0..96b0748fc 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -36,7 +36,7 @@ #include "ff-mac-common.h" #include "lte-sinr-chunk-processor.h" #include - +#include NS_LOG_COMPONENT_DEFINE ("LteUePhy"); @@ -239,6 +239,21 @@ LteUePhy::GetTypeId (void) UintegerValue (1), MakeUintegerAccessor (&LteUePhy::m_rsrpRsrqSamplePeriod), MakeUintegerChecker ()) + .AddTraceSource ("UlPhyTransmission", + "DL transmission PHY layer statistics.", + MakeTraceSourceAccessor (&LteUePhy::m_ulPhyTransmission)) + .AddAttribute ("DlSpectrumPhy", + "The downlink LteSpectrumPhy associated to this LtePhy", + TypeId::ATTR_GET, + PointerValue (), + MakePointerAccessor (&LteUePhy::m_downlinkSpectrumPhy), + MakePointerChecker ()) + .AddAttribute ("UlSpectrumPhy", + "The uplink LteSpectrumPhy associated to this LtePhy", + TypeId::ATTR_GET, + PointerValue (), + MakePointerAccessor (&LteUePhy::m_uplinkSpectrumPhy), + MakePointerChecker ()) ; return tid; } @@ -598,7 +613,7 @@ LteUePhy::ReceiveLteControlMessageList (std::list > msgLi NS_LOG_DEBUG (this << " UE " << m_rnti << " DL-DCI " << dci.m_rnti << " bitmap " << dci.m_rbBitmap); for (uint8_t i = 0; i < dci.m_tbsSize.size (); i++) { - m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_ndi.at (i), dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i, dci.m_harqProcess, true /* DL */); + m_downlinkSpectrumPhy->AddExpectedTb (dci.m_rnti, dci.m_ndi.at (i), dci.m_tbsSize.at (i), dci.m_mcs.at (i), dlRb, i, dci.m_harqProcess, dci.m_rv.at (i), true /* DL */); } SetSubChannelsForReception (dlRb); @@ -623,6 +638,20 @@ LteUePhy::ReceiveLteControlMessageList (std::list > msgLi //NS_LOG_DEBUG (this << " UE RB " << i + dci.m_rbStart); } QueueSubChannelsForTransmission (ulRb); + // fire trace of UL Tx PHY stats + HarqProcessInfoList_t harqInfoList = m_harqPhyModule->GetHarqProcessInfoUl (m_rnti, 0); + PhyTransmissionStatParameters params; + params.m_cellId = m_cellId; + params.m_imsi = 0; // it will be set by DlPhyTransmissionCallback in LteHelper + params.m_timestamp = Simulator::Now ().GetMilliSeconds () + UL_PUSCH_TTIS_DELAY; + params.m_rnti = m_rnti; + params.m_txMode = 0; // always SISO for UE + params.m_layer = 0; + params.m_mcs = dci.m_mcs; + params.m_size = dci.m_tbSize; + params.m_rv = harqInfoList.size (); + params.m_ndi = dci.m_ndi; + m_ulPhyTransmission (params); // pass the info to the MAC m_uePhySapUser->ReceiveLteControlMessage (msg); } diff --git a/src/lte/model/lte-ue-phy.h b/src/lte/model/lte-ue-phy.h index 53ea0d653..a684195e7 100644 --- a/src/lte/model/lte-ue-phy.h +++ b/src/lte/model/lte-ue-phy.h @@ -278,6 +278,12 @@ private: uint16_t m_rsrpRsrqSamplePeriod; uint16_t m_rsrpRsrqSampleCounter; + /** + * Trace information regarding PHY stats from DL Tx perspective + * PhyTrasmissionStatParameters see lte-common.h + */ + TracedCallback m_ulPhyTransmission; + }; diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index f65f7fcba..546ee4cdf 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -737,7 +737,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched std::map ::iterator it = m_dlHarqProcessesStatus.find (rnti); if (it == m_dlHarqProcessesStatus.end ()) { - NS_FATAL_ERROR ("No info found in HARQ buffer for UE " << m_dlInfoListBuffered.at (i).m_rnti); + NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << m_dlInfoListBuffered.at (i).m_rnti); } (*it).second.at (harqId) = 0; std::map ::iterator itRlcPdu = m_dlHarqProcessesRlcPduListBuffer.find (rnti); @@ -1359,20 +1359,20 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched itProcId = m_ulHarqCurrentProcessId.find (rnti); if (itProcId == m_ulHarqCurrentProcessId.end ()) { - NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); + NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti); } uint8_t harqId = (uint8_t)((*itProcId).second - HARQ_PERIOD) % HARQ_PROC_NUM; NS_LOG_INFO (this << " UL-HARQ retx RNTI " << rnti << " harqId " << (uint16_t)harqId); std::map ::iterator itHarq = m_ulHarqProcessesDciBuffer.find (rnti); if (itHarq == m_ulHarqProcessesDciBuffer.end ()) { - NS_FATAL_ERROR ("No info find in UL-HARQ buffer for UE " << rnti); + NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti); } UlDciListElement_s dci = (*itHarq).second.at (harqId); std::map ::iterator itStat = m_ulHarqProcessesStatus.find (rnti); if (itStat == m_ulHarqProcessesStatus.end ()) { - NS_FATAL_ERROR ("No info find in HARQ buffer for UE " << rnti); + NS_LOG_ERROR ("No info find in HARQ buffer for UE (might change eNB) " << rnti); } if ((*itStat).second.at (harqId) >= 3) { diff --git a/src/lte/wscript b/src/lte/wscript index 8658d59e7..1da8986d5 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -43,6 +43,8 @@ def build(bld): 'helper/radio-bearer-stats-calculator.cc', 'helper/radio-bearer-stats-connector.cc', 'helper/mac-stats-calculator.cc', + 'helper/phy-tx-stats-calculator.cc', + 'helper/phy-rx-stats-calculator.cc', 'helper/radio-environment-map-helper.cc', 'helper/lte-hex-grid-enb-topology-helper.cc', 'model/rem-spectrum-phy.cc', @@ -162,6 +164,8 @@ def build(bld): 'helper/lte-stats-calculator.h', 'helper/epc-helper.h', 'helper/mac-stats-calculator.h', + 'helper/phy-tx-stats-calculator.h', + 'helper/phy-rx-stats-calculator.h', 'helper/radio-bearer-stats-calculator.h', 'helper/radio-bearer-stats-connector.h', 'helper/radio-environment-map-helper.h',