A complete stand-alone simulator for the P2PSP protocol
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

P2PSP simulator

Join the chat at https://gitter.im/P2PSP/Simulator

A complete stand-alone simulator of the P2PSP protocol using Processes and message passing in order to do the prototyping of new strategies easier.

Pre-requisites

Linux

$ sudo apt install python3-tk
$ sudo apt-get install gnuplot
$ pip3 install fire
$ pip3 install matplotlib==2.0.0
$ pip3 install networkx

Arch

sudo pacman -S python-pmw

Usage

First, go to src dir:

$ cd src

Running a simulation

$ python3 -u simulator.py run [options]

Options

--set_of_rules SET_OF_RULES (currently available: dbs, cis and cis-sss)
--number-of-monitors NUMBER_OF_MONITORS
--number-of-peers NUMBER_OF_PEERS
--number-of-malicious NUMBER_OF_MALICIOUS (optional)
--number-of-rounds NUMBER_OF_ROUNDS
--drawing-log FILENAME
[--gui] (optional)

Example:

# inside src folder, run
$ python simulator.py run --set-of-rules dbs --number-of-monitors 1 --number-of-peers 20 --number-of-rounds 20 --drawing-log output_file

Drawing the simulation

$ python3 play.py draw --drawing-log FILENAME

Note: If you want to draw in simulation time, you can add --gui option as a flag in the run command.

Example:

$ python play.py draw --drawing-log output_file

Ploting team and buffer results

Change to tools dir and use the plot script_

$ cd ../tools
$ ./plot.sh ../src/DRAWING_LOG_FILENAME

Drawing file format

  • First line -> experiment configuration:
C;[NumberOfMonitor];[NumberOfPeers];[NumberOfMalicious];[NumberOfRounds];[SetOfRules]
  • Nodes -> O;Node;[Direction];[NodeID]. Example: O;Node;IN;M1
  • Round -> R;[Number]
  • Team Status -> T;[NodeID];[Quantity];[RoundNumber]
  • Buffer Status (following lines are related)
    • Buffer -> B;[NodeID];[C][L][...]. C-> Chunk, L -> Gap
    • Sender -> S;[NodeID];[NodeID][...]
  • Chunk Loss Ratio -> CLR;[NodeID];[Value]

GUI

Network Overlay

It shows how the network overlay evolves during the simulation.

Nodes represent the following entities:

  • green: monitor/trusted peer (M/TPs)
  • blue: regular peer (WIPs)
  • red: malicious peer (MPs)

Edges represent the existence of communication (or not) among the nodes:

  • black: there is communication
  • red: there is not communication overlay

Team Status

It shows the number of each type of peer into the team (same colors as used in Network Overlay). team

Buffer Status

Buffer status for each peer. Each point in the chart represents a chunk in the buffer of a peer:

  • black: chunk from the splitter.
  • gray: chunk consumed.
  • others: chunk from other peers. One different color for each peer. buffer