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 using namespace ns3;
26 
37 NS_LOG_COMPONENT_DEFINE("sat-environmental-variables-example");
38 
39 int
40 main(int argc, char* argv[])
41 {
42  LogComponentEnable("sat-environmental-variables-example", LOG_LEVEL_INFO);
43  LogComponentEnable("SatEnvVariables", LOG_LEVEL_INFO);
44 
46  auto simulationHelper = CreateObject<SimulationHelper>("exampleCampaign");
47  simulationHelper->SetOutputTag("exampleTag");
48  Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
49 
50  CommandLine cmd;
51  simulationHelper->AddDefaultUiArguments(cmd);
52  cmd.Parse(argc, argv);
53 
55  Ptr<SatEnvVariables> envVariables = CreateObject<SatEnvVariables>();
56 
58  Simulator::Schedule(MilliSeconds(0),
60  envVariables);
61  Simulator::Schedule(MilliSeconds(1), &SatEnvVariables::GetPathToExecutable, envVariables);
62  Simulator::Schedule(MilliSeconds(2), &SatEnvVariables::GetDataPath, envVariables);
63  Simulator::Schedule(MilliSeconds(3), &SatEnvVariables::GetOutputPath, envVariables);
64  Simulator::Schedule(MilliSeconds(4), &SatEnvVariables::LocateDataDirectory, envVariables);
65  Simulator::Schedule(MilliSeconds(5),
67  envVariables,
68  "contrib/satellite/data");
69  Simulator::Schedule(MilliSeconds(6),
71  envVariables,
72  "contrib/satellite/data/notfound");
73  Simulator::Schedule(MilliSeconds(7), &SatEnvVariables::GetCurrentDateAndTime, envVariables);
74 
75  simulationHelper->SetSimulationTime(Seconds(1));
76  simulationHelper->RunSimulation();
77 
78  return 0;
79 }
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.