From eb3fd649c4cbdfc85c96880acb3af5d096384eb3 Mon Sep 17 00:00:00 2001 From: markusrc11 Date: Mon, 28 Oct 2024 15:48:19 +0100 Subject: [PATCH 1/6] Fix B02 test --- spec/Order_B02_spec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/Order_B02_spec.py b/spec/Order_B02_spec.py index b12af95..7d9fb2b 100644 --- a/spec/Order_B02_spec.py +++ b/spec/Order_B02_spec.py @@ -24,7 +24,8 @@ 'id_pet': str(1234), 'id_req': 'B02', 'cnc': 'CIR000000000', - 'cnt': 'CNT000000000' + 'cnt': 'CNT000000000', + 'version': '3.1.c' } payload = { 'activation_date': datetime(2021, 4, 1), From a2111b6e2bf66d795622a961bcae0a636bfcb366 Mon Sep 17 00:00:00 2001 From: markusrc11 Date: Mon, 28 Oct 2024 15:48:25 +0100 Subject: [PATCH 2/6] Fix B07 test --- spec/Order_B07_spec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/Order_B07_spec.py b/spec/Order_B07_spec.py index 54d9b2b..83757e1 100644 --- a/spec/Order_B07_spec.py +++ b/spec/Order_B07_spec.py @@ -15,10 +15,11 @@ 'id_pet': '1234', 'id_req': 'B07', 'cnc': 'CIR000000000', + 'version': '3.1.c' } payload = { 'IPftp': '10.1.5.206', } - order = Order('B07_ipftp') + order = Order('B07_ip') order = order.create(generic_values, payload) expect(order).to(equal(expected_result)) From 349d9501badfa3517a7f5f44f57cc3d3c2085511 Mon Sep 17 00:00:00 2001 From: markusrc11 Date: Mon, 28 Oct 2024 15:48:43 +0100 Subject: [PATCH 3/6] Fix getting values integer/float --- primestg/report/reports.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/primestg/report/reports.py b/primestg/report/reports.py index 6899593..ff1bdd6 100644 --- a/primestg/report/reports.py +++ b/primestg/report/reports.py @@ -7,8 +7,8 @@ from primestg.message import MessageS from primestg.utils import octet2name, octet2number -SUPPORTED_REPORTS = ['S02', 'S04', 'S05', 'S06', 'S09', 'S12', 'S13', 'S14', 'S15', - 'S17', 'S18', 'S23', 'S24', 'S27', 'S42', 'S52'] +SUPPORTED_REPORTS = ['S01', 'S02', 'S04', 'S05', 'S06', 'S09', 'S12', 'S13', 'S14', 'S15', + 'S17', 'S18', 'S21', 'S23', 'S24', 'S26', 'S27', 'S42', 'S52'] def is_supported(report_code): @@ -154,19 +154,19 @@ def values(self): 'timestamp': self._get_timestamp('Fh'), 'season': self.objectified.get('Fh')[-1:], 'active_quadrant': get_integer_value(temp_values.get('Ca', 0)), - 'current_sum_3_phases': get_integer_value(temp_values.get('I3', 0.0)), + 'current_sum_3_phases': get_float_value(temp_values.get('I3', 0.0)), - 'voltage1': get_integer_value(temp_values.get('L1v', 0.0)), - 'current1': get_integer_value(temp_values.get('L1i', 0.0)), + 'voltage1': get_integer_value(temp_values.get('L1v', 0)), + 'current1': get_float_value(temp_values.get('L1i', 0.0)), 'active_power_import1': get_integer_value(temp_values.get('Pimp', 0)), 'active_power_export1': get_integer_value(temp_values.get('Pexp', 0)), 'reactive_power_import1': get_integer_value(temp_values.get('Qimp', 0)), 'reactive_power_export1': get_integer_value(temp_values.get('Qexp', 0)), - 'power_factor1': get_integer_value(temp_values.get('PF', 0.0)), + 'power_factor1': get_float_value(temp_values.get('PF', 0.0)), 'active_quadrant_phase1': 0, - 'voltage2': get_integer_value(temp_values.get('L2v', 0.0)), - 'current2': get_integer_value(temp_values.get('L2i', 0.0)), + 'voltage2': get_integer_value(temp_values.get('L2v', 0)), + 'current2': get_float_value(temp_values.get('L2i', 0.0)), 'active_power_import2': 0, 'active_power_export2': 0, 'reactive_power_import2': 0, @@ -174,14 +174,14 @@ def values(self): 'power_factor2': 0.0, 'active_quadrant_phase2': 0, - 'voltage3': get_integer_value(temp_values.get('L3v', 0.0)), - 'current3': get_integer_value(temp_values.get('L3i', 0.0)), + 'voltage3': get_integer_value(temp_values.get('L3v', 0)), + 'current3': get_float_value(temp_values.get('L3i', 0.0)), 'active_power_import3': 0, 'active_power_export3': 0, 'reactive_power_import3': 0, 'reactive_power_export3': 0, 'power_factor3': 0.0, - 'active_quadrant_phase3': 0.0, + 'active_quadrant_phase3': 0, 'phase_presence': [get_integer_value(i) for i in (temp_values.get('PP', '0')).split(",")], 'meter_phase': get_integer_value(temp_values.get('Fc', 0)), From 17f0000724e0be32a5498e3c5d3defc306196de1 Mon Sep 17 00:00:00 2001 From: markusrc11 Date: Mon, 28 Oct 2024 15:49:06 +0100 Subject: [PATCH 4/6] Fix S26 tests --- spec/Report_S26_spec.py | 7 ++++--- spec/data/{S26_result.txt => S26.xml_result.txt} | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) rename spec/data/{S26_result.txt => S26.xml_result.txt} (94%) diff --git a/spec/Report_S26_spec.py b/spec/Report_S26_spec.py index 94079eb..5e1f70c 100644 --- a/spec/Report_S26_spec.py +++ b/spec/Report_S26_spec.py @@ -21,6 +21,7 @@ expected_first_value_first_meter = [ { 'timestamp': '2024-09-09 11:58:58', + 'season': 'S', 'active_quadrant': 0, 'current_sum_3_phases': 23.0, @@ -33,7 +34,7 @@ 'power_factor1': 0.0, 'active_quadrant_phase1': 0, - 'voltage2': 0.0, + 'voltage2': 0, 'current2': 0.0, 'active_power_import2': 0, 'active_power_export2': 0, @@ -42,7 +43,7 @@ 'power_factor2': 0.0, 'active_quadrant_phase2': 0, - 'voltage3': 0.0, + 'voltage3': 0, 'current3': 0.0, 'active_power_import3': 0, 'active_power_export3': 0, @@ -90,4 +91,4 @@ result.append(value) if meter.warnings: warnings.append(meter.warnings) - expect(result).to(equal(expected_result)) \ No newline at end of file + expect(result).to(equal(expected_result)) diff --git a/spec/data/S26_result.txt b/spec/data/S26.xml_result.txt similarity index 94% rename from spec/data/S26_result.txt rename to spec/data/S26.xml_result.txt index 008a370..0639a2c 100644 --- a/spec/data/S26_result.txt +++ b/spec/data/S26.xml_result.txt @@ -1,6 +1,7 @@ [ { 'timestamp': '2024-09-09 11:58:58', + 'season': 'S', 'active_quadrant': 0, 'current_sum_3_phases': 23.0, @@ -13,7 +14,7 @@ 'power_factor1': 0.0, 'active_quadrant_phase1': 0, - 'voltage2': 0.0, + 'voltage2': 0, 'current2': 0.0, 'active_power_import2': 0, 'active_power_export2': 0, @@ -22,7 +23,7 @@ 'power_factor2': 0.0, 'active_quadrant_phase2': 0, - 'voltage3': 0.0, + 'voltage3': 0, 'current3': 0.0, 'active_power_import3': 0, 'active_power_export3': 0, @@ -47,6 +48,7 @@ }, { 'timestamp': '2024-09-09 12:00:14', + 'season': 'S', 'active_quadrant': 0, 'current_sum_3_phases': 23.1, @@ -59,7 +61,7 @@ 'power_factor1': 0.0, 'active_quadrant_phase1': 0, - 'voltage2': 0.0, + 'voltage2': 0, 'current2': 0.0, 'active_power_import2': 0, 'active_power_export2': 0, @@ -68,7 +70,7 @@ 'power_factor2': 0.0, 'active_quadrant_phase2': 0, - 'voltage3': 0.0, + 'voltage3': 0, 'current3': 0.0, 'active_power_import3': 0, 'active_power_export3': 0, From dd15c31fce2a0ab8e336e79dac2c0def0dcdba22 Mon Sep 17 00:00:00 2001 From: markusrc11 Date: Mon, 28 Oct 2024 16:00:04 +0100 Subject: [PATCH 5/6] Fix S21 tests --- spec/Report_S21_spec.py | 1 + spec/data/S21.xml_result.txt | 1 + spec/data/S21_with_error.xml_result.txt | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/Report_S21_spec.py b/spec/Report_S21_spec.py index 9838e62..77185c0 100644 --- a/spec/Report_S21_spec.py +++ b/spec/Report_S21_spec.py @@ -23,6 +23,7 @@ expected_first_value_first_meter = [ { 'timestamp': '2019-10-15 15:27:14', + 'season': 'S', 'active_quadrant': 4, 'current_sum_3_phases': 8.2, diff --git a/spec/data/S21.xml_result.txt b/spec/data/S21.xml_result.txt index d5df100..60d0b54 100644 --- a/spec/data/S21.xml_result.txt +++ b/spec/data/S21.xml_result.txt @@ -1,6 +1,7 @@ [ { 'timestamp': '2019-10-15 15:27:14', + 'season': 'S', 'active_quadrant': 4, 'current_sum_3_phases': 8.2, diff --git a/spec/data/S21_with_error.xml_result.txt b/spec/data/S21_with_error.xml_result.txt index 2fc6a5b..5e92c5b 100644 --- a/spec/data/S21_with_error.xml_result.txt +++ b/spec/data/S21_with_error.xml_result.txt @@ -1,2 +1,2 @@ -[{'meter_phase': 5, 'ae': 0, 'ai': 254, 'voltage2': 0, 'voltage3': 0, 'voltage1': 236, 'current_switch_state': 1, 'cnc_name': 'ZIV0004394488', 'current_sum_3_phases': 0.0, 'power_factor1': 1.0, 'active_power_import2': 0, 'name': 'ZIV0040318130', 'reactive_power_import1': 0, 'reactive_power_import3': 0, 'reactive_power_import2': 0, 'active_power_export3': 0, 'active_power_export2': 0, 'active_power_export1': 0, 'timestamp': '2019-10-16 13:27:00', 'power_factor2': 0, 'power_factor3': 0, 'reactive_power_export2': 0, 'reactive_power_export3': 0, 'active_quadrant_phase3': 0, 'active_quadrant_phase2': 0, 'active_power_import1': 450, 'active_quadrant': 1, 'active_power_import3': 0, 'current1': 1.9, 'current3': 0.0, 'current2': 0.0, 'r4': 0, 'active_quadrant_phase1': 1, 'r1': 274, 'r2': 0, 'r3': 0, 'previous_switch_state': 0, 'reactive_power_export1': 0, 'phase_presence': [4]}] +[{'meter_phase': 5, 'ae': 0, 'ai': 254, 'voltage2': 0, 'voltage3': 0, 'voltage1': 236, 'current_switch_state': 1, 'cnc_name': 'ZIV0004394488', 'current_sum_3_phases': 0.0, 'power_factor1': 1.0, 'active_power_import2': 0, 'name': 'ZIV0040318130', 'reactive_power_import1': 0, 'reactive_power_import3': 0, 'reactive_power_import2': 0, 'active_power_export3': 0, 'active_power_export2': 0, 'active_power_export1': 0, 'timestamp': '2019-10-16 13:27:00', 'season': 'S', 'power_factor2': 0, 'power_factor3': 0, 'reactive_power_export2': 0, 'reactive_power_export3': 0, 'active_quadrant_phase3': 0, 'active_quadrant_phase2': 0, 'active_power_import1': 450, 'active_quadrant': 1, 'active_power_import3': 0, 'current1': 1.9, 'current3': 0.0, 'current2': 0.0, 'r4': 0, 'active_quadrant_phase1': 1, 'r1': 274, 'r2': 0, 'r3': 0, 'previous_switch_state': 0, 'reactive_power_export1': 0, 'phase_presence': [4]}] From 9404b761187fc46510ee2d41ae2df294b4c7d19c Mon Sep 17 00:00:00 2001 From: markusrc11 Date: Mon, 28 Oct 2024 16:00:10 +0100 Subject: [PATCH 6/6] Fix S01 tests --- spec/Report_S01_spec.py | 1 + spec/data/S01.xml_result.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/Report_S01_spec.py b/spec/Report_S01_spec.py index e605a19..b870bf9 100644 --- a/spec/Report_S01_spec.py +++ b/spec/Report_S01_spec.py @@ -22,6 +22,7 @@ expected_first_value_first_meter = [ { 'timestamp': '2019-10-15 15:26:17', + 'season': 'S', 'voltage': 230, 'current': 0.0, 'active_power_import': 1870, diff --git a/spec/data/S01.xml_result.txt b/spec/data/S01.xml_result.txt index 2570a28..63c00ef 100644 --- a/spec/data/S01.xml_result.txt +++ b/spec/data/S01.xml_result.txt @@ -1,6 +1,7 @@ [ { 'timestamp': '2019-10-15 15:26:17', + 'season': 'S', 'voltage': 230, 'current': 0.0, 'active_power_import': 1870,