From eac479430ad5b71477883f81a8aa163d67be6a26 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sat, 16 Dec 2023 14:52:47 +0100 Subject: [PATCH 01/11] Gridprofileparser: Added latest known values Thanks to @stefan123t and @noone2k --- lib/Hoymiles/src/parser/GridProfileParser.cpp | 50 +++++++++++++++++-- lib/Hoymiles/src/parser/GridProfileParser.h | 4 +- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/lib/Hoymiles/src/parser/GridProfileParser.cpp b/lib/Hoymiles/src/parser/GridProfileParser.cpp index 9bd0dd600..d280c9c2e 100644 --- a/lib/Hoymiles/src/parser/GridProfileParser.cpp +++ b/lib/Hoymiles/src/parser/GridProfileParser.cpp @@ -14,7 +14,7 @@ const std::array GridProfileParser::_pr { 0x0a, 0x00, "European - EN 50549-1:2019" }, { 0x0c, 0x00, "AT Tor - EU_EN50438" }, { 0x0d, 0x04, "France" }, - { 0x12, 0x00, "Poland" }, + { 0x12, 0x00, "Poland - EU_EN50438" }, { 0x37, 0x00, "Swiss - CH_NA EEA-NE7-CH2020" }, } }; @@ -45,7 +45,7 @@ constexpr GridProfileItemDefinition_t make_value(frozen::string Name, frozen::st return v; } -constexpr frozen::map itemDefinitions = { +constexpr frozen::map itemDefinitions = { { 0x01, make_value("Nominale Voltage (NV)", "V", 10) }, { 0x02, make_value("Low Voltage 1 (LV1)", "V", 10) }, { 0x03, make_value("LV1 Maximum Trip Time (MTT)", "s", 10) }, @@ -102,6 +102,7 @@ constexpr frozen::map itemDefinition { 0x36, make_value("WPF Function Activated", "bool", 1) }, { 0x37, make_value("Start of Power of WPF (Pstart)", "%Pn", 10) }, { 0x38, make_value("Power Factor ar Rated Power (PFRP)", "", 100) }, + { 0xff, make_value("Unkown Value", "", 1) }, }; const std::array GridProfileParser::_profileValues = { { @@ -123,6 +124,14 @@ const std::array GridProfileParse { 0x00, 0x03, 0x08 }, { 0x00, 0x03, 0x09 }, + // Version 0x08 + { 0x00, 0x08, 0x01 }, + { 0x00, 0x08, 0x02 }, + { 0x00, 0x08, 0x03 }, + { 0x00, 0x08, 0x04 }, + { 0x00, 0x08, 0x05 }, + { 0x00, 0x08, 0xff }, + // Version 0x0a { 0x00, 0x0a, 0x01 }, { 0x00, 0x0a, 0x02 }, @@ -159,6 +168,21 @@ const std::array GridProfileParse { 0x00, 0x0c, 0x0c }, { 0x00, 0x0c, 0x0a }, + // Version 0x35 + { 0x00, 0x35, 0x01 }, + { 0x00, 0x35, 0x02 }, + { 0x00, 0x35, 0x03 }, + { 0x00, 0x35, 0x04 }, + { 0x00, 0x35, 0x05 }, + { 0x00, 0x35, 0x06 }, + { 0x00, 0x35, 0x07 }, + { 0x00, 0x35, 0x08 }, + { 0x00, 0x35, 0x09 }, + { 0x00, 0x35, 0xff }, + { 0x00, 0x35, 0xff }, + { 0x00, 0x35, 0xff }, + { 0x00, 0x35, 0xff }, + // Frequency (H/LFRT) // Version 0x00 { 0x10, 0x00, 0x0d }, @@ -190,6 +214,15 @@ const std::array GridProfileParse { 0x30, 0x03, 0x1a }, { 0x30, 0x03, 0x1b }, + // Version 0x07 + { 0x30, 0x07, 0x17 }, + { 0x30, 0x07, 0x18 }, + { 0x30, 0x07, 0x19 }, + { 0x30, 0x07, 0x1a }, + { 0x30, 0x07, 0x1b }, + { 0x30, 0x07, 0xff }, + { 0x30, 0x07, 0xff }, + // Ramp Rates (RR) // Version 0x00 { 0x40, 0x00, 0x1c }, @@ -217,6 +250,13 @@ const std::array GridProfileParse { 0x50, 0x08, 0x22 }, { 0x50, 0x08, 0x23 }, + // Version 0x11 + { 0x50, 0x11, 0x1e }, + { 0x50, 0x11, 0x1f }, + { 0x50, 0x11, 0x20 }, + { 0x50, 0x11, 0x21 }, + { 0x50, 0x11, 0x22 }, + // Volt Watt (VW) // Version 0x00 { 0x60, 0x00, 0x24 }, @@ -336,7 +376,7 @@ std::list GridProfileParser::getProfile() const do { const uint8_t section_id = _payloadGridProfile[pos]; const uint8_t section_version = _payloadGridProfile[pos + 1]; - const int8_t section_start = getSectionStart(section_id, section_version); + const int16_t section_start = getSectionStart(section_id, section_version); const uint8_t section_size = getSectionSize(section_id, section_version); pos += 2; @@ -382,9 +422,9 @@ uint8_t GridProfileParser::getSectionSize(const uint8_t section_id, const uint8_ return count; } -int8_t GridProfileParser::getSectionStart(const uint8_t section_id, const uint8_t section_version) +int16_t GridProfileParser::getSectionStart(const uint8_t section_id, const uint8_t section_version) { - uint8_t count = -1; + int16_t count = -1; for (auto& values : _profileValues) { count++; if (values.Section == section_id && values.Version == section_version) { diff --git a/lib/Hoymiles/src/parser/GridProfileParser.h b/lib/Hoymiles/src/parser/GridProfileParser.h index 370463d57..031891f3f 100644 --- a/lib/Hoymiles/src/parser/GridProfileParser.h +++ b/lib/Hoymiles/src/parser/GridProfileParser.h @@ -5,7 +5,7 @@ #define GRID_PROFILE_SIZE 141 #define PROFILE_TYPE_COUNT 7 -#define SECTION_VALUE_COUNT 113 +#define SECTION_VALUE_COUNT 144 typedef struct { uint8_t lIdx; @@ -45,7 +45,7 @@ class GridProfileParser : public Parser { private: static uint8_t getSectionSize(const uint8_t section_id, const uint8_t section_version); - static int8_t getSectionStart(const uint8_t section_id, const uint8_t section_version); + static int16_t getSectionStart(const uint8_t section_id, const uint8_t section_version); uint8_t _payloadGridProfile[GRID_PROFILE_SIZE] = {}; uint8_t _gridProfileLength = 0; From e0cc1559d0da02a1a5c67aabc6dc505a29f37b9e Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sat, 16 Dec 2023 15:03:58 +0100 Subject: [PATCH 02/11] webapp: Fix lint errors --- webapp/src/components/GridProfile.vue | 4 ++-- webapp/src/views/DeviceAdminView.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/src/components/GridProfile.vue b/webapp/src/components/GridProfile.vue index 941a7bc8c..6c93caece 100644 --- a/webapp/src/components/GridProfile.vue +++ b/webapp/src/components/GridProfile.vue @@ -20,7 +20,7 @@
-
+