mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-02-26 17:04:20 +00:00
Show when I2 is unavailable
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
bool isThreePhase();
|
||||
bool isTwoPhase();
|
||||
bool isL2currentEstimated();
|
||||
bool isL2currentMissing();
|
||||
|
||||
int8_t getLastError();
|
||||
void setLastError(int8_t);
|
||||
@@ -86,7 +86,7 @@ protected:
|
||||
float l1activeExportPower = 0, l2activeExportPower = 0, l3activeExportPower = 0;
|
||||
float powerFactor = 0, l1PowerFactor = 0, l2PowerFactor = 0, l3PowerFactor = 0;
|
||||
double activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0;
|
||||
bool threePhase = false, twoPhase = false, counterEstimated = false, l2currentEstimated = false;
|
||||
bool threePhase = false, twoPhase = false, counterEstimated = false, l2currentMissing = false;;
|
||||
|
||||
int8_t lastError = 0x00;
|
||||
uint8_t lastErrorCount = 0;
|
||||
|
||||
@@ -67,7 +67,7 @@ void AmsData::apply(AmsData& other) {
|
||||
this->reactiveExportPower = other.getReactiveExportPower();
|
||||
this->l1current = other.getL1Current();
|
||||
this->l2current = other.getL2Current();
|
||||
this->l2currentEstimated = other.isL2currentEstimated();
|
||||
this->l2currentMissing = other.isL2currentMissing();
|
||||
this->l3current = other.getL3Current();
|
||||
this->l1voltage = other.getL1Voltage();
|
||||
this->l2voltage = other.getL2Voltage();
|
||||
@@ -219,8 +219,8 @@ bool AmsData::isTwoPhase() {
|
||||
return this->twoPhase;
|
||||
}
|
||||
|
||||
bool AmsData::isL2currentEstimated() {
|
||||
return this->l2currentEstimated;
|
||||
bool AmsData::isL2currentMissing() {
|
||||
return this->l2currentMissing;
|
||||
}
|
||||
|
||||
int8_t AmsData::getLastError() {
|
||||
|
||||
20
lib/SvelteUi/app/dist/index.js
vendored
20
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -13,12 +13,12 @@
|
||||
|
||||
let config = {};
|
||||
|
||||
function point(v,e) {
|
||||
function point(v) {
|
||||
return {
|
||||
label: fmtnum(v) + 'A',
|
||||
title: (e ? 'Estimated ' : '') + v.toFixed(1) + ' A',
|
||||
title: v.toFixed(1) + ' A',
|
||||
value: isNaN(v) ? 0 : v,
|
||||
color: ampcol(v ? (v)/(max)*100 : 0, e)
|
||||
color: ampcol(v ? (v)/(max)*100 : 0)
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,8 +30,19 @@
|
||||
points.push(point(i1));
|
||||
}
|
||||
if(u2 > 0) {
|
||||
xTicks.push({ label: 'L2' });
|
||||
points.push(point(i2, i2e));
|
||||
if(i2e) {
|
||||
xTicks.push({ label: 'L2' });
|
||||
points.push({
|
||||
label: 'N/A',
|
||||
labelAngle: 90,
|
||||
title: 'The value is not reported by your meter',
|
||||
value: 0,
|
||||
color: '#7c3aedcc'
|
||||
});
|
||||
} else {
|
||||
xTicks.push({ label: 'L2' });
|
||||
points.push(point(i2));
|
||||
}
|
||||
}
|
||||
if(u3 > 0) {
|
||||
xTicks.push({ label: 'L3' });
|
||||
|
||||
@@ -11,7 +11,7 @@ export function voltcol(volt) {
|
||||
return '#d90000';
|
||||
};
|
||||
|
||||
export function ampcol(pct, est) {
|
||||
export function ampcol(pct) {
|
||||
let col;
|
||||
if(pct > 90) col = '#d90000';
|
||||
else if(pct > 85) col = '#e32100';
|
||||
@@ -19,7 +19,7 @@ export function ampcol(pct, est) {
|
||||
else if(pct > 75) col = '#dcd800';
|
||||
else col = '#32d900';
|
||||
|
||||
return col+(est?'88':'');
|
||||
return col;
|
||||
};
|
||||
|
||||
export function exportcol(pct) {
|
||||
|
||||
@@ -17,21 +17,21 @@ export default defineConfig({
|
||||
plugins: [svelte()],
|
||||
server: {
|
||||
proxy: {
|
||||
"/data.json": "http://192.168.233.244",
|
||||
"/energyprice.json": "http://192.168.233.244",
|
||||
"/dayplot.json": "http://192.168.233.244",
|
||||
"/monthplot.json": "http://192.168.233.244",
|
||||
"/temperature.json": "http://192.168.233.244",
|
||||
"/sysinfo.json": "http://192.168.233.244",
|
||||
"/configuration.json": "http://192.168.233.244",
|
||||
"/tariff.json": "http://192.168.233.244",
|
||||
"/save": "http://192.168.233.244",
|
||||
"/reboot": "http://192.168.233.244",
|
||||
"/configfile": "http://192.168.233.244",
|
||||
"/upgrade": "http://192.168.233.244",
|
||||
"/mqtt-ca": "http://192.168.233.244",
|
||||
"/mqtt-cert": "http://192.168.233.244",
|
||||
"/mqtt-key": "http://192.168.233.244",
|
||||
"/data.json": "http://192.168.233.49",
|
||||
"/energyprice.json": "http://192.168.233.49",
|
||||
"/dayplot.json": "http://192.168.233.49",
|
||||
"/monthplot.json": "http://192.168.233.49",
|
||||
"/temperature.json": "http://192.168.233.49",
|
||||
"/sysinfo.json": "http://192.168.233.49",
|
||||
"/configuration.json": "http://192.168.233.49",
|
||||
"/tariff.json": "http://192.168.233.49",
|
||||
"/save": "http://192.168.233.49",
|
||||
"/reboot": "http://192.168.233.49",
|
||||
"/configfile": "http://192.168.233.49",
|
||||
"/upgrade": "http://192.168.233.49",
|
||||
"/mqtt-ca": "http://192.168.233.49",
|
||||
"/mqtt-cert": "http://192.168.233.49",
|
||||
"/mqtt-key": "http://192.168.233.49",
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -464,7 +464,7 @@ void AmsWebServer::dataJson() {
|
||||
meterState->getL3Voltage(),
|
||||
meterState->getL1Current(),
|
||||
meterState->getL2Current(),
|
||||
meterState->isL2currentEstimated() ? "true" : "false",
|
||||
meterState->isL2currentMissing() ? "true" : "false",
|
||||
meterState->getL3Current(),
|
||||
meterState->getPowerFactor(),
|
||||
meterState->getL1PowerFactor(),
|
||||
|
||||
@@ -1346,7 +1346,7 @@ bool readHanPort() {
|
||||
data = new IEC6205675(payload, meterState.getMeterType(), &meterConfig, ctx, meterState);
|
||||
}
|
||||
} else if(ctx.type == DATA_TAG_DSMR) {
|
||||
data = new IEC6205621(payload, tz);
|
||||
data = new IEC6205621(payload, tz, &meterConfig);
|
||||
}
|
||||
len = 0;
|
||||
|
||||
|
||||
@@ -100,10 +100,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
||||
|
||||
if(listType >= 2 && memcmp(meterModel.c_str(), "MA304T3", 7) == 0) {
|
||||
l2voltage = sqrt(pow(l1voltage - l3voltage * cos(60 * (PI/180)), 2) + pow(l3voltage * sin(60 * (PI/180)),2));
|
||||
if(l2voltage > 0) {
|
||||
l2current = ((activeImportPower - activeExportPower) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
|
||||
l2currentEstimated = true;
|
||||
}
|
||||
l2currentMissing = true;
|
||||
}
|
||||
|
||||
if(listType == 3) {
|
||||
@@ -297,6 +294,8 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
||||
if(val != NOVALUE) {
|
||||
listType = 2;
|
||||
l2current = val;
|
||||
} else if(listType == 2) {
|
||||
l2currentMissing = true;
|
||||
}
|
||||
val = getNumber(AMS_OBIS_CURRENT_L3, sizeof(AMS_OBIS_CURRENT_L3), ((char *) (d)));
|
||||
if(val != NOVALUE) {
|
||||
@@ -487,15 +486,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
||||
|
||||
// Special case for Norwegian IT/TT meters that does not report all values
|
||||
if(meterConfig->distributionSystem == 1) {
|
||||
if(threePhase) {
|
||||
if(l2current == 0.0 && l1current > 0.0 && l3current > 0.0) {
|
||||
l2current = ((activeImportPower - activeExportPower) - (l1voltage * l1current) - (l3voltage * l3current)) / l2voltage;
|
||||
if(activeExportPower == 0.0) {
|
||||
l2current = max((float) 0.0, l2current);
|
||||
}
|
||||
l2currentEstimated = true;
|
||||
}
|
||||
} else if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) {
|
||||
if(twoPhase && l1current > 0.0 && l2current > 0.0 && l3current > 0.0) {
|
||||
l2voltage = sqrt(pow(l1voltage - l3voltage * cos(60.0 * (PI/180.0)), 2) + pow(l3voltage * sin(60.0 * (PI/180.0)),2));
|
||||
threePhase = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user