The Python Opportunistic Network Simulator (PONS) is a discrete-event simulator for opportunistic/DTN networks.
Project description
PONS - Python Opportunistic Network Simulator
A modular DTN simulator in the style of the ONE.
Features:
- distance- or contact-window-based network simulation
- DTN routing algorithms
- epidemic
- spray & wait
- first contact
- direct delivery
- PRoPHET
- static
- mobility
- random waypoint
- external ONE movement
- external ns2 movement
- contact plan connectivity model
- ION DTN contact plans
- [core contact plan}(https://github.com/gh0st42/ccm/)
- static networkx topology
- optionally: from graphml
- optionally: fluctuating from contact plan
- simulated user applications
- tools
neteditfor generating graphml topologiesponsanimfor generating animated gifs and mp4 from graphml topologies with a contact plan or event logsscenariorunnerto simulate scenarios described in a mix of csv and json files without writing any code
Requirements
- simpy >= 4.0
- networkx >= 3.2
- plotting:
- seaborn
- pandas
- matplotlib
- numpy
- tools:
- pillow
- opencv-python
- tkinter
Example
import random
import json
import pons
import pons.routing
RANDOM_SEED = 42
SIM_TIME = 3600*24
NET_RANGE = 50
NUM_NODES = 10
WORLD_SIZE = (3000, 3000)
# Setup and start the simulation
random.seed(RANDOM_SEED)
moves = pons.generate_randomwaypoint_movement(
SIM_TIME, NUM_NODES, WORLD_SIZE[0], WORLD_SIZE[1], max_pause=60.0)
net = pons.NetworkSettings("NET1", range=NET_RANGE)
epidemic = pons.routing.EpidemicRouter()
nodes = pons.generate_nodes(NUM_NODES, net=[net], router=epidemic)
config = {"movement_logger": False, "peers_logger": False, "event_logger": True}
msggenconfig = {"type": "single", "interval": 30,
"src": (0, NUM_NODES), "dst": (0, NUM_NODES),
"size": 100, "id": "M"}
netsim = pons.NetSim(SIM_TIME, WORLD_SIZE, nodes, moves,
config=config, msggens=[msggenconfig])
netsim.setup()
netsim.run()
# print results
print(json.dumps(netsim.net_stats, indent=4))
print(json.dumps(netsim.routing_stats, indent=4))
Run using python3 or for improved performance use pypy3.
Magic ENV Variables
Some of the simulation core functions can be set during runtime without having to change your simulation code.
LOG_FILEcan be set to change the default event log file from/tmp/events.logto something elseSIM_DURATIONcan be used to override the calculated simulation duration
For netedit there are also ways to influence its behavior:
BG_IMGcan be set to any image and it while be rendered as a background behind the network topology
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pons_dtn-0.2.0.tar.gz.
File metadata
- Download URL: pons_dtn-0.2.0.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92c3712761a5e3b522e5135e995b9cb803430d0dc6e50d687909cb181263aaaa
|
|
| MD5 |
7377281e42275faac7f2519b9c654227
|
|
| BLAKE2b-256 |
a8206a8dc1f8208a460635eb40d70c16121e9c4230861b9ddbf061bdcd963cd8
|
File details
Details for the file pons_dtn-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pons_dtn-0.2.0-py3-none-any.whl
- Upload date:
- Size: 80.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e5a4aa7e974c8c31a7a661d0fc69416566fc580f042f3f73ca3cd3322dca08a
|
|
| MD5 |
c61a6fb1fa73e4887048b2cb97ce7c3a
|
|
| BLAKE2b-256 |
5971e45af02ef5b07d4b62232c527f789bd7c920715d7d2eaa9d64fb6e5ddf39
|