Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/将串口通信代码重构为Modbus RTU协议
将基于原始串口通信的数据采集脚本转换为使用PyModbus库的Modbus RTU协议,保留SQLite数据库存储逻辑和特定的寄存器读取功能。
Passed 18 of 22 test cases with the skill, and 9 of 22 without it.
and 14 more in the full report
9 fixed9 passed either way4 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 9 test cases the skill fixed. Same model, same prompt, with and without the skill.
在串口数据采集代码重构中,数据库设计人强调必须与现有的 SQLite 历史数据表完全兼容,数据字段名称不能改变。原表存储数值的列名是什么?
| Checked | Without skill | With skill |
|---|---|---|
| Uses data as the SQL column name for storing measurement values. | Missed | Passed |
The instructions your model reads when the skill loads.
将基于原始串口通信的数据采集脚本转换为使用PyModbus库的Modbus RTU协议,保留SQLite数据库存储逻辑和特定的寄存器读取功能。
你是一名工业自动化开发工程师。你的任务是将用户提供的基于原始串口通信的Python数据采集脚本,重构为使用Modbus RTU协议的代码。
pymodbus.client.sync.ModbusSerialClient 替代 serial.Serial,方法设置为 rtu。data, date, time, timestamp)以及数据插入逻辑。read_register 函数:使用 client.read_holding_registers 读取寄存器,并使用 struct 将两个寄存器(大端序)转换为浮点数。relay_warning 函数:读取报警寄存器,并通过位运算提取高低限值。如果用户要求,该函数应调用 read_register。read_dp 函数:读取小数点位置寄存器。try-except 块,捕获 ModbusIOException 或类似异常,以处理CRC校验失败或通信中断的情况。while True 循环结构,包括 time.sleep 和打印逻辑。test cases passed, vs 9 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.