HART — The HART Testing Framework
The HART Testing Framework enables users to
write automatable tests for HART slaves
simulate HART devices and HART masters
add device specific commands
develop and debug a HART device interactively using the HART-Shell
monitor HART messages using the HART-Monitor
send corrupted frames and
run HART Fuzzing tests
It is based on version 7.6 of the HART specification and implements all universal and common practice commands (0..533). Extended commands up to 16-bit are supported.
You need the hart
feature in your license to unlock the HART Testing Framework.
HART Interface
The HartInterface
implements the data link layer and physical layer.
It enables you to write binary data that is sent to the connected
HART devices and read HART frames.
The used serial port must support the RS485 mode
that sets RTS
high
while sending. Many USB-Uarts do not support this feature and thus
cannot be used.
It is recommended to use USB-HART-Modems such as the MACTek Viator. They do support this feature and are known to work.
Real COM ports are very sparse nowadays.
- class htf.hart.HartInterface(comport: str, timeout: int | float = 0.3)
Data-Link-Layer and Physical-Layer for HART.
- Parameters:
comport – the comport to be used where the HART modem is connected to. Must support RS485 mode.
timeout=.3 – the time out for a single byte. Timeouts in
read()
are multiple of this timeout.
- get_last_preamble_count() int
Gets the count of preambles that was most recently received. This does NOT require a full HART frame to be read, but does require the preambles to be followed by a valid delimiter.
- Returns:
the most recently received number of consecutive preambles
- Return type:
- query(data: bytes, number_of_preambles: int = 5, preamble: bytes = b'\xff', timeout: int | float = 1.0) bytes | None
Query a HART command.
- Parameters:
request – the hart frame to be sent.
number_of_preambles=5 – the number of preambles.
preamble='\xff' –
number_of_preambles
timespreamble
is sent before the frame content is sent.timeout=1.0 – the timeout in seconds.
- Returns:
if no frame was received
None
is returned else a HART frame is returned.- Return type:
bytes or None
Example:
import oser
from htf.hart import HartInterface
hi = HartInterface(comport="/dev/ttyUSB1")
cmd0_request = b"\x02\x80\x00\x00\x82"
response = hi.query(cmd0_request)
print(oser.to_hex(response))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x06\x80\x00\x0e\x00\x00\x00\x13\x37\x00\x00\x00\x00\x00\x00\x00\x00\x23\x8f
hi.close()
HART Frame
The HartFrame
abstracts the HART-PDU that is
used for HART communication.
It is based on OSER and lets the user specify device specific commands.
The check byte is generated automatically when
encode
is called.
- class htf.hart.HartFrame(command: int | None = None, auto_length: bool = True, auto_checkbyte: bool = True)
A HART frame abstraction.
- Parameters:
command=None – the HART command number.
auto_length=True – if set to
True
the byte count of the HART frame is calculated automatically when callingencode
.auto_checkbyte=True – if set to
True
the checkbyte of the HART frame is calculated automatically when callingencode
.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
byte_count
is set automatically ifauto_length
is supplied.- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_command_request_parser(command: int) ByteStruct
Get a command request parser.
- Parameters:
command – the command number to be returned.
- Returns:
the command parser.
- Return type:
ByteStruct
- Raises:
KeyError – Raises a
KeyError
if the command if the commandis not set. –
- get_command_response_parser(command: int) ByteStruct
Get a command response parser.
- Parameters:
command – the command number to be returned.
- Returns:
the command parser.
- Return type:
ByteStruct
- Raises:
KeyError – Raises a
KeyError
if the command if the commandis not set. –
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- requests_generator() Generator[Tuple[int, ByteStruct | BitStruct | ByteType | BitType], None, None]
A generator that yields command, parser tuples for requests.
This method shall be overwritten to realize device specific commands.
- Yields:
tuples of command and parser
- responses_generator() Generator[Tuple[int, ByteStruct | BitStruct | ByteType | BitType], None, None]
A generator that yields command, parser tuples for responses.
This method shall be overwritten to realize device specific commands.
- Yields:
tuples of command and parser
- root() ByteStruct | BitStruct
return root element
- set_auto_check_byte_enable(enable_auto_check_byte: bool = True) None
Enable or disable the automatic checkbyte calculation on
encode
.- Parameters:
enable_auto_check_byte=True – the new enable state.
- set_auto_length_enable(enable_auto_length: bool = True) None
Enable or disable the auto length feature.
- Parameters:
enable_auto_length=True – the new enable state.
- set_command_request_parser(command: int, parser: ByteStruct | BitStruct | ByteType | BitType) None
Set a command request parser. This overwrites exising command parsers.
- Parameters:
command – the command number to be set.
parser – the parser for the command.
- set_command_response_parser(command: int, parser: ByteStruct | BitStruct | ByteType | BitType) None
Set a command response parser. This overwrites exising command parsers.
- Parameters:
command – the command number to be set.
parser – the parser for the command.
- up() ByteStruct | BitStruct
return parent element
Example:
import oser
from htf.hart import HartFrame
hf = HartFrame(1)
hf.address.address.set(0x13370023)
encoded = hf.encode()
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 322371619 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 4 (CheckByte)
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x13\x37\x00\x23\x01\x00\x04
HART Application Layer
The HART Application Layer interfaces
the HartInterface
and
the abstracted protocol with HartFrame
.
It lets the user communicate with a single HART device easily.
Additionally you can search for HART devices, set the master address and the device address.
- class htf.hart.HartApplicationLayer(interface: HartInterface, decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None)
HART Application-Layer.
- Parameters:
interface – the HART interface to be used.
decoder_generator=None – a callable that returns a HartFrame instance with or without device specific commands.
- close() None
Close the HART application layer and close the HART interface supplied. Is called in __del__, too.
- find_device(polling_addresses: List[int] | None = None) int
Find the first HART device by polling all addresses stated in
polling_addresses
and use the first device found.If no device is found an
AssertionError
is raised.- Parameters:
polling_addresses=[0] – the polling addresses used to find a HART device.
- Returns:
Unique HART address of the first device found in polling.
- Return type:
- poll_devices(polling_addresses: List[int] | None = None) Generator[int, None, None]
Poll
polling_addresses
to find HART devices.- Parameters:
polling_addresses=[0] – list of HART polling addresses
- Yields:
int – HART device addresses
- query(request: HartFrame, number_of_preambles: int = 5, preamble: bytes = b'\xff', timeout: int | float = 1.0) HartFrame | None
Query a HART command. The HART frame is encoded automatically.
- Parameters:
request – the hart frame to be sent.
number_of_preambles=5 – the number of preambles.
preamble='ÿ' –
number_of_preambles
timespreamble
is sent before the frame content is sent.timeout=1.0 – the timeout in seconds.
- Returns:
if no frame was received
None
is returned.- Return type:
HartFrame or None
- read(timeout: int | float = 1.0) HartFrame | None
Read a message using the interface and decode it using the decoder.
- Parameters:
timeout=1.0 – the timeout in seconds.
- Returns:
if no frame was received
None
is returned.- Return type:
HartFrame or None
- set_decoder_generator(decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None) None
Set the frame generator.
- Parameters:
decoder_generator=HartFrame – when called returns
- set_device_address(device_address: int) None
Set the current HART device address.
- Parameters:
device_address – the HART device address to be used (<= 38 bits)
- set_master_address(master_address: str) None
Set the current simulated master address.
- Parameters:
master_address – “primary_master” or “secondary_master”
- write(frame: HartFrame, number_of_preambles: int = 5, preamble: bytes = b'\xff') None
Write a HART frame. The HART frame is encoded automatically.
Except for command 0 the HART device address is set automatically before sending the frame content.
- Parameters:
frame – the hart frame to be sent.
number_of_preambles=5 – the number of preambles.
preamble='ÿ' –
number_of_preambles
timespreamble
is sent before the frame content is sent.
Find device at polling address 0 manually:
import oser
from htf.hart import \
HartInterface, HartApplicationLayer, HartFrame
hi = HartInterface(comport="/dev/ttyUSB1")
hal = HartApplicationLayer(hi)
# search for HART device at polling address 0 manually
cmd0_request = HartFrame(0)
cmd0_request.delimiter.frame_type.set("stx")
cmd0_request.delimiter.address_type.set("polling")
cmd0_request.address.address.set(0)
print(cmd0_request)
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command0_ReadUniqueIdentifierRequest():
check_byte: 0 (CheckByte)
response = hal.query(cmd0_request)
print(response)
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 14 (UBInt8)
payload: Command0_ReadUniqueIdentifierResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
data_object_id: 0 (UBInt8)
device_type: 4919 (UBInt16)
minimum_preambles_request: 0 (UBInt8)
protocol_revision: 0 (UBInt8)
device_revision_level: 0 (UBInt8)
software_revision_level: 0 (UBInt8)
hardware_revision_level_and_physical_signaling_code: 0 (UBInt8)
flags: 0 (UBInt8)
device_id: BitStruct():
value: 35 (BitField(24))
check_byte: 143 (CheckByte)
device_address = (response.payload.device_type.get() << 24) +\
response.payload.device_id.value.get()
print("0x%x" % device_address)
0x1337000023
hal.close()
Find device at polling address 0:
import oser
from htf.hart import \
HartInterface, HartApplicationLayer
hi = HartInterface(comport="/dev/ttyUSB1")
hal = HartApplicationLayer(hi)
# search for HART device at polling address 0
device_address = hal.find_device()
print("0x%x" % device_address)
0x1337000023
hal.close()
Poll addresses 0 .. 9:
import oser
from htf.hart import \
HartInterface, HartApplicationLayer
hi = HartInterface(comport="/dev/ttyUSB1")
hal = HartApplicationLayer(hi)
# poll address 0 .. 9
device_addresses = hal.poll_devices(range(10))
for device_address in device_addresses:
print("0x%x" % device_address)
0x1337000023
hal.close()
Query Command 1 from first found HART device and print primary variable:
import oser
from htf.hart import \
HartInterface, HartApplicationLayer, HartFrame
hi = HartInterface(comport="/dev/ttyUSB1")
hal = HartApplicationLayer(hi)
# search for HART device at polling address 0
hal.find_device()
82527125539
# query command 1
cmd1_request = HartFrame(1)
response = hal.query(cmd1_request)
print(response)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 82527125539 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'buffer_overflow' (UBInt8)
field_device_status: non-primary_variable_out_of_limits (FieldDeviceStatus)
units: 123 (UBInt8)
primary_variable: 456.78900146484375 (BFloat)
check_byte: 193 (CheckByte)
primary_variable = response.payload.primary_variable.get()
print("PV:", primary_variable)
PV: 456.78900146484375
hal.close()
Data Types
The data types implement the needed components to build HART frames.
Packed ASCII
PackedASCII
implements the
Packed ASCII
data type for the HART protocol.
- class htf.hart.data_types.PackedASCII(length: Callable | int | None = None, value: bytes | str = b'', padding: bytes | str = b'\x00')
The HART Packed ASCII data type
- Parameters:
length=None – states the string length. Can be a callable (e.g. lambda) or a scalar. If set to an Integer the result is a fixed length string padded with
padding
. If set to acallable
(lambda or function) the result is a fixed or variable length string padded withpadding
. The length must be a multiple of three.value="" – the initial string value.
padding="" – that padding pattern used for filling the encoded data if value is shorter than length.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the encoded binary string.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- set_length(length: Callable | int | None) None
Set the length.
- Parameters:
length=None – states the string length. Can be a callable (e.g. lambda) or a scalar. If set to
None
the result is a null-terminated string. If set to an Integer the result is a fixed length string padded withpadding
. If set to acallable
(lambda or function) the result is a fixed or variable length string padded withpadding
.
- up() ByteStruct | BitStruct
Return the parent element.
Example:
import oser
from htf.hart import PackedASCII
pa = PackedASCII(length=6, value=b"ABCDEFGH")
encoded = pa.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5
\x04\x20\xc4\x14\x61\xc8
pa2 = PackedASCII(length=3, value=b"ABC")
pa2.decode(encoded)
3
print(pa2)
b'ABCD'
Date
Date
implements the
Date
data type for the HART protocol.
- class htf.hart.data_types.Date(date: date)
The HART Date data type
- Parameters:
date – an instance of
datetime.date
ordatetime.datetime
between1900-01-01
and2155-12-31
.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the encoded binary string.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- set_length(length: Callable | int | None) None
Set the length.
- Parameters:
length=None – states the string length. Can be a callable (e.g. lambda) or a scalar. If set to
None
the result is a null-terminated string. If set to an Integer the result is a fixed length string padded withpadding
. If set to acallable
(lambda or function) the result is a fixed or variable length string padded withpadding
.
- up() ByteStruct | BitStruct
Return the parent element.
Example:
import oser
from htf.hart import Date
import datetime
date = Date(datetime.date(2017, 1, 11))
encoded = date.encode()
print(oser.to_hex(encoded))
0| 1| 2
\x75\x01\x0b
date2 = Date(None)
date2.decode(encoded)
3
print(date2)
datetime.date(2017, 1, 11)
Time
Time
implements the
Time
data type for the HART protocol.
- class htf.hart.data_types.Time(time: time)
The HART Time data type.
- Parameters:
time – an instance of
datetime.time
ordatetime.datetime
between00:00:00
and23:59:59
.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- get_byte_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set(value)
Set the value.
- Parameters:
value – the new value
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- up() ByteStruct | BitStruct
Return the parent element.
Example:
import oser
from htf.hart import Time
import datetime
time = Time(datetime.time(23, 24, 7, 1000))
encoded = time.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3
\xa0\xb0\x3b\x20
time2 = Time(None)
time2.decode(encoded)
4
print(time2)
23:24:07.001000 (Time)
Response Code
ResponseCode
implements the
Response Code
data type for the HART protocol.
When printed the states are concatenated with ;
.
- class htf.hart.data_types.ResponseCode(**kwargs: int)
HART device specific response code generator.
0: "success"
is added automatically.- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
- Returns:
the number of bytes that were decoded.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None (object) – stop introspection at
stop_at
.
- is_error() bool
Checks if the response code is of class ‘error’ or not. Warning response codes must have the ‘warning_’-prefix. If there is no prefix the response is considered to be an error.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values (iterable) – the values used for fuzzing.
- up() ByteStruct | BitStruct
Return the parent element.
If the MSB of the response code’s value is set a communication error is represented:
import oser
from htf.hart import ResponseCode
response_code = ResponseCode()
response_code.set(0x82)
encoded = response_code.encode()
print(oser.to_hex(encoded))
0
\x82
print(response_code)
'buffer_overflow' (UBInt8)
response_code2 = ResponseCode()
response_code2.decode(b"\xff")
1
print(response_code2)
'vertical_perity_error; overrun_error; framing_error; longitudinal_error; buffer_overflow' (UBInt8)
If the MSB is not set a command specific response code can be represented.
Command specific response codes are passed to
ResponseCode
as named parameters.
import oser
from htf.hart import ResponseCode
class Command48_ReadAdditionalDeviceStatusResponse(oser.ByteStruct):
"""
HART command 48 response abstraction.
"""
def __init__(self):
super(Command48_ReadAdditionalDeviceStatusResponse, self).__init__()
self.response_code = ResponseCode(
error_device_specific_command_error=6,
warning_update_in_progress=8,
error_access_restricted=16,
error_busy=32)
self.data = oser.String(length=3)
# ...
c48 = Command48_ReadAdditionalDeviceStatusResponse()
c48.response_code.set(32)
print(c48)
Command48_ReadAdditionalDeviceStatusResponse():
response_code: 'error_busy' (UBInt8)
data: b''
encoded = c48.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3
\x20\x00\x00\x00
c48_2 = Command48_ReadAdditionalDeviceStatusResponse()
c48_2.decode(b"\x08\x00\x00\x00")
4
print(c48_2)
Command48_ReadAdditionalDeviceStatusResponse():
response_code: 'warning_update_in_progress' (UBInt8)
data: b'\x00\x00\x00'
Field Device Status
FieldDeviceStatus
implements the
Field Device Status
data type for the HART protocol.
When printed the states are concatenated with ;
.
- class htf.hart.data_types.FieldDeviceStatus(value: int = 0, format: str | None = None)
HART Field Device Status data type.
- Parameters:
value – the initial value.
format=None – Use “hex” to format values to hexadecimal. Use “bin” to format values to binary.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- get_byte_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the length of the byte type in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- set_fuzzing_values(values: Generator[Any, None, None] | List[Any] | None) None
Set fuzzing values.
- Parameters:
values – the values used for fuzzing.
- up() ByteStruct | BitStruct
Return the parent element.
The FieldDeviceStatus
is a bit field for predefined values:
import oser
from htf.hart import FieldDeviceStatus
fds = FieldDeviceStatus(0x42)
print(fds)
configuration_changed; non-primary_variable_out_of_limits (FieldDeviceStatus)
fds2 = FieldDeviceStatus(0x02)
print(fds2)
non-primary_variable_out_of_limits (FieldDeviceStatus)
encoded = fds2.encode()
print(oser.to_hex(encoded))
0
\x02
fds3 = FieldDeviceStatus(0x00)
fds3.decode(encoded)
1
print(fds3)
non-primary_variable_out_of_limits (FieldDeviceStatus)
HART Responses
HartResponse
implements a
HART response
data type to automatically handle error responses.
All HART responses should be derived from this class.
- class htf.hart.data_types.HartResponse
A ByteStruct for HART responses which checks for error response codes in _items() and stops iteration after field_device_status. All HART responses should be derived from this class.
- decode(data: bytes, full_data: bytes = b'', context_data: bytes = b'') int
Decode a binary string and return the number of bytes that were decoded.
- Parameters:
data – the data buffer that is decoded.
full_data – the binary data string until the part to be decoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- Returns:
the number of bytes that were decoded.
- Return type:
- encode(full_data: bytes = b'', context_data: bytes = b'') bytes
Return the encoded binary string.
- Parameters:
full_data – the binary data string until the part to be encoded. The user normally does not need to supply this.
context_data – the binary data of the current context. The user normally does not need to supply this.
- from_dict(data: Dict) None
Fill self with data.
- Parameters:
data – data to be used to fill the calling instance.
- fuzzing_iterator(copy: bool = False) Generator[Any, None, None]
The fuzzing iterator iterates over all combinations of set fuzzing values (
oser.ByteType.set_fuzzing_values
). If no fuzzing values are set the current struct is yielded.- Parameters:
copy=False – if set to
True
the generated fuzzing values are deep copies of the original. Creating these deep copies is slow. If set toFalse
the original struct is retruned and the generated value must be used immediately since the next generated overwrites the values on the same value.- Yields:
the fuzzing combinations.
- get_byte_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- get_size() int
Return the size in bytes.
- Returns:
the length of the byte type in bytes.
- Return type:
- introspect(stop_at: ByteStruct | BitStruct | ByteType | BitType | None = None) str
Return the introspection representation of the object as a string.
- Parameters:
stop_at=None – stop introspection at
stop_at
.
- root() ByteStruct | BitStruct
return root element
- up() ByteStruct | BitStruct
return parent element
Universal Commands
Command 0
Command 0 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(0)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (PollingAddress(6))
expansion_bytes: Array():
[
]
command: 0 (Command)
byte_count: 0 (UBInt8)
payload: Command0_ReadUniqueIdentifierRequest():
check_byte: 130 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4
\x02\x80\x00\x00\x82
# response
hf = HartFrame(0)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (PollingAddress(6))
expansion_bytes: Array():
[
]
command: 0 (Command)
byte_count: 14 (UBInt8)
payload: Command0_ReadUniqueIdentifierResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
data_object_id: 0 (UBInt8)
device_type: 0 (UBInt16)
minimum_preambles_request: 0 (UBInt8)
protocol_revision: 0 (UBInt8)
device_revision_level: 0 (UBInt8)
software_revision_level: 0 (UBInt8)
hardware_revision_level_and_physical_signaling_code: 0 (UBInt8)
flags: 0 (UBInt8)
device_id: BitStruct():
value: 0 (BitField(24))
check_byte: 136 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x06\x80\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x88
Command 1
Command 1 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(1)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 1 (Command)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 3 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x01\x00\x03
# response
hf = HartFrame(1)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 1 (Command)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
units: 0 (UBInt8)
primary_variable: 0.0 (BFloat)
check_byte: 0 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x86\x80\x00\x00\x00\x00\x01\x07\x00\x00\x00\x00\x00\x00\x00\x00
Command 2
Command 2 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(2)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 2 (Command)
byte_count: 0 (UBInt8)
payload: Command2_ReadLoopCurrentAndPercentageOfRangeRequest():
check_byte: 0 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x02\x00\x00
# response
hf = HartFrame(2)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 2 (Command)
byte_count: 10 (UBInt8)
payload: Command2_ReadLoopCurrentAndPercentageOfRangeResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_loop_current: 0.0 (BFloat)
primary_variable_percentage_of_range: 0.0 (BFloat)
check_byte: 14 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x02\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e
Command 3
Command 3 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(3)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 3 (Command)
byte_count: 0 (UBInt8)
payload: Command3_ReadDynamicVariablesAndLoopCurrentRequest():
check_byte: 1 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x03\x00\x01
# response
hf = HartFrame(3)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 3 (Command)
byte_count: 6 (UBInt8)
payload: Command3_ReadDynamicVariablesAndLoopCurrentResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_loop_current: 0.0 (BFloat)
units_and_variables: Array():
[
]
check_byte: 3 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x03\x06\x00\x00\x00\x00\x00\x00\x03
Command 6
Command 6 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(6)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 6 (Command)
byte_count: 1 (UBInt8)
payload: Command6_WritePollingAddressRequest():
polling_address: 0 (UBInt8)
check_byte: 5 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x06\x01\x00\x05
# response
hf = HartFrame(6)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 6 (Command)
byte_count: 4 (UBInt8)
payload: Command6_WritePollingAddressResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
polling_address: 0 (UBInt8)
loop_current_mode: 0 (UBInt8)
check_byte: 4 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x06\x04\x00\x00\x00\x00\x04
Command 7
Command 7 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(7)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 7 (Command)
byte_count: 0 (UBInt8)
payload: Command7_ReadLoopConfigurationRequest():
check_byte: 5 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x07\x00\x05
# response
hf = HartFrame(7)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 7 (Command)
byte_count: 4 (UBInt8)
payload: Command7_ReadLoopConfigurationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
polling_address: 0 (UBInt8)
loop_current_mode: 0 (UBInt8)
check_byte: 5 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x07\x04\x00\x00\x00\x00\x05
Command 8
Command 8 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(8)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 8 (Command)
byte_count: 0 (UBInt8)
payload: Command8_ReadDynamicVariableClassificationsRequest():
check_byte: 10 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x08\x00\x0a
# response
hf = HartFrame(8)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 8 (Command)
byte_count: 6 (UBInt8)
payload: Command8_ReadDynamicVariableClassificationsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_classification: 0 (UBInt8)
secondary_variable_classification: 0 (UBInt8)
tertiary_variable_classification: 0 (UBInt8)
quaternary_variable_classification: 0 (UBInt8)
check_byte: 8 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x08\x06\x00\x00\x00\x00\x00\x00\x08
Command 9
Command 9 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(9)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 9 (Command)
byte_count: 0 (UBInt8)
payload: Command9_ReadDeviceVariablesWithStatusRequest():
device_variable_codes: Array():
[
]
check_byte: 11 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x09\x00\x0b
# response
hf = HartFrame(9)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 9 (Command)
byte_count: 7 (UBInt8)
payload: Command9_ReadDeviceVariablesWithStatusResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
extended_field_device_status: 0 (UBInt8)
variables_and_statuses: Array():
[
]
slot0_data_time_stamp: 00:00:00 (Time)
check_byte: 8 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x86\x80\x00\x00\x00\x00\x09\x07\x00\x00\x00\x00\x00\x00\x00\x08
Command 11
Command 11 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(11)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 11 (Command)
byte_count: 6 (UBInt8)
payload: Command11_ReadUniqueIdentifierAssociatedWithTagRequest():
tag: b'????????'
check_byte: 15 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x82\x80\x00\x00\x00\x00\x0b\x06\xff\xff\xff\xff\xff\xff\x0f
# response
hf = HartFrame(11)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 11 (Command)
byte_count: 14 (UBInt8)
payload: Command11_ReadUniqueIdentifierAssociatedWithTagResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
data_object_id: 0 (UBInt8)
device_type: 0 (UBInt16)
minimum_preambles_request: 0 (UBInt8)
protocol_revision: 0 (UBInt8)
device_revision_level: 0 (UBInt8)
software_revision_level: 0 (UBInt8)
hardware_revision_level_and_physical_signaling_code: 0 (UBInt8)
flags: 0 (UBInt8)
device_id: BitStruct():
value: 0 (BitField(24))
check_byte: 3 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22
\x86\x80\x00\x00\x00\x00\x0b\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03
Command 12
Command 12 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(12)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 12 (Command)
byte_count: 0 (UBInt8)
payload: Command12_ReadMessageRequest():
check_byte: 14 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x0c\x00\x0e
# response
hf = HartFrame(12)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 12 (Command)
byte_count: 26 (UBInt8)
payload: Command12_ReadMessageResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
message: b'????????????????????????????????'
check_byte: 16 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34
\x86\x80\x00\x00\x00\x00\x0c\x1a\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x10
Command 13
Command 13 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(13)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 13 (Command)
byte_count: 0 (UBInt8)
payload: Command13_ReadTagDescriptorDateRequest():
check_byte: 15 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x0d\x00\x0f
# response
hf = HartFrame(13)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 13 (Command)
byte_count: 23 (UBInt8)
payload: Command13_ReadTagDescriptorDateResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
tag: b'????????'
descriptor: b'????????????????'
date: datetime.date(1900, 1, 1)
check_byte: 28 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31
\x86\x80\x00\x00\x00\x00\x0d\x17\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x01\x00\x1c
Command 14
Command 14 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(14)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 14 (Command)
byte_count: 0 (UBInt8)
payload: Command14_ReadPrimaryVariableTransducerInformationRequest():
check_byte: 12 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x0e\x00\x0c
# response
hf = HartFrame(14)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 14 (Command)
byte_count: 18 (UBInt8)
payload: Command14_ReadPrimaryVariableTransducerInformationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
serial_number: BitStruct():
value: 0 (BitField(24))
units_code: 0 (UBInt8)
upper_limit: 0.0 (BFloat)
lower_limit: 0.0 (BFloat)
minimum_span: 0.0 (BFloat)
check_byte: 26 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26
\x86\x80\x00\x00\x00\x00\x0e\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a
Command 15
Command 15 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(15)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 15 (Command)
byte_count: 0 (UBInt8)
payload: Command15_ReadDeviceInformationRequest():
check_byte: 13 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x0f\x00\x0d
# response
hf = HartFrame(15)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 15 (Command)
byte_count: 20 (UBInt8)
payload: Command15_ReadDeviceInformationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
alarm_selection_code: 0 (UBInt8)
transfer_function_code: 0 (UBInt8)
units_code: 0 (UBInt8)
upper_range_value: 0.0 (BFloat)
lower_range_value: 0.0 (BFloat)
daming_value: 0.0 (BFloat)
write_protect_code: 0 (UBInt8)
reserved: 250 (UBInt8)
analog_channel_flags: 0 (UBInt8)
check_byte: 231 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28
\x86\x80\x00\x00\x00\x00\x0f\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfa\x00\xe7
Command 16
Command 16 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(16)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 16 (Command)
byte_count: 0 (UBInt8)
payload: Command16_ReadFinalAssemblyNumberRequest():
check_byte: 18 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x10\x00\x12
# response
hf = HartFrame(16)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 16 (Command)
byte_count: 5 (UBInt8)
payload: Command16_ReadFinalAssemblyNumberResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
final_assembly_number: BitStruct():
value: 0 (BitField(24))
check_byte: 19 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x86\x80\x00\x00\x00\x00\x10\x05\x00\x00\x00\x00\x00\x13
Command 17
Command 17 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(17)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 17 (Command)
byte_count: 24 (UBInt8)
payload: Command17_WriteMessageRequest():
message: b'????????????????????????????????'
check_byte: 11 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32
\x82\x80\x00\x00\x00\x00\x11\x18\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b
# response
hf = HartFrame(17)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 17 (Command)
byte_count: 26 (UBInt8)
payload: Command17_WriteMessageResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
message: b'????????????????????????????????'
check_byte: 13 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34
\x86\x80\x00\x00\x00\x00\x11\x1a\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d
Command 18
Command 18 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(18)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 18 (Command)
byte_count: 21 (UBInt8)
payload: Command18_WriteTageDescriptorDateRequest():
tag: b'????????'
descriptor: b'????????????????'
date: datetime.date(1900, 1, 1)
check_byte: 5 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29
\x82\x80\x00\x00\x00\x00\x12\x15\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x01\x00\x05
# response
hf = HartFrame(18)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 18 (Command)
byte_count: 23 (UBInt8)
payload: Command18_WriteTageDescriptorDateResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
tag: b'????????'
descriptor: b'????????????????'
date: datetime.date(1900, 1, 1)
check_byte: 3 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31
\x86\x80\x00\x00\x00\x00\x12\x17\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x01\x00\x03
Command 19
Command 19 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(19)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 19 (Command)
byte_count: 3 (UBInt8)
payload: Command19_WriteFinalAssemblyNumberRequest():
final_assembly_number: BitStruct():
value: 0 (BitField(24))
check_byte: 18 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x82\x80\x00\x00\x00\x00\x13\x03\x00\x00\x00\x12
# response
hf = HartFrame(19)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 19 (Command)
byte_count: 5 (UBInt8)
payload: Command19_WriteFinalAssemblyNumberResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
final_assembly_number: BitStruct():
value: 0 (BitField(24))
check_byte: 16 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x86\x80\x00\x00\x00\x00\x13\x05\x00\x00\x00\x00\x00\x10
Command 20
Command 20 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(20)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 20 (Command)
byte_count: 0 (UBInt8)
payload: Command20_ReadLongTagRequest():
check_byte: 22 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x14\x00\x16
# response
hf = HartFrame(20)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 20 (Command)
byte_count: 34 (UBInt8)
payload: Command20_ReadLongTagResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
long_tag: b''
check_byte: 48 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42
\x86\x80\x00\x00\x00\x00\x14\x22\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30
Command 21
Command 21 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(21)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 21 (Command)
byte_count: 32 (UBInt8)
payload: Command21_ReadUniqueIdentifierAssociatedWithLongTagRequest():
long_tag: b''
check_byte: 55 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40
\x82\x80\x00\x00\x00\x00\x15\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37
# response
hf = HartFrame(21)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 21 (Command)
byte_count: 14 (UBInt8)
payload: Command21_ReadUniqueIdentifierAssociatedWithLongTagResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
data_object_id: 0 (UBInt8)
device_type: 0 (UBInt16)
minimum_preambles_request: 0 (UBInt8)
protocol_revision: 0 (UBInt8)
device_revision_level: 0 (UBInt8)
software_revision_level: 0 (UBInt8)
hardware_revision_level_and_physical_signaling_code: 0 (UBInt8)
flags: 0 (UBInt8)
device_id: BitStruct():
value: 0 (BitField(24))
check_byte: 29 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22
\x86\x80\x00\x00\x00\x00\x15\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d
Command 22
Command 22 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(22)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 22 (Command)
byte_count: 32 (UBInt8)
payload: Command22_WriteLongTagRequest():
long_tag: b''
check_byte: 52 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40
\x82\x80\x00\x00\x00\x00\x16\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34
# response
hf = HartFrame(22)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 22 (Command)
byte_count: 34 (UBInt8)
payload: Command22_WriteLongTagResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
long_tag: b''
check_byte: 50 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42
\x86\x80\x00\x00\x00\x00\x16\x22\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x32
Command 38
Command 38 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(38)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 38 (Command)
byte_count: 0 (UBInt8)
payload: Command38_ResetConfigurationChangedFlagRequest():
check_byte: 36 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x26\x00\x24
# response
hf = HartFrame(38)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 38 (Command)
byte_count: 4 (UBInt8)
payload: Command38_ResetConfigurationChangedFlagResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
configuration_change_counter: 0 (UBInt16)
check_byte: 36 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x26\x04\x00\x00\x00\x00\x24
Common Practice Commands
Common Practice Commands
Command 33
Command 33 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(33)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 33 (Command)
byte_count: 0 (UBInt8)
payload: Command33_ReadDeviceVariablesRequest():
device_variable_codes: Array():
[
]
check_byte: 35 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x21\x00\x23
# response
hf = HartFrame(33)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 33 (Command)
byte_count: 2 (UBInt8)
payload: Command33_ReadDeviceVariablesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_codes_units_and_values: Array():
[
]
check_byte: 37 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x21\x02\x00\x00\x25
Command 34
Command 34 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(34)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 34 (Command)
byte_count: 4 (UBInt8)
payload: Command34_WritePrimaryVariableDampingValueRequest():
primary_variable_damping_value: 0.0 (BFloat)
check_byte: 36 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x82\x80\x00\x00\x00\x00\x22\x04\x00\x00\x00\x00\x24
# response
hf = HartFrame(34)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 34 (Command)
byte_count: 6 (UBInt8)
payload: Command34_WritePrimaryVariableDampingValueResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
actual_primary_variable_damping_value: 0.0 (BFloat)
check_byte: 34 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x22\x06\x00\x00\x00\x00\x00\x00\x22
Command 35
Command 35 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(35)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 35 (Command)
byte_count: 9 (UBInt8)
payload: Command35_WritePrimaryVariableRangeValuesRequest():
primary_variable_upper_and_lower_range_value_units_code: 0 (UBInt8)
primary_variable_upper_range_value: 0.0 (BFloat)
primary_variable_lower_range_value: 0.0 (BFloat)
check_byte: 40 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x82\x80\x00\x00\x00\x00\x23\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x28
# response
hf = HartFrame(35)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 35 (Command)
byte_count: 11 (UBInt8)
payload: Command35_WritePrimaryVariableRangeValuesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_upper_and_lower_range_value_units_code: 0 (UBInt8)
primary_variable_upper_range_value: 0.0 (BFloat)
primary_variable_lower_range_value: 0.0 (BFloat)
check_byte: 46 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19
\x86\x80\x00\x00\x00\x00\x23\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e
Command 36
Command 36 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(36)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 36 (Command)
byte_count: 0 (UBInt8)
payload: Command36_SetPrimaryVariableUpperRangeValueRequest():
check_byte: 38 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x24\x00\x26
# response
hf = HartFrame(36)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 36 (Command)
byte_count: 2 (UBInt8)
payload: Command36_SetPrimaryVariableUpperRangeValueResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
check_byte: 32 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x24\x02\x00\x00\x20
Command 37
Command 37 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(37)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 37 (Command)
byte_count: 0 (UBInt8)
payload: Command37_SetPrimaryVariableLowerRangeValueRequest():
check_byte: 39 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x25\x00\x27
# response
hf = HartFrame(37)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 37 (Command)
byte_count: 2 (UBInt8)
payload: Command37_SetPrimaryVariableLowerRangeValueResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
check_byte: 33 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x25\x02\x00\x00\x21
Command 39
Command 39 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(39)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 39 (Command)
byte_count: 1 (UBInt8)
payload: Command39_EEPROMControlRequest():
eeprom_control_code: 0 (UBInt8)
check_byte: 36 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x27\x01\x00\x24
# response
hf = HartFrame(39)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 39 (Command)
byte_count: 3 (UBInt8)
payload: Command39_EEPROMControlResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
eeprom_control_code: 0 (UBInt8)
check_byte: 34 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x27\x03\x00\x00\x00\x22
Command 40
Command 40 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(40)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 40 (Command)
byte_count: 4 (UBInt8)
payload: Command40_EnterExitFixedCurrentModeRequest():
primary_variable_fixed_current_level: 0.0 (BFloat)
check_byte: 46 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x82\x80\x00\x00\x00\x00\x28\x04\x00\x00\x00\x00\x2e
# response
hf = HartFrame(40)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 40 (Command)
byte_count: 6 (UBInt8)
payload: Command40_EnterExitFixedCurrentModeResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
actual_primary_variable_current_level: 0.0 (BFloat)
check_byte: 40 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x28\x06\x00\x00\x00\x00\x00\x00\x28
Command 41
Command 41 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(41)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 41 (Command)
byte_count: 0 (UBInt8)
payload: Command41_PerformSelfTestRequest():
check_byte: 43 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x29\x00\x2b
# response
hf = HartFrame(41)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 41 (Command)
byte_count: 2 (UBInt8)
payload: Command41_PerformSelfTestResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
check_byte: 45 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x29\x02\x00\x00\x2d
Command 42
Command 42 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(42)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 42 (Command)
byte_count: 0 (UBInt8)
payload: Command42_PerformDeviceResetRequest():
check_byte: 40 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x2a\x00\x28
# response
hf = HartFrame(42)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 42 (Command)
byte_count: 2 (UBInt8)
payload: Command42_PerformDeviceResetResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
check_byte: 46 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x2a\x02\x00\x00\x2e
Command 43
Command 43 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(43)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 43 (Command)
byte_count: 0 (UBInt8)
payload: Command43_SetPrimaryVariableZeroRequest():
check_byte: 41 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x2b\x00\x29
# response
hf = HartFrame(43)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 43 (Command)
byte_count: 2 (UBInt8)
payload: Command43_SetPrimaryVariableZeroResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
check_byte: 47 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x2b\x02\x00\x00\x2f
Command 44
Command 44 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(44)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 44 (Command)
byte_count: 1 (UBInt8)
payload: Command44_WritePrimaryVariableUnitsRequest():
primary_variable_units_code: 0 (UBInt8)
check_byte: 47 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x2c\x01\x00\x2f
# response
hf = HartFrame(44)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 44 (Command)
byte_count: 3 (UBInt8)
payload: Command44_WritePrimaryVariableUnitsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_units_code: 0 (UBInt8)
check_byte: 41 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x2c\x03\x00\x00\x00\x29
Command 45
Command 45 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(45)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 45 (Command)
byte_count: 4 (UBInt8)
payload: Command45_TrimLoopCurrentZeroRequest():
externally_measured_primary_variable_loop_current_level: 0.0 (BFloat)
check_byte: 43 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x82\x80\x00\x00\x00\x00\x2d\x04\x00\x00\x00\x00\x2b
# response
hf = HartFrame(45)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 45 (Command)
byte_count: 6 (UBInt8)
payload: Command45_TrimLoopCurrentZeroResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
actual_measured_primary_variable_loop_current_level: 0.0 (BFloat)
check_byte: 45 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x2d\x06\x00\x00\x00\x00\x00\x00\x2d
Command 46
Command 46 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(46)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 46 (Command)
byte_count: 4 (UBInt8)
payload: Command46_TrimLoopCurrentGainRequest():
externally_measured_primary_variable_loop_current_level: 0.0 (BFloat)
check_byte: 40 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x82\x80\x00\x00\x00\x00\x2e\x04\x00\x00\x00\x00\x28
# response
hf = HartFrame(46)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 46 (Command)
byte_count: 6 (UBInt8)
payload: Command46_TrimLoopCurrentGainResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
actual_measured_primary_variable_loop_current_level: 0.0 (BFloat)
check_byte: 46 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x2e\x06\x00\x00\x00\x00\x00\x00\x2e
Command 47
Command 47 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(47)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 47 (Command)
byte_count: 1 (UBInt8)
payload: Command47_WritePrimaryVariableTransferFunctionRequest():
primary_variable_transfer_function_code: 0 (UBInt8)
check_byte: 44 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x2f\x01\x00\x2c
# response
hf = HartFrame(47)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 47 (Command)
byte_count: 3 (UBInt8)
payload: Command47_WritePrimaryVariableTransferFunctionResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_transfer_function_code: 0 (UBInt8)
check_byte: 42 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x2f\x03\x00\x00\x00\x2a
Command 48
Command 48 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(48)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 48 (Command)
byte_count: 0 (UBInt8)
payload: Command48_ReadAdditionalDeviceStatusRequest():
check_byte: 50 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x30\x00\x32
# response
hf = HartFrame(48)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 48 (Command)
byte_count: 11 (UBInt8)
payload: Command48_ReadAdditionalDeviceStatusResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_specific_status: BitStruct():
value: 0 (BitField(48))
extended_device_status: 0 (UBInt8)
device_operating_mode: 0 (UBInt8)
status0: 0 (UBInt8)
check_byte: 61 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19
\x86\x80\x00\x00\x00\x00\x30\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3d
Command 49
Command 49 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(49)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 49 (Command)
byte_count: 3 (UBInt8)
payload: Command49_WritePrimaryVariableTransducerSerialNumberRequest():
primary_variable_transducer_serial_number: BitStruct():
value: 0 (BitField(24))
check_byte: 48 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x82\x80\x00\x00\x00\x00\x31\x03\x00\x00\x00\x30
# response
hf = HartFrame(49)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 49 (Command)
byte_count: 5 (UBInt8)
payload: Command49_WritePrimaryVariableTransducerSerialNumberResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_transducer_serial_number: BitStruct():
value: 0 (BitField(24))
check_byte: 50 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x86\x80\x00\x00\x00\x00\x31\x05\x00\x00\x00\x00\x00\x32
Command 50
Command 50 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(50)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 50 (Command)
byte_count: 0 (UBInt8)
payload: Command50_ReadDynamicVariableAssignmentsRequest():
check_byte: 48 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x32\x00\x30
# response
hf = HartFrame(50)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 50 (Command)
byte_count: 6 (UBInt8)
payload: Command50_ReadDynamicVariableAssignmentsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_device_variable: 0 (UBInt8)
secondary_variable_device_variable: 0 (UBInt8)
tertiary_variable_device_variable: 0 (UBInt8)
quaternary_variable_device_variable: 0 (UBInt8)
check_byte: 50 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x32\x06\x00\x00\x00\x00\x00\x00\x32
Command 51
Command 51 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(51)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 51 (Command)
byte_count: 0 (UBInt8)
payload: Command51_WriteDynamicVariableAssignmentsRequest():
device_variables: Array():
[
]
check_byte: 49 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x33\x00\x31
# response
hf = HartFrame(51)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 51 (Command)
byte_count: 2 (UBInt8)
payload: Command51_WriteDynamicVariableAssignmentsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variables: Array():
[
]
check_byte: 55 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x33\x02\x00\x00\x37
Command 52
Command 52 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(52)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 52 (Command)
byte_count: 1 (UBInt8)
payload: Command52_SetDeviceVariableZeroRequest():
device_variable_to_zero: 0 (UBInt8)
check_byte: 55 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x34\x01\x00\x37
# response
hf = HartFrame(52)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 52 (Command)
byte_count: 3 (UBInt8)
payload: Command52_SetDeviceVariableZeroResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_to_zero: 0 (UBInt8)
check_byte: 49 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x34\x03\x00\x00\x00\x31
Command 53
Command 53 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(53)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 53 (Command)
byte_count: 2 (UBInt8)
payload: Command53_WriteDeviceVariableUnitsRequest():
device_variable_code: 0 (UBInt8)
device_variable_units_code: 0 (UBInt8)
check_byte: 53 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x35\x02\x00\x00\x35
# response
hf = HartFrame(53)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 53 (Command)
byte_count: 4 (UBInt8)
payload: Command53_WriteDeviceVariableUnitsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
device_variable_units_code: 0 (UBInt8)
check_byte: 55 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x35\x04\x00\x00\x00\x00\x37
Command 54
Command 54 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(54)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 54 (Command)
byte_count: 1 (UBInt8)
payload: Command54_ReadDeviceVariableInformationRequest():
device_variable_code: 0 (UBInt8)
check_byte: 53 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x36\x01\x00\x35
# response
hf = HartFrame(54)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 54 (Command)
byte_count: 30 (UBInt8)
payload: Command54_ReadDeviceVariableInformationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
device_variable_transducer_serial_number: BitStruct():
value: 0 (BitField(24))
device_variable_limits: 0 (UBInt8)
device_variable_upper_transducer_limit: 0.0 (BFloat)
device_variable_lower_transducer_limit: 0.0 (BFloat)
device_variable_damping_value: 0.0 (BFloat)
device_variable_minimum_span: 0.0 (BFloat)
device_variable_classification: 0 (UBInt8)
device_variable_family: 0 (UBInt8)
acquisition_period: 00:00:00 (Time)
device_variable_properties: 0 (UBInt8)
check_byte: 46 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38
\x86\x80\x00\x00\x00\x00\x36\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e
Command 55
Command 55 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(55)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 55 (Command)
byte_count: 5 (UBInt8)
payload: Command55_WriteDeviceVariableDampingValueRequest():
device_variable_code: 0 (UBInt8)
device_variable_damping_value: 0.0 (BFloat)
check_byte: 48 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x82\x80\x00\x00\x00\x00\x37\x05\x00\x00\x00\x00\x00\x30
# response
hf = HartFrame(55)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 55 (Command)
byte_count: 7 (UBInt8)
payload: Command55_WriteDeviceVariableDampingValueResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
device_variable_damping_value: 0.0 (BFloat)
check_byte: 54 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x86\x80\x00\x00\x00\x00\x37\x07\x00\x00\x00\x00\x00\x00\x00\x36
Command 56
Command 56 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(56)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 56 (Command)
byte_count: 4 (UBInt8)
payload: Command56_WriteDeviceVariableTransducerSerialNumberRequest():
device_variable_code: 0 (UBInt8)
device_variable_transducer_serial_number: BitStruct():
value: 0 (BitField(24))
check_byte: 62 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x82\x80\x00\x00\x00\x00\x38\x04\x00\x00\x00\x00\x3e
# response
hf = HartFrame(56)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 56 (Command)
byte_count: 6 (UBInt8)
payload: Command56_WriteDeviceVariableTransducerSerialNumberResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
device_variable_transducer_serial_number: BitStruct():
value: 0 (BitField(24))
check_byte: 56 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x38\x06\x00\x00\x00\x00\x00\x00\x38
Command 57
Command 57 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(57)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 57 (Command)
byte_count: 0 (UBInt8)
payload: Command57_ReadUnitTagDescriptorDateRequest():
check_byte: 59 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x39\x00\x3b
# response
hf = HartFrame(57)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 57 (Command)
byte_count: 23 (UBInt8)
payload: Command57_ReadUnitTagDescriptorDateResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
unit_tag: b'????????'
unit_descriptor: b'????????????????'
unit_date: BitStruct():
value: 0 (BitField(24))
check_byte: 40 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31
\x86\x80\x00\x00\x00\x00\x39\x17\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x28
Command 58
Command 58 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(58)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 58 (Command)
byte_count: 21 (UBInt8)
payload: Command58_WriteUnitTagDescriptorDateRequest():
unit_tag: b'????????'
unit_descriptor: b'????????????????'
unit_date: BitStruct():
value: 0 (BitField(24))
check_byte: 45 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29
\x82\x80\x00\x00\x00\x00\x3a\x15\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x2d
# response
hf = HartFrame(58)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 58 (Command)
byte_count: 23 (UBInt8)
payload: Command58_WriteUnitTagDescriptorDateResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
unit_tag: b'????????'
unit_descriptor: b'????????????????'
unit_date: BitStruct():
value: 0 (BitField(24))
check_byte: 43 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31
\x86\x80\x00\x00\x00\x00\x3a\x17\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x2b
Command 59
Command 59 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(59)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 59 (Command)
byte_count: 1 (UBInt8)
payload: Command59_WriteNumberOfResponsePreamblesRequest():
number_of_preambles: 0 (UBInt8)
check_byte: 56 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x3b\x01\x00\x38
# response
hf = HartFrame(59)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 59 (Command)
byte_count: 3 (UBInt8)
payload: Command59_WriteNumberOfResponsePreamblesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
number_of_preambles: 0 (UBInt8)
check_byte: 62 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x3b\x03\x00\x00\x00\x3e
Command 60
Command 60 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(60)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 60 (Command)
byte_count: 1 (UBInt8)
payload: Command60_ReadAnalogChannelAndPercentOfRangeRequest():
analog_channel_number_code: 0 (UBInt8)
check_byte: 63 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x3c\x01\x00\x3f
# response
hf = HartFrame(60)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 60 (Command)
byte_count: 12 (UBInt8)
payload: Command60_ReadAnalogChannelAndPercentOfRangeResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
analog_channel_level: 0.0 (BFloat)
analog_channel_percent_of_range: 0.0 (BFloat)
check_byte: 54 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20
\x86\x80\x00\x00\x00\x00\x3c\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x36
Command 61
Command 61 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(61)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 61 (Command)
byte_count: 0 (UBInt8)
payload: Command61_ReadDynamicVariablesAndPrimaryVariableAnalogChannelRequest():
check_byte: 63 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x3d\x00\x3f
# response
hf = HartFrame(61)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 61 (Command)
byte_count: 7 (UBInt8)
payload: Command61_ReadDynamicVariablesAndPrimaryVariableAnalogChannelResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_analog_channel_units_code: 0 (UBInt8)
primary_variable_analog_level: 0.0 (BFloat)
dynamic_variables: Array():
[
]
check_byte: 60 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x86\x80\x00\x00\x00\x00\x3d\x07\x00\x00\x00\x00\x00\x00\x00\x3c
Command 62
Command 62 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(62)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 62 (Command)
byte_count: 0 (UBInt8)
payload: Command62_ReadAnalogChannelsRequest():
analog_channel_number_codes: Array():
[
]
check_byte: 60 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x3e\x00\x3c
# response
hf = HartFrame(62)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 62 (Command)
byte_count: 2 (UBInt8)
payload: Command62_ReadAnalogChannelsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_levels: Array():
[
]
check_byte: 58 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x3e\x02\x00\x00\x3a
Command 63
Command 63 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(63)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 63 (Command)
byte_count: 1 (UBInt8)
payload: Command63_ReadAnalogChannelInformationRequest():
analog_channel_number_code: 0 (UBInt8)
check_byte: 60 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x3f\x01\x00\x3c
# response
hf = HartFrame(63)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 63 (Command)
byte_count: 19 (UBInt8)
payload: Command63_ReadAnalogChannelInformationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_alarm_selection_code: 0 (UBInt8)
analog_channel_transfer_function_code: 0 (UBInt8)
analog_channel_upper_and_lower_range_value_units_code: 0 (UBInt8)
analog_channel_upper_range_value: 0.0 (BFloat)
analog_channel_lower_range_value: 0.0 (BFloat)
analog_channel_damping_value: 0.0 (BFloat)
analog_channel_flags: 0 (UBInt8)
check_byte: 42 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27
\x86\x80\x00\x00\x00\x00\x3f\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2a
Command 64
Command 64 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(64)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 64 (Command)
byte_count: 5 (UBInt8)
payload: Command64_WriteAnalogChannelAdditionalDampingValueRequest():
analog_channel_number_code: 0 (UBInt8)
analog_channel_additional_damping_value: 0.0 (BFloat)
check_byte: 71 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x82\x80\x00\x00\x00\x00\x40\x05\x00\x00\x00\x00\x00\x47
# response
hf = HartFrame(64)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 64 (Command)
byte_count: 7 (UBInt8)
payload: Command64_WriteAnalogChannelAdditionalDampingValueResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_additional_damping_value: 0.0 (BFloat)
check_byte: 65 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x86\x80\x00\x00\x00\x00\x40\x07\x00\x00\x00\x00\x00\x00\x00\x41
Command 65
Command 65 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(65)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 65 (Command)
byte_count: 10 (UBInt8)
payload: Command65_WriteAnalogChannelRangeValuesRequest():
analog_channel_number_code: 0 (UBInt8)
analog_channel_upper_and_lower_range_value_units_code: 0 (UBInt8)
analog_channel_upper_range_value: 0.0 (BFloat)
analog_channel_lower_range_value: 0.0 (BFloat)
check_byte: 73 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x82\x80\x00\x00\x00\x00\x41\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x49
# response
hf = HartFrame(65)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 65 (Command)
byte_count: 12 (UBInt8)
payload: Command65_WriteAnalogChannelRangeValuesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_upper_and_lower_range_value_units_code: 0 (UBInt8)
analog_channel_upper_range_value: 0.0 (BFloat)
analog_channel_lower_range_value: 0.0 (BFloat)
check_byte: 75 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20
\x86\x80\x00\x00\x00\x00\x41\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4b
Command 66
Command 66 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(66)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 66 (Command)
byte_count: 6 (UBInt8)
payload: Command66_EnterExitFixedAnalogChannelModeRequest():
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
fixed_analog_channel_level: 0.0 (BFloat)
check_byte: 70 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x82\x80\x00\x00\x00\x00\x42\x06\x00\x00\x00\x00\x00\x00\x46
# response
hf = HartFrame(66)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 66 (Command)
byte_count: 8 (UBInt8)
payload: Command66_EnterExitFixedAnalogChannelModeResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
fixed_analog_channel_level: 0.0 (BFloat)
check_byte: 76 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x86\x80\x00\x00\x00\x00\x42\x08\x00\x00\x00\x00\x00\x00\x00\x00\x4c
Command 67
Command 67 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(67)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 67 (Command)
byte_count: 6 (UBInt8)
payload: Command67_TrimAnalogChannelZeroRequest():
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
externally_measured_analog_channel_level: 0.0 (BFloat)
check_byte: 71 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x82\x80\x00\x00\x00\x00\x43\x06\x00\x00\x00\x00\x00\x00\x47
# response
hf = HartFrame(67)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 67 (Command)
byte_count: 8 (UBInt8)
payload: Command67_TrimAnalogChannelZeroResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
actual_channel_level: 0.0 (BFloat)
check_byte: 77 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x86\x80\x00\x00\x00\x00\x43\x08\x00\x00\x00\x00\x00\x00\x00\x00\x4d
Command 68
Command 68 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(68)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 68 (Command)
byte_count: 6 (UBInt8)
payload: Command68_TrimAnalogChannelGainRequest():
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
externally_measured_analog_channel_level: 0.0 (BFloat)
check_byte: 64 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x82\x80\x00\x00\x00\x00\x44\x06\x00\x00\x00\x00\x00\x00\x40
# response
hf = HartFrame(68)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 68 (Command)
byte_count: 8 (UBInt8)
payload: Command68_TrimAnalogChannelGainResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_units_code: 0 (UBInt8)
externally_measured_analog_channel_level: 0.0 (BFloat)
check_byte: 74 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x86\x80\x00\x00\x00\x00\x44\x08\x00\x00\x00\x00\x00\x00\x00\x00\x4a
Command 69
Command 69 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(69)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 69 (Command)
byte_count: 2 (UBInt8)
payload: Command69_WriteAnalogChannelTransferFunctionRequest():
analog_channel_number_code: 0 (UBInt8)
analog_channel_transfer_function_code: 0 (UBInt8)
check_byte: 69 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x45\x02\x00\x00\x45
# response
hf = HartFrame(69)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 69 (Command)
byte_count: 4 (UBInt8)
payload: Command69_WriteAnalogChannelTransferFunctionResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_transfer_function_code: 0 (UBInt8)
check_byte: 71 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x45\x04\x00\x00\x00\x00\x47
Command 70
Command 70 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(70)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 70 (Command)
byte_count: 1 (UBInt8)
payload: Command70_ReadAnalogChannelEndpointValuesRequest():
analog_channel_number_code: 0 (UBInt8)
check_byte: 69 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x46\x01\x00\x45
# response
hf = HartFrame(70)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 70 (Command)
byte_count: 20 (UBInt8)
payload: Command70_ReadAnalogChannelEndpointValuesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
analog_channel_number_code: 0 (UBInt8)
analog_channel_upper_and_lower_range_value_units_code: 0 (UBInt8)
analog_channel_upper_endpoint_value: 0.0 (BFloat)
analog_channel_lower_endpoint_value: 0.0 (BFloat)
analog_channel_upper_limit_value: 0.0 (BFloat)
analog_channel_lower_limit_value: 0.0 (BFloat)
check_byte: 84 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28
\x86\x80\x00\x00\x00\x00\x46\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54
Command 71
Command 71 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(71)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 71 (Command)
byte_count: 1 (UBInt8)
payload: Command71_LockDeviceRequest():
lock_code: 0 (UBInt8)
check_byte: 68 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x47\x01\x00\x44
# response
hf = HartFrame(71)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 71 (Command)
byte_count: 3 (UBInt8)
payload: Command71_LockDeviceResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
lock_code: 0 (UBInt8)
check_byte: 66 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x47\x03\x00\x00\x00\x42
Command 72
Command 72 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(72)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 72 (Command)
byte_count: 1 (UBInt8)
payload: Command72_SquawkRequest():
squawk_control: 0 (UBInt8)
check_byte: 75 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x48\x01\x00\x4b
# response
hf = HartFrame(72)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 72 (Command)
byte_count: 3 (UBInt8)
payload: Command72_SquawkResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
squawk_control: 0 (UBInt8)
check_byte: 77 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x48\x03\x00\x00\x00\x4d
Command 73
Command 73 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(73)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 73 (Command)
byte_count: 0 (UBInt8)
payload: Command73_FindDeviceRequest():
check_byte: 75 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x49\x00\x4b
# response
hf = HartFrame(73)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 73 (Command)
byte_count: 14 (UBInt8)
payload: Command73_FindDeviceResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
data_object_id: 0 (UBInt8)
device_type: 0 (UBInt16)
minimum_preambles_request: 0 (UBInt8)
protocol_revision: 0 (UBInt8)
device_revision_level: 0 (UBInt8)
software_revision_level: 0 (UBInt8)
hardware_revision_level_and_physical_signaling_code: 0 (UBInt8)
flags: 0 (UBInt8)
device_id: BitStruct():
value: 0 (BitField(24))
check_byte: 65 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22
\x86\x80\x00\x00\x00\x00\x49\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x41
Command 74
Command 74 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(74)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 74 (Command)
byte_count: 0 (UBInt8)
payload: Command74_ReadIOSystemCapabilitiesRequest():
check_byte: 72 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x4a\x00\x48
# response
hf = HartFrame(74)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 74 (Command)
byte_count: 10 (UBInt8)
payload: Command74_ReadIOSystemCapabilitiesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
maximum_number_of_io_cards: 0 (UBInt8)
maximum_number_of_channels_per_card: 0 (UBInt8)
maximum_number_of_subdevices_per_channel: 0 (UBInt8)
number_of_devices: 0 (UBInt16)
maximum_number_of_delayed_responses: 0 (UBInt8)
master_mode: 0 (UBInt8)
retry_count: 0 (UBInt8)
check_byte: 70 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x4a\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x46
Command 75
Command 75 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(75)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 75 (Command)
byte_count: 3 (UBInt8)
payload: Command75_PollSubDeviceRequest():
io_card: 0 (UBInt8)
channel: 0 (UBInt8)
subdevice_polling_address: 0 (UBInt8)
check_byte: 74 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x82\x80\x00\x00\x00\x00\x4b\x03\x00\x00\x00\x4a
# response
hf = HartFrame(75)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 75 (Command)
byte_count: 14 (UBInt8)
payload: Command75_PollSubDeviceResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
data_object_id: 0 (UBInt8)
device_type: 0 (UBInt16)
minimum_preambles_request: 0 (UBInt8)
protocol_revision: 0 (UBInt8)
device_revision_level: 0 (UBInt8)
software_revision_level: 0 (UBInt8)
hardware_revision_level_and_physical_signaling_code: 0 (UBInt8)
flags: 0 (UBInt8)
device_id: BitStruct():
value: 0 (BitField(24))
check_byte: 67 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22
\x86\x80\x00\x00\x00\x00\x4b\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x43
Command 76
Command 76 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(76)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 76 (Command)
byte_count: 0 (UBInt8)
payload: Command76_ReadLockDeviceStateRequest():
check_byte: 78 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x4c\x00\x4e
# response
hf = HartFrame(76)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 76 (Command)
byte_count: 3 (UBInt8)
payload: Command76_ReadLockDeviceStateResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
lock_status: 0 (UBInt8)
check_byte: 73 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x4c\x03\x00\x00\x00\x49
Command 77
Command 77 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(77)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 77 (Command)
byte_count: 11 (UBInt8)
payload: Command77_SendCommandToSubDeviceRequest():
io_card: 0 (UBInt8)
channel: 0 (UBInt8)
transmit_preamble_count: 0 (UBInt8)
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Array():
[
@0: 0 (UBInt8)
@1: 0 (UBInt8)
@2: 0 (UBInt8)
@3: 0 (UBInt8)
@4: 0 (UBInt8)
]
command: 0 (UBInt8)
byte_count: 0 (UBInt8)
data: Array():
[
]
check_byte: 198 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19
\x82\x80\x00\x00\x00\x00\x4d\x0b\x00\x00\x00\x82\x00\x00\x00\x00\x00\x00\x00\xc6
# response
hf = HartFrame(77)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 77 (Command)
byte_count: 12 (UBInt8)
payload: Command77_SendCommandToSubDeviceResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
io_card: 0 (UBInt8)
channel: 0 (UBInt8)
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Array():
[
@0: 0 (UBInt8)
@1: 0 (UBInt8)
@2: 0 (UBInt8)
@3: 0 (UBInt8)
@4: 0 (UBInt8)
]
command: 0 (UBInt8)
byte_count: 0 (UBInt8)
data: Array():
[
]
check_byte: 197 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20
\x86\x80\x00\x00\x00\x00\x4d\x0c\x00\x00\x00\x00\x82\x00\x00\x00\x00\x00\x00\x00\xc5
Command 78
Command 78 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(78)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 78 (Command)
byte_count: 1 (UBInt8)
payload: Command78_ReadAggregatedCommandsRequest():
requested_commands: 0 (UBInt8)
commands: Array():
[
]
check_byte: 77 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x4e\x01\x00\x4d
# response
hf = HartFrame(78)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 78 (Command)
byte_count: 4 (UBInt8)
payload: Command78_ReadAggregatedCommandsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
extended_field_device_status: 0 (UBInt8)
requested_commands: 0 (UBInt8)
commands: Array():
[
]
check_byte: 76 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x4e\x04\x00\x00\x00\x00\x4c
Command 79
Command 79 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(79)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 79 (Command)
byte_count: 8 (UBInt8)
payload: Command79_WriteDeviceVariableRequest():
device_variable_code: 0 (UBInt8)
write_device_variable_command_code: 0 (UBInt8)
units_code: 0 (UBInt8)
device_variable_value: 0.0 (BFloat)
device_variable_status: 0 (UBInt8)
check_byte: 69 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x82\x80\x00\x00\x00\x00\x4f\x08\x00\x00\x00\x00\x00\x00\x00\x00\x45
# response
hf = HartFrame(79)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 79 (Command)
byte_count: 10 (UBInt8)
payload: Command79_WriteDeviceVariableResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
write_device_variable_command_code: 0 (UBInt8)
units_code: 0 (UBInt8)
device_variable_value: 0.0 (BFloat)
device_variable_status: 0 (UBInt8)
check_byte: 67 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x4f\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x43
Command 80
Command 80 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(80)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 80 (Command)
byte_count: 1 (UBInt8)
payload: Command80_ReadDeviceVariableTrimPointsRequest():
device_variable_code: 0 (UBInt8)
check_byte: 83 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x50\x01\x00\x53
# response
hf = HartFrame(80)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 80 (Command)
byte_count: 12 (UBInt8)
payload: Command80_ReadDeviceVariableTrimPointsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
trim_points_units_code: 0 (UBInt8)
lower_trim_point: 0.0 (BFloat)
upper_trim_point: 0.0 (BFloat)
check_byte: 90 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20
\x86\x80\x00\x00\x00\x00\x50\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5a
Command 81
Command 81 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(81)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 81 (Command)
byte_count: 1 (UBInt8)
payload: Command81_ReadDeviceVariableTrimGuidelinesRequest():
device_variable_guidelines: 0 (UBInt8)
check_byte: 82 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x51\x01\x00\x52
# response
hf = HartFrame(81)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 81 (Command)
byte_count: 25 (UBInt8)
payload: Command81_ReadDeviceVariableTrimGuidelinesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_guidelines: 0 (UBInt8)
trim_points_supported: 0 (UBInt8)
trim_points_units_code: 0 (UBInt8)
minimum_lower_trim_point_value: 0.0 (BFloat)
maximum_lower_trim_point_value: 0.0 (BFloat)
minimum_upper_trim_point_value: 0.0 (BFloat)
maximum_upper_trim_point_value: 0.0 (BFloat)
minimum_differential: 0.0 (BFloat)
check_byte: 78 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33
\x86\x80\x00\x00\x00\x00\x51\x19\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4e
Command 82
Command 82 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(82)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 82 (Command)
byte_count: 7 (UBInt8)
payload: Command82_WriteDeviceVariableTrimPointRequest():
device_variable_code: 0 (UBInt8)
trim_point: 0 (UBInt8)
trim_point_units_code: 0 (UBInt8)
trim_point_value: 0.0 (BFloat)
check_byte: 87 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x82\x80\x00\x00\x00\x00\x52\x07\x00\x00\x00\x00\x00\x00\x00\x57
# response
hf = HartFrame(82)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 82 (Command)
byte_count: 9 (UBInt8)
payload: Command82_WriteDeviceVariableTrimPointResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
trim_point: 0 (UBInt8)
trim_point_units_code: 0 (UBInt8)
trim_point_value: 0.0 (BFloat)
check_byte: 93 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x86\x80\x00\x00\x00\x00\x52\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5d
Command 83
Command 83 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(83)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 83 (Command)
byte_count: 1 (UBInt8)
payload: Command83_ResetDeviceVariableTrimRequest():
device_variable_code: 0 (UBInt8)
check_byte: 80 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x53\x01\x00\x50
# response
hf = HartFrame(83)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 83 (Command)
byte_count: 3 (UBInt8)
payload: Command83_ResetDeviceVariableTrimResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code: 0 (UBInt8)
check_byte: 86 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x53\x03\x00\x00\x00\x56
Command 84
Command 84 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(84)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 84 (Command)
byte_count: 2 (UBInt8)
payload: Command84_ReadSubDeviceIdentitySummaryRequest():
subdevice_index: 0 (UBInt16)
check_byte: 84 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x54\x02\x00\x00\x54
# response
hf = HartFrame(84)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 84 (Command)
byte_count: 50 (UBInt8)
payload: Command84_ReadSubDeviceIdentitySummaryResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
subdevice_index: 0 (UBInt16)
io_card: 0 (UBInt8)
channel: 0 (UBInt8)
manufacturer_id: 0 (UBInt16)
expanded_device_type_code: 0 (UBInt16)
device_id: BitStruct():
value: 0 (BitField(24))
universal_command_revision_level: 0 (UBInt8)
long_tag: b''
device_revision: 0 (UBInt8)
device_profile: 0 (UBInt8)
private_label_distributor_code: 0 (UBInt16)
check_byte: 96 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 45| 46| 47| 48| 49| 50| 51| 52| 53| 54| 55| 56| 57| 58
\x86\x80\x00\x00\x00\x00\x54\x32\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60
Command 85
Command 85 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(85)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 85 (Command)
byte_count: 2 (UBInt8)
payload: Command85_ReadIOChannelStatisticsRequest():
io_card: 0 (UBInt8)
channel: 0 (UBInt8)
check_byte: 85 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x55\x02\x00\x00\x55
# response
hf = HartFrame(85)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 85 (Command)
byte_count: 14 (UBInt8)
payload: Command85_ReadIOChannelStatisticsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
io_card: 0 (UBInt8)
channel: 0 (UBInt8)
stx_count: 0 (UBInt16)
ack_count: 0 (UBInt16)
ostx_count: 0 (UBInt16)
oack_count: 0 (UBInt16)
back_count: 0 (UBInt16)
check_byte: 93 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22
\x86\x80\x00\x00\x00\x00\x55\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5d
Command 86
Command 86 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(86)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 86 (Command)
byte_count: 2 (UBInt8)
payload: Command86_ReadSubDeviceStatisticsRequest():
subdevice_index: 0 (UBInt16)
check_byte: 86 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x56\x02\x00\x00\x56
# response
hf = HartFrame(86)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 86 (Command)
byte_count: 10 (UBInt8)
payload: Command86_ReadSubDeviceStatisticsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
subdevice_index: 0 (UBInt16)
stx_count: 0 (UBInt16)
ack_count: 0 (UBInt16)
back_count: 0 (UBInt16)
check_byte: 90 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x56\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5a
Command 87
Command 87 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(87)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 87 (Command)
byte_count: 1 (UBInt8)
payload: Command87_WriteIOSystemMasterModeRequest():
master_mode: 0 (UBInt8)
check_byte: 84 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x57\x01\x00\x54
# response
hf = HartFrame(87)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 87 (Command)
byte_count: 3 (UBInt8)
payload: Command87_WriteIOSystemMasterModeResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
master_mode: 0 (UBInt8)
check_byte: 82 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x57\x03\x00\x00\x00\x52
Command 88
Command 88 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(88)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 88 (Command)
byte_count: 1 (UBInt8)
payload: Command88_WriteIOSystemRetryCountRequest():
retry_count: 0 (UBInt8)
check_byte: 91 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x58\x01\x00\x5b
# response
hf = HartFrame(88)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 88 (Command)
byte_count: 3 (UBInt8)
payload: Command88_WriteIOSystemRetryCountResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
retry_count: 0 (UBInt8)
check_byte: 93 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x58\x03\x00\x00\x00\x5d
Command 89
Command 89 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(89)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 89 (Command)
byte_count: 10 (UBInt8)
payload: Command89_SetRealTimeClockRequest():
time_set_code: 0 (UBInt8)
date: datetime.date(1900, 1, 1)
time: 00:00:00 (Time)
padding: 0 (UBInt16)
check_byte: 81 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x82\x80\x00\x00\x00\x00\x59\x0a\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x51
# response
hf = HartFrame(89)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 89 (Command)
byte_count: 10 (UBInt8)
payload: Command89_SetRealTimeClockResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
time_set_code: 0 (UBInt8)
date: datetime.date(1900, 1, 1)
time: 00:00:00 (Time)
check_byte: 85 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x59\x0a\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x55
Command 90
Command 90 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(90)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 90 (Command)
byte_count: 0 (UBInt8)
payload: Command90_ReadRealTimeClockRequest():
check_byte: 88 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x5a\x00\x58
# response
hf = HartFrame(90)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 90 (Command)
byte_count: 17 (UBInt8)
payload: Command90_ReadRealTimeClockResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
date: datetime.date(1900, 1, 1)
time: 00:00:00 (Time)
date_clock_last_set: datetime.date(1900, 1, 1)
time_clock_last_set: 00:00:00 (Time)
rtc_flags: 0 (UBInt8)
check_byte: 77 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25
\x86\x80\x00\x00\x00\x00\x5a\x11\x00\x00\x01\x01\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x4d
Command 91
Command 91 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(91)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 91 (Command)
byte_count: 1 (UBInt8)
payload: Command91_ReadTrendConfigurationRequest():
trend_number: 0 (UBInt8)
check_byte: 88 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x5b\x01\x00\x58
# response
hf = HartFrame(91)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 91 (Command)
byte_count: 10 (UBInt8)
payload: Command91_ReadTrendConfigurationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
trend_number: 0 (UBInt8)
total_trends_supported: 0 (UBInt8)
trend_control_code: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
trend_sample_interval: 00:00:00 (Time)
check_byte: 87 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x5b\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x57
Command 92
Command 92 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(92)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 92 (Command)
byte_count: 7 (UBInt8)
payload: Command92_WriteTrendConfigurationRequest():
trend_number: 0 (UBInt8)
trend_control_code: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
trend_sample_interval: 00:00:00 (Time)
check_byte: 89 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x82\x80\x00\x00\x00\x00\x5c\x07\x00\x00\x00\x00\x00\x00\x00\x59
# response
hf = HartFrame(92)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 92 (Command)
byte_count: 9 (UBInt8)
payload: Command92_WriteTrendConfigurationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
trend_number: 0 (UBInt8)
trend_control_code: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
trend_sample_interval: 00:00:00 (Time)
check_byte: 83 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x86\x80\x00\x00\x00\x00\x5c\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x53
Command 93
Command 93 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(93)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 93 (Command)
byte_count: 1 (UBInt8)
payload: Command93_ReadTrendRequest():
trend_number: 0 (UBInt8)
check_byte: 94 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x5d\x01\x00\x5e
# response
hf = HartFrame(93)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 93 (Command)
byte_count: 77 (UBInt8)
payload: Command93_ReadTrendResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
trend_number: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
device_variable_classification: 0 (UBInt8)
device_variable_units_code: 0 (UBInt8)
date_trend_value0: datetime.date(1900, 1, 1)
time_trend_value0: 00:00:00 (Time)
time_sample_interval: 00:00:00 (Time)
trend_values: Array():
[
@0: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@1: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@2: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@3: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@4: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@5: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@6: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@7: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@8: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@9: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@10: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
@11: TrendValueAndStatus():
trend_value: 0.0 (BFloat)
trend_status: 0 (UBInt8)
]
check_byte: 22 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 45| 46| 47| 48| 49| 50| 51| 52| 53| 54| 55| 56| 57| 58| 59| 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79| 80| 81| 82| 83| 84| 85
\x86\x80\x00\x00\x00\x00\x5d\x4d\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16
Command 94
Command 94 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(94)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 94 (Command)
byte_count: 0 (UBInt8)
payload: Command94_ReadIOSystemClientSideCommunicationStatisticsRequest():
check_byte: 92 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x5e\x00\x5c
# response
hf = HartFrame(94)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 94 (Command)
byte_count: 18 (UBInt8)
payload: Command94_ReadIOSystemClientSideCommunicationStatisticsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
messages_received: 0 (UBInt32)
messages_returned: 0 (UBInt32)
requests_forwared: 0 (UBInt32)
responses_returned: 0 (UBInt32)
check_byte: 74 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26
\x86\x80\x00\x00\x00\x00\x5e\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4a
Command 95
Command 95 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(95)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 95 (Command)
byte_count: 0 (UBInt8)
payload: Command95_ReadDeviceCommunicationStatisticsRequest():
check_byte: 93 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x5f\x00\x5d
# response
hf = HartFrame(95)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 95 (Command)
byte_count: 8 (UBInt8)
payload: Command95_ReadDeviceCommunicationStatisticsResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
stx_count: 0 (UBInt16)
ack_count: 0 (UBInt16)
back_count: 0 (UBInt16)
check_byte: 81 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x86\x80\x00\x00\x00\x00\x5f\x08\x00\x00\x00\x00\x00\x00\x00\x00\x51
Command 96
Command 96 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(96)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 96 (Command)
byte_count: 1 (UBInt8)
payload: Command96_ReadSynchronousActionRequest():
action_number: 0 (UBInt8)
check_byte: 99 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x60\x01\x00\x63
# response
hf = HartFrame(96)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 96 (Command)
byte_count: 15 (UBInt8)
payload: Command96_ReadSynchronousActionResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
action_number: 0 (UBInt8)
total_action: 0 (UBInt8)
action_control: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
command: 0 (UBInt16)
trigger_date: datetime.date(1900, 1, 1)
trigger_time: 00:00:00 (Time)
check_byte: 105 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23
\x86\x80\x00\x00\x00\x00\x60\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x69
Command 97
Command 97 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(97)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 97 (Command)
byte_count: 12 (UBInt8)
payload: Command97_ConfigureSynchronousActionRequest():
action_number: 0 (UBInt8)
action_control: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
command: 0 (UBInt16)
trigger_date: datetime.date(1900, 1, 1)
trigger_time: 00:00:00 (Time)
check_byte: 111 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20
\x82\x80\x00\x00\x00\x00\x61\x0c\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x6f
# response
hf = HartFrame(97)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 97 (Command)
byte_count: 14 (UBInt8)
payload: Command97_ConfigureSynchronousActionResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
action_number: 0 (UBInt8)
action_control: 0 (UBInt8)
device_variable_code: 0 (UBInt8)
command: 0 (UBInt16)
trigger_date: datetime.date(1900, 1, 1)
trigger_time: 00:00:00 (Time)
check_byte: 105 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22
\x86\x80\x00\x00\x00\x00\x61\x0e\x00\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x69
Command 98
Command 98 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(98)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 98 (Command)
byte_count: 1 (UBInt8)
payload: Command98_ReadCommandActionRequest():
action_number: 0 (UBInt8)
check_byte: 97 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x62\x01\x00\x61
# response
hf = HartFrame(98)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 98 (Command)
byte_count: 6 (UBInt8)
payload: Command98_ReadCommandActionResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
action_number: 0 (UBInt8)
command: 0 (UBInt16)
byte_count: 0 (UBInt8)
data: Array():
[
]
check_byte: 98 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x62\x06\x00\x00\x00\x00\x00\x00\x62
Command 99
Command 99 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(99)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 99 (Command)
byte_count: 4 (UBInt8)
payload: Command99_ConfigureCommandActionRequest():
action_number: 0 (UBInt8)
command: 0 (UBInt16)
byte_count: 0 (UBInt8)
data: Array():
[
]
check_byte: 101 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x82\x80\x00\x00\x00\x00\x63\x04\x00\x00\x00\x00\x65
# response
hf = HartFrame(99)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 99 (Command)
byte_count: 6 (UBInt8)
payload: Command99_ConfigureCommandActionResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
action_number: 0 (UBInt8)
command: 0 (UBInt16)
byte_count: 0 (UBInt8)
data: Array():
[
]
check_byte: 99 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14
\x86\x80\x00\x00\x00\x00\x63\x06\x00\x00\x00\x00\x00\x00\x63
Command 100
Command 100 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(100)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 100 (Command)
byte_count: 1 (UBInt8)
payload: Command100_WritePrimaryVariableAlarmCodeRequest():
primary_variable_alarm_selection_code: 0 (UBInt8)
check_byte: 103 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x64\x01\x00\x67
# response
hf = HartFrame(100)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 100 (Command)
byte_count: 3 (UBInt8)
payload: Command100_WritePrimaryVariableAlarmCodeResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
primary_variable_alarm_selection_code: 0 (UBInt8)
check_byte: 97 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x86\x80\x00\x00\x00\x00\x64\x03\x00\x00\x00\x61
Command 101
Command 101 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(101)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 101 (Command)
byte_count: 1 (UBInt8)
payload: Command101_ReadSubDeviceToBurstMessageMapRequest():
burst_message: 0 (UBInt8)
check_byte: 102 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x65\x01\x00\x66
# response
hf = HartFrame(101)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 101 (Command)
byte_count: 5 (UBInt8)
payload: Command101_ReadSubDeviceToBurstMessageMapResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
burst_message: 0 (UBInt8)
subdevice_index: 0 (UBInt16)
check_byte: 102 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x86\x80\x00\x00\x00\x00\x65\x05\x00\x00\x00\x00\x00\x66
Command 102
Command 102 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(102)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 102 (Command)
byte_count: 3 (UBInt8)
payload: Command102_MapSubdeviceToBurstMessageRequest():
burst_message: 0 (UBInt8)
subdevice_index: 0 (UBInt16)
check_byte: 103 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x82\x80\x00\x00\x00\x00\x66\x03\x00\x00\x00\x67
# response
hf = HartFrame(102)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 102 (Command)
byte_count: 5 (UBInt8)
payload: Command102_MapSubdeviceToBurstMessageResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
burst_message: 0 (UBInt8)
subdevice_index: 0 (UBInt16)
check_byte: 101 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x86\x80\x00\x00\x00\x00\x66\x05\x00\x00\x00\x00\x00\x65
Command 103
Command 103 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(103)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 103 (Command)
byte_count: 9 (UBInt8)
payload: Command103_WriteBurstPeriodRequest():
burst_message: 0 (UBInt8)
update_period: 00:00:00 (Time)
maximum_update_period: 00:00:00 (Time)
check_byte: 108 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x82\x80\x00\x00\x00\x00\x67\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6c
# response
hf = HartFrame(103)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 103 (Command)
byte_count: 11 (UBInt8)
payload: Command103_WriteBurstPeriodResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
burst_message: 0 (UBInt8)
update_period: 00:00:00 (Time)
maximum_update_period: 00:00:00 (Time)
check_byte: 106 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19
\x86\x80\x00\x00\x00\x00\x67\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6a
Command 104
Command 104 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(104)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 104 (Command)
byte_count: 8 (UBInt8)
payload: Command104_WriteBurstTriggerRequest():
burst_message: 0 (UBInt8)
burst_trigger_mode_selection_code: 0 (UBInt8)
device_variable_classification: 0 (UBInt8)
units_code: 0 (UBInt8)
trigger_level: 0.0 (BFloat)
check_byte: 98 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x82\x80\x00\x00\x00\x00\x68\x08\x00\x00\x00\x00\x00\x00\x00\x00\x62
# response
hf = HartFrame(104)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 104 (Command)
byte_count: 10 (UBInt8)
payload: Command104_WriteBurstTriggerResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
burst_message: 0 (UBInt8)
burst_trigger_mode_selection_code: 0 (UBInt8)
device_variable_classification: 0 (UBInt8)
units_code: 0 (UBInt8)
trigger_level: 0.0 (BFloat)
check_byte: 100 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x68\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64
Command 105
Command 105 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(105)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 105 (Command)
byte_count: 1 (UBInt8)
payload: Command105_ReadBurstModeConfigurationRequest():
burst_message: 0 (UBInt8)
check_byte: 106 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x69\x01\x00\x6a
# response
hf = HartFrame(105)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 105 (Command)
byte_count: 31 (UBInt8)
payload: Command105_ReadBurstModeConfigurationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
burst_mode_control_code: 0 (UBInt8)
command_number_expansion_flag: 0 (UBInt8)
device_variable_code_slot0: 0 (UBInt8)
device_variable_code_slot1: 0 (UBInt8)
device_variable_code_slot2: 0 (UBInt8)
device_variable_code_slot3: 0 (UBInt8)
device_variable_code_slot4: 0 (UBInt8)
device_variable_code_slot5: 0 (UBInt8)
device_variable_code_slot6: 0 (UBInt8)
device_variable_code_slot7: 0 (UBInt8)
burst_message: 0 (UBInt8)
maximum_burst_messages: 0 (UBInt8)
extended_command_number: 0 (UBInt16)
update_time: 00:00:00 (Time)
maximum_update_time: 00:00:00 (Time)
burst_trigger_mode_code: 0 (UBInt8)
device_variable_classification: 0 (UBInt8)
units_code: 0 (UBInt8)
trigger_value: 0.0 (BFloat)
check_byte: 112 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39
\x86\x80\x00\x00\x00\x00\x69\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x70
Command 106
Command 106 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(106)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 106 (Command)
byte_count: 0 (UBInt8)
payload: Command106_FlushDelayedResponsesRequest():
check_byte: 104 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x6a\x00\x68
# response
hf = HartFrame(106)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 106 (Command)
byte_count: 2 (UBInt8)
payload: Command106_FlushDelayedResponsesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
check_byte: 110 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x6a\x02\x00\x00\x6e
Command 107
Command 107 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(107)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 107 (Command)
byte_count: 9 (UBInt8)
payload: Command107_WriteBurstDeviceVariablesRequest():
device_variable_code_slot0: 0 (UBInt8)
device_variable_code_slot1: 0 (UBInt8)
device_variable_code_slot2: 0 (UBInt8)
device_variable_code_slot3: 0 (UBInt8)
device_variable_code_slot4: 0 (UBInt8)
device_variable_code_slot5: 0 (UBInt8)
device_variable_code_slot6: 0 (UBInt8)
device_variable_code_slot7: 0 (UBInt8)
burst_message: 0 (UBInt8)
check_byte: 96 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x82\x80\x00\x00\x00\x00\x6b\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60
# response
hf = HartFrame(107)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 107 (Command)
byte_count: 11 (UBInt8)
payload: Command107_WriteBurstDeviceVariablesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
device_variable_code_slot0: 0 (UBInt8)
device_variable_code_slot1: 0 (UBInt8)
device_variable_code_slot2: 0 (UBInt8)
device_variable_code_slot3: 0 (UBInt8)
device_variable_code_slot4: 0 (UBInt8)
device_variable_code_slot5: 0 (UBInt8)
device_variable_code_slot6: 0 (UBInt8)
device_variable_code_slot7: 0 (UBInt8)
burst_message: 0 (UBInt8)
check_byte: 102 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19
\x86\x80\x00\x00\x00\x00\x6b\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x66
Command 108
Command 108 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(108)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 108 (Command)
byte_count: 3 (UBInt8)
payload: Command108_WriteBurstModeCommandNumberRequest():
command: 0 (UBInt16)
burst_message: 0 (UBInt8)
check_byte: 109 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11
\x82\x80\x00\x00\x00\x00\x6c\x03\x00\x00\x00\x6d
# response
hf = HartFrame(108)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 108 (Command)
byte_count: 5 (UBInt8)
payload: Command108_WriteBurstModeCommandNumberResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
command: 0 (UBInt16)
burst_message: 0 (UBInt8)
check_byte: 111 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x86\x80\x00\x00\x00\x00\x6c\x05\x00\x00\x00\x00\x00\x6f
Command 109
Command 109 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(109)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 109 (Command)
byte_count: 2 (UBInt8)
payload: Command109_BurstModeControlRequest():
burst_mode_control_code: 0 (UBInt8)
burst_message: 0 (UBInt8)
check_byte: 109 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x6d\x02\x00\x00\x6d
# response
hf = HartFrame(109)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 109 (Command)
byte_count: 4 (UBInt8)
payload: Command109_BurstModeControlResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
burst_mode_control_code: 0 (UBInt8)
burst_message: 0 (UBInt8)
check_byte: 111 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x6d\x04\x00\x00\x00\x00\x6f
Command 110
Command 110 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(110)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 110 (Command)
byte_count: 0 (UBInt8)
payload: Command110_ReadAllDynamicVariablesRequest():
check_byte: 108 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x82\x80\x00\x00\x00\x00\x6e\x00\x6c
# response
hf = HartFrame(110)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 110 (Command)
byte_count: 2 (UBInt8)
payload: Command110_ReadAllDynamicVariablesResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
dynamic_variables: Array():
[
]
check_byte: 106 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x86\x80\x00\x00\x00\x00\x6e\x02\x00\x00\x6a
Command 111
Command 111 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(111)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 111 (Command)
byte_count: 5 (UBInt8)
payload: Command111_TransferServiceControlRequest():
port: 0 (UBInt8)
function_code: 0 (UBInt8)
maximum_segment_length: 0 (UBInt8)
starting_master_byte_counter: 0 (UBInt16)
check_byte: 104 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13
\x82\x80\x00\x00\x00\x00\x6f\x05\x00\x00\x00\x00\x00\x68
# response
hf = HartFrame(111)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 111 (Command)
byte_count: 9 (UBInt8)
payload: Command111_TransferServiceControlResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
port: 0 (UBInt8)
function_code: 0 (UBInt8)
maximum_segment_length: 0 (UBInt8)
starting_master_byte_counter: 0 (UBInt16)
starting_field_device_byte_counter: 0 (UBInt16)
check_byte: 96 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x86\x80\x00\x00\x00\x00\x6f\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60
Command 112
Command 112 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(112)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 112 (Command)
byte_count: 7 (UBInt8)
payload: Command112_BlockTransferRequest():
port: 0 (UBInt8)
function_code: 0 (UBInt8)
number_of_bytes_transferred: 0 (UBInt8)
master_byte_count: 0 (UBInt16)
slave_byte_count: 0 (UBInt16)
data: Array():
[
]
check_byte: 117 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15
\x82\x80\x00\x00\x00\x00\x70\x07\x00\x00\x00\x00\x00\x00\x00\x75
# response
hf = HartFrame(112)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 112 (Command)
byte_count: 9 (UBInt8)
payload: Command112_BlockTransferResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
port: 0 (UBInt8)
function_code: 0 (UBInt8)
number_of_bytes_transferred: 0 (UBInt8)
master_byte_count: 0 (UBInt16)
slave_byte_count: 0 (UBInt16)
data: Array():
[
]
check_byte: 127 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x86\x80\x00\x00\x00\x00\x70\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f
Command 113
Command 113 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(113)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 113 (Command)
byte_count: 15 (UBInt8)
payload: Command113_CatchDeviceVariableRequest():
destination_device_variable: 0 (UBInt8)
capture_mode_code: 0 (UBInt8)
source_slave_expanded_device_type_code: 0 (UBInt16)
source_slave_device_id: BitStruct():
value: 0 (BitField(24))
command_number_expansion_flag: 0 (UBInt8)
source_slot_number: 0 (UBInt8)
shed_time: 0.0 (BFloat)
source_command_number: 0 (UBInt16)
check_byte: 124 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23
\x82\x80\x00\x00\x00\x00\x71\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c
# response
hf = HartFrame(113)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 113 (Command)
byte_count: 17 (UBInt8)
payload: Command113_CatchDeviceVariableResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
destination_device_variable: 0 (UBInt8)
capture_mode_code: 0 (UBInt8)
source_slave_address: BitStruct():
value: 0 (BitField(40))
command_number_expansion_flag: 0 (UBInt8)
source_slot_number: 0 (UBInt8)
shed_time: 0.0 (BFloat)
source_command_number: 0 (UBInt16)
check_byte: 102 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25
\x86\x80\x00\x00\x00\x00\x71\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x66
Command 114
Command 114 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(114)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 114 (Command)
byte_count: 1 (UBInt8)
payload: Command114_ReadCaughtDeviceVariableRequest():
destination_device_variable: 0 (UBInt8)
check_byte: 113 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x72\x01\x00\x71
# response
hf = HartFrame(114)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 114 (Command)
byte_count: 17 (UBInt8)
payload: Command114_ReadCaughtDeviceVariableResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
destination_device_variable: 0 (UBInt8)
capture_mode_code: 0 (UBInt8)
source_slave_address: BitStruct():
value: 0 (BitField(40))
LSB_of_source_command_number: 0 (UBInt8)
source_slot_number: 0 (UBInt8)
shed_time: 0.0 (BFloat)
source_command_number: 0 (UBInt16)
check_byte: 101 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25
\x86\x80\x00\x00\x00\x00\x72\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x65
Command 115
Command 115 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(115)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 115 (Command)
byte_count: 1 (UBInt8)
payload: Command115_ReadEventNotificationSummaryRequest():
event_specification_number: 0 (UBInt8)
check_byte: 112 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9
\x82\x80\x00\x00\x00\x00\x73\x01\x00\x70
# response
hf = HartFrame(115)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 115 (Command)
byte_count: 22 (UBInt8)
payload: Command115_ReadEventNotificationSummaryResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
event_specification_number: 0 (UBInt8)
number_of_events_supported: 0 (UBInt8)
event_status_notification_control: BitStruct():
event_status: 0 (Nibble)
notification_control_code: 0 (Nibble)
first_event_trigger_time: 00:00:00 (Time)
event_notification_retry_time: 00:00:00 (Time)
maximum_update_time: 00:00:00 (Time)
event_debounce_interval: 00:00:00 (Time)
device_status_mask: BitStruct():
value: 0 (BitField(8))
event_mask: Array():
[
]
check_byte: 99 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30
\x86\x80\x00\x00\x00\x00\x73\x16\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x63
Command 116
Command 116 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(116)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 116 (Command)
byte_count: 2 (UBInt8)
payload: Command116_WriteEventNotificationBitMaskRequest():
event_specification_number: 0 (UBInt8)
device_status_mask: BitStruct():
value: 0 (BitField(8))
event_mask: Array():
[
]
check_byte: 116 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x74\x02\x00\x00\x74
# response
hf = HartFrame(116)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 116 (Command)
byte_count: 4 (UBInt8)
payload: Command116_WriteEventNotificationBitMaskResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
event_specification_number: 0 (UBInt8)
device_status_mask: BitStruct():
value: 0 (BitField(8))
event_mask: Array():
[
]
check_byte: 118 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x74\x04\x00\x00\x00\x00\x76
Command 117
Command 117 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(117)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 117 (Command)
byte_count: 13 (UBInt8)
payload: Command117_WriteEventNotificationTimingRequest():
event_specification_number: 0 (UBInt8)
event_notification_retry_time: 00:00:00 (Time)
maximum_update_time: 00:00:00 (Time)
event_debounce_interval: 00:00:00 (Time)
check_byte: 122 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21
\x82\x80\x00\x00\x00\x00\x75\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7a
# response
hf = HartFrame(117)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 117 (Command)
byte_count: 15 (UBInt8)
payload: Command117_WriteEventNotificationTimingResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
event_specification_number: 0 (UBInt8)
event_notification_retry_time: 00:00:00 (Time)
maximum_update_time: 00:00:00 (Time)
event_debounce_interval: 00:00:00 (Time)
check_byte: 124 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23
\x86\x80\x00\x00\x00\x00\x75\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7c
Command 118
Command 118 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(118)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 118 (Command)
byte_count: 2 (UBInt8)
payload: Command118_EventNotificationControlRequest():
event_specification_number: 0 (UBInt8)
event_notification_control_code: 0 (UBInt8)
check_byte: 118 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10
\x82\x80\x00\x00\x00\x00\x76\x02\x00\x00\x76
# response
hf = HartFrame(118)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 118 (Command)
byte_count: 4 (UBInt8)
payload: Command118_EventNotificationControlResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
event_specification_number: 0 (UBInt8)
event_notification_control_code: 0 (UBInt8)
check_byte: 116 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12
\x86\x80\x00\x00\x00\x00\x76\x04\x00\x00\x00\x00\x74
Command 119
Command 119 example:
import oser
from htf.hart import HartFrame
# request
hf = HartFrame(119)
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 119 (Command)
byte_count: 8 (UBInt8)
payload: Command119_AcknowledgeEventNotificationRequest():
event_specification_number: 0 (UBInt8)
first_event_trigger_time: 00:00:00 (Time)
configuration_change_counter: 0 (UBInt16)
device_status: BitStruct():
value: 0 (BitField(8))
command48_data: Array():
[
]
check_byte: 125 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16
\x82\x80\x00\x00\x00\x00\x77\x08\x00\x00\x00\x00\x00\x00\x00\x00\x7d
# response
hf = HartFrame(119)
hf.delimiter.frame_type.set("ack")
print(hf)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: False (Flag)
address: 0x0 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 119 (Command)
byte_count: 10 (UBInt8)
payload: Command119_AcknowledgeEventNotificationResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
event_specification_number: 0 (UBInt8)
first_event_trigger_time: 00:00:00 (Time)
configuration_change_counter: 0 (UBInt16)
device_status: BitStruct():
value: 0 (BitField(8))
command48_data: Array():
[
]
check_byte: 123 (CheckByte)
encoded = hf.encode()
print(oser.to_hex(encoded))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18
\x86\x80\x00\x00\x00\x00\x77\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7b
Device Specific Commands
To realize device specific commands HartFrame
must be subclassed and the methods
requests_generator
and
responses_generator
must be
overwritten.
Both methods are generators that yield tuples consisting of the command number and a device specific parser.
It is recommended to use oser.Lazy
to wrap the parser to speed up
the initialization of the HART frame.
In the following example the command 48 and 181 are implemented:
from oser import \
ByteStruct, BitStruct, BitField, Switch, String, \
Enum, UBInt8, Lazy, BFloat, to_hex
from htf.hart import HartFrame, ResponseCode, FieldDeviceStatus
class Command48_ReadAdditionalDeviceStatusRequest(ByteStruct):
def __init__(self):
super(Command48_ReadAdditionalDeviceStatusRequest, self).__init__()
self.device_specific_status = BitStruct()
self.device_specific_status.value = BitField(length=48)
self.extended_device_status = UBInt8()
self.device_operating_mode = UBInt8()
self.status0 = UBInt8()
self.status1 = UBInt8()
self.analog_channel_saturated = UBInt8()
self.status2 = UBInt8()
self.status3 = UBInt8()
self.analog_channel_fixed = UBInt8()
self.device_specific_status = BitStruct()
self.device_specific_status.value = BitField(length=88)
class Command48_ReadAdditionalDeviceStatusResponse(ByteStruct):
def __init__(self):
super(Command48_ReadAdditionalDeviceStatusResponse, self).__init__()
self.response_code = ResponseCode(
error_device_specific_command_error=6,
warning_update_in_progress=8,
error_access_restricted=16,
error_busy=32)
self.field_device_status = FieldDeviceStatus()
self.device_specific_status = BitStruct()
self.device_specific_status.value = BitField(length=48)
self.extended_device_status = UBInt8()
self.device_operating_mode = UBInt8()
self.status0 = UBInt8()
self.status1 = UBInt8()
self.analog_channel_saturated = UBInt8()
self.status2 = UBInt8()
self.status3 = UBInt8()
self.analog_channel_fixed = UBInt8()
self.device_specific_status = BitStruct()
self.device_specific_status.value = BitField(length=88)
class Command181_SetAnalogOutputRequest(ByteStruct):
def __init__(self):
super(Command181_SetAnalogOutputRequest, self).__init__()
self.temporary_analog_output = Enum(
prototype=UBInt8,
values={
"invalid": 0x07,
"beamblock_signal": 0x06,
"fixed_current": 0x05,
"current_corresponding_to_gas_concentration": 0x04,
"maintenance_signal": 0x03,
"error_signal": 0x02,
"warning_signal": 0x01,
"analog_normal": 0x00,
},
value="invalid",
strict=True)
self.gas_concentration = BFloat(.0)
self.fixed_current_mA = BFloat(.0)
class Command181_SetAnalogOutputResponse(ByteStruct):
def __init__(self):
super(Command181_SetAnalogOutputResponse, self).__init__()
self.response_code = ResponseCode()
self.field_device_status = FieldDeviceStatus()
self.temporary_analog_output = Enum(
prototype=UBInt8,
values={
"invalid": 0x07,
"beamblock_signal": 0x06,
"fixed_current": 0x05,
"current_corresponding_to_gas_concentration": 0x04,
"maintenance_signal": 0x03,
"error_signal": 0x02,
"warning_signal": 0x01,
"analog_normal": 0x00,
},
value="invalid",
strict=True)
self.gas_concentration = BFloat(.0)
self.fixed_current_mA = BFloat(.0)
class DeviceHartFrame(HartFrame):
def requests_generator(self):
# this is only needed in subclass hierarchies
for command, parser in super(DeviceHartFrame, self).requests_generator():
yield command, parser
# the following commands are device specific
yield 48, Lazy(Command48_ReadAdditionalDeviceStatusRequest)
yield 181, Lazy(Command181_SetAnalogOutputRequest)
def responses_generator(self):
# this is only needed in subclass hierarchies
for command, parser in super(DeviceHartFrame, self).responses_generator():
yield command, parser
# the following commands are device specific
yield 48, Lazy(Command48_ReadAdditionalDeviceStatusResponse)
yield 181, Lazy(Command181_SetAnalogOutputResponse)
These commands can be easily adapted for the customer’s needs.
In the following example the usage is demonstrated.
# command 48
hf = DeviceHartFrame(command=48)
# request
hf.delimiter.frame_type.set("stx")
binary = hf.encode()
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 48 (UBInt8)
byte_count: 19 (UBInt8)
payload: Command48_ReadAdditionalDeviceStatusRequest():
device_specific_status: BitStruct():
value: 0 (BitField(88))
extended_device_status: 0 (UBInt8)
device_operating_mode: 0 (UBInt8)
status0: 0 (UBInt8)
status1: 0 (UBInt8)
analog_channel_saturated: 0 (UBInt8)
status2: 0 (UBInt8)
status3: 0 (UBInt8)
analog_channel_fixed: 0 (UBInt8)
check_byte: 33 (CheckByte)
print(to_hex(binary))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27
\x82\x80\x00\x00\x00\x00\x30\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x21
# response
hf.delimiter.frame_type.set("ack")
binary = hf.encode()
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 48 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command48_ReadAdditionalDeviceStatusResponse():
check_byte: 54 (CheckByte)
print(to_hex(binary))
0| 1| 2| 3| 4| 5| 6| 7| 8
\x86\x80\x00\x00\x00\x00\x30\x00\x36
# command 181
hf = DeviceHartFrame(command=181)
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 181 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command181_SetAnalogOutputRequest():
temporary_analog_output: 'invalid' (UBInt8)
gas_concentration: 0.0 (BFloat)
fixed_current_mA: 0.0 (BFloat)
check_byte: 0 (CheckByte)
# request
hf.delimiter.frame_type.set("stx")
hf.payload.temporary_analog_output.set(0x04)
hf.payload.gas_concentration.set(15.0)
hf.payload.fixed_current_mA.set(4.5)
binary = hf.encode()
print(hf)
DevieHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 181 (UBInt8)
byte_count: 9 (UBInt8)
payload: Command181_SetAnalogOutputRequest():
temporary_analog_output: 'current_corresponding_to_gas_concentration' (UBInt8)
gas_concentration: 15.0 (BFloat)
fixed_current_mA: 4.5 (BFloat)
check_byte: 91 (CheckByte)
print(to_hex(binary))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17
\x82\x80\x00\x00\x00\x00\xb5\x09\x04\x41\x70\x00\x00\x40\x90\x00\x00\x5b
# response
hf.delimiter.frame_type.set("ack")
binary = hf.encode()
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 181 (UBInt8)
byte_count: 11 (UBInt8)
payload: Command181_SetAnalogOutputResponse():
response_code: 'success' (UBInt8)
field_device_status: (FieldDeviceStatus)
temporary_analog_output: 'invalid' (UBInt8)
gas_concentration: 0.0 (BFloat)
fixed_current_mA: 0.0 (BFloat)
check_byte: 191 (CheckByte)
print(to_hex(binary))
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19
\x86\x80\x00\x00\x00\x00\xb5\x0b\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\xbf
Protocol Factory
A protocol factory creates device specific HART frame abstractions respecting the device type or device address.
It is useful for the HART-shell and the HART-monitor.
A protocol factory needs two methods that return a device specific HART frame by device type or device address (in which the device type is included).
from htf.hart import HartFrame
from htf.hart.universal_commands import \
Command48_ReadAdditionalDeviceStatusRequest,\
Command48_ReadAdditionalDeviceStatusResponse
from oser import Lazy
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class DeviceHartFrame(HartFrame):
def requests_generator(self):
# here come the device specific commands
yield 48, Lazy(Command48_ReadAdditionalDeviceStatusRequest)
def responses_generator(self):
# here come the device specific commands
yield 48, Lazy(Command48_ReadAdditionalDeviceStatusResponse)
_frame_parser_db = {
# the two LSBs in the device type cannot be used in the
# device address so they must be masked
0x1337 & 0x3fff: ["SpecificHartDevice", DeviceHartFrame],
# ...
}
def get_hart_frame_by_device_type(device_type):
"""
Create a HartFrame with device specific commands
for the given device type.
Args:
device_type (int): the device type to be used
Returns:
HartFrame: a HartFrame generator for device specific commands
"""
logger.info("Selecting frame by device type 0x%010x" % device_type)
# the two LSBs in the device type cannot be used in the
# device address so they must be masked
device_type = device_type & 0x3fff
try:
name, DeviceSpecificHartFrame = _frame_parser_db[device_type]
logger.info(
"Found specific frame parser for %s (0x%x)" %
(name, device_type))
def _generator(command=None, auto_length=True):
return DeviceSpecificHartFrame(command=command, auto_length=auto_length)
return _generator
except KeyError:
logger.info("No specific frame parser found for device id 0x%010x. "
"Using default HartFrame()." % device_type)
return HartFrame
def get_hart_frame_by_device_address(device_address):
"""
Create a HartFrame with device specific commands
for the given device address by extracting the
device type from the device address
Args:
device_address (int): the device address to be used
Returns:
HartFrame: a HartFrame generator for device specific commands
"""
device_type = device_address >> 24
return get_hart_frame_by_device_type(device_type)
An exemplary usage looks like:
DeviceSpecificHartFrame = get_hart_frame_by_device_type(device_type=0x1337)
hf = DeviceSpecificHartFrame(command=48)
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 48 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command48_ReadAdditionalDeviceStatusRequest():
device_specific_status: BitStruct():
value: 0 (BitField(88))
extended_device_status: 0 (UBInt8)
device_operating_mode: 0 (UBInt8)
status0: 0 (UBInt8)
status1: 0 (UBInt8)
analog_channel_saturated: 0 (UBInt8)
status2: 0 (UBInt8)
status3: 0 (UBInt8)
analog_channel_fixed: 0 (UBInt8)
check_byte: 0 (CheckByte)
hf = DeviceSpecificHartFrame(command=181)
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 181 (UBInt8)
byte_count: 0 (UBInt8)
payload: b''
check_byte: 0 (CheckByte)
DeviceSpecificHartFrame = get_hart_frame_by_device_address(device_address=0x1337000023)
INFO:__main__:Selecting frame by device type 0x0000001337
INFO:__main__:Found specific frame parser for SpecificHartDevice (0x1337)
hf = DeviceSpecificHartFrame(command=48)
print(hf)
DeviceHartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 48 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command48_ReadAdditionalDeviceStatusRequest():
device_specific_status: BitStruct():
value: 0 (BitField(88))
extended_device_status: 0 (UBInt8)
device_operating_mode: 0 (UBInt8)
status0: 0 (UBInt8)
status1: 0 (UBInt8)
analog_channel_saturated: 0 (UBInt8)
status2: 0 (UBInt8)
status3: 0 (UBInt8)
analog_channel_fixed: 0 (UBInt8)
check_byte: 0 (CheckByte)
HART-Shell
The HART-shell enables you to develop and debug a HART device interactively. It is intended to be used interactively but can also be used non-interactively. The HART-shell is also customizable.
- class htf.hart.HartShell(comport: str | None = None, decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None, protocol_factory: Callable[[...], Type[HartFrame]] | None = None, timeout: int | float | None = None, interactive: bool = True, loglevel: int | None = 2, argv: List[str] | None = None)
A HART Shell that can be used interactively.
- Parameters:
comport – the comport to be used where the HART modem is connected to.
decoder_generator=None – a callable that returns a HartFrame instance with or without device specific commands.
protocol_factory=None – a protocol factory that returns a device specific HART frame parser with respect to the supplied device type.
timeout=None – the default timeout in seconds.
interactive=True – if set to
True
the HART Shell becomes interactive.loglevel=2 – set loglevel for loggnig to
loglevel
.argv=None – used for testing, etc.
- close() None
Close the HART application layer and close the HART interface supplied. Is called in __del__, too.
- cmd(command: int, inputs: List[Any] | None = None, edit_all: bool = False, interactive: bool = True, timeout: int | float | None = None) HartFrame | None
Query a HART command.
- Parameters:
command – the HART command number.
inputs=None – the inputs to be set in order to be put into the HART request.
edit_all=False – if set to
True
and the HART shell runs interactively all request fields are edited interactively.interactive=True – if set to
True
the request is edited interactively.timeout=None – the timeout in seconds. If
None
is supplied the default timeout is used. If the default timeout is not set 1.0 is used.
- find_device(polling_addresses: List[int] | None = None) int | None
Find the first HART device by polling all addresses stated in
polling_addresses
and use the first device found.If no device is found an
AssertionError
is raised.- Parameters:
polling_addresses=[0] – the polling addresses used to find a HART device.
- Returns:
Unique HART address of the first device found in polling.
- Return type:
- last_preamble_count() int
Returns the number of preambles most recently received by the HartInterface.
- Returns:
number of preambles
- Return type:
- last_response() HartFrame | Any | None
Get the last response.
The last received packet can also be access via
self.response
.- Returns:
the last received packet.
- Return type:
- list_device_commands(commands: List[int] | None = None) List[int]
List the implemented commands of a HART device. Helps to find undocumented commands.
- poll_devices(polling_addresses: List[int] | None = None) None
Poll
polling_addresses
to find HART devices.- Parameters:
polling_addresses=[0] – list of HART polling addresses
- set_decoder_by_device_address(device_address: int) None
Select the frame decoder and encoder by the device address
- Parameters:
device_address – the device address
- set_decoder_generator(decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None) None
Set the frame generator.
- Parameters:
decoder_generator=HartFrame – a parser for HART frames.
- set_device_address(device_address: int) None
Set the current HART device address.
- Parameters:
device_address – the HART device address to be used (<= 38 bits)
- set_loglevel(loglevel: int | None) None
Set the loglevel.
Loglevel
0
meansquiet
.Loglevel
1
meansbinary
output. All packets are printed in a compact binary format.Loglevel
2
meansbinary+payload of interest
output. All packets are printed in a compact binary format. Additionally the interesting payload is printed.response_code
is left out if it issuccess
andfield_device_status
is left out in case of0
. Other payload is printed line by line.Loglevel
3
meansbinary+whole packet
output. All packets are printed in a compact binary format. Additionally the packets are fully printed.- Parameters:
loglevel – Set loglevel to
loglevel
.
- set_master_address(master_address: int) None
Set the current simulated master address.
- Parameters:
master_address – “primary_master” or “secondary_master”
- set_number_of_preambles(number_of_preambles: int) None
Set the number of preambles for requests.
- Parameters:
number_of_preambles – the number of preambles for requests.
Interactive usage
htf
comes with a HART-shell command line utility called hart-shell
.
When run interactively all methods in htf.hart.HartShell
are put into the local namespace so they can be run by entering the name.
Additionally macros are created for each possible command, eg. cmd0
,
cmd1
, ..
, cmd255
. These can be run by name, too.
The command line utility is based on IPython. IPython allows tab-completion.
To enter long commands enter the first characters and press TAB
and select
the command using the arrow keys.
To run the hart-shell
simply enter
$ hart-shell -c <comport>
Show help
$ hart-shell -h
usage: hart-shell [-h] -c COMPORT [-d Protocol database] [-t timeout]
[-v loglevel] [-V]
hart-shell - HILSTER Testing Framework (HILSTER GmbH, http://hilster.io)
optional arguments:
-h, --help show this help message and exit
-c COMPORT, --comport COMPORT
comport for HART communication
-d Protocol database, --database Protocol database
An import string to the protocol database where device
specific HART frames can be found. See docs for
details.
-t timeout, --timeout timeout
The default timeout for commands.
-v loglevel, --loglevel loglevel
The loglevel: 0: quiet, 1: binary, 2: binary+payload
of interest, 3: binary+debug
-V, --version Show version and exit
Find and select the first device
To find and select a device
htf.hart.HartShell.find_device
is used.
If a device or multiple devices are found the first device address is
selected and the address is used for all other commands entered.
Find and select the first device for polling address 0
:
In [1]: find_device()
Using first device with address 0x1337000023
Find and select the first device for polling addresses 0..9
:
In [2]: find_device(range(10))
Using first device with address 0x1337000023
Poll devices
To poll HART devices
htf.hart.HartShell.poll_devices
is used.
To poll polling address 0
enter:
In [1]: poll_devices()
Found 1 HART device.
0x1337000023
To poll polling addresses 0..9
enter:
In [2]: poll_devices(range(10))
Found 1 HART device.
0x1337000023
Set the timeout
The timeout for commands can be set using
htf.hart.HartShell.set_timeout
.
To set the timeout to 3.0
seconds enter:
In [1]: set_timeout(3.0)
Device selection
To select a device manually the device address can be set using
htf.hart.HartShell.set_device_address
.
To set the device address to 0x1337000024
enter:
In [1]: set_device_address(0x1337000024)
Running commands interactively
You can run commands interactively to debug, test and develop a HART-device.
The easiest way is to enter cmd
plus the command number to be run, eg.
cmd1
to run command 1.
By default the device address selected by
htf.hart.HartShell.find_device
or set by
htf.hart.HartShell.set_device_address
is used
automatically.
To select a device and run command 1 on it enter:
In [1]: find_device()
Using first device with address 0x1337000023
Out[1]: 82527125539
In [2]: cmd1()
Running Command 1
Request:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 0 (CheckByte)
Response:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 82527125539 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'buffer_overflow' (UBInt8)
field_device_status: non-primary_variable_out_of_limits (FieldDeviceStatus)
units: 123 (UBInt8)
primary_variable: 456.78900146484375 (BFloat)
check_byte: 193 (CheckByte)
Out[2]: <htf.hart.protocol.HartFrame at 0x7fb4d4165080>
The timeout set by htf.hart.HartShell.set_timeout
is used if not specified for the specific comamnd.
To set the timeout add a timeout=3.0
agrument.
In [3]: cmd1(timeout=3.0)
Loglevel
The loglevel can be set via commandline using the -v
option or within the HART-Shell using
In [1]: set_loglevel(loglevel)
The values for loglevel
reach from 0
to 3
.
0
means quiet.
1
means binary short form.
2
means binary short form and payload of interest.
3
means binary short form and debug.
The following example lists all loglevel usages:
In [1]: find_device()
Using first device with address 0x52eb021ce5
Out[1]: 356130102501
In [2]: set_loglevel(0)
In [3]: cmd1()
Out[3]: <htf.hart.protocol.HartFrame at 0x7419a90>
In [4]: set_loglevel(1)
In [5]: cmd1()
STX: 5FF 82 92EB021CE5 01
ACK: 5FF 86 92EB021CE5 00508B7FE00000 06
Out[5]: <htf.hart.protocol.HartFrame at 0x71da278>
In [6]: set_loglevel(2)
In [7]: cmd1()
STX: 5FF 82 92EB021CE5 01
ACK: 5FF 86 92EB021CE5 00508B7FE00000 06
field_device_status: 80
units: 139
primary_variable: nan
Out[7]: <htf.hart.protocol.HartFrame at 0x1f862e8>
In [8]: set_loglevel(3)
In [9]: cmd1()
STX: 5FF 82 92EB021CE5 01
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0x52eb021ce5 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 1 (Command)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 1 (CheckByte)
ACK: 5FF 86 92EB021CE5 00508B7FE00000 06
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0x12eb021ce5 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 1 (Command)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'success' (UBInt8)
field_device_status: configuration_changed; more_status_available (FieldDeviceStatus)
units: 139 (UBInt8)
primary_variable: nan (BFloat)
check_byte: 6 (CheckByte)
Out[9]: <htf.hart.protocol.HartFrame at 0x6ed22b0>
The default loglevel is 2
.
Set the number of preambles
You can set the number of preambles for requests using
In [1]: set_number_of_preambles(3)
In [2]: cmd1()
STX: 3FF 82 92EB021CE5 01
ACK: 5FF 86 92EB021CE5 00508B7FE00000 06
field_device_status: 80
units: 139
primary_variable: 0.0
Out[2]: <htf.hart.protocol.HartFrame at 0x7238ef0>
In [3]: set_number_of_preambles(5)
In [4]: cmd1()
STX: 5FF 82 92EB021CE5 01
ACK: 5FF 86 92EB021CE5 00508B7FE00000 06
field_device_status: 80
units: 139
primary_variable: nan
Out[4]: <htf.hart.protocol.HartFrame at 0x6edab70>
Access last response
The last response can be accessed using self.response
.
In [1]: find_device()
Using first device with address 0x52eb021ce5
Out[1]: 356130102501
In [2]: cmd1()
STX: 5FF 82 92EB021CE5 01
ACK: 5FF 86 92EB021CE5 00508B7FE00000 06
field_device_status: 80
units: 139
primary_variable: nan
Out[2]: <htf.hart.protocol.HartFrame at 0x7014240>
In [3]: print(self.response)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0x12eb021ce5 (SlaveAddress(38))
expansion_bytes: Array():
[
]
command: 1 (Command)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'success' (UBInt8)
field_device_status: configuration_changed; more_status_available (FieldDeviceStatus)
units: 139 (UBInt8)
primary_variable: 0.0 (BFloat)
check_byte: 6 (CheckByte)
List device commands
You can poll a list of device commands to see which are supported. This way it is possible to find undocumented commands.
If you do not specify a list of commands to be polled 0 .. 255
is used.
In [1]: find_device()
Using first device with address 0x52eb021ce5
Out[1]: 356130102501
In [2]: list_device_commands()
command 0 .. is supported
command 1 .. is supported
command 2 .. is supported
command 3 .. is supported
command 4 .. is supported
command 5 .. is supported
command 6 .. is not supported
command 7 .. is not supported
command 8 .. is not supported
command 9 .. is not supported
command 10 .. is supported
command 11 .. is not supported
command 12 .. is supported
command 13 .. is not supported
command 14 .. is supported
command 15 .. is not supported
[...]
command 248 .. is supported
command 249 .. is supported
command 250 .. is supported
command 251 .. is supported
command 252 .. is supported
command 253 .. is supported
command 254 .. is supported
command 255 .. is supported
Out[2]:
[0,
1,
2,
3,
4,
5,
10,
12,
14,
[...]
248,
249,
250,
251,
252,
253,
254,
255]
You can specify the commands to poll by adding commands=<iterable>
:
In [2]: list_device_commands(commands=[1, 2, 3])
command 1 .. is supported
command 2 .. is supported
command 3 .. is supported
Out[2]: [1, 2, 3]
Master address
To set the master address
htf.hart.HartShell.set_master_address
is used.
To set the master address to secondary_master enter:
In [1]: set_master_address('secondary_master')
Exit
To exit hart-shell
enter exit()
, exit
or press CTRL+d
followed
by y
and Return
.
Method documentation
You can easily see the documentation for a method by adding a ?
at the
end of the command.
In [1]: set_master_address?
Signature: set_master_address(master_address)
Docstring:
Set the current simulated master address.
Args:
master_address (str): "primary_master" or "secondary_master"
Editing command payload interactively
By default a commands payload can be changed interactively. If the payload is empty there is nothing to be changed and the command is sent immediately.
For example the command 6 (set polling address) has a changeable payload.
To change the polling address to 1
enter:
In [1]: find_device()
Using first device with address 0x1337000023
Out[1]: 82527125539
In [2]: cmd6()
Running Command 6
Enter value for HartFrame.payload.polling_address (UBInt8) [0]> 1
Enter value for HartFrame.payload.loop_current_mode (UBInt8) [0]>
Request:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 6 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command6_WritePollingAddressRequest():
polling_address: 1 (UBInt8)
loop_current_mode: 0 (UBInt8)
check_byte: 0 (CheckByte)
If you do not want to change a value simply press Return
. The value
in the [
]
is the current value that is not changed then.
Editing commands interactively
If you want to edit the whole request frame add a edit_all=True
argument.
In this case you can also change the command number, etc. on the fly.
In [1]: find_device()
Using first device with address 0x1337000023
Out[1]: 82527125539
In [2]: cmd1(edit_all=True)
Running Command 1
Enter value for HartFrame().delimiter.address_type (Enum of Flag) ['unique']>
Enter value for HartFrame().delimiter.number_of_expansion_bytes (BitField) [0]>
Enter value for HartFrame().delimiter.physical_layer_type (Enum of BitField) ['asynchronous']>
Enter value for HartFrame().delimiter.frame_type (Enum of BitField) ['stx']>
Enter value for HartFrame().address.master_address (Enum of Flag) ['primary_master']>
Enter value for HartFrame().address.burst_mode (Flag) [0]>
Enter value for HartFrame().command (UBInt8) [1]>
Enter value for HartFrame().byte_count (UBInt8) [0]>
Enter value for HartFrame().check_byte (CheckByte) [0]>
Request:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 0 (CheckByte)
Response:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 82527125539 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'buffer_overflow' (UBInt8)
field_device_status: non-primary_variable_out_of_limits (FieldDeviceStatus)
units: 123 (UBInt8)
primary_variable: 456.78900146484375 (BFloat)
check_byte: 193 (CheckByte)
Out[2]: <htf.hart.protocol.HartFrame at 0x7fead57fabe0>
Passing contents to a command
The contents for interactively editable payload or frame contents
can also be passed using the inputs=[..]
argument.
To set the polling address to 2
non-interactively enter:
In [1]: find_device()
Using first device with address 0x1337000023
Out[1]: 82527125539
In [2]: cmd6(inputs=[2, 0])
Running Command 6
Request:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 6 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command6_WritePollingAddressRequest():
polling_address: 2 (UBInt8)
loop_current_mode: 0 (UBInt8)
check_byte: 0 (CheckByte)
Enabling autocall
To enable the autocall-feature enter:
In [1]: %autocall 2
Automatic calling is: Full
Now you do not need to add brackets to the commands to be called:
In [1]: find_device
------> find_device()
Using first device with address 0x1337000023
Out[1]: 82527125539
In [2]: cmd1
------> cmd1()
Running Command 1
Request:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 0 (CheckByte)
Response:
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 82527125539 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'buffer_overflow' (UBInt8)
field_device_status: non-primary_variable_out_of_limits (FieldDeviceStatus)
units: 123 (UBInt8)
primary_variable: 456.78900146484375 (BFloat)
check_byte: 193 (CheckByte)
Out[2]: <htf.hart.protocol.HartFrame at 0x7f39eef2c3c8>
Setting the protocol factory
To use the protocol factory created for your device enter:
hart-shell -c /dev/ttyUSB0 -d protocol_factory.get_hart_frame_by_device_type
hart-shell
needs a protocol factory that created a HART-frame by device
type.
In the example protocol_factory
is an importable python file and
get_hart_frame_by_device_type
is a method within it.
Scripting the HART-Shell
You can script the HART-Shell by putting your commands into a text file for easy reuse.
$ cat >hart_commands.txt <<EOL
find_device()
cmd1()
EOL
$ hart-shell -c /dev/ttyUSB0 < hart_commands.txt
You can even use the autocall-feature.
HART-Monitor
The HartMonitor
enables you to debug HART communications. It can be run within
a python script or via command line.
The HartMonitor
support two types
of decoders. One is used in the underlying
HartApplicationLayer
to decode
frames in the first decoding phase. This is called the decoder_generator
.
To be able to monitor multiple different devices with different device
specific commands it is possible to do a second step decoding with the
protocol_factory
.
This is a factory method that returns a device specific HART-frame by device address.
- class htf.hart.monitor.HartMonitor(comport: str | None = None, decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None, protocol_factory: Callable[[...], Type[HartFrame]] | None = None, interactive: bool = False, argv: List[str] | None = None)
A HART Monitor that can be used interactively.
- Parameters:
comport – the comport to be used where the HART modem is connected to.
decoder_generator=None – a callable that returns a HartFrame instance with or without device specific commands that is used to decode all frames (if
protocol_factory
isNone
).protocol_factory=None – a protocol factory that returns a device specific HART frame parser with respect to the supplied device address. For every received frame the frame is decoded using the
decoder_generator
that may beNone
and after that a device specific decoder is created respecting the device address.interactive=True – if set to
True
the HART Monitor becomes interactiveargv=None – used for testing, etc.
- handle_exception(frame: HartFrame | None, exc: BaseException) None
The exception handler that prints the formatted output. This method can be overwritten.
This overwritten method may or may not call
raise
at the end to raise the exception again.- Parameters:
frame – the HART frame to be monitored.
exc – the exception that can be formatted.
- handle_frame(frame: HartFrame) None
The frame handler that prints the formatted output. This method can be overwritten.
- Parameters:
frame – the HART frame to be monitored.
- run(frame_count: int = 0) None
Run the monitor and display received HART frames.
- Parameters:
frame_count – The number of frames to be received.
0
means forever.
Command line usage
htf
comes with a HART-Monitor command line utility called hart-monitor
.
To start it enter
$ hart-monitor -c <comport>
Show help
$ hart-monitor -h
usage: hart-monitor [-h] -c COMPORT [-d Protocol database] [-V]
hart-monitor - HILSTER Testing Framework (HILSTER GmbH, http://hilster.io)
optional arguments:
-h, --help show this help message and exit
-c COMPORT, --comport COMPORT
comport for HART communication
-d Protocol database, --database Protocol database
An import string to the protocol database where device
specific HART frames can be found. See docs for
details.
-V, --version Show version and exit
Setting the protocol factory
To use the protocol factory created for your device enter:
hart-monitor -c /dev/ttyUSB0 -d protocol_factory.get_hart_frame_by_device_type
hart-monitor
needs a protocol factory that created a HART-frame by
device type.
In the example protocol_factory
is an importable python file and
get_hart_frame_by_device_type
is a method within it.
Customizing the HART-Monitor
If a different output format is needed etc. the class
HartMonitor
can be subclassed
and handle_frame
can be
overwritten.
In the following example every received frame is serializied to be printed on a single line with a timestamp.
from htf.hart.monitor import HartMonitor
import datetime
class MyHartMonitor(HartMonitor):
def handle_frame(self, frame):
frame_type = frame.delimiter.frame_type.get()
direction = " ->"
if frame_type == "ack":
direction = "<- "
command = frame.command.get()
byte_count = frame.byte_count.get()
address = frame.address.address.get()
payload = str(frame.payload).replace("\n", "").replace(" ", ", ")
print(str(datetime.datetime.utcnow()) +
": " + "%s %3i %s 0x%010x %3i (%s)" %
(frame_type.upper(),
command,
direction,
address,
byte_count,
payload))
if __name__ == "__main__":
hm = MyHartMonitor(comport="COM46")
hm.run(n=0)
HART Device Communication
The
HartDeviceCommunication
simplifies the communication with a HART device.
It can be either used as an instance or as a context block and helps to find a device and to query commands on that device.
- class htf.hart.device_communication.HartDeviceCommunication(comport: str, polling_addresses: List[int] = [0], device_address: int | None = None, decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None)
A communication to a HART device usable as a context block.
- Parameters:
comport – the comport to be used where the HART modem is connected to.
polling_addresses=[0] – the polling addresses used to find a HART device.
device_address=None – the initial HART device address. If set to an interger no device must be looked up.
decoder_generator=None – a callable that returns a HartFrame instance with or without device specific commands.
- close() None
Close the HART application layer and close the HART interface supplied. Is called in __del__, too.
- find_device(polling_addresses: List[int] | None = None) int
Find the first HART device by polling all addresses stated in
polling_addresses
and use the first device found.If no device is found an
AssertionError
is raised.- Parameters:
polling_addresses=[0] – the polling addresses used to find a HART device.
- Returns:
Unique HART address of the first device found in polling.
- Return type:
- query(request: HartFrame, number_of_preambles: int = 5, preamble: bytes = b'\xff', timeout: int | float = 1.0) HartFrame | None
Query a HART command. The HART frame is encoded automatically.
- Parameters:
request – the hart frame to be sent.
number_of_preambles=5 – the number of preambles.
preamble='ÿ' –
number_of_preambles
timespreamble
is sent before the frame content is sent.timeout=1.0 – the timeout in seconds.
- Returns:
if no frame was received
None
is returned.- Return type:
HartFrame or None
In the following examples Command 1
is queried on the first found device.
Usage with an instance:
from htf.hart import HartDeviceCommunication
from htf.hart.protocol import HartFrame
dc = HartDeviceCommunication(comport="/dev/ttyUSB1")
dc.find_device()
82527125539
cmd1_request = HartFrame(command=1)
cmd1_response = dc.query(cmd1_request)
print(cmd1_response)
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 82527125539 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'buffer_overflow' (UBInt8)
field_device_status: non-primary_variable_out_of_limits (FieldDeviceStatus)
units: 123 (UBInt8)
primary_variable: 456.78900146484375 (BFloat)
check_byte: 193 (CheckByte)
dc.close()
If a device_address
is supplied
find_device
needs not to be called.
When used as a context block and no device_address
is supplied
find_device
is called automatically.
When the context block is left the underlying HART interface and Application
Layer are closed automatically.
Example usage with a context block:
from htf.hart import HartDeviceCommunication
from htf.hart.protocol import HartFrame
with HartDeviceCommunication(comport="/dev/ttyUSB1") as dc:
dc.find_device()
cmd1_request = HartFrame(command=1)
cmd1_response = dc.query(cmd1_request)
print(cmd1_response)
82527125539
HartFrame():
delimiter: Delimiter():
address_type: 'unique' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'ack' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 82527125539 (BitField(38))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 7 (UBInt8)
payload: Command1_ReadPrimaryVariableResponse():
response_code: 'buffer_overflow' (UBInt8)
field_device_status: non-primary_variable_out_of_limits (FieldDeviceStatus)
units: 123 (UBInt8)
primary_variable: 456.78900146484375 (BFloat)
check_byte: 193 (CheckByte)
HART Fuzzing
The HART Testing Framework lets you easily run fuzzing tests on your HART device since it is based on OSER. You should have read the OSER documentation.
In the first example all HART frames shall have a valid checkbyte at the end.
All commands from 0
to 255
shall be sent to the target. The payload is
the default.
from htf.hart import HartFrame
import oser
h = HartFrame(0)
h.command.set_fuzzing_values(range(256))
for frame in h.fuzzing_iterator():
encoded = frame.encode() # update checkbyte
print(frame)
print(oser.to_hex(encoded))
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command0_ReadUniqueIdentifierRequest():
check_byte: 130 (CheckByte)
0| 1| 2| 3| 4
\x02\x80\x00\x00\x82
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 1 (UBInt8)
byte_count: 0 (UBInt8)
payload: Command1_ReadPrimaryVariableRequest():
check_byte: 131 (CheckByte)
# [%< %< %< %< %< %< %< %< %< %<]
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23
\x02\x80\xfd\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6c
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 254 (UBInt8)
byte_count: 19 (UBInt8)
payload: b''
check_byte: 111 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23
\x02\x80\xfe\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 255 (UBInt8)
byte_count: 19 (UBInt8)
payload: b''
check_byte: 110 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23
\x02\x80\xff\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6e
In the second example the whole payload is random with a random length. All frames have a valid length field and a valid checkbyte.
from htf.hart import HartFrame
import oser
import string
h = HartFrame(0)
_random_length_iterator = oser.RandomIntegerFuzzingValue(a=0, b=40, count=1)
h.payload = oser.String(length=lambda self: next(_random_length_iterator()))
h.payload.set_fuzzing_values(
oser.RandomBytesFuzzingValue(length=40, count=5)
)
for frame in h.fuzzing_iterator():
encoded = frame.encode() # update checkbyte
print(frame)
print(oser.to_hex(encoded))
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 28 (UBInt8)
payload: b'\x8c\xdd\x0b]\x0cd\xf9\xde\x1a1fo\xea{@n\x82\x94dG \xf3\x9e\xbb`\x06\x83`\xe5L\xa7\xdb?q*?\xbeW\x08\x8c'
check_byte: 150 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38
\x02\x80\x00\x1c\x8c\xdd\x0b\x5d\x0c\x64\xf9\xde\x1a\x31\x66\x6f\xea\x7b\x40\x6e\x82\x94\x64\x47\x20\xf3\x9e\xbb\x60\x06\x83\x60\xe5\x4c\xa7\xdb\x3f\x71\x96
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 34 (UBInt8)
payload: b'\xc4OHo\x17\xcb\xaf\xf5\x9b\xd0[N\x88n\x9b\x013\xa4z\xf2\\\x15\xa8\xcb\xd9;2\x15\x10H\x7fC\xf3\xbd~\xf2&>\xab$'
check_byte: 235 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25
\x02\x80\x00\x22\xc4\x4f\x48\x6f\x17\xcb\xaf\xf5\x9b\xd0\x5b\x4e\x88\x6e\x9b\x01\x33\xa4\x7a\xf2\x5c\xeb
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 24 (UBInt8)
payload: b'w]w_\xeb\x1b\x9f\xad\t\xcd\x9ei\xf7te\x17\x0c\x96\x9e\xe0/\x9f\x1cR\xd7\xeb\x87\x9f\xfc\x1aC^q\xed/\x085\xfc\xaf6'
check_byte: 182 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44
\x02\x80\x00\x18\x77\x5d\x77\x5f\xeb\x1b\x9f\xad\x09\xcd\x9e\x69\xf7\x74\x65\x17\x0c\x96\x9e\xe0\x2f\x9f\x1c\x52\xd7\xeb\x87\x9f\xfc\x1a\x43\x5e\x71\xed\x2f\x08\x35\xfc\xaf\x36\xb6
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 25 (UBInt8)
payload: b'\x9e\x8dR\xebO\xb8\xa3\xe8\x0b|c\x02,>GpFD4\xdc\xed\xe9,\xa6\xbd\x1f\xa2;`\xd3\xb5\x83Nv\xe7\x8a\xcc\xd7\xbeW'
check_byte: 225 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32
\x02\x80\x00\x19\x9e\x8d\x52\xeb\x4f\xb8\xa3\xe8\x0b\x7c\x63\x02\x2c\x3e\x47\x70\x46\x44\x34\xdc\xed\xe9\x2c\xa6\xbd\x1f\xa2\x3b\xe1
HartFrame():
delimiter: Delimiter():
address_type: 'polling' (Flag)
number_of_expansion_bytes: 0 (BitField(2))
physical_layer_type: 'asynchronous' (BitField(2))
frame_type: 'stx' (BitField(3))
address: Address():
master_address: 'primary_master' (Flag)
burst_mode: 0 (Flag)
address: 0 (BitField(6))
expansion_bytes: Array():
[
]
command: 0 (UBInt8)
byte_count: 32 (UBInt8)
payload: b"\x1c`]\xbain'\x8dq\xcb\x0fw\xa3\x9b\x89\xb8T\xe4&\x08\x90{\xfa\x9f\x08\xb2\xbe\xd5\xec\x12\xe7\xf2b&\x943Yc\xd0I"
check_byte: 165 (CheckByte)
0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39
\x02\x80\x00\x20\x1c\x60\x5d\xba\x69\x6e\x27\x8d\x71\xcb\x0f\x77\xa3\x9b\x89\xb8\x54\xe4\x26\x08\x90\x7b\xfa\x9f\x08\xb2\xbe\xd5\xec\x12\xe7\xf2\x62\x26\x94\xa5
HART Slave Simulator
The HartSlaveSimulator
allows simulation of HART slaves by sub-classing the HartSlaveSimulator
.
- class htf.hart.slave_simulator.HartSlaveSimulator(comport: str, decoder_generator: Type[HartFrame] | Callable[[...], HartFrame] | None = None, polling_address: int = 0, device_type: int = 0, device_id: int = 0)
-
- handle_command0(frame: HartFrame) HartFrame | None
Handler for command 0 HART requests. Checks if the polling address in the frame matches the one set in the simulator.
- Parameters:
frame – the command 0 HART request
- Returns:
the response containing device type, device id and protocol revision
- Return type:
- handle_default(frame: HartFrame) None
Default handler for HART requests that don’t have a specialized handler.
- Parameters:
frame – the HART frame to handle
- handle_exception(exc: BaseException) None
The exception handler that prints the raised exception.
- Parameters:
exc – the exception that was raised.
- handle_frame(frame: HartFrame) None
Checks that the device address matches and whether responses to the HART command are disabled. Calls possible frame callbacks and sends a HART response frame if there is one.
- Parameters:
frame – the HART frame to handle
- register_frame_callback(callback: Callable[[float, HartFrame], None]) None
Registers a callback for every HART request and response that is received or send out. Callbacks are called with two arguments: a timestamp and the HART frame.
- Parameters:
callback – callback for HART frames
- run(frame_count: int = 0) None
Run the HART device simulator
- Parameters:
frame_count – The number of frames to handle.
0
means forever.
- run_while(condition: bool | Callable[[...], bool]) None
Simulate while the condition is
True
.- Parameters:
condition – the condition for the run.
If you’d like to add other handlers for different commands simply add
a handler method that fits the name convention handle_command<cmd>
where <cmd>
is the desired command number.
from htf.hart.slave_simulator import HartSlaveSimulator
from htf.hart import HartFrame, ResponseCode, FieldDeviceStatus
import oser
# Command abstractions
class Command123_ReadValueRequest(oser.ByteStruct):
def __init__(self):
super(Command123_ReadValue, self).__init__()
self.double_value = oser.Flag(False)
class Command123_ReadValueResponse(oser.ByteStruct):
def __init__(self):
super(Command123_ReadValue, self).__init__()
self.response_code = ResponseCode()
self.field_device_status = FieldDeviceStatus()
self.value = oser.UBInt8()
# Decoder generator extending the default HART frame implementation
class MyHartDeviceFrame(HartFrame):
def requests_generator(self):
for command, parser in super(MyHartDeviceFrame, self).requests_generator():
yield command, parser
yield 123, oser.Lazy(Command123_ReadValueRequest)
def responses_generator(self):
for command, parser in super(MyHartDeviceFrame, self).responses_generator():
yield command, parser
yield 123, oser.Lazy(Command123_ReadValueResponse)
# Slave simulator with the extended HART frame (MyHartDeviceFrame)
class MyHartDevice(HartSlaveSimulator):
# Initialization of the device attributes
def __init__(self, comport):
super(MyHartDevice, self).__init__(comport, decoder_generator=MyHartDeviceFrame,
polling_address=0, device_type=0x1337,
device_id=0x23)
self.value = 321
# Implementation of the response behavior
def handle_command123(self, request):
response = self._create_response(request)
if request.payload.double_value.get():
response.payload.value.set(self.value * 2)
else:
response.payload.value.set(self.value)
return response
if __name__ == "__main__":
sim = MyHartDevice("COM1")
sim.run(10)
Changelog
htf-hart-3.1.5
add support for Python 3.13
htf-hart-3.1.4
add requirements for validation purposes
htf-hart-3.1.3
add build environment data for validation purposes
htf-hart-3.1.2
htf-hart
can now be used standalone
htf-hart-3.1.1
add support for Python 3.12
htf-hart-3.1.0
add type-hints
use
hlm-3.1
use
oser-3.1
htf-hart-3.0.1
add support for Python 3.11
htf-hart-3.0.0
extract
htf-hart
fromhtf