A Discrete-Event Network Simulator
lorawan @ (+)
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
l
m
n
o
p
q
r
s
t
w
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Symbols
:
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
e
l
v
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
▼
ns-3
►
ns-3 Documentation
►
All Environment Variables
Todo List
Deprecated List
Bug List
►
Topics
►
Namespaces
►
Classes
▼
Files
▼
File List
►
doc
►
examples
▼
src
►
antenna
►
aodv
►
applications
►
bridge
►
brite
►
buildings
►
click
►
config-store
►
core
►
csma
►
csma-layout
►
dsdv
►
dsr
►
energy
►
fd-net-device
►
flow-monitor
►
internet
►
internet-apps
►
lorawan
►
lr-wpan
►
lte
►
mesh
▼
mobility
▼
examples
►
bonnmotion-ns2-example.cc
►
constant-mobility-example.cc
main-grid-topology.cc
►
main-random-topology.cc
►
main-random-walk.cc
mobility-trace-example.cc
►
ns2-mobility-trace.cc
►
reference-point-group-mobility-example.cc
►
helper
►
model
►
test
►
mpi
►
netanim
►
network
►
nix-vector-routing
►
olsr
►
openflow
►
point-to-point
►
point-to-point-layout
►
propagation
►
sixlowpan
►
spectrum
►
stats
►
tap-bridge
►
test
►
topology-read
►
traffic-control
►
uan
►
virtual-net-device
►
visualizer
►
wifi
►
wimax
►
utils
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
main-grid-topology.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006,2007 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*/
6
7
#include "ns3/core-module.h"
8
#include "ns3/mobility-module.h"
9
#include "ns3/network-module.h"
10
11
using namespace
ns3
;
12
13
int
14
main(
int
argc,
char
* argv[])
15
{
16
CommandLine
cmd
(__FILE__);
17
cmd
.Parse(argc, argv);
18
19
NodeContainer
nodes
;
20
21
// create an array of empty nodes for testing purposes
22
nodes
.
Create
(120);
23
24
MobilityHelper
mobility
;
25
// setup the grid itself: objects are laid out
26
// started from (-100,-100) with 20 objects per row,
27
// the x interval between each object is 5 meters
28
// and the y interval between each object is 20 meters
29
mobility
.SetPositionAllocator(
"ns3::GridPositionAllocator"
,
30
"MinX"
,
31
DoubleValue
(-100.0),
32
"MinY"
,
33
DoubleValue
(-100.0),
34
"DeltaX"
,
35
DoubleValue
(5.0),
36
"DeltaY"
,
37
DoubleValue
(20.0),
38
"GridWidth"
,
39
UintegerValue
(20),
40
"LayoutType"
,
41
StringValue
(
"RowFirst"
));
42
// each object will be attached a static position.
43
// i.e., once set by the "position allocator", the
44
// position will never change.
45
mobility
.SetMobilityModel(
"ns3::ConstantPositionMobilityModel"
);
46
47
// finalize the setup by attaching to each object
48
// in the input array a position and initializing
49
// this position with the calculated coordinates.
50
mobility
.Install(
nodes
);
51
52
// iterate our nodes and print their position.
53
for
(
auto
j =
nodes
.
Begin
(); j !=
nodes
.
End
(); ++j)
54
{
55
Ptr<Node>
object
= *j;
56
Ptr<MobilityModel>
position =
object
->GetObject<
MobilityModel
>();
57
NS_ASSERT
(position);
58
Vector pos = position->GetPosition();
59
std::cout <<
"x="
<< pos.x <<
", y="
<< pos.y <<
", z="
<< pos.z << std::endl;
60
}
61
62
Simulator::Destroy
();
63
return
0;
64
}
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::MobilityHelper
Helper class used to assign positions and mobility models to nodes.
Definition
mobility-helper.h:33
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition
mobility-model.h:29
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::NodeContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Definition
node-container.cc:55
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition
node-container.cc:73
ns3::NodeContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Definition
node-container.cc:49
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Simulator::Destroy
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition
simulator.cc:131
ns3::StringValue
Hold variables of type string.
Definition
string.h:45
ns3::UintegerValue
Hold an unsigned integer type.
Definition
uinteger.h:34
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition
assert.h:55
nodes
NodeContainer nodes
Definition
lr-wpan-bootstrap.cc:43
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.cmd
cmd
Definition
second.py:29
third.mobility
mobility
Definition
third.py:92
src
mobility
examples
main-grid-topology.cc
Generated on Mon Jan 27 2025 16:35:51 for ns-3 by
1.11.0