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 
36 namespace ns3
37 {
38 
55 class SatAntennaGainPattern : public Object
56 {
57  public:
62  static TypeId GetTypeId(void);
63 
68  virtual TypeId GetInstanceTypeId(void) const;
69 
74 
80  SatAntennaGainPattern(std::string filePathName, GeoCoordinate defaultSatellitePosition);
81 
83  {
84  }
85 
91  double GetAntennaGain_lin(GeoCoordinate coord, Ptr<SatMobilityModel> mobility) const;
92 
98  GeoCoordinate GetValidRandomPosition(Ptr<SatMobilityModel> mobility) const;
99 
106  bool IsValidPosition(GeoCoordinate coord,
107  TracedCallback<double> cb,
108  Ptr<SatMobilityModel> mobility) const;
109 
110  void GetSatelliteOffset(double& latOffset,
111  double& lonOffset,
112  Ptr<SatMobilityModel> mobility) const;
113 
120  double GetCenterLatitude(Ptr<SatMobilityModel> mobility) const;
121 
128  double GetCenterLongitude(Ptr<SatMobilityModel> mobility) const;
129 
130  private:
135  void ReadAntennaPatternFromFile(std::string filePathName);
136 
142  std::vector<std::vector<double>> m_antennaPattern;
143 
149  std::vector<std::pair<double, double>> m_validPositions;
150 
156 
160  Ptr<UniformRandomVariable> m_uniformRandomVariable;
161 
165  std::vector<double> m_latitudes;
166 
170  std::vector<double> m_longitudes;
171 
176 
181 
185  double m_minLat;
186 
190  double m_minLon;
191 
195  double m_maxLat;
196 
200  double m_maxLon;
201 
206 
211 
216 
221 
225  static const std::string m_nanStringArray[4];
226  std::vector<std::string> m_nanStrings;
227 };
228 
229 } // namespace ns3
230 
231 #endif /* SATELLITE_ANTENNA_GAIN_PATTERN_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
SatAntennaGainPattern class holds the antenna gain pattern data for a one single spot-beam.
double m_centerLatitude
Latitude with best gain.
void GetSatelliteOffset(double &latOffset, double &lonOffset, Ptr< SatMobilityModel > mobility) const
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
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.
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.
std::vector< std::string > m_nanStrings
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.