get_write_frame_ext
Tobias Müller, M. Eng edited this page 5 years ago

📜 Table of Contents


get_write_frame_ext

Definition
def get_write_frame_ext(self, object_type, object_id, property_id, property_data, data_format):
Description

The "get_write_frame_ext" method is used to encode a byte-frame for a 'write'-instruction with other Object_IDs listed in the technical documentation of the Xcom-232i. It returns a bytearray of the frame.

Note: The link to the documentation of the Xcom-232i can you find under the section: Hardware Information.

Arguments

The "self" argument is pointing to the object, which calls the method.

The "object_type" indicates the type of the "object_id", whether it is for example an info or a parameter number.

Object_Type:

_object_type_info                     = 1
_object_type_parameter                = 2
_object_type_message                  = 3
_object_type_datalog_field            = 5
_object_type_datalog_transfer         = 257

The "object_id" is a parameter number, whose value you want to change.

The "property_id" identifies the property of the data, which should be change.

Property_ID:

_property_id_value                    = 1
_property_id_string                   = 1
_property_id_value_qsp                = 5
_property_id_min_qsp                  = 6
_property_id_max_qsp                  = 7
_property_id_level_qsp                = 8
_property_id_unsaved_value_qsp        = 13
_property_id_invalid_Action           = 0
_property_id_sd_start                 = 21
_property_id_sd_datablock             = 22
_property_id_sd_ack_continue          = 23
_property_id_sd_nack_retry            = 24
_property_id_sd_abort                 = 25
_property_id_sd_finish                = 26

The "property_data" is the value, you want to send.

The "data_format" described the format of the "property_data".

Format:

_format_bool                          = [1,1]
_format_format                        = [2,2]
_format_short_int                     = [3,2]
_format_enum                          = [4,2]
_format_short_enum                    = [5,2]
_format_long_enum                     = [6,4]
_format_error                         = [7,2]
_format_int32                         = [8,4]
_format_float                         = [9,4]
_format_byte                          = [10,1]
Return Value

Type -> bytearray

Example Code
>>> # create an object of the Xcom-API-Class
>>> Object = Xcom_API()
>>> 
>>> # set an Object_ID, whose value should be change
>>> Equalization_current = 1290
>>> 
>>> # create a variable with a value for the Property_Data
>>> Data_in_Ampere = 120.0
>>> 
>>> # call the Method 'get_write_frame_ext'
>>> Byte_Frame = Object.get_write_frame_ext(Xcom_API._object_type_parameter, Equalization_current, Xcom_API._property_id_value, Data_in_Ampere, Xcom_API._format_float)
>>> 
>>> # print Byte_Frame
>>> print(Byte_Frame)
    bytearray(b'\\xAA\\x00\\x01\\x00\\x00\\x00\\x65\\x00\\x00\\x00\\x0E\\x00\\x73\\x79\\x00\\x02\\x02\\x00\\x0A\\x05\\x00\\x00\\x01\\x00\\x00\\x00\\xF0\\x42\\x45\\xDD')

Hochschule Anhalt | Anhalt University of Applied Sciences | Department 6 EMW
Xcom-API

Tobias Müller, M. Eng.
📧 Tobias.Mueller@HS-Anhalt.de

© es-lab.de, 31.10.2017