Skip to content

Commit

Permalink
Improve calculation of _sum/EssDcDischargePower (#1800)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonfey authored Apr 26, 2022
1 parent 6b016a0 commit b1d60d5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit b1d60d5

Please sign in to comment.