Show when I2 is unavailable

This commit is contained in:
Gunnar Skjold
2023-12-21 14:50:20 +01:00
parent 859868c99b
commit 378b67a5bd
9 changed files with 54 additions and 52 deletions

View File

@@ -1346,7 +1346,7 @@ bool readHanPort() {
data = new IEC6205675(payload, meterState.getMeterType(), &meterConfig, ctx, meterState);
}
} else if(ctx.type == DATA_TAG_DSMR) {
data = new IEC6205621(payload, tz);
data = new IEC6205621(payload, tz, &meterConfig);
}
len = 0;

View File

@@ -100,10 +100,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
if(listType >= 2 && memcmp(meterModel.c_str(), "MA304T3", 7) == 0) {
l2voltage = sqrt(pow(l1voltage - l3voltage * cos(60 * (PI/180)), 2) + pow(l3voltage * sin(60 * (PI/180)),2));
if(l2voltage > 0) {
l2current = ((activeImportPower - activeExportPower) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
l2currentEstimated = true;
}
l2currentMissing = true;
}
if(listType == 3) {
@@ -297,6 +294,8 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
if(val != NOVALUE) {
listType = 2;
l2current = val;
} else if(listType == 2) {
l2currentMissing = true;
}
val = getNumber(AMS_OBIS_CURRENT_L3, sizeof(AMS_OBIS_CURRENT_L3), ((char *) (d)));
if(val != NOVALUE) {
@@ -487,15 +486,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
// Special case for Norwegian IT/TT meters that does not report all values
if(meterConfig->distributionSystem == 1) {
if(threePhase) {
if(l2current == 0.0 && l1current > 0.0 && l3current > 0.0) {
l2current = ((activeImportPower - activeExportPower) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
if(activeExportPower == 0.0) {
l2current = max((float) 0.0, l2current);
}
l2currentEstimated = true;
}
} else if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) {
if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) {
l2voltage = sqrt(pow(l1voltage - l3voltage * cos(60.0 * (PI/180.0)), 2) + pow(l3voltage * sin(60.0 * (PI/180.0)),2));
threePhase = true;
}