Initialize all meter data to 0. Removed calculations for i2

This commit is contained in:
Gunnar Skjold
2020-02-26 09:06:29 +01:00
parent 5b94d8ff61
commit 8ade50c2a6
3 changed files with 10 additions and 9 deletions

View File

@@ -163,11 +163,12 @@ void AmsData::extractFromAidon(HanReader& hanReader, int listSize) {
activeExportPower = hanReader.getInt( (int)Aidon_List3PhaseIT::ActiveExportPower);
reactiveExportPower = hanReader.getInt( (int)Aidon_List3PhaseIT::ReactiveExportPower);
l1current = ((double) hanReader.getInt( (int)Aidon_List3PhaseIT::CurrentL1)) / 10;
l2current = 0;
l3current = ((double) hanReader.getInt( (int)Aidon_List3PhaseIT::CurrentL3)) / 10;
l1voltage = ((double) hanReader.getInt( (int)Aidon_List3PhaseIT::VoltageL1)) / 10;
l2voltage = ((double) hanReader.getInt( (int)Aidon_List3PhaseIT::VoltageL2)) / 10;
l3voltage = ((double) hanReader.getInt( (int)Aidon_List3PhaseIT::VoltageL3)) / 10;
l2current = ((activeImportPower * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
//l2current = ((activeImportPower * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
threePhase = true;
break;
}

View File

@@ -48,15 +48,15 @@ public:
bool isThreePhase();
private:
unsigned long lastUpdateMillis;
int listType;
unsigned long packageTimestamp;
unsigned long lastUpdateMillis = 0;
int listType = 0;
unsigned long packageTimestamp = 0;
String listId, meterId, meterType;
unsigned long meterTimestamp;
int activeImportPower, reactiveImportPower, activeExportPower, reactiveExportPower;
double l1voltage, l2voltage, l3voltage, l1current, l2current, l3current;
double activeImportCounter, reactiveImportCounter, activeExportCounter, reactiveExportCounter;
bool threePhase;
unsigned long meterTimestamp = 0;
int activeImportPower = 0, reactiveImportPower = 0, activeExportPower = 0, reactiveExportPower = 0;
double l1voltage = 0, l2voltage = 0, l3voltage = 0, l1current = 0, l2current = 0, l3current = 0;
double activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0;
bool threePhase = false;
void extractFromKaifa(HanReader& hanReader, int listSize);
void extractFromAidon(HanReader& hanReader, int listSize);