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"
57NS_LOG_COMPONENT_DEFINE(
"SatUtHelperDvb");
68 TypeId(
"ns3::SatUtHelperDvb").SetParent<
SatUtHelper>().AddConstructor<SatUtHelperDvb>();
74 NS_LOG_FUNCTION(
this);
77 NS_FATAL_ERROR(
"SatUtHelperDvb::SatUtHelperDvb - 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;
130 Ptr<SatPacketClassifier> classifier = Create<SatPacketClassifier>();
135 Ptr<SatChannelEstimationErrorContainer> cec;
139 cec = Create<SatSimpleChannelEstimationErrorContainer>();
144 cec = Create<SatFwdLinkChannelEstimationErrorContainer>();
147 SatPhyRxCarrierConf::RxCarrierCreateParams_s parameters =
148 SatPhyRxCarrierConf::RxCarrierCreateParams_s();
152 parameters.m_raIfModel =
m_raSettings.m_raInterferenceModel;
153 parameters.m_raIfEliminateModel =
m_raSettings.m_raInterferenceEliminationModel;
154 parameters.m_linkRegenerationMode =
155 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode();
158 parameters.m_cec = cec;
159 parameters.m_raCollisionModel =
m_raSettings.m_raCollisionModel;
160 parameters.m_randomAccessModel =
m_raSettings.m_randomAccessModel;
162 Ptr<SatUtPhy> phy = CreateObject<SatUtPhy>(
167 phy->SetChannelPairGetterCallback(cbChannel);
185 NS_ASSERT(observer !=
nullptr);
189 mac->SetTimingAdvanceCallback(timingCb);
195 phy->SetAttribute(
"ReceiveCb", CallbackValue(recCb));
202 Ptr<SatUtLlc> llc = CreateObject<SatUtLlc>();
208 Ptr<SatRequestManager> rm = CreateObject<SatRequestManager>();
209 llc->SetRequestManager(rm);
213 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() !=
242 dev->SetPacketClassifier(classifier);
246 phy->SetAttribute(
"CnoCb", CallbackValue(cnoCb));
249 Mac48Address addr = Mac48Address::Allocate();
250 dev->SetAddress(addr);
252 Singleton<SatIdMapper>::Get()->AttachMacToTraceId(dev->GetAddress());
253 Singleton<SatIdMapper>::Get()->AttachMacToUtId(dev->GetAddress());
254 Singleton<SatIdMapper>::Get()->AttachMacToBeamId(dev->GetAddress(), beamId);
255 Singleton<SatIdMapper>::Get()->AttachMacToSatId(dev->GetAddress(), satId + 1);
258 Mac48Address gwAddr = Mac48Address::ConvertFrom(gwNd->GetAddress());
264 Ptr<SatBaseEncapsulator> utEncap;
265 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
268 utEncap = CreateObject<SatBaseEncapsulator>(addr,
269 Mac48Address::ConvertFrom(satUserAddress),
295 queue->AddLogonCallback(logonCb);
296 queue->AddQueueEventCallback(macCb);
297 queue->AddQueueEventCallback(rmCb);
298 utEncap->SetQueue(queue);
299 if (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode() ==
303 Mac48Address::ConvertFrom(satUserAddress),
316 llc->SetMacQueueEventCallback(macCb);
319 mac->SetRoutingUpdateCallback(cbRouting);
321 mac->SetGwAddress(gwAddr);
334 Ptr<SatSuperframeConf> superFrameConf =
336 bool enableLogon = superFrameConf->IsLogonEnabled();
337 uint32_t logonChannelId = superFrameConf->GetLogonChannelIndex();
342 ncc->ReserveLogonChannel(logonChannelId);
356 Ptr<SatUtScheduler> utScheduler = CreateObject<SatUtScheduler>(
m_llsConf);
359 mac->SetAttribute(
"Scheduler", PointerValue(utScheduler));
362 Ptr<SatNodeInfo> nodeInfo = Create<SatNodeInfo>(
SatEnums::NT_UT, n->GetId(), addr);
363 dev->SetNodeInfo(nodeInfo);
364 llc->SetNodeInfo(nodeInfo);
365 mac->SetNodeInfo(nodeInfo);
366 phy->SetNodeInfo(nodeInfo);
372 Ptr<SatRandomAccessConf> randomAccessConf =
376 Ptr<SatRandomAccess> randomAccess =
377 CreateObject<SatRandomAccess>(randomAccessConf,
m_raSettings.m_randomAccessModel);
382 randomAccess->SetAreBuffersEmptyCallback(
391 mac->SetRandomAccess(randomAccess);
394 mac->SetLogonChannel(logonChannelId);
398 else if (enableLogon)
400 NS_FATAL_ERROR(
"Cannot simulate logon without a RA frame");
404 if (handoverModule !=
nullptr)
406 handoverModule->SetHandoverRequestCallback(
408 mac->SetHandoverModule(handoverModule);
413 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.
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.
Creates needed objects for DVB UT nodes like SatOrbiterNetDevice objects.
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.
SatUtHelperDvb()
Default constructor.
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.
SatUtHelper()
Default constructor.
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.