18
OPERATION MANUAL
change_to:
Changes the command/value pair given and ensures that set correctly
1st parameter is the command to be sent (send and check if really set)
2nd parameter is the value to be set
lai.change_to("I", slave_address)
request_echo:
Sends a request command and waits for the answer from the remote.
As argument the command string must be given.
string = lai.request_echo("L", "********")
more complete Example:
----------------------
from softcheck.logic import Com
from softcheck.logic import CommunicationTimeout
from softcheck.lai_commands import LaiCom
com = Com("serial", 2.5, 3)
com.open(0, 9600) #open COM1 with 9600 (address not defined)
lai = LaiCom(com, 1)
lai.send("V")
lai.check("Pilot ONE-Trainee V1.0")
lai.send("G", "C0****")
# O: off, 0: no Alarm, tttt: setpoint, iiii: internal temp., dddd: external temp.
lai.check_regex(r"[OC]0[0-9A-F]{4}[0-9A-F]{4}[0-9A-F]{4}")
string = lai.get_last_value()
setpoint = 2000
lai.check_hex(string[2:6], setpoint)
min_int_temp = 200 # 2°C
max_int_temp = 5000 # 50°C
min_ext_temp = 500 # 5°C
max_ext_temp = 6000 # 60°C
lai.check_hex_range(string[6:10], min_int_temp, max_int_temp)
lai.check_hex_range(string[10:14], min_ext_temp, max_ext_temp)
time.sleep(1)
lai.send("G", "O0****")
lai.check_regex(r"[OC]0[0-9A-F]{4}[0-9A-F]{4}[0-9A-F]{4}")
com.close()
5.5
MbCom object (Modbus commands)
Namespace: from softcheck.mb_commands import MbCom
To construct a new MbCom class - which is used for communication with Modbus commands
with the device - the following arguments are needed:
The 1st parameter must be a configured Com object.
As 2nd parameter the protocol mode can be given. Only "tcp" is supported.
As 3rd parameter the the verbosity level can be given. "1" means that the program ex-
plains what goes wrong in case of an error. "2" means that the sent and received
strings will be printed and "3" prints the time information for each command also.
4th parameter: When set to True (default), the program throws an exception in case of
an error, otherwise the program goes on.
Example: mb = MbCom(com, "tcp")
request:
sends the MbTCPCommand object as a bytearray
Example: mb.request(MbTCPCommand(bytearray([0x41]), 0xFF)
requst_echo:
sends the MbTCPCommand object as a byte array and waits for the received MbTCPCommand
Example: recv_obj = mb.request_echo(MbTCPCommand(bytearray([0x41]), 0xFF))
check:
checks if two MbTCPCommand objects are equal
send_obj = MbTCPCommand(bytearray([0x41]), 0xFF)
recv_obj = MbTCPCommand(bytearray([0x41]), 0xFF)
Example: ret = mb.check(send_obj, recv_obj)
pySoftcheck
Liability for errors and misprints excluded.
pySoftcheck.01.20171002.2
Summary of Contents for Pilot ONE
Page 1: ...Operation Manual ...
Page 2: ......