Loading...
Searching...
No Matches
satellite-antenna-gain-pattern.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: Jani Puttonen <jani.puttonen@magister.fi>
19 */
20
21#ifndef SATELLITE_ANTENNA_GAIN_PATTERN_H
22#define SATELLITE_ANTENNA_GAIN_PATTERN_H
23
24#include "geo-coordinate.h"
26
27#include "ns3/object.h"
28#include "ns3/random-variable-stream.h"
29#include "ns3/traced-callback.h"
30
31#include <fstream>
32#include <string>
33#include <utility>
34#include <vector>
35
36namespace ns3
37{
38
55class SatAntennaGainPattern : public Object
56{
57 public:
62 static TypeId GetTypeId(void);
63
68
74 SatAntennaGainPattern(std::string filePathName, GeoCoordinate defaultSatellitePosition);
75
84 virtual void NotifyConstructionCompleted() override;
85
89
95 double GetAntennaGain_lin(GeoCoordinate coord, Ptr<SatMobilityModel> mobility) const;
96
102 GeoCoordinate GetValidRandomPosition(Ptr<SatMobilityModel> mobility) const;
103
111 TracedCallback<double> cb,
112 Ptr<SatMobilityModel> mobility) const;
113
114 void GetSatelliteOffset(double& latOffset,
115 double& lonOffset,
116 Ptr<SatMobilityModel> mobility) const;
117
124 double GetCenterLatitude(Ptr<SatMobilityModel> mobility) const;
125
132 double GetCenterLongitude(Ptr<SatMobilityModel> mobility) const;
133
134 private:
139 void ReadAntennaPatternFromFile(std::string filePathName);
140
146 std::vector<std::vector<double>> m_antennaPattern;
147
153 std::vector<std::pair<double, double>> m_validPositions;
154
160
164 Ptr<UniformRandomVariable> m_uniformRandomVariable;
165
169 std::vector<double> m_latitudes;
170
174 std::vector<double> m_longitudes;
175
180
185
189 double m_minLat;
190
194 double m_minLon;
195
199 double m_maxLat;
200
204 double m_maxLon;
205
210
215
220
225
229 static const std::string m_nanStringArray[4];
230 std::vector<std::string> m_nanStrings;
231
232 std::string m_filePathName;
234};
235
236} // namespace ns3
237
238#endif /* SATELLITE_ANTENNA_GAIN_PATTERN_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
double m_centerLatitude
Latitude with best gain.
void GetSatelliteOffset(double &latOffset, double &lonOffset, Ptr< SatMobilityModel > mobility) const
double GetCenterLongitude(Ptr< SatMobilityModel > mobility) const
Get latitude of this beam with best gain, based on satellite given in mobility model.
double GetAntennaGain_lin(GeoCoordinate coord, Ptr< SatMobilityModel > mobility) const
Calculate the antenna gain value for a certain {latitude, longitude} point.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Uniform random variable used for beam selection.
GeoCoordinate GetValidRandomPosition(Ptr< SatMobilityModel > mobility) const
Get a valid random position under this spot-beam coverage.
double m_lonInterval
Interval between longitudes, must be constant.
static const std::string m_nanStringArray[4]
Valid Not-a-Number (NaN) strings.
double m_centerLongitude
Longitude with best gain.
double m_minLon
Minimum longitude value of the antenna gain pattern.
std::vector< double > m_latitudes
All valid latitudes from the file.
double m_maxLat
Maximum latitude value of the antenna gain pattern.
virtual void NotifyConstructionCompleted() override
Notifier called once the ObjectBase is fully constructed.
double m_lonDefaultSatellite
Longitude of default satellite for antenna gain pattern.
bool IsValidPosition(GeoCoordinate coord, TracedCallback< double > cb, Ptr< SatMobilityModel > mobility) const
Check if a given position is under this spot-beam coverage.
double GetCenterLatitude(Ptr< SatMobilityModel > mobility) const
Get latitude of this beam with best gain, based on satellite given in mobility model.
double m_minAcceptableAntennaGainInDb
Minimum acceptable antenna gain for a serving spot-beam.
double m_latDefaultSatellite
Latitude of default satellite for antenna gain pattern.
double m_maxLon
Minimum longitude value of the antenna gain pattern.
double m_minLat
Minimum latitude value of the antenna gain pattern.
void ReadAntennaPatternFromFile(std::string filePathName)
Read the antenna gain pattern from a file.
std::vector< std::pair< double, double > > m_validPositions
Container for valid positions.
std::vector< double > m_longitudes
All valid latitudes from the file.
std::vector< std::vector< double > > m_antennaPattern
Container for the antenna pattern from one spot-beam.
static TypeId GetTypeId(void)
Get the type ID.
double m_latInterval
Interval between latitudes, must be constant.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.