From 83b9deb5fab12cda63ca99c492b395ab04af6da8 Mon Sep 17 00:00:00 2001 From: Simon Fey Date: Wed, 13 Apr 2022 08:45:06 +0200 Subject: [PATCH] build dcdischarge sum out of hybridess channel instead of plain calculation --- .../src/io/openems/edge/core/sum/SumImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/io.openems.edge.core/src/io/openems/edge/core/sum/SumImpl.java b/io.openems.edge.core/src/io/openems/edge/core/sum/SumImpl.java index 0c2ab3c0ac0..6d0e19c349b 100644 --- a/io.openems.edge.core/src/io/openems/edge/core/sum/SumImpl.java +++ b/io.openems.edge.core/src/io/openems/edge/core/sum/SumImpl.java @@ -135,7 +135,8 @@ private void calculateChannelValues() { final var essDcChargeEnergy = new CalculateLongSum(); final var essDcDischargeEnergy = new CalculateLongSum(); final var essCapacity = new CalculateIntegerSum(); - + final var essDcDischargePower = new CalculateIntegerSum(); + // Grid final var gridActivePower = new CalculateIntegerSum(); final var gridActivePowerL1 = new CalculateIntegerSum(); @@ -156,6 +157,7 @@ private void calculateChannelValues() { final var productionMaxDcActualPower = new CalculateIntegerSum(); final var productionAcActiveEnergy = new CalculateLongSum(); final var productionDcActiveEnergy = new CalculateLongSum(); + // handling the corner-case of wrongly measured negative production, due to // cabling errors, etc. final var productionAcActiveEnergyNegative = new CalculateLongSum(); @@ -195,6 +197,7 @@ private void calculateChannelValues() { var e = (HybridEss) ess; essDcChargeEnergy.addValue(e.getDcChargeEnergyChannel()); essDcDischargeEnergy.addValue(e.getDcDischargeEnergyChannel()); + essDcDischargePower.addValue(e.getDcDischargePowerChannel()); } else { essDcChargeEnergy.addValue(ess.getActiveChargeEnergyChannel()); essDcDischargeEnergy.addValue(ess.getActiveDischargeEnergyChannel()); @@ -387,8 +390,9 @@ private void calculateChannelValues() { Optional.ofNullable(enterTheSystem).orElse(0L) - Optional.ofNullable(leaveTheSystem).orElse(0L)); // Further calculated Channels + var essDischargePowerSum = essDcDischargePower.calculate(); this.getEssDischargePowerChannel() - .setNextValue(TypeUtils.subtract(essActivePowerSum, productionDcActualPowerSum)); + .setNextValue(essDischargePowerSum); } /**