24 #include <ns3/callback.h>
26 #include <ns3/pointer.h>
27 #include <ns3/satellite-base-encapsulator.h>
28 #include <ns3/satellite-channel-estimation-error-container.h>
29 #include <ns3/satellite-channel.h>
30 #include <ns3/satellite-const-variables.h>
31 #include <ns3/satellite-enums.h>
32 #include <ns3/satellite-generic-stream-encapsulator-arq.h>
33 #include <ns3/satellite-generic-stream-encapsulator.h>
34 #include <ns3/satellite-gw-llc.h>
35 #include <ns3/satellite-handover-module.h>
36 #include <ns3/satellite-id-mapper.h>
37 #include <ns3/satellite-mobility-observer.h>
38 #include <ns3/satellite-net-device.h>
39 #include <ns3/satellite-node-info.h>
40 #include <ns3/satellite-packet-classifier.h>
41 #include <ns3/satellite-phy-rx-carrier-conf.h>
42 #include <ns3/satellite-phy-rx.h>
43 #include <ns3/satellite-phy-tx.h>
44 #include <ns3/satellite-queue.h>
45 #include <ns3/satellite-request-manager.h>
46 #include <ns3/satellite-return-link-encapsulator-arq.h>
47 #include <ns3/satellite-return-link-encapsulator.h>
48 #include <ns3/satellite-topology.h>
49 #include <ns3/satellite-typedefs.h>
50 #include <ns3/satellite-ut-llc.h>
51 #include <ns3/satellite-ut-mac.h>
52 #include <ns3/satellite-ut-phy.h>
53 #include <ns3/satellite-ut-scheduler.h>
54 #include <ns3/satellite-utils.h>
55 #include <ns3/singleton.h>
57 NS_LOG_COMPONENT_DEFINE(
"SatUtHelperDvb");
62 NS_OBJECT_ENSURE_REGISTERED(SatUtHelperDvb);
68 TypeId(
"ns3::SatUtHelperDvb").SetParent<
SatUtHelper>().AddConstructor<SatUtHelperDvb>();
75 NS_LOG_FUNCTION(
this);
82 NS_LOG_FUNCTION(
this);
85 NS_FATAL_ERROR(
"SatUtHelperDvb::SatUtHelperDvb - Constructor not in use");
89 uint32_t fwdLinkCarrierCount,
90 Ptr<SatSuperframeSeq> seq,
101 randomAccessSettings)
103 NS_LOG_FUNCTION(
this << fwdLinkCarrierCount << seq);
112 Ptr<SatNetDevice> gwNd,
114 Address satUserAddress,
118 NS_LOG_FUNCTION(
this << n << satId << beamId << fCh << rCh << gwNd << ncc << satUserAddress);
120 NetDeviceContainer container;
138 Ptr<SatPacketClassifier> classifier = Create<SatPacketClassifier>();
143 Ptr<SatChannelEstimationErrorContainer> cec;
147 cec = Create<SatSimpleChannelEstimationErrorContainer>();
152 cec = Create<SatFwdLinkChannelEstimationErrorContainer>();
155 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters =
156 SatPhyRxCarrierConf::RxCarrierCreateParams_s();
162 parameters.m_linkRegenerationMode =
163 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode();
166 parameters.m_cec = cec;
170 Ptr<SatUtPhy> phy = CreateObject<SatUtPhy>(
175 phy->SetChannelPairGetterCallback(cbChannel);
193 NS_ASSERT(observer !=
nullptr);
197 mac->SetTimingAdvanceCallback(timingCb);
203 phy->SetAttribute(
"ReceiveCb", CallbackValue(recCb));
210 Ptr<SatUtLlc> llc = CreateObject<SatUtLlc>();
216 Ptr<SatRequestManager> rm = CreateObject<SatRequestManager>();
217 llc->SetRequestManager(rm);
221 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() !=
250 dev->SetPacketClassifier(classifier);
254 phy->SetAttribute(
"CnoCb", CallbackValue(cnoCb));
257 Mac48Address addr = Mac48Address::Allocate();
258 dev->SetAddress(addr);
260 Singleton<SatIdMapper>::Get()->AttachMacToTraceId(dev->GetAddress());
261 Singleton<SatIdMapper>::Get()->AttachMacToUtId(dev->GetAddress());
262 Singleton<SatIdMapper>::Get()->AttachMacToBeamId(dev->GetAddress(), beamId);
263 Singleton<SatIdMapper>::Get()->AttachMacToSatId(dev->GetAddress(), satId + 1);
266 Mac48Address gwAddr = Mac48Address::ConvertFrom(gwNd->GetAddress());
272 Ptr<SatBaseEncapsulator> utEncap;
273 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
276 utEncap = CreateObject<SatBaseEncapsulator>(addr,
277 Mac48Address::ConvertFrom(satUserAddress),
303 queue->AddLogonCallback(logonCb);
304 queue->AddQueueEventCallback(macCb);
305 queue->AddQueueEventCallback(rmCb);
306 utEncap->SetQueue(queue);
307 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
311 Mac48Address::ConvertFrom(satUserAddress),
324 llc->SetMacQueueEventCallback(macCb);
327 mac->SetRoutingUpdateCallback(cbRouting);
329 mac->SetGwAddress(gwAddr);
342 Ptr<SatSuperframeConf> superFrameConf =
344 bool enableLogon = superFrameConf->IsLogonEnabled();
345 uint32_t logonChannelId = superFrameConf->GetLogonChannelIndex();
350 ncc->ReserveLogonChannel(logonChannelId);
364 Ptr<SatUtScheduler> utScheduler = CreateObject<SatUtScheduler>(
m_llsConf);
367 mac->SetAttribute(
"Scheduler", PointerValue(utScheduler));
370 Ptr<SatNodeInfo> nodeInfo = Create<SatNodeInfo>(
SatEnums::NT_UT, n->GetId(), addr);
371 dev->SetNodeInfo(nodeInfo);
372 llc->SetNodeInfo(nodeInfo);
373 mac->SetNodeInfo(nodeInfo);
374 phy->SetNodeInfo(nodeInfo);
380 Ptr<SatRandomAccessConf> randomAccessConf =
384 Ptr<SatRandomAccess> randomAccess =
390 randomAccess->SetAreBuffersEmptyCallback(
399 mac->SetRandomAccess(randomAccess);
402 mac->SetLogonChannel(logonChannelId);
406 else if (enableLogon)
408 NS_FATAL_ERROR(
"Cannot simulate logon without a RA frame");
412 if (handoverModule !=
nullptr)
416 mac->SetHandoverModule(handoverModule);
421 Singleton<SatTopology>::Get()->AddUtLayersDvb(n, satId, beamId, 0, dev, llc, mac, phy);
static const uint32_t SIZE
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.
virtual bool BuffersEmpty() const
Are buffers empty?
virtual void GetSchedulingContexts(std::vector< Ptr< SatSchedulingObject >> &output) const =0
Create and fill the scheduling objects based on LLC layer information.
virtual bool ControlBuffersEmpty() const
Are buffers empty?
virtual void Receive(Ptr< Packet > packet, Mac48Address source, Mac48Address dest)
Receive user data packet from lower layer.
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.
Observes given mobilities and keeps track of certain wanted properties.
Time GetTimingAdvance(void)
Get timing advance.
Ptr< SatBeamScheduler > GetBeamScheduler(uint32_t satId, uint32_t beamId) const
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, 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< void, SatQueue::QueueEvent_t, uint8_t > QueueEventCallback
Callback to indicate queue related event.
Callback< void, Ptr< Packet > > LogonCallback
logon msg sending callback
QueueStats_t GetQueueStatistics(bool reset)
GetQueueStatistics returns a struct of KPIs.
void AssignedDaResources(uint8_t rcIndex, uint32_t bytes)
Sat UT MAC informs that certain amount of resources have been received in TBTP.
void SendLogonMessage()
Send a logon message to the gateway.
void ReceiveQueueEvent(SatQueue::QueueEvent_t event, uint8_t rcIndex)
Receive a queue event.
void SetGwAddress(Mac48Address address)
Set the GW address needed for CR transmission.
void CnoUpdated(uint32_t satId, uint32_t beamId, Address sourceMac, Address gwId, double cno, bool isSatelliteMac)
Update C/N0 information from lower layer.
void SendHandoverRecommendation(uint32_t satId, uint32_t beamId)
Send a handover recommendation message to the gateway.
Callback< double, SatEnums::ChannelType_t, uint32_t, SatEnums::CarrierBandwidthType_t > CarrierBandwidthConverter_t
Callback for carrier bandwidths.
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.
TypeId GetInstanceTypeId(void) const
Derived from Object.
SatUtHelperDvb()
Default constructor.
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).
SatMac::ReadCtrlMsgCallback m_readCtrlCb
double m_daConstantErrorRate
Ptr< SatLinkResults > m_linkResults
Ptr< SatLowerLayerServiceConf > m_llsConf
Configured lower layer service configuration.
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
ObjectFactory m_deviceFactory
bool m_crdsaOnlyForControl
Planned CRDSA usage:
SatMac::SendCtrlMsgCallback m_sendCtrlCb
Ptr< SatSuperframeSeq > m_superframeSeq
SatMac::ReserveCtrlMsgCallback m_reserveCtrlCb
void SetGwAddress(Mac48Address address)
Set the GW address.
virtual Ptr< Packet > NotifyTxOpportunity(uint32_t bytes, Mac48Address utAddr, uint8_t rcIndex, uint32_t &bytesLeft, uint32_t &nextMinTxO)
Called from lower layer (MAC) to inform a Tx opportunity of certain amount of bytes.
virtual void ReceiveQueueEventEssa(SatQueue::QueueEvent_t event, uint8_t rcIndex)
Receive a queue event:
virtual void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)
Receive packet from lower layer.
void SendLogon(Ptr< Packet > packet)
Receive a logon message to transmit /param packet The logon packet to send.
virtual void ReceiveQueueEvent(SatQueue::QueueEvent_t event, uint8_t rcIndex)
Receive a queue event:
Callback< Time > TimingAdvanceCallback
void SetRaChannel(uint32_t raChannel)
Set RA channel assigned for this UT.
bool ControlMsgTransmissionPossible() const
Method to check whether a transmission of a control msg is somewhat possible.
bool LogonMsgTransmissionPossible() const
Method to check whether a transmission of a logon msg is somewhat possible.
bool IsTxPossible(void) const
Inform whether or not the underlying Tx channel is properly configured for transmission.
void UpdateSliceSubscription(uint8_t slice)
Updates the slices subscription list.
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