From 427346b56ccc93c8ead3615d08815328b5d171a4 Mon Sep 17 00:00:00 2001 From: cm0x4D Date: Wed, 16 Aug 2017 23:59:50 +0200 Subject: [PATCH] Fixes #753 --- src/main/java/mods/eln/sim/BatteryProcess.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/mods/eln/sim/BatteryProcess.java b/src/main/java/mods/eln/sim/BatteryProcess.java index daebfea69..7d2c9a031 100644 --- a/src/main/java/mods/eln/sim/BatteryProcess.java +++ b/src/main/java/mods/eln/sim/BatteryProcess.java @@ -29,8 +29,7 @@ public BatteryProcess(VoltageState positiveLoad, VoltageState negativeLoad, Func @Override public void process(double time) { -// Utils.print("*"); - Q -= voltageSource.getCurrent() * time / QNominal; + Q = Math.max(Q - voltageSource.getCurrent() * time / QNominal, 0); double voltage = computeVoltage();