|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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;
155 nextPosition.x += speed.x * delayLeft.
GetSeconds ();
156 nextPosition.y += speed.y * delayLeft.
GetSeconds ();
157 nextPosition.z += speed.z * delayLeft.
GetSeconds ();
a unique identifier for an interface.
void SetVelocity(const Vector &vel)
Set new velocity vector.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
void DoWalk(Time timeLeft)
Perform a walk operation.
GaussMarkovMobilityModel()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double zMin
The z coordinate of the down bound of the box.
Ptr< RandomVariableStream > m_rndMeanDirection
rv used to assign avg direction
double xMin
The x coordinate of the left bound of the box.
void NotifyCourseChange(void) const
Must be invoked by subclasses when the course of the position changes to notify course change listene...
virtual int64_t DoAssignStreams(int64_t)
The default implementation does nothing but return the passed-in parameter.
Time m_timeStep
duraiton after which direction and speed should change
double m_meanDirection
current mean direction
Ptr< const AttributeChecker > MakeBoxChecker(void)
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
virtual void DoDispose(void)
Destructor implementation.
double yMin
The y coordinate of the bottom bound of the box.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
double m_meanPitch
current mean pitch
Ptr< RandomVariableStream > m_rndMeanVelocity
rv used to assign avg velocity
Ptr< RandomVariableStream > m_rndMeanPitch
rv used to assign avg.
virtual Vector DoGetPosition(void) const
Vector GetCurrentPosition(void) const
Get current position vector.
Gauss-Markov mobility model.
virtual void DoSetPosition(const Vector &position)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Simulation virtual time values and global simulation resolution.
virtual Vector DoGetVelocity(void) const
Ptr< NormalRandomVariable > m_normalDirection
Gaussian rv for next direction value.
void Unpause(void)
Resume mobility from current position at current velocity.
double m_meanVelocity
current mean velocity
double zMax
The z coordinate of the up bound of the box.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Hold variables of type string.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
double m_alpha
tunable constant in the model
Ptr< NormalRandomVariable > m_normalVelocity
Gaussian rv used to for next velocity.
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
void UpdateWithBounds(const Rectangle &rectangle) const
Update position, if not paused, from last position and time of last update.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Update(void) const
Update position, if not paused, from last position and time of last update.
double m_Velocity
current velocity
AttributeValue implementation for Box.
AttributeValue implementation for Time.
void SetPosition(const Vector &position)
Set position vector.
Keep track of the current position and velocity of an object.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
double m_Pitch
current pitch
Ptr< NormalRandomVariable > m_normalPitch
Gaussian rv for next pitch.
bool IsInside(const Vector &position) const
EventId m_event
event id of scheduled start
double m_Direction
current direction
double xMax
The x coordinate of the right bound of the box.
void Start(void)
Initialize the model and calculate new velocity, direction, and pitch.
virtual void DoDispose(void)
Destructor implementation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Vector GetVelocity(void) const
Get velocity; if paused, will return a zero vector.
Ptr< const AttributeAccessor > MakeBoxAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
ConstantVelocityHelper m_helper
constant velocity helper
double yMax
The y coordinate of the top bound of the box.