From 958564541625cbfbba5d4f2326c8178521af6fb4 Mon Sep 17 00:00:00 2001 From: Roar Fredriksen Date: Wed, 25 Oct 2017 22:25:11 +0200 Subject: [PATCH] Fixed names of Kamstrup items, added List2 --- .gitignore | 4 +- Code/Arduino/HanReader/src/Kamstrup.h | 95 +++++++++++++------ Code/Arduino/KamstrupTest/KamstrupTest.ino | 16 ++-- .../KamstrupTest/__vm/Compile.vmps.xml | 2 +- .../__vm/Configuration.Debug.vmps.xml | 2 +- 5 files changed, 80 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 1ca9059b..71b675cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .vs/ -[Dd]ebug/ \ No newline at end of file +[Dd]ebug/ +[Rr]elease/ +**/__vm/ diff --git a/Code/Arduino/HanReader/src/Kamstrup.h b/Code/Arduino/HanReader/src/Kamstrup.h index f368921a..c7b20ce0 100644 --- a/Code/Arduino/HanReader/src/Kamstrup.h +++ b/Code/Arduino/HanReader/src/Kamstrup.h @@ -6,38 +6,77 @@ enum class Kamstrup { - List1 = 0x19 + List1 = 0x19, + List2 = 0x23 }; enum class Kamstrup_List1 { - Kamstrup_List1_Time, - Kamstrup_List1_ListID, - Kamstrup_List1_ListVersionIdentifier, - Kamstrup_List1_MeterID_OBIS, - Kamstrup_List1_MeterID, - Kamstrup_List1_MeterType_OBIS, - Kamstrup_List1_MeterType, - Kamstrup_List1_ActivePowerPos_OBIS, - Kamstrup_List1_ActivePowerPos, - Kamstrup_List1_ActivePowerNeg_OBIS, - Kamstrup_List1_ActivePowerNeg, - Kamstrup_List1_ReactivePowerPos_OBIS, - Kamstrup_List1_ReactivePowerPos, - Kamstrup_List1_ReactivePowerNeg_OBIS, - Kamstrup_List1_ReactivePowerNeg, - Kamstrup_List1_CurrentL1_OBIS, - Kamstrup_List1_CurrentL1, - Kamstrup_List1_CurrentL2_OBIS, - Kamstrup_List1_CurrentL2, - Kamstrup_List1_CurrentL3_OBIS, - Kamstrup_List1_CurrentL3, - Kamstrup_List1_VoltageL1_OBIS, - Kamstrup_List1_VoltageL1, - Kamstrup_List1_VoltageL2_OBIS, - Kamstrup_List1_VoltageL2, - Kamstrup_List1_VoltageL3_OBIS, - Kamstrup_List1_VoltageL3 + Time, + ListID, + ListVersionIdentifier, + MeterID_OBIS, + MeterID, + MeterType_OBIS, + MeterType, + ActiveImportPower_OBIS, + ActiveImportPower, + ActiveExportPower_OBIS, + ActiveExportPower, + ReactiveImportPower_OBIS, + ReactiveImportPower, + ReactiveExportPower_OBIS, + ReactiveExportPower, + CurrentL1_OBIS, + CurrentL1, + CurrentL2_OBIS, + CurrentL2, + CurrentL3_OBIS, + CurrentL3, + VoltageL1_OBIS, + VoltageL1, + VoltageL2_OBIS, + VoltageL2, + VoltageL3_OBIS, + VoltageL3 +}; + + +enum class Kamstrup_List2 +{ + Time, + ListID, + ListVersionIdentifier, + MeterID_OBIS, + MeterID, + MeterType_OBIS, + MeterType, + ActiveImportPower_OBIS, + ActiveImportPower, + ActiveExportPower_OBIS, + ActiveExportPower, + ReactiveImportPower_OBIS, + ReactiveImportPower, + ReactiveExportPower_OBIS, + ReactiveExportPower, + CurrentL1_OBIS, + CurrentL1, + CurrentL2_OBIS, + CurrentL2, + CurrentL3_OBIS, + CurrentL3, + VoltageL1_OBIS, + VoltageL1, + VoltageL2_OBIS, + VoltageL2, + VoltageL3_OBIS, + VoltageL3, + MeterClock, + CumulativeActiveImportEnergy, + CumulativeActiveExportEnergy, + CumulativeReactiveImportEnergy, + CumulativeReactiveExportEnergy + }; diff --git a/Code/Arduino/KamstrupTest/KamstrupTest.ino b/Code/Arduino/KamstrupTest/KamstrupTest.ino index 1aa562b7..1ff6ca8c 100644 --- a/Code/Arduino/KamstrupTest/KamstrupTest.ino +++ b/Code/Arduino/KamstrupTest/KamstrupTest.ino @@ -65,27 +65,27 @@ void loop() { // Only care for the ACtive Power Imported, which is found in the first list if (list == (int)Kamstrup::List1) { - String id = hanReader.getString((int)Kamstrup_List1::Kamstrup_List1_ListVersionIdentifier); + String id = hanReader.getString((int)Kamstrup_List1::ListVersionIdentifier); Serial.println(id); time_t time = hanReader.getPackageTime(); Serial.print("Time of the package is: "); Serial.println(time); - int power = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_ActivePowerPos); + int power = hanReader.getInt((int)Kamstrup_List1::ActiveImportPower); Serial.print("Power consumtion is right now: "); Serial.print(power); Serial.println(" W"); float current[3]; - current[0] = (float)hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_CurrentL1) / 100.0; - current[1] = (float)hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_CurrentL2) / 100.0; - current[2] = (float)hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_CurrentL3) / 100.0; + current[0] = (float)hanReader.getInt((int)Kamstrup_List1::CurrentL1) / 100.0; + current[1] = (float)hanReader.getInt((int)Kamstrup_List1::CurrentL2) / 100.0; + current[2] = (float)hanReader.getInt((int)Kamstrup_List1::CurrentL3) / 100.0; int voltage[3]; - voltage[0] = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_VoltageL1); - voltage[1] = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_VoltageL2); - voltage[2] = hanReader.getInt((int)Kamstrup_List1::Kamstrup_List1_VoltageL3); + voltage[0] = hanReader.getInt((int)Kamstrup_List1::VoltageL1); + voltage[1] = hanReader.getInt((int)Kamstrup_List1::VoltageL2); + voltage[2] = hanReader.getInt((int)Kamstrup_List1::VoltageL3); for (int i = 0; i < 3; i++) { diff --git a/Code/Arduino/KamstrupTest/__vm/Compile.vmps.xml b/Code/Arduino/KamstrupTest/__vm/Compile.vmps.xml index d3cefbc5..43253c81 100644 --- a/Code/Arduino/KamstrupTest/__vm/Compile.vmps.xml +++ b/Code/Arduino/KamstrupTest/__vm/Compile.vmps.xml @@ -2,7 +2,7 @@ - + diff --git a/Code/Arduino/KamstrupTest/__vm/Configuration.Debug.vmps.xml b/Code/Arduino/KamstrupTest/__vm/Configuration.Debug.vmps.xml index c6dd389d..8993f725 100644 --- a/Code/Arduino/KamstrupTest/__vm/Configuration.Debug.vmps.xml +++ b/Code/Arduino/KamstrupTest/__vm/Configuration.Debug.vmps.xml @@ -2,7 +2,7 @@ - +