diff options
Diffstat (limited to 'opendc-simulator')
5 files changed, 7 insertions, 28 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java index ac3bff74..24627a9c 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java @@ -124,7 +124,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer // Calculate Power Demand and send to PSU // TODO: look at the double / double thing - double powerDemand = (double) this.cpuPowerModel.computePower((double) this.currentCpuUtilization); + double powerDemand = this.cpuPowerModel.computePower(this.currentCpuUtilization); if (powerDemand != this.currentPowerDemand) { this.pushDemand(this.psuEdge, powerDemand); @@ -201,10 +201,6 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer */ @Override public void handleDemand(FlowEdge consumerEdge, double newCpuDemand) { - if (newCpuDemand == this.currentCpuDemand) { - return; - } - updateCounters(); this.currentCpuDemand = newCpuDemand; this.currentCpuUtilization = this.currentCpuDemand / this.maxCapacity; diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java index 21f59cf6..0557165b 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java @@ -202,9 +202,6 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli **/ @Override public void handleDemand(FlowEdge consumerEdge, double newDemand) { - if (this.cpuDemand == newDemand) { - return; - } updateCounters(this.clock.millis()); this.cpuDemand = newDemand; @@ -217,9 +214,6 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli **/ @Override public void handleSupply(FlowEdge supplierEdge, double newCpuSupply) { - if (newCpuSupply == this.cpuSupply) { - return; - } updateCounters(this.clock.millis()); this.cpuSupply = newCpuSupply; diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java index 2c953d06..a219d4e6 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java @@ -163,9 +163,6 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { @Override public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { - if (newPowerDemand == this.powerDemand) { - return; - } this.powerDemand = newPowerDemand; this.invalidate(); @@ -173,9 +170,6 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { @Override public void pushSupply(FlowEdge consumerEdge, double newSupply) { - if (newSupply == this.powerSupplied) { - return; - } this.powerSupplied = newSupply; consumerEdge.pushSupply(newSupply); diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java index 436c5c12..709d3e15 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java @@ -148,9 +148,6 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer @Override public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { - if (newPowerDemand == this.powerDemand) { - return; - } updateCounters(); this.powerDemand = newPowerDemand; @@ -160,9 +157,6 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer @Override public void handleSupply(FlowEdge supplierEdge, double newPowerSupply) { - if (newPowerSupply == this.powerSupplied) { - return; - } updateCounters(); this.powerSupplied = newPowerSupply; diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java index a87ded8d..25dc564f 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java +++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java @@ -130,6 +130,8 @@ public class Multiplexer extends FlowNode implements FlowSupplier, FlowConsumer this.consumerEdges.add(consumerEdge); this.demands.add(0.0); this.supplies.add(0.0); + + this.invalidate(); } @Override @@ -137,6 +139,8 @@ public class Multiplexer extends FlowNode implements FlowSupplier, FlowConsumer this.supplierEdge = supplierEdge; this.capacity = supplierEdge.getCapacity(); this.totalSupply = 0; + + this.invalidate(); } @Override @@ -176,15 +180,12 @@ public class Multiplexer extends FlowNode implements FlowSupplier, FlowConsumer demands.set(idx, newDemand); this.totalDemand += (newDemand - prevDemand); + this.invalidate(); } @Override public void handleSupply(FlowEdge supplierEdge, double newSupply) { - if (newSupply == this.totalSupply) { - return; - } - - this.totalSupply = newSupply; + this.invalidate(); } @Override |
