Compare commits
7 Commits
2d12c160b9
...
edafd91567
Author | SHA1 | Date | |
---|---|---|---|
edafd91567 | |||
03b15751c2 | |||
29bd4185c4 | |||
97071d231f | |||
62e5e6ab50 | |||
8f342832b2 | |||
addb123a8a |
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,10 +7,8 @@ aio/venv
|
||||
aio/__pycache__/
|
||||
aio/code/automatic_test/__pycache__/
|
||||
aio/code/data_process/__pycache__/
|
||||
aio/assets/templates/c_msg.log*
|
||||
aio/code/durable_action/__pycache__/
|
||||
aio/assets/templates/durable/
|
||||
aio/assets/templates/.__c_msg.lock
|
||||
aio/code/commons/__pycache__/
|
||||
aio/assets/templates/debug.log
|
||||
aio/assets/templates/logs/
|
||||
dial_gauge/results.xlsx
|
||||
|
@ -34,7 +34,7 @@
|
||||
打包时,只需要修改 clibs.py 中的 PREFIX 即可,调试时再修改回来
|
||||
|
||||
```
|
||||
pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory . --upx-dir "D:/Syncthing/common/A_Program/upx-4.2.4-win64/" --add-data "C:/Users/Administrator/AppData/Local/Programs/Python/Python312/Lib/site-packages/customtkinter;customtkinter/" --add-data "D:/Syncthing/company/D-测试工作/X-自动化测试/01-AIO/rokae/aio/assets/templates:templates" --version-file ../assets/file_version_info.txt -i ../assets/icon.ico ../code/aio.py -p ../code/data_process/brake.py -p ../code/data_process/iso.py -p ../code/data_process/current.py -p ../code/data_process/wavelogger.py -p ../code/commons/openapi.py -p ../code/commons/clibs.py -p ../code/automatic_test/btn_functions.py -p ../code/automatic_test/do_current.py -p ../code/automatic_test/do_brake.py -p ../code/durable_action/factory_test.py
|
||||
pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory . --upx-dir "D:/Syncthing/common/A_Program/upx-4.2.4-win64/" --add-data "C:/Users/Administrator/AppData/Local/Programs/Python/Python312/Lib/site-packages/customtkinter;customtkinter/" --add-data "D:/Syncthing/company/D-测试工作/X-自动化测试/01-AIO/rokae/aio/assets/templates:templates" --version-file ../assets/file_version_info.txt -i ../assets/templates/icon.ico ../code/aio.py -p ../code/data_process/brake.py -p ../code/data_process/iso.py -p ../code/data_process/current.py -p ../code/data_process/wavelogger.py -p ../code/commons/openapi.py -p ../code/commons/clibs.py -p ../code/automatic_test/btn_functions.py -p ../code/automatic_test/do_current.py -p ../code/automatic_test/do_brake.py -p ../code/durable_action/factory_test.py
|
||||
```
|
||||
|
||||
---
|
||||
@ -146,6 +146,7 @@ pyinstaller --noconfirm --onedir --windowed --optimize 2 --contents-directory .
|
||||
10. 由于xCore系统问题,运行过程中可能会出现机器人宕机问题,如果遇到,可以手动重启控制柜,重新运行
|
||||
11. 务必正确填写configs.xlsx中的Target页面,A1单元格可以选择正负方向急停
|
||||
12. 工程文件可以手动重命名,按照机型存档,或者导出用于自动化测试
|
||||
13. 自动化测试前,需要将HMI程序速度设置为100%并同步至控制器,也即左下方速度滑条滑动至最大
|
||||
|
||||
#### 6) 电机电流自动化测试
|
||||
|
||||
@ -274,7 +275,7 @@ v0.1.5.1(2024/06/12)
|
||||
5. [requirements.txt] 新增必要库配置文件
|
||||
|
||||
v0.1.5.2(2024/06/13)
|
||||
1. [brake.py/aio.py]: 将sto修改为estop
|
||||
1. [brake.py/aio.py]: 将sto修改为estop
|
||||
2. [brake.py] 修改了速度计算逻辑,新版本的vel列数据遵循如下规则,av = vel * 180 / pi,根据av再计算speed
|
||||
3. [brake.py] 将threshold修改为常量50
|
||||
4. [brake.py] 提高了输出提示语的明确性,删除了不必要的省略号
|
||||
@ -448,18 +449,18 @@ v0.1.7.6(2024/07/04)
|
||||
3. [APIs: openapi.py]
|
||||
- 增加了modbus读取浮点数的功能
|
||||
- 优化了get_from_id的逻辑
|
||||
4. [autotest.xml]: 新增了scenario_time只写寄存器
|
||||
4. [autotest.xml]: 新增了scenario_time只写寄存器
|
||||
|
||||
v0.1.8.0(2024/07/04)
|
||||
1. [APIs: do_current.py]: 完成了堵转电流和惯量负载电机电流的采集和处理,至此,电机电流的自动化工作基本完成
|
||||
1. [APIs: do_current.py]: 完成了堵转电流和惯量负载电机电流的采集和处理,至此,电机电流的自动化工作基本完成
|
||||
|
||||
v0.1.8.1(2024/07/05)
|
||||
1. [APIs: do_brake.py]: 完成了制动性能测试框架的搭建,可以顺利执行完整的测试程序,但是未实现急停和数据处理
|
||||
2. [APIs: aio.py]: 修改了do_brake主函数的参数
|
||||
1. [APIs: do_brake.py]: 完成了制动性能测试框架的搭建,可以顺利执行完整的测试程序,但是未实现急停和数据处理
|
||||
2. [APIs: aio.py]: 修改了do_brake主函数的参数
|
||||
3. 增加工程文件target.zip
|
||||
|
||||
v0.1.8.2(2024/07/08)
|
||||
1. [APIs: do_brake.py]: 完成了制动性能测试逻辑,只不过制动信号传递生效延迟不可控,暂时pending
|
||||
1. [APIs: do_brake.py]: 完成了制动性能测试逻辑,只不过制动信号传递生效延迟不可控,暂时pending
|
||||
2. [APIs: do_current.py]: 修改曲线数据时序,主要是value data取反即可,解决了波形锯齿明细的问题
|
||||
3. [APIs: openapi.py]: modbus新增了触发急停信号的寄存器 stop0_signal,并重写了解除急停,socket新增了register.set_value协议
|
||||
|
||||
@ -590,8 +591,8 @@ v0.2.0.5(2024/07/31)
|
||||
- 保持电流,只取最后 15s
|
||||
- 优化 ssh 输入密码的部分
|
||||
6. [t_change_ui: all the part]: 引入 commons 包,并定制了 logging 输出,后续持续优化
|
||||
7. [APIs: btn_functions.py]: 重写了告警输出函数,从日志中拿数据
|
||||
8. [APIs: aio.py]: 将日志框输出的内容,也保存至日志文件
|
||||
7. [APIs: btn_functions.py]: 重写了告警输出函数,从日志中拿数据
|
||||
8. [APIs: aio.py]: 将日志框输出的内容,也保存至日志文件
|
||||
9. [APIs: do_brake.py]
|
||||
- 修改获取初始速度的逻辑,只获取configs文件中配置的时间内的速度
|
||||
- 新增 configs 参数 single_brake,可针对特定条件做测试
|
||||
@ -617,3 +618,10 @@ v0.2.0.7(2024/08/16)
|
||||
|
||||
|
||||
> 前两个修改点,修复的是网络提示的颜色不正确问题,因为日志将 textbox 中的内容也作为 debug 信息写入 hmi.log 了
|
||||
|
||||
v0.2.0.8(2024/08/20)
|
||||
1. [t_change_ui: clibs.py]
|
||||
- 从外部拷贝 icon.ico 文件到 templates 目录
|
||||
- 在 assets 目录新建 logs 目录,存放日志文件,并增加了相应的逻辑保证正常执行
|
||||
2. [t_change_ui: aio.py]:增加 App 窗口图标代码
|
||||
3. [t_change_ui: openapi.py]:将重复输出的网络错误提示,从 textbox 中转移到 debug.log 日志文件中
|
||||
|
@ -6,8 +6,8 @@ VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
||||
# Set not needed items to zero 0.
|
||||
filevers=(0, 2, 0, 5),
|
||||
prodvers=(0, 2, 0, 5),
|
||||
filevers=(0, 2, 0, 8),
|
||||
prodvers=(0, 2, 0, 8),
|
||||
# Contains a bitmask that specifies the valid bits 'flags'r
|
||||
mask=0x3f,
|
||||
# Contains a bitmask that specifies the Boolean attributes of the file.
|
||||
@ -31,12 +31,12 @@ VSVersionInfo(
|
||||
'040904b0',
|
||||
[StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'),
|
||||
StringStruct('FileDescription', 'All in one automatic toolbox'),
|
||||
StringStruct('FileVersion', '0.2.0.5 (2024-08-02)'),
|
||||
StringStruct('FileVersion', '0.2.0.8 (2024-08-20)'),
|
||||
StringStruct('InternalName', 'AIO.exe'),
|
||||
StringStruct('LegalCopyright', '© 2024-2024 Manford Fan'),
|
||||
StringStruct('OriginalFilename', 'AIO.exe'),
|
||||
StringStruct('ProductName', 'AIO'),
|
||||
StringStruct('ProductVersion', '0.2.0.5 (2024-08-02)')])
|
||||
StringStruct('ProductVersion', '0.2.0.8 (2024-08-20)')])
|
||||
]),
|
||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||
]
|
||||
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
@ -1 +1 @@
|
||||
0.2.0.5 @ 08/02/2024
|
||||
0.2.0.8 @ 08/20/2024
|
@ -70,14 +70,14 @@ class App(customtkinter.CTk):
|
||||
# =====================================================================
|
||||
# configure window
|
||||
self.title("AIO - All in one automatic toolbox")
|
||||
# self.iconbitmap('./icon.ico')
|
||||
self.wm_iconbitmap(clibs.app_icon)
|
||||
self.geometry("1200x550+30+30")
|
||||
self.protocol("WM_DELETE_WINDOW", self.func_end_callback)
|
||||
self.config(bg='#E9E9E9')
|
||||
self.rowconfigure(0, weight=1)
|
||||
self.rowconfigure(1, weight=19)
|
||||
self.columnconfigure(0, weight=1)
|
||||
self.columnconfigure(1, weight=19)
|
||||
self.grid_rowconfigure(0, weight=1)
|
||||
self.grid_rowconfigure(1, weight=19)
|
||||
self.grid_columnconfigure(0, weight=1)
|
||||
self.grid_columnconfigure(1, weight=19)
|
||||
self.minsize(1200, 550)
|
||||
# =====================================================================
|
||||
# 1. create frame sidebar(left)
|
||||
@ -96,7 +96,7 @@ class App(customtkinter.CTk):
|
||||
btns_func['log']['btn'].configure(command=lambda: self.thread_it(self.func_log_callback))
|
||||
btns_func['end']['btn'].configure(command=lambda: self.thread_it(self.func_end_callback))
|
||||
# 1.3 create version info
|
||||
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.2.0.5\nDate: 08/02/2024", font=self.my_font, text_color="#4F4F4F")
|
||||
self.label_version = customtkinter.CTkLabel(self.frame_func, justify='left', text="Vers: 0.2.0.8\nDate: 08/20/2024", font=self.my_font, text_color="#4F4F4F")
|
||||
self.frame_func.rowconfigure(6, weight=1)
|
||||
self.label_version.grid(row=6, column=0, padx=20, pady=20, sticky='s')
|
||||
# =====================================================================
|
||||
|
@ -1,4 +1,4 @@
|
||||
from os import scandir
|
||||
from os import scandir, mkdir
|
||||
from threading import Thread
|
||||
from time import sleep
|
||||
from os.path import exists
|
||||
@ -17,8 +17,10 @@ setdefaulttimeout(TIMEOUT)
|
||||
tab_names = {'dp': 'Data Process', 'at': 'Automatic Test', 'da': 'Duration Action', 'op': 'openapi'}
|
||||
# PREFIX = '' # for pyinstaller packaging
|
||||
PREFIX = '../assets/' # for source code debug
|
||||
log_data_hmi = f'{PREFIX}templates/c_msg.log'
|
||||
log_data_debug = f'{PREFIX}templates/debug.log'
|
||||
app_icon = f'{PREFIX}templates/icon.ico'
|
||||
log_path = f'{PREFIX}templates/logs/'
|
||||
log_data_hmi = f'{PREFIX}templates/logs/c_msg.log'
|
||||
log_data_debug = f'{PREFIX}templates/logs/debug.log'
|
||||
heartbeat = f'{PREFIX}templates/heartbeat'
|
||||
durable_data_current_xlsx = f'{PREFIX}templates/durable/durable_data_current.xlsx'
|
||||
durable_data_current_max_xlsx = f'{PREFIX}templates/durable/durable_data_current_max.xlsx'
|
||||
@ -41,6 +43,9 @@ durable_data_current_max = {
|
||||
'axis6': [0 for _ in range(18)],
|
||||
}
|
||||
|
||||
if not exists(log_path):
|
||||
mkdir(log_path)
|
||||
|
||||
# version:表示版本,该键值为从1开始的整数。该key必选,除此之外,其它key都是可选。
|
||||
# formatters:日志格式化器,其value值为一个字典,该字典的每个键值对都代表一个Formatter,键值对中,key代表Formatter ID(自定义ID),value为字典,描述如何配置相应的Formatter实例。默认格式为 ‘%(message)s’
|
||||
# filters:日志过滤器,其value值为一个字典,该字典的每个键值对都代表一个Filter,键值对中,key代表Filter ID(自定义ID),value为字典,描述如何配置相应的Filter实例。
|
||||
|
@ -203,7 +203,7 @@ class HmiRequest(object):
|
||||
self.c_xs.connect((clibs.ip_addr, 6666))
|
||||
self.c_xs.setblocking(False)
|
||||
|
||||
self.w2t("Connection success", 0, 0, 'green', tab_name=self.tab_name)
|
||||
logger.info("Connection success...")
|
||||
with open(clibs.heartbeat, "w", encoding='utf-8') as f_hb:
|
||||
f_hb.write('1')
|
||||
md = ModbusRequest(self.w2t)
|
||||
@ -213,7 +213,7 @@ class HmiRequest(object):
|
||||
md.write_probe(False)
|
||||
md.write_axis(1)
|
||||
except Exception as Err:
|
||||
self.w2t("Connection failed...", 0, 0, 'red', tab_name=self.tab_name)
|
||||
logger.info("Connection failed...")
|
||||
with open(clibs.heartbeat, "w", encoding='utf-8') as f_hb:
|
||||
f_hb.write('0')
|
||||
|
||||
@ -255,7 +255,7 @@ class HmiRequest(object):
|
||||
with open(clibs.heartbeat, "w", encoding='utf-8') as f_hb:
|
||||
f_hb.write(_flag)
|
||||
if _flag == '0':
|
||||
self.w2t(f"{_id} 心跳丢失,连接失败,重新连接中...", 0, 7, 'red', tab_name=self.tab_name)
|
||||
logger.info(f"{_id} 心跳丢失,连接失败,重新连接中...")
|
||||
sleep(2)
|
||||
|
||||
def msg_storage(self, response, flag=0):
|
||||
@ -539,14 +539,17 @@ class HmiRequest(object):
|
||||
sel.unregister(conn)
|
||||
conn.close()
|
||||
|
||||
sel = selectors.DefaultSelector()
|
||||
sel.register(sock, selectors.EVENT_READ, to_read)
|
||||
try:
|
||||
sel = selectors.DefaultSelector()
|
||||
sel.register(sock, selectors.EVENT_READ, to_read)
|
||||
|
||||
while self.t_bool:
|
||||
events = sel.select()
|
||||
for key, mask in events:
|
||||
callback = key.data
|
||||
callback(key.fileobj, mask)
|
||||
while self.t_bool:
|
||||
events = sel.select()
|
||||
for key, mask in events:
|
||||
callback = key.data
|
||||
callback(key.fileobj, mask)
|
||||
except Exception as Err:
|
||||
logger.warning(Err)
|
||||
|
||||
def unpackage_xs(self, sock):
|
||||
def to_read(conn, mask):
|
||||
@ -559,14 +562,17 @@ class HmiRequest(object):
|
||||
sel.unregister(conn)
|
||||
conn.close()
|
||||
|
||||
sel = selectors.DefaultSelector()
|
||||
sel.register(sock, selectors.EVENT_READ, to_read)
|
||||
try:
|
||||
sel = selectors.DefaultSelector()
|
||||
sel.register(sock, selectors.EVENT_READ, to_read)
|
||||
|
||||
while self.t_bool:
|
||||
events = sel.select()
|
||||
for key, mask in events:
|
||||
callback = key.data
|
||||
callback(key.fileobj, mask)
|
||||
while self.t_bool:
|
||||
events = sel.select()
|
||||
for key, mask in events:
|
||||
callback = key.data
|
||||
callback(key.fileobj, mask)
|
||||
except Exception as Err:
|
||||
logger.warning(Err)
|
||||
|
||||
def gen_id(self, command):
|
||||
_now = time()
|
||||
@ -615,7 +621,8 @@ class HmiRequest(object):
|
||||
self.c.send(self.package(cmd))
|
||||
sleep(0.5)
|
||||
except Exception as Err:
|
||||
self.w2t(f"{cmd}: 请求发送失败...{Err}", 0, 0, 'red', tab_name=self.tab_name)
|
||||
# self.w2t(f"{cmd}: 请求发送失败...{Err}", 0, 0, 'red', tab_name=self.tab_name)
|
||||
logger.info(f"{cmd}: 请求发送失败...{Err}")
|
||||
|
||||
return req['id']
|
||||
|
||||
|
@ -28,16 +28,16 @@ def initialization(path, sub, w2t):
|
||||
filename = data_file.split('\\')[-1]
|
||||
if data_file.endswith('configs.xlsx'):
|
||||
count += 1
|
||||
elif sub == 'cycle' and data_file.endswith('.xlsx'):
|
||||
elif sub == 'cycle' and data_file.endswith('T_电机电流.xlsx'):
|
||||
count += 1
|
||||
else:
|
||||
if not (match('j[1-7].*\\.data', filename) or match('j[1-7].*\\.csv', filename)):
|
||||
msg = f"不合规 {data_file}\n"
|
||||
msg += f"所有文件必须以 jx_ 开头,以 .data/csv 结尾(x取值1-7),请检查后重新运行。"
|
||||
msg += f"所有数据文件必须以 jx_ 开头,以 .data/csv 结尾(x取值1-7),配置文件需要命名为\"configs.xlsx\",结果文件需要命名为\"T_电机电流.xlsx\",请检查后重新运行。"
|
||||
w2t(msg, 0, 6, 'red')
|
||||
|
||||
if not ((sub == 'cycle' and count == 2) or (sub != 'cycle' and count == 1)):
|
||||
w2t("使用max/avg功能时,需要有配置文件表格;使用cycle功能时,需要有电机电流数据处理和配置文件两个表格,确认后重新运行!", 0, 5, 'red')
|
||||
w2t("使用max/avg功能时,需要有配置文件表格\"configs.xlsx\";使用cycle功能时,需要有电机电流数据处理\"T_电机电流.xlsx\"和配置文件\"configs.xlsx\"两个表格,确认后重新运行!", 0, 5, 'red')
|
||||
|
||||
return data_files
|
||||
|
||||
@ -186,7 +186,8 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
|
||||
else:
|
||||
return _row_s, _row_e
|
||||
else:
|
||||
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, exitcode, 'red')
|
||||
# w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, exitcode, 'red')
|
||||
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, 0, 'red')
|
||||
elif flag == 'gt':
|
||||
while _row_e > end_point:
|
||||
speed_avg = df.iloc[_row_s:_row_e, 0].abs().mean()
|
||||
@ -197,7 +198,8 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
|
||||
else:
|
||||
return _row_s, _row_e
|
||||
else:
|
||||
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red')
|
||||
# w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red')
|
||||
w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, 0, 'red')
|
||||
|
||||
|
||||
def p_single(wb, single, vel, trq, rpms, rrs, w2t):
|
||||
|
Reference in New Issue
Block a user