21 #include "ns3/simulator.h"
22 #include "ns3/double.h"
23 #include "ns3/pointer.h"
24 #include "ns3/string.h"
36 static TypeId tid =
TypeId (
"ns3::GaussMarkovMobilityModel")
38 .SetGroupName (
"Mobility")
40 .AddAttribute (
"Bounds",
41 "Bounds of the area to cruise.",
42 BoxValue (
Box (-100.0, 100.0, -100.0, 100.0, 0.0, 100.0)),
45 .AddAttribute (
"TimeStep",
46 "Change current direction and speed after moving for this time.",
50 .AddAttribute (
"Alpha",
51 "A constant representing the tunable parameter in the Gauss-Markov model.",
54 MakeDoubleChecker<double> ())
55 .AddAttribute (
"MeanVelocity",
56 "A random variable used to assign the average velocity.",
57 StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
59 MakePointerChecker<RandomVariableStream> ())
60 .AddAttribute (
"MeanDirection",
61 "A random variable used to assign the average direction.",
62 StringValue (
"ns3::UniformRandomVariable[Min=0.0|Max=6.283185307]"),
64 MakePointerChecker<RandomVariableStream> ())
65 .AddAttribute (
"MeanPitch",
66 "A random variable used to assign the average pitch.",
67 StringValue (
"ns3::ConstantRandomVariable[Constant=0.0]"),
69 MakePointerChecker<RandomVariableStream> ())
70 .AddAttribute (
"NormalVelocity",
71 "A gaussian random variable used to calculate the next velocity value.",
72 StringValue (
"ns3::NormalRandomVariable[Mean=0.0|Variance=1.0|Bound=10.0]"),
74 MakePointerChecker<NormalRandomVariable> ())
75 .AddAttribute (
"NormalDirection",
76 "A gaussian random variable used to calculate the next direction value.",
77 StringValue (
"ns3::NormalRandomVariable[Mean=0.0|Variance=1.0|Bound=10.0]"),
79 MakePointerChecker<NormalRandomVariable> ())
80 .AddAttribute (
"NormalPitch",
81 "A gaussian random variable used to calculate the next pitch value.",
82 StringValue (
"ns3::NormalRandomVariable[Mean=0.0|Variance=1.0|Bound=10.0]"),
84 MakePointerChecker<NormalRandomVariable> ());
128 double one_minus_alpha = 1 -
m_alpha;
136 double cosPit = std::cos (
m_Pitch);
138 double sinPit = std::sin (
m_Pitch);
155 Vector nextPosition = position;
159 if (delayLeft.
GetSeconds () < 0.0) delayLeft = Seconds (1.0);
ConstantVelocityHelper m_helper
double x
x coordinate of vector
keep track of time values and allow control of global simulation resolution
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
GaussMarkovMobilityModel()
hold variables of type string
Ptr< RandomVariableStream > m_rndMeanDirection
Vector GetCurrentPosition(void) const
void DoWalk(Time timeLeft)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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.
Keep track of the current position and velocity of an object.
double GetSeconds(void) const
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)
hold 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.
static TypeId GetTypeId(void)
Ptr< NormalRandomVariable > m_normalVelocity
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
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