28 #include "ns3/config.h"
29 #include "ns3/double.h"
32 #include "ns3/names.h"
33 #include "ns3/packet.h"
34 #include "ns3/pointer.h"
35 #include "ns3/satellite-channel-estimation-error-container.h"
36 #include "ns3/satellite-const-variables.h"
37 #include "ns3/satellite-id-mapper.h"
38 #include "ns3/satellite-orbiter-feeder-llc.h"
39 #include "ns3/satellite-orbiter-feeder-mac.h"
40 #include "ns3/satellite-orbiter-feeder-phy.h"
41 #include "ns3/satellite-orbiter-net-device-dvb.h"
42 #include "ns3/satellite-orbiter-user-llc.h"
43 #include "ns3/satellite-orbiter-user-mac.h"
44 #include "ns3/satellite-orbiter-user-phy.h"
45 #include "ns3/satellite-phy-rx-carrier-conf.h"
46 #include "ns3/satellite-phy-rx.h"
47 #include "ns3/satellite-phy-tx.h"
48 #include "ns3/satellite-topology.h"
49 #include "ns3/satellite-typedefs.h"
50 #include "ns3/satellite-utils.h"
51 #include "ns3/singleton.h"
52 #include "ns3/uinteger.h"
59 NS_LOG_COMPONENT_DEFINE(
"SatOrbiterHelperDvb");
64 NS_OBJECT_ENSURE_REGISTERED(SatOrbiterHelperDvb);
69 static TypeId tid = TypeId(
"ns3::SatOrbiterHelperDvb")
71 .AddConstructor<SatOrbiterHelperDvb>();
78 NS_LOG_FUNCTION(
this);
86 NS_LOG_FUNCTION(
this);
94 uint32_t rtnLinkCarrierCount,
95 uint32_t fwdLinkCarrierCount,
96 Ptr<SatSuperframeSeq> seq,
106 randomAccessSettings)
108 NS_LOG_FUNCTION(
this << rtnLinkCarrierCount << fwdLinkCarrierCount);
113 Ptr<SatOrbiterNetDevice>
116 NS_LOG_FUNCTION(
this);
125 Ptr<SatAntennaGainPattern> userAgp,
130 NS_LOG_FUNCTION(
this << dev << uf << ur << userAgp << satId << userBeamId);
141 Ptr<SatChannelEstimationErrorContainer> cec =
142 Create<SatSimpleChannelEstimationErrorContainer>();
144 SatPhyRxCarrierConf::RxCarrierCreateParams_s parametersUser =
145 SatPhyRxCarrierConf::RxCarrierCreateParams_s();
151 parametersUser.m_linkRegenerationMode =
152 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode();
155 parametersUser.m_cec = cec;
162 Ptr<SatOrbiterUserPhy> uPhy = CreateObject<SatOrbiterUserPhy>(
171 uPhy->SetTxAntennaGainPattern(userAgp, dev->GetNode()->GetObject<
SatMobilityModel>());
172 uPhy->SetRxAntennaGainPattern(userAgp, dev->GetNode()->GetObject<
SatMobilityModel>());
174 dev->AddUserPhy(uPhy, userBeamId);
178 Ptr<SatOrbiterUserMac> uMac;
179 Ptr<SatOrbiterUserLlc> uLlc;
181 uMac = CreateObject<SatOrbiterUserMac>(satId, userBeamId);
183 Mac48Address userAddress;
186 switch (std::max(Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode(),
187 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode()))
192 Ptr<SatNodeInfo> niPhyUser =
195 Mac48Address::ConvertFrom(dev->GetAddress()));
196 uPhy->SetNodeInfo(niPhyUser);
197 uMac->SetNodeInfo(niPhyUser);
203 uLlc = CreateObject<SatOrbiterUserLlc>();
205 dev->AddUserMac(uMac, userBeamId);
211 userAddress = Mac48Address::Allocate();
212 Ptr<SatNodeInfo> niUser =
214 uPhy->SetNodeInfo(niUser);
215 uMac->SetNodeInfo(niUser);
216 uLlc->SetNodeInfo(niUser);
218 dev->AddUserPair(userBeamId, userAddress);
224 uLlc = CreateObject<SatOrbiterUserLlc>();
226 dev->AddUserMac(uMac, userBeamId);
232 userAddress = Mac48Address::Allocate();
233 Ptr<SatNodeInfo> niUser =
235 uPhy->SetNodeInfo(niUser);
236 uMac->SetNodeInfo(niUser);
237 uLlc->SetNodeInfo(niUser);
239 dev->AddUserPair(userBeamId, userAddress);
244 NS_FATAL_ERROR(
"Forward or return link regeneration mode unknown");
248 switch (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode())
261 Ptr<SatFwdLinkScheduler> fwdScheduler =
262 CreateObject<SatScpcScheduler>(
m_bbFrameConfFwd, userAddress, carrierBandwidth);
263 uMac->SetFwdScheduler(fwdScheduler);
265 uMac->StartPeriodicTransmissions();
269 fwdScheduler->SetTxOpportunityCallback(
276 NS_FATAL_ERROR(
"Forward link regeneration mode unknown");
280 switch (Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode())
285 uPhy->SetAttribute(
"ReceiveCb", CallbackValue(uCb));
293 uPhy->SetAttribute(
"ReceiveCb", CallbackValue(uCb));
301 uPhy->SetAttribute(
"ReceiveCb", CallbackValue(uCb));
305 uLlc->SetReceiveSatelliteCallback(
311 NS_FATAL_ERROR(
"Return link regeneration mode unknown");
316 uPhy->BeginEndScheduling();
317 uPhy->SetSendControlMsgToFeederCallback(
321 Singleton<SatTopology>::Get()
322 ->AddOrbiterUserLayersDvb(dev->GetNode(), satId, userBeamId, dev, uLlc, uMac, uPhy);
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.
Callback< Ptr< SatControlMessage >, uint32_t > ReadCtrlMsgCallback
Callback to read control messages from container storing control messages.
Keep track of the current position and velocity of an object in satellite network.
SatOrbiterHelperDvb()
Default constructor.
TypeId GetInstanceTypeId(void) const
static TypeId GetTypeId(void)
Get the type ID.
virtual Ptr< SatOrbiterNetDevice > CreateOrbiterNetDevice()
Create a SatOrbiterNetDevice instance, with correct type infered from child classes.
virtual void AttachChannelsUser(Ptr< SatOrbiterNetDevice > dev, Ptr< SatChannel > uf, Ptr< SatChannel > ur, Ptr< SatAntennaGainPattern > userAgp, Ptr< SatNcc > ncc, uint32_t satId, uint32_t userBeamId)
Creates needed objects for Satellite node like SatorbiterNetDevice objects.
Ptr< SatLinkResults > m_rtnLinkResults
Return channel link results (DVB-RCS2) are created if ErrorModel is configured to be AVI.
uint32_t m_rtnLinkCarrierCount
RandomAccessSettings_s m_raSettings
The used random access model settings.
ObjectFactory m_deviceFactory
std::vector< uint32_t > m_nodeIds
Satellites node id.
double m_rtnDaConstantErrorRate
SatPhy::ErrorModel m_rtnErrorModel
Ptr< SatBbFrameConf > m_bbFrameConfFwd
Ptr< SatSuperframeSeq > m_superframeSeq
Superframe sequence.
SatPhy::InterferenceModel m_daRtnLinkInterferenceModel
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
SatMac::ReadCtrlMsgCallback m_rtnReadCtrlCb
Control return link messages callback.
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.
SatOrbiterNetDeviceDvb to be utilized in geostationary satellite.
virtual bool SendControlMsgToFeeder(Ptr< SatControlMessage > msg, const Address &dest, Ptr< SatSignalParameters > rxParams)=0
Send a control packet on the feeder link.
void ReceiveUser(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters > rxParams)
Receive the packet from the lower layers.
virtual void ReceivePacketUser(Ptr< Packet > packet, const Address &userAddress)=0
Receive the packet from the lower layers, in network regeneration on return link.
void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters > txParams)
Receive packet from lower layer.
virtual void SendPduWithParams(Ptr< SatSignalParameters > rxParams)
Send Pdu to the PHY tx module (for satellite switch packet forwarding)
Callback< void, PacketContainer_t, Ptr< SatSignalParameters > > ReceiveCallback
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.
Random access setting options.
SatPhyRxCarrierConf::InterferenceModel m_raRtnInterferenceModel
SatEnums::RandomAccessModel_t m_randomAccessModel
SatPhyRxCarrierConf::RandomAccessCollisionModel m_raCollisionModel
SatPhyRxCarrierConf::InterferenceEliminationModel m_raInterferenceEliminationModel
Creation parameters for base PHY object.
Ptr< NetDevice > m_device
SatEnums::SatLoraNodeType_t m_standard