A complete stand-alone simulator of the P2PSP protocol using Processes and message passing in order to do the prototyping of new strategies easier.
$ sudo apt install python3-tk
$ sudo apt-get install gnuplot
$ pip3 install fire
$ pip3 install matplotlib==2.0.0
$ pip3 install networkx
sudo pacman -S python-pmw
First, go to src dir:
$ cd src
$ python3 -u simulator.py run [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
$ 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
Change to tools dir and use the plot script_
$ cd ../tools
$ ./plot.sh ../src/DRAWING_LOG_FILENAME
- 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][...]
- Buffer ->
- Chunk Loss Ratio ->
CLR;[NodeID];[Value]
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:
It shows the number of each type of peer into the team (same colors as used in Network Overlay).

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

