10#include <ns3/angles.h>
29 TypeId(
"ns3::GeocentricConstantPositionMobilityModel")
31 .SetGroupName(
"Mobility")
35 "The geographic position, in degrees (lat/lon) and meter (alt), in the order: "
36 "latitude, longitude and "
41 .AddAttribute(
"GeographicReferencePoint",
42 "The point, in meters, taken as reference when converting from "
43 "geographic to topographic.",
84 const Vector& position)
117 Vector topographicCoordinates =
121 return topographicCoordinates;
127 Vector geographicCoordinates =
139 Vector cartesianCoordA =
144 Vector cartesianCoordB = other->DoGetGeocentricPosition();
146 double distance = (cartesianCoordA - cartesianCoordB).GetLength();
161 "Latitude must be between -90 deg and +90 deg");
162 NS_ASSERT_MSG(latLonAlt.z >= 0,
"Altitude must be higher or equal than 0 meters");
173 Vector geocentricCoordinates =
178 return geocentricCoordinates;
184 Vector geographicCoordinates =
196 Vector them = other->DoGetGeocentricPosition();
199 Vector& a = (me.z < them.z ? me : them);
200 Vector& b = (me.z < them.z ? them : me);
202 Vector bMinusA = b - a;
203 double numerator = std::abs(a * bMinusA);
204 double denominator = a.GetLength() * bMinusA.GetLength();
205 double x = numerator / denominator;
208 x = std::min(x, 1.0);
209 x = std::max(x, -1.0);
212 double elevAngle = std::abs((180.0 * M_1_PI) * asin(x));
219 const Vector& refPoint)
233 return Vector(0.0, 0.0, 0.0);
Mobility model using geocentric euclidean coordinates, as defined in 38.811 chapter 6....
virtual void SetGeographicPosition(const Vector &latLonAlt)
Set the position using geographic coordinates.
virtual Vector GetPosition() const
virtual Vector GetGeographicPosition() const
Get the position using geographic (geodetic) coordinates.
Vector m_geographicReferencePoint
This is the point (meter) taken as a reference for converting from geographic to topographic (also re...
virtual Vector GetGeocentricPosition() const
Get the position using Geocentric Cartesian coordinates.
virtual Vector GetCoordinateTranslationReferencePoint() const
Get the reference point for coordinate conversion.
static TypeId GetTypeId()
Register this type with the TypeId system.
virtual Vector DoGetGeographicPosition() const
Get the position using geographic (geodetic) coordinates.
virtual void SetPosition(const Vector &position)
void DoSetPosition(const Vector &position) override
Vector DoGetVelocity() const override
Vector DoGetPosition() const override
virtual void DoSetCoordinateTranslationReferencePoint(const Vector &refPoint)
Set the reference point for coordinate conversion.
virtual void DoSetGeographicPosition(const Vector &latLonAlt)
Set the position using geographic coordinates.
virtual void SetCoordinateTranslationReferencePoint(const Vector &refPoint)
Set the reference point for coordinate conversion.
double GetDistanceFrom(Ptr< const GeocentricConstantPositionMobilityModel > other) const
virtual void SetGeocentricPosition(const Vector &position)
Set the position using Geocentric Cartesian coordinates.
virtual Vector DoGetGeocentricPosition() const
Get the position using Geocentric Cartesian coordinates.
virtual void DoSetGeocentricPosition(const Vector &position)
Set the position using Geocentric Cartesian coordinates.
Vector m_position
the constant Geographic position,, in order: latitude (degree), longitude (degree),...
virtual Vector DoGetCoordinateTranslationReferencePoint() const
Get the reference point for coordinate conversion.
double DoGetDistanceFrom(Ptr< const GeocentricConstantPositionMobilityModel > other) const
virtual double GetElevationAngle(Ptr< const GeocentricConstantPositionMobilityModel > other)
Computes elevation angle between a ground terminal and a HAPS/Satellite.
virtual double DoGetElevationAngle(Ptr< const GeocentricConstantPositionMobilityModel > other)
Computes elevation angle between a ground terminal and a HAPS/Satellite.
static Vector TopocentricToGeographicCoordinates(Vector pos, Vector refPoint, EarthSpheroidType sphType)
Conversion from topocentric to geographic.
static Vector GeographicToCartesianCoordinates(double latitude, double longitude, double altitude, EarthSpheroidType sphType)
Converts earth geographic/geodetic coordinates (latitude and longitude in degrees) with a given altit...
static Vector GeographicToTopocentricCoordinates(Vector pos, Vector refPoint, EarthSpheroidType sphType)
Conversion from geographic to topocentric coordinates.
static Vector CartesianToGeographicCoordinates(Vector pos, EarthSpheroidType sphType)
Inverse of GeographicToCartesianCoordinates using [1].
Keep track of the current position and velocity of an object.
void NotifyCourseChange() const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Class GeocentricConstantPositionMobilityModel declaration.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
log2() macro definition; to deal with Bug 1467 .
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double WrapTo180(double a)
Wrap angle in [-180, 180)
Ptr< const AttributeAccessor > MakeVector3DAccessor(T1 a1)
Ptr< const AttributeChecker > MakeVector3DChecker()