Merge with 1db2126cb7c946c431b18ecc3e95ebf5c2efc09a

This commit is contained in:
jnin
2011-04-11 17:33:28 +02:00
10 changed files with 190 additions and 73 deletions

View File

@@ -23,11 +23,25 @@
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/config-store.h"
//#include "ns3/gtk-config-store.h"
using namespace ns3;
int main (int argc, char *argv[])
{
{
CommandLine cmd;
cmd.Parse (argc, argv);
// to save a template default attribute file run it like this:
// ./waf --command-template="%s --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::FileFormat=RawText" --run src/lte/examples/lena-first-sim
//
// to load a previously created default attribute file
// ./waf --command-template="%s --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::FileFormat=RawText" --run src/lte/examples/lena-first-sim
// note that the latter will override any of the defaults set via command-line arguments
//
ConfigStore inputConfig;
inputConfig.ConfigureDefaults ();
LenaHelper lena;
lena.EnableLogComponents ();

View File

@@ -258,15 +258,19 @@ LenaHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
Ptr<LteUeRrc> ueRrc = ueDevice->GetObject<LteUeNetDevice> ()->GetRrc ();
ueRrc->ConfigureUe (rnti);
// attach UE PHY to eNB
// attach UE to eNB
ueDevice->GetObject<LteUeNetDevice> ()->SetTargetEnb (enbDevice->GetObject<LteEnbNetDevice> ());
// WILD HACK - should be done through PHY SAP, probably passing by RRC
Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
uePhy->SetRnti (rnti);
// connect at the PHY layer
Ptr<LteEnbPhy> enbPhy = enbDevice->GetObject<LteEnbNetDevice> ()->GetPhy ();
Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
enbPhy->AddUePhy (rnti, uePhy);
// WILD HACK - should be done through PHY SAP, probably passing by RRC
uePhy->SetRnti (rnti);
uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
enbDevice->GetObject<LteEnbNetDevice> ()->GetDlBandwidth ());
}

View File

@@ -515,7 +515,7 @@ LteEnbMac::ReceiveDlCqiIdealControlMessage (Ptr<DlCqiIdealControlMessage> msg)
// NS_LOG_FUNCTION (this << msg->GetSourceDevice () << msg->GetDestinationDevice ());
CqiListElement_s dlcqi = msg->GetDlCqi ();
NS_LOG_FUNCTION(this << "Enb Received DCI rnti" << dlcqi.m_rnti);
NS_LOG_FUNCTION(this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti);
m_dlCqiReceived.push_back (dlcqi);
}

View File

@@ -60,6 +60,34 @@ TypeId LteEnbNetDevice::GetTypeId (void)
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_rrc),
MakePointerChecker <LteEnbRrc> ())
.AddAttribute ("LteEnbMac",
"The MAC associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_mac),
MakePointerChecker <LteEnbMac> ())
.AddAttribute ("FfMacScheduler",
"The scheduler associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_scheduler),
MakePointerChecker <FfMacScheduler> ())
.AddAttribute ("LteEnbPhy",
"The PHY associated to this EnbNetDevice",
PointerValue (),
MakePointerAccessor (&LteEnbNetDevice::m_phy),
MakePointerChecker <LteEnbPhy> ())
.AddAttribute ("UlBandwidth",
"Uplink bandwidth in number of Resource Blocks",
UintegerValue (25),
MakeUintegerAccessor (&LteEnbNetDevice::SetUlBandwidth,
&LteEnbNetDevice::GetUlBandwidth),
MakeUintegerChecker<uint8_t> ())
.AddAttribute ("DlBandwidth",
"Downlink bandwidth in number of Resource Blocks",
UintegerValue (25),
MakeUintegerAccessor (&LteEnbNetDevice::SetDlBandwidth,
&LteEnbNetDevice::GetDlBandwidth),
MakeUintegerChecker<uint8_t> ())
;
return tid;
}
@@ -109,22 +137,9 @@ LteEnbNetDevice::DoDispose ()
}
void
LteEnbNetDevice::UpdateConfig (void)
{
NS_LOG_FUNCTION (this);
m_rrc->ConfigureCell (25, 25);
// WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC
m_phy->DoSetBandwidth (25,25);
m_phy->DoSetCellId (m_cellId);
}
Ptr<LteEnbMac>
LteEnbNetDevice::GetMac (void)
LteEnbNetDevice::GetMac (void) const
{
NS_LOG_FUNCTION (this);
return m_mac;
@@ -139,6 +154,71 @@ LteEnbNetDevice::GetPhy (void) const
}
Ptr<LteEnbRrc>
LteEnbNetDevice::GetRrc () const
{
return m_rrc;
}
uint16_t
LteEnbNetDevice::GetCellId () const
{
return m_cellId;
}
uint8_t
LteEnbNetDevice::GetUlBandwidth () const
{
return m_ulBandwidth;
}
void
LteEnbNetDevice::SetUlBandwidth (uint8_t bw)
{
switch (bw)
{
case 6:
case 15:
case 25:
case 50:
case 75:
case 100:
m_ulBandwidth = bw;
break;
default:
NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw);
break;
}
}
uint8_t
LteEnbNetDevice::GetDlBandwidth () const
{
return m_dlBandwidth;
}
void
LteEnbNetDevice::SetDlBandwidth (uint8_t bw)
{
switch (bw)
{
case 6:
case 15:
case 25:
case 50:
case 75:
case 100:
m_dlBandwidth = bw;
break;
default:
NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw);
break;
}
}
bool
LteEnbNetDevice::DoSend (Ptr<Packet> packet, const Mac48Address& source,
const Mac48Address& dest, uint16_t protocolNumber)
@@ -178,26 +258,17 @@ LteEnbNetDevice::DoReceive (Ptr<Packet> p)
void
LteEnbNetDevice::SendIdealPdcchMessage (void)
LteEnbNetDevice::UpdateConfig (void)
{
NS_LOG_FUNCTION (this);
/*
* Get both PDCCH ideal message for UL and DL and
* set assigned resources to UEs using
* SendAssignedDLResources and SendAssignedULResources
*/
m_rrc->ConfigureCell (m_ulBandwidth, m_dlBandwidth);
// WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC
m_phy->DoSetBandwidth (m_ulBandwidth, m_dlBandwidth);
m_phy->DoSetCellId (m_cellId);
}
Ptr<LteEnbRrc>
LteEnbNetDevice::GetRrc ()
{
return m_rrc;
}
uint16_t
LteEnbNetDevice::GetCellId ()
{
return m_cellId;
}
} // namespace ns3

