From bab4852db61cd16eb64c2d1a63ef76875fd9af7c Mon Sep 17 00:00:00 2001 From: Abhinna Adhikari Date: Sun, 21 Mar 2021 15:43:41 -0400 Subject: [PATCH] Remove packets dropped due to connection within animation instructions --- Python/main.py | 5 ----- static/js/entity.js | 6 ++---- static/js/index.js | 5 ++--- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Python/main.py b/Python/main.py index 39f8f02..2d46707 100644 --- a/Python/main.py +++ b/Python/main.py @@ -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) diff --git a/static/js/entity.js b/static/js/entity.js index 0688060..e90084e 100644 --- a/static/js/entity.js +++ b/static/js/entity.js @@ -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 @@ -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(); diff --git a/static/js/index.js b/static/js/index.js index 31b003b..04b6f78 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -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; @@ -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]; @@ -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]; } } }