subframe indication now triggered independently by LteUePhy

This commit is contained in:
Nicola Baldo
2012-07-29 20:32:28 +02:00
parent 12089b1b59
commit 91073a0006
6 changed files with 84 additions and 114 deletions

View File

@@ -484,7 +484,7 @@ LteHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
// connect at the PHY layer
Ptr<LteEnbPhy> enbPhy = enbDevice->GetObject<LteEnbNetDevice> ()->GetPhy ();
Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
enbPhy->AddUePhy (rnti, uePhy);
enbPhy->AddUePhy (rnti);
//
// WILD HACK - should be done through PHY SAP, probably passing by RRC

View File

@@ -42,6 +42,14 @@ NS_LOG_COMPONENT_DEFINE ("LteEnbPhy");
namespace ns3 {
// duration of the data part of a subframe in DL
// = 0.001 / 14 * 11 (fixed to 11 symbols) -1ns as margin to avoid overlapping simulator events
static const Time DL_DATA_DURATION = NanoSeconds (785714 -1);
// delay from subframe start to transmission of the data in DL
// = 0.001 / 14 * 3 (ctrl fixed to 3 symbols)
static const Time DL_CTRL_DELAY_FROM_SUBFRAME_START = NanoSeconds (214286);
////////////////////////////////////////
// member SAP forwarders
////////////////////////////////////////
@@ -267,13 +275,13 @@ LteEnbPhy::GetMacChDelay (void) const
}
bool
LteEnbPhy::AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy)
LteEnbPhy::AddUePhy (uint16_t rnti)
{
std::map <uint16_t, Ptr<LteUePhy> >::iterator it;
std::set <uint16_t>::iterator it;
it = m_ueAttached.find (rnti);
if (it == m_ueAttached.end ())
{
m_ueAttached.insert (std::pair<uint16_t, Ptr<LteUePhy> > (rnti, phy));
m_ueAttached.insert (rnti);
return (true);
}
else
@@ -286,7 +294,7 @@ LteEnbPhy::AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy)
bool
LteEnbPhy::DeleteUePhy (uint16_t rnti)
{
std::map <uint16_t, Ptr<LteUePhy> >::iterator it;
std::set <uint16_t>::iterator it;
it = m_ueAttached.find (rnti);
if (it == m_ueAttached.end ())
{
@@ -422,7 +430,7 @@ LteEnbPhy::StartSubFrame (void)
NS_LOG_DEBUG (this << " eNB Expected TBs " << uldcilist.size ());
for (dciIt = uldcilist.begin (); dciIt!=uldcilist.end (); dciIt++)
{
std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
std::set <uint16_t>::iterator it2;
it2 = m_ueAttached.find ((*dciIt).GetDci ().m_rnti);
if (it2 == m_ueAttached.end ())
@@ -493,7 +501,7 @@ LteEnbPhy::StartSubFrame (void)
Ptr<PacketBurst> pb = GetPacketBurst ();
if (pb)
{
Simulator::Schedule (Seconds (0.000214286), // ctrl frame fixed to 3 symbols
Simulator::Schedule (DL_CTRL_DELAY_FROM_SUBFRAME_START, // ctrl frame fixed to 3 symbols
&LteEnbPhy::SendDataChannels,
this,pb);
}
@@ -501,15 +509,6 @@ LteEnbPhy::StartSubFrame (void)
// trigger the MAC
m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);
// trigger the UE(s)
std::map <uint16_t, Ptr<LteUePhy> >::iterator it;
for (it = m_ueAttached.begin (); it != m_ueAttached.end (); it++)
{
(*it).second->SubframeIndication (m_nrFrames, m_nrSubFrames);
}
Simulator::Schedule (Seconds (GetTti ()),
&LteEnbPhy::EndSubFrame,
this);
@@ -539,10 +538,9 @@ LteEnbPhy::SendDataChannels (Ptr<PacketBurst> pb)
SetDownlinkSubChannels (m_dlDataRbMap);
// send the current burts of packets
NS_LOG_LOGIC (this << " eNB start TX DATA");
double dlDataFrame = 0.000785714; // 0.001 / 14 * 11 (fixed to 11 symbols)
std::list<Ptr<LteControlMessage> > ctrlMsgList;
ctrlMsgList.clear ();
m_downlinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsgList, dlDataFrame);
m_downlinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsgList, DL_DATA_DURATION);
}

