Skip to content

Commit

Permalink
Remove packets dropped due to connection within animation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinna Adhikari committed Mar 21, 2021
1 parent a8578c9 commit bab4852
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 0 additions & 5 deletions Python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,6 @@ def runSimulation(dddState, skipsim, sumOut,
animationDataAttacker[5] = 'attacker'
animationDataNat[5] = 'nat'
# Index 6 is the number of outbound packets that get dropped due to the bandwidth
animationDataClient[6] = str(simClient.packetsDroppedOnConnection)
animationDataMServer[6] = str(simMServer.packetsDroppedOnConnection)
animationDataNServer[6] = str(simNServer.packetsDroppedOnConnection)
animationDataRouter[6] = str(simRouter.packetsDroppedOnConnection)
animationDataAttacker[6] = str(simAttacker.packetsDroppedOnConnection)
fileGen.animateData(animationDataClient, animationDataMServer,
animationDataNServer, animationDataRouter,
animationDataAttacker, animationDataNat)
Expand Down
6 changes: 2 additions & 4 deletions static/js/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ export class Entity {
this.img = new Image();
this.img.src = imgSrc;

this.queue = [];
this.queueSize = 0;
this.receivedCounter = 0; // Number of packets successfully received
this.droppedCounter = 0; // Number of packets dropped
this.generateCounter = 0;
this.sentCounter = 0; // Number of packets successfully sent
this.bandwidthDrop = 0;

this.img.onload = () => this.draw; // Need to onload the draw function onto the img

Expand All @@ -33,8 +31,8 @@ export class Entity {
}

drawEntityData(color, font, textDistance){
let textLst = ['Queue Size: ', 'Total Packets Received: ', 'Total Packets Dropped: ', 'Total Packets Generated: ', 'Total Packets Sent: ', 'Sent Packets Dropped (bandwidth): '];
let dataLst = [this.queueSize, this.receivedCounter, this.droppedCounter, this.generateCounter, this.sentCounter, this.bandwidthDrop];
let textLst = ['Queue Size: ', 'Total Packets Received: ', 'Total Packets Dropped: ', 'Total Packets Generated: ', 'Total Packets Sent: '];
let dataLst = [this.queueSize, this.receivedCounter, this.droppedCounter, this.generateCounter, this.sentCounter];
let y = this.y + this.height + textDistance;
for(let i = 0; i < textLst.length; ++i){
let text = textLst[i] + dataLst[i].toString();
Expand Down
5 changes: 2 additions & 3 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ for(let entity of entities){
entity.ctx = ctx;
}

// animate function variables
// Animate function variables
let packets = new Set();
let animateInstructions = [];
var instructionInd = 0;
Expand Down Expand Up @@ -92,7 +92,7 @@ function animateLoop(){
// Update clock variables
clock.update();

// Animating using instructions experiment
// Animating using instructions
if(clock.animateDelta >= 1000 / scale){
if(instructionInd < animateInstructions.length){
let instructions = animateInstructions[instructionInd];
Expand Down Expand Up @@ -158,7 +158,6 @@ function animateLoop(){
entity.droppedCounter = instruction[2]; // Number of packets dropped
entity.generateCounter = instruction[3];
entity.sentCounter = instruction[4]; // Number of packets successfully sent
entity.bandwidthDrop = instruction[6];
}
}
}
Expand Down

0 comments on commit bab4852

Please sign in to comment.