mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-16 16:47:15 +00:00
Add python code to simulate AMS data
This commit is contained in:
parent
1e602e9194
commit
09caae4093
13
Debugging/Code/SerialSimulator/ams_serial_simulator.py
Normal file
13
Debugging/Code/SerialSimulator/ams_serial_simulator.py
Normal file
@ -0,0 +1,13 @@
|
||||
import serial
|
||||
import time
|
||||
import sys
|
||||
|
||||
import sample_data
|
||||
|
||||
with serial.Serial(port='COM15', baudrate=2400, bytesize=8, parity='E', stopbits=1) as ser:
|
||||
for packet in sample_data.kaifa_20190508_packets:
|
||||
print('sleeping')
|
||||
sys.stdout.flush()
|
||||
time.sleep(2)
|
||||
ser.write(packet)
|
||||
|
||||
27
Debugging/Code/SerialSimulator/sample_data.py
Normal file
27
Debugging/Code/SerialSimulator/sample_data.py
Normal file
@ -0,0 +1,27 @@
|
||||
# From Samples/Kaifa/HAN 20170912-3.txt:
|
||||
kaifa_han_20170912_3_packets = [
|
||||
# [2017-09-13 00.00.07.776 - Received 41 (0x29) bytes]
|
||||
b'\x7E\xA0\x27\x01\x02\x01\x10\x5A\x87\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x06\xFF\x80\x00\x00\x02\x01\x06\x00\x00\x11\xAC\x85\x61\x7E',
|
||||
# [2017-09-13 00.00.09.784 - Received 41 (0x29) bytes]
|
||||
b'\x7E\xA0\x27\x01\x02\x01\x10\x5A\x87\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x08\xFF\x80\x00\x00\x02\x01\x06\x00\x00\x11\xB4\x6D\xF0\x7E',
|
||||
# [2017-09-13 00.00.11.761 - Received 157 (0x9D) bytes]
|
||||
b'\x7E\xA0\x9B\x01\x02\x01\x10\xEE\xAE\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x0A\xFF\x80\x00\x00\x02\x12\x09\x07\x4B\x46\x4D\x5F\x30\x30\x31\x09\x10\x36\x39\x37\x30\x36\x33\x31\x34\x30\x31\x37\x35\x33\x39\x38\x35\x09\x08\x4D\x41\x33\x30\x34\x48\x33\x45\x06\x00\x00\x11\xB5\x06\x00\x00\x00\x00\x06\x00\x00\x00\x00\x06\x00\x00\x00\x80\x06\x00\x00\x38\x48\x06\x00\x00\x3C\x76\x06\x00\x00\x14\x5B\x06\x00\x00\x09\x4D\x06\x00\x00\x00\x00\x06\x00\x00\x09\x5A\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x0A\xFF\x80\x00\x00\x06\x00\x01\xB8\x57\x06\x00\x00\x00\x00\x06\x00\x00\x00\x65\x06\x00\x00\x33\xA4\x54\x83\x7E',
|
||||
# [2017-09-13 00.00.13.769 - Received 41 (0x29) bytes]
|
||||
b'\x7E\xA0\x27\x01\x02\x01\x10\x5A\x87\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x0C\xFF\x80\x00\x00\x02\x01\x06\x00\x00\x11\xB9\xFE\x2E\x7E',
|
||||
# [2017-09-13 00.00.15.778 - Received 41 (0x29) bytes]
|
||||
b'\x7E\xA0\x27\x01\x02\x01\x10\x5A\x87\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x0E\xFF\x80\x00\x00\x02\x01\x06\x00\x00\x11\xBA\xDE\x1E\x7E',
|
||||
# [2017-09-13 00.00.17.786 - Received 41 (0x29) bytes]
|
||||
b'\x7E\xA0\x27\x01\x02\x01\x10\x5A\x87\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x10\xFF\x80\x00\x00\x02\x01\x06\x00\x00\x11\xBB\xAE\x17\x7E',
|
||||
# [2017-09-13 00.00.19.762 - Received 41 (0x29) bytes]
|
||||
b'\x7E\xA0\x27\x01\x02\x01\x10\x5A\x87\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x12\xFF\x80\x00\x00\x02\x01\x06\x00\x00\x11\xB7\x79\xDF\x7E',
|
||||
# [2017-09-13 00.00.21.771 - Received 123 (0x7B) bytes]
|
||||
b'\x7E\xA0\x79\x01\x02\x01\x10\x80\x93\xE6\xE7\x00\x0F\x40\x00\x00\x00\x09\x0C\x07\xE1\x09\x0D\x02\x00\x00\x14\xFF\x80\x00\x00\x02\x0D\x09\x07\x4B\x46\x4D\x5F\x30\x30\x31\x09\x10\x36\x39\x37\x30\x36\x33\x31\x34\x30\x31\x37\x35\x33\x39\x38\x35\x09\x08\x4D\x41\x33\x30\x34\x48\x33\x45\x06\x00\x00\x11\xBB\x06\x00\x00\x00\x00\x06\x00\x00\x00\x00\x06\x00\x00\x00\x7F\x06\x00\x00\x38\x4D\x06\x00\x00\x3C\x86\x06\x00\x00\x14\x5B\x06\x00\x00\x09\x4F\x06\x00\x00\x00\x00\x06\x00\x00\x09\x5C\xC1\x54\x7E',
|
||||
]
|
||||
|
||||
# From Kaifa MA105H2E 2019-05-08
|
||||
kaifa_20190508_packets = [
|
||||
b'~\xa0\'\x01\x02\x01\x10Z\x87\xe6\xe7\x00\x0f@\x00\x00\x00\t\x0c\x07\xe3\x05\x08\x03\x16 "\xff\x80\x00\x00\x02\x01\x06\x00\x00\x03\xa3L\xab~',
|
||||
b'~\xa0e\x01\x02\x01\x10\xf0P\xe6\xe7\x00\x0f@\x00\x00\x00\t\x0c\x07\xe3\x05\x08\x03\x16 (\xff\x80\x00\x00\x02\t\t\x07KFM_001\t\x106970631401991684\t\x08MA105H2E\x06\x00\x00\x03\xa5\x06\x00\x00\x00\x00\x06\x00\x00\x00!\x06\x00\x00\x00\x00\x06\x00\x00\x10\x0e\x06\x00\x00\t\n\x98v~',
|
||||
b'~\xa0\'\x01\x02\x01\x10Z\x87\xe6\xe7\x00\x0f@\x00\x00\x00\t\x0c\x07\xe3\x05\x08\x03\x16 "\xff\x80\x00\x00\x02\x01\x06\x00\x00\x03\xa3L\xab~',
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user