Initial changes for v2.3

This commit is contained in:
Gunnar Skjold
2023-11-16 18:21:56 +01:00
parent 8cada69aaf
commit ae82914795
121 changed files with 6175 additions and 3080 deletions

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "AmsData.h"
AmsData::AmsData() {}
@@ -82,6 +88,91 @@ void AmsData::apply(AmsData& other) {
this->activeExportPower = other.getActiveExportPower();
}
void AmsData::apply(OBIS_code_t obis, double value) {
switch(obis.gr) {
case 1:
switch(obis.sensor) {
case 7:
switch(obis.tariff) {
case 0:
activeImportPower = value;
listType = max(listType, (uint8_t) 1);
break;
}
break;
case 8:
switch(obis.tariff) {
case 0:
activeImportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
}
break;
}
break;
case 2:
switch(obis.sensor) {
case 7:
switch(obis.tariff) {
case 0:
activeExportPower = value;
listType = max(listType, (uint8_t) 2);
break;
}
break;
case 8:
switch(obis.tariff) {
case 0:
activeExportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
}
break;
}
break;
case 3:
switch(obis.sensor) {
case 7:
switch(obis.tariff) {
case 0:
reactiveImportPower = value;
listType = max(listType, (uint8_t) 2);
break;
}
break;
case 8:
switch(obis.tariff) {
case 0:
reactiveImportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
}
break;
}
break;
case 4:
switch(obis.sensor) {
case 7:
switch(obis.tariff) {
case 0:
reactiveExportPower = value;
listType = max(listType, (uint8_t) 2);
break;
}
break;
case 8:
switch(obis.tariff) {
case 0:
reactiveExportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
}
break;
}
break;
}
}
uint64_t AmsData::getLastUpdateMillis() {
return this->lastUpdateMillis;
}
@@ -218,6 +309,10 @@ bool AmsData::isTwoPhase() {
return this->twoPhase;
}
bool AmsData::isCounterEstimated() {
return this->counterEstimated;
}
int8_t AmsData::getLastError() {
return lastErrorCount > 2 ? lastError : 0;
}