Keep track of the orbital position and velocity of a satellite. More...
#include "leo-circular-orbit-mobility-model.h"
Public Member Functions | |
| LeoCircularOrbitMobilityModel () | |
| constructor | |
| ~LeoCircularOrbitMobilityModel () override | |
| destructor | |
| Ptr< MobilityModel > | Copy () const override |
| Copy function allows one to copy the underlying MobilityModel from a MobilityModel pointer, by calling each children Copy implementation. | |
| Vector | DoGetGeocentricPosition () const override |
| Returns the Geocentric Position of the Node in ECEF (cartesian). | |
| double | GetAltitude () const |
| Gets the altitude in m. | |
| double | GetAltitudeKm () const |
| Gets the altitude in km (not the usual meters used in ns-3). | |
| double | GetAngularVelocity () const |
| Get the orbital angular velocity. | |
| double | GetInclination () const |
| Gets the inclination. | |
| double | GetSpeed () const |
| Gets the speed of the node. | |
| void | SetAltitude (double h) |
| Sets the altitude in m. | |
| void | SetAltitudeKm (double h) |
| Sets the altitude in km (not the usual meters used in ns-3). | |
| void | SetInclination (double incl) |
| Sets the inclination. | |
| Public Member Functions inherited from ns3::GeocentricConstantPositionMobilityModel | |
| GeocentricConstantPositionMobilityModel ()=default | |
| Create a position located at coordinates (0,0,0). | |
| ~GeocentricConstantPositionMobilityModel () override=default | |
| virtual Vector | GetCoordinateTranslationReferencePoint () const |
| Get the reference point for coordinate conversion. | |
| double | GetDistanceFrom (Ptr< const GeocentricConstantPositionMobilityModel > other) const |
| virtual double | GetElevationAngle (Ptr< const GeocentricConstantPositionMobilityModel > other) |
| Computes elevation angle between a ground terminal and a HAPS/Satellite. | |
| virtual Vector | GetGeocentricPosition () const |
| Get the position using Geocentric Cartesian coordinates. | |
| virtual Vector | GetGeographicPosition () const |
| Get the position using geographic (geodetic) coordinates. | |
| virtual Vector | GetPosition () const |
| virtual void | SetCoordinateTranslationReferencePoint (const Vector &refPoint) |
| Set the reference point for coordinate conversion. | |
| virtual void | SetGeocentricPosition (const Vector &position) |
| Set the position using Geocentric Cartesian coordinates. | |
| virtual void | SetGeographicPosition (const Vector &latLonAlt) |
| Set the position using geographic coordinates. | |
| virtual void | SetPosition (const Vector &position) |
| Public Member Functions inherited from ns3::MobilityModel | |
| MobilityModel () | |
| ~MobilityModel () override=0 | |
| int64_t | AssignStreams (int64_t stream) |
| Assign a fixed random variable stream number to the random variables used by this model. | |
| double | GetDistanceFrom (Ptr< const MobilityModel > position) const |
| Vector | GetPosition () const |
| Vector | GetPositionWithReference (const Vector &referencePosition) const |
| This method may be used if the position returned may depend on some reference position provided. | |
| double | GetRelativeSpeed (Ptr< const MobilityModel > other) const |
| Vector | GetVelocity () const |
| void | SetPosition (const Vector &position) |
| Public Member Functions inherited from ns3::Object | |
| Object () | |
| Caller graph was not generated because of its size. | |
| ~Object () override | |
| Destructor. | |
| void | AggregateObject (Ptr< Object > other) |
| Aggregate two Objects together. | |
| void | Dispose () |
| Dispose of this Object. | |
| AggregateIterator | GetAggregateIterator () const |
| Get an iterator to the Objects aggregated to this one. | |
| TypeId | GetInstanceTypeId () const final |
| Get the most derived TypeId for this Object. | |
| template<> | |
| Ptr< Object > | GetObject () const |
| Specialization of () for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject () const |
| Get a pointer to the requested aggregated Object. | |
| template<> | |
| Ptr< Object > | GetObject (TypeId tid) const |
| Specialization of (TypeId tid) for objects of type ns3::Object. | |
| template<typename T> | |
| Ptr< T > | GetObject (TypeId tid) const |
| Get a pointer to the requested aggregated Object by TypeId. | |
| void | Initialize () |
| Invoke DoInitialize on all Objects aggregated to this one. | |
| bool | IsInitialized () const |
| Check if the object has been initialized. | |
| void | UnidirectionalAggregateObject (Ptr< Object > other) |
| Aggregate an Object to another Object. | |
| Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
| SimpleRefCount () | |
| Default constructor. | |
| uint32_t | GetReferenceCount () const |
| Get the reference count of the object. | |
| SimpleRefCount & | operator= (const SimpleRefCount &o) |
| Assignment operator. | |
| void | Ref () const |
| Increment the reference count. | |
| void | Unref () const |
| Decrement the reference count. | |
| Public Member Functions inherited from ns3::ObjectBase | |
| virtual | ~ObjectBase () |
| Virtual destructor. | |
| void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
| Get the value of an attribute, raising fatal errors if unsuccessful. | |
| bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
| Get the value of an attribute without raising errors. | |
| void | SetAttribute (std::string name, const AttributeValue &value) |
| Set a single attribute, raising fatal errors if unsuccessful. | |
| bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
| Set a single attribute without raising errors. | |
| bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
| Connect a TraceSource to a Callback with a context. | |
| bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
| Connect a TraceSource to a Callback without a context. | |
| bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected with a context. | |
| bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
| Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
| Static Public Member Functions inherited from ns3::GeocentricConstantPositionMobilityModel | |
| static TypeId | GetTypeId () |
| Register this type with the TypeId system. | |
| Static Public Member Functions inherited from ns3::MobilityModel | |
| static TypeId | GetTypeId () |
| Register this type with the TypeId system. | |
| Static Public Member Functions inherited from ns3::Object | |
| static TypeId | GetTypeId () |
| Register this type. | |
| Static Public Member Functions inherited from ns3::ObjectBase | |
| static TypeId | GetTypeId () |
| Get the type ID. | |
Private Member Functions | |
| double | CalcLongitude (Time t) const |
| Calculate the ECEF longitude of the ascending node at simulation time t. | |
| Vector | CalcPosition (Time t) const |
| Calculate the position at time t. | |
| void | DoDispose () override |
| Destructor implementation. | |
| Vector | DoGetPosition () const override |
| Returns the node current position. | |
| Vector | DoGetVelocity () const override |
| Returns the current velocity of the node. | |
| void | DoInitialize () override |
| Initialize() implementation. | |
| void | DoSetPosition (const Vector &position) override |
| Sets the node position via argument. | |
| void | NotifyCourseChangeAndReschedule () |
| Fire NotifyCourseChange and reschedule at m_resolutionTimeStep. | |
| Vector3D | PlaneNorm (Time t) const |
| Get the normal vector of the orbital plane. | |
| Vector3D | RotatePlane (double theta, const Vector3D &v, Time t) const |
| Rotates a position vector by angle 'a' around the orbital plane normal, using the Rodrigues rotation formula (see https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula ). | |
Private Attributes | |
| double | m_argumentOfLatitude |
| Argument of latitude in rad. | |
| EventId | m_courseChangeEvent |
| Event for course change notification. | |
| double | m_inclination |
| Inclination in rad. | |
| double | m_longitude |
| Longitudinal offset in rad. | |
| double | m_orbitalSpeed |
| Orbital speed in m/s; negative means compute from gravity. | |
| double | m_orbitHeight |
| Orbit height in km. | |
| Time | m_resolutionTimeStep |
| Time interval between CourseChange notifications; zero disables periodic notifications. | |
Additional Inherited Members | |
| Public Types inherited from ns3::MobilityModel | |
| typedef void(* | TracedCallback) (Ptr< const MobilityModel > model) |
| TracedCallback signature. | |
| Protected Member Functions inherited from ns3::MobilityModel | |
| void | NotifyCourseChange () const |
| Must be invoked by subclasses when the course of the position changes to notify course change listeners. | |
| Protected Member Functions inherited from ns3::Object | |
| Object (const Object &o) | |
| Copy an Object. | |
| virtual void | NotifyNewAggregate () |
| Notify all Objects aggregated to this one of a new Object being aggregated. | |
| Protected Member Functions inherited from ns3::ObjectBase | |
| void | ConstructSelf (const AttributeConstructionList &attributes) |
| Complete construction of ObjectBase; invoked by derived classes. | |
| virtual void | NotifyConstructionCompleted () |
| Notifier called once the ObjectBase is fully constructed. | |
| Related Symbols inherited from ns3::ObjectBase | |
| static TypeId | GetObjectIid () |
| Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
Keep track of the orbital position and velocity of a satellite.
This uses simple circular orbits based on the inclination of the orbital plane and the altitude of the satellite. Assumes earth is a perfect sphere.
Note: Position in DoSetPosition() is in degrees, not the usual meters. Note: Altitude is stored in km, not the usual ns-3 m.
This model is distinct from GeocentricEcefMobilityModel in that it implements a dynamic circular orbital model, whereas GeocentricEcefMobilityModel is intended for ECEF coordinates that do not evolve according to orbital dynamics.
Definition at line 42 of file leo-circular-orbit-mobility-model.h.
| ns3::LeoCircularOrbitMobilityModel::LeoCircularOrbitMobilityModel | ( | ) |
constructor
Definition at line 66 of file leo-circular-orbit-mobility-model.cc.
References ns3::GeocentricConstantPositionMobilityModel::GeocentricConstantPositionMobilityModel(), m_argumentOfLatitude, m_longitude, m_orbitalSpeed, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
override |
destructor
Definition at line 82 of file leo-circular-orbit-mobility-model.cc.
References m_courseChangeEvent, and NS_LOG_FUNCTION.
Calculate the ECEF longitude of the ascending node at simulation time t.
The orbital plane drifts westward in the ECEF frame because the Earth rotates eastward, so this returns m_longitude minus the Earth-rotation angle accumulated over time t.
| t | time |
Definition at line 140 of file leo-circular-orbit-mobility-model.cc.
References ns3::Days(), and m_longitude.
Referenced by CalcPosition(), and PlaneNorm().
|
private |
Calculate the position at time t.
The returned Vector contains Cartesian ECEF coordinates in meters. Note that this differs from DoSetPosition(), where the Vector encodes angular orbital parameters (longitude and offset in degrees); that discrepancy is a consequence of the MobilityModel base class interface, which uses a single Vector type for both input and output.
| t | simulation time |
Definition at line 171 of file leo-circular-orbit-mobility-model.cc.
References CalcLongitude(), GetAngularVelocity(), ns3::Time::GetSeconds(), m_argumentOfLatitude, m_inclination, m_orbitHeight, ns3::M_PER_KM, RotatePlane(), and x.
Referenced by DoGetGeocentricPosition(), DoGetPosition(), and NotifyCourseChangeAndReschedule().
|
inlineoverridevirtual |
Copy function allows one to copy the underlying MobilityModel from a MobilityModel pointer, by calling each children Copy implementation.
This is primarily used by wraparound models for the spectrum channel.
Reimplemented from ns3::GeocentricConstantPositionMobilityModel.
Definition at line 119 of file leo-circular-orbit-mobility-model.h.
References ns3::CreateObject().
|
overrideprivatevirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Caller graph was not generated because of its size.
Reimplemented from ns3::Object.
Definition at line 212 of file leo-circular-orbit-mobility-model.cc.
References ns3::Object::DoDispose(), m_courseChangeEvent, and NS_LOG_FUNCTION.
|
overridevirtual |
Returns the Geocentric Position of the Node in ECEF (cartesian).
Reimplemented from ns3::GeocentricConstantPositionMobilityModel.
Definition at line 227 of file leo-circular-orbit-mobility-model.cc.
References CalcPosition(), and ns3::Simulator::Now().
|
overrideprivatevirtual |
Returns the node current position.
Reimplemented from ns3::GeocentricConstantPositionMobilityModel.
Definition at line 234 of file leo-circular-orbit-mobility-model.cc.
References CalcPosition(), and ns3::Simulator::Now().
Referenced by DoGetVelocity().
|
overrideprivatevirtual |
Returns the current velocity of the node.
Reimplemented from ns3::GeocentricConstantPositionMobilityModel.
Definition at line 109 of file leo-circular-orbit-mobility-model.cc.
References ns3::CrossProduct(), DoGetPosition(), ns3::Vector3D::GetLength(), GetSpeed(), ns3::Simulator::Now(), and PlaneNorm().
|
overrideprivatevirtual |
Initialize() implementation.
This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 197 of file leo-circular-orbit-mobility-model.cc.
References ns3::Object::DoInitialize(), m_courseChangeEvent, m_resolutionTimeStep, NotifyCourseChangeAndReschedule(), NS_LOG_FUNCTION, NS_LOG_INFO, ns3::Time::S, ns3::Simulator::Schedule(), and ns3::Seconds().
|
overrideprivatevirtual |
Sets the node position via argument.
Note: This method deviates from the MobilityModel interface which typically expects position in meters. For this model, position is interpreted as angular coordinates (degrees) because specifying orbital parameters (longitude of ascending node and offset) is more intuitive in degrees than in meters relative to the earth's center.
| position | position.x is the longitude of the ascending node in degrees; position.y is the argument of latitude on the orbital plane in degrees. Both are converted to radians internally. |
Reimplemented from ns3::GeocentricConstantPositionMobilityModel.
Definition at line 240 of file leo-circular-orbit-mobility-model.cc.
References ns3::DegreesToRadians(), GetAltitudeKm(), GetAngularVelocity(), GetInclination(), m_argumentOfLatitude, m_longitude, ns3::MobilityModel::NotifyCourseChange(), NS_LOG_FUNCTION, and NS_LOG_INFO.
| double ns3::LeoCircularOrbitMobilityModel::GetAltitude | ( | ) | const |
Gets the altitude in m.
Definition at line 257 of file leo-circular-orbit-mobility-model.cc.
References GetAltitudeKm(), and ns3::M_PER_KM.
| double ns3::LeoCircularOrbitMobilityModel::GetAltitudeKm | ( | ) | const |
Gets the altitude in km (not the usual meters used in ns-3).
Definition at line 270 of file leo-circular-orbit-mobility-model.cc.
References ns3::GeographicPositions::EARTH_SPHERE_RADIUS, m_orbitHeight, and ns3::M_PER_KM.
Referenced by DoSetPosition(), GetAltitude(), and GetTypeId().
| double ns3::LeoCircularOrbitMobilityModel::GetAngularVelocity | ( | ) | const |
Get the orbital angular velocity.
Computed from Keplerian mechanics: omega = sqrt(GM / r^3). Negated for retrograde orbits (inclination > 90 degrees).
If the user set an orbital angular velocity >= 0, it will be used instead.
Definition at line 146 of file leo-circular-orbit-mobility-model.cc.
References ns3::GeographicPositions::LEO_EARTH_GGC, m_inclination, m_orbitalSpeed, m_orbitHeight, and ns3::M_PER_KM.
Referenced by CalcPosition(), and DoSetPosition().
| double ns3::LeoCircularOrbitMobilityModel::GetInclination | ( | ) | const |
Gets the inclination.
Definition at line 283 of file leo-circular-orbit-mobility-model.cc.
References m_inclination, and ns3::RadiansToDegrees().
Referenced by DoSetPosition(), and GetTypeId().
| double ns3::LeoCircularOrbitMobilityModel::GetSpeed | ( | ) | const |
Gets the speed of the node.
Definition at line 95 of file leo-circular-orbit-mobility-model.cc.
References ns3::GeographicPositions::LEO_EARTH_GGC, m_orbitalSpeed, m_orbitHeight, and ns3::M_PER_KM.
Referenced by DoGetVelocity().
|
static |
Get the type ID.
Definition at line 32 of file leo-circular-orbit-mobility-model.cc.
References ns3::GeocentricConstantPositionMobilityModel::GeocentricConstantPositionMobilityModel(), LeoCircularOrbitMobilityModel(), GetAltitudeKm(), GetInclination(), m_orbitalSpeed, m_resolutionTimeStep, ns3::MakeDoubleAccessor(), ns3::MakeDoubleChecker(), ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::Seconds(), SetAltitudeKm(), SetInclination(), and ns3::TypeId::SetParent().
|
private |
Fire NotifyCourseChange and reschedule at m_resolutionTimeStep.
Definition at line 185 of file leo-circular-orbit-mobility-model.cc.
References CalcPosition(), m_courseChangeEvent, m_resolutionTimeStep, ns3::MobilityModel::NotifyCourseChange(), NotifyCourseChangeAndReschedule(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Simulator::Schedule().
Referenced by DoInitialize(), and NotifyCourseChangeAndReschedule().
Get the normal vector of the orbital plane.
| t | the amount of time passed since the start of the simulation |
Definition at line 119 of file leo-circular-orbit-mobility-model.cc.
References CalcLongitude(), and m_inclination.
Referenced by DoGetVelocity(), and RotatePlane().
|
private |
Rotates a position vector by angle 'a' around the orbital plane normal, using the Rodrigues rotation formula (see https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula ).
| theta | angle by which to rotate, in radians |
| v | position vector to rotate, in meters (ECEF) |
| t | time passed since simulation start (used to compute the current orbital plane normal) |
Definition at line 128 of file leo-circular-orbit-mobility-model.cc.
References ns3::CrossProduct(), PlaneNorm(), and v.
Referenced by CalcPosition().
| void ns3::LeoCircularOrbitMobilityModel::SetAltitude | ( | double | h | ) |
Sets the altitude in m.
| h | the altitude in m (above Earth surface) |
Definition at line 263 of file leo-circular-orbit-mobility-model.cc.
References ns3::M_PER_KM, NS_LOG_FUNCTION, and SetAltitudeKm().
| void ns3::LeoCircularOrbitMobilityModel::SetAltitudeKm | ( | double | h | ) |
Sets the altitude in km (not the usual meters used in ns-3).
| h | the altitude in km (above Earth surface) |
Definition at line 276 of file leo-circular-orbit-mobility-model.cc.
References ns3::GeographicPositions::EARTH_SPHERE_RADIUS, m_orbitHeight, ns3::M_PER_KM, and NS_LOG_FUNCTION.
Referenced by GetTypeId(), and SetAltitude().
| void ns3::LeoCircularOrbitMobilityModel::SetInclination | ( | double | incl | ) |
Sets the inclination.
| incl | the inclination in degrees |
Definition at line 289 of file leo-circular-orbit-mobility-model.cc.
References ns3::DegreesToRadians(), m_inclination, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
private |
Argument of latitude in rad.
Definition at line 138 of file leo-circular-orbit-mobility-model.h.
Referenced by LeoCircularOrbitMobilityModel(), CalcPosition(), and DoSetPosition().
|
private |
Event for course change notification.
Definition at line 148 of file leo-circular-orbit-mobility-model.h.
Referenced by ~LeoCircularOrbitMobilityModel(), DoDispose(), DoInitialize(), and NotifyCourseChangeAndReschedule().
|
private |
Inclination in rad.
Definition at line 132 of file leo-circular-orbit-mobility-model.h.
Referenced by CalcPosition(), GetAngularVelocity(), GetInclination(), PlaneNorm(), and SetInclination().
|
private |
Longitudinal offset in rad.
Definition at line 135 of file leo-circular-orbit-mobility-model.h.
Referenced by LeoCircularOrbitMobilityModel(), CalcLongitude(), and DoSetPosition().
|
private |
Orbital speed in m/s; negative means compute from gravity.
Definition at line 141 of file leo-circular-orbit-mobility-model.h.
Referenced by LeoCircularOrbitMobilityModel(), GetAngularVelocity(), GetSpeed(), and GetTypeId().
|
private |
Orbit height in km.
Definition at line 129 of file leo-circular-orbit-mobility-model.h.
Referenced by CalcPosition(), GetAltitudeKm(), GetAngularVelocity(), GetSpeed(), and SetAltitudeKm().
|
private |
Time interval between CourseChange notifications; zero disables periodic notifications.
Definition at line 145 of file leo-circular-orbit-mobility-model.h.
Referenced by DoInitialize(), GetTypeId(), and NotifyCourseChangeAndReschedule().