Compare commits
99
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05e7fa9f1e | ||
|
|
0ccbbd580b | ||
|
|
cbe744d4fb | ||
|
|
34ca4127f2 | ||
|
|
b586f57453 | ||
|
|
1550e56e50 | ||
|
|
f45de3b510 | ||
|
|
953e6f8ca9 | ||
|
|
45d8865932 | ||
|
|
7cb87966e1 | ||
|
|
235585ed5e | ||
|
|
50824fcf58 | ||
|
|
d84deee868 | ||
|
|
f909187f04 | ||
|
|
fc8f796760 | ||
|
|
3919aabe3a | ||
|
|
d6e815346e | ||
|
|
c9012555bf | ||
|
|
83d00574ab | ||
|
|
d04c4da1de | ||
|
|
172fa3b227 | ||
|
|
bcc2cf67f8 | ||
|
|
c3d0f3e226 | ||
|
|
26a3dcf506 | ||
|
|
ac27288871 | ||
|
|
2172a233ee | ||
|
|
8e9f018222 | ||
|
|
b1552962e6 | ||
|
|
315e45bf01 | ||
|
|
b6a4475357 | ||
|
|
2894eb3da4 | ||
|
|
77c07296be | ||
|
|
4c8fc4fc78 | ||
|
|
54b5760f86 | ||
|
|
8d7e2c2822 | ||
|
|
e2aaa9c9c0 | ||
|
|
3ea29a9df3 | ||
|
|
66f29d7ee6 | ||
|
|
5228ad81d7 | ||
|
|
92f085c07d | ||
|
|
a73b0a4226 | ||
|
|
502852a67b | ||
|
|
0fcbfbe38b | ||
|
|
87ad3830f5 | ||
|
|
24fe59cfbb | ||
|
|
50f298b400 | ||
|
|
8cd6c25962 | ||
|
|
d5a2afddb0 | ||
|
|
b6d1afd1a4 | ||
|
|
a482fe425d | ||
|
|
f36fa545a6 | ||
|
|
612a08373c | ||
|
|
6a9d3c3775 | ||
|
|
005105dba2 | ||
|
|
8d0cf0776c | ||
|
|
dbbed882fe | ||
|
|
55d5a5b453 | ||
|
|
50d0743753 | ||
|
|
bda125fd86 | ||
|
|
42b662fd58 | ||
|
|
0e858f92ed | ||
|
|
3b09edc3e2 | ||
|
|
a0c7d6ea8d | ||
|
|
d3bb3718d0 | ||
|
|
80663034e3 | ||
|
|
90d5128cf1 | ||
|
|
e074bdd6f3 | ||
|
|
3fcb3c137d | ||
|
|
e0918edc18 | ||
|
|
8707b44da8 | ||
|
|
8b0c038a18 | ||
|
|
d9f7e14c5a | ||
|
|
b301836c07 | ||
|
|
976d97b4ee | ||
|
|
ab6feba375 | ||
|
|
e7c25f9c3c | ||
|
|
13674a7bda | ||
|
|
521bc21456 | ||
|
|
92244ae188 | ||
|
|
03f1934de7 | ||
|
|
d071049665 | ||
|
|
19af32a6e3 | ||
|
|
be602d0271 | ||
|
|
cb8a465692 | ||
|
|
3306567d57 | ||
|
|
2d6ad0b37f | ||
|
|
eeb22f032e | ||
|
|
ef64362351 | ||
|
|
55b1e38d9b | ||
|
|
4c0a1cc3c1 | ||
|
|
6ee8f5b891 | ||
|
|
83dd97c451 | ||
|
|
18947ae628 | ||
|
|
f8b97d44a6 | ||
|
|
a9b9e503b9 | ||
|
|
2e6e133380 | ||
|
|
002252d0e4 | ||
|
|
06c6a5275b | ||
|
|
dd1879c2e0 |
No files matched your search
+48
@@ -0,0 +1,48 @@
|
||||
*.pyc
|
||||
.waf*
|
||||
src/NDNabstraction
|
||||
build/
|
||||
doc/html/
|
||||
doc/latex/
|
||||
\.rej$
|
||||
\.orig$
|
||||
\.o$
|
||||
~$
|
||||
^build-dir
|
||||
^build
|
||||
^testpy-output
|
||||
^doc/html
|
||||
^doc/latex
|
||||
.lock-wscript
|
||||
doc/ns3-object.txt
|
||||
doc/introspected-doxygen.h
|
||||
.lock-waf_darwin_build
|
||||
.lock-waf_linux2_build
|
||||
.lock-waf_cygwin_build
|
||||
.lock-waf_freebsd7_build
|
||||
.lock-waf_freebsd8_build
|
||||
.lock-waf_freebsd9_build
|
||||
.waf
|
||||
^doc/introspected-doxygen\.h$
|
||||
.*\.py[co]$
|
||||
\.pcap$
|
||||
\.mob$
|
||||
\.routes$
|
||||
^doc/manual/build
|
||||
^doc/tutorial/build
|
||||
^doc/testing/build
|
||||
^doc/models/build
|
||||
^doc/models/source-temp
|
||||
^doc/manual/figures/.*eps
|
||||
^doc/manual/figures/.*pdf
|
||||
^doc/manual/figures/.*png
|
||||
^bindings/python/pybindgen/
|
||||
ms_print.*
|
||||
massif.*
|
||||
\.patch$
|
||||
\.diff$
|
||||
\.tr$
|
||||
\#[^\#/]+\#$
|
||||
.lock-wscript
|
||||
.lock-wafbuild
|
||||
|
||||
@@ -61,3 +61,4 @@ e48ed3aabca6ad71c8c49e4604c0f83345eda6a8 ns-3.11-RC3
|
||||
19c9e2b33b4a53f200be80cd49810bdfecf76770 ns-3.12-RC1
|
||||
167fc2274f53d4d89fdd769e4a7683ad7b6b7157 ns-3.12
|
||||
9007193fbb8d18b69a1feb6aec16501dcf138b6f ns-3.13
|
||||
ae540de68a2534213342c5e0b12afb47d7518a90 ns-3.14
|
||||
@@ -1,4 +1,4 @@
|
||||
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
|
||||
Alexander Afanasyev (alexander.afanasyev@ucla.edu)
|
||||
Rohit Agarwal (mindprince@gmail.com)
|
||||
Kirill Andreev (andreev@iitp.ru)
|
||||
Dean Armstrong (deanarm@gmail.com)
|
||||
@@ -8,7 +8,7 @@ Ramon Bauza (monbauza@gmail.com)
|
||||
Mehdi Benamor (mehdi.benamor@telecom-bretagne.eu)
|
||||
Raj Bhattacharjea (raj.b@gatech.edu)
|
||||
Timo Bingmann (timo.bingmann@student.kit.edu)
|
||||
Julien Boite <juboite@gmail.com>
|
||||
Julien Boite (juboite@gmail.com)
|
||||
Elena Borovkova (borokovaes@iitp.ru)
|
||||
Pavel Boyko (boyko@iitp.ru)
|
||||
Dan Broyles (muxman@sbcglobal.net)
|
||||
@@ -26,18 +26,19 @@ Craig Dowell (craigdo@ee.washington.edu)
|
||||
Denis Fakhriev (fakhriev@iitp.ru)
|
||||
Jahanzeb Farooq (Jahanzeb.Farooq@inria.fr, Jahanzeb.Farooq@gmail.com)
|
||||
Juliana Freitag Borin (juliana.freitag@gmail.com)
|
||||
Thomas Geithner (thomas.geithner@dai-labor.de)
|
||||
Martin Giachino (martin.giachino@gmail.com,giachino@fing.edu.uy)
|
||||
Charline Taibi Guguen (charline.guguen@gmail.com)
|
||||
Tom Goff (tgoff@tgoff.net)
|
||||
David Gross (gdavid.devel@gmail.com)
|
||||
Charline Taibi Guguen (charline.guguen@gmail.com)
|
||||
Daniel Halperin (daniel@halper.in)
|
||||
Bruno Haick (bghaick@hotmail.com)
|
||||
Frank Helbert (frank@ime.usp.br)
|
||||
Tom Henderson (tomhend@u.washington.edu)
|
||||
Blake Hurd (naimorai@gmail.com)
|
||||
ishan <ishan.chhabra@gmail.com>
|
||||
ishan (ishan.chhabra@gmail.com)
|
||||
Mohamed Amine Ismail (amine.ismail@inria.fr, iamine@udcast.com)
|
||||
Atishay Jain <atishayjain25@gmail.com>
|
||||
Atishay Jain (atishayjain25@gmail.com)
|
||||
Sascha Alexander Jopen (jopen@informatik.uni-bonn.de)
|
||||
Sam Jansen (sam.jansen@gmail.com)
|
||||
Liu Jian (liujatp@gmail.com)
|
||||
@@ -66,11 +67,11 @@ Duy Nguyen (duy@soe.ucsc.edu)
|
||||
Tommaso Pecorella (tommaso.pecorella@unifi.it)
|
||||
Vikas Pushkar (vikaskupushkar@gmail.com)
|
||||
Josh Pelkey (jpelkey@gatech.edu)
|
||||
Colin Perkins <csp@csperkins.org>
|
||||
Colin Perkins (csp@csperkins.org)
|
||||
Giuseppe Piro (g.piro@poliba.it)
|
||||
Yana Podkosova (yanapdk@rambler.ru)
|
||||
Guangyu Pei (guangyu.pei@boeing.com)
|
||||
Andrea Ranieri <andreran@uno.it>
|
||||
Andrea Ranieri (andreran@uno.it)
|
||||
Bruno Ranieri (Yrrsinn@googlemail.com)
|
||||
Ken Renard (kenneth.renard@arl.army.mil)
|
||||
Manuel Requena (mrequena@cttc.es)
|
||||
@@ -83,11 +84,11 @@ Florian Schmidt (Florian.Schmidt@cs.rwth-aachen.de)
|
||||
Guillaume Seguin (guillaume.seguin@inria.fr)
|
||||
Kulin Shah (m.kulin@gmail.com)
|
||||
Phillip Sitbon (phillip.sitbon@gmail.com)
|
||||
Anirudh Sivaraman <sk.anirudh@gmail.com>
|
||||
Anirudh Sivaraman (sk.anirudh@gmail.com)
|
||||
Ewgenij Starostin (estar@cs.tu-berlin.de)
|
||||
YunQiang Su <wzssyqa@gmail.com>
|
||||
YunQiang Su (wzssyqa@gmail.com)
|
||||
Lalith Suresh (suresh.lalith@gmail.com)
|
||||
Marcos Talau <talau@users.sourceforge.net>
|
||||
Marcos Talau (talau@users.sourceforge.net)
|
||||
Adrian S. W. Tam (adrian.sw.tam@gmail.com)
|
||||
Hajime Tazaki (tazaki@sfc.wide.ad.jp)
|
||||
Wilson Thong (wilsonwk@ee.cityu.edu.hk)
|
||||
|
||||
+40
-1
@@ -44,7 +44,46 @@ to this file based on your experience, please contribute a patch or drop
|
||||
us a note on ns-developers mailing list.</p>
|
||||
|
||||
<hr>
|
||||
<h1>Changes from ns-3.13 to ns-3-dev</h1>
|
||||
<h1>Changes from ns-3.14 to ns-3.15</h1>
|
||||
|
||||
<h2>New API:</h2>
|
||||
<ul>
|
||||
<li>A RandomVariableStreamHelper has been introduced to assist with
|
||||
using the Config subsystem path names to assign fixed stream numbers
|
||||
to RandomVariableStream objects.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Changes to existing API:</h2>
|
||||
<ul>
|
||||
<li>Derived classes of RandomVariable (i.e. the random variable
|
||||
implementations) have been ported to a new RandomVariableStream base class.
|
||||
<li>For a given distribution DistributionVariable (such as UniformVariable),
|
||||
the new class name is DistributionRandomVariable (such as
|
||||
UniformRandomVariable). </li>
|
||||
<li>The new implementations are also derived from class ns3::Object and
|
||||
are handled using the ns-3 smart pointer (Ptr) class. </li>
|
||||
<li>The new variable classes also have a new attributed called "Stream"
|
||||
which allows them to be assigned to a fix stream index when assigned
|
||||
to the underlying pseudo-random stream of numbers.</li>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Changes to build system:</h2>
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
|
||||
<h2>Changed behavior:</h2>
|
||||
<ul>
|
||||
<li>Programs using random variables or models that include random variables
|
||||
may exhibit changed output for a given run number or seed, due to a possible
|
||||
change in the order in which random variables are assigned to underlying
|
||||
pseudo-random sequences. Consult the manual for more information regarding
|
||||
this.</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h1>Changes from ns-3.13 to ns-3.14</h1>
|
||||
|
||||
<h2>New API:</h2>
|
||||
<ul>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
Note:
|
||||
|
||||
This is a custom and unsupported fork of NS-3 simulator (http://www.nsnam.org/).
|
||||
|
||||
**The code in this repository is frequently rebased on top of the latest ns-3-dev branch**
|
||||
|
||||
|
||||
The Network Simulator, Version 3
|
||||
--------------------------------
|
||||
|
||||
+60
-11
@@ -9,36 +9,83 @@ http://www.nsnam.org including tutorials: http://www.nsnam.org/tutorials.html
|
||||
Consult the file CHANGES.html for more detailed information about changed
|
||||
API and behavior across ns-3 releases.
|
||||
|
||||
Release 3-dev
|
||||
============
|
||||
|
||||
Availability
|
||||
------------
|
||||
This release is not yet available.
|
||||
|
||||
Supported platforms
|
||||
-------------------
|
||||
|
||||
New user-visible features
|
||||
-------------------------
|
||||
- A new random variable base class called 'RandomVariableStream', has been
|
||||
introduced. This base class derives from ns3::Object, unlike the current
|
||||
'RandomVariable' class which is a special type of object in the ns-3
|
||||
system to date. By making this class derive from ns3::Object, it can be
|
||||
handled with the Ptr class, can carry attributes, and can have its parameters
|
||||
and initial state saved in the config-store subsystem. A new attribute
|
||||
called "Stream" has been introduced for this class, to allow users to
|
||||
better control the assignment of underlying pseudo-random sequences to
|
||||
the RandomVariableStream objects (bug 101).
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
- bug 101 - random variable initialization
|
||||
|
||||
Known issues
|
||||
------------
|
||||
In general, known issues are tracked on the project tracker available
|
||||
at http://www.nsnam.org/bugzilla/
|
||||
|
||||
Release 3.14.1
|
||||
==============
|
||||
|
||||
Availability
|
||||
------------
|
||||
This release is available from:
|
||||
http://www.nsnam.org/release/ns-allinone-3.14.1.tar.bz2
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
This hotfix release contains a fix for the PyViz visualizer and makes it
|
||||
easier to add PyViz support to examples; otherwise it is the same as the
|
||||
ns-3.14 release.
|
||||
|
||||
Release 3.14
|
||||
============
|
||||
|
||||
Availability
|
||||
------------
|
||||
This release not yet available.
|
||||
This release is available from:
|
||||
http://www.nsnam.org/release/ns-allinone-3.14.tar.bz2
|
||||
|
||||
Supported platforms
|
||||
-------------------
|
||||
ns-3.14 has been tested on the following platforms. Not all features are
|
||||
available on all platforms; check the Installation page on the project wiki.
|
||||
|
||||
- Ubuntu 12.04 (32/64 bit) with g++-4.6.3
|
||||
- Ubuntu 10.04.4 LTS (64 bit) with g++-4.4.3
|
||||
- Fedora Core 17 (32/64 bit) with g++-4.7.0
|
||||
- Fedora Core 16 (32/64 bit) with g++-4.6.3
|
||||
- Fedora Core 15 (64 bit) with g++-4.6.3
|
||||
- Ubuntu 12.04 (32/64 bit) with g++-4.6.3
|
||||
- Ubuntu 11.10 (32 bit) with g++-4.6.1
|
||||
- OS X Lion with g++-4.2.1
|
||||
- OS X Snow Leopard with g++-4.2.1
|
||||
- Ubuntu 10.04.4 LTS (64 bit) with g++-4.4.3
|
||||
- OS X Lion 10.7.4 with g++-4.2.1
|
||||
- OS X Snow Leopard 10.6.8 with g++-4.2.1
|
||||
- FreeBSD 8.2 (32 bit) with g++-4.2.1
|
||||
- Cygwin 1.7.9-1 with g++-4.5.3
|
||||
|
||||
New user-visible features
|
||||
-------------------------
|
||||
- Transport protocol implementations (TCP, UDP) have been refactored to
|
||||
support also IPv6 connections. Dual-stacked IPv6 sockets are implemented.
|
||||
An IPv6 socket can accept an IPv4 connection, returning the senders
|
||||
An IPv6 socket can accept an IPv4 connection, returning the sender's
|
||||
address as an IPv4-mapped address (IPV6_V6ONLY socket option is not
|
||||
implemented).
|
||||
- The LTE code from the LENA project has been merged, bringin in a
|
||||
- The LTE code from the LENA project has been merged, bringing in a
|
||||
significant redesign of the LTE module as well as many new features.
|
||||
- An antenna module is now included, which includes different
|
||||
radiation pattern models. See the corresponding new section of the
|
||||
@@ -50,7 +97,7 @@ New user-visible features
|
||||
- The Dynamic Source Routing (DSR) MANET routing protocol for IPv4 was added.
|
||||
- A Random Early Detection (RED) queue model has been added.
|
||||
- Ipv6RoutingHelper is now in-line with Ipv4RoutingHelper concerning the RT
|
||||
print functions. Various minor changes made in Ipv6RoutingProtocol and
|
||||
print functions. Various minor changes were made in Ipv6RoutingProtocol and
|
||||
derived classes to make this possible.
|
||||
- New "SendIcmpv6Redirect" attribute (and getter/setter functions) to
|
||||
Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects",
|
||||
@@ -58,12 +105,12 @@ New user-visible features
|
||||
- Longer and more descriptive names are used for error units in RateErrorModel
|
||||
class and queue mode in Queue class. Attributes in those classes are also
|
||||
changed for consistency. See API documentation for details.
|
||||
- The netanim animator is now included with the release.
|
||||
- The netanim animator is now bundled with the release.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
- bug 631 - RealtimeSimulatorImpl does not handle Ctrl-C with python bindings
|
||||
- bug 603 - Simulator::Next is useless
|
||||
- bug 631 - RealtimeSimulatorImpl does not handle Ctrl-C with python bindings
|
||||
- bug 962 - list of paths to reach objects contains bogus entries
|
||||
- bug 1000 - Make RealtimeSimulatorImpl last until stop
|
||||
- bug 1053 - Need better error diagnostics in ns2-mobility-trace example
|
||||
@@ -103,10 +150,12 @@ Bugs fixed
|
||||
- bug 1393 - IPv6 Routing Helper RT Print functions
|
||||
- bug 1395 - AODV DeferredRouteOutputTag missing constructor
|
||||
- bug 1396 - ARP with hardware addresses longer than 6 bytes
|
||||
- bug 1399 - TCP not backing off retransmissions properly
|
||||
- bug 1404 - Bound user input in tutorial third.cc program
|
||||
- bug 1406 - waf exits with maximum recursion depth exceeded
|
||||
- bug 1415 - examples-to-run.py doesn't work with command line arguments
|
||||
- bug 1420 - bug 1420: no python bindings for csma-layout
|
||||
- bug 1420 - no python bindings for csma-layout
|
||||
- bug 1441 - IPv4 header length handling
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
@@ -11,10 +11,11 @@ be asked to contribute test code. Models that you contribute will be
|
||||
used for many years by other people, who probably have no idea upon
|
||||
first glance whether the model is correct. The test code that you
|
||||
write for your model will help to avoid future regressions in
|
||||
the output and will aid future users in understanding the validity
|
||||
the output and will aid future users in understanding the verification
|
||||
and bounds of applicability of your models.
|
||||
|
||||
There are many ways to test that a model is valid. In this chapter,
|
||||
There are many ways to verify the correctness of a model's implementation.
|
||||
In this section,
|
||||
we hope to cover some common cases that can be used as a guide to
|
||||
writing new tests.
|
||||
|
||||
@@ -31,15 +32,63 @@ TestSuite), these things need to be decided up front:
|
||||
separately in src/test/ directory). You will have to edit the wscript
|
||||
file in that directory to compile your new code, if it is a new file.
|
||||
|
||||
See the file ``src/template/test/sample-test-suite.cc`` and corresponding
|
||||
wscript file in that directory for a simple example, and see the directories
|
||||
under ``src/test`` for more complicated examples.
|
||||
A program called ``src/create-module.py`` is a good starting point.
|
||||
This program can be invoked such as ``create-module.py router`` for
|
||||
a hypothetical new module called ``router``. Once you do this, you
|
||||
will see a ``router`` directory, and a ``test/router-test-suite.cc``
|
||||
test suite. This file can be a starting point for your initial test.
|
||||
This is a working test suite, although the actual tests performed are
|
||||
trivial. Copy it over to your module's test directory, and do a global
|
||||
substitution of "Router" in that file for something pertaining to
|
||||
the model that you want to test. You can also edit things such as a
|
||||
more descriptive test case name.
|
||||
|
||||
*The rest of this chapter remains to be written*
|
||||
You also need to add a block into your wscript to get this test to
|
||||
compile:
|
||||
|
||||
::
|
||||
|
||||
module_test.source = [
|
||||
'test/router-test-suite.cc',
|
||||
]
|
||||
|
||||
Before you actually start making this do useful things, it may help
|
||||
to try to run the skeleton. Make sure that ns-3 has been configured with
|
||||
the "--enable-tests" option. Let's assume that your new test suite
|
||||
is called "router" such as here:
|
||||
|
||||
::
|
||||
|
||||
RouterTestSuite::RouterTestSuite ()
|
||||
: TestSuite ("router", UNIT)
|
||||
|
||||
Try this command:
|
||||
|
||||
::
|
||||
|
||||
./test.py -s router
|
||||
|
||||
Output such as below should be produced:
|
||||
|
||||
::
|
||||
|
||||
PASS: TestSuite router
|
||||
1 of 1 tests passed (1 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
|
||||
|
||||
/* see src/lte/test/test-lte-antenna.cc for a worked example */
|
||||
|
||||
How to add an example program to the test suite
|
||||
***********************************************
|
||||
|
||||
One can "smoke test" that examples compile and run successfully
|
||||
to completion (without memory leaks) using the ``examples-to-run.py``
|
||||
script located in your module's test directory. Briefly, by including
|
||||
an instance of this file in your test directory, you can cause the
|
||||
test runner to execute the examples listed. It is usually best to make
|
||||
sure that you select examples that have reasonably short run times so as
|
||||
to not bog down the tests. See the example in ``src/lte/test/``
|
||||
directory.
|
||||
|
||||
Testing for boolean outcomes
|
||||
****************************
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Quick Overview
|
||||
**************
|
||||
|
||||
|ns3| random numbers are provided via instances of
|
||||
:cpp:class:`ns3::RandomVariable`.
|
||||
:cpp:class:`ns3::RandomVariableStream`.
|
||||
|
||||
* by default, |ns3| simulations use a fixed seed; if there is any randomness in
|
||||
the simulation, each run of the program will yield identical results unless
|
||||
@@ -21,13 +21,18 @@ Quick Overview
|
||||
* in *ns-3.3* and earlier, |ns3| simulations used a random seed by default; this
|
||||
marks a change in policy starting with *ns-3.4*.
|
||||
|
||||
* in *ns-3.14* and earlier, |ns3| simulations used a different wrapper class
|
||||
called :cpp:class:`ns3::RandomVariable`. As of *ns-3.15*, this class has been
|
||||
replaced by :cpp:class:`ns3::RandomVariableStream`; the underlying pseudo-random
|
||||
number generator has not changed.
|
||||
|
||||
* to obtain randomness across multiple simulation runs, you must either set the
|
||||
seed differently or set the run number differently. To set a seed, call
|
||||
:cpp:func:`ns3::SeedManager::SetSeed` at the beginning of the program; to set
|
||||
a run number with the same seed, call :cpp:func:`ns3::SeedManager::SetRun` at
|
||||
the beginning of the program; see :ref:`seeding-and-independent-replications`.
|
||||
|
||||
* each RandomVariable used in |ns3| has a virtual random number generator
|
||||
* each RandomVariableStream used in |ns3| has a virtual random number generator
|
||||
associated with it; all random variables use either a fixed or random seed
|
||||
based on the use of the global seed (previous bullet);
|
||||
|
||||
@@ -82,14 +87,14 @@ period (*i.e.*, the number of random numbers before overlap) of
|
||||
:math:`7.6x10^{22}`. The period of the entire generator is :math:`3.1x10^{57}`.
|
||||
|
||||
|
||||
Class :cpp:class:`ns3::RandomVariable` is the public interface to this
|
||||
underlying random number generator. When users create new ``RandomVariables``
|
||||
(such as :cpp:class:`ns3::UniformVariable`,
|
||||
:cpp:class:`ns3::ExponentialVariable`, etc.), they create an object that uses
|
||||
Class :cpp:class:`ns3::RandomVariableStream` is the public interface to this
|
||||
underlying random number generator. When users create new random variables
|
||||
(such as :cpp:class:`ns3::UniformRandomVariable`,
|
||||
:cpp:class:`ns3::ExponentialRandomVariable`, etc.), they create an object that uses
|
||||
one of the distinct, independent streams of the random number generator.
|
||||
Therefore, each object of type :cpp:class:`ns3::RandomVariable` has,
|
||||
Therefore, each object of type :cpp:class:`ns3::RandomVariableStream` has,
|
||||
conceptually, its own "virtual" RNG. Furthermore, each
|
||||
:cpp:class:`ns3::RandomVariable` can be configured to use one of the set of
|
||||
:cpp:class:`ns3::RandomVariableStream` can be configured to use one of the set of
|
||||
substreams drawn from the main stream.
|
||||
|
||||
An alternate implementation would be to allow each RandomVariable to have its
|
||||
@@ -122,8 +127,8 @@ before any random variables are created; e.g::
|
||||
SeedManager::SetSeed (3); // Changes seed from default of 1 to 3
|
||||
SeedManager::SetRun (7); // Changes run number from default of 1 to 7
|
||||
// Now, create random variables
|
||||
UniformVariable x(0,10);
|
||||
ExponentialVariable y(2902);
|
||||
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
|
||||
Ptr<ExponentialRandomVariable> y = CreateObject<ExponentialRandomVarlable> ();
|
||||
...
|
||||
|
||||
Which is better, setting a new seed or advancing the substream state? There is
|
||||
@@ -154,16 +159,16 @@ or, if you are running programs directly outside of waf::
|
||||
The above command-line variants make it easy to run lots of different
|
||||
runs from a shell script by just passing a different RngRun index.
|
||||
|
||||
Class RandomVariable
|
||||
********************
|
||||
Class RandomVariableStream
|
||||
**************************
|
||||
|
||||
All random variables should derive from class :cpp:class:`RandomVariable`. This
|
||||
base class provides a few static methods for globally configuring the behavior
|
||||
base class provides a few methods for globally configuring the behavior
|
||||
of the random number generator. Derived classes provide API for drawing random
|
||||
variates from the particular distribution being supported.
|
||||
|
||||
Each RandomVariable created in the simulation is given a generator that is a new
|
||||
RNGStream from the underlying PRNG. Used in this manner, the L'Ecuyer
|
||||
Each RandomVariableStream created in the simulation is given a generator that is a
|
||||
new RNGStream from the underlying PRNG. Used in this manner, the L'Ecuyer
|
||||
implementation allows for a maximum of :math:`1.8x10^19` random variables. Each
|
||||
random variable in a single replication can produce up to :math:`7.6x10^22`
|
||||
random numbers before overlapping.
|
||||
@@ -171,7 +176,7 @@ random numbers before overlapping.
|
||||
Base class public API
|
||||
*********************
|
||||
|
||||
Below are excerpted a few public methods of class :cpp:class:`RandomVariable`
|
||||
Below are excerpted a few public methods of class :cpp:class:`RandomVariableStream`
|
||||
that access the next value in the substream.::
|
||||
|
||||
/**
|
||||
@@ -181,7 +186,7 @@ that access the next value in the substream.::
|
||||
double GetValue (void) const;
|
||||
|
||||
/**
|
||||
* \brief Returns a random integer integer from the underlying distribution
|
||||
* \brief Returns a random integer from the underlying distribution
|
||||
* \return Integer cast of ::GetValue()
|
||||
*/
|
||||
uint32_t GetInteger (void) const;
|
||||
@@ -193,36 +198,33 @@ Types of RandomVariables
|
||||
************************
|
||||
|
||||
The following types of random variables are provided, and are documented in the
|
||||
|ns3| Doxygen or by reading ``src/core/model/random-variable.h``. Users can also
|
||||
create their own custom random variables by deriving from class
|
||||
:cpp:class:`RandomVariable`.
|
||||
|ns3| Doxygen or by reading ``src/core/model/random-variable-stream.h``. Users
|
||||
can also create their own custom random variables by deriving from class
|
||||
:cpp:class:`RandomVariableStream`.
|
||||
|
||||
* class :cpp:class:`UniformVariable`
|
||||
* class :cpp:class:`ConstantVariable`
|
||||
* class :cpp:class:`SequentialVariable`
|
||||
* class :cpp:class:`ExponentialVariable`
|
||||
* class :cpp:class:`ParetoVariable`
|
||||
* class :cpp:class:`WeibullVariable`
|
||||
* class :cpp:class:`NormalVariable`
|
||||
* class :cpp:class:`EmpiricalVariable`
|
||||
* class :cpp:class:`IntEmpiricalVariable`
|
||||
* class :cpp:class:`DeterministicVariable`
|
||||
* class :cpp:class:`LogNormalVariable`
|
||||
* class :cpp:class:`TriangularVariable`
|
||||
* class :cpp:class:`GammaVariable`
|
||||
* class :cpp:class:`ErlangVariable`
|
||||
* class :cpp:class:`ZipfVariable`
|
||||
* class :cpp:class:`UniformRandomVariable`
|
||||
* class :cpp:class:`ConstantRandomVariable`
|
||||
* class :cpp:class:`SequentialRandomVariable`
|
||||
* class :cpp:class:`ExponentialRandomVariable`
|
||||
* class :cpp:class:`ParetoRandomVariable`
|
||||
* class :cpp:class:`WeibullRandomVariable`
|
||||
* class :cpp:class:`NormalRandomVariable`
|
||||
* class :cpp:class:`LogNormalRandomVariable`
|
||||
* class :cpp:class:`GammaRandomVariable`
|
||||
* class :cpp:class:`ErlangRandomVariable`
|
||||
* class :cpp:class:`TriangularRandomVariable`
|
||||
* class :cpp:class:`ZipfRandomVariable`
|
||||
* class :cpp:class:`ZetaRandomVariable`
|
||||
* class :cpp:class:`DeterministicRandomVariable`
|
||||
* class :cpp:class:`EmpiricalRandomVariable`
|
||||
|
||||
Semantics of RandomVariable objects
|
||||
***********************************
|
||||
Semantics of RandomVariableStream objects
|
||||
*****************************************
|
||||
|
||||
RandomVariable objects have value semantics. This means that they can be passed
|
||||
by value to functions. The can also be passed by reference to const.
|
||||
RandomVariables do not derive from :cpp:class:`ns3::Object` and we do not use
|
||||
smart pointers to manage them; they are either allocated on the stack or else
|
||||
users explicitly manage any heap-allocated RandomVariables.
|
||||
RandomVariableStream objects derive from :cpp:class:`ns3::Object` and are
|
||||
handled by smart pointers.
|
||||
|
||||
RandomVariable objects can also be used in |ns3| attributes, which means
|
||||
RandomVariableStream instances can also be used in |ns3| attributes, which means
|
||||
that values can be set for them through the |ns3| attribute system.
|
||||
An example is in the propagation models for WifiNetDevice:::
|
||||
|
||||
@@ -234,15 +236,15 @@ An example is in the propagation models for WifiNetDevice:::
|
||||
.AddConstructor<RandomPropagationDelayModel> ()
|
||||
.AddAttribute ("Variable",
|
||||
"The random variable which generates random delays (s).",
|
||||
RandomVariableValue (UniformVariable (0.0, 1.0)),
|
||||
MakeRandomVariableAccessor (&RandomPropagationDelayModel::m_variable),
|
||||
MakeRandomVariableChecker ())
|
||||
StringValue ("ns3::UniformRandomVariable"),
|
||||
MakePointerAccessor (&RandomPropagationDelayModel::m_variable),
|
||||
MakePointerChecker<RandomVariableStream> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
Here, the |ns3| user can change the default random variable for this
|
||||
delay model (which is a UniformVariable ranging from 0 to 1) through
|
||||
delay model (which is a UniformRandomVariable ranging from 0 to 1) through
|
||||
the attribute system.
|
||||
|
||||
Using other PRNG
|
||||
@@ -252,10 +254,56 @@ There is presently no support for substituting a different underlying
|
||||
random number generator (e.g., the GNU Scientific Library or the Akaroa
|
||||
package). Patches are welcome.
|
||||
|
||||
More advanced usage
|
||||
*******************
|
||||
Setting the stream number
|
||||
*************************
|
||||
|
||||
*To be completed.*
|
||||
The underlying MRG32k3a generator provides 2^64 independent streams.
|
||||
In ns-3, these are assigned sequentially starting from the first stream as
|
||||
new RandomVariableStream instances make their first call to GetValue().
|
||||
|
||||
As a result of how these RandomVariableStream objects are assigned to
|
||||
underlying streams, the assignment is sensitive to perturbations of
|
||||
the simulation configuration. The consequence is that if any aspect of the
|
||||
simulation configuration is changed, the mapping of RandomVariables to
|
||||
streams may (or may not) change.
|
||||
|
||||
As a concrete example, a user running a comparative study between routing
|
||||
protocols may find that the act of changing one routing protocol for another
|
||||
will notice that the underlying mobility pattern also changed.
|
||||
|
||||
Starting with ns-3.15, some control has been provided to users to allow
|
||||
users to optionally fix the assignment of selected RandomVariableStream
|
||||
objects to underlying streams. This is the ``Stream`` attribute, part
|
||||
of the base class RandomVariableStream.
|
||||
|
||||
By partitioning the existing sequence of streams from before:
|
||||
|
||||
::
|
||||
|
||||
<-------------------------------------------------------------------------->
|
||||
stream 0 stream (2^64 - 1)
|
||||
|
||||
into two equal-sized sets:
|
||||
|
||||
::
|
||||
|
||||
<--------------------------------------------------------------------------->
|
||||
^ ^^ ^
|
||||
| || |
|
||||
stream 0 stream (2^63 - 1) stream 2^63 stream (2^64 - 1)
|
||||
<- automatically assigned -----><-------- assigned by user----------->
|
||||
|
||||
The first 2^63 streams continue to be automatically assigned, while
|
||||
the last 2^63 are given stream indices starting with zero up to
|
||||
2^63-1.
|
||||
|
||||
The assignment of streams to a fixed stream number is optional; instances
|
||||
of RandomVariableStream that do not have a stream value assigned will
|
||||
be assigned the next one from the pool of automatic streams.
|
||||
|
||||
To fix a RandomVariableStream to a particular underlying stream, assign
|
||||
its ``Stream`` attribute to a non-negative integer (the default value
|
||||
of -1 means that a value will be automatically allocated).
|
||||
|
||||
Publishing your results
|
||||
***********************
|
||||
|
||||
@@ -49,6 +49,7 @@ SOURCES = \
|
||||
$(SRC)/network/doc/packets.rst \
|
||||
$(SRC)/network/doc/sockets-api.rst \
|
||||
$(SRC)/network/doc/simple.rst \
|
||||
$(SRC)/network/doc/queue.rst \
|
||||
$(SRC)/internet/doc/internet-stack.rst \
|
||||
$(SRC)/internet/doc/ipv4.rst \
|
||||
$(SRC)/internet/doc/ipv6.rst \
|
||||
|
||||
@@ -40,7 +40,6 @@ This document is written in `reStructuredText <http://docutils.sourceforge.net/r
|
||||
openflow-switch
|
||||
point-to-point
|
||||
propagation
|
||||
simple
|
||||
statistics
|
||||
topology
|
||||
uan
|
||||
|
||||
@@ -7,3 +7,4 @@ Network Module
|
||||
network-overview
|
||||
sockets-api
|
||||
simple
|
||||
queue
|
||||
+91
-75
@@ -1,93 +1,89 @@
|
||||
Steps in doing an ns-3 release
|
||||
|
||||
ns-3-dev preparation
|
||||
--------------------
|
||||
We typically post release candidates for testing at the following URL:
|
||||
https://www.nsnam.org/release/ns-allinone-3.X.rcX.tar.bz2
|
||||
|
||||
1. check out a clean ns-3-dev somewhere using ns-3-allinone (you will need it)
|
||||
- hg clone http://code.nsnam.org/ns-3-allinone
|
||||
- ./download.py
|
||||
- ./build.py --enable-examples --enable-tests
|
||||
- try building static, optimized, and debug versions
|
||||
This overview covers the following release stages:
|
||||
1) new feature additions and bug fixing
|
||||
2) preparing release candidates for testing
|
||||
3) making the actual release
|
||||
4) maintaining the release
|
||||
|
||||
1) new feature additions and bug fixing
|
||||
---------------------------------------
|
||||
|
||||
During the software development phase, it is important for the release
|
||||
manager to try to maintain the following files with updated information:
|
||||
- AUTHORS
|
||||
- RELEASE_NOTES
|
||||
- CHANGES.html
|
||||
|
||||
otherwise, this becomes painful to edit (and things are forgotten)
|
||||
when the release is imminent.
|
||||
|
||||
2) preparing release candidates for testing
|
||||
-------------------------------------------
|
||||
|
||||
This step presumes that you have a reasonably solid ns-3-dev that you
|
||||
and/or the buildbots have been testing
|
||||
- building static, optimized, and debug versions
|
||||
- try Python visualizer (not tested by buildbots)
|
||||
-- ./waf --pyrun src/flow-monitor/examples/wifi-olsr-flowmon.py --vis
|
||||
- cd ns-3-dev
|
||||
- ensure that tests pass (./test.py -g) and make sure that the buildbots
|
||||
are reporting greens based on the tip of the repository
|
||||
|
||||
2. prepare the source files
|
||||
- revise and check in AUTHORS, if needed
|
||||
- revise and check in RELEASE_NOTES. Make sure to edit the Availability
|
||||
section if this is a final release.
|
||||
- DO NOT change VERSION at this time
|
||||
are reporting blue based on the tip of the repository
|
||||
- revise and check in AUTHORS, RELEASE_NOTES, and CHANGES>html
|
||||
- required versions for related libraries (nsc, netanim, pybindgen)
|
||||
are correct
|
||||
- make latexpdf in the doc/manual, doc/models, and doc/tutorial directories
|
||||
- confirm that Doxygen builds cleanly (./waf doxygen),
|
||||
and check in any necessary changes. Currently, doxygen does not build
|
||||
cleanly, we need to fix this over time.
|
||||
|
||||
At this point, the ns-3-dev should be ready, except for changing the
|
||||
name of this repo from "3-dev" to the numbered release. That will come
|
||||
in subsequent steps.
|
||||
|
||||
ns-allinone-3.X.tar.bz2 dry run
|
||||
-------------------------------
|
||||
|
||||
This phase is optional to dry-run a tarball before tagging. You may skip
|
||||
to the next phase if you are ready to just make the release or release
|
||||
candidate.
|
||||
|
||||
1. check out a clean ns-3-allinone again
|
||||
- change into the allinone directory
|
||||
Check out a clean ns-3-dev somewhere using ns-3-allinone
|
||||
- hg clone http://code.nsnam.org/ns-3-allinone
|
||||
- ./download.py
|
||||
- cd ns-3-dev
|
||||
- change VERSION to the appropriate string, either "3.X" (for a release) or
|
||||
"3.X.RC1" Do not commit this VERSION change to ns-3-dev. It is used
|
||||
by dist.py script to name the directory properly.
|
||||
- cd into allinone directory and type "./dist.py"; you should see something
|
||||
like this:
|
||||
- edit VERSION such as "ns-3.14.rc1" (DO NOT commit this change to ns-3-dev)
|
||||
- cd ..
|
||||
- ./dist.py
|
||||
|
||||
NS-3 version: '3.12'
|
||||
Adding ns-3-dev as ns-allinone-3.12/ns-3.12
|
||||
Adding pybindgen as ns-allinone-3.12/pybindgen-0.15.0.795
|
||||
Adding nsc as ns-allinone-3.12/nsc-0.5.2
|
||||
Adding the build script files
|
||||
This should yield a compressed tarfile, such as: ns-allinone-3.14.rc1.tar.bz2
|
||||
Test this, and when satisfied, upload it to
|
||||
www.nsnam.org:/var/www/html/releases/ (with apache:apache file ownership)
|
||||
|
||||
This will create an ns-allinone-3.X.tar.bz2 tarball
|
||||
Announce it to ns-developers as:
|
||||
https://www.nsnam.org/release/ns-allinone-3.14.rc3.tar.bz2
|
||||
|
||||
2. test tarball on release platforms
|
||||
- optimized, debug, and static builds
|
||||
- ./test.py -g
|
||||
- make latexpdf in the doc/manual, doc/models, and doc/tutorial directories
|
||||
- ./waf --doxygen
|
||||
Iterate the above as needed during the release testing phase.
|
||||
|
||||
Note, in the past we have added mercurial tags to ns-3-dev to denote
|
||||
release candidates, but lately we have not been bothering with this.
|
||||
If you would like to tag a release candidate, follow these steps
|
||||
-- hg tag "ns-3.X.rcX" (for the appropriate version numbers)
|
||||
-- hg push ssh://code@code.nsnam.org/repos/ns-3-dev
|
||||
|
||||
3) making the release
|
||||
---------------------
|
||||
|
||||
Follow similar steps for creating the release candidate tarballs, except
|
||||
we will work off of a release repository.
|
||||
|
||||
At this point, you are ready for final packaging and repository/site work
|
||||
|
||||
tagging ns-3-dev and creating ns-3.X repositories
|
||||
-------------------------------------------------
|
||||
|
||||
The steps here involve tagging ns-3-dev, copying over ns-3-dev to ns-3.X
|
||||
on code.nsnam.org, cloning it locally, making changes from "3-dev" to "3.X"
|
||||
in various places, and checking in those changes to the new ns-3.X repository.
|
||||
We'll refer to the release number as "X" or "x" below. The steps here
|
||||
involve tagging ns-3-dev, copying over ns-3-dev to ns-3.X on code.nsnam.org,
|
||||
cloning it locally, making changes from "3-dev" to "3.X" in various places,
|
||||
and checking in those changes to the new ns-3.X repository.
|
||||
|
||||
1. once you are happy with the tarball, tag ns-3-dev
|
||||
1. once you are happy with the most recent release candidate tarball and
|
||||
do not plan to further touch ns-3-dev, tag ns-3-dev
|
||||
- cd into ns-3-dev
|
||||
- if release candidate
|
||||
-- hg tag "ns-3.x-RCy"
|
||||
-- hg push ssh://code@code.nsnam.org//home/code/repos/ns-3-dev
|
||||
- else if final release
|
||||
-- hg tag "ns-3.x"
|
||||
-- hg push ssh://code@code.nsnam.org//home/code/repos/ns-3-dev
|
||||
|
||||
2. copy the tagged ns-3-dev and place it on the repository
|
||||
- ssh code.nsnam.org; sudo bash; su code;
|
||||
- if release candidate
|
||||
-- cp -r /home/code/repos/ns-3-dev /home/code/repos/ns-3.x-RCy
|
||||
-- cd /home/code/repos/ns-3.x-RCy/.hg and edit the hgrc appropriately:
|
||||
[paths]
|
||||
default = /home/code/repos/ns-3.x-RCy
|
||||
[web]
|
||||
description = ns-3.x-RCy release
|
||||
name = ns-3.x-RCy
|
||||
contact = <ns-developers@isi.edu>
|
||||
- else if final release
|
||||
-- cp -r /home/code/repos/ns-3-dev /home/code/repos/ns-3.x
|
||||
-- cd /home/code/repos/ns-3.x/.hg and edit the hgrc appropriately:
|
||||
[paths]
|
||||
@@ -97,21 +93,20 @@ in various places, and checking in those changes to the new ns-3.X repository.
|
||||
name = ns-3.x
|
||||
contact = <ns-developers@isi.edu>
|
||||
|
||||
3. If this is a final release (not RC)
|
||||
- move (mv) ns-3.x RCs in /home/code/archived-repos
|
||||
3. check out a clean version of the new release (ns-3.x)
|
||||
to a scratch directory on your local machine
|
||||
- hg clone http://code.nsnam.org/ns-3.x
|
||||
|
||||
4. check out a clean version of the new release (ns-3.x) or (ns-3.x-RCy)
|
||||
to your local machine
|
||||
- hg clone http://code.nsnam.org/ns-3.x or (-RCy)
|
||||
|
||||
5. Update the VERSION for this new release
|
||||
5. Update the VERSION for this new release, in the ns-3.x directory (i.e.
|
||||
NOT in ns-3-dev)
|
||||
- change the string 3-dev in the VERSION file to the real version
|
||||
(e.g. 3.7 or 3.7-RC1) This must agree with the version name you chose in the clone.
|
||||
(e.g. 3.14) This must agree with the version name you chose in the clone.
|
||||
- change the version and release string for the documentation in
|
||||
doc/manual/source, doc/tutorial/source, and doc/models/source conf.py files
|
||||
doc/manual/source, doc/tutorial/source, doc/tutorial-pt/source,
|
||||
and doc/models/source conf.py files
|
||||
This should hopefully be updated in the future to simply pull from the
|
||||
VERSION file.
|
||||
- hg commit -m "update VERSION to ns-3.x" or (-RCy), you get the point
|
||||
- hg commit -m "update VERSION to ns-3.x"
|
||||
- hg push ssh://code@code.nsnam.org//home/code/repos/ns-3.x
|
||||
|
||||
creating the distribution tarball
|
||||
@@ -171,7 +166,7 @@ Documentation)
|
||||
4. The main page http://www.nsnam.org should point to
|
||||
ns-3.x in the "Download" and "Documentation" boxes
|
||||
|
||||
5. Create blog entry to announce release
|
||||
5. Create a blog entry to announce release
|
||||
|
||||
ns-3 wiki edits
|
||||
---------------
|
||||
@@ -198,3 +193,24 @@ Announcing
|
||||
|
||||
2. announce to ns-developers and ns-3-users, with summary of release notes
|
||||
|
||||
|
||||
4) maintaining the release
|
||||
--------------------------
|
||||
|
||||
First, create skeletal sections in CHANGES.html and RELEASE_NOTES to
|
||||
start collecting inputs for the ns-3.(x+1) release.
|
||||
|
||||
The project may decide to make incremental, bug-fix releases from
|
||||
time to time, with a minor version number (e.g. ns-3.7.1). To do
|
||||
this, changesets may be cherry-picked from ns-3-dev and added to
|
||||
ns-3.x repository. Do not move over changesets that pertain to
|
||||
adding new features, but documentation fixes and bug fixes are good
|
||||
changesets to make available in a minor release. The same steps
|
||||
above for making a release are generally followed, although one
|
||||
does not need to create a separate repository, but instead just tags
|
||||
the existing ns-3-dev and ns-3.x repositories with a "ns-3.x.1" type
|
||||
of tag.
|
||||
|
||||
Also, on the main website, make sure that "latest release" points to
|
||||
the right page. See how it was handled for ns-3.12 (which made
|
||||
a minor release): https://www.nsnam.org/ns-3.12/
|
||||
@@ -24,7 +24,7 @@ who want to learn more are encouraged to read the following additional
|
||||
documentation:
|
||||
|
||||
* The |ns3| manual
|
||||
* The |ns3| model library documentatio
|
||||
* The |ns3| model library documentation
|
||||
* The |ns3| Doxygen (API documentation)
|
||||
* The |ns3| wiki
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Downloading ns-3
|
||||
|
||||
The |ns3| system as a whole is a fairly complex system and has a
|
||||
number of dependencies on other components. Along with the systems you will
|
||||
most likely deal with every day (the GNU toolchain, Mercurial, you programmer
|
||||
most likely deal with every day (the GNU toolchain, Mercurial, a text
|
||||
editor) you will need to ensure that a number of additional libraries are
|
||||
present on your system before proceeding. |ns3| provides a wiki
|
||||
for your reading pleasure that includes pages with many useful hints and tips.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
def build(bld):
|
||||
obj = bld.create_ns3_program('tcp-large-transfer',
|
||||
['visualizer', 'point-to-point', 'applications', 'internet'])
|
||||
['point-to-point', 'applications', 'internet'])
|
||||
obj.source = 'tcp-large-transfer.cc'
|
||||
|
||||
obj = bld.create_ns3_program('tcp-nsc-lfn',
|
||||
|
||||
@@ -8,16 +8,16 @@ def build(bld):
|
||||
bld.register_ns3_script('mixed-wireless.py', ['core', 'mobility', 'wifi', 'applications', 'point-to-point',
|
||||
'internet', 'csma', 'olsr'])
|
||||
|
||||
obj = bld.create_ns3_program('wifi-adhoc', ['core', 'mobility', 'wifi', 'applications', 'tools', 'visualizer'])
|
||||
obj = bld.create_ns3_program('wifi-adhoc', ['core', 'mobility', 'wifi', 'applications', 'tools'])
|
||||
obj.source = 'wifi-adhoc.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-clear-channel-cmu', ['internet', 'mobility', 'wifi', 'tools'])
|
||||
obj.source = 'wifi-clear-channel-cmu.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-ap', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools', 'visualizer'])
|
||||
obj = bld.create_ns3_program('wifi-ap', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools'])
|
||||
obj.source = 'wifi-ap.cc'
|
||||
|
||||
bld.register_ns3_script('wifi-ap.py', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools', 'visualizer'])
|
||||
bld.register_ns3_script('wifi-ap.py', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools'])
|
||||
|
||||
obj = bld.create_ns3_program('wifi-wired-bridging', ['internet', 'mobility', 'wifi', 'csma', 'bridge', 'applications'])
|
||||
obj.source = 'wifi-wired-bridging.cc'
|
||||
@@ -28,16 +28,16 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('multirate', ['internet', 'mobility', 'wifi', 'tools', 'flow-monitor', 'olsr', 'applications', 'point-to-point'])
|
||||
obj.source = 'multirate.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc', ['internet', 'mobility', 'wifi', 'config-store', 'tools', 'visualizer'])
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc', ['internet', 'mobility', 'wifi', 'config-store', 'tools'])
|
||||
obj.source = 'wifi-simple-adhoc.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc-grid', ['internet', 'mobility', 'wifi', 'olsr', 'config-store', 'tools', 'point-to-point', 'visualizer'])
|
||||
obj = bld.create_ns3_program('wifi-simple-adhoc-grid', ['internet', 'mobility', 'wifi', 'olsr', 'config-store', 'tools', 'point-to-point'])
|
||||
obj.source = 'wifi-simple-adhoc-grid.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-infra', ['internet', 'mobility', 'wifi','config-store', 'visualizer'])
|
||||
obj = bld.create_ns3_program('wifi-simple-infra', ['internet', 'mobility', 'wifi','config-store'])
|
||||
obj.source = 'wifi-simple-infra.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-simple-interference', ['internet', 'mobility', 'wifi', 'config-store', 'tools', 'visualizer'])
|
||||
obj = bld.create_ns3_program('wifi-simple-interference', ['internet', 'mobility', 'wifi', 'config-store', 'tools'])
|
||||
obj.source = 'wifi-simple-interference.cc'
|
||||
|
||||
obj = bld.create_ns3_program('wifi-blockack', ['internet', 'mobility', 'wifi', 'applications'])
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
/**
|
||||
* this method is expected to be re-implemented by each antenna model
|
||||
*
|
||||
* \param the spherical angles at which the radiation pattern should
|
||||
* \param a the spherical angles at which the radiation pattern should
|
||||
* be evaluated
|
||||
*
|
||||
* \return the power gain in dBi of the antenna radiation pattern at
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace aodv
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (TypeHeader);
|
||||
|
||||
TypeHeader::TypeHeader (MessageType t = AODVTYPE_RREQ) :
|
||||
TypeHeader::TypeHeader (MessageType t/* = AODVTYPE_RREQ*/) :
|
||||
m_type (t), m_valid (true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class TypeHeader : public Header
|
||||
{
|
||||
public:
|
||||
/// c-tor
|
||||
TypeHeader (MessageType t);
|
||||
TypeHeader (MessageType t = AODVTYPE_RREQ);
|
||||
|
||||
///\name Header serialization/deserialization
|
||||
//\{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "attribute-default-iterator.h"
|
||||
#include "ns3/attribute.h"
|
||||
#include "ns3/pointer.h"
|
||||
#include "ns3/callback.h"
|
||||
#include "ns3/global-value.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/object-ptr-container.h"
|
||||
@@ -82,7 +83,13 @@ AttributeDefaultIterator::Iterate (void)
|
||||
//pointer value, won't take it
|
||||
continue;
|
||||
}
|
||||
//We take only values, no pointers or vectors
|
||||
Ptr<const CallbackValue> callback = DynamicCast<const CallbackValue> (info.initialValue);
|
||||
if (callback != 0)
|
||||
{
|
||||
//callback value, won't take it
|
||||
continue;
|
||||
}
|
||||
//We take only values, no pointers or vectors or callbacks
|
||||
if (!calledStart)
|
||||
{
|
||||
StartVisitTypeId (tid.GetName ());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
callback_classes = [
|
||||
['void', 'unsigned char*', 'long', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'unsigned char*', 'int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
]
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,532 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2008 Timo Bingmann
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Timo Bingmann <timo.bingmann@student.kit.edu>
|
||||
*/
|
||||
#include "ns3/random-variable-stream.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/integer.h"
|
||||
#include "ns3/gnuplot.h"
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2
|
||||
/// and dround(0.257, 0.1) = 0.3
|
||||
double dround (double number, double precision)
|
||||
{
|
||||
number /= precision;
|
||||
if (number >= 0)
|
||||
number = std::floor (number + 0.5);
|
||||
else
|
||||
number = std::ceil (number - 0.5);
|
||||
number *= precision;
|
||||
return number;
|
||||
}
|
||||
|
||||
static GnuplotDataset
|
||||
Histogramm (Ptr<RandomVariableStream> rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
|
||||
{
|
||||
typedef std::map<double, unsigned int> histogramm_maptype;
|
||||
histogramm_maptype histogramm;
|
||||
|
||||
for(unsigned int i = 0; i < probes; ++i)
|
||||
{
|
||||
double val = dround ( rndvar->GetValue (), precision );
|
||||
|
||||
++histogramm[val];
|
||||
}
|
||||
|
||||
Gnuplot2dDataset data;
|
||||
data.SetTitle (title);
|
||||
|
||||
if (notcontinous)
|
||||
{
|
||||
data.SetStyle (Gnuplot2dDataset::IMPULSES);
|
||||
}
|
||||
|
||||
for(histogramm_maptype::const_iterator hi = histogramm.begin ();
|
||||
hi != histogramm.end (); ++hi)
|
||||
{
|
||||
data.Add (hi->first, (double)hi->second / (double)probes / precision);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
unsigned int probes = 1000000;
|
||||
double precision = 0.01;
|
||||
|
||||
GnuplotCollection gnuplots ("main-random-variables.pdf");
|
||||
gnuplots.SetTerminal ("pdf enhanced");
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("UniformRandomVariable");
|
||||
plot.AppendExtra ("set yrange [0:]");
|
||||
|
||||
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
|
||||
x->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x->SetAttribute ("Max", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x, probes, precision,
|
||||
"UniformRandomVariable [0.0 .. 1.0)") );
|
||||
plot.AddDataset ( Gnuplot2dFunction ("1.0",
|
||||
"0 <= x && x <= 1 ? 1.0 : 0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ExponentialRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:8]");
|
||||
plot.AppendExtra ("ExpDist(x,l) = 1/l * exp(-1/l * x)");
|
||||
|
||||
Ptr<ExponentialRandomVariable> x1 = CreateObject<ExponentialRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ExponentialRandomVariable m=0.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 0.5",
|
||||
"ExpDist(x, 0.5)") );
|
||||
|
||||
Ptr<ExponentialRandomVariable> x2 = CreateObject<ExponentialRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ExponentialRandomVariable m=1") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.0",
|
||||
"ExpDist(x, 1.0)") );
|
||||
|
||||
Ptr<ExponentialRandomVariable> x3 = CreateObject<ExponentialRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ExponentialRandomVariable m=1.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.5",
|
||||
"ExpDist(x, 1.5)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ParetoRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:2]");
|
||||
|
||||
Ptr<ParetoRandomVariable> x1 = CreateObject<ParetoRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=1.5") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x2 = CreateObject<ParetoRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x3 = CreateObject<ParetoRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("WeibullRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
Ptr<WeibullRandomVariable> x1 = CreateObject<WeibullRandomVariable> ();
|
||||
x1->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=1.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x2 = CreateObject<WeibullRandomVariable> ();
|
||||
x2->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x3 = CreateObject<WeibullRandomVariable> ();
|
||||
x3->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=3.0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("NormalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [-3:3]");
|
||||
plot.AppendExtra ("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)");
|
||||
|
||||
Ptr<NormalRandomVariable> x1 = CreateObject<NormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Variance", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0",
|
||||
"NormalDist(x,0.0,1.0)") );
|
||||
|
||||
Ptr<NormalRandomVariable> x2 = CreateObject<NormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Variance", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)",
|
||||
"NormalDist(x,0.0,sqrt(2.0))") );
|
||||
|
||||
Ptr<NormalRandomVariable> x3 = CreateObject<NormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Variance", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)",
|
||||
"NormalDist(x,0.0,sqrt(3.0))") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
// XXX Turn this plot back on once its distribution has been finished.
|
||||
/*
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("EmpiricalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
EmpiricalRandomVariable emp1;
|
||||
emp1.CDF (0.0, 0.0 / 15.0);
|
||||
emp1.CDF (0.2, 1.0 / 15.0);
|
||||
emp1.CDF (0.4, 3.0 / 15.0);
|
||||
emp1.CDF (0.6, 6.0 / 15.0);
|
||||
emp1.CDF (0.8, 10.0 / 15.0);
|
||||
emp1.CDF (1.0, 15.0 / 15.0);
|
||||
|
||||
plot.AddDataset ( Histogramm (emp1, probes, precision,
|
||||
"EmpiricalRandomVariable (Stairs)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
// XXX Turn the above plot back on once its distribution has been finished.
|
||||
*/
|
||||
|
||||
// XXX Turn this plot back on once its distribution has been finished.
|
||||
/*
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("DeterministicRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
double values[] = { 0.0, 0.2, 0.2, 0.4, 0.2, 0.6, 0.8, 0.8, 1.0 };
|
||||
DeterministicRandomVariable det1 (values, sizeof(values) / sizeof(values[0]));
|
||||
|
||||
plot.AddDataset ( Histogramm (det1, probes, precision,
|
||||
"DeterministicRandomVariable", true) );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
// XXX Turn the above plot back on once its distribution has been finished.
|
||||
*/
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("LogNormalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
plot.AppendExtra ("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)");
|
||||
|
||||
Ptr<LogNormalRandomVariable> x1 = CreateObject<LogNormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Sigma", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 1.0)",
|
||||
"LogNormalDist(x, 0.0, 1.0)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x2 = CreateObject<LogNormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Sigma", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.5") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x3 = CreateObject<LogNormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Sigma", DoubleValue (0.25));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.25") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 0.25)",
|
||||
"LogNormalDist(x, 0.0, 0.25)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x4 = CreateObject<LogNormalRandomVariable> ();
|
||||
x4->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x4->SetAttribute ("Sigma", DoubleValue (0.125));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.125") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x5 = CreateObject<LogNormalRandomVariable> ();
|
||||
x5->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x5->SetAttribute ("Sigma", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 2.0)",
|
||||
"LogNormalDist(x, 0.0, 2.0)") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x6 = CreateObject<LogNormalRandomVariable> ();
|
||||
x6->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x6->SetAttribute ("Sigma", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("TriangularRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
Ptr<TriangularRandomVariable> x1 = CreateObject<TriangularRandomVariable> ();
|
||||
x1->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.5") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x2 = CreateObject<TriangularRandomVariable> ();
|
||||
x2->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.4));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.4") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x3 = CreateObject<TriangularRandomVariable> ();
|
||||
x3->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.65));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.65") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("GammaRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("set yrange [0:1]");
|
||||
plot.AppendExtra ("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)");
|
||||
|
||||
plot.AppendExtra ("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9");
|
||||
|
||||
Ptr<GammaRandomVariable> x1 = CreateObject<GammaRandomVariable> ();
|
||||
x1->SetAttribute ("Alpha", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"GammaRandomVariable a=1.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.0, 1.0)",
|
||||
"GammaDist(x, 1.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x2 = CreateObject<GammaRandomVariable> ();
|
||||
x2->SetAttribute ("Alpha", DoubleValue (1.5));
|
||||
x2->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"GammaRandomVariable a=1.5 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.5, 1.0)",
|
||||
"GammaDist(x, 1.5, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x3 = CreateObject<GammaRandomVariable> ();
|
||||
x3->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x3->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 1.0)",
|
||||
"GammaDist(x, 2.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x4 = CreateObject<GammaRandomVariable> ();
|
||||
x4->SetAttribute ("Alpha", DoubleValue (4.0));
|
||||
x4->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"GammaRandomVariable a=4.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 4.0, 1.0)",
|
||||
"GammaDist(x, 4.0, 1.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x5 = CreateObject<GammaRandomVariable> ();
|
||||
x5->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x5->SetAttribute ("Beta", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 2.0)",
|
||||
"GammaDist(x, 2.0, 2.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x6 = CreateObject<GammaRandomVariable> ();
|
||||
x6->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x6->SetAttribute ("Beta", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 3.0)",
|
||||
"GammaDist(x, 2.5, 3.0)") );
|
||||
|
||||
Ptr<GammaRandomVariable> x7 = CreateObject<GammaRandomVariable> ();
|
||||
x7->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x7->SetAttribute ("Beta", DoubleValue (4.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=4.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 4.5)",
|
||||
"GammaDist(x, 2.5, 4.5)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ErlangRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!");
|
||||
|
||||
plot.AppendExtra ("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9");
|
||||
|
||||
Ptr<ErlangRandomVariable> x1 = CreateObject<ErlangRandomVariable> ();
|
||||
x1->SetAttribute ("K", IntegerValue (1));
|
||||
x1->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ErlangRandomVariable k=1 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 1, 1.0)",
|
||||
"ErlangDist(x, 1, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x2 = CreateObject<ErlangRandomVariable> ();
|
||||
x2->SetAttribute ("K", IntegerValue (2));
|
||||
x2->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 1.0)",
|
||||
"ErlangDist(x, 2, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x3 = CreateObject<ErlangRandomVariable> ();
|
||||
x3->SetAttribute ("K", IntegerValue (3));
|
||||
x3->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ErlangRandomVariable k=3 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 3, 1.0)",
|
||||
"ErlangDist(x, 3, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x4 = CreateObject<ErlangRandomVariable> ();
|
||||
x4->SetAttribute ("K", IntegerValue (5));
|
||||
x4->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"ErlangRandomVariable k=5 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 5, 1.0)",
|
||||
"ErlangDist(x, 5, 1.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x5 = CreateObject<ErlangRandomVariable> ();
|
||||
x5->SetAttribute ("K", IntegerValue (2));
|
||||
x5->SetAttribute ("Lambda", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 2.0)",
|
||||
"ErlangDist(x, 2, 2.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x6 = CreateObject<ErlangRandomVariable> ();
|
||||
x6->SetAttribute ("K", IntegerValue (2));
|
||||
x6->SetAttribute ("Lambda", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 3.0)",
|
||||
"ErlangDist(x, 2, 3.0)") );
|
||||
|
||||
Ptr<ErlangRandomVariable> x7 = CreateObject<ErlangRandomVariable> ();
|
||||
x7->SetAttribute ("K", IntegerValue (2));
|
||||
x7->SetAttribute ("Lambda", DoubleValue (5.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=5.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 5.0)",
|
||||
"ErlangDist(x, 2, 5.0)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
gnuplots.GenerateOutput (std::cout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -17,7 +17,11 @@
|
||||
*
|
||||
* Author: Timo Bingmann <timo.bingmann@student.kit.edu>
|
||||
*/
|
||||
#include "ns3/random-variable.h"
|
||||
#include "ns3/random-variable-stream.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/integer.h"
|
||||
#include "ns3/gnuplot.h"
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
@@ -38,14 +42,14 @@ double dround (double number, double precision)
|
||||
}
|
||||
|
||||
static GnuplotDataset
|
||||
Histogramm (RandomVariable rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
|
||||
Histogramm (Ptr<RandomVariableStream> rndvar, unsigned int probes, double precision, const std::string& title, bool notcontinous = false)
|
||||
{
|
||||
typedef std::map<double, unsigned int> histogramm_maptype;
|
||||
histogramm_maptype histogramm;
|
||||
|
||||
for(unsigned int i = 0; i < probes; ++i)
|
||||
{
|
||||
double val = dround ( rndvar.GetValue (), precision );
|
||||
double val = dround ( rndvar->GetValue (), precision );
|
||||
|
||||
++histogramm[val];
|
||||
}
|
||||
@@ -77,13 +81,16 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("UniformVariable");
|
||||
plot.SetTitle ("UniformRandomVariable");
|
||||
plot.AppendExtra ("set yrange [0:]");
|
||||
|
||||
plot.AddDataset ( Histogramm (UniformVariable (0.0, 1.0), probes, precision,
|
||||
"UniformVariable [0.0 .. 1.0)") );
|
||||
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
|
||||
x->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x->SetAttribute ("Max", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("0.1",
|
||||
plot.AddDataset ( Histogramm (x, probes, precision,
|
||||
"UniformRandomVariable [0.0 .. 1.0)") );
|
||||
plot.AddDataset ( Gnuplot2dFunction ("1.0",
|
||||
"0 <= x && x <= 1 ? 1.0 : 0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
@@ -91,24 +98,33 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ExponentialVariable");
|
||||
plot.SetTitle ("ExponentialRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:8]");
|
||||
plot.AppendExtra ("ExpDist(x,l) = 1/l * exp(-1/l * x)");
|
||||
|
||||
plot.AddDataset ( Histogramm (ExponentialVariable (0.5), probes, precision,
|
||||
"ExponentialVariable m=0.5") );
|
||||
Ptr<ExponentialRandomVariable> x1 = CreateObject<ExponentialRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ExponentialRandomVariable m=0.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 0.5",
|
||||
"ExpDist(x, 0.5)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ExponentialVariable (1.0), probes, precision,
|
||||
"ExponentialVariable m=1") );
|
||||
Ptr<ExponentialRandomVariable> x2 = CreateObject<ExponentialRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ExponentialRandomVariable m=1") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.0",
|
||||
"ExpDist(x, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ExponentialVariable (1.5), probes, precision,
|
||||
"ExponentialVariable m=1.5") );
|
||||
Ptr<ExponentialRandomVariable> x3 = CreateObject<ExponentialRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ExponentialRandomVariable m=1.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("ExponentialDistribution mean 1.5",
|
||||
"ExpDist(x, 1.5)") );
|
||||
@@ -118,58 +134,94 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ParetoVariable");
|
||||
plot.SetTitle ("ParetoRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:2]");
|
||||
|
||||
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 1.5), probes, precision,
|
||||
"ParetoVariable m=1.0 s=1.5") );
|
||||
Ptr<ParetoRandomVariable> x1 = CreateObject<ParetoRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.0), probes, precision,
|
||||
"ParetoVariable m=1.0 s=2.0") );
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=1.5") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ParetoVariable (1.0, 2.5), probes, precision,
|
||||
"ParetoVariable m=1.0 s=2.5") );
|
||||
Ptr<ParetoRandomVariable> x2 = CreateObject<ParetoRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<ParetoRandomVariable> x3 = CreateObject<ParetoRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ParetoRandomVariable m=1.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("WeibullVariable");
|
||||
plot.SetTitle ("WeibullRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 1.0), probes, precision,
|
||||
"WeibullVariable m=1.0 s=1.0") );
|
||||
Ptr<WeibullRandomVariable> x1 = CreateObject<WeibullRandomVariable> ();
|
||||
x1->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Shape", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 2.0), probes, precision,
|
||||
"WeibullVariable m=1.0 s=2.0") );
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=1.0") );
|
||||
|
||||
plot.AddDataset ( Histogramm (WeibullVariable (1.0, 3.0), probes, precision,
|
||||
"WeibullVariable m=1.0 s=3.0") );
|
||||
Ptr<WeibullRandomVariable> x2 = CreateObject<WeibullRandomVariable> ();
|
||||
x2->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Shape", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=2.0") );
|
||||
|
||||
Ptr<WeibullRandomVariable> x3 = CreateObject<WeibullRandomVariable> ();
|
||||
x3->SetAttribute ("Scale", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Shape", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"WeibullRandomVariable m=1.0 s=3.0") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("NormalVariable");
|
||||
plot.SetTitle ("NormalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [-3:3]");
|
||||
plot.AppendExtra ("NormalDist(x,m,s) = 1 / (s * sqrt(2*pi)) * exp(-1.0 / 2.0 * ((x-m) / s)**2)");
|
||||
|
||||
plot.AddDataset ( Histogramm (NormalVariable (0.0, 1.0), probes, precision,
|
||||
"NormalVariable m=0.0 v=1.0") );
|
||||
Ptr<NormalRandomVariable> x1 = CreateObject<NormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Variance", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=1.0",
|
||||
"NormalDist(x,0.0,1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (NormalVariable (0.0, 2.0), probes, precision,
|
||||
"NormalVariable m=0.0 v=2.0") );
|
||||
Ptr<NormalRandomVariable> x2 = CreateObject<NormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Variance", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(2.0)",
|
||||
"NormalDist(x,0.0,sqrt(2.0))") );
|
||||
|
||||
plot.AddDataset ( Histogramm (NormalVariable (0.0, 3.0), probes, precision,
|
||||
"NormalVariable m=0.0 v=3.0") );
|
||||
Ptr<NormalRandomVariable> x3 = CreateObject<NormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Variance", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"NormalRandomVariable m=0.0 v=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("NormalDist {/Symbol m}=0.0 {/Symbol s}=sqrt(3.0)",
|
||||
"NormalDist(x,0.0,sqrt(3.0))") );
|
||||
@@ -179,138 +231,207 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("EmpiricalVariable");
|
||||
plot.SetTitle ("EmpiricalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
EmpiricalVariable emp1;
|
||||
emp1.CDF (0.0, 0.0 / 15.0);
|
||||
emp1.CDF (0.2, 1.0 / 15.0);
|
||||
emp1.CDF (0.4, 3.0 / 15.0);
|
||||
emp1.CDF (0.6, 6.0 / 15.0);
|
||||
emp1.CDF (0.8, 10.0 / 15.0);
|
||||
emp1.CDF (1.0, 15.0 / 15.0);
|
||||
Ptr<EmpiricalRandomVariable> emp1 = CreateObject<EmpiricalRandomVariable> ();
|
||||
emp1->CDF (0.0, 0.0 / 15.0);
|
||||
emp1->CDF (0.2, 1.0 / 15.0);
|
||||
emp1->CDF (0.4, 3.0 / 15.0);
|
||||
emp1->CDF (0.6, 6.0 / 15.0);
|
||||
emp1->CDF (0.8, 10.0 / 15.0);
|
||||
emp1->CDF (1.0, 15.0 / 15.0);
|
||||
|
||||
plot.AddDataset ( Histogramm (emp1, probes, precision,
|
||||
"EmpiricalVariable (Stairs)") );
|
||||
"EmpiricalRandomVariable (Stairs)") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("DeterministicVariable");
|
||||
plot.SetTitle ("DeterministicRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
double values[] = { 0.0, 0.2, 0.2, 0.4, 0.2, 0.6, 0.8, 0.8, 1.0 };
|
||||
DeterministicVariable det1 (values, sizeof(values) / sizeof(values[0]));
|
||||
|
||||
Ptr<DeterministicRandomVariable> det1 = CreateObject<DeterministicRandomVariable> ();
|
||||
det1->SetValueArray (values, sizeof(values) / sizeof(values[0]));
|
||||
|
||||
plot.AddDataset ( Histogramm (det1, probes, precision,
|
||||
"DeterministicVariable", true) );
|
||||
"DeterministicRandomVariable", true) );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("LogNormalVariable");
|
||||
plot.SetTitle ("LogNormalRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:3]");
|
||||
|
||||
plot.AppendExtra ("LogNormalDist(x,m,s) = 1.0/x * NormalDist(log(x), m, s)");
|
||||
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 1.0), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=1.0") );
|
||||
Ptr<LogNormalRandomVariable> x1 = CreateObject<LogNormalRandomVariable> ();
|
||||
x1->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Sigma", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 1.0)",
|
||||
"LogNormalDist(x, 0.0, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.5), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=0.5") );
|
||||
Ptr<LogNormalRandomVariable> x2 = CreateObject<LogNormalRandomVariable> ();
|
||||
x2->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Sigma", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.25), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=0.25") );
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.5") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x3 = CreateObject<LogNormalRandomVariable> ();
|
||||
x3->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Sigma", DoubleValue (0.25));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.25") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 0.25)",
|
||||
"LogNormalDist(x, 0.0, 0.25)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 0.125), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=0.125") );
|
||||
Ptr<LogNormalRandomVariable> x4 = CreateObject<LogNormalRandomVariable> ();
|
||||
x4->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x4->SetAttribute ("Sigma", DoubleValue (0.125));
|
||||
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.0), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=2.0") );
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=0.125") );
|
||||
|
||||
Ptr<LogNormalRandomVariable> x5 = CreateObject<LogNormalRandomVariable> ();
|
||||
x5->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x5->SetAttribute ("Sigma", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("LogNormalDist(x, 0.0, 2.0)",
|
||||
"LogNormalDist(x, 0.0, 2.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (LogNormalVariable (0.0, 2.5), probes, precision,
|
||||
"LogNormalVariable m=0.0 s=2.5") );
|
||||
Ptr<LogNormalRandomVariable> x6 = CreateObject<LogNormalRandomVariable> ();
|
||||
x6->SetAttribute ("Mu", DoubleValue (0.0));
|
||||
x6->SetAttribute ("Sigma", DoubleValue (2.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"LogNormalRandomVariable m=0.0 s=2.5") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("TriangularVariable");
|
||||
plot.SetTitle ("TriangularRandomVariable");
|
||||
plot.AppendExtra ("set xrange [*:*]");
|
||||
|
||||
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.5), probes, precision,
|
||||
"TriangularVariable [0.0 .. 1.0) m=0.5") );
|
||||
Ptr<TriangularRandomVariable> x1 = CreateObject<TriangularRandomVariable> ();
|
||||
x1->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x1->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Mean", DoubleValue (0.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.4), probes, precision,
|
||||
"TriangularVariable [0.0 .. 1.0) m=0.4") );
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.5") );
|
||||
|
||||
plot.AddDataset ( Histogramm (TriangularVariable (0.0, 1.0, 0.65), probes, precision,
|
||||
"TriangularVariable [0.0 .. 1.0) m=0.65") );
|
||||
Ptr<TriangularRandomVariable> x2 = CreateObject<TriangularRandomVariable> ();
|
||||
x2->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x2->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x2->SetAttribute ("Mean", DoubleValue (0.4));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.4") );
|
||||
|
||||
Ptr<TriangularRandomVariable> x3 = CreateObject<TriangularRandomVariable> ();
|
||||
x3->SetAttribute ("Min", DoubleValue (0.0));
|
||||
x3->SetAttribute ("Max", DoubleValue (1.0));
|
||||
x3->SetAttribute ("Mean", DoubleValue (0.65));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"TriangularRandomVariable [0.0 .. 1.0) m=0.65") );
|
||||
|
||||
gnuplots.AddPlot (plot);
|
||||
}
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("GammaVariable");
|
||||
plot.SetTitle ("GammaRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("set yrange [0:1]");
|
||||
plot.AppendExtra ("GammaDist(x,a,b) = x**(a-1) * 1/b**a * exp(-x/b) / gamma(a)");
|
||||
|
||||
plot.AppendExtra ("set label 1 '{/Symbol g}(x,{/Symbol a},{/Symbol b}) = x^{/Symbol a-1} e^{-x {/Symbol b}^{-1}} ( {/Symbol b}^{/Symbol a} {/Symbol G}({/Symbol a}) )^{-1}' at 0.7, 0.9");
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (1.0, 1.0), probes, precision,
|
||||
"GammaVariable a=1.0 b=1.0") );
|
||||
Ptr<GammaRandomVariable> x1 = CreateObject<GammaRandomVariable> ();
|
||||
x1->SetAttribute ("Alpha", DoubleValue (1.0));
|
||||
x1->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"GammaRandomVariable a=1.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.0, 1.0)",
|
||||
"GammaDist(x, 1.0, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (1.5, 1.0), probes, precision,
|
||||
"GammaVariable a=1.5 b=1.0") );
|
||||
Ptr<GammaRandomVariable> x2 = CreateObject<GammaRandomVariable> ();
|
||||
x2->SetAttribute ("Alpha", DoubleValue (1.5));
|
||||
x2->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"GammaRandomVariable a=1.5 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 1.5, 1.0)",
|
||||
"GammaDist(x, 1.5, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.0, 1.0), probes, precision,
|
||||
"GammaVariable a=2.0 b=1.0") );
|
||||
Ptr<GammaRandomVariable> x3 = CreateObject<GammaRandomVariable> ();
|
||||
x3->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x3->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 1.0)",
|
||||
"GammaDist(x, 2.0, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (4.0, 1.0), probes, precision,
|
||||
"GammaVariable a=4.0 b=1.0") );
|
||||
Ptr<GammaRandomVariable> x4 = CreateObject<GammaRandomVariable> ();
|
||||
x4->SetAttribute ("Alpha", DoubleValue (4.0));
|
||||
x4->SetAttribute ("Beta", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"GammaRandomVariable a=4.0 b=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 4.0, 1.0)",
|
||||
"GammaDist(x, 4.0, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.0, 2.0), probes, precision,
|
||||
"GammaVariable a=2.0 b=2.0") );
|
||||
Ptr<GammaRandomVariable> x5 = CreateObject<GammaRandomVariable> ();
|
||||
x5->SetAttribute ("Alpha", DoubleValue (2.0));
|
||||
x5->SetAttribute ("Beta", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"GammaRandomVariable a=2.0 b=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.0, 2.0)",
|
||||
"GammaDist(x, 2.0, 2.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.5, 3.0), probes, precision,
|
||||
"GammaVariable a=2.5 b=3.0") );
|
||||
Ptr<GammaRandomVariable> x6 = CreateObject<GammaRandomVariable> ();
|
||||
x6->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x6->SetAttribute ("Beta", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 3.0)",
|
||||
"GammaDist(x, 2.5, 3.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (GammaVariable (2.5, 4.5), probes, precision,
|
||||
"GammaVariable a=2.5 b=4.5") );
|
||||
Ptr<GammaRandomVariable> x7 = CreateObject<GammaRandomVariable> ();
|
||||
x7->SetAttribute ("Alpha", DoubleValue (2.5));
|
||||
x7->SetAttribute ("Beta", DoubleValue (4.5));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"GammaRandomVariable a=2.5 b=4.5") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("{/Symbol g}(x, 2.5, 4.5)",
|
||||
"GammaDist(x, 2.5, 4.5)") );
|
||||
@@ -320,50 +441,78 @@ int main (int argc, char *argv[])
|
||||
|
||||
{
|
||||
Gnuplot plot;
|
||||
plot.SetTitle ("ErlangVariable");
|
||||
plot.SetTitle ("ErlangRandomVariable");
|
||||
plot.AppendExtra ("set xrange [0:10]");
|
||||
plot.AppendExtra ("ErlangDist(x,k,l) = x**(k-1) * 1/l**k * exp(-x/l) / (k-1)!");
|
||||
|
||||
plot.AppendExtra ("set label 1 'Erlang(x,k,{/Symbol l}) = x^{k-1} e^{-x {/Symbol l}^{-1}} ( {/Symbol l}^k (k-1)! )^{-1}' at 0.7, 0.9");
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (1, 1.0), probes, precision,
|
||||
"ErlangVariable k=1 {/Symbol l}=1.0") );
|
||||
Ptr<ErlangRandomVariable> x1 = CreateObject<ErlangRandomVariable> ();
|
||||
x1->SetAttribute ("K", IntegerValue (1));
|
||||
x1->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x1, probes, precision,
|
||||
"ErlangRandomVariable k=1 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 1, 1.0)",
|
||||
"ErlangDist(x, 1, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 1.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=1.0") );
|
||||
Ptr<ErlangRandomVariable> x2 = CreateObject<ErlangRandomVariable> ();
|
||||
x2->SetAttribute ("K", IntegerValue (2));
|
||||
x2->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x2, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 1.0)",
|
||||
"ErlangDist(x, 2, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (3, 1.0), probes, precision,
|
||||
"ErlangVariable k=3 {/Symbol l}=1.0") );
|
||||
Ptr<ErlangRandomVariable> x3 = CreateObject<ErlangRandomVariable> ();
|
||||
x3->SetAttribute ("K", IntegerValue (3));
|
||||
x3->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x3, probes, precision,
|
||||
"ErlangRandomVariable k=3 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 3, 1.0)",
|
||||
"ErlangDist(x, 3, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (5, 1.0), probes, precision,
|
||||
"ErlangVariable k=5 {/Symbol l}=1.0") );
|
||||
Ptr<ErlangRandomVariable> x4 = CreateObject<ErlangRandomVariable> ();
|
||||
x4->SetAttribute ("K", IntegerValue (5));
|
||||
x4->SetAttribute ("Lambda", DoubleValue (1.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x4, probes, precision,
|
||||
"ErlangRandomVariable k=5 {/Symbol l}=1.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 5, 1.0)",
|
||||
"ErlangDist(x, 5, 1.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 2.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=2.0") );
|
||||
Ptr<ErlangRandomVariable> x5 = CreateObject<ErlangRandomVariable> ();
|
||||
x5->SetAttribute ("K", IntegerValue (2));
|
||||
x5->SetAttribute ("Lambda", DoubleValue (2.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x5, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=2.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 2.0)",
|
||||
"ErlangDist(x, 2, 2.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 3.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=3.0") );
|
||||
Ptr<ErlangRandomVariable> x6 = CreateObject<ErlangRandomVariable> ();
|
||||
x6->SetAttribute ("K", IntegerValue (2));
|
||||
x6->SetAttribute ("Lambda", DoubleValue (3.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x6, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=3.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 3.0)",
|
||||
"ErlangDist(x, 2, 3.0)") );
|
||||
|
||||
plot.AddDataset ( Histogramm (ErlangVariable (2, 5.0), probes, precision,
|
||||
"ErlangVariable k=2 {/Symbol l}=5.0") );
|
||||
Ptr<ErlangRandomVariable> x7 = CreateObject<ErlangRandomVariable> ();
|
||||
x7->SetAttribute ("K", IntegerValue (2));
|
||||
x7->SetAttribute ("Lambda", DoubleValue (5.0));
|
||||
|
||||
plot.AddDataset ( Histogramm (x7, probes, precision,
|
||||
"ErlangRandomVariable k=2 {/Symbol l}=5.0") );
|
||||
|
||||
plot.AddDataset ( Gnuplot2dFunction ("Erlang(x, 2, 5.0)",
|
||||
"ErlangDist(x, 2, 5.0)") );
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of Washington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/random-variable-stream.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace ns3;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
* This program can be run from waf such as "./waf --run sample-random-variable-stream"
|
||||
*
|
||||
* This program is about as simple as possible to display the use of ns-3
|
||||
* to generate random numbers. By default, the uniform random variate that
|
||||
* will be outputted is 0.816532. Because ns-3 uses a fixed seed for the
|
||||
* pseudo-random number generator, this program should always output the
|
||||
* same number. Likewise, ns-3 simulations using random variables will
|
||||
* behave deterministically unless the user changes the RunNumber or the
|
||||
* Seed.
|
||||
*
|
||||
* There are three primary mechanisms to change the seed or run numbers
|
||||
* from their default integer value of 1
|
||||
* 1) Through explicit call of SeedManager::SetSeed () and
|
||||
* SeedManager::SetRun () (commented out below)
|
||||
* 2) Through the passing of command line arguments such as:
|
||||
* "./waf --command-template="%s --RngRun=<value>" --run program-name"
|
||||
* 3) Through the use of the NS_GLOBAL_VALUE environment variable, such as:
|
||||
* "NS_GLOBAL_VALUE="RngRun=<value>" ./waf --run program-name"
|
||||
*
|
||||
* For instance, setting the run number to 3 will change the program output to
|
||||
* 0.775417
|
||||
*
|
||||
* Consult the ns-3 manual for more information about the use of the
|
||||
* random number generator
|
||||
*/
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
CommandLine cmd;
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
// SeedManager::SetRun (3);
|
||||
|
||||
Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
|
||||
|
||||
cout << uv->GetValue () << endl;
|
||||
|
||||
}
|
||||
@@ -18,10 +18,17 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('main-random-variable', ['core', 'config-store', 'tools'])
|
||||
obj.source = 'main-random-variable.cc'
|
||||
|
||||
obj = bld.create_ns3_program('main-random-variable-stream', ['core', 'config-store', 'tools'])
|
||||
obj.source = 'main-random-variable-stream.cc'
|
||||
|
||||
obj = bld.create_ns3_program('sample-random-variable',
|
||||
['core'])
|
||||
obj.source = 'sample-random-variable.cc'
|
||||
|
||||
obj = bld.create_ns3_program('sample-random-variable-stream',
|
||||
['core'])
|
||||
obj.source = 'sample-random-variable-stream.cc'
|
||||
|
||||
if bld.env['ENABLE_THREADING'] and bld.env["ENABLE_REAL_TIME"]:
|
||||
obj = bld.create_ns3_program('main-test-sync', ['network'])
|
||||
obj.source = 'main-test-sync.cc'
|
||||
|
||||
@@ -199,7 +199,7 @@ private:
|
||||
}
|
||||
|
||||
template <typename W, typename T, typename U, typename V>
|
||||
Ptr<const AttributeAccessor>
|
||||
inline Ptr<const AttributeAccessor>
|
||||
DoMakeAccessorHelperTwo (void (T::*setter)(U),
|
||||
V (T::*getter)(void) const)
|
||||
{
|
||||
@@ -240,7 +240,7 @@ private:
|
||||
}
|
||||
|
||||
template <typename W, typename T, typename U, typename V>
|
||||
Ptr<const AttributeAccessor>
|
||||
inline Ptr<const AttributeAccessor>
|
||||
DoMakeAccessorHelperTwo (V (T::*getter)(void) const,
|
||||
void (T::*setter)(U))
|
||||
{
|
||||
@@ -248,7 +248,7 @@ DoMakeAccessorHelperTwo (V (T::*getter)(void) const,
|
||||
}
|
||||
|
||||
template <typename W, typename T, typename U, typename V>
|
||||
Ptr<const AttributeAccessor>
|
||||
inline Ptr<const AttributeAccessor>
|
||||
DoMakeAccessorHelperTwo (bool (T::*setter)(U),
|
||||
V (T::*getter)(void) const)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ private:
|
||||
}
|
||||
|
||||
template <typename W, typename T, typename U, typename V>
|
||||
Ptr<const AttributeAccessor>
|
||||
inline Ptr<const AttributeAccessor>
|
||||
DoMakeAccessorHelperTwo (bool (T::*getter)(void) const,
|
||||
void (T::*setter)(U))
|
||||
{
|
||||
@@ -297,14 +297,14 @@ DoMakeAccessorHelperTwo (bool (T::*getter)(void) const,
|
||||
}
|
||||
|
||||
template <typename V, typename T1>
|
||||
Ptr<const AttributeAccessor>
|
||||
inline Ptr<const AttributeAccessor>
|
||||
MakeAccessorHelper (T1 a1)
|
||||
{
|
||||
return DoMakeAccessorHelperOne<V> (a1);
|
||||
}
|
||||
|
||||
template <typename V, typename T1, typename T2>
|
||||
Ptr<const AttributeAccessor>
|
||||
inline Ptr<const AttributeAccessor>
|
||||
MakeAccessorHelper (T1 a1, T2 a2)
|
||||
{
|
||||
return DoMakeAccessorHelperTwo<V> (a1, a2);
|
||||
|
||||
+49
-39
@@ -376,52 +376,62 @@ Resolver::DoResolve (std::string path, Ptr<Object> root)
|
||||
else
|
||||
{
|
||||
// this is a normal attribute.
|
||||
TypeId tid = root->GetInstanceTypeId ();
|
||||
TypeId tid;
|
||||
TypeId nextTid = root->GetInstanceTypeId ();
|
||||
bool foundMatch = false;
|
||||
for (uint32_t i = 0; i < tid.GetAttributeN(); i++)
|
||||
|
||||
do
|
||||
{
|
||||
struct TypeId::AttributeInformation info;
|
||||
info = tid.GetAttribute(i);
|
||||
if (info.name != item && item != "*")
|
||||
tid = nextTid;
|
||||
|
||||
for (uint32_t i = 0; i < tid.GetAttributeN(); i++)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// attempt to cast to a pointer checker.
|
||||
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
|
||||
if (ptr != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
|
||||
PointerValue ptr;
|
||||
root->GetAttribute (info.name, ptr);
|
||||
Ptr<Object> object = ptr.Get<Object> ();
|
||||
if (object == 0)
|
||||
struct TypeId::AttributeInformation info;
|
||||
info = tid.GetAttribute(i);
|
||||
if (info.name != item && item != "*")
|
||||
{
|
||||
NS_LOG_ERROR ("Requested object name=\""<<item<<
|
||||
"\" exists on path=\""<<GetResolvedPath ()<<"\""
|
||||
" but is null.");
|
||||
continue;
|
||||
}
|
||||
foundMatch = true;
|
||||
m_workStack.push_back (info.name);
|
||||
DoResolve (pathLeft, object);
|
||||
m_workStack.pop_back ();
|
||||
// attempt to cast to a pointer checker.
|
||||
const PointerChecker *ptr = dynamic_cast<const PointerChecker *> (PeekPointer (info.checker));
|
||||
if (ptr != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(ptr)="<<info.name<<" on path="<<GetResolvedPath ());
|
||||
PointerValue ptr;
|
||||
root->GetAttribute (info.name, ptr);
|
||||
Ptr<Object> object = ptr.Get<Object> ();
|
||||
if (object == 0)
|
||||
{
|
||||
NS_LOG_ERROR ("Requested object name=\""<<item<<
|
||||
"\" exists on path=\""<<GetResolvedPath ()<<"\""
|
||||
" but is null.");
|
||||
continue;
|
||||
}
|
||||
foundMatch = true;
|
||||
m_workStack.push_back (info.name);
|
||||
DoResolve (pathLeft, object);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
// attempt to cast to an object vector.
|
||||
const ObjectPtrContainerChecker *vectorChecker =
|
||||
dynamic_cast<const ObjectPtrContainerChecker *> (PeekPointer (info.checker));
|
||||
if (vectorChecker != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(vector)="<<info.name<<" on path="<<GetResolvedPath () << pathLeft);
|
||||
foundMatch = true;
|
||||
ObjectPtrContainerValue vector;
|
||||
root->GetAttribute (info.name, vector);
|
||||
m_workStack.push_back (info.name);
|
||||
DoArrayResolve (pathLeft, vector);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
// this could be anything else and we don't know what to do with it.
|
||||
// So, we just ignore it.
|
||||
}
|
||||
// attempt to cast to an object vector.
|
||||
const ObjectPtrContainerChecker *vectorChecker =
|
||||
dynamic_cast<const ObjectPtrContainerChecker *> (PeekPointer (info.checker));
|
||||
if (vectorChecker != 0)
|
||||
{
|
||||
NS_LOG_DEBUG ("GetAttribute(vector)="<<info.name<<" on path="<<GetResolvedPath () << pathLeft);
|
||||
foundMatch = true;
|
||||
ObjectPtrContainerValue vector;
|
||||
root->GetAttribute (info.name, vector);
|
||||
m_workStack.push_back (info.name);
|
||||
DoArrayResolve (pathLeft, vector);
|
||||
m_workStack.pop_back ();
|
||||
}
|
||||
// this could be anything else and we don't know what to do with it.
|
||||
// So, we just ignore it.
|
||||
}
|
||||
|
||||
nextTid = tid.GetParent ();
|
||||
} while (nextTid != tid);
|
||||
|
||||
if (!foundMatch)
|
||||
{
|
||||
NS_LOG_DEBUG ("Requested item="<<item<<" does not exist on path="<<GetResolvedPath ());
|
||||
|
||||
@@ -62,7 +62,9 @@ EventImpl * MakeEvent (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5
|
||||
namespace ns3 {
|
||||
|
||||
template <typename T>
|
||||
struct EventMemberImplObjTraits;
|
||||
struct EventMemberImplObjTraits
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct EventMemberImplObjTraits<T *>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of Washington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#include "random-variable-stream.h"
|
||||
#include "random-variable-stream-helper.h"
|
||||
#include "config.h"
|
||||
#include "pointer.h"
|
||||
#include "log.h"
|
||||
#include "assert.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("RandomVariableStreamHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
int64_t RandomVariableStreamHelper::AssignStreams (std::string path, int64_t stream)
|
||||
{
|
||||
NS_ASSERT (stream >= 0);
|
||||
Config::MatchContainer mc = Config::LookupMatches (path);
|
||||
int64_t i = 0;
|
||||
for (Config::MatchContainer::Iterator mci = mc.Begin (); mci != mc.End (); ++mci, ++i)
|
||||
{
|
||||
PointerValue ptr = mc.Get (i);
|
||||
Ptr<RandomVariableStream> rvs = ptr.Get<RandomVariableStream> ();
|
||||
NS_LOG_DEBUG ("RandomVariableStream found: " << rvs << "; setting stream to " << (stream + i));
|
||||
rvs->SetStream (stream + i);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -0,0 +1,65 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2012 University of Washington
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef RANDOM_VARIABLE_STREAM_HELPER_H
|
||||
#define RANDOM_VARIABLE_STREAM_HELPER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief Helper class for static methods involving RandomVariableStream
|
||||
*/
|
||||
class RandomVariableStreamHelper
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* This helper method can be used to configure the stream number for
|
||||
* one or more RNG streams. The path passed in should correspond to
|
||||
* an attribute path in the configuration system. It may contain wildcards
|
||||
* and may ultimately match zero, one, or more than one objects.
|
||||
*
|
||||
* The objects to match are of type PointerValue where the underlying
|
||||
* type is of type Ptr<RandomVariableStream>.
|
||||
*
|
||||
* \code
|
||||
* .AddAttribute ("Speed",
|
||||
* "A random variable used to pick the speed of a random waypoint model.",
|
||||
* StringValue("ns3::UniformRandomVariable[Min=0.3|Max=0.7]"),
|
||||
* MakePointerAccessor (&RandomWaypointMobilityModel::m_speed),
|
||||
* MakePointerChecker<RandomVariableStream> ())
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* Usage would look (for node 3) like this:
|
||||
* \code
|
||||
* std::string path ("/$ns3::NodeListPriv/NodeList/3/$ns3::Node/$ns3::RandomWaypointMobilityModel/Speed/$ns3::UniformRandomVariable");
|
||||
* int64_t retVal = RandomVariableStreamHelper::AssignStreams (path, 0);
|
||||
* \endcode
|
||||
*
|
||||
* \return The number of streams set
|
||||
* \param path (possibly wildcarded) path to a RandomVariableStream PointerValue
|
||||
* \param stream stream number to set; must be non-negative
|
||||
*/
|
||||
static int64_t AssignStreams (std::string path, int64_t stream);
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* RANDOM_VARIABLE_STREAM_HELPER_H */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -33,9 +33,8 @@
|
||||
#include <vector>
|
||||
|
||||
#include "assert.h"
|
||||
#include "config.h"
|
||||
#include "integer.h"
|
||||
#include "random-variable.h"
|
||||
#include "rng-seed-manager.h"
|
||||
#include "rng-stream.h"
|
||||
#include "fatal-error.h"
|
||||
|
||||
@@ -43,44 +42,6 @@ using namespace std;
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Seed Manager
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
uint32_t SeedManager::GetSeed ()
|
||||
{
|
||||
uint32_t s[6];
|
||||
RngStream::GetPackageSeed (s);
|
||||
NS_ASSERT (
|
||||
s[0] == s[1]
|
||||
&& s[0] == s[2]
|
||||
&& s[0] == s[3]
|
||||
&& s[0] == s[4]
|
||||
&& s[0] == s[5]
|
||||
);
|
||||
return s[0];
|
||||
}
|
||||
|
||||
void SeedManager::SetSeed (uint32_t seed)
|
||||
{
|
||||
Config::SetGlobal ("RngSeed", IntegerValue (seed));
|
||||
}
|
||||
|
||||
void SeedManager::SetRun (uint32_t run)
|
||||
{
|
||||
Config::SetGlobal ("RngRun", IntegerValue (run));
|
||||
}
|
||||
|
||||
uint32_t SeedManager::GetRun ()
|
||||
{
|
||||
return RngStream::GetPackageRun ();
|
||||
}
|
||||
|
||||
bool SeedManager::CheckSeed (uint32_t seed)
|
||||
{
|
||||
return RngStream::CheckSeed (seed);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// RandomVariableBase methods
|
||||
@@ -95,22 +56,24 @@ public:
|
||||
virtual double GetValue () = 0;
|
||||
virtual uint32_t GetInteger ();
|
||||
virtual RandomVariableBase* Copy (void) const = 0;
|
||||
|
||||
protected:
|
||||
RngStream *GetStream(void);
|
||||
private:
|
||||
RngStream* m_generator; // underlying generator being wrapped
|
||||
};
|
||||
|
||||
RandomVariableBase::RandomVariableBase ()
|
||||
: m_generator (NULL)
|
||||
: m_generator (0)
|
||||
{
|
||||
}
|
||||
|
||||
RandomVariableBase::RandomVariableBase (const RandomVariableBase& r)
|
||||
: m_generator (0)
|
||||
{
|
||||
if (r.m_generator)
|
||||
if (r.m_generator != 0)
|
||||
{
|
||||
m_generator = new RngStream (*r.m_generator);
|
||||
m_generator = new RngStream (RngSeedManager::GetSeed (),
|
||||
RngSeedManager::GetNextStreamIndex (),
|
||||
RngSeedManager::GetRun ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +87,18 @@ uint32_t RandomVariableBase::GetInteger ()
|
||||
return (uint32_t)GetValue ();
|
||||
}
|
||||
|
||||
RngStream *
|
||||
RandomVariableBase::GetStream (void)
|
||||
{
|
||||
if (m_generator == 0)
|
||||
{
|
||||
m_generator = new RngStream (RngSeedManager::GetSeed (),
|
||||
RngSeedManager::GetNextStreamIndex (),
|
||||
RngSeedManager::GetRun ());
|
||||
}
|
||||
return m_generator;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
RandomVariable::RandomVariable ()
|
||||
@@ -250,20 +225,14 @@ UniformVariableImpl::GetMax (void) const
|
||||
|
||||
double UniformVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
return m_min + m_generator->RandU01 () * (m_max - m_min);
|
||||
RngStream *generator = GetStream ();
|
||||
return m_min + generator->RandU01 () * (m_max - m_min);
|
||||
}
|
||||
|
||||
double UniformVariableImpl::GetValue (double s, double l)
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
return s + m_generator->RandU01 () * (l - s);
|
||||
RngStream *generator = GetStream ();
|
||||
return s + generator->RandU01 () * (l - s);
|
||||
}
|
||||
|
||||
RandomVariableBase* UniformVariableImpl::Copy () const
|
||||
@@ -573,13 +542,10 @@ ExponentialVariableImpl::ExponentialVariableImpl (const ExponentialVariableImpl&
|
||||
|
||||
double ExponentialVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
while (1)
|
||||
{
|
||||
double r = -m_mean*log (m_generator->RandU01 ());
|
||||
double r = -m_mean*log (generator->RandU01 ());
|
||||
if (m_bound == 0 || r <= m_bound)
|
||||
{
|
||||
return r;
|
||||
@@ -737,13 +703,10 @@ ParetoVariableImpl::ParetoVariableImpl (const ParetoVariableImpl& c)
|
||||
|
||||
double ParetoVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
while (1)
|
||||
{
|
||||
double r = (m_scale * ( 1.0 / pow (m_generator->RandU01 (), 1.0 / m_shape)));
|
||||
double r = (m_scale * ( 1.0 / pow (generator->RandU01 (), 1.0 / m_shape)));
|
||||
if (m_bound == 0 || r <= m_bound)
|
||||
{
|
||||
return r;
|
||||
@@ -871,14 +834,11 @@ WeibullVariableImpl::WeibullVariableImpl (const WeibullVariableImpl& c)
|
||||
|
||||
double WeibullVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
double exponent = 1.0 / m_alpha;
|
||||
while (1)
|
||||
{
|
||||
double r = m_mean * pow ( -log (m_generator->RandU01 ()), exponent);
|
||||
double r = m_mean * pow ( -log (generator->RandU01 ()), exponent);
|
||||
if (m_bound == 0 || r <= m_bound)
|
||||
{
|
||||
return r;
|
||||
@@ -981,10 +941,7 @@ NormalVariableImpl::NormalVariableImpl (const NormalVariableImpl& c)
|
||||
|
||||
double NormalVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
if (m_nextValid)
|
||||
{ // use previously generated
|
||||
m_nextValid = false;
|
||||
@@ -994,8 +951,8 @@ double NormalVariableImpl::GetValue ()
|
||||
{ // See Simulation Modeling and Analysis p. 466 (Averill Law)
|
||||
// for algorithm; basically a Box-Muller transform:
|
||||
// http://en.wikipedia.org/wiki/Box-Muller_transform
|
||||
double u1 = m_generator->RandU01 ();
|
||||
double u2 = m_generator->RandU01 ();
|
||||
double u1 = generator->RandU01 ();
|
||||
double u2 = generator->RandU01 ();
|
||||
double v1 = 2 * u1 - 1;
|
||||
double v2 = 2 * u2 - 1;
|
||||
double w = v1 * v1 + v2 * v2;
|
||||
@@ -1138,10 +1095,7 @@ EmpiricalVariableImpl::~EmpiricalVariableImpl ()
|
||||
double EmpiricalVariableImpl::GetValue ()
|
||||
{ // Return a value from the empirical distribution
|
||||
// This code based (loosely) on code by Bruce Mah (Thanks Bruce!)
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
if (emp.size () == 0)
|
||||
{
|
||||
return 0.0; // HuH? No empirical data
|
||||
@@ -1150,7 +1104,7 @@ double EmpiricalVariableImpl::GetValue ()
|
||||
{
|
||||
Validate (); // Insure in non-decreasing
|
||||
}
|
||||
double r = m_generator->RandU01 ();
|
||||
double r = generator->RandU01 ();
|
||||
if (r <= emp.front ().cdf)
|
||||
{
|
||||
return emp.front ().value; // Less than first
|
||||
@@ -1406,18 +1360,15 @@ LogNormalVariableImpl::LogNormalVariableImpl (double mu, double sigma)
|
||||
double
|
||||
LogNormalVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
double u, v, r2, normal, z;
|
||||
|
||||
do
|
||||
{
|
||||
/* choose x,y in uniform square (-1,-1) to (+1,+1) */
|
||||
|
||||
u = -1 + 2 * m_generator->RandU01 ();
|
||||
v = -1 + 2 * m_generator->RandU01 ();
|
||||
u = -1 + 2 * generator->RandU01 ();
|
||||
v = -1 + 2 * generator->RandU01 ();
|
||||
|
||||
/* see if it is in the unit circle */
|
||||
r2 = u * u + v * v;
|
||||
@@ -1504,14 +1455,11 @@ GammaVariableImpl::GetValue ()
|
||||
double
|
||||
GammaVariableImpl::GetValue (double alpha, double beta)
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
|
||||
if (alpha < 1)
|
||||
{
|
||||
double u = m_generator->RandU01 ();
|
||||
double u = generator->RandU01 ();
|
||||
return GetValue (1.0 + alpha, beta) * pow (u, 1.0 / alpha);
|
||||
}
|
||||
|
||||
@@ -1529,7 +1477,7 @@ GammaVariableImpl::GetValue (double alpha, double beta)
|
||||
while (v <= 0);
|
||||
|
||||
v = v * v * v;
|
||||
u = m_generator->RandU01 ();
|
||||
u = generator->RandU01 ();
|
||||
if (u < 1 - 0.0331 * x * x * x * x)
|
||||
{
|
||||
break;
|
||||
@@ -1627,11 +1575,8 @@ ErlangVariableImpl::GetValue ()
|
||||
double
|
||||
ErlangVariableImpl::GetValue (unsigned int k, double lambda)
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
|
||||
// XXX: Fixme: do not create a new
|
||||
// RNG stream every time the function is called !
|
||||
ExponentialVariable exponential (lambda);
|
||||
|
||||
double result = 0;
|
||||
@@ -1723,11 +1668,8 @@ TriangularVariableImpl::TriangularVariableImpl (const TriangularVariableImpl& c)
|
||||
|
||||
double TriangularVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
double u = m_generator->RandU01 ();
|
||||
RngStream *generator = GetStream ();
|
||||
double u = generator->RandU01 ();
|
||||
if (u <= (m_mode - m_min) / (m_max - m_min) )
|
||||
{
|
||||
return m_min + sqrt (u * (m_max - m_min) * (m_mode - m_min) );
|
||||
@@ -1811,12 +1753,9 @@ ZipfVariableImpl::ZipfVariableImpl (long n, double alpha)
|
||||
double
|
||||
ZipfVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
|
||||
double u = m_generator->RandU01 ();
|
||||
double u = generator->RandU01 ();
|
||||
double sum_prob = 0,zipf_value = 0;
|
||||
for (int i = 1; i <= m_n; i++)
|
||||
{
|
||||
@@ -1895,10 +1834,7 @@ ZetaVariableImpl::ZetaVariableImpl (double alpha)
|
||||
double
|
||||
ZetaVariableImpl::GetValue ()
|
||||
{
|
||||
if (!m_generator)
|
||||
{
|
||||
m_generator = new RngStream ();
|
||||
}
|
||||
RngStream *generator = GetStream ();
|
||||
|
||||
double u, v;
|
||||
double X, T;
|
||||
@@ -1906,8 +1842,8 @@ ZetaVariableImpl::GetValue ()
|
||||
|
||||
do
|
||||
{
|
||||
u = m_generator->RandU01 ();
|
||||
v = m_generator->RandU01 ();
|
||||
u = generator->RandU01 ();
|
||||
v = generator->RandU01 ();
|
||||
X = floor (pow (u, -1.0 / (m_alpha - 1.0)));
|
||||
T = pow (1.0 + 1.0 / X, m_alpha - 1.0);
|
||||
test = v * X * (T - 1.0) / (m_b - 1.0);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <ostream>
|
||||
#include "attribute.h"
|
||||
#include "attribute-helper.h"
|
||||
#include "rng-seed-manager.h"
|
||||
|
||||
/**
|
||||
* \ingroup core
|
||||
@@ -40,69 +41,6 @@ namespace ns3 {
|
||||
|
||||
class RandomVariableBase;
|
||||
|
||||
class SeedManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief set the seed
|
||||
* it will duplicate the seed value 6 times
|
||||
* \code
|
||||
* SeedManger::SetSeed(15);
|
||||
* UniformVariable x(2,3); //these will give the same output everytime
|
||||
* ExponentialVariable y(120); //as long as the seed stays the same
|
||||
* \endcode
|
||||
* \param seed
|
||||
*
|
||||
* Note, while the underlying RNG takes six integer values as a seed;
|
||||
* it is sufficient to set these all to the same integer, so we provide
|
||||
* a simpler interface here that just takes one integer.
|
||||
*/
|
||||
static void SetSeed (uint32_t seed);
|
||||
|
||||
/**
|
||||
* \brief Get the seed value
|
||||
* \return the seed value
|
||||
*
|
||||
* Note: returns the first of the six seed values used in the underlying RNG
|
||||
*/
|
||||
static uint32_t GetSeed ();
|
||||
|
||||
/**
|
||||
* \brief Set the run number of simulation
|
||||
*
|
||||
* \code
|
||||
* SeedManager::SetSeed(12);
|
||||
* int N = atol(argv[1]); //read in run number from command line
|
||||
* SeedManager::SetRun(N);
|
||||
* UniformVariable x(0,10);
|
||||
* ExponentialVariable y(2902);
|
||||
* \endcode
|
||||
* In this example, N could successivly be equal to 1,2,3, etc. and the user
|
||||
* would continue to get independent runs out of the single simulation. For
|
||||
* this simple example, the following might work:
|
||||
* \code
|
||||
* ./simulation 0
|
||||
* ...Results for run 0:...
|
||||
*
|
||||
* ./simulation 1
|
||||
* ...Results for run 1:...
|
||||
* \endcode
|
||||
*/
|
||||
static void SetRun (uint32_t run);
|
||||
/**
|
||||
* \returns the current run number
|
||||
* @sa SetRun
|
||||
*/
|
||||
static uint32_t GetRun (void);
|
||||
|
||||
/**
|
||||
* \brief Check if seed value is valid if wanted to be used as seed
|
||||
* \return true if valid and false if invalid
|
||||
*/
|
||||
static bool CheckSeed (uint32_t seed);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief The basic RNG for NS-3.
|
||||
* \ingroup randomvariable
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "rng-seed-manager.h"
|
||||
#include "global-value.h"
|
||||
#include "attribute-helper.h"
|
||||
#include "integer.h"
|
||||
#include "config.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
static uint64_t g_nextStreamIndex = 0;
|
||||
static ns3::GlobalValue g_rngSeed ("RngSeed",
|
||||
"The global seed of all rng streams",
|
||||
ns3::IntegerValue(1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
static ns3::GlobalValue g_rngRun ("RngRun",
|
||||
"The run number used to modify the global seed",
|
||||
ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<int64_t> ());
|
||||
|
||||
|
||||
uint32_t RngSeedManager::GetSeed (void)
|
||||
{
|
||||
IntegerValue seedValue;
|
||||
g_rngSeed.GetValue (seedValue);
|
||||
return seedValue.Get ();
|
||||
}
|
||||
void
|
||||
RngSeedManager::SetSeed (uint32_t seed)
|
||||
{
|
||||
Config::SetGlobal ("RngSeed", IntegerValue(seed));
|
||||
}
|
||||
|
||||
void RngSeedManager::SetRun (uint64_t run)
|
||||
{
|
||||
Config::SetGlobal ("RngRun", IntegerValue (run));
|
||||
}
|
||||
|
||||
uint64_t RngSeedManager::GetRun ()
|
||||
{
|
||||
IntegerValue value;
|
||||
g_rngRun.GetValue (value);
|
||||
int run = value.Get();
|
||||
return run;
|
||||
}
|
||||
|
||||
uint64_t RngSeedManager::GetNextStreamIndex (void)
|
||||
{
|
||||
uint64_t next = g_nextStreamIndex;
|
||||
g_nextStreamIndex++;
|
||||
return next;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef RNG_SEED_MANAGER_H
|
||||
#define RNG_SEED_MANAGER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class RngSeedManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief set the seed
|
||||
* it will duplicate the seed value 6 times
|
||||
* \code
|
||||
* SeedManger::SetSeed(15);
|
||||
* UniformVariable x(2,3); //these will give the same output everytime
|
||||
* ExponentialVariable y(120); //as long as the seed stays the same
|
||||
* \endcode
|
||||
* \param seed
|
||||
*
|
||||
* Note, while the underlying RNG takes six integer values as a seed;
|
||||
* it is sufficient to set these all to the same integer, so we provide
|
||||
* a simpler interface here that just takes one integer.
|
||||
*/
|
||||
static void SetSeed (uint32_t seed);
|
||||
|
||||
/**
|
||||
* \brief Get the seed value
|
||||
* \return the seed value
|
||||
*
|
||||
* Note: returns the first of the six seed values used in the underlying RNG
|
||||
*/
|
||||
static uint32_t GetSeed (void);
|
||||
|
||||
/**
|
||||
* \brief Set the run number of simulation
|
||||
*
|
||||
* \code
|
||||
* SeedManager::SetSeed(12);
|
||||
* int N = atol(argv[1]); //read in run number from command line
|
||||
* SeedManager::SetRun(N);
|
||||
* UniformVariable x(0,10);
|
||||
* ExponentialVariable y(2902);
|
||||
* \endcode
|
||||
* In this example, N could successivly be equal to 1,2,3, etc. and the user
|
||||
* would continue to get independent runs out of the single simulation. For
|
||||
* this simple example, the following might work:
|
||||
* \code
|
||||
* ./simulation 0
|
||||
* ...Results for run 0:...
|
||||
*
|
||||
* ./simulation 1
|
||||
* ...Results for run 1:...
|
||||
* \endcode
|
||||
*/
|
||||
static void SetRun (uint64_t run);
|
||||
/**
|
||||
* \returns the current run number
|
||||
* @sa SetRun
|
||||
*/
|
||||
static uint64_t GetRun (void);
|
||||
|
||||
static uint64_t GetNextStreamIndex(void);
|
||||
|
||||
};
|
||||
|
||||
// for compatibility
|
||||
typedef RngSeedManager SeedManager;
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
#endif /* RNG_SEED_MANAGER_H */
|
||||
+142
-385
@@ -15,18 +15,20 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// Modified for ns-3 by: Rajib Bhattacharjea<raj.b@gatech.edu>
|
||||
// Modified for ns-3 by:
|
||||
// - Rajib Bhattacharjea<raj.b@gatech.edu>
|
||||
// - Mathieu Lacage <mathieu.lacage@gmail.com>
|
||||
//
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "rng-stream.h"
|
||||
#include "global-value.h"
|
||||
#include "integer.h"
|
||||
using namespace std;
|
||||
#include "fatal-error.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef double Matrix[3][3];
|
||||
|
||||
const double m1 = 4294967087.0;
|
||||
const double m2 = 4294944443.0;
|
||||
const double norm = 1.0 / (m1 + 1.0);
|
||||
@@ -38,58 +40,30 @@ const double two17 = 131072.0;
|
||||
const double two53 = 9007199254740992.0;
|
||||
const double fact = 5.9604644775390625e-8; /* 1 / 2^24 */
|
||||
|
||||
// The following are the transition matrices of the two MRG components
|
||||
// (in matrix form), raised to the powers -1, 1, 2^76, and 2^127, resp.
|
||||
|
||||
const double InvA1[3][3] = { // Inverse of A1p0
|
||||
const Matrix InvA1 = { // Inverse of A1p0
|
||||
{ 184888585.0, 0.0, 1945170933.0 },
|
||||
{ 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0, 0.0 }
|
||||
};
|
||||
|
||||
const double InvA2[3][3] = { // Inverse of A2p0
|
||||
const Matrix InvA2 = { // Inverse of A2p0
|
||||
{ 0.0, 360363334.0, 4225571728.0 },
|
||||
{ 1.0, 0.0, 0.0 },
|
||||
{ 0.0, 1.0, 0.0 }
|
||||
};
|
||||
|
||||
const double A1p0[3][3] = {
|
||||
const Matrix A1p0 = {
|
||||
{ 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 },
|
||||
{ -810728.0, 1403580.0, 0.0 }
|
||||
};
|
||||
|
||||
const double A2p0[3][3] = {
|
||||
const Matrix A2p0 = {
|
||||
{ 0.0, 1.0, 0.0 },
|
||||
{ 0.0, 0.0, 1.0 },
|
||||
{ -1370589.0, 0.0, 527612.0 }
|
||||
};
|
||||
|
||||
const double A1p76[3][3] = {
|
||||
{ 82758667.0, 1871391091.0, 4127413238.0 },
|
||||
{ 3672831523.0, 69195019.0, 1871391091.0 },
|
||||
{ 3672091415.0, 3528743235.0, 69195019.0 }
|
||||
};
|
||||
|
||||
const double A2p76[3][3] = {
|
||||
{ 1511326704.0, 3759209742.0, 1610795712.0 },
|
||||
{ 4292754251.0, 1511326704.0, 3889917532.0 },
|
||||
{ 3859662829.0, 4292754251.0, 3708466080.0 }
|
||||
};
|
||||
|
||||
const double A1p127[3][3] = {
|
||||
{ 2427906178.0, 3580155704.0, 949770784.0 },
|
||||
{ 226153695.0, 1230515664.0, 3580155704.0 },
|
||||
{ 1988835001.0, 986791581.0, 1230515664.0 }
|
||||
};
|
||||
|
||||
const double A2p127[3][3] = {
|
||||
{ 1464411153.0, 277697599.0, 1610723613.0 },
|
||||
{ 32183930.0, 1464411153.0, 1022607788.0 },
|
||||
{ 2824425944.0, 32183930.0, 2093834863.0 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Return (a*s + c) MOD m; a, s, c and m must be < 2^35
|
||||
@@ -101,16 +75,26 @@ double MultModM (double a, double s, double c, double m)
|
||||
|
||||
v = a * s + c;
|
||||
|
||||
if (v >= two53 || v <= -two53) {
|
||||
a1 = static_cast<int32_t> (a / two17); a -= a1 * two17;
|
||||
if (v >= two53 || v <= -two53)
|
||||
{
|
||||
a1 = static_cast<int32_t> (a / two17);
|
||||
a -= a1 * two17;
|
||||
v = a1 * s;
|
||||
a1 = static_cast<int32_t> (v / m); v -= a1 * m;
|
||||
a1 = static_cast<int32_t> (v / m);
|
||||
v -= a1 * m;
|
||||
v = v * two17 + a * s + c;
|
||||
}
|
||||
|
||||
a1 = static_cast<int32_t> (v / m);
|
||||
/* in case v < 0)*/
|
||||
if ((v -= a1 * m) < 0.0) return v += m; else return v;
|
||||
if ((v -= a1 * m) < 0.0)
|
||||
{
|
||||
return v += m;
|
||||
}
|
||||
else
|
||||
{
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,19 +102,22 @@ double MultModM (double a, double s, double c, double m)
|
||||
// Compute the vector v = A*s MOD m. Assume that -m < s[i] < m.
|
||||
// Works also when v = s.
|
||||
//
|
||||
void MatVecModM (const double A[3][3], const double s[3], double v[3],
|
||||
void MatVecModM (const Matrix A, const double s[3], double v[3],
|
||||
double m)
|
||||
{
|
||||
int i;
|
||||
double x[3]; // Necessary if v = s
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
x[i] = MultModM (A[i][0], s[0], 0.0, m);
|
||||
x[i] = MultModM (A[i][1], s[1], x[i], m);
|
||||
x[i] = MultModM (A[i][2], s[2], x[i], m);
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
v[i] = x[i];
|
||||
{
|
||||
v[i] = x[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,41 +125,55 @@ void MatVecModM (const double A[3][3], const double s[3], double v[3],
|
||||
// Compute the matrix C = A*B MOD m. Assume that -m < s[i] < m.
|
||||
// Note: works also if A = C or B = C or A = B = C.
|
||||
//
|
||||
void MatMatModM (const double A[3][3], const double B[3][3],
|
||||
double C[3][3], double m)
|
||||
void MatMatModM (const Matrix A, const Matrix B,
|
||||
Matrix C, double m)
|
||||
{
|
||||
int i, j;
|
||||
double V[3], W[3][3];
|
||||
double V[3];
|
||||
Matrix W;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
V[j] = B[j][i];
|
||||
{
|
||||
V[j] = B[j][i];
|
||||
}
|
||||
MatVecModM (A, V, V, m);
|
||||
for (j = 0; j < 3; ++j)
|
||||
W[j][i] = V[j];
|
||||
{
|
||||
W[j][i] = V[j];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (j = 0; j < 3; ++j)
|
||||
C[i][j] = W[i][j];
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
C[i][j] = W[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Compute the matrix B = (A^(2^e) Mod m); works also if A = B.
|
||||
//
|
||||
void MatTwoPowModM (const double A[3][3], double B[3][3], double m, int32_t e)
|
||||
void MatTwoPowModM (const Matrix src, Matrix dst, double m, int32_t e)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
/* initialize: B = A */
|
||||
if (A != B) {
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (j = 0; j < 3; ++j)
|
||||
B[i][j] = A[i][j];
|
||||
/* initialize: dst = src */
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
dst[i][j] = src[i][j];
|
||||
}
|
||||
}
|
||||
/* Compute B = A^(2^e) mod m */
|
||||
/* Compute dst = src^(2^e) mod m */
|
||||
for (i = 0; i < e; i++)
|
||||
MatMatModM (B, B, B, m);
|
||||
{
|
||||
MatMatModM (dst, dst, dst, m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,30 +187,60 @@ void MatPowModM (const double A[3][3], double B[3][3], double m, int32_t n)
|
||||
|
||||
/* initialize: W = A; B = I */
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (j = 0; j < 3; ++j) {
|
||||
W[i][j] = A[i][j];
|
||||
B[i][j] = 0.0;
|
||||
}
|
||||
{
|
||||
for (j = 0; j < 3; ++j)
|
||||
{
|
||||
W[i][j] = A[i][j];
|
||||
B[i][j] = 0.0;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < 3; ++j)
|
||||
B[j][j] = 1.0;
|
||||
{
|
||||
B[j][j] = 1.0;
|
||||
}
|
||||
|
||||
/* Compute B = A^n mod m using the binary decomposition of n */
|
||||
while (n > 0) {
|
||||
if (n % 2) MatMatModM (W, B, B, m);
|
||||
while (n > 0)
|
||||
{
|
||||
if (n % 2)
|
||||
{
|
||||
MatMatModM (W, B, B, m);
|
||||
}
|
||||
MatMatModM (W, W, W, m);
|
||||
n /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ns3::GlobalValue g_rngSeed ("RngSeed",
|
||||
"The global seed of all rng streams",
|
||||
ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
static ns3::GlobalValue g_rngRun ("RngRun",
|
||||
"The run number used to modify the global seed",
|
||||
ns3::IntegerValue (1),
|
||||
ns3::MakeIntegerChecker<uint32_t> ());
|
||||
// The following are the transition matrices of the two MRG components
|
||||
// (in matrix form), raised to all powers of 2 from 1 to 191
|
||||
struct Precalculated
|
||||
{
|
||||
Matrix a1[190];
|
||||
Matrix a2[190];
|
||||
};
|
||||
struct Precalculated PowerOfTwoConstants (void)
|
||||
{
|
||||
struct Precalculated precalculated;
|
||||
for (int i = 0; i < 190; i++)
|
||||
{
|
||||
int power = i + 1;
|
||||
MatTwoPowModM (A1p0, precalculated.a1[i], m1, power);
|
||||
MatTwoPowModM (A2p0, precalculated.a2[i], m2, power);
|
||||
}
|
||||
return precalculated;
|
||||
}
|
||||
void PowerOfTwoMatrix (int n, Matrix a1p, Matrix a2p)
|
||||
{
|
||||
static struct Precalculated constants = PowerOfTwoConstants ();
|
||||
for (int i = 0; i < 3; i ++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
a1p[i][j] = constants.a1[n-1][i][j];
|
||||
a2p[i][j] = constants.a2[n-1][i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
@@ -218,348 +249,74 @@ namespace ns3 {
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random number.
|
||||
//
|
||||
double RngStream::U01 ()
|
||||
double RngStream::RandU01 ()
|
||||
{
|
||||
int32_t k;
|
||||
double p1, p2, u;
|
||||
|
||||
/* Component 1 */
|
||||
p1 = a12 * Cg[1] - a13n * Cg[0];
|
||||
p1 = a12 * m_currentState[1] - a13n * m_currentState[0];
|
||||
k = static_cast<int32_t> (p1 / m1);
|
||||
p1 -= k * m1;
|
||||
if (p1 < 0.0) p1 += m1;
|
||||
Cg[0] = Cg[1]; Cg[1] = Cg[2]; Cg[2] = p1;
|
||||
if (p1 < 0.0)
|
||||
{
|
||||
p1 += m1;
|
||||
}
|
||||
m_currentState[0] = m_currentState[1]; m_currentState[1] = m_currentState[2]; m_currentState[2] = p1;
|
||||
|
||||
/* Component 2 */
|
||||
p2 = a21 * Cg[5] - a23n * Cg[3];
|
||||
p2 = a21 * m_currentState[5] - a23n * m_currentState[3];
|
||||
k = static_cast<int32_t> (p2 / m2);
|
||||
p2 -= k * m2;
|
||||
if (p2 < 0.0) p2 += m2;
|
||||
Cg[3] = Cg[4]; Cg[4] = Cg[5]; Cg[5] = p2;
|
||||
if (p2 < 0.0)
|
||||
{
|
||||
p2 += m2;
|
||||
}
|
||||
m_currentState[3] = m_currentState[4]; m_currentState[4] = m_currentState[5]; m_currentState[5] = p2;
|
||||
|
||||
/* Combination */
|
||||
u = ((p1 > p2) ? (p1 - p2) * norm : (p1 - p2 + m1) * norm);
|
||||
|
||||
return (anti == false) ? u : (1 - u);
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random number with extended (53 bits) precision.
|
||||
//
|
||||
double RngStream::U01d ()
|
||||
RngStream::RngStream (uint32_t seedNumber, uint64_t stream, uint64_t substream)
|
||||
{
|
||||
double u;
|
||||
u = U01 ();
|
||||
if (anti) {
|
||||
// Don't forget that U01() returns 1 - u in the antithetic case
|
||||
u += (U01 () - 1.0) * fact;
|
||||
return (u < 0.0) ? u + 1.0 : u;
|
||||
} else {
|
||||
u += U01 () * fact;
|
||||
return (u < 1.0) ? u : (u - 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Check that the seeds are legitimate values. Returns true if legal seeds,
|
||||
// false otherwise.
|
||||
//
|
||||
bool RngStream::CheckSeed (const uint32_t seed[6])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
if (seed[i] >= m1) {
|
||||
cerr << "****************************************\n\n"
|
||||
<< "ERROR: Seed[" << i << "] >= 4294967087, Seed is not set."
|
||||
<< "\n\n****************************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
for (i = 3; i < 6; ++i) {
|
||||
if (seed[i] >= m2) {
|
||||
cerr << "Seed[" << i << "] = " << seed[i] << endl;
|
||||
cerr << "*****************************************\n\n"
|
||||
<< "ERROR: Seed[" << i << "] >= 4294944443, Seed is not set."
|
||||
<< "\n\n*****************************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
if (seed[0] == 0 && seed[1] == 0 && seed[2] == 0) {
|
||||
cerr << "****************************\n\n"
|
||||
<< "ERROR: First 3 seeds = 0.\n\n"
|
||||
<< "****************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
if (seed[3] == 0 && seed[4] == 0 && seed[5] == 0) {
|
||||
cerr << "****************************\n\n"
|
||||
<< "ERROR: Last 3 seeds = 0.\n\n"
|
||||
<< "****************************\n\n";
|
||||
return (false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
RngStream::EnsureGlobalInitialized (void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
static uint32_t run = 0;
|
||||
if (!initialized)
|
||||
if (seedNumber >= m1 || seedNumber >= m2 || seedNumber == 0)
|
||||
{
|
||||
initialized = true;
|
||||
uint32_t seed;
|
||||
IntegerValue value;
|
||||
g_rngSeed.GetValue (value);
|
||||
seed = value.Get ();
|
||||
g_rngRun.GetValue (value);
|
||||
run = value.Get ();
|
||||
SetPackageSeed (seed);
|
||||
NS_FATAL_ERROR ("invalid Seed " << seedNumber);
|
||||
}
|
||||
return run;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
// Public members of the class start here
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// The default seed of the package; at run time, this will be overwritten
|
||||
// by the g_rngSeed value the first time RngStream::RngStream is visited;
|
||||
// so the value 12345 is for debugging
|
||||
//
|
||||
double RngStream::nextSeed[6] =
|
||||
{
|
||||
12345.0, 12345.0, 12345.0, 12345.0, 12345.0, 12345.0
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// constructor
|
||||
//
|
||||
RngStream::RngStream ()
|
||||
{
|
||||
uint32_t run = EnsureGlobalInitialized ();
|
||||
|
||||
anti = false;
|
||||
incPrec = false;
|
||||
// Stream initialization moved to separate method.
|
||||
InitializeStream ();
|
||||
//move the state of this stream up
|
||||
ResetNthSubstream (run);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
m_currentState[i] = seedNumber;
|
||||
}
|
||||
AdvanceNthBy (stream, 127, m_currentState);
|
||||
AdvanceNthBy (substream, 76, m_currentState);
|
||||
}
|
||||
|
||||
RngStream::RngStream(const RngStream& r)
|
||||
{
|
||||
anti = r.anti;
|
||||
incPrec = r.incPrec;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
Cg[i] = r.Cg[i];
|
||||
Bg[i] = r.Bg[i];
|
||||
Ig[i] = r.Ig[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RngStream::InitializeStream ()
|
||||
{ // Moved from the RngStream constructor above to allow seeding
|
||||
// AFTER the global package seed has been set in the Random
|
||||
// object constructor.
|
||||
/* Information on a stream. The arrays {Cg, Bg, Ig} contain the current
|
||||
state of the stream, the starting state of the current SubStream, and the
|
||||
starting state of the stream. This stream generates antithetic variates
|
||||
if anti = true. It also generates numbers with extended precision (53
|
||||
bits if machine follows IEEE 754 standard) if incPrec = true. nextSeed
|
||||
will be the seed of the next declared RngStream. */
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
Bg[i] = Cg[i] = Ig[i] = nextSeed[i];
|
||||
}
|
||||
|
||||
MatVecModM (A1p127, nextSeed, nextSeed, m1);
|
||||
MatVecModM (A2p127, &nextSeed[3], &nextSeed[3], m2);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to beginning of Stream.
|
||||
//
|
||||
void RngStream::ResetStartStream ()
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i] = Ig[i];
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to beginning of SubStream.
|
||||
//
|
||||
void RngStream::ResetStartSubstream ()
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i];
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to NextSubStream.
|
||||
//
|
||||
void RngStream::ResetNextSubstream ()
|
||||
{
|
||||
MatVecModM (A1p76, Bg, Bg, m1);
|
||||
MatVecModM (A2p76, &Bg[3], &Bg[3], m2);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Reset Stream to Nth SubStream.
|
||||
//
|
||||
void RngStream::ResetNthSubstream (uint32_t N)
|
||||
{
|
||||
if(N==0) return;
|
||||
for(uint32_t i=0; i<N; ++i) {
|
||||
MatVecModM (A1p76, Bg, Bg, m1);
|
||||
MatVecModM (A2p76, &Bg[3], &Bg[3], m2);
|
||||
}
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
bool RngStream::SetPackageSeed (const uint32_t seed[6])
|
||||
{
|
||||
if (!CheckSeed (seed))
|
||||
{
|
||||
return false;
|
||||
m_currentState[i] = r.m_currentState[i];
|
||||
}
|
||||
for (int i = 0; i < 6; ++i)
|
||||
nextSeed[i] = seed[i];
|
||||
return true;
|
||||
}
|
||||
bool
|
||||
RngStream::SetPackageSeed (uint32_t seed)
|
||||
{
|
||||
uint32_t seeds[6] = { seed, seed, seed, seed, seed, seed};
|
||||
return SetPackageSeed (seeds);
|
||||
}
|
||||
|
||||
void
|
||||
RngStream::GetPackageSeed (uint32_t seed[6])
|
||||
RngStream::AdvanceNthBy (uint64_t nth, int by, double state[6])
|
||||
{
|
||||
IntegerValue value;
|
||||
g_rngSeed.GetValue (value);
|
||||
uint32_t theSeed = value.Get ();
|
||||
for (int i = 0; i < 6; i++)
|
||||
Matrix matrix1,matrix2;
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
seed[i] = static_cast<uint32_t> (theSeed);
|
||||
int nbit = 63 - i;
|
||||
int bit = (nth >> nbit) & 0x1;
|
||||
if (bit)
|
||||
{
|
||||
PowerOfTwoMatrix(by + nbit, matrix1, matrix2);
|
||||
MatVecModM (matrix1, state, state, m1);
|
||||
MatVecModM (matrix2, &state[3], &state[3], m2);
|
||||
}
|
||||
}
|
||||
}
|
||||
void
|
||||
RngStream::SetPackageRun (uint32_t run)
|
||||
{
|
||||
g_rngRun.SetValue (IntegerValue (run));
|
||||
}
|
||||
uint32_t
|
||||
RngStream::GetPackageRun (void)
|
||||
{
|
||||
IntegerValue run;
|
||||
g_rngRun.GetValue (run);
|
||||
return run.Get ();
|
||||
}
|
||||
bool
|
||||
RngStream::CheckSeed (uint32_t seed)
|
||||
{
|
||||
uint32_t seeds[6] = { seed, seed, seed, seed, seed, seed};
|
||||
return CheckSeed (seeds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
bool RngStream::SetSeeds (const uint32_t seed[6])
|
||||
{
|
||||
if (!CheckSeed (seed)) return false;
|
||||
for (int i = 0; i < 6; ++i)
|
||||
Cg[i] = Bg[i] = Ig[i] = seed[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// if e > 0, let n = 2^e + c;
|
||||
// if e < 0, let n = -2^(-e) + c;
|
||||
// if e = 0, let n = c.
|
||||
// Jump n steps forward if n > 0, backwards if n < 0.
|
||||
//
|
||||
void RngStream::AdvanceState (int32_t e, int32_t c)
|
||||
{
|
||||
double B1[3][3], C1[3][3], B2[3][3], C2[3][3];
|
||||
|
||||
if (e > 0) {
|
||||
MatTwoPowModM (A1p0, B1, m1, e);
|
||||
MatTwoPowModM (A2p0, B2, m2, e);
|
||||
} else if (e < 0) {
|
||||
MatTwoPowModM (InvA1, B1, m1, -e);
|
||||
MatTwoPowModM (InvA2, B2, m2, -e);
|
||||
}
|
||||
|
||||
if (c >= 0) {
|
||||
MatPowModM (A1p0, C1, m1, c);
|
||||
MatPowModM (A2p0, C2, m2, c);
|
||||
} else {
|
||||
MatPowModM (InvA1, C1, m1, -c);
|
||||
MatPowModM (InvA2, C2, m2, -c);
|
||||
}
|
||||
|
||||
if (e) {
|
||||
MatMatModM (B1, C1, C1, m1);
|
||||
MatMatModM (B2, C2, C2, m2);
|
||||
}
|
||||
|
||||
MatVecModM (C1, Cg, Cg, m1);
|
||||
MatVecModM (C2, &Cg[3], &Cg[3], m2);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void RngStream::GetState (uint32_t seed[6]) const
|
||||
{
|
||||
for (int i = 0; i < 6; ++i)
|
||||
seed[i] = static_cast<uint32_t> (Cg[i]);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void RngStream::IncreasedPrecis (bool incp)
|
||||
{
|
||||
incPrec = incp;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
void RngStream::SetAntithetic (bool a)
|
||||
{
|
||||
anti = a;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random number.
|
||||
//
|
||||
double RngStream::RandU01 ()
|
||||
{
|
||||
if (incPrec)
|
||||
return U01d ();
|
||||
else
|
||||
return U01 ();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Generate the next random integer.
|
||||
//
|
||||
int32_t RngStream::RandInt (int32_t low, int32_t high)
|
||||
{
|
||||
return low + static_cast<int32_t> ((high - low + 1) * RandU01 ());
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
+14
-31
@@ -36,38 +36,21 @@ namespace ns3 {
|
||||
* class are explained in:
|
||||
* http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf
|
||||
*/
|
||||
class RngStream {
|
||||
public: //public api
|
||||
RngStream ();
|
||||
class RngStream
|
||||
{
|
||||
public:
|
||||
RngStream (uint32_t seed, uint64_t stream, uint64_t substream);
|
||||
RngStream (const RngStream&);
|
||||
void InitializeStream (); // Separate initialization
|
||||
void ResetStartStream ();
|
||||
void ResetStartSubstream ();
|
||||
void ResetNextSubstream ();
|
||||
void ResetNthSubstream (uint32_t N);
|
||||
void SetAntithetic (bool a);
|
||||
void IncreasedPrecis (bool incp);
|
||||
bool SetSeeds (const uint32_t seed[6]);
|
||||
void AdvanceState (int32_t e, int32_t c);
|
||||
void GetState (uint32_t seed[6]) const;
|
||||
double RandU01 ();
|
||||
int32_t RandInt (int32_t i, int32_t j);
|
||||
public: //public static api
|
||||
static bool SetPackageSeed (uint32_t seed);
|
||||
static bool SetPackageSeed (const uint32_t seed[6]);
|
||||
static void GetPackageSeed (uint32_t seed[6]);
|
||||
static void SetPackageRun (uint32_t run);
|
||||
static uint32_t GetPackageRun (void);
|
||||
static bool CheckSeed (const uint32_t seed[6]);
|
||||
static bool CheckSeed (uint32_t seed);
|
||||
private: //members
|
||||
double Cg[6], Bg[6], Ig[6];
|
||||
bool anti, incPrec;
|
||||
double U01 ();
|
||||
double U01d ();
|
||||
static uint32_t EnsureGlobalInitialized (void);
|
||||
private: //static data
|
||||
static double nextSeed[6];
|
||||
/**
|
||||
* Generate the next random number for this stream.
|
||||
* Uniformly distributed between 0 and 1.
|
||||
*/
|
||||
double RandU01 (void);
|
||||
|
||||
private:
|
||||
void AdvanceNthBy (uint64_t nth, int by, double state[6]);
|
||||
|
||||
double m_currentState[6];
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -47,6 +47,68 @@ Vector3D::Vector3D ()
|
||||
{
|
||||
}
|
||||
|
||||
double
|
||||
Vector3D::GetLength () const
|
||||
{
|
||||
return sqrt (x*x + y*y + z*z);
|
||||
}
|
||||
|
||||
Vector3D&
|
||||
Vector3D::operator += (const Vector3D &v)
|
||||
{
|
||||
x += v.x;
|
||||
y += v.y;
|
||||
z += v.z;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3D&
|
||||
Vector3D::operator += (double v)
|
||||
{
|
||||
x += v;
|
||||
y += v;
|
||||
z += v;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3D
|
||||
Vector3D::operator + (const Vector3D &v) const
|
||||
{
|
||||
return Vector3D (x+v.x, y+v.y, z+v.z);
|
||||
}
|
||||
|
||||
Vector3D
|
||||
Vector3D::operator + (double v) const
|
||||
{
|
||||
return Vector3D (x+v, y+v, z+v);
|
||||
}
|
||||
|
||||
Vector3D
|
||||
Vector3D::operator * (const Vector3D &v) const
|
||||
{
|
||||
return Vector3D (x*v.x, y*v.y, z*v.z);
|
||||
}
|
||||
|
||||
Vector3D
|
||||
Vector3D::operator * (double v) const
|
||||
{
|
||||
return Vector3D (x*v, y*v, z*v);
|
||||
}
|
||||
|
||||
Vector3D
|
||||
Vector3D::operator - (const Vector3D &v) const
|
||||
{
|
||||
return Vector3D (x-v.x, y-v.y, z-v.z);
|
||||
}
|
||||
|
||||
Vector3D
|
||||
Vector3D::operator / (double div) const
|
||||
{
|
||||
return Vector3D (x/div, y/div, z/div);
|
||||
}
|
||||
|
||||
Vector2D::Vector2D (double _x, double _y)
|
||||
: x (_x),
|
||||
y (_y)
|
||||
@@ -59,6 +121,66 @@ Vector2D::Vector2D ()
|
||||
{
|
||||
}
|
||||
|
||||
double
|
||||
Vector2D::GetLength () const
|
||||
{
|
||||
return sqrt (x*x + y*y);
|
||||
}
|
||||
|
||||
Vector2D&
|
||||
Vector2D::operator += (const Vector2D &v)
|
||||
{
|
||||
x += v.x;
|
||||
y += v.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector2D&
|
||||
Vector2D::operator += (double v)
|
||||
{
|
||||
x += v;
|
||||
y += v;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector2D
|
||||
Vector2D::operator + (const Vector2D &v) const
|
||||
{
|
||||
return Vector2D (x+v.x, y+v.y);
|
||||
}
|
||||
|
||||
Vector2D
|
||||
Vector2D::operator + (double v) const
|
||||
{
|
||||
return Vector2D (x+v, y+v);
|
||||
}
|
||||
|
||||
Vector2D
|
||||
Vector2D::operator * (const Vector2D &v) const
|
||||
{
|
||||
return Vector2D (x*v.x, y*v.y);
|
||||
}
|
||||
|
||||
Vector2D
|
||||
Vector2D::operator * (double v) const
|
||||
{
|
||||
return Vector2D (x*v, y*v);
|
||||
}
|
||||
|
||||
Vector2D
|
||||
Vector2D::operator - (const Vector2D &v) const
|
||||
{
|
||||
return Vector2D (x-v.x, y-v.y);
|
||||
}
|
||||
|
||||
Vector2D
|
||||
Vector2D::operator / (double div) const
|
||||
{
|
||||
return Vector2D (x/div, y/div);
|
||||
}
|
||||
|
||||
double
|
||||
CalculateDistance (const Vector3D &a, const Vector3D &b)
|
||||
{
|
||||
@@ -77,6 +199,21 @@ CalculateDistance (const Vector2D &a, const Vector2D &b)
|
||||
return distance;
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
ScalarMultiplication (const Vector3D &a, const Vector3D &b)
|
||||
{
|
||||
Vector3D tmp = a * b;
|
||||
return tmp.x + tmp.y + tmp.z;
|
||||
}
|
||||
|
||||
double
|
||||
ScalarMultiplication (const Vector2D &a, const Vector2D &b)
|
||||
{
|
||||
Vector2D tmp = a * b;
|
||||
return tmp.x + tmp.y;
|
||||
}
|
||||
|
||||
std::ostream &operator << (std::ostream &os, const Vector3D &vector)
|
||||
{
|
||||
os << vector.x << ":" << vector.y << ":" << vector.z;
|
||||
|
||||
@@ -55,6 +55,17 @@ public:
|
||||
* z coordinate of vector
|
||||
*/
|
||||
double z;
|
||||
|
||||
double GetLength () const;
|
||||
|
||||
Vector3D& operator += (const Vector3D &);
|
||||
Vector3D& operator += (double);
|
||||
Vector3D operator + (const Vector3D &) const;
|
||||
Vector3D operator + (double) const;
|
||||
Vector3D operator * (const Vector3D &) const;
|
||||
Vector3D operator * (double v) const;
|
||||
Vector3D operator - (const Vector3D &) const;
|
||||
Vector3D operator / (double) const;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -82,6 +93,17 @@ public:
|
||||
* y coordinate of vector
|
||||
*/
|
||||
double y;
|
||||
|
||||
double GetLength () const;
|
||||
|
||||
Vector2D& operator += (const Vector2D &);
|
||||
Vector2D& operator += (double);
|
||||
Vector2D operator + (const Vector2D &) const;
|
||||
Vector2D operator + (double) const;
|
||||
Vector2D operator * (const Vector2D &) const;
|
||||
Vector2D operator * (double v) const;
|
||||
Vector2D operator - (const Vector2D &) const;
|
||||
Vector2D operator / (double) const;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -98,6 +120,19 @@ double CalculateDistance (const Vector3D &a, const Vector3D &b);
|
||||
*/
|
||||
double CalculateDistance (const Vector2D &a, const Vector2D &b);
|
||||
|
||||
/**
|
||||
* \brief Calculate scalar multiplication between two vectors
|
||||
* \param a one point
|
||||
* \param b another point
|
||||
*/
|
||||
double ScalarMultiplication (const Vector3D &a, const Vector3D &b);
|
||||
/**
|
||||
* \brief Calculate scalar multiplication between two vectors
|
||||
* \param a one point
|
||||
* \param b another point
|
||||
*/
|
||||
double ScalarMultiplication (const Vector2D &a, const Vector2D &b);
|
||||
|
||||
/**
|
||||
* \class ns3::Vector3DValue
|
||||
* \brief hold objects of type ns3::Vector3D
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -124,6 +124,8 @@ def build(bld):
|
||||
'model/object.cc',
|
||||
'model/test.cc',
|
||||
'model/random-variable.cc',
|
||||
'model/random-variable-stream.cc',
|
||||
'model/rng-seed-manager.cc',
|
||||
'model/rng-stream.cc',
|
||||
'model/command-line.cc',
|
||||
'model/type-name.cc',
|
||||
@@ -206,6 +208,8 @@ def build(bld):
|
||||
'model/fatal-error.h',
|
||||
'model/test.h',
|
||||
'model/random-variable.h',
|
||||
'model/random-variable-stream.h',
|
||||
'model/rng-seed-manager.h',
|
||||
'model/rng-stream.h',
|
||||
'model/command-line.h',
|
||||
'model/type-name.h',
|
||||
|
||||
+26
-6
@@ -230,11 +230,13 @@ Model Description
|
||||
|
||||
The source code for the new module lives in the directory ``src/%(MODULE)s``.
|
||||
|
||||
Add here a basic description of what is being modeled.
|
||||
|
||||
Design
|
||||
======
|
||||
|
||||
Add here an overall description of the software design and how it fits
|
||||
into the existing ns-3 architecture.
|
||||
Briefly describe the software design of the model and how it fits into
|
||||
the existing ns-3 architecture.
|
||||
|
||||
Scope and Limitations
|
||||
=====================
|
||||
@@ -252,18 +254,31 @@ Usage
|
||||
*****
|
||||
|
||||
This section is principally concerned with the usage of your model, using
|
||||
the public API.
|
||||
the public API. Focus first on most common usage patterns, then go
|
||||
into more advanced topics.
|
||||
|
||||
Building New Module
|
||||
===================
|
||||
|
||||
Include this section if there are special build instructions.
|
||||
Include this subsection only if there are special build instructions or
|
||||
platform limitations.
|
||||
|
||||
Helper
|
||||
======
|
||||
Helpers
|
||||
=======
|
||||
|
||||
What helper API will users typically use? Describe it here.
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
What classes hold attributes, and what are the key ones worth mentioning?
|
||||
|
||||
Output
|
||||
======
|
||||
|
||||
What kind of data does the model generate? What are the key trace
|
||||
sources? What kind of logging output can be enabled?
|
||||
|
||||
Advanced Usage
|
||||
==============
|
||||
|
||||
@@ -275,6 +290,11 @@ Examples
|
||||
|
||||
What examples using this new code are available? Describe them here.
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
Add any tips for avoiding pitfalls, etc.
|
||||
|
||||
Validation
|
||||
**********
|
||||
|
||||
|
||||
@@ -222,6 +222,7 @@ private:
|
||||
* \param stream The output stream object to use when logging ascii traces.
|
||||
* \param prefix Filename prefix to use for ascii trace files.
|
||||
* \param nd Net device for which you want to enable tracing.
|
||||
* \param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
|
||||
@@ -155,7 +155,7 @@ DsdvManetExample::ReceivePacket (Ptr <Socket> socket)
|
||||
{
|
||||
NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << " Received one packet!");
|
||||
Ptr <Packet> packet;
|
||||
while (packet = socket->Recv ())
|
||||
while ((packet = socket->Recv ()))
|
||||
{
|
||||
bytesTotal += packet->GetSize ();
|
||||
packetsReceived += 1;
|
||||
|
||||
+78
-70
@@ -3,8 +3,8 @@
|
||||
DSR Routing
|
||||
-----------
|
||||
|
||||
Dynamic Source Routing (DSR) protocol is a reactive routing protocol designed specifically for use in multi-hop
|
||||
wireless ad hoc networks of mobile nodes.
|
||||
Dynamic Source Routing (DSR) protocol is a reactive routing protocol designed
|
||||
specifically for use in multi-hop wireless ad hoc networks of mobile nodes.
|
||||
|
||||
This model was developed by
|
||||
`the ResiliNets research group <http://www.ittc.ku.edu/resilinets>`_
|
||||
@@ -13,83 +13,87 @@ at the University of Kansas.
|
||||
DSR Routing Overview
|
||||
********************
|
||||
|
||||
This model implements the base specification of the Dynamic Source Routing (DSR)
|
||||
protocol. Implementation is based on RFC4728.
|
||||
This model implements the base specification of the Dynamic Source Routing
|
||||
(DSR) protocol. Implementation is based on RFC4728.
|
||||
|
||||
Class dsr::DsrRouting implements all functionality of service packet exchange and inherits IpL4Protocol.
|
||||
* ``Class dsr::DsrRouting`` implements all functionality of service packet exchange and inherits IpL4Protocol.
|
||||
* ``Class dsr::DsrOptions`` implements functionality of packet processing and talks to DsrRouting to send/receive packets
|
||||
* ``Class dsr::DsrFsHeader`` defines the fixed-size header and identifies the up-layer protocol
|
||||
* ``Class dsr::DsrOptionHeader`` takes care of different dsr options and processes different header according to the specification from the RFC
|
||||
* ``Class dsr::DsrSendBuffer`` is a buffer to save data packets and route error packets when there is no route to forward the packets
|
||||
* ``Class dsr::DsrMaintainBuffer`` is a buffer to save data packets for next-hop notification when the data packet has already been sent out of send buffer
|
||||
* ``Class dsr::RouteCache`` is the essential part to save routes found for data packets. DSR responds to several routes for a single destination
|
||||
* ``Class dsr::RreqTable`` implements the functions to avoid duplicate route requests and control route request rate for a single destination
|
||||
|
||||
Protocol operation depends on many adjustable parameters. We support parameters, with their default values, from RFC and parameters that enable/disable
|
||||
protocol features or tune for specific simulation scenarios, such as the max
|
||||
size of the send buffer and its timeout value. The full parameter list is
|
||||
found in the dsr-routing.cc file.
|
||||
|
||||
Class dsr::DsrOptions implements functionality of packet processing and talk to DsrRouting to send/receive packets
|
||||
DSR discovers routes on-demand. Therefore, our DSR model buffers all packets,
|
||||
while a route request packet (RREQ) is disseminated. We implement a packet
|
||||
buffer in dsr-rsendbuff.cc. The packet queue implements garbage collection
|
||||
of old packets and a queue size limit. When the packet is sent out from the
|
||||
send buffer, it will be queued in maintenance buffer for next hop
|
||||
acknowledgment.
|
||||
|
||||
Class dsr::DsrFsHeader defines the fixed-size header and identify the up-layer protocol
|
||||
The Route Cache implementation support garbage collection of old entries
|
||||
and state machine, as defined in the standard. It implements as a STL
|
||||
map container. The key is the destination IP address.
|
||||
|
||||
Class dsr::DsrOptionHeader takes care of different dsr options and process different header according to specification from rfc
|
||||
Protocol operation strongly depends on broken link detection mechanism.
|
||||
We implement the three heuristics recommended.
|
||||
|
||||
First, we use layer 2 feedback when possible. A link is considered to be
|
||||
broken if frame transmission results in a transmission failure for all
|
||||
retries. This mechanism is meant for active links and works much faster than
|
||||
in its absence. Layer 2 feedback implementation relies on TxErrHeader trace
|
||||
source, currently it is supported in AdhocWifiMac only.
|
||||
|
||||
Class dsr::DsrSendBuffer is a buffer to save data packet as well as route error packet when there is no route to forward the packet
|
||||
Second, passive acknowledgment should be used whenever possible. The node
|
||||
turns on "promiscuous" receive mode, in which it can receive packets not
|
||||
destined for itself, and when the node assures the delivery of that data
|
||||
packet to its destination, it cancels the passive acknowledgment timer.
|
||||
|
||||
Class dsr::DsrMaintainBuffer is a buffer to save data packet for next-hop notification when the data packet has already sent out of send buffer
|
||||
Last, we use a network layer acknowledge scheme to notify the receipt of
|
||||
a packet. Route request packet will not be acknowledged or retransmitted.
|
||||
|
||||
Class dsr::RouteCache is the essential part to save routes found for data packet, dsr responds to several routes for a single destination
|
||||
The following optional protocol optimizations aren't implemented:
|
||||
|
||||
Class dsr::RreqTable implements the functionalities to avoid duplicate route requests and control route request rate for a single destination
|
||||
|
||||
Protocol operation depends on the many adjustable parameters. We support parameters, with their default values, from
|
||||
RFC and parameters that enable/disable protocol features or tune for specific simulation scenarios, such as the max size
|
||||
of send buffer and its timeout value. The full parameter list is in DsrRouting.cc file.
|
||||
|
||||
DSR discovers routes totally on demand. Therefore, our DSR model buffers all packets, while a route request packet (RREQ)
|
||||
is disseminated. We implement a packet buffer in dsr-rsendbuff.cc. The packet queue implements garbage collection of old
|
||||
packets and a queue size limit. When the packet is sent out from the send buffer, it will be queued in maintenance buffer for
|
||||
next hop acknowledgment
|
||||
|
||||
Route Cache implementation support garbage collection of old entries and state machine, defined in standard.
|
||||
It implements as a STL map container. The key is the destination IP address.
|
||||
|
||||
Protocol operation strongly depends on broken link detection mechanism. We implement all the three heuristics.
|
||||
First, we use layer 2 feedback when possible. Link considered to be broken, if frame transmission results in a transmission
|
||||
failure for all retries. This mechanism meant for active links and work much more faster, than first method.
|
||||
Layer 2 feedback implementation relies on TxErrHeader trace source, currently it is supported in AdhocWifiMac only.
|
||||
|
||||
Second, passive acknowledgment should be used whenever possible. The node turns on "promiscuous" receive mode, in which it can receive
|
||||
packet not destined for itself, and when the node assures the delivery of that data packet to its destination, it cancels the passive
|
||||
acknowledgment timer.
|
||||
|
||||
Last, we use network layer acknowledge scheme to notify the receipt of a packet. Route request packet will not
|
||||
be acknowledge or retransmitted.
|
||||
|
||||
Following optional protocol optimizations aren't implemented:
|
||||
- Flow state
|
||||
- First Hop External (F), Last Hop External (L) flags
|
||||
- Handling unknown DSR options
|
||||
- Two types of error headers:
|
||||
* Flow state
|
||||
* First Hop External (F), Last Hop External (L) flags
|
||||
* Handling unknown DSR options
|
||||
* Two types of error headers:
|
||||
1. flow state not supported option
|
||||
2. unsupported option (not going to happen in simulation)
|
||||
|
||||
DSR operates with direct access to IP header, and operates between network and transport layer.
|
||||
DSR operates with direct access to IP header, and operates between
|
||||
network and transport layer.
|
||||
|
||||
Implementation changes
|
||||
- The DsrFsHeader has added 3 fields: message type, source id, destination id, and these changes only for post-processing
|
||||
- message type is used to identify the data packet from control packet
|
||||
- source id is used to identify the real source of the data packet since we have to deliver the packet hop-by-hop and the ipv4header
|
||||
is not carrying the real source and destination ip address as needed
|
||||
- destination id is for same reason of above
|
||||
Implementation changes
|
||||
======================
|
||||
|
||||
Changes:
|
||||
- Route Reply header is not word-aligned in DSR rfc, change it to word-aligned in implementation
|
||||
- DSR works as a shim header between transport and network protocol, it needs its own forwarding mechanism,
|
||||
we are changing the packet transmission to hop-by-hop delivery, so we added two fields in dsr fixed header
|
||||
to notify packet delivery
|
||||
* The DsrFsHeader has added 3 fields: message type, source id, destination id,
|
||||
and these changes only for post-processing
|
||||
** message type is used to identify the data packet from control packet
|
||||
** source id is used to identify the real source of the data packet since we have to deliver the packet hop-by-hop and the ipv4header is not carrying the real source and destination ip address as needed
|
||||
** destination id is for same reason of above
|
||||
* Route Reply header is not word-aligned in DSR rfc, change it to word-aligned in implementation
|
||||
* DSR works as a shim header between transport and network protocol, it needs its own forwarding mechanism, we are changing the packet transmission to hop-by-hop delivery, so we added two fields in dsr fixed header to notify packet delivery
|
||||
1. message type to notify the type of this packet: data packet or control one
|
||||
2. source id to identify the real source address of this packet
|
||||
3. destination id to identify the real destination
|
||||
|
||||
Current Route Cache implementation:
|
||||
- This implementation used "path cache", which is simple to implement and ensures loop-free
|
||||
- the path cache has automatic expire policy
|
||||
- the cache saves multiple route entries for a certain destination and sort the entries based on hop counts
|
||||
- the MaxEntriesEachDst can be tuned to change the maximum entries saved for a single destination
|
||||
- when adding mulitiple routes for one destination, the route is compared based on hop-count and expire time, the one with less hop count
|
||||
or relatively new route is favored
|
||||
- Future implementation may include "link cache" as another possibility
|
||||
Current Route Cache implementation
|
||||
==================================
|
||||
|
||||
This implementation used "path cache", which is simple to implement and ensures loop-free paths:
|
||||
|
||||
* the path cache has automatic expire policy
|
||||
* the cache saves multiple route entries for a certain destination and sort the entries based on hop counts
|
||||
* the MaxEntriesEachDst can be tuned to change the maximum entries saved for a single destination
|
||||
* when adding mulitiple routes for one destination, the route is compared based on hop-count and expire time, the one with less hop count or relatively new route is favored
|
||||
* Future implementation may include "link cache" as another possibility
|
||||
|
||||
DSR Instructions
|
||||
****************
|
||||
@@ -103,14 +107,15 @@ The following should be kept in mind when running DSR as routing protocol:
|
||||
Helper
|
||||
******
|
||||
|
||||
To have a node run DSR, the easiest way would be to use the ClickInternetStackHelper
|
||||
class in your simulation script. For instance::
|
||||
To have a node run DSR, the easiest way would be to use the DsrHelper
|
||||
and DsrMainHelpers in your simulation script. For instance::
|
||||
|
||||
DsrHelper dsr;
|
||||
DsrMainHelper dsrMain;
|
||||
dsrMain.Install (dsr, adhocNodes);
|
||||
|
||||
The example scripts inside ``src/dsr/examples/`` demonstrate the use of DSR based nodes
|
||||
The example scripts inside ``src/dsr/examples/`` demonstrate the use of
|
||||
DSR based nodes
|
||||
in different scenarios. The helper source can be found inside ``src/dsr/helper/dsr-main-helper.{h,cc}``
|
||||
and ``src/dsr/helper/dsr-helper.{h,cc}``
|
||||
|
||||
@@ -120,10 +125,9 @@ Examples
|
||||
The example can be found in ``src/dsr/examples/``:
|
||||
|
||||
* dsr.cc use DSR as routing protocol within a traditional MANETs environment[3].
|
||||
|
||||
DSR is also built in the routing comparison case in ``examples/routing/``:
|
||||
|
||||
* manet-routing-compare.cc is a comparison case with built in MANET routing protocols and can generate its own results.
|
||||
* ``manet-routing-compare.cc`` is a comparison case with built in MANET routing protocols and can generate its own results.
|
||||
|
||||
Validation
|
||||
**********
|
||||
@@ -133,10 +137,14 @@ This model has been tested as follows:
|
||||
* Unit tests have been written to verify the internals of DSR. This can be found in ``src/dsr/test/dsr-test-suite.cc``. These tests verify whether the methods inside DSR module which deal with packet buffer, headers work correctly.
|
||||
* Simulation cases similar to [3] have been tested and have comparable results.
|
||||
* manet-routing-compare.cc has been used to compare DSR with three of other routing protocols.
|
||||
|
||||
A paper was presented on these results at the Workshop on ns-3 in 2011.
|
||||
|
||||
References
|
||||
**********
|
||||
|
||||
[1] Link for the original paper: www.monarch.cs.rice.edu/monarch-papers/dsr-chapter00.pdf
|
||||
[2] Link for RFC 4728: http://www6.ietf.org/rfc/rfc4728.txt
|
||||
[3] Link for the broch's comparison paper: http://www.monarch.cs.rice.edu/monarch-papers/mobicom98.ps
|
||||
[1] Link for the `original paper: <http://www.monarch.cs.rice.edu/monarch-papers/dsr-chapter00.pdf>`_
|
||||
|
||||
[2] Link for `RFC 4728: <http://www6.ietf.org/rfc/rfc4728.txt>`_
|
||||
|
||||
[3] Link for the `Broch's comparison paper: <http://www.monarch.cs.rice.edu/monarch-papers/mobicom98.ps>`_
|
||||
@@ -50,14 +50,15 @@ main (int argc, char *argv[])
|
||||
//
|
||||
#if 0
|
||||
LogComponentEnable ("Ipv4L3Protocol", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("Ipv4L4Protocol", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("UdpL4Protocol", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("UdpSocketImpl", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("NetDevice", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("Ipv4EndPointDemux", LOG_LEVEL_ALL);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
LogComponentEnable ("DsrOptions", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrHelper", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrRouting", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrOptionHeader", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("DsrFsHeader", LOG_LEVEL_ALL);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
def build(bld):
|
||||
obj = bld.create_ns3_program('dsr', ['core', 'simulator', 'node', 'internet-stack'])
|
||||
obj = bld.create_ns3_program('dsr', ['core', 'network', 'internet', 'applications', 'mobility', 'config-store', 'wifi', 'dsr'])
|
||||
obj.source = 'dsr.cc'
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
m_src (s),
|
||||
m_dst (dst),
|
||||
m_ackId (ackId),
|
||||
m_id (0),
|
||||
m_segsLeft (segs),
|
||||
m_expire (exp + Simulator::Now ())
|
||||
{
|
||||
@@ -158,6 +159,14 @@ public:
|
||||
{
|
||||
m_ackId = ackId;
|
||||
}
|
||||
uint16_t GetId () const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
void SetId (uint16_t id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
uint8_t GetSegsLeft () const
|
||||
{
|
||||
return m_segsLeft;
|
||||
|
||||
@@ -138,6 +138,7 @@ private:
|
||||
* \param stream The output stream object to use when logging ascii traces.
|
||||
* \param prefix Filename prefix to use for ascii trace files.
|
||||
* \param nd Net device for which you want to enable tracing.
|
||||
* \param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
private:
|
||||
/**
|
||||
* \param device Pointer to the NetDevice to install DeviceEnergyModel.
|
||||
* \param source Pointer to EnergySource to install.
|
||||
*
|
||||
* Implements DeviceEnergyModel::Install.
|
||||
*/
|
||||
|
||||
@@ -229,7 +229,7 @@ private:
|
||||
virtual double DoGetCurrentA (void) const;
|
||||
|
||||
/**
|
||||
* \param currentState New state the radio device is currently in.
|
||||
* \param state New state the radio device is currently in.
|
||||
*
|
||||
* Sets current state. This function is private so that only the energy model
|
||||
* can change its own state.
|
||||
|
||||
@@ -76,7 +76,7 @@ private:
|
||||
/**
|
||||
* \param loads Load profile.
|
||||
* \param timeStamps Time stamps.
|
||||
* \param expLifeTime Expected lifetime.
|
||||
* \param expLifetime Expected lifetime.
|
||||
* \returns False if no error occurs.
|
||||
*
|
||||
* Runs simulation with variable load and checks the battery lifetime with
|
||||
|
||||
@@ -97,7 +97,7 @@ Histogram::Histogram (double binWidth)
|
||||
|
||||
Histogram::Histogram ()
|
||||
{
|
||||
Histogram (DEFAULT_BIN_WIDTH);
|
||||
m_binWidth = DEFAULT_BIN_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -200,6 +200,8 @@ def register_types(module):
|
||||
module.add_class('PcapHelperForIpv6', allow_subclassing=True)
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory [class]
|
||||
module.add_class('RttHistory')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex [class]
|
||||
module.add_class('SPFVertex')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::VertexType [enumeration]
|
||||
@@ -370,6 +372,10 @@ def register_types(module):
|
||||
module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
|
||||
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator [class]
|
||||
module.add_class('RttEstimator', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation [class]
|
||||
module.add_class('RttMeanDeviation', parent=root_module['ns3::RttEstimator'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
|
||||
@@ -607,6 +613,9 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >', 'ns3::RttHistory_t')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >*', 'ns3::RttHistory_t*')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >&', 'ns3::RttHistory_t&')
|
||||
|
||||
## Register a nested module for the namespace FatalImpl
|
||||
|
||||
@@ -689,6 +698,7 @@ def register_methods(root_module):
|
||||
register_Ns3PcapHelperForIpv4_methods(root_module, root_module['ns3::PcapHelperForIpv4'])
|
||||
register_Ns3PcapHelperForIpv6_methods(root_module, root_module['ns3::PcapHelperForIpv6'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RttHistory_methods(root_module, root_module['ns3::RttHistory'])
|
||||
register_Ns3SPFVertex_methods(root_module, root_module['ns3::SPFVertex'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
|
||||
@@ -759,6 +769,8 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
|
||||
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
|
||||
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
|
||||
register_Ns3RttEstimator_methods(root_module, root_module['ns3::RttEstimator'])
|
||||
register_Ns3RttMeanDeviation_methods(root_module, root_module['ns3::RttMeanDeviation'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
@@ -1348,6 +1360,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1360,6 +1376,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -3981,6 +4001,21 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RttHistory_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::SequenceNumber32 s, uint32_t c, ns3::Time t) [constructor]
|
||||
cls.add_constructor([param('ns3::SequenceNumber32', 's'), param('uint32_t', 'c'), param('ns3::Time', 't')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::RttHistory const & h) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttHistory const &', 'h')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::count [variable]
|
||||
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::retx [variable]
|
||||
cls.add_instance_attribute('retx', 'bool', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::seq [variable]
|
||||
cls.add_instance_attribute('seq', 'ns3::SequenceNumber32', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::time [variable]
|
||||
cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SPFVertex_methods(root_module, cls):
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::SPFVertex() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -4677,7 +4712,6 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4730,6 +4764,7 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -7187,6 +7222,126 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3RttEstimator_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator(ns3::RttEstimator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttEstimator const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::AckSeq(ns3::SequenceNumber32 ackSeq) [member function]
|
||||
cls.add_method('AckSeq',
|
||||
'ns3::Time',
|
||||
[param('ns3::SequenceNumber32', 'ackSeq')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ClearSent() [member function]
|
||||
cls.add_method('ClearSent',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttEstimator::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
|
||||
cls.add_method('GetCurrentEstimate',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMaxRto() const [member function]
|
||||
cls.add_method('GetMaxRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMinRto() const [member function]
|
||||
cls.add_method('GetMinRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::IncreaseMultiplier() [member function]
|
||||
cls.add_method('IncreaseMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Measurement(ns3::Time t) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 't')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ResetMultiplier() [member function]
|
||||
cls.add_method('ResetMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
|
||||
cls.add_method('SentSeq',
|
||||
'void',
|
||||
[param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
|
||||
cls.add_method('SetCurrentEstimate',
|
||||
'void',
|
||||
[param('ns3::Time', 'estimate')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMaxRto(ns3::Time maxRto) [member function]
|
||||
cls.add_method('SetMaxRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'maxRto')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMinRto(ns3::Time minRto) [member function]
|
||||
cls.add_method('SetMinRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'minRto')])
|
||||
return
|
||||
|
||||
def register_Ns3RttMeanDeviation_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation(ns3::RttMeanDeviation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttMeanDeviation const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttMeanDeviation::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Gain(double g) [member function]
|
||||
cls.add_method('Gain',
|
||||
'void',
|
||||
[param('double', 'g')])
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttMeanDeviation::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Measurement(ns3::Time measure) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 'measure')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttMeanDeviation::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -8007,11 +8162,11 @@ def register_Ns3TcpSocketFactory_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
|
||||
@@ -200,6 +200,8 @@ def register_types(module):
|
||||
module.add_class('PcapHelperForIpv6', allow_subclassing=True)
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory [class]
|
||||
module.add_class('RttHistory')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex [class]
|
||||
module.add_class('SPFVertex')
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::VertexType [enumeration]
|
||||
@@ -370,6 +372,10 @@ def register_types(module):
|
||||
module.add_class('ParetoVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
|
||||
module.add_class('PcapFileWrapper', import_from_module='ns.network', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator [class]
|
||||
module.add_class('RttEstimator', parent=root_module['ns3::Object'])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation [class]
|
||||
module.add_class('RttMeanDeviation', parent=root_module['ns3::RttEstimator'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
|
||||
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
|
||||
@@ -607,6 +613,9 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >', 'ns3::SequenceNumber32')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >*', 'ns3::SequenceNumber32*')
|
||||
typehandlers.add_type_alias('ns3::SequenceNumber< unsigned int, int >&', 'ns3::SequenceNumber32&')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >', 'ns3::RttHistory_t')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >*', 'ns3::RttHistory_t*')
|
||||
typehandlers.add_type_alias('std::deque< ns3::RttHistory, std::allocator< ns3::RttHistory > >&', 'ns3::RttHistory_t&')
|
||||
|
||||
## Register a nested module for the namespace FatalImpl
|
||||
|
||||
@@ -689,6 +698,7 @@ def register_methods(root_module):
|
||||
register_Ns3PcapHelperForIpv4_methods(root_module, root_module['ns3::PcapHelperForIpv4'])
|
||||
register_Ns3PcapHelperForIpv6_methods(root_module, root_module['ns3::PcapHelperForIpv6'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3RttHistory_methods(root_module, root_module['ns3::RttHistory'])
|
||||
register_Ns3SPFVertex_methods(root_module, root_module['ns3::SPFVertex'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
|
||||
@@ -759,6 +769,8 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
|
||||
register_Ns3ParetoVariable_methods(root_module, root_module['ns3::ParetoVariable'])
|
||||
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
|
||||
register_Ns3RttEstimator_methods(root_module, root_module['ns3::RttEstimator'])
|
||||
register_Ns3RttMeanDeviation_methods(root_module, root_module['ns3::RttMeanDeviation'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
|
||||
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
|
||||
@@ -1348,6 +1360,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1360,6 +1376,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -3981,6 +4001,21 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3RttHistory_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::SequenceNumber32 s, uint32_t c, ns3::Time t) [constructor]
|
||||
cls.add_constructor([param('ns3::SequenceNumber32', 's'), param('uint32_t', 'c'), param('ns3::Time', 't')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::RttHistory(ns3::RttHistory const & h) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttHistory const &', 'h')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::count [variable]
|
||||
cls.add_instance_attribute('count', 'uint32_t', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::retx [variable]
|
||||
cls.add_instance_attribute('retx', 'bool', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::seq [variable]
|
||||
cls.add_instance_attribute('seq', 'ns3::SequenceNumber32', is_const=False)
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttHistory::time [variable]
|
||||
cls.add_instance_attribute('time', 'ns3::Time', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SPFVertex_methods(root_module, cls):
|
||||
## global-route-manager-impl.h (module 'internet'): ns3::SPFVertex::SPFVertex() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -4677,7 +4712,6 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4730,6 +4764,7 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -7187,6 +7222,126 @@ def register_Ns3PcapFileWrapper_methods(root_module, cls):
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3RttEstimator_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttEstimator::RttEstimator(ns3::RttEstimator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttEstimator const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::AckSeq(ns3::SequenceNumber32 ackSeq) [member function]
|
||||
cls.add_method('AckSeq',
|
||||
'ns3::Time',
|
||||
[param('ns3::SequenceNumber32', 'ackSeq')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ClearSent() [member function]
|
||||
cls.add_method('ClearSent',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttEstimator::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetCurrentEstimate() const [member function]
|
||||
cls.add_method('GetCurrentEstimate',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMaxRto() const [member function]
|
||||
cls.add_method('GetMaxRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::GetMinRto() const [member function]
|
||||
cls.add_method('GetMinRto',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttEstimator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::IncreaseMultiplier() [member function]
|
||||
cls.add_method('IncreaseMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Measurement(ns3::Time t) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 't')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::ResetMultiplier() [member function]
|
||||
cls.add_method('ResetMultiplier',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttEstimator::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SentSeq(ns3::SequenceNumber32 seq, uint32_t size) [member function]
|
||||
cls.add_method('SentSeq',
|
||||
'void',
|
||||
[param('ns3::SequenceNumber32', 'seq'), param('uint32_t', 'size')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetCurrentEstimate(ns3::Time estimate) [member function]
|
||||
cls.add_method('SetCurrentEstimate',
|
||||
'void',
|
||||
[param('ns3::Time', 'estimate')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMaxRto(ns3::Time maxRto) [member function]
|
||||
cls.add_method('SetMaxRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'maxRto')])
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttEstimator::SetMinRto(ns3::Time minRto) [member function]
|
||||
cls.add_method('SetMinRto',
|
||||
'void',
|
||||
[param('ns3::Time', 'minRto')])
|
||||
return
|
||||
|
||||
def register_Ns3RttMeanDeviation_methods(root_module, cls):
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rtt-estimator.h (module 'internet'): ns3::RttMeanDeviation::RttMeanDeviation(ns3::RttMeanDeviation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RttMeanDeviation const &', 'arg0')])
|
||||
## rtt-estimator.h (module 'internet'): ns3::Ptr<ns3::RttEstimator> ns3::RttMeanDeviation::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::RttEstimator >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Gain(double g) [member function]
|
||||
cls.add_method('Gain',
|
||||
'void',
|
||||
[param('double', 'g')])
|
||||
## rtt-estimator.h (module 'internet'): static ns3::TypeId ns3::RttMeanDeviation::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Measurement(ns3::Time measure) [member function]
|
||||
cls.add_method('Measurement',
|
||||
'void',
|
||||
[param('ns3::Time', 'measure')],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): void ns3::RttMeanDeviation::Reset() [member function]
|
||||
cls.add_method('Reset',
|
||||
'void',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## rtt-estimator.h (module 'internet'): ns3::Time ns3::RttMeanDeviation::RetransmitTimeout() [member function]
|
||||
cls.add_method('RetransmitTimeout',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls):
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
|
||||
cls.add_constructor([])
|
||||
@@ -8007,11 +8162,11 @@ def register_Ns3TcpSocketFactory_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
|
||||
@@ -186,6 +186,7 @@ private:
|
||||
* @param prefix Filename prefix to use for pcap files.
|
||||
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnablePcapIpv4Internal (std::string prefix,
|
||||
Ptr<Ipv4> ipv4,
|
||||
@@ -201,6 +202,7 @@ private:
|
||||
* @param prefix Filename prefix to use for ascii trace files.
|
||||
* @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv4 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiIpv4Internal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
@@ -215,6 +217,7 @@ private:
|
||||
* @param prefix Filename prefix to use for pcap files.
|
||||
* @param ipv6 Ptr to the Ipv6 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv6 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnablePcapIpv6Internal (std::string prefix,
|
||||
Ptr<Ipv6> ipv6,
|
||||
@@ -230,6 +233,7 @@ private:
|
||||
* @param prefix Filename prefix to use for ascii trace files.
|
||||
* @param ipv6 Ptr to the Ipv6 interface on which you want to enable tracing.
|
||||
* @param interface Interface ID on the Ipv6 on which you want to enable tracing.
|
||||
* @param explicitFilename Treat the prefix as an explicit filename if true
|
||||
*/
|
||||
virtual void EnableAsciiIpv6Internal (Ptr<OutputStreamWrapper> stream,
|
||||
std::string prefix,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/output-stream-wrapper.h"
|
||||
#include "ns3/ipv4-list-routing.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -60,7 +61,7 @@ public:
|
||||
* \returns a newly-created routing protocol
|
||||
*/
|
||||
virtual Ptr<Ipv4RoutingProtocol> Create (Ptr<Node> node) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief prints the routing tables of all nodes at a particular time.
|
||||
* \param printTime the time at which the routing table is supposed to be printed.
|
||||
@@ -107,11 +108,47 @@ public:
|
||||
*/
|
||||
void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
|
||||
|
||||
/**
|
||||
* @brief Request a specified routing protocol <T> from Ipv4RoutingProtocol protocol
|
||||
*
|
||||
* If protocol is Ipv4ListRouting, then protocol will be searched in the list,
|
||||
* otherwise a simple DynamicCast will be performed
|
||||
*
|
||||
* @param protocol Smart pointer to Ipv4RoutingProtocol object
|
||||
*/
|
||||
template<class T>
|
||||
static Ptr<T> GetRouting (Ptr<Ipv4RoutingProtocol> protocol);
|
||||
|
||||
private:
|
||||
void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
|
||||
void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
|
||||
};
|
||||
|
||||
// This function does a recursive search for a requested routing protocol.
|
||||
// Strictly speaking this recursion is not necessary, but why not?
|
||||
template<class T>
|
||||
Ptr<T> Ipv4RoutingHelper::GetRouting (Ptr<Ipv4RoutingProtocol> protocol)
|
||||
{
|
||||
Ptr<T> ret = DynamicCast<T> (protocol);
|
||||
if (ret == 0)
|
||||
{
|
||||
// trying to check if protocol is a list routing
|
||||
Ptr<Ipv4ListRouting> lrp = DynamicCast<Ipv4ListRouting> (protocol);
|
||||
if (lrp != 0)
|
||||
{
|
||||
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
|
||||
{
|
||||
int16_t priority;
|
||||
ret = GetRouting<T> (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/output-stream-wrapper.h"
|
||||
#include "ns3/ipv6-list-routing.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -110,11 +111,47 @@ public:
|
||||
*/
|
||||
void PrintRoutingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
|
||||
|
||||
/**
|
||||
* @brief Request a specified routing protocol <T> from Ipv4RoutingProtocol protocol
|
||||
*
|
||||
* If protocol is Ipv4ListRouting, then protocol will be searched in the list,
|
||||
* otherwise a simple DynamicCast will be performed
|
||||
*
|
||||
* @param protocol Smart pointer to Ipv4RoutingProtocol object
|
||||
*/
|
||||
template<class T>
|
||||
static Ptr<T> GetRouting (Ptr<Ipv6RoutingProtocol> protocol);
|
||||
|
||||
private:
|
||||
void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
|
||||
void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
|
||||
};
|
||||
|
||||
// This function does a recursive search for a requested routing protocol.
|
||||
// Strictly speaking this recursion is not necessary, but why not?
|
||||
template<class T>
|
||||
Ptr<T> Ipv6RoutingHelper::GetRouting (Ptr<Ipv6RoutingProtocol> protocol)
|
||||
{
|
||||
Ptr<T> ret = DynamicCast<T> (protocol);
|
||||
if (ret == 0)
|
||||
{
|
||||
// trying to check if protocol is a list routing
|
||||
Ptr<Ipv6ListRouting> lrp = DynamicCast<Ipv6ListRouting> (protocol);
|
||||
if (lrp != 0)
|
||||
{
|
||||
for (uint32_t i = 0; i < lrp->GetNRoutingProtocols (); i++)
|
||||
{
|
||||
int16_t priority;
|
||||
ret = GetRouting<T> (lrp->GetRoutingProtocol (i, priority)); // potential recursion, if inside ListRouting is ListRouting
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
|
||||
@@ -336,8 +336,6 @@ public:
|
||||
* @see GlobalRouter
|
||||
* @see GlobalRoutingLSA
|
||||
* @see GlobalRoutingLinkRecord
|
||||
* @param nextHop The IP address to use when forwarding packets to the host
|
||||
* or network represented by "this" SPFVertex.
|
||||
* @param exit The pair of next-hop-IP and outgoing-interface-index to use when
|
||||
* forwarding packets to the host or network represented by "this" SPFVertex.
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ Icmpv4L4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
this->SetNode (node);
|
||||
ipv4->Insert (this);
|
||||
|
||||
@@ -112,7 +112,7 @@ void Icmpv6L4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv6L3Protocol> ipv6 = this->GetObject<Ipv6L3Protocol> ();
|
||||
if (ipv6 != 0)
|
||||
if (ipv6 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
SetNode (node);
|
||||
ipv6->Insert (this);
|
||||
|
||||
@@ -1285,7 +1285,7 @@ Ipv4L3Protocol::Fragments::AddFragment (Ptr<Packet> fragment, uint16_t fragmentO
|
||||
m_moreFragment = moreFragment;
|
||||
}
|
||||
|
||||
m_fragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset));
|
||||
m_fragments.insert (it, std::make_pair (fragment, fragmentOffset));
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -334,7 +334,7 @@ uint8_t Ipv6ExtensionFragment::Process (Ptr<Packet>& packet, uint8_t offset, Ipv
|
||||
uint32_t identification = fragmentHeader.GetIdentification ();
|
||||
Ipv6Address src = ipv6Header.GetSourceAddress ();
|
||||
|
||||
std::pair<Ipv6Address, uint32_t> fragmentsId = std::make_pair<Ipv6Address, uint32_t> (src, identification);
|
||||
std::pair<Ipv6Address, uint32_t> fragmentsId = std::make_pair (src, identification);
|
||||
Ptr<Fragments> fragments;
|
||||
|
||||
Ipv6Header ipHeader = ipv6Header;
|
||||
@@ -599,7 +599,7 @@ void Ipv6ExtensionFragment::Fragments::AddFragment (Ptr<Packet> fragment, uint16
|
||||
m_moreFragment = moreFragment;
|
||||
}
|
||||
|
||||
m_packetFragments.insert (it, std::make_pair<Ptr<Packet>, uint16_t> (fragment, fragmentOffset));
|
||||
m_packetFragments.insert (it, std::make_pair (fragment, fragmentOffset));
|
||||
}
|
||||
|
||||
void Ipv6ExtensionFragment::Fragments::SetUnfragmentablePart (Ptr<Packet> unfragmentablePart)
|
||||
|
||||
@@ -196,7 +196,7 @@ NscTcpL4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
this->SetNode (node);
|
||||
ipv4->Insert (this);
|
||||
|
||||
@@ -61,6 +61,12 @@ RttEstimator::GetTypeId (void)
|
||||
MakeTimeAccessor (&RttEstimator::SetMinRto,
|
||||
&RttEstimator::GetMinRto),
|
||||
MakeTimeChecker ())
|
||||
.AddAttribute ("MaxRTO",
|
||||
"Maximum retransmit timeout value",
|
||||
TimeValue (Seconds (200.0)),
|
||||
MakeTimeAccessor (&RttEstimator::SetMaxRto,
|
||||
&RttEstimator::GetMaxRto),
|
||||
MakeTimeChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -76,6 +82,19 @@ RttEstimator::GetMinRto (void) const
|
||||
{
|
||||
return m_minRto;
|
||||
}
|
||||
|
||||
void
|
||||
RttEstimator::SetMaxRto (Time maxRto)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << maxRto);
|
||||
m_maxRto = maxRto;
|
||||
}
|
||||
Time
|
||||
RttEstimator::GetMaxRto (void) const
|
||||
{
|
||||
return m_maxRto;
|
||||
}
|
||||
|
||||
void
|
||||
RttEstimator::SetCurrentEstimate (Time estimate)
|
||||
{
|
||||
@@ -123,7 +142,7 @@ RttEstimator::RttEstimator (const RttEstimator& c)
|
||||
: Object (c), m_next (c.m_next), m_history (c.m_history),
|
||||
m_maxMultiplier (c.m_maxMultiplier),
|
||||
m_initialEstimatedRtt (c.m_initialEstimatedRtt),
|
||||
m_currentEstimatedRtt (c.m_currentEstimatedRtt), m_minRto (c.m_minRto),
|
||||
m_currentEstimatedRtt (c.m_currentEstimatedRtt), m_minRto (c.m_minRto), m_maxRto (c.m_maxRto),
|
||||
m_nSamples (c.m_nSamples), m_multiplier (c.m_multiplier)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
@@ -234,10 +253,15 @@ RttMeanDeviation::GetTypeId (void)
|
||||
.SetParent<RttEstimator> ()
|
||||
.AddConstructor<RttMeanDeviation> ()
|
||||
.AddAttribute ("Gain",
|
||||
"Gain used in estimating the RTT, must be 0 < Gain < 1",
|
||||
DoubleValue (0.1),
|
||||
"Gain used in estimating the RTT (smoothed RTT), must be 0 < Gain < 1",
|
||||
DoubleValue (0.125),
|
||||
MakeDoubleAccessor (&RttMeanDeviation::m_gain),
|
||||
MakeDoubleChecker<double> ())
|
||||
.AddAttribute ("Gain2",
|
||||
"Gain2 used in estimating the RTT (variance), must be 0 < Gain2 < 1",
|
||||
DoubleValue (0.25),
|
||||
MakeDoubleAccessor (&RttMeanDeviation::m_gain2),
|
||||
MakeDoubleChecker<double> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -249,7 +273,7 @@ RttMeanDeviation::RttMeanDeviation() :
|
||||
}
|
||||
|
||||
RttMeanDeviation::RttMeanDeviation (const RttMeanDeviation& c)
|
||||
: RttEstimator (c), m_gain (c.m_gain), m_variance (c.m_variance)
|
||||
: RttEstimator (c), m_gain (c.m_gain), m_gain2 (c.m_gain2), m_variance (c.m_variance)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
@@ -263,14 +287,15 @@ void RttMeanDeviation::Measurement (Time m)
|
||||
double gErr = err.ToDouble (Time::S) * m_gain;
|
||||
m_currentEstimatedRtt += Time::FromDouble (gErr, Time::S);
|
||||
Time difference = Abs (err) - m_variance;
|
||||
NS_LOG_DEBUG ("m_variance += " << Time::FromDouble (difference.ToDouble (Time::S) * m_gain, Time::S));
|
||||
m_variance += Time::FromDouble (difference.ToDouble (Time::S) * m_gain, Time::S);
|
||||
NS_LOG_DEBUG ("m_variance += " << Time::FromDouble (difference.ToDouble (Time::S) * m_gain2, Time::S));
|
||||
m_variance += Time::FromDouble (difference.ToDouble (Time::S) * m_gain2, Time::S);
|
||||
}
|
||||
else
|
||||
{ // First sample
|
||||
m_currentEstimatedRtt = m; // Set estimate to current
|
||||
//variance = sample / 2; // And variance to current / 2
|
||||
m_variance = m; // try this
|
||||
// m_variance = m; // try this why????
|
||||
m_variance = Seconds (m.ToDouble (Time::S) / 2);
|
||||
NS_LOG_DEBUG ("(first sample) m_variance += " << m);
|
||||
}
|
||||
m_nSamples++;
|
||||
@@ -279,17 +304,29 @@ void RttMeanDeviation::Measurement (Time m)
|
||||
Time RttMeanDeviation::RetransmitTimeout ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_LOG_DEBUG ("RetransmitTimeout: var " << m_variance.GetSeconds () << " est " << m_currentEstimatedRtt.GetSeconds () << " multiplier " << m_multiplier);
|
||||
// RTO = srtt + 4* rttvar
|
||||
int64_t temp = m_currentEstimatedRtt.ToInteger (Time::MS) + 4 * m_variance.ToInteger (Time::MS);
|
||||
if (temp < m_minRto.ToInteger (Time::MS))
|
||||
{
|
||||
temp = m_minRto.ToInteger (Time::MS);
|
||||
}
|
||||
temp = temp * m_multiplier; // Apply backoff
|
||||
Time retval = Time::FromInteger (temp, Time::MS);
|
||||
NS_LOG_DEBUG ("RetransmitTimeout: return " << retval.GetSeconds ());
|
||||
return (retval);
|
||||
// If not enough samples, just return 2 times estimate
|
||||
//if (nSamples < 2) return est * 2;
|
||||
|
||||
double retval = std::min (m_maxRto.ToDouble (Time::S),
|
||||
std::max (m_multiplier*m_minRto.ToDouble (Time::S),
|
||||
m_multiplier*(m_currentEstimatedRtt.ToDouble (Time::S) + 4 * m_variance.ToDouble (Time::S))));
|
||||
|
||||
// NS_LOG_DEBUG ("RetransmitTimeout: var " << var << " est " << m_currentEstimatedRtt.ToDouble (Time::S) << " multiplier " << m_multiplier);
|
||||
// if (var < (m_currentEstimatedRtt.ToDouble (Time::S) / 4.0) )
|
||||
// {
|
||||
// for (uint16_t i = 0; i < 2* m_multiplier; i++)
|
||||
// {
|
||||
// retval += m_currentEstimatedRtt;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// int64_t temp = m_currentEstimatedRtt.ToInteger (Time::S) + 4 * m_variance.ToInteger (Time::S);
|
||||
// retval = Time::FromInteger (temp, Time::S);
|
||||
// }
|
||||
NS_LOG_DEBUG ("RetransmitTimeout: return " << retval);
|
||||
|
||||
return Seconds (retval);
|
||||
}
|
||||
|
||||
Ptr<RttEstimator> RttMeanDeviation::Copy () const
|
||||
|
||||
@@ -124,6 +124,18 @@ public:
|
||||
*/
|
||||
Time GetMinRto (void) const;
|
||||
|
||||
/**
|
||||
* \brief Sets the Maximum RTO.
|
||||
* \param minRto The maximum RTO returned by the estimator.
|
||||
*/
|
||||
void SetMaxRto (Time maxRto);
|
||||
|
||||
/**
|
||||
* \brief Get the Maximum RTO.
|
||||
* \return The maximum RTO returned by the estimator.
|
||||
*/
|
||||
Time GetMaxRto (void) const;
|
||||
|
||||
/**
|
||||
* \brief Sets the current RTT estimate (forcefully).
|
||||
* \param estimate The current RTT estimate.
|
||||
@@ -145,6 +157,7 @@ private:
|
||||
protected:
|
||||
Time m_currentEstimatedRtt; // Current estimate
|
||||
Time m_minRto; // minimum value of the timeout
|
||||
Time m_maxRto; // maximum value of the timeout
|
||||
uint32_t m_nSamples; // Number of samples
|
||||
uint16_t m_multiplier; // RTO Multiplier
|
||||
};
|
||||
@@ -194,6 +207,7 @@ public:
|
||||
|
||||
private:
|
||||
double m_gain; // Filter gain
|
||||
double m_gain2; // Filter gain
|
||||
Time m_variance; // Current variance
|
||||
};
|
||||
} // namespace ns3
|
||||
|
||||
@@ -132,12 +132,12 @@ TcpL4Protocol::NotifyNewAggregate ()
|
||||
// need to keep track of whether we are connected to an IPv4 or
|
||||
// IPv6 lower layer and call the appropriate one.
|
||||
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
ipv4->Insert(this);
|
||||
this->SetDownTarget(MakeCallback(&Ipv4::Send, ipv4));
|
||||
}
|
||||
if (ipv6 != 0)
|
||||
if (ipv6 != 0 && m_downTarget6.IsNull ())
|
||||
{
|
||||
ipv6->Insert(this);
|
||||
this->SetDownTarget6(MakeCallback(&Ipv6L3Protocol::Send, ipv6));
|
||||
|
||||
@@ -88,6 +88,7 @@ UdpL4Protocol::SetNode (Ptr<Node> node)
|
||||
void
|
||||
UdpL4Protocol::NotifyNewAggregate ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<Node> node = this->GetObject<Node> ();
|
||||
Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
|
||||
Ptr<Ipv6L3Protocol> ipv6 = node->GetObject<Ipv6L3Protocol> ();
|
||||
@@ -108,12 +109,12 @@ UdpL4Protocol::NotifyNewAggregate ()
|
||||
// need to keep track of whether we are connected to an IPv4 or
|
||||
// IPv6 lower layer and call the appropriate one.
|
||||
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull())
|
||||
{
|
||||
ipv4->Insert (this);
|
||||
this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4));
|
||||
}
|
||||
if (ipv6 != 0)
|
||||
if (ipv6 != 0 && m_downTarget6.IsNull())
|
||||
{
|
||||
ipv6->Insert (this);
|
||||
this->SetDownTarget6 (MakeCallback (&Ipv6L3Protocol::Send, ipv6));
|
||||
@@ -499,6 +500,7 @@ UdpL4Protocol::Send (Ptr<Packet> packet,
|
||||
void
|
||||
UdpL4Protocol::SetDownTarget (IpL4Protocol::DownTargetCallback callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downTarget = callback;
|
||||
}
|
||||
|
||||
@@ -511,6 +513,7 @@ UdpL4Protocol::GetDownTarget (void) const
|
||||
void
|
||||
UdpL4Protocol::SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downTarget6 = callback;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,6 +280,7 @@ def build(bld):
|
||||
'helper/ipv6-interface-container.h',
|
||||
'helper/ipv6-routing-helper.h',
|
||||
'model/ipv6-address-generator.h',
|
||||
'model/rtt-estimator.h',
|
||||
]
|
||||
|
||||
if bld.env['NSC_ENABLED']:
|
||||
|
||||
@@ -276,8 +276,8 @@ def register_types(module):
|
||||
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## random-variable.h (module 'core'): ns3::SeedManager [class]
|
||||
module.add_class('SeedManager', import_from_module='ns.core')
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class]
|
||||
module.add_class('RngSeedManager', import_from_module='ns.core')
|
||||
## lte-rlc-sequence-number.h (module 'lte'): ns3::SequenceNumber10 [class]
|
||||
module.add_class('SequenceNumber10')
|
||||
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
|
||||
@@ -737,6 +737,10 @@ def register_types(module):
|
||||
module.add_container('std::map< unsigned short, ns3::Ptr< ns3::UeInfo > >', ('short unsigned int', 'ns3::Ptr< ns3::UeInfo >'), container_type='map')
|
||||
module.add_container('std::list< ns3::Ptr< ns3::IdealControlMessage > >', 'ns3::Ptr< ns3::IdealControlMessage >', container_type='list')
|
||||
module.add_container('std::list< ns3::UlDciIdealControlMessage >', 'ns3::UlDciIdealControlMessage', container_type='list')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&')
|
||||
module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >', 'ns3::Uint64Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >*', 'ns3::Uint64Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >&', 'ns3::Uint64Map&')
|
||||
@@ -758,6 +762,9 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >', 'ns3::Bands')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >*', 'ns3::Bands*')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >&', 'ns3::Bands&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
|
||||
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
|
||||
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
|
||||
@@ -769,15 +776,12 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('uint32_t', 'ns3::SpectrumModelUid_t')
|
||||
typehandlers.add_type_alias('uint32_t*', 'ns3::SpectrumModelUid_t*')
|
||||
typehandlers.add_type_alias('uint32_t&', 'ns3::SpectrumModelUid_t&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >', 'ns3::Uint32Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >*', 'ns3::Uint32Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >&', 'ns3::Uint32Map&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >', 'ns3::DoubleMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >*', 'ns3::DoubleMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >&', 'ns3::DoubleMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >', 'ns3::Uint32Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >*', 'ns3::Uint32Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >&', 'ns3::Uint32Map&')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
|
||||
@@ -934,7 +938,7 @@ def register_methods(root_module):
|
||||
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
|
||||
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager'])
|
||||
register_Ns3SequenceNumber10_methods(root_module, root_module['ns3::SequenceNumber10'])
|
||||
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
|
||||
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
|
||||
@@ -1397,6 +1401,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1409,6 +1417,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -4145,32 +4157,32 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3SeedManager_methods(root_module, cls):
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
|
||||
def register_Ns3RngSeedManager_methods(root_module, cls):
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
|
||||
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
|
||||
cls.add_method('CheckSeed',
|
||||
'bool',
|
||||
[param('uint32_t', 'seed')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint32_t',
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')])
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function]
|
||||
cls.add_method('GetNextStreamIndex',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function]
|
||||
cls.add_method('GetSeed',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function]
|
||||
cls.add_method('SetRun',
|
||||
'void',
|
||||
[param('uint32_t', 'run')],
|
||||
[param('uint64_t', 'run')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function]
|
||||
cls.add_method('SetSeed',
|
||||
'void',
|
||||
[param('uint32_t', 'seed')],
|
||||
@@ -4769,12 +4781,25 @@ def register_Ns3UniformVariable_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector2D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector2D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector2D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector2D::y [variable]
|
||||
@@ -4783,12 +4808,25 @@ def register_Ns3Vector2D_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector3D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector3D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector3D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector3D::y [variable]
|
||||
@@ -4837,7 +4875,6 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4890,6 +4927,7 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6907,11 +6945,11 @@ def register_Ns3SpectrumValue_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -7066,10 +7104,11 @@ def register_Ns3TraceFadingLossModel_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::TraceFadingLossModel const &', 'arg0')])
|
||||
## trace-fading-loss-model.h (module 'lte'): ns3::TraceFadingLossModel::TraceFadingLossModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::CreateFadingChannelRealization(ns3::Ptr<const ns3::MobilityModel> enbMobility, ns3::Ptr<const ns3::MobilityModel> ueMobility) [member function]
|
||||
cls.add_method('CreateFadingChannelRealization',
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::DoStart() [member function]
|
||||
cls.add_method('DoStart',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'enbMobility'), param('ns3::Ptr< ns3::MobilityModel const >', 'ueMobility')])
|
||||
[],
|
||||
is_virtual=True)
|
||||
## trace-fading-loss-model.h (module 'lte'): static ns3::TypeId ns3::TraceFadingLossModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
|
||||
@@ -276,8 +276,8 @@ def register_types(module):
|
||||
module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
|
||||
## random-variable.h (module 'core'): ns3::RandomVariable [class]
|
||||
module.add_class('RandomVariable', import_from_module='ns.core')
|
||||
## random-variable.h (module 'core'): ns3::SeedManager [class]
|
||||
module.add_class('SeedManager', import_from_module='ns.core')
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class]
|
||||
module.add_class('RngSeedManager', import_from_module='ns.core')
|
||||
## lte-rlc-sequence-number.h (module 'lte'): ns3::SequenceNumber10 [class]
|
||||
module.add_class('SequenceNumber10')
|
||||
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
|
||||
@@ -737,9 +737,13 @@ def register_types(module):
|
||||
module.add_container('std::map< unsigned short, ns3::Ptr< ns3::UeInfo > >', ('short unsigned int', 'ns3::Ptr< ns3::UeInfo >'), container_type='map')
|
||||
module.add_container('std::list< ns3::Ptr< ns3::IdealControlMessage > >', 'ns3::Ptr< ns3::IdealControlMessage >', container_type='list')
|
||||
module.add_container('std::list< ns3::UlDciIdealControlMessage >', 'ns3::UlDciIdealControlMessage', container_type='list')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long > > >', 'ns3::Uint64Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long > > >*', 'ns3::Uint64Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long > > >&', 'ns3::Uint64Map&')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&')
|
||||
module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >', 'ns3::Uint64Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >*', 'ns3::Uint64Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned long long, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned long long > > >&', 'ns3::Uint64Map&')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyTxEndCallback')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyTxEndCallback*')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyTxEndCallback&')
|
||||
@@ -758,6 +762,9 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >', 'ns3::Bands')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >*', 'ns3::Bands*')
|
||||
typehandlers.add_type_alias('std::vector< ns3::BandInfo, std::allocator< ns3::BandInfo > >&', 'ns3::Bands&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
|
||||
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
|
||||
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
|
||||
@@ -769,15 +776,12 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('uint32_t', 'ns3::SpectrumModelUid_t')
|
||||
typehandlers.add_type_alias('uint32_t*', 'ns3::SpectrumModelUid_t*')
|
||||
typehandlers.add_type_alias('uint32_t&', 'ns3::SpectrumModelUid_t&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >', 'ns3::Uint32Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >*', 'ns3::Uint32Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >&', 'ns3::Uint32Map&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >', 'ns3::DoubleMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >*', 'ns3::DoubleMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, double, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, double > > >&', 'ns3::DoubleMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >', 'ns3::expectedTbs_t')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >*', 'ns3::expectedTbs_t*')
|
||||
typehandlers.add_type_alias('std::map< ns3::TbId_t, ns3::tbInfo_t, std::less< ns3::TbId_t >, std::allocator< std::pair< ns3::TbId_t const, ns3::tbInfo_t > > >&', 'ns3::expectedTbs_t&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >', 'ns3::Uint32Map')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >*', 'ns3::Uint32Map*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, unsigned int, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, unsigned int > > >&', 'ns3::Uint32Map&')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
|
||||
@@ -791,9 +795,9 @@ def register_types(module):
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'ns3::GenericPhyRxEndOkCallback')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', 'ns3::GenericPhyRxEndOkCallback*')
|
||||
typehandlers.add_type_alias('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', 'ns3::GenericPhyRxEndOkCallback&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > > > > >', 'ns3::Uint64StatsMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > > > > >*', 'ns3::Uint64StatsMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long > > > > >&', 'ns3::Uint64StatsMap&')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > > > > >', 'ns3::Uint64StatsMap')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > > > > >*', 'ns3::Uint64StatsMap*')
|
||||
typehandlers.add_type_alias('std::map< ns3::ImsiLcidPair_t, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > >, std::less< ns3::ImsiLcidPair_t >, std::allocator< std::pair< ns3::ImsiLcidPair_t const, ns3::Ptr< ns3::MinMaxAvgTotalCalculator< unsigned long long > > > > >&', 'ns3::Uint64StatsMap&')
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
@@ -934,7 +938,7 @@ def register_methods(root_module):
|
||||
register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList'])
|
||||
register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager'])
|
||||
register_Ns3SequenceNumber10_methods(root_module, root_module['ns3::SequenceNumber10'])
|
||||
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
|
||||
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
|
||||
@@ -1397,6 +1401,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Next',
|
||||
'void',
|
||||
[param('uint32_t', 'delta')])
|
||||
## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function]
|
||||
cls.add_method('PeekU8',
|
||||
'uint8_t',
|
||||
[])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function]
|
||||
cls.add_method('Prev',
|
||||
'void',
|
||||
@@ -1409,6 +1417,10 @@ def register_Ns3BufferIterator_methods(root_module, cls):
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('uint8_t *', 'buffer'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function]
|
||||
cls.add_method('Read',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')])
|
||||
## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function]
|
||||
cls.add_method('ReadLsbtohU16',
|
||||
'uint16_t',
|
||||
@@ -4145,32 +4157,32 @@ def register_Ns3RandomVariable_methods(root_module, cls):
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3SeedManager_methods(root_module, cls):
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
|
||||
def register_Ns3RngSeedManager_methods(root_module, cls):
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
|
||||
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
|
||||
cls.add_method('CheckSeed',
|
||||
'bool',
|
||||
[param('uint32_t', 'seed')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint32_t',
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')])
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function]
|
||||
cls.add_method('GetNextStreamIndex',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function]
|
||||
cls.add_method('GetSeed',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function]
|
||||
cls.add_method('SetRun',
|
||||
'void',
|
||||
[param('uint32_t', 'run')],
|
||||
[param('uint64_t', 'run')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function]
|
||||
cls.add_method('SetSeed',
|
||||
'void',
|
||||
[param('uint32_t', 'seed')],
|
||||
@@ -4769,12 +4781,25 @@ def register_Ns3UniformVariable_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector2D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector2D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector2D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector2D::y [variable]
|
||||
@@ -4783,12 +4808,25 @@ def register_Ns3Vector2D_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector3D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector3D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector3D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector3D::y [variable]
|
||||
@@ -4837,7 +4875,6 @@ def register_Ns3Empty_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('long unsigned int const', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('unsigned int const', 'right'))
|
||||
@@ -4890,6 +4927,7 @@ def register_Ns3Int64x64_t_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
@@ -6907,11 +6945,11 @@ def register_Ns3SpectrumValue_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Time_methods(root_module, cls):
|
||||
cls.add_binary_comparison_operator('!=')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', 'right'))
|
||||
cls.add_binary_comparison_operator('<')
|
||||
cls.add_binary_comparison_operator('>')
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', 'right'))
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_comparison_operator('<=')
|
||||
@@ -7066,10 +7104,11 @@ def register_Ns3TraceFadingLossModel_methods(root_module, cls):
|
||||
cls.add_constructor([param('ns3::TraceFadingLossModel const &', 'arg0')])
|
||||
## trace-fading-loss-model.h (module 'lte'): ns3::TraceFadingLossModel::TraceFadingLossModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::CreateFadingChannelRealization(ns3::Ptr<const ns3::MobilityModel> enbMobility, ns3::Ptr<const ns3::MobilityModel> ueMobility) [member function]
|
||||
cls.add_method('CreateFadingChannelRealization',
|
||||
## trace-fading-loss-model.h (module 'lte'): void ns3::TraceFadingLossModel::DoStart() [member function]
|
||||
cls.add_method('DoStart',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'enbMobility'), param('ns3::Ptr< ns3::MobilityModel const >', 'ueMobility')])
|
||||
[],
|
||||
is_virtual=True)
|
||||
## trace-fading-loss-model.h (module 'lte'): static ns3::TypeId ns3::TraceFadingLossModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
|
||||
@@ -596,15 +596,15 @@ usable by user :math:`i` on resource block :math:`k` according to what reported
|
||||
model (see `Adaptive Modulation and Coding`_); finally, let :math:`S(M, B)` be the TB
|
||||
size in bits as defined in [TS36213]_ for the case where a number :math:`B` of
|
||||
resource blocks is used. The achievable rate :math:`R_{i}(k,t)` in bit/s for user :math:`i`
|
||||
on resource block :math:`k` at subframe :math:`t` is defined as
|
||||
on resource block group :math:`k` at subframe :math:`t` is defined as
|
||||
|
||||
.. math::
|
||||
|
||||
R_{i}(k,t) = \frac{S\left( M_{i,k}(t), 1\right)}{\tau}
|
||||
|
||||
where :math:`\tau` is the TTI duration.
|
||||
At the start of each subframe :math:`t`, each RB is assigned to a certain user.
|
||||
In detail, the index :math:`\widehat{i}_{k}(t)` to which RB :math:`k` is assigned at time
|
||||
At the start of each subframe :math:`t`, each RBG is assigned to a certain user.
|
||||
In detail, the index :math:`\widehat{i}_{k}(t)` to which RBG :math:`k` is assigned at time
|
||||
:math:`t` is determined as
|
||||
|
||||
.. math::
|
||||
@@ -637,7 +637,7 @@ determine the MCS :math:`\widehat{M}_j(t)` actually used by user
|
||||
|
||||
\widehat{M}_j(t) = \min_{k: \widehat{i}_{k}(t) = j}{M_{j,k}(t)}
|
||||
|
||||
then we determine the total number :math:`\widehat{B}_j(t)` of RBs allocated to user
|
||||
then we determine the total number :math:`\widehat{B}_j(t)` of RBGs allocated to user
|
||||
:math:`j`:
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
.. [R1-081483] 3GPP R1-081483 `Conveying MCS and TB size via PDCCH <http://www.3gpp.org/ftp/tsg_ran/WG1_RL1/TSGR1_52b/Docs/R1-081483.zip>`_
|
||||
|
||||
.. [R4-092042] 3GPP R4-092042 "Simulation assumptions and parameters for FDD HeNB RF requirements"
|
||||
|
||||
.. [TR36814] 3GPP TR 36.814 "E-UTRA Further advancements for E-UTRA physical layer aspects"
|
||||
|
||||
.. [FFAPI] `FemtoForum LTE MAC Scheduler Interface Specification v1.11 <http://www.femtoforum.org/femto/technical.php>`_
|
||||
|
||||
.. [ns3tutorial] `The ns-3 Tutorial <http://www.nsnam.org/docs/tutorial/singlehtml/index.html>`_
|
||||
|
||||
@@ -368,7 +368,7 @@ Physical Error Model
|
||||
--------------------
|
||||
|
||||
|
||||
The test suite ``lte-phy-error-model`` generates nine test cases with single eNB and a various number of UEs, all having the same Radio Bearer specification. Each test is designed for evaluating the error rate perceived by a specific TB size in order to verify that it corresponds to the expected values according to the BLER generated for CB size analog to the TB size. This means that, for instance, the test will check that the performance of a TB of :math:`N` bits is analogous to the one of a a CB size of :math:`N` bits by collecting the performance of a user which has been forced the generation of a such TB size according to the distance to eNB. In order to significantly test the BER at MAC level, we modified the Adaptive Modulation and Coding (AMC) module, the ``LteAmc`` class, for making it less robust to channel conditions by adding a configurable BER parameter (called ``Ber`` in the ns3 attribute system) which enable the selection of the desired BER at MAC level when choosing the MCS to be used. In detail, the AMC module has been forced to select the AMC considering a BER of 0.01 (instead of the standard value equal to 0.00005). We note that, these values do not reflect actual BER since they come from an analytical bound which do not consider all the transmission chain aspects; therefore the resulted BER might be different.
|
||||
The test suite ``lte-test-phy-error-model`` generates nine test cases with single eNB and a various number of UEs, all having the same Radio Bearer specification. Each test is designed for evaluating the error rate perceived by a specific TB size in order to verify that it corresponds to the expected values according to the BLER generated for CB size analog to the TB size. This means that, for instance, the test will check that the performance of a TB of :math:`N` bits is analogous to the one of a a CB size of :math:`N` bits by collecting the performance of a user which has been forced the generation of a such TB size according to the distance to eNB. In order to significantly test the BER at MAC level, we modified the Adaptive Modulation and Coding (AMC) module, the ``LteAmc`` class, for making it less robust to channel conditions by adding a configurable BER parameter (called ``Ber`` in the ns3 attribute system) which enable the selection of the desired BER at MAC level when choosing the MCS to be used. In detail, the AMC module has been forced to select the AMC considering a BER of 0.01 (instead of the standard value equal to 0.00005). We note that, these values do not reflect actual BER since they come from an analytical bound which do not consider all the transmission chain aspects; therefore the resulted BER might be different.
|
||||
|
||||
The parameters of the nine test cases are reported in the following:
|
||||
|
||||
@@ -403,7 +403,7 @@ The parameters of the nine test cases are reported in the following:
|
||||
BLER for test 6.
|
||||
|
||||
|
||||
The test verifies that in each case the expected number of packets received correct corresponds to a Bernoulli distribution with a confidence interval of 95%, where the probability of success in each trail is :math:`1-BER` and :math:`n` is the total number of packet sent.
|
||||
The test verifies that in each case the obtained number of packets received correctly falls within the 99.9% confidence interval (CI) of a Binomial distribution where the parameter :math:`p` is equal to :math:`1-BER`, the parameter :math:`n` is the total number of packets sent and the parameter :math:`k` is the number of packets correctly received. The value of the CI has been chosen for guaranteeing a sufficient margin on the errors due to the quantization of the MI values in the tables.
|
||||
|
||||
|
||||
MIMO Model
|
||||
|
||||
@@ -727,13 +727,26 @@ That's all! You can now start your simulation as usual::
|
||||
Simulator::Run ();
|
||||
|
||||
|
||||
Further Reading
|
||||
---------------
|
||||
|
||||
|
||||
|
||||
Examples Programs
|
||||
-----------------
|
||||
|
||||
The directory ``src/lte/examples/`` contains some example simulation programs that
|
||||
show how to simulate different LTE scenarios.
|
||||
|
||||
|
||||
Reference scenarios
|
||||
-------------------
|
||||
|
||||
There is a vast amount of reference LTE simulation scenarios which can be found in the literature. Here we list some of them:
|
||||
|
||||
* The dual stripe model [R4-092042]_, which is partially implemented in the example program ``src/lte/examples/lena-dual-stripe.cc``
|
||||
|
||||
* The system simulation scenarios mentioned in section A.2 of [TR36814]_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ main (int argc, char *argv[])
|
||||
bool epcUl = true;
|
||||
bool useUdp = true;
|
||||
bool generateRem = false;
|
||||
std::string fadingFileTrace = "";
|
||||
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("nBlocks", "Number of femtocell blocks", nBlocks);
|
||||
@@ -287,6 +288,7 @@ main (int argc, char *argv[])
|
||||
cmd.AddValue ("useUdp", "if true, the UdpClient application will be used. "
|
||||
"Otherwise, the BulkSend application will be used over a TCP connection. "
|
||||
"If EPC is not used, this parameter will be ignored.", useUdp);
|
||||
cmd.AddValue ("fadingTrace", "The path of the fading trace (by default any fading trace is loadedm which implies that fading is not considered)", fadingFileTrace);
|
||||
|
||||
|
||||
cmd.Parse (argc, argv);
|
||||
@@ -356,6 +358,12 @@ main (int argc, char *argv[])
|
||||
// use always LOS model
|
||||
lteHelper->SetPathlossModelAttribute ("Los2NlosThr", DoubleValue (1e6));
|
||||
lteHelper->SetSpectrumChannelType ("ns3::MultiModelSpectrumChannel");
|
||||
|
||||
if (!fadingFileTrace.empty ())
|
||||
{
|
||||
lteHelper->SetAttribute ("FadingModel", StringValue ("ns3::TraceFadingLossModel"));
|
||||
lteHelper->SetFadingModelAttribute("TraceFilename", StringValue (fadingFileTrace));
|
||||
}
|
||||
|
||||
Ptr<EpcHelper> epcHelper;
|
||||
if (epc)
|
||||
@@ -417,13 +425,18 @@ main (int argc, char *argv[])
|
||||
NetDeviceContainer homeUeDevs = lteHelper->InstallUeDevice (homeUes);
|
||||
|
||||
NetDeviceContainer::Iterator ueDevIt;
|
||||
NetDeviceContainer::Iterator enbDevIt;
|
||||
NetDeviceContainer::Iterator enbDevIt = homeEnbDevs.Begin ();
|
||||
// attach explicitly each home UE to its home eNB
|
||||
for (ueDevIt = homeUeDevs.Begin (),
|
||||
enbDevIt = homeEnbDevs.Begin ();
|
||||
ueDevIt != homeUeDevs.End () && enbDevIt != homeEnbDevs.End ();
|
||||
for (ueDevIt = homeUeDevs.Begin ();
|
||||
ueDevIt != homeUeDevs.End ();
|
||||
++ueDevIt, ++enbDevIt)
|
||||
{
|
||||
// this because of the order in which SameRoomPositionAllocator
|
||||
// will place the UEs
|
||||
if (enbDevIt == homeEnbDevs.End ())
|
||||
{
|
||||
enbDevIt = homeEnbDevs.Begin ();
|
||||
}
|
||||
lteHelper->Attach (*ueDevIt, *enbDevIt);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ main (int argc, char *argv[])
|
||||
uint16_t numberOfNodes = 2;
|
||||
double simTime = 5.0;
|
||||
double distance = 60.0;
|
||||
// Inter packet interval in ms
|
||||
// double interPacketInterval = 1;
|
||||
double interPacketInterval = 100;
|
||||
|
||||
// Command line arguments
|
||||
CommandLine cmd;
|
||||
cmd.AddValue("numberOfNodes", "Number of eNodeBs + UE pairs", numberOfNodes);
|
||||
cmd.AddValue("simTime", "Total duration of the simulation (in seconds)",simTime);
|
||||
cmd.AddValue("simTime", "Total duration of the simulation [s])", simTime);
|
||||
cmd.AddValue("distance", "Distance between eNBs [m]", distance);
|
||||
cmd.AddValue("interPacketInterval", "Inter packet interval [ms])", interPacketInterval);
|
||||
cmd.Parse(argc, argv);
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
|
||||
@@ -101,10 +101,11 @@ LteHelper::DoStart (void)
|
||||
NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
|
||||
m_uplinkChannel->AddPropagationLossModel (ulPlm);
|
||||
}
|
||||
|
||||
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
if (!m_fadingModelType.empty ())
|
||||
{
|
||||
m_fadingModule = m_fadingModelFactory.Create<TraceFadingLossModel> ();
|
||||
Ptr<SpectrumPropagationLossModel> m_fadingModule;
|
||||
m_fadingModule = m_fadingModelFactory.Create<SpectrumPropagationLossModel> ();
|
||||
m_fadingModule->Start ();
|
||||
m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
}
|
||||
@@ -482,18 +483,7 @@ LteHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
|
||||
Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
|
||||
enbPhy->AddUePhy (rnti, uePhy);
|
||||
|
||||
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
{
|
||||
Ptr<MobilityModel> mm_enb_dl = enbPhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_ul = uePhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_enb_ul = enbPhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_dl = uePhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_enb_dl, mm_ue_dl); //downlink eNB -> UE
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_ue_ul, mm_enb_ul); //uplink UE -> eNB
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// WILD HACK - should be done through PHY SAP, probably passing by RRC
|
||||
uePhy->SetRnti (rnti);
|
||||
uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <ns3/mac-stats-calculator.h>
|
||||
#include <ns3/radio-bearer-stats-calculator.h>
|
||||
#include <ns3/epc-tft.h>
|
||||
#include <ns3/trace-fading-loss-model.h>
|
||||
#include <ns3/mobility-model.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -340,8 +340,6 @@ private:
|
||||
std::string m_fadingModelType;
|
||||
ObjectFactory m_fadingModelFactory;
|
||||
|
||||
Ptr<TraceFadingLossModel> m_fadingModule;
|
||||
|
||||
Ptr<MacStatsCalculator> m_macStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_rlcStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_pdcpStats;
|
||||
|
||||
@@ -579,8 +579,10 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
|
||||
// new RNTI
|
||||
UlInfoListElement_s ulinfonew;
|
||||
ulinfonew.m_rnti = tag.GetRnti ();
|
||||
std::vector <uint16_t>::iterator it = ulinfonew.m_ulReception.begin ();
|
||||
ulinfonew.m_ulReception.insert (it + (tag.GetLcid () - 1), p->GetSize ());
|
||||
// always allocate full size of ulReception vector, initializing all elements to 0
|
||||
ulinfonew.m_ulReception.assign (MAX_LC_LIST+1, 0);
|
||||
// set the element for the current LCID
|
||||
ulinfonew.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
|
||||
ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok;
|
||||
ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage
|
||||
m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (), ulinfonew));
|
||||
@@ -588,15 +590,11 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*it).second.m_ulReception.size () < tag.GetLcid ())
|
||||
{
|
||||
std::vector <uint16_t>::iterator itV = (*it).second.m_ulReception.begin ();
|
||||
(*it).second.m_ulReception.insert (itV + (tag.GetLcid () - 1), p->GetSize ());
|
||||
}
|
||||
else
|
||||
{
|
||||
(*it).second.m_ulReception.at (tag.GetLcid () - 1) += p->GetSize ();
|
||||
}
|
||||
// existing RNTI: we just set the value for the current
|
||||
// LCID. Note that the corresponding element had already been
|
||||
// allocated previously.
|
||||
NS_ASSERT_MSG ((*it).second.m_ulReception.at (tag.GetLcid ()) == 0, "would overwrite previously written ulReception element");
|
||||
(*it).second.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
|
||||
(*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +447,7 @@ LteEnbPhy::StartSubFrame (void)
|
||||
{
|
||||
std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
|
||||
Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
|
||||
QueueUlDci (*dci);
|
||||
// QueueUlDci (*dci);
|
||||
it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
|
||||
|
||||
if (it2 == m_ueAttached.end ())
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <tr1/functional>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/pointer.h>
|
||||
|
||||
@@ -231,7 +231,7 @@ operator << (std::ostream& os, const std::vector<int>& v)
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateTxPowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double powerTx, std::vector <int> activeRbs)
|
||||
{
|
||||
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << activeRbs);
|
||||
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << &activeRbs);
|
||||
|
||||
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
|
||||
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (model);
|
||||
|
||||
@@ -292,16 +292,22 @@ LteUeMac::SendReportBufferStatus (void)
|
||||
MacCeListElement_s bsr;
|
||||
bsr.m_rnti = m_rnti;
|
||||
bsr.m_macCeType = MacCeListElement_s::BSR;
|
||||
// BSR
|
||||
std::map <uint8_t, uint64_t>::iterator it;
|
||||
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
|
||||
|
||||
|
||||
// BSR is reported for each LCG. As a simplification, we consider that all LCs belong to the first LCG.
|
||||
std::map <uint8_t, uint64_t>::iterator it;
|
||||
int queue = 0;
|
||||
for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
|
||||
{
|
||||
int queue = (*it).second;
|
||||
int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (index);
|
||||
queue += (*it).second;
|
||||
|
||||
}
|
||||
int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (index);
|
||||
// FF API says that all 4 LCGs are always present
|
||||
// we do so but reporting a 0 size for all other LCGs
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
|
||||
|
||||
// create the feedback to eNB
|
||||
Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
|
||||
|
||||
@@ -507,7 +507,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
|
||||
// no info on this subband -> worst MCS
|
||||
mcs = 0;
|
||||
}
|
||||
achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, 1) / 8) / 0.001); // = TB size / TTI
|
||||
achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
|
||||
}
|
||||
|
||||
double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
|
||||
@@ -1025,6 +1025,8 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
|
||||
{
|
||||
// buffer status report
|
||||
// note that we only consider LCG 0, the other three LCGs are neglected
|
||||
// this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
|
||||
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
|
||||
it = m_ceBsrRxed.find (rnti);
|
||||
if (it == m_ceBsrRxed.end ())
|
||||
@@ -1032,11 +1034,11 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
// create the new entry
|
||||
uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
|
||||
int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the CQI value
|
||||
// update the buffer size value
|
||||
(*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
|
||||
}
|
||||
}
|
||||
@@ -1191,6 +1193,7 @@ PfFfMacScheduler::RefreshUlCqiMaps(void)
|
||||
void
|
||||
PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
|
||||
{
|
||||
size = size - 2; // remove the minimum RLC overhead
|
||||
std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
|
||||
LteFlowId_t flow (rnti, lcid);
|
||||
it = m_rlcBufferReq.find (flow);
|
||||
@@ -1242,7 +1245,7 @@ void
|
||||
PfFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
|
||||
{
|
||||
|
||||
|
||||
size = size - 2; // remove the minimum RLC overhead
|
||||
std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
|
||||
if (it!=m_ceBsrRxed.end ())
|
||||
{
|
||||
|
||||
@@ -827,6 +827,8 @@ RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
|
||||
{
|
||||
// buffer status report
|
||||
// note that we only consider LCG 0, the other three LCGs are neglected
|
||||
// this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
|
||||
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
|
||||
it = m_ceBsrRxed.find (rnti);
|
||||
if (it == m_ceBsrRxed.end ())
|
||||
@@ -834,13 +836,12 @@ RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
// create the new entry
|
||||
uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
|
||||
int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the CQI value
|
||||
// update the buffer size value
|
||||
(*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
|
||||
// NS_LOG_DEBUG (this << " Update BSR with " << BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0)) << " at " << Simulator::Now ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -972,6 +973,7 @@ RrFfMacScheduler::RefreshUlCqiMaps(void)
|
||||
void
|
||||
RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
|
||||
{
|
||||
size = size - 2; // remove the minimum RLC overhead
|
||||
std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
|
||||
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
|
||||
{
|
||||
@@ -1021,7 +1023,7 @@ void
|
||||
RrFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
|
||||
{
|
||||
|
||||
|
||||
size = size - 2; // remove the minimum RLC overhead
|
||||
std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
|
||||
if (it!=m_ceBsrRxed.end ())
|
||||
{
|
||||
|
||||
@@ -109,6 +109,13 @@ TraceFadingLossModel::SetTraceLength (Time t)
|
||||
m_traceLength = t;
|
||||
}
|
||||
|
||||
void
|
||||
TraceFadingLossModel::DoStart ()
|
||||
{
|
||||
LoadTrace ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TraceFadingLossModel::LoadTrace ()
|
||||
{
|
||||
@@ -136,6 +143,7 @@ TraceFadingLossModel::LoadTrace ()
|
||||
m_fadingTrace.push_back (rbTimeFadingTrace);
|
||||
}
|
||||
m_timeGranularity = m_traceLength.GetMilliSeconds () / m_samplesNum;
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
}
|
||||
|
||||
|
||||
@@ -150,15 +158,26 @@ TraceFadingLossModel::DoCalcRxPowerSpectralDensity (
|
||||
std::map <ChannelRealizationId_t, int >::iterator itOff;
|
||||
ChannelRealizationId_t mobilityPair = std::make_pair (a,b);
|
||||
itOff = m_windowOffsetsMap.find (mobilityPair);
|
||||
if (Simulator::Now ().GetSeconds () >= m_lastWindowUpdate.GetSeconds () + m_windowSize.GetSeconds ())
|
||||
if (itOff!=m_windowOffsetsMap.end ())
|
||||
{
|
||||
NS_LOG_INFO ("Fading Window Updated");
|
||||
std::map <ChannelRealizationId_t, UniformVariable* >::iterator itVar;
|
||||
if (Simulator::Now ().GetSeconds () >= m_lastWindowUpdate.GetSeconds () + m_windowSize.GetSeconds ())
|
||||
{
|
||||
NS_LOG_INFO ("Fading Window Updated");
|
||||
std::map <ChannelRealizationId_t, UniformVariable* >::iterator itVar;
|
||||
|
||||
itVar = m_startVariableMap.find (mobilityPair);
|
||||
(*itOff).second = (*itVar).second->GetValue ();
|
||||
itVar = m_startVariableMap.find (mobilityPair);
|
||||
(*itOff).second = (*itVar).second->GetValue ();
|
||||
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC (this << "insert new channel realization, m_windowOffsetMap.size () = " << m_windowOffsetsMap.size ());
|
||||
UniformVariable* startV = new UniformVariable (1, (m_traceLength.GetSeconds () - m_windowSize.GetSeconds ()) * 1000.0);
|
||||
ChannelRealizationId_t mobilityPair = std::make_pair (a,b);
|
||||
m_startVariableMap.insert (std::pair<ChannelRealizationId_t,UniformVariable* > (mobilityPair, startV));
|
||||
m_windowOffsetsMap.insert (std::pair<ChannelRealizationId_t,int> (mobilityPair, startV->GetValue ()));
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +190,7 @@ TraceFadingLossModel::DoCalcRxPowerSpectralDensity (
|
||||
//double speed = sqrt (pow (aSpeedVector.x-bSpeedVector.x,2) + pow (aSpeedVector.y-bSpeedVector.y,2));
|
||||
|
||||
NS_LOG_LOGIC (this << *rxPsd);
|
||||
|
||||
NS_ASSERT (!m_fadingTrace.empty ());
|
||||
int now_ms = static_cast<int> (Simulator::Now ().GetMilliSeconds () * m_timeGranularity);
|
||||
int lastUpdate_ms = static_cast<int> (m_lastWindowUpdate.GetMilliSeconds () * m_timeGranularity);
|
||||
int index = (*itOff).second + now_ms - lastUpdate_ms;
|
||||
@@ -204,24 +223,5 @@ TraceFadingLossModel::DoCalcRxPowerSpectralDensity (
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TraceFadingLossModel::CreateFadingChannelRealization (Ptr<const MobilityModel> enbMobility, Ptr<const MobilityModel> ueMobility)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << enbMobility << ueMobility);
|
||||
|
||||
if (m_fadingTrace.empty ())
|
||||
{
|
||||
TraceFadingLossModel::LoadTrace ();
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
}
|
||||
|
||||
NS_LOG_LOGIC (this << "insert new channel realization, m_windowOffsetMap.size () = " << m_windowOffsetsMap.size ());
|
||||
UniformVariable* startV = new UniformVariable (1, (m_traceLength.GetSeconds () - m_windowSize.GetSeconds ()) * 1000.0);
|
||||
ChannelRealizationId_t mobilityPair = std::make_pair (enbMobility,ueMobility);
|
||||
m_startVariableMap.insert (std::pair<ChannelRealizationId_t,UniformVariable* > (mobilityPair, startV));
|
||||
m_windowOffsetsMap.insert (std::pair<ChannelRealizationId_t,int> (mobilityPair, startV->GetValue ()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
@@ -48,19 +48,14 @@ public:
|
||||
virtual ~TraceFadingLossModel ();
|
||||
|
||||
static TypeId GetTypeId ();
|
||||
|
||||
virtual void DoStart (void);
|
||||
|
||||
/**
|
||||
* \brief The couple of mobility mnode that form a fading channel realization
|
||||
*/
|
||||
typedef std::pair<Ptr<const MobilityModel>, Ptr<const MobilityModel> > ChannelRealizationId_t;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Create a fading channel realization among two device
|
||||
* \param enbMobility mobility object of the enb
|
||||
* \param ueMobility mobility object of the ue
|
||||
*/
|
||||
void CreateFadingChannelRealization (Ptr<const MobilityModel> enbMobility, Ptr<const MobilityModel> ueMobility);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,8 @@ cpp_examples = [
|
||||
("lena-dual-stripe --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --epc=1 --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --epc=1 --useUdp=0 --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --epc=1 --fadingTrace=../../src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --nBlocks=1 --nMacroEnbSites=0 --macroUeDensity=0 --homeEnbDeploymentRatio=1 --homeEnbActivationRatio=1 --homeUesHomeEnbRatio=2 --macroEnbTxPowerDbm=0 --simTime=0.01", "True", "True"),
|
||||
("lena-fading", "True", "True"),
|
||||
("lena-gtpu-tunnel", "True", "True"),
|
||||
("lena-intercell-interference", "True", "True"),
|
||||
|
||||
@@ -145,13 +145,14 @@ LteDownlinkSinrTestCase::DoRun (void)
|
||||
int numOfPkts = 10;
|
||||
|
||||
// Packet bursts
|
||||
Ptr<PacketBurst> packetBursts[numOfPbs];
|
||||
Ptr<PacketBurst> *packetBursts = new Ptr<PacketBurst>[numOfPbs];
|
||||
|
||||
// Packets
|
||||
Ptr<Packet> pkt[numOfPbs][numOfPkts];
|
||||
Ptr<Packet> **pkt = new Ptr<Packet>* [numOfPbs];
|
||||
for (int i = 0; i < numOfPbs; i++) pkt[i] = new Ptr<Packet> [numOfPkts];
|
||||
|
||||
// Phy tags
|
||||
LtePhyTag pktTag[numOfPbs];
|
||||
LtePhyTag *pktTag = new LtePhyTag [numOfPbs];
|
||||
|
||||
/**
|
||||
* Build packet burst
|
||||
@@ -266,6 +267,11 @@ LteDownlinkSinrTestCase::DoRun (void)
|
||||
NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
|
||||
dlPhy->Dispose ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
delete [] pktTag;
|
||||
for (int i = 0; i < numOfPbs; i++) delete [] pkt[i];
|
||||
delete [] pkt;
|
||||
delete [] packetBursts;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -60,18 +60,18 @@ LenaTestPhyErrorModelrSuite::LenaTestPhyErrorModelrSuite ()
|
||||
NS_LOG_INFO ("creating LenaTestPhyErrorModelTestCase");
|
||||
|
||||
// MCS 2 TB size of 256 bits BER 0.33 SINR -5.51
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (4, 1800, 32, 0.33, 29));
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (4, 1800, 32, 0.35, 50));
|
||||
// MCS 2 TB size of 528 bits BER 0.11 SINR -5.51
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (2, 1800, 66, 0.11, 20));
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (2, 1800, 66, 0.11, 34));
|
||||
// MCS 2 TB size of 1088 bits BER 0.02 SINR -5.51
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 1800, 136, 0.02, 9));
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 1800, 136, 0.02, 16));
|
||||
// MCS 12 TB size of 4800 bits BER 0.3 SINR 4.43
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 600, 600, 0.3, 29));
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 600, 600, 0.3, 48));
|
||||
// MCS 12 TB size of 1632 bits BER 0.55 SINR 4.43
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (3, 600, 204, 0.55, 31));
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (3, 600, 204, 0.55, 52));
|
||||
// MCS 16 TB size of 7272 bits (3648 x 3584) BER 0.14 SINR 8.48
|
||||
// BER 0.14 = 1 - ((1-0.075)*(1-0.075))
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 470, 781, 0.14, 22));
|
||||
AddTestCase (new LenaPhyErrorModelTestCase (1, 470, 781, 0.14, 29));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -154,14 +154,14 @@ LteUplinkSinrTestCase::DoRun (void)
|
||||
int numOfPkts = 10;
|
||||
|
||||
// Packet bursts
|
||||
Ptr<PacketBurst> packetBursts[numOfPbs];
|
||||
Ptr<PacketBurst> *packetBursts = new Ptr<PacketBurst>[numOfPbs];
|
||||
|
||||
// Packets
|
||||
Ptr<Packet> pkt[numOfPbs][numOfPkts];
|
||||
Ptr<Packet> **pkt = new Ptr<Packet>* [numOfPbs];
|
||||
for (int i = 0; i < numOfPbs; i++) pkt[i] = new Ptr<Packet> [numOfPkts];
|
||||
|
||||
// Phy tags
|
||||
LtePhyTag pktTag[numOfPbs];
|
||||
|
||||
LtePhyTag *pktTag = new LtePhyTag [numOfPbs];
|
||||
|
||||
/**
|
||||
* Build packet burst (Data and interference)
|
||||
@@ -304,8 +304,12 @@ LteUplinkSinrTestCase::DoRun (void)
|
||||
|
||||
NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
|
||||
ulPhy->Dispose ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
Simulator::Destroy ();
|
||||
|
||||
delete [] pktTag;
|
||||
for (int i = 0; i < numOfPbs; i++) delete [] pkt[i];
|
||||
delete [] pkt;
|
||||
delete [] packetBursts;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
% Generation of the quantiles of the Bernoulli distribution at 95%
|
||||
% Generation of the quantiles of the Bernoulli distribution at 99.9%
|
||||
% related to phy error model test
|
||||
|
||||
n = 1000;
|
||||
p_vect = [0.33 0.11 0.02 0.3 0.55 0.14];
|
||||
p_vect = [0.35 0.11 0.02 0.3 0.55 0.14];
|
||||
for i=1:length(p_vect)
|
||||
p = p_vect(i)
|
||||
cdf = 0.0;
|
||||
@@ -12,10 +12,10 @@ for i=1:length(p_vect)
|
||||
for k=1:n
|
||||
pk = bincoeff(n,k)* p^k * (1-p)^(n-k);
|
||||
cdf = cdf + pk;
|
||||
if cdf > 0.025 & kmin == 0.0
|
||||
if cdf > 0.0005 & kmin == 0.0
|
||||
kmin = lambda - k
|
||||
end
|
||||
if cdf > 0.975 & kmax == 0.0
|
||||
if cdf > 0.9995 & kmax == 0.0
|
||||
kmax = k - lambda
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,8 +68,8 @@ def register_types(module):
|
||||
module.add_class('Rectangle')
|
||||
## rectangle.h (module 'mobility'): ns3::Rectangle::Side [enumeration]
|
||||
module.add_enum('Side', ['RIGHT', 'LEFT', 'TOP', 'BOTTOM'], outer_class=root_module['ns3::Rectangle'])
|
||||
## random-variable.h (module 'core'): ns3::SeedManager [class]
|
||||
module.add_class('SeedManager', import_from_module='ns.core')
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class]
|
||||
module.add_class('RngSeedManager', import_from_module='ns.core')
|
||||
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
|
||||
module.add_class('SequentialVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
|
||||
@@ -266,14 +266,18 @@ def register_types(module):
|
||||
module.add_class('GaussMarkovMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## hierarchical-mobility-model.h (module 'mobility'): ns3::HierarchicalMobilityModel [class]
|
||||
module.add_class('HierarchicalMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue', 'ns3::VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue*', 'ns3::VectorValue*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue&', 'ns3::VectorValue&')
|
||||
module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
|
||||
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
|
||||
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
|
||||
module.add_typedef(root_module['ns3::Vector3D'], 'Vector')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&')
|
||||
module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue', 'ns3::VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue*', 'ns3::VectorValue*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue&', 'ns3::VectorValue&')
|
||||
module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
|
||||
@@ -309,7 +313,7 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3Rectangle_methods(root_module, root_module['ns3::Rectangle'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager'])
|
||||
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
|
||||
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
|
||||
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
|
||||
@@ -1375,32 +1379,32 @@ def register_Ns3Rectangle_methods(root_module, cls):
|
||||
cls.add_instance_attribute('yMin', 'double', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SeedManager_methods(root_module, cls):
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
|
||||
def register_Ns3RngSeedManager_methods(root_module, cls):
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
|
||||
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
|
||||
cls.add_method('CheckSeed',
|
||||
'bool',
|
||||
[param('uint32_t', 'seed')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint32_t',
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')])
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function]
|
||||
cls.add_method('GetNextStreamIndex',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function]
|
||||
cls.add_method('GetSeed',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function]
|
||||
cls.add_method('SetRun',
|
||||
'void',
|
||||
[param('uint32_t', 'run')],
|
||||
[param('uint64_t', 'run')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function]
|
||||
cls.add_method('SetSeed',
|
||||
'void',
|
||||
[param('uint32_t', 'seed')],
|
||||
@@ -1698,12 +1702,25 @@ def register_Ns3UniformVariable_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector2D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector2D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector2D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector2D::y [variable]
|
||||
@@ -1712,12 +1729,25 @@ def register_Ns3Vector2D_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector3D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector3D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector3D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector3D::y [variable]
|
||||
@@ -2011,6 +2041,11 @@ def register_Ns3Object_methods(root_module, cls):
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## object.h (module 'core'): ns3::Ptr<ns3::MobilityModel> ns3::Object::GetObject() const [member function]
|
||||
cls.add_method('GetObject',
|
||||
'ns3::Ptr< ns3::MobilityModel >',
|
||||
[],
|
||||
is_const=True, template_parameters=['ns3::MobilityModel'])
|
||||
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
@@ -2947,6 +2982,11 @@ def register_Ns3MobilityModel_methods(root_module, cls):
|
||||
'double',
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'position')],
|
||||
is_const=True)
|
||||
## mobility-model.h (module 'mobility'): static ns3::Ptr<ns3::MobilityModel> ns3::MobilityModel::GetMobilityModel(ns3::Ptr<ns3::Object> node) [member function]
|
||||
cls.add_method('GetMobilityModel',
|
||||
'ns3::Ptr< ns3::MobilityModel >',
|
||||
[param('ns3::Ptr< ns3::Object >', 'node')],
|
||||
is_static=True)
|
||||
## mobility-model.h (module 'mobility'): ns3::Vector ns3::MobilityModel::GetPosition() const [member function]
|
||||
cls.add_method('GetPosition',
|
||||
'ns3::Vector',
|
||||
|
||||
@@ -68,8 +68,8 @@ def register_types(module):
|
||||
module.add_class('Rectangle')
|
||||
## rectangle.h (module 'mobility'): ns3::Rectangle::Side [enumeration]
|
||||
module.add_enum('Side', ['RIGHT', 'LEFT', 'TOP', 'BOTTOM'], outer_class=root_module['ns3::Rectangle'])
|
||||
## random-variable.h (module 'core'): ns3::SeedManager [class]
|
||||
module.add_class('SeedManager', import_from_module='ns.core')
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager [class]
|
||||
module.add_class('RngSeedManager', import_from_module='ns.core')
|
||||
## random-variable.h (module 'core'): ns3::SequentialVariable [class]
|
||||
module.add_class('SequentialVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariable'])
|
||||
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
|
||||
@@ -266,14 +266,18 @@ def register_types(module):
|
||||
module.add_class('GaussMarkovMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## hierarchical-mobility-model.h (module 'mobility'): ns3::HierarchicalMobilityModel [class]
|
||||
module.add_class('HierarchicalMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue', 'ns3::VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue*', 'ns3::VectorValue*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue&', 'ns3::VectorValue&')
|
||||
module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3D', 'ns3::Vector')
|
||||
typehandlers.add_type_alias('ns3::Vector3D*', 'ns3::Vector*')
|
||||
typehandlers.add_type_alias('ns3::Vector3D&', 'ns3::Vector&')
|
||||
module.add_typedef(root_module['ns3::Vector3D'], 'Vector')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager', 'ns3::SeedManager')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager*', 'ns3::SeedManager*')
|
||||
typehandlers.add_type_alias('ns3::RngSeedManager&', 'ns3::SeedManager&')
|
||||
module.add_typedef(root_module['ns3::RngSeedManager'], 'SeedManager')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue', 'ns3::VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue*', 'ns3::VectorValue*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DValue&', 'ns3::VectorValue&')
|
||||
module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker', 'ns3::VectorChecker')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker*', 'ns3::VectorChecker*')
|
||||
typehandlers.add_type_alias('ns3::Vector3DChecker&', 'ns3::VectorChecker&')
|
||||
@@ -309,7 +313,7 @@ def register_methods(root_module):
|
||||
register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory'])
|
||||
register_Ns3RandomVariable_methods(root_module, root_module['ns3::RandomVariable'])
|
||||
register_Ns3Rectangle_methods(root_module, root_module['ns3::Rectangle'])
|
||||
register_Ns3SeedManager_methods(root_module, root_module['ns3::SeedManager'])
|
||||
register_Ns3RngSeedManager_methods(root_module, root_module['ns3::RngSeedManager'])
|
||||
register_Ns3SequentialVariable_methods(root_module, root_module['ns3::SequentialVariable'])
|
||||
register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
|
||||
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
|
||||
@@ -1375,32 +1379,32 @@ def register_Ns3Rectangle_methods(root_module, cls):
|
||||
cls.add_instance_attribute('yMin', 'double', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3SeedManager_methods(root_module, cls):
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager() [constructor]
|
||||
def register_Ns3RngSeedManager_methods(root_module, cls):
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-variable.h (module 'core'): ns3::SeedManager::SeedManager(ns3::SeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SeedManager const &', 'arg0')])
|
||||
## random-variable.h (module 'core'): static bool ns3::SeedManager::CheckSeed(uint32_t seed) [member function]
|
||||
cls.add_method('CheckSeed',
|
||||
'bool',
|
||||
[param('uint32_t', 'seed')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint32_t',
|
||||
## rng-seed-manager.h (module 'core'): ns3::RngSeedManager::RngSeedManager(ns3::RngSeedManager const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RngSeedManager const &', 'arg0')])
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetNextStreamIndex() [member function]
|
||||
cls.add_method('GetNextStreamIndex',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static uint32_t ns3::SeedManager::GetSeed() [member function]
|
||||
## rng-seed-manager.h (module 'core'): static uint64_t ns3::RngSeedManager::GetRun() [member function]
|
||||
cls.add_method('GetRun',
|
||||
'uint64_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## rng-seed-manager.h (module 'core'): static uint32_t ns3::RngSeedManager::GetSeed() [member function]
|
||||
cls.add_method('GetSeed',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetRun(uint32_t run) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetRun(uint64_t run) [member function]
|
||||
cls.add_method('SetRun',
|
||||
'void',
|
||||
[param('uint32_t', 'run')],
|
||||
[param('uint64_t', 'run')],
|
||||
is_static=True)
|
||||
## random-variable.h (module 'core'): static void ns3::SeedManager::SetSeed(uint32_t seed) [member function]
|
||||
## rng-seed-manager.h (module 'core'): static void ns3::RngSeedManager::SetSeed(uint32_t seed) [member function]
|
||||
cls.add_method('SetSeed',
|
||||
'void',
|
||||
[param('uint32_t', 'seed')],
|
||||
@@ -1698,12 +1702,25 @@ def register_Ns3UniformVariable_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector2D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('ns3::Vector2D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector2D'], root_module['ns3::Vector2D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector2D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y')])
|
||||
## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector2D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector2D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector2D::y [variable]
|
||||
@@ -1712,12 +1729,25 @@ def register_Ns3Vector2D_methods(root_module, cls):
|
||||
|
||||
def register_Ns3Vector3D_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('*', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('+', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_inplace_numeric_operator('+=', param('double', 'right'))
|
||||
cls.add_binary_numeric_operator('-', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('ns3::Vector3D const &', 'right'))
|
||||
cls.add_binary_numeric_operator('/', root_module['ns3::Vector3D'], root_module['ns3::Vector3D'], param('double', 'right'))
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector3D const &', 'arg0')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h (module 'core'): double ns3::Vector3D::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h (module 'core'): ns3::Vector3D::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h (module 'core'): ns3::Vector3D::y [variable]
|
||||
@@ -2011,6 +2041,11 @@ def register_Ns3Object_methods(root_module, cls):
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## object.h (module 'core'): ns3::Ptr<ns3::MobilityModel> ns3::Object::GetObject() const [member function]
|
||||
cls.add_method('GetObject',
|
||||
'ns3::Ptr< ns3::MobilityModel >',
|
||||
[],
|
||||
is_const=True, template_parameters=['ns3::MobilityModel'])
|
||||
## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
@@ -2947,6 +2982,11 @@ def register_Ns3MobilityModel_methods(root_module, cls):
|
||||
'double',
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'position')],
|
||||
is_const=True)
|
||||
## mobility-model.h (module 'mobility'): static ns3::Ptr<ns3::MobilityModel> ns3::MobilityModel::GetMobilityModel(ns3::Ptr<ns3::Object> node) [member function]
|
||||
cls.add_method('GetMobilityModel',
|
||||
'ns3::Ptr< ns3::MobilityModel >',
|
||||
[param('ns3::Ptr< ns3::Object >', 'node')],
|
||||
is_static=True)
|
||||
## mobility-model.h (module 'mobility'): ns3::Vector ns3::MobilityModel::GetPosition() const [member function]
|
||||
cls.add_method('GetPosition',
|
||||
'ns3::Vector',
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
*/
|
||||
double GetRelativeSpeed (Ptr<const MobilityModel> other) const;
|
||||
|
||||
static inline Ptr<MobilityModel>
|
||||
GetMobilityModel (Ptr<Object> node);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Must be invoked by subclasses when the course of the
|
||||
@@ -103,6 +106,13 @@ private:
|
||||
|
||||
};
|
||||
|
||||
Ptr<MobilityModel>
|
||||
MobilityModel::GetMobilityModel (Ptr<Object> node)
|
||||
{
|
||||
return node->GetObject<MobilityModel> ();
|
||||
}
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* MOBILITY_MODEL_H */
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
* Create new test case. To make it useful SetTrace () and AddReferencePoint () must be called
|
||||
*
|
||||
* \param name Short description
|
||||
* \param timeLimit Test time limit
|
||||
* \param nodes Number of nodes used in the test trace, 1 by default
|
||||
*/
|
||||
Ns2MobilityHelperTest (std::string const & name, Time timeLimit, uint32_t nodes = 1)
|
||||
|
||||
Loaded 100 of 169 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user