20 #include "ns3/mobility-helper.h"
21 #include "ns3/mobility-model.h"
22 #include "ns3/position-allocator.h"
23 #include "ns3/hierarchical-mobility-model.h"
25 #include "ns3/pointer.h"
26 #include "ns3/config.h"
27 #include "ns3/simulator.h"
28 #include "ns3/names.h"
29 #include "ns3/string.h"
39 m_position = CreateObjectWithAttributes<RandomRectanglePositionAllocator>
40 (
"X",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.0]"),
41 "Y",
StringValue (
"ns3::ConstantRandomVariable[Constant=0.0]"));
140 NS_FATAL_ERROR (
"The requested mobility model is not a mobility model: \""<<
146 object->AggregateObject (model);
153 CreateObjectWithAttributes<HierarchicalMobilityModel> (
"Child",
PointerValue (model),
166 Ptr<Node> node = Names::Find<Node> (nodeName);
186 if (v <= 1e-4 && v >= -1e-4)
190 else if (v <= 1e-3 && v >= 0)
194 else if (v >= -1e-3 && v <= 0)
209 <<
" node=" << node->
GetId ();
210 Vector pos = mobility->GetPosition ();
214 Vector vel = mobility->GetVelocity ();
218 std::streamsize saved_precision = os->precision ();
219 std::ios::fmtflags saved_flags = os->flags ();
221 os->setf (std::ios::fixed,std::ios::floatfield);
222 *os <<
" pos=" << pos.
x <<
":" << pos.
y <<
":" << pos.
z
223 <<
" vel=" << vel.
x <<
":" << vel.
y <<
":" << vel.
z
225 os->flags (saved_flags);
226 os->precision (saved_precision);
232 std::ostringstream oss;
233 oss <<
"/NodeList/" << nodeid <<
"/$ns3::MobilityModel/CourseChange";
253 int64_t currentStream = stream;
265 return (currentStream - stream);
void InstallAll(void)
Perform the work of MobilityHelper::Install on all nodes which exist in the simulation.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
double x
x coordinate of vector
TypeId GetTypeId(void) const
smart pointer class similar to boost::intrusive_ptr
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
std::vector< Ptr< Node > >::const_iterator Iterator
hold variables of type string
Hold a value for an Attribute.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Build bound Callbacks which take varying numbers of arguments, and potentially returning a value...
void SetTypeId(TypeId tid)
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the mobility models (inc...
void PushReferenceMobilityModel(Ptr< Object > reference)
#define NS_FATAL_ERROR(msg)
fatal error handling
Ptr< PositionAllocator > m_position
Keep track of the current position and velocity of an object.
static double DoRound(double v)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
Ptr< Object > Create(void) const
static void CourseChanged(Ptr< OutputStreamWrapper > stream, Ptr< const MobilityModel > mobility)
void AggregateObject(Ptr< Object > other)
static void EnableAscii(Ptr< OutputStreamWrapper > stream, uint32_t nodeid)
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
std::string reference
reference tag
std::string GetName(void) const
void Set(std::string name, const AttributeValue &value)
double y
y coordinate of vector
static Time Now(void)
Return the "current simulation time".
void SetPosition(const Vector &position)
static NodeContainer GetGlobal(void)
Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and ...
std::vector< Ptr< MobilityModel > > m_mobilityStack
instantiate subclasses of ns3::Object.
MobilityHelper()
Construct a Mobility Helper which is used to make life easier when working with mobility models...
uint32_t GetId(void) const
#define NS_LOG_DEBUG(msg)
static void EnableAsciiAll(Ptr< OutputStreamWrapper > stream)
std::string GetMobilityModelType(void) const
void PopReferenceMobilityModel(void)
Remove the top item from the top of the stack of "reference mobility models".
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
Ptr< T > GetObject(void) const
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
double z
z coordinate of vector
Allocate a set of positions.