View File

@@ -23,11 +23,15 @@
#define ENB_LTE_PHY_H
#include "lte-phy.h"
#include <ns3/lte-enb-phy-sap.h>
#include <map>
#include <ns3/lte-phy.h>
#include <ns3/lte-ue-phy.h>
#include <map>
#include <set>
namespace ns3 {
class PacketBurst;
@@ -173,7 +177,7 @@ public:
void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
bool AddUePhy (uint16_t rnti, Ptr<LteUePhy> phy);
bool AddUePhy (uint16_t rnti);
bool DeleteUePhy (uint16_t rnti);
@@ -233,7 +237,7 @@ public:
private:
std::map <uint16_t, Ptr<LteUePhy> > m_ueAttached;
std::set <uint16_t> m_ueAttached;
std::vector <int> m_listOfDownlinkSubchannel;

View File

@@ -41,7 +41,19 @@
NS_LOG_COMPONENT_DEFINE ("LteSpectrumPhy");
namespace ns3 {
// duration of SRS portion of UL subframe
// = 1 symbol for SRS -1ns as margin to avoid overlapping simulator events
static const Time UL_SRS_DURATION = NanoSeconds (71429 -1);
// duration of the control portion of a subframe
// = 0.001 / 14 * 3 (ctrl fixed to 3 symbols) -1ns as margin to avoid overlapping simulator events
static const Time DL_CTRL_DURATION = NanoSeconds (214286 -1);
TbId_t::TbId_t ()
{
@@ -130,7 +142,6 @@ std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s)
return os;
}
TypeId
LteSpectrumPhy::GetTypeId (void)
{
@@ -300,70 +311,9 @@ LteSpectrumPhy::ChangeState (State newState)
}
bool
LteSpectrumPhy::StartTx (Ptr<PacketBurst> pb)
{
NS_LOG_WARN (this << " Obsolete Function");
NS_LOG_FUNCTION (this << pb);
NS_LOG_LOGIC (this << " state: " << m_state);
m_phyTxStartTrace (pb);
switch (m_state)
{
case RX_DATA:
case RX_CTRL:
NS_FATAL_ERROR ("cannot TX while RX: according to FDD channel acces, the physical layer for transmission cannot be used for reception");
break;
case TX:
NS_FATAL_ERROR ("cannot TX while already TX: the MAC should avoid this");
break;
case IDLE:
{
/*
m_txPsd must be setted by the device, according to
(i) the available subchannel for transmission
(ii) the power transmission
*/
NS_ASSERT (m_txPsd);
m_txPacketBurst = pb;
// we need to convey some PHY meta information to the receiver
// to be used for simulation purposes (e.g., the CellId). This
// is done by adding an LtePhyTag to the first packet in the
// burst.
NS_ASSERT (pb->Begin () != pb->End ());
LtePhyTag tag (m_cellId);
Ptr<Packet> firstPacketInBurst = *(pb->Begin ());
firstPacketInBurst->AddPacketTag (tag);
ChangeState (TX);
NS_ASSERT (m_channel);
double tti = 0.001;
Ptr<LteSpectrumSignalParameters> txParams = Create<LteSpectrumSignalParameters> ();
txParams->duration = Seconds (tti);
txParams->txPhy = GetObject<SpectrumPhy> ();
txParams->txAntenna = m_antenna;
txParams->psd = m_txPsd;
txParams->packetBurst = pb;
m_channel->StartTx (txParams);
Simulator::Schedule (Seconds (tti), &LteSpectrumPhy::EndTx, this);
}
return false;
break;
default:
NS_FATAL_ERROR ("unknown state");
return true;
break;
}
}
bool
LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, double duration)
LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, Time duration)
{
NS_LOG_FUNCTION (this << pb);
NS_LOG_LOGIC (this << " state: " << m_state);
@@ -398,7 +348,7 @@ LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlM
ChangeState (TX);
NS_ASSERT (m_channel);
Ptr<LteSpectrumSignalParametersDataFrame> txParams = Create<LteSpectrumSignalParametersDataFrame> ();
txParams->duration = Seconds (duration);
txParams->duration = duration;
txParams->txPhy = GetObject<SpectrumPhy> ();
txParams->txAntenna = m_antenna;
txParams->psd = m_txPsd;
@@ -406,7 +356,7 @@ LteSpectrumPhy::StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlM
txParams->ctrlMsgList = ctrlMsgList;
txParams->cellId = m_cellId;
m_channel->StartTx (txParams);
Simulator::Schedule (Seconds (duration), &LteSpectrumPhy::EndTx, this);
Simulator::Schedule (duration, &LteSpectrumPhy::EndTx, this);
}
return false;
break;
@@ -452,16 +402,16 @@ LteSpectrumPhy::StartTxDlCtrlFrame (std::list<Ptr<LteControlMessage> > ctrlMsgLi
// LteSpectrumSignalParametersDlCtrlFrame
ChangeState (TX);
NS_ASSERT (m_channel);
double dlCtrlFrame = 0.000214286; // 0.001 / 14 * 3 (fixed to 3 symbols)
Ptr<LteSpectrumSignalParametersDlCtrlFrame> txParams = Create<LteSpectrumSignalParametersDlCtrlFrame> ();
txParams->duration = Seconds (dlCtrlFrame);
txParams->duration = DL_CTRL_DURATION;
txParams->txPhy = GetObject<SpectrumPhy> ();
txParams->txAntenna = m_antenna;
txParams->psd = m_txPsd;
txParams->cellId = m_cellId;
txParams->ctrlMsgList = ctrlMsgList;
m_channel->StartTx (txParams);
Simulator::Schedule (Seconds (dlCtrlFrame), &LteSpectrumPhy::EndTx, this);
Simulator::Schedule (DL_CTRL_DURATION, &LteSpectrumPhy::EndTx, this);
}
return false;
break;
@@ -508,15 +458,14 @@ LteSpectrumPhy::StartTxUlSrsFrame ()
// LteSpectrumSignalParametersDlCtrlFrame
ChangeState (TX);
NS_ASSERT (m_channel);
double ulCtrlFrame = 0.000071429; // 0.001 / 14 * 1 (fixed to 1 symbols)
Ptr<LteSpectrumSignalParametersUlSrsFrame> txParams = Create<LteSpectrumSignalParametersUlSrsFrame> ();
txParams->duration = Seconds (ulCtrlFrame);
txParams->duration = UL_SRS_DURATION;
txParams->txPhy = GetObject<SpectrumPhy> ();
txParams->txAntenna = m_antenna;
txParams->psd = m_txPsd;
txParams->cellId = m_cellId;
m_channel->StartTx (txParams);
Simulator::Schedule (Seconds (ulCtrlFrame), &LteSpectrumPhy::EndTx, this);
Simulator::Schedule (UL_SRS_DURATION, &LteSpectrumPhy::EndTx, this);
}
return false;
break;
@@ -622,7 +571,7 @@ LteSpectrumPhy::StartRxData (Ptr<LteSpectrumSignalParametersDataFrame> params)
// start RX
m_firstRxStart = Simulator::Now ();
m_firstRxDuration = params->duration;
NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration);
NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.GetSeconds () << "s");
Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, this);
}
else

View File

@@ -174,17 +174,6 @@ public:
* \param a the Antenna Model
*/
void SetAntenna (Ptr<AntennaModel> a);
/**
* Start a transmission
*
*
* @param pb the burst of packets to be transmitted
*
* @return true if an error occurred and the transmission was not
* started, false otherwise.
*/
bool StartTx (Ptr<PacketBurst> pb);
/**
* Start a transmission of data frame in DL and UL
@@ -192,12 +181,12 @@ public:
*
* @param pb the burst of packets to be transmitted in PDSCH/PUSCH
* @param ctrlMsgList the list of LteControlMessage to send
* @param duration the duration of the data frame (in sec.)
* @param duration the duration of the data frame
*
* @return true if an error occurred and the transmission was not
* started, false otherwise.
*/
bool StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, double duration);
bool StartTxDataFrame (Ptr<PacketBurst> pb, std::list<Ptr<LteControlMessage> > ctrlMsgList, Time duration);
/**
* Start a transmission of control frame in DL

View File

@@ -42,6 +42,22 @@ NS_LOG_COMPONENT_DEFINE ("LteUePhy");
namespace ns3 {
// duration of data portion of UL subframe
// = TTI - 1 symbol for SRS - 1ns as margin to avoid overlapping simulator events
// (symbol duration in nanoseconds = TTI / 14 (rounded))
// in other words, duration of data portion of UL subframe = TTI*(13/14) -1ns
static const Time UL_DATA_DURATION = NanoSeconds (1e6 - 71429 - 1);
// delay from subframe start to transmission of SRS
// = TTI - 1 symbol for SRS
static const Time UL_SRS_DELAY_FROM_SUBFRAME_START = NanoSeconds (1e6 - 71429);
////////////////////////////////////////
// member SAP forwarders
////////////////////////////////////////
@@ -99,6 +115,7 @@ UeMemberLteUePhySapProvider::SetSrsConfigurationIndex (uint16_t srcCi)
m_phy->DoSetSrsConfigurationIndex (srcCi);
}
////////////////////////////////////////
// generic LteUePhy methods
////////////////////////////////////////
@@ -136,6 +153,8 @@ LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
}
std::vector <int> ulRb;
m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
Simulator::ScheduleNow (&LteUePhy::SubframeIndication, this, 1, 1);
}
@@ -577,7 +596,7 @@ LteUePhy::QueueSubChannelsForTransmission (std::vector <int> rbMap)
void
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
// trigger from eNB
NS_LOG_LOGIC (this << frameNo << subframeNo);
// update uplink transmission mask according to previous UL-CQIs
SetSubChannelsForTransmission (m_subChannelsForTransmissionQueue.at (0));
@@ -599,11 +618,12 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
m_srsCounter--;
}
double dataFrame = 0.001 - 0.000071429; // 0.001 - 1 symbol for SRS
if (srs)
{
Simulator::Schedule (Seconds (0.000928572), // (0.001/14) * 13
&LteUePhy::SendSrs, this);
Simulator::Schedule (UL_SRS_DELAY_FROM_SUBFRAME_START,
&LteUePhy::SendSrs,
this);
}
@@ -614,7 +634,7 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
if (pb)
{
NS_LOG_LOGIC (this << " UE - start TX PUSCH + PUCCH");
m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, dataFrame);
m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
}
else
{
@@ -627,7 +647,7 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
dlRb.push_back (i);
}
SetSubChannelsForTransmission (dlRb);
m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, dataFrame);
m_uplinkSpectrumPhy->StartTxDataFrame (pb, ctrlMsg, UL_DATA_DURATION);
}
}
@@ -635,6 +655,16 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
// trigger the MAC
m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
++subframeNo;
if (subframeNo > 10)
{
++frameNo;
subframeNo = 1;
}
// schedule next subframe indication
Simulator::Schedule (Seconds (GetTti ()), &LteUePhy::SubframeIndication, this, frameNo, subframeNo);
}
void