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 <vector>
33 
34 namespace ns3
35 {
36 
53 class SatAntennaGainPattern : public Object
54 {
55  public:
60  static TypeId GetTypeId(void);
61 
66  virtual TypeId GetInstanceTypeId(void) const;
67 
72 
78  SatAntennaGainPattern(std::string filePathName, GeoCoordinate defaultSatellitePosition);
79 
81  {
82  }
83 
89  double GetAntennaGain_lin(GeoCoordinate coord, Ptr<SatMobilityModel> mobility) const;
90 
96  GeoCoordinate GetValidRandomPosition(Ptr<SatMobilityModel> mobility) const;
97 
104  bool IsValidPosition(GeoCoordinate coord,
105  TracedCallback<double> cb,
106  Ptr<SatMobilityModel> mobility) const;
107 
108  void GetSatelliteOffset(double& latOffset,
109  double& lonOffset,
110  Ptr<SatMobilityModel> mobility) const;
111 
112  private:
117  void ReadAntennaPatternFromFile(std::string filePathName);
118 
124  std::vector<std::vector<double>> m_antennaPattern;
125 
131  std::vector<std::pair<double, double>> m_validPositions;
132 
138 
142  Ptr<UniformRandomVariable> m_uniformRandomVariable;
143 
147  std::vector<double> m_latitudes;
148 
152  std::vector<double> m_longitudes;
153 
157  double m_minLat;
158 
162  double m_minLon;
163 
167  double m_maxLat;
168 
172  double m_maxLon;
173 
178 
183 
188 
193 
197  static const std::string m_nanStringArray[4];
198  std::vector<std::string> m_nanStrings;
199 };
200 
201 } // namespace ns3
202 
203 #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.
void GetSatelliteOffset(double &latOffset, double &lonOffset, Ptr< SatMobilityModel > mobility) const
virtual TypeId GetInstanceTypeId(void) const
Get the type ID of instance.
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_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 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.