Code Monkey home page Code Monkey logo

speedfalloff-plots's Introduction

Clang-format build-ns3 Create Docker Container GitHub Lines of code NS3 version

Random Waypoint Mobility Model Test

This repository holds the code that is used to run the ns-3 simulations to generate the data and produce the RWPM plots used for my thesis.

This code was written for use with the ns-3.32 simulator and is designed to be run from within the scratch folder.

This is a very simple simulation of 500 nodes in a 1km x 1km area that move around according to the RWPM and it collects the nodes speed and position every second,

Prereqs:

pip install matplotlib sem seaborn requests

If building netanim:

  • qt4-qmake
  • libqt4-dev

(additionally, on ubuntu 20.10, you need to add an additional repo because qt4 no longer ships with it)

Building this project

Reproducibility is one of the key goals of simulator studies.

  1. Download and build copy of the ns-3.32 all-in-one distribution.

    wget https://www.nsnam.org/release/ns-allinone-3.32.tar.bz2
    tar xjvf ns-allinone-3.32.tar.bz2
    cd ns-allinone-3.32
    python3 ./build.py --enable-examples --enable-tests
  2. Change directories to the scratch/ folder of the ns-3.32 source distribution.

    cd ns-3.32/scratch/
  3. Clone this repository.

    git clone [email protected]:marshallasch/speedfalloff-plots.git
  4. Change directory back to the ns-3.32 folder of the source distribution and re-configure ./waf so it can cache the new changes

    cd ..
    ./waf configure --enable-examples --enable-tests
    ./waf build
  5. Run the example simulation that is included within the module.

    ./waf --run 'scratch/speedfalloff-plots/speedfalloff-plots'

    This will produce an output file in the form of:

    # time(seconds) nodeID xLocation yLocation xVelocity yVelocity
    0 0 831.69 955.872 0 0
    ...
    

    There are a number of flags that can be given to change various parameters. See ./waf --run 'scratch/speedfalloff-plots/speedfalloff-plots --help' for the available options

Building the container

$ docker build \
   --build-arg GIT_COMMIT=$(git rev-parse -q --verify HEAD) \
   --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
   -t marshallasch/speedfalloff:latest .

The build variant can be configured using the BUILD_PROFILE build-arg, it can be set to either debug, release, or optimized. It is set to debug by default.

Run using Docker

In order to keep a version of the figure generator we have developed a prebuilt docker image that can be used to run the simulation without needing to install ns3 or any of its dependencies.

The prebuilt docker container can be used in one of three ways:

  • interactively using a bash shell
  • directly to run the simulation script with the desired flags
  • to run the SEM script directly to collect the results and generate the simulation plots

Interactive bash terminal

The interactive shell will put you in the ns3 root directory. Depending on which docker image tag is used ns3 can either be built in debug mode or optimized mode. The simulation script has been pre installed in the scratch folder. SEM has been installed and the sem runner script can be accessed in the parent directory.

docker run --rm -it marshallasch/speedfalloff:optimized bash

Directly run the simulation

Any flags that are given to the container in the docker run command are passed directly to the waf script. It is equivalent to running ./waf --run "scratch/speedfalloff-plots/speedfalloff-plots <my flags>".

docker run --rm  marshallasch/speedfalloff:optimized --runTime=5

Collect the simulation results and generate the figues

By giving the sem command to the docker container the sem script will be run to collect the simulation results and generate the figures. The results will be put into the /results directory, which can be mounted so the figures can be used.

docker run --rm  -v "$(pwd)/results:/results" marshallasch/speedfalloff:optimized sem

Generating the figures

Alternatively you can run the SEM script manually by placing it in the parent directory of the ns3-3.2 folder. Some modifications will need to me made to the simulation.py script as it is developed to be used in the docker container. Specifically the location that it writes the files to should be modified.

To use it ns3 needs to be installed on the system and the script needs to be placed outside of the ns3 directory, as shown below.

Note, this currently requires features from SEM that are only in the develop branch.

ns-3.32/
  scratch/
    speedfalloff-plots/
      ....
simulation.py

This directory structure can be changed somewhat by editing the script, but it must be outside the directory. Then running ./simulation.py from the parent directory will compile and run the simulations as well as generate the figures.

speedfalloff-plots's People

Contributors

marshallasch avatar renovate-bot avatar

Watchers

James Cloos avatar  avatar

speedfalloff-plots's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • Update marshallasch/ns3 Docker tag to v3.35

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • marshallasch/ns3 3.32-debug
github-actions
.github/workflows/clang-format.yml
  • actions/checkout v2
  • HorstBaerbel/action-clang-format 1.4
.github/workflows/deployment.yml
  • actions/checkout v2
  • docker/metadata-action v3
  • docker/setup-qemu-action v1
  • docker/setup-buildx-action v1
  • docker/login-action v1
  • docker/build-push-action v2
.github/workflows/ns3-build.yml
  • actions/checkout v2
pip_requirements
requirements.txt
  • seaborn ==0.11.2
  • requests ==2.27.1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.