satellite-mobility-model.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: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_MOBILITY_MODEL_H
22 #define SATELLITE_MOBILITY_MODEL_H
23 
24 #include "geo-coordinate.h"
25 
26 #include <ns3/mobility-model.h>
27 
28 namespace ns3
29 {
30 
41 class SatMobilityModel : public MobilityModel
42 {
43  public:
48  static TypeId GetTypeId(void);
49  TypeId GetInstanceTypeId(void) const;
50 
55 
59  virtual ~SatMobilityModel() = 0;
60 
64  GeoCoordinate GetGeoPosition(void) const;
68  void SetGeoPosition(const GeoCoordinate& position);
69 
70  void NotifyGeoCourseChange(void) const;
71 
77  typedef void (*CourseChangeCallback)(const Ptr<const SatMobilityModel> model);
78 
79  private:
86  virtual GeoCoordinate DoGetGeoPosition(void) const = 0;
93  virtual void DoSetGeoPosition(const GeoCoordinate& position) = 0;
103  void DoSetCartesianPosition(const Vector& position) const;
104 
110  virtual Vector DoGetPosition(void) const;
111 
117  virtual void DoSetPosition(const Vector& position);
118 
123  ns3::TracedCallback<Ptr<const SatMobilityModel>> m_satCourseChangeTrace;
124 
125  // These are defined as mutable in order to support 'lazy' update.
126 
127  // position info in Cartesian format
128  mutable Vector m_cartesianPosition;
129 
130  // flag to indicated if position in Cartesian format is out of date.
132 
133  // this is the flag for indicating that when calling method DoSetPosition (defined by class
134  // Mobility Model) is taking Vector filled by longitude (in x), latitude (in y) and altitude (in
135  // z) this enables using ns-3 mobility helper without to convert geo coordinates first to
136  // Cartesian but if for some reason used model needs Cartesian coordinates then this flag can be
137  // turned off through attribute 'AsGeoCoordinates'.
139 };
140 
141 } // namespace ns3
142 
143 #endif /* SATELLITE_MOBILITY_MODEL_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
Keep track of the current position and velocity of an object in satellite network.
void(* CourseChangeCallback)(const Ptr< const SatMobilityModel > model)
Callback signature for SatCourseChange trace source.
virtual ~SatMobilityModel()=0
Destructor for SatMobilityModel.
TypeId GetInstanceTypeId(void) const
virtual GeoCoordinate DoGetGeoPosition(void) const =0
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoSetGeoPosition(const GeoCoordinate &position)=0
void DoSetCartesianPosition(const Vector &position) const
This method is used to force update of cartesian position.
virtual Vector DoGetPosition(void) const
SatMobilityModel()
Default constructor.
GeoCoordinate GetGeoPosition(void) const
virtual void DoSetPosition(const Vector &position)
ns3::TracedCallback< Ptr< const SatMobilityModel > > m_satCourseChangeTrace
Used to alert subscribers that a change in direction, velocity, or position has occurred.
void SetGeoPosition(const GeoCoordinate &position)
void NotifyGeoCourseChange(void) const
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.