25 #include <ns3/pointer.h>
26 #include <ns3/satellite-channel-estimation-error-container.h>
27 #include <ns3/satellite-channel.h>
28 #include <ns3/satellite-const-variables.h>
29 #include <ns3/satellite-enums.h>
30 #include <ns3/satellite-fwd-link-scheduler-default.h>
31 #include <ns3/satellite-fwd-link-scheduler-time-slicing.h>
32 #include <ns3/satellite-fwd-link-scheduler.h>
33 #include <ns3/satellite-gw-llc.h>
34 #include <ns3/satellite-gw-mac.h>
35 #include <ns3/satellite-gw-phy.h>
36 #include <ns3/satellite-id-mapper.h>
37 #include <ns3/satellite-link-results.h>
38 #include <ns3/satellite-lorawan-net-device.h>
39 #include <ns3/satellite-lower-layer-service.h>
40 #include <ns3/satellite-net-device.h>
41 #include <ns3/satellite-node-info.h>
42 #include <ns3/satellite-orbiter-net-device.h>
43 #include <ns3/satellite-packet-classifier.h>
44 #include <ns3/satellite-phy-rx-carrier-conf.h>
45 #include <ns3/satellite-topology.h>
46 #include <ns3/satellite-typedefs.h>
47 #include <ns3/singleton.h>
49 NS_LOG_COMPONENT_DEFINE(
"SatGwHelperDvb");
56 Ptr<SatLowerLayerServiceConf> llsConf,
60 Callback<void, uint32_t> setRaChannelCallback)
62 ncc->AddUt(llsConf, utId, satId, beamId, setRaChannelCallback,
true);
65 NS_OBJECT_ENSURE_REGISTERED(SatGwHelperDvb);
71 TypeId(
"ns3::SatGwHelperDvb").SetParent<
SatGwHelper>().AddConstructor<SatGwHelperDvb>();
84 NS_FATAL_ERROR(
"Default constructor not supported!!!");
88 uint32_t rtnLinkCarrierCount,
89 Ptr<SatSuperframeSeq> seq,
100 randomAccessSettings)
102 NS_LOG_FUNCTION(
this << rtnLinkCarrierCount << seq);
110 uint32_t feederSatId,
111 uint32_t feederBeamId,
116 Ptr<SatLowerLayerServiceConf> llsConf)
118 NS_LOG_FUNCTION(
this << n << gwId << satId << beamId << fCh << rCh << ncc << llsConf);
120 NetDeviceContainer container;
123 Ptr<SatNetDevice> dev;
124 switch (Singleton<SatTopology>::Get()->GetStandard())
137 NS_FATAL_ERROR(
"Incorrect standard chosen");
152 Ptr<SatPacketClassifier> classifier = Create<SatPacketClassifier>();
157 Ptr<SatChannelEstimationErrorContainer> cec;
161 cec = Create<SatSimpleChannelEstimationErrorContainer>();
168 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
170 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
173 cec = Create<SatRtnLinkChannelEstimationErrorContainer>(minWfId, maxWfId);
177 cec = Create<SatFwdLinkChannelEstimationErrorContainer>();
181 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters =
182 SatPhyRxCarrierConf::RxCarrierCreateParams_s();
188 parameters.m_linkRegenerationMode =
189 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode();
192 parameters.m_cec = cec;
197 Ptr<SatGwPhy> phy = CreateObject<SatGwPhy>(
202 phy->SetChannelPairGetterCallback(cbChannel);
211 Ptr<SatGwMac> mac = CreateObject<SatGwMac>(n, satId, beamId, feederSatId, feederBeamId);
232 phy->SetAttribute(
"ReceiveCb", CallbackValue(recCb));
233 phy->SetAttribute(
"CnoCb", CallbackValue(cnoCb));
234 phy->SetAttribute(
"AverageNormalizedOfferedLoadCallback",
235 CallbackValue(avgNormalizedOfferedLoadCb));
244 Ptr<SatGwLlc> llc = CreateObject<SatGwLlc>();
250 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() !=
260 dev->SetPacketClassifier(classifier);
284 Mac48Address addr = Mac48Address::Allocate();
285 dev->SetAddress(addr);
287 Singleton<SatIdMapper>::Get()->AttachMacToTraceId(dev->GetAddress());
288 Singleton<SatIdMapper>::Get()->AttachMacToGwId(dev->GetAddress(), gwId);
289 Singleton<SatIdMapper>::Get()->AttachMacToBeamId(dev->GetAddress(), beamId);
290 Singleton<SatIdMapper>::Get()->AttachMacToSatId(dev->GetAddress(), satId + 1);
297 Ptr<SatBaseEncapsulator> gwEncap =
298 CreateObject<SatBaseEncapsulator>(addr,
299 Mac48Address::GetBroadcast(),
301 Mac48Address::GetBroadcast(),
303 gwEncap->SetQueue(queue);
310 Ptr<SatNodeInfo> nodeInfo = Create<SatNodeInfo>(
SatEnums::NT_GW, n->GetId(), addr);
311 dev->SetNodeInfo(nodeInfo);
312 llc->SetNodeInfo(nodeInfo);
313 mac->SetNodeInfo(nodeInfo);
314 phy->SetNodeInfo(nodeInfo);
321 phy->BeginEndScheduling();
325 double carrierBandwidth =
328 Ptr<SatFwdLinkScheduler> fwdLinkScheduler;
333 CreateObject<SatFwdLinkSchedulerDefault>(
m_bbFrameConf, addr, carrierBandwidth);
337 CreateObject<SatFwdLinkSchedulerTimeSlicing>(
m_bbFrameConf, addr, carrierBandwidth);
340 NS_FATAL_ERROR(
"Forward scheduling algorithm is not implemented");
350 mac->SetFwdScheduler(fwdLinkScheduler);
353 mac->StartPeriodicTransmissions();
356 if (handoverModule !=
nullptr)
360 mac->SetHandoverModule(handoverModule);
363 Singleton<SatTopology>::Get()
364 ->AddGwLayersDvb(n, feederSatId, feederBeamId, satId, beamId, dev, llc, mac, phy);
static const uint32_t SIZE
Base class for fading models such as Markov-based fading or fading trace.
virtual Ptr< NetDevice > Install(Ptr< Node > n, uint32_t gwId, uint32_t satId, uint32_t beamId, uint32_t feederSatId, uint32_t feederBeamId, Ptr< SatChannel > fCh, Ptr< SatChannel > rCh, SatPhy::ChannelPairGetterCallback cbChannel, Ptr< SatNcc > ncc, Ptr< SatLowerLayerServiceConf > llsConf)
SatGwHelperDvb()
Default constructor.
TypeId GetInstanceTypeId(void) const
static TypeId GetTypeId(void)
Get the type ID.
Creates needed objects for GW nodes like SatOrbiterNetDevice objects.
Ptr< SatSuperframeSeq > m_superframeSeq
SatPhy::ErrorModel m_errorModel
SatMac::SendCtrlMsgCallback m_sendCtrlCb
RandomAccessSettings_s m_raSettings
The used random access model settings.
SatEnums::FwdSchedulingAlgorithm_t m_fwdSchedulingAlgorithm
The forward link algorithm used.
uint32_t m_rtnLinkCarrierCount
bool m_enableChannelEstimationError
Enable channel estimation error modeling at forward link receiver (= UT).
double m_daConstantErrorRate
SatMac::ReadCtrlMsgCallback m_readCtrlCb
ObjectFactory m_deviceFactory
Ptr< SatBbFrameConf > m_bbFrameConf
Ptr< SatLinkResults > m_linkResults
SatMac::ReserveCtrlMsgCallback m_reserveCtrlCb
SatPhy::InterferenceModel m_daInterferenceModel
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
virtual Ptr< Packet > NotifyTxOpportunity(uint32_t bytes, Mac48Address utAddr, uint8_t flowId, uint32_t &bytesLeft, uint32_t &nextMinTxO)
Called from lower layer (MAC) to inform a tx opportunity of certain amount of bytes.
virtual void ClearQueues()
Remove all packets from the queues.
void ChangeBeam(uint32_t satId, uint32_t beamId)
Method handling beam handover.
void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)
Receive packet from lower layer.
void PerformHandover(uint32_t satId, uint32_t beamId)
Change underlying SatChannel to send and receive data from a new satellite and beam.
void SetHandoverRequestCallback(SatHandoverModule::HandoverRequestCallback cb)
Set the handover recommendation message sending callback.
virtual void GetSchedulingContexts(std::vector< Ptr< SatSchedulingObject >> &output) const =0
Create and fill the scheduling objects based on LLC layer information.
virtual void Receive(Ptr< Packet > packet, Mac48Address source, Mac48Address dest)
Receive user data packet from lower layer.
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< 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.
void ReceiveControlBurst(Address utId, uint32_t satId, uint32_t beamId)
Function to call when a control burst has been received.
void RemoveUt(Address utId, uint32_t satId, uint32_t beamId)
Remove a UT.
void MoveUtBetweenBeams(Address utId, uint32_t srcSatId, uint32_t srcBeamId, uint32_t destSatId, uint32_t destBeamId)
Check if a terminal can be moved between two beams.
void UtCrReceived(uint32_t satId, uint32_t beamId, Address utId, Ptr< SatCrMessage > crMsg)
Capacity request receiver.
Ptr< SatBeamScheduler > GetBeamScheduler(uint32_t satId, uint32_t beamId) const
void DoRandomAccessDynamicLoadControl(uint32_t satId, uint32_t beamId, uint32_t carrierId, uint8_t allocationChannelId, double averageNormalizedOfferedLoad)
Function for adjusting the random access allocation channel specific load.
void UtCnoUpdated(uint32_t satId, uint32_t beamId, Address sourceMac, Address gwId, double cno, bool isSatelliteMac)
Update UT specific C/N0 information.
SatNetDevice to be utilized in the UT and GW nodes.
virtual void Receive(Ptr< const Packet > packet)
bool SendControlMsg(Ptr< SatControlMessage > msg, const Address &dest)
Callback< void, uint32_t, uint32_t, Address, Address, double, bool > CnoCallback
virtual void SendPdu(PacketContainer_t, uint32_t carrierId, Time duration, SatSignalParameters::txInfo_s txInfo)
Send Pdu to the PHY tx module (for initial transmissions from either UT or GW)
Callback< void, uint32_t, uint32_t, uint32_t, uint8_t, double > AverageNormalizedOfferedLoadCallback
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.
constexpr uint8_t SUPERFRAME_SEQUENCE
Used superframe sequence in the RTN link.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
void logonCallbackHelper(Ptr< SatNcc > ncc, Ptr< SatLowerLayerServiceConf > llsConf, Address utId, uint32_t satId, uint32_t beamId, Callback< void, uint32_t > setRaChannelCallback)
Random access setting options.
SatPhyRxCarrierConf::InterferenceModel m_raInterferenceModel
double m_raConstantErrorRate
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
Creation parameters for base PHY object.
Ptr< NetDevice > m_device
SatEnums::SatLoraNodeType_t m_standard