DLMS-SPODES 0.87.13__py3-none-any.whl → 0.87.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. DLMS_SPODES/Values/EN/__init__.py +1 -1
  2. DLMS_SPODES/Values/EN/actors.py +8 -8
  3. DLMS_SPODES/Values/EN/relation_to_obis_names.py +387 -387
  4. DLMS_SPODES/Values/RU/__init__.py +1 -1
  5. DLMS_SPODES/Values/RU/actors.py +8 -8
  6. DLMS_SPODES/Values/RU/relation_to_obis_names.py +396 -396
  7. DLMS_SPODES/__init__.py +6 -6
  8. DLMS_SPODES/configEN.ini +126 -126
  9. DLMS_SPODES/config_parser.py +53 -53
  10. DLMS_SPODES/cosem_interface_classes/__class_init__.py +3 -3
  11. DLMS_SPODES/cosem_interface_classes/__init__.py +1 -1
  12. DLMS_SPODES/cosem_interface_classes/a_parameter.py +20 -20
  13. DLMS_SPODES/cosem_interface_classes/activity_calendar.py +254 -254
  14. DLMS_SPODES/cosem_interface_classes/arbitrator.py +105 -105
  15. DLMS_SPODES/cosem_interface_classes/association_ln/abstract.py +34 -34
  16. DLMS_SPODES/cosem_interface_classes/association_ln/authentication_mechanism_name.py +25 -25
  17. DLMS_SPODES/cosem_interface_classes/association_ln/mechanism_id.py +25 -25
  18. DLMS_SPODES/cosem_interface_classes/association_ln/method.py +5 -5
  19. DLMS_SPODES/cosem_interface_classes/association_ln/ver0.py +485 -485
  20. DLMS_SPODES/cosem_interface_classes/association_ln/ver1.py +133 -133
  21. DLMS_SPODES/cosem_interface_classes/association_ln/ver2.py +36 -36
  22. DLMS_SPODES/cosem_interface_classes/association_ln/ver3.py +4 -4
  23. DLMS_SPODES/cosem_interface_classes/association_sn/ver0.py +12 -12
  24. DLMS_SPODES/cosem_interface_classes/attr_indexes.py +12 -12
  25. DLMS_SPODES/cosem_interface_classes/clock.py +131 -131
  26. DLMS_SPODES/cosem_interface_classes/collection.py +2122 -2122
  27. DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py +583 -583
  28. DLMS_SPODES/cosem_interface_classes/data.py +21 -21
  29. DLMS_SPODES/cosem_interface_classes/demand_register/ver0.py +59 -59
  30. DLMS_SPODES/cosem_interface_classes/disconnect_control.py +74 -74
  31. DLMS_SPODES/cosem_interface_classes/extended_register.py +27 -27
  32. DLMS_SPODES/cosem_interface_classes/gprs_modem_setup.py +43 -43
  33. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver0.py +103 -103
  34. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver1.py +40 -40
  35. DLMS_SPODES/cosem_interface_classes/gsm_diagnostic/ver2.py +9 -9
  36. DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver0.py +11 -11
  37. DLMS_SPODES/cosem_interface_classes/iec_hdlc_setup/ver1.py +53 -53
  38. DLMS_SPODES/cosem_interface_classes/iec_local_port_setup.py +11 -11
  39. DLMS_SPODES/cosem_interface_classes/image_transfer/image_transfer_status.py +15 -15
  40. DLMS_SPODES/cosem_interface_classes/image_transfer/ver0.py +126 -126
  41. DLMS_SPODES/cosem_interface_classes/implementations/__init__.py +3 -3
  42. DLMS_SPODES/cosem_interface_classes/implementations/arbitrator.py +19 -19
  43. DLMS_SPODES/cosem_interface_classes/implementations/data.py +487 -487
  44. DLMS_SPODES/cosem_interface_classes/implementations/profile_generic.py +83 -83
  45. DLMS_SPODES/cosem_interface_classes/ipv4_setup.py +72 -72
  46. DLMS_SPODES/cosem_interface_classes/limiter.py +111 -111
  47. DLMS_SPODES/cosem_interface_classes/ln_pattern.py +333 -333
  48. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver0.py +65 -65
  49. DLMS_SPODES/cosem_interface_classes/modem_configuration/ver1.py +39 -39
  50. DLMS_SPODES/cosem_interface_classes/ntp_setup/ver0.py +67 -67
  51. DLMS_SPODES/cosem_interface_classes/obis.py +23 -23
  52. DLMS_SPODES/cosem_interface_classes/overview.py +197 -197
  53. DLMS_SPODES/cosem_interface_classes/parameter.py +547 -547
  54. DLMS_SPODES/cosem_interface_classes/parameters.py +172 -172
  55. DLMS_SPODES/cosem_interface_classes/profile_generic/ver0.py +122 -122
  56. DLMS_SPODES/cosem_interface_classes/profile_generic/ver1.py +277 -277
  57. DLMS_SPODES/cosem_interface_classes/push_setup/ver0.py +12 -12
  58. DLMS_SPODES/cosem_interface_classes/push_setup/ver1.py +10 -10
  59. DLMS_SPODES/cosem_interface_classes/push_setup/ver2.py +166 -166
  60. DLMS_SPODES/cosem_interface_classes/register.py +45 -45
  61. DLMS_SPODES/cosem_interface_classes/register_activation/ver0.py +80 -80
  62. DLMS_SPODES/cosem_interface_classes/register_monitor.py +46 -46
  63. DLMS_SPODES/cosem_interface_classes/reports.py +70 -70
  64. DLMS_SPODES/cosem_interface_classes/schedule.py +176 -176
  65. DLMS_SPODES/cosem_interface_classes/script_table.py +87 -87
  66. DLMS_SPODES/cosem_interface_classes/security_setup/ver0.py +68 -68
  67. DLMS_SPODES/cosem_interface_classes/security_setup/ver1.py +158 -158
  68. DLMS_SPODES/cosem_interface_classes/single_action_schedule.py +50 -50
  69. DLMS_SPODES/cosem_interface_classes/special_days_table.py +84 -84
  70. DLMS_SPODES/cosem_interface_classes/tcp_udp_setup.py +42 -42
  71. DLMS_SPODES/cosem_pdu.py +93 -93
  72. DLMS_SPODES/enums.py +625 -625
  73. DLMS_SPODES/exceptions.py +106 -106
  74. DLMS_SPODES/firmwares.py +99 -99
  75. DLMS_SPODES/hdlc/frame.py +875 -875
  76. DLMS_SPODES/hdlc/sub_layer.py +54 -54
  77. DLMS_SPODES/literals.py +17 -17
  78. DLMS_SPODES/obis/__init__.py +1 -1
  79. DLMS_SPODES/obis/media_id.py +931 -931
  80. DLMS_SPODES/pardata.py +22 -22
  81. DLMS_SPODES/pdu_enums.py +98 -98
  82. DLMS_SPODES/relation_to_OBIS.py +465 -463
  83. DLMS_SPODES/settings.py +551 -551
  84. DLMS_SPODES/types/choices.py +142 -142
  85. DLMS_SPODES/types/common_data_types.py +2401 -2401
  86. DLMS_SPODES/types/cosem_service_types.py +109 -109
  87. DLMS_SPODES/types/implementations/arrays.py +25 -25
  88. DLMS_SPODES/types/implementations/bitstrings.py +97 -97
  89. DLMS_SPODES/types/implementations/double_long_usingneds.py +35 -35
  90. DLMS_SPODES/types/implementations/enums.py +57 -57
  91. DLMS_SPODES/types/implementations/integers.py +11 -11
  92. DLMS_SPODES/types/implementations/long_unsigneds.py +127 -127
  93. DLMS_SPODES/types/implementations/octet_string.py +11 -11
  94. DLMS_SPODES/types/implementations/structs.py +64 -64
  95. DLMS_SPODES/types/useful_types.py +677 -677
  96. {dlms_spodes-0.87.13.dist-info → dlms_spodes-0.87.16.dist-info}/METADATA +30 -30
  97. dlms_spodes-0.87.16.dist-info/RECORD +117 -0
  98. {dlms_spodes-0.87.13.dist-info → dlms_spodes-0.87.16.dist-info}/WHEEL +1 -1
  99. dlms_spodes-0.87.13.dist-info/RECORD +0 -117
  100. {dlms_spodes-0.87.13.dist-info → dlms_spodes-0.87.16.dist-info}/top_level.txt +0 -0
@@ -1,83 +1,83 @@
1
- from ..profile_generic import ver0, ver1
2
- from ...types.implementations import structs, enums
3
- from ...types import ut, cdt
4
-
5
-
6
- class SPODES3ScalesProfile(ver1.ProfileGeneric):
7
- """Cosem3 Для профилей масштаба"""
8
- A_ELEMENTS = (
9
- ver1.ic.ICAElement(
10
- NAME=ver1.ProfileGeneric.A_ELEMENTS[0].NAME,
11
- DATA_TYPE=ver1.ProfileGeneric.A_ELEMENTS[0].DATA_TYPE),
12
- *ver1.ProfileGeneric.A_ELEMENTS[1:])
13
- """override buffer with STATIC classifier"""
14
-
15
-
16
- class SPODES3CurrentProfile(ver1.ProfileGeneric):
17
- """Cosem3 Б.1 Текущие значения"""
18
- scaler_profile_key = bytes((1, 0, 94, 7, 3, 255))
19
-
20
-
21
- class SPODES3MonthProfile(ver1.ProfileGeneric):
22
- """СПОДЭС3 В.4 Параметры ежемесячного профиля"""
23
- scaler_profile_key = bytes((1, 0, 94, 7, 1, 255))
24
-
25
-
26
- class SPODES3DailyProfile(ver1.ProfileGeneric):
27
- """СПОДЭС3 В.3 Параметры ежесуточного профиля"""
28
- scaler_profile_key = bytes((1, 0, 94, 7, 2, 255))
29
-
30
-
31
- class SPODES3LoadProfile(ver1.ProfileGeneric):
32
- """СПОДЭС3 В.2 Параметры профиля нагрузки"""
33
- scaler_profile_key = bytes((1, 0, 94, 7, 4, 255))
34
-
35
-
36
- class CaptureObjectsDisplayReadout(ver1.CaptureObjects):
37
- """for DisplayReadout special"""
38
-
39
-
40
- class SPODES3DisplayReadout(ver1.ProfileGeneric):
41
- """СПОДЭС3 13.12. Настройка индикации"""
42
- A_ELEMENTS = (ver1.ProfileGeneric.A_ELEMENTS[0],
43
- ver1.ProfileGeneric.A_ELEMENTS[1].get_change(data_type=CaptureObjectsDisplayReadout),
44
- ver1.ProfileGeneric.A_ELEMENTS[2],
45
- ver1.ProfileGeneric.A_ELEMENTS[3],
46
- ver1.ProfileGeneric.A_ELEMENTS[4],
47
- ver1.ProfileGeneric.A_ELEMENTS[5],
48
- ver1.ProfileGeneric.A_ELEMENTS[6])
49
-
50
- def characteristics_init(self):
51
- self.set_attr(ver0.BUFFER, None)
52
- self.buffer.register_cb_preset(lambda _: self.__create_buffer_struct_type()) # value not used for creating struct type
53
-
54
- self._cbs_attr_post_init.update({ver0.CAPTURE_OBJECTS: self.__create_buffer_struct_type})
55
-
56
- self.buffer_capture_objects = self.capture_objects
57
- """ objects for buffer. Change with access_selection """
58
-
59
- def __create_buffer_struct_type(self):
60
- """ TODO: more refactoring !!! """
61
- # rename CaptureObjectDefinition's and adding object if it absense in collection
62
- for el_value in self.capture_objects:
63
- el_value: structs.CaptureObjectDefinition
64
- obj = self.collection.add_if_missing(class_id=ut.CosemClassId(el_value.class_id.contents),
65
- version=None,
66
- logical_name=el_value.logical_name)
67
- el_value.set_name(self.collection.get_name_and_type(el_value)[0][-1])
68
- self.buffer_capture_objects = self.capture_objects
69
- buffer_elements: list[cdt.StructElement] = list()
70
- for el_value in self.buffer_capture_objects:
71
- names, type_ = self.collection.get_name_and_type(el_value)
72
- buffer_elements.append(cdt.StructElement(NAME=". ".join(names), TYPE=cdt.Boolean))
73
-
74
- class Entry(cdt.Structure):
75
- """ The number and the order of the elements of the structure holding the entries is the same as in the definition of the capture_objects.
76
- The buffer is filled by auto captures or by subsequent calls of the method (capture). The sequence of the entries within the array is ordered
77
- according to the sort method specified. Default: The buffer is empty after reset.
78
- REMARK 1 Reading the entire buffer delivers only those entries, which are “in use”.
79
- REMARK 2 The value of a captured object may be replaced by “null-data” if it can be unambiguously recovered from the previous value
80
- (e.g. for time: if it can be calculated from the previous value and capture_period; or for a value: if it is equal to the previous value). """
81
- ELEMENTS = tuple(buffer_elements)
82
-
83
- self.buffer.set_type(Entry)
1
+ from ..profile_generic import ver0, ver1
2
+ from ...types.implementations import structs, enums
3
+ from ...types import ut, cdt
4
+
5
+
6
+ class SPODES3ScalesProfile(ver1.ProfileGeneric):
7
+ """Cosem3 Для профилей масштаба"""
8
+ A_ELEMENTS = (
9
+ ver1.ic.ICAElement(
10
+ NAME=ver1.ProfileGeneric.A_ELEMENTS[0].NAME,
11
+ DATA_TYPE=ver1.ProfileGeneric.A_ELEMENTS[0].DATA_TYPE),
12
+ *ver1.ProfileGeneric.A_ELEMENTS[1:])
13
+ """override buffer with STATIC classifier"""
14
+
15
+
16
+ class SPODES3CurrentProfile(ver1.ProfileGeneric):
17
+ """Cosem3 Б.1 Текущие значения"""
18
+ scaler_profile_key = bytes((1, 0, 94, 7, 3, 255))
19
+
20
+
21
+ class SPODES3MonthProfile(ver1.ProfileGeneric):
22
+ """СПОДЭС3 В.4 Параметры ежемесячного профиля"""
23
+ scaler_profile_key = bytes((1, 0, 94, 7, 1, 255))
24
+
25
+
26
+ class SPODES3DailyProfile(ver1.ProfileGeneric):
27
+ """СПОДЭС3 В.3 Параметры ежесуточного профиля"""
28
+ scaler_profile_key = bytes((1, 0, 94, 7, 2, 255))
29
+
30
+
31
+ class SPODES3LoadProfile(ver1.ProfileGeneric):
32
+ """СПОДЭС3 В.2 Параметры профиля нагрузки"""
33
+ scaler_profile_key = bytes((1, 0, 94, 7, 4, 255))
34
+
35
+
36
+ class CaptureObjectsDisplayReadout(ver1.CaptureObjects):
37
+ """for DisplayReadout special"""
38
+
39
+
40
+ class SPODES3DisplayReadout(ver1.ProfileGeneric):
41
+ """СПОДЭС3 13.12. Настройка индикации"""
42
+ A_ELEMENTS = (ver1.ProfileGeneric.A_ELEMENTS[0],
43
+ ver1.ProfileGeneric.A_ELEMENTS[1].get_change(data_type=CaptureObjectsDisplayReadout),
44
+ ver1.ProfileGeneric.A_ELEMENTS[2],
45
+ ver1.ProfileGeneric.A_ELEMENTS[3],
46
+ ver1.ProfileGeneric.A_ELEMENTS[4],
47
+ ver1.ProfileGeneric.A_ELEMENTS[5],
48
+ ver1.ProfileGeneric.A_ELEMENTS[6])
49
+
50
+ def characteristics_init(self):
51
+ self.set_attr(ver0.BUFFER, None)
52
+ self.buffer.register_cb_preset(lambda _: self.__create_buffer_struct_type()) # value not used for creating struct type
53
+
54
+ self._cbs_attr_post_init.update({ver0.CAPTURE_OBJECTS: self.__create_buffer_struct_type})
55
+
56
+ self.buffer_capture_objects = self.capture_objects
57
+ """ objects for buffer. Change with access_selection """
58
+
59
+ def __create_buffer_struct_type(self):
60
+ """ TODO: more refactoring !!! """
61
+ # rename CaptureObjectDefinition's and adding object if it absense in collection
62
+ for el_value in self.capture_objects:
63
+ el_value: structs.CaptureObjectDefinition
64
+ obj = self.collection.add_if_missing(class_id=ut.CosemClassId(el_value.class_id.contents),
65
+ version=None,
66
+ logical_name=el_value.logical_name)
67
+ el_value.set_name(self.collection.get_name_and_type(el_value)[0][-1])
68
+ self.buffer_capture_objects = self.capture_objects
69
+ buffer_elements: list[cdt.StructElement] = list()
70
+ for el_value in self.buffer_capture_objects:
71
+ names, type_ = self.collection.get_name_and_type(el_value)
72
+ buffer_elements.append(cdt.StructElement(NAME=". ".join(names), TYPE=cdt.Boolean))
73
+
74
+ class Entry(cdt.Structure):
75
+ """ The number and the order of the elements of the structure holding the entries is the same as in the definition of the capture_objects.
76
+ The buffer is filled by auto captures or by subsequent calls of the method (capture). The sequence of the entries within the array is ordered
77
+ according to the sort method specified. Default: The buffer is empty after reset.
78
+ REMARK 1 Reading the entire buffer delivers only those entries, which are “in use”.
79
+ REMARK 2 The value of a captured object may be replaced by “null-data” if it can be unambiguously recovered from the previous value
80
+ (e.g. for time: if it can be calculated from the previous value and capture_period; or for a value: if it is equal to the previous value). """
81
+ ELEMENTS = tuple(buffer_elements)
82
+
83
+ self.buffer.set_type(Entry)
@@ -1,72 +1,72 @@
1
- from .__class_init__ import *
2
- from ..types.implementations import double_long_usingneds, arrays
3
- from .overview import VERSION_0
4
-
5
-
6
- class IPOptionsElement(cdt.Structure):
7
- IP_Option_Type: cdt.Unsigned
8
- IP_Option_Length: cdt.Unsigned
9
- IP_Option_Data: cdt.OctetString
10
-
11
-
12
- class IPOptions(cdt.Array):
13
- TYPE = IPOptionsElement
14
-
15
-
16
- class IPv4Setup(ic.COSEMInterfaceClasses):
17
- """ This IC allows modelling the setup of teh IPv4 layer, handling all information related to the IP Address settings associated to a given device adn to a lower layer
18
- connection on which these settings are used. There shall be and instance of this IC in a device for each different network interface implemented. For example, if a device has
19
- two interfaces (using the TCP-UDP/ITv4 profile on both of them), there shall be two instances of the IPc4 setup IC in that device: one for each of these interfaces."""
20
- CLASS_ID = ClassID.IPV4_SETUP
21
- VERSION = VERSION_0
22
- # TODO: more 7 attr and 3 methods
23
- A_ELEMENTS = (ic.ICAElement("DL_reference", cst.LogicalName),
24
- ic.ICAElement("IP_address", double_long_usingneds.IPAddress),
25
- ic.ICAElement("multicast_IP_address", arrays.MulticastIPAddress),
26
- ic.ICAElement("IP_options", IPOptions),
27
- ic.ICAElement("subnet_mask", double_long_usingneds.IPAddress),
28
- ic.ICAElement("gateway_IP_address", double_long_usingneds.IPAddress),
29
- ic.ICAElement("use_DHCP_flag", cdt.Boolean),
30
- ic.ICAElement("primary_DNS_address", double_long_usingneds.IPAddress),
31
- ic.ICAElement("secondary_DNS_address", double_long_usingneds.IPAddress),
32
- # TODO: more 3 methods
33
- )
34
-
35
- def characteristics_init(self):
36
- self.set_attr(3, 3232235521)
37
-
38
- @property
39
- def DL_reference(self) -> cdt.OctetString:
40
- return self.get_attr(2)
41
-
42
- @property
43
- def IP_address(self) -> double_long_usingneds.IPAddress:
44
- return self.get_attr(3)
45
-
46
- @property
47
- def multicast_IP_address(self) -> arrays.MulticastIPAddress:
48
- return self.get_attr(4)
49
-
50
- @property
51
- def IP_options(self) -> IPOptions:
52
- return self.get_attr(5)
53
-
54
- @property
55
- def subnet_mask(self) -> double_long_usingneds.IPAddress:
56
- return self.get_attr(6)
57
-
58
- @property
59
- def gateway_IP_address(self) -> double_long_usingneds.IPAddress:
60
- return self.get_attr(7)
61
-
62
- @property
63
- def use_DHCP_flag(self) -> cdt.Boolean:
64
- return self.get_attr(8)
65
-
66
- @property
67
- def primary_DNS_address(self) -> double_long_usingneds.IPAddress:
68
- return self.get_attr(9)
69
-
70
- @property
71
- def secondary_DNS_address(self) -> double_long_usingneds.IPAddress:
72
- return self.get_attr(10)
1
+ from .__class_init__ import *
2
+ from ..types.implementations import double_long_usingneds, arrays
3
+ from .overview import VERSION_0
4
+
5
+
6
+ class IPOptionsElement(cdt.Structure):
7
+ IP_Option_Type: cdt.Unsigned
8
+ IP_Option_Length: cdt.Unsigned
9
+ IP_Option_Data: cdt.OctetString
10
+
11
+
12
+ class IPOptions(cdt.Array):
13
+ TYPE = IPOptionsElement
14
+
15
+
16
+ class IPv4Setup(ic.COSEMInterfaceClasses):
17
+ """ This IC allows modelling the setup of teh IPv4 layer, handling all information related to the IP Address settings associated to a given device adn to a lower layer
18
+ connection on which these settings are used. There shall be and instance of this IC in a device for each different network interface implemented. For example, if a device has
19
+ two interfaces (using the TCP-UDP/ITv4 profile on both of them), there shall be two instances of the IPc4 setup IC in that device: one for each of these interfaces."""
20
+ CLASS_ID = ClassID.IPV4_SETUP
21
+ VERSION = VERSION_0
22
+ # TODO: more 7 attr and 3 methods
23
+ A_ELEMENTS = (ic.ICAElement("DL_reference", cst.LogicalName),
24
+ ic.ICAElement("IP_address", double_long_usingneds.IPAddress),
25
+ ic.ICAElement("multicast_IP_address", arrays.MulticastIPAddress),
26
+ ic.ICAElement("IP_options", IPOptions),
27
+ ic.ICAElement("subnet_mask", double_long_usingneds.IPAddress),
28
+ ic.ICAElement("gateway_IP_address", double_long_usingneds.IPAddress),
29
+ ic.ICAElement("use_DHCP_flag", cdt.Boolean),
30
+ ic.ICAElement("primary_DNS_address", double_long_usingneds.IPAddress),
31
+ ic.ICAElement("secondary_DNS_address", double_long_usingneds.IPAddress),
32
+ # TODO: more 3 methods
33
+ )
34
+
35
+ def characteristics_init(self):
36
+ self.set_attr(3, 3232235521)
37
+
38
+ @property
39
+ def DL_reference(self) -> cdt.OctetString:
40
+ return self.get_attr(2)
41
+
42
+ @property
43
+ def IP_address(self) -> double_long_usingneds.IPAddress:
44
+ return self.get_attr(3)
45
+
46
+ @property
47
+ def multicast_IP_address(self) -> arrays.MulticastIPAddress:
48
+ return self.get_attr(4)
49
+
50
+ @property
51
+ def IP_options(self) -> IPOptions:
52
+ return self.get_attr(5)
53
+
54
+ @property
55
+ def subnet_mask(self) -> double_long_usingneds.IPAddress:
56
+ return self.get_attr(6)
57
+
58
+ @property
59
+ def gateway_IP_address(self) -> double_long_usingneds.IPAddress:
60
+ return self.get_attr(7)
61
+
62
+ @property
63
+ def use_DHCP_flag(self) -> cdt.Boolean:
64
+ return self.get_attr(8)
65
+
66
+ @property
67
+ def primary_DNS_address(self) -> double_long_usingneds.IPAddress:
68
+ return self.get_attr(9)
69
+
70
+ @property
71
+ def secondary_DNS_address(self) -> double_long_usingneds.IPAddress:
72
+ return self.get_attr(10)
@@ -1,111 +1,111 @@
1
- from .. import cosem_interface_classes
2
- from .. import exceptions as exc
3
- from .__class_init__ import *
4
- from ..types import choices
5
- from ..types.implementations import structs, long_unsigneds, double_long_usingneds
6
- from .overview import VERSION_0
7
-
8
-
9
- threshold_scaler_unit = cdt.ScalUnitType(b'\x02\x02\x0f\x00\x16\x07')
10
-
11
-
12
- class ValueDefinitionType(cdt.Structure):
13
- """ Defines an attribute of an object to be monitored. Only attributes with simple data types are allowed. """
14
- class_id: cdt.LongUnsigned
15
- logical_name: cst.LogicalName
16
- attribute_index: cdt.Integer
17
-
18
-
19
- class EmergencyProfileType(cdt.Structure):
20
- """ An emergency_profile is defined by three elements: emergency_profile_id, emergency_activation_time and emergency_duration.
21
- An emergency profile is activated if the emergency_profile_id element matches one of the elements on the emergency_profile _group_id_list, and time matches the
22
- emergency_activation_time and emergency_duration element """
23
- emergency_profile_id: cdt.LongUnsigned
24
- emergency_activation_time: cst.OctetStringDateTime
25
- emergency_duration: double_long_usingneds.DoubleLongUnsignedSecond
26
-
27
-
28
- class EmergencyProfileGroupIdList(cdt.Array):
29
- """ A list of group id-s of the emergency profile. The emergency profile can be activated only if emergency_profile_id element of the emergency_profile_type matches one of the
30
- elements on the emergency_profile_group_id list """
31
- TYPE = cdt.LongUnsigned
32
-
33
-
34
- class ActionType(cdt.Structure):
35
- """ Defines the scripts to be executed when the monitored value crosses the threshold for minimal duration time. """
36
- action_over_threshold: structs.ActionItem
37
- action_under_threshold: structs.ActionItem
38
-
39
-
40
- class Limiter(ic.COSEMInterfaceClasses):
41
- """ Instances of the Limiter interface class allow defining a set of actions that are executed when the value of a value attribute of a monitored object “Data”, “Register”,
42
- “Extended Register”, “Demand Register”, etc. crosses the threshold value for at least minimal duration time.
43
- The threshold value can be normal or emergency threshold. The emergency threshold is activated via the emergency profile defined by emergency profile id, activation start
44
- time, and duration. The emergency profile id element is matched to an emergency profile group id: this mechanism enables the activation of the emergency threshold only
45
- for a specific emergency group. """
46
- CLASS_ID = ClassID.LIMITER
47
- VERSION = VERSION_0
48
- A_ELEMENTS = (ic.ICAElement("monitored_value", structs.ValueDefinition),
49
- ic.ICAElement("threshold_active", choices.simple_dt, classifier=ic.Classifier.DYNAMIC),
50
- ic.ICAElement("threshold_normal", choices.simple_dt),
51
- ic.ICAElement("threshold_emergency", choices.simple_dt),
52
- ic.ICAElement("min_over_threshold_duration", double_long_usingneds.DoubleLongUnsignedSecond),
53
- ic.ICAElement("min_under_threshold_duration", double_long_usingneds.DoubleLongUnsignedSecond),
54
- ic.ICAElement("emergency_profile", EmergencyProfileType),
55
- ic.ICAElement("emergency_profile_group_id_list", EmergencyProfileGroupIdList),
56
- ic.ICAElement("emergency_profile_active", cdt.Boolean, classifier=ic.Classifier.DYNAMIC),
57
- ic.ICAElement("actions", ActionType))
58
-
59
- def characteristics_init(self):
60
- self.set_attr(6, None)
61
- self.set_attr(7, None)
62
- self._cbs_attr_before_init.update({
63
- 3: lambda value: self.__validate_threshold_scaler_unit(3, value),
64
- 4: lambda value: self.__validate_threshold_scaler_unit(4, value),
65
- 5: lambda value: self.__validate_threshold_scaler_unit(5, value)})
66
-
67
- @property
68
- def monitored_value(self) -> structs.ValueDefinition:
69
- return self.get_attr(2)
70
-
71
- @property
72
- def threshold_active(self) -> choices.simple_dt:
73
- return self.get_attr(3)
74
-
75
- @property
76
- def threshold_normal(self) -> choices.simple_dt:
77
- return self.get_attr(4)
78
-
79
- @property
80
- def threshold_emergency(self) -> choices.simple_dt:
81
- return self.get_attr(5)
82
-
83
- @property
84
- def min_over_threshold_duration(self) -> double_long_usingneds.DoubleLongUnsignedSecond:
85
- return self.get_attr(6)
86
-
87
- @property
88
- def min_under_threshold_duration(self) -> double_long_usingneds.DoubleLongUnsignedSecond:
89
- return self.get_attr(7)
90
-
91
- @property
92
- def emergency_profile(self) -> EmergencyProfileType:
93
- return self.get_attr(8)
94
-
95
- @property
96
- def emergency_profile_group_id_list(self) -> EmergencyProfileGroupIdList:
97
- return self.get_attr(9)
98
-
99
- @property
100
- def emergency_profile_active(self) -> cdt.Boolean:
101
- return self.get_attr(10)
102
-
103
- @property
104
- def actions(self) -> ActionType:
105
- return self.get_attr(11)
106
-
107
- def __validate_threshold_scaler_unit(self, index: int, value: cdt.CommonDataTypes):
108
- if self.monitored_value is not None:
109
- """let setup"""
110
- else:
111
- raise exc.EmptyObj(F"don't set attribute: {index} with {value=} because {self} monitored_value is empty")
1
+ from .. import cosem_interface_classes
2
+ from .. import exceptions as exc
3
+ from .__class_init__ import *
4
+ from ..types import choices
5
+ from ..types.implementations import structs, long_unsigneds, double_long_usingneds
6
+ from .overview import VERSION_0
7
+
8
+
9
+ threshold_scaler_unit = cdt.ScalUnitType(b'\x02\x02\x0f\x00\x16\x07')
10
+
11
+
12
+ class ValueDefinitionType(cdt.Structure):
13
+ """ Defines an attribute of an object to be monitored. Only attributes with simple data types are allowed. """
14
+ class_id: cdt.LongUnsigned
15
+ logical_name: cst.LogicalName
16
+ attribute_index: cdt.Integer
17
+
18
+
19
+ class EmergencyProfileType(cdt.Structure):
20
+ """ An emergency_profile is defined by three elements: emergency_profile_id, emergency_activation_time and emergency_duration.
21
+ An emergency profile is activated if the emergency_profile_id element matches one of the elements on the emergency_profile _group_id_list, and time matches the
22
+ emergency_activation_time and emergency_duration element """
23
+ emergency_profile_id: cdt.LongUnsigned
24
+ emergency_activation_time: cst.OctetStringDateTime
25
+ emergency_duration: double_long_usingneds.DoubleLongUnsignedSecond
26
+
27
+
28
+ class EmergencyProfileGroupIdList(cdt.Array):
29
+ """ A list of group id-s of the emergency profile. The emergency profile can be activated only if emergency_profile_id element of the emergency_profile_type matches one of the
30
+ elements on the emergency_profile_group_id list """
31
+ TYPE = cdt.LongUnsigned
32
+
33
+
34
+ class ActionType(cdt.Structure):
35
+ """ Defines the scripts to be executed when the monitored value crosses the threshold for minimal duration time. """
36
+ action_over_threshold: structs.ActionItem
37
+ action_under_threshold: structs.ActionItem
38
+
39
+
40
+ class Limiter(ic.COSEMInterfaceClasses):
41
+ """ Instances of the Limiter interface class allow defining a set of actions that are executed when the value of a value attribute of a monitored object “Data”, “Register”,
42
+ “Extended Register”, “Demand Register”, etc. crosses the threshold value for at least minimal duration time.
43
+ The threshold value can be normal or emergency threshold. The emergency threshold is activated via the emergency profile defined by emergency profile id, activation start
44
+ time, and duration. The emergency profile id element is matched to an emergency profile group id: this mechanism enables the activation of the emergency threshold only
45
+ for a specific emergency group. """
46
+ CLASS_ID = ClassID.LIMITER
47
+ VERSION = VERSION_0
48
+ A_ELEMENTS = (ic.ICAElement("monitored_value", structs.ValueDefinition),
49
+ ic.ICAElement("threshold_active", choices.simple_dt, classifier=ic.Classifier.DYNAMIC),
50
+ ic.ICAElement("threshold_normal", choices.simple_dt),
51
+ ic.ICAElement("threshold_emergency", choices.simple_dt),
52
+ ic.ICAElement("min_over_threshold_duration", double_long_usingneds.DoubleLongUnsignedSecond),
53
+ ic.ICAElement("min_under_threshold_duration", double_long_usingneds.DoubleLongUnsignedSecond),
54
+ ic.ICAElement("emergency_profile", EmergencyProfileType),
55
+ ic.ICAElement("emergency_profile_group_id_list", EmergencyProfileGroupIdList),
56
+ ic.ICAElement("emergency_profile_active", cdt.Boolean, classifier=ic.Classifier.DYNAMIC),
57
+ ic.ICAElement("actions", ActionType))
58
+
59
+ def characteristics_init(self):
60
+ self.set_attr(6, None)
61
+ self.set_attr(7, None)
62
+ self._cbs_attr_before_init.update({
63
+ 3: lambda value: self.__validate_threshold_scaler_unit(3, value),
64
+ 4: lambda value: self.__validate_threshold_scaler_unit(4, value),
65
+ 5: lambda value: self.__validate_threshold_scaler_unit(5, value)})
66
+
67
+ @property
68
+ def monitored_value(self) -> structs.ValueDefinition:
69
+ return self.get_attr(2)
70
+
71
+ @property
72
+ def threshold_active(self) -> choices.simple_dt:
73
+ return self.get_attr(3)
74
+
75
+ @property
76
+ def threshold_normal(self) -> choices.simple_dt:
77
+ return self.get_attr(4)
78
+
79
+ @property
80
+ def threshold_emergency(self) -> choices.simple_dt:
81
+ return self.get_attr(5)
82
+
83
+ @property
84
+ def min_over_threshold_duration(self) -> double_long_usingneds.DoubleLongUnsignedSecond:
85
+ return self.get_attr(6)
86
+
87
+ @property
88
+ def min_under_threshold_duration(self) -> double_long_usingneds.DoubleLongUnsignedSecond:
89
+ return self.get_attr(7)
90
+
91
+ @property
92
+ def emergency_profile(self) -> EmergencyProfileType:
93
+ return self.get_attr(8)
94
+
95
+ @property
96
+ def emergency_profile_group_id_list(self) -> EmergencyProfileGroupIdList:
97
+ return self.get_attr(9)
98
+
99
+ @property
100
+ def emergency_profile_active(self) -> cdt.Boolean:
101
+ return self.get_attr(10)
102
+
103
+ @property
104
+ def actions(self) -> ActionType:
105
+ return self.get_attr(11)
106
+
107
+ def __validate_threshold_scaler_unit(self, index: int, value: cdt.CommonDataTypes):
108
+ if self.monitored_value is not None:
109
+ """let setup"""
110
+ else:
111
+ raise exc.EmptyObj(F"don't set attribute: {index} with {value=} because {self} monitored_value is empty")