kopia lustrzana https://github.com/weetmuts/wmbusmeters
				
				
				
			Added ev200 and emerlin868.
							rodzic
							
								
									dcb46566da
								
							
						
					
					
						commit
						3735c9fa70
					
				
							
								
								
									
										3
									
								
								CHANGES
								
								
								
								
							
							
						
						
									
										3
									
								
								CHANGES
								
								
								
								
							| 
						 | 
				
			
			@ -1,4 +1,7 @@
 | 
			
		|||
 | 
			
		||||
Mira added support for Elster V200H water meter and the Elster Merlin 868 addon.
 | 
			
		||||
Thanks Mira!
 | 
			
		||||
 | 
			
		||||
Version 1.0.3: 2020-11-11
 | 
			
		||||
 | 
			
		||||
Add missing files and update man page for --nodeviceexit
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										2
									
								
								Makefile
								
								
								
								
							| 
						 | 
				
			
			@ -120,6 +120,8 @@ METER_OBJS:=\
 | 
			
		|||
	$(BUILD)/meter_ehzp.o \
 | 
			
		||||
	$(BUILD)/meter_esyswm.o \
 | 
			
		||||
	$(BUILD)/meter_em24.o \
 | 
			
		||||
	$(BUILD)/meter_emerlin868.o \
 | 
			
		||||
	$(BUILD)/meter_ev200.o \
 | 
			
		||||
	$(BUILD)/meter_eurisii.o \
 | 
			
		||||
	$(BUILD)/meter_fhkvdataiii.o \
 | 
			
		||||
	$(BUILD)/meter_flowiq2200.o \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -267,6 +267,8 @@ Aquametro/Integra Topas Es Kr (topaseskr)
 | 
			
		|||
Bmeters Hydrodigit (hydrodigit) (partly non-standard protocol)
 | 
			
		||||
Diehl/Sappel IZAR RC 868 I R4 PL (izar) (non-standard protocol)
 | 
			
		||||
Diehl HYDRUS (hydrus)
 | 
			
		||||
Elster Merlin 868 (emerlin868)
 | 
			
		||||
Elster V200H (ev200)
 | 
			
		||||
Honeywell Q400 (q400)
 | 
			
		||||
Kamstrup Multical 21 (multical21)
 | 
			
		||||
Kamstrup flowIQ 2200 (flowiq2200)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -180,3 +180,13 @@ telegram=|2E4401069897969501167A4B0320052F2F|0413320C000003FD1700000044132109000
 | 
			
		|||
telegram=|9E44C5147956341200047A7B0090052F2F|046D25248A2B04063D1F000001FD17000415265F00004406131F0000840106901E0000C40106841E0000840206841E0000C402067A1E0000840306541E0000C40306021E00008404069E1D0000C40406D71C0000840506F21B0000C40506681A00008406061E190000C40606EB1700008407061C170000C40706EE1600002F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F|
 | 
			
		||||
{"media":"heat","meter":"sensostar","name":"Heater","id":"12345679","meter_timestamp":"2020-11-10 04:37","total_kwh":7997,"total_water_m3":2435.8,"current_status":"OK","timestamp":"1111-11-11T11:11:11Z"}
 | 
			
		||||
|Heater;12345679;7997.000000;2435.800000;OK;1111-11-11 11:11.11
 | 
			
		||||
 | 
			
		||||
# Test Elster V200H water meter
 | 
			
		||||
telegram=|2E449215303099990D077AB50820452F2F|0C12495849004C12557545000FB10445007022C50BFFFFFFFF0000FFF000|
 | 
			
		||||
{"media":"water","meter":"ev200","name":"Voda","id":"99993030","total_m3":49.5849,"target_m3":45.7555,"timestamp":"1111-11-11T11:11:11Z"}
 | 
			
		||||
|Voda;99993030;49.584900;45.755500;1111-11-11 11:11.11
 | 
			
		||||
 | 
			
		||||
# Test Elster Merlin 868 radio attachement
 | 
			
		||||
telegram=|2E4492159293949511377ABE0020252F2F|04135515000004FD971D80800000441300000000426C000002FDFD02B300|
 | 
			
		||||
{"media":"radio converter (meter side)","meter":"emerlin868","name":"Vodda","id":"95949392","total_m3":5.461,"target_m3":0,"timestamp":"1111-11-11T11:11:11Z"}
 | 
			
		||||
|Vodda;95949392;5.461000;0.000000;1111-11-11 11:11.11
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,107 @@
 | 
			
		|||
