29 #include "ns3/config.h"
30 #include "ns3/double.h"
33 #include "ns3/lorawan-mac-gateway.h"
34 #include "ns3/lorawan-orbiter-mac-gateway.h"
35 #include "ns3/names.h"
36 #include "ns3/packet.h"
37 #include "ns3/pointer.h"
38 #include "ns3/satellite-channel-estimation-error-container.h"
39 #include "ns3/satellite-const-variables.h"
40 #include "ns3/satellite-id-mapper.h"
41 #include "ns3/satellite-orbiter-feeder-llc.h"
42 #include "ns3/satellite-orbiter-feeder-mac.h"
43 #include "ns3/satellite-orbiter-feeder-phy.h"
44 #include "ns3/satellite-orbiter-net-device-lora.h"
45 #include "ns3/satellite-orbiter-user-llc.h"
46 #include "ns3/satellite-orbiter-user-mac.h"
47 #include "ns3/satellite-orbiter-user-phy.h"
48 #include "ns3/satellite-phy-rx-carrier-conf.h"
49 #include "ns3/satellite-phy-rx.h"
50 #include "ns3/satellite-phy-tx.h"
51 #include "ns3/satellite-topology.h"
52 #include "ns3/satellite-typedefs.h"
53 #include "ns3/satellite-utils.h"
54 #include "ns3/singleton.h"
55 #include "ns3/uinteger.h"
62 NS_LOG_COMPONENT_DEFINE(
"SatOrbiterHelperLora");
67 NS_OBJECT_ENSURE_REGISTERED(SatOrbiterHelperLora);
72 static TypeId tid = TypeId(
"ns3::SatOrbiterHelperLora")
74 .AddConstructor<SatOrbiterHelperLora>();
81 NS_LOG_FUNCTION(
this);
89 NS_LOG_FUNCTION(
this);
97 uint32_t rtnLinkCarrierCount,
98 uint32_t fwdLinkCarrierCount,
99 Ptr<SatSuperframeSeq> seq,
109 randomAccessSettings)
111 NS_LOG_FUNCTION(
this << rtnLinkCarrierCount << fwdLinkCarrierCount);
116 Ptr<SatOrbiterNetDevice>
119 NS_LOG_FUNCTION(
this);
128 Ptr<SatAntennaGainPattern> userAgp,
133 NS_LOG_FUNCTION(
this << dev << uf << ur << userAgp << satId << userBeamId);
136 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
137 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode(),
138 "Regeneration level must be the same on forward and return in Lora configuration");
141 Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode() ==
143 "Satellite can only be transparent or with network regenration in Lora configuration");
157 Ptr<SatChannelEstimationErrorContainer> cec =
158 Create<SatSimpleChannelEstimationErrorContainer>();
160 SatPhyRxCarrierConf::RxCarrierCreateParams_s parametersUser =
161 SatPhyRxCarrierConf::RxCarrierCreateParams_s();
167 parametersUser.m_linkRegenerationMode =
168 Singleton<SatTopology>::Get()->GetReturnLinkRegenerationMode();
171 parametersUser.m_cec = cec;
178 Ptr<SatOrbiterUserPhy> uPhy = CreateObject<SatOrbiterUserPhy>(
187 uPhy->SetTxAntennaGainPattern(userAgp, dev->GetNode()->GetObject<
SatMobilityModel>());
188 uPhy->SetRxAntennaGainPattern(userAgp, dev->GetNode()->GetObject<
SatMobilityModel>());
190 dev->AddUserPhy(uPhy, userBeamId);
194 ncc->SetUseLora(
true);
196 Mac48Address userAddress;
199 switch (Singleton<SatTopology>::Get()->GetForwardLinkRegenerationMode())
203 Ptr<SatOrbiterUserMac> uTransparentMac = CreateObject<SatOrbiterUserMac>(satId, userBeamId);
205 Ptr<SatNodeInfo> niPhyUser =
208 Mac48Address::ConvertFrom(dev->GetAddress()));
209 uPhy->SetNodeInfo(niPhyUser);
210 uTransparentMac->SetNodeInfo(niPhyUser);
214 uPhy->SetAttribute(
"ReceiveCb", CallbackValue(uCb));
216 uTransparentMac->SetReceiveNetDeviceCallback(
219 Singleton<SatTopology>::Get()->AddOrbiterUserLayersDvb(dev->GetNode(),
230 Ptr<LorawanMacGateway> uRegenerationMac =
231 CreateObject<LorawanOrbiterMacGateway>(satId, userBeamId);
233 dev->AddUserMac(uRegenerationMac, userBeamId);
234 uRegenerationMac->SetDevice(dev);
239 satLoraConf.
SetConf(uRegenerationMac);
243 uPhy->SetAttribute(
"ReceiveCb", CallbackValue(recCb));
246 userAddress = Mac48Address::Allocate();
247 Ptr<SatNodeInfo> niUser =
249 uPhy->SetNodeInfo(niUser);
250 uRegenerationMac->SetNodeInfo(niUser);
252 dev->AddUserPair(userBeamId, userAddress);
254 uRegenerationMac->SetPhy(uPhy);
256 Singleton<SatTopology>::Get()->AddOrbiterUserLayersLora(
261 DynamicCast<LorawanOrbiterMacGateway>(uRegenerationMac),
267 NS_FATAL_ERROR(
"Regeneration mode unknown");
272 uPhy->BeginEndScheduling();
273 uPhy->SetSendControlMsgToFeederCallback(
virtual void Receive(SatPhy::PacketContainer_t packets, Ptr< SatSignalParameters >)=0
Receive a packet from the lower layer.
A configuration class for the satellite reference system.
void SetConf(Ptr< LorawanMacGateway > gatewayMac)
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.
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< SatSuperframeSeq > m_superframeSeq
Superframe sequence.
SatPhy::InterferenceModel m_daRtnLinkInterferenceModel
SatTypedefs::CarrierBandwidthConverter_t m_carrierBandwidthConverter
SatMac::ReadCtrlMsgCallback m_rtnReadCtrlCb
Control return link messages callback.
SatOrbiterHelperLora()
Default constructor.
static TypeId GetTypeId(void)
Get the type ID.
virtual Ptr< SatOrbiterNetDevice > CreateOrbiterNetDevice()
Create a SatOrbiterNetDevice instance, with correct type infered from child classes.
TypeId GetInstanceTypeId(void) const
virtual void AttachChannelsUser(Ptr< SatOrbiterNetDevice > dev, Ptr< SatChannel > uf, Ptr< SatChannel > ur, Ptr< SatAntennaGainPattern > userAgp, Ptr< SatNcc > ncc, uint32_t satId, uint32_t userBeamId)
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.
SatOrbiterNetDeviceLora to be utilized in geostationary satellite.
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