21#include <ns3/angles.h>
40 TypeId(
"ns3::GeocentricConstantPositionMobilityModel")
42 .SetGroupName(
"Mobility")
46 "The geographic position, in degrees (lat/lon) and meter (alt), in the order: "
47 "latitude, longitude and "
52 .AddAttribute(
"GeographicReferencePoint",
53 "The point, in meters, taken as reference when converting from "
54 "geographic to topographic.",
95 const Vector& position)
128 Vector topographicCoordinates =
132 return topographicCoordinates;
138 Vector geographicCoordinates =
150 Vector cartesianCoordA =
155 Vector cartesianCoordB = other->DoGetGeocentricPosition();
157 double distance = (cartesianCoordA - cartesianCoordB).GetLength();
172 "Latitude must be between -90 deg and +90 deg");
173 NS_ASSERT_MSG(latLonAlt.z >= 0,
"Altitude must be higher or equal than 0 meters");
184 Vector geocentricCoordinates =
189 return geocentricCoordinates;
195 Vector geographicCoordinates =
207 Vector them = other->DoGetGeocentricPosition();
210 Vector& a = (me.z < them.z ? me : them);
211 Vector& b = (me.z < them.z ? them : me);
213 Vector bMinusA = b - a;
214 double numerator = std::abs(a * bMinusA);
215 double denominator = a.GetLength() * bMinusA.GetLength();
216 double x = numerator / denominator;
219 x = std::min(x, 1.0);
220 x = std::max(x, -1.0);
223 double elevAngle = abs((180.0 * M_1_PI) * asin(x));
230 const Vector& refPoint)
244 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.
AttributeValue implementation for Vector3D.
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...
Ptr< const AttributeAccessor > MakeVector3DAccessor(T1 a1)
Ptr< const AttributeChecker > MakeVector3DChecker()
#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)