Skip to content

Commit

Permalink
Fix phase dependent min/max power estimate (evcc-io#9895)
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis authored Sep 16, 2023
1 parent b5c8b93 commit 32e5be7
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions assets/js/components/LoadpointSettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ import formatter from "../mixins/formatter";
const V = 230;
const PHASES_AUTO = 0;
const PHASES_1 = 1;
const PHASES_3 = 3;
const range = (start, stop, step = -1) =>
Array.from({ length: (stop - start) / step + 1 }, (_, i) => start + i * step);
Expand Down Expand Up @@ -226,19 +230,31 @@ export default {
return this.fmtKw(this.minCurrent * V * 3);
},
maxPower: function () {
if (this.phasesConfigured === 3) {
return this.maxPower3p;
}
if (this.phasesConfigured === 1) {
return this.maxPower1p;
switch (this.phasesConfigured) {
case PHASES_AUTO:
return this.maxPower3p;
case PHASES_3:
return this.maxPower3p;
case PHASES_1:
return this.maxPower1p;
default:
return this.fmtKw(this.maxCurrent * V * this.phasesActive);
}
return this.fmtKw(this.maxCurrent * V * this.phasesActive);
},
minPower: function () {
return this.phasesConfigured === 3 ? this.minPower3p : this.minPower1p;
switch (this.phasesConfigured) {
case PHASES_AUTO:
return this.minPower1p;
case PHASES_3:
return this.minPower3p;
case PHASES_1:
return this.minPower1p;
default:
return this.fmtKw(this.minCurrent * V * this.phasesActive);
}
},
showConfigurablePhases: function () {
return [0, 1, 3].includes(this.phasesConfigured);
return [PHASES_AUTO, PHASES_3, PHASES_1].includes(this.phasesConfigured);
},
showCurrentSettings: function () {
return this.$hiddenFeatures();
Expand Down

0 comments on commit 32e5be7

Please sign in to comment.