/*
 | 
			
		||||
 Copyright (C) 2017-2020 Fredrik Öhrström
 | 
			
		||||
 Copyright (C) 2018 David Mallon
 | 
			
		||||
 | 
			
		||||
 This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 it under the terms of the GNU General Public License as published by
 | 
			
		||||
 the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
 This program is distributed in the hope that it will be useful,
 | 
			
		||||
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
 You should have received a copy of the GNU General Public License
 | 
			
		||||
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include"dvparser.h"
 | 
			
		||||
#include"meters.h"
 | 
			
		||||
#include"meters_common_implementation.h"
 | 
			
		||||
#include"wmbus.h"
 | 
			
		||||
#include"wmbus_utils.h"
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
struct MeterEMerlin868 : public virtual WaterMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
    MeterEMerlin868(MeterInfo &mi);
 | 
			
		||||
 | 
			
		||||
    // Total water counted through the meter
 | 
			
		||||
    double totalWaterConsumption(Unit u);
 | 
			
		||||
    bool  hasTotalWaterConsumption();
 | 
			
		||||
    double targetWaterConsumption(Unit u);
 | 
			
		||||
    bool   hasTargetWaterConsumption();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void processContent(Telegram *t);
 | 
			
		||||
 | 
			
		||||
    double actual_total_water_consumption_m3_ {};
 | 
			
		||||
    double last_total_water_consumption_m3h_ {};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
MeterEMerlin868::MeterEMerlin868(MeterInfo &mi) :
 | 
			
		||||
    MeterCommonImplementation(mi, MeterType::EMERLIN868)
 | 
			
		||||
{
 | 
			
		||||
    setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV);
 | 
			
		||||
 | 
			
		||||
    addLinkMode(LinkMode::T1);
 | 
			
		||||
 | 
			
		||||
    // version 0x68
 | 
			
		||||
    // version 0x7c Sensus 640
 | 
			
		||||
 | 
			
		||||
    addPrint("total", Quantity::Volume,
 | 
			
		||||
             [&](Unit u){ return totalWaterConsumption(u); },
 | 
			
		||||
             "The total water consumption recorded by this meter.",
 | 
			
		||||
             true, true);
 | 
			
		||||
 | 
			
		||||
    addPrint("target", Quantity::Volume,
 | 
			
		||||
             [&](Unit u){ return targetWaterConsumption(u); },
 | 
			
		||||
             "The target water consumption recorded at previous period.",
 | 
			
		||||
             true, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
shared_ptr<WaterMeter> createEMerlin868(MeterInfo &mi)
 | 
			
		||||
{
 | 
			
		||||
    return shared_ptr<WaterMeter>(new MeterEMerlin868(mi));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MeterEMerlin868::processContent(Telegram *t)
 | 
			
		||||
{
 | 
			
		||||
    int offset;
 | 
			
		||||
    string key;
 | 
			
		||||
 | 
			
		||||
    if(findKey(MeasurementType::Unknown, ValueInformation::Volume, 0, 0, &key, &t->values)) {
 | 
			
		||||
        extractDVdouble(&t->values, key, &offset, &actual_total_water_consumption_m3_);
 | 
			
		||||
        t->addMoreExplanation(offset, " actual total consumption (%f m3)", actual_total_water_consumption_m3_);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(findKey(MeasurementType::Unknown, ValueInformation::Volume, 1, 0, &key, &t->values)) {
 | 
			
		||||
        extractDVdouble(&t->values, key, &offset, &last_total_water_consumption_m3h_);
 | 
			
		||||
        t->addMoreExplanation(offset, " last total consumption (%f m3)", last_total_water_consumption_m3h_);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterEMerlin868::totalWaterConsumption(Unit u)
 | 
			
		||||
{
 | 
			
		||||
    assertQuantity(u, Quantity::Volume);
 | 
			
		||||
    return convert(actual_total_water_consumption_m3_, Unit::M3, u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MeterEMerlin868::hasTotalWaterConsumption()
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterEMerlin868::targetWaterConsumption(Unit u)
 | 
			
		||||
{
 | 
			
		||||
    assertQuantity(u, Quantity::Volume);
 | 
			
		||||
    return convert(last_total_water_consumption_m3h_, Unit::M3, u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MeterEMerlin868::hasTargetWaterConsumption()
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
#include"wmbus.h"
 | 
			
		||||
#include"wmbus_utils.h"
 | 
			
		||||
 | 
			
		||||
struct MeterEurisII : public virtual HeatCostMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
struct MeterEurisII : public virtual HeatCostAllocationMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
    MeterEurisII(MeterInfo &mi);
 | 
			
		||||
 | 
			
		||||
    double currentConsumption(Unit u);
 | 
			
		||||
| 
						 | 
				
			
			@ -80,9 +80,9 @@ MeterEurisII::MeterEurisII(MeterInfo &mi) :
 | 
			
		|||
             true, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
shared_ptr<HeatCostMeter> createEurisII(MeterInfo &mi)
 | 
			
		||||
shared_ptr<HeatCostAllocationMeter> createEurisII(MeterInfo &mi)
 | 
			
		||||
{
 | 
			
		||||
    return shared_ptr<HeatCostMeter>(new MeterEurisII(mi));
 | 
			
		||||
    return shared_ptr<HeatCostAllocationMeter>(new MeterEurisII(mi));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterEurisII::currentConsumption(Unit u)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,107 @@
 | 
			
		|||
/*
 | 
			
		||||
 Copyright (C) 2017-2020 Fredrik Öhrström
 | 
			
		||||
 Copyright (C) 2018 David Mallon
 | 
			
		||||
 | 
			
		||||
 This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 it under the terms of the GNU General Public License as published by
 | 
			
		||||
 the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
 This program is distributed in the hope that it will be useful,
 | 
			
		||||
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
 You should have received a copy of the GNU General Public License
 | 
			
		||||
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include"dvparser.h"
 | 
			
		||||
#include"meters.h"
 | 
			
		||||
#include"meters_common_implementation.h"
 | 
			
		||||
#include"wmbus.h"
 | 
			
		||||
#include"wmbus_utils.h"
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
struct MeterEV200 : public virtual WaterMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
    MeterEV200(MeterInfo &mi);
 | 
			
		||||
 | 
			
		||||
    // Total water counted through the meter
 | 
			
		||||
    double totalWaterConsumption(Unit u);
 | 
			
		||||
    bool  hasTotalWaterConsumption();
 | 
			
		||||
    double targetWaterConsumption(Unit u);
 | 
			
		||||
    bool   hasTargetWaterConsumption();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    void processContent(Telegram *t);
 | 
			
		||||
 | 
			
		||||
    double actual_total_water_consumption_m3_ {};
 | 
			
		||||
    double last_total_water_consumption_m3h_ {};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
MeterEV200::MeterEV200(MeterInfo &mi) :
 | 
			
		||||
    MeterCommonImplementation(mi, MeterType::EV200)
 | 
			
		||||
{
 | 
			
		||||
    setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV);
 | 
			
		||||
 | 
			
		||||
    addLinkMode(LinkMode::T1);
 | 
			
		||||
 | 
			
		||||
    // version 0x68
 | 
			
		||||
    // version 0x7c Sensus 640
 | 
			
		||||
 | 
			
		||||
    addPrint("total", Quantity::Volume,
 | 
			
		||||
             [&](Unit u){ return totalWaterConsumption(u); },
 | 
			
		||||
             "The total water consumption recorded by this meter.",
 | 
			
		||||
             true, true);
 | 
			
		||||
 | 
			
		||||
    addPrint("target", Quantity::Volume,
 | 
			
		||||
             [&](Unit u){ return targetWaterConsumption(u); },
 | 
			
		||||
             "The target water consumption recorded at previous period.",
 | 
			
		||||
             true, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
shared_ptr<WaterMeter> createEV200(MeterInfo &mi)
 | 
			
		||||
{
 | 
			
		||||
    return shared_ptr<WaterMeter>(new MeterEV200(mi));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MeterEV200::processContent(Telegram *t)
 | 
			
		||||
{
 | 
			
		||||
    int offset;
 | 
			
		||||
    string key;
 | 
			
		||||
 | 
			
		||||
    if(findKey(MeasurementType::Unknown, ValueInformation::Volume, 0, 0, &key, &t->values)) {
 | 
			
		||||
        extractDVdouble(&t->values, key, &offset, &actual_total_water_consumption_m3_);
 | 
			
		||||
        t->addMoreExplanation(offset, " actual total consumption (%f m3)", actual_total_water_consumption_m3_);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(findKey(MeasurementType::Unknown, ValueInformation::Volume, 1, 0, &key, &t->values)) {
 | 
			
		||||
        extractDVdouble(&t->values, key, &offset, &last_total_water_consumption_m3h_);
 | 
			
		||||
        t->addMoreExplanation(offset, " last total consumption (%f m3)", last_total_water_consumption_m3h_);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterEV200::totalWaterConsumption(Unit u)
 | 
			
		||||
{
 | 
			
		||||
    assertQuantity(u, Quantity::Volume);
 | 
			
		||||
    return convert(actual_total_water_consumption_m3_, Unit::M3, u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MeterEV200::hasTotalWaterConsumption()
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterEV200::targetWaterConsumption(Unit u)
 | 
			
		||||
{
 | 
			
		||||
    assertQuantity(u, Quantity::Volume);
 | 
			
		||||
    return convert(last_total_water_consumption_m3h_, Unit::M3, u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MeterEV200::hasTargetWaterConsumption()
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +24,7 @@
 | 
			
		|||
#include"util.h"
 | 
			
		||||
#include <ctime>
 | 
			
		||||
 | 
			
		||||
struct MeterFHKVDataIII : public virtual HeatCostMeter, public virtual MeterCommonImplementation
 | 
			
		||||
struct MeterFHKVDataIII : public virtual HeatCostAllocationMeter, public virtual MeterCommonImplementation
 | 
			
		||||
{
 | 
			
		||||
    MeterFHKVDataIII(MeterInfo &mi);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,9 +49,9 @@ struct MeterFHKVDataIII : public virtual HeatCostMeter, public virtual MeterComm
 | 
			
		|||
    double temp_radiator_ {};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
shared_ptr<HeatCostMeter> createFHKVDataIII(MeterInfo &mi)
 | 
			
		||||
shared_ptr<HeatCostAllocationMeter> createFHKVDataIII(MeterInfo &mi)
 | 
			
		||||
{
 | 
			
		||||
    return shared_ptr<HeatCostMeter>(new MeterFHKVDataIII(mi));
 | 
			
		||||
    return shared_ptr<HeatCostAllocationMeter>(new MeterFHKVDataIII(mi));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
#include"wmbus.h"
 | 
			
		||||
#include"wmbus_utils.h"
 | 
			
		||||
 | 
			
		||||
struct MeterQCaloric : public virtual HeatCostMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
struct MeterQCaloric : public virtual HeatCostAllocationMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
    MeterQCaloric(MeterInfo &mi);
 | 
			
		||||
 | 
			
		||||
    double currentConsumption(Unit u);
 | 
			
		||||
| 
						 | 
				
			
			@ -98,9 +98,9 @@ MeterQCaloric::MeterQCaloric(MeterInfo &mi) :
 | 
			
		|||
             false, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
shared_ptr<HeatCostMeter> createQCaloric(MeterInfo &mi)
 | 
			
		||||
shared_ptr<HeatCostAllocationMeter> createQCaloric(MeterInfo &mi)
 | 
			
		||||
{
 | 
			
		||||
    return shared_ptr<HeatCostMeter>(new MeterQCaloric(mi));
 | 
			
		||||
    return shared_ptr<HeatCostAllocationMeter>(new MeterQCaloric(mi));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterQCaloric::currentConsumption(Unit u)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
#include"wmbus.h"
 | 
			
		||||
#include"wmbus_utils.h"
 | 
			
		||||
 | 
			
		||||
struct MeterSontex868 : public virtual HeatCostMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
struct MeterSontex868 : public virtual HeatCostAllocationMeter, public virtual MeterCommonImplementation {
 | 
			
		||||
    MeterSontex868(MeterInfo &mi);
 | 
			
		||||
 | 
			
		||||
    double currentConsumption(Unit u);
 | 
			
		||||
| 
						 | 
				
			
			@ -101,9 +101,9 @@ MeterSontex868::MeterSontex868(MeterInfo &mi) :
 | 
			
		|||
             false, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
shared_ptr<HeatCostMeter> createSontex868(MeterInfo &mi)
 | 
			
		||||
shared_ptr<HeatCostAllocationMeter> createSontex868(MeterInfo &mi)
 | 
			
		||||
{
 | 
			
		||||
    return shared_ptr<HeatCostMeter>(new MeterSontex868(mi));
 | 
			
		||||
    return shared_ptr<HeatCostAllocationMeter>(new MeterSontex868(mi));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double MeterSontex868::currentConsumption(Unit u)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -630,9 +630,9 @@ double ElectricityMeter::totalApparentEnergyProduction(Unit u) { return -NAN; }
 | 
			
		|||
double ElectricityMeter::currentPowerConsumption(Unit u) { return -NAN; }
 | 
			
		||||
double ElectricityMeter::currentPowerProduction(Unit u) { return -NAN; }
 | 
			
		||||
 | 
			
		||||
double HeatCostMeter::currentConsumption(Unit u) { return -NAN; }
 | 
			
		||||
string HeatCostMeter::setDate() { return "NAN"; }
 | 
			
		||||
double HeatCostMeter::consumptionAtSetDate(Unit u) { return -NAN; }
 | 
			
		||||
double HeatCostAllocationMeter::currentConsumption(Unit u) { return -NAN; }
 | 
			
		||||
string HeatCostAllocationMeter::setDate() { return "NAN"; }
 | 
			
		||||
double HeatCostAllocationMeter::consumptionAtSetDate(Unit u) { return -NAN; }
 | 
			
		||||
 | 
			
		||||
void MeterCommonImplementation::setExpectedTPLSecurityMode(TPLSecurityMode tsm)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										130
									
								
								src/meters.h
								
								
								
								
							
							
						
						
									
										130
									
								
								src/meters.h
								
								
								
								
							| 
						 | 
				
			
			@ -27,45 +27,47 @@
 | 
			
		|||
#include<vector>
 | 
			
		||||
 | 
			
		||||
#define LIST_OF_METERS \
 | 
			
		||||
    X(amiplus,    T1_bit, Electricity, AMIPLUS,     Amiplus)      \
 | 
			
		||||
    X(apator08,   T1_bit,        Water,       APATOR08,    Apator08)    \
 | 
			
		||||
    X(apator162,  C1_bit|T1_bit, Water,       APATOR162,   Apator162)   \
 | 
			
		||||
    X(cma12w,     C1_bit|T1_bit, TempHygro,   CMA12W,      CMa12w)      \
 | 
			
		||||
    X(compact5,   T1_bit, Heat,        COMPACT5,    Compact5)     \
 | 
			
		||||
    X(ebzwmbe,    T1_bit, Electricity, EBZWMBE, EBZWMBE)   \
 | 
			
		||||
    X(eurisii,    T1_bit, HeatCostAllocation, EURISII, EurisII)   \
 | 
			
		||||
    X(ehzp,       T1_bit, Electricity, EHZP,        EHZP)         \
 | 
			
		||||
    X(esyswm,     T1_bit, Electricity, ESYSWM,      ESYSWM)       \
 | 
			
		||||
    X(flowiq2200, C1_bit, Water,       FLOWIQ2200,  FlowIQ2200)   \
 | 
			
		||||
    X(flowiq3100, C1_bit, Water,       FLOWIQ3100,  FlowIQ3100)   \
 | 
			
		||||
    X(em24,       C1_bit, Electricity, EM24,        EM24)         \
 | 
			
		||||
    X(fhkvdataiii,   T1_bit, HeatCostAllocation,        FHKVDATAIII,    FHKVDataIII)     \
 | 
			
		||||
    X(hydrus,     T1_bit, Water,       HYDRUS,      Hydrus)       \
 | 
			
		||||
    X(hydrodigit, T1_bit, Water,       HYDRODIGIT,  Hydrodigit)   \
 | 
			
		||||
    X(iperl,      T1_bit, Water,       IPERL,       Iperl)        \
 | 
			
		||||
    X(izar,       T1_bit, Water,       IZAR,        Izar)         \
 | 
			
		||||
    X(izar3,      T1_bit, Water,       IZAR3,       Izar3)        \
 | 
			
		||||
    X(lansensm,   T1_bit, Smoke,       LANSENSM,    LansenSM)     \
 | 
			
		||||
    X(lansenth,   T1_bit, TempHygro,   LANSENTH,    LansenTH)     \
 | 
			
		||||
    X(lansendw,   T1_bit, DoorWindow,  LANSENDW,    LansenDW)     \
 | 
			
		||||
    X(lansenpu,   T1_bit, Pulse,       LANSENPU,    LansenPU)     \
 | 
			
		||||
    X(mkradio3,   T1_bit, Water,       MKRADIO3,    MKRadio3)     \
 | 
			
		||||
    X(multical21, C1_bit|T1_bit, Water,       MULTICAL21,  Multical21)   \
 | 
			
		||||
    X(multical302,C1_bit, Heat,        MULTICAL302, Multical302)  \
 | 
			
		||||
    X(multical403,C1_bit, Heat,        MULTICAL403, Multical403)  \
 | 
			
		||||
    X(multical603,C1_bit, Heat,        MULTICAL603, Multical603)  \
 | 
			
		||||
    X(omnipower,  C1_bit, Electricity, OMNIPOWER,   Omnipower)    \
 | 
			
		||||
    X(rfmamb,     T1_bit, TempHygro,   RFMAMB,      RfmAmb)       \
 | 
			
		||||
    X(rfmtx1,     T1_bit, Water,       RFMTX1,      RfmTX1)       \
 | 
			
		||||
    X(q400,       T1_bit, Water,       Q400,        Q400)         \
 | 
			
		||||
    X(qcaloric,   C1_bit, HeatCostAllocation, QCALORIC, QCaloric) \
 | 
			
		||||
    X(sontex868,  T1_bit, HeatCostAllocation, SONTEX868, Sontex868) \
 | 
			
		||||
    X(supercom587,T1_bit, Water,       SUPERCOM587, Supercom587)  \
 | 
			
		||||
    X(ultrimis,   T1_bit, Water,       ULTRIMIS,    Ultrimis)     \
 | 
			
		||||
    X(vario451,   T1_bit, Heat,        VARIO451,    Vario451)     \
 | 
			
		||||
    X(waterstarm, C1_bit|T1_bit, Water,WATERSTARM,  WaterstarM)   \
 | 
			
		||||
    X(topaseskr, T1_bit, Water,   TOPASESKR, TopasEsKr)  \
 | 
			
		||||
    X(sensostar, C1_bit|T1_bit, Heat,SENSOSTAR,  Sensostar)   \
 | 
			
		||||
    X(amiplus,    T1_bit, ElectricityMeter, AMIPLUS,     Amiplus)      \
 | 
			
		||||
    X(apator08,   T1_bit,        WaterMeter,       APATOR08,    Apator08)    \
 | 
			
		||||
    X(apator162,  C1_bit|T1_bit, WaterMeter,       APATOR162,   Apator162)   \
 | 
			
		||||
    X(cma12w,     C1_bit|T1_bit, TempHygroMeter,   CMA12W,      CMa12w)      \
 | 
			
		||||
    X(compact5,   T1_bit, HeatMeter,        COMPACT5,    Compact5)     \
 | 
			
		||||
    X(ebzwmbe,    T1_bit, ElectricityMeter, EBZWMBE, EBZWMBE)          \
 | 
			
		||||
    X(eurisii,    T1_bit, HeatCostAllocationMeter, EURISII, EurisII)   \
 | 
			
		||||
    X(ehzp,       T1_bit, ElectricityMeter, EHZP,        EHZP)         \
 | 
			
		||||
    X(esyswm,     T1_bit, ElectricityMeter, ESYSWM,      ESYSWM)       \
 | 
			
		||||
    X(flowiq2200, C1_bit, WaterMeter,       FLOWIQ2200,  FlowIQ2200)   \
 | 
			
		||||
    X(flowiq3100, C1_bit, WaterMeter,       FLOWIQ3100,  FlowIQ3100)   \
 | 
			
		||||
    X(em24,       C1_bit, ElectricityMeter, EM24,        EM24)         \
 | 
			
		||||
    X(emerlin868, T1_bit, WaterMeter,       EMERLIN868,  EMerlin868)   \
 | 
			
		||||
    X(ev200,      T1_bit, WaterMeter,       EV200,       EV200)        \
 | 
			
		||||
    X(fhkvdataiii,   T1_bit, HeatCostAllocationMeter,        FHKVDATAIII,    FHKVDataIII)     \
 | 
			
		||||
    X(hydrus,     T1_bit, WaterMeter,       HYDRUS,      Hydrus)       \
 | 
			
		||||
    X(hydrodigit, T1_bit, WaterMeter,       HYDRODIGIT,  Hydrodigit)   \
 | 
			
		||||
    X(iperl,      T1_bit, WaterMeter,       IPERL,       Iperl)        \
 | 
			
		||||
    X(izar,       T1_bit, WaterMeter,       IZAR,        Izar)         \
 | 
			
		||||
    X(izar3,      T1_bit, WaterMeter,       IZAR3,       Izar3)        \
 | 
			
		||||
    X(lansensm,   T1_bit, SmokeDetector,    LANSENSM,    LansenSM)     \
 | 
			
		||||
    X(lansenth,   T1_bit, TempHygroMeter,   LANSENTH,    LansenTH)     \
 | 
			
		||||
    X(lansendw,   T1_bit, DoorWindowDetector,  LANSENDW,    LansenDW)     \
 | 
			
		||||
    X(lansenpu,   T1_bit, PulseCounter,     LANSENPU,    LansenPU)     \
 | 
			
		||||
    X(mkradio3,   T1_bit, WaterMeter,       MKRADIO3,    MKRadio3)     \
 | 
			
		||||
    X(multical21, C1_bit|T1_bit, WaterMeter,       MULTICAL21,  Multical21)   \
 | 
			
		||||
    X(multical302,C1_bit, HeatMeter,        MULTICAL302, Multical302)  \
 | 
			
		||||
    X(multical403,C1_bit, HeatMeter,        MULTICAL403, Multical403)  \
 | 
			
		||||
    X(multical603,C1_bit, HeatMeter,        MULTICAL603, Multical603)  \
 | 
			
		||||
    X(omnipower,  C1_bit, ElectricityMeter, OMNIPOWER,   Omnipower)    \
 | 
			
		||||
    X(rfmamb,     T1_bit, TempHygroMeter,   RFMAMB,      RfmAmb)       \
 | 
			
		||||
    X(rfmtx1,     T1_bit, WaterMeter,       RFMTX1,      RfmTX1)       \
 | 
			
		||||
    X(q400,       T1_bit, WaterMeter,       Q400,        Q400)         \
 | 
			
		||||
    X(qcaloric,   C1_bit, HeatCostAllocationMeter, QCALORIC, QCaloric) \
 | 
			
		||||
    X(sontex868,  T1_bit, HeatCostAllocationMeter, SONTEX868, Sontex868) \
 | 
			
		||||
    X(supercom587,T1_bit, WaterMeter,       SUPERCOM587, Supercom587)  \
 | 
			
		||||
    X(ultrimis,   T1_bit, WaterMeter,       ULTRIMIS,    Ultrimis)     \
 | 
			
		||||
    X(vario451,   T1_bit, HeatMeter,        VARIO451,    Vario451)     \
 | 
			
		||||
    X(waterstarm, C1_bit|T1_bit, WaterMeter,WATERSTARM,  WaterstarM)   \
 | 
			
		||||
    X(topaseskr, T1_bit, WaterMeter,   TOPASESKR, TopasEsKr)  \
 | 
			
		||||
    X(sensostar, C1_bit|T1_bit, HeatMeter,SENSOSTAR,  Sensostar)   \
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// List of numbers that can be used to detect the meter driver
 | 
			
		||||
| 
						 | 
				
			
			@ -98,6 +100,8 @@
 | 
			
		|||
    X(FLOWIQ2200,MANUFACTURER_KAW,  0x16,  0x3a) \
 | 
			
		||||
    X(FLOWIQ3100,MANUFACTURER_KAM,  0x16,  0x1d) \
 | 
			
		||||
    X(EM24,      MANUFACTURER_KAM,  0x02,  0x33) \
 | 
			
		||||
    X(EMERLIN868,MANUFACTURER_ELR,  0x37,  0x11) \
 | 
			
		||||
    X(EV200,     MANUFACTURER_ELR,  0x07,  0x0d) \
 | 
			
		||||
    X(FHKVDATAIII,MANUFACTURER_TCH, 0x80,  0x69) \
 | 
			
		||||
    X(HYDRUS,    MANUFACTURER_DME,  0x07,  0x70) \
 | 
			
		||||
    X(HYDRUS,    MANUFACTURER_HYD,  0x07,  0x24) \
 | 
			
		||||
| 
						 | 
				
			
			@ -313,7 +317,7 @@ struct ElectricityMeter : public virtual Meter
 | 
			
		|||
    virtual double currentPowerProduction(Unit u); // kw
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct HeatCostMeter : public virtual Meter
 | 
			
		||||
struct HeatCostAllocationMeter : public virtual Meter
 | 
			
		||||
{
 | 
			
		||||
    virtual double currentConsumption(Unit u);
 | 
			
		||||
    virtual string setDate();
 | 
			
		||||
| 
						 | 
				
			
			@ -356,53 +360,17 @@ struct PulseCounter : public virtual Meter
 | 
			
		|||
    virtual ~PulseCounter() = default;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct GenericMeter : public virtual Meter {
 | 
			
		||||
struct Generic : public virtual Meter {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
string toMeterName(MeterType mt);
 | 
			
		||||
MeterType toMeterType(string& type);
 | 
			
		||||
LinkModeSet toMeterLinkModeSet(string& type);
 | 
			
		||||
 | 
			
		||||
shared_ptr<WaterMeter> createMultical21(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createFlowIQ2200(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createFlowIQ3100(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatMeter> createMultical302(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatMeter> createMultical403(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatMeter> createMultical603(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatMeter> createVario451(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createWaterstarM(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatMeter> createCompact5(MeterInfo &m);
 | 
			
		||||
shared_ptr<ElectricityMeter> createOmnipower(MeterInfo &m);
 | 
			
		||||
shared_ptr<ElectricityMeter> createAmiplus(MeterInfo &m);
 | 
			
		||||
shared_ptr<ElectricityMeter> createEM24(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createSupercom587(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createMKRadio3(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createApator08(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createApator162(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createIperl(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createHydrus(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createHydrodigit(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createIzar(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createIzar3(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createQ400(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatCostMeter> createQCaloric(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatCostMeter> createEurisII(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatCostMeter> createFHKVDataIII(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatCostMeter> createSontex868(MeterInfo &m);
 | 
			
		||||
shared_ptr<TempHygroMeter> createLansenTH(MeterInfo &m);
 | 
			
		||||
shared_ptr<SmokeDetector> createLansenSM(MeterInfo &m);
 | 
			
		||||
shared_ptr<PulseCounter> createLansenPU(MeterInfo &m);
 | 
			
		||||
shared_ptr<DoorWindowDetector> createLansenDW(MeterInfo &m);
 | 
			
		||||
shared_ptr<TempHygroMeter> createCMa12w(MeterInfo &m);
 | 
			
		||||
shared_ptr<TempHygroMeter> createRfmAmb(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createRfmTX1(MeterInfo &m);
 | 
			
		||||
shared_ptr<ElectricityMeter> createEHZP(MeterInfo &m);
 | 
			
		||||
shared_ptr<ElectricityMeter> createESYSWM(MeterInfo &m);
 | 
			
		||||
shared_ptr<ElectricityMeter> createEBZWMBE(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createTopasEsKr(MeterInfo &m);
 | 
			
		||||
shared_ptr<WaterMeter> createUltrimis(MeterInfo &m);
 | 
			
		||||
shared_ptr<HeatMeter> createSensostar(MeterInfo &m);
 | 
			
		||||
#define X(mname,linkmode,info,type,cname) shared_ptr<info> create##cname(MeterInfo &m);
 | 
			
		||||
LIST_OF_METERS
 | 
			
		||||
#undef X
 | 
			
		||||
 | 
			
		||||
GenericMeter *createGeneric(WMBus *bus, MeterInfo &m);
 | 
			
		||||
Generic *createGeneric(WMBus *bus, MeterInfo &m);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,6 +185,16 @@ Received telegram from: 12345679
 | 
			
		|||
                  type: Heat meter (0x04)
 | 
			
		||||
                   ver: 0x00
 | 
			
		||||
                driver: sensostar
 | 
			
		||||
Received telegram from: 99993030
 | 
			
		||||
          manufacturer: (ELR) Elster Metering, United Kingdom (0x1592)
 | 
			
		||||
                  type: Water meter (0x07)
 | 
			
		||||
                   ver: 0x0d
 | 
			
		||||
                driver: ev200
 | 
			
		||||
Received telegram from: 95949392
 | 
			
		||||
          manufacturer: (ELR) Elster Metering, United Kingdom (0x1592)
 | 
			
		||||
                  type: Radio converter (meter side) (0x37)
 | 
			
		||||
                   ver: 0x11
 | 
			
		||||
                driver: emerlin868
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
RES=$($PROG --logfile=$LOGFILE --t1 simulations/simulation_t1.txt 2>&1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,9 @@ METERS="MyWarmWater supercom587 12345678 NOKEY
 | 
			
		|||
      Wasser      rfmtx1      74737271 NOKEY
 | 
			
		||||
      Woter       waterstarm  20096221 BEDB81B52C29B5C143388CBB0D15A051
 | 
			
		||||
      Witer       topaseskr   78563412 NOKEY
 | 
			
		||||
      Heater      sensostar   12345679 NOKEY"
 | 
			
		||||
      Heater      sensostar   12345679 NOKEY
 | 
			
		||||
      Voda        ev200       99993030 NOKEY
 | 
			
		||||
      Vodda       emerlin868  95949392 NOKEY"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cat simulations/simulation_t1.txt | grep '^{' > $TEST/test_expected.txt
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue