DL EARFCN attribute for UE

This commit is contained in:
Budiarto Herman
2013-07-17 15:12:01 +03:00
parent c1adaa985d
commit eddab79fdb
6 changed files with 104 additions and 41 deletions

View File

@@ -78,6 +78,13 @@ TypeId LteUeNetDevice::GetTypeId (void)
UintegerValue (0), // not used because the attribute is read-only
MakeUintegerAccessor (&LteUeNetDevice::m_imsi),
MakeUintegerChecker<uint64_t> ())
.AddAttribute ("DlEarfcn",
"Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
"as per 3GPP 36.101 Section 5.7.3. ",
UintegerValue (100),
MakeUintegerAccessor (&LteUeNetDevice::SetDlEarfcn,
&LteUeNetDevice::GetDlEarfcn),
MakeUintegerChecker<uint16_t> (0, 6149))
;
return tid;
@@ -91,7 +98,7 @@ LteUeNetDevice::LteUeNetDevice (void)
}
LteUeNetDevice::LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy, Ptr<LteUeMac> mac, Ptr<LteUeRrc> rrc, Ptr<EpcUeNas> nas, uint64_t imsi)
LteUeNetDevice::LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy, Ptr<LteUeMac> mac, Ptr<LteUeRrc> rrc, Ptr<EpcUeNas> nas, uint64_t imsi)
{
NS_LOG_FUNCTION (this);
m_phy = phy;
@@ -129,7 +136,7 @@ LteUeNetDevice::UpdateConfig (void)
NS_LOG_FUNCTION (this);
m_nas->SetImsi (m_imsi);
m_rrc->SetImsi (m_imsi);
}
@@ -171,6 +178,20 @@ LteUeNetDevice::GetImsi () const
return m_imsi;
}
uint16_t
LteUeNetDevice::GetDlEarfcn () const
{
return m_dlEarfcn;
}
void
LteUeNetDevice::SetDlEarfcn (uint16_t earfcn)
{
m_rrc->SetDlEarfcn (earfcn);
m_phy->SetDlEarfcn (earfcn);
m_dlEarfcn = earfcn;
}
void
LteUeNetDevice::SetTargetEnb (Ptr<LteEnbNetDevice> enb)
{
@@ -201,7 +222,7 @@ LteUeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocol
{
NS_LOG_FUNCTION (this << dest << protocolNumber);
NS_ASSERT_MSG (protocolNumber == Ipv4L3Protocol::PROT_NUMBER, "unsupported protocol " << protocolNumber << ", only IPv4 is supported");
return m_nas->Send (packet);
}

View File

@@ -73,25 +73,40 @@ public:
// inherited from NetDevice
virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
Ptr<LteUeMac> GetMac (void) const;
Ptr<LteUeRrc> GetRrc () const ;
Ptr<LteUeRrc> GetRrc () const;
Ptr<LteUePhy> GetPhy (void) const;
Ptr<EpcUeNas> GetNas (void) const;
uint64_t GetImsi () const;
/**
* \return the downlink carrier frequency (EARFCN)
*
* Note that real-life handset typically supports more than one EARFCN, but
* the sake of simplicity we assume only one EARFCN is supported.
*/
uint16_t GetDlEarfcn () const;
/**
* \param bw the downlink carrier frequency (EARFCN)
*
* Note that real-life handset typically supports more than one EARFCN, but
* the sake of simplicity we assume only one EARFCN is supported.
*/
void SetDlEarfcn (uint16_t earfcn);
/**
* \brief Set the targer eNB where the UE is registered
* \param enb
*/
void SetTargetEnb (Ptr<LteEnbNetDevice> enb);
/**
* \brief Get the targer eNB where the UE is registered
* \return the pointer to the enb
@@ -124,7 +139,9 @@ private:
Ptr<EpcUeNas> m_nas;
uint64_t m_imsi;
uint16_t m_dlEarfcn; /**< downlink carrier frequency */
};
} // namespace ns3

