Validate charger phase wiring during charging (#2739)

This commit is contained in:
premultiply 2022-03-02 17:47:47 +01:00 • committed by GitHub
parent de0c81280c
commit a6039c23b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1285,12 +1285,14 @@ func (lp *LoadPoint) updateChargeCurrents() {
lp.publish("chargeCurrents", lp.chargeCurrents)
if lp.charging() {
// Quine-McCluskey for (¬L1∧L2∧¬L3) ∨ (¬L1∧¬L2∧L3) ∨ (L1∧¬L2∧L3) ∨ (¬L1∧L2∧L3) -> ¬L1 ∧ L2 ∨ ¬L2 ∧ L3
if !(i1 > minActiveCurrent) && (i2 > minActiveCurrent) || !(i2 > minActiveCurrent) && (i3 > minActiveCurrent) {
lp.log.WARN.Printf("invalid phase wiring between charge meter and vehicle")
}
var phases int
for l, i := range lp.chargeCurrents {
if i >= minActiveCurrent {
if l > 0 && phases == 0 {
lp.log.WARN.Printf("invalid wiring: phase %d observed active should be first phase", l+1)
}
for _, i := range lp.chargeCurrents {
if i > minActiveCurrent {
phases++
}
}