Part 5 : Runtime and Communication¶
Definitions¶
mtppy.part5.definitions.iec61131_data_types
¶
Implementation of IEC-61131 Data Types.
mtppy.part5.definitions.w3c_xml_data_types
¶
Conversion of MTP supported automation datatypes.
W3cXmlDataTypes(string_value, python_type, opcua_variant, converse_function)
¶
Bases: Enum
Enumeration of W3C XML schema data types supported by MTP 2.0.
Each member of this enumeration maps a W3C XML schema data type to the
corresponding Python type, the matching opcua.ua.VariantType
and an optional conversion function used to cast Python values to the
target representation when reading or writing MTP data items.
Fully Supported Attributes
BOOLEAN, BYTE, UNSIGNED_BYTE SHORT, UNSIGNED_SHORT INT, UNSIGNED_INT LONG, UNSIGNED_LONG FLOAT, DOUBLE STRING
Partially Supported Attributes
DATE, TIME, DATE_TIME ANY_URI, TOKEN
Initialize a W3cXmlDataTypes enum member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string_value
|
str
|
The W3C XML schema name of the data type (e.g. "boolean", "unsignedInt", a.s.o). |
required |
python_type
|
type | None
|
The corresponding Python type (e.g. |
required |
opcua_variant
|
VariantType | None
|
The corresponding
|
required |
converse_function
|
Callable[[ANY_TYPE], ANY_TYPE] | None
|
A callable used to cast or convert a Python
value to the data type's expected Python representation.
May be |
required |
mtppy.part5.definitions.opcua_data_types
¶
Definition of String Constants for OPCUA Data Types.
Mediator Communication Object for the Communication¶
mtppy.part5.communication_object.OPCUACommunicationObject(opcua_node_obj, node_id, variant_type=None)
¶
Bases: CommunicationObject
Write DataItem values to an OPC UA node.
Values are wrapped in an opcua.ua.Variant before being passed to the
node's set_value method.
Initialize an OPC UA communication object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
opcua_node_obj
|
Node
|
OPC UA node that receives written values. |
required |
node_id
|
str
|
OPC UA node identifier retained for diagnostics and model generation. |
required |
variant_type
|
VariantType | None
|
The OPC UA variant type the node was created with.
When provided, values are written with this exact type so the
node's value type stays consistent with its declared DataType.
When |
None
|