Loading...
Searching...
No Matches
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
28namespace ns3
29{
30
41class SatMobilityModel : public MobilityModel
42{
43 public:
48 static TypeId GetTypeId(void);
49
54
58 virtual ~SatMobilityModel() = 0;
59
67 virtual Ptr<MobilityModel> Copy() const = 0;
68
72 GeoCoordinate GetGeoPosition(void) const;
76 void SetGeoPosition(const GeoCoordinate& position);
77
82 double GetDistanceFrom(Ptr<const SatMobilityModel> position) const;
83
84 void NotifyGeoCourseChange(void) const;
85
91 typedef void (*CourseChangeCallback)(const Ptr<const SatMobilityModel> model);
92
93 private:
100 virtual GeoCoordinate DoGetGeoPosition(void) const = 0;
107 virtual void DoSetGeoPosition(const GeoCoordinate& position) = 0;
117 void DoSetCartesianPosition(const Vector& position) const;
118
124 virtual Vector DoGetPosition(void) const;
125
131 virtual void DoSetPosition(const Vector& position);
132
137 ns3::TracedCallback<Ptr<const SatMobilityModel>> m_satCourseChangeTrace;
138
139 // These are defined as mutable in order to support 'lazy' update.
140
141 // position info in Cartesian format
142 mutable Vector m_cartesianPosition;
143
144 // flag to indicated if position in Cartesian format is out of date.
146
147 // this is the flag for indicating that when calling method DoSetPosition (defined by class
148 // Mobility Model) is taking Vector filled by longitude (in x), latitude (in y) and altitude (in
149 // z) this enables using ns-3 mobility helper without to convert geo coordinates first to
150 // Cartesian but if for some reason used model needs Cartesian coordinates then this flag can be
151 // turned off through attribute 'AsGeoCoordinates'.
153};
154
155} // namespace ns3
156
157#endif /* SATELLITE_MOBILITY_MODEL_H */
GeoCoordinate class is used to store and operate with geodetic coordinates.
void(* CourseChangeCallback)(const Ptr< const SatMobilityModel > model)
Callback signature for SatCourseChange trace source.
virtual ~SatMobilityModel()=0
Destructor for SatMobilityModel.
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.
double GetDistanceFrom(Ptr< const SatMobilityModel > position) const
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)
virtual Ptr< MobilityModel > Copy() const =0
Copy function allows one to copy the underlying MobilityModel from a MobilityModel pointer,...
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.