--- a/src/lte/model/lte-ue-cphy-sap.h Wed Dec 05 19:32:23 2012 +0100
+++ b/src/lte/model/lte-ue-cphy-sap.h Wed Dec 05 19:32:37 2012 +0100
@@ -48,6 +48,12 @@
virtual ~LteUeCphySapProvider ();
/**
+ * reset the PHY
+ *
+ */
+ virtual void Reset () = 0;
+
+ /**
* tell the PHY to synchronize with a given eNB for communication purposes
*
* \param cellId the ID of the eNB
@@ -125,6 +131,7 @@
MemberLteUeCphySapProvider (C* owner);
// inherited from LteUeCphySapProvider
+ virtual void Reset ();
virtual void SyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
virtual void SetDlBandwidth (uint8_t ulBandwidth);
virtual void ConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
@@ -150,6 +157,13 @@
template <class C>
void
+MemberLteUeCphySapProvider<C>::Reset ()
+{
+ m_owner->DoReset ();
+}
+
+template <class C>
+void
MemberLteUeCphySapProvider<C>::SyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn)
{
m_owner->DoSyncronizeWithEnb (cellId, dlEarfcn);
--- a/src/lte/model/lte-ue-phy.cc Wed Dec 05 19:32:23 2012 +0100
+++ b/src/lte/model/lte-ue-phy.cc Wed Dec 05 19:32:37 2012 +0100
@@ -117,42 +117,21 @@
LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: LtePhy (dlPhy, ulPhy),
- m_p10CqiPeriocity (MilliSeconds (1)),
- // ideal behavior
- m_p10CqiLast (MilliSeconds (0)),
- m_a30CqiPeriocity (MilliSeconds (1)),
- // ideal behavior
- m_a30CqiLast (MilliSeconds (0)),
+ m_p10CqiPeriocity (MilliSeconds (1)), // ideal behavior
+ m_a30CqiPeriocity (MilliSeconds (1)), // ideal behavior
m_uePhySapUser (0),
- m_ueCphySapUser (0),
- m_rnti (0),
- m_transmissionMode (0),
- m_srsPeriodicity (0),
- m_srsConfigured (false),
- m_dlConfigured (false),
- m_ulConfigured (false),
- m_addedToDlChannel (false),
- m_raPreambleId (255), // value out of range
- m_raRnti (11), // value out of range
- m_rsrpRsrqSampleCounter (0)
+ m_ueCphySapUser (0)
{
m_amc = CreateObject <LteAmc> ();
m_uePhySapProvider = new UeMemberLteUePhySapProvider (this);
m_ueCphySapProvider = new MemberLteUeCphySapProvider<LteUePhy> (this);
m_macChTtiDelay = UL_PUSCH_TTIS_DELAY;
- for (int i = 0; i < m_macChTtiDelay; i++)
- {
- Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
- m_packetBurstQueue.push_back (pb);
- std::list<Ptr<LteControlMessage> > l;
- m_controlMessagesQueue.push_back (l);
- }
- std::vector <int> ulRb;
- m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
-
+
NS_ASSERT_MSG (Simulator::Now ().GetNanoSeconds () == 0,
"Cannot create UE devices after simulation started");
Simulator::ScheduleNow (&LteUePhy::SubframeIndication, this, 1, 1);
+
+ DoReset ();
}
@@ -709,9 +688,9 @@
if ((((frameNo-1)*10 + (subframeNo-1)) % m_srsPeriodicity) == m_srsSubframeOffset)
{
NS_LOG_INFO ("frame " << frameNo << " subframe " << subframeNo << " sending SRS (offset=" << m_srsSubframeOffset << ", period=" << m_srsPeriodicity << ")");
- Simulator::Schedule (UL_SRS_DELAY_FROM_SUBFRAME_START,
- &LteUePhy::SendSrs,
- this);
+ m_sendSrsEvent = Simulator::Schedule (UL_SRS_DELAY_FROM_SUBFRAME_START,
+ &LteUePhy::SendSrs,
+ this);
}
}
@@ -772,6 +751,38 @@
}
+void
+LteUePhy::DoReset ()
+{
+ NS_LOG_FUNCTION (this);
+
+ m_rnti = 0;
+ m_transmissionMode = 0;
+ m_srsPeriodicity = 0;
+ m_srsConfigured = false;
+ m_dlConfigured = false;
+ m_ulConfigured = false;
+ m_raPreambleId = 255; // value out of range
+ m_raRnti = 11; // value out of range
+ m_rsrpRsrqSampleCounter = 0;
+ m_p10CqiLast = Simulator::Now ();
+ m_a30CqiLast = Simulator::Now ();
+
+ m_packetBurstQueue.clear ();
+ m_controlMessagesQueue.clear ();
+ m_subChannelsForTransmissionQueue.clear ();
+ for (int i = 0; i < m_macChTtiDelay; i++)
+ {
+ Ptr<PacketBurst> pb = CreateObject <PacketBurst> ();
+ m_packetBurstQueue.push_back (pb);
+ std::list<Ptr<LteControlMessage> > l;
+ m_controlMessagesQueue.push_back (l);
+ }
+ std::vector <int> ulRb;
+ m_subChannelsForTransmissionQueue.resize (m_macChTtiDelay, ulRb);
+
+ m_sendSrsEvent.Cancel ();
+}
void
LteUePhy::DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn)
--- a/src/lte/model/lte-ue-phy.h Wed Dec 05 19:32:23 2012 +0100
+++ b/src/lte/model/lte-ue-phy.h Wed Dec 05 19:32:37 2012 +0100
@@ -216,6 +216,7 @@
void QueueSubChannelsForTransmission (std::vector <int> rbMap);
// UE CPHY SAP methods
+ void DoReset ();
void DoSyncronizeWithEnb (uint16_t cellId, uint16_t dlEarfcn);
void DoSetDlBandwidth (uint8_t ulBandwidth);
void DoConfigureUplink (uint16_t ulEarfcn, uint8_t ulBandwidth);
@@ -262,7 +263,6 @@
bool m_dlConfigured;
bool m_ulConfigured;
- bool m_addedToDlChannel;
Ptr<LteHarqPhy> m_harqPhyModule;
@@ -277,6 +277,8 @@
uint16_t m_rsrpRsrqSamplePeriod;
uint16_t m_rsrpRsrqSampleCounter;
+ EventId m_sendSrsEvent;
+
};
--- a/src/lte/model/lte-ue-rrc.cc Wed Dec 05 19:32:23 2012 +0100
+++ b/src/lte/model/lte-ue-rrc.cc Wed Dec 05 19:32:37 2012 +0100
@@ -608,6 +608,8 @@
SwitchToState (CONNECTED_HANDOVER);
const LteRrcSap::MobilityControlInfo& mci = msg.mobilityControlInfo;
m_handoverStartTrace (m_imsi, m_cellId, m_rnti, mci.targetPhysCellId);
+ m_cmacSapProvider->Reset ();
+ m_cphySapProvider->Reset ();
m_cellId = mci.targetPhysCellId;
NS_ASSERT (mci.haveCarrierFreq);
NS_ASSERT (mci.haveCarrierBandwidth);
@@ -616,7 +618,6 @@
m_cphySapProvider->ConfigureUplink (mci.carrierFreq.ulCarrierFreq, mci.carrierBandwidth.ulBandwidth);
m_rnti = msg.mobilityControlInfo.newUeIdentity;
m_srb0->m_rlc->SetRnti (m_rnti);
- m_cmacSapProvider->Reset ();
NS_ASSERT_MSG (mci.haveRachConfigDedicated, "handover is only supported with non-contention-based random access procedure");
m_cmacSapProvider->StartNonContentionBasedRandomAccessProcedure (m_rnti, mci.rachConfigDedicated.raPreambleIndex, mci.rachConfigDedicated.raPrachMaskIndex);
m_cphySapProvider->SetRnti (m_rnti);