Browse Source

Test 1.1 and 1.2: test LteUePhy interface instead of CqiSinrChunkProcessor interface

ndnSIM-v1
mrequena 14 years ago
parent
commit
371792608a
  1. 12
      src/lte/test/lte-test-downlink-sinr.cc
  2. 103
      src/lte/test/lte-test-ue-phy.cc
  3. 74
      src/lte/test/lte-test-ue-phy.h
  4. 12
      src/lte/test/lte-test-uplink-sinr.cc
  5. 2
      src/lte/wscript

12
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<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteUePhy> uePhy = CreateObject<LteUePhy> (dlPhy, ulPhy);
Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
dlPhy->SetCellId (100);
Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
Ptr<LteCqiSinrChunkProcessor> chunkProcessor = Create<LteCqiSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
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);

103
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 <manuel.requena@cttc.es>
*/
#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<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> 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<LtePhy> ()
.AddConstructor<LteTestUePhy> ()
;
return tid;
}
void
LteTestUePhy::DoSendMacPdu (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this);
}
Ptr<SpectrumValue>
LteTestUePhy::CreateTxPowerSpectralDensity ()
{
NS_LOG_FUNCTION (this);
Ptr<SpectrumValue> 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<IdealControlMessage> msg)
{
NS_LOG_FUNCTION (this << msg);
}
SpectrumValue
LteTestUePhy::GetSinr ()
{
NS_LOG_FUNCTION (this);
return m_sinr;
}
} // namespace ns3

74
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 <manuel.requena@cttc.es> : 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<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> 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<Packet> p);
/**
* \brief Create the PSD for the TX
* \return the pointer to the PSD
*/
virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity ();
virtual void GenerateCqiFeedback (const SpectrumValue& sinr);
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
SpectrumValue GetSinr ();
private:
SpectrumValue m_sinr;
};
} // namespace ns3
#endif /* LTE_TEST_UE_PHY_H */

12
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<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteUePhy> uePhy = CreateObject<LteUePhy> (dlPhy, ulPhy);
Ptr<LteTestUePhy> uePhy = CreateObject<LteTestUePhy> (dlPhy, ulPhy);
ulPhy->SetCellId (100);
Ptr<LteTestSinrChunkProcessor> chunkProcessor = Create<LteTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
Ptr<LteCqiSinrChunkProcessor> chunkProcessor = Create<LteCqiSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
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);

2
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',
]

Loading…
Cancel
Save