mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-04-28 04:55:46 +00:00
Various changes
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
1.1.2.8.0.255 - Active- Energy
|
1.1.2.8.0.255 - Active- Energy
|
||||||
1.1.3.8.0.255 - Reactive+ Energy
|
1.1.3.8.0.255 - Reactive+ Energy
|
||||||
1.1.4.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.1.7.0.255 - Active+ Instantaneous value
|
||||||
1.1.2.7.0.255 - Active- Instantaneous value
|
1.1.2.7.0.255 - Active- Instantaneous value
|
||||||
1.1.3.7.0.255 - Reactive+ Instantaneous value
|
1.1.3.7.0.255 - Reactive+ Instantaneous value
|
||||||
|
|||||||
BIN
doc/omnipower.technical.description.pdf
Normal file
BIN
doc/omnipower.technical.description.pdf
Normal file
Binary file not shown.
@@ -69,7 +69,7 @@ protected:
|
|||||||
String listId, meterId, meterModel;
|
String listId, meterId, meterModel;
|
||||||
time_t meterTimestamp = 0;
|
time_t meterTimestamp = 0;
|
||||||
uint16_t activeImportPower = 0, reactiveImportPower = 0, activeExportPower = 0, reactiveExportPower = 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 powerFactor = 0, l1PowerFactor = 0, l2PowerFactor = 0, l3PowerFactor = 0;
|
||||||
float activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0;
|
float activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0;
|
||||||
bool threePhase = false, twoPhase = false, counterEstimated = false;
|
bool threePhase = false, twoPhase = false, counterEstimated = false;
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ void AmsDataStorage::setHour(uint8_t hour, int32_t val) {
|
|||||||
day.points[hour] = val / 10;
|
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;
|
if(hour < 0 || hour > 24) return 0;
|
||||||
return day.points[hour] * 10;
|
return day.points[hour] * 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
AmsDataStorage(RemoteDebug*);
|
AmsDataStorage(RemoteDebug*);
|
||||||
void setTimezone(Timezone*);
|
void setTimezone(Timezone*);
|
||||||
bool update(AmsData*);
|
bool update(AmsData*);
|
||||||
int16_t getHour(uint8_t);
|
int32_t getHour(uint8_t);
|
||||||
int32_t getDay(uint8_t);
|
int32_t getDay(uint8_t);
|
||||||
bool load();
|
bool load();
|
||||||
bool save();
|
bool save();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ ADC_MODE(ADC_VCC);
|
|||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
#include <esp_task_wdt.h>
|
#include <esp_task_wdt.h>
|
||||||
#endif
|
#endif
|
||||||
#define WDT_TIMEOUT 30
|
#define WDT_TIMEOUT 60
|
||||||
|
|
||||||
#include "AmsToMqttBridge.h"
|
#include "AmsToMqttBridge.h"
|
||||||
#include "AmsStorage.h"
|
#include "AmsStorage.h"
|
||||||
|
|||||||
@@ -308,6 +308,17 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, uint8_t distribution
|
|||||||
l2PowerFactor /= 100;
|
l2PowerFactor /= 100;
|
||||||
if(l3PowerFactor != 0)
|
if(l3PowerFactor != 0)
|
||||||
l3PowerFactor /= 100;
|
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) {
|
} else if(meterType == AmsTypeSagemcom) {
|
||||||
CosemData* meterTs = getCosemDataAt(1, ((char *) (d)));
|
CosemData* meterTs = getCosemDataAt(1, ((char *) (d)));
|
||||||
if(meterTs != NULL) {
|
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) {
|
if(l2current == 0.0 && l1current > 0.0 && l3current > 0.0) {
|
||||||
l2current = (((activeImportPower - activeExportPower) * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
|
l2current = (((activeImportPower - activeExportPower) * sqrt(3)) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
|
||||||
if(activeExportPower == 0.0) {
|
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) {
|
} else if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) {
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ int HDLC_validate(const uint8_t* d, int length, HDLCConfig* config, CosemDateTim
|
|||||||
} else if(dateTime->base.type == CosemTypeDateTime) {
|
} else if(dateTime->base.type == CosemTypeDateTime) {
|
||||||
memcpy(timestamp, ptr, dateTime->base.length);
|
memcpy(timestamp, ptr, dateTime->base.length);
|
||||||
} else if(dateTime->base.type == 0x0C) { // Kamstrup bug...
|
} else if(dateTime->base.type == 0x0C) { // Kamstrup bug...
|
||||||
memcpy(timestamp, ptr, 0x0C);
|
memcpy(timestamp, ptr, 0x13);
|
||||||
ptr += 13;
|
ptr += 13;
|
||||||
} else {
|
} else {
|
||||||
return HDLC_TIMESTAMP_UNKNOWN;
|
return HDLC_TIMESTAMP_UNKNOWN;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ EntsoeApi::EntsoeApi(RemoteDebug* Debug) {
|
|||||||
|
|
||||||
client.setInsecure();
|
client.setInsecure();
|
||||||
https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
https.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
|
||||||
https.setTimeout(20000);
|
https.setTimeout(50000);
|
||||||
|
|
||||||
// Entso-E uses CET/CEST
|
// Entso-E uses CET/CEST
|
||||||
TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120};
|
TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120};
|
||||||
|
|||||||
@@ -726,19 +726,19 @@ var fetch = function() {
|
|||||||
var a = 0;
|
var a = 0;
|
||||||
var r = 1;
|
var r = 1;
|
||||||
var arr = [['Phase', 'Amperage', { role: 'style' }, { role: 'annotation' }]];
|
var arr = [['Phase', 'Amperage', { role: 'style' }, { role: 'annotation' }]];
|
||||||
if(json.i1) {
|
if(json.i1 || json.u1) {
|
||||||
var i1 = parseFloat(json.i1);
|
var i1 = parseFloat(json.i1);
|
||||||
a = Math.max(a, i1);
|
a = Math.max(a, i1);
|
||||||
var pct = (parseFloat(json.i1)/parseInt(json.mf))*100;
|
var pct = (parseFloat(json.i1)/parseInt(json.mf))*100;
|
||||||
arr[r++] = ['L1', pct, "color: " + ampcol(pct) + ";opacity: 0.9;", i1 + "A"];
|
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);
|
var i2 = parseFloat(json.i2);
|
||||||
a = Math.max(a, i2);
|
a = Math.max(a, i2);
|
||||||
var pct = (parseFloat(json.i2)/parseInt(json.mf))*100;
|
var pct = (parseFloat(json.i2)/parseInt(json.mf))*100;
|
||||||
arr[r++] = ['L2', pct, "color: " + ampcol(pct) + ";opacity: 0.9;", i2 + "A"];
|
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);
|
var i3 = parseFloat(json.i3);
|
||||||
a = Math.max(a, i3);
|
a = Math.max(a, i3);
|
||||||
var pct = (parseFloat(json.i3)/parseInt(json.mf))*100;
|
var pct = (parseFloat(json.i3)/parseInt(json.mf))*100;
|
||||||
|
|||||||
@@ -44,8 +44,8 @@
|
|||||||
<div class="text-center overlay-plot">
|
<div class="text-center overlay-plot">
|
||||||
<div id="xp" class="plot1"></div>
|
<div id="xp" class="plot1"></div>
|
||||||
<span class="plot-overlay">
|
<span class="plot-overlay">
|
||||||
<span class="xpo">{PO}</span>
|
<span class="epo">{PO}</span>
|
||||||
<span class="xpoa">W</span>
|
<span class="epoa">W</span>
|
||||||
<br/>
|
<br/>
|
||||||
<span class="pol">Export</span>
|
<span class="pol">Export</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user