Loading...
Searching...
No Matches
sat-markov-logic-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
27using namespace ns3;
28
37
38NS_LOG_COMPONENT_DEFINE("sat-markov-logic-example");
39
40static double g_elevation = 45;
41static double g_velocity = 0;
42
43static double
45{
46 return g_elevation;
47}
48
49static void
50SetElevation(double elevation)
51{
52 g_elevation = elevation;
53}
54
55static double
57{
58 return g_velocity;
59}
60
61static void
62SetVelocity(double velocity)
63{
64 g_velocity = velocity;
65}
66
67int
68main(int argc, char* argv[])
69{
71 LogComponentEnable("sat-markov-logic-example", LOG_LEVEL_INFO);
72 LogComponentEnable("SatMarkovContainer", LOG_LEVEL_INFO);
73 LogComponentEnable("SatMarkovModel", LOG_LEVEL_INFO);
74 LogComponentEnable("SatMarkovConf", LOG_LEVEL_INFO);
75
77 Config::SetDefault("ns3::SatEnvVariables::SimulationCampaignName",
78 StringValue("example-markov-logic"));
79 Config::SetDefault("ns3::SatEnvVariables::SimulationTag", StringValue(""));
80 Config::SetDefault("ns3::SatEnvVariables::EnableSimulationOutputOverwrite", BooleanValue(true));
81
83 Ptr<SatMarkovConf> markovConf = CreateObject<SatMarkovConf>();
84
85 SatBaseFading::ElevationCallback elevationCb = MakeCallback(&GetElevation);
86 SatBaseFading::VelocityCallback velocityCb = MakeCallback(&GetVelocity);
87
89 Ptr<SatMarkovContainer> markovContainer =
90 CreateObject<SatMarkovContainer>(markovConf, elevationCb, velocityCb);
91
92 Address macAddress;
93
95 Simulator::Schedule(Time("5ms"), &SetVelocity, 0);
96 Simulator::Schedule(Time("10ms"),
98 markovContainer,
99 macAddress,
101 Simulator::Schedule(Time("30ms"),
103 markovContainer,
104 macAddress,
106 Simulator::Schedule(Time("45ms"), &SetElevation, 55);
107 Simulator::Schedule(Time("50ms"),
109 markovContainer,
110 macAddress,
112 Simulator::Schedule(Time("60ms"),
114 markovContainer,
115 macAddress,
117 Simulator::Schedule(Time("90ms"),
119 markovContainer,
120 macAddress,
122 Simulator::Schedule(Time("95ms"), &SetElevation, 75);
123 Simulator::Schedule(Time("100ms"),
125 markovContainer,
126 macAddress,
128 Simulator::Schedule(Time("130ms"),
130 markovContainer,
131 macAddress,
133 Simulator::Schedule(Time("200ms"),
135 markovContainer,
136 macAddress,
138
139 Simulator::Run();
140 Simulator::Destroy();
141
142 return 0;
143}
Callback< double > VelocityCallback
Gets velocity in m/s.
Callback< double > ElevationCallback
Gets elevation angle in degrees.
double DoGetFading(Address macAddress, SatEnums::ChannelType_t channeltype)
Function for getting the fading.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
static double g_velocity
static void SetElevation(double elevation)
static double g_elevation
static double GetVelocity()
static void SetVelocity(double velocity)
static double GetElevation()