21 #include "ns3/simulator.h"
22 #include "ns3/double.h"
23 #include "ns3/pointer.h"
24 #include "ns3/string.h"
35 static TypeId tid =
TypeId (
"ns3::GaussMarkovMobilityModel")
37 .SetGroupName (
"Mobility")
39 .AddAttribute (
"Bounds",
40 "Bounds of the area to cruise.",
41 BoxValue (
Box (-100.0, 100.0, -100.0, 100.0, 0.0, 100.0)),
44 .AddAttribute (
"TimeStep",
45 "Change current direction and speed after moving for this time.",
49 .AddAttribute (
"Alpha",
50 "A constant representing the tunable parameter in the Gauss-Markov model.",
53 MakeDoubleChecker<double> ())
54 .AddAttribute (
"MeanVelocity",
55 "A random variable used to assign the average velocity.",
56 StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
58 MakePointerChecker<RandomVariableStream> ())
59 .AddAttribute (
"MeanDirection",
60 "A random variable used to assign the average direction.",
61 StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=6.283185307]"),
63 MakePointerChecker<RandomVariableStream> ())
64 .AddAttribute (
"MeanPitch",
65 "A random variable used to assign the average pitch.",
66 StringValue (
"ns3::ConstantRandomVariable[Constant=0.0]"),
68 MakePointerChecker<RandomVariableStream> ())
69 .AddAttribute (
"NormalVelocity",
70 "A gaussian random variable used to calculate the next velocity value.",
71 StringValue (
"ns3::NormalRandomVariable[Mean=0.0|Variance=1.0|Bound=10.0]"),
73 MakePointerChecker<NormalRandomVariable> ())
74 .AddAttribute (
"NormalDirection",
75 "A gaussian random variable used to calculate the next direction value.",
76 StringValue (
"ns3::NormalRandomVariable[Mean=0.0|Variance=1.0|Bound=10.0]"),
78 MakePointerChecker<NormalRandomVariable> ())
79 .AddAttribute (
"NormalPitch",
80 "A gaussian random variable used to calculate the next pitch value.",
81 StringValue (
"ns3::NormalRandomVariable[Mean=0.0|Variance=1.0|Bound=10.0]"),
83 MakePointerChecker<NormalRandomVariable> ());
127 double one_minus_alpha = 1 -
m_alpha;
135 double cosPit = std::cos (
m_Pitch);
137 double sinPit = std::sin (
m_Pitch);
154 Vector nextPosition = position;
ConstantVelocityHelper m_helper
double x
x coordinate of vector
Simulation virtual time values and global simulation resolution.
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
GaussMarkovMobilityModel()
hold variables of type string
Ptr< RandomVariableStream > m_rndMeanDirection
Vector GetCurrentPosition(void) const
void DoWalk(Time timeLeft)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
virtual double GetValue(void)=0
Returns a random double from the underlying distribution.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
virtual int64_t DoAssignStreams(int64_t)
The default implementation does nothing but return the passed-in parameter.
Ptr< RandomVariableStream > m_rndMeanVelocity
virtual void DoSetPosition(const Vector &position)
Attribute for objects of type ns3::Time.
virtual Vector DoGetVelocity(void) const
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
hold objects of type ns3::Box
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
static void Remove(const EventId &id)
Remove an event from the event list.
Ptr< RandomVariableStream > m_rndMeanPitch
virtual Vector DoGetPosition(void) const
Ptr< NormalRandomVariable > m_normalDirection
void SetVelocity(const Vector &vel)
double y
y coordinate of vector
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Vector GetVelocity(void) const
void UpdateWithBounds(const Rectangle &rectangle) const
Gauss-Markov mobility model.
Time Seconds(double value)
Construct a Time in the indicated unit.
static TypeId GetTypeId(void)
Ptr< NormalRandomVariable > m_normalVelocity
Ptr< NormalRandomVariable > m_normalPitch
bool IsInside(const Vector &position) const
void SetPosition(const Vector &position)
Hold a floating point type.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
double z
z coordinate of vector