View File

@@ -68,29 +68,43 @@ public:
/**
* \return a pointer to the MAC
*/
Ptr<LteEnbMac> GetMac (void);
Ptr<LteEnbMac> GetMac (void) const;
/**
* \return a pointer to the physical layer.
*/
Ptr<LteEnbPhy> GetPhy (void) const;
Ptr<LteEnbRrc> GetRrc ();
/**
* \brief Send the PDCCH ideal mesages under an
* ideal control channel
/**
* \return a pointer to the Radio Resource Control instance of the eNB
*/
void SendIdealPdcchMessage (void);
Ptr<LteEnbRrc> GetRrc () const;
/**
*
* \return the Cell Identifier of this eNB
*/
uint16_t GetCellId ();
uint16_t GetCellId () const;
/**
* \return the uplink bandwidth in RBs
*/
uint8_t GetUlBandwidth () const;
/**
* \param bw the uplink bandwidth in RBs
*/
void SetUlBandwidth (uint8_t bw);
/**
* \return the downlink bandwidth in RBs
*/
uint8_t GetDlBandwidth () const;
/**
* \param bw the downlink bandwidth in RBs
*/
void SetDlBandwidth (uint8_t bw);
private:
bool DoSend (Ptr<Packet> packet,
@@ -100,6 +114,14 @@ private:
void DoReceive (Ptr<Packet> p);
/**
* Several attributes (e.g., the bandwidth) are exported as
* attributes of the LteEnbNetDevice from a user perspective, but
* are actually used also in other modules as well (the RRC, the
* PHY, the scheduler...). This methods takes care of updating the
* configuration of all modules so that their copy of the attribute
* values is in sync with the one in the LteEnbNetDevice.
*/
void UpdateConfig (void);
Ptr<LteEnbMac> m_mac;
@@ -113,6 +135,10 @@ private:
uint16_t m_cellId; /**< Cell Identifer. Part of the CGI, see TS 29.274, section 8.21.1 */
static uint16_t m_cellIdCounter;
uint8_t m_dlBandwidth; /**< downlink bandwidth in RBs */
uint8_t m_ulBandwidth; /**< uplink bandwidth in RBs */
};
} // namespace ns3

View File

@@ -418,13 +418,14 @@ LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr)
UlCqi_s ulcqi;
ulcqi.m_type = UlCqi_s::PUSCH;
int i = 0;
NS_LOG_DEBUG (this << "EVALUATING UL-CQI");
for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
{
double sinrdb = 10*log10 ((*it));
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx
int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb);
ulcqi.m_sinr.push_back (sinrFp);
//NS_LOG_DEBUG(this << " RB " << i << " SINR FP " << sinrFp << " orig " << sinrdb);
NS_LOG_DEBUG(this << " RB " << i << " SINR FP " << sinrFp << " orig " << sinrdb);
i++;
}
return (ulcqi);

