37 NS_LOG_COMPONENT_DEFINE(
"LorawanGroundMacGateway");
39 NS_OBJECT_ENSURE_REGISTERED(LorawanGroundMacGateway);
44 static TypeId tid = TypeId(
"ns3::LorawanGroundMacGateway")
46 .AddConstructor<LorawanGroundMacGateway>();
52 NS_FATAL_ERROR(
"Default constructor not in use");
58 NS_LOG_FUNCTION(
this);
63 NS_LOG_FUNCTION(
this);
69 NS_LOG_FUNCTION(
this << packet);
73 packet->RemovePacketTag(tag);
77 NS_LOG_DEBUG(
"DR: " << (uint32_t)
unsigned(dataRate));
80 NS_LOG_DEBUG(
"Freq: " << frequency <<
" MHz");
81 packet->AddPacketTag(tag);
92 packet->RemovePacketTag(satDevTag);
100 NS_LOG_WARN(
"Trying to send a packet but Duty Cycle won't allow it. Aborting.");
107 NS_LOG_WARN(
"Gateway is already transmitting. Aborting.");
130 NS_LOG_DEBUG(
"Duration: " << duration.GetSeconds());
138 packet->AddPacketTag(mTag);
143 packet->AddPacketTag(addressE2ETag);
146 packets.push_back(packet);
147 uint32_t carrierId = 0;
150 m_phy->SendPdu(packets, carrierId, duration, txInfo);
157 Ptr<SatSignalParameters> )
159 NS_LOG_FUNCTION(
this << packets);
165 for (SatPhy::PacketContainer_t::iterator i = packets.begin(); i != packets.end(); i++)
169 Ptr<Packet> packetCopy = packet->Copy();
172 packetCopy->RemovePacketTag(mTag);
176 packetCopy->PeekHeader(macHdr);
181 packetCopy->AddPacketTag(beamTag);
184 lorawanNetDevice->
Receive(packetCopy);
186 NS_LOG_DEBUG(
"Received packet: " << packet);
192 NS_LOG_DEBUG(
"Not forwarding downlink message to NetDevice");
Tag used to save various data about a packet, like its Spreading Factor and data about interference.
Time GetWaitingTime(Ptr< LoraLogicalChannel > channel)
Get the time it is necessary to wait for before transmitting on a given channel.
void AddEvent(Time duration, Ptr< LoraLogicalChannel > channel)
Register the transmission of a packet.
Tag used to save various data about a packet, like its Spreading Factor and data about interference.
double GetFrequency(void)
Get the frequency of the packet.
uint8_t GetDataRate(void)
Get the data rate for this packet.
uint8_t GetModcod(void)
Get the modcod for this packet.
static TypeId GetTypeId(void)
virtual void Send(Ptr< Packet > packet)
Send a packet.
virtual void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)
Receive a packet from the lower layer.
LorawanGroundMacGateway()
virtual ~LorawanGroundMacGateway()
bool IsTransmitting(void)
TracedCallback< Ptr< const Packet > > m_receivedPacket
Trace source that is fired when a packet reaches the MAC layer.
Time GetOnAirTime(Ptr< Packet > packet, LoraTxParameters txParams)
Compute the time that a packet with certain characteristics will take to be transmitted.
Ptr< SatPhy > m_phy
The PHY instance that sits under this MAC layer.
TracedCallback< Ptr< const Packet > > m_sentNewPacket
Trace source that is fired when a new APP layer packet arrives at the MAC layer.
uint8_t GetSfFromDataRate(uint8_t dataRate)
Get the SF corresponding to a data rate, based on this MAC's region.
Ptr< NetDevice > m_device
The device this MAC layer is installed on.
LoraLogicalChannelHelper m_channelHelper
The LoraLogicalChannelHelper instance that is assigned to this MAC.
double GetBandwidthFromDataRate(uint8_t dataRate)
Get the BW corresponding to a data rate, based on this MAC's region.
This class implements a tag that carries the satellite MAC of GW and UT.
void SetE2ESourceAddress(Mac48Address e2eSourceAddress)
Set E2E source MAC address.
void SetE2EDestAddress(Mac48Address e2eDestAddress)
Set E2E destination MAC address.
This class implements a tag that carries the MAC address of the sender of the packet.
Time tag used to identify the time when packet is enqueued at device level.
SatModcod_t
Modulation scheme and coding rate for DVB-S2.
@ PACKET_TYPE_DEDICATED_ACCESS
SatLorawanNetDevice to be utilized in the UT and GW nodes for IoT configuration.
void Receive(Ptr< const Packet > packet)
uint32_t GetBeamId() const
Get beam ID of the object.
void RxTraces(SatPhy::PacketContainer_t packets)
Invoke the Rx trace source for each received packet.
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
Ptr< SatNodeInfo > m_nodeInfo
Node info containing node related information, such as node type, node id and MAC address (of the Sat...
This class implements a tag that carries the satellite MAC specific information, such as source and d...
void SetDestAddress(Mac48Address dest)
Set destination MAC address.
void SetSourceAddress(Mac48Address source)
Set source MAC address.
Time tag used to identify the time when packet is enqueued at MAC level.
SatSignalParameters::PacketsInBurst_t PacketContainer_t
Define PacketContainer in SatPhy.
static double GetCodingRate(SatEnums::SatModcod_t modcod)
Gets the coding rate of a certain MODCOD.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Structure to collect all parameters that are used to compute the duration of a packet (excluding payl...
bool lowDataRateOptimizationEnabled
Whether Low Data Rate Optimization is enabled.
uint32_t nPreamble
Number of preamble symbols.
bool headerDisabled
Whether to use implicit header mode.
uint8_t sf
Spreading Factor.
double bandwidthHz
Bandwidth in Hz.
double codingRate
Code rate.
bool crcEnabled
Whether Cyclic Redundancy Check is enabled.
Struct for storing the packet specific Tx information.
SatEnums::PacketType_t packetType
SatEnums::SatBbFrameType_t frameType
SatEnums::SatModcod_t modCod