View File

@@ -107,11 +107,11 @@ UeMemberLteUePhySapProvider::SendRachPreamble (uint32_t prachId, uint32_t raRnti
////////////////////////////////////////
const char* g_uePhyStateName[LteUePhy::NUM_STATES] =
{
"CELL_SEARCH",
"DECODING_BCH",
"ATTACHED"
};
{
"CELL_SEARCH",
"DECODING_BCH",
"ATTACHED"
};
std::string ToString (LteUePhy::State s)
{
@@ -280,6 +280,8 @@ LteUePhy::DoInitialize ()
{
NS_LOG_FUNCTION (this);
LtePhy::DoInitialize ();
DoSetDlBandwidth (6); // configure DL for receiving PSS
SwitchToState (CELL_SEARCH);
}
void
@@ -419,6 +421,12 @@ LteUePhy::CreateTxPowerSpectralDensity ()
return psd;
}
void
LteUePhy::SetDlEarfcn (uint16_t earfcn)
{
m_dlEarfcn = earfcn;
}
void
LteUePhy::GenerateCtrlCqiReport (const SpectrumValue& sinr)
{
@@ -683,8 +691,8 @@ LteUePhy::ReportUeMeasurements ()
double avg_rsrp = (*it).second.rsrpSum / (double)(*it).second.rsrpNum;
double avg_rsrq = (*it).second.rsrqSum / (double)(*it).second.rsrqNum;
NS_LOG_DEBUG (this << " CellId " << (*it).first
<< " RSRP " << avg_rsrp << " (nSamples " << (uint16_t)(*it).second.rsrpNum
<< ") RSRQ " << avg_rsrq << " (nSamples " << (uint16_t)(*it).second.rsrpNum << ")");
<< " RSRP " << avg_rsrp << " (nSamples " << (uint16_t)(*it).second.rsrpNum
<< ") RSRQ " << avg_rsrq << " (nSamples " << (uint16_t)(*it).second.rsrpNum << ")");
if ((m_state == CELL_SEARCH) && (maxRsrp < avg_rsrp))
{
@@ -1114,20 +1122,13 @@ LteUePhy::DoReset ()
m_downlinkSpectrumPhy->Reset ();
m_uplinkSpectrumPhy->Reset ();
// configure DL for receiving PSS
m_dlEarfcn = 100; // TODO hardcoded value
m_noiseFigure = 9.0; // TODO hardcoded value
NS_ASSERT (m_downlinkSpectrumPhy->GetChannel () != 0);
DoSetDlBandwidth (6);
SwitchToState (CELL_SEARCH);
} // end of void LteUePhy::DoReset ()
void
LteUePhy::DoRetryCellSearch ()
{
NS_LOG_FUNCTION (this);
DoSetDlBandwidth (6); // configure DL for receiving PSS
SwitchToState (CELL_SEARCH);
}

View File

@@ -143,6 +143,10 @@ public:
*/
Ptr<LteSpectrumPhy> GetUlSpectrumPhy () const;
/**
* \param bw the downlink carrier frequency (EARFCN)
*/
void SetDlEarfcn (uint16_t earfcn);
/**
* \brief Create the PSD for the TX
@@ -210,18 +214,18 @@ public:
/**
* \brief Send the SRS signal in the last symbols of the frame
*/
* \brief Send the SRS signal in the last symbols of the frame
*/
void SendSrs ();
/**
* \brief PhySpectrum generated a new DL HARQ feedback
*/
/**
* \brief PhySpectrum generated a new DL HARQ feedback
*/
virtual void ReceiveLteDlHarqFeedback (DlInfoListElement_s mes);
/**
* \brief Set the HARQ PHY module
*/
* \brief Set the HARQ PHY module
*/
void SetHarqPhyModule (Ptr<LteHarqPhy> harq);
/**
@@ -249,10 +253,10 @@ private:
void SwitchToState (State s);
// UE CPHY SAP methods
void DoReset ();
void DoReset ();
void DoRetryCellSearch ();
void DoAttach ();
void DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
void DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
void DoSetDlBandwidth (uint8_t ulBandwidth);
void DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
void DoSetRnti (uint16_t rnti);

View File

@@ -324,12 +324,18 @@ LteUeRrc::GetDlBandwidth () const
return m_dlBandwidth;
}
uint16_t
uint16_t
LteUeRrc::GetDlEarfcn () const
{
return m_dlEarfcn;
}
void
LteUeRrc::SetDlEarfcn (uint16_t earfcn)
{
m_dlEarfcn = earfcn;
}
uint16_t
LteUeRrc::GetUlEarfcn () const
{
@@ -337,6 +343,11 @@ LteUeRrc::GetUlEarfcn () const
return m_ulEarfcn;
}
void
LteUeRrc::SetUlEarfcn (uint16_t earfcn)
{
m_ulEarfcn = earfcn;
}
LteUeRrc::State
LteUeRrc::GetState (void)
@@ -544,10 +555,9 @@ LteUeRrc::DoConnect ()
// CPHY SAP methods
void
LteUeRrc::DoRecvMasterInformationBlock (LteRrcSap::MasterInformationBlock msg)
LteUeRrc::DoRecvMasterInformationBlock (LteRrcSap::MasterInformationBlock msg)
{
NS_LOG_FUNCTION (this);
// TODO may speed up a bit if only execute the following when bandwidth changes?
m_dlBandwidth = msg.dlBandwidth;
m_cphySapProvider->SetDlBandwidth (msg.dlBandwidth);
m_receivedMib = true;
@@ -590,14 +600,14 @@ LteUeRrc::DoReportUeMeasurements (LteUeCphySapUser::UeMeasurementsParameters par
std::vector <LteUeCphySapUser::UeMeasurementsElement>::iterator newMeasIt;
for (newMeasIt = params.m_ueMeasurementsList.begin ();
newMeasIt != params.m_ueMeasurementsList.end (); ++newMeasIt)
newMeasIt != params.m_ueMeasurementsList.end (); ++newMeasIt)
{
Layer3Filtering (newMeasIt->m_cellId, newMeasIt->m_rsrp, newMeasIt->m_rsrq);
}
std::map<uint8_t, LteRrcSap::MeasIdToAddMod>::iterator measIdIt;
for (measIdIt = m_varMeasConfig.measIdList.begin ();
measIdIt != m_varMeasConfig.measIdList.end (); ++measIdIt)
measIdIt != m_varMeasConfig.measIdList.end (); ++measIdIt)
{
MeasurementReportTriggering (measIdIt->first);
}
@@ -637,14 +647,14 @@ LteUeRrc::DoRecvSystemInformation (LteRrcSap::SystemInformation msg)
}
if (m_state == IDLE_WAIT_SYSTEM_INFO && m_receivedMib && m_receivedSib2)
{
SwitchToState (IDLE_CAMPED_NORMALLY);
SwitchToState (IDLE_CAMPED_NORMALLY);
}
}
void
LteUeRrc::DoRecvRrcConnectionSetup (LteRrcSap::RrcConnectionSetup msg)
{
{
NS_LOG_FUNCTION (this);
switch (m_state)
{

View File

@@ -221,16 +221,26 @@ public:
*/
uint8_t GetDlBandwidth () const;
/**
/**
* \return the downlink carrier frequency (EARFCN)
*/
uint16_t GetDlEarfcn () const;
/**
* \param bw the downlink carrier frequency (EARFCN)
*/
void SetDlEarfcn (uint16_t earfcn);
/**
* \return the uplink carrier frequency (EARFCN)
*/
uint16_t GetUlEarfcn () const;
/**
* \param bw the uplink carrier frequency (EARFCN)
*/
void SetUlEarfcn (uint16_t earfcn);
/**
*
* \return the current state