View File

@@ -141,6 +141,8 @@ void
LteInterference::ConditionallyEvaluateChunk ()
{
NS_LOG_FUNCTION (this);
if (m_receiving) NS_LOG_DEBUG (this << " Receiving");
NS_LOG_DEBUG (this << " now " << Now () << " last " << m_lastChangeTime);
if (m_receiving && (Now () > m_lastChangeTime))
{
SpectrumValue sinr = (*m_rxSignal) / ((*m_allSignals) - (*m_rxSignal) + (*m_noise));
@@ -150,6 +152,10 @@ LteInterference::ConditionallyEvaluateChunk ()
(*it)->EvaluateSinrChunk (sinr, duration);
}
}
else
{
NS_LOG_DEBUG (this << " NO EV");
}
}
void

View File

@@ -105,11 +105,6 @@ void
LteUeNetDevice::UpdateConfig (void)
{
NS_LOG_FUNCTION (this);
/**
* WILD HACK
* to be translated to PHY-SAP primitive, or maybe to be set through RRC
*/
m_phy->DoSetBandwidth (25,25);
}

View File

@@ -490,6 +490,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << rbgPerFlow);
// create the DlDciListElement_s
DlDciListElement_s newDci;
std::vector <struct RlcPduListElement_s> newRlcPduLe;
newDci.m_rnti = (*flowIt).m_rnti;
newDci.m_resAlloc = 0;
newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213)
@@ -525,18 +526,16 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
//NS_LOG_DEBUG (this << " nPRB " << nPRB << " tbSize " << newDci.m_tbsSize.at (0));
rlcPduSize += newDci.m_tbsSize.at (i);
RlcPduListElement_s newRlcEl;
newRlcEl.m_logicalChannelIdentity = (*flowIt).m_lcId;
// NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity);
newRlcEl.m_size = newDci.m_tbsSize.at (i);
newRlcPduLe.push_back (newRlcEl);
}
newEl.m_dci = newDci;
// ...more parameters -> ingored in this version
RlcPduListElement_s newRlcEl;
newRlcEl.m_logicalChannelIdentity = (*flowIt).m_lcId;
// NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity);
newRlcEl.m_size = rlcPduSize; // TBD (max length of RLC-PDU in bytes)
std::vector <struct RlcPduListElement_s> newRlcPduLe;
newRlcPduLe.push_back (newRlcEl);
newEl.m_rlcPduList.push_back (newRlcPduLe);
ret.m_buildDataList.push_back (newEl);

View File

@@ -408,6 +408,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << rbgPerFlow);
// create the DlDciListElement_s
DlDciListElement_s newDci;
std::vector <struct RlcPduListElement_s> newRlcPduLe;
newDci.m_rnti = (*it).m_rnti;
newDci.m_resAlloc = 0;
newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213)
@@ -424,14 +425,14 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
int rlcPduSize = 0;
for (int i = 0; i < nbOfTbsInNewDci; i++)
{
std::map <uint16_t,uint8_t>::iterator it = m_p10CqiRxed.find (newDci.m_rnti);
if (it == m_p10CqiRxed.end ())
std::map <uint16_t,uint8_t>::iterator itCqi = m_p10CqiRxed.find (newDci.m_rnti);
if (itCqi == m_p10CqiRxed.end ())
{
newDci.m_mcs.push_back (1); // no info on this user -> lowest MCS
}
else
{
newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*it).second) );
newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*itCqi).second) );
}
int nPRB = rbgSize * rbgPerFlow;
newDci.m_tbsSize.push_back ( (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (i), nPRB) / 8) ); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213)
@@ -439,17 +440,17 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
newDci.m_rv.push_back (0); // TBD (redundancy version)
rlcPduSize += newDci.m_tbsSize.at (i);
RlcPduListElement_s newRlcEl;
newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity;
// NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity);
newRlcEl.m_size = newDci.m_tbsSize.at (i);
newRlcPduLe.push_back (newRlcEl);
}
newEl.m_dci = newDci;
// ...more parameters -> ignored in this version
RlcPduListElement_s newRlcEl;
newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity;
// NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity);
newRlcEl.m_size = rlcPduSize; // TBD (max length of RLC-PDU in bytes)
std::vector <struct RlcPduListElement_s> newRlcPduLe;
newRlcPduLe.push_back (newRlcEl);
newEl.m_rlcPduList.push_back (newRlcPduLe);
ret.m_buildDataList.push_back (newEl);