From 1768292251957da5ce6411ecc7d2dffebf8709c8 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 10 Jun 2021 17:32:43 +0200 Subject: simulator: Integrate power subsystem with compute subsystem This change integrates the power subsystem of the simulator with the compute subsystem by exposing a new field on a SimBareMetalMachine, psu, which provides access to the machine's PSU, which in turn can be connected to a SimPowerOutlet. --- .../main/kotlin/org/opendc/simulator/resources/SimResourceSource.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'opendc-simulator/opendc-simulator-resources') diff --git a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimResourceSource.kt b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimResourceSource.kt index 9f062cc3..2f70e3cc 100644 --- a/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimResourceSource.kt +++ b/opendc-simulator/opendc-simulator-resources/src/main/kotlin/org/opendc/simulator/resources/SimResourceSource.kt @@ -44,7 +44,11 @@ public class SimResourceSource( } override fun onConsume(ctx: SimResourceControllableContext, work: Double, limit: Double, deadline: Long): Long { - return min(deadline, ctx.clock.millis() + getDuration(work, speed)) + return if (work.isInfinite()) { + Long.MAX_VALUE + } else { + min(deadline, ctx.clock.millis() + getDuration(work, speed)) + } } override fun onUpdate(ctx: SimResourceControllableContext, work: Double) { -- cgit v1.2.3