26 #include <ns3/callback.h>
28 #include <ns3/lorawan-mac-end-device-class-a.h>
29 #include <ns3/pointer.h>
30 #include <ns3/satellite-channel-estimation-error-container.h>
31 #include <ns3/satellite-channel.h>
32 #include <ns3/satellite-const-variables.h>
33 #include <ns3/satellite-enums.h>
34 #include <ns3/satellite-id-mapper.h>
35 #include <ns3/satellite-lorawan-net-device.h>
36 #include <ns3/satellite-net-device.h>
37 #include <ns3/satellite-node-info.h>
38 #include <ns3/satellite-phy-rx-carrier-conf.h>
39 #include <ns3/satellite-phy-rx.h>
40 #include <ns3/satellite-phy-tx.h>
41 #include <ns3/satellite-queue.h>
42 #include <ns3/satellite-topology.h>
43 #include <ns3/satellite-typedefs.h>
44 #include <ns3/satellite-ut-phy.h>
45 #include <ns3/singleton.h>
49 NS_LOG_COMPONENT_DEFINE(
"SatUtHelperLora");
54 NS_OBJECT_ENSURE_REGISTERED(SatUtHelperLora);
60 TypeId(
"ns3::SatUtHelperLora").SetParent<
SatUtHelper>().AddConstructor<SatUtHelperLora>();
67 NS_LOG_FUNCTION(
this);
74 NS_LOG_FUNCTION(
this);
77 NS_FATAL_ERROR(
"SatUtHelperLora::SatUtHelperLora - Constructor not in use");
81 uint32_t fwdLinkCarrierCount,
82 Ptr<SatSuperframeSeq> seq,
95 NS_LOG_FUNCTION(
this << fwdLinkCarrierCount << seq);
104 Ptr<SatNetDevice> gwNd,
106 Address satUserAddress,
110 NS_LOG_FUNCTION(
this << n << satId << beamId << fCh << rCh << gwNd << ncc << satUserAddress);
112 NetDeviceContainer container;
132 Ptr<SatChannelEstimationErrorContainer> cec;
136 cec = Create<SatSimpleChannelEstimationErrorContainer>();
141 cec = Create<SatFwdLinkChannelEstimationErrorContainer>();
144 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters =
145 SatPhyRxCarrierConf::RxCarrierCreateParams_s();
151 parameters.m_linkRegenerationMode =
152 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode();
155 parameters.m_cec = cec;
159 Ptr<SatUtPhy> phy = CreateObject<SatUtPhy>(
164 phy->SetChannelPairGetterCallback(cbChannel);
170 Ptr<LorawanMacEndDeviceClassA> mac =
171 CreateObject<LorawanMacEndDeviceClassA>(n, satId, beamId,
m_superframeSeq);
174 mac->SetTxDbmForTxPower(std::vector<double>{16, 14, 12, 10, 8, 6, 4, 2});
182 phy->SetAttribute(
"ReceiveCb", CallbackValue(recCb));
192 mac->SetPhyRx(DynamicCast<SatLoraPhyRx>(phy->GetPhyRx()));
196 Mac48Address addr = Mac48Address::Allocate();
197 dev->SetAddress(addr);
199 Singleton<SatIdMapper>::Get()->AttachMacToTraceId(dev->GetAddress());
200 Singleton<SatIdMapper>::Get()->AttachMacToUtId(dev->GetAddress());
201 Singleton<SatIdMapper>::Get()->AttachMacToBeamId(dev->GetAddress(), beamId);
202 Singleton<SatIdMapper>::Get()->AttachMacToSatId(dev->GetAddress(), satId + 1);
205 Mac48Address gwAddr = Mac48Address::ConvertFrom(gwNd->GetAddress());
208 mac->SetRoutingUpdateCallback(cbRouting);
209 mac->SetGwAddress(gwAddr);
213 if (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
216 mac->SetSatAddress(Mac48Address::ConvertFrom(satUserAddress));
217 mac->SetRegenerative(
true);
230 Ptr<SatNodeInfo> nodeInfo = Create<SatNodeInfo>(
SatEnums::NT_UT, n->GetId(), addr);
231 dev->SetNodeInfo(nodeInfo);
232 mac->SetNodeInfo(nodeInfo);
233 phy->SetNodeInfo(nodeInfo);
236 if (handoverModule !=
nullptr)
240 mac->SetHandoverModule(handoverModule);
244 Singleton<SatTopology>::Get()->AddUtLayersLora(n, satId, beamId, 0, dev, mac, phy);
void ChangeBeam(uint32_t satId, uint32_t beamId)
Method handling beam handover.
void SetRaChannel(uint32_t raChannel)
Set RA channel assigned for this UT.
virtual void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)=0
Receive a packet from the lower layer.
Base class for fading models such as Markov-based fading or fading trace.
void SetHandoverRequestCallback(SatHandoverModule::HandoverRequestCallback cb)
Set the handover recommendation message sending callback.
A configuration class for the satellite reference system.
void SetConf(Ptr< LorawanMacGateway > gatewayMac)
SatLorawanNetDevice to be utilized in the UT and GW nodes for IoT configuration.
Callback< uint32_t, Ptr< SatControlMessage > > ReserveCtrlMsgCallback
Callback to reserve an id and initially store the control message.
Callback< void, Address, Address > RoutingUpdateCallback
Callback to update routing and ARP tables after handover.
Callback< uint32_t, uint32_t > SendCtrlMsgCallback
Callback to send a control message and allocate a recv ID for it.
Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
Callback to read control messages from container storing control messages.
Ptr< SatBeamScheduler > GetBeamScheduler(uint32_t satId, uint32_t beamId) const
Callback< void, PacketContainer_t, Ptr< SatSignalParameters > > ReceiveCallback
Callback< SatChannelPair::ChannelPair_t, uint32_t, uint32_t > ChannelPairGetterCallback
Callback for retrieving a pair of SatChannel associated to a beam.
Callback< double, SatEnums::ChannelType_t, uint32_t, SatEnums::CarrierBandwidthType_t > CarrierBandwidthConverter_t
Callback for carrier bandwidths.
Creates needed objects for UT nodes like SatOrbiterNetDevice objects.
SatPhy::ErrorModel m_errorModel
SatPhy::InterferenceModel m_daInterferenceModel
uint32_t m_fwdLinkCarrierCount
RandomAccessSettings_s m_raSettings
The used random access model settings.
bool m_enableChannelEstimationError
Enable channel estimation error modeling at forward link receiver (= UT).
double m_daConstantErrorRate
Ptr< SatLinkResults > m_linkResults
Ptr< SatLowerLayerServiceConf > m_llsConf
Configured lower layer service configuration.
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
ObjectFactory m_deviceFactory
Ptr< SatSuperframeSeq > m_superframeSeq
TypeId GetInstanceTypeId(void) const
Derived from Object.
SatUtHelperLora()
Default constructor.
virtual Ptr< NetDevice > Install(Ptr< Node > n, uint32_t satId, uint32_t beamId, Ptr< SatChannel > fCh, Ptr< SatChannel > rCh, Ptr< SatNetDevice > gwNd, Ptr< SatNcc > ncc, Address satUserAddress, SatPhy::ChannelPairGetterCallback cbChannel, SatMac::RoutingUpdateCallback cbRouting)
static TypeId GetTypeId(void)
Derived from Object.
void PerformHandover(uint32_t satId, uint32_t beamId)
Change underlying SatChannel to send and receive data from a new satellite and beam.
constexpr uint8_t SUPERFRAME_SEQUENCE
Used superframe sequence in the RTN link.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Creation parameters for base PHY object.
Ptr< NetDevice > m_device
SatEnums::SatLoraNodeType_t m_standard
Define RandomAccessSettings as a struct.
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel