23 #ifndef SIMULATION_HELPER_H
24 #define SIMULATION_HELPER_H
26 #include <ns3/command-line.h>
27 #include <ns3/random-variable-stream.h>
28 #include <ns3/satellite-cno-helper.h>
29 #include <ns3/satellite-enums.h>
30 #include <ns3/satellite-group-helper.h>
31 #include <ns3/satellite-helper.h>
32 #include <ns3/satellite-stats-helper-container.h>
33 #include <ns3/satellite-traffic-helper.h>
37 #define STRINGIFY(x) #x
38 #define TOSTRING(x) STRINGIFY(x)
109 void SetBeams(
const std::string& beamList);
128 const std::set<uint32_t>&
GetBeams();
289 double carrierSpacing,
290 bool isRandomAccess =
false);
336 double constantIf = 0.0);
377 const std::string& mobileUtsFolder =
"");
476 "CreateSatScenario not called before calling GetSatelliteHelper");
653 NS_ASSERT_MSG(
m_utUserCount != NULL,
"User count per UT not set");
683 std::map<uint32_t, Ptr<RandomVariableStream>>
m_utCount;
771 std::map<std::string, TrafficConfiguration_t>::iterator it =
781 it->second.m_percentage = percentage;
787 std::map<std::string, TrafficConfiguration_t>::const_iterator it =
791 NS_FATAL_ERROR(
"Traffic model " << trafficModel <<
" has not been configured");
794 return it->second.m_percentage;
799 std::map<std::string, TrafficConfiguration_t>::iterator it =
809 it->second.m_protocol = protocol;
815 std::map<std::string, TrafficConfiguration_t>::const_iterator it =
819 NS_FATAL_ERROR(
"Traffic model " << trafficModel <<
" has not been configured");
822 return it->second.m_protocol;
827 std::map<std::string, TrafficConfiguration_t>::iterator it =
837 it->second.m_direction = direction;
843 std::map<std::string, TrafficConfiguration_t>::const_iterator it =
847 NS_FATAL_ERROR(
"Traffic model " << trafficModel <<
" has not been configured");
850 return it->second.m_direction;
855 std::map<std::string, TrafficConfiguration_t>::iterator it =
865 it->second.m_startTime = startTime;
871 std::map<std::string, TrafficConfiguration_t>::const_iterator it =
875 NS_FATAL_ERROR(
"Traffic model " << trafficModel <<
" has not been configured");
878 return it->second.m_startTime;
883 std::map<std::string, TrafficConfiguration_t>::iterator it =
893 it->second.m_stopTime = stopTime;
899 std::map<std::string, TrafficConfiguration_t>::const_iterator it =
903 NS_FATAL_ERROR(
"Traffic model " << trafficModel <<
" has not been configured");
906 return it->second.m_stopTime;
911 std::map<std::string, TrafficConfiguration_t>::iterator it =
921 it->second.m_startDelay = startDelay;
927 std::map<std::string, TrafficConfiguration_t>::const_iterator it =
931 NS_FATAL_ERROR(
"Traffic model " << trafficModel <<
" has not been configured");
934 return it->second.m_startDelay;
937 #define TRAFFIC_MODEL_ATTRIBUTE_ACCESSOR_DEFINE(index) \
938 inline void SetTraffic##index##Percentage(double value) \
940 return SetTrafficPercentage(TOSTRING(index), value); \
942 inline double GetTraffic##index##Percentage() const \
944 return GetTrafficPercentage(TOSTRING(index)); \
946 inline void SetTraffic##index##Protocol(TransportLayerProtocol_t value) \
948 return SetTrafficProtocol(TOSTRING(index), value); \
950 inline TransportLayerProtocol_t GetTraffic##index##Protocol() const \
952 return GetTrafficProtocol(TOSTRING(index)); \
954 inline void SetTraffic##index##Direction(TrafficDirection_t value) \
956 return SetTrafficDirection(TOSTRING(index), value); \
958 inline TrafficDirection_t GetTraffic##index##Direction() const \
960 return GetTrafficDirection(TOSTRING(index)); \
962 inline void SetTraffic##index##StartTime(Time value) \
964 return SetTrafficStartTime(TOSTRING(index), value); \
966 inline Time GetTraffic##index##StartTime() const \
968 return GetTrafficStartTime(TOSTRING(index)); \
970 inline void SetTraffic##index##StopTime(Time value) \
972 return SetTrafficStopTime(TOSTRING(index), value); \
974 inline Time GetTraffic##index##StopTime() const \
976 return GetTrafficStopTime(TOSTRING(index)); \
978 inline void SetTraffic##index##StartDelay(Time value) \
980 return SetTrafficStartDelay(TOSTRING(index), value); \
982 inline Time GetTraffic##index##StartDelay() const \
984 return GetTrafficStartDelay(TOSTRING(index)); \
SatLinkDir_t
Link direction used for packet tracing.
PreDefinedScenario_t
Values for pre-defined scenarios to be used by helper when building satellite network topology base.
ErrorModel
Error model enum.
InterferenceModel
Interference model enum.
std::map< std::string, TrafficConfiguration_t > m_trafficModel
Ptr< RandomVariableStream > m_utCount
Ptr< RandomVariableStream > m_utUserCount
void SetTrafficProtocol(std::string trafficModel, TransportLayerProtocol_t protocol)
Time GetTrafficStartDelay(std::string trafficModel) const
void SetTrafficStartTime(std::string trafficModel, Time startTime)
std::string m_enabledBeams
TransportLayerProtocol_t GetTrafficProtocol(std::string trafficModel) const
bool m_activateStatistics
void SetTrafficStopTime(std::string trafficModel, Time stopTime)
Ptr< RandomVariableStream > m_utMobileUserCount
SimulationHelper::CrTxConf_t m_crTxConf
TrafficDirection_t GetTrafficDirection(std::string trafficModel) const
TRAFFIC_MODEL_ATTRIBUTE_ACCESSOR_DEFINE(Http)
Time GetTrafficStopTime(std::string trafficModel) const
double GetTrafficPercentage(std::string trafficModel) const
std::string m_mobileUtsFolder
TypeId GetInstanceTypeId(void) const
Derived from Object.
TRAFFIC_MODEL_ATTRIBUTE_ACCESSOR_DEFINE(Cbr)
SimulationHelperConf()
Default constructor.
static TypeId GetTypeId(void)
Derived from Object.
Time GetTrafficStartTime(std::string trafficModel) const
bool m_activateProgressLogging
TRAFFIC_MODEL_ATTRIBUTE_ACCESSOR_DEFINE(Nrtv)
void SetTrafficStartDelay(std::string trafficModel, Time startDelay)
void SetTrafficDirection(std::string trafficModel, TrafficDirection_t direction)
void SetTrafficPercentage(std::string trafficModel, double percentage)
virtual ~SimulationHelperConf()
Destructor.
TRAFFIC_MODEL_ATTRIBUTE_ACCESSOR_DEFINE(OnOff)
A helper to make it easier to create example simulation cases.
uint32_t GetNextUtCount(uint32_t beamId=0) const
Get next UT count from internal random variable stream.
void EnableCrdsa()
Enable CRDSA random access.
Ptr< SatCnoHelper > m_cnoHelper
void ProgressCb()
Callback that prints simulation progress to stdout.
std::string m_simulationName
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction, Time startTime, Time stopTime, Time startDelay, double percentage)
Install simple traffic model from GW users to UT users or vice versa.
void SetErrorModel(SatPhyRxCarrierConf::ErrorModel em, double errorRate=0.0)
Set simulation error model.
Ptr< SatTrafficHelper > m_trafficHelper
void SetupOutputPath()
Check if output path has been set.
void SetUserCountPerMobileUt(uint32_t count)
Set user count per mobile UT.
void EnableAcm(SatEnums::SatLinkDir_t dir)
Enable ACM for a simulation direction.
Time & GetSimTime()
Get simulation time.
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction)
void DoDispose(void)
Disposing.
void SetSimulationTime(Time time)
Set simulation time.
SimulationHelper()
Default constructor, which is not used.
void ConfigureFrequencyBands()
Configure the default setting for the forward and return link frequencies.
virtual ~SimulationHelper()
Destructor.
void DisableAcm(SatEnums::SatLinkDir_t dir)
Disable ACM for a simulation direction.
void ConfigureAttributesFromFile(std::string filePath, bool overrideManualConfiguration=true)
Configure this instance after reading input attributes from XML file.
std::map< uint32_t, Ptr< RandomVariableStream > > m_utCount
Ptr< SatCnoHelper > GetCnoHelper()
Get the C/N0 helper to customize C/N0 on some nodes.
void DisableProgressLogs()
Disables simulation progress logs.
void SetIdealPhyParameterization()
Set ideal channel/physical layer parameterization.
void DisableFca()
Disable free capacity allocation.
Ptr< SatHelper > m_satHelper
Ptr< SatHelper > CreateSatScenario(SatHelper::PreDefinedScenario_t scenario=SatHelper::NONE, const std::string &mobileUtsFolder="")
Create the satellite scenario.
void CreateDefaultRtnLinkStats()
Create stats collectors if needed and set default statistics settings for both RTN link.
Ptr< SatGroupHelper > m_groupHelper
Ptr< SatListPositionAllocator > m_commonUtPositions
void RunSimulation()
Run the simulation.
void SetSimulationTime(double seconds)
Set simulation time in seconds.
void EnableFca()
Enable free capacity allocation.
std::string StoreAttributesToFile(std::string fileName, bool outputAttributes=false)
Store all used attributes.
void SetCrTxConf(CrTxConf_t crTxConf)
bool m_enableInputFileUtListPositions
void SetGwUserCount(uint32_t gwUserCount)
Set the number of GW users in the scenario.
void EnableOnlyConstantRate(uint32_t rcIndex, double rateKbps)
Enable only CRA for a given RC index.
EventId m_progressReportEvent
void EnableExternalFadingInputTrace()
Enable external fading input.
void EnableOutputTraces()
Enable all output traces.
void ConfigureLinkBudget()
Configure all link budget related attributes.
void EnableSlottedAloha()
Enable slotted ALOHA random access.
void DisableAllCapacityAssignmentCategories()
Disable all capacity allocation categories: CRA/VBDC/RBDC.
void EnableArq(SatEnums::SatLinkDir_t dir)
Enable ARQ.
void ConfigureFrame(uint32_t superFrameId, double bw, double carrierBw, double rollOff, double carrierSpacing, bool isRandomAccess=false)
Configure a frame for a certain superframe id.
void EnableOnlyRbdc(uint32_t rcIndex)
Enable only RBDC for a given RC index.
void EnableOnlyVbdc(uint32_t rcIndex)
Enable only VBDC for a given RC index.
void SetUtPositionAllocatorForBeam(uint32_t beamId, Ptr< SatListPositionAllocator > posAllocator)
Set a list position allocator for UTs of a specific beam.
void SetUtCountPerBeam(uint32_t count)
Set UT count per beam.
Time m_progressUpdateInterval
bool m_progressLoggingEnabled
void InstallLoraTrafficModel(LoraTrafficModel_t trafficModel, Time interval, uint32_t packetSize, Time startTime, Time stopTime, Time startDelay)
Ptr< SatHelper > GetSatelliteHelper()
If lower layer API access is required, use this to access SatHelper.
Ptr< SatTrafficHelper > GetTrafficHelper()
Get the traffic helper to create more complex traffics.
void SetGwUserId(uint32_t gwUserId)
Set the ID of the GW user for traffic models.
TypeId GetInstanceTypeId(void) const
Derived from Object.
void ReadInputAttributesFromFile(std::string filePath)
Read input attributes from XML file.
void CreateDefaultFwdLinkStats()
Create stats collectors if needed and set default statistics settings for both FWD link.
void DisableRandomAccess()
Disable random access.
void EnablePeriodicalControlSlots(Time periodicity)
Enable periodical control slots.
Ptr< SatStatsHelperContainer > GetStatisticsContainer()
Get the statistics container of this helper.
void EnableRandomAccess()
Enable random access.
void EnableUtListPositionsFromInputFile(std::string inputFile, bool checkBeams=true)
Enable reading UT list positions from input file.
std::set< uint32_t > m_enabledBeams
void SetUserCountPerUt(uint32_t count)
Set user count per UT.
void CreateDefaultStats()
Create stats collectors and set default statistics settings for both FWD and RTN links.
std::string m_simulationTag
std::set< uint32_t > GetBeamSet(void) const
void SetOutputPath(std::string path)
Force a output file path to this simulation instead of default satellite/data/sims/.
uint32_t GetNextUtUserCount() const
Get next UT user count from internal random variable stream.
Ptr< SatGroupHelper > GetGroupHelper()
Get the group helper.
void SetInterferenceModel(SatPhyRxCarrierConf::InterferenceModel ifModel, double constantIf=0.0)
Set simulation interference model.
void SetBeams(const std::string &beamList)
Ptr< RandomVariableStream > m_utMobileUserCount
const std::set< uint32_t > & GetBeams()
Get enabled beams in integer format.
bool HasSinkInstalled(Ptr< Node > node, uint16_t port)
Check if node has a PacketSink installed at certain port.
std::map< uint32_t, Ptr< SatListPositionAllocator > > m_utPositionsByBeam
void EnableProgressLogs()
Enables simulation progress logging.
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction, Time startTime, Time stopTime)
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction, Time startTime)
void InstallTrafficModel(TrafficModel_t trafficModel, TransportLayerProtocol_t protocol, TrafficDirection_t direction, Time startTime, Time stopTime, Time startDelay)
bool m_inputFileUtPositionsCheckBeams
bool IsBeamEnabled(uint32_t beamId) const
Check if a beam is enabled.
void SetCommonUtPositionAllocator(Ptr< SatListPositionAllocator > posAllocator)
Set common UT position allocator for all beams.
void ConfigureFwdLinkBeamHopping()
Configure the beam hopping functionality for the FWD link.
void AddDefaultUiArguments(CommandLine &cmd)
Add default command line arguments for the simulation.
Ptr< SatStatsHelperContainer > m_statContainer
void SetOutputTag(std::string tag)
Set simulation output tag, which is the basename of the directory where output files are stored.
Ptr< RandomVariableStream > m_utUserCount
bool m_randomAccessConfigured
uint32_t m_numberOfConfiguredFrames
static TypeId GetTypeId(void)
Derived from Object.
std::string m_enabledBeamsStr
void SetDefaultValues()
Set default values shared by all examples using SimulationHelper.
void SetBeamSet(std::set< uint32_t > beamSet)
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
TrafficDirection_t m_direction
TransportLayerProtocol_t m_protocol