MTPPy2.0 0.1.5__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.
- examples/__init__.py +0 -0
- examples/minimal+pid.py +82 -0
- examples/minimal.py +32 -0
- examples/minimal_recipe.py +117 -0
- examples/pea_alarm_base.py +47 -0
- examples/pea_minimal.py +258 -0
- mtppy/__init__.py +1 -0
- mtppy/part1/__init__.py +4 -0
- mtppy/part1/empty_folder_test.py +7 -0
- mtppy/part3/__init__.py +4 -0
- mtppy/part3/data_assembly_set/__init__.py +4 -0
- mtppy/part3/data_assembly_set/active_elements/__init__.py +4 -0
- mtppy/part3/data_assembly_set/active_elements/active_element.py +22 -0
- mtppy/part3/data_assembly_set/active_elements/drives/__init__.py +4 -0
- mtppy/part3/data_assembly_set/active_elements/drives/ana_drv.py +446 -0
- mtppy/part3/data_assembly_set/active_elements/drives/ana_drv_test.py +567 -0
- mtppy/part3/data_assembly_set/active_elements/drives/bin_drv.py +365 -0
- mtppy/part3/data_assembly_set/active_elements/drives/bin_drv_test.py +503 -0
- mtppy/part3/data_assembly_set/active_elements/drives/mon_ana_drv.py +469 -0
- mtppy/part3/data_assembly_set/active_elements/drives/mon_ana_drv_test.py +418 -0
- mtppy/part3/data_assembly_set/active_elements/drives/mon_bin_drv.py +295 -0
- mtppy/part3/data_assembly_set/active_elements/drives/mon_bin_drv_test.py +265 -0
- mtppy/part3/data_assembly_set/active_elements/pid/__init__.py +4 -0
- mtppy/part3/data_assembly_set/active_elements/pid/pid_ctrl.py +333 -0
- mtppy/part3/data_assembly_set/active_elements/pid/pid_ctrl_test.py +156 -0
- mtppy/part3/data_assembly_set/active_elements/valves/__init__.py +4 -0
- mtppy/part3/data_assembly_set/active_elements/valves/ana_vlv.py +402 -0
- mtppy/part3/data_assembly_set/active_elements/valves/ana_vlv_test.py +732 -0
- mtppy/part3/data_assembly_set/active_elements/valves/bin_vlv.py +279 -0
- mtppy/part3/data_assembly_set/active_elements/valves/bin_vlv_test.py +585 -0
- mtppy/part3/data_assembly_set/active_elements/valves/mon_ana_vlv.py +402 -0
- mtppy/part3/data_assembly_set/active_elements/valves/mon_ana_vlv_test.py +270 -0
- mtppy/part3/data_assembly_set/active_elements/valves/mon_bin_vlv.py +286 -0
- mtppy/part3/data_assembly_set/active_elements/valves/mon_bin_vlv_test.py +224 -0
- mtppy/part3/data_assembly_set/base_functions/__init__.py +4 -0
- mtppy/part3/data_assembly_set/base_functions/operation_mode.py +252 -0
- mtppy/part3/data_assembly_set/base_functions/operation_mode_test.py +260 -0
- mtppy/part3/data_assembly_set/base_functions/oslevel.py +35 -0
- mtppy/part3/data_assembly_set/base_functions/source_mode.py +189 -0
- mtppy/part3/data_assembly_set/base_functions/source_mode_test.py +112 -0
- mtppy/part3/data_assembly_set/base_functions/wqc.py +75 -0
- mtppy/part3/data_assembly_set/base_functions/wqc_test.py +86 -0
- mtppy/part3/data_assembly_set/data_assembly.py +65 -0
- mtppy/part3/data_assembly_set/diagnostic_elements/__init__.py +4 -0
- mtppy/part3/data_assembly_set/diagnostic_elements/diagnostic_element.py +19 -0
- mtppy/part3/data_assembly_set/indicator_elements/__init__.py +4 -0
- mtppy/part3/data_assembly_set/indicator_elements/indicator_element.py +22 -0
- mtppy/part3/data_assembly_set/indicator_elements/views/__init__.py +4 -0
- mtppy/part3/data_assembly_set/indicator_elements/views/ana_view.py +68 -0
- mtppy/part3/data_assembly_set/indicator_elements/views/bin_view.py +73 -0
- mtppy/part3/data_assembly_set/indicator_elements/views/dint_view.py +76 -0
- mtppy/part3/data_assembly_set/indicator_elements/views/string_view.py +55 -0
- mtppy/part3/data_assembly_set/operation_elements/__init__.py +4 -0
- mtppy/part3/data_assembly_set/operation_elements/operation_element.py +19 -0
- mtppy/part3/data_assembly_set/pea_elements/__init__.py +4 -0
- mtppy/part3/data_assembly_set/pea_elements/pea_element.py +28 -0
- mtppy/part3/data_assembly_set/pea_elements/pea_information_label/__init__.py +4 -0
- mtppy/part3/data_assembly_set/pea_elements/pea_information_label/pea_information_label.py +231 -0
- mtppy/part3/data_assembly_set/pea_elements/web_server_url_info/__init__.py +4 -0
- mtppy/part3/data_assembly_set/pea_elements/web_server_url_info/web_server_url_info.py +42 -0
- mtppy/part3/definitions/__init__.py +4 -0
- mtppy/part3/definitions/mtp_access.py +15 -0
- mtppy/part4/__init__.py +4 -0
- mtppy/part4/automation_services/__init__.py +4 -0
- mtppy/part4/automation_services/base_functions/__init__.py +4 -0
- mtppy/part4/automation_services/base_functions/service_operation_mode.py +368 -0
- mtppy/part4/automation_services/base_functions/service_operation_mode_test.py +242 -0
- mtppy/part4/automation_services/base_functions/service_operator_interaction.py +62 -0
- mtppy/part4/automation_services/base_functions/service_source_mode.py +138 -0
- mtppy/part4/automation_services/base_functions/service_source_mode_test.py +179 -0
- mtppy/part4/automation_services/helpers/__init__.py +4 -0
- mtppy/part4/automation_services/helpers/command_en_control.py +330 -0
- mtppy/part4/automation_services/helpers/command_en_control_test.py +302 -0
- mtppy/part4/automation_services/helpers/state_machine.py +167 -0
- mtppy/part4/automation_services/helpers/state_machine_test.py +294 -0
- mtppy/part4/automation_services/helpers/thread_control.py +39 -0
- mtppy/part4/automation_services/helpers/thread_control_test.py +80 -0
- mtppy/part4/automation_services/procedure.py +111 -0
- mtppy/part4/automation_services/procedure_test.py +185 -0
- mtppy/part4/automation_services/service.py +463 -0
- mtppy/part4/automation_services/service_elements/__init__.py +4 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/__init__.py +4 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/ana_serv_param.py +108 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/ana_serv_param_test.py +59 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/bin_serv_param.py +70 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/bin_serv_param_test.py +39 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/common_serv_param.py +111 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/dint_serv_param.py +77 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/dint_serv_param_test.py +58 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/parameter_element.py +175 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/parameter_element_test.py +246 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/string_serv_param.py +48 -0
- mtppy/part4/automation_services/service_elements/parameter_elements/string_serv_param_test.py +37 -0
- mtppy/part4/automation_services/service_elements/procedure_health_view.py +36 -0
- mtppy/part4/automation_services/service_elements/service_control.py +473 -0
- mtppy/part4/automation_services/service_elements/service_control_test.py +150 -0
- mtppy/part4/automation_services/service_elements/service_element.py +20 -0
- mtppy/part4/automation_services/service_test.py +407 -0
- mtppy/part4/definitions/__init__.py +4 -0
- mtppy/part4/definitions/command_codes.py +58 -0
- mtppy/part4/definitions/command_codes_test.py +44 -0
- mtppy/part4/definitions/state_codes.py +65 -0
- mtppy/part4/definitions/state_codes_test.py +44 -0
- mtppy/part4/process_values/__init__.py +4 -0
- mtppy/part4/process_values/base_functions/__init__.py +4 -0
- mtppy/part4/process_values/base_functions/vqc.py +48 -0
- mtppy/part4/process_values/input_elements/__init__.py +4 -0
- mtppy/part4/process_values/input_elements/ana_process_value_in.py +160 -0
- mtppy/part4/process_values/input_elements/bin_process_value_in.py +83 -0
- mtppy/part4/process_values/input_elements/dint_process_value_in.py +159 -0
- mtppy/part4/process_values/input_elements/input_element.py +40 -0
- mtppy/part4/process_values/input_elements/string_process_value_in.py +45 -0
- mtppy/part5/__init__.py +4 -0
- mtppy/part5/communication_object.py +99 -0
- mtppy/part5/communication_object_test.py +59 -0
- mtppy/part5/definitions/__init__.py +4 -0
- mtppy/part5/definitions/iec61131_data_types.py +31 -0
- mtppy/part5/definitions/iec61131_data_types_test.py +82 -0
- mtppy/part5/definitions/opcua_data_types.py +36 -0
- mtppy/part5/definitions/opcua_data_types_test.py +90 -0
- mtppy/part5/definitions/w3c_xml_data_types.py +177 -0
- mtppy/part5/definitions/w3c_xml_data_types_test.py +143 -0
- mtppy/part5/server_assembly_set/__init__.py +5 -0
- mtppy/part6/__init__.py +4 -0
- mtppy/part6/alarm_set/__init__.py +4 -0
- mtppy/part6/alarm_set/alarm.py +132 -0
- mtppy/part6/alarm_set/alarm_test.py +265 -0
- mtppy/pea/__init__.py +19 -0
- mtppy/pea/data_assembly_factory.py +124 -0
- mtppy/pea/data_assembly_factory_test.py +229 -0
- mtppy/pea/mtp_generator/__init__.py +4 -0
- mtppy/pea/mtp_generator/mtp_generator.py +1183 -0
- mtppy/pea/mtp_generator/mtp_generator_test.py +518 -0
- mtppy/pea/pea.py +139 -0
- mtppy/pea/pea_opcua_server/__init__.py +4 -0
- mtppy/pea/pea_opcua_server/marshalling.py +60 -0
- mtppy/pea/pea_opcua_server/opcua_options_provider/__init__.py +4 -0
- mtppy/pea/pea_opcua_server/opcua_options_provider/instances/basic_opcua_options_provider.py +50 -0
- mtppy/pea/pea_opcua_server/opcua_options_provider/opcua_options_provider.py +103 -0
- mtppy/pea/pea_opcua_server/pea_opcua_server.py +492 -0
- mtppy/pea/pea_opcua_server/subscription_list.py +55 -0
- mtppy/pea/pea_test.py +59 -0
- mtppy/pea/rmtp_pea.py +155 -0
- mtppy/pea/rmtp_pea_test.py +27 -0
- mtppy/pea/service_factory.py +178 -0
- mtppy/pea/service_factory_test.py +156 -0
- mtppy/pea/user_logic/__init__.py +4 -0
- mtppy/pea/user_logic/user_logic_pea.py +72 -0
- mtppy/pea/user_logic/user_logic_registry.py +106 -0
- mtppy/pea/user_logic/user_logic_registry_test.py +167 -0
- mtppy/pea/user_logic/user_logic_service.py +228 -0
- mtppy/pea/user_logic/user_logic_service_test.py +289 -0
- mtppy/utils/__init__.py +4 -0
- mtppy/utils/data_assembly_dict.py +61 -0
- mtppy/utils/data_assembly_dict_test.py +107 -0
- mtppy/utils/data_item.py +446 -0
- mtppy/utils/data_item_com_test.py +82 -0
- mtppy/utils/data_item_test.py +325 -0
- mtppy/utils/logging.py +23 -0
- mtppy/utils/logging_test.py +26 -0
- mtppy/utils/mtp_file_handling/__init__.py +4 -0
- mtppy/utils/mtp_file_handling/extract_manifest_from_mtp_file.py +22 -0
- mtppy/utils/mtp_file_handling/extract_mtp_file.py +22 -0
- mtppy/utils/mtp_file_handling/is_valid_mtp.py +22 -0
- mtppy/utils/mtp_file_handling/is_valid_path_for_manifest.py +15 -0
- mtppy/utils/mtp_file_handling/is_valid_path_to_manifest.py +17 -0
- mtppy/utils/mtp_file_handling/is_valid_path_to_mtp.py +17 -0
- mtppy/utils/mtp_file_handling/load_manifest_file.py +24 -0
- mtppy/utils/mtp_file_handling/mtp_reader/__init__.py +4 -0
- mtppy/utils/mtp_file_handling/mtp_reader/mtp_reader.py +103 -0
- mtppy/utils/mtp_file_handling/mtp_reader/mtp_reader_test.py +96 -0
- mtppy/utils/mtp_file_handling/mtp_reader/mtp_xml.py +226 -0
- mtppy/utils/mtp_file_handling/mtp_reader/mtp_xml_test.py +108 -0
- mtppy/utils/mtp_file_handling/mtp_writer/__init__.py +4 -0
- mtppy/utils/mtp_file_handling/mtp_writer/mtp_writer.py +77 -0
- mtppy/utils/mtp_file_handling/mtp_writer/ressources/get_content_types.py +10 -0
- mtppy/utils/mtp_file_handling/mtp_writer/ressources/get_rels.py +11 -0
- mtppy/utils/mtp_file_handling/mtp_writer/test_mtp_writer.py +25 -0
- mtppy/utils/mtp_file_handling/write_manifest_file.py +29 -0
- mtppy/utils/mtp_file_handling/write_manifest_file_test.py +22 -0
- mtppy/utils/mtp_file_handling/write_mtp_file.py +43 -0
- mtppy/utils/mtp_file_handling/write_mtp_file_test.py +22 -0
- mtppy/utils/testing.py +31 -0
- mtppy2_0-0.1.5.dist-info/METADATA +75 -0
- mtppy2_0-0.1.5.dist-info/RECORD +214 -0
- mtppy2_0-0.1.5.dist-info/WHEEL +5 -0
- mtppy2_0-0.1.5.dist-info/entry_points.txt +3 -0
- mtppy2_0-0.1.5.dist-info/licenses/LICENSE +21 -0
- mtppy2_0-0.1.5.dist-info/top_level.txt +4 -0
- tools/__init__.py +0 -0
- tools/create_bugreport.py +150 -0
- tools/inspect_mtp.py +110 -0
- utils/__init__.py +1 -0
- utils/file_handling/__init__.py +4 -0
- utils/file_handling/cleanup_folder.py +9 -0
- utils/file_handling/get_utc_foldername_with_ms.py +15 -0
- utils/file_handling/get_work_dir.py +9 -0
- utils/file_handling/is_valid_path_for_json.py +11 -0
- utils/file_handling/is_valid_path_to_json.py +17 -0
- utils/file_handling/load_json_file.py +18 -0
- utils/file_handling/read_file_from_file_archive.py +43 -0
- utils/file_handling/read_file_string.py +10 -0
- utils/file_handling/validate_json_data.py +28 -0
- utils/file_handling/write_json_file.py +23 -0
- utils/get_uuid.py +18 -0
- utils/get_uuid_test.py +17 -0
- utils/logging.py +100 -0
- utils/logging_test.py +67 -0
- utils/opcua/check_node.py +79 -0
- utils/resolve_unit/resolve_unit.py +11 -0
- utils/resolve_unit/unit_lib.py +2101 -0
- utils/resolve_unit/unit_lib_test.py +36 -0
- utils/type_conversion.py +236 -0
- utils/type_conversion_test.py +114 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Implementation of BinView."""
|
|
2
|
+
|
|
3
|
+
__copyright__ = (
|
|
4
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
5
|
+
)
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
from typing import ClassVar
|
|
8
|
+
|
|
9
|
+
from mtppy.utils.logging import logger
|
|
10
|
+
|
|
11
|
+
from mtppy.utils.data_item import DataItem
|
|
12
|
+
from mtppy.part3.definitions.mtp_access import MTPAccess
|
|
13
|
+
from mtppy.part5.definitions.w3c_xml_data_types import W3cXmlDataTypes
|
|
14
|
+
from mtppy.part3.data_assembly_set.indicator_elements.indicator_element import (
|
|
15
|
+
IndicatorElement,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class BinView(IndicatorElement):
|
|
20
|
+
"""Binary View (BinView).
|
|
21
|
+
|
|
22
|
+
Implements a binary view according to MTP 2.0 specification.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
V_ = "V"
|
|
26
|
+
V_STATE_0 = "VState0"
|
|
27
|
+
V_STATE_1 = "VState1"
|
|
28
|
+
|
|
29
|
+
# Class-level data items dictionary
|
|
30
|
+
CLASS_DATA_ITEMS: ClassVar = {
|
|
31
|
+
V_: DataItem(V_, W3cXmlDataTypes.BOOLEAN, MTPAccess.ReadAccess, False),
|
|
32
|
+
V_STATE_0: DataItem(
|
|
33
|
+
V_STATE_0, W3cXmlDataTypes.STRING, MTPAccess.ReadAccess, ""
|
|
34
|
+
),
|
|
35
|
+
V_STATE_1: DataItem(
|
|
36
|
+
V_STATE_1, W3cXmlDataTypes.STRING, MTPAccess.ReadAccess, ""
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def __init__(
|
|
41
|
+
self,
|
|
42
|
+
tag_name: str,
|
|
43
|
+
tag_description: str = "",
|
|
44
|
+
v_state_0: str = "state_0_active",
|
|
45
|
+
v_state_1: str = "state_1_active",
|
|
46
|
+
) -> None:
|
|
47
|
+
"""Initialize the BinView element.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
tag_name: Name of the tag.
|
|
51
|
+
tag_description: Description of the tag.
|
|
52
|
+
v_state_0: Value for the state 0 description.
|
|
53
|
+
v_state_1: Value for the state 1 description.
|
|
54
|
+
"""
|
|
55
|
+
super().__init__(tag_name, tag_description)
|
|
56
|
+
self.mtpObjectType = (
|
|
57
|
+
"MTPDataAssemblySUCLib/DataAssembly/IndicatorElement/BinView"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# Set initial values for data items
|
|
61
|
+
self[BinView.V_STATE_0] = v_state_0
|
|
62
|
+
self[BinView.V_STATE_1] = v_state_1
|
|
63
|
+
|
|
64
|
+
# Add callbacks for ReadWrite Variables
|
|
65
|
+
|
|
66
|
+
def set_v(self, value: bool) -> None:
|
|
67
|
+
"""Set the V data item value.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
value: The boolean value to set for the V data item.
|
|
71
|
+
"""
|
|
72
|
+
self[BinView.V_] = value
|
|
73
|
+
logger.debug(f"V set to {value}")
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Implementation of DIntView
|
|
2
|
+
|
|
3
|
+
This module implements the DIntView class which represents a discrete integer view
|
|
4
|
+
in accordance with the MTP 2.0 specification.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__copyright__ = (
|
|
8
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
9
|
+
)
|
|
10
|
+
__license__ = "MIT"
|
|
11
|
+
from typing import ClassVar
|
|
12
|
+
|
|
13
|
+
from mtppy.utils.logging import logger
|
|
14
|
+
|
|
15
|
+
from mtppy.utils.data_item import DataItem
|
|
16
|
+
from mtppy.part3.definitions.mtp_access import MTPAccess
|
|
17
|
+
from mtppy.part5.definitions.w3c_xml_data_types import W3cXmlDataTypes
|
|
18
|
+
from mtppy.part3.data_assembly_set.indicator_elements.indicator_element import (
|
|
19
|
+
IndicatorElement,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class DIntView(IndicatorElement):
|
|
24
|
+
"""Discrete Integer View (DIntView).
|
|
25
|
+
|
|
26
|
+
Implements a discrete integer view according to MTP 2.0 specification.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
V_ = "V"
|
|
30
|
+
V_UNIT = "VUnit"
|
|
31
|
+
V_SCL_MIN = "VSclMin"
|
|
32
|
+
V_SCL_MAX = "VSclMax"
|
|
33
|
+
|
|
34
|
+
# Class-level data items dictionary
|
|
35
|
+
CLASS_DATA_ITEMS: ClassVar = {
|
|
36
|
+
V_: DataItem(V_, W3cXmlDataTypes.SHORT, MTPAccess.ReadAccess, 0),
|
|
37
|
+
V_UNIT: DataItem(V_UNIT, W3cXmlDataTypes.SHORT, MTPAccess.ReadAccess, 0),
|
|
38
|
+
V_SCL_MIN: DataItem(V_SCL_MIN, W3cXmlDataTypes.SHORT, MTPAccess.ReadAccess, 0),
|
|
39
|
+
V_SCL_MAX: DataItem(V_SCL_MAX, W3cXmlDataTypes.SHORT, MTPAccess.ReadAccess, 0),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
def __init__(
|
|
43
|
+
self,
|
|
44
|
+
tag_name: str,
|
|
45
|
+
tag_description: str = "",
|
|
46
|
+
v_scl_min: int = 0,
|
|
47
|
+
v_scl_max: int = 100,
|
|
48
|
+
v_unit: int = 1998,
|
|
49
|
+
) -> None:
|
|
50
|
+
"""Initialize the DIntView element.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
tag_name: Name of the tag.
|
|
54
|
+
tag_description: Description of the tag.
|
|
55
|
+
v_scl_min: Minimum scale value.
|
|
56
|
+
v_scl_max: Maximum scale value.
|
|
57
|
+
v_unit: Unit value.
|
|
58
|
+
"""
|
|
59
|
+
super().__init__(tag_name, tag_description)
|
|
60
|
+
self.mtpObjectType = (
|
|
61
|
+
"MTPDataAssemblySUCLib/DataAssembly/IndicatorElement/DIntView"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Set the specific values for the data items
|
|
65
|
+
self[DIntView.V_UNIT] = v_unit
|
|
66
|
+
self[DIntView.V_SCL_MIN] = v_scl_min
|
|
67
|
+
self[DIntView.V_SCL_MAX] = v_scl_max
|
|
68
|
+
|
|
69
|
+
def set_v(self, value: int) -> None:
|
|
70
|
+
"""Set the V data item value.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
value: The value to set for the V data item.
|
|
74
|
+
"""
|
|
75
|
+
self[self.V_] = value
|
|
76
|
+
logger.debug(f"V set to {value}")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Implementation of StringView.
|
|
2
|
+
|
|
3
|
+
This module implements the StringView class which represents a string view
|
|
4
|
+
in accordance with the MTP 2.0 specification.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__copyright__ = (
|
|
8
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
9
|
+
)
|
|
10
|
+
__license__ = "MIT"
|
|
11
|
+
from typing import ClassVar
|
|
12
|
+
|
|
13
|
+
from mtppy.utils.logging import logger
|
|
14
|
+
from mtppy.utils.data_item import DataItem
|
|
15
|
+
from mtppy.part3.definitions.mtp_access import MTPAccess
|
|
16
|
+
from mtppy.part5.definitions.w3c_xml_data_types import W3cXmlDataTypes
|
|
17
|
+
from mtppy.part3.data_assembly_set.indicator_elements.indicator_element import (
|
|
18
|
+
IndicatorElement,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class StringView(IndicatorElement):
|
|
23
|
+
"""String View (StringView).
|
|
24
|
+
|
|
25
|
+
Implements a string view according to MTP 2.0 specification.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
V_ = "V"
|
|
29
|
+
|
|
30
|
+
# Class-level data items dictionary
|
|
31
|
+
CLASS_DATA_ITEMS: ClassVar = {
|
|
32
|
+
V_: DataItem(V_, W3cXmlDataTypes.STRING, MTPAccess.ReadAccess, ""),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def __init__(self, tag_name: str, tag_description: str = "") -> None:
|
|
36
|
+
"""Initialize the StringView element.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
tag_name: Name of the tag.
|
|
40
|
+
tag_description: Description of the tag.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
super().__init__(tag_name, tag_description)
|
|
44
|
+
self.mtpObjectType = (
|
|
45
|
+
"MTPDataAssemblySUCLib/DataAssembly/IndicatorElement/dStringView"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def set_v(self, value: str) -> None:
|
|
49
|
+
"""Set the V data item value.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
value: The value to set for the V data item.
|
|
53
|
+
"""
|
|
54
|
+
self[self.V_] = value
|
|
55
|
+
logger.debug(f"V set to {value}")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Base Class for Operation Elements."""
|
|
2
|
+
|
|
3
|
+
__copyright__ = (
|
|
4
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
5
|
+
)
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
from mtppy.part3.data_assembly_set.data_assembly import DataAssembly
|
|
8
|
+
from mtppy.part3.data_assembly_set.base_functions.oslevel import OSLevelBaseFunction
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OperationElement(DataAssembly):
|
|
12
|
+
|
|
13
|
+
os_level: OSLevelBaseFunction
|
|
14
|
+
|
|
15
|
+
def __init__(self, tag_name: str, tag_description: str):
|
|
16
|
+
super().__init__(tag_name, tag_description)
|
|
17
|
+
self.mtpObjectType = "MTPDataAssemblySUCLib/DataAssembly/OperationElement"
|
|
18
|
+
|
|
19
|
+
self.os_level = OSLevelBaseFunction()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Base Class for PEA Element."""
|
|
2
|
+
|
|
3
|
+
__copyright__ = (
|
|
4
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
5
|
+
)
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
|
|
8
|
+
from mtppy.part3.data_assembly_set.data_assembly import DataAssembly
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PeaElement(DataAssembly):
|
|
12
|
+
"""Base class for Process Element Assembly (PEA) elements.
|
|
13
|
+
|
|
14
|
+
This class serves as the foundation for all PEA elements in the system.
|
|
15
|
+
It inherits from DataAssembly and provides common functionality for
|
|
16
|
+
process element assemblies.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, tag_name: str, tag_description: str):
|
|
21
|
+
"""Initialize a PEA element.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
tag_name: The name identifier for the PEA element.
|
|
25
|
+
tag_description: A descriptive text for the PEA element.
|
|
26
|
+
"""
|
|
27
|
+
super().__init__(tag_name, tag_description)
|
|
28
|
+
self.mtpObjectType = "MTPDataObjectSUCLib/DataAssembly/PeaElement"
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"""Implementation of PeaInformationLabel."""
|
|
2
|
+
|
|
3
|
+
__copyright__ = (
|
|
4
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
5
|
+
)
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
|
|
8
|
+
from typing import ClassVar
|
|
9
|
+
|
|
10
|
+
from mtppy.utils.data_item import DataItem
|
|
11
|
+
from mtppy.part3.definitions.mtp_access import MTPAccess
|
|
12
|
+
from mtppy.part5.definitions.w3c_xml_data_types import W3cXmlDataTypes
|
|
13
|
+
from mtppy.part3.data_assembly_set.pea_elements.pea_element import PeaElement
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PeaInformationLabel(PeaElement):
|
|
17
|
+
"""Process Equipment Assembly (PEA) Information Label.
|
|
18
|
+
|
|
19
|
+
This class represents an information label for PEA elements, containing
|
|
20
|
+
various identification and metadata fields for devices and components.
|
|
21
|
+
It inherits from PeaElement and provides specific data items for
|
|
22
|
+
asset identification, device specifications, and manufacturing information.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
# DataItem constant definitions
|
|
26
|
+
ASSET_ID = "AssetId"
|
|
27
|
+
COMPONENT_NAME = "ComponentName"
|
|
28
|
+
DEVICE_CLASS = "DeviceClass"
|
|
29
|
+
DEVICE_HEALTH = "DeviceHealth"
|
|
30
|
+
DEVICE_MANUAL = "DeviceManual"
|
|
31
|
+
DEVICE_REVISION = "DeviceRevision"
|
|
32
|
+
HARDWARE_REVISION = "HardwareRevision"
|
|
33
|
+
MANUFACTURER_ = "Manufacturer"
|
|
34
|
+
MANUFACTURER_URI = "ManufacturerUri"
|
|
35
|
+
MODEL_ = "Model"
|
|
36
|
+
PRODUCT_CODE = "ProductCode"
|
|
37
|
+
PRODUCT_INSTANCE_URI = "ProductInstanceUri"
|
|
38
|
+
REVISION_COUNTER = "RevisionCounter"
|
|
39
|
+
SERIAL_NUMBER = "SerialNumber"
|
|
40
|
+
SOFTWARE_REVISION = "SoftwareRevision"
|
|
41
|
+
|
|
42
|
+
# Class-level data items dictionary
|
|
43
|
+
CLASS_DATA_ITEMS: ClassVar = {
|
|
44
|
+
ASSET_ID: DataItem(
|
|
45
|
+
ASSET_ID,
|
|
46
|
+
W3cXmlDataTypes.STRING,
|
|
47
|
+
MTPAccess.ReadWriteAccess,
|
|
48
|
+
None,
|
|
49
|
+
),
|
|
50
|
+
COMPONENT_NAME: DataItem(
|
|
51
|
+
COMPONENT_NAME,
|
|
52
|
+
W3cXmlDataTypes.STRING,
|
|
53
|
+
MTPAccess.ReadWriteAccess,
|
|
54
|
+
None,
|
|
55
|
+
),
|
|
56
|
+
DEVICE_CLASS: DataItem(
|
|
57
|
+
DEVICE_CLASS,
|
|
58
|
+
W3cXmlDataTypes.STRING,
|
|
59
|
+
MTPAccess.ReadWriteAccess,
|
|
60
|
+
None,
|
|
61
|
+
),
|
|
62
|
+
DEVICE_HEALTH: DataItem(
|
|
63
|
+
DEVICE_HEALTH,
|
|
64
|
+
W3cXmlDataTypes.UNSIGNED_BYTE,
|
|
65
|
+
MTPAccess.ReadAccess,
|
|
66
|
+
None,
|
|
67
|
+
),
|
|
68
|
+
DEVICE_MANUAL: DataItem(
|
|
69
|
+
DEVICE_MANUAL,
|
|
70
|
+
W3cXmlDataTypes.STRING,
|
|
71
|
+
MTPAccess.ReadAccess,
|
|
72
|
+
None,
|
|
73
|
+
),
|
|
74
|
+
DEVICE_REVISION: DataItem(
|
|
75
|
+
DEVICE_REVISION,
|
|
76
|
+
W3cXmlDataTypes.STRING,
|
|
77
|
+
MTPAccess.ReadAccess,
|
|
78
|
+
None,
|
|
79
|
+
),
|
|
80
|
+
HARDWARE_REVISION: DataItem(
|
|
81
|
+
HARDWARE_REVISION,
|
|
82
|
+
W3cXmlDataTypes.STRING,
|
|
83
|
+
MTPAccess.ReadAccess,
|
|
84
|
+
None,
|
|
85
|
+
),
|
|
86
|
+
MANUFACTURER_: DataItem(
|
|
87
|
+
MANUFACTURER_,
|
|
88
|
+
W3cXmlDataTypes.STRING,
|
|
89
|
+
MTPAccess.ReadAccess,
|
|
90
|
+
None,
|
|
91
|
+
),
|
|
92
|
+
MANUFACTURER_URI: DataItem(
|
|
93
|
+
MANUFACTURER_URI,
|
|
94
|
+
W3cXmlDataTypes.STRING,
|
|
95
|
+
MTPAccess.ReadAccess,
|
|
96
|
+
None,
|
|
97
|
+
),
|
|
98
|
+
MODEL_: DataItem(
|
|
99
|
+
MODEL_,
|
|
100
|
+
W3cXmlDataTypes.STRING,
|
|
101
|
+
MTPAccess.ReadAccess,
|
|
102
|
+
None,
|
|
103
|
+
),
|
|
104
|
+
PRODUCT_CODE: DataItem(
|
|
105
|
+
PRODUCT_CODE,
|
|
106
|
+
W3cXmlDataTypes.STRING,
|
|
107
|
+
MTPAccess.ReadAccess,
|
|
108
|
+
None,
|
|
109
|
+
),
|
|
110
|
+
PRODUCT_INSTANCE_URI: DataItem(
|
|
111
|
+
PRODUCT_INSTANCE_URI,
|
|
112
|
+
W3cXmlDataTypes.STRING,
|
|
113
|
+
MTPAccess.ReadAccess,
|
|
114
|
+
None,
|
|
115
|
+
),
|
|
116
|
+
REVISION_COUNTER: DataItem(
|
|
117
|
+
REVISION_COUNTER,
|
|
118
|
+
W3cXmlDataTypes.SHORT,
|
|
119
|
+
MTPAccess.ReadAccess,
|
|
120
|
+
None,
|
|
121
|
+
),
|
|
122
|
+
SERIAL_NUMBER: DataItem(
|
|
123
|
+
SERIAL_NUMBER,
|
|
124
|
+
W3cXmlDataTypes.STRING,
|
|
125
|
+
MTPAccess.ReadAccess,
|
|
126
|
+
None,
|
|
127
|
+
),
|
|
128
|
+
SOFTWARE_REVISION: DataItem(
|
|
129
|
+
SOFTWARE_REVISION,
|
|
130
|
+
W3cXmlDataTypes.STRING,
|
|
131
|
+
MTPAccess.ReadAccess,
|
|
132
|
+
None,
|
|
133
|
+
),
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
def __init__(
|
|
137
|
+
self,
|
|
138
|
+
tag_name: str,
|
|
139
|
+
tag_description: str,
|
|
140
|
+
*,
|
|
141
|
+
asset_id: str = "",
|
|
142
|
+
component_name: str = "",
|
|
143
|
+
device_class: str = "",
|
|
144
|
+
device_health: int = 255,
|
|
145
|
+
device_manual: str = "",
|
|
146
|
+
device_revision: str = "",
|
|
147
|
+
hardware_revision: str = "",
|
|
148
|
+
manufacturer: str = "",
|
|
149
|
+
manufacturer_uri: str = "",
|
|
150
|
+
model: str = "",
|
|
151
|
+
product_code: str = "",
|
|
152
|
+
product_instance_uri: str = "",
|
|
153
|
+
revision_counter: int = 0,
|
|
154
|
+
serial_number: str = "",
|
|
155
|
+
software_revision: str = "",
|
|
156
|
+
) -> None:
|
|
157
|
+
"""Initialize a PeaInformationLabel instance.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
tag_name: The name identifier for the PEA element
|
|
161
|
+
tag_description: A descriptive text for the PEA element
|
|
162
|
+
asset_id: Asset identification string
|
|
163
|
+
component_name: Component name string
|
|
164
|
+
device_class: Device class string
|
|
165
|
+
device_health: Device health status (0-255)
|
|
166
|
+
device_manual: Device manual reference string
|
|
167
|
+
device_revision: Device revision string
|
|
168
|
+
hardware_revision: Hardware revision string
|
|
169
|
+
manufacturer: Manufacturer name string
|
|
170
|
+
manufacturer_uri: Manufacturer URI string
|
|
171
|
+
model: Model name string
|
|
172
|
+
product_code: Product code string
|
|
173
|
+
product_instance_uri: Product instance URI string
|
|
174
|
+
revision_counter: Revision counter value
|
|
175
|
+
serial_number: Serial number string
|
|
176
|
+
software_revision: Software revision string
|
|
177
|
+
"""
|
|
178
|
+
super().__init__(tag_name, tag_description)
|
|
179
|
+
self.mtpObjectType = (
|
|
180
|
+
"MTPDataObjectSUCLib/DataAssembly/PeaElement/PeaInformationLabel"
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
# Initialize data items with dynamic values (using class-defined data items)
|
|
184
|
+
self[PeaInformationLabel.ASSET_ID] = asset_id
|
|
185
|
+
self[PeaInformationLabel.COMPONENT_NAME] = component_name
|
|
186
|
+
self[PeaInformationLabel.DEVICE_CLASS] = device_class
|
|
187
|
+
self[PeaInformationLabel.DEVICE_HEALTH] = device_health
|
|
188
|
+
self[PeaInformationLabel.DEVICE_MANUAL] = device_manual
|
|
189
|
+
self[PeaInformationLabel.DEVICE_REVISION] = device_revision
|
|
190
|
+
self[PeaInformationLabel.HARDWARE_REVISION] = hardware_revision
|
|
191
|
+
self[PeaInformationLabel.MANUFACTURER_] = manufacturer
|
|
192
|
+
self[PeaInformationLabel.MANUFACTURER_URI] = manufacturer_uri
|
|
193
|
+
self[PeaInformationLabel.MODEL_] = model
|
|
194
|
+
self[PeaInformationLabel.PRODUCT_CODE] = product_code
|
|
195
|
+
self[PeaInformationLabel.PRODUCT_INSTANCE_URI] = product_instance_uri
|
|
196
|
+
self[PeaInformationLabel.REVISION_COUNTER] = revision_counter
|
|
197
|
+
self[PeaInformationLabel.SERIAL_NUMBER] = serial_number
|
|
198
|
+
self[PeaInformationLabel.SOFTWARE_REVISION] = software_revision
|
|
199
|
+
|
|
200
|
+
# Set callbacks for writable items
|
|
201
|
+
self.get_item(PeaInformationLabel.ASSET_ID).ext_wrt_cb = self.set_asset_id
|
|
202
|
+
self.get_item(PeaInformationLabel.COMPONENT_NAME).ext_wrt_cb = (
|
|
203
|
+
self.set_component_name
|
|
204
|
+
)
|
|
205
|
+
self.get_item(PeaInformationLabel.DEVICE_CLASS).ext_wrt_cb = (
|
|
206
|
+
self.set_device_class
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def set_asset_id(self, value: str) -> None:
|
|
210
|
+
"""Set the asset ID value.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
value: The asset ID string to set.
|
|
214
|
+
"""
|
|
215
|
+
self[PeaInformationLabel.ASSET_ID] = value
|
|
216
|
+
|
|
217
|
+
def set_component_name(self, value: str) -> None:
|
|
218
|
+
"""Set the component name value.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
value: The component name string to set.
|
|
222
|
+
"""
|
|
223
|
+
self[PeaInformationLabel.COMPONENT_NAME] = value
|
|
224
|
+
|
|
225
|
+
def set_device_class(self, value: str) -> None:
|
|
226
|
+
"""Set the device class value.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
value: The device class string to set.
|
|
230
|
+
"""
|
|
231
|
+
self[PeaInformationLabel.DEVICE_CLASS] = value
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Implementation of WebServerUrlInfo Element."""
|
|
2
|
+
|
|
3
|
+
__copyright__ = (
|
|
4
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
5
|
+
)
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
from typing import ClassVar
|
|
8
|
+
|
|
9
|
+
from mtppy.utils.data_item import DataItem
|
|
10
|
+
from mtppy.part3.definitions.mtp_access import MTPAccess
|
|
11
|
+
from mtppy.part5.definitions.w3c_xml_data_types import W3cXmlDataTypes
|
|
12
|
+
from mtppy.part3.data_assembly_set.pea_elements.pea_element import PeaElement
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class WebServerUrlInfo(PeaElement):
|
|
16
|
+
"""Web Server URL Information.
|
|
17
|
+
|
|
18
|
+
This class represents web server URL information for PEAs.
|
|
19
|
+
It inherits from PeaElement and provides a data item for storing
|
|
20
|
+
web server URLs.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
URL_ = "Url"
|
|
25
|
+
|
|
26
|
+
CLASS_DATA_ITEMS: ClassVar = {
|
|
27
|
+
URL_: DataItem(URL_, W3cXmlDataTypes.STRING, MTPAccess.ReadAccess, ""),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def __init__(self, tag_name: str, tag_description: str, url: str = "") -> None:
|
|
31
|
+
"""Initialize a WebServerUrlInfo instance.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
tag_name: The name identifier for the PEA element
|
|
35
|
+
tag_description: A descriptive text for the PEA element
|
|
36
|
+
url: The web server URL string to initialize with
|
|
37
|
+
"""
|
|
38
|
+
super().__init__(tag_name, tag_description)
|
|
39
|
+
self.mtpObjectType = (
|
|
40
|
+
"MTPDataObjectSUCLib/DataAssembly/PeaElement/WebServerUrlInfo"
|
|
41
|
+
)
|
|
42
|
+
self[WebServerUrlInfo.URL_] = url
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Enumeration for MTPAccess."""
|
|
2
|
+
|
|
3
|
+
__copyright__ = (
|
|
4
|
+
"Copyright (c) 2026 Dresden University of Technology, Process-to-Order Group"
|
|
5
|
+
)
|
|
6
|
+
__license__ = "MIT"
|
|
7
|
+
|
|
8
|
+
from enum import Enum
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MTPAccess(Enum):
|
|
12
|
+
NoAccess = (0,)
|
|
13
|
+
ReadAccess = (1,)
|
|
14
|
+
WriteAccess = (2,)
|
|
15
|
+
ReadWriteAccess = 3
|
mtppy/part4/__init__.py
ADDED