diff --git a/src/lte/test/lte-test-downlink-sinr.cc b/src/lte/test/lte-test-downlink-sinr.cc index 963bb6492..5fa0fb69f 100644 --- a/src/lte/test/lte-test-downlink-sinr.cc +++ b/src/lte/test/lte-test-downlink-sinr.cc @@ -23,8 +23,8 @@ #include "ns3/log.h" #include "ns3/lte-phy-tag.h" -#include "ns3/lte-ue-phy.h" -#include "ns3/lte-test-sinr-chunk-processor.h" +#include "ns3/lte-test-ue-phy.h" +#include "ns3/lte-sinr-chunk-processor.h" #include "ns3/lte-test-downlink-sinr.h" @@ -46,7 +46,7 @@ LteDownlinkSinrTestSuite::LteDownlinkSinrTestSuite () { LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); - LogComponentEnable ("LteTestSinrChunkProcessor", logLevel); + LogComponentEnable ("LteTestUePhy", logLevel); LogComponentEnable ("LteDownlinkSinrTest", logLevel); NS_LOG_INFO ("Creating LteDownlinkSinrTestSuite"); @@ -155,11 +155,11 @@ LteDownlinkSinrTestCase::DoRun (void) */ Ptr dlPhy = CreateObject (); Ptr ulPhy = CreateObject (); - Ptr uePhy = CreateObject (dlPhy, ulPhy); + Ptr uePhy = CreateObject (dlPhy, ulPhy); dlPhy->SetCellId (100); - Ptr chunkProcessor = Create (uePhy->GetObject ()); + Ptr chunkProcessor = Create (uePhy->GetObject ()); dlPhy->AddSinrChunkProcessor (chunkProcessor); /** @@ -261,7 +261,7 @@ LteDownlinkSinrTestCase::DoRun (void) * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond * to known values which have been calculated offline (with octave) for the generated signals */ - SpectrumValue calculatedSinr = chunkProcessor->GetSinr (); + SpectrumValue calculatedSinr = uePhy->GetSinr (); NS_LOG_INFO ("Theoretical SINR: " << *m_sinr); NS_LOG_INFO ("Calculated SINR: " << calculatedSinr); diff --git a/src/lte/test/lte-test-ue-phy.cc b/src/lte/test/lte-test-ue-phy.cc new file mode 100644 index 000000000..8834cafbe --- /dev/null +++ b/src/lte/test/lte-test-ue-phy.cc @@ -0,0 +1,103 @@ +/* -*- 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: Manuel Requena + */ + +#include "ns3/lte-test-ue-phy.h" + +NS_LOG_COMPONENT_DEFINE ("LteTestUePhy"); + +namespace ns3 { + + +NS_OBJECT_ENSURE_REGISTERED (LteTestUePhy); + +LteTestUePhy::LteTestUePhy () +{ + NS_LOG_FUNCTION (this); + NS_FATAL_ERROR ("This constructor should not be called"); +} + +LteTestUePhy::LteTestUePhy (Ptr dlPhy, Ptr ulPhy) + : LtePhy (dlPhy, ulPhy) +{ + NS_LOG_FUNCTION (this); +} + +LteTestUePhy::~LteTestUePhy () +{ +} + +void +LteTestUePhy::DoDispose () +{ + NS_LOG_FUNCTION (this); + + LtePhy::DoDispose (); +} + +TypeId +LteTestUePhy::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::LteTestUePhy") + .SetParent () + .AddConstructor () + ; + return tid; +} + +void +LteTestUePhy::DoSendMacPdu (Ptr p) +{ + NS_LOG_FUNCTION (this); +} + +Ptr +LteTestUePhy::CreateTxPowerSpectralDensity () +{ + NS_LOG_FUNCTION (this); + Ptr psd; + + return psd; +} + +void +LteTestUePhy::GenerateCqiFeedback (const SpectrumValue& sinr) +{ + NS_LOG_FUNCTION (this); + + // Store calculated SINR, it will be retrieved at the end of the test + m_sinr = sinr; +} + +void +LteTestUePhy::ReceiveIdealControlMessage (Ptr msg) +{ + NS_LOG_FUNCTION (this << msg); +} + +SpectrumValue +LteTestUePhy::GetSinr () +{ + NS_LOG_FUNCTION (this); + + return m_sinr; +} + + +} // namespace ns3 diff --git a/src/lte/test/lte-test-ue-phy.h b/src/lte/test/lte-test-ue-phy.h new file mode 100644 index 000000000..2711f72c4 --- /dev/null +++ b/src/lte/test/lte-test-ue-phy.h @@ -0,0 +1,74 @@ +/* -*- 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: Manuel Requena : Based on lte-ue-phy code + */ + +#ifndef LTE_TEST_UE_PHY_H +#define LTE_TEST_UE_PHY_H + +#include "ns3/lte-phy.h" + +#include "ns3/ideal-control-messages.h" + +namespace ns3 { + +class LteTestUePhy : public LtePhy +{ +public: + /** + * @warning the default constructor should not be used + */ + LteTestUePhy (); + + /** + * \param dlPhy the downlink LteSpectrumPhy instance + * \param ulPhy the uplink LteSpectrumPhy instance + */ + LteTestUePhy (Ptr dlPhy, Ptr ulPhy); + + virtual ~LteTestUePhy (); + + virtual void DoDispose (); + static TypeId GetTypeId (void); + + /** + * \brief Queue the MAC PDU to be sent + * \param p the MAC PDU to sent + */ + virtual void DoSendMacPdu (Ptr p); + + /** + * \brief Create the PSD for the TX + * \return the pointer to the PSD + */ + virtual Ptr CreateTxPowerSpectralDensity (); + + virtual void GenerateCqiFeedback (const SpectrumValue& sinr); + + virtual void ReceiveIdealControlMessage (Ptr msg); + + SpectrumValue GetSinr (); + +private: + SpectrumValue m_sinr; +}; + + +} // namespace ns3 + +#endif /* LTE_TEST_UE_PHY_H */ diff --git a/src/lte/test/lte-test-uplink-sinr.cc b/src/lte/test/lte-test-uplink-sinr.cc index cca228b81..bfbc45383 100644 --- a/src/lte/test/lte-test-uplink-sinr.cc +++ b/src/lte/test/lte-test-uplink-sinr.cc @@ -23,8 +23,8 @@ #include "ns3/log.h" #include "ns3/lte-phy-tag.h" -#include "ns3/lte-ue-phy.h" -#include "ns3/lte-test-sinr-chunk-processor.h" +#include "ns3/lte-test-ue-phy.h" +#include "ns3/lte-sinr-chunk-processor.h" #include "ns3/lte-test-uplink-sinr.h" @@ -45,7 +45,7 @@ LteUplinkSinrTestSuite::LteUplinkSinrTestSuite () { LogLevel logLevel = (LogLevel)(LOG_PREFIX_FUNC | LOG_PREFIX_TIME | LOG_LEVEL_ALL); - LogComponentEnable ("LteTestSinrChunkProcessor", logLevel); + LogComponentEnable ("LteTestUePhy", logLevel); LogComponentEnable ("LteUplinkSinrTest", logLevel); NS_LOG_INFO ("Creating LteUplinkSinrTestSuite"); @@ -163,11 +163,11 @@ LteUplinkSinrTestCase::DoRun (void) */ Ptr dlPhy = CreateObject (); Ptr ulPhy = CreateObject (); - Ptr uePhy = CreateObject (dlPhy, ulPhy); + Ptr uePhy = CreateObject (dlPhy, ulPhy); ulPhy->SetCellId (100); - Ptr chunkProcessor = Create (uePhy->GetObject ()); + Ptr chunkProcessor = Create (uePhy->GetObject ()); ulPhy->AddSinrChunkProcessor (chunkProcessor); /** @@ -295,7 +295,7 @@ LteUplinkSinrTestCase::DoRun (void) * Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond * to known values which have been calculated offline (with octave) for the generated signals */ - SpectrumValue calculatedSinr = chunkProcessor->GetSinr (); + SpectrumValue calculatedSinr = uePhy->GetSinr (); NS_LOG_INFO ("Theoretical SINR: " << *m_sinr); NS_LOG_INFO ("Calculated SINR: " << calculatedSinr); diff --git a/src/lte/wscript b/src/lte/wscript index 97efef15d..b9325ca6b 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -49,6 +49,7 @@ def build(bld): 'test/lte-test-downlink-sinr.cc', 'test/lte-test-uplink-sinr.cc', 'test/lte-test-sinr-chunk-processor.cc', + 'test/lte-test-ue-phy.cc', 'test/lte-test-rr-ff-mac-scheduler.cc', 'test/lte-test-pf-ff-mac-scheduler.cc', 'test/lte-test-earfcn.cc', @@ -103,6 +104,7 @@ def build(bld): 'test/lte-test-downlink-sinr.h', 'test/lte-test-uplink-sinr.h', 'test/lte-test-sinr-chunk-processor.h', + 'test/lte-test-ue-phy.h', 'test/lte-test-rr-ff-mac-scheduler.h', 'test/lte-test-pf-ff-mac-scheduler.h', ]