19#include "ns3/angles.h"
20#include "ns3/double.h"
21#include "ns3/nstime.h"
22#include "ns3/simulator.h"
35 TypeId(
"ns3::LeoCircularOrbitMobilityModel")
39 .AddAttribute(
"Altitude",
40 "A height from the earth's surface in kilometers",
46 .AddAttribute(
"Inclination",
47 "The inclination of the orbital plane in degrees",
52 .AddAttribute(
"Speed",
53 "Orbital speed in meters per second; negative to compute from gravity",
57 .AddAttribute(
"Resolution",
58 "Time interval between CourseChange notifications (zero disables). "
59 "Determines how frequently the mobility model notifies course changes.",
115 return (
GetSpeed() / radius) * heading;
134 const double cosTheta = cos(theta);
135 const double sinTheta = sin(theta);
136 return (
v * cosTheta) + (
CrossProduct(k,
v) * sinTheta) + (k * (k *
v) * (1 - cosTheta));
160 (orbitMeters * orbitMeters * orbitMeters));
244 const auto [longitudeDeg, argumentOfLatitudeDeg, satIndex] = position;
248 << longitudeDeg <<
" deg, argument of latitude = " << argumentOfLatitudeDeg
cairo_uint64_t x
_cairo_uint_96by64_32x64_divrem:
This class can be used to hold variables of floating point type such as 'double' or 'float'.
GeocentricConstantPositionMobilityModel()=default
Create a position located at coordinates (0,0,0).
static constexpr double EARTH_SPHERE_RADIUS
Earth's radius in meters if modeled as a perfect sphere.
static constexpr double LEO_EARTH_GGC
Spheroid model to use for earth: perfect sphere (SPHERE), Geodetic Reference System 1980 (GRS80),...
Keep track of the orbital position and velocity of a satellite.
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 ...
~LeoCircularOrbitMobilityModel() override
destructor
double GetInclination() const
Gets the inclination.
double m_longitude
Longitudinal offset in rad.
double GetAltitudeKm() const
Gets the altitude in km (not the usual meters used in ns-3).
double m_orbitalSpeed
Orbital speed in m/s; negative means compute from gravity.
Vector CalcPosition(Time t) const
Calculate the position at time t.
double m_orbitHeight
Orbit height in km.
double GetAltitude() const
Gets the altitude in m.
double GetSpeed() const
Gets the speed of the node.
void SetAltitudeKm(double h)
Sets the altitude in km (not the usual meters used in ns-3).
void SetInclination(double incl)
Sets the inclination.
double m_argumentOfLatitude
Argument of latitude in rad.
Vector3D PlaneNorm(Time t) const
Get the normal vector of the orbital plane.
LeoCircularOrbitMobilityModel()
constructor
Time m_resolutionTimeStep
Time interval between CourseChange notifications; zero disables periodic notifications.
void SetAltitude(double h)
Sets the altitude in m.
double m_inclination
Inclination in rad.
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
Vector DoGetVelocity() const override
Returns the current velocity of the node.
void NotifyCourseChangeAndReschedule()
Fire NotifyCourseChange and reschedule at m_resolutionTimeStep.
double CalcLongitude(Time t) const
Calculate the ECEF longitude of the ascending node at simulation time t.
void DoInitialize() override
Initialize() implementation.
Vector DoGetGeocentricPosition() const override
Returns the Geocentric Position of the Node in ECEF (cartesian).
EventId m_courseChangeEvent
Event for course change notification.
void DoSetPosition(const Vector &position) override
Sets the node position via argument.
Vector DoGetPosition() const override
Returns the node current position.
double GetAngularVelocity() const
Get the orbital angular velocity.
void NotifyCourseChange() const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
virtual void DoInitialize()
Initialize() implementation.
virtual void DoDispose()
Destructor implementation.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
double GetLength() const
Compute the length (magnitude) of the vector.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time Days(double value)
Construct a Time in the indicated unit.
Declaration of LeoCircularOrbitMobilityModel.
log2() macro definition; to deal with Bug 1467.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
constexpr double M_PER_KM
meters in a kilometer
Ptr< const AttributeChecker > MakeDoubleChecker()
Vector3D CrossProduct(const Vector3D &a, const Vector3D &b)
double DegreesToRadians(double degrees)
converts degrees to radians
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
double RadiansToDegrees(double radians)
converts radians to degrees
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.