diff --git a/index.html b/index.html index 7af06de..44c3784 100644 --- a/index.html +++ b/index.html @@ -97,12 +97,21 @@

DDD Filter applications in the Network

+

+ +
+

+

+
+ + +
diff --git a/js/canvas.js b/js/canvas.js index 8c289ae..f2ab5ac 100644 --- a/js/canvas.js +++ b/js/canvas.js @@ -100,6 +100,16 @@ function allEmpty(entities) { return true; } +// dashboard functions + +function dashboardOpenPorts(ddd){ + document.getElementById("openPorts").textContent = "DDD Open Ports: " + ddd.openPorts; +} +function dashboardDroppedPackets(garbage){ + document.getElementById("droppedPackets").textContent = "Dropped Packets: " + garbage.droppedPackets; +} + + //Stop simulation var stop = false; window.stopSimulation = stopSimulation; @@ -198,6 +208,12 @@ async function startSimulation() { } } + // Update dashboard + if(ddd){ + dashboardOpenPorts(ddd); + } + dashboardDroppedPackets(garbage); + // Animate the packets moving through the system await animatePacket(packets, allEntities); diff --git a/js/garbage.js b/js/garbage.js index 5aaad95..fdcc88b 100644 --- a/js/garbage.js +++ b/js/garbage.js @@ -3,6 +3,7 @@ import { Entity } from './entity.js'; export class Garbage extends Entity { constructor(x, y, nextEntity, packetsPerTimeUnit, queue = []) { super('images/Trash.jpg', 'Garbage', x, y, 150, 100, nextEntity, packetsPerTimeUnit, queue); + this.droppedPackets = 0; // Bind methods //this.fillPossibleMoves = this.fillPossibleMoves.bind(this); @@ -14,10 +15,12 @@ export class Garbage extends Entity { dstEntity = this.nextEntity; } + // Send packetsPerTimeUnit packets from current entity to dstEntity for (let i = 0; i < this.packetsPerTimeUnit; ++i) { let packet = this.dequeue(); if (packet) { + this.droppedPackets++; console.log(packet); packet.nextEntity = dstEntity; // Used for packet animation packet.dropped = false;