Loading...
Searching...
No Matches
satellite-helper.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Sami Rantanen <sami.rantanen@magister.fi>
19 */
20#ifndef __SATELLITE_HELPER_H__
21#define __SATELLITE_HELPER_H__
22
25#include "satellite-conf.h"
28
29#include "ns3/csma-helper.h"
30#include "ns3/ipv4-address-helper.h"
31#include "ns3/node-container.h"
32#include "ns3/object.h"
33#include "ns3/output-stream-wrapper.h"
34#include "ns3/satellite-antenna-gain-pattern-container.h"
35#include "ns3/satellite-fading-input-trace-container.h"
36#include "ns3/satellite-fading-output-trace-container.h"
37#include "ns3/satellite-interference-input-trace-container.h"
38#include "ns3/satellite-interference-output-trace-container.h"
39#include "ns3/satellite-position-allocator.h"
40#include "ns3/satellite-rx-power-input-trace-container.h"
41#include "ns3/satellite-rx-power-output-trace-container.h"
42#include "ns3/satellite-stats-helper-container.h"
43#include "ns3/trace-helper.h"
44
45#include <map>
46#include <set>
47#include <stdint.h>
48#include <string>
49#include <utility>
50#include <vector>
51
52namespace ns3
53{
54
55class SatGroupHelper;
56
61class SatHelper : public Object
62{
63 public:
67 typedef std::map<std::pair<uint32_t, uint32_t>, SatBeamUserInfo> BeamUserInfoMap_t;
68
80
85 static TypeId GetTypeId(void);
86
90 SatHelper();
91
97 SatHelper(std::string scenarioPath);
98
107 virtual void NotifyConstructionCompleted() override;
108
112 virtual ~SatHelper()
113 {
114 }
115
120 typedef Callback<uint32_t> GetNextUtUserCountCallback;
121
126
133
146 BeamUserInfoMap_t& info,
147 std::string inputFileUtListPositions,
148 bool checkBeam);
149
157 GetNextUtUserCountCallback getNextUtUserCountCallback);
158
163 void SetGwAddressInUts();
164
169
175 Ipv4Address GetUserAddress(Ptr<Node> node);
176
180 Ptr<SatBeamHelper> GetBeamHelper() const;
181
185 Ptr<SatGroupHelper> GetGroupHelper() const;
186
190 void SetGroupHelper(Ptr<SatGroupHelper> groupHelper);
191
196 void SetAntennaGainPatterns(Ptr<SatAntennaGainPatternContainer> antennaGainPattern);
197
201 Ptr<SatAntennaGainPatternContainer> GetAntennaGainPatterns();
202
206 Ptr<SatUserHelper> GetUserHelper() const;
207
213 uint32_t GetBeamCount() const;
214
219 void SetCustomUtPositionAllocator(Ptr<SatListPositionAllocator> posAllocator);
220
227 void SetUtPositionAllocatorForBeam(uint32_t beamId, Ptr<SatListPositionAllocator> posAllocator);
228
236 void LoadMobileUTsFromFolder(const std::string& folderName, Ptr<RandomVariableStream> utUsers);
237
243 Ptr<Node> LoadMobileUtFromFile(const std::string& filename);
244
251 Ptr<Node> LoadMobileUtFromFile(uint32_t satId, const std::string& filename);
252
261 void SetMulticastGroupRoutes(Ptr<Node> source,
262 NodeContainer receivers,
263 Ipv4Address sourceAddress,
264 Ipv4Address groupAddress);
265
269 void DoDispose();
270
277 Ptr<SatSpotBeamPositionAllocator> GetBeamAllocator(uint32_t beamId);
278
280 {
282 }
283
284 private:
285 static const uint16_t MIN_ADDRESS_PREFIX_LENGTH = 1;
286 static const uint16_t MAX_ADDRESS_PREFIX_LENGTH = 31;
287
290
294 std::string m_scenarioPath;
295
299 std::string m_rtnConfFileName;
300 std::string m_fwdConfFileName;
301 std::string m_gwPosFileName;
302 std::string m_satPosFileName;
303 std::string m_utPosFileName;
305
310
311 /*
312 * The global standard used. Can be either DVB or Lora
313 */
315
319 Ptr<SatUserHelper> m_userHelper;
320
324 Ptr<SatBeamHelper> m_beamHelper;
325
329 Ptr<SatGroupHelper> m_groupHelper;
330
334 Ptr<SatConf> m_satConf;
335
339 TracedCallback<std::string> m_creationDetailsTrace;
340
344
345 TracedCallback<std::string> m_creationSummaryTrace;
346
350 Ptr<OutputStreamWrapper> m_creationTraceStream;
351
355 Ptr<OutputStreamWrapper> m_utTraceStream;
356
357 Ipv4Address
359 Ipv4Address
361 Ipv4Address m_utNetworkAddress;
362
366
371
376
381
386
391
395 uint32_t m_utsInBeam;
396
400 uint32_t m_gwUsers;
401
406 uint32_t m_utUsers;
407
416
421
426
431
435 Ptr<SatAntennaGainPatternContainer> m_antennaGainPatterns;
436
441 std::map<uint32_t, Ptr<SatListPositionAllocator>> m_utPositionsByBeam;
442
446 Ptr<SatListPositionAllocator> m_utPositions;
447
451 std::map<uint32_t, NodeContainer> m_mobileUtsByBeam;
452
456 std::multimap<uint32_t, uint32_t> m_mobileUtsUsersByBeam;
457
461 std::map<uint32_t, uint32_t> m_gwSats;
462
466 std::map<Ptr<NetDevice>, NetDeviceContainer> m_utsDistribution;
467
472
477
481 void EnablePacketTrace();
482
488 void LoadConstellationTopology(std::vector<std::string>& tles,
489 std::vector<std::pair<uint32_t, uint32_t>>& isls);
490
497 static void CreationDetailsSink(Ptr<OutputStreamWrapper> stream,
498 std::string context,
499 std::string info);
504 void CreationSummarySink(std::string title);
516 void CreateFullScenario();
517
523 void DoCreateScenario(BeamUserInfoMap_t& info, uint32_t gwUsers);
524
530 std::string CreateCreationSummary(std::string title);
531
537 void SetGwMobility(NodeContainer gwNodes);
538
544 void SetSatMobility(Ptr<Node> node);
545
552 void SetSatMobility(Ptr<Node> node, std::string tle);
553
562 void SetUtMobility(NodeContainer uts, uint32_t satId, uint32_t beamId);
563
574 NodeContainer uts,
575 uint32_t satId,
576 uint32_t beamId,
577 std::vector<std::pair<GeoCoordinate, uint32_t>> positionsAndGroupId);
578
585 void InstallMobilityObserver(uint32_t satId, NodeContainer nodes) const;
586
595 Ptr<NetDevice> FindMatchingDevice(Ptr<NetDevice> devA, Ptr<Node> nodeB);
596
598
607 bool FindMatchingDevices(Ptr<Node> nodeA,
608 Ptr<Node> nodeB,
609 std::pair<Ptr<NetDevice>, Ptr<NetDevice>>& matchingDevices);
610
621 void SetMulticastRouteToSourceNetwork(Ptr<Node> source, Ptr<Node> destination);
622
633 bool ConstructMulticastInfo(Ptr<Node> sourceUtNode,
634 NodeContainer receivers,
635 MulticastBeamInfo_t& beamInfo,
636 Ptr<NetDevice>& routerUserOutputDev);
637
641 void SetNetworkAddresses(BeamUserInfoMap_t& info, uint32_t gwUsers) const;
642
652 void CheckNetwork(std::string networkName,
653 const Ipv4Address& firstNetwork,
654 const Ipv4Mask& mask,
655 const std::set<uint32_t>& networkAddresses,
656 uint32_t networkCount,
657 uint32_t hostCount) const;
658
664 void ReadStandard(std::string pathName);
665};
666
667} // namespace ns3
668
669#endif /* __SATELLITE_HELPER_H__ */
std::set< Ptr< Node > > MulticastBeamInfoItem_t
std::map< uint32_t, std::set< Ptr< Node > > > MulticastBeamInfo_t
Class that holds information for each beam regarding UTs and their users camped in each beam.
Standard_t
The global standard used.
This helper is used to create groups of UTs.
Ptr< SatUserHelper > GetUserHelper() const
std::string m_waveformConfDirectoryName
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
void CreatePredefinedScenario(PreDefinedScenario_t scenario)
Create a pre-defined SatHelper to make life easier when creating Satellite topologies.
Ipv4Mask m_beamNetworkMask
Network mask number of satellite devices.
std::string m_utCreationFileName
File name for UT creation trace output.
SatHelper()
Default constructor.
static void CreationDetailsSink(Ptr< OutputStreamWrapper > stream, std::string context, std::string info)
Sink for creation details traces.
SatEnums::Standard_t m_standard
void LoadConstellationTopology(std::vector< std::string > &tles, std::vector< std::pair< uint32_t, uint32_t > > &isls)
Load a constellation topology.
std::multimap< uint32_t, uint32_t > m_mobileUtsUsersByBeam
List of users by mobile UT by beam ID.
Ptr< SatSpotBeamPositionAllocator > GetBeamAllocator(uint32_t beamId)
Create a SatSpotBeamPositionAllocator able to generate random position within the given beam.
Ipv4Address m_beamNetworkAddress
Initial network number of satellite devices, e.g., 10.1.1.0.
std::string m_wfConfigFileName
File name for Waveform configurations file.
void CreateLargerScenario()
Creates satellite objects according to larger scenario.
bool m_handoversEnabled
Enable handovers for all UTs and GWs.
void SetGwMobility(NodeContainer gwNodes)
Sets mobilities to created GW nodes.
Ipv4Address m_gwNetworkAddress
Initial network number of GW, router, and GW users, e.g., 10.2.1.0.
Callback< uint32_t > GetNextUtUserCountCallback
Get number of Users for a UT.
void CheckNetwork(std::string networkName, const Ipv4Address &firstNetwork, const Ipv4Mask &mask, const std::set< uint32_t > &networkAddresses, uint32_t networkCount, uint32_t hostCount) const
Check validity of the configured network space.
Ipv4Mask m_utNetworkMask
Network mask number of UT and UT users.
void InstallMobilityObserver(uint32_t satId, NodeContainer nodes) const
Install Satellite Mobility Observer to nodes, if observer doesn't exist already in a node.
void ReadStandard(std::string pathName)
Read to standard use from file given in path.
static TypeId GetTypeId(void)
Get the type ID.
void SetGwAddressInUts()
Set the value of GW address for each UT.
std::string m_scenarioCreationFileName
File name for scenario creation trace output.
BeamUserInfoMap_t m_beamUserInfos
Info for beam creation in user defined scenario.
void DoCreateScenario(BeamUserInfoMap_t &info, uint32_t gwUsers)
Creates satellite objects according to given beam info.
uint32_t m_utsInBeam
Number of UTs created per Beam in full or user-defined scenario.
std::string m_scenarioPath
Scenario folder path.
std::string m_gwPosFileName
Ipv4Address GetUserAddress(Ptr< Node > node)
bool FindMatchingDevices(Ptr< Node > nodeA, Ptr< Node > nodeB, std::pair< Ptr< NetDevice >, Ptr< NetDevice > > &matchingDevices)
Find counterpart (device belonging to same network) devices from given nodes.
void SetCustomUtPositionAllocator(Ptr< SatListPositionAllocator > posAllocator)
Set custom position allocator.
void SetGroupHelper(Ptr< SatGroupHelper > groupHelper)
set the group helper.
std::string m_fwdConfFileName
bool m_creationTraces
flag to indicate if creation trace should be enabled for scenario creation.
virtual ~SatHelper()
Destructor for SatHelper.
void SetBeamRoutingConstellations()
Populate the routes, when using constellations.
SatBeamHelper::MulticastBeamInfo_t MulticastBeamInfo_t
static const uint16_t MAX_ADDRESS_PREFIX_LENGTH
Ptr< SatConf > m_satConf
Configuration for satellite network.
void SetAntennaGainPatterns(Ptr< SatAntennaGainPatternContainer > antennaGainPattern)
Set the antenna gain patterns.
Ptr< OutputStreamWrapper > m_creationTraceStream
Stream wrapper used for creation traces.
bool ConstructMulticastInfo(Ptr< Node > sourceUtNode, NodeContainer receivers, MulticastBeamInfo_t &beamInfo, Ptr< NetDevice > &routerUserOutputDev)
Construct multicast information from source UT node and group receivers.
std::string m_rtnConfFileName
Configuration file names as attributes of this class.
void LoadConstellationScenario(BeamUserInfoMap_t &info, GetNextUtUserCountCallback getNextUtUserCountCallback)
Load satellite objects according to constellation parameters.
bool m_packetTraces
flag to indicate if packet trace should be enabled after scenario creation.
void SetSatMobility(Ptr< Node > node)
Sets mobility to created Sat node.
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
@ LARGER
LARGER Larger scenario used as base.
@ NONE
NONE Not used.
@ FULL
FULL Full scenario used as base.
@ SIMPLE
SIMPLE Simple scenario used as base.
Ptr< SatAntennaGainPatternContainer > GetAntennaGainPatterns()
TracedCallback< std::string > m_creationSummaryTrace
Trace callback for creation traces (summary).
bool IsSatConstellationEnabled()
void SetUtMobility(NodeContainer uts, uint32_t satId, uint32_t beamId)
Sets mobility to created UT nodes.
void EnableCreationTraces()
Enables creation traces to be written in given file.
bool m_detailedCreationTraces
flag to indicate if detailed creation trace should be enabled for scenario creation.
void CreationSummarySink(std::string title)
Sink for creation summary traces.
std::string CreateCreationSummary(std::string title)
Creates trace summary starting with give title.
Ptr< OutputStreamWrapper > m_utTraceStream
Stream wrapper used for UT position traces.
Ptr< SatUserHelper > m_userHelper
User helper.
void SetUtPositionAllocatorForBeam(uint32_t beamId, Ptr< SatListPositionAllocator > posAllocator)
Set custom position allocator for specific beam.
void SetUtMobilityFromPosition(NodeContainer uts, uint32_t satId, uint32_t beamId, std::vector< std::pair< GeoCoordinate, uint32_t > > positionsAndGroupId)
Sets mobility to created UT nodes when position is known.
void EnablePacketTrace()
Enable packet traces.
uint32_t GetBeamCount() const
Get count of the beams (configurations).
SatBeamHelper::MulticastBeamInfoItem_t MulticastBeamInfoItem_t
Ptr< SatAntennaGainPatternContainer > m_antennaGainPatterns
Antenna gain patterns for all spot-beams.
void CreateFullScenario()
Creates satellite objects according to full scenario.
std::map< uint32_t, NodeContainer > m_mobileUtsByBeam
List of mobile UTs by beam ID.
Ptr< SatGroupHelper > GetGroupHelper() const
void CreateSimpleScenario()
Creates satellite objects according to simple scenario.
bool m_scenarioCreated
flag to check if scenario is already created.
Ptr< SatGroupHelper > m_groupHelper
Group helper.
std::string m_satPosFileName
void SetNetworkAddresses(BeamUserInfoMap_t &info, uint32_t gwUsers) const
Set configured network addresses to user and beam helpers.
void CreateUserDefinedScenarioFromListPositions(uint32_t satId, BeamUserInfoMap_t &info, std::string inputFileUtListPositions, bool checkBeam)
Creates satellite objects according to user defined scenario.
void SetMulticastRouteToSourceNetwork(Ptr< Node > source, Ptr< Node > destination)
Set multicast traffic to source's nwtwork by finding source network utilizing given destination node.
void LoadMobileUTsFromFolder(const std::string &folderName, Ptr< RandomVariableStream > utUsers)
Load UTs with a SatTracedMobilityModel associated to them from the files found in the given folder.
Ipv4Address m_utNetworkAddress
Initial network number of UT and UT users, e.g., 10.3.1.0.
uint32_t m_utUsers
Number of users created in end user network (behind every UT) in full or user-defined scenario.
Ptr< NetDevice > FindMatchingDevice(Ptr< NetDevice > devA, Ptr< Node > nodeB)
Find given device's counterpart (device belonging to same network) device from given node.
TracedCallback< std::string > m_creationDetailsTrace
Trace callback for creation traces (details).
std::map< std::pair< uint32_t, uint32_t >, SatBeamUserInfo > BeamUserInfoMap_t
definition for beam map key is pair sat ID / beam ID and value is UT/user info.
static const uint16_t MIN_ADDRESS_PREFIX_LENGTH
std::map< uint32_t, Ptr< SatListPositionAllocator > > m_utPositionsByBeam
User defined UT positions by beam ID.
Ipv4Mask m_gwNetworkMask
Network mask number of GW, router, and GW users.
Ptr< SatBeamHelper > m_beamHelper
Beam helper.
void CreateUserDefinedScenario(BeamUserInfoMap_t &info)
Creates satellite objects according to user defined scenario.
Ptr< Node > LoadMobileUtFromFile(const std::string &filename)
Load an UT with a SatTracedMobilityModel associated to them from the given file.
void DoDispose()
Dispose of this class instance.
std::map< Ptr< NetDevice >, NetDeviceContainer > m_utsDistribution
Map indicating all UT NetDevices associated to each GW NetDevice.
std::map< uint32_t, uint32_t > m_gwSats
Map of closest satellite for each GW.
std::string m_utPosFileName
void SetMulticastGroupRoutes(Ptr< Node > source, NodeContainer receivers, Ipv4Address sourceAddress, Ipv4Address groupAddress)
Set multicast group to satellite network and IP router.
uint32_t m_gwUsers
Number of users created in public network (behind GWs) in full or user-defined scenario.
Ptr< SatBeamHelper > GetBeamHelper() const
bool m_satConstellationEnabled
Use a constellation of satellites.
void EnableDetailedCreationTraces()
Enables creation traces in sub-helpers.
Ptr< SatListPositionAllocator > m_utPositions
User defined UT positions from SatConf (or manually set).
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.