mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-24 19:40:33 +00:00
More changes for slovakian iskra
This commit is contained in:
@@ -14,14 +14,17 @@ enum CosemType {
|
|||||||
CosemTypeNull = 0x00,
|
CosemTypeNull = 0x00,
|
||||||
CosemTypeArray = 0x01,
|
CosemTypeArray = 0x01,
|
||||||
CosemTypeStructure = 0x02,
|
CosemTypeStructure = 0x02,
|
||||||
|
CosemTypeBoolean = 0x03,
|
||||||
CosemTypeOctetString = 0x09,
|
CosemTypeOctetString = 0x09,
|
||||||
CosemTypeString = 0x0A,
|
CosemTypeString = 0x0A,
|
||||||
CosemTypeDLongSigned = 0x05,
|
CosemTypeDLongSigned = 0x05,
|
||||||
CosemTypeDLongUnsigned = 0x06,
|
CosemTypeDLongUnsigned = 0x06,
|
||||||
CosemTypeLongSigned = 0x10,
|
CosemTypeLongSigned = 0x10,
|
||||||
|
CosemTypeUnsigned = 0x11,
|
||||||
CosemTypeLongUnsigned = 0x12,
|
CosemTypeLongUnsigned = 0x12,
|
||||||
CosemTypeLong64Signed = 0x14,
|
CosemTypeLong64Signed = 0x14,
|
||||||
CosemTypeLong64Unsigned = 0x15,
|
CosemTypeLong64Unsigned = 0x15,
|
||||||
|
CosemTypeEnum = 0x16,
|
||||||
CosemTypeDateTime = 0x19
|
CosemTypeDateTime = 0x19
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -224,108 +224,304 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
|||||||
|
|
||||||
lastUpdateMillis = millis64();
|
lastUpdateMillis = millis64();
|
||||||
} else if(data->base.length == 0x0C) {
|
} else if(data->base.length == 0x0C) {
|
||||||
apply(state);
|
CosemData* no3 = getCosemDataAt(3, ((char *) (d)));
|
||||||
listType = state.getListType() > 3 ? state.getListType() : 3;
|
if(no3->base.type == CosemTypeBoolean) {
|
||||||
|
apply(state);
|
||||||
|
listType = state.getListType() > 3 ? state.getListType() : 3;
|
||||||
|
|
||||||
// 42.0.0 COSEM logical device name
|
// 42.0.0 COSEM logical device name
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
// 96.1.3 Device ID 4
|
// 96.1.3 Device ID 4
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
memcpy(str, data->oct.data, data->oct.length);
|
memcpy(str, data->oct.data, data->oct.length);
|
||||||
str[data->oct.length] = 0x00;
|
str[data->oct.length] = 0x00;
|
||||||
meterId = String(str);
|
meterId = String(str);
|
||||||
|
|
||||||
// 96.3.10 Disconnect control
|
// 96.3.10 Disconnect control
|
||||||
// 96.14.0 Currently acrive energy tariff
|
// 96.14.0 Currently acrive energy tariff
|
||||||
idx += 2;
|
idx += 2;
|
||||||
|
|
||||||
// 1.8.0
|
// 1.8.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
activeImportCounter = ntohl(data->dlu.data) / 1000.0;
|
activeImportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
// 1.8.1
|
// 1.8.1
|
||||||
// 1.8.2
|
// 1.8.2
|
||||||
idx += 2;
|
idx += 2;
|
||||||
|
|
||||||
// 2.8.0
|
// 2.8.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
activeExportCounter = ntohl(data->dlu.data) / 1000.0;
|
activeExportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
// 2.8.1
|
// 2.8.1
|
||||||
// 2.8.2
|
// 2.8.2
|
||||||
idx += 2;
|
idx += 2;
|
||||||
|
|
||||||
// 3.8.0
|
// 3.8.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
reactiveImportCounter = ntohl(data->dlu.data) / 1000.0;
|
reactiveImportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
// 4.8.0
|
// 4.8.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
reactiveExportCounter = ntohl(data->dlu.data) / 1000.0;
|
reactiveExportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
lastUpdateMillis = millis64();
|
lastUpdateMillis = millis64();
|
||||||
|
} else if(no3->base.type == CosemTypeLongUnsigned) {
|
||||||
|
apply(state);
|
||||||
|
listType = state.getListType() > 2 ? state.getListType() : 2;
|
||||||
|
|
||||||
|
// 42.0.0 COSEM logical device name
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// 96.1.2 Device ID 3
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
memcpy(str, data->oct.data, data->oct.length);
|
||||||
|
str[data->oct.length] = 0x00;
|
||||||
|
meterId = String(str);
|
||||||
|
|
||||||
|
// 32.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1voltage = ntohs(data->lu.data) / 10.0;
|
||||||
|
|
||||||
|
// 52.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l2voltage = ntohs(data->lu.data) / 10.0;
|
||||||
|
|
||||||
|
// 72.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l3voltage = ntohs(data->lu.data) / 10.0;
|
||||||
|
|
||||||
|
// 31.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1current = ntohs(data->lu.data) / 100.0;
|
||||||
|
|
||||||
|
// 51.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l2current = ntohs(data->lu.data) / 100.0;
|
||||||
|
|
||||||
|
// 71.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l3current = ntohs(data->lu.data) / 100.0;
|
||||||
|
|
||||||
|
// 1.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 2.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 3.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
reactiveImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 4.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
reactiveExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
lastUpdateMillis = millis64();
|
||||||
|
}
|
||||||
} else if(data->base.length == 0x0A) {
|
} else if(data->base.length == 0x0A) {
|
||||||
apply(state);
|
CosemData* no7 = getCosemDataAt(7, ((char *) (d)));
|
||||||
listType = state.getListType() > 3 ? state.getListType() : 3;
|
if(no7->base.type == CosemTypeLongUnsigned) {
|
||||||
|
apply(state);
|
||||||
|
listType = state.getListType() > 2 ? state.getListType() : 2;
|
||||||
|
|
||||||
|
// 42.0.0 COSEM logical device name
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// 96.1.2 Device ID 3
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
memcpy(str, data->oct.data, data->oct.length);
|
||||||
|
str[data->oct.length] = 0x00;
|
||||||
|
meterId = String(str);
|
||||||
|
|
||||||
|
// 1.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 2.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 3.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
reactiveImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 4.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
reactiveExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 32.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1voltage = ntohs(data->lu.data) / 10.0;
|
||||||
|
|
||||||
|
// 31.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1current = ntohs(data->lu.data) / 100.0;
|
||||||
|
|
||||||
|
// 21.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1activeImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 22.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1activeExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
lastUpdateMillis = millis64();
|
||||||
|
} else if(no7->base.type == CosemTypeDLongUnsigned) {
|
||||||
|
apply(state);
|
||||||
|
listType = state.getListType() > 3 ? state.getListType() : 3;
|
||||||
|
|
||||||
|
// 42.0.0 COSEM logical device name
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// 96.1.3 Device ID 4
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
memcpy(str, data->oct.data, data->oct.length);
|
||||||
|
str[data->oct.length] = 0x00;
|
||||||
|
meterId = String(str);
|
||||||
|
|
||||||
|
// 1.8.1
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis181 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 1.8.2
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis182 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
activeImportCounter = obis181 + obis182;
|
||||||
|
|
||||||
|
// 2.8.1
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis281 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 2.8.2
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis282 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
activeExportCounter = obis281 + obis282;
|
||||||
|
|
||||||
|
// 3.8.1
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis381 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 3.8.2
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis382 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
reactiveImportCounter = obis381 + obis382;
|
||||||
|
|
||||||
|
// 4.8.1
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis481 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 4.8.2
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis482 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
reactiveExportCounter = obis481 + obis482;
|
||||||
|
|
||||||
|
lastUpdateMillis = millis64();
|
||||||
|
}
|
||||||
|
} else if(data->base.length == 0x09) {
|
||||||
|
CosemData* no7 = getCosemDataAt(7, ((char *) (d)));
|
||||||
|
if(no7->base.type == CosemTypeLongUnsigned) {
|
||||||
|
apply(state);
|
||||||
|
listType = state.getListType() > 3 ? state.getListType() : 3;
|
||||||
|
|
||||||
|
// 42.0.0 COSEM logical device name
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// 96.1.2 Device ID 3
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
memcpy(str, data->oct.data, data->oct.length);
|
||||||
|
str[data->oct.length] = 0x00;
|
||||||
|
meterId = String(str);
|
||||||
|
|
||||||
|
// 1.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 2.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 3.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
reactiveImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 4.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
reactiveExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 32.7.0
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
l1voltage = ntohs(data->lu.data) / 10.0;
|
||||||
|
|
||||||
|
// 2.8.1
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis281 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 2.8.2
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
double obis282 = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
activeExportCounter = obis281 + obis282;
|
||||||
|
|
||||||
|
lastUpdateMillis = millis64();
|
||||||
|
} else if(no7->base.type == CosemTypeDLongUnsigned) {
|
||||||
|
apply(state);
|
||||||
|
listType = state.getListType() > 3 ? state.getListType() : 3;
|
||||||
|
|
||||||
|
// 42.0.0 COSEM logical device name?
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// 1.7.0?
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeImportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 2.7.0?
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
|
// 1.8.0?
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeImportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 1.8.1?
|
||||||
|
// 1.8.2?
|
||||||
|
idx += 2;
|
||||||
|
|
||||||
|
// 2.8.0?
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeExportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 2.8.1?
|
||||||
|
// 2.8.2?
|
||||||
|
idx += 2;
|
||||||
|
|
||||||
|
lastUpdateMillis = millis64();
|
||||||
|
}
|
||||||
|
} else if(data->base.length == 0x08) {
|
||||||
// 42.0.0 COSEM logical device name
|
// 42.0.0 COSEM logical device name
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
// 96.1.2 Device ID 3
|
// 96.1.2 Device ID 3
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
memcpy(str, data->oct.data, data->oct.length);
|
memcpy(str, data->oct.data, data->oct.length);
|
||||||
str[data->oct.length] = 0x00;
|
str[data->oct.length] = 0x00;
|
||||||
meterId = String(str);
|
meterId = String(str);
|
||||||
|
|
||||||
// 1.7.0
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
activeImportPower = ntohl(data->dlu.data);
|
|
||||||
|
|
||||||
// 2.7.0
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
activeExportPower = ntohl(data->dlu.data);
|
|
||||||
|
|
||||||
// 3.7.0
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
reactiveImportPower = ntohl(data->dlu.data);
|
|
||||||
|
|
||||||
// 4.7.0
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
reactiveExportPower = ntohl(data->dlu.data);
|
|
||||||
|
|
||||||
// 32.7.0
|
// 32.7.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
l1voltage = ntohs(data->lu.data) / 10.0;
|
l1voltage = ntohs(data->lu.data) / 10.0;
|
||||||
|
|
||||||
// Current?
|
// 31.7.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
l1current = ntohs(data->lu.data) / 100.0;
|
l1current = ntohs(data->lu.data) / 100.0;
|
||||||
|
|
||||||
// 2.8.1
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
double obis281 = ntohl(data->dlu.data) / 1000.0;
|
|
||||||
|
|
||||||
// 2.8.2
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
double obis282 = ntohl(data->dlu.data) / 1000.0;
|
|
||||||
|
|
||||||
activeExportCounter = obis281 + obis282;
|
|
||||||
|
|
||||||
lastUpdateMillis = millis64();
|
|
||||||
} else if(data->base.length == 0x09) {
|
|
||||||
apply(state);
|
|
||||||
listType = state.getListType() > 3 ? state.getListType() : 3;
|
|
||||||
|
|
||||||
// 42.0.0 COSEM logical device name
|
|
||||||
idx++;
|
|
||||||
|
|
||||||
// 96.1.2 Device ID 3
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
memcpy(str, data->oct.data, data->oct.length);
|
|
||||||
str[data->oct.length] = 0x00;
|
|
||||||
meterId = String(str);
|
|
||||||
|
|
||||||
// 1.7.0
|
// 1.7.0
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
activeImportPower = ntohl(data->dlu.data);
|
activeImportPower = ntohl(data->dlu.data);
|
||||||
@@ -342,21 +538,21 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
|||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
reactiveExportPower = ntohl(data->dlu.data);
|
reactiveExportPower = ntohl(data->dlu.data);
|
||||||
|
|
||||||
// 32.7.0
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
l1voltage = ntohs(data->lu.data) / 10.0;
|
|
||||||
|
|
||||||
// 2.8.1
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
double obis281 = ntohl(data->dlu.data) / 1000.0;
|
|
||||||
|
|
||||||
// 2.8.2
|
|
||||||
data = getCosemDataAt(idx++, ((char *) (d)));
|
|
||||||
double obis282 = ntohl(data->dlu.data) / 1000.0;
|
|
||||||
|
|
||||||
activeExportCounter = obis281 + obis282;
|
|
||||||
|
|
||||||
lastUpdateMillis = millis64();
|
lastUpdateMillis = millis64();
|
||||||
|
} else if(data->base.length == 0x04) {
|
||||||
|
// ?
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// ?
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
// 1.8.0?
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeImportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
|
|
||||||
|
// 2.8.0?
|
||||||
|
data = getCosemDataAt(idx++, ((char *) (d)));
|
||||||
|
activeExportCounter = ntohl(data->dlu.data) / 1000.0;
|
||||||
}
|
}
|
||||||
} else if(useMeterType == AmsTypeIskra && data->base.type == CosemTypeOctetString) { // Iskra special case
|
} else if(useMeterType == AmsTypeIskra && data->base.type == CosemTypeOctetString) { // Iskra special case
|
||||||
meterType = AmsTypeIskra;
|
meterType = AmsTypeIskra;
|
||||||
|
|||||||
Reference in New Issue
Block a user