kopia lustrzana https://github.com/weetmuts/wmbusmeters
refactor voltage for phase 1 to keep naming consistent with GSS meter
rodzic
3baeb3b243
commit
9b6638d6dc
|
@ -29,7 +29,7 @@ telegram=|1844AE4C4455223368077A55000000|041389E20100023B0000|
|
|||
# Test amiplus/apator electricity meter
|
||||
|
||||
telegram=|4E4401061010101002027A00004005|2F2F0E035040691500000B2B300300066D00790C7423400C78371204860BABC8FC100000000E833C8074000000000BAB3C0000000AFDC9FC0136022F2F2F2F2F|
|
||||
{"media":"electricity","meter":"amiplus","name":"MyElectricity1","id":"10101010","total_energy_consumption_kwh":15694.05,"current_power_consumption_kw":0.33,"total_energy_production_kwh":7.48,"current_power_production_kw":0,"current_voltage_phase1_v":236,"device_date_time":"2019-03-20 12:57","timestamp":"1111-11-11T11:11:11Z"}
|
||||
{"media":"electricity","meter":"amiplus","name":"MyElectricity1","id":"10101010","total_energy_consumption_kwh":15694.05,"current_power_consumption_kw":0.33,"total_energy_production_kwh":7.48,"current_power_production_kw":0,"voltage_at_phase_1_v":236,"device_date_time":"2019-03-20 12:57","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|MyElectricity1;10101010;15694.050000;0.330000;7.480000;0.000000;236.000000;1111-11-11 11:11.11
|
||||
|
||||
# Test MKRadio3 T1 telegrams
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include"wmbus.h"
|
||||
#include"wmbus_utils.h"
|
||||
#include"util.h"
|
||||
#include<cmath>
|
||||
|
||||
struct MeterAmiplus : public virtual ElectricityMeter, public virtual MeterCommonImplementation {
|
||||
MeterAmiplus(MeterInfo &mi);
|
||||
|
@ -29,7 +30,6 @@ struct MeterAmiplus : public virtual ElectricityMeter, public virtual MeterCommo
|
|||
double currentPowerConsumption(Unit u);
|
||||
double totalEnergyProduction(Unit u);
|
||||
double currentPowerProduction(Unit u);
|
||||
double currentVoltagePhase1(Unit u);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -39,7 +39,8 @@ private:
|
|||
double current_power_kw_ {};
|
||||
double total_energy_returned_kwh_ {};
|
||||
double current_power_returned_kw_ {};
|
||||
double current_voltage_phase1_v_ {};
|
||||
double voltage_L_[3]{NAN, NAN, NAN};
|
||||
|
||||
string device_date_time_;
|
||||
};
|
||||
|
||||
|
@ -70,9 +71,9 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi) :
|
|||
"Current power production.",
|
||||
true, true);
|
||||
|
||||
addPrint("current_voltage_phase1", Quantity::Voltage,
|
||||
[&](Unit u){ return currentVoltagePhase1(u); },
|
||||
"Current voltage for phase 1.",
|
||||
addPrint("voltage_at_phase_1", Quantity::Voltage,
|
||||
[&](Unit u){ return convert(voltage_L_[0], Unit::Volt, u); },
|
||||
"Voltage at phase L1.",
|
||||
true, true);
|
||||
|
||||
addPrint("device_date_time", Quantity::Text,
|
||||
|
@ -110,12 +111,6 @@ double MeterAmiplus::currentPowerProduction(Unit u)
|
|||
return convert(current_power_returned_kw_, Unit::KW, u);
|
||||
}
|
||||
|
||||
double MeterAmiplus::currentVoltagePhase1(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Voltage);
|
||||
return convert(current_voltage_phase1_v_, Unit::Volt, u);
|
||||
}
|
||||
|
||||
void MeterAmiplus::processContent(Telegram *t)
|
||||
{
|
||||
int offset;
|
||||
|
@ -137,11 +132,13 @@ void MeterAmiplus::processContent(Telegram *t)
|
|||
extractDVdouble(&t->values, "0BAB3C", &offset, ¤t_power_returned_kw_);
|
||||
t->addMoreExplanation(offset, " current power returned (%f kw)", current_power_returned_kw_);
|
||||
|
||||
uint64_t volt1 {};
|
||||
if (hasKey(&t->values, "0AFDC9FC01") && extractDVlong(&t->values, "0AFDC9FC01", &offset, &volt1))
|
||||
voltage_L_[0]=voltage_L_[1]=voltage_L_[2] = NAN;
|
||||
uint64_t tmpvolt {};
|
||||
|
||||
if (extractDVlong(&t->values, "0AFDC9FC01", &offset, &tmpvolt))
|
||||
{
|
||||
current_voltage_phase1_v_ = ((double)volt1);
|
||||
t->addMoreExplanation(offset, " current voltage phase 1 (%f v)", current_voltage_phase1_v_);
|
||||
voltage_L_[0] = ((double)tmpvolt);
|
||||
t->addMoreExplanation(offset, " voltage L1 (%f volts)", voltage_L_[0]);
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::DateTime, 0, 0, &key, &t->values)) {
|
||||
|
|
|
@ -1016,9 +1016,6 @@ double ElectricityMeter::totalApparentEnergyProduction(Unit u) { return -NAN; }
|
|||
|
||||
double ElectricityMeter::currentPowerConsumption(Unit u) { return -NAN; }
|
||||
double ElectricityMeter::currentPowerProduction(Unit u) { return -NAN; }
|
||||
double ElectricityMeter::currentVoltagePhase1(Unit u) { return -NAN; }
|
||||
double ElectricityMeter::currentVoltagePhase2(Unit u) { return -NAN; }
|
||||
double ElectricityMeter::currentVoltagePhase3(Unit u) { return -NAN; }
|
||||
|
||||
double HeatCostAllocationMeter::currentConsumption(Unit u) { return -NAN; }
|
||||
string HeatCostAllocationMeter::setDate() { return "NAN"; }
|
||||
|
|
|
@ -340,10 +340,6 @@ struct ElectricityMeter : public virtual Meter
|
|||
|
||||
virtual double currentPowerConsumption(Unit u); // kw
|
||||
virtual double currentPowerProduction(Unit u); // kw
|
||||
|
||||
virtual double currentVoltagePhase1(Unit u); //v
|
||||
virtual double currentVoltagePhase2(Unit u); //v
|
||||
virtual double currentVoltagePhase3(Unit u); //v
|
||||
};
|
||||
|
||||
struct HeatCostAllocationMeter : public virtual Meter
|
||||
|
|
Ładowanie…
Reference in New Issue