sat-environmental-variables-example.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Magister Solutions
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: Frans Laakso <frans.laakso@magister.fi>
19  *
20  */
21 
22 #include "ns3/core-module.h"
23 #include "ns3/satellite-module.h"
24 
25 #include <stdint.h>
26 
27 using namespace ns3;
28 
39 NS_LOG_COMPONENT_DEFINE("sat-environmental-variables-example");
40 
41 int
42 main(int argc, char* argv[])
43 {
44  LogComponentEnable("sat-environmental-variables-example", LOG_LEVEL_INFO);
45  LogComponentEnable("SatEnvVariables", LOG_LEVEL_INFO);
46 
48  auto simulationHelper = CreateObject<SimulationHelper>("exampleCampaign");
49  simulationHelper->SetOutputTag("exampleTag");
50  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
51 
52  CommandLine cmd;
53  simulationHelper->AddDefaultUiArguments(cmd);
54  cmd.Parse(argc, argv);
55 
57  Ptr<SatEnvVariables> envVariables = CreateObject<SatEnvVariables>();
58 
60  Simulator::Schedule(MilliSeconds(0),
62  envVariables);
63  Simulator::Schedule(MilliSeconds(1), &SatEnvVariables::GetPathToExecutable, envVariables);
64  Simulator::Schedule(MilliSeconds(2), &SatEnvVariables::GetDataPath, envVariables);
65  Simulator::Schedule(MilliSeconds(3), &SatEnvVariables::GetOutputPath, envVariables);
66  Simulator::Schedule(MilliSeconds(4), &SatEnvVariables::LocateDataDirectory, envVariables);
67  Simulator::Schedule(MilliSeconds(5),
69  envVariables,
70  "contrib/satellite/data");
71  Simulator::Schedule(MilliSeconds(6),
73  envVariables,
74  "contrib/satellite/data/notfound");
75  Simulator::Schedule(MilliSeconds(7), &SatEnvVariables::GetCurrentDateAndTime, envVariables);
76 
77  simulationHelper->SetSimulationTime(Seconds(1));
78  simulationHelper->RunSimulation();
79 
80  return 0;
81 }
std::string GetPathToExecutable()
Function for getting the path to executable.
std::string GetOutputPath()
Function for getting the simulation folder.
std::string GetCurrentWorkingDirectory()
Function for getting the path to current working directory.
std::string LocateDataDirectory()
Function for locating the data directory within the NS-3 simulator folder.
bool IsValidDirectory(std::string path)
Function for checking if the directory exists.
std::string GetDataPath()
Function for locating the data folder.
std::string LocateDirectory(std::string initialPath)
Function for locating a specific directory within the NS-3 simulator folder.
std::string GetCurrentDateAndTime()
Returns current real world date and time.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.