Various changes

This commit is contained in:
Gunnar Skjold 2022-02-04 17:35:47 +01:00
parent dd87d70876
commit 5be921a342
11 changed files with 24 additions and 13 deletions

View File

@ -2,7 +2,7 @@
1.1.2.8.0.255 - Active- Energy
1.1.3.8.0.255 - Reactive+ Energy
1.1.4.8.0.255 - Reactive- Energy
1.1.0.0.1.255 - Electricity ID?
1.1.0.0.1.255 - Meter number 1
1.1.1.7.0.255 - Active+ Instantaneous value
1.1.2.7.0.255 - Active- Instantaneous value
1.1.3.7.0.255 - Reactive+ Instantaneous value

Binary file not shown.

View File

@ -69,7 +69,7 @@ protected:
String listId, meterId, meterModel;
time_t meterTimestamp = 0;
uint16_t activeImportPower = 0, reactiveImportPower = 0, activeExportPower = 0, reactiveExportPower = 0;
float l1voltage = 0, l2voltage = 0, l3voltage = 0, l1current = 0, l2current = 0, l3current = 0;
double l1voltage = 0, l2voltage = 0, l3voltage = 0, l1current = 0, l2current = 0, l3current = 0;
float powerFactor = 0, l1PowerFactor = 0, l2PowerFactor = 0, l3PowerFactor = 0;
float activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0;
bool threePhase = false, twoPhase = false, counterEstimated = false;

View File

@ -253,7 +253,7 @@ void AmsDataStorage::setHour(uint8_t hour, int32_t val) {
day.points[hour] = val / 10;
}
int16_t AmsDataStorage::getHour(uint8_t hour) {
int32_t AmsDataStorage::getHour(uint8_t hour) {
if(hour < 0 || hour > 24) return 0;
return day.points[hour] * 10;
}

View File

@ -28,7 +28,7 @@ public:
AmsDataStorage(RemoteDebug*);
void setTimezone(Timezone*);
bool update(AmsData*);
int16_t getHour(uint8_t);
int32_t getHour(uint8_t);
int32_t getDay(uint8_t);
bool load();
bool save();

View File

@ -18,7 +18,7 @@ ADC_MODE(ADC_VCC);
#if defined(ESP32)
#include <esp_task_wdt.h>
#endif
#define WDT_TIMEOUT 30
#define WDT_TIMEOUT 60
#include "AmsToMqttBridge.h"
#include "AmsStorage.h"

View File

@ -308,6 +308,17 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, uint8_t distribution
l2PowerFactor /= 100;
if(l3PowerFactor != 0)
l3PowerFactor /= 100;
int adiv = 1;
int watt = abs((l1voltage * l1current) + (l2voltage * l2current) + (l3voltage * l3current));
while(watt / (activeImportPower + activeExportPower + reactiveImportPower + reactiveExportPower) > 2) {
adiv *= 10;
watt /= 10;
}
l1current = l1current != 0 ? l1current / adiv : 0;
l2current = l2current != 0 ? l2current / adiv : 0;
l3current = l3current != 0 ? l3current / adiv : 0;
} else if(meterType == AmsTypeSagemcom) {
CosemData* meterTs = getCosemDataAt(1, ((char *) (d)));
if(meterTs != NULL) {
@ -344,7 +355,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, uint8_t distribution
if(l2current == 0.0 && l1current > 0.0 && l3current > 0.0) {
l2current = (((activeImportPower - activeExportPower) * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
if(activeExportPower == 0.0) {
l2current = max((float) 0.0, l2current);
l2current = max((double) 0.0, l2current);
}
}
} else if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) {

View File

@ -268,7 +268,7 @@ int HDLC_validate(const uint8_t* d, int length, HDLCConfig* config, CosemDateTim
} else if(dateTime->base.type == CosemTypeDateTime) {
memcpy(timestamp, ptr, dateTime->base.length);
} else if(dateTime->base.type == 0x0C) { // Kamstrup bug...
memcpy(timestamp, ptr, 0x0C);
memcpy(timestamp, ptr, 0x13);
ptr += 13;
} else {
return HDLC_TIMESTAMP_UNKNOWN;

View File

@ -13,7 +13,7 @@ EntsoeApi::EntsoeApi(RemoteDebug* Debug) {
client.setInsecure();
https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
https.setTimeout(20000);
https.setTimeout(50000);
// Entso-E uses CET/CEST
TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120};

View File

@ -726,19 +726,19 @@ var fetch = function() {
var a = 0;
var r = 1;
var arr = [['Phase', 'Amperage', { role: 'style' }, { role: 'annotation' }]];
if(json.i1) {
if(json.i1 || json.u1) {
var i1 = parseFloat(json.i1);
a = Math.max(a, i1);
var pct = (parseFloat(json.i1)/parseInt(json.mf))*100;
arr[r++] = ['L1', pct, "color: " + ampcol(pct) + ";opacity: 0.9;", i1 + "A"];
}
if(json.i2) {
if(json.i2 || json.u2) {
var i2 = parseFloat(json.i2);
a = Math.max(a, i2);
var pct = (parseFloat(json.i2)/parseInt(json.mf))*100;
arr[r++] = ['L2', pct, "color: " + ampcol(pct) + ";opacity: 0.9;", i2 + "A"];
}
if(json.i3) {
if(json.i3 || json.u3) {
var i3 = parseFloat(json.i3);
a = Math.max(a, i3);
var pct = (parseFloat(json.i3)/parseInt(json.mf))*100;

View File

@ -44,8 +44,8 @@
<div class="text-center overlay-plot">
<div id="xp" class="plot1"></div>
<span class="plot-overlay">
<span class="xpo">{PO}</span>
<span class="xpoa">W</span>
<span class="epo">{PO}</span>
<span class="epoa">W</span>
<br/>
<span class="pol">Export</span>
</span>