A Discrete-Event Network Simulator
API
lte-ue-mac.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Nicola Baldo <nbaldo@cttc.es>
18  * Author: Marco Miozzo <mmiozzo@cttc.es>
19  */
20 
21 #ifndef LTE_UE_MAC_ENTITY_H
22 #define LTE_UE_MAC_ENTITY_H
23 
24 #include <ns3/event-id.h>
25 #include <ns3/lte-mac-sap.h>
26 #include <ns3/lte-ue-cmac-sap.h>
27 #include <ns3/lte-ue-phy-sap.h>
28 #include <ns3/nstime.h>
29 #include <ns3/packet-burst.h>
30 #include <ns3/packet.h>
31 #include <ns3/traced-callback.h>
32 
33 #include <map>
34 #include <vector>
35 
36 namespace ns3
37 {
38 
39 class UniformRandomVariable;
40 
41 class LteUeMac : public Object
42 {
49 
50  public:
55  static TypeId GetTypeId();
56 
57  LteUeMac();
58  ~LteUeMac() override;
59  void DoDispose() override;
60 
71  typedef void (*RaResponseTimeoutTracedCallback)(uint64_t imsi,
72  bool contention,
73  uint8_t preambleTxCounter,
74  uint8_t maxPreambleTxLimit);
75 
91 
96  void SetComponentCarrierId(uint8_t index);
97 
103 
109 
116  void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo);
117 
126  int64_t AssignStreams(int64_t stream);
127 
128  private:
129  // forwarded from MAC SAP
142 
143  // forwarded from UE CMAC SAP
159  void DoSetRnti(uint16_t rnti);
168  uint8_t rapId,
169  uint8_t prachMask);
177  void DoAddLc(uint8_t lcId,
179  LteMacSapUser* msu);
185  void DoRemoveLc(uint8_t lcId);
189  void DoReset();
200  void DoSetImsi(uint64_t imsi);
201 
202  // forwarded from PHY SAP
215 
216  // internal methods
224  void SendRaPreamble(bool contention);
232  void RecvRaResponse(BuildRarListElement_s raResponse);
238  void RaResponseTimeout(bool contention);
240  void SendReportBufferStatus();
243 
246 
247  private:
249  struct LcInfo
250  {
253  };
254 
255  std::map<uint8_t, LcInfo> m_lcInfoMap;
256 
258 
261 
264 
265  std::map<uint8_t, LteMacSapProvider::ReportBufferStatusParameters>
267 
270 
272 
273  uint8_t m_harqProcessId;
274  std::vector<Ptr<PacketBurst>>
276  std::vector<uint8_t> m_miUlHarqProcessesPacketTimer;
277 
278  uint16_t m_rnti;
279  uint16_t m_imsi;
280 
283  uint8_t m_raPreambleId;
288 
289  uint32_t m_frameNo;
290  uint32_t m_subframeNo;
291  uint8_t m_raRnti;
293 
300 };
301 
302 } // namespace ns3
303 
304 #endif // LTE_UE_MAC_ENTITY
An identifier for simulation events.
Definition: event-id.h:55
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:96
Service Access Point (SAP) offered by the UE MAC to the UE RRC.
Service Access Point (SAP) offered by the UE MAC to the UE RRC.
uint8_t m_raRnti
RA RNTI.
Definition: lte-ue-mac.h:291
std::vector< Ptr< PacketBurst > > m_miUlHarqProcessesPacket
Packets under transmission of the UL HARQ processes.
Definition: lte-ue-mac.h:275
LteUePhySapUser * m_uePhySapUser
UE Phy SAP user.
Definition: lte-ue-mac.h:263
uint8_t m_componentCarrierId
component carrier Id --> used to address sap
Definition: lte-ue-mac.h:245
void RaResponseTimeout(bool contention)
RA response timeout function.
Definition: lte-ue-mac.cc:492
LteUeCmacSapProvider::RachConfig m_rachConfig
RACH configuration.
Definition: lte-ue-mac.h:282
uint32_t m_frameNo
frame number
Definition: lte-ue-mac.h:289
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Forwarded from LteUePhySapUser: trigger the start from a new frame.
Definition: lte-ue-mac.cc:918
void SendReportBufferStatus()
Send report buffer status.
Definition: lte-ue-mac.cc:355
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report buffers status function.
Definition: lte-ue-mac.cc:333
TracedCallback< uint64_t, bool, uint8_t, uint8_t > m_raResponseTimeoutTrace
The RaResponseTimeout trace source.
Definition: lte-ue-mac.h:299
LteUePhySapProvider * m_uePhySapProvider
UE Phy SAP provider.
Definition: lte-ue-mac.h:262
void SetLteUePhySapProvider(LteUePhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-ue-mac.cc:290
Time m_bsrPeriodicity
BSR periodicity.
Definition: lte-ue-mac.h:268
void RefreshHarqProcessesPacketBuffer()
Refresh HARQ processes packet buffer function.
Definition: lte-ue-mac.cc:894
uint16_t m_imsi
IMSI.
Definition: lte-ue-mac.h:279
EventId m_noRaResponseReceivedEvent
no RA response received event ID
Definition: lte-ue-mac.h:286
LteUeCmacSapProvider * m_cmacSapProvider
CMAC SAP provider.
Definition: lte-ue-mac.h:260
uint8_t m_preambleTransmissionCounter
preamble tranamission counter
Definition: lte-ue-mac.h:284
Ptr< UniformRandomVariable > m_raPreambleUniformVariable
RA preamble random variable.
Definition: lte-ue-mac.h:287
void SetComponentCarrierId(uint8_t index)
Set the component carried ID.
Definition: lte-ue-mac.cc:314
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: lte-ue-mac.cc:938
void DoConfigureRach(LteUeCmacSapProvider::RachConfig rc)
Configure RACH function.
Definition: lte-ue-mac.cc:523
LteUePhySapUser * GetLteUePhySapUser()
Get the PHY SAP user.
Definition: lte-ue-mac.cc:284
bool m_rachConfigured
is RACH configured?
Definition: lte-ue-mac.h:281
void DoRemoveLc(uint8_t lcId)
Remove LC function.
Definition: lte-ue-mac.cc:588
void RecvRaResponse(BuildRarListElement_s raResponse)
Receive the RA response function.
Definition: lte-ue-mac.cc:449
void DoReceivePhyPdu(Ptr< Packet > p)
Receive Phy PDU function.
Definition: lte-ue-mac.cc:630
uint8_t m_raPreambleId
RA preamble ID.
Definition: lte-ue-mac.h:283
void DoNotifyConnectionSuccessful()
Notify MAC about the successful RRC connection establishment.
Definition: lte-ue-mac.cc:623
Time m_bsrLast
BSR last.
Definition: lte-ue-mac.h:269
std::vector< uint8_t > m_miUlHarqProcessesPacketTimer
timer for packet life in the buffer
Definition: lte-ue-mac.h:276
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive LTE control message function.
Definition: lte-ue-mac.cc:654
uint16_t m_rnti
RNTI.
Definition: lte-ue-mac.h:278
static TypeId GetTypeId()
Get the type ID.
Definition: lte-ue-mac.cc:224
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU function.
Definition: lte-ue-mac.cc:320
uint32_t m_subframeNo
subframe number
Definition: lte-ue-mac.h:290
std::map< uint8_t, LteMacSapProvider::ReportBufferStatusParameters > m_ulBsrReceived
BSR received from RLC (the last one)
Definition: lte-ue-mac.h:266
void DoDispose() override
Destructor implementation.
Definition: lte-ue-mac.cc:273
void DoReset()
Reset function.
Definition: lte-ue-mac.cc:597
~LteUeMac() override
Definition: lte-ue-mac.cc:267
LteUeCmacSapUser * m_cmacSapUser
CMAC SAP user.
Definition: lte-ue-mac.h:259
bool m_freshUlBsr
true when a BSR has been received in the last TTI
Definition: lte-ue-mac.h:271
LteMacSapProvider * GetLteMacSapProvider()
Get the LTE MAC SAP provider.
Definition: lte-ue-mac.cc:296
void DoStartNonContentionBasedRandomAccessProcedure(uint16_t rnti, uint8_t rapId, uint8_t prachMask)
Start non contention based random access procedure function.
Definition: lte-ue-mac.cc:557
LteUeCmacSapProvider * GetLteUeCmacSapProvider()
Get the LTE CMAC SAP provider.
Definition: lte-ue-mac.cc:308
bool m_waitingForRaResponse
waiting for RA response
Definition: lte-ue-mac.h:292
void DoAddLc(uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser *msu)
Add LC function.
Definition: lte-ue-mac.cc:573
uint8_t m_harqProcessId
HARQ process ID.
Definition: lte-ue-mac.h:273
LteMacSapProvider * m_macSapProvider
MAC SAP provider.
Definition: lte-ue-mac.h:257
void RandomlySelectAndSendRaPreamble()
Randomly select and send RA preamble function.
Definition: lte-ue-mac.cc:405
void DoStartContentionBasedRandomAccessProcedure()
Start contention based random access procedure function.
Definition: lte-ue-mac.cc:531
void(* RaResponseTimeoutTracedCallback)(uint64_t imsi, bool contention, uint8_t preambleTxCounter, uint8_t maxPreambleTxLimit)
TracedCallback signature for RA response timeout events exporting IMSI, contention flag,...
Definition: lte-ue-mac.h:71
uint16_t m_backoffParameter
backoff parameter
Definition: lte-ue-mac.h:285
void StartWaitingForRaResponse()
Start waiting for RA response function.
Definition: lte-ue-mac.cc:442
void DoSetRnti(uint16_t rnti)
Set RNTI.
Definition: lte-ue-mac.cc:543
void DoSetImsi(uint64_t imsi)
Set IMSI.
Definition: lte-ue-mac.cc:550
void SendRaPreamble(bool contention)
Send RA preamble function.
Definition: lte-ue-mac.cc:418
void SetLteUeCmacSapUser(LteUeCmacSapUser *s)
Set the LTE UE CMAC SAP user.
Definition: lte-ue-mac.cc:302
std::map< uint8_t, LcInfo > m_lcInfoMap
logical channel info map
Definition: lte-ue-mac.h:255
Service Access Point (SAP) offered by the UE-PHY to the UE-MAC.
Service Access Point (SAP) offered by the PHY to the MAC.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
UeMemberLteMacSapProvider class.
Definition: lte-ue-mac.cc:140
UeMemberLteUeCmacSapProvider class.
Definition: lte-ue-mac.cc:49
UeMemberLteUePhySapUser.
Definition: lte-ue-mac.cc:178
Every class exported by the ns3 library is enclosed in the ns3 namespace.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
See section 4.3.10 buildRARListElement.
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:69
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45
LcInfo structure.
Definition: lte-ue-mac.h:250
LteUeCmacSapProvider::LogicalChannelConfig lcConfig
logical channel config
Definition: lte-ue-mac.h:251
LteMacSapUser * macSapUser
MAC SAP user.
Definition: lte-ue-mac.h:252