src/lte/model/lte-spectrum-phy.cc
changeset 9579 1f1a0bd0c009
parent 9562 691b97de80ed
child 9581 d1ad2deb4a04
--- a/src/lte/model/lte-spectrum-phy.cc	Tue Dec 18 12:26:39 2012 +0100
+++ b/src/lte/model/lte-spectrum-phy.cc	Tue Dec 18 16:13:03 2012 +0100
@@ -294,6 +294,21 @@
   m_interferenceCtrl->SetNoisePowerSpectralDensity (noisePsd);
 }
 
+  
+void 
+LteSpectrumPhy::Reset ()
+{
+  NS_LOG_FUNCTION (this);
+  m_cellId = 0;
+  m_state = IDLE;
+  m_transmissionMode = 0;
+  m_layersNum = 1;
+  m_endTxEvent.Cancel ();
+  m_endRxDataEvent.Cancel ();
+  m_endRxDlCtrlEvent.Cancel ();
+  m_endRxUlSrsEvent.Cancel ();
+}
+
 
 
 void
@@ -429,7 +444,7 @@
       txParams->ctrlMsgList = ctrlMsgList;
       txParams->cellId = m_cellId;
       m_channel->StartTx (txParams);
-      Simulator::Schedule (duration, &LteSpectrumPhy::EndTx, this);
+      m_endTxEvent = Simulator::Schedule (duration, &LteSpectrumPhy::EndTx, this);
     }
     return false;
     break;
@@ -484,7 +499,7 @@
       txParams->cellId = m_cellId;
       txParams->ctrlMsgList = ctrlMsgList;
       m_channel->StartTx (txParams);
-      Simulator::Schedule (DL_CTRL_DURATION, &LteSpectrumPhy::EndTx, this);
+      m_endTxEvent = Simulator::Schedule (DL_CTRL_DURATION, &LteSpectrumPhy::EndTx, this);
     }
     return false;
     break;
@@ -539,7 +554,7 @@
       txParams->psd = m_txPsd;
       txParams->cellId = m_cellId;
       m_channel->StartTx (txParams);
-      Simulator::Schedule (UL_SRS_DURATION, &LteSpectrumPhy::EndTx, this);
+      m_endTxEvent = Simulator::Schedule (UL_SRS_DURATION, &LteSpectrumPhy::EndTx, this);
     }
     return false;
     break;
@@ -646,7 +661,7 @@
                   m_firstRxStart = Simulator::Now ();
                   m_firstRxDuration = params->duration;
                   NS_LOG_LOGIC (this << " scheduling EndRx with delay " << params->duration.GetSeconds () << "s");
-                  Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, this);
+                  m_endRxDataEvent = Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxData, this);
                 }
               else
                 {
@@ -740,11 +755,11 @@
               {
                 // store the DCIs
                 m_rxControlMessageList = lteDlCtrlRxParams->ctrlMsgList;
-                Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
+                m_endRxDlCtrlEvent = Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxDlCtrl, this);
               }
             else
               {
-                Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxUlSrs, this);
+                m_endRxUlSrsEvent = Simulator::Schedule (params->duration, &LteSpectrumPhy::EndRxUlSrs, this);
               }
           }
           else if (m_state == RX_CTRL)