diff --git a/Doc/SVN 内网与外网访问切换.txt b/Doc/SVN 内网与外网访问切换.txt new file mode 100644 index 0000000..4aecfcd --- /dev/null +++ b/Doc/SVN 内网与外网访问切换.txt @@ -0,0 +1,18 @@ +SVN地址重定义一下, 方便远程访问 + +右键对应的目录, 选择TortoiseSVN->Relocate... + +https://zhizhancreate:8443/svn/MenuPython 改成 http://zhizhancreate:8443/svn/MenuPython +公司内部使用(需要重新输入用户名与密码) + + +https://zhizhancreate:8443/svn/MenuPython 改成 http://24a9e25d.r28.cpolar.top/svn/MenuPython +外网使用(需要重新输入用户名与密码) + +其中 http://24a9e25d.r28.cpolar.top 每隔不定时间 可能会发送变化, + +linux 端软件无法解析win下域名,故直接使用 (QT界面单用) http://192.168.1.229:8443/svn/MenuPython_QT + + + + diff --git a/Doc/statusTip状态描述.txt b/Doc/statusTip状态描述.txt new file mode 100644 index 0000000..58c6686 --- /dev/null +++ b/Doc/statusTip状态描述.txt @@ -0,0 +1,47 @@ +statusTip()属性描述, 多个属性之间用','分隔 + +现在每个控件可以设置缺省styleSheet, 选中后可以独立处理, 解除选中后可恢复缺省值 + +password (QLineEdit, 所有交互控件) 使得属性在编辑前会经过密码提示 + +circuit=%d (QPushButton, QLabel, QLineEdit, 所有容器) 指定本对象属于哪一个回路, 如果本对象未指定回路, 本对象会继承父节点的回路, 直到最顶层父节点 + +main=%d (QPushButton, QLabel, QLineEdit, 所有容器) 指定本对象的主索引, 主索引为%d指定的值, 如果本对象未指定主索引, 本对象会继承父节点的主索引, 直到最顶层父节点 + +Alias=%s (QLabel, QLineEdit) 指定本对象需要采用别名方式显示或修改, %s为别名字符串 + +Format=%s (QQLabel, QLineEdit) 用来指定被对象刷新时的数据格式, 小数位数, 与菜单配置的Format相同格式 + %s=%05.2f 显示5位字符, 2位小数 + +Caption=%s (QLabel, QLineEdit) 参数修改时显示的描述信息%s + +Timeout=%d (QLabel, QLineEdit) 指定本对象(%d)ms时间未刷新后, 页面显示Timeout + +page=%d (QMainWindow) 用来指定页面编号, 编号为%d指定, + +canvas%d=camera%d (QLabel) 用来指定QLabel的画布编号%d(前一个), 绑定到摄像头编号%d(后一个), 用于显示绑定的视频流 + +Index=%d (QLabel, QPushButton, QLineEdit) 表示该项可通过菜单选中并执行功能, 选中先后顺序按比较索引排序 (主索引 * 64 + %d)。 + +mqtt=Ia (QLabel, QPushButton, QLineEdit) 与菜单配置文件的Ia进行绑定, 或者statusTip的第一项不写mqtt=, 直接写Ia + +SetCircuit=0 (QLabel) 用来指定QLabel的画布编号%d(前一个), 绑定到摄像头编号%d(后一个), 用于显示绑定的视频流 + + +ImageBackGround=%s (QLabel, QPushButton) 背景图片装载 %s为图片文件名字 + +SelectImag=%s (QLabel, QPushButton, QLineEdit) 表示菜单项选中时, 显示%s指定的图片文件 +SelectIcon=%s (QPushButton) 表示按钮控件, 菜单项选中时, 显示%s指定的图标文件 +ImageValue=%s_%d.%s (QLabel, QPushButton) 第一个%s为文件名前导, 第二个%s为图片文件后缀, %d为显示值。 + 需要与mqtt绑定, 当mqtt传入对应的值后之后, 通过(通过%d)来选择不同图片文件 来显示闯入的值值 +例子 +mqtt=OnStatus, ImageValue=help_%d.png + 当OnStatus传入值为1时, 显示 help_1.png图片, 传入值为2时, 显示help_2.png图片, 用图片来代替数字显示 + +Action处理,目前支持以下几种预先定义的Action, 可通过'_'扩展与组合 + +Action=SetMain%d (QPushButton) 按下按键后, 页面选中对应主索引的第一项菜单 +Action=SetPage%d (QPushButton) 按下按键后, 页面切换到页面编号%d (其中页面编号通过page=%d提前指定) +Action=canvas%d_camera%d (QPushButton) 按下按键后, 把画布ID(第一个%d)与摄像头ID(第二个%d)进行绑定 +Action=Modify (QPushButton, QLineEdit, QLabel) 修改选中对象的参数, 必须包含(mqtt, Alias或Format之1), 与保护器参数绑定 +Action=CmdExecute (QPushButton, QLabel) 发出通讯命令 必须与(mqtt)共同使用 \ No newline at end of file diff --git a/NameConvert.py b/NameConvert.py new file mode 100644 index 0000000..6aa8305 --- /dev/null +++ b/NameConvert.py @@ -0,0 +1,174 @@ +from pypinyin import lazy_pinyin, Style + +#用于把常用中文翻译成英文变量名,越前优先级越高, 如果不在表里,用拼音首字母 +ProgramVariableNameList = [ + + ["延时", "Delay"], + ["保护", "Protect"], + ["设置", "Set"], + ["试验", "Test"], + ["测试", "Test"], + ["相位", "Phase"], + ["比值", "Percent"], + ["定值", "Value"], + ["压板", "BitValue"], + ["类型", "Type"], + ["模式", "Mode"], + + ["双风机", "SFJ"], + ["双磁力", "DCL"], + ["移变高压侧", "YBGY"], + ["组合馈电", "ZHKD"], + ["双高爆", "SGB"], + ["双照明", "DZM"], + ["馈电", "KD"], + ["高爆", "GB"], + ["移变", "YB"], + ["磁力", "CL"], + ["照明", "ZM"], + + ["互感器", "Sensor"], + ["不平衡", "Unbalance"], + ["总开关", "Top"], + ["分开关", "Bottom"], + ["电压", "Volt"], + ["电流", "Current"], + ["额定", "Rate"], + ["无功电量", "KVar"], + ["有功电量", "Kwh"], + ["有功功率", "PowS"], + ["无功功率", "PowU"], + ["功率", "Pow"], + ["有功", "S"], + ["无功", "U"], + ["系统", "System"], + ["校正", "Correct"], + ["版本", "Version"], + ["短路", "Short"], + ["过流", "OverCurrent"], + ["欠压", "VoltLow"], + ["过压", "VoltHigh"], + ["设备", "Device"], + ["编号", "ID"], + ["故障", "Alarm"], + ["查询", "Query"], + ["值", "Value"], + + ["测量", "Measure"], + ["检测", "Measure"], + ["平均", "Average"], + ["断相", "Break"], + ["闭锁", "Lock"], + ["解锁", "Delock"], + ["动作", "Action"], + ["开关", "Switch"], + ["无校验", "None"], + ["奇校验", "Odd"], + ["偶校验", "Even"], + ["地址", "Addr"], + ["波特率", "Baud"], + ["校验", "Parity"], + ["网关", "Gate"], + ["掩码", "Mask"], + ["工作", "Work"], + ["控制", "Control"], + ["触点", "InputMode"], + ["风电", "WindMotor"], + ["瓦斯", "Gas"], + ["维修", "Repair"], + ["日期", "Date"], + ["时间", "Time"], + ["累计", "Acc"], + ["数据", "Data"], + ["当前", "Cur"], + ["软件", "Soft"], + ["密码", "Password"], + ["零序", "ZeroSeq"], + ["负序", "NegSeq"], + ["反馈", "FeedBack"], + ["电阻", "Resistor"], + ["漏电", "Insulation"], + ["正反转", "FWD_RVS"], + ["定时限", "FixTime"], + ["反时限", "AntiTime"], + ["过负荷", "OverLoad"], + ["欠负荷", "UnderLoad"], + ["启动", "Start"], + ["停止", "Stop"], + ["以太网", "Eth"], + ["模块", "Module"], + ["型号", "Select"], + ["选择", "Select"], + ["欧姆", "R"], + ["欧", ""], + ["投入", "On"], + ["串联", "SeriesConn"], + ["通讯", "Comm"], + ["水位", "Water_Level"], + ["高", "High"], + ["低", "Low"], + + ["正常", "Normal"], + ["非常", "Very"], + ["极端", "Extreme"], + ["方向", "Direct"], + ["正", "Pos"], + ["负", "Neg"], + ["非", "Non"], + ["电量", "Electric"], + ["门槛", "Threshold"], + ["常数", "Const"], + ["配置", "Conf"], + ["次数", "Count"], + ["合闸", "ON"], + ["分闸", "OFF"], + ["1段", "1"], + ["2段", "2"], + ["3段", "3"], + ["一段", "1"], + ["二段", "2"], + ["三段", "3"], + ["一代", "V1"], + ["二代", "V2"], + ["关闭", "Disable"], + ["打开", "Enable"], + ["常开", "NormalOpen"], + ["常闭", "NormalClose"], + ["模拟", "Analog"], + ["继电器", "Relay"], + ["就地", "Local"], + ["程控", "Remote"], + ["无效", "Invalid"], + ["无", "None"], +] + +def get_variable_name(combine_name_str : str, convert_list : list = None) : + remain_name = combine_name_str + variable_name = "" + + if convert_list == None : + convert_list = ProgramVariableNameList + + for list_item in convert_list : + if list_item[0] in remain_name: + if variable_name != "" : + variable_name += "_" + variable_name = variable_name + list_item[1] + remain_name = remain_name.replace(list_item[0], "") + remain_name = remain_name.replace(" ", "") + remain_name = remain_name.replace("/", "") + remain_name = remain_name.replace("\\", "") + + remain_pinying = lazy_pinyin(remain_name, style=Style.FIRST_LETTER) + first_letter_pinying = "" + for each in remain_pinying : + first_letter_pinying += each.capitalize() + + if len(remain_pinying) > 0 : + if variable_name == "" : + variable_name = first_letter_pinying + else : + variable_name = variable_name + "_" + first_letter_pinying + + return variable_name + \ No newline at end of file diff --git a/PythonMenu_T03.py b/PythonMenu_T03.py new file mode 100644 index 0000000..b5df75d --- /dev/null +++ b/PythonMenu_T03.py @@ -0,0 +1,1383 @@ +import sys +import struct +import os +#import crcmod +#import menu_pump as menu +#import MenuDesc as menu +import menu_pump_ver_wolong as menu +#import menu_pump_hor_panda as menu +#import menu_mine as menu +import re +import time +import sys +import zlib +import menu_utils as utils +from device_conf import class_comm_device_config +from enum import Enum +from print_color import * +from NameConvert import get_variable_name +import pypinyin +from pypinyin import pinyin +from pypinyin import lazy_pinyin, Style +from datetime import datetime + +current_time = datetime.now() +print(current_time) + + +DEFAULT_EMPTY_STR = " " +DEFAULT_FORMAT_STR = "%5d" + +MENU_ITEM_NORMAL = 0 +MENU_ITEM_ALIAS = 1 +MENU_ITEM_SUB_MENU = 2 + +def DebugPrint(object) : + #print(object) + return + +#定义字典管理类: +class DictsManager(): + + def __init__(self) -> None: + #--Dict---------------------------------------------------------------------------------------------------------------------------- + #-全局别名字典- + self.MenuAliasDict = {} #字段字典 + self.MenuAliasIndex = 0 #字段字典索引 + + self.MenuCommDict = {} + self.MenuCommTable = [] + self.MenuCommTableIndex = 0 + + # 全局菜单项 + self.MenuItemList = [] + + self.config : class_comm_device_config= menu.comm_device_config + + self.encode_type = 'utf-8' + if hasattr(self.config, "is_gb2312") : + if self.config.is_gb2312() : + self.encode_type = 'gb2312' + + self.alias_table = self.config.get_alias_table() + self.menu_top = self.config.get_menu_top() + self.menu_description = self.config.get_menu_caption_info() + + self.MenuDescriptionTable = [] + + + self.comm_table, self.func_comm_table_trigger_check = self.config.get_comm_table() + + #-全局字符串字典- + self.MenuStringDict = {} #菜单字符串表 + self.MenuStringOffset = 0 #菜单字符串表索引 + + #-字段字典->Format,Unit,Action + self.MenuScaleFormatDict = {} #字段字典 + self.MenuScaleFormatIndex = 0 #字段字典索引 + self.MenuScaleFormatTable = [] + + self.MenuUnitDict = {} #字段字典 + self.MenuUnitIndex = 0 #字段字典索引 + + self.MenuActionDict = {} #字段字典 + self.MenuActionIndex = 0 #字段字典索引 + + #--Table--------------------------------------------------------------------------------- + #-根据MenuAliasDict字典创建的MenuAliasTable + #-别名表 + self.MenuAliasTable = [] #一级别名表 + self.MenuAliasTableIndex = 0 #一级表索引 + + self.MenuAliasTable2 = [] #二级别名表 + self.MenuAliasTable2Index = 0 #二级表索引 + + self.MenuLimitDict = {} + self.MenuLimitTable = [] + self.MenuLimitIndex = 0 + + self.MenuRegAddrDict = {} + self.MenuRegAddrTable = [] + self.MenuRegAddrIndex = 0 + + self.MenuSubMenuDict = {} + + #菜单表 + self.MenuMenuTable = [] #一级菜单表 + self.MenuMenuTableIndex = 0 + self.MenuMenuTable2 = [] #二级菜单表 + self.MenuMenuTable2Index = 0 + + self.MenuTopIndex = 0 + self.MenuProcessedList = [] #已经完成处理的菜单项,防止递归电压 + + #self.MenuJsonDict + + #--PackedTable--------------------------------------------------------------------------------- + #-全局字符串字典MenuStringDict打包后的字符表 + self.Packed_MenuStringTable = bytes() + + #-字典MenuUnitTable打包后的字符表 + self.Packed_MenuUnitTable = bytes() + + #-字典MenuScaleFormatTable打包后的字符表 + self.Packed_MenuScaleFormatTable = bytes() + + #-字典MenuActionTable打包后的字符表 + self.Packed_MenuActionTable = bytes() + + #-字典MenuLimitTable打包后的字符表 + self.Packed_MenuLimitTable = bytes() + + #-字典MenuCommTable打包后的字符表 + self.Packed_MenuCommTable = bytes() + + + #--Buf--------------------------------------------------------------------------------- + self.Packed_AliasBuf = bytes() + self.Packed_AliasBuf2 = bytes() + + self.Packed_MenuBuf = bytes() + self.Packed_MenuBuf2 = bytes() + + self.Packed_MenuDescription = bytes() + + #- + #字符串打包时设置的编码格式 + + pass + + #--内部API----------------------------------------------------------------------------------------------------------------------------- + #从列表中获取字典------------------ + def GetDict_Alias(self,alias_str): #从列表alias_table中,获取参数alias_str指定的字典 + for item in self.alias_table: #[1]遍历列表中的所有字典 + if alias_str in item.keys(): #[2]判断alias_str指定的字典是否存在 + return item #[3]字典存在,将其返回>,存储字典的字典 + return None #[4]列表遍历完毕后字典未找到,返回None + + #填充MenuStringDict--------------- + def AddKeyTo_MenuStringDict(self,info_str) : #填充:将字符串及其对应的序号填入 + if self.MenuStringOffset == 0: + self.MenuStringDict[DEFAULT_EMPTY_STR] = self.MenuStringOffset + self.MenuStringOffset += len(DEFAULT_EMPTY_STR.encode(self.encode_type)) + 1 + if info_str not in self.MenuStringDict.keys(): #首先判断要添加的info_str是否已经存在 + self.MenuStringDict[info_str] = self.MenuStringOffset #添加键值对儿: + self.MenuStringOffset += len(info_str.encode(self.encode_type)) + 1 #序号自增:字符串索引的长度+1 以0分割? + + #查询MenuStringDict--------------- + def GetOffsetFrom_MenuStringDict(self,info_str): #从中,查询info_str对应的偏移值 + offset = 0 + if info_str in self.MenuStringDict.keys(): #[1]首先判断要查询的info_str是否存在 + offset = self.MenuStringDict[info_str] #[2]返回字典中的记录:info_str对应的偏移值 + return offset + + def GetStringFromOffset(self, offset) : + my_list = (list(filter(lambda k1: self.MenuStringDict[k1] == offset, self.MenuStringDict))) + + if (len(my_list)== 1) : + return my_list[0] + return None + + def menu_get_str_key(self, str1, str2) : + return str1 + "," + str2 + + #填充MenuScaleFormatDict--------------- + def AddKeyTo_MenuScaleFormatDict(self, scale_str, format_str) : #填充:将字符串及其对应的序号填入 + str_key = self.menu_get_str_key(scale_str, format_str) + + if self.MenuScaleFormatIndex == 0 : + self.MenuScaleFormatDict[DEFAULT_EMPTY_STR] = self.MenuScaleFormatIndex + self.MenuScaleFormatTable.append([0, 0]) + self.MenuScaleFormatIndex += 1 #序号自增1 + + self.AddKeyTo_MenuStringDict(scale_str) #将字段值存储到 Menu_StringDict + self.AddKeyTo_MenuStringDict(format_str) #将字段值存储到 Menu_StringDict + if str_key not in self.MenuScaleFormatDict.keys(): #首先判断要添加的info_str是否已经存在了 + self.MenuScaleFormatDict[str_key] = self.MenuScaleFormatIndex #添加键值对儿: + scale_str_off = self.GetOffsetFrom_MenuStringDict(scale_str) + format_str_off = self.GetOffsetFrom_MenuStringDict(format_str) + self.MenuScaleFormatTable.append([scale_str_off, format_str_off]) + self.MenuScaleFormatIndex += 1 #序号自增1 + + + def Get_ScaleFormatTableIndex(self, scale, format) : + index = 0 + str_key = self.menu_get_str_key(scale, format) + if str_key in self.MenuScaleFormatDict.keys(): + index = self.MenuScaleFormatDict[str_key] + return index + + #填充MenuUnitDict----------------- + def AddKeyTo_MenuUnitDict(self,info_str) : #填充:将字符串及其对应的序号填入 + if self.MenuUnitIndex == 0 : + self.MenuUnitDict[DEFAULT_EMPTY_STR] = self.MenuUnitIndex + self.MenuUnitIndex += 1 + if info_str not in self.MenuUnitDict.keys(): #首先判断要添加的info_str是否已经添加了 + self.MenuUnitDict[info_str] = self.MenuUnitIndex #添加键值对儿: + self.MenuUnitIndex += 1 #序号自增1 + + def AddKeyTo_MenuAddrDict(self, reg_addr_str) : + if self.MenuRegAddrIndex == 0: + self.MenuRegAddrDict[DEFAULT_EMPTY_STR] = self.MenuRegAddrIndex + self.MenuRegAddrIndex += 1 + + if reg_addr_str not in self.MenuRegAddrDict.keys() : + self.MenuRegAddrDict[reg_addr_str] = self.MenuRegAddrIndex + self.MenuRegAddrIndex += 1 + + #填充MenuLimitDict----------------- + def AddKeyTo_LimitDict(self, min_str, max_str) : #填充:将字符串及其对应的序号填入 + if self.MenuLimitIndex == 0 : + self.MenuLimitIndex += 1 + self.MenuLimitTable.append([0, 0]) + + self.AddKeyTo_MenuStringDict(min_str) + self.AddKeyTo_MenuStringDict(max_str) + str_key = self.menu_get_str_key(min_str, max_str) + + if str_key not in self.MenuLimitDict.keys() : + self.MenuLimitDict[str_key] = self.MenuLimitIndex + min_str_off = self.GetOffsetFrom_MenuStringDict(min_str) + max_str_off = self.GetOffsetFrom_MenuStringDict(max_str) + self.MenuLimitTable.append([min_str_off, max_str_off]) + self.MenuLimitIndex += 1 + + def Get_LimitTableIndex(self, min_str, max_str) : + index = 0 + key_str = self.menu_get_str_key(min_str, max_str) + if key_str in self.MenuLimitDict.keys() : + index = self.MenuLimitDict[key_str] + + return index + + #填充MenuActionDict--------------- + def AddKeyTo_MenuActionDict(self,info_str) : #构造:将字符串及其对应的序号填入 + if self.MenuActionIndex == 0: + self.MenuActionDict[DEFAULT_EMPTY_STR] = self.MenuActionIndex + self.MenuActionIndex += 1 + if info_str not in self.MenuActionDict.keys(): #首先判断要添加的info_str是否已经添加了 + self.MenuActionDict[info_str] = self.MenuActionIndex #添加键值对儿: + self.MenuActionIndex += 1 #序号自增1 + + #别名字典alias_dict填充Menu_StringDict---------- + def StuffDict_MenuStringDict_ByAliasDict(self): #把别名表中的最底层字典的Value(所有别名)存储到Menu_StringDict + for alias_dict in self.alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + self.AddKeyTo_MenuStringDict(alias_name) + + for alias_dict in self.alias_table : #遍历alias_table表 + for alias_name, value_dict in alias_dict.items() : #遍历alias_table表中的每个字典 + for key, value_str in value_dict.items() : #遍历字典中的字典 + self.AddKeyTo_MenuStringDict(value_str) #将所有别名值存入Menu_StringDict + DebugPrint("MenuStringDict->") + DebugPrint(self.MenuStringDict) + + +#--CreateTable----------------------------------------------------------------------------------------------------------------------------- + def menu_get_min_max_index(self, min_value_str, max_value_str) : + index = 0 + str_key = self.menu_get_str_key(min_value_str, max_value_str) + if str_key in self.MenuLimitDict.keys() : + index = self.MenuLimitDict[str_key] + return index + + def menu_item_get_reg_addr_str(self, menu_item) : + reg_addr_str = DEFAULT_EMPTY_STR + reg_addr = None + + if "addr" in menu_item.keys() : + reg_addr = menu_item["addr"] + + if isinstance(reg_addr, float) : + reg_addr_str = str(reg_addr) + elif isinstance(reg_addr, int) : + reg_addr_str = str(reg_addr) + elif isinstance(reg_addr, str) : + reg_addr_str = reg_addr + + return reg_addr_str + + def menu_item_remap_addr(self, menu_item) : + remap_addr = utils.dict_or_object_get_attr(menu_item, "remap_addr", 0) + return remap_addr + + def menu_item_get_min_max_str(self, menu_item) : + min_value_str = DEFAULT_EMPTY_STR + max_value_str = DEFAULT_EMPTY_STR + + min_value = utils.dict_or_object_get_attr(menu_item, "min", None) + max_value = utils.dict_or_object_get_attr(menu_item, "max", None) + format_str = utils.dict_or_object_get_attr(menu_item, "format", "%05.0f") + + if isinstance(min_value, float) : + min_value_str = format_str%(min_value) + elif isinstance(min_value, int) : + min_value = min_value * 1.0 + min_value_str = format_str%(min_value) + elif isinstance(min_value, str) : + min_value_str = min_value + + if isinstance(max_value, float) : + max_value_str = format_str%(max_value) + elif isinstance(max_value, int) : + max_value = max_value * 1.0 + max_value_str = format_str%(max_value) + elif isinstance(max_value, str) : + max_value_str = max_value + + return min_value_str, max_value_str + + def menu_item_get_scale_format(self, menu_item) : + scale_str = str(1.0) + format_str = DEFAULT_EMPTY_STR + format_value = None + scale_value = None + + if "format" in menu_item.keys() : + format_value = menu_item["format"] + if "scale" in menu_item.keys() : + scale_value = menu_item["scale"] + + if isinstance(format_value, float) : + format_str = str(format_value) + elif isinstance(format_value, str) : + format_str = format_value + + if isinstance(scale_value, float) : + scale_str = str(scale_value) + elif isinstance(scale_value, str) : + scale_str = scale_value + + return scale_str, format_str + + #根据菜单内容,填充各个字段字典->MenuUnitDict,MenuScaleFormatDict,MenuActionDict--- + def StuffDict_MenuDict(self,menu, lead): #填充一个菜单对应的各个字典,menu:指定的菜单,lead:要添加信息的各个属性字段字典 + if menu == None : + return + for menu_item in menu : #遍历菜单的各个菜单项 + if lead == "scale_format" : #处理字段: + scale_str, format_str = self.menu_item_get_scale_format(menu_item) + self.AddKeyTo_MenuScaleFormatDict(scale_str, format_str) #将字段值存储到 Menu_FormatDict + if lead == "min_max" : + min_value_str, max_value_str = self.menu_item_get_min_max_str(menu_item) + self.AddKeyTo_LimitDict(min_value_str, max_value_str) + if lead == "remap_addr" : + remap_addr = self.menu_item_remap_addr(menu_item) + if lead == "addr": + reg_addr_key_str = self.menu_item_get_reg_addr_str(menu_item) + self.AddKeyTo_MenuStringDict(reg_addr_key_str) + self.AddKeyTo_MenuAddrDict (reg_addr_key_str) + if lead in menu_item.keys() : #检测菜单项是否包含lead指定的字段 + if lead == "name" : #处理字段: + self.AddKeyTo_MenuStringDict(menu_item["name"]) #将字段值存储到 Menu_StringDict + if lead == "unit" : #处理字段: + self.AddKeyTo_MenuStringDict(menu_item["unit"]) #将字段值存储到 Menu_StringDict + self.AddKeyTo_MenuUnitDict(menu_item["unit"]) #将字段值存储到 Menu_UnitDict + if lead == "action" : #处理字段: + self.AddKeyTo_MenuStringDict(menu_item["action"]) #将字段值存储到 Menu_StringDict + self.AddKeyTo_MenuActionDict(menu_item["action"]) #将字段值存储到 Menu_ActionDict + if lead == "default" : + default_str = "%s"%(menu_item["default"]) + self.AddKeyTo_MenuStringDict(default_str) + + def Create_MenuInfo(self) : + for item_dict in self.menu_description : + menu_object = utils.dict_or_object_get_attr(item_dict, "menu", None) + if menu_object != None : + self.StuffDict_MenuDict(menu_object, "addr") #处理字段 + self.StuffDict_MenuDict(menu_object, "unit") #处理字段 + self.StuffDict_MenuDict(menu_object, "scale_format") #处理字段 + self.StuffDict_MenuDict(menu_object, "action") #处理字段 + self.StuffDict_MenuDict(menu_object, "name") #处理字段 + self.StuffDict_MenuDict(menu_object, "min_max") #处理<最小最大值>字段 + self.StuffDict_MenuDict(menu_object, "remap_addr") #处理重映射字段 + self.StuffDict_MenuDict(menu_object, "default") #处理重映射字段 + + #填充<别名字典>,创建2张别名表------ + def Create_MenuAliasTables(self): + self.StuffDict_MenuStringDict_ByAliasDict() #首先把别名表数值填充到Menu_StringDict字典中 + DebugPrint("MenuStringDict->" + str(self.MenuStringDict)) + DebugPrint("MenuAliasDict->" + str(self.alias_table)) + + for alias_dict in self.alias_table : #遍历别名字典表alias_table + for alias_name, value_dict in alias_dict.items(): #遍历表中单独的一个字典alias_dict + + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + if alias_name not in self.MenuAliasDict.keys() : #因为是空字典,所以会执行 + self.MenuAliasDict[alias_name] = self.MenuAliasTableIndex #填充Menu_AliasDict,将alias_name存储: + DebugPrint("Dict:"+ alias_name + " GetIndex->" + str(self.MenuAliasTableIndex)) + + self.MenuAliasTable.append([self.MenuAliasTable2Index, len(value_dict)]) #构造一级别名表:将[2级表索引,字典长度]存储 + DebugPrint("MenuAliasDict-> [地址偏移,字典大小]->" + str(self.MenuAliasTable)) #[起始地址,内容长度] + self.MenuAliasTableIndex += 1 #索引+1 + + + sorted_list_turple = sorted(value_dict.items(), key=lambda x: x[0] if isinstance(x[0], Enum) == False else x[0].value[0]) + + for each in sorted_list_turple: + if isinstance(each[0], Enum) : + key_value = each[0].value[0] + else : + key_value = each[0] + key_string = each[1] + key_string_offset = self.GetOffsetFrom_MenuStringDict(key_string) #查询Menu_StringDict,找到对应的偏移值:'关闭'-> + self.MenuAliasTable2.append([key_value, key_string_offset]) #构造二级别名表: + self.MenuAliasTable2Index += 1 #索引+1 + DebugPrint("MenuAliasDict2->[数值,别名偏移]->" + str(self.MenuAliasTable2)) #[别名索引,在字符串表中偏移] + + + #for key_value, key_string in value_dict.items(): #遍历字典值:别名内容 {0: '关闭', 1: '打开'} #{'alias_bool': {0: '关闭', 1: '打开'}}, + # key_string_offset = self.GetOffsetFrom_MenuStringDict(key_string) #查询Menu_StringDict,找到对应的偏移值:'关闭'-> + # self.MenuAliasTable2.append([key_value, key_string_offset]) #构造二级别名表: + # self.MenuAliasTable2Index += 1 #索引+1 + # DebugPrint("MenuAliasDict2->[数值,别名偏移]->" + str(self.MenuAliasTable2)) #[别名索引,在字符串表中偏移] + #第一个表Menu_AliasTable存储的是 :[字典1的起始地址,字典1大小],[字典2的起始地址,字典2大小],[字典3的起始地址,字典3大小]. + #第二个表Menu_AliasTable2存储的是 :[别名索引,在字符串表中偏移],[别名索引,在字符串表中偏移],[别名索引,在字符串表中偏移]. + + def Create_MenuCommTables(self) : + if self.MenuCommTableIndex == 0 : + self.MenuCommTable.append([0, 0, 0, 0]) + self.MenuCommTableIndex += 1 + + for comm_dict in self.comm_table : #遍历通讯表comm_table + comm_group_name = utils.dict_or_object_get_attr(comm_dict, "name", None) + if comm_group_name not in self.MenuCommDict.keys() : + self.MenuCommDict[comm_group_name] = self.MenuCommTableIndex + DebugPrint("Dict:"+ comm_group_name + " GetIndex->" + str(self.MenuCommTableIndex)) + + reg_addr = utils.dict_or_object_get_attr(comm_dict, "reg_addr", 0) + reg_count = utils.dict_or_object_get_attr(comm_dict, "reg_count", 0) + cycle = utils.dict_or_object_get_attr(comm_dict, "cycle", 0) + mqtt_pack_object = utils.dict_or_object_get_attr(comm_dict, "mqtt_pack", None) + mqtt_pack_name = self.get_menu_object_name(mqtt_pack_object) + mqtt_menu_index = utils.dict_or_object_get_attr(self.MenuSubMenuDict, mqtt_pack_name, 0) + self.MenuCommTable.append([reg_addr, reg_count, cycle, mqtt_menu_index]) + self.MenuCommTableIndex += 1 #索引+1 + + DebugPrint("MenuCommDict2->[寄存器, 数量, 周期, 菜单索引]->" + str(self.MenuCommTable)) #[别名索引,在字符串表中偏移] + + def get_menu_object_name(self, menu_object) : + for item_dict in self.menu_description : + object = utils.dict_or_object_get_attr(item_dict, "menu", None) + if object == menu_object : + return utils.dict_or_object_get_attr(item_dict, "name", None) + return None + + def Create_MenuNameDict(self): + menu_index = 0 + self.MenuSubMenuDict[DEFAULT_EMPTY_STR] = menu_index + menu_index += 1 + + has_same_name = False + + for item_dict in self.menu_description : + action_name = utils.dict_or_object_get_attr(item_dict, "action", None) + if action_name != None: + self.AddKeyTo_MenuStringDict(action_name) #将字段值存储到 Menu_StringDict + self.AddKeyTo_MenuActionDict(action_name) #将字段值存储到 Menu_ActionDict + + menu_name = utils.dict_or_object_get_attr(item_dict, "name", None) + if menu_name != None : + if menu_name not in self.MenuSubMenuDict.keys() : + self.MenuSubMenuDict[menu_name] = menu_index + else : + has_same_name = True + print_error_msg("有相同的菜单名(%s)"%(menu_name)) + menu_index += 1 + + if has_same_name : + exit(0) + + menu_top = self.config.get_menu_top() + menu_top_name = self.config.get_menu_name(menu_top) + self.MenuTopIndex = utils.dict_or_object_get_attr(self.MenuSubMenuDict, menu_top_name, 0) + + def Create_MenuDescriptionTable(self) : + self.MenuDescriptionTable.append([0, 0, 0, 0, 0, 0, 0, 0, 0]) + + for item_dict in self.menu_description : + menu_name = utils.dict_or_object_get_attr(item_dict, "name", None) + + prev_menu_object = utils.dict_or_object_get_attr(item_dict, "prev", None) + prev_menu_name = self.get_menu_object_name(prev_menu_object) + if prev_menu_name == None : + prev_menu_name = menu_name + else : + DebugPrint(prev_menu_name) + + next_menu_object = utils.dict_or_object_get_attr(item_dict, "next", None) + next_menu_name = self.get_menu_object_name(next_menu_object) + if next_menu_name == None : + next_menu_name = menu_name + else : + DebugPrint(next_menu_name) + + display_menu_object = utils.dict_or_object_get_attr(item_dict, "display", None) + display_menu_name = self.get_menu_object_name(display_menu_object) + + caption_name = utils.dict_or_object_get_attr(item_dict, "caption", DEFAULT_EMPTY_STR) + display_page = utils.dict_or_object_get_attr(item_dict, "page", 0) + max_menu_item = utils.dict_or_object_get_attr(item_dict, "max_items", 0) + + active_index = 0 + + ''' + action_name = utils.dict_or_object_get_attr(item_dict, "action", None) + if action_name == None : + active_index = 0 + else : + active_index = utils.dict_or_object_get_attr(self.MenuActionDict, action_name, 0) + ''' + self.AddKeyTo_MenuStringDict(menu_name) + self.AddKeyTo_MenuStringDict(caption_name) + + menu_index = utils.dict_or_object_get_attr(self.MenuSubMenuDict, menu_name, 0) + prev_menu_index = utils.dict_or_object_get_attr(self.MenuSubMenuDict, prev_menu_name, 0) + next_menu_index = utils.dict_or_object_get_attr(self.MenuSubMenuDict, next_menu_name, 0) + display_menu_index = utils.dict_or_object_get_attr(self.MenuSubMenuDict, display_menu_name, 0) + + menu_name_str_off = self.GetOffsetFrom_MenuStringDict(menu_name) + caption_str_off = self.GetOffsetFrom_MenuStringDict(caption_name) + self.MenuDescriptionTable.append([menu_index, display_menu_index, next_menu_index, prev_menu_index, display_page, max_menu_item, active_index, menu_name_str_off, caption_str_off]) + + #创建2张菜单表create_menu_item_talbe(Menu_Top) + def Create_MenuItemTable(self, menu, self_menu_str) : #创建菜单表,菜单本身由字典列表描述 + #自身菜单索引写入到菜单字典中 + #self_menu_str = self.config.get_menu_name(menu) + self_menu_index = self.MenuSubMenuDict[self_menu_str] + start_index = self.MenuMenuTable2Index #设置起始索引 + + for menu_item_dict in menu : #遍历字典 + alias_index = 0 # + unit_index = 0 + name_offset = 0 + is_alias = 0 + action_index = 0 + sub_menu_index = 0 + comm_index = 0 + + min_value_str, max_value_str = self.menu_item_get_min_max_str(menu_item_dict) + limit_index = self.menu_get_min_max_index(min_value_str, max_value_str) + + scale_str, format_str = self.menu_item_get_scale_format(menu_item_dict) + scale_format_index = self.Get_ScaleFormatTableIndex(scale_str, format_str) + + remap_addr = utils.dict_or_object_get_attr(menu_item_dict, "remap_addr", 0) + menu_property = utils.dict_or_object_get_attr(menu_item_dict, "property", 1) + + for key, value in menu_item_dict.items(): #遍历字典中的键值对 "name": "电流设置", + if key == "alias" : # + if isinstance(value, Enum) : + value = value.name + + if value in self.MenuAliasDict.keys() : + alias_index = self.MenuAliasDict[value] #查询到对应的在别名表的偏移 + is_alias = 1 + else : + alias_index = 0 + elif key == "unit" : + unit_index = self.MenuUnitDict[value] + elif key == "name" : + name_offset = self.GetOffsetFrom_MenuStringDict(value) + elif key == "action" : + action_index = self.MenuActionDict[value] + elif key == "comm" : + comm_index = self.MenuCommDict[value] + elif key == "sub_menu" : + sub_menu_str = value + if isinstance(sub_menu_str, Enum) : + sub_menu_str = sub_menu_str.name + + sub_menu_index = utils.dict_or_object_get_attr(self.MenuSubMenuDict, sub_menu_str, 0) + + reg_addr_key_str = self.menu_item_get_reg_addr_str(menu_item_dict) + reg_addr_key_index = self.GetOffsetFrom_MenuStringDict(reg_addr_key_str) + + + self.MenuMenuTable2Index += 1 + self.MenuItemList.append([menu_item_dict, self.MenuMenuTable2Index]) + + self.MenuMenuTable2.append([reg_addr_key_index, name_offset, is_alias, unit_index, alias_index, scale_format_index, action_index, sub_menu_index, limit_index, comm_index, remap_addr, menu_property]) + + end_index = self.MenuMenuTable2Index + if len(self.MenuMenuTable) == 0 : + self.MenuMenuTable.insert(0, [0, 0]) + self.MenuMenuTable.insert(self_menu_index, [start_index, end_index - start_index]) #MenuMenuTable表存储 + + DebugPrint("MenuMenuTable->" + str(self.MenuMenuTable)) # + DebugPrint("----") # + DebugPrint("MenuMenuTable2->" + str(self.MenuMenuTable2)) # + DebugPrint(" ") # + + #第一个表Menu_MenuTable存储的是 :[[0, 4], [4, 5], [9, 4]] :[起始地址,项数],. + #第二个表MMenu_MenuTable2存储的是 :[2000, 46, 0, 0, 0, 0, 0, 0], [2001, 59, 0, 1, 0, 1, 0, 0]. + + def Create_AllMenuItemTable(self) : #创建菜单表,菜单本身由字典列表描述 + for item_dict in self.menu_description : + menu_object = utils.dict_or_object_get_attr(item_dict, "menu", None) + menu_name = utils.dict_or_object_get_attr(item_dict, "name", None) + if menu_object != None and menu_name != None: + self.Create_MenuItemTable(menu_object, menu_name) + +#--Packing------------------------------------------------------------------------------------------------------------------------------------------------------ + + #对数据包补零处理------------------ + #API_Align_PackBuf() + def Align_PackBuf(self,pack_buf) : #保证4字节对齐,对不满足的进行补零操作 + remain = len(pack_buf) % 4 #计算要补零的个数 + if remain == 1 : + return pack_buf + struct.pack("BBB", 0, 0, 0) #补3个0 + elif remain == 2 : + return pack_buf + struct.pack("BB", 0, 0) #补2个0 + elif remain == 3 : + return pack_buf + struct.pack("B", 0) #补1个0 + return pack_buf #返回补零处理后的包 + + #将MenuStringDict中的键打包-------------------- + #API_Pack_MeunStringDict() + def Pack_MeunStringDict(self): #打包<字符串表> + for str_key in self.MenuStringDict.keys() : #遍历Menu_StringDict字典的索引 + str_format = str(len(str_key.encode(self.encode_type)) + 1) + 's' #要打包的格式字符:每条索引的字符长度+1 + self.Packed_MenuStringTable += struct.pack(str_format, str_key.encode(self.encode_type)) #将每个索引打包进Pack_StringTable + self.Packed_MenuStringTable = struct.pack("I", len(self.Packed_MenuStringTable)) + self.Packed_MenuStringTable + + for str_key, str_off in self.MenuStringDict.items() : #遍历Menu_StringDict,将存储的键值对打印<额定电流 : 94> + object_str = "name=" + str_key + ": offset=" + str(str_off) + DebugPrint(object_str) #打印键值对:<额定电流 : 94> + + DebugPrint("-----------------------------------") + DebugPrint("Pack_MenuStringTable->") + DebugPrint(self.Packed_MenuStringTable) + + #打包字典MenuUnitDict得到Menu_UnitTable :单位在字符表中的偏移-------------------------------------------------- + def Pack_MenuUnitDict(self): + MenuUnitTurpleSort = sorted(self.MenuUnitDict.items(), key=lambda x:x[1], reverse=False) #先对Menu_UnitDict字典的索引排序 + MenuUnitDictSort = dict(MenuUnitTurpleSort) #由排序好的tuple生成新的字典 + self.Packed_MenuUnitTable = struct.pack("I", len(self.MenuUnitDict)) #打包长度 + for key in MenuUnitDictSort.keys() : #遍历单位字典中所有项目 + key_offset = self.GetOffsetFrom_MenuStringDict(key) #从字符串字典中 查询偏移值 + self.Packed_MenuUnitTable += struct.pack("H", key_offset) # + self.Packed_MenuUnitTable = self.Align_PackBuf(self.Packed_MenuUnitTable) #打包 + DebugPrint("Origin:MenuUnitDictSort->" + str(MenuUnitDictSort)) # + DebugPrint("Packed:Packed_MenuUnitTable->" + str(self.Packed_MenuUnitTable)) # + + #打包字典MenuScaleFormatDict得到Packed_MenuScaleFormatTable:动作在字符表中的偏移---------------------------------------------------- + def Pack_MenuScaleFormatDict(self): + self.Packed_MenuScaleFormatTable = struct.pack("I", len(self.MenuScaleFormatTable)) + for item in self.MenuScaleFormatTable : + self.Packed_MenuScaleFormatTable += struct.pack("HH", item[0], item[1]) + self.Packed_MenuScaleFormatTable = self.Align_PackBuf(self.Packed_MenuScaleFormatTable) + DebugPrint("Origin:MenuScaleFormatDict->" + str(self.MenuScaleFormatDict)) + DebugPrint("Origin:MenuScaleFormatTable->" + str(self.MenuScaleFormatTable)) + DebugPrint("Packed:MenuScaleFormatTable->" + str(self.Packed_MenuScaleFormatTable)) + + #打包字典MenuScaleFormatDict得到Packed_MenuScaleFormatTable:动作在字符表中的偏移---------------------------------------------------- + def Pack_MenuCaptionInfoDict(self): + ''' + struct TMenuDescriptionItem + { + uint16_t menu_index : 8; + uint16_t next_menu_index : 8; + uint16_t prev_menu_index : 8; + uint16_t display_page : 8; + uint16_t max_menu_item : 8; + uint16_t action_index : 8; + uint16_t menu_name_str_offset; + uint16_t description_str_off; + uint16_t display_menu_index : 8; + uint16_t rsv : 8; + }; + ''' + self.Packed_MenuDescription = struct.pack("I", len(self.MenuDescriptionTable)) + + for item in self.MenuDescriptionTable : + value = 0 + value2 = 0 + + value |= item[0] + + display_menu_index = item[1] + next_menu_index = item[2] + value |= (next_menu_index << 8) + prev_menu_index = item[3] + value |= (prev_menu_index << 16) + page = item[4] + value |= (page << 24) + + max_items = item[5] + value2 |= (max_items << 0) + + action_index = item[6] + value2 |= (action_index << 8) + + menu_name_off = item[7] + caption_str_off = item[8] + + self.Packed_MenuDescription += struct.pack("IHHHBB", value, value2, menu_name_off, caption_str_off, display_menu_index, 0) + + self.Packed_MenuDescription = self.Align_PackBuf(self.Packed_MenuDescription) + + + #打包字典Pack_MenuActionDict得到Packed_MenuActionTable:动作在字符表中的偏移---------------------------------------------------- + def Pack_MenuActionDict(self): + Menu_actionTurpleSort = sorted(self.MenuActionDict.items(), key=lambda x:x[1], reverse=False) + MenuactionDictSort = dict(Menu_actionTurpleSort) + self.Packed_MenuActionTable = struct.pack("I", len(self.MenuActionDict)) + DebugPrint("01-Packed_MenuActionTable->" + str(self.Packed_MenuActionTable)) # + for key in MenuactionDictSort.keys() : + key_offset = self.GetOffsetFrom_MenuStringDict(key) + DebugPrint("02-offset->" + str(key_offset)) # + self.Packed_MenuActionTable += struct.pack("H", key_offset) + DebugPrint("02-Current:Packed_MenuActionTable->" + str(self.Packed_MenuActionTable)) # + self.Packed_MenuActionTable = self.Align_PackBuf(self.Packed_MenuActionTable) + DebugPrint("03-Current:MenuActionTable ->" + str(self.MenuActionDict)) # + DebugPrint("04-Sorted :MenuactionDictSort->" + str(MenuactionDictSort)) # + DebugPrint("05-Packed:Packed_MenuActionTable->" + str(self.Packed_MenuActionTable)) # + + def Pack_MenuLimitDict(self): + self.Packed_MenuLimitTable = struct.pack("I", len(self.MenuLimitTable)) + for item in self.MenuLimitTable: + self.Packed_MenuLimitTable += struct.pack("HH", item[0], item[1]) + def Pack_MenuCommDict(self): + self.Packed_MenuCommTable = struct.pack("I", len(self.MenuCommTable)) + for item in self.MenuCommTable: + self.Packed_MenuCommTable += struct.pack("IHHHH", item[0], item[1], item[2], item[3], 0) + + #打包2张别名表Menu_AliasTable Menu_AliasTable2------------------- + def Pack_MenuAliasTables(self): + self.Packed_AliasBuf = struct.pack("I", len(self.MenuAliasTable)) #将Menu_AliasDict菜单别字典打包,先将长度填充 + for item in self.MenuAliasTable: #将Menu_AliasTable菜单别名表打包[[0, 2], [2, 3], [5, 2]] + self.Packed_AliasBuf += struct.pack("HH", item[0], item[1]) #[0,2] -> x00\x00\x02\x00 [2,3] -> x02\x00\x03\x00 + self.Packed_AliasBuf = self.Align_PackBuf(self.Packed_AliasBuf) #补零处理 + DebugPrint("Origin:MenuAliasTable->" + str(self.MenuAliasTable)) # + DebugPrint("Packed:MenuAliasDict->" + str(self.Packed_AliasBuf)) # + + self.Packed_AliasBuf2 = struct.pack("I", len(self.MenuAliasTable2)) #[[0, 1], [1, 8], [0, 15], [1, 20], [2, 25], [0, 1], [1, 31]]打包,填充长度占4个字节长度 + for item in self.MenuAliasTable2: #遍历每一项[x,x] + if isinstance(item[0], Enum) : + value = item[0].value[0] + else : + value = item[0] + self.Packed_AliasBuf2 += struct.pack("HH", value, item[1]) #[0,1] -> x00\x00\x01\x00\ [1,8] -> x01\x00\x08\x00\ + + self.Packed_AliasBuf2 = self.Align_PackBuf(self.Packed_AliasBuf2) #补零处理 + DebugPrint("Origin:MenuAliasTable2->" + str(self.MenuAliasTable2)) # + DebugPrint("Packed:MenuAliasDict->" + str(self.Packed_AliasBuf2)) # + + ''' + typedef enum EMenuItemInfoType + { + MENU_ITEM_NORMAL, + MENU_ITEM_ALIAS, + MENU_ITEM_SUB_MENU, + } EMenuItemInfoType; + + typedef struct TMenuItemInfoTypeCommon + { + uint32_t type : 2; + uint32_t rsv : 22; + uint32_t action_index : 8; + } TMenuItemInfoTypeCommon; + + typedef struct TMenuItemInfoTypeAlias + { + uint32_t type : 2; + uint32_t rsv : 14; + uint32_t alias_index : 8; + uint32_t action_index : 8; + } TMenuItemInfoTypeAlias; + + typedef struct TMenuItemInfoTypeNormal + { + uint32_t type : 2; + uint32_t scale_format_index : 8; + uint32_t limit_index : 8; + uint32_t unit_index : 6; + uint32_t action_index : 8; + } TMenuItemInfoTypeNormal; + + typedef struct TMenuItemInfoTypeSubMenu + { + uint32_t type : 2; + uint32_t rsv : 14; + uint32_t sub_menu_index : 8; + uint32_t action_index : 8; + } TMenuItemInfoTypeSubMenu; + + typedef enum EMenuProperty + { + MENU_PROP_READ_ONLY = 0, + MENU_PRIO_USER, + MENU_PRIO_ENGINEER, + } EMenuProperty; + + //每个菜单项12字节 + struct TMenuItemInfo + { + uint16_t comm_str_offset; + uint16_t name_offset; + uint16_t comm_group_index : 8; + uint16_t menu_property : 8; //EMenuProperty + uint16_t remap_addr; + union { + TMenuItemInfoTypeCommon common; + TMenuItemInfoTypeAlias alias; + TMenuItemInfoTypeNormal normal; + TMenuItemInfoTypeSubMenu sub_menu; + } info; + }; + ''' + + #打包菜单表MenuMenuTable :格式在字符表中的偏移 + def Pack_MenuMenuTable(self): + self.Packed_MenuBuf = struct.pack("HH", len(self.MenuSubMenuDict), self.MenuTopIndex) + for item in self.MenuMenuTable: + self.Packed_MenuBuf += struct.pack("HH", item[0], item[1]) + + self.Packed_MenuBuf2 = struct.pack("I", len(self.MenuMenuTable2)) #菜单包2组包,构造字节流,首先添加长度信息 + for item in self.MenuMenuTable2: #在一个循环中将各个信息流填入buf中 + reg_addr_key_index = item[0] + name_offset = item[1] + is_alias = item[2] + unit_index = item[3] + alias_index = item[4] + scale_format_index = item[5] + action_index = item[6] + sub_menu_index = item[7] + limit_index = item[8] + comm_index = item[9] + remap_addr = item[10] + menu_property = item[11] + + menu_item_prop = 0 + menu_item_prop |= (action_index & 0xFF) << 24 + + if is_alias : + menu_item_prop |= (MENU_ITEM_ALIAS << 0) + menu_item_prop |= ((alias_index & 0xFF) << 16) + elif sub_menu_index > 0 : + menu_item_prop |= (MENU_ITEM_SUB_MENU << 0) + menu_item_prop |= ((sub_menu_index & 0xFF) << 16) + else : + menu_item_prop |= (MENU_ITEM_NORMAL << 0) + menu_item_prop |= ((scale_format_index & 0xFF) << 2) + menu_item_prop |= ((limit_index & 0xFF) << 10) + menu_item_prop |= ((unit_index & 0x3F) << 18) + + self.Packed_MenuBuf2 += struct.pack("HHBBHI", reg_addr_key_index, name_offset, comm_index, menu_property, remap_addr, menu_item_prop) + + self.Packed_MenuBuf = self.Align_PackBuf(self.Packed_MenuBuf) + self.Packed_MenuBuf2 = self.Align_PackBuf(self.Packed_MenuBuf2) + self.Packed_MenuDescription = self.Align_PackBuf(self.Packed_MenuDescription) + self.Packed_AliasBuf = self.Align_PackBuf(self.Packed_AliasBuf) + self.Packed_AliasBuf2 = self.Align_PackBuf(self.Packed_AliasBuf2) + self.Packed_MenuScaleFormatTable = self.Align_PackBuf(self.Packed_MenuScaleFormatTable) + self.Packed_MenuUnitTable = self.Align_PackBuf(self.Packed_MenuUnitTable) + self.Packed_MenuStringTable = self.Align_PackBuf(self.Packed_MenuStringTable) + self.Packed_MenuLimitTable = self.Align_PackBuf(self.Packed_MenuLimitTable) + self.Packed_MenuCommTable = self.Align_PackBuf(self.Packed_MenuCommTable) + self.Packed_MenuActionTable = self.Align_PackBuf(self.Packed_MenuActionTable) + + DebugPrint("01-Origin:Menu_MenuTable->" + str(self.MenuMenuTable)) # + DebugPrint("<->") # + DebugPrint("01-Packed:Pack_MenuBuf->" + str(self.Packed_MenuBuf)) # + DebugPrint("...........................") # + DebugPrint("02-Origin:Menu_MenuTable2->" + str(self.MenuMenuTable2)) # + DebugPrint("<->") # + DebugPrint("02-Packed:Pack_MenuBuf2->" + str(self.Packed_MenuBuf2)) # + + #打包整体 + def Pack_All(self): + + PackData = self.Packed_MenuBuf + PackData = PackData + self.Packed_MenuBuf2 + PackData = PackData + self.Packed_MenuDescription + PackData = PackData + self.Packed_AliasBuf + PackData = PackData + self.Packed_AliasBuf2 + PackData = PackData + self.Packed_MenuScaleFormatTable + PackData = PackData + self.Packed_MenuUnitTable + PackData = PackData + self.Packed_MenuLimitTable + PackData = PackData + self.Packed_MenuCommTable + PackData = PackData + self.Packed_MenuActionTable + PackData = PackData + self.Packed_MenuStringTable + + #crc_function = crcmod.mkCrcFun(0x104c11db7, initCrc=0xFFFFFFFF, xorOut=0xFFFFFFFF) #获取计算CRC校验的函数->crc_function + #data_crc_value = crc_function(PackData) + + data_crc_value = 0 + data_crc_value = zlib.crc32(PackData, data_crc_value) + data_crc_value &= 0xFFFFFFFF + + PackHeader = struct.pack("8s", "PackV0.1".encode(self.encode_type)) #将"PackV0.1"8个字符编码后填入buf中 + header_size = 80 + PackHeader += struct.pack("I", header_size) #文件头长度 + + pack_offset = 0 #菜单包1偏移 = 64 + + PackHeader += struct.pack("I", pack_offset) + DebugPrint("00-<菜单表1偏移>-menu_pack_offset ->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuBuf) #菜单包2偏移 = 菜单包1偏移 + 菜单包1长度 + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("01-<菜单表2偏移>-menu_pack2_offset ->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuBuf2) #菜单包2偏移 = 菜单包1偏移 + 菜单包1长度 + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("02-<菜单描述偏移>-menu_desc_offset ->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuDescription) #菜单包2偏移 = 菜单包1偏移 + 菜单包1长度 + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("03-<别名表1偏移>-alias_pack_offset ->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_AliasBuf) #别名包1偏移 = 菜单包2偏移 + 菜单包2长度 + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("04-<别名表2偏移>-alias_pack2_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_AliasBuf2) #别名包2偏移 = 别名包1偏移 + 别名包1长度 + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("05--format_table_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuScaleFormatTable) + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("06--unit_table_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuUnitTable) + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("07--limit_table_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuLimitTable) + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("08--comm_table_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuCommTable) + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("09--action_table_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuActionTable) + PackHeader += struct.pack("I", pack_offset) + + DebugPrint("10--string_table_offset->" + str(pack_offset)) + pack_offset = pack_offset + len(self.Packed_MenuStringTable) + + PackHeader += struct.pack("III", 0, 0, 0) #保留 + + PackHeader += struct.pack("I", len(PackData)) + PackHeader += struct.pack("I", data_crc_value) + + #head_crc_value = crc_function(PackHeader) + head_crc_value = 0 + head_crc_value = zlib.crc32(PackHeader, head_crc_value) + head_crc_value &= 0xFFFFFFFF + + PackHeader += struct.pack("I", head_crc_value) + + header_len = len(PackHeader) + DebugPrint("04-<文件头长度 >-PackHeaderLen ->" + str(header_len)) + + PackFile = PackHeader + PackData #文件 = 文件头 + 文件数据 + file_len = len(PackFile) + DebugPrint("04-<文件总长度 >-PackFileLen ->" + str(file_len)) + + DebugPrint(" ") + DebugPrint("01-<文件头部>PackHeader->") + DebugPrint(repr(PackHeader)) + DebugPrint(" ") + + DebugPrint("03-<文件整体>PackFile->") + DebugPrint(len(PackFile)) + DebugPrint(repr(PackFile)) + DebugPrint(" ") + return PackFile + + def PackSave(self, file_name, pack_file) : + with open(file_name,'wb') as file: + file.write(pack_file) + file.close() + + def PackSaveC(self, file_name, pack_file) : + index = 0 + with open(file_name,'w', encoding='utf-8') as file: + current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") + file.write("/" + "/" + file_name + " create date: " + current_time + "\n") + + file.write("#include \n") + + file.write("__attribute__((aligned(4)))\n") + file.write("const char menu_data[] = {\n") + for each in pack_file : + if index == 0 : + file.write(" ") + index += 1 + file.write("0x%02x, "%(each)) + if index >= 16 : + index = 0 + file.write("\n") + if index > 0 : + file.write("\n") + file.write("};\n") + + file.write("const uint16_t menu_data_buf_size = sizeof(menu_data);\n") + + file.close() + + +def get_comm_str_info(comm_str : str) : + splits = comm_str.split('#') + total_len = len(splits) + base = 0 + bit = -1 + sign = 1 + + if comm_str == DEFAULT_EMPTY_STR : + return base, bit, sign + + if total_len >= 1 : + bit_splits = splits[0].split('.') + if len(bit_splits) == 2: + base = int(bit_splits[0]) + bit = int(bit_splits[1]) + else : + base = int(bit_splits[0]) + return base, bit, sign + +def caculate_comm_str_compare(comm_str : str) : + base, bit, sign = get_comm_str_info(comm_str) + if bit < 0: + return base * 16 + else : + return base * 16 + bit + +def get_variable_info(comm_str : str, name_str : str, alias_str : str = DEFAULT_EMPTY_STR) : + name = "" + is_float = "#f" in comm_str + is_sign = "#s" in comm_str + is_data_32 = "#2" in comm_str + base, bit, sign = get_comm_str_info(comm_str) + + if alias_str != DEFAULT_EMPTY_STR: + type = alias_str + elif is_float : + type = "float" + elif bit >= 0: + type = "uint16_t" + elif is_sign : + type = "int32_t" if is_data_32 else "int16_t" + else : + type = "uint32_t" if is_data_32 else "uint16_t" + + name = get_variable_name(name_str) + return type, name + + +COMM_STRUCT_PROP_STR_DEF = """ +typedef struct TCommTable +{ + uint32_t comm_addr; + uint16_t offset; + uint16_t default_str_off; + uint16_t is_measure : 1; + uint16_t menu_item_index : 12; + uint16_t data_size : 3; +} TCommTable; \n +""" +COMM_PARA_STRUCT_ITEM_INIT = """ + { + //%s + .comm_addr= %d, + .offset = offsetof(TSystemPara, %s), + .is_measure = false, + .default_str_off = %d, + .menu_item_index = %d, + .data_size = sizeof(((TSystemPara *)0)->%s), + },""" + +COMM_MEASURE_STRUCT_ITEM_INIT = """ + { + //%s + .comm_addr= %d, + .offset = offsetof(TMeasureValue, %s), + .is_measure = true, + .default_str_off = %d, + .menu_item_index = %d, + .data_size = sizeof(((TMeasureValue *)0)->%s), + },""" + + +class CommTableCreate(): + def __init__(self) -> None: + self.CommStringList = [] + self.STRUCT_PROP_DEF = COMM_STRUCT_PROP_STR_DEF + + def CommFileCreate(self, file_name, dictManager: DictsManager) : + + for menu_item_info in dictManager.MenuItemList : + each_dict = menu_item_info[0] + menu_index = menu_item_info[1] + + scale_str = utils.dict_or_object_get_attr(each_dict, "scale", "1.0") + format_str = utils.dict_or_object_get_attr(each_dict, "format", "%5.0f") + unit_str = utils.dict_or_object_get_attr(each_dict, "unit", DEFAULT_EMPTY_STR) + name_str = utils.dict_or_object_get_attr(each_dict, "name", DEFAULT_EMPTY_STR) + comm_str = utils.dict_or_object_get_attr(each_dict, "addr", DEFAULT_EMPTY_STR) + min_str = utils.dict_or_object_get_attr(each_dict, "min", DEFAULT_EMPTY_STR) + max_str = utils.dict_or_object_get_attr(each_dict, "max", DEFAULT_EMPTY_STR) + alias_str = utils.dict_or_object_get_attr(each_dict, "alias", DEFAULT_EMPTY_STR) + default_str = utils.dict_or_object_get_attr(each_dict, "default", DEFAULT_EMPTY_STR) + is_measure = utils.dict_or_object_get_attr(each_dict, "measure", False) + + default_str = "%s"%(default_str) + + if comm_str != DEFAULT_EMPTY_STR : + aleady_exist = False + for item_list in self.CommStringList : + if comm_str == item_list[0] : + aleady_exist = True + break + if aleady_exist == False: + self.CommStringList.append([comm_str, name_str, scale_str, format_str, unit_str, min_str, max_str, alias_str, menu_index, default_str, is_measure]) + + print ("Sorted Table: ") + sorted_comm_items = sorted(self.CommStringList, key=lambda x: caculate_comm_str_compare(x[0])) + + file_name_h = file_name.replace(".c", ".h") + base_name: str = os.path.basename(file_name_h) + FILE_H_HEADER = base_name.replace(".h", "_H").upper() + + with open(file_name_h,'w', encoding='utf-8') as file: + current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") + file.write("/" + "/" + file_name + " create date: " + current_time + "\n") + file.write("#ifndef %s\n"%(FILE_H_HEADER)) + file.write("#define %s\n"%(FILE_H_HEADER)) + file.write("\n#include \n") + + #定义别名枚举类型 + for alias_dict in dictManager.alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + enum_define = True + for key_value, value_str in value_dict.items() : + if isinstance(key_value, Enum): + enum_define = False + break + + if enum_define : + file.write("\ntypedef enum %s { \n"%(alias_name)) + for key_str, value_str in value_dict.items() : + enum_item_str = alias_name.upper() + "_" + get_variable_name(value_str).upper() + caption_str = value_str + main_str = "%s = %d,"%(enum_item_str, key_str) + write_str = " %-40s//%s\n"%(main_str, caption_str) + file.write(write_str) + file.write("} %s; \n"%(alias_name)) + + #创建.h文件 + para_def_list = [] + measure_def_list = [] + for items in sorted_comm_items: + is_measure = items[10] + unit_str = "(%s)"%(items[4]) + scale_format_str = "%s, %s"%(items[2], items[3]) + if items[5] != DEFAULT_EMPTY_STR and items[6] != DEFAULT_EMPTY_STR: + min_max_str = "[%s, %s]"%(items[5], items[6]) + else : + min_max_str = DEFAULT_EMPTY_STR + alias_str = items[7] + if isinstance(alias_str, Enum): + alias_str = alias_str.name + + para_type, para_name = get_variable_info(items[0], items[1], alias_str) + para_name = para_name + caption = '//%-15s%-10s%-20s%-30s'%(scale_format_str, unit_str, min_max_str, items[1]) + para_type_name = "%-20s %s;"%(para_type, para_name) + + if is_measure : + measure_def_list.append(" %-50s %s"%(para_type_name, caption) + "\n") + else : + para_def_list.append(" %-50s %s"%(para_type_name, caption) + "\n") + + sorted_para_def_list = sorted(para_def_list, key=lambda x: x, reverse=True) + sorted_measure_def_lit = sorted(measure_def_list, key=lambda x: x, reverse=True) + + file.write("\ntypedef struct TSystemPara { \n") + for items in sorted_para_def_list: + file.write(items) + file.write("} TSystemPara; \n") + + + file.write("\ntypedef struct TMeasureValue { \n") + for items in sorted_measure_def_lit: + file.write(items) + file.write("} TMeasureValue; \n") + + file.write("\n#endif //%s\n"%(FILE_H_HEADER)) + file.close() + + #创建.c文件 + with open(file_name,'w', encoding='utf-8') as file: + current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") + file.write("/" + "/" + file_name + " create date: " + current_time + "\n") + file.write("#include <%s>\n"%(base_name)) + + + file.write(self.STRUCT_PROP_DEF) + file.write("\nconst TCommTable CommTable[] = { \n") + + for items in sorted_comm_items: + comm_str = items[0] + menu_item_index = items[8] + default_str = items[9] + caption_str = items[1] + is_measure = items[10] + if default_str == DEFAULT_EMPTY_STR : + default_str_offset = 0 + else : + default_str_offset = utils.dict_or_object_get_attr(dictManager.MenuStringDict, default_str, 0) + + comm_addr, bit, sign = get_comm_str_info(items[0]) + para_name = get_variable_name(items[1]) + + if is_measure : + file.write(COMM_MEASURE_STRUCT_ITEM_INIT%(caption_str, comm_addr, para_name, default_str_offset, menu_item_index, para_name)) + else : + file.write(COMM_PARA_STRUCT_ITEM_INIT%(caption_str, comm_addr, para_name, default_str_offset, menu_item_index, para_name)) + file.write("\n};") + + file.close() + + +if __name__ == "__main__": + + modify_value = 1.0 + #把浮点数转换成4字节数, 然后转化成32位整数 + bs = struct.pack("f", modify_value) + + print("%02x%02x%02x%02x"%(bs[0], bs[1], bs[2], bs[3])) + + dictManager = DictsManager() + + #[01]打印<别名字典列表alias_table>全部内容 --> DebugPrint(alias_table) + #[02]将所有别名字符串存储到<全局字符串字典MenuStringDict>,根据<别名字典列表alias_table>创建2张别名表 --> Create_MenuAliasTables()->StuffDict_MenuStringDict_ByAliasDict() + #[03]根据菜单内容,填充<全局字符串字典MenuStringDict>和各个字段字典,, --> StuffDict_MenuDict() + #[04]根据菜单结构,创建2张菜单表 --> Create_MenuItemTable() + #[05]打包 得到Packed_MenuStringTable --> Pack_MeunStringDict() + #[06]打包 得到Packed_MenuUnitTable --> Pack_MenuUnitDict() + #[07]打包 得到Packed_MenuScaleFormatTable --> Pack_MenuScaleFormatDict() + #[08]打包 得到Packed_MenuActionTable --> Pack_MenuActionDict() + #[09]打包2张别名表 得到Packed_AliasBuf和Packed_AliasBuf2 --> Pack_MenuAliasTables() + #[10]打包2张菜单表 得到Packed_MenuBuf和Packed_MenuBuf2 --> Pack_MenuMenuTable() + #[11]打包全部 + + DebugPrint("↓---------------------------------------------------S(打印<别名字典列表alias_table>全部内容)---------------------------------------------↓") + DebugPrint("Step_01") + DebugPrint(dictManager.alias_table) + DebugPrint("Step_01") + DebugPrint("↑--------------------alias_table------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + DebugPrint("↓---------------------------------------S(将所有别名字符串存储到<全局字符串字典MenuStringDict>)--------------------------------------------↓") + DebugPrint("↓--------------------------------------------S(根据<别名字典列表alias_table>创建2张别名表)------------------------------------------------↓") + + DebugPrint("Step_02") + dictManager.Create_MenuAliasTables() + DebugPrint("__________MenuStringDict___________>"+ str(dictManager.MenuStringDict)) + DebugPrint("Step_02") + DebugPrint("↑--------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + dictManager.Create_MenuNameDict() + + dictManager.Create_MenuCommTables() + + DebugPrint("↓-----------S(根据菜单内容,填充<全局字符串字典MenuStringDict>和各个字段字典,,)--------------↓") + DebugPrint("Step_03") + + dictManager.Create_MenuInfo() + + DebugPrint("↓--------------------------------------------S(根据菜单结构,创建2张菜单表)-----------------------------------------------------------------------↓") + DebugPrint("Step_04") + dictManager.Create_AllMenuItemTable() + DebugPrint("Step_04") + DebugPrint("↑----------------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + + dictManager.Create_MenuDescriptionTable() + DebugPrint("MenuDescriptionTable->") + DebugPrint(dictManager.MenuDescriptionTable) + DebugPrint(" ") + + DebugPrint("MenuUnitDict->") + DebugPrint(dictManager.MenuUnitDict) + DebugPrint(" ") + DebugPrint("MenuScaleFormatDict->") + DebugPrint(dictManager.MenuScaleFormatDict) + DebugPrint(" ") + DebugPrint("MenuActionDict->") + DebugPrint(dictManager.MenuActionDict) + DebugPrint(" ") + DebugPrint("MenuStringDict->") + DebugPrint(dictManager.MenuStringDict) + DebugPrint("Step_03") + DebugPrint("↑----------------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + + DebugPrint("↓--------------------------------------------S(打包 得到Packed_MenuStringTable )------------------------------------------------↓") + DebugPrint("↓--------------------------------------------S(打包 得到Packed_MenuUnitTable )------------------------------------------------↓") + DebugPrint("↓--------------------------------------------S(打包 得到Packed_MenuScaleFormatTable )--------------------------------------↓") + DebugPrint("↓--------------------------------------------S(打包 得到Packed_MenuActionTable )------------------------------------------------↓") + DebugPrint("Step_05") + dictManager.Pack_MeunStringDict() + dictManager.Pack_MenuUnitDict() + dictManager.Pack_MenuScaleFormatDict() + dictManager.Pack_MenuActionDict() + dictManager.Pack_MenuCaptionInfoDict() + dictManager.Pack_MenuLimitDict() + dictManager.Pack_MenuCommDict() + DebugPrint("Step_05") + DebugPrint("↑----------------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + DebugPrint("↓--------------------------------S(打包 得到Packed_AliasBuf和Packed_AliasBuf2)-------------------------------↓") + DebugPrint("TEST_06") + dictManager.Pack_MenuAliasTables() + DebugPrint("TEST_06") + DebugPrint("↑---------------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + DebugPrint("↓--------------------------------S(打包 得到Packed_MenuBuf和Packed_MenuBuf2)-------------------------------↓") + DebugPrint("TEST_07") + dictManager.Pack_MenuMenuTable() + DebugPrint("TEST_07") + DebugPrint("↑---------------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + DebugPrint("↓-------------------------------------------------------------------S(打包全部)-----------------------------------------------------------------↓") + DebugPrint("TEST_08") + pack_file_buf = dictManager.Pack_All() + DebugPrint("TEST_08") + DebugPrint("↑---------------------------------------------------------------------------------------------------------------------------------------------↑") + DebugPrint("|") + + file_name = sys.path[0] + "/menu.dat" + print(file_name) + dictManager.PackSave(file_name, pack_file_buf) + + file_name = sys.path[0] + "/menu_dat.c" + print(file_name) + dictManager.PackSaveC(file_name, pack_file_buf) + + print("%s"%(1.23)) + name1 = get_variable_name("系统电压") + name2 = get_variable_name("Ia 校正") + name3 = get_variable_name("Ib 校正") + name4 = get_variable_name("馈电设备") + + table_create = CommTableCreate() + file_name = sys.path[0] + "/CommTable.c" + table_create.CommFileCreate(file_name, dictManager) diff --git a/QT5_Project/GB_ZM_8/APPWindow.py b/QT5_Project/GB_ZM_8/APPWindow.py new file mode 100644 index 0000000..4b9bf92 --- /dev/null +++ b/QT5_Project/GB_ZM_8/APPWindow.py @@ -0,0 +1,640 @@ +# This Python file uses the following encoding: utf-8 +import sys +import time +from PyQt5.QtWidgets import QWidget, QLineEdit +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QWidget, QLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +from PyQt5 import uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent +from PyQt5.QtGui import QImage, QPixmap, QColor, QKeySequence +from UIFrameWork import UIFrameWork +from UIFrameWork import * +# 添加当前脚本的父级目录到 sys.path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget +from PyQt5.QtWidgets import QDesktopWidget + +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from print_color import * +from Shared_CODE.get_tip_prop import * + + +# 设置 UI 目录的路径 +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'UI')) + + +# 页面文件,动态构建 UI 文件的路径 +uiFile_P20DeviceList = os.path.join(ui_path, "P20DeviceList.ui") +uiFile_P21DeviceMenu = os.path.join(ui_path, "P21DeviceMenu.ui") +uiFile_P22DataView = os.path.join(ui_path, "P22DataView.ui") +uiFile_P23SwitchAction = os.path.join(ui_path, "P23SwitchAction.ui") +uiFile_P24ParamSet = os.path.join(ui_path, "P24ParamSet.ui") +uiFile_P25CameraView = os.path.join(ui_path, "P25CameraView.ui") +uiFile_P26FaultQuery = os.path.join(ui_path, "P26FaultQuery.ui") +uiFile_P27SystemSet = os.path.join(ui_path, "P27SystemSet.ui") +uiFile_P28FieldTestAction = os.path.join(ui_path, "P28FieldTestAction.ui") +uiFile_P11LightDeviceMenu = os.path.join(ui_path, "P11LightDeviceMenu.ui") +uiFile_P12LightDataView = os.path.join(ui_path, "P12LightDataView.ui") +uiFile_P13LightSwitchAction = os.path.join(ui_path, "P13LightSwitchAction.ui") +uiFile_P14LightParamSet = os.path.join(ui_path, "P14LightParamSet.ui") +uiFile_P16LightFaultQuery = os.path.join(ui_path, "P16LightFaultQuery.ui") +uiFile_P17LightSystemSet = os.path.join(ui_path, "P17LightSystemSet.ui") +uiFile_P18LightFieldTestAction = os.path.join(ui_path, "P18LightFieldTestAction.ui") + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#ECECEC").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() + +COLOR_VALUE_NORMAL_YELLOW = QColor("#F8C822").name() +COLOR_VALUE_NORMAL_BLUE = QColor("#4E76D4").name() +COLOR_VALUE_NORMAL_READ = QColor("#CE5D62").name() +COLOR_VALUE_NORMAL_GREEN = QColor("#83BF6E").name() + + + +def get_camera_id_and_canvas_id(action : str) : + camera_id = -1 + canvas_id = -1 + if "canvas" in action and "camera" in action : + action_splits = action.split("_") + for action_split_str in action_splits: + if "camera" in action_split_str: + camera_id = get_value_from_lead_value_str(action_split_str, "camera", -1) + elif "canvas" in action_split_str: + canvas_id = get_value_from_lead_value_str(action_split_str, "canvas", -1) + return camera_id, canvas_id + + +#根据回路选择摄像头url地址 +def search_camera_url(camera_id : int) : + cameral_url = None + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_camera_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_camera_id == camera_id : + cameral_url = utils.dict_or_object_get_attr(item_dict, "camera_url", None) + if cameral_url != None : + return cameral_url + return cameral_url + +menu_page_widget_list = [] + +class PageTemplate(UIFrameWork): # 页面模板类,包含各子页面公用功能 + def __init__(self, parent_window): # + UIFrameWork.__init__(self) # + self.parent_window : APPWindow = parent_window + + def connect_matched_camera_canvas(self) : + page_widget : UIFrameWork = self.parent_window.stack.currentWidget() + if page_widget != None : + for canvas_id in range(9) : + camera_id , face_detect = page_widget.get_canvas_prop(canvas_id) + if camera_id >= 0 : + self.parent_window.connect_camera_to_canvas(page_widget, camera_id, canvas_id, face_detect) + + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.parent_window.camera_thread_list) : + face_detect = 0 + canvas_object = self.search_canvas_object(canvas_id) + if canvas_object != None : + face_detect = get_tip_face_detection(canvas_object.statusTip()) + + camera_thread : CameraThread = self.parent_window.camera_thread_list[camera_id] + if camera_thread != None : + if not camera_thread.is_emit and is_visible: + self.show_camera_error(camera_id) + + if camera_thread.is_emit: + self.connect_camera_thread(camera_thread, canvas_id, is_visible) + self.parent_window.camera_signal.emit(camera_id) + camera_thread.face_detection = face_detect + + if hasattr(self, "CameraChioceLabel") : + # self.CameraChioceLabel.setStyleSheet("color: rgb(255, 255, 255); font-size: 50px;") + self.CameraChioceLabel.setText("回路" + str(camera_id+1)) + else: + self.show_camera_error(camera_id) + + def show_camera_error(self, camera_id) : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", f"视频流{camera_id+1}无法初始化或失去连接!") + + #定义虚函数, 进入页面时调用 + def virtual_on_page_enter(self) : + pass + + #定义虚函数, 退出页面时调用 + def virtual_on_page_leave(self) : + pass + + #重载虚函数, 切换页面时调用 + def virtual_change_to_page(self, page) : + if self.parent_window == None : + return + + self_page_widget : PageTemplate = self.parent_window.stack.currentWidget() + if self_page_widget == None : + return + + target_page_widget : PageTemplate = None + + if page >= 0 : + target_page_widget = self.parent_window.search_page_widget(page) + if target_page_widget in menu_page_widget_list: + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == None or pop_page_widget == target_page_widget: + break + else : + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == self : + continue + else : + target_page_widget = pop_page_widget + break + + if target_page_widget == None : + target_page_widget = self.parent_window.allpages_list[0] + + if target_page_widget != None : + menu_page_widget_list.append(target_page_widget) + self_page_widget.virtual_on_page_leave() + self.parent_window.stack.setCurrentWidget(target_page_widget) + target_page_widget.virtual_on_page_enter() + self.connect_matched_camera_canvas() + + def virtual_widget_action_process(self, widget : QWidget, action : str) : + action_splits = action.split("+") + page_id = -1 + circuit_id = -1 + main_index = -1 + add_circuit = -1 + binding_circuit = -1 + for action_split_str in action_splits : + if "SetPage" in action_split_str : + page_id = get_value_from_lead_value_str(action_split_str, "SetPage", -1) + elif "SetCircuit" in action_split_str : + circuit_id = get_value_from_lead_value_str(action_split_str, "SetCircuit", -1) + elif "SetMain" in action_split_str: + main_index = get_value_from_lead_value_str(action_split_str, "SetMain", -1) + elif "AddCircuit" in action_split_str : + add_circuit = get_value_from_lead_value_str(action_split_str, "AddCircuit", -1) + elif "SetBinding" in action_split_str : + binding_circuit = get_value_from_lead_value_str(action_split_str, "SetBinding", 1) + + + print("@Line:",inspect.currentframe().f_lineno,' = ',circuit_id,' = ',action_splits) + + if add_circuit >= 0 : + tip_str : str = page_widget.statusTip() + circuit_id = get_tip_circuit(tip_str) + circuit_id = circuit_id + 1 + + if binding_circuit > 0 : + circuit_id = self.get_circuit_from_object(widget) + + target_page_widget = self.parent_window.search_page_widget(page_id) + page_widget : PageTemplate = target_page_widget + + if page_id >= 0 : # 功能标记:执行页面跳转功能 + target_page_widget = self.parent_window.search_page_widget(page_id) + + if target_page_widget != None : + if circuit_id >= 0 : + target_page_widget.set_page_circuit(circuit_id) + self.virtual_change_to_page(page_id) + + if main_index >= 0 : # 功能标记:执行控件主索引设定 + self.set_menu_main_index(main_index) # 设置页面主索引字段
,可以跨组选择控件 + + if circuit_id >= 0 : + indicator : QLineEdit = target_page_widget.findChild(QLineEdit,"BindNum_Title") + indicator.setText("当前回路为 %d"%(circuit_id + 1)) + + # 显示提示图标 + indicator_Label : QLabel = target_page_widget.findChild(QLabel,"indicator_Label") + tip_str : str = indicator_Label.statusTip() + imag_file_name = get_imag_value_file_name(tip_str, circuit_id) + if imag_file_name != None : + self.modify_object_style_sheet(indicator_Label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(indicator_Label) + + camera_id, canvas_id = get_camera_id_and_canvas_id(action) + self.virtual_connect_canvas_to_camera(canvas_id, camera_id) + +#P20设备列表页面 +class QDeviceListPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P20DeviceList) + + +#P21设备列表页面 +class QDeviceMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P21DeviceMenu) + +#P22数据查看页面 +class QDataViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P22DataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P23开关操作页面 +class QSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P23SwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P24参数设置页面 +class QParamSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P24ParamSet) + + + +#P25视频查看页面 QFaultQueryPage +class QCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P25CameraView) + + def virtual_on_page_enter(self) : + self.parent_window.camera_signal.emit(0) + +#P26故障查询页面 QFaultQueryPage +class QFaultQueryPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P26FaultQuery) + self.alarm_index = 0 + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +#P27系统参数设置页面 +class QSystemSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P27SystemSet) + +#P28现场试验页面 +class QFieldTestAction(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P28FieldTestAction) + +# P11照明菜单选择 +class QLightMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P11LightDeviceMenu) + +# P12照明运行数据页面 +class QRunDataPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P12LightDataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P13照明开关操作页面 +class QLightSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P13LightSwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P14照明参数设置页面 +class QLightParamSetPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P14LightParamSet) + +# P16照明故障查询 +class QLightFaultQuery(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P16LightFaultQuery) + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +# P17照明系统参数 +class QLightSystemSet(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P17LightSystemSet) + +# P18现场试验页面 +class QLightFieldTestAction(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P18LightFieldTestAction) + +class APPWindow(QMainWindow): + camera_signal = pyqtSignal(int) + def __init__(self): + super().__init__() + + # 获取屏幕分辨率 + screen = QDesktopWidget().screenGeometry() + screen_width = screen.width() + screen_height = screen.height() + + self.stack = QStackedWidget(self) + self.setGeometry(0, 0, screen_width, screen_height) # 设置窗口大小为屏幕分辨率 + self.stack.setGeometry(0, 0, screen_width, screen_height) # 设置堆叠窗口大小为屏幕分辨率 + + #调试的时候用下面两行,全屏就注释 + # self.setGeometry(0, 0, 1024, 768) + # self.stack.setGeometry(0, 0, 1024, 768) + + + + self.showFullScreen() + + self.menu_sequence_list : PageTemplate = [] + self.camera_thread_list : CameraThread = [None, None, None, None, None, None, None, None, None] + self.allpages_list : PageTemplate = [] + + self.P20_DeviceList : PageTemplate = QDeviceListPage(parent_window = self) + self.P21_DeviceMenu : PageTemplate = QDeviceMenuPage(parent_window = self) + self.P22_DataView : PageTemplate = QDataViewPage(parent_window = self) + self.P23_SwitchAction : PageTemplate = QSwitchActionPage(parent_window = self) + self.P24_ParamSet : PageTemplate = QParamSetPage(parent_window = self) + self.P25_CameraView : PageTemplate = QCameraViewPage(parent_window = self) + self.P26_FaultQuery : PageTemplate = QFaultQueryPage(parent_window = self) + self.P27_SystemSet : PageTemplate = QSystemSetPage(parent_window = self) + self.P28_FieldTestAction : PageTemplate = QFieldTestAction(parent_window = self) + self.P11_DeviceMenu : PageTemplate = QLightMenuPage(parent_window = self) + self.P12_DateView : PageTemplate = QRunDataPage(parent_window = self) + self.P13_SwitchAction : PageTemplate = QLightSwitchActionPage(parent_window = self) + self.P14_ParamSet : PageTemplate = QLightParamSetPage(parent_window = self) + self.P16_LightFaultQuery : PageTemplate = QLightFaultQuery(parent_window = self) + self.P17_LightSystemSet : PageTemplate = QLightSystemSet(parent_window = self) + self.P18_LightFieldTestAction : PageTemplate = QLightFieldTestAction(parent_window = self) + + self.allpages_list.append(self.P20_DeviceList) + self.allpages_list.append(self.P21_DeviceMenu) + self.allpages_list.append(self.P22_DataView) + self.allpages_list.append(self.P23_SwitchAction) + self.allpages_list.append(self.P24_ParamSet) + self.allpages_list.append(self.P25_CameraView) + self.allpages_list.append(self.P26_FaultQuery) + self.allpages_list.append(self.P27_SystemSet) + self.allpages_list.append(self.P28_FieldTestAction) + self.allpages_list.append(self.P11_DeviceMenu) + self.allpages_list.append(self.P12_DateView) + self.allpages_list.append(self.P13_SwitchAction) + self.allpages_list.append(self.P14_ParamSet) + self.allpages_list.append(self.P16_LightFaultQuery) + self.allpages_list.append(self.P17_LightSystemSet) + self.allpages_list.append(self.P18_LightFieldTestAction) + + self.stack.addWidget(self.P20_DeviceList) + self.stack.addWidget(self.P21_DeviceMenu) + self.stack.addWidget(self.P22_DataView) + self.stack.addWidget(self.P23_SwitchAction) + self.stack.addWidget(self.P24_ParamSet) + self.stack.addWidget(self.P25_CameraView) + self.stack.addWidget(self.P26_FaultQuery) + self.stack.addWidget(self.P27_SystemSet) + self.stack.addWidget(self.P28_FieldTestAction) + self.stack.addWidget(self.P11_DeviceMenu) + self.stack.addWidget(self.P12_DateView) + self.stack.addWidget(self.P13_SwitchAction) + self.stack.addWidget(self.P14_ParamSet) + self.stack.addWidget(self.P16_LightFaultQuery) + self.stack.addWidget(self.P17_LightSystemSet) + self.stack.addWidget(self.P18_LightFieldTestAction) + + test_init = system_parameter() + set_screen_blanking_time(test_init.get_screen_blanking_time()) + + + def search_page_widget(self, page) : + for list_item in self.allpages_list: + window_page : UIFrameWork = list_item + if window_page.page == page : + return window_page + return None + + def connect_camera_to_canvas(self, page_widget : UIFrameWork, camera_id: int , canvas_id : int, face_detect : int = 0) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.camera_thread_list) : + camera_thread : CameraThread = self.camera_thread_list[camera_id] + if camera_thread != None : + page_widget.connect_camera_thread(camera_thread, canvas_id) + camera_thread.face_detection = face_detect + + def create_all_camera_thread(self) : + for camera_id in range(len(self.camera_thread_list)) : + _camera_url = search_camera_url(camera_id) + if _camera_url != None : + camera_thread = CameraThread(_camera_url, camera_id) + camera_thread.set_video_cycle_ms(10) + self.camera_thread_list[camera_id] = camera_thread + self.camera_signal.connect(camera_thread.change_camera_url) + + #摄像头与 界面进行绑定 + for index in range(self.stack.count()) : + page_widget : UIFrameWork = self.stack.widget(index) + page_widget.connect_matched_camera_canvas() + + time.sleep(0.1) + + #开启多个摄像头线程 + for camera_thread in self.camera_thread_list: + thread_to_start : CameraThread = camera_thread + if thread_to_start != None : + thread_to_start.start() + time.sleep(0.01) + + + def get_page_currentwidget(self) : + return self.stack.currentWidget().sort_menu_list[self.stack.currentWidget().menu_key_index][1] + + def closeEvent(self, event): + # 在这里处理关闭事件 + # 例如,提示用户是否真的想要关闭 + reply = QMessageBox.question(self, '确认', '确定要退出吗?', + QMessageBox.Yes | QMessageBox.No) + if reply == QMessageBox.Yes: + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.close() + + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.wait() + + event.accept() # 接受关闭事件 + else: + event.ignore() # 忽略关闭事件 + + +if __name__ == '__main__': + #创建mqtt线程 + fvalue = float('06.00') + value = round(fvalue) + + _user_name = utils.dict_or_object_get_attr(group_config.mqtt_server, "user_name", "admin") + _password = utils.dict_or_object_get_attr(group_config.mqtt_server, "password", "admin") + _server = utils.dict_or_object_get_attr(group_config.mqtt_server, "remote", "127.0.0.1") + _port = utils.dict_or_object_get_attr(group_config.mqtt_server, "port", 1883) + + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = _server, port = _port, keep_alive = 60, user_name=_user_name, password=_password) + + app = QApplication([]) + app_main_window = APPWindow() + app_main_window.show() + app_main_window.create_all_camera_thread() + + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name != None : + global_mqtt_thread.add_unique_object(circuit_unique_name, app_main_window.allpages_list) + + global_mqtt_thread.start() + app.exec_() + global_mqtt_thread.close() + global_mqtt_thread.join() + + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_CameraView.png b/QT5_Project/GB_ZM_8/GB_image/GB_CameraView.png new file mode 100644 index 0000000..13dfb76 Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_CameraView.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_DataView.png b/QT5_Project/GB_ZM_8/GB_image/GB_DataView.png new file mode 100644 index 0000000..11926e4 Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_DataView.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_DeviceList.png b/QT5_Project/GB_ZM_8/GB_image/GB_DeviceList.png new file mode 100644 index 0000000..f2b8cab Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_DeviceList.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_DeviceMenu.png b/QT5_Project/GB_ZM_8/GB_image/GB_DeviceMenu.png new file mode 100644 index 0000000..06d1401 Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_DeviceMenu.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_FaultQuery.png b/QT5_Project/GB_ZM_8/GB_image/GB_FaultQuery.png new file mode 100644 index 0000000..85d115e Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_FaultQuery.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_FieldTestAction.png b/QT5_Project/GB_ZM_8/GB_image/GB_FieldTestAction.png new file mode 100644 index 0000000..9228d9c Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_FieldTestAction.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_Paramset.png b/QT5_Project/GB_ZM_8/GB_image/GB_Paramset.png new file mode 100644 index 0000000..e9d2afc Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_Paramset.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_SwitchAction.png b/QT5_Project/GB_ZM_8/GB_image/GB_SwitchAction.png new file mode 100644 index 0000000..073918f Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_SwitchAction.png differ diff --git a/QT5_Project/GB_ZM_8/GB_image/GB_SystemSet.png b/QT5_Project/GB_ZM_8/GB_image/GB_SystemSet.png new file mode 100644 index 0000000..cfdce63 Binary files /dev/null and b/QT5_Project/GB_ZM_8/GB_image/GB_SystemSet.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Light_CameraView.png b/QT5_Project/GB_ZM_8/Light_image/Light_CameraView.png new file mode 100644 index 0000000..66b618a Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Light_CameraView.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Light_DataView.png b/QT5_Project/GB_ZM_8/Light_image/Light_DataView.png new file mode 100644 index 0000000..c96693d Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Light_DataView.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Light_DeviceMenu.png b/QT5_Project/GB_ZM_8/Light_image/Light_DeviceMenu.png new file mode 100644 index 0000000..d287ba9 Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Light_DeviceMenu.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Light_FieldTestAction.png b/QT5_Project/GB_ZM_8/Light_image/Light_FieldTestAction.png new file mode 100644 index 0000000..a7108d5 Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Light_FieldTestAction.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Light_ParamSet.png b/QT5_Project/GB_ZM_8/Light_image/Light_ParamSet.png new file mode 100644 index 0000000..6768524 Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Light_ParamSet.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Light_SystemSet.png b/QT5_Project/GB_ZM_8/Light_image/Light_SystemSet.png new file mode 100644 index 0000000..9b26d6b Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Light_SystemSet.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Ligth_FaultQuery.png b/QT5_Project/GB_ZM_8/Light_image/Ligth_FaultQuery.png new file mode 100644 index 0000000..f983d51 Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Ligth_FaultQuery.png differ diff --git a/QT5_Project/GB_ZM_8/Light_image/Ligth_SwitchAction.png b/QT5_Project/GB_ZM_8/Light_image/Ligth_SwitchAction.png new file mode 100644 index 0000000..4693c9f Binary files /dev/null and b/QT5_Project/GB_ZM_8/Light_image/Ligth_SwitchAction.png differ diff --git a/QT5_Project/GB_ZM_8/UI/P11LightDeviceMenu.ui b/QT5_Project/GB_ZM_8/UI/P11LightDeviceMenu.ui new file mode 100644 index 0000000..f1da380 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P11LightDeviceMenu.ui @@ -0,0 +1,339 @@ + + + P11DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=11 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage12+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage13+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage14+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage17+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage16+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage18+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P12LightDataView.ui b/QT5_Project/GB_ZM_8/UI/P12LightDataView.ui new file mode 100644 index 0000000..3d1180e --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P12LightDataView.ui @@ -0,0 +1,573 @@ + + + P12DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=12 + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + + 340 + 10 + 391 + 16 + + + + cameral_url=canvas1 + + + + + + + + + 750 + 10 + 411 + 16 + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../Light_image/Light_DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 500 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 500 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 575 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 650 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 300 + 574 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 300 + 650 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 517 + 570 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ro, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 525 + 494 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 90 + 120 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + CameralUrlLabel + CameralUrlLabel_2 + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P13LightSwitchAction.ui b/QT5_Project/GB_ZM_8/UI/P13LightSwitchAction.ui new file mode 100644 index 0000000..3d71298 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P13LightSwitchAction.ui @@ -0,0 +1,345 @@ + + + P13SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=13 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_SwitchAction.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 150 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 290 + 180 + 1300 + 781 + + + + + + + main=1 + + + border:none; + + + + + + + + 147 + 490 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 411 + 493 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 500 + 170 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 674 + 493 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 581 + 98 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 940 + 490 + 246 + 84 + + + + Index=7, Action=SetPage11,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + false + + + + 0 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备照明 + + + false + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P14LightParamSet.ui b/QT5_Project/GB_ZM_8/UI/P14LightParamSet.ui new file mode 100644 index 0000000..b620232 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P14LightParamSet.ui @@ -0,0 +1,1734 @@ + + + P14ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=14 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=照明额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=照明短路倍数, Format=%04.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=照明短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIs, Action=Modify, Index=11, Caption=Is 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentIs, Action=Modify, Index=12, Caption=信号Ie Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortIs, Action=Modify, Index=13, Caption=信号短路倍数, Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 825 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=14, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=1, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=2, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=3, Format=%05.1f, Caption=闭锁电阻,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectIsShort, Index=2, Alias=alias_bool, Action=Modify, Caption=信号短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P16LightFaultQuery.ui b/QT5_Project/GB_ZM_8/UI/P16LightFaultQuery.ui new file mode 100644 index 0000000..3ebe32f --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P16LightFaultQuery.ui @@ -0,0 +1,637 @@ + + + P16FaultQuery + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=16 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 51 + 410 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 270 + 410 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 488 + 410 + 85 + 169 + + + + Index=4, Action=SetPage11, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 7 + 149 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 320 + 170 + 421 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 20 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P17LightSystemSet.ui b/QT5_Project/GB_ZM_8/UI/P17LightSystemSet.ui new file mode 100644 index 0000000..49e732f --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P17LightSystemSet.ui @@ -0,0 +1,792 @@ + + + P17SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=17 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 100 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Temperature, Action=Modify, Index=1, Format=%03.0f, Caption=温度设定,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 155 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 210 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 265 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 320 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 375 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 430 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 485 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 540 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=9,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 595 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=10,SelectImag=P4_ParaSelect.png, password,groupend=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_SystemSet.png + + + P07BG + groupBox + groupBox_2 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P18LightFieldTestAction.ui b/QT5_Project/GB_ZM_8/UI/P18LightFieldTestAction.ui new file mode 100644 index 0000000..5b0e8c0 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P18LightFieldTestAction.ui @@ -0,0 +1,345 @@ + + + P18FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=18 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_FieldTestAction.png + + + + + false + + + + 290 + 174 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 280 + 691 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 53 + 243 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 53 + 357 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 400 + 248 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 365 + 135 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 79 + 93 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 400 + 357 + 246 + 84 + + + + Index=5, Action=SetPage11,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 153 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 4 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P20DeviceList.ui b/QT5_Project/GB_ZM_8/UI/P20DeviceList.ui new file mode 100644 index 0000000..d824553 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P20DeviceList.ui @@ -0,0 +1,3176 @@ + + + P00DeviceList + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=0 + + + + + + 0 + -1 + 1920 + 1080 + + + + + + + ../GB_image/GB_DeviceList.png + + + + + + 91 + 97 + 450 + 481 + + + + + + + circuit=0, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=0, Action=SetPage1+SetCircuit0+SetBinding0,SelectImag=IM00_01B.png + + + + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 90 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas0=camera0 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper + m01_SwitchStatus_0 + m03_AlarmMessage_0 + m04_Voltage + m05_Power + m06_Current + m07_Electricity + Ls01 + Ls01_2 + Ls01_3 + Ls01_4 + m03_CarMessage_7 + Video0 + + + + + 546 + 97 + 450 + 481 + + + + + + + circuit=1, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=1, Action=SetPage1+SetCircuit1+SetBinding1,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 100 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas1=camera1 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_2 + m01_SwitchStatus_1 + m03_AlarmMessage_1 + m04_Voltage_2 + m05_Power_2 + m06_Current_2 + m07_Electricity_2 + Ls01_5 + Ls01_6 + Ls01_7 + Ls01_8 + m03_CarMessage_8 + Video0_1 + + + + + 1001 + 97 + 450 + 481 + + + + + + + circuit=2, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=2,Action=SetPage1+SetCircuit2+SetBinding2,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 100 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas2=camera2 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_3 + m01_SwitchStatus_2 + m03_AlarmMessage_2 + m04_Voltage_3 + m05_Power_3 + m06_Current_3 + m07_Electricity_3 + Ls01_9 + Ls01_10 + Ls01_11 + Ls01_12 + m03_CarMessage_9 + Video0_2 + + + + + 1456 + 97 + 450 + 481 + + + + + + + circuit=3, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=3, Action=SetPage1+SetCircuit3+SetBinding3,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 110 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas3=camera3 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_4 + m01_SwitchStatus_3 + m03_AlarmMessage_3 + m04_Voltage_4 + m05_Power_4 + m06_Current_4 + m07_Electricity_4 + Ls01_13 + Ls01_14 + Ls01_15 + Ls01_16 + m03_CarMessage_10 + Video0_3 + + + + + 91 + 583 + 450 + 481 + + + + + + + circuit=4, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=4, Action=SetPage1+SetCircuit4+SetBinding4,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 90 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas4=camera4 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_5 + m01_SwitchStatus_4 + m03_AlarmMessage_4 + m04_Voltage_5 + m05_Power_5 + m06_Current_5 + m07_Electricity_5 + Ls01_17 + Ls01_18 + Ls01_19 + Ls01_20 + m03_CarMessage_11 + Video0_4 + + + + + 546 + 583 + 450 + 481 + + + + + + + circuit=5, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=5, Action=SetPage1+SetCircuit5+SetBinding5,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 100 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas5=camera5 + + + + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_6 + m01_SwitchStatus_5 + m03_AlarmMessage_5 + m04_Voltage_6 + m05_Power_6 + m06_Current_6 + m07_Electricity_6 + Ls01_21 + Ls01_22 + Ls01_23 + Ls01_24 + m03_CarMessage_12 + Video0_5 + + + + + 1001 + 583 + 450 + 481 + + + + + + + circuit=6, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=6, Action=SetPage1+SetCircuit6+SetBinding6,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 100 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas6=camera6 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_7 + m01_SwitchStatus_6 + m03_AlarmMessage_6 + m04_Voltage_7 + m05_Power_7 + m06_Current_7 + m07_Electricity_7 + Ls01_25 + Ls01_26 + Ls01_27 + Ls01_28 + m03_CarMessage_13 + Video0_6 + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 3 + 72 + 144 + + + + Index=7, Action=SetPage5,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 100 + 10 + 431 + 61 + + + + + 15 + + + + + + + border:none; + + + + + + border:none; + + + + + 0 + 10 + 411 + 41 + + + + + Microsoft YaHei UI + 22 + false + false + + + + System=DateTime, Action=ModifySystem, Index=8,main=1,SelectImag=SR_001.png + + + color: rgb(166, 215, 236); +font: 22pt "Microsoft YaHei UI"; + + + 2024-5-18 + + + + + + + 1455 + 583 + 450 + 481 + + + + + + + circuit=7, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=7, Action=SetPage11+SetCircuit7+SetBinding7,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 110 + 70 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P21DeviceMenu.ui b/QT5_Project/GB_ZM_8/UI/P21DeviceMenu.ui new file mode 100644 index 0000000..11df782 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P21DeviceMenu.ui @@ -0,0 +1,339 @@ + + + P01DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=1 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage2+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage3+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage4+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage7+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage6+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage8+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P22DataView.ui b/QT5_Project/GB_ZM_8/UI/P22DataView.ui new file mode 100644 index 0000000..6a772c2 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P22DataView.ui @@ -0,0 +1,1033 @@ + + + P02DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=2 + + + + + PreferDefaultHinting + + + + + + + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + true + + + + 0 + 0 + 1920 + 1080 + + + + + false + PreferDefaultHinting + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../GB_image/GB_DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + PreferDefaultHinting + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 276 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 277 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 330 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 385 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 440 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Io, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 300 + 330 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 300 + 386 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 300 + 440 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Uo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 274 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 331 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 388 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 442 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosf, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 497 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + R, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 290 + 496 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=AngleUoIo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 525 + 494 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 100 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Aup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 310 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 520 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 100 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Adown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 310 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bdown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 520 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cdown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 170 + 70 + 262 + 131 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + true + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + PreferDefaultHinting + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P23SwitchAction.ui b/QT5_Project/GB_ZM_8/UI/P23SwitchAction.ui new file mode 100644 index 0000000..856ca79 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P23SwitchAction.ui @@ -0,0 +1,434 @@ + + + P03SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=3 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_SwitchAction.png + + + + + false + + + + 295 + 190 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 374 + 189 + 1141 + 811 + + + + + + + main=1 + + + border:none; + + + + + + + + 47 + 458 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 47 + 557 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 473 + 559 + 246 + 84 + + + + CarRetreat,Index=6,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 473 + 460 + 246 + 84 + + + + CarForward,Index=5,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 47 + 657 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 150 + 90 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 650 + 125 + 441 + 241 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::Box + + + + + + + + + 842 + 461 + 246 + 84 + + + + Index=7, Action=SetPage1,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + + 690 + 81 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + + + + 100 + 180 + 262 + 131 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + true + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P24ParamSet.ui b/QT5_Project/GB_ZM_8/UI/P24ParamSet.ui new file mode 100644 index 0000000..3b0772e --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P24ParamSet.ui @@ -0,0 +1,2017 @@ + + + P04ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=4 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=短路倍数, Format=%04.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIa, Action=Modify, Index=11, Caption=Ia 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIb, Action=Modify, Index=12, Caption=Ib 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIc, Action=Modify, Index=13, Caption=Ic 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 825 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=14, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayUnderVoltage, Action=Modify, Index=6, Format=%04.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 262 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GB.Io, Index=1, Action=Modify,Format=%05.1f,Caption=零序电流, Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GB.Uo, Index=2, Action=Modify,Format=%04.0f,Caption=零序电压, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=3, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=4, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayInsulationMonitor, Action=Modify, Index=6, Format=%03.0f, Caption=绝缘监视延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 439 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayZeroOverVoltage, Action=Modify, Index=7, Format=%04.1f, Caption=零序过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SelectZeroOverVoltage, Action=Modify, Index=8, Caption=零序过压选型, Alias=alias_overvoltage, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUo, Action=Modify, Index=9, Format=%05.1f, Caption=Uo校正,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIo, Action=Modify, Index=10, Format=%05.1f, Caption=Io校正,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 262 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageSelect, Action=Modify, Index=5, Caption=漏电方式, Alias=alias_leakage, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + Qt::NoFocus + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 174 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_Paramset.png + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=3, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=2, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=6, Alias=alias_bool, Action=Modify, Caption=定时间短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=4, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=5, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=7, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=8, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLossVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=失压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=10, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=11, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectMonitor, Index=12, Alias=alias_bool, Action=Modify, Caption=绝缘监视保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_sys_2 + indicator_Label + groupBox_4 + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P25CameraView.ui b/QT5_Project/GB_ZM_8/UI/P25CameraView.ui new file mode 100644 index 0000000..c587028 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P25CameraView.ui @@ -0,0 +1,656 @@ + + + P05CameraView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=5 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_CameraView.png + + + + + + 0 + 100 + 85 + 960 + + + + + + + + + + border:none; + + + + + + + + 8 + 2 + 72 + 144 + + + + Index=9, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 380 + 124 + 1165 + 720 + + + + canvas0=camera0, Timeout=5000 + + + TextLabel + + + + + + 200 + 120 + 111 + 41 + + + + + 黑体 + -1 + + + + color: rgb(177, 229, 252); font-size: 35px; + + + 回路1 + + + Qt::AlignCenter + + + + + + 90 + 890 + 1821 + 171 + + + + + + + + + + border:none; + + + + + + + + 236 + 5 + 220 + 159 + + + + Index=2, Action=canvas0_camera1, SelectImag=IM05_A2.png + + + + + + + + + + 450 + 876 + + + + + + + 10 + 5 + 220 + 159 + + + + Index=1, Action=canvas0_camera0, SelectImag=IM05_A1.png + + + + + + + + + + 450 + 876 + + + + + + + 462 + 5 + 220 + 159 + + + + Index=3, Action=canvas0_camera2, SelectImag=IM05_A3.png + + + + + + + + + + 450 + 876 + + + + + + + 688 + 5 + 220 + 159 + + + + Index=4, Action=canvas0_camera3, SelectImag=IM05_A4.png + + + + + + + + + + 450 + 876 + + + + + + + 914 + 5 + 220 + 159 + + + + Index=5, Action=canvas0_camera4, SelectImag=IM05_A5.png + + + + + + + + + + 450 + 876 + + + + + + + 1140 + 5 + 220 + 159 + + + + Index=6, Action=canvas0_camera5, SelectImag=IM05_A6.png + + + + + + + + + + 450 + 876 + + + + + + + 1366 + 5 + 220 + 159 + + + + Index=7, Action=canvas0_camera6, SelectImag=IM05_A7.png + + + + + + + + + + 450 + 876 + + + + + + + 1592 + 5 + 220 + 159 + + + + Index=8, Action=canvas0_camera7, SelectImag=IM05_A8.png + + + + + + + + + + 450 + 876 + + + + + + + 12 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas1=camera0, Timeout=5000 + + + + + + QFrame::NoFrame + + + + + + Qt::AutoText + + + background/IM05_002.png + + + false + + + Qt::AlignCenter + + + + + + 238 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas2=camera1, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 464 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas3=camera2, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 690 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas4=camera3, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 916 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas5=camera4, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 1142 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas6=camera5, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 1368 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas7=camera6, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 1594 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas8=camera7, Timeout=5000 + + + + + + background/IM05_002.png + + + Canvas08 + Canvas07 + Canvas06 + Canvas05 + Canvas04 + Canvas03 + Canvas02 + Canvas01 + Btn02 + Btn01 + Btn03 + Btn04 + Btn05 + Btn06 + Btn07 + Btn08 + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P26FaultQuery.ui b/QT5_Project/GB_ZM_8/UI/P26FaultQuery.ui new file mode 100644 index 0000000..a50e9bb --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P26FaultQuery.ui @@ -0,0 +1,708 @@ + + + P06FaultQuery + + + + 0 + 0 + 1920 + 1076 + + + + MainWindow + + + Page=6 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 48 + 412 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 267 + 412 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 485 + 412 + 85 + 169 + + + + Index=4, Action=SetPage1, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 260 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 152 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 330 + 160 + 361 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 30 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P27SystemSet.ui b/QT5_Project/GB_ZM_8/UI/P27SystemSet.ui new file mode 100644 index 0000000..610e684 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P27SystemSet.ui @@ -0,0 +1,897 @@ + + + P07SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=7 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 84 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PowerSelect, Action=Modify, Index=1, Alias=alias_powerselect, Caption=电源选择,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 198 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 253 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 308 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 364 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 418 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 475 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 530 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 585 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CarAlarmDelay, Action=Modify, Index=9, Format=%05.1f, Caption=小车报警延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 640 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + OffVoltageDelay, Action=Modify, Index=10, Format=%06.1f, Caption=断电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 698 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 754 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=14,SelectImag=P4_ParaSelect.png, password,groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + 270 + 138 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PowerCalculation, Action=Modify, Index=1, Alias=alias_powercalculation, Caption=功率计算,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 25 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_SystemSet.png + + + P07BG + groupBox_2 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/GB_ZM_8/UI/P28FieldTestAction.ui b/QT5_Project/GB_ZM_8/UI/P28FieldTestAction.ui new file mode 100644 index 0000000..42bce09 --- /dev/null +++ b/QT5_Project/GB_ZM_8/UI/P28FieldTestAction.ui @@ -0,0 +1,345 @@ + + + P08FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=08 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../GB_image/GB_FieldTestAction.png + + + + + false + + + + 290 + 174 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 280 + 691 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 47 + 200 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 47 + 310 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 395 + 200 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 360 + 80 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 80 + 40 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 395 + 310 + 246 + 84 + + + + Index=5, Action=SetPage11,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 153 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 4 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/GB_ZM_8/UIFrameWork.py b/QT5_Project/GB_ZM_8/UIFrameWork.py new file mode 100644 index 0000000..aef42bf --- /dev/null +++ b/QT5_Project/GB_ZM_8/UIFrameWork.py @@ -0,0 +1,1584 @@ +# This Python file uses the following encoding: utf-8 +import sys +import os +import time +import inspect +import cv2 +import json +from itertools import chain +from PyQt5 import uic +from PyQt5.QtGui import QImage, QPixmap, QColor,QBrush, QKeySequence, QIcon, QPalette +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent, QSize, QDateTime +from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget, QLayout, QLabel +from PyQt5.QtWidgets import QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from Shared_CODE.DialogModifyValue import DialogModifyValue +from Shared_CODE.DialogModifyAlias import DialogModifyAlias +from Shared_CODE.DialogModifyText import DialogModifyText +from Shared_CODE.DialogInform import DialogInform +from Shared_CODE.get_tip_prop import * +from print_color import * +import time +from PyQt5.QtCore import QDateTime +import re +from datetime import datetime +import platform +import subprocess + + +# sys.path.append(sys.path[0] + "/../..") +# sys_path = sys.path[0].replace("\\", "/") + + +# 设置 img 目录的路径 +img_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'background')) + + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#31D19E").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() +COLOR_VALUE_NORMAL = QColor("#31D19E").name() + +ALIAS_QUERY_NONE = 0 +ALIAS_QUERY_WAIT_RESPOINSE = 1 + + + + +#设置系统时间 + +def is_linux(): + return platform.system() == 'Linux' + +def set_system_time(year, month, day, hour, minute, second): + if is_linux(): + try: + new_time = datetime(year, month, day, hour, minute, second).strftime("%Y-%m-%d %H:%M:%S") + subprocess.run(f'sudo timedatectl set-time "{new_time}"', shell=True, check=True) + print(f"System time updated to {new_time}") + except subprocess.CalledProcessError as e: + print(f"Failed to update system time: {e}") + else: + import ctypes + import ctypes.wintypes + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + TIME_ZONE_ID_DAYLIGHT = 2 + + class SYSTEMTIME(ctypes.Structure): + _fields_ = [ + ("wYear", ctypes.wintypes.WORD), + ("wMonth", ctypes.wintypes.WORD), + ("wDayOfWeek", ctypes.wintypes.WORD), + ("wDay", ctypes.wintypes.WORD), + ("wHour", ctypes.wintypes.WORD), + ("wMinute", ctypes.wintypes.WORD), + ("wSecond", ctypes.wintypes.WORD), + ("wMilliseconds", ctypes.wintypes.WORD), + ] + + system_time = SYSTEMTIME() + ctypes.windll.kernel32.GetSystemTime(ctypes.byref(system_time)) + + system_time.wYear = year + system_time.wMonth = month + system_time.wDay = day + system_time.wHour = hour + system_time.wMinute = minute + system_time.wSecond = second + ctypes.windll.kernel32.SetSystemTime(ctypes.byref(system_time)) + print(f"System time updated to {year}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}") +def set_screen_blanking_time(minutes): + """ + 设置屏幕黑屏时间:param minutes: 屏幕黑屏时间,以分钟为单位 + """ + if is_linux(): + # 如果是 Linux 系统,使用 xfconf-query 命令设置 Xfce 的屏幕黑屏时间 + try: + # Xfce 的屏幕黑屏时间是以秒为单位 + seconds = int(minutes) * 60 + subprocess.run([ + 'xfconf-query', '-c', 'xfce4-power-manager', + '-p', '/xfce4-power-manager/blank-on-ac', + '-s', str(seconds), '-t', 'int', '--create' + ], check=True) + print(f"Xfce屏幕黑屏时间设置为 {minutes} 分钟") + except subprocess.CalledProcessError as e: + print(f"设置Xfce屏幕黑屏时间失败: {e}") + except FileNotFoundError: + print("xfconf-query 命令未找到,请确保已安装 xfce4-power-manager。") + elif platform.system() == 'Windows': + # 如果是 Windows 系统,使用 powercfg 命令设置屏幕黑屏时间 + try: + # 设置交流电源时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-ac', str(minutes)], check=True) + # 设置电池供电时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-dc', str(minutes)], check=True) + print(f"屏幕黑屏时间设置为 {minutes} 分钟 (适用于交流电和电池供电)") + except subprocess.CalledProcessError as e: + print(f"设置屏幕黑屏时间失败: {e}") + else: + print("当前操作系统不支持此操作。") + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + else : + json_dict = json.loads(message) + return json_dict + +def modify_style_sheet(type_name : str, origin_style_sheet : str, lead_str : str, value_str : str) : + if len(value_str) == 0 : + new_style_items = "" + else : + new_style_items = "%s:%s;"%(lead_str, value_str) + style_splits = origin_style_sheet.split("{") + if len(style_splits) == 1 : + style_items_str = style_splits[0] + elif len(style_splits) == 2 : + style_items_str = style_splits[1] + else : + style_items_str = "" + style_items_str = style_items_str.replace("}", "") + + prop_splits = style_items_str.split(";") + for each_style_prop in prop_splits : + if lead_str in each_style_prop : + key_value_splits = each_style_prop.split(":") + cmp_str = key_value_splits[0] + cmp_str = cmp_str.replace(" ", "") + cmp_str = cmp_str.replace("\n", "") + if lead_str == cmp_str : + continue + + if len(each_style_prop) > 0 : + new_style_items += each_style_prop + new_style_items += ";" + + if len(type_name) == 0: + return "%s"%(new_style_items) + else : + return "%s {%s}"%(type_name, new_style_items) + +def get_key_combine_str(str1, str2) : + return str1 + "," + str2 + +def search_circuit_from_topic(topic : str) : + circuit_id = -1 + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name in topic : + circuit_id = config_circuit_id + break + if circuit_id >= 0 : + break + return circuit_id + +def get_imag_value_file_name(tip_str : str, value : int) : + file_name = get_tip_value_str(tip_str, "ImageValue", default_string = None) + try : + if isinstance(value, str) : + fvalue = float(value) + value_id = round(fvalue) + else : + value_id = value + except Exception as e : + return None + + if file_name != None : + file_name_with_value = file_name%(value_id) + imag_value_file_name = os.path.join(img_path, file_name_with_value) + else : + imag_value_file_name = None + + if imag_value_file_name != None : + if os.path.exists(imag_value_file_name) : + return imag_value_file_name.replace("\\", "/") + return None + +def get_imag_file_name(tip_str : str, key_imag : str, default_string = None) : + file_name = get_tip_value_str(tip_str, key_imag, default_string) + select_image_file_name = None + if file_name != None : + select_image_file_name = os.path.join(img_path, file_name) + if os.path.exists(select_image_file_name) : + return select_image_file_name.replace("\\", "/") + return None + +def get_select_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectImag", default_string = None) + +def get_select_icon_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectIcon", default_string = None) + +def get_bk_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageBackGround", default_string = None) + +def get_indicator_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageIndicator", default_string = None) + +def get_compare_index(main_index : int, sub_index : int) : + return (main_index + 1) * 64 + sub_index + +class UIFrameWork(QMainWindow, class_comm_mqtt_interface): + mqtt_signal : pyqtSignal = pyqtSignal(str) + + def __init__(self): + QMainWindow.__init__(self) + self.topic_message_list : list = [] + self.mutex : QMutex = QMutex() + + self.mqtt_signal.connect(self.mqtt_topic_message_process) + self.menu_list = [] + self.sort_menu_list = [] + self.menu_key_index = 0 + self.key_active = 0 + self.select_object : QWidget = None + self.wait_response_list = [] + self.mqtt_thread : class_comm_mqtt_thread= None + + self.mqtt_value_dict = {} + + self.widget_timeout_list = [] + + self.alias_dict = {} + self.alias_query_timer : QTimer = None + + self.alias_query_timer = QTimer() + self.alias_query_timer.timeout.connect(self.process_alias_query) + self.alias_query_timer.start(3000) + + self.video_visible_timer = QTimer() + self.video_visible_timer.timeout.connect(self.video_visible_timeout) + self.video_visible_timer.start(200) + + self.time_timer = QTimer() + self.time_timer.timeout.connect(self.flush_system_cycle) + self.time_timer.start(500) + + self.canvas_visible_arr = [ + False, + False, + False, + False, + False, + False, + False, + False, + False, + ] + + # QLabel list_index CameraThread + # self.canvas_label_list : QLabel = [ [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None] + # ] + # self.set_video_image_func_arr = [self.set_video_image_0, self.set_video_image_1, self.set_video_image_2, self.set_video_image_3, + # self.set_video_image_4, self.set_video_image_5, self.set_video_image_6, self.set_video_image_7, + # self.set_video_image_8 + # ] + + # 使用列表推导式动态生成 canvas_label_list + self.canvas_label_list = [[None, -1, None] for _ in range(9)] + # 使用列表推导式动态生成 set_video_image_func_arr + self.set_video_image_func_arr = [getattr(self, f'set_video_image_{i}') for i in range(9)] + + self.page = -1 + self.select_main_index = -1 + self.exist_circuit_mask = 0 + + self.check_widget_timeout_timer : QTimer = None + + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_0), self, activated=self.key_Test_process0) + QShortcut(QKeySequence(Qt.Key_1), self, activated=self.key_Test_process1) + QShortcut(QKeySequence(Qt.Key_2), self, activated=self.key_Test_process2) + QShortcut(QKeySequence(Qt.Key_3), self, activated=self.key_Test_process3) + self.bind_channel = -1 + + #虚函数, 切换到本页面时调用 + def virtual_on_page_enter(self) : + pass + + #虚函数, 退出到本页面时调用 + def virtual_on_page_leave(self) : + pass + + #虚函数, 切换到页面, 需要在派生类中实现, page=-1表示退出到上一级菜单 + def virtual_change_to_page(self, page) : + pass + + #虚函数, 画布连接到摄像头, 需要在派生类中实现。 + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + pass + + #虚函数, action处理函数, 派生类可以额外处理 + def virtual_widget_action_process(self, widget : QObject, action : str) : + return + + def set_mqtt_value(self, circuit : int, mqtt_name : str, mqtt_value) : + key = f'{circuit}+{mqtt_name}' + self.mqtt_value_dict[key] = mqtt_value + + def get_mqtt_value(self, circuit : int, mqtt_name : str) : + key = f'{circuit}+{mqtt_name}' + if key in self.mqtt_value_dict.keys() : + return self.mqtt_value_dict[key] + return None + + def modify_object_style_sheet(self, object :QWidget, lead_str : str, value_str : str) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.styleSheet() + new_style_sheet = modify_style_sheet(object_type_name, origin_style, lead_str, value_str) + object.setStyleSheet(new_style_sheet) + + def reset_object_style_sheet(self, object :QWidget) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.whatsThis() + object.setStyleSheet(origin_style) + + def load_window_ui(self, file_window_ui : str) : + if os.path.exists(file_window_ui): + uic.loadUi(file_window_ui, self) + self.load_resource_bitmap() + self.create_menu_list() + self.sort_menu_list = sorted(self.menu_list, key=lambda x: x[0]) + self.create_style_sheet_backup() + self.create_timeout_list() + self.create_alias_list() + self.update_window_circuit_mask() + self.exist_circuit_mask = self.get_circuit_mask() + self.check_widget_timeout_timer : QTimer = QTimer() + self.check_widget_timeout_timer.timeout.connect(self.process_widget_timeout_list) + self.check_widget_timeout_timer.start(100) + self.page = get_tip_page(self.statusTip()) + self.menu_selectable_object_flush() + + def get_circuit_mask(self, child_widget : QWidget = None) : + widget :QWidget = child_widget + if widget == None : + widget = self + circuit_id_mask = 0 + + for each_object in widget.children(): + child : QWidget = each_object + if hasattr(child, "statusTip") : + circuit_id = self.get_circuit_from_object(child) + if circuit_id >= 0 : + circuit_id_mask |= (0x01 << circuit_id) + circuit_id_mask |= self.get_circuit_mask(child) + return circuit_id_mask + + def update_window_circuit_mask(self) : + self.exist_circuit_mask = self.get_circuit_mask() + return + + def set_menu_main_index(self, main_index) : + self.main_index = main_index + if len(self.sort_menu_list) == 0 : + return + if self.main_index < 0 : + self.menu_key_index = 0 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + return + menu_key_index = 0 + for each_item in self.sort_menu_list : + compare_index = each_item[0] + if compare_index >= get_compare_index(main_index, 0) : + break + menu_key_index += 1 + self.menu_key_index = menu_key_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def process_alias_query(self): + if not self.mqtt_thread: + return # 如果没有 MQTT 线程,直接返回 + + for alias_unique_name, alias_value_dict in self.alias_dict.items(): # {"xxxxx,sss": 123} + if not isinstance(alias_value_dict, int) or alias_value_dict != ALIAS_QUERY_NONE: + continue # 仅处理需要查询的整数别名 + + alias_name, uniqe_name = alias_unique_name.split(",") + + # 初始化 select_object 变量 + select_object: QWidget = None + + # 将别名的值设置为等待响应状态 + self.alias_dict[alias_unique_name] = ALIAS_QUERY_WAIT_RESPOINSE + + # 发布 MQTT 消息并等待响应 + self.mqtt_publish_and_wait_response( + f"request/alias/{uniqe_name}", + json.dumps({"name": alias_name}), + select_object, + 2000, + False + ) + + def process_widget_timeout_list(self) : + list_index = 0 + for timeout_items in self.widget_timeout_list: + time_limit = timeout_items[0] + cur_time = timeout_items[1] + cur_time += 100 + if cur_time >= time_limit: + cur_time = 0 + timeout_widget : QWidget = timeout_items[2] + if isinstance(timeout_widget, QLineEdit) : + lineedit_widget : QLineEdit = timeout_widget + lineedit_widget.setText("通信超时") + elif isinstance(timeout_widget, QLabel) : + label_widget : QLabel = timeout_widget + if "canvas" in label_widget.statusTip() : + self.camera_signal_timeout(label_widget) + else : + if label_widget.isVisible() : + label_widget.setVisible(False) + #label_widget.hide() + elif isinstance(timeout_widget, QPushButton) : + button_widget : QPushButton = timeout_widget + self.reset_object_style_sheet(button_widget) + button_widget.setText("通信超时") + timeout_items[1] = cur_time + self.widget_timeout_list[list_index] = timeout_items + list_index = list_index + 1 + + def reset_widget_timeout(self, widget : QObject) : + Index = 0 + for timeout_item in self.widget_timeout_list: + cur_time = timeout_item[1] + timeout_widget : QWidget = timeout_item[2] + if timeout_widget == widget : + timeout_item[1] = 0 + self.widget_timeout_list[Index] = timeout_item + break + Index = Index + 1 + + + def connect_camera_thread(self, camera_thread : CameraThread, canvas_id : int = 0, is_visible : bool = True) : + if camera_thread == None or canvas_id < 0: + return + if canvas_id < len(self.set_video_image_func_arr) : + canvas_object : QLabel = self.search_canvas_object(canvas_id) + if canvas_object : + canvas_info_item = self.canvas_label_list[canvas_id] + + origin_camera_thread : CameraThread = canvas_info_item[2] + if origin_camera_thread != None and origin_camera_thread.is_signal_connect: + origin_camera_thread.image_signal.disconnect(self.set_video_image_func_arr[canvas_id]) + + if is_visible : + + camera_thread.signal_connect(self.set_video_image_func_arr[canvas_id]) + + list_index : int = self.get_timeout_List_index(canvas_object) + self.canvas_label_list[canvas_id] = [canvas_object, list_index, camera_thread] + else : + self.canvas_label_list[canvas_id] = [None, -1, None] + + self.canvas_visible_arr[canvas_id] = is_visible + + + + def camera_signal_timeout(self, camera_label : QLabel): + if camera_label != None : + image_path = os.path.join(img_path, 'IM05_002.png') + if os.path.exists(image_path): + image = QPixmap(image_path) + scaled_image = image.scaled(camera_label.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) + camera_label.setPixmap(scaled_image) + + def search_canvas_object(self, canvas_id = 0, child = None) : + widget :QWidget = child + if widget == None : + widget = self + child_count = 0 + for each_object in widget.children(): + child_count += 1 + child : QWidget = each_object + + if hasattr(child, "statusTip") : + tip_str : str = child.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if config_canvas_id >= 0 and config_camera_id >= 0 and config_canvas_id == canvas_id: + if isinstance(child, QLabel) : + return child + + find_canvas_object = self.search_canvas_object(canvas_id, child) + if find_canvas_object != None : + return find_canvas_object + + if child_count == 0 : + return None + + def get_canvas_prop (self, canvas_id : int= 0) : + config_camera_id = -1 + is_face_detect : int = 0 + + canvas_object : QWidget = self.search_canvas_object(canvas_id) + if canvas_object != None : + tip_str : str = canvas_object.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + is_face_detect = get_tip_face_detection(tip_str) + return config_camera_id, is_face_detect + + def load_resource_bitmap(self, child = None) : + widget :QWidget = self + if child != None : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + imag_file_name = get_bk_imag_file_name(tip_str) + if imag_file_name != None : + if isinstance(child_widget, QLabel) : + label_child_object : QLabel = child_widget + label_child_object.setScaledContents(True) + image = QPixmap(imag_file_name) + label_child_object.setPixmap(image) + elif isinstance(child_widget, QWidget) : + file_url = "url(%s)"%(imag_file_name) + self.modify_object_style_sheet(child_widget, "background-image", file_url) + self.load_resource_bitmap(child_widget) + + def create_style_sheet_backup(self, child = None) : + widget :QWidget = child + if child == None : + widget = self + for child_widget in widget.children(): + if hasattr(child_widget, "styleSheet") : + widget : QWidget = child_widget + style_sheet : str = widget.styleSheet() + widget.setWhatsThis(style_sheet) + self.create_style_sheet_backup(child_widget) + + def create_timeout_list(self, child = None) : + widget :QWidget = self + if child == None : + self.widget_timeout_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + timeout_limit_ms = get_tip_timeout(tip_str) + if timeout_limit_ms >= 0: + self.widget_timeout_list.append([timeout_limit_ms, 0, child_widget]) + self.create_timeout_list(child_widget) + + def get_timeout_List_index(self, object : QWidget) : + list_index = -1 + search_list_index = 0 + for items in self.widget_timeout_list : + child_widget : QWidget = items[2] + if child_widget == object : + list_index = search_list_index + break + search_list_index += 1 + return list_index + + def get_page_circuit(self): + if hasattr(self, "statusTip") : + return get_tip_circuit(self.statusTip()) + return -1 + + def set_page_circuit(self, circuit_id = -1) : + if hasattr(self, "statusTip") : + origin_status_tip : str = self.statusTip() + origin_tip_splits = origin_status_tip.split(",") + new_status_tip = "" + for each_str in origin_tip_splits: + if "circuit" not in each_str : + new_status_tip += each_str + new_status_tip += "," + new_status_tip += "circuit=%d"%(circuit_id) + self.setStatusTip(new_status_tip) + self.update_window_circuit_mask() + self.create_alias_list() + self.process_alias_query() + self.para_or_measure_query() + + def create_alias_list(self, child = None) : + widget :QWidget = self + if child == None : + self.alias_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + alias_str = get_tip_alias_str(tip_str) + if alias_str != None: + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None : + key_combine_str = get_key_combine_str(alias_str, unique_name) + if key_combine_str not in self.alias_dict.keys() : + self.alias_dict[key_combine_str] = ALIAS_QUERY_NONE + self.create_alias_list(child_widget) + + def create_menu_list(self, child = None) : + widget :QWidget = self + if child == None : + self.menu_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + sub_index = get_tip_menu_sub_index(tip_str) + if sub_index >= 0: + main_index = self.get_main_index_from_object(child_widget) + if main_index >= 0 : + compare_index = get_compare_index(main_index, sub_index) + else : + compare_index = sub_index + self.menu_list.append([compare_index, child_widget]) + if isinstance(child_widget, QPushButton) : + button : QPushButton = child_widget + button.clicked.connect(self.on_menu_qpush_button_click) + self.create_menu_list(child_widget) + + def on_select_object_action_process(self, select_object : QWidget) : + tip_str = select_object.statusTip() + action_str = get_tip_value_str(tip_str, "Action", None) + if action_str != None : + if "password" in tip_str : + dialog_modify_text = DialogModifyValue(self) + caption_str = "请输入密码:" + dialog_modify_text.update_modify_info("", "0000", caption_str) + input = False + + if dialog_modify_text.exec() == QDialog.Accepted: + input = True + modify_screen_time_str = dialog_modify_text.value + pass_word = system_parameter() + if modify_screen_time_str != pass_word.get_system_password() : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", "密码错误,无法修改!") + return + else: + input = True + if input : + if "CmdExecute" in action_str : + mqtt_name = get_tip_mqtt_name(tip_str) + unique_name = self.get_unique_name_from_object(select_object) + if mqtt_name != None and unique_name != None: + if len(mqtt_name) > 0 and self.mqtt_thread != None: + publish_topic = "request/action/" + unique_name + publish_message = '{"name" : "%s"}'%(mqtt_name) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, select_object, 1000) + elif "ModifySystem" in action_str: + self.on_system_param_modify(tip_str) + elif "Modify" in action_str : + if isinstance(select_object, QLineEdit) : + self.on_line_edit_modify_click(select_object) + + self.virtual_widget_action_process(select_object, action_str) + + def search_menu_match_object(self, object) : + match_object : QWidget = None + menu_index = 0 + for each_list in self.sort_menu_list : + search_object = each_list[1] + if search_object == object : + match_object = search_object + break + menu_index += 1 + return match_object, menu_index + + #刷新屏幕上的系统信息, 例如时间日期之类 + def flush_system_info(self, child = None) : + widget : QWidget= child + if child == None : + widget = self + else : + widget = child + + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + system_str = get_tip_system(tip_str) + + if system_str == "DateTime" : + qdate_time = QDateTime.currentDateTime() + time_str = qdate_time.toString("yyyy-MM-dd hh:mm:ss") + + if isinstance(child_widget, QPushButton) : + button_widget : QPushButton = child_widget + button_widget.setText(time_str) + elif isinstance(child_widget, QLineEdit) : + line_edit_widget : QLineEdit = child_widget + line_edit_widget.setText(time_str) + elif isinstance(child_widget, QLabel) : + label_widget : QLabel = child_widget + label_widget.setText(time_str) + self.flush_system_info(child_widget) + + def func_mqtt_param_modify(self, modify_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/modify/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, modify_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def func_call_back_on_mqtt_param_info(self, info_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/info/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, info_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def on_menu_qpush_button_click(self, sender : QPushButton): + sender : QPushButton = self.sender() + match_object : QWidget = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + self.menu_selectable_object_flush() + if isinstance(match_object, QPushButton) : + self.on_select_object_action_process(match_object) + + #修改系统时间与日期 + def func_modify_system_time(self, modify_str : str) : + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + set_system_time(year, month, day, hour, minute, second) + + return year, month, day, hour, minute, second + return None + + #修改系统黑屏时间 + def func_modify_screen_blanking_time(self, modify_str: str): + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 1: + minutes = int(numbers[0]) + set_screen_blanking_time(minutes) + return minutes + return None + + def on_system_param_modify(self, tip : str) : + system = get_tip_system(tip) + if system == "DateTime" : + dialog_modify_text : DialogModifyText = DialogModifyText(self) + caption_str = "修改系统时间" + cur_time = QDateTime.currentDateTime() + date_time_str = cur_time.toString("yyyy-MM-dd hh:mm:ss") + dialog_modify_text.update_modify_info(date_time_str, caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_date_time_str = dialog_modify_text.value + self.func_modify_system_time(modify_date_time_str) + for circuit_id in range(8) : + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None and self.mqtt_thread != None: + time_message = '{"name" : "SetupTime", "value" : "%s"}'%(modify_date_time_str) + self.mqtt_thread.publish("request/action/" + unique_name, time_message) + dialog_inform = DialogInform(self) + dialog_inform.information("系统时间修改", "系统时间修改成功") + elif system == "ScreenBlankingTime": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改屏幕黑屏时间(分钟)" + sbt = system_parameter() + dialog_modify_text.update_modify_info("", str(sbt.get_screen_blanking_time()), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + result = self.func_modify_screen_blanking_time(modify_screen_time_str) + sbt.change_screen_blanking_time(modify_screen_time_str) + + if result is not None: + self.BlankTimelineEdit.setText(str(result)) + dialog_inform = DialogInform(self) + dialog_inform.information("屏幕黑屏时间修改", "屏幕黑屏时间修改成功") + + elif system == "SystemPassWord": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改系统密码" + pass_word = system_parameter() + dialog_modify_text.update_modify_info("", pass_word.get_system_password(), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + pass_word.set_system_password(modify_screen_time_str) + dialog_inform = DialogInform(self) + dialog_inform.information("系统密码修改", "系统密码修改成功") + def on_line_edit_modify_click(self, sender :QLineEdit) : + match_object : QLineEdit = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + if isinstance(match_object, QLineEdit) : + self.dialog_modify_value = None + tip = match_object.statusTip() + alias_name = get_tip_alias_str(tip) + unique_name = self.get_unique_name_from_object(match_object) + if unique_name != None and alias_name != None : + key_combine_str = get_key_combine_str(alias_name, unique_name) + value_dict = utils.dict_or_object_get_attr(self.alias_dict, key_combine_str, None) + + if isinstance(value_dict, dict) : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + caption_str = get_tip_caption_str(match_object.statusTip()) + value_text = match_object.text() + dialog_modify_alias.set_alias_item_info(value_dict, value_text, caption_str) + self.dialog_modify_alias = dialog_modify_alias + + if dialog_modify_alias.exec() == QDialog.Accepted : + modify_value = dialog_modify_alias.value + self.func_mqtt_param_modify(modify_value) + else : + inform_box : DialogInform = DialogInform() + inform_box.information('别名数据未获取', 'message: %s'%(alias_name)) + else : + dialog_modify_value : DialogModifyValue = DialogModifyValue(self) + caption_str = get_tip_caption_str(match_object.statusTip()) + try : + origin_value = float(match_object.text()) + except Exception as e : + origin_value = None + inform_box : DialogInform = DialogInform() + inform_box.information('无效值', str(e)) + + if origin_value != None : + format_str = get_tip_format(tip) + dialog_modify_value.update_modify_info(format_str, origin_value, caption_str) + if dialog_modify_value.exec() == QDialog.Accepted : + modify_value = dialog_modify_value.value + self.func_mqtt_param_modify(modify_value) + def set_video_image(self, image_object : QObject, canvas_id = 0) : + if canvas_id >= len(self.canvas_label_list) : + return + camera_info_items = self.canvas_label_list[canvas_id] + camera_label: QLabel = camera_info_items[0] + timeout_list_index = camera_info_items[1] + camera_thread : CameraThread = camera_info_items[2] + + if camera_label != None: + shape = image_object.shape + width = shape[1] + height = shape[0] + if camera_label.isVisible() : + + qt_img = QImage(image_object.data, width, height, QImage.Format_RGB888) + + camera_label.setScaledContents(True) + camera_label.setPixmap(QPixmap.fromImage(qt_img)) + + if timeout_list_index >= 0 : + self.widget_timeout_list[timeout_list_index][1] = 0 + + def set_video_image_0(self, image_object : QObject) : + self.set_video_image(image_object, 0) + + def set_video_image_1(self, image_object : QObject) : + self.set_video_image(image_object, 1) + + def set_video_image_2(self, image_object : QObject) : + self.set_video_image(image_object, 2) + + def set_video_image_3(self, image_object : QObject) : + self.set_video_image(image_object, 3) + + def set_video_image_4(self, image_object : QObject) : + self.set_video_image(image_object, 4) + + def set_video_image_5(self, image_object : QObject) : + self.set_video_image(image_object, 5) + + def set_video_image_6(self, image_object : QObject) : + self.set_video_image(image_object, 6) + + def set_video_image_7(self, image_object : QObject) : + self.set_video_image(image_object, 7) + + def set_video_image_8(self, image_object : QObject) : + self.set_video_image(image_object, 8) + + def update_mqtt_value(self, circuit, json_dict) : + for json_key, json_value in json_dict.items() : + self.set_mqtt_value(circuit, json_key, json_value) + + #更新视频显示与否 + def update_canvas_camera_visible(self, child = None) : + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if isinstance(child, QLabel) : + widget_label : QLabel = child + tip_str = widget_label.statusTip() + visible_mqtt = get_tip_visible_mqtt(tip_str, None) + if visible_mqtt != None : + #该Label具有Visible控制, 检查一下是不是视频流 + canvas_id, camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if canvas_id >= 0 and camera_id >= 0 : + circuit_id = self.get_circuit_from_object(widget_label) + visible_value = self.get_mqtt_value(circuit_id, visible_mqtt) + + is_visible = False + if visible_value != None : + try : + is_visible = True if int(visible_value) > 0 else False + except Exception as e : + is_visible = False + + widget_label.setVisible(is_visible) + if is_visible != self.canvas_visible_arr[canvas_id] and canvas_id < len(self.canvas_visible_arr): + self.canvas_visible_arr[canvas_id] = is_visible + self.virtual_connect_canvas_to_camera(canvas_id, camera_id, is_visible) + + self.update_canvas_camera_visible(child) + + def video_visible_timeout(self) : + self.update_canvas_camera_visible() + + #通过json包刷新界面数据 + def flush_widgets(self, circuit, json_dict, child = None): + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if not hasattr(child, "statusTip") : + continue + tip_str : str = child.statusTip() + + mqtt_name = get_tip_mqtt_name(tip_str) + + circuit_id = self.get_circuit_from_object(each_object) + self.flush_widgets(circuit, json_dict, child) + + if circuit_id != circuit : + continue + + if mqtt_name in json_dict.keys() : + value_or_dict = json_dict[mqtt_name] + + if isinstance(value_or_dict, dict) : + value_text = utils.dict_or_object_get_attr(value_or_dict, "value", "") + else : + value_text = value_or_dict + + color_str = utils.dict_or_object_get_attr(value_or_dict, "color", None) + bk_color_str = utils.dict_or_object_get_attr(value_or_dict, "bk_color", None) + + imag_file_name = get_imag_value_file_name(tip_str, value_text) + timeout_ms = get_tip_timeout(tip_str) + if timeout_ms > 0 : + self.reset_widget_timeout(child) + + if isinstance(child, QPushButton) : + widget_button : QPushButton = child + if imag_file_name != None : + self.modify_object_style_sheet(widget_button, "border-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_button) + + if isinstance(child, QLabel) : + widget_label : QLabel = child + if imag_file_name != None : + if widget_label.isVisible() == False : + widget_label.setVisible(True) + self.modify_object_style_sheet(widget_label, "border-image", "url(%s)"%(imag_file_name)) + widget_label.setScaledContents(True) + else : + self.reset_object_style_sheet(widget_label) + widget_label.setText(value_text) + + if isinstance(child, QLineEdit) : + widget_line_edit : QLineEdit = child + alias_name = get_tip_alias_str(widget_line_edit.statusTip()) + unique_name = self.get_unique_name_from_object(widget_line_edit) + + if alias_name != None : + fvalue = float(value_text) + value = round(fvalue) + value_str = str(value) + display_text = "(%s)"%(value_str) + + alias_key_str = get_key_combine_str(alias_name, unique_name) + if alias_key_str in self.alias_dict.keys() : + alias_value_dict = self.alias_dict[alias_key_str] + if isinstance(alias_value_dict, dict) : + display_text = utils.dict_or_object_get_attr(alias_value_dict, value_str, value_text) + else : + display_text = value_text + widget_line_edit.setText(display_text) + + if bk_color_str != None : + if isinstance(child, QLineEdit) : + self.modify_object_style_sheet(child, "background-color", bk_color_str) + if color_str != None : + self.modify_object_style_sheet(child, "color", color_str) + + def get_circuit_from_object(self, object :QWidget) : + parent : QWidget= object + circuit_id = -1 + while parent != None : + if hasattr(parent, "statusTip") : + tip_str = parent.statusTip() + circuit_id = get_tip_circuit(tip_str) + if circuit_id >= 0 or parent == self: + break + parent = parent.parent() + return circuit_id + + def get_main_index_from_object(self, object :QWidget) : + parent : QWidget= object + main_index = -1 + while parent != None : + if not hasattr(parent, "statusTip") : + return -1 + + tip_str = parent.statusTip() + main_index = get_tip_main_index(tip_str) + if main_index >= 0 or parent == self: + break + parent = parent.parent() + return main_index + + def get_unique_name_from_circuit(self, circuit_id : int) : + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_circuit_id == circuit_id : + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + return circuit_unique_name + return None + + def get_unique_name_from_object(self, object :QWidget) : + circuit_id = self.get_circuit_from_object(object) + return self.get_unique_name_from_circuit(circuit_id) + + def key_increase_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_end(tip_str) + + if group_items_count == -1: + next_menu_index = (self.menu_key_index + 1) % menu_count + else: + next_menu_index = (self.menu_key_index - group_items_count + 1) % menu_count + + self.menu_key_index = next_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def key_decrease_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_start(tip_str) + if group_items_count == -1: + prev_menu_index = (self.menu_key_index - 1) % menu_count + else: + prev_menu_index = (self.menu_key_index + group_items_count - 1) % menu_count + + self.menu_key_index = prev_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + + def key_enter_process(self): + menu_count = len(self.sort_menu_list) + if menu_count == 0: + return + + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.on_select_object_action_process(self.select_object) + + def key_escape_process(self): + #在菜单第一项, 按下复位, 退出到上一页 + if self.menu_key_index == 0: + self.virtual_change_to_page(-1) + + menu_count = len(self.sort_menu_list) # 获取当前页面可交互控件个数 + if menu_count == 0: # 若注册可交互控件个数为0,则退出处理,返回 + return + + # 重置菜单选择 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_key_index = 0 + self.menu_selectable_object_flush() + + + def key_Test_process0(self): + json_dict = {"Uab" :"1111", + "Ubc" : "1111", + "Uca" : "1111", + "Uo" : "11" , + "Iab" : "1111", + "Ibc" : "1111", + "Ica" : "1111", + "Io" : "1111", + "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + } + + + self.flush_widgets(0, json_dict) + + def key_Test_process1(self): + json_dict = {"Uab" :"2222", + "Ubc" : "2222", + "Uca" : "2222", + "Uo" : "22" , + "Iab" : "2222", + "Ibc" : "2222", + "Ica" : "2222", + "Io" : "2222", + "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + + + } + self.flush_widgets(1, json_dict) + + def key_Test_process2(self): + json_dict = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + self.flush_widgets(2, json_dict) + + def key_Test_process3(self): + json_dict = {"Uab" :"33333", "Ubc" : "33333", "Uca" : "33333"} + self.flush_widgets(3, json_dict) + + def menu_selectable_object_flush(self) : + menu_count = len(self.sort_menu_list) + for i in range(menu_count): + object : QWidget = self.sort_menu_list[i][1] + is_select_object_draw = False + + if isinstance(object, QPushButton) : + button_object : QPushButton = object + image_file_name = get_select_imag_file_name(object.statusTip()) + image_icon_name = get_select_icon_file_name(object.statusTip()) + + if i == self.menu_key_index: + button_object.setFocus() + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(button_object, "border-image", file_url) + elif image_icon_name != None : + is_select_object_draw = True + button_size : QSize = button_object.size() + button_object.setIcon(QIcon(image_icon_name)) + button_object.setIconSize(button_size) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(button_object) + elif image_icon_name != None : + is_select_object_draw = True + button_object.setIcon(QIcon()) + + elif isinstance(object, QLabel) : + label_object : QLabel = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(label_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(label_object) + + elif isinstance(object, QLineEdit) : + line_object : QLineEdit = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(line_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(line_object) + + + if is_select_object_draw == False : + if i == self.menu_key_index : + self.modify_object_style_sheet(object, "background-color", COLOR_BLUE) + else : + self.reset_object_style_sheet(object) + + def response_topic_message_process(self, topic: str, + message : str, + is_timeout :bool = False, inform : bool = False) : + find_reponse_topic_msg = None + for wait_topic_msg in self.wait_response_list : + if wait_topic_msg[0] == topic : + find_reponse_topic_msg = wait_topic_msg + self.wait_response_list.remove(wait_topic_msg) + break + + if find_reponse_topic_msg == None : + return + + select_object :QWidget = find_reponse_topic_msg[2] + request_message : str = find_reponse_topic_msg[1] + + inform_box : DialogInform = None + if inform : + inform_box : DialogInform = DialogInform() + + try : + json_dict = json_load_message(message) + result = utils.dict_or_object_get_attr(json_dict, "result", 0) + result = int(result) + except Exception as e: + json_dict = None + result = 0 + print_error_msg(str(e) + "invalid json message: %s" % (message)) + + if "response/action" in topic : + if is_timeout : + inform_message = "命令执行超时" + if inform == True: + inform_box.information('命令执行超时', inform_message) + else : + inform_message = '命令执行成功' if result == 1 else '命令执行失败!!!' + if inform == True: + inform_box.information('命令执行', inform_message) + elif "response/param/modify" in topic : + if is_timeout : + inform_message = '参数修改超时' + if inform == True: + inform_box.information('参数修改超时', inform_message) + else : + inform_message = '参数修改成功' if result == 1 else '参数修改失败!!!' + if inform == True: + inform_box.information('参数修改', inform_message) + if result == 1 : + self.para_or_measure_query() + elif "response/alias" in topic : + unique_name = topic.replace("response/alias/", "") + + if is_timeout : + if json_dict != None : + alias_name = None + if "name" in json_dict.keys() : + alias_name = json_dict["name"] + + if alias_name != None : + key_str = get_key_combine_str(alias_name, unique_name) + if key_str in self.alias_dict.keys() : + if isinstance(self.alias_dict[key_str], int) : + self.alias_dict[key_str] = ALIAS_QUERY_NONE + + if inform == True: + inform_box.information('获取别名超时', message) + else : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + if isinstance(json_dict, list): + for item in json_dict: + for alias_key_name, alias_dict in item.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + else: + for alias_key_name, alias_dict in json_dict.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + + def mqtt_topic_message_process(self, msg) : + topic_msg_item = True + while topic_msg_item != None : + self.mutex.lock() + topic_msg_count = len(self.topic_message_list) + if topic_msg_count > 0: + topic_msg_item = self.topic_message_list.pop(0) + else : + topic_msg_item = None + self.mutex.unlock() + if topic_msg_item != None : + topic = topic_msg_item[0] + message = topic_msg_item[1] + try : + json_dict = json_load_message(message) + except Exception as e : + json_dict = None + print_error_msg("invalid json message : %s"%(message)) + if json_dict != None: + if "measure" in topic : + circuit_id = search_circuit_from_topic(topic) + self.update_mqtt_value(circuit_id, json_dict) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.flush_widgets(circuit_id, json_dict) + elif "param/info" in topic: + circuit_id = search_circuit_from_topic(topic) + #print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response/alarm" in topic : + circuit_id = search_circuit_from_topic(topic) + self.flush_alarminfo(circuit_id, json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response" in topic : + self.response_topic_message_process(topic, message, is_timeout = False, inform = True) + + elif "alarm/test" in topic : + circuit_id = search_circuit_from_topic(topic) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + + # 将告警信息刷新到页面 + def flush_alarminfo(self, circuit, json_dict, child = None): + + alarmTitle : QLineEdit = self.findChild(QLineEdit,"alarmTitle") + if alarmTitle != None: + display_title = "%s"%(json_dict["index"]) + alarmTitle.setText(display_title) + + alarmTime : QLineEdit = self.findChild(QLineEdit,"alarmTime") + if alarmTime != None: + display_year = "%s-"%(json_dict["AlarmYear"]) + display_month = "%s-"%(json_dict["AlarmMonth"]) + display_day = "%s"%(json_dict["AlarmDay"]) + display_hour = " %s:"%(json_dict["AlarmHour"]) + display_minute = "%s: "%(json_dict["AlarmMinute"]) + display_second = "%s"%(json_dict["AlarmSecond"]) + + disp_time = display_year + display_month + display_day + display_hour+ display_minute+ display_second + alarmTime.setText(disp_time) + + alarmMsg : QLineEdit = self.findChild(QLineEdit,"alarmMsg") + if alarmMsg != None: + display_msg = "%s"%(json_dict["AlarmCodeMsg"]) + alarmMsg.setText(display_msg) + + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0: + self.mqtt_thread = mqtt_thread + self.mqtt_thread.subscribe("response/#") + self.mqtt_thread.subscribe("param/info/#") + self.mqtt_thread.subscribe("param/modify/#") + self.mqtt_thread.subscribe("measure/#") + self.mqtt_thread.subscribe("status/#") + self.mqtt_thread.subscribe("alarm/#") + self.mqtt_thread.subscribe("response/alarm/#") + self.mqtt_thread.subscribe("action/#") + else : + self.mqtt_thread = None + + def on_message(self, mqtt_thread, topic, message) : + circuit_id = search_circuit_from_topic(topic) + if circuit_id < 0 : + return + if (self.exist_circuit_mask & (0x1 << circuit_id)) == 0 : + return + self.mutex.lock() + if len(self.topic_message_list) < 100 : + self.topic_message_list.append([topic, message]) + self.mutex.unlock() + self.mqtt_signal.emit("Refresh UI") + + def response_topic_messge_timeout(self): + timer = self.sender() + for wait_response_items in self.wait_response_list: + wait_timer : QTimer = wait_response_items[3] + _inform : bool = wait_response_items[4] + + if wait_timer == timer : + topic : str = wait_response_items[0] + message : str = wait_response_items[1] + wait_timer.stop() + self.response_topic_message_process(topic, message, is_timeout=True, inform = _inform) + break + + # def mqtt_publish_and_wait_response(self, publish_topic : str, publish_message : str, select_object : QWidget = None, timeout_ms : int = 1000, inform : bool = True) : + # if self.mqtt_thread != None : + # self.mqtt_thread.publish(publish_topic, publish_message) + + # response_topic = publish_topic.replace("request", "response") + # #开启超时定时器 + # wait_timer = QTimer() + # wait_timer.timeout.connect(self.response_topic_messge_timeout) + # wait_timer.start(timeout_ms) + # self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + def mqtt_publish_and_wait_response(self, publish_topic: str, publish_message: str, select_object: QWidget = None, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda: self.response_topic_message_timeout(response_topic)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def response_topic_message_timeout(self, response_topic): + # 处理超时事件 + for response_info in self.wait_response_list: + if response_info[0] == response_topic: + response_info[3].stop() # 停止定时器 + self.wait_response_list.remove(response_info) + # 在这里添加超时后的处理逻辑,例如通知用户请求超时 + if response_info[4]: # 检查是否需要通知 + self.inform_timeout(response_info) + break + + def inform_timeout(self, response_info): + # 通知用户请求超时的逻辑 + # response_info[2] 是 select_object + # 根据具体需求实现通知逻辑 + print(f"Request for {response_info[1]} on topic {response_info[0]} timed out.") + + def batch_mqtt_publish_and_wait_response(self, publish_list: list, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + for publish_topic, publish_message, select_object in publish_list: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda rt=response_topic: self.response_topic_message_timeout(rt)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + + def para_or_measure_query(self, child = None) : + widget :QWidget = self + if child == None : + self.param_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + if "ScreenBlankingTime" in tip_str : + sbt = system_parameter() + child_widget.setText(sbt.get_screen_blanking_time()) + continue + mqtt_str = get_tip_mqtt_name(tip_str) + if mqtt_str != None and mqtt_str not in self.param_dict.keys(): + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None and self.mqtt_thread != None: + self.mqtt_thread.publish("request/param/info/"+unique_name, '{"name":"%s"}'%mqtt_str) + self.param_dict[mqtt_str] = ALIAS_QUERY_NONE + self.para_or_measure_query(child_widget) + + def flush_system_cycle(self) : + self.flush_system_info() + +if __name__ == '__main__': + + style_sheet = "QLabel {color : RED;\nbackground-color : GREEN;}" + print(style_sheet) + + new_style_items = modify_style_sheet("QLabel", style_sheet, "background-color", "WHITE") + new_style_items = modify_style_sheet("QLabel", new_style_items, "color", "YELLOW") + + print(new_style_items) + sys.exit(0) diff --git a/QT5_Project/GB_ZM_8/__init__.py b/QT5_Project/GB_ZM_8/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/GB_ZM_8/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/GB_ZM_8/background/IM00_01B.png b/QT5_Project/GB_ZM_8/background/IM00_01B.png new file mode 100644 index 0000000..7895e62 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM00_01B.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM00_SwitchStatus_0.png b/QT5_Project/GB_ZM_8/background/IM00_SwitchStatus_0.png new file mode 100644 index 0000000..7af2bc2 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM00_SwitchStatus_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM00_SwitchStatus_1.png b/QT5_Project/GB_ZM_8/background/IM00_SwitchStatus_1.png new file mode 100644 index 0000000..3b8eec3 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM00_SwitchStatus_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM00_SwitchType_0.png b/QT5_Project/GB_ZM_8/background/IM00_SwitchType_0.png new file mode 100644 index 0000000..6d93e04 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM00_SwitchType_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM00_SwitchType_1.png b/QT5_Project/GB_ZM_8/background/IM00_SwitchType_1.png new file mode 100644 index 0000000..bc57853 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM00_SwitchType_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM01_01.png b/QT5_Project/GB_ZM_8/background/IM01_01.png new file mode 100644 index 0000000..ca8ba7b Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM01_01.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM01_0122.png b/QT5_Project/GB_ZM_8/background/IM01_0122.png new file mode 100644 index 0000000..1e0fc04 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM01_0122.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM02_SwitchStatus_0.png b/QT5_Project/GB_ZM_8/background/IM02_SwitchStatus_0.png new file mode 100644 index 0000000..3846172 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM02_SwitchStatus_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM02_SwitchStatus_1.png b/QT5_Project/GB_ZM_8/background/IM02_SwitchStatus_1.png new file mode 100644 index 0000000..a648e14 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM02_SwitchStatus_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM02_SwitchType_0.png b/QT5_Project/GB_ZM_8/background/IM02_SwitchType_0.png new file mode 100644 index 0000000..62cb1a4 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM02_SwitchType_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM02_SwitchType_1.png b/QT5_Project/GB_ZM_8/background/IM02_SwitchType_1.png new file mode 100644 index 0000000..841ccfa Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM02_SwitchType_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM03_001.png b/QT5_Project/GB_ZM_8/background/IM03_001.png new file mode 100644 index 0000000..164c3b2 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM03_001.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM03_SwitchStatus_0.png b/QT5_Project/GB_ZM_8/background/IM03_SwitchStatus_0.png new file mode 100644 index 0000000..f2796ca Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM03_SwitchStatus_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM03_SwitchStatus_1.png b/QT5_Project/GB_ZM_8/background/IM03_SwitchStatus_1.png new file mode 100644 index 0000000..3d469ef Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM03_SwitchStatus_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM04_00.png b/QT5_Project/GB_ZM_8/background/IM04_00.png new file mode 100644 index 0000000..8e19fb2 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM04_00.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_001.png b/QT5_Project/GB_ZM_8/background/IM05_001.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_001.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_002.png b/QT5_Project/GB_ZM_8/background/IM05_002.png new file mode 100644 index 0000000..d1c3db6 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_002.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A1.png b/QT5_Project/GB_ZM_8/background/IM05_A1.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A2.png b/QT5_Project/GB_ZM_8/background/IM05_A2.png new file mode 100644 index 0000000..ca50d84 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A2.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A3.png b/QT5_Project/GB_ZM_8/background/IM05_A3.png new file mode 100644 index 0000000..9462fc6 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A3.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A4.png b/QT5_Project/GB_ZM_8/background/IM05_A4.png new file mode 100644 index 0000000..e4d3b74 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A4.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A5.png b/QT5_Project/GB_ZM_8/background/IM05_A5.png new file mode 100644 index 0000000..85544ac Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A5.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A6.png b/QT5_Project/GB_ZM_8/background/IM05_A6.png new file mode 100644 index 0000000..bff0217 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A6.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A7.png b/QT5_Project/GB_ZM_8/background/IM05_A7.png new file mode 100644 index 0000000..a5832fc Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A7.png differ diff --git a/QT5_Project/GB_ZM_8/background/IM05_A8.png b/QT5_Project/GB_ZM_8/background/IM05_A8.png new file mode 100644 index 0000000..d8ab1f4 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IM05_A8.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_00D.png b/QT5_Project/GB_ZM_8/background/IMxx_00D.png new file mode 100644 index 0000000..b47cc71 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_00D.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_00E.png b/QT5_Project/GB_ZM_8/background/IMxx_00E.png new file mode 100644 index 0000000..f00eef7 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_00E.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_00F.png b/QT5_Project/GB_ZM_8/background/IMxx_00F.png new file mode 100644 index 0000000..28446f1 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_00F.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_0.png b/QT5_Project/GB_ZM_8/background/IMxx_A_0.png new file mode 100644 index 0000000..b2d9427 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_1.png b/QT5_Project/GB_ZM_8/background/IMxx_A_1.png new file mode 100644 index 0000000..02ccba6 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_2.png b/QT5_Project/GB_ZM_8/background/IMxx_A_2.png new file mode 100644 index 0000000..b3c036c Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_2.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_3.png b/QT5_Project/GB_ZM_8/background/IMxx_A_3.png new file mode 100644 index 0000000..4de3901 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_3.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_4.png b/QT5_Project/GB_ZM_8/background/IMxx_A_4.png new file mode 100644 index 0000000..7de2f89 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_4.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_5.png b/QT5_Project/GB_ZM_8/background/IMxx_A_5.png new file mode 100644 index 0000000..1c3cd15 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_5.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_6.png b/QT5_Project/GB_ZM_8/background/IMxx_A_6.png new file mode 100644 index 0000000..0f628d3 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_6.png differ diff --git a/QT5_Project/GB_ZM_8/background/IMxx_A_7.png b/QT5_Project/GB_ZM_8/background/IMxx_A_7.png new file mode 100644 index 0000000..003e551 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/IMxx_A_7.png differ diff --git a/QT5_Project/GB_ZM_8/background/P4_ParaSelect.png b/QT5_Project/GB_ZM_8/background/P4_ParaSelect.png new file mode 100644 index 0000000..489633e Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/P4_ParaSelect.png differ diff --git a/QT5_Project/GB_ZM_8/background/P4_ToggleSelect.png b/QT5_Project/GB_ZM_8/background/P4_ToggleSelect.png new file mode 100644 index 0000000..d190adf Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/P4_ToggleSelect.png differ diff --git a/QT5_Project/GB_ZM_8/background/SR_001.png b/QT5_Project/GB_ZM_8/background/SR_001.png new file mode 100644 index 0000000..654c93b Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/SR_001.png differ diff --git a/QT5_Project/GB_ZM_8/background/SwitchStatus_0.png b/QT5_Project/GB_ZM_8/background/SwitchStatus_0.png new file mode 100644 index 0000000..108f3f0 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/SwitchStatus_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/SwitchStatus_1.png b/QT5_Project/GB_ZM_8/background/SwitchStatus_1.png new file mode 100644 index 0000000..25bafe1 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/SwitchStatus_1.png differ diff --git a/QT5_Project/GB_ZM_8/background/SwitchType_0.png b/QT5_Project/GB_ZM_8/background/SwitchType_0.png new file mode 100644 index 0000000..3bf1062 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/SwitchType_0.png differ diff --git a/QT5_Project/GB_ZM_8/background/SwitchType_1.png b/QT5_Project/GB_ZM_8/background/SwitchType_1.png new file mode 100644 index 0000000..700b4f6 Binary files /dev/null and b/QT5_Project/GB_ZM_8/background/SwitchType_1.png differ diff --git a/QT5_Project/GB_ZM_8/image/CameraView.png b/QT5_Project/GB_ZM_8/image/CameraView.png new file mode 100644 index 0000000..de6e64d Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/CameraView.png differ diff --git a/QT5_Project/GB_ZM_8/image/DataView.png b/QT5_Project/GB_ZM_8/image/DataView.png new file mode 100644 index 0000000..fe6abd2 Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/DataView.png differ diff --git a/QT5_Project/GB_ZM_8/image/DeviceList.png b/QT5_Project/GB_ZM_8/image/DeviceList.png new file mode 100644 index 0000000..b9746c6 Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/DeviceList.png differ diff --git a/QT5_Project/GB_ZM_8/image/DeviceMenu.png b/QT5_Project/GB_ZM_8/image/DeviceMenu.png new file mode 100644 index 0000000..e080fbb Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/DeviceMenu.png differ diff --git a/QT5_Project/GB_ZM_8/image/FaultQuery.png b/QT5_Project/GB_ZM_8/image/FaultQuery.png new file mode 100644 index 0000000..5ede260 Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/FaultQuery.png differ diff --git a/QT5_Project/GB_ZM_8/image/FieldTestAction.png b/QT5_Project/GB_ZM_8/image/FieldTestAction.png new file mode 100644 index 0000000..c8fed05 Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/FieldTestAction.png differ diff --git a/QT5_Project/GB_ZM_8/image/ParamSet.png b/QT5_Project/GB_ZM_8/image/ParamSet.png new file mode 100644 index 0000000..feb13ec Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/ParamSet.png differ diff --git a/QT5_Project/GB_ZM_8/image/SwitchAction.png b/QT5_Project/GB_ZM_8/image/SwitchAction.png new file mode 100644 index 0000000..ddc38be Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/SwitchAction.png differ diff --git a/QT5_Project/GB_ZM_8/image/SystemSet.png b/QT5_Project/GB_ZM_8/image/SystemSet.png new file mode 100644 index 0000000..2093ed4 Binary files /dev/null and b/QT5_Project/GB_ZM_8/image/SystemSet.png differ diff --git a/QT5_Project/KD_ZM_6/.vscode/settings.json b/QT5_Project/KD_ZM_6/.vscode/settings.json new file mode 100644 index 0000000..29819fc --- /dev/null +++ b/QT5_Project/KD_ZM_6/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "MicroPython.executeButton": [ + { + "text": "▶", + "tooltip": "Run", + "alignment": "left", + "command": "extension.executeFile", + "priority": 3.5 + } + ], + "MicroPython.syncButton": [ + { + "text": "$(sync)", + "tooltip": "sync", + "alignment": "left", + "command": "extension.execute", + "priority": 4 + } + ] +} \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/APPWindow.py b/QT5_Project/KD_ZM_6/APPWindow.py new file mode 100644 index 0000000..b5cfe8e --- /dev/null +++ b/QT5_Project/KD_ZM_6/APPWindow.py @@ -0,0 +1,788 @@ +# This Python file uses the following encoding: utf-8 +import sys +import time +from PyQt5.QtWidgets import QWidget, QLineEdit +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QWidget, QLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +from PyQt5 import uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent +from PyQt5.QtGui import QImage, QPixmap, QColor, QKeySequence +from PyQt5.QtTest import QTest +from KeyWidget import KetWidget +from UIFrameWork import UIFrameWork +from UIFrameWork import * +from CameraThread import CameraThread +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget +from PyQt5.QtWidgets import QDesktopWidget + +sys.path.append(sys.path[0] + "/../..") +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from print_color import * +from get_tip_prop import * +from PyQt5.QtWidgets import QPushButton + +sys_path = sys.path[0].replace("\\", "/") + +# 页面文件 +uiFile_P00DeviceList = sys_path + "/P00DeviceList.ui" +uiFile_P01DeviceMenu = sys_path + "/P01DeviceMenu.ui" +uiFile_P02DataView = sys_path + "/P02DataView.ui" +uiFile_P03SwitchAction = sys_path + "/P03SwitchAction.ui" +uiFile_P04ParamSet = sys_path + "/P04ParamSet.ui" +uiFile_P05CameraView = sys_path + "/P05CameraView.ui" +uiFile_P06FaultQuery = sys_path + "/P06FaultQuery.ui" +uiFile_P07SystemSet = sys_path + "/P07SystemSet.ui" +uiFile_P08FieldTestAction = sys_path + "/P08FieldTestAction.ui" +uiFile_P11LightDeviceMenu = sys_path + "/P11LightDeviceMenu.ui" +uiFile_P12LightDataView = sys_path + "/P12LightDataView.ui" +uiFile_P13LightSwitchAction = sys_path + "/P13LightSwitchAction.ui" +uiFile_P14LightParamSet = sys_path + "/P14LightParamSet.ui" +uiFile_P16LightFaultQuery = sys_path + "/P16LightFaultQuery.ui" +uiFile_P17LightSystemSet = sys_path + "/P17LightSystemSet.ui" +uiFile_P18LightFieldTestAction = sys_path + "/P18LightFieldTestAction.ui" + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#ECECEC").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() + +COLOR_VALUE_NORMAL_YELLOW = QColor("#F8C822").name() +COLOR_VALUE_NORMAL_BLUE = QColor("#4E76D4").name() +COLOR_VALUE_NORMAL_READ = QColor("#CE5D62").name() +COLOR_VALUE_NORMAL_GREEN = QColor("#83BF6E").name() + + + +def get_camera_id_and_canvas_id(action : str) : + camera_id = -1 + canvas_id = -1 + if "canvas" in action and "camera" in action : + action_splits = action.split("_") + for action_split_str in action_splits: + if "camera" in action_split_str: + camera_id = get_value_from_lead_value_str(action_split_str, "camera", -1) + elif "canvas" in action_split_str: + canvas_id = get_value_from_lead_value_str(action_split_str, "canvas", -1) + return camera_id, canvas_id + + +#根据回路选择摄像头url地址 +def search_camera_url(camera_id : int) : + cameral_url = None + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_camera_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_camera_id == camera_id : + cameral_url = utils.dict_or_object_get_attr(item_dict, "camera_url", None) + if cameral_url != None : + return cameral_url + return cameral_url + +menu_page_widget_list = [] + +class PageTemplate(UIFrameWork): # 页面模板类,包含各子页面公用功能 + def __init__(self, parent_window): # + UIFrameWork.__init__(self) # + self.parent_window : APPWindow = parent_window + + def connect_matched_camera_canvas(self) : + page_widget : UIFrameWork = self.parent_window.stack.currentWidget() + if page_widget != None : + for canvas_id in range(9) : + camera_id , face_detect = page_widget.get_canvas_prop(canvas_id) + if camera_id >= 0 : + self.parent_window.connect_camera_to_canvas(page_widget, camera_id, canvas_id, face_detect) + + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.parent_window.camera_thread_list) : + face_detect = 0 + canvas_object = self.search_canvas_object(canvas_id) + if canvas_object != None : + face_detect = get_tip_face_detection(canvas_object.statusTip()) + + camera_thread : CameraThread = self.parent_window.camera_thread_list[camera_id] + if camera_thread != None : + if not camera_thread.is_emit and is_visible: + self.show_camera_error(camera_id) + + if camera_thread.is_emit: + self.connect_camera_thread(camera_thread, canvas_id, is_visible) + self.parent_window.camera_signal.emit(camera_id) + camera_thread.face_detection = face_detect + + if hasattr(self, "CameraChioceLabel") : + # self.CameraChioceLabel.setStyleSheet("color: rgb(255, 255, 255); font-size: 50px;") + self.CameraChioceLabel.setText("回路" + str(camera_id+1)) + else: + self.show_camera_error(camera_id) + + def show_camera_error(self, camera_id) : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", f"视频流{camera_id+1}无法初始化或失去连接!") + + #定义虚函数, 进入页面时调用 + def virtual_on_page_enter(self) : + pass + + #定义虚函数, 退出页面时调用 + def virtual_on_page_leave(self) : + pass + + #重载虚函数, 切换页面时调用 + def virtual_change_to_page(self, page) : + if self.parent_window == None : + return + + self_page_widget : PageTemplate = self.parent_window.stack.currentWidget() + if self_page_widget == None : + return + + target_page_widget : PageTemplate = None + + if page >= 0 : + target_page_widget = self.parent_window.search_page_widget(page) + if target_page_widget in menu_page_widget_list: + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == None or pop_page_widget == target_page_widget: + break + else : + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == self : + continue + else : + target_page_widget = pop_page_widget + break + + if target_page_widget == None : + target_page_widget = self.parent_window.allpages_list[0] + + if target_page_widget != None : + menu_page_widget_list.append(target_page_widget) + self_page_widget.virtual_on_page_leave() + self.parent_window.stack.setCurrentWidget(target_page_widget) + target_page_widget.virtual_on_page_enter() + self.connect_matched_camera_canvas() + + def virtual_widget_action_process(self, widget : QWidget, action : str) : + action_splits = action.split("+") + page_id = -1 + circuit_id = -1 + main_index = -1 + add_circuit = -1 + binding_circuit = -1 + for action_split_str in action_splits : + if "SetPage" in action_split_str : + page_id = get_value_from_lead_value_str(action_split_str, "SetPage", -1) + elif "SetCircuit" in action_split_str : + circuit_id = get_value_from_lead_value_str(action_split_str, "SetCircuit", -1) + elif "SetMain" in action_split_str: + main_index = get_value_from_lead_value_str(action_split_str, "SetMain", -1) + elif "AddCircuit" in action_split_str : + add_circuit = get_value_from_lead_value_str(action_split_str, "AddCircuit", -1) + elif "SetBinding" in action_split_str : + binding_circuit = get_value_from_lead_value_str(action_split_str, "SetBinding", 1) + + + print("@Line:",inspect.currentframe().f_lineno,' = ',circuit_id,' = ',action_splits) + + if add_circuit >= 0 : + tip_str : str = page_widget.statusTip() + circuit_id = get_tip_circuit(tip_str) + circuit_id = circuit_id + 1 + + if binding_circuit > 0 : + circuit_id = self.get_circuit_from_object(widget) + + target_page_widget = self.parent_window.search_page_widget(page_id) + page_widget : PageTemplate = target_page_widget + + if page_id >= 0 : # 功能标记:执行页面跳转功能 + target_page_widget = self.parent_window.search_page_widget(page_id) + + if target_page_widget != None : + if circuit_id >= 0 : + target_page_widget.set_page_circuit(circuit_id) + self.virtual_change_to_page(page_id) + + if main_index >= 0 : # 功能标记:执行控件主索引设定 + self.set_menu_main_index(main_index) # 设置页面主索引字段
,可以跨组选择控件 + + if circuit_id >= 0 : + indicator : QLineEdit = target_page_widget.findChild(QLineEdit,"BindNum_Title") + indicator.setText("当前回路为 %d"%(circuit_id + 1)) + + # 显示提示图标 + indicator_Label : QLabel = target_page_widget.findChild(QLabel,"indicator_Label") + tip_str : str = indicator_Label.statusTip() + imag_file_name = get_imag_value_file_name(tip_str, circuit_id) + if imag_file_name != None : + self.modify_object_style_sheet(indicator_Label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(indicator_Label) + + camera_id, canvas_id = get_camera_id_and_canvas_id(action) + self.virtual_connect_canvas_to_camera(canvas_id, camera_id) + +#P00设备列表页面 +class QDeviceListPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P00DeviceList) + + # 回路1测试:开关合闸1,总开关0,无报警 + json_dict0 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"无故障","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1143", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"60", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"20", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路2测试:开关合闸1,分开关1,无报警 + json_dict1 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"开关未到位","type" : "alarm","color" : COLOR_ALARM_ERROR_TEXT}, + "Voltage" : {"value" :"1120", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"45", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"46321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路3测试:开关合闸1,总开关0,无报警 + json_dict2 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1065", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"16", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"1321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路4测试:开关合闸1,总开关0,无报警 + json_dict3 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1141", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"32321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路5测试:开关合闸1,总开关0,无报警 + json_dict4 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"2133", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"4453", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路6测试:开关合闸1,总开关0,无报警 + json_dict5 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1212", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"27", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"11212", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路7测试:开关合闸1,总开关0,无报警 + json_dict6 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1564", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"32", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45341", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + # self.flush_widgets(3, json_dict3) + # # self.flush_widgets(4, json_dict4) + # # self.flush_widgets(5, json_dict5) + # # self.flush_widgets(6, json_dict6) + +#P01设备列表页面 +class QDeviceMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P01DeviceMenu) + +#P02数据查看页面 +class QDataViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P02DataView) + + json_dict0 = {"Uab" :"1111", "Ubc" : "1111", "Uca" : "1111", "Uo" : "11" , "Iab" : "1111", "Ibc" : "1111", "Ica" : "1111", "Io" : "1111"} + json_dict1 = {"Uab" :"2222", "Ubc" : "2222", "Uca" : "2222", "Uo" : "22" , "Iab" : "2222", "Ibc" : "2222", "Ica" : "2222", "Io" : "2222"} + json_dict2 = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P03开关操作页面 +class QSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P03SwitchAction) + + json_dict0 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict1 = {"SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict2 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + + self.flush_widgets(0, json_dict0) + self.flush_widgets(1, json_dict1) + self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P04参数设置页面 +class QParamSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P04ParamSet) + + json_dict0 = {"Uab" :"1000", "Ubc" : "5", "Uca" : "50"} + json_dict1 = {"Uab" :"1111", "Ubc" : "111", "Uca" : "111"} + json_dict2 = {"Uab" :"2222", "Ubc" : "222", "Uca" : "222"} + + self.flush_widgets(0, json_dict0) + self.flush_widgets(1, json_dict1) + self.flush_widgets(2, json_dict2) + +#P05视频查看页面 QFaultQueryPage +class QCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P05CameraView) + + def virtual_on_page_enter(self) : + self.parent_window.camera_signal.emit(0) + +#P06故障查询页面 QFaultQueryPage +class QFaultQueryPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P06FaultQuery) + self.alarm_index = 0 + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +#P07系统参数设置页面 +class QSystemSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P07SystemSet) + +#P08现场试验页面 +class QFieldTestAction(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P08FieldTestAction) + +# P11照明菜单选择 +class QLightMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P11LightDeviceMenu) + +# P12照明运行数据页面 +class QRunDataPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P12LightDataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P13照明开关操作页面 +class QLightSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P13LightSwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P14照明参数设置页面 +class QLightParamSetPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P14LightParamSet) + +# P16照明故障查询 +class QLightFaultQuery(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P16LightFaultQuery) + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +# P17照明系统参数 +class QLightSystemSet(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P17LightSystemSet) + +# P18现场试验页面 +class QLightFieldTestAction(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P18LightFieldTestAction) + +class APPWindow(QMainWindow): + camera_signal = pyqtSignal(int) + def __init__(self): + super().__init__() + + # 获取屏幕分辨率 + screen = QDesktopWidget().screenGeometry() + screen_width = screen.width() + screen_height = screen.height() + + self.stack = QStackedWidget(self) + self.setGeometry(0, 0, screen_width, screen_height) # 设置窗口大小为屏幕分辨率 + self.stack.setGeometry(0, 0, screen_width, screen_height) # 设置堆叠窗口大小为屏幕分辨率 + + #调试的时候用下面两行,全屏就注释 + # self.setGeometry(0, 0, 1024, 768) + # self.stack.setGeometry(0, 0, 1024, 768) + + + # self.float_button1 = QPushButton("↑", self) + # self.float_button1.move(self.width() - 200, self.height() - 200) + # self.float_button1.setFixedSize(90, 90) + # self.float_button1.clicked.connect(self.focus_do_inscrease) + + # self.float_button2 = QPushButton("↓", self) + # self.float_button2.move(self.width() - 200, self.height() - 100) + # self.float_button2.setFixedSize(90, 90) + # self.float_button2.clicked.connect(self.focus_do_decrease) + + # self.float_button3 = QPushButton("enter", self) + # self.float_button3.move(self.width() - 100, self.height() - 200) + # self.float_button3.setFixedSize(90, 90) + # self.float_button3.clicked.connect(self.focus_do_action) + + # self.float_button4 = QPushButton("esc", self) + # self.float_button4.move(self.width() - 100, self.height() - 100) + # self.float_button4.setFixedSize(90, 90) + # self.float_button4.clicked.connect(self.focus_do_escape) + + # self.show_hide_button = QPushButton("show/hide", self) + # self.show_hide_button.move(self.width()-10, self.height() - 100) + # self.show_hide_button.setFixedSize(90, 90) + # self.show_hide_button.clicked.connect(self.focus_show_hide) + # self.kw = KetWidget(self) + # self.setLayout(QVBoxLayout()) + # self.layout().addWidget(self.kw) + + self.showFullScreen() + + self.menu_sequence_list : PageTemplate = [] + self.camera_thread_list : CameraThread = [None, None, None, None, None, None, None, None, None] + self.allpages_list : PageTemplate = [] + + self.P00_DeviceList : PageTemplate = QDeviceListPage(parent_window = self) + self.P01_DeviceMenu : PageTemplate = QDeviceMenuPage(parent_window = self) + self.P02_DataView : PageTemplate = QDataViewPage(parent_window = self) + self.P03_SwitchAction : PageTemplate = QSwitchActionPage(parent_window = self) + self.P04_ParamSet : PageTemplate = QParamSetPage(parent_window = self) + self.P05_CameraView : PageTemplate = QCameraViewPage(parent_window = self) + self.P06_FaultQuery : PageTemplate = QFaultQueryPage(parent_window = self) + self.P07_SystemSet : PageTemplate = QSystemSetPage(parent_window = self) + self.P08_FieldTestAction : PageTemplate = QFieldTestAction(parent_window = self) + self.P11_DeviceMenu : PageTemplate = QLightMenuPage(parent_window = self) + self.P12_DateView : PageTemplate = QRunDataPage(parent_window = self) + self.P13_SwitchAction : PageTemplate = QLightSwitchActionPage(parent_window = self) + self.P14_ParamSet : PageTemplate = QLightParamSetPage(parent_window = self) + self.P16_LightFaultQuery : PageTemplate = QLightFaultQuery(parent_window = self) + self.P17_LightSystemSet : PageTemplate = QLightSystemSet(parent_window = self) + self.P18_LightFieldTestAction : PageTemplate = QLightFieldTestAction(parent_window = self) + + self.allpages_list.append(self.P00_DeviceList) + self.allpages_list.append(self.P01_DeviceMenu) + self.allpages_list.append(self.P02_DataView) + self.allpages_list.append(self.P03_SwitchAction) + self.allpages_list.append(self.P04_ParamSet) + self.allpages_list.append(self.P05_CameraView) + self.allpages_list.append(self.P06_FaultQuery) + self.allpages_list.append(self.P07_SystemSet) + self.allpages_list.append(self.P08_FieldTestAction) + self.allpages_list.append(self.P11_DeviceMenu) + self.allpages_list.append(self.P12_DateView) + self.allpages_list.append(self.P13_SwitchAction) + self.allpages_list.append(self.P14_ParamSet) + self.allpages_list.append(self.P16_LightFaultQuery) + self.allpages_list.append(self.P17_LightSystemSet) + self.allpages_list.append(self.P18_LightFieldTestAction) + + self.stack.addWidget(self.P00_DeviceList) + self.stack.addWidget(self.P01_DeviceMenu) + self.stack.addWidget(self.P02_DataView) + self.stack.addWidget(self.P03_SwitchAction) + self.stack.addWidget(self.P04_ParamSet) + self.stack.addWidget(self.P05_CameraView) + self.stack.addWidget(self.P06_FaultQuery) + self.stack.addWidget(self.P07_SystemSet) + self.stack.addWidget(self.P08_FieldTestAction) + self.stack.addWidget(self.P11_DeviceMenu) + self.stack.addWidget(self.P12_DateView) + self.stack.addWidget(self.P13_SwitchAction) + self.stack.addWidget(self.P14_ParamSet) + self.stack.addWidget(self.P16_LightFaultQuery) + self.stack.addWidget(self.P17_LightSystemSet) + self.stack.addWidget(self.P18_LightFieldTestAction) + + test_init = system_parameter() + set_screen_blanking_time(test_init.get_screen_blanking_time()) + + + def search_page_widget(self, page) : + for list_item in self.allpages_list: + window_page : UIFrameWork = list_item + if window_page.page == page : + return window_page + return None + + def connect_camera_to_canvas(self, page_widget : UIFrameWork, camera_id: int , canvas_id : int, face_detect : int = 0) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.camera_thread_list) : + camera_thread : CameraThread = self.camera_thread_list[camera_id] + if camera_thread != None : + page_widget.connect_camera_thread(camera_thread, canvas_id) + camera_thread.face_detection = face_detect + + def create_all_camera_thread(self) : + for camera_id in range(len(self.camera_thread_list)) : + _camera_url = search_camera_url(camera_id) + if _camera_url != None : + camera_thread = CameraThread(_camera_url, camera_id) + camera_thread.set_video_cycle_ms(10) + self.camera_thread_list[camera_id] = camera_thread + self.camera_signal.connect(camera_thread.change_camera_url) + + #摄像头与 界面进行绑定 + for index in range(self.stack.count()) : + page_widget : UIFrameWork = self.stack.widget(index) + page_widget.connect_matched_camera_canvas() + + time.sleep(0.1) + + #开启多个摄像头线程 + for camera_thread in self.camera_thread_list: + thread_to_start : CameraThread = camera_thread + if thread_to_start != None : + thread_to_start.start() + time.sleep(0.01) + + # def focus_do_inscrease(self) : + # self.stack.currentWidget().key_decrease_parameter() + + # def focus_do_decrease(self) : + # self.stack.currentWidget().key_increase_parameter() + + # def focus_do_action(self) : + # self.stack.currentWidget().key_enter_process() + + # def focus_do_escape(self) : + # self.stack.currentWidget().key_escape_process() + + # def focus_show_hide(self) : + # if self.float_button1.isHidden() : + # self.float_button1.show() + # self.float_button2.show() + # self.float_button3.show() + # self.float_button4.show() + # else : + # self.float_button1.hide() + # self.float_button2.hide() + # self.float_button3.hide() + # self.float_button4.hide() + + def get_page_currentwidget(self) : + return self.stack.currentWidget().sort_menu_list[self.stack.currentWidget().menu_key_index][1] + + def closeEvent(self, event): + # 在这里处理关闭事件 + # 例如,提示用户是否真的想要关闭 + reply = QMessageBox.question(self, '确认', '确定要退出吗?', + QMessageBox.Yes | QMessageBox.No) + if reply == QMessageBox.Yes: + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.close() + + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.wait() + + event.accept() # 接受关闭事件 + else: + event.ignore() # 忽略关闭事件 + + +if __name__ == '__main__': + #创建mqtt线程 + fvalue = float('06.00') + value = round(fvalue) + + _user_name = utils.dict_or_object_get_attr(group_config.mqtt_server, "user_name", "admin") + _password = utils.dict_or_object_get_attr(group_config.mqtt_server, "password", "admin") + _server = utils.dict_or_object_get_attr(group_config.mqtt_server, "remote", "127.0.0.1") + _port = utils.dict_or_object_get_attr(group_config.mqtt_server, "port", 1883) + + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = _server, port = _port, keep_alive = 60, user_name=_user_name, password=_password) + + app = QApplication([]) + app_main_window = APPWindow() + app_main_window.show() + app_main_window.create_all_camera_thread() + + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name != None : + global_mqtt_thread.add_unique_object(circuit_unique_name, app_main_window.allpages_list) + + global_mqtt_thread.start() + app.exec_() + global_mqtt_thread.close() + global_mqtt_thread.join() + + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/BG09_001.png b/QT5_Project/KD_ZM_6/BG09_001.png new file mode 100644 index 0000000..c1a185f Binary files /dev/null and b/QT5_Project/KD_ZM_6/BG09_001.png differ diff --git a/QT5_Project/KD_ZM_6/BG09_002.png b/QT5_Project/KD_ZM_6/BG09_002.png new file mode 100644 index 0000000..c4c499d Binary files /dev/null and b/QT5_Project/KD_ZM_6/BG09_002.png differ diff --git a/QT5_Project/KD_ZM_6/BG09_003.png b/QT5_Project/KD_ZM_6/BG09_003.png new file mode 100644 index 0000000..0efe2d9 Binary files /dev/null and b/QT5_Project/KD_ZM_6/BG09_003.png differ diff --git a/QT5_Project/KD_ZM_6/BG09_004.png b/QT5_Project/KD_ZM_6/BG09_004.png new file mode 100644 index 0000000..2dc9ffd Binary files /dev/null and b/QT5_Project/KD_ZM_6/BG09_004.png differ diff --git a/QT5_Project/KD_ZM_6/CameraThread.py b/QT5_Project/KD_ZM_6/CameraThread.py new file mode 100644 index 0000000..bab086b --- /dev/null +++ b/QT5_Project/KD_ZM_6/CameraThread.py @@ -0,0 +1,163 @@ +import sys +import cv2 +import time +from PyQt5.QtCore import QThread, pyqtSignal, QObject + +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys.path[0] + "/../.." +if sys_path_linux not in sys.path: + sys.path.append(sys_path_linux) + +from print_color import * + +DEFAULT_VIDEO_SLEEP_MS = 20 + +# 图像处理线程 +class ImageProcessingThread(QThread): + processed_image_signal = pyqtSignal(object) + + def __init__(self): + super().__init__() + + def run(self): + while True: + # 在这里添加图像处理代码 + # 这里暂时只是将图像传递给下一个线程 + time.sleep(0.01) + self.processed_image_signal.emit(None) + +# 摄像头采集线程 +class CameraThread(QThread): + image_signal = pyqtSignal(object) + + def __init__(self, camera_url, circuit_id: int = 0): + super().__init__() + + self.camera_url = camera_url # 摄像头url地址, 整数 或者 字符串 + self.face_detection: bool = False + + if isinstance(camera_url, int): + self.camera_url_str = str(camera_url) + else: + self.camera_url_str = camera_url + + self.cap: cv2.VideoCapture = None + self.running: bool = True + + self.fps = 0 + + self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS + self.cycle_ms = 0 + self.circuit_id = circuit_id # 摄像头对应的回路, 组合开关每一个回路都有对应的摄像头 + self.is_signal_connect = False + self.is_emit = False + + self.set_video_cycle_ms(2000) + + def signal_connect(self, slot_func): + self.image_signal.connect(slot_func) + self.is_signal_connect = True + + def signal_disconnect(self): + # 判断信号是否已连接 + if self.is_signal_connect: + self.image_signal.disconnect() + self.is_signal_connect = False + + def set_video_cycle_ms(self, cycle_ms: int = 10): + if self.cycle_limit != cycle_ms: + if cycle_ms <= DEFAULT_VIDEO_SLEEP_MS: + self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS + else: + self.cycle_limit = cycle_ms + + # 新建函数,改变函数延时方法 + def change_camera_url(self, camera_url: str): + if self.circuit_id == camera_url: + self.set_video_cycle_ms(DEFAULT_VIDEO_SLEEP_MS) + else: + self.set_video_cycle_ms(1000) + + def close(self): + if self.cap == None: # 初始化一直未完成 + self.terminate() + self.running = False + + def run(self): + process_count = 0 + fps_time = 0 + + while self.running == True: + inform_msg = "cameral init start, url = " + self.camera_url_str + print_inform_msg(inform_msg) + + try: + if isinstance(self.camera_url, int): + # 在 Windows 平台下,使用默认的 cv2.VideoCapture 接口 + self.cap = cv2.VideoCapture(self.camera_url, cv2.CAP_DSHOW) + else: + # 在 Linux 平台下,使用默认的 cv2.VideoCapture 接口 + self.cap = cv2.VideoCapture(self.camera_url) + + if self.cap != None: + inform_msg = "cameral Init Success, url = " + self.camera_url_str + self.is_emit = True + print_inform_msg(inform_msg) + else: + inform_msg = "cameral connection timeout, url = " + self.camera_url_str + print_inform_msg(inform_msg) + + except Exception as e: + self.cap = None + inform_msg = "cameral camera Init Fail, url = " + self.camera_url_str + print_error_msg(inform_msg) + + base_time = time.time() + + while self.running and self.cap != None: + # 延时20ms + time.sleep(DEFAULT_VIDEO_SLEEP_MS / 1000) + if self.cycle_ms + DEFAULT_VIDEO_SLEEP_MS < self.cycle_limit: + self.cycle_ms += DEFAULT_VIDEO_SLEEP_MS + self.cap.grab() # 抛弃多余的帧,保持最新帧 + continue + else: + self.cycle_ms = 0 + + try: + ret, frame = self.cap.read() + cur_time = time.time() + + execution_time = cur_time - base_time + base_time = cur_time + process_count += 1 + + fps_time += execution_time + + if fps_time >= 1: + self.fps = process_count + process_count = 0 + fps_time = 0 + + if execution_time < 5: + image_object: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + self.image_signal.emit(image_object) + else: # 时间差大于5秒, 表示网络可能中断过, 退出并重新连接 + err_message = "cameral read timeout, url = " + self.camera_url_str + print_error_msg(err_message) + break + except Exception as e: + err_message = "cameral read timeout, url = " + self.camera_url_str + self.is_emit = False + print_error_msg(err_message) + if self.running == True: + time.sleep(2) + break + + print_inform_msg("cameral connection End") + time.sleep(0.01) + + if self.cap != None: + self.cap.release() + self.cap = None + diff --git a/QT5_Project/KD_ZM_6/DialogInform.py b/QT5_Project/KD_ZM_6/DialogInform.py new file mode 100644 index 0000000..4e912b2 --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogInform.py @@ -0,0 +1,60 @@ +import sys +from PyQt5.QtWidgets import QApplication, QDialog, QLabel, QLineEdit, QWidget, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject, QTimer + +ui_file_path = sys.path[0] + "/DialogInform.ui" + +class DialogInform(QDialog): + def __init__(self, parent=None): + super(DialogInform, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + label :QLabel = self.label + label.setText("") + label.setWordWrap(True) # 允许文本自动换行 + + + self.message_timer = QTimer() + self.message_timer.timeout.connect(self.close_dialog_timeout) + + self.setWindowTitle("消息提示") + self.setWindowFlag(Qt.FramelessWindowHint) + button_box : QDialogButtonBox = self.buttonBox + button_box.button(QDialogButtonBox.Ok).setText('确定') + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + def information(self, title : str, message : str, timeout_ms : int = 2000) : + self.setWindowTitle(title) + label :QLabel = self.label + label.setText(message) + self.message_timer.start(timeout_ms) + self.exec() + + def key_enter_process(self): + button_box : QDialogButtonBox = self.buttonBox + select_button = button_box.button(QDialogButtonBox.Ok) + if select_button: + select_button.click() + + def key_escape_process(self): + button_box : QDialogButtonBox = self.buttonBox + select_button = button_box.button(QDialogButtonBox.Cancel) + if select_button: + select_button.click() + + #消息超时 + def close_dialog_timeout(self): + self.key_enter_process() + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = DialogInform() + dialog.exec() + sys.exit(0) diff --git a/QT5_Project/KD_ZM_6/DialogInform.ui b/QT5_Project/KD_ZM_6/DialogInform.ui new file mode 100644 index 0000000..d403ef7 --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogInform.ui @@ -0,0 +1,123 @@ + + + DialogInform + + + + 0 + 0 + 587 + 231 + + + + Dialog + + + false + + + border:none; +background-color: rgba(0, 0, 0, 0); + + + + + 110 + 160 + 381 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + 120 + 100 + 361 + 51 + + + + + Microsoft YaHei UI + 14 + false + false + + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); +font: 14pt "Microsoft YaHei UI"; + + + TextLabel + + + Qt::AlignCenter + + + + + + 0 + 0 + 731 + 231 + + + + + + + BG09_002.png + + + BG + buttonBox + label + + + + + buttonBox + accepted() + DialogInform + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogInform + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/KD_ZM_6/DialogModifyAlias.py b/QT5_Project/KD_ZM_6/DialogModifyAlias.py new file mode 100644 index 0000000..fa4891f --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogModifyAlias.py @@ -0,0 +1,129 @@ +import sys +from PyQt5.QtWidgets import QApplication, QWidget, QDialog, QLabel, QVBoxLayout, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject +import json +from print_color import * + +sys_path = sys.path[0].replace("\\", "/") +ui_file_path = sys_path + "/DialogModifyAlias.ui" + +class DialogModifyAlias(QDialog): + def __init__(self, main_window, parent=None): + super(DialogModifyAlias, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + combo : QComboBox = self.comboBox + + combo.clear() + self.alias_item_dict = {} + self.main_window = main_window + + self.setWindowTitle("别名参数修改") + self.setWindowFlag(Qt.FramelessWindowHint) + self.buttonBox.button(QDialogButtonBox.Ok).setText('确定') + self.buttonBox.button(QDialogButtonBox.Cancel).setText('取消') + self.buttonBox.clicked.connect(self.dialog_button_ok_clicked) + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + def set_caption_name(self, name : str) : + label : QLabel = self.label + label.setText(name) + + def key_increase_parameter(self): + combo : QComboBox = self.comboBox + index = combo.currentIndex() + index += 1 + if index >= combo.count() : + index = 0 + combo.setCurrentIndex(index) + + def key_decrease_parameter(self): + combo : QComboBox = self.comboBox + index = combo.currentIndex() + index -= 1 + if index < 0 : + index = combo.count() - 1 + combo.setCurrentIndex(index) + + def get_alias_key_str(self): + combo : QComboBox = self.comboBox + select_text = combo.currentText() + alias_key = None + for alias_key, alias_str in self.alias_item_dict.items() : + if alias_str == select_text : + return alias_key + return alias_key + + @property + def value(self): + alias_key = self.get_alias_key_str() + return alias_key + + def modify_alias_value(self, modify_str) : + if self.main_window != None : + if hasattr(self.main_window, "func_call_back_on_mqtt_param_modify") : + self.main_window.func_call_back_on_mqtt_param_modify(modify_str) + + def key_enter_process(self): + alias_key = self.get_alias_key_str() + self.modify_alias_value(alias_key) + self.buttonBox.button(QDialogButtonBox.Ok).click() + + def key_escape_process(self): + self.buttonBox.button(QDialogButtonBox.Cancel).click() + + def set_alias_item_info(self, alias_item_dict, key_value, inform_message : str = "系统参数") : + combo : QComboBox = self.comboBox + + self.alias_item_dict = alias_item_dict + combo.clear() + current_index = 0 + select_index = -1 + + self.set_caption_name(inform_message) + + for key, value_str in alias_item_dict.items() : + combo.addItem(value_str) + if key_value == key : + select_index = current_index + current_index += 1 + + if select_index >= 0 : + combo.setCurrentIndex(select_index) + else : + combo.setCurrentText(key_value) + + def dialog_button_ok_clicked(self, button): + if button == self.buttonBox.button(QDialogButtonBox.Ok) : + alias_key = self.get_alias_key_str() + self.modify_alias_value(alias_key) + +if __name__ == '__main__': + app = QApplication(sys.argv) + alias_select = {0 : "380V", 1 : "660V", 2: "1140V", 3 : "3300V"} + json_msg : str = json.dumps(alias_select, ensure_ascii=False) + print_inform_msg(json_msg) + + alias_2 = {"alias_voltage" : {0 : "380V", 1 : "660V", 2: "1140V", 3 : "3300V"}} + json_msg2 : str = json.dumps(alias_2, ensure_ascii=False) + print_inform_msg(json_msg2) + + + dialog = DialogModifyAlias(None) + dialog.set_alias_item_info(alias_select, 1) + dialog.show() + result = dialog.exec_() + + if dialog.result() == QDialog.Accepted: + print_inform_msg(dialog.get_alias_key_str()) # 输出: Button clicked + + sys.exit(0) diff --git a/QT5_Project/KD_ZM_6/DialogModifyAlias.ui b/QT5_Project/KD_ZM_6/DialogModifyAlias.ui new file mode 100644 index 0000000..8729493 --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogModifyAlias.ui @@ -0,0 +1,140 @@ + + + DialogModifyAlias + + + Qt::ApplicationModal + + + + 0 + 0 + 587 + 231 + + + + Qt::DefaultContextMenu + + + Dialog + + + + + 190 + 180 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 262 + 100 + 221 + 31 + + + + color: rgb(255, 170, 0); +background: transparent + + + + + + 120 + 90 + 141 + 51 + + + + + 12 + + + + color: rgb(0, 170, 0); + + + 别名参数 + + + true + + + + + + 0 + 0 + 587 + 231 + + + + + 12 + + + + + + + BG09_004.png + + + true + + + buttonBox + BG + comboBox + label + + + + + buttonBox + accepted() + DialogModifyAlias + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogModifyAlias + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/KD_ZM_6/DialogModifyText.py b/QT5_Project/KD_ZM_6/DialogModifyText.py new file mode 100644 index 0000000..467abc4 --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogModifyText.py @@ -0,0 +1,136 @@ +import sys +from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit, QLabel, QWidget, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject, QTimer + +sys_path = sys.path[0].replace("\\", "/") + +ui_file_path = sys_path + "/DialogModifyText.ui" + +def modify_string(string, index, new_char): + string_list = list(string) + string_list[index] = new_char + modified_string = ''.join(string_list) + return modified_string + +def chr_adjust(old_chr, dif : int) : + new_chr = old_chr + if old_chr == '+': + new_chr = '-' + elif old_chr == '-': + new_chr = '+' + elif dif > 0: + new_chr = chr(ord(old_chr) + 1) + if new_chr > '9' : + new_chr = '0' + else : + new_chr = chr(ord(old_chr) - 1) + if new_chr < '0' : + new_chr = '9' + return new_chr + +class DialogModifyText(QDialog): + def __init__(self, main_window, parent=None): + super(DialogModifyText, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + + self.Text = "2019-09-10 10:22:23" + self.select_bit = 0 + self.main_window = main_window + + self.setWindowTitle("参数修改") + self.setWindowFlag(Qt.FramelessWindowHint) + self.buttonBox.button(QDialogButtonBox.Ok).setText('确定') + self.buttonBox.button(QDialogButtonBox.Cancel).setText('取消') + + self.buttonBox.clicked.connect(self.dialog_button_ok_clicked) + + modify_text = self.Text + self.update_modify_info(modify_text, "缺省多字符修改") + + #让定时器周期刷修改字符串, 防止出现焦点切换时选中消失的情况 + self.timer = QTimer(self) + self.timer.timeout.connect(self.timeout_modify_string_refresh) + self.timer.start(100) + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + @property + def value(self): + return self.Text + + def timeout_modify_string_refresh(self) : + line_modify : QLineEdit = self.lineEdit + modify_str : str = line_modify.text() + self.update_modify_string(modify_str) + + def update_modify_info(self, modify_str, caption : str) : + if hasattr(self, "label") : + label : QLabel = self.label + label.setText(caption) + self.update_modify_string(modify_str) + + def update_modify_string(self, modify_str : str) : + line_modify : QLineEdit = self.lineEdit + line_modify.setText(modify_str) + + if self.select_bit < len(modify_str) : + if modify_str[self.select_bit] == ' ': + self.key_enter_process() + + # 设置选择从第self.select_bit个字符开始,长度为1 + line_modify.setSelection(self.select_bit, 1) + + def key_increase_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, 1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_decrease_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, -1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_enter_process(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + + if self.select_bit < len(text) - 1: + self.select_bit += 1 + if not str.isdigit(text[self.select_bit]) : + self.key_enter_process() + else : + self.update_modify_string(text) + else : + self.buttonBox.button(QDialogButtonBox.Ok).click() + + def key_escape_process(self): + self.buttonBox.button(QDialogButtonBox.Cancel).click() + + def dialog_button_ok_clicked(self, button): + if button == self.buttonBox.button(QDialogButtonBox.Ok) : + line_modify : QLineEdit = self.lineEdit + self.Text = line_modify.text() + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = DialogModifyText(None) + dialog.show() + dialog.exec_() + sys.exit(0) diff --git a/QT5_Project/KD_ZM_6/DialogModifyText.ui b/QT5_Project/KD_ZM_6/DialogModifyText.ui new file mode 100644 index 0000000..10b898d --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogModifyText.ui @@ -0,0 +1,168 @@ + + + DialogModifyValue + + + + 0 + 0 + 587 + 231 + + + + Dialog + + + + true + + + + 180 + 190 + 341 + 32 + + + + + false + PreferDefault + + + + background: transparent + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 227 + 95 + 292 + 41 + + + + + 16 + ExtraBold + + + + Qt::NoFocus + + + color: rgb(255, 170, 0); +background: transparent + + + 2024-05-24 + + + false + + + QLineEdit::Normal + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 110 + 90 + 141 + 51 + + + + + 12 + false + + + + color: rgb(0, 170, 0); + + + 参数名称 + + + true + + + + + + 0 + 0 + 587 + 231 + + + + + 12 + + + + + + + BG09_003.png + + + true + + + BG + buttonBox + label + lineEdit + + + + + buttonBox + accepted() + DialogModifyValue + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogModifyValue + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/KD_ZM_6/DialogModifyValue.py b/QT5_Project/KD_ZM_6/DialogModifyValue.py new file mode 100644 index 0000000..12ae091 --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogModifyValue.py @@ -0,0 +1,151 @@ +import sys +from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit, QLabel, QWidget, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject, QTimer + +sys_path = sys.path[0].replace("\\", "/") + +ui_file_path = sys_path + "/DialogModifyValue.ui" + +def modify_string(string, index, new_char): + string_list = list(string) + string_list[index] = new_char + modified_string = ''.join(string_list) + return modified_string + +def chr_adjust(old_chr, dif : int) : + new_chr = old_chr + if old_chr == '+': + new_chr = '-' + elif old_chr == '-': + new_chr = '+' + elif dif > 0: + new_chr = chr(ord(old_chr) + 1) + if new_chr > '9' : + new_chr = '0' + else : + new_chr = chr(ord(old_chr) - 1) + if new_chr < '0' : + new_chr = '9' + return new_chr + + +class DialogModifyValue(QDialog): + def __init__(self, main_window, parent=None): + super(DialogModifyValue, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + + self.value_origin = 1000.3 + self.value_modify = 1000.3 + self.format = "%05.1f" + self.scale = 1.0 + self.offset = 0.0 + self.select_bit = 0 + self.main_window = main_window + + self.setWindowTitle("参数修改") + self.setWindowFlag(Qt.FramelessWindowHint) + self.buttonBox.button(QDialogButtonBox.Ok).setText('确定') + self.buttonBox.button(QDialogButtonBox.Cancel).setText('取消') + + self.buttonBox.clicked.connect(self.dialog_button_ok_clicked) + + modify_value = self.value_origin * self.scale + self.offset + self.update_modify_info(self.format, modify_value, "缺省参数修改", self.offset) + + #让定时器周期刷修改字符串, 防止出现焦点切换时选中消失的情况 + self.timer = QTimer(self) + self.timer.timeout.connect(self.timeout_modify_string_refresh) + self.timer.start(100) + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + @property + def value(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + return text + + def timeout_modify_string_refresh(self) : + line_modify : QLineEdit = self.lineEdit + modify_str : str = line_modify.text() + self.update_modify_string(modify_str) + + def update_modify_info(self, format_str, value, caption : str, offset = 0) : + self.value_origin = value + self.format = format_str + self.offset = offset + if hasattr(self, "label") : + label : QLabel = self.label + label.setText(caption) + if self.format != "" : + modify_str = self.format%(value) + else : + modify_str = str(value) + self.update_modify_string(modify_str) + + def update_modify_string(self, modify_str : str) : + line_modify : QLineEdit = self.lineEdit + line_modify.setText(modify_str) + + if self.select_bit < len(modify_str) : + if modify_str[self.select_bit] == ' ': + self.key_enter_process() + + # 设置选择从第self.select_bit个字符开始,长度为1 + line_modify.setSelection(self.select_bit, 1) + + def key_increase_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, 1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_decrease_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, -1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_enter_process(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + + if self.select_bit < len(text) - 1: + self.select_bit += 1 + if not str.isdigit(text[self.select_bit]) : + self.key_enter_process() + else : + self.update_modify_string(text) + else : + self.buttonBox.button(QDialogButtonBox.Ok).click() + + def key_escape_process(self): + self.buttonBox.button(QDialogButtonBox.Cancel).click() + + def dialog_button_ok_clicked(self, button): + if button == self.buttonBox.button(QDialogButtonBox.Ok) : + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + self.value_modify = float(text) + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = DialogModifyValue() + dialog.show() + + sys.exit(dialog.exec_()) diff --git a/QT5_Project/KD_ZM_6/DialogModifyValue.ui b/QT5_Project/KD_ZM_6/DialogModifyValue.ui new file mode 100644 index 0000000..5449378 --- /dev/null +++ b/QT5_Project/KD_ZM_6/DialogModifyValue.ui @@ -0,0 +1,157 @@ + + + DialogModifyValue + + + + 0 + 0 + 587 + 231 + + + + Dialog + + + border:none; +background-color: rgba(0, 0, 0, 0); + + + + + 190 + 180 + 341 + 32 + + + + Qt::CustomContextMenu + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 260 + 96 + 191 + 41 + + + + + 16 + + + + Qt::NoFocus + + + color: rgb(255, 170, 0); + + + 000.0 + + + Qt::AlignCenter + + + + + + 120 + 90 + 141 + 51 + + + + + 12 + + + + color: rgb(0, 170, 0); + + + 参数名称 + + + true + + + + + + 0 + 0 + 587 + 231 + + + + + 12 + + + + + + + BG09_004.png + + + true + + + BG + buttonBox + lineEdit + label + + + + + buttonBox + accepted() + DialogModifyValue + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogModifyValue + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/KD_ZM_6/EmptyFaceDetection.py b/QT5_Project/KD_ZM_6/EmptyFaceDetection.py new file mode 100644 index 0000000..b476b5c --- /dev/null +++ b/QT5_Project/KD_ZM_6/EmptyFaceDetection.py @@ -0,0 +1,7 @@ +import sys +import cv2 + +sys_path = sys.path[0].replace("\\", "/") + +def process_face_detection(image : cv2.typing.MatLike, fps : int = 10) : + pass diff --git a/QT5_Project/KD_ZM_6/FaceDetection.py b/QT5_Project/KD_ZM_6/FaceDetection.py new file mode 100644 index 0000000..6157875 --- /dev/null +++ b/QT5_Project/KD_ZM_6/FaceDetection.py @@ -0,0 +1,61 @@ +import sys +import cv2 +import numpy as np + +sys_path = sys.path[0].replace("\\", "/") + +# 加载人脸检测模型 +tensorflowWeightFile = sys_path + "/opencv_face_detector.pbtxt" +tensorflowModelFile = sys_path + "/opencv_face_detector_uint8.pb" + +conf_threshold = 0.7 + +net = cv2.dnn.readNetFromTensorflow(tensorflowModelFile, tensorflowWeightFile) + +def process_face_detection(image : cv2.typing.MatLike, fps : int = 10) : + # 读取图片 + #image = cv2.imread(sys_path + "/example.jpg") + height, width, _ = image.shape + + # # 准备输入数据 + # blob = cv2.dnn.blobFromImage(cv2.resize(image, (300, 300)), 1.0, + # (300, 300), (104.0, 177.0, 123.0)) + + # 设置参数 + scalefactor = 1.0 + size = (300, 300) + mean = (104.0, 177.0, 123.0) + swapRB = False + crop = False + ddepth = cv2.CV_32F + + # 将图像转换为blob + blob = cv2.dnn.blobFromImage(cv2.resize(image, (320, 240)), scalefactor, size, mean, swapRB, crop, ddepth) + + net.setInput(blob) + + # 运行网络 + detections = net.forward() + + text = "fps : %d"%(fps) + cv2.putText(image, text, org = (50, 50), fontFace = cv2.FONT_HERSHEY_SIMPLEX, fontScale = 1, color = (0, 255, 0), thickness = 1) + + # 解析检测结果 + for i in range(detections.shape[2]): + confidence = detections[0, 0, i, 2] + if confidence > 0.5: + box = detections[0, 0, i, 3:7] * np.array([width, height, width, height]) + (startX, startY, endX, endY) = box.astype("int") + + # 画出检测到的人脸 + cv2.rectangle(image, (startX, startY), (endX, endY), (0, 255, 0), 2) + + +if __name__ == "__main__": + # 显示图片 + image = cv2.imread(sys_path + "/example.jpg") + process_face_detection(image) + + cv2.imshow("Face Detection", image) + cv2.waitKey(0) + cv2.destroyAllWindows() \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/FaceDetection2.py b/QT5_Project/KD_ZM_6/FaceDetection2.py new file mode 100644 index 0000000..72537c8 --- /dev/null +++ b/QT5_Project/KD_ZM_6/FaceDetection2.py @@ -0,0 +1,62 @@ +import sys +import cv2 +import numpy as np +import mediapipe as mp + +sys_path = sys.path[0].replace("\\", "/") +image = cv2.imread(sys_path + "/example.jpg") + +# 初始化BlazeFace模型 +mp_face_detection = mp.solutions.face_detection +face_detection = mp_face_detection.FaceDetection(min_detection_confidence=0.5, model_selection=2) + +def process_face_detection(image : cv2.typing.MatLike, fps : int = 10) : + image_width = image.shape[1] + image_height = image.shape[0] + + # 检测人脸 + results = face_detection.process(image) + total_score = 0 + + if results.detections: + for face in results.detections: + relative_box = face.location_data.relative_bounding_box + + # print(f'Detection score: {detection.score}') + # print(f'Box location: {relative_box}') + + if face.score[0] < 0.55 : + continue + + total_score += face.score[0] + + # 在图片上绘制方框 + xmin = relative_box.xmin + ymin = relative_box.ymin + ymax = relative_box.height + ymin + xmax = relative_box.width + xmin + + # ymin, xmin, ymax, xmax = detection.location_data.relative_bounding_box + cv2.rectangle(image, (int(xmin * image_width), int(ymin * image_height)), + (int(xmax * image_width), int(ymax * image_height)), (0, 255, 0), 2) + + key_points = np.array([(p.x, p.y) for p in face.location_data.relative_keypoints]) + key_points_coords = np.multiply(key_points,[image_width,image_height]).astype(int) + for p in key_points_coords: + cv2.circle(image, p, 4, (255, 255, 255), 2) + cv2.circle(image, p, 2, (0, 0, 0), -1) + + average_score = total_score / len(results.detections) + text = "fps : %d, score = %f"%(fps, average_score) + else : + text = "fps :%d"%(fps) + cv2.putText(image, text, org = (50, 50), fontFace = cv2.FONT_HERSHEY_SIMPLEX, fontScale = 1, color = (255, 255, 0), thickness = 1) + +if __name__ == "__main__": + # 显示图片 + image = cv2.imread(sys_path + "/example.jpg") + process_face_detection(image) + + cv2.imshow("Face Detection", image) + cv2.waitKey(0) + cv2.destroyAllWindows() diff --git a/QT5_Project/KD_ZM_6/FlashStaticImag.py b/QT5_Project/KD_ZM_6/FlashStaticImag.py new file mode 100644 index 0000000..4cbaec0 --- /dev/null +++ b/QT5_Project/KD_ZM_6/FlashStaticImag.py @@ -0,0 +1,23 @@ +from flask import Flask, render_template +from flask_socketio import SocketIO +from threading import Timer +from random import randint + +app = Flask(__name__) +app.config['SECRET_KEY'] = 'secret!' +socketio = SocketIO(app) + + +def generate_data(): + data = randint(0, 100) # 示例数据,实际中可以是实时生成的数据 + socketio.emit('update', data) + Timer(1, generate_data).start() # 每1秒生成一次数据 + +@app.route('/') +def index(): + return render_template('index.html') + +if __name__ == '__main__': + generate_data() + socketio.run(app, debug=True) + diff --git a/QT5_Project/KD_ZM_6/HttpServer.py b/QT5_Project/KD_ZM_6/HttpServer.py new file mode 100644 index 0000000..8f76cd9 --- /dev/null +++ b/QT5_Project/KD_ZM_6/HttpServer.py @@ -0,0 +1,22 @@ +from http.server import BaseHTTPRequestHandler +from http.server import HTTPServer +from flask import Flask, render_template, jsonify +import random + + +app = Flask(__name__) + +# 假设的数据源,这里用随机数模拟实时更新的数据 +data_source = [random.randint(0, 100) for _ in range(10)] + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/data') +def data(): + # 返回最新数据 + return jsonify(data_source) + +if __name__ == '__main__': + app.run(debug=True) \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/IM00_01B.png b/QT5_Project/KD_ZM_6/IM00_01B.png new file mode 100644 index 0000000..7895e62 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM00_01B.png differ diff --git a/QT5_Project/KD_ZM_6/IM00_01B1.png b/QT5_Project/KD_ZM_6/IM00_01B1.png new file mode 100644 index 0000000..458778f Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM00_01B1.png differ diff --git a/QT5_Project/KD_ZM_6/IM00_SwitchStatus_0.png b/QT5_Project/KD_ZM_6/IM00_SwitchStatus_0.png new file mode 100644 index 0000000..7af2bc2 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM00_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_6/IM00_SwitchStatus_1.png b/QT5_Project/KD_ZM_6/IM00_SwitchStatus_1.png new file mode 100644 index 0000000..3b8eec3 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM00_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_6/IM00_SwitchType_0.png b/QT5_Project/KD_ZM_6/IM00_SwitchType_0.png new file mode 100644 index 0000000..6d93e04 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM00_SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_6/IM00_SwitchType_1.png b/QT5_Project/KD_ZM_6/IM00_SwitchType_1.png new file mode 100644 index 0000000..bc57853 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM00_SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_6/IM01_01.png b/QT5_Project/KD_ZM_6/IM01_01.png new file mode 100644 index 0000000..ca8ba7b Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM01_01.png differ diff --git a/QT5_Project/KD_ZM_6/IM01_0122.png b/QT5_Project/KD_ZM_6/IM01_0122.png new file mode 100644 index 0000000..1e0fc04 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM01_0122.png differ diff --git a/QT5_Project/KD_ZM_6/IM02_SwitchStatus_0.png b/QT5_Project/KD_ZM_6/IM02_SwitchStatus_0.png new file mode 100644 index 0000000..3846172 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM02_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_6/IM02_SwitchStatus_1.png b/QT5_Project/KD_ZM_6/IM02_SwitchStatus_1.png new file mode 100644 index 0000000..a648e14 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM02_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_6/IM02_SwitchType_0.png b/QT5_Project/KD_ZM_6/IM02_SwitchType_0.png new file mode 100644 index 0000000..62cb1a4 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM02_SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_6/IM02_SwitchType_1.png b/QT5_Project/KD_ZM_6/IM02_SwitchType_1.png new file mode 100644 index 0000000..841ccfa Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM02_SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_6/IM03_001.png b/QT5_Project/KD_ZM_6/IM03_001.png new file mode 100644 index 0000000..164c3b2 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM03_001.png differ diff --git a/QT5_Project/KD_ZM_6/IM03_SwitchStatus_0.png b/QT5_Project/KD_ZM_6/IM03_SwitchStatus_0.png new file mode 100644 index 0000000..f2796ca Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM03_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_6/IM03_SwitchStatus_1.png b/QT5_Project/KD_ZM_6/IM03_SwitchStatus_1.png new file mode 100644 index 0000000..3d469ef Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM03_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_6/IM04_00.png b/QT5_Project/KD_ZM_6/IM04_00.png new file mode 100644 index 0000000..8e19fb2 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM04_00.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_001.png b/QT5_Project/KD_ZM_6/IM05_001.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_001.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_001B.png b/QT5_Project/KD_ZM_6/IM05_001B.png new file mode 100644 index 0000000..7ce13f9 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_001B.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_002.png b/QT5_Project/KD_ZM_6/IM05_002.png new file mode 100644 index 0000000..d1c3db6 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_002.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A1.png b/QT5_Project/KD_ZM_6/IM05_A1.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A1.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A2.png b/QT5_Project/KD_ZM_6/IM05_A2.png new file mode 100644 index 0000000..ca50d84 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A2.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A3.png b/QT5_Project/KD_ZM_6/IM05_A3.png new file mode 100644 index 0000000..9462fc6 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A3.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A4.png b/QT5_Project/KD_ZM_6/IM05_A4.png new file mode 100644 index 0000000..e4d3b74 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A4.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A5.png b/QT5_Project/KD_ZM_6/IM05_A5.png new file mode 100644 index 0000000..85544ac Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A5.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A6.png b/QT5_Project/KD_ZM_6/IM05_A6.png new file mode 100644 index 0000000..bff0217 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A6.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A7.png b/QT5_Project/KD_ZM_6/IM05_A7.png new file mode 100644 index 0000000..a5832fc Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A7.png differ diff --git a/QT5_Project/KD_ZM_6/IM05_A8.png b/QT5_Project/KD_ZM_6/IM05_A8.png new file mode 100644 index 0000000..d8ab1f4 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM05_A8.png differ diff --git a/QT5_Project/KD_ZM_6/IM_LOGO.png b/QT5_Project/KD_ZM_6/IM_LOGO.png new file mode 100644 index 0000000..11d80b7 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM_LOGO.png differ diff --git a/QT5_Project/KD_ZM_6/IM_LOGO2.png b/QT5_Project/KD_ZM_6/IM_LOGO2.png new file mode 100644 index 0000000..0cea565 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IM_LOGO2.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_00.png b/QT5_Project/KD_ZM_6/IMxx_00.png new file mode 100644 index 0000000..a78847c Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_00.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_00B.png b/QT5_Project/KD_ZM_6/IMxx_00B.png new file mode 100644 index 0000000..0e3b13c Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_00B.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_00C.png b/QT5_Project/KD_ZM_6/IMxx_00C.png new file mode 100644 index 0000000..19bb89c Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_00C.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_00D.png b/QT5_Project/KD_ZM_6/IMxx_00D.png new file mode 100644 index 0000000..b47cc71 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_00D.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_00E.png b/QT5_Project/KD_ZM_6/IMxx_00E.png new file mode 100644 index 0000000..f00eef7 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_00E.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_00F.png b/QT5_Project/KD_ZM_6/IMxx_00F.png new file mode 100644 index 0000000..28446f1 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_00F.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_01.png b/QT5_Project/KD_ZM_6/IMxx_01.png new file mode 100644 index 0000000..1470081 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_01.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_0.png b/QT5_Project/KD_ZM_6/IMxx_A_0.png new file mode 100644 index 0000000..b2d9427 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_0.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_1.png b/QT5_Project/KD_ZM_6/IMxx_A_1.png new file mode 100644 index 0000000..02ccba6 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_1.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_2.png b/QT5_Project/KD_ZM_6/IMxx_A_2.png new file mode 100644 index 0000000..b3c036c Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_2.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_3.png b/QT5_Project/KD_ZM_6/IMxx_A_3.png new file mode 100644 index 0000000..4de3901 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_3.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_4.png b/QT5_Project/KD_ZM_6/IMxx_A_4.png new file mode 100644 index 0000000..7de2f89 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_4.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_5.png b/QT5_Project/KD_ZM_6/IMxx_A_5.png new file mode 100644 index 0000000..1c3cd15 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_5.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_6.png b/QT5_Project/KD_ZM_6/IMxx_A_6.png new file mode 100644 index 0000000..0f628d3 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_6.png differ diff --git a/QT5_Project/KD_ZM_6/IMxx_A_7.png b/QT5_Project/KD_ZM_6/IMxx_A_7.png new file mode 100644 index 0000000..003e551 Binary files /dev/null and b/QT5_Project/KD_ZM_6/IMxx_A_7.png differ diff --git a/QT5_Project/KD_ZM_6/KeyWidget.py b/QT5_Project/KD_ZM_6/KeyWidget.py new file mode 100644 index 0000000..bdfd036 --- /dev/null +++ b/QT5_Project/KD_ZM_6/KeyWidget.py @@ -0,0 +1,90 @@ +from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton, QDialog +from PyQt5.QtCore import Qt, QRect + +class KetWidget(QWidget) : + def __init__(self, parent) : + super().__init__() + self.initUI() + self.parent = parent + + def initUI(self) : + btn_box = QVBoxLayout() + + self.float_button1 = QPushButton("↑", self) + self.float_button1.move(self.width() - 200, self.height() - 200) + self.float_button1.setFixedSize(90, 90) + self.float_button1.clicked.connect(self.focus_do_inscrease) + + self.float_button2 = QPushButton("↓", self) + self.float_button2.move(self.width() - 200, self.height() - 100) + self.float_button2.setFixedSize(90, 90) + self.float_button2.clicked.connect(self.focus_do_decrease) + + self.float_button3 = QPushButton("enter", self) + self.float_button3.move(self.width() - 100, self.height() - 200) + self.float_button3.setFixedSize(90, 90) + self.float_button3.clicked.connect(self.focus_do_action) + + self.float_button4 = QPushButton("esc", self) + self.float_button4.move(self.width() - 100, self.height() - 100) + self.float_button4.setFixedSize(90, 90) + self.float_button4.clicked.connect(self.focus_do_escape) + + self.show_hide_button = QPushButton("show/hide", self) + self.show_hide_button.move(self.width()-10, self.height() - 100) + self.show_hide_button.setFixedSize(90, 90) + self.show_hide_button.clicked.connect(self.focus_show_hide) + + btn_box.addWidget(self.float_button1) + btn_box.addWidget(self.float_button2) + btn_box.addWidget(self.float_button3) + btn_box.addWidget(self.float_button4) + + + def focus_do_inscrease(self) : + if hasattr(self.parent, 'stack'): + self.parent.stack.currentWidget().key_decrease_parameter() + else : + self.parent.key_increase_parameter() + + def focus_do_decrease(self) : + if hasattr(self.parent, 'stack'): + self.parent.stack.currentWidget().key_increase_parameter() + else : + self.parent.key_decrease_parameter() + + def focus_do_action(self) : + if hasattr(self.parent, 'stack'): + self.parent.stack.currentWidget().key_enter_process() + else : + self.parent.key_enter_process() + + def focus_do_escape(self) : + if hasattr(self.parent, 'stack'): + self.parent.stack.currentWidget().key_escape_process() + else : + self.parent.key_escape_process() + + def focus_show_hide(self) : + if self.float_button1.isHidden() : + self.float_button1.show() + self.float_button2.show() + self.float_button3.show() + self.float_button4.show() + else : + self.float_button1.hide() + self.float_button2.hide() + self.float_button3.hide() + self.float_button4.hide() + + def showEvent(self, event): + super().showEvent(event) + # 获取屏幕大小 + screen = QApplication.primaryScreen() + screen_rect = screen.geometry() + # 计算窗口在屏幕右下角的位置 + width, height = self.width(), self.height() + x = screen_rect.width() - width + y = screen_rect.height() - height + # 设置窗口位置 + self.move(x, y) \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/Light_image/Light_CameraView.png b/QT5_Project/KD_ZM_6/Light_image/Light_CameraView.png new file mode 100644 index 0000000..66b618a Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Light_CameraView.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Light_DataView.png b/QT5_Project/KD_ZM_6/Light_image/Light_DataView.png new file mode 100644 index 0000000..c96693d Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Light_DataView.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Light_DeviceMenu.png b/QT5_Project/KD_ZM_6/Light_image/Light_DeviceMenu.png new file mode 100644 index 0000000..d287ba9 Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Light_DeviceMenu.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Light_FieldTestAction.png b/QT5_Project/KD_ZM_6/Light_image/Light_FieldTestAction.png new file mode 100644 index 0000000..a7108d5 Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Light_FieldTestAction.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Light_ParamSet.png b/QT5_Project/KD_ZM_6/Light_image/Light_ParamSet.png new file mode 100644 index 0000000..6768524 Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Light_ParamSet.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Light_SystemSet.png b/QT5_Project/KD_ZM_6/Light_image/Light_SystemSet.png new file mode 100644 index 0000000..9b26d6b Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Light_SystemSet.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Ligth_FaultQuery.png b/QT5_Project/KD_ZM_6/Light_image/Ligth_FaultQuery.png new file mode 100644 index 0000000..600705e Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Ligth_FaultQuery.png differ diff --git a/QT5_Project/KD_ZM_6/Light_image/Ligth_SwitchAction.png b/QT5_Project/KD_ZM_6/Light_image/Ligth_SwitchAction.png new file mode 100644 index 0000000..4693c9f Binary files /dev/null and b/QT5_Project/KD_ZM_6/Light_image/Ligth_SwitchAction.png differ diff --git a/QT5_Project/KD_ZM_6/P00DeviceList.ui b/QT5_Project/KD_ZM_6/P00DeviceList.ui new file mode 100644 index 0000000..6eed37a --- /dev/null +++ b/QT5_Project/KD_ZM_6/P00DeviceList.ui @@ -0,0 +1,3438 @@ + + + P00DeviceList + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=0 + + + + + + 0 + -1 + 1920 + 1080 + + + + + + + image/DeviceList.png + + + + + + 91 + 97 + 450 + 481 + + + + + + + circuit=0, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=0, Action=SetPage1+SetCircuit0+SetBinding0,SelectImag=IM00_01B.png + + + + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas0=camera0 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper + m01_SwitchStatus_0 + m02_SwitchType_0 + m03_AlarmMessage_0 + m04_Voltage + m05_Power + m06_Current + m07_Electricity + Ls01 + Ls01_2 + Ls01_3 + Ls01_4 + m03_CarMessage_7 + Video0 + + + + + 546 + 97 + 450 + 481 + + + + + + + circuit=1, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=1, Action=SetPage1+SetCircuit1+SetBinding1,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas1=camera1 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_2 + m01_SwitchStatus_1 + m02_SwitchType_1 + m03_AlarmMessage_1 + m04_Voltage_2 + m05_Power_2 + m06_Current_2 + m07_Electricity_2 + Ls01_5 + Ls01_6 + Ls01_7 + Ls01_8 + m03_CarMessage_8 + Video0_1 + + + + + 1001 + 97 + 450 + 481 + + + + + + + circuit=2, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=2,Action=SetPage1+SetCircuit2+SetBinding2,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas2=camera2 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_3 + m01_SwitchStatus_2 + m02_SwitchType_2 + m03_AlarmMessage_2 + m04_Voltage_3 + m05_Power_3 + m06_Current_3 + m07_Electricity_3 + Ls01_9 + Ls01_10 + Ls01_11 + Ls01_12 + m03_CarMessage_9 + Video0_2 + + + + + 1456 + 97 + 450 + 481 + + + + + + + circuit=3, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=3, Action=SetPage1+SetCircuit3+SetBinding3,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas3=camera3 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_4 + m01_SwitchStatus_3 + m02_SwitchType_3 + m03_AlarmMessage_3 + m04_Voltage_4 + m05_Power_4 + m06_Current_4 + m07_Electricity_4 + Ls01_13 + Ls01_14 + Ls01_15 + Ls01_16 + m03_CarMessage_10 + Video0_3 + + + + + 91 + 583 + 450 + 481 + + + + + + + circuit=4, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=4, Action=SetPage1+SetCircuit4+SetBinding4,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas4=camera4 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_5 + m01_SwitchStatus_4 + m02_SwitchType_4 + m03_AlarmMessage_4 + m04_Voltage_5 + m05_Power_5 + m06_Current_5 + m07_Electricity_5 + Ls01_17 + Ls01_18 + Ls01_19 + Ls01_20 + m03_CarMessage_11 + Video0_4 + + + + + 546 + 583 + 450 + 481 + + + + + + + circuit=5, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=5, Action=SetPage1+SetCircuit5+SetBinding5,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas5=camera5 + + + + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_6 + m01_SwitchStatus_5 + m02_SwitchType_5 + m03_AlarmMessage_5 + m04_Voltage_6 + m05_Power_6 + m06_Current_6 + m07_Electricity_6 + Ls01_21 + Ls01_22 + Ls01_23 + Ls01_24 + m03_CarMessage_12 + Video0_5 + + + + + 1001 + 583 + 450 + 481 + + + + + + + circuit=6, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=6, Action=SetPage1+SetCircuit6+SetBinding6,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas6=camera6 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_7 + m01_SwitchStatus_6 + m02_SwitchType_6 + m03_AlarmMessage_6 + m04_Voltage_7 + m05_Power_7 + m06_Current_7 + m07_Electricity_7 + Ls01_25 + Ls01_26 + Ls01_27 + Ls01_28 + m03_CarMessage_13 + Video0_6 + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 3 + 72 + 144 + + + + Index=7, Action=SetPage5,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 100 + 10 + 431 + 61 + + + + + 15 + + + + + + + border:none; + + + + + + border:none; + + + + + 0 + 10 + 411 + 41 + + + + + Microsoft YaHei UI + 22 + false + false + + + + System=DateTime, Action=ModifySystem, Index=8,main=1,SelectImag=SR_001.png + + + color: rgb(166, 215, 236); +font: 22pt "Microsoft YaHei UI"; + + + 2024-5-18 + + + + + + + 1455 + 583 + 450 + 481 + + + + + + + circuit=7, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=7, Action=SetPage11+SetCircuit7+SetBinding7,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 70 + 105 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + + 660 + 10 + 121 + 51 + + + + font: 34pt "黑体"; +color: rgb(175, 226, 249); + + + 1-6路 + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P01DeviceMenu.ui b/QT5_Project/KD_ZM_6/P01DeviceMenu.ui new file mode 100644 index 0000000..186c776 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P01DeviceMenu.ui @@ -0,0 +1,339 @@ + + + P01DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=1 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage2+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage3+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage4+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage7+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage6+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage8+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P02DataView.ui b/QT5_Project/KD_ZM_6/P02DataView.ui new file mode 100644 index 0000000..59d2dc7 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P02DataView.ui @@ -0,0 +1,1004 @@ + + + P02DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=2 + + + + + PreferDefaultHinting + + + + + + + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + true + + + + 0 + 0 + 1920 + 1080 + + + + + false + PreferDefaultHinting + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + image/DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + PreferDefaultHinting + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 276 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 80 + 277 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 330 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 385 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 440 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Io, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 300 + 330 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 300 + 386 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 300 + 440 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Uo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 274 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 331 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 388 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 442 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosf, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 86 + 497 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + R, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 300 + 496 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=AngleUoIo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 531 + 494 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 100 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Aup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 310 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 520 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 100 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Adown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 310 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bdown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 520 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cdown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 104 + 40 + 161 + 171 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM02_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 260 + 40 + 141 + 171 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM02_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + PreferDefaultHinting + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/KD_ZM_6/P03SwitchAction.ui b/QT5_Project/KD_ZM_6/P03SwitchAction.ui new file mode 100644 index 0000000..ca1db8e --- /dev/null +++ b/QT5_Project/KD_ZM_6/P03SwitchAction.ui @@ -0,0 +1,468 @@ + + + P03SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=3 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/SwitchAction.png + + + + + false + + + + 295 + 190 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 374 + 189 + 1141 + 811 + + + + + + + main=1 + + + border:none; + + + + + + + + 47 + 458 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 47 + 557 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 473 + 559 + 246 + 84 + + + + CarRetreat,Index=6,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 473 + 460 + 246 + 84 + + + + CarForward,Index=5,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 70 + 140 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 47 + 657 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 150 + 90 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 650 + 125 + 441 + 241 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::Box + + + + + + + + + 842 + 461 + 246 + 84 + + + + Index=7, Action=SetPage1,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + + 690 + 81 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + + + + 144 + 310 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=10000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P04ParamSet.ui b/QT5_Project/KD_ZM_6/P04ParamSet.ui new file mode 100644 index 0000000..cb90a58 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P04ParamSet.ui @@ -0,0 +1,1948 @@ + + + P04ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=4 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=短路倍数, Format=%04.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIa, Action=Modify, Index=11, Caption=Ia 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIb, Action=Modify, Index=12, Caption=Ib 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIc, Action=Modify, Index=13, Caption=Ic 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Io, Index=2, Action=Modify,Format=%05.1f,Caption=零序电流, Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Uo, Index=2, Action=Modify,Format=%04.0f,Caption=零序电压, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=3, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=4, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=5, Format=%05.1f, Caption=闭锁电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUo, Action=Modify, Index=6, Format=%05.1f, Caption=Uo校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIo, Action=Modify, Index=7, Format=%05.1f, Caption=Io校正值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MeasureV, Index=8, Alias=alias_measure_v, Action=Modify, Caption=检测电压,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLeakageTrip, Action=Modify, Index=9, Format=%04.1f, Caption=漏电投入延时,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectPhaseSensitivity, Index=2, Alias=alias_bool, Action=Modify, Caption=相敏保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTubeAdhesion, Index=12, Alias=alias_bool, Action=Modify, Caption=真空管粘连保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 820 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=12, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + Protect_14 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + Qt::NoFocus + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 174 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_6/P05CameraView.ui b/QT5_Project/KD_ZM_6/P05CameraView.ui new file mode 100644 index 0000000..abe9001 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P05CameraView.ui @@ -0,0 +1,656 @@ + + + P05CameraView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=5 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/CameraView.png + + + + + + 0 + 100 + 85 + 960 + + + + + + + + + + border:none; + + + + + + + + 8 + 2 + 72 + 144 + + + + Index=9, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 380 + 124 + 1165 + 720 + + + + canvas0=camera0, timeout=5000 + + + TextLabel + + + + + + 200 + 120 + 111 + 41 + + + + + 黑体 + -1 + + + + color: rgb(177, 229, 252); font-size: 35px; + + + 回路1 + + + Qt::AlignCenter + + + + + + 90 + 890 + 1821 + 171 + + + + + + + + + + border:none; + + + + + + + + 236 + 5 + 220 + 159 + + + + Index=2, Action=canvas0_camera1, SelectImag=IM05_A2.png + + + + + + + + + + 450 + 876 + + + + + + + 10 + 5 + 220 + 159 + + + + Index=1, Action=canvas0_camera0, SelectImag=IM05_A1.png + + + + + + + + + + 450 + 876 + + + + + + + 462 + 5 + 220 + 159 + + + + Index=3, Action=canvas0_camera2, SelectImag=IM05_A3.png + + + + + + + + + + 450 + 876 + + + + + + + 688 + 5 + 220 + 159 + + + + Index=4, Action=canvas0_camera3, SelectImag=IM05_A4.png + + + + + + + + + + 450 + 876 + + + + + + + 914 + 5 + 220 + 159 + + + + Index=5, Action=canvas0_camera4, SelectImag=IM05_A5.png + + + + + + + + + + 450 + 876 + + + + + + + 1140 + 5 + 220 + 159 + + + + Index=6, Action=canvas0_camera5, SelectImag=IM05_A6.png + + + + + + + + + + 450 + 876 + + + + + + + 1366 + 5 + 220 + 159 + + + + Index=7, Action=canvas0_camera6, SelectImag=IM05_A7.png + + + + + + + + + + 450 + 876 + + + + + + + 1592 + 5 + 220 + 159 + + + + Index=8, Action=canvas0_camera7, SelectImag=IM05_A8.png + + + + + + + + + + 450 + 876 + + + + + + + 12 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas1=camera0, Timeout=5000 + + + + + + QFrame::NoFrame + + + + + + Qt::AutoText + + + IM05_002.png + + + false + + + Qt::AlignCenter + + + + + + 238 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas2=camera1, Timeout=5000 + + + + + + IM05_002.png + + + + + + 464 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas3=camera2, Timeout=5000 + + + + + + IM05_002.png + + + + + + 690 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas4=camera3, Timeout=5000 + + + + + + IM05_002.png + + + + + + 916 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas5=camera4, Timeout=5000 + + + + + + IM05_002.png + + + + + + 1142 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas6=camera5, Timeout=5000 + + + + + + IM05_002.png + + + + + + 1368 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas7=camera6, Timeout=5000 + + + + + + IM05_002.png + + + + + + 1594 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas8=camera7, Timeout=5000 + + + + + + IM05_002.png + + + Canvas08 + Canvas07 + Canvas06 + Canvas05 + Canvas04 + Canvas03 + Canvas02 + Canvas01 + Btn02 + Btn01 + Btn03 + Btn04 + Btn05 + Btn06 + Btn07 + Btn08 + + + + + + diff --git a/QT5_Project/KD_ZM_6/P06FaultQuery.ui b/QT5_Project/KD_ZM_6/P06FaultQuery.ui new file mode 100644 index 0000000..ddcf086 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P06FaultQuery.ui @@ -0,0 +1,708 @@ + + + P06FaultQuery + + + + 0 + 0 + 1920 + 1076 + + + + MainWindow + + + Page=6 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 48 + 412 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 267 + 412 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 485 + 412 + 85 + 169 + + + + Index=4, Action=SetPage1, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 260 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 152 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 330 + 160 + 361 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 30 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P07SystemSet.ui b/QT5_Project/KD_ZM_6/P07SystemSet.ui new file mode 100644 index 0000000..d503aeb --- /dev/null +++ b/QT5_Project/KD_ZM_6/P07SystemSet.ui @@ -0,0 +1,932 @@ + + + P07SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=7 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 84 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SwitchType, Action=Modify, Index=1, Alias=alias_switch_type, Caption=开关类型,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 144 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 198 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 253 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 308 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 364 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 418 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 475 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 530 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CarAlarmDelay, Action=Modify, Index=9, Format=%05.1f, Caption=小车报警延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 583 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + OffVoltageDelay, Action=Modify, Index=10, Format=%06.1f, Caption=断电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 640 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TubeDelay, Action=Modify, Index=11, Format=%06.2f, Caption=真空管粘连延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 750 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 805 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=14,SelectImag=P4_ParaSelect.png, password,groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + 270 + 695 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LoadSelect, Action=Modify, Index=12, Alias=alias_select, Caption=负载选择,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 25 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/SystemSet.png + + + P07BG + groupBox_2 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/KD_ZM_6/P08FieldTestAction.ui b/QT5_Project/KD_ZM_6/P08FieldTestAction.ui new file mode 100644 index 0000000..48a92ba --- /dev/null +++ b/QT5_Project/KD_ZM_6/P08FieldTestAction.ui @@ -0,0 +1,391 @@ + + + P08FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=8 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + image/FieldTestAction.png + + + + + false + + + + 300 + 170 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 260 + 681 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 45 + 215 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 46 + 330 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 393 + 220 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 392 + 330 + 246 + 84 + + + + Index=5, Action=SetPage1,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + 422 + 95 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 365 + 60 + 291 + 41 + + + + + 黑体 + 16 + + + + true + + + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + + + + false + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 154 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 678 + 319 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P11LightDeviceMenu.ui b/QT5_Project/KD_ZM_6/P11LightDeviceMenu.ui new file mode 100644 index 0000000..e03e03e --- /dev/null +++ b/QT5_Project/KD_ZM_6/P11LightDeviceMenu.ui @@ -0,0 +1,339 @@ + + + P11DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=11 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + Light_image/Light_DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage12+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage13+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage14+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage17+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage16+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage18+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P12LightDataView.ui b/QT5_Project/KD_ZM_6/P12LightDataView.ui new file mode 100644 index 0000000..b9fb671 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P12LightDataView.ui @@ -0,0 +1,573 @@ + + + P12DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=12 + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + + 340 + 10 + 391 + 16 + + + + cameral_url=canvas1 + + + + + + + + + 750 + 10 + 411 + 16 + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Light_image/Light_DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 304 + 500 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 500 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 575 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 650 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 305 + 574 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 305 + 650 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 520 + 570 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ro, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 531 + 494 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 90 + 120 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + CameralUrlLabel + CameralUrlLabel_2 + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/KD_ZM_6/P13LightSwitchAction.ui b/QT5_Project/KD_ZM_6/P13LightSwitchAction.ui new file mode 100644 index 0000000..6318bc4 --- /dev/null +++ b/QT5_Project/KD_ZM_6/P13LightSwitchAction.ui @@ -0,0 +1,345 @@ + + + P13SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=13 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + Light_image/Ligth_SwitchAction.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 150 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 290 + 180 + 1300 + 781 + + + + + + + main=1 + + + border:none; + + + + + + + + 147 + 490 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 411 + 493 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 500 + 170 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 674 + 493 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 581 + 98 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 940 + 490 + 246 + 84 + + + + Index=7, Action=SetPage11,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + false + + + + 0 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备照明 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P14LightParamSet.ui b/QT5_Project/KD_ZM_6/P14LightParamSet.ui new file mode 100644 index 0000000..067307b --- /dev/null +++ b/QT5_Project/KD_ZM_6/P14LightParamSet.ui @@ -0,0 +1,1734 @@ + + + P14ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=14 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=照明额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=照明短路倍数, Format=%04.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=照明短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIs, Action=Modify, Index=11, Caption=Is 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentIs, Action=Modify, Index=12, Caption=信号Ie Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortIs, Action=Modify, Index=13, Caption=信号短路倍数, Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 825 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=14, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=1, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=2, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=3, Format=%05.1f, Caption=闭锁电阻,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectIsShort, Index=2, Alias=alias_bool, Action=Modify, Caption=信号短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + Light_image/Light_ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_6/P16LightFaultQuery.ui b/QT5_Project/KD_ZM_6/P16LightFaultQuery.ui new file mode 100644 index 0000000..60b1c1e --- /dev/null +++ b/QT5_Project/KD_ZM_6/P16LightFaultQuery.ui @@ -0,0 +1,637 @@ + + + P16FaultQuery + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=16 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + Light_image/Ligth_FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 51 + 410 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 270 + 410 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 488 + 410 + 85 + 169 + + + + Index=4, Action=SetPage11, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 7 + 149 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 320 + 170 + 421 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 20 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P17LightSystemSet.ui b/QT5_Project/KD_ZM_6/P17LightSystemSet.ui new file mode 100644 index 0000000..b3936cf --- /dev/null +++ b/QT5_Project/KD_ZM_6/P17LightSystemSet.ui @@ -0,0 +1,792 @@ + + + P17SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=17 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 100 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Temperature, Action=Modify, Index=1, Format=%03.0f, Caption=温度设定,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 155 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 210 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 265 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 320 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 375 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 430 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 485 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 540 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=9,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 595 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=10,SelectImag=P4_ParaSelect.png, password,groupend=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + Light_image/Light_SystemSet.png + + + P07BG + groupBox + groupBox_2 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_6/P18LightFieldTestAction.ui b/QT5_Project/KD_ZM_6/P18LightFieldTestAction.ui new file mode 100644 index 0000000..75aba1c --- /dev/null +++ b/QT5_Project/KD_ZM_6/P18LightFieldTestAction.ui @@ -0,0 +1,345 @@ + + + P18FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=18 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + Light_image/Light_FieldTestAction.png + + + + + false + + + + 290 + 174 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 280 + 691 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 53 + 243 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 53 + 357 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 400 + 248 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 365 + 135 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 79 + 93 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 400 + 357 + 246 + 84 + + + + Index=5, Action=SetPage11,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 153 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 4 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/KD_ZM_6/P4_ParaSelect.png b/QT5_Project/KD_ZM_6/P4_ParaSelect.png new file mode 100644 index 0000000..489633e Binary files /dev/null and b/QT5_Project/KD_ZM_6/P4_ParaSelect.png differ diff --git a/QT5_Project/KD_ZM_6/P4_ToggleSelect.png b/QT5_Project/KD_ZM_6/P4_ToggleSelect.png new file mode 100644 index 0000000..d190adf Binary files /dev/null and b/QT5_Project/KD_ZM_6/P4_ToggleSelect.png differ diff --git a/QT5_Project/KD_ZM_6/SR_001.png b/QT5_Project/KD_ZM_6/SR_001.png new file mode 100644 index 0000000..654c93b Binary files /dev/null and b/QT5_Project/KD_ZM_6/SR_001.png differ diff --git a/QT5_Project/KD_ZM_6/SwitchStatus_0.png b/QT5_Project/KD_ZM_6/SwitchStatus_0.png new file mode 100644 index 0000000..108f3f0 Binary files /dev/null and b/QT5_Project/KD_ZM_6/SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_6/SwitchStatus_1.png b/QT5_Project/KD_ZM_6/SwitchStatus_1.png new file mode 100644 index 0000000..25bafe1 Binary files /dev/null and b/QT5_Project/KD_ZM_6/SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_6/SwitchType_0.png b/QT5_Project/KD_ZM_6/SwitchType_0.png new file mode 100644 index 0000000..3bf1062 Binary files /dev/null and b/QT5_Project/KD_ZM_6/SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_6/SwitchType_1.png b/QT5_Project/KD_ZM_6/SwitchType_1.png new file mode 100644 index 0000000..700b4f6 Binary files /dev/null and b/QT5_Project/KD_ZM_6/SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_6/UIFrameWork.py b/QT5_Project/KD_ZM_6/UIFrameWork.py new file mode 100644 index 0000000..ec1e811 --- /dev/null +++ b/QT5_Project/KD_ZM_6/UIFrameWork.py @@ -0,0 +1,1497 @@ +# This Python file uses the following encoding: utf-8 +import sys +import os +import time +import inspect +import cv2 +import json +from PyQt5 import uic +from PyQt5.QtGui import QImage, QPixmap, QColor,QBrush, QKeySequence, QIcon, QPalette +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent, QSize, QDateTime +from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget, QLayout, QLabel +from PyQt5.QtWidgets import QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +from CameraThread import CameraThread +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from DialogModifyValue import DialogModifyValue +from DialogModifyAlias import DialogModifyAlias +from DialogModifyText import DialogModifyText +from DialogInform import DialogInform +from get_tip_prop import * +from print_color import * +import time +from PyQt5.QtCore import QDateTime +import re +from datetime import datetime +import platform +import subprocess + + +sys.path.append(sys.path[0] + "/../..") +sys_path = sys.path[0].replace("\\", "/") + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#31D19E").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() +COLOR_VALUE_NORMAL = QColor("#31D19E").name() + +ALIAS_QUERY_NONE = 0 +ALIAS_QUERY_WAIT_RESPOINSE = 1 + + + + +#设置系统时间 + +def is_linux(): + return platform.system() == 'Linux' + +def set_system_time(year, month, day, hour, minute, second): + if is_linux(): + try: + new_time = datetime(year, month, day, hour, minute, second).strftime("%Y-%m-%d %H:%M:%S") + subprocess.run(f'sudo timedatectl set-time "{new_time}"', shell=True, check=True) + print(f"System time updated to {new_time}") + except subprocess.CalledProcessError as e: + print(f"Failed to update system time: {e}") + else: + import ctypes + import ctypes.wintypes + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + TIME_ZONE_ID_DAYLIGHT = 2 + + class SYSTEMTIME(ctypes.Structure): + _fields_ = [ + ("wYear", ctypes.wintypes.WORD), + ("wMonth", ctypes.wintypes.WORD), + ("wDayOfWeek", ctypes.wintypes.WORD), + ("wDay", ctypes.wintypes.WORD), + ("wHour", ctypes.wintypes.WORD), + ("wMinute", ctypes.wintypes.WORD), + ("wSecond", ctypes.wintypes.WORD), + ("wMilliseconds", ctypes.wintypes.WORD), + ] + + system_time = SYSTEMTIME() + ctypes.windll.kernel32.GetSystemTime(ctypes.byref(system_time)) + + system_time.wYear = year + system_time.wMonth = month + system_time.wDay = day + system_time.wHour = hour + system_time.wMinute = minute + system_time.wSecond = second + ctypes.windll.kernel32.SetSystemTime(ctypes.byref(system_time)) + print(f"System time updated to {year}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}") +def set_screen_blanking_time(minutes): + """ + 设置屏幕黑屏时间。 + + :param minutes: 屏幕黑屏时间(分钟)。 + """ + if is_linux(): + try: + # 使用 xfconf-query 命令设置Xfce桌面环境下的屏幕黑屏时间 + subprocess.run([ + 'xfconf-query', '-c', 'xfce4-power-manager', + '-p', '/xfce4-power-manager/blank-on-ac', + '-s', str(minutes * 60), '-t', 'int', '--create' + ], check=True) + print(f"Xfce屏幕黑屏时间设置为 {minutes} 分钟") + except subprocess.CalledProcessError as e: + print(f"设置Xfce屏幕黑屏时间失败: {e}") + else: + try: + subprocess.run(f'powercfg -change -monitor-timeout-ac {minutes}', shell=True, check=True) + subprocess.run(f'powercfg -change -monitor-timeout-dc {minutes}', shell=True, check=True) + print(f"屏幕黑屏时间设置为 {minutes} 分钟 (适用于交流电和电池供电)") + except subprocess.CalledProcessError as e: + print(f"设置屏幕黑屏时间失败: {e}") + + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + else : + json_dict = json.loads(message) + return json_dict + +def modify_style_sheet(type_name : str, origin_style_sheet : str, lead_str : str, value_str : str) : + if len(value_str) == 0 : + new_style_items = "" + else : + new_style_items = "%s:%s;"%(lead_str, value_str) + style_splits = origin_style_sheet.split("{") + if len(style_splits) == 1 : + style_items_str = style_splits[0] + elif len(style_splits) == 2 : + style_items_str = style_splits[1] + else : + style_items_str = "" + style_items_str = style_items_str.replace("}", "") + + prop_splits = style_items_str.split(";") + for each_style_prop in prop_splits : + if lead_str in each_style_prop : + key_value_splits = each_style_prop.split(":") + cmp_str = key_value_splits[0] + cmp_str = cmp_str.replace(" ", "") + cmp_str = cmp_str.replace("\n", "") + if lead_str == cmp_str : + continue + + if len(each_style_prop) > 0 : + new_style_items += each_style_prop + new_style_items += ";" + + if len(type_name) == 0: + return "%s"%(new_style_items) + else : + return "%s {%s}"%(type_name, new_style_items) + +def get_key_combine_str(str1, str2) : + return str1 + "," + str2 + +def search_circuit_from_topic(topic : str) : + circuit_id = -1 + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name in topic : + circuit_id = config_circuit_id + break + if circuit_id >= 0 : + break + return circuit_id + +def get_imag_value_file_name(tip_str : str, value : int) : + file_name = get_tip_value_str(tip_str, "ImageValue", default_string = None) + try : + if isinstance(value, str) : + fvalue = float(value) + value_id = round(fvalue) + else : + value_id = value + except Exception as e : + return None + + if file_name != None : + file_name_with_value = file_name%(value_id) + imag_value_file_name = sys_path + "/" + file_name_with_value + else : + imag_value_file_name = None + + if imag_value_file_name != None : + if os.path.exists(imag_value_file_name) : + return imag_value_file_name + return None + +def get_imag_file_name(tip_str : str, key_imag : str, default_string = None) : + file_name = get_tip_value_str(tip_str, key_imag, default_string) + select_image_file_name = None + if file_name != None : + select_image_file_name = sys_path + "/" + file_name + if os.path.exists(select_image_file_name) : + return select_image_file_name + return None + +def get_select_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectImag", default_string = None) + +def get_select_icon_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectIcon", default_string = None) + +def get_bk_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageBackGround", default_string = None) + +def get_indicator_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageIndicator", default_string = None) + +def get_compare_index(main_index : int, sub_index : int) : + return (main_index + 1) * 64 + sub_index + +class UIFrameWork(QMainWindow, class_comm_mqtt_interface): + mqtt_signal : pyqtSignal = pyqtSignal(str) + + def __init__(self): + QMainWindow.__init__(self) + self.topic_message_list : list = [] + self.mutex : QMutex = QMutex() + + self.mqtt_signal.connect(self.mqtt_topic_message_process) + self.menu_list = [] + self.sort_menu_list = [] + self.menu_key_index = 0 + self.key_active = 0 + self.select_object : QWidget = None + self.wait_response_list = [] + self.mqtt_thread : class_comm_mqtt_thread= None + + self.mqtt_value_dict = {} + + self.widget_timeout_list = [] + + self.alias_dict = {} + self.alias_query_timer : QTimer = None + + self.alias_query_timer = QTimer() + self.alias_query_timer.timeout.connect(self.process_alias_query) + self.alias_query_timer.start(3000) + + self.video_visible_timer = QTimer() + self.video_visible_timer.timeout.connect(self.video_visible_timeout) + self.video_visible_timer.start(200) + + self.time_timer = QTimer() + self.time_timer.timeout.connect(self.flush_system_cycle) + self.time_timer.start(500) + + self.canvas_visible_arr = [ + False, + False, + False, + False, + False, + False, + False, + False, + False, + ] + + # QLabel list_index CameraThread + # self.canvas_label_list : QLabel = [ [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None] + # ] + # self.set_video_image_func_arr = [self.set_video_image_0, self.set_video_image_1, self.set_video_image_2, self.set_video_image_3, + # self.set_video_image_4, self.set_video_image_5, self.set_video_image_6, self.set_video_image_7, + # self.set_video_image_8 + # ] + + # 使用列表推导式动态生成 canvas_label_list + self.canvas_label_list = [[None, -1, None] for _ in range(9)] + # 使用列表推导式动态生成 set_video_image_func_arr + self.set_video_image_func_arr = [getattr(self, f'set_video_image_{i}') for i in range(9)] + + self.page = -1 + self.select_main_index = -1 + self.exist_circuit_mask = 0 + + self.check_widget_timeout_timer : QTimer = None + + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_0), self, activated=self.key_Test_process0) + QShortcut(QKeySequence(Qt.Key_1), self, activated=self.key_Test_process1) + QShortcut(QKeySequence(Qt.Key_2), self, activated=self.key_Test_process2) + QShortcut(QKeySequence(Qt.Key_3), self, activated=self.key_Test_process3) + self.bind_channel = -1 + + #虚函数, 切换到本页面时调用 + def virtual_on_page_enter(self) : + pass + + #虚函数, 退出到本页面时调用 + def virtual_on_page_leave(self) : + pass + + #虚函数, 切换到页面, 需要在派生类中实现, page=-1表示退出到上一级菜单 + def virtual_change_to_page(self, page) : + pass + + #虚函数, 画布连接到摄像头, 需要在派生类中实现。 + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + pass + + #虚函数, action处理函数, 派生类可以额外处理 + def virtual_widget_action_process(self, widget : QObject, action : str) : + return + + def set_mqtt_value(self, circuit : int, mqtt_name : str, mqtt_value) : + key = f'{circuit}+{mqtt_name}' + self.mqtt_value_dict[key] = mqtt_value + + def get_mqtt_value(self, circuit : int, mqtt_name : str) : + key = f'{circuit}+{mqtt_name}' + if key in self.mqtt_value_dict.keys() : + return self.mqtt_value_dict[key] + return None + + def modify_object_style_sheet(self, object :QWidget, lead_str : str, value_str : str) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.styleSheet() + new_style_sheet = modify_style_sheet(object_type_name, origin_style, lead_str, value_str) + object.setStyleSheet(new_style_sheet) + + def reset_object_style_sheet(self, object :QWidget) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.whatsThis() + object.setStyleSheet(origin_style) + + def load_window_ui(self, file_window_ui : str) : + uic.loadUi(file_window_ui, self) + self.load_resource_bitmap() + self.create_menu_list() + self.sort_menu_list = sorted(self.menu_list, key=lambda x: x[0]) + self.create_style_sheet_backup() + self.create_timeout_list() + self.create_alias_list() + self.update_window_circuit_mask() + self.exist_circuit_mask = self.get_circuit_mask() + self.check_widget_timeout_timer : QTimer = QTimer() + self.check_widget_timeout_timer.timeout.connect(self.process_widget_timeout_list) + self.check_widget_timeout_timer.start(100) + self.page = get_tip_page(self.statusTip()) + self.menu_selectable_object_flush() + + def get_circuit_mask(self, child_widget : QWidget = None) : + widget :QWidget = child_widget + if widget == None : + widget = self + circuit_id_mask = 0 + + for each_object in widget.children(): + child : QWidget = each_object + if hasattr(child, "statusTip") : + circuit_id = self.get_circuit_from_object(child) + if circuit_id >= 0 : + circuit_id_mask |= (0x01 << circuit_id) + circuit_id_mask |= self.get_circuit_mask(child) + return circuit_id_mask + + def update_window_circuit_mask(self) : + self.exist_circuit_mask = self.get_circuit_mask() + return + + def set_menu_main_index(self, main_index) : + self.main_index = main_index + if len(self.sort_menu_list) == 0 : + return + if self.main_index < 0 : + self.menu_key_index = 0 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + return + menu_key_index = 0 + for each_item in self.sort_menu_list : + compare_index = each_item[0] + if compare_index >= get_compare_index(main_index, 0) : + break + menu_key_index += 1 + self.menu_key_index = menu_key_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def process_alias_query(self) : + for alias_unique_name, alias_value_dict in self.alias_dict.items() :# {"xxxxx,sss": 123} + alias_unique_name_splits = alias_unique_name.split(",") + alias_name = alias_unique_name_splits[0] + uniqe_name = alias_unique_name_splits[1] + if isinstance(alias_value_dict, int) : + if alias_value_dict == ALIAS_QUERY_NONE : + if self.mqtt_thread != None : + select_object : QWidget = None + self.alias_dict[alias_unique_name] = ALIAS_QUERY_WAIT_RESPOINSE + self.mqtt_publish_and_wait_response("request/alias/" + uniqe_name, '{"name":"%s"}'%(alias_name), select_object, 2000, False) + + def process_widget_timeout_list(self) : + list_index = 0 + for timeout_items in self.widget_timeout_list: + time_limit = timeout_items[0] + cur_time = timeout_items[1] + cur_time += 100 + if cur_time >= time_limit: + cur_time = 0 + timeout_widget : QWidget = timeout_items[2] + if isinstance(timeout_widget, QLineEdit) : + lineedit_widget : QLineEdit = timeout_widget + lineedit_widget.setText("通信超时") + elif isinstance(timeout_widget, QLabel) : + label_widget : QLabel = timeout_widget + if "canvas" in label_widget.statusTip() : + self.camera_signal_timeout(label_widget) + else : + if label_widget.isVisible() : + label_widget.setVisible(False) + #label_widget.hide() + elif isinstance(timeout_widget, QPushButton) : + button_widget : QPushButton = timeout_widget + self.reset_object_style_sheet(button_widget) + button_widget.setText("通信超时") + timeout_items[1] = cur_time + self.widget_timeout_list[list_index] = timeout_items + list_index = list_index + 1 + + def reset_widget_timeout(self, widget : QObject) : + Index = 0 + for timeout_item in self.widget_timeout_list: + cur_time = timeout_item[1] + timeout_widget : QWidget = timeout_item[2] + if timeout_widget == widget : + timeout_item[1] = 0 + self.widget_timeout_list[Index] = timeout_item + break + Index = Index + 1 + + + def connect_camera_thread(self, camera_thread : CameraThread, canvas_id : int = 0, is_visible : bool = True) : + if camera_thread == None or canvas_id < 0: + return + if canvas_id < len(self.set_video_image_func_arr) : + canvas_object : QLabel = self.search_canvas_object(canvas_id) + if canvas_object : + canvas_info_item = self.canvas_label_list[canvas_id] + + origin_camera_thread : CameraThread = canvas_info_item[2] + if origin_camera_thread != None and origin_camera_thread.is_signal_connect: + origin_camera_thread.image_signal.disconnect(self.set_video_image_func_arr[canvas_id]) + + if is_visible : + + camera_thread.signal_connect(self.set_video_image_func_arr[canvas_id]) + + list_index : int = self.get_timeout_List_index(canvas_object) + self.canvas_label_list[canvas_id] = [canvas_object, list_index, camera_thread] + else : + self.canvas_label_list[canvas_id] = [None, -1, None] + + self.canvas_visible_arr[canvas_id] = is_visible + + def camera_signal_timeout(self, camera_label : QLabel): + if camera_label != None : + image = QPixmap(sys_path + '/IM05_002.png') + scaled_image = image.scaled(camera_label.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) + camera_label.setPixmap(scaled_image) + + def search_canvas_object(self, canvas_id = 0, child = None) : + widget :QWidget = child + if widget == None : + widget = self + child_count = 0 + for each_object in widget.children(): + child_count += 1 + child : QWidget = each_object + + if hasattr(child, "statusTip") : + tip_str : str = child.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if config_canvas_id >= 0 and config_camera_id >= 0 and config_canvas_id == canvas_id: + if isinstance(child, QLabel) : + return child + + find_canvas_object = self.search_canvas_object(canvas_id, child) + if find_canvas_object != None : + return find_canvas_object + + if child_count == 0 : + return None + + def get_canvas_prop (self, canvas_id : int= 0) : + config_camera_id = -1 + is_face_detect : int = 0 + + canvas_object : QWidget = self.search_canvas_object(canvas_id) + if canvas_object != None : + tip_str : str = canvas_object.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + is_face_detect = get_tip_face_detection(tip_str) + return config_camera_id, is_face_detect + + def load_resource_bitmap(self, child = None) : + widget :QWidget = self + if child != None : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + imag_file_name = get_bk_imag_file_name(tip_str) + if imag_file_name != None : + if isinstance(child_widget, QLabel) : + label_child_object : QLabel = child_widget + label_child_object.setScaledContents(True) + image = QPixmap(imag_file_name) + label_child_object.setPixmap(image) + elif isinstance(child_widget, QWidget) : + file_url = "url(%s)"%(imag_file_name) + self.modify_object_style_sheet(child_widget, "background-image", file_url) + self.load_resource_bitmap(child_widget) + + def create_style_sheet_backup(self, child = None) : + widget :QWidget = child + if child == None : + widget = self + for child_widget in widget.children(): + if hasattr(child_widget, "styleSheet") : + widget : QWidget = child_widget + style_sheet : str = widget.styleSheet() + widget.setWhatsThis(style_sheet) + self.create_style_sheet_backup(child_widget) + + def create_timeout_list(self, child = None) : + widget :QWidget = self + if child == None : + self.widget_timeout_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + timeout_limit_ms = get_tip_timeout(tip_str) + if timeout_limit_ms >= 0: + self.widget_timeout_list.append([timeout_limit_ms, 0, child_widget]) + self.create_timeout_list(child_widget) + + def get_timeout_List_index(self, object : QWidget) : + list_index = -1 + search_list_index = 0 + for items in self.widget_timeout_list : + child_widget : QWidget = items[2] + if child_widget == object : + list_index = search_list_index + break + search_list_index += 1 + return list_index + + def get_page_circuit(self): + if hasattr(self, "statusTip") : + return get_tip_circuit(self.statusTip()) + return -1 + + def set_page_circuit(self, circuit_id = -1) : + if hasattr(self, "statusTip") : + origin_status_tip : str = self.statusTip() + origin_tip_splits = origin_status_tip.split(",") + new_status_tip = "" + for each_str in origin_tip_splits: + if "circuit" not in each_str : + new_status_tip += each_str + new_status_tip += "," + new_status_tip += "circuit=%d"%(circuit_id) + self.setStatusTip(new_status_tip) + self.update_window_circuit_mask() + self.create_alias_list() + self.process_alias_query() + self.para_or_measure_query() + + def create_alias_list(self, child = None) : + widget :QWidget = self + if child == None : + self.alias_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + alias_str = get_tip_alias_str(tip_str) + if alias_str != None: + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None : + key_combine_str = get_key_combine_str(alias_str, unique_name) + if key_combine_str not in self.alias_dict.keys() : + self.alias_dict[key_combine_str] = ALIAS_QUERY_NONE + self.create_alias_list(child_widget) + + def create_menu_list(self, child = None) : + widget :QWidget = self + if child == None : + self.menu_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + sub_index = get_tip_menu_sub_index(tip_str) + if sub_index >= 0: + main_index = self.get_main_index_from_object(child_widget) + if main_index >= 0 : + compare_index = get_compare_index(main_index, sub_index) + else : + compare_index = sub_index + self.menu_list.append([compare_index, child_widget]) + if isinstance(child_widget, QPushButton) : + button : QPushButton = child_widget + button.clicked.connect(self.on_menu_qpush_button_click) + self.create_menu_list(child_widget) + + def on_select_object_action_process(self, select_object : QWidget) : + tip_str = select_object.statusTip() + action_str = get_tip_value_str(tip_str, "Action", None) + if action_str != None : + if "password" in tip_str : + dialog_modify_text = DialogModifyValue(self) + caption_str = "请输入密码:" + dialog_modify_text.update_modify_info("", "0000", caption_str) + input = False + + if dialog_modify_text.exec() == QDialog.Accepted: + input = True + modify_screen_time_str = dialog_modify_text.value + pass_word = system_parameter() + if modify_screen_time_str != pass_word.get_system_password() : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", "密码错误,无法修改!") + return + else: + input = True + if input : + if "CmdExecute" in action_str : + mqtt_name = get_tip_mqtt_name(tip_str) + unique_name = self.get_unique_name_from_object(select_object) + if mqtt_name != None and unique_name != None: + if len(mqtt_name) > 0 and self.mqtt_thread != None: + publish_topic = "request/action/" + unique_name + publish_message = '{"name" : "%s"}'%(mqtt_name) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, select_object, 1000) + elif "ModifySystem" in action_str: + self.on_system_param_modify(tip_str) + elif "Modify" in action_str : + if isinstance(select_object, QLineEdit) : + self.on_line_edit_modify_click(select_object) + + self.virtual_widget_action_process(select_object, action_str) + + def search_menu_match_object(self, object) : + match_object : QWidget = None + menu_index = 0 + for each_list in self.sort_menu_list : + search_object = each_list[1] + if search_object == object : + match_object = search_object + break + menu_index += 1 + return match_object, menu_index + + #刷新屏幕上的系统信息, 例如时间日期之类 + def flush_system_info(self, child = None) : + widget : QWidget= child + if child == None : + widget = self + else : + widget = child + + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + system_str = get_tip_system(tip_str) + + if system_str == "DateTime" : + qdate_time = QDateTime.currentDateTime() + time_str = qdate_time.toString("yyyy-MM-dd hh:mm:ss") + + if isinstance(child_widget, QPushButton) : + button_widget : QPushButton = child_widget + button_widget.setText(time_str) + elif isinstance(child_widget, QLineEdit) : + line_edit_widget : QLineEdit = child_widget + line_edit_widget.setText(time_str) + elif isinstance(child_widget, QLabel) : + label_widget : QLabel = child_widget + label_widget.setText(time_str) + self.flush_system_info(child_widget) + + def func_mqtt_param_modify(self, modify_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/modify/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, modify_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def func_call_back_on_mqtt_param_info(self, info_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/info/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, info_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def on_menu_qpush_button_click(self, sender : QPushButton): + sender : QPushButton = self.sender() + match_object : QWidget = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + self.menu_selectable_object_flush() + if isinstance(match_object, QPushButton) : + self.on_select_object_action_process(match_object) + + #修改系统时间与日期 + def func_modify_system_time(self, modify_str : str) : + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + set_system_time(year, month, day, hour, minute, second) + + return year, month, day, hour, minute, second + return None + + #修改系统黑屏时间 + def func_modify_screen_blanking_time(self, modify_str: str): + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 1: + minutes = int(numbers[0]) + set_screen_blanking_time(minutes) + return minutes + return None + + def on_system_param_modify(self, tip : str) : + system = get_tip_system(tip) + if system == "DateTime" : + dialog_modify_text : DialogModifyText = DialogModifyText(self) + caption_str = "修改系统时间" + cur_time = QDateTime.currentDateTime() + date_time_str = cur_time.toString("yyyy-MM-dd hh:mm:ss") + dialog_modify_text.update_modify_info(date_time_str, caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_date_time_str = dialog_modify_text.value + self.func_modify_system_time(modify_date_time_str) + for circuit_id in range(8) : + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None and self.mqtt_thread != None: + time_message = '{"name" : "SetupTime", "value" : "%s"}'%(modify_date_time_str) + self.mqtt_thread.publish("request/action/" + unique_name, time_message) + dialog_inform = DialogInform(self) + dialog_inform.information("系统时间修改", "系统时间修改成功") + elif system == "ScreenBlankingTime": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改屏幕黑屏时间(分钟)" + sbt = system_parameter() + dialog_modify_text.update_modify_info("", str(sbt.get_screen_blanking_time()), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + result = self.func_modify_screen_blanking_time(modify_screen_time_str) + sbt.change_screen_blanking_time(modify_screen_time_str) + + if result is not None: + self.BlankTimelineEdit.setText(str(result)) + dialog_inform = DialogInform(self) + dialog_inform.information("屏幕黑屏时间修改", "屏幕黑屏时间修改成功") + + elif system == "SystemPassWord": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改系统密码" + pass_word = system_parameter() + dialog_modify_text.update_modify_info("", pass_word.get_system_password(), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + pass_word.set_system_password(modify_screen_time_str) + dialog_inform = DialogInform(self) + dialog_inform.information("系统密码修改", "系统密码修改成功") + def on_line_edit_modify_click(self, sender :QLineEdit) : + match_object : QLineEdit = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + if isinstance(match_object, QLineEdit) : + self.dialog_modify_value = None + tip = match_object.statusTip() + alias_name = get_tip_alias_str(tip) + unique_name = self.get_unique_name_from_object(match_object) + if unique_name != None and alias_name != None : + key_combine_str = get_key_combine_str(alias_name, unique_name) + value_dict = utils.dict_or_object_get_attr(self.alias_dict, key_combine_str, None) + + if isinstance(value_dict, dict) : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + caption_str = get_tip_caption_str(match_object.statusTip()) + value_text = match_object.text() + dialog_modify_alias.set_alias_item_info(value_dict, value_text, caption_str) + self.dialog_modify_alias = dialog_modify_alias + + if dialog_modify_alias.exec() == QDialog.Accepted : + modify_value = dialog_modify_alias.value + self.func_mqtt_param_modify(modify_value) + else : + inform_box : DialogInform = DialogInform() + inform_box.information('别名数据未获取', 'message: %s'%(alias_name)) + else : + dialog_modify_value : DialogModifyValue = DialogModifyValue(self) + caption_str = get_tip_caption_str(match_object.statusTip()) + try : + origin_value = float(match_object.text()) + except Exception as e : + origin_value = None + inform_box : DialogInform = DialogInform() + inform_box.information('无效值', str(e)) + + if origin_value != None : + format_str = get_tip_format(tip) + dialog_modify_value.update_modify_info(format_str, origin_value, caption_str) + if dialog_modify_value.exec() == QDialog.Accepted : + modify_value = dialog_modify_value.value + self.func_mqtt_param_modify(modify_value) + def set_video_image(self, image_object : QObject, canvas_id = 0) : + if canvas_id >= len(self.canvas_label_list) : + return + camera_info_items = self.canvas_label_list[canvas_id] + camera_label: QLabel = camera_info_items[0] + timeout_list_index = camera_info_items[1] + camera_thread : CameraThread = camera_info_items[2] + + if camera_label != None: + shape = image_object.shape + width = shape[1] + height = shape[0] + if camera_label.isVisible() : + + qt_img = QImage(image_object.data, width, height, QImage.Format_RGB888) + + camera_label.setScaledContents(True) + camera_label.setPixmap(QPixmap.fromImage(qt_img)) + + if timeout_list_index >= 0 : + self.widget_timeout_list[timeout_list_index][1] = 0 + + def set_video_image_0(self, image_object : QObject) : + self.set_video_image(image_object, 0) + + def set_video_image_1(self, image_object : QObject) : + self.set_video_image(image_object, 1) + + def set_video_image_2(self, image_object : QObject) : + self.set_video_image(image_object, 2) + + def set_video_image_3(self, image_object : QObject) : + self.set_video_image(image_object, 3) + + def set_video_image_4(self, image_object : QObject) : + self.set_video_image(image_object, 4) + + def set_video_image_5(self, image_object : QObject) : + self.set_video_image(image_object, 5) + + def set_video_image_6(self, image_object : QObject) : + self.set_video_image(image_object, 6) + + def set_video_image_7(self, image_object : QObject) : + self.set_video_image(image_object, 7) + + def set_video_image_8(self, image_object : QObject) : + self.set_video_image(image_object, 8) + + def update_mqtt_value(self, circuit, json_dict) : + for json_key, json_value in json_dict.items() : + self.set_mqtt_value(circuit, json_key, json_value) + + #更新视频显示与否 + def update_canvas_camera_visible(self, child = None) : + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if isinstance(child, QLabel) : + widget_label : QLabel = child + tip_str = widget_label.statusTip() + visible_mqtt = get_tip_visible_mqtt(tip_str, None) + if visible_mqtt != None : + #该Label具有Visible控制, 检查一下是不是视频流 + canvas_id, camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if canvas_id >= 0 and camera_id >= 0 : + circuit_id = self.get_circuit_from_object(widget_label) + visible_value = self.get_mqtt_value(circuit_id, visible_mqtt) + + is_visible = False + if visible_value != None : + try : + is_visible = True if int(visible_value) > 0 else False + except Exception as e : + is_visible = False + + widget_label.setVisible(is_visible) + if is_visible != self.canvas_visible_arr[canvas_id] and canvas_id < len(self.canvas_visible_arr): + self.canvas_visible_arr[canvas_id] = is_visible + self.virtual_connect_canvas_to_camera(canvas_id, camera_id, is_visible) + + self.update_canvas_camera_visible(child) + + def video_visible_timeout(self) : + self.update_canvas_camera_visible() + + #通过json包刷新界面数据 + def flush_widgets(self, circuit, json_dict, child = None): + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if not hasattr(child, "statusTip") : + continue + tip_str : str = child.statusTip() + + mqtt_name = get_tip_mqtt_name(tip_str) + + circuit_id = self.get_circuit_from_object(each_object) + self.flush_widgets(circuit, json_dict, child) + + if circuit_id != circuit : + continue + + if mqtt_name in json_dict.keys() : + value_or_dict = json_dict[mqtt_name] + + if isinstance(value_or_dict, dict) : + value_text = utils.dict_or_object_get_attr(value_or_dict, "value", "") + else : + value_text = value_or_dict + + color_str = utils.dict_or_object_get_attr(value_or_dict, "color", None) + bk_color_str = utils.dict_or_object_get_attr(value_or_dict, "bk_color", None) + + imag_file_name = get_imag_value_file_name(tip_str, value_text) + timeout_ms = get_tip_timeout(tip_str) + if timeout_ms > 0 : + self.reset_widget_timeout(child) + + if isinstance(child, QPushButton) : + widget_button : QPushButton = child + if imag_file_name != None : + self.modify_object_style_sheet(widget_button, "border-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_button) + + if isinstance(child, QLabel) : + widget_label : QLabel = child + if imag_file_name != None : + if widget_label.isVisible() == False : + widget_label.setVisible(True) + self.modify_object_style_sheet(widget_label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_label) + widget_label.setText(value_text) + + if isinstance(child, QLineEdit) : + widget_line_edit : QLineEdit = child + alias_name = get_tip_alias_str(widget_line_edit.statusTip()) + unique_name = self.get_unique_name_from_object(widget_line_edit) + + if alias_name != None : + fvalue = float(value_text) + value = round(fvalue) + value_str = str(value) + display_text = "(%s)"%(value_str) + + alias_key_str = get_key_combine_str(alias_name, unique_name) + if alias_key_str in self.alias_dict.keys() : + alias_value_dict = self.alias_dict[alias_key_str] + if isinstance(alias_value_dict, dict) : + display_text = utils.dict_or_object_get_attr(alias_value_dict, value_str, value_text) + else : + display_text = value_text + widget_line_edit.setText(display_text) + + if bk_color_str != None : + if isinstance(child, QLineEdit) : + self.modify_object_style_sheet(child, "background-color", bk_color_str) + if color_str != None : + self.modify_object_style_sheet(child, "color", color_str) + + def get_circuit_from_object(self, object :QWidget) : + parent : QWidget= object + circuit_id = -1 + while parent != None : + if hasattr(parent, "statusTip") : + tip_str = parent.statusTip() + circuit_id = get_tip_circuit(tip_str) + if circuit_id >= 0 or parent == self: + break + parent = parent.parent() + return circuit_id + + def get_main_index_from_object(self, object :QWidget) : + parent : QWidget= object + main_index = -1 + while parent != None : + if not hasattr(parent, "statusTip") : + return -1 + + tip_str = parent.statusTip() + main_index = get_tip_main_index(tip_str) + if main_index >= 0 or parent == self: + break + parent = parent.parent() + return main_index + + def get_unique_name_from_circuit(self, circuit_id : int) : + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_circuit_id == circuit_id : + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + return circuit_unique_name + return None + + def get_unique_name_from_object(self, object :QWidget) : + circuit_id = self.get_circuit_from_object(object) + return self.get_unique_name_from_circuit(circuit_id) + + def key_increase_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_end(tip_str) + + if group_items_count == -1: + next_menu_index = (self.menu_key_index + 1) % menu_count + else: + next_menu_index = (self.menu_key_index - group_items_count + 1) % menu_count + + self.menu_key_index = next_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def key_decrease_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_start(tip_str) + if group_items_count == -1: + prev_menu_index = (self.menu_key_index - 1) % menu_count + else: + prev_menu_index = (self.menu_key_index + group_items_count - 1) % menu_count + + self.menu_key_index = prev_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + + def key_enter_process(self): + menu_count = len(self.sort_menu_list) + if menu_count == 0: + return + + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.on_select_object_action_process(self.select_object) + + def key_escape_process(self): + #在菜单第一项, 按下复位, 退出到上一页 + if self.menu_key_index == 0: + self.virtual_change_to_page(-1) + + menu_count = len(self.sort_menu_list) # 获取当前页面可交互控件个数 + if menu_count == 0: # 若注册可交互控件个数为0,则退出处理,返回 + return + + # 重置菜单选择 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_key_index = 0 + self.menu_selectable_object_flush() + + + def key_Test_process0(self): + json_dict = {"Uab" :"1111", + "Ubc" : "1111", + "Uca" : "1111", + "Uo" : "11" , + "Iab" : "1111", + "Ibc" : "1111", + "Ica" : "1111", + "Io" : "1111", + "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + } + + + self.flush_widgets(0, json_dict) + + def key_Test_process1(self): + json_dict = {"Uab" :"2222", + "Ubc" : "2222", + "Uca" : "2222", + "Uo" : "22" , + "Iab" : "2222", + "Ibc" : "2222", + "Ica" : "2222", + "Io" : "2222", + "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + + + } + self.flush_widgets(1, json_dict) + + def key_Test_process2(self): + json_dict = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + self.flush_widgets(2, json_dict) + + def key_Test_process3(self): + json_dict = {"Uab" :"33333", "Ubc" : "33333", "Uca" : "33333"} + self.flush_widgets(3, json_dict) + + def menu_selectable_object_flush(self) : + menu_count = len(self.sort_menu_list) + for i in range(menu_count): + object : QWidget = self.sort_menu_list[i][1] + is_select_object_draw = False + + if isinstance(object, QPushButton) : + button_object : QPushButton = object + image_file_name = get_select_imag_file_name(object.statusTip()) + image_icon_name = get_select_icon_file_name(object.statusTip()) + + if i == self.menu_key_index: + button_object.setFocus() + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(button_object, "border-image", file_url) + elif image_icon_name != None : + is_select_object_draw = True + button_size : QSize = button_object.size() + button_object.setIcon(QIcon(image_icon_name)) + button_object.setIconSize(button_size) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(button_object) + elif image_icon_name != None : + is_select_object_draw = True + button_object.setIcon(QIcon()) + + elif isinstance(object, QLabel) : + label_object : QLabel = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(label_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(label_object) + + elif isinstance(object, QLineEdit) : + line_object : QLineEdit = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(line_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(line_object) + + + if is_select_object_draw == False : + if i == self.menu_key_index : + self.modify_object_style_sheet(object, "background-color", COLOR_BLUE) + else : + self.reset_object_style_sheet(object) + + def response_topic_message_process(self, topic: str, + message : str, + is_timeout :bool = False, inform : bool = False) : + find_reponse_topic_msg = None + for wait_topic_msg in self.wait_response_list : + if wait_topic_msg[0] == topic : + find_reponse_topic_msg = wait_topic_msg + self.wait_response_list.remove(wait_topic_msg) + break + + if find_reponse_topic_msg == None : + return + + select_object :QWidget = find_reponse_topic_msg[2] + request_message : str = find_reponse_topic_msg[1] + + inform_box : DialogInform = None + if inform : + inform_box : DialogInform = DialogInform() + + try : + json_dict = json_load_message(message) + result = utils.dict_or_object_get_attr(json_dict, "result", 0) + result = int(result) + except Exception as e: + json_dict = None + result = 0 + print_error_msg(str(e) + "invalid json message: %s" % (message)) + + if "response/action" in topic : + if is_timeout : + inform_message = "命令执行超时" + if inform == True: + inform_box.information('命令执行超时', inform_message) + else : + inform_message = '命令执行成功' if result == 1 else '命令执行失败!!!' + if inform == True: + inform_box.information('命令执行', inform_message) + elif "response/param/modify" in topic : + if is_timeout : + inform_message = '参数修改超时' + if inform == True: + inform_box.information('参数修改超时', inform_message) + else : + inform_message = '参数修改成功' if result == 1 else '参数修改失败!!!' + if inform == True: + inform_box.information('参数修改', inform_message) + if result == 1 : + self.para_or_measure_query() + elif "response/alias" in topic : + unique_name = topic.replace("response/alias/", "") + + if is_timeout : + if json_dict != None : + alias_name = None + if "name" in json_dict.keys() : + alias_name = json_dict["name"] + + if alias_name != None : + key_str = get_key_combine_str(alias_name, unique_name) + if key_str in self.alias_dict.keys() : + if isinstance(self.alias_dict[key_str], int) : + self.alias_dict[key_str] = ALIAS_QUERY_NONE + + if inform == True: + inform_box.information('获取别名超时', message) + else : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + if isinstance(json_dict, list): + for item in json_dict: + for alias_key_name, alias_dict in item.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + else: + for alias_key_name, alias_dict in json_dict.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + + def mqtt_topic_message_process(self, msg) : + topic_msg_item = True + while topic_msg_item != None : + self.mutex.lock() + topic_msg_count = len(self.topic_message_list) + if topic_msg_count > 0: + topic_msg_item = self.topic_message_list.pop(0) + else : + topic_msg_item = None + self.mutex.unlock() + if topic_msg_item != None : + topic = topic_msg_item[0] + message = topic_msg_item[1] + try : + json_dict = json_load_message(message) + except Exception as e : + json_dict = None + print_error_msg("invalid json message : %s"%(message)) + if json_dict != None: + if "measure" in topic : + circuit_id = search_circuit_from_topic(topic) + self.update_mqtt_value(circuit_id, json_dict) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.flush_widgets(circuit_id, json_dict) + elif "param/info" in topic: + circuit_id = search_circuit_from_topic(topic) + #print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response/alarm" in topic : + circuit_id = search_circuit_from_topic(topic) + self.flush_alarminfo(circuit_id, json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response" in topic : + self.response_topic_message_process(topic, message, is_timeout = False, inform = True) + + elif "alarm/test" in topic : + circuit_id = search_circuit_from_topic(topic) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + + # 将告警信息刷新到页面 + def flush_alarminfo(self, circuit, json_dict, child = None): + + alarmTitle : QLineEdit = self.findChild(QLineEdit,"alarmTitle") + if alarmTitle != None: + display_title = "%s"%(json_dict["index"]) + alarmTitle.setText(display_title) + + alarmTime : QLineEdit = self.findChild(QLineEdit,"alarmTime") + if alarmTime != None: + display_year = "%s-"%(json_dict["AlarmYear"]) + display_month = "%s-"%(json_dict["AlarmMonth"]) + display_day = "%s"%(json_dict["AlarmDay"]) + display_hour = " %s:"%(json_dict["AlarmHour"]) + display_minute = "%s: "%(json_dict["AlarmMinute"]) + display_second = "%s"%(json_dict["AlarmSecond"]) + + disp_time = display_year + display_month + display_day + display_hour+ display_minute+ display_second + alarmTime.setText(disp_time) + + alarmMsg : QLineEdit = self.findChild(QLineEdit,"alarmMsg") + if alarmMsg != None: + display_msg = "%s"%(json_dict["AlarmCodeMsg"]) + alarmMsg.setText(display_msg) + + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0: + self.mqtt_thread = mqtt_thread + self.mqtt_thread.subscribe("response/#") + self.mqtt_thread.subscribe("param/info/#") + self.mqtt_thread.subscribe("param/modify/#") + self.mqtt_thread.subscribe("measure/#") + self.mqtt_thread.subscribe("status/#") + self.mqtt_thread.subscribe("alarm/#") + self.mqtt_thread.subscribe("response/alarm/#") + self.mqtt_thread.subscribe("action/#") + else : + self.mqtt_thread = None + + def on_message(self, mqtt_thread, topic, message) : + circuit_id = search_circuit_from_topic(topic) + if circuit_id < 0 : + return + if (self.exist_circuit_mask & (0x1 << circuit_id)) == 0 : + return + self.mutex.lock() + if len(self.topic_message_list) < 100 : + self.topic_message_list.append([topic, message]) + self.mutex.unlock() + self.mqtt_signal.emit("Refresh UI") + + def response_topic_messge_timeout(self): + timer = self.sender() + for wait_response_items in self.wait_response_list: + wait_timer : QTimer = wait_response_items[3] + _inform : bool = wait_response_items[4] + + if wait_timer == timer : + topic : str = wait_response_items[0] + message : str = wait_response_items[1] + wait_timer.stop() + self.response_topic_message_process(topic, message, is_timeout=True, inform = _inform) + break + + def mqtt_publish_and_wait_response(self, publish_topic : str, publish_message : str, select_object : QWidget = None, timeout_ms : int = 1000, inform : bool = True) : + if self.mqtt_thread != None : + self.mqtt_thread.publish(publish_topic, publish_message) + + response_topic = publish_topic.replace("request", "response") + #开启超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(self.response_topic_messge_timeout) + wait_timer.start(timeout_ms) + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def para_or_measure_query(self, child = None) : + widget :QWidget = self + if child == None : + self.param_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + if "ScreenBlankingTime" in tip_str : + sbt = system_parameter() + child_widget.setText(sbt.get_screen_blanking_time()) + continue + mqtt_str = get_tip_mqtt_name(tip_str) + if mqtt_str != None and mqtt_str not in self.param_dict.keys(): + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None and self.mqtt_thread != None: + self.mqtt_thread.publish("request/param/info/"+unique_name, '{"name":"%s"}'%mqtt_str) + self.param_dict[mqtt_str] = ALIAS_QUERY_NONE + self.para_or_measure_query(child_widget) + + def flush_system_cycle(self) : + self.flush_system_info() + +if __name__ == '__main__': + + style_sheet = "QLabel {color : RED;\nbackground-color : GREEN;}" + print(style_sheet) + + new_style_items = modify_style_sheet("QLabel", style_sheet, "background-color", "WHITE") + new_style_items = modify_style_sheet("QLabel", new_style_items, "color", "YELLOW") + + print(new_style_items) + sys.exit(0) diff --git a/QT5_Project/KD_ZM_6/__init__.py b/QT5_Project/KD_ZM_6/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/KD_ZM_6/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/KD_ZM_6/get_tip_prop.py b/QT5_Project/KD_ZM_6/get_tip_prop.py new file mode 100644 index 0000000..0d98776 --- /dev/null +++ b/QT5_Project/KD_ZM_6/get_tip_prop.py @@ -0,0 +1,186 @@ +from print_color import * +import configparser +import os + +def get_value_from_lead_value_str(lead_value_str : str, lead_str, default_value = None) : + value = default_value + if lead_str in lead_value_str : + value_str = lead_value_str.replace(lead_str, "") + value_str = value_str.replace("=", "") + + try : + value = int(value_str) + except Exception as e : + pass + return value + +def get_tip_value_str(tip_str : str, key_str : str, default_string : str = None) : + value_str = default_string + if len(tip_str) == 0 : + return value_str + + tip_split_strs = tip_str.split(",") + for prop_str in tip_split_strs : + if key_str in prop_str : + prop_split_strs = prop_str.split("=") + full_cmp_str : str = prop_split_strs[0].replace(" ", "") + if len(prop_split_strs) >= 2 and full_cmp_str == key_str: + value_str = prop_split_strs[1] + return value_str + +def get_tip_value(tip_str : str, key_str : str, default_value : int) : + value_str = get_tip_value_str(tip_str, key_str) + value = default_value + try : + value = int(value_str) + except Exception as e : + value = default_value + return value + +def get_tip_visible_mqtt(tip_str : str, default_mqtt : str) : + value_str = get_tip_value_str(tip_str, "Visible", default_string = default_mqtt) + return value_str + +def get_tip_face_detection(tip_str : str) : + return get_tip_value(tip_str, "FaceDetect", default_value = 0) + +def get_tip_frame_box(tip_str : str) : + return get_tip_value(tip_str, "SelectBox", default_value = 0) + +def get_tip_page(tip_str : str) : + return get_tip_value(tip_str, "Page", default_value = -1) + +def get_tip_caption_str(tip_str : str) : + return get_tip_value_str(tip_str, "Caption", default_string = "") + +def get_tip_alias_str(tip_str : str) : + return get_tip_value_str(tip_str, "Alias", default_string = None) + +def get_tip_menu_sub_index(tip_str : str) : + return get_tip_value(tip_str, "Index", default_value = -1) + +def get_tip_timeout(tip_str : str) : + return get_tip_value(tip_str, "Timeout", default_value = -1) + +def get_tip_caption_index(tip_str : str) : + return get_tip_value(tip_str, "CaptionIndex", default_value = -1) + +def get_tip_format(tip_str : str) : + return get_tip_value_str(tip_str, "Format", default_string = "%1.0f") + +def get_tip_circuit(tip_str : str) : + return get_tip_value(tip_str, "circuit", default_value = -1) + +def get_tip_main_index(tip_str : str) : + return get_tip_value(tip_str, "main", default_value = -1) + +def get_tip_binding_circuit(tip_str : str) : + return get_tip_value(tip_str, "bindingcircuit", default_value = -1) + +# def get_tip_group_start(tip_str : str) : +# print_normal_msg(f"Tip String:{tip_str}") +# return get_tip_value(tip_str, "groupstart", default_value = -1) + +# def get_tip_group_end(tip_str : str) : +# print_normal_msg(f"Tip String:{tip_str}") +# return get_tip_value(tip_str, "groupend", default_value = -1) +def get_tip_group_start(tip_str: str): + # 创建一个局部变量来保存传入的参数 tip_str + local_tip_str = tip_str + # 直接返回状态提示信息中的组开始标签数量 + return get_tip_value(local_tip_str, "groupstart", default_value=-1) + +def get_tip_group_end(tip_str: str): + # 创建一个局部变量来保存传入的参数 tip_str + local_tip_str = tip_str + # 直接返回状态提示信息中的组结束标签数量 + return get_tip_value(local_tip_str, "groupend", default_value=-1) + +def get_tip_system(tip_str : str) : + return get_tip_value_str(tip_str, "System", default_string = None) + +def get_tip_password(tip_str : str) : + return get_tip_value_str(tip_str, "Password", default_string = None) + +#获取画布Id和摄像头Id +def get_tip_canvas_id_and_camera_id(tip_str : str) : + canvas_id = -1 + camera_id = -1 + if len(tip_str) == 0 : + return canvas_id, camera_id + + tip_split_strs = tip_str.split(",") + for prop_str in tip_split_strs : + if "canvas" in prop_str and "camera" in prop_str: + prop_split_strs = prop_str.split("=") + if len(prop_split_strs) >= 2 : + canvas_id = get_value_from_lead_value_str(prop_split_strs[0], "canvas", -1) + camera_id = get_value_from_lead_value_str(prop_split_strs[1], "camera", -1) + break + return canvas_id, camera_id + +def get_tip_mqtt_name(tip_str : str) : + mqtt_name = get_tip_value_str(tip_str, "mqtt", default_string = None) + if mqtt_name != None : + return mqtt_name + + prop_split_strs = tip_str.split(",") + if len(prop_split_strs[0]) == 0: + return None + elif "=" not in prop_split_strs[0] : + return prop_split_strs[0] + else : + return None +class system_parameter : + _instance = None + + def __new__(cls): + if cls._instance is None: + cls._instance = super().__new__(cls) + + # 阅读属性/初始化属性 + config = configparser.ConfigParser() + + if os.path.exists("system_parameter.ini"): + config.read("system_parameter.ini") + cls._instance.screen_blanking_time = config['SystemParam']['blanking_time'] + cls._instance.system_password = config['SystemParam']['password'] + cls._instance.language = config['SystemParam']['language'] + else: + cls._instance.screen_blanking_time = "060" + cls._instance.system_password = "2008" + cls._instance.language = "zh_CN" + cls._instance.write_to_ini() + return cls._instance + + + def change_screen_blanking_time(self, time): + self.screen_blanking_time = time + self.write_to_ini() + + def get_screen_blanking_time(self): + return self.screen_blanking_time + + def set_system_password(self, password): + self.system_password = password + self.write_to_ini() + + def get_system_password(self): + return self.system_password + + def set_system_language(self, language): + self.language = language + self.write_to_ini() + + def get_system_language(self): + return self.language + + # 向文件存储系统信息 + def write_to_ini(self): + system_param = configparser.ConfigParser() + system_param['SystemParam'] = {'language': self.language, + 'blanking_time': self.screen_blanking_time, + 'password': self.system_password} + with open('system_parameter.ini', 'w') as f: + system_param.write(f) + \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/image/CameraView.png b/QT5_Project/KD_ZM_6/image/CameraView.png new file mode 100644 index 0000000..de6e64d Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/CameraView.png differ diff --git a/QT5_Project/KD_ZM_6/image/DataView.png b/QT5_Project/KD_ZM_6/image/DataView.png new file mode 100644 index 0000000..fe6abd2 Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/DataView.png differ diff --git a/QT5_Project/KD_ZM_6/image/DeviceList.png b/QT5_Project/KD_ZM_6/image/DeviceList.png new file mode 100644 index 0000000..b9746c6 Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/DeviceList.png differ diff --git a/QT5_Project/KD_ZM_6/image/DeviceMenu.png b/QT5_Project/KD_ZM_6/image/DeviceMenu.png new file mode 100644 index 0000000..e080fbb Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/DeviceMenu.png differ diff --git a/QT5_Project/KD_ZM_6/image/FaultQuery.png b/QT5_Project/KD_ZM_6/image/FaultQuery.png new file mode 100644 index 0000000..4e3a6e6 Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/FaultQuery.png differ diff --git a/QT5_Project/KD_ZM_6/image/FieldTestAction.png b/QT5_Project/KD_ZM_6/image/FieldTestAction.png new file mode 100644 index 0000000..c8fed05 Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/FieldTestAction.png differ diff --git a/QT5_Project/KD_ZM_6/image/ParamSet.png b/QT5_Project/KD_ZM_6/image/ParamSet.png new file mode 100644 index 0000000..feb13ec Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/ParamSet.png differ diff --git a/QT5_Project/KD_ZM_6/image/SwitchAction.png b/QT5_Project/KD_ZM_6/image/SwitchAction.png new file mode 100644 index 0000000..ddc38be Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/SwitchAction.png differ diff --git a/QT5_Project/KD_ZM_6/image/SystemSet.png b/QT5_Project/KD_ZM_6/image/SystemSet.png new file mode 100644 index 0000000..2093ed4 Binary files /dev/null and b/QT5_Project/KD_ZM_6/image/SystemSet.png differ diff --git a/QT5_Project/KD_ZM_6/opencv/MultiFunc_V2.py b/QT5_Project/KD_ZM_6/opencv/MultiFunc_V2.py new file mode 100644 index 0000000..bb7b36b --- /dev/null +++ b/QT5_Project/KD_ZM_6/opencv/MultiFunc_V2.py @@ -0,0 +1,236 @@ +import sys +import cv2 +import time +import numpy as np +import threading +import socket +import struct, os, select + + +class GlobVar: + server_ip = '192.168.1.17' + server_port = 8000 + name_namelist = '' # 人脸匹配结果 + + event2 = threading.Event() # 用于告知socket进程,数据已准备好,可以发送给服务器了 + event3 = threading.Event() # 用于告知socket进程,允许或不允许修改name_namelist + + flag = 0 + + st_time = 0 # 记录定时1秒的起始时间 + nd_time = 0 # 记录定时1秒的结束时间 + + frame_new = [] + frame_old = [] + + sys_path = sys.path[0].replace("\\", "/") + + # 加载人脸检测模型 + tensorflowWeightFile = sys_path + "/opencv_face_detector.pbtxt" + tensorflowModelFile = sys_path + "/opencv_face_detector_uint8.pb" + + conf_threshold = 0.7 + + # net = cv2.dnn.readNetFromCaffe(caffeWeightFile, caffeModel=None) # 未找到caffee的模型文件 + net = cv2.dnn.readNetFromTensorflow(tensorflowModelFile, tensorflowWeightFile) + + faces = np.array([]) + + +class ClientNetworkThread(threading.Thread): + + def __init__(self): + self._running = True # 定义线程状态变量 + super().__init__() + + def terminate(self): + self._running = False + + def run(self): + while self._running: + if GlobVar.event2.isSet(): + sock_client_image() + time.sleep(0.02) + + +def sock_client_image(): + # 1、建立socket + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((GlobVar.server_ip, GlobVar.server_port)) + s.setblocking(0) # 设置为非阻塞模式 + except socket.error as msg: + print("%s L102" % msg) + print("未连接到服务器 L103") + try: + s.close() + except socket.error as msg: + print(msg) + return + # 2、发送图片数据,如果发送成功则等待接收,如果不成功则不进行接收 + flag = socket_send(s) + # 3、接收识别结果 + if flag: socket_recv(s) + # 4、关闭socket + try: + s.close() + except socket.error as msg: + print(msg) + + +def action(): + if len(GlobVar.faces) == 1: # 检测到有且仅有一张人脸,并且保持静止1秒 + if GlobVar.flag == 0: + GlobVar.flag = 1 + GlobVar.frame_old = GlobVar.frame_new + GlobVar.st_time = time.time() # 开始计时 + else: + if moving_detect(GlobVar.frame_old, GlobVar.frame_new): # 画面静止 + GlobVar.nd_time = time.time() # 计算时间是否达到1秒 + # print("已保持不动 {0} 秒".format(end - start)) + if GlobVar.nd_time - GlobVar.st_time >= 1 and GlobVar.flag == 1: # 计时1秒,时间到 + GlobVar.flag = 2 + print('存在单张人脸L55') + + else: # 画面有变动 + GlobVar.flag = 0 + else: # 无人脸或有多张人脸 + GlobVar.flag = 0 + if len(GlobVar.faces) > 1: + print("Error: More than one person!!!") + else: + print("No person!") + + +def function(image): + GlobVar.faces = [] # 清空 + GlobVar.name_namelist = "" # 清空 + GlobVar.event2.clear() + GlobVar.event3.set() + GlobVar.frame_new = image + + (h, w) = image.shape[:2] + blob = cv2.dnn.blobFromImage(cv2.resize(image, (300, 300)), 1.0, + (300, 300), (104.0, 177.0, 123.0)) + + GlobVar.net.setInput(blob) + detections = GlobVar.net.forward() + + for i in range(0, detections.shape[2]): + # extract the confidence (i.e., probability) associated with the + # prediction + confidence = detections[0, 0, i, 2] + # filter out weak detections by ensuring the `confidence` is + # greater than the minimum confidence + if confidence < GlobVar.conf_threshold: + continue + # compute the (x, y)-coordinates of the bounding box for the + # object + box = detections[0, 0, i, 3:7] * np.array([w, h, w, h]) + (startX, startY, endX, endY) = box.astype("int") + + GlobVar.faces.append(i) + GlobVar.faces[i] = [startX, startY, endX, endY] + # cv2.rectangle(frame, (startX, startY), (endX, endY), (0, 255, 255), 1) + + # 再根据人脸个数做出判断 + action() + + # 若存在单张人脸且静止时间达到1秒 + if GlobVar.flag == 2: + print("返回人脸位置坐标,并且发送图片到server") + GlobVar.flag = 0 + saveimage(h, w) + GlobVar.event2.set() # 告知子进程数据已准备好 + + GlobVar.event3.clear() + name = GlobVar.name_namelist + GlobVar.event3.set() + + # 返回faces和name + return GlobVar.faces, name + + +def moving_detect(img1, img2): # 比较两幅画面,判断是否静止 + grey_diff = cv2.absdiff(img1, img2) # 计算两幅图的像素差 + change = np.average(grey_diff) + if change > 10: + return False # 画面有明显变动,返回False + else: + return True # 画面无明显变动,返回True + + +def saveimage(height, width): + # 提取人脸区域并保存成图片 + for (x, y, endx, endy) in GlobVar.faces: + (w, h) = (endx - x, endy - y) + left = int(x - 0.25 * w) + if left < 0: left = 0 + right = int(x + 1.25 * w) + if right > width: right = width + top = int(y - 0.25 * h) + if top < 0: top = 0 + bottom = int(y + 1.25 * h) + if bottom > height: bottom = height + + cropped_image = GlobVar.frame_new[top:bottom, left:right] + cv2.imwrite("singleface.jpg", cropped_image) + + +def socket_send(s): + file_path = 'singleface.jpg' # 输入当前目录下的图片名 + # pack按照图片格式、图片名字、图片大小 + + fsend = struct.pack(b'128sq', # 图片打包的格式为128sq + bytes(os.path.basename(file_path), encoding='utf-8'), # 返回图片文件名,编码字节化 + os.stat(file_path).st_size) # 返回读取文件的相关属性,然后得到其中st_size的数据(记录文件大小) + try: + s.send(fsend) + except socket.error as msg: + print(msg) + return 0 # 数据发送失败,返回0 + + fp = open(file_path, 'rb') # 打开要传输的图片 + + while True: + data = fp.read(1024) # 读入图片数据,data是图片的数据字节流(由于图片字节很多,这里一次只读取1024个字节) + if not data: # 如果读到字节的数据没有了 + print('{0} send over...'.format(len(data))) + break + try: + s.send(data) # 以二进制格式发送图片数据(每次发1024个字节) + except socket.error as msg: + print(msg) + return 0 # 数据发送出错,返回0 + + print("数据已发送,开始接收...") + GlobVar.event2.clear() + return 1 # 数据发送完毕,返回1 + + +def socket_recv(s): + st1 = time.time() + response = "" + + while True: + infds, outfds, errfds = select.select([s, ], [], []) + if len(infds) > 0: # 有数据返回,不管是否成功接收,均跳出while循环 + try: + buf = s.recv(1024).decode('utf-8') + print("received: " + str(buf)) + response += str(buf) + break + except socket.error as msg: + print(msg) + break + except BlockingIOError: + break + + else: + print("no data comes back") + + st2 = time.time() + if st2 - st1 > 0.5: + break # 等待超时 + if GlobVar.event3.isSet(): + GlobVar.name_namelist = response diff --git a/QT5_Project/KD_ZM_6/opencv/MultiThreadClient_V2.py b/QT5_Project/KD_ZM_6/opencv/MultiThreadClient_V2.py new file mode 100644 index 0000000..24f49ad --- /dev/null +++ b/QT5_Project/KD_ZM_6/opencv/MultiThreadClient_V2.py @@ -0,0 +1,167 @@ +# Client主进程 +# 读取摄像头数据并显示 + +import MultiFunc_V2 as Func +import cv2 +import threading +import numpy as np +import time +import queue + +rtsp_ulr = 0 #"rtsp://192.168.1.206:554" +# rtsp_ulr = "rtsp://admin:123456@192.168.1.123/video1" + +# 自定义无缓存读视频类 +class NetCameraCapture: + """Customized VideoCapture, always read latest frame """ + + def __init__(self, camera_id): + # "camera_id" is a int type id or string name + self.cap = cv2.VideoCapture(camera_id) + self.q = queue.Queue(maxsize=3) + self.stop_threads = False # to gracefully close sub-thread + th = threading.Thread(target=self._reader) + th.daemon = True # 设置工作线程为后台运行 + th.start() + + # 实时读帧,只保存最后一帧 + def _reader(self): + while not self.stop_threads: + if self.cap.isOpened(): # 判断是否已经打开 + ret, frame = self.cap.read() + if not ret: + break + if not self.q.empty(): + try: + self.q.get_nowait() + except queue.Empty: + pass + self.q.put(frame) + + + def read(self): + return True, self.q.get() + + def get(self, id): + return self.cap.get(id) + + def release(self): + self.stop_threads = True + self.cap.release() + + +class ClientThread(threading.Thread): + + def __init__(self): + self._running = True # 定义线程状态变量 + super().__init__() + + def terminate(self): + self._running = False + + def run(self): + while self._running: + if GlobalVar.event1.isSet(): + GlobalVar.faces, temp_name = Func.function(GlobalVar.frame) + # 如果识别结果为空,且少于15张图片(约0.5s),则不更新name + if len(temp_name) < 2 and GlobalVar.i < 15: # 识别结果为空 + GlobalVar.i = GlobalVar.i + 1 + else: + GlobalVar.name = temp_name + GlobalVar.i = 0 + time.sleep(0.02) + + +class GlobalVar: + event1 = threading.Event() # 用于主进程读取摄像头图像时,不会同时取用图像 + + frame = [] + faces = np.array([]) + t = ClientThread() # 图片处理的子线程 + sk = Func.ClientNetworkThread() # 与服务器通信的子线程 + width = 0 # 图片宽度 + height = 0 # 图片高度 + + name = "" # 识别结果 + i = 0 + + +def init(): + GlobalVar.event1.clear + # 开启线程 + GlobalVar.t.start() + GlobalVar.sk.start() + + +def draw_frame(): + font = cv2.FONT_HERSHEY_COMPLEX + cv2.putText(GlobalVar.frame, "Press 'q': Quit", (20, GlobalVar.height - 30), font, 0.8, (84, 255, 159), 1, + cv2.LINE_AA) + # 显示人脸识别结果 + cv2.putText(GlobalVar.frame, GlobalVar.name, (20, GlobalVar.height - 80), font, 0.8, (84, 255, 159), 1, cv2.LINE_AA) + + if len(GlobalVar.faces) != 0: + cv2.putText(GlobalVar.frame, "Faces: " + str(len(GlobalVar.faces)), (20, 50), font, 1, (0, 0, 255), 1, + cv2.LINE_AA) + for kk, d in enumerate(GlobalVar.faces): + # 绘制矩形框 + # cv2.rectangle(GlobalVar.frame, tuple([d.left(), d.top()]), tuple([d.right(), d.bottom()]), + cv2.rectangle(GlobalVar.frame, (d[0], d[1]), (d[2], d[3]), (0, 255, 255), 2) + # 显示人脸识别结果 + cv2.putText(GlobalVar.frame, GlobalVar.name, (d[0], d[1] - 10), font, 0.8, (0, 255, 255), 1, cv2.LINE_AA) + else: + cv2.putText(GlobalVar.frame, "Faces: " + str(0), (20, 50), font, 1, (0, 0, 255), 1, cv2.LINE_AA) + + +def demo(): + # 初始化 + init() + + # 创建 cv2 摄像头对象 + # 获取摄像机来捕获实时流 参数0表示本台设备的序号为0的采集设备(camera) + # capture = cv2.VideoCapture(0) + + # 使用网络摄像头 + capture = NetCameraCapture(rtsp_ulr) + + # 获取捕获图像分辨率 + GlobalVar.width, GlobalVar.height = int(capture.get(3)), int(capture.get(4)) + print("图像尺寸:", GlobalVar.width, "x", GlobalVar.height, "px") + + i = 0 + s1 = time.time() + + while i < 1000: + i = i + 1 + + GlobalVar.event1.clear() # 置为false,不允许子进程读取图片 + + ret, GlobalVar.frame = capture.read() + # if frame is read correctly ret is True + if not ret: + print("Can't receive frame (stream end?). Exiting ...") + exit() + + GlobalVar.event1.set() # 置为true,允许子进程读取图片 + + # 在图片上绘制文字和框 + draw_frame() + + # 窗口显示 show with opencv + cv2.imshow("Face Recognition", GlobalVar.frame) + + if cv2.waitKey(1) == ord('q') or cv2.waitKey(1) == ord('Q'): + # 关闭摄像头 释放窗口 + capture.release() + cv2.destroyAllWindows() + GlobalVar.t.terminate() + break + + s2 = time.time() + print(i, " 张图片共用时:", (s2 - s1)) + GlobalVar.t.terminate() + GlobalVar.sk.terminate() + + +if __name__ == "__main__": + demo() diff --git a/QT5_Project/KD_ZM_6/opencv/Server_V2.py b/QT5_Project/KD_ZM_6/opencv/Server_V2.py new file mode 100644 index 0000000..3605d86 --- /dev/null +++ b/QT5_Project/KD_ZM_6/opencv/Server_V2.py @@ -0,0 +1,358 @@ +# 服务端版本2,接收客户端发来的图像并返回识别结果 +# -*- coding=utf-8 -*- +import socket +import threading +import sys +import os +import struct +#import dlib +import csv +import numpy as np +#import cv2 +import time + + +class GlobalVar: + ip = '' + port = 8000 + # 候选人名单 + candidate = [] + # 候选人特征向量 + descriptors = [] + + name_namelist = "" + + # 候选人脸文件夹 + faces_folder_path = "D:/JetBrains/FaceRecognation/picture/id/" + + mainpage_file = "mainpage.jpg" # 主页图片 + + detector = [] + sp = [] + facerec = [] + descriptors = [] + + +class ServerThread(threading.Thread): + + def __init__(self): + self._running = True # 定义线程状态变量 + super().__init__() + + def terminate(self): + self._running = False + + def run(self) -> None: + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + s.bind((GlobalVar.ip, GlobalVar.port)) + s.listen(10) + print("Wait for Connection.....................") + except socket.error as msg: + print(msg) + sys.exit(1) + + while self._running: + try: + sock, address = s.accept() # 等待客户端连接 + #deal_image(sock, address) + except socket.error: + print("连接失败") + + +# 接收并处理图片 +def deal_image(sock, address): + global name_namelist + print("Accept connection from {0}".format(address)) # 查看发送端的ip和端口 + st1 = time.time() + while True: + fileinfo_size = struct.calcsize('128sq') # 申请相同大小的空间存放发送过来的文件名与文件大小信息 + # print('fileinfo_size is', fileinfo_size) + buf = sock.recv(fileinfo_size) # 接收图片名 + # 判断是否接收到文件头信息 + if buf: # 如果接收到了数据就开始接下来的操作 + filename, filesize = struct.unpack('128sq', buf) # 按照客户端打包的格式进行解包,得到图片的名字和图片大小 + # print('filename :', filename.decode(), 'filesize :', filesize) + fn = filename.strip(b'\00') + fn = fn.decode() + print('file new name is {0}, filesize is {1}'.format(str(fn), filesize)) + + new_filename = os.path.join(str('./'), str('new_') + fn) + + # 在服务器端新建图片名(可以不用新建的,直接用原来的也行,只要客户端和服务器不是同一个系统或接收到的图片和原图片不在一个文件夹下) + recvd_size = 0 + fp = open(new_filename, 'wb') # 二进制打开文件 + print('start receiving...') + + while not recvd_size == filesize: # 如果收到的直接总数不等于这个文件的直接总数,那么就继续接受数据 + if filesize - recvd_size > 1024: # 这个不是最后一次 + try: + data = sock.recv(1024) # 每次从客户端接受1024个字节 + recvd_size += len(data) # 每次都记录好收到的字节数,然后叠加上去 + except socket.error as msg: + print(msg) + + else: # 这个最后一次数据如果比1024少的话那么这一次读完就OK了,而且这次结束后循环也就结束了 + try: + data = sock.recv(filesize - recvd_size) + recvd_size = filesize + except socket.error as msg: + print(msg) + # print('data is', data) # 输出每一次收到的数据 + fp.write(data) # 写入图片数据,因为每次都是读取到1024个字节,所以每一次读取都需要把得到的字节进行拼凑 + fp.close() + print('end receive...') + + analysize(new_filename) + + try: + sock.send(GlobalVar.name_namelist.encode('utf-8')) + print("Name is sent back already: " + GlobalVar.name_namelist) + except socket.error as msg: + print(msg) + + st2 = time.time() + + if st2 - st1 > 2: + break + + sock.close() + + +def analysize(new_filename): + str1 = str(new_filename).replace("b'./", "") + str2 = str1.replace("'", "") + + features_cap_arr = [] + + image = cv2.imread(str2) + # cv2.imshow("Server", image) + cv2.waitKey(1) + try: + gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + except: + return + + faces2 = GlobalVar.detector(gray, 0) + + if len(faces2) == 0: return # 相片中不存在人脸,直接返回 + + # 获取当前捕获到的图像的人脸特征,存储到 features_cap_arr + shape = GlobalVar.sp(image, faces2[0]) + features_cap_arr.append(GlobalVar.facerec.compute_face_descriptor(image, shape)) + + # 先默认不认识,是 unknown + GlobalVar.name_namelist = "Unknown person" + + # 对于某张人脸,遍历所有存储的人脸特征 + # for every faces detected, compare the faces in the database + e_distance_list = [] + for i in range(len(GlobalVar.descriptors)): + # 如果 person_X 数据不为空 + if str(GlobalVar.descriptors[i][0]) != '0.0': + # print("with person", str(i + 1), "the e distance: ", end='') + e_distance_tmp = return_euclidean_distance(features_cap_arr[0], GlobalVar.descriptors[i]) + # print(e_distance_tmp) + e_distance_list.append(e_distance_tmp) + else: + # 空数据 person_X + e_distance_list.append(999999999) + # Find the one with minimum e distance + similar_person_num = e_distance_list.index(min(e_distance_list)) + # print("Minimum e distance with person:", candidate[int(similar_person_num)]) + + if min(e_distance_list) < 0.45: + GlobalVar.name_namelist = GlobalVar.candidate[int(similar_person_num)] + print("In Server: The person may be " + GlobalVar.name_namelist) + + +def init(): + # 加载正脸检测器 + # GlobalVar.detector = dlib.get_frontal_face_detector() + + # 加载人脸关键点检测器 + ##GlobalVar.facerec = dlib.face_recognition_model_v1( + # "D:/JetBrains/FaceRecognation/model/dlib_face_recognition_resnet_model_v1.dat") + + + # 7. 获取本机IP地址 + hostname = socket.gethostname() + GlobalVar.ip = socket.gethostbyname(hostname) + print("本机地址:", GlobalVar.ip) + + +def load_csv(): + with open('D:/JetBrains/FaceRecognation/feature.csv', 'r') as file: + csv_reader = csv.reader(file) + for row in csv_reader: + # 转换为numpy array + v = np.array(row) + v_data = [float(x) for x in v] # 将数据从string形式转换为float形式 + GlobalVar.descriptors.append(v_data) + + file.close() + + +def load_names(): + with open('D:/JetBrains/FaceRecognation/names.txt', 'r', encoding="utf-8") as namesfile: + line = namesfile.readline() + while line: + line = line.replace('\n', '') + GlobalVar.candidate.append(line) + line = namesfile.readline() + + namesfile.close() + + +def show_mainpage(): + #mp = cv2.imread(GlobalVar.mainpage_file) + (h, w) = mp.shape[:2] + #resized = cv2.resize(mp, (w // 2, h // 2), interpolation=cv2.INTER_LINEAR) + #cv2.imshow("MainPage", resized) + #cv2.waitKey(10) + + +def predict(descriptors, img): + # 对需识别人脸进行同样处理 + # 提取描述子 + + dets = GlobalVar.detector(img, 1) + + dist = [] + for k, d in enumerate(dets): + shape = GlobalVar.sp(img, d) + face_descriptor = GlobalVar.facerec.compute_face_descriptor(img, shape) + d_test = np.array(face_descriptor) + + # 计算欧式距离 + for i in descriptors: + dist_ = np.linalg.norm(i - d_test) + dist.append(dist_) + return dist + + +def return_euclidean_distance(feature_1, feature_2): + feature_1 = np.array(feature_1) + feature_2 = np.array(feature_2) + dist = np.sqrt(np.sum(np.square(feature_1 - feature_2))) + return dist + + +def Save(): + #cap = cv2.VideoCapture(0) # 从摄像头获取图像 + flag = 0 + time1 = time.time() # 计时开始 + while flag != 2: + ret, frame = cap.read() # if frame is read correctly ret is True + if not ret: + print("Can't receive frame (stream end?). Exiting ...") + exit() + #cv2.imshow("MainPage", frame) + #cv2.waitKey(10) + + #frame_gray = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) + #faces = GlobalVar.detector(frame_gray, 0) + + if (len(faces) == 1): # 检测到有且仅有一张人脸,并且保持静止1秒 + if (flag == 0): + flag = 1 + frame_gray_old = frame_gray + start = time.time() # 开始计时 + else: + if (moving_detect(frame_gray_old, frame_gray) and flag == 1): # 画面静止 + end = time.time() # 计算时间是否达到1秒 + if (end - start >= 1): # 计时1秒,时间到 + cv2.destroyWindow("MainPage") + SavePic(frame) # 保存图像 + flag = 2 # 退出while循环 + + else: # 画面有变动 + flag = 0 + else: # 无人脸或有多张人脸 + flag = 0 + if (len(faces) > 1): + print("Error: More than 1 person!!!") + + time2 = time.time() + if (time2 - time1 > 10): # 超时退出 + break + + cap.release() + + +def SavePic(img): + filename = input("Please input your name (in English):") # 输入姓名(拼音) + + confirm = input("Your name is " + filename + ". Please confirm: Y/N:") + + if (filename != "" and (confirm == "Y" or confirm == "y")): + # 保存图片 + save_path = os.path.join(GlobalVar.faces_folder_path, filename + ".jpg") # 构建保存路径 + cv2.imwrite(save_path, img) + Add2CSV(img) # 更新人脸特征CSV文件 + Add2TXT(filename) # 更新候选人名单 + load_names() # 重新加载候选人名单 + load_csv() # 重新加载全部人脸特征 + + +def Add2CSV(img): + with open('feature.csv', "a", newline="") as csvfile: + writer = csv.writer(csvfile) + # 1.人脸检测 + dets = GlobalVar.detector(img, 1) + + for k, d in enumerate(dets): + # 2.关键点检测 + shape = GlobalVar.sp(img, d) + + # 3.描述子提取,128D向量 + face_descriptor = GlobalVar.facerec.compute_face_descriptor(img, shape) + + # 转换为numpy array + v = np.array(face_descriptor) + + writer.writerow(v) # 按行写入到Csv文件中 + + csvfile.close() + + +def Add2TXT(filename): + with open('names.txt', "a", newline="", encoding="utf-8") as namesfile: + namesfile.write(filename + '\n') + + namesfile.close() + + +def moving_detect(img1, img2): # 比较两幅画面,判断是否静止 + grey_diff = cv2.absdiff(img1, img2) # 计算两幅图的像素差 + change = np.average(grey_diff) + if (change > 10): + return False # 画面有明显变动,返回False + else: + return True # 画面无明显变动,返回True + + +def Reset(): + cv2.destroyAllWindows() + init() + + +if __name__ == '__main__': + init() + # 开启线程 + t = ServerThread() + t.start() +''' + while True: + if cv2.waitKey(1) == ord('s') or cv2.waitKey(1) == ord('S'): + Save() # 保存图像 + show_mainpage() + if cv2.waitKey(1) == ord('r') or cv2.waitKey(1) == ord('R'): + Reset() # 重新启动服务器 + if cv2.waitKey(1) == ord('q') or cv2.waitKey(1) == ord('Q'): + # 释放窗口 + cv2.destroyAllWindows() + t.terminate() # 关闭子线程 + break + ''' diff --git a/QT5_Project/KD_ZM_6/opencv/opencv_face_detector.pbtxt b/QT5_Project/KD_ZM_6/opencv/opencv_face_detector.pbtxt new file mode 100644 index 0000000..5f498aa --- /dev/null +++ b/QT5_Project/KD_ZM_6/opencv/opencv_face_detector.pbtxt @@ -0,0 +1,2362 @@ +node { + name: "data" + op: "Placeholder" + attr { + key: "dtype" + value { + type: DT_FLOAT + } + } +} +node { + name: "data_bn/FusedBatchNorm" + op: "FusedBatchNorm" + input: "data:0" + input: "data_bn/gamma" + input: "data_bn/beta" + input: "data_bn/mean" + input: "data_bn/std" + attr { + key: "epsilon" + value { + f: 1.00099996416e-05 + } + } +} +node { + name: "data_scale/Mul" + op: "Mul" + input: "data_bn/FusedBatchNorm" + input: "data_scale/mul" +} +node { + name: "data_scale/BiasAdd" + op: "BiasAdd" + input: "data_scale/Mul" + input: "data_scale/add" +} +node { + name: "SpaceToBatchND/block_shape" + op: "Const" + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 2 + } + } + int_val: 1 + int_val: 1 + } + } + } +} +node { + name: "SpaceToBatchND/paddings" + op: "Const" + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 2 + } + dim { + size: 2 + } + } + int_val: 3 + int_val: 3 + int_val: 3 + int_val: 3 + } + } + } +} +node { + name: "Pad" + op: "SpaceToBatchND" + input: "data_scale/BiasAdd" + input: "SpaceToBatchND/block_shape" + input: "SpaceToBatchND/paddings" +} +node { + name: "conv1_h/Conv2D" + op: "Conv2D" + input: "Pad" + input: "conv1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "VALID" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "conv1_h/BiasAdd" + op: "BiasAdd" + input: "conv1_h/Conv2D" + input: "conv1_h/bias" +} +node { + name: "BatchToSpaceND" + op: "BatchToSpaceND" + input: "conv1_h/BiasAdd" +} +node { + name: "conv1_bn_h/FusedBatchNorm" + op: "FusedBatchNorm" + input: "BatchToSpaceND" + input: "conv1_bn_h/gamma" + input: "conv1_bn_h/beta" + input: "conv1_bn_h/mean" + input: "conv1_bn_h/std" + attr { + key: "epsilon" + value { + f: 1.00099996416e-05 + } + } +} +node { + name: "conv1_scale_h/Mul" + op: "Mul" + input: "conv1_bn_h/FusedBatchNorm" + input: "conv1_scale_h/mul" +} +node { + name: "conv1_scale_h/BiasAdd" + op: "BiasAdd" + input: "conv1_scale_h/Mul" + input: "conv1_scale_h/add" +} +node { + name: "Relu" + op: "Relu" + input: "conv1_scale_h/BiasAdd" +} +node { + name: "conv1_pool/MaxPool" + op: "MaxPool" + input: "Relu" + attr { + key: "ksize" + value { + list { + i: 1 + i: 3 + i: 3 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "layer_64_1_conv1_h/Conv2D" + op: "Conv2D" + input: "conv1_pool/MaxPool" + input: "layer_64_1_conv1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "layer_64_1_bn2_h/FusedBatchNorm" + op: "BiasAdd" + input: "layer_64_1_conv1_h/Conv2D" + input: "layer_64_1_conv1_h/Conv2D_bn_offset" +} +node { + name: "layer_64_1_scale2_h/Mul" + op: "Mul" + input: "layer_64_1_bn2_h/FusedBatchNorm" + input: "layer_64_1_scale2_h/mul" +} +node { + name: "layer_64_1_scale2_h/BiasAdd" + op: "BiasAdd" + input: "layer_64_1_scale2_h/Mul" + input: "layer_64_1_scale2_h/add" +} +node { + name: "Relu_1" + op: "Relu" + input: "layer_64_1_scale2_h/BiasAdd" +} +node { + name: "layer_64_1_conv2_h/Conv2D" + op: "Conv2D" + input: "Relu_1" + input: "layer_64_1_conv2_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "add" + op: "Add" + input: "layer_64_1_conv2_h/Conv2D" + input: "conv1_pool/MaxPool" +} +node { + name: "layer_128_1_bn1_h/FusedBatchNorm" + op: "FusedBatchNorm" + input: "add" + input: "layer_128_1_bn1_h/gamma" + input: "layer_128_1_bn1_h/beta" + input: "layer_128_1_bn1_h/mean" + input: "layer_128_1_bn1_h/std" + attr { + key: "epsilon" + value { + f: 1.00099996416e-05 + } + } +} +node { + name: "layer_128_1_scale1_h/Mul" + op: "Mul" + input: "layer_128_1_bn1_h/FusedBatchNorm" + input: "layer_128_1_scale1_h/mul" +} +node { + name: "layer_128_1_scale1_h/BiasAdd" + op: "BiasAdd" + input: "layer_128_1_scale1_h/Mul" + input: "layer_128_1_scale1_h/add" +} +node { + name: "Relu_2" + op: "Relu" + input: "layer_128_1_scale1_h/BiasAdd" +} +node { + name: "layer_128_1_conv_expand_h/Conv2D" + op: "Conv2D" + input: "Relu_2" + input: "layer_128_1_conv_expand_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "layer_128_1_conv1_h/Conv2D" + op: "Conv2D" + input: "Relu_2" + input: "layer_128_1_conv1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "layer_128_1_bn2/FusedBatchNorm" + op: "BiasAdd" + input: "layer_128_1_conv1_h/Conv2D" + input: "layer_128_1_conv1_h/Conv2D_bn_offset" +} +node { + name: "layer_128_1_scale2/Mul" + op: "Mul" + input: "layer_128_1_bn2/FusedBatchNorm" + input: "layer_128_1_scale2/mul" +} +node { + name: "layer_128_1_scale2/BiasAdd" + op: "BiasAdd" + input: "layer_128_1_scale2/Mul" + input: "layer_128_1_scale2/add" +} +node { + name: "Relu_3" + op: "Relu" + input: "layer_128_1_scale2/BiasAdd" +} +node { + name: "layer_128_1_conv2/Conv2D" + op: "Conv2D" + input: "Relu_3" + input: "layer_128_1_conv2/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "add_1" + op: "Add" + input: "layer_128_1_conv2/Conv2D" + input: "layer_128_1_conv_expand_h/Conv2D" +} +node { + name: "layer_256_1_bn1/FusedBatchNorm" + op: "FusedBatchNorm" + input: "add_1" + input: "layer_256_1_bn1/gamma" + input: "layer_256_1_bn1/beta" + input: "layer_256_1_bn1/mean" + input: "layer_256_1_bn1/std" + attr { + key: "epsilon" + value { + f: 1.00099996416e-05 + } + } +} +node { + name: "layer_256_1_scale1/Mul" + op: "Mul" + input: "layer_256_1_bn1/FusedBatchNorm" + input: "layer_256_1_scale1/mul" +} +node { + name: "layer_256_1_scale1/BiasAdd" + op: "BiasAdd" + input: "layer_256_1_scale1/Mul" + input: "layer_256_1_scale1/add" +} +node { + name: "Relu_4" + op: "Relu" + input: "layer_256_1_scale1/BiasAdd" +} +node { + name: "SpaceToBatchND_1/paddings" + op: "Const" + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 2 + } + dim { + size: 2 + } + } + int_val: 1 + int_val: 1 + int_val: 1 + int_val: 1 + } + } + } +} +node { + name: "layer_256_1_conv_expand/Conv2D" + op: "Conv2D" + input: "Relu_4" + input: "layer_256_1_conv_expand/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "conv4_3_norm/l2_normalize" + op: "L2Normalize" + input: "Relu_4:0" + input: "conv4_3_norm/l2_normalize/Sum/reduction_indices" +} +node { + name: "conv4_3_norm/mul_1" + op: "Mul" + input: "conv4_3_norm/l2_normalize" + input: "conv4_3_norm/mul" +} +node { + name: "conv4_3_norm_mbox_loc/Conv2D" + op: "Conv2D" + input: "conv4_3_norm/mul_1" + input: "conv4_3_norm_mbox_loc/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv4_3_norm_mbox_loc/BiasAdd" + op: "BiasAdd" + input: "conv4_3_norm_mbox_loc/Conv2D" + input: "conv4_3_norm_mbox_loc/bias" +} +node { + name: "flatten/Reshape" + op: "Flatten" + input: "conv4_3_norm_mbox_loc/BiasAdd" +} +node { + name: "conv4_3_norm_mbox_conf/Conv2D" + op: "Conv2D" + input: "conv4_3_norm/mul_1" + input: "conv4_3_norm_mbox_conf/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv4_3_norm_mbox_conf/BiasAdd" + op: "BiasAdd" + input: "conv4_3_norm_mbox_conf/Conv2D" + input: "conv4_3_norm_mbox_conf/bias" +} +node { + name: "flatten_6/Reshape" + op: "Flatten" + input: "conv4_3_norm_mbox_conf/BiasAdd" +} +node { + name: "Pad_1" + op: "SpaceToBatchND" + input: "Relu_4" + input: "SpaceToBatchND/block_shape" + input: "SpaceToBatchND_1/paddings" +} +node { + name: "layer_256_1_conv1/Conv2D" + op: "Conv2D" + input: "Pad_1" + input: "layer_256_1_conv1/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "VALID" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "layer_256_1_bn2/FusedBatchNorm" + op: "BiasAdd" + input: "layer_256_1_conv1/Conv2D" + input: "layer_256_1_conv1/Conv2D_bn_offset" +} +node { + name: "BatchToSpaceND_1" + op: "BatchToSpaceND" + input: "layer_256_1_bn2/FusedBatchNorm" +} +node { + name: "layer_256_1_scale2/Mul" + op: "Mul" + input: "BatchToSpaceND_1" + input: "layer_256_1_scale2/mul" +} +node { + name: "layer_256_1_scale2/BiasAdd" + op: "BiasAdd" + input: "layer_256_1_scale2/Mul" + input: "layer_256_1_scale2/add" +} +node { + name: "Relu_5" + op: "Relu" + input: "layer_256_1_scale2/BiasAdd" +} +node { + name: "layer_256_1_conv2/Conv2D" + op: "Conv2D" + input: "Relu_5" + input: "layer_256_1_conv2/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "add_2" + op: "Add" + input: "layer_256_1_conv2/Conv2D" + input: "layer_256_1_conv_expand/Conv2D" +} +node { + name: "layer_512_1_bn1/FusedBatchNorm" + op: "FusedBatchNorm" + input: "add_2" + input: "layer_512_1_bn1/gamma" + input: "layer_512_1_bn1/beta" + input: "layer_512_1_bn1/mean" + input: "layer_512_1_bn1/std" + attr { + key: "epsilon" + value { + f: 1.00099996416e-05 + } + } +} +node { + name: "layer_512_1_scale1/Mul" + op: "Mul" + input: "layer_512_1_bn1/FusedBatchNorm" + input: "layer_512_1_scale1/mul" +} +node { + name: "layer_512_1_scale1/BiasAdd" + op: "BiasAdd" + input: "layer_512_1_scale1/Mul" + input: "layer_512_1_scale1/add" +} +node { + name: "Relu_6" + op: "Relu" + input: "layer_512_1_scale1/BiasAdd" +} +node { + name: "layer_512_1_conv_expand_h/Conv2D" + op: "Conv2D" + input: "Relu_6" + input: "layer_512_1_conv_expand_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "layer_512_1_conv1_h/Conv2D" + op: "Conv2D" + input: "Relu_6" + input: "layer_512_1_conv1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "layer_512_1_bn2_h/FusedBatchNorm" + op: "BiasAdd" + input: "layer_512_1_conv1_h/Conv2D" + input: "layer_512_1_conv1_h/Conv2D_bn_offset" +} +node { + name: "layer_512_1_scale2_h/Mul" + op: "Mul" + input: "layer_512_1_bn2_h/FusedBatchNorm" + input: "layer_512_1_scale2_h/mul" +} +node { + name: "layer_512_1_scale2_h/BiasAdd" + op: "BiasAdd" + input: "layer_512_1_scale2_h/Mul" + input: "layer_512_1_scale2_h/add" +} +node { + name: "Relu_7" + op: "Relu" + input: "layer_512_1_scale2_h/BiasAdd" +} +node { + name: "layer_512_1_conv2_h/convolution/SpaceToBatchND" + op: "SpaceToBatchND" + input: "Relu_7" + input: "layer_512_1_conv2_h/convolution/SpaceToBatchND/block_shape" + input: "layer_512_1_conv2_h/convolution/SpaceToBatchND/paddings" +} +node { + name: "layer_512_1_conv2_h/convolution" + op: "Conv2D" + input: "layer_512_1_conv2_h/convolution/SpaceToBatchND" + input: "layer_512_1_conv2_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "VALID" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "layer_512_1_conv2_h/convolution/BatchToSpaceND" + op: "BatchToSpaceND" + input: "layer_512_1_conv2_h/convolution" + input: "layer_512_1_conv2_h/convolution/BatchToSpaceND/block_shape" + input: "layer_512_1_conv2_h/convolution/BatchToSpaceND/crops" +} +node { + name: "add_3" + op: "Add" + input: "layer_512_1_conv2_h/convolution/BatchToSpaceND" + input: "layer_512_1_conv_expand_h/Conv2D" +} +node { + name: "last_bn_h/FusedBatchNorm" + op: "FusedBatchNorm" + input: "add_3" + input: "last_bn_h/gamma" + input: "last_bn_h/beta" + input: "last_bn_h/mean" + input: "last_bn_h/std" + attr { + key: "epsilon" + value { + f: 1.00099996416e-05 + } + } +} +node { + name: "last_scale_h/Mul" + op: "Mul" + input: "last_bn_h/FusedBatchNorm" + input: "last_scale_h/mul" +} +node { + name: "last_scale_h/BiasAdd" + op: "BiasAdd" + input: "last_scale_h/Mul" + input: "last_scale_h/add" +} +node { + name: "last_relu" + op: "Relu" + input: "last_scale_h/BiasAdd" +} +node { + name: "conv6_1_h/Conv2D" + op: "Conv2D" + input: "last_relu" + input: "conv6_1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv6_1_h/BiasAdd" + op: "BiasAdd" + input: "conv6_1_h/Conv2D" + input: "conv6_1_h/bias" +} +node { + name: "conv6_1_h/Relu" + op: "Relu" + input: "conv6_1_h/BiasAdd" +} +node { + name: "conv6_2_h/Conv2D" + op: "Conv2D" + input: "conv6_1_h/Relu" + input: "conv6_2_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "conv6_2_h/BiasAdd" + op: "BiasAdd" + input: "conv6_2_h/Conv2D" + input: "conv6_2_h/bias" +} +node { + name: "conv6_2_h/Relu" + op: "Relu" + input: "conv6_2_h/BiasAdd" +} +node { + name: "conv7_1_h/Conv2D" + op: "Conv2D" + input: "conv6_2_h/Relu" + input: "conv7_1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv7_1_h/BiasAdd" + op: "BiasAdd" + input: "conv7_1_h/Conv2D" + input: "conv7_1_h/bias" +} +node { + name: "conv7_1_h/Relu" + op: "Relu" + input: "conv7_1_h/BiasAdd" +} +node { + name: "Pad_2" + op: "SpaceToBatchND" + input: "conv7_1_h/Relu" + input: "SpaceToBatchND/block_shape" + input: "SpaceToBatchND_1/paddings" +} +node { + name: "conv7_2_h/Conv2D" + op: "Conv2D" + input: "Pad_2" + input: "conv7_2_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "VALID" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 2 + i: 2 + i: 1 + } + } + } +} +node { + name: "conv7_2_h/BiasAdd" + op: "BiasAdd" + input: "conv7_2_h/Conv2D" + input: "conv7_2_h/bias" +} +node { + name: "BatchToSpaceND_2" + op: "BatchToSpaceND" + input: "conv7_2_h/BiasAdd" +} +node { + name: "conv7_2_h/Relu" + op: "Relu" + input: "BatchToSpaceND_2" +} +node { + name: "conv8_1_h/Conv2D" + op: "Conv2D" + input: "conv7_2_h/Relu" + input: "conv8_1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv8_1_h/BiasAdd" + op: "BiasAdd" + input: "conv8_1_h/Conv2D" + input: "conv8_1_h/bias" +} +node { + name: "conv8_1_h/Relu" + op: "Relu" + input: "conv8_1_h/BiasAdd" +} +node { + name: "conv8_2_h/Conv2D" + op: "Conv2D" + input: "conv8_1_h/Relu" + input: "conv8_2_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv8_2_h/BiasAdd" + op: "BiasAdd" + input: "conv8_2_h/Conv2D" + input: "conv8_2_h/bias" +} +node { + name: "conv8_2_h/Relu" + op: "Relu" + input: "conv8_2_h/BiasAdd" +} +node { + name: "conv9_1_h/Conv2D" + op: "Conv2D" + input: "conv8_2_h/Relu" + input: "conv9_1_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv9_1_h/BiasAdd" + op: "BiasAdd" + input: "conv9_1_h/Conv2D" + input: "conv9_1_h/bias" +} +node { + name: "conv9_1_h/Relu" + op: "Relu" + input: "conv9_1_h/BiasAdd" +} +node { + name: "conv9_2_h/Conv2D" + op: "Conv2D" + input: "conv9_1_h/Relu" + input: "conv9_2_h/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv9_2_h/BiasAdd" + op: "BiasAdd" + input: "conv9_2_h/Conv2D" + input: "conv9_2_h/bias" +} +node { + name: "conv9_2_h/Relu" + op: "Relu" + input: "conv9_2_h/BiasAdd" +} +node { + name: "conv9_2_mbox_loc/Conv2D" + op: "Conv2D" + input: "conv9_2_h/Relu" + input: "conv9_2_mbox_loc/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv9_2_mbox_loc/BiasAdd" + op: "BiasAdd" + input: "conv9_2_mbox_loc/Conv2D" + input: "conv9_2_mbox_loc/bias" +} +node { + name: "flatten_5/Reshape" + op: "Flatten" + input: "conv9_2_mbox_loc/BiasAdd" +} +node { + name: "conv9_2_mbox_conf/Conv2D" + op: "Conv2D" + input: "conv9_2_h/Relu" + input: "conv9_2_mbox_conf/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv9_2_mbox_conf/BiasAdd" + op: "BiasAdd" + input: "conv9_2_mbox_conf/Conv2D" + input: "conv9_2_mbox_conf/bias" +} +node { + name: "flatten_11/Reshape" + op: "Flatten" + input: "conv9_2_mbox_conf/BiasAdd" +} +node { + name: "conv8_2_mbox_loc/Conv2D" + op: "Conv2D" + input: "conv8_2_h/Relu" + input: "conv8_2_mbox_loc/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv8_2_mbox_loc/BiasAdd" + op: "BiasAdd" + input: "conv8_2_mbox_loc/Conv2D" + input: "conv8_2_mbox_loc/bias" +} +node { + name: "flatten_4/Reshape" + op: "Flatten" + input: "conv8_2_mbox_loc/BiasAdd" +} +node { + name: "conv8_2_mbox_conf/Conv2D" + op: "Conv2D" + input: "conv8_2_h/Relu" + input: "conv8_2_mbox_conf/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv8_2_mbox_conf/BiasAdd" + op: "BiasAdd" + input: "conv8_2_mbox_conf/Conv2D" + input: "conv8_2_mbox_conf/bias" +} +node { + name: "flatten_10/Reshape" + op: "Flatten" + input: "conv8_2_mbox_conf/BiasAdd" +} +node { + name: "conv7_2_mbox_loc/Conv2D" + op: "Conv2D" + input: "conv7_2_h/Relu" + input: "conv7_2_mbox_loc/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv7_2_mbox_loc/BiasAdd" + op: "BiasAdd" + input: "conv7_2_mbox_loc/Conv2D" + input: "conv7_2_mbox_loc/bias" +} +node { + name: "flatten_3/Reshape" + op: "Flatten" + input: "conv7_2_mbox_loc/BiasAdd" +} +node { + name: "conv7_2_mbox_conf/Conv2D" + op: "Conv2D" + input: "conv7_2_h/Relu" + input: "conv7_2_mbox_conf/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv7_2_mbox_conf/BiasAdd" + op: "BiasAdd" + input: "conv7_2_mbox_conf/Conv2D" + input: "conv7_2_mbox_conf/bias" +} +node { + name: "flatten_9/Reshape" + op: "Flatten" + input: "conv7_2_mbox_conf/BiasAdd" +} +node { + name: "conv6_2_mbox_loc/Conv2D" + op: "Conv2D" + input: "conv6_2_h/Relu" + input: "conv6_2_mbox_loc/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv6_2_mbox_loc/BiasAdd" + op: "BiasAdd" + input: "conv6_2_mbox_loc/Conv2D" + input: "conv6_2_mbox_loc/bias" +} +node { + name: "flatten_2/Reshape" + op: "Flatten" + input: "conv6_2_mbox_loc/BiasAdd" +} +node { + name: "conv6_2_mbox_conf/Conv2D" + op: "Conv2D" + input: "conv6_2_h/Relu" + input: "conv6_2_mbox_conf/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "conv6_2_mbox_conf/BiasAdd" + op: "BiasAdd" + input: "conv6_2_mbox_conf/Conv2D" + input: "conv6_2_mbox_conf/bias" +} +node { + name: "flatten_8/Reshape" + op: "Flatten" + input: "conv6_2_mbox_conf/BiasAdd" +} +node { + name: "fc7_mbox_loc/Conv2D" + op: "Conv2D" + input: "last_relu" + input: "fc7_mbox_loc/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "fc7_mbox_loc/BiasAdd" + op: "BiasAdd" + input: "fc7_mbox_loc/Conv2D" + input: "fc7_mbox_loc/bias" +} +node { + name: "flatten_1/Reshape" + op: "Flatten" + input: "fc7_mbox_loc/BiasAdd" +} +node { + name: "mbox_loc" + op: "ConcatV2" + input: "flatten/Reshape" + input: "flatten_1/Reshape" + input: "flatten_2/Reshape" + input: "flatten_3/Reshape" + input: "flatten_4/Reshape" + input: "flatten_5/Reshape" + input: "mbox_loc/axis" +} +node { + name: "fc7_mbox_conf/Conv2D" + op: "Conv2D" + input: "last_relu" + input: "fc7_mbox_conf/weights" + attr { + key: "dilations" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } + attr { + key: "padding" + value { + s: "SAME" + } + } + attr { + key: "strides" + value { + list { + i: 1 + i: 1 + i: 1 + i: 1 + } + } + } +} +node { + name: "fc7_mbox_conf/BiasAdd" + op: "BiasAdd" + input: "fc7_mbox_conf/Conv2D" + input: "fc7_mbox_conf/bias" +} +node { + name: "flatten_7/Reshape" + op: "Flatten" + input: "fc7_mbox_conf/BiasAdd" +} +node { + name: "mbox_conf" + op: "ConcatV2" + input: "flatten_6/Reshape" + input: "flatten_7/Reshape" + input: "flatten_8/Reshape" + input: "flatten_9/Reshape" + input: "flatten_10/Reshape" + input: "flatten_11/Reshape" + input: "mbox_conf/axis" +} +node { + name: "mbox_conf_reshape" + op: "Reshape" + input: "mbox_conf" + input: "reshape_before_softmax" +} +node { + name: "mbox_conf_softmax" + op: "Softmax" + input: "mbox_conf_reshape" + attr { + key: "axis" + value { + i: 2 + } + } +} +node { + name: "mbox_conf_flatten" + op: "Flatten" + input: "mbox_conf_softmax" +} +node { + name: "PriorBox_0" + op: "PriorBox" + input: "conv4_3_norm/mul_1" + input: "data" + attr { + key: "aspect_ratio" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 1 + } + } + float_val: 2.0 + } + } + } + attr { + key: "clip" + value { + b: false + } + } + attr { + key: "flip" + value { + b: true + } + } + attr { + key: "max_size" + value { + i: 60 + } + } + attr { + key: "min_size" + value { + i: 30 + } + } + attr { + key: "offset" + value { + f: 0.5 + } + } + attr { + key: "step" + value { + f: 8.0 + } + } + attr { + key: "variance" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 4 + } + } + float_val: 0.10000000149 + float_val: 0.10000000149 + float_val: 0.20000000298 + float_val: 0.20000000298 + } + } + } +} +node { + name: "PriorBox_1" + op: "PriorBox" + input: "last_relu" + input: "data" + attr { + key: "aspect_ratio" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 2 + } + } + float_val: 2.0 + float_val: 3.0 + } + } + } + attr { + key: "clip" + value { + b: false + } + } + attr { + key: "flip" + value { + b: true + } + } + attr { + key: "max_size" + value { + i: 111 + } + } + attr { + key: "min_size" + value { + i: 60 + } + } + attr { + key: "offset" + value { + f: 0.5 + } + } + attr { + key: "step" + value { + f: 16.0 + } + } + attr { + key: "variance" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 4 + } + } + float_val: 0.10000000149 + float_val: 0.10000000149 + float_val: 0.20000000298 + float_val: 0.20000000298 + } + } + } +} +node { + name: "PriorBox_2" + op: "PriorBox" + input: "conv6_2_h/Relu" + input: "data" + attr { + key: "aspect_ratio" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 2 + } + } + float_val: 2.0 + float_val: 3.0 + } + } + } + attr { + key: "clip" + value { + b: false + } + } + attr { + key: "flip" + value { + b: true + } + } + attr { + key: "max_size" + value { + i: 162 + } + } + attr { + key: "min_size" + value { + i: 111 + } + } + attr { + key: "offset" + value { + f: 0.5 + } + } + attr { + key: "step" + value { + f: 32.0 + } + } + attr { + key: "variance" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 4 + } + } + float_val: 0.10000000149 + float_val: 0.10000000149 + float_val: 0.20000000298 + float_val: 0.20000000298 + } + } + } +} +node { + name: "PriorBox_3" + op: "PriorBox" + input: "conv7_2_h/Relu" + input: "data" + attr { + key: "aspect_ratio" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 2 + } + } + float_val: 2.0 + float_val: 3.0 + } + } + } + attr { + key: "clip" + value { + b: false + } + } + attr { + key: "flip" + value { + b: true + } + } + attr { + key: "max_size" + value { + i: 213 + } + } + attr { + key: "min_size" + value { + i: 162 + } + } + attr { + key: "offset" + value { + f: 0.5 + } + } + attr { + key: "step" + value { + f: 64.0 + } + } + attr { + key: "variance" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 4 + } + } + float_val: 0.10000000149 + float_val: 0.10000000149 + float_val: 0.20000000298 + float_val: 0.20000000298 + } + } + } +} +node { + name: "PriorBox_4" + op: "PriorBox" + input: "conv8_2_h/Relu" + input: "data" + attr { + key: "aspect_ratio" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 1 + } + } + float_val: 2.0 + } + } + } + attr { + key: "clip" + value { + b: false + } + } + attr { + key: "flip" + value { + b: true + } + } + attr { + key: "max_size" + value { + i: 264 + } + } + attr { + key: "min_size" + value { + i: 213 + } + } + attr { + key: "offset" + value { + f: 0.5 + } + } + attr { + key: "step" + value { + f: 100.0 + } + } + attr { + key: "variance" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 4 + } + } + float_val: 0.10000000149 + float_val: 0.10000000149 + float_val: 0.20000000298 + float_val: 0.20000000298 + } + } + } +} +node { + name: "PriorBox_5" + op: "PriorBox" + input: "conv9_2_h/Relu" + input: "data" + attr { + key: "aspect_ratio" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 1 + } + } + float_val: 2.0 + } + } + } + attr { + key: "clip" + value { + b: false + } + } + attr { + key: "flip" + value { + b: true + } + } + attr { + key: "max_size" + value { + i: 315 + } + } + attr { + key: "min_size" + value { + i: 264 + } + } + attr { + key: "offset" + value { + f: 0.5 + } + } + attr { + key: "step" + value { + f: 300.0 + } + } + attr { + key: "variance" + value { + tensor { + dtype: DT_FLOAT + tensor_shape { + dim { + size: 4 + } + } + float_val: 0.10000000149 + float_val: 0.10000000149 + float_val: 0.20000000298 + float_val: 0.20000000298 + } + } + } +} +node { + name: "mbox_priorbox" + op: "ConcatV2" + input: "PriorBox_0" + input: "PriorBox_1" + input: "PriorBox_2" + input: "PriorBox_3" + input: "PriorBox_4" + input: "PriorBox_5" + input: "mbox_loc/axis" +} +node { + name: "detection_out" + op: "DetectionOutput" + input: "mbox_loc" + input: "mbox_conf_flatten" + input: "mbox_priorbox" + attr { + key: "background_label_id" + value { + i: 0 + } + } + attr { + key: "code_type" + value { + s: "CENTER_SIZE" + } + } + attr { + key: "confidence_threshold" + value { + f: 0.00999999977648 + } + } + attr { + key: "keep_top_k" + value { + i: 200 + } + } + attr { + key: "nms_threshold" + value { + f: 0.449999988079 + } + } + attr { + key: "num_classes" + value { + i: 2 + } + } + attr { + key: "share_location" + value { + b: true + } + } + attr { + key: "top_k" + value { + i: 400 + } + } +} +node { + name: "reshape_before_softmax" + op: "Const" + attr { + key: "value" + value { + tensor { + dtype: DT_INT32 + tensor_shape { + dim { + size: 3 + } + } + int_val: 0 + int_val: -1 + int_val: 2 + } + } + } +} +library { +} diff --git a/QT5_Project/KD_ZM_6/opencv/opencv_face_detector_uint8.pb b/QT5_Project/KD_ZM_6/opencv/opencv_face_detector_uint8.pb new file mode 100644 index 0000000..124bdd1 Binary files /dev/null and b/QT5_Project/KD_ZM_6/opencv/opencv_face_detector_uint8.pb differ diff --git a/QT5_Project/KD_ZM_6/statusTip状态描述.txt b/QT5_Project/KD_ZM_6/statusTip状态描述.txt new file mode 100644 index 0000000..58c6686 --- /dev/null +++ b/QT5_Project/KD_ZM_6/statusTip状态描述.txt @@ -0,0 +1,47 @@ +statusTip()属性描述, 多个属性之间用','分隔 + +现在每个控件可以设置缺省styleSheet, 选中后可以独立处理, 解除选中后可恢复缺省值 + +password (QLineEdit, 所有交互控件) 使得属性在编辑前会经过密码提示 + +circuit=%d (QPushButton, QLabel, QLineEdit, 所有容器) 指定本对象属于哪一个回路, 如果本对象未指定回路, 本对象会继承父节点的回路, 直到最顶层父节点 + +main=%d (QPushButton, QLabel, QLineEdit, 所有容器) 指定本对象的主索引, 主索引为%d指定的值, 如果本对象未指定主索引, 本对象会继承父节点的主索引, 直到最顶层父节点 + +Alias=%s (QLabel, QLineEdit) 指定本对象需要采用别名方式显示或修改, %s为别名字符串 + +Format=%s (QQLabel, QLineEdit) 用来指定被对象刷新时的数据格式, 小数位数, 与菜单配置的Format相同格式 + %s=%05.2f 显示5位字符, 2位小数 + +Caption=%s (QLabel, QLineEdit) 参数修改时显示的描述信息%s + +Timeout=%d (QLabel, QLineEdit) 指定本对象(%d)ms时间未刷新后, 页面显示Timeout + +page=%d (QMainWindow) 用来指定页面编号, 编号为%d指定, + +canvas%d=camera%d (QLabel) 用来指定QLabel的画布编号%d(前一个), 绑定到摄像头编号%d(后一个), 用于显示绑定的视频流 + +Index=%d (QLabel, QPushButton, QLineEdit) 表示该项可通过菜单选中并执行功能, 选中先后顺序按比较索引排序 (主索引 * 64 + %d)。 + +mqtt=Ia (QLabel, QPushButton, QLineEdit) 与菜单配置文件的Ia进行绑定, 或者statusTip的第一项不写mqtt=, 直接写Ia + +SetCircuit=0 (QLabel) 用来指定QLabel的画布编号%d(前一个), 绑定到摄像头编号%d(后一个), 用于显示绑定的视频流 + + +ImageBackGround=%s (QLabel, QPushButton) 背景图片装载 %s为图片文件名字 + +SelectImag=%s (QLabel, QPushButton, QLineEdit) 表示菜单项选中时, 显示%s指定的图片文件 +SelectIcon=%s (QPushButton) 表示按钮控件, 菜单项选中时, 显示%s指定的图标文件 +ImageValue=%s_%d.%s (QLabel, QPushButton) 第一个%s为文件名前导, 第二个%s为图片文件后缀, %d为显示值。 + 需要与mqtt绑定, 当mqtt传入对应的值后之后, 通过(通过%d)来选择不同图片文件 来显示闯入的值值 +例子 +mqtt=OnStatus, ImageValue=help_%d.png + 当OnStatus传入值为1时, 显示 help_1.png图片, 传入值为2时, 显示help_2.png图片, 用图片来代替数字显示 + +Action处理,目前支持以下几种预先定义的Action, 可通过'_'扩展与组合 + +Action=SetMain%d (QPushButton) 按下按键后, 页面选中对应主索引的第一项菜单 +Action=SetPage%d (QPushButton) 按下按键后, 页面切换到页面编号%d (其中页面编号通过page=%d提前指定) +Action=canvas%d_camera%d (QPushButton) 按下按键后, 把画布ID(第一个%d)与摄像头ID(第二个%d)进行绑定 +Action=Modify (QPushButton, QLineEdit, QLabel) 修改选中对象的参数, 必须包含(mqtt, Alias或Format之1), 与保护器参数绑定 +Action=CmdExecute (QPushButton, QLabel) 发出通讯命令 必须与(mqtt)共同使用 \ No newline at end of file diff --git a/QT5_Project/KD_ZM_6/testcamera.py b/QT5_Project/KD_ZM_6/testcamera.py new file mode 100644 index 0000000..403cb3d --- /dev/null +++ b/QT5_Project/KD_ZM_6/testcamera.py @@ -0,0 +1,41 @@ +import sys +from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget +from PyQt5.QtGui import QPixmap, QImage +from PyQt5.QtCore import Qt +from CameraThread import CameraThread +from print_color import * +class MainWindow(QWidget): + def __init__(self): + super().__init__() + self.initUI() + + def initUI(self): + self.setWindowTitle("Camera Test") + self.setGeometry(100, 100, 800, 600) + + self.label = QLabel(self) + self.label.setAlignment(Qt.AlignCenter) + + layout = QVBoxLayout() + layout.addWidget(self.label) + self.setLayout(layout) + + self.camera_thread = CameraThread("rtsp://192.168.1.211:554") + self.camera_thread.image_signal.connect(self.update_image) + self.camera_thread.start() + + def update_image(self, image): + q_image = QImage(image.data, image.shape[1], image.shape[0], QImage.Format_RGB888) + pixmap = QPixmap.fromImage(q_image) + self.label.setPixmap(pixmap.scaled(self.label.size(), Qt.KeepAspectRatio)) + + def closeEvent(self, event): + self.camera_thread.close() + self.camera_thread.wait() + event.accept() + +if __name__ == "__main__": + app = QApplication(sys.argv) + window = MainWindow() + window.show() + sys.exit(app.exec_()) diff --git a/QT5_Project/KD_ZM_8/APPWindow.py b/QT5_Project/KD_ZM_8/APPWindow.py new file mode 100644 index 0000000..cf4fd53 --- /dev/null +++ b/QT5_Project/KD_ZM_8/APPWindow.py @@ -0,0 +1,774 @@ +# This Python file uses the following encoding: utf-8 +import sys +import time +from PyQt5.QtWidgets import QWidget, QLineEdit +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QWidget, QLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +from PyQt5 import uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent +from PyQt5.QtGui import QImage, QPixmap, QColor, QKeySequence +from UIFrameWork import UIFrameWork +from UIFrameWork import * +# 添加当前脚本的父级目录到 sys.path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget +from PyQt5.QtWidgets import QDesktopWidget + +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from print_color import * +from Shared_CODE.get_tip_prop import * + + +# 设置 UI 目录的路径 +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'UI')) + + +# 页面文件,动态构建 UI 文件的路径 +uiFile_P00DeviceList = os.path.join(ui_path, "P00DeviceList.ui") +uiFile_P01DeviceMenu = os.path.join(ui_path, "P01DeviceMenu.ui") +uiFile_P02DataView = os.path.join(ui_path, "P02DataView.ui") +uiFile_P03SwitchAction = os.path.join(ui_path, "P03SwitchAction.ui") +uiFile_P04ParamSet = os.path.join(ui_path, "P04ParamSet.ui") +uiFile_P05CameraView = os.path.join(ui_path, "P05CameraView.ui") +uiFile_P06FaultQuery = os.path.join(ui_path, "P06FaultQuery.ui") +uiFile_P07SystemSet = os.path.join(ui_path, "P07SystemSet.ui") +uiFile_P08FieldTestAction = os.path.join(ui_path, "P08FieldTestAction.ui") +uiFile_P11LightDeviceMenu = os.path.join(ui_path, "P11LightDeviceMenu.ui") +uiFile_P12LightDataView = os.path.join(ui_path, "P12LightDataView.ui") +uiFile_P13LightSwitchAction = os.path.join(ui_path, "P13LightSwitchAction.ui") +uiFile_P14LightParamSet = os.path.join(ui_path, "P14LightParamSet.ui") +uiFile_P16LightFaultQuery = os.path.join(ui_path, "P16LightFaultQuery.ui") +uiFile_P17LightSystemSet = os.path.join(ui_path, "P17LightSystemSet.ui") +uiFile_P18LightFieldTestAction = os.path.join(ui_path, "P18LightFieldTestAction.ui") + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#ECECEC").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() + +COLOR_VALUE_NORMAL_YELLOW = QColor("#F8C822").name() +COLOR_VALUE_NORMAL_BLUE = QColor("#4E76D4").name() +COLOR_VALUE_NORMAL_READ = QColor("#CE5D62").name() +COLOR_VALUE_NORMAL_GREEN = QColor("#83BF6E").name() + + + +def get_camera_id_and_canvas_id(action : str) : + camera_id = -1 + canvas_id = -1 + if "canvas" in action and "camera" in action : + action_splits = action.split("_") + for action_split_str in action_splits: + if "camera" in action_split_str: + camera_id = get_value_from_lead_value_str(action_split_str, "camera", -1) + elif "canvas" in action_split_str: + canvas_id = get_value_from_lead_value_str(action_split_str, "canvas", -1) + return camera_id, canvas_id + + +#根据回路选择摄像头url地址 +def search_camera_url(camera_id : int) : + cameral_url = None + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_camera_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_camera_id == camera_id : + cameral_url = utils.dict_or_object_get_attr(item_dict, "camera_url", None) + if cameral_url != None : + return cameral_url + return cameral_url + +menu_page_widget_list = [] + +class PageTemplate(UIFrameWork): # 页面模板类,包含各子页面公用功能 + def __init__(self, parent_window): # + UIFrameWork.__init__(self) # + self.parent_window : APPWindow = parent_window + + def connect_matched_camera_canvas(self) : + page_widget : UIFrameWork = self.parent_window.stack.currentWidget() + if page_widget != None : + for canvas_id in range(9) : + camera_id , face_detect = page_widget.get_canvas_prop(canvas_id) + if camera_id >= 0 : + self.parent_window.connect_camera_to_canvas(page_widget, camera_id, canvas_id, face_detect) + + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.parent_window.camera_thread_list) : + face_detect = 0 + canvas_object = self.search_canvas_object(canvas_id) + if canvas_object != None : + face_detect = get_tip_face_detection(canvas_object.statusTip()) + + camera_thread : CameraThread = self.parent_window.camera_thread_list[camera_id] + if camera_thread != None : + if not camera_thread.is_emit and is_visible: + self.show_camera_error(camera_id) + + if camera_thread.is_emit: + self.connect_camera_thread(camera_thread, canvas_id, is_visible) + self.parent_window.camera_signal.emit(camera_id) + camera_thread.face_detection = face_detect + + if hasattr(self, "CameraChioceLabel") : + # self.CameraChioceLabel.setStyleSheet("color: rgb(255, 255, 255); font-size: 50px;") + self.CameraChioceLabel.setText("回路" + str(camera_id+1)) + else: + self.show_camera_error(camera_id) + + def show_camera_error(self, camera_id) : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", f"视频流{camera_id+1}无法初始化或失去连接!") + + #定义虚函数, 进入页面时调用 + def virtual_on_page_enter(self) : + pass + + #定义虚函数, 退出页面时调用 + def virtual_on_page_leave(self) : + pass + + #重载虚函数, 切换页面时调用 + def virtual_change_to_page(self, page) : + if self.parent_window == None : + return + + self_page_widget : PageTemplate = self.parent_window.stack.currentWidget() + if self_page_widget == None : + return + + target_page_widget : PageTemplate = None + + if page >= 0 : + target_page_widget = self.parent_window.search_page_widget(page) + if target_page_widget in menu_page_widget_list: + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == None or pop_page_widget == target_page_widget: + break + else : + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == self : + continue + else : + target_page_widget = pop_page_widget + break + + if target_page_widget == None : + target_page_widget = self.parent_window.allpages_list[0] + + if target_page_widget != None : + menu_page_widget_list.append(target_page_widget) + self_page_widget.virtual_on_page_leave() + self.parent_window.stack.setCurrentWidget(target_page_widget) + target_page_widget.virtual_on_page_enter() + self.connect_matched_camera_canvas() + + def virtual_widget_action_process(self, widget : QWidget, action : str) : + action_splits = action.split("+") + page_id = -1 + circuit_id = -1 + main_index = -1 + add_circuit = -1 + binding_circuit = -1 + for action_split_str in action_splits : + if "SetPage" in action_split_str : + page_id = get_value_from_lead_value_str(action_split_str, "SetPage", -1) + elif "SetCircuit" in action_split_str : + circuit_id = get_value_from_lead_value_str(action_split_str, "SetCircuit", -1) + elif "SetMain" in action_split_str: + main_index = get_value_from_lead_value_str(action_split_str, "SetMain", -1) + elif "AddCircuit" in action_split_str : + add_circuit = get_value_from_lead_value_str(action_split_str, "AddCircuit", -1) + elif "SetBinding" in action_split_str : + binding_circuit = get_value_from_lead_value_str(action_split_str, "SetBinding", 1) + + + print("@Line:",inspect.currentframe().f_lineno,' = ',circuit_id,' = ',action_splits) + + if add_circuit >= 0 : + tip_str : str = page_widget.statusTip() + circuit_id = get_tip_circuit(tip_str) + circuit_id = circuit_id + 1 + + if binding_circuit > 0 : + circuit_id = self.get_circuit_from_object(widget) + + target_page_widget = self.parent_window.search_page_widget(page_id) + page_widget : PageTemplate = target_page_widget + + if page_id >= 0 : # 功能标记:执行页面跳转功能 + target_page_widget = self.parent_window.search_page_widget(page_id) + + if target_page_widget != None : + if circuit_id >= 0 : + target_page_widget.set_page_circuit(circuit_id) + self.virtual_change_to_page(page_id) + + if main_index >= 0 : # 功能标记:执行控件主索引设定 + self.set_menu_main_index(main_index) # 设置页面主索引字段
,可以跨组选择控件 + + if circuit_id >= 0 : + indicator : QLineEdit = target_page_widget.findChild(QLineEdit,"BindNum_Title") + indicator.setText("当前回路为 %d"%(circuit_id + 1)) + + # 显示提示图标 + indicator_Label : QLabel = target_page_widget.findChild(QLabel,"indicator_Label") + tip_str : str = indicator_Label.statusTip() + imag_file_name = get_imag_value_file_name(tip_str, circuit_id) + if imag_file_name != None : + self.modify_object_style_sheet(indicator_Label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(indicator_Label) + + camera_id, canvas_id = get_camera_id_and_canvas_id(action) + self.virtual_connect_canvas_to_camera(canvas_id, camera_id) + +#P00设备列表页面 +class QDeviceListPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P00DeviceList) + + # 回路1测试:开关合闸1,总开关0,无报警 + json_dict0 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"无故障","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1143", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"60", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"20", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路2测试:开关合闸1,分开关1,无报警 + json_dict1 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"开关未到位","type" : "alarm","color" : COLOR_ALARM_ERROR_TEXT}, + "Voltage" : {"value" :"1120", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"45", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"46321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路3测试:开关合闸1,总开关0,无报警 + json_dict2 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1065", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"16", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"1321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路4测试:开关合闸1,总开关0,无报警 + json_dict3 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1141", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"32321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路5测试:开关合闸1,总开关0,无报警 + json_dict4 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"2133", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"4453", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路6测试:开关合闸1,总开关0,无报警 + json_dict5 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1212", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"27", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"11212", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路7测试:开关合闸1,总开关0,无报警 + json_dict6 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1564", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"32", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45341", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + # self.flush_widgets(3, json_dict3) + # # self.flush_widgets(4, json_dict4) + # # self.flush_widgets(5, json_dict5) + # # self.flush_widgets(6, json_dict6) + +#P01设备列表页面 +class QDeviceMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P01DeviceMenu) + +#P02数据查看页面 +class QDataViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P02DataView) + + json_dict0 = {"Uab" :"1111", "Ubc" : "1111", "Uca" : "1111", "Uo" : "11" , "Iab" : "1111", "Ibc" : "1111", "Ica" : "1111", "Io" : "1111"} + json_dict1 = {"Uab" :"2222", "Ubc" : "2222", "Uca" : "2222", "Uo" : "22" , "Iab" : "2222", "Ibc" : "2222", "Ica" : "2222", "Io" : "2222"} + json_dict2 = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P03开关操作页面 +class QSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P03SwitchAction) + + json_dict0 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict1 = {"SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict2 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P04参数设置页面 +class QParamSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P04ParamSet) + + json_dict0 = {"Uab" :"1000", "Ubc" : "5", "Uca" : "50"} + json_dict1 = {"Uab" :"1111", "Ubc" : "111", "Uca" : "111"} + json_dict2 = {"Uab" :"2222", "Ubc" : "222", "Uca" : "222"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) +''' + # 查找 QLineEdit 控件 + self.line_edit = self.findChild(QLineEdit) + if self.line_edit: + # 重写 QLineEdit 的鼠标按下事件 + self.line_edit.mousePressEvent = self.on_line_edit_clicked + def on_line_edit_clicked(self, event): + + self.key_enter_process() + # 调用原始的鼠标按下事件处理方法 + QLineEdit.mousePressEvent(self.line_edit, event) + +''' +#P05视频查看页面 QFaultQueryPage +class QCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P05CameraView) + + def virtual_on_page_enter(self) : + self.parent_window.camera_signal.emit(0) + +#P06故障查询页面 QFaultQueryPage +class QFaultQueryPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P06FaultQuery) + self.alarm_index = 0 + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +#P07系统参数设置页面 +class QSystemSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P07SystemSet) + +#P08现场试验页面 +class QFieldTestAction(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P08FieldTestAction) + +# P11照明菜单选择 +class QLightMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P11LightDeviceMenu) + +# P12照明运行数据页面 +class QRunDataPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P12LightDataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P13照明开关操作页面 +class QLightSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P13LightSwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P14照明参数设置页面 +class QLightParamSetPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P14LightParamSet) + +# P16照明故障查询 +class QLightFaultQuery(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P16LightFaultQuery) + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +# P17照明系统参数 +class QLightSystemSet(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P17LightSystemSet) + +# P18现场试验页面 +class QLightFieldTestAction(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P18LightFieldTestAction) + +class APPWindow(QMainWindow): + camera_signal = pyqtSignal(int) + def __init__(self): + super().__init__() + + # 获取屏幕分辨率 + screen = QDesktopWidget().screenGeometry() + screen_width = screen.width() + screen_height = screen.height() + + self.stack = QStackedWidget(self) + self.setGeometry(0, 0, screen_width, screen_height) # 设置窗口大小为屏幕分辨率 + self.stack.setGeometry(0, 0, screen_width, screen_height) # 设置堆叠窗口大小为屏幕分辨率 + + #调试的时候用下面两行,全屏就注释 + # self.setGeometry(0, 0, 1024, 768) + # self.stack.setGeometry(0, 0, 1024, 768) + + + + self.showFullScreen() + + self.menu_sequence_list : PageTemplate = [] + self.camera_thread_list : CameraThread = [None, None, None, None, None, None, None, None, None] + self.allpages_list : PageTemplate = [] + + self.P00_DeviceList : PageTemplate = QDeviceListPage(parent_window = self) + self.P01_DeviceMenu : PageTemplate = QDeviceMenuPage(parent_window = self) + self.P02_DataView : PageTemplate = QDataViewPage(parent_window = self) + self.P03_SwitchAction : PageTemplate = QSwitchActionPage(parent_window = self) + self.P04_ParamSet : PageTemplate = QParamSetPage(parent_window = self) + self.P05_CameraView : PageTemplate = QCameraViewPage(parent_window = self) + self.P06_FaultQuery : PageTemplate = QFaultQueryPage(parent_window = self) + self.P07_SystemSet : PageTemplate = QSystemSetPage(parent_window = self) + self.P08_FieldTestAction : PageTemplate = QFieldTestAction(parent_window = self) + self.P11_DeviceMenu : PageTemplate = QLightMenuPage(parent_window = self) + self.P12_DateView : PageTemplate = QRunDataPage(parent_window = self) + self.P13_SwitchAction : PageTemplate = QLightSwitchActionPage(parent_window = self) + self.P14_ParamSet : PageTemplate = QLightParamSetPage(parent_window = self) + self.P16_LightFaultQuery : PageTemplate = QLightFaultQuery(parent_window = self) + self.P17_LightSystemSet : PageTemplate = QLightSystemSet(parent_window = self) + self.P18_LightFieldTestAction : PageTemplate = QLightFieldTestAction(parent_window = self) + + self.allpages_list.append(self.P00_DeviceList) + self.allpages_list.append(self.P01_DeviceMenu) + self.allpages_list.append(self.P02_DataView) + self.allpages_list.append(self.P03_SwitchAction) + self.allpages_list.append(self.P04_ParamSet) + self.allpages_list.append(self.P05_CameraView) + self.allpages_list.append(self.P06_FaultQuery) + self.allpages_list.append(self.P07_SystemSet) + self.allpages_list.append(self.P08_FieldTestAction) + self.allpages_list.append(self.P11_DeviceMenu) + self.allpages_list.append(self.P12_DateView) + self.allpages_list.append(self.P13_SwitchAction) + self.allpages_list.append(self.P14_ParamSet) + self.allpages_list.append(self.P16_LightFaultQuery) + self.allpages_list.append(self.P17_LightSystemSet) + self.allpages_list.append(self.P18_LightFieldTestAction) + + self.stack.addWidget(self.P00_DeviceList) + self.stack.addWidget(self.P01_DeviceMenu) + self.stack.addWidget(self.P02_DataView) + self.stack.addWidget(self.P03_SwitchAction) + self.stack.addWidget(self.P04_ParamSet) + self.stack.addWidget(self.P05_CameraView) + self.stack.addWidget(self.P06_FaultQuery) + self.stack.addWidget(self.P07_SystemSet) + self.stack.addWidget(self.P08_FieldTestAction) + self.stack.addWidget(self.P11_DeviceMenu) + self.stack.addWidget(self.P12_DateView) + self.stack.addWidget(self.P13_SwitchAction) + self.stack.addWidget(self.P14_ParamSet) + self.stack.addWidget(self.P16_LightFaultQuery) + self.stack.addWidget(self.P17_LightSystemSet) + self.stack.addWidget(self.P18_LightFieldTestAction) + + test_init = system_parameter() + set_screen_blanking_time(test_init.get_screen_blanking_time()) + + + def search_page_widget(self, page) : + for list_item in self.allpages_list: + window_page : UIFrameWork = list_item + if window_page.page == page : + return window_page + return None + + def connect_camera_to_canvas(self, page_widget : UIFrameWork, camera_id: int , canvas_id : int, face_detect : int = 0) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.camera_thread_list) : + camera_thread : CameraThread = self.camera_thread_list[camera_id] + if camera_thread != None : + page_widget.connect_camera_thread(camera_thread, canvas_id) + camera_thread.face_detection = face_detect + + def create_all_camera_thread(self) : + for camera_id in range(len(self.camera_thread_list)) : + _camera_url = search_camera_url(camera_id) + if _camera_url != None : + camera_thread = CameraThread(_camera_url, camera_id) + camera_thread.set_video_cycle_ms(10) + self.camera_thread_list[camera_id] = camera_thread + self.camera_signal.connect(camera_thread.change_camera_url) + + #摄像头与 界面进行绑定 + for index in range(self.stack.count()) : + page_widget : UIFrameWork = self.stack.widget(index) + page_widget.connect_matched_camera_canvas() + + time.sleep(0.1) + + #开启多个摄像头线程 + for camera_thread in self.camera_thread_list: + thread_to_start : CameraThread = camera_thread + if thread_to_start != None : + thread_to_start.start() + time.sleep(0.01) + + # def focus_do_inscrease(self) : + # self.stack.currentWidget().key_decrease_parameter() + + # def focus_do_decrease(self) : + # self.stack.currentWidget().key_increase_parameter() + + # def focus_do_action(self) : + # self.stack.currentWidget().key_enter_process() + + # def focus_do_escape(self) : + # self.stack.currentWidget().key_escape_process() + + # def focus_show_hide(self) : + # if self.float_button1.isHidden() : + # self.float_button1.show() + # self.float_button2.show() + # self.float_button3.show() + # self.float_button4.show() + # else : + # self.float_button1.hide() + # self.float_button2.hide() + # self.float_button3.hide() + # self.float_button4.hide() + + def get_page_currentwidget(self) : + return self.stack.currentWidget().sort_menu_list[self.stack.currentWidget().menu_key_index][1] + + def closeEvent(self, event): + # 在这里处理关闭事件 + # 例如,提示用户是否真的想要关闭 + reply = QMessageBox.question(self, '确认', '确定要退出吗?', + QMessageBox.Yes | QMessageBox.No) + if reply == QMessageBox.Yes: + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.close() + + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.wait() + + event.accept() # 接受关闭事件 + else: + event.ignore() # 忽略关闭事件 + + +if __name__ == '__main__': + #创建mqtt线程 + fvalue = float('06.00') + value = round(fvalue) + + _user_name = utils.dict_or_object_get_attr(group_config.mqtt_server, "user_name", "admin") + _password = utils.dict_or_object_get_attr(group_config.mqtt_server, "password", "admin") + _server = utils.dict_or_object_get_attr(group_config.mqtt_server, "remote", "127.0.0.1") + _port = utils.dict_or_object_get_attr(group_config.mqtt_server, "port", 1883) + + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = _server, port = _port, keep_alive = 60, user_name=_user_name, password=_password) + + app = QApplication([]) + app_main_window = APPWindow() + app_main_window.show() + app_main_window.create_all_camera_thread() + + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name != None : + global_mqtt_thread.add_unique_object(circuit_unique_name, app_main_window.allpages_list) + + global_mqtt_thread.start() + app.exec_() + global_mqtt_thread.close() + global_mqtt_thread.join() + + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/KD_ZM_8/Light_image/Light_CameraView.png b/QT5_Project/KD_ZM_8/Light_image/Light_CameraView.png new file mode 100644 index 0000000..124d069 Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Light_CameraView.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Light_DataView.png b/QT5_Project/KD_ZM_8/Light_image/Light_DataView.png new file mode 100644 index 0000000..d70d6cf Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Light_DataView.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Light_DeviceMenu.png b/QT5_Project/KD_ZM_8/Light_image/Light_DeviceMenu.png new file mode 100644 index 0000000..4d63c9b Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Light_DeviceMenu.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Light_FieldTestAction.png b/QT5_Project/KD_ZM_8/Light_image/Light_FieldTestAction.png new file mode 100644 index 0000000..0ebc77d Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Light_FieldTestAction.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Light_ParamSet.png b/QT5_Project/KD_ZM_8/Light_image/Light_ParamSet.png new file mode 100644 index 0000000..5d8aee0 Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Light_ParamSet.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Light_SystemSet.png b/QT5_Project/KD_ZM_8/Light_image/Light_SystemSet.png new file mode 100644 index 0000000..f04e409 Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Light_SystemSet.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Ligth_FaultQuery.png b/QT5_Project/KD_ZM_8/Light_image/Ligth_FaultQuery.png new file mode 100644 index 0000000..d168b56 Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Ligth_FaultQuery.png differ diff --git a/QT5_Project/KD_ZM_8/Light_image/Ligth_SwitchAction.png b/QT5_Project/KD_ZM_8/Light_image/Ligth_SwitchAction.png new file mode 100644 index 0000000..478faa8 Binary files /dev/null and b/QT5_Project/KD_ZM_8/Light_image/Ligth_SwitchAction.png differ diff --git a/QT5_Project/KD_ZM_8/UI/P00DeviceList.ui b/QT5_Project/KD_ZM_8/UI/P00DeviceList.ui new file mode 100644 index 0000000..afe161f --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P00DeviceList.ui @@ -0,0 +1,3421 @@ + + + P00DeviceList + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=0 + + + + + + 0 + -1 + 1920 + 1080 + + + + + + + ../image/DeviceList.png + + + + + + 91 + 97 + 450 + 481 + + + + + + + circuit=0, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=0, Action=SetPage1+SetCircuit0+SetBinding0,SelectImag=IM00_01B.png + + + + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas0=camera0 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper + m01_SwitchStatus_0 + m02_SwitchType_0 + m03_AlarmMessage_0 + m04_Voltage + m05_Power + m06_Current + m07_Electricity + Ls01 + Ls01_2 + Ls01_3 + Ls01_4 + m03_CarMessage_7 + Video0 + + + + + 546 + 97 + 450 + 481 + + + + + + + circuit=1, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=1, Action=SetPage1+SetCircuit1+SetBinding1,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas1=camera1 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_2 + m01_SwitchStatus_1 + m02_SwitchType_1 + m03_AlarmMessage_1 + m04_Voltage_2 + m05_Power_2 + m06_Current_2 + m07_Electricity_2 + Ls01_5 + Ls01_6 + Ls01_7 + Ls01_8 + m03_CarMessage_8 + Video0_1 + + + + + 1001 + 97 + 450 + 481 + + + + + + + circuit=2, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=2,Action=SetPage1+SetCircuit2+SetBinding2,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas2=camera2 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_3 + m01_SwitchStatus_2 + m02_SwitchType_2 + m03_AlarmMessage_2 + m04_Voltage_3 + m05_Power_3 + m06_Current_3 + m07_Electricity_3 + Ls01_9 + Ls01_10 + Ls01_11 + Ls01_12 + m03_CarMessage_9 + Video0_2 + + + + + 1456 + 97 + 450 + 481 + + + + + + + circuit=3, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=3, Action=SetPage1+SetCircuit3+SetBinding3,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas3=camera3 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_4 + m01_SwitchStatus_3 + m02_SwitchType_3 + m03_AlarmMessage_3 + m04_Voltage_4 + m05_Power_4 + m06_Current_4 + m07_Electricity_4 + Ls01_13 + Ls01_14 + Ls01_15 + Ls01_16 + m03_CarMessage_10 + Video0_3 + + + + + 91 + 583 + 450 + 481 + + + + + + + circuit=4, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=4, Action=SetPage1+SetCircuit4+SetBinding4,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas4=camera4 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_5 + m01_SwitchStatus_4 + m02_SwitchType_4 + m03_AlarmMessage_4 + m04_Voltage_5 + m05_Power_5 + m06_Current_5 + m07_Electricity_5 + Ls01_17 + Ls01_18 + Ls01_19 + Ls01_20 + m03_CarMessage_11 + Video0_4 + + + + + 546 + 583 + 450 + 481 + + + + + + + circuit=5, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=5, Action=SetPage1+SetCircuit5+SetBinding5,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas5=camera5 + + + + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_6 + m01_SwitchStatus_5 + m02_SwitchType_5 + m03_AlarmMessage_5 + m04_Voltage_6 + m05_Power_6 + m06_Current_6 + m07_Electricity_6 + Ls01_21 + Ls01_22 + Ls01_23 + Ls01_24 + m03_CarMessage_12 + Video0_5 + + + + + 1001 + 583 + 450 + 481 + + + + + + + circuit=6, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=6, Action=SetPage1+SetCircuit6+SetBinding6,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas6=camera6 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_7 + m01_SwitchStatus_6 + m02_SwitchType_6 + m03_AlarmMessage_6 + m04_Voltage_7 + m05_Power_7 + m06_Current_7 + m07_Electricity_7 + Ls01_25 + Ls01_26 + Ls01_27 + Ls01_28 + m03_CarMessage_13 + Video0_6 + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 3 + 72 + 144 + + + + Index=7, Action=SetPage5,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 100 + 10 + 431 + 61 + + + + + 15 + + + + + + + border:none; + + + + + + border:none; + + + + + 0 + 10 + 411 + 41 + + + + + Microsoft YaHei UI + 22 + false + false + + + + System=DateTime, Action=ModifySystem, Index=8,main=1,SelectImag=SR_001.png + + + color: rgb(166, 215, 236); +font: 22pt "Microsoft YaHei UI"; + + + 2024-5-18 + + + + + + + 1455 + 583 + 450 + 481 + + + + + + + circuit=7, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=7, Action=SetPage11+SetCircuit7+SetBinding7,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 70 + 105 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P01DeviceMenu.ui b/QT5_Project/KD_ZM_8/UI/P01DeviceMenu.ui new file mode 100644 index 0000000..ccf9c28 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P01DeviceMenu.ui @@ -0,0 +1,339 @@ + + + P01DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=1 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage2+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage3+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage4+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage7+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage6+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage8+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P02DataView.ui b/QT5_Project/KD_ZM_8/UI/P02DataView.ui new file mode 100644 index 0000000..5e7a3c0 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P02DataView.ui @@ -0,0 +1,1004 @@ + + + P02DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=2 + + + + + PreferDefaultHinting + + + + + + + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + true + + + + 0 + 0 + 1920 + 1080 + + + + + false + PreferDefaultHinting + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../image/DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + PreferDefaultHinting + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 276 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 80 + 277 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=15000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 330 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 385 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 80 + 440 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Io, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 300 + 330 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 300 + 386 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 300 + 440 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Uo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 274 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 331 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 388 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 550 + 442 + 61 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosf, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + true + + + + + + 86 + 497 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + R, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 300 + 496 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=AngleUoIo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 531 + 494 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 100 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Aup, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 310 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bup, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 520 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cup, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 100 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Adown, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 310 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bdown, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 520 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cdown, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + true + + + + + + 104 + 40 + 161 + 171 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM02_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 260 + 40 + 141 + 171 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM02_SwitchType_%d.png, Timeout=15000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + PreferDefaultHinting + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P03SwitchAction.ui b/QT5_Project/KD_ZM_8/UI/P03SwitchAction.ui new file mode 100644 index 0000000..7a6ed76 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P03SwitchAction.ui @@ -0,0 +1,468 @@ + + + P03SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=3 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/SwitchAction.png + + + + + false + + + + 295 + 190 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 374 + 189 + 1141 + 811 + + + + + + + main=1 + + + border:none; + + + + + + + + 60 + 484 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 60 + 582 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 487 + 583 + 246 + 84 + + + + CarRetreat,Index=6,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 487 + 483 + 246 + 84 + + + + CarForward,Index=5,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 77 + 150 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 60 + 681 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 150 + 114 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 650 + 150 + 441 + 241 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::Box + + + + + + + + + 856 + 485 + 246 + 84 + + + + Index=7, Action=SetPage1,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + + 690 + 114 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=15000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + + + + 144 + 320 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=10000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P04ParamSet.ui b/QT5_Project/KD_ZM_8/UI/P04ParamSet.ui new file mode 100644 index 0000000..947910b --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P04ParamSet.ui @@ -0,0 +1,1948 @@ + + + P04ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=4 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=额定电流,Timeout=15000, SelectImag=P4_ParaSelect.png, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=短路倍数, Format=%04.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=短路延时,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIa, Action=Modify, Index=11, Caption=Ia 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIb, Action=Modify, Index=12, Caption=Ib 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIc, Action=Modify, Index=13, Caption=Ic 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=15000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Io, Index=2, Action=Modify,Format=%05.1f,Caption=零序电流, Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Uo, Index=2, Action=Modify,Format=%04.0f,Caption=零序电压, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=3, Format=%03.0f, Caption=漏电延时,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=4, Format=%05.1f, Caption=串联电阻,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=5, Format=%05.1f, Caption=闭锁电阻,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUo, Action=Modify, Index=6, Format=%05.1f, Caption=Uo校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIo, Action=Modify, Index=7, Format=%05.1f, Caption=Io校正值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MeasureV, Index=8, Alias=alias_measure_v, Action=Modify, Caption=检测电压,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLeakageTrip, Action=Modify, Index=9, Format=%04.1f, Caption=漏电投入延时,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectPhaseSensitivity, Index=2, Alias=alias_bool, Action=Modify, Caption=相敏保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTubeAdhesion, Index=12, Alias=alias_bool, Action=Modify, Caption=真空管粘连保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 820 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=12, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + Protect_14 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + Qt::NoFocus + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 174 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_5 + sys_P00_4 + sys_P00_3 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/ParamSet.png + + + P04BG + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P05CameraView.ui b/QT5_Project/KD_ZM_8/UI/P05CameraView.ui new file mode 100644 index 0000000..ca8b622 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P05CameraView.ui @@ -0,0 +1,656 @@ + + + P05CameraView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=5 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/CameraView.png + + + + + + 0 + 100 + 85 + 960 + + + + + + + + + + border:none; + + + + + + + + 8 + 2 + 72 + 144 + + + + Index=9, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 380 + 124 + 1165 + 720 + + + + canvas0=camera0, Timeout=15000 + + + TextLabel + + + + + + 200 + 120 + 111 + 41 + + + + + 黑体 + -1 + + + + color: rgb(177, 229, 252); font-size: 35px; + + + 回路1 + + + Qt::AlignCenter + + + + + + 90 + 890 + 1821 + 171 + + + + + + + + + + border:none; + + + + + + + + 236 + 5 + 220 + 159 + + + + Index=2, Action=canvas0_camera1, SelectImag=IM05_A2.png + + + + + + + + + + 450 + 876 + + + + + + + 10 + 5 + 220 + 159 + + + + Index=1, Action=canvas0_camera0, SelectImag=IM05_A1.png + + + + + + + + + + 450 + 876 + + + + + + + 462 + 5 + 220 + 159 + + + + Index=3, Action=canvas0_camera2, SelectImag=IM05_A3.png + + + + + + + + + + 450 + 876 + + + + + + + 688 + 5 + 220 + 159 + + + + Index=4, Action=canvas0_camera3, SelectImag=IM05_A4.png + + + + + + + + + + 450 + 876 + + + + + + + 914 + 5 + 220 + 159 + + + + Index=5, Action=canvas0_camera4, SelectImag=IM05_A5.png + + + + + + + + + + 450 + 876 + + + + + + + 1140 + 5 + 220 + 159 + + + + Index=6, Action=canvas0_camera5, SelectImag=IM05_A6.png + + + + + + + + + + 450 + 876 + + + + + + + 1366 + 5 + 220 + 159 + + + + Index=7, Action=canvas0_camera6, SelectImag=IM05_A7.png + + + + + + + + + + 450 + 876 + + + + + + + 1592 + 5 + 220 + 159 + + + + Index=8, Action=canvas0_camera7, SelectImag=IM05_A8.png + + + + + + + + + + 450 + 876 + + + + + + + 12 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas1=camera0, Timeout=15000 + + + + + + QFrame::NoFrame + + + + + + Qt::AutoText + + + background/IM05_002.png + + + false + + + Qt::AlignCenter + + + + + + 238 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas2=camera1, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 464 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas3=camera2, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 690 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas4=camera3, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 916 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas5=camera4, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 1142 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas6=camera5, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 1368 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas7=camera6, Timeout=15000 + + + + + + background/IM05_002.png + + + + + + 1594 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas8=camera7, Timeout=15000 + + + + + + background/IM05_002.png + + + Canvas08 + Canvas07 + Canvas06 + Canvas05 + Canvas04 + Canvas03 + Canvas02 + Canvas01 + Btn02 + Btn01 + Btn03 + Btn04 + Btn05 + Btn06 + Btn07 + Btn08 + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P06FaultQuery.ui b/QT5_Project/KD_ZM_8/UI/P06FaultQuery.ui new file mode 100644 index 0000000..1c1dbce --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P06FaultQuery.ui @@ -0,0 +1,708 @@ + + + P06FaultQuery + + + + 0 + 0 + 1920 + 1076 + + + + MainWindow + + + Page=6 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 48 + 412 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 267 + 412 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 485 + 412 + 85 + 169 + + + + Index=4, Action=SetPage1, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 260 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 152 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 330 + 160 + 361 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 30 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P07SystemSet.ui b/QT5_Project/KD_ZM_8/UI/P07SystemSet.ui new file mode 100644 index 0000000..28b135a --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P07SystemSet.ui @@ -0,0 +1,932 @@ + + + P07SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=7 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 84 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SwitchType, Action=Modify, Index=1, Alias=alias_switch_type, Caption=开关类型,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 144 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 198 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 253 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 308 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 364 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 418 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 475 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 530 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CarAlarmDelay, Action=Modify, Index=9, Format=%05.1f, Caption=小车报警延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 583 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + OffVoltageDelay, Action=Modify, Index=10, Format=%06.1f, Caption=断电延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 640 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TubeDelay, Action=Modify, Index=11, Format=%06.2f, Caption=真空管粘连延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 750 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 805 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=14,SelectImag=P4_ParaSelect.png, password,groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + 270 + 695 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LoadSelect, Action=Modify, Index=12, Alias=alias_select, Caption=负载选择,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=15000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 25 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/SystemSet.png + + + P07BG + groupBox_2 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P08FieldTestAction.ui b/QT5_Project/KD_ZM_8/UI/P08FieldTestAction.ui new file mode 100644 index 0000000..8c7f6d1 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P08FieldTestAction.ui @@ -0,0 +1,391 @@ + + + P08FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=8 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/FieldTestAction.png + + + + + false + + + + 300 + 170 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 260 + 681 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 45 + 215 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 46 + 330 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 393 + 220 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 392 + 330 + 246 + 84 + + + + Index=5, Action=SetPage1,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + 422 + 95 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=15000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 365 + 60 + 291 + 41 + + + + + 黑体 + 16 + + + + true + + + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + + + + false + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 154 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 678 + 319 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P11LightDeviceMenu.ui b/QT5_Project/KD_ZM_8/UI/P11LightDeviceMenu.ui new file mode 100644 index 0000000..f1da380 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P11LightDeviceMenu.ui @@ -0,0 +1,339 @@ + + + P11DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=11 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage12+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage13+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage14+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage17+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage16+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage18+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P12LightDataView.ui b/QT5_Project/KD_ZM_8/UI/P12LightDataView.ui new file mode 100644 index 0000000..f77d7c3 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P12LightDataView.ui @@ -0,0 +1,573 @@ + + + P12DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=12 + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + + 340 + 10 + 391 + 16 + + + + cameral_url=canvas1 + + + + + + + + + 750 + 10 + 411 + 16 + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../Light_image/Light_DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 304 + 500 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 500 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=15000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 575 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 650 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 305 + 574 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 305 + 650 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 520 + 570 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ro, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 531 + 494 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=15000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 90 + 120 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + CameralUrlLabel + CameralUrlLabel_2 + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P13LightSwitchAction.ui b/QT5_Project/KD_ZM_8/UI/P13LightSwitchAction.ui new file mode 100644 index 0000000..334b755 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P13LightSwitchAction.ui @@ -0,0 +1,345 @@ + + + P13SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=13 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_SwitchAction.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 150 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 290 + 180 + 1300 + 781 + + + + + + + main=1 + + + border:none; + + + + + + + + 147 + 490 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 411 + 493 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 500 + 170 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 674 + 493 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 581 + 98 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 940 + 490 + 246 + 84 + + + + Index=7, Action=SetPage11,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + false + + + + 0 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备照明 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P14LightParamSet.ui b/QT5_Project/KD_ZM_8/UI/P14LightParamSet.ui new file mode 100644 index 0000000..bbbb45e --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P14LightParamSet.ui @@ -0,0 +1,1734 @@ + + + P14ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=14 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=照明额定电流,Timeout=15000, SelectImag=P4_ParaSelect.png, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=照明短路倍数, Format=%04.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=照明短路延时,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIs, Action=Modify, Index=11, Caption=Is 校正, Format=%05.1f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentIs, Action=Modify, Index=12, Caption=信号Ie Format=%05.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortIs, Action=Modify, Index=13, Caption=信号短路倍数, Format=%05.2f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 825 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=14, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=15000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=1, Format=%03.0f, Caption=漏电延时,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=2, Format=%05.1f, Caption=串联电阻,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=3, Format=%05.1f, Caption=闭锁电阻,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectIsShort, Index=2, Alias=alias_bool, Action=Modify, Caption=信号短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=15000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=15000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P16LightFaultQuery.ui b/QT5_Project/KD_ZM_8/UI/P16LightFaultQuery.ui new file mode 100644 index 0000000..79835c8 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P16LightFaultQuery.ui @@ -0,0 +1,637 @@ + + + P16FaultQuery + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=16 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 51 + 410 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 270 + 410 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 488 + 410 + 85 + 169 + + + + Index=4, Action=SetPage11, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=15000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 7 + 149 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 320 + 170 + 421 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 20 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P17LightSystemSet.ui b/QT5_Project/KD_ZM_8/UI/P17LightSystemSet.ui new file mode 100644 index 0000000..a34dfae --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P17LightSystemSet.ui @@ -0,0 +1,792 @@ + + + P17SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=17 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 100 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Temperature, Action=Modify, Index=1, Format=%03.0f, Caption=温度设定,Timeout=15000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 155 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 210 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 265 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 320 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 375 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 430 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 485 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 540 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=9,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 595 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=10,SelectImag=P4_ParaSelect.png, password,groupend=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=15000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=15000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=15000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_SystemSet.png + + + P07BG + groupBox + groupBox_2 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/KD_ZM_8/UI/P18LightFieldTestAction.ui b/QT5_Project/KD_ZM_8/UI/P18LightFieldTestAction.ui new file mode 100644 index 0000000..2f8dd09 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UI/P18LightFieldTestAction.ui @@ -0,0 +1,345 @@ + + + P18FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=18 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_FieldTestAction.png + + + + + false + + + + 290 + 174 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 280 + 691 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 53 + 243 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 53 + 357 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 400 + 248 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 365 + 135 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=15000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 79 + 93 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=15000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 400 + 357 + 246 + 84 + + + + Index=5, Action=SetPage11,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 153 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 4 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/KD_ZM_8/UIFrameWork.py b/QT5_Project/KD_ZM_8/UIFrameWork.py new file mode 100644 index 0000000..2d294d6 --- /dev/null +++ b/QT5_Project/KD_ZM_8/UIFrameWork.py @@ -0,0 +1,1581 @@ +# This Python file uses the following encoding: utf-8 +import sys +import os +import time +import inspect +import cv2 +import json +from itertools import chain +from PyQt5 import uic +from PyQt5.QtGui import QImage, QPixmap, QColor,QBrush, QKeySequence, QIcon, QPalette +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent, QSize, QDateTime +from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget, QLayout, QLabel +from PyQt5.QtWidgets import QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from Shared_CODE.DialogModifyValue import DialogModifyValue +from Shared_CODE.DialogModifyAlias import DialogModifyAlias +from Shared_CODE.DialogModifyText import DialogModifyText +from Shared_CODE.DialogInform import DialogInform +from Shared_CODE.get_tip_prop import * +from print_color import * +import time +from PyQt5.QtCore import QDateTime +import re +from datetime import datetime +import platform +import subprocess + + +# sys.path.append(sys.path[0] + "/../..") +# sys_path = sys.path[0].replace("\\", "/") + + +# 设置 img 目录的路径 +img_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'background')) + + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#31D19E").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() +COLOR_VALUE_NORMAL = QColor("#31D19E").name() + +ALIAS_QUERY_NONE = 0 +ALIAS_QUERY_WAIT_RESPOINSE = 1 + + + + +#设置系统时间 + +def is_linux(): + return platform.system() == 'Linux' + +def set_system_time(year, month, day, hour, minute, second): + if is_linux(): + try: + new_time = datetime(year, month, day, hour, minute, second).strftime("%Y-%m-%d %H:%M:%S") + subprocess.run(f'sudo timedatectl set-time "{new_time}"', shell=True, check=True) + print(f"System time updated to {new_time}") + except subprocess.CalledProcessError as e: + print(f"Failed to update system time: {e}") + else: + import ctypes + import ctypes.wintypes + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + TIME_ZONE_ID_DAYLIGHT = 2 + + class SYSTEMTIME(ctypes.Structure): + _fields_ = [ + ("wYear", ctypes.wintypes.WORD), + ("wMonth", ctypes.wintypes.WORD), + ("wDayOfWeek", ctypes.wintypes.WORD), + ("wDay", ctypes.wintypes.WORD), + ("wHour", ctypes.wintypes.WORD), + ("wMinute", ctypes.wintypes.WORD), + ("wSecond", ctypes.wintypes.WORD), + ("wMilliseconds", ctypes.wintypes.WORD), + ] + + system_time = SYSTEMTIME() + ctypes.windll.kernel32.GetSystemTime(ctypes.byref(system_time)) + + system_time.wYear = year + system_time.wMonth = month + system_time.wDay = day + system_time.wHour = hour + system_time.wMinute = minute + system_time.wSecond = second + ctypes.windll.kernel32.SetSystemTime(ctypes.byref(system_time)) + print(f"System time updated to {year}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}") +def set_screen_blanking_time(minutes): + """ + 设置屏幕黑屏时间:param minutes: 屏幕黑屏时间,以分钟为单位 + """ + if is_linux(): + # 如果是 Linux 系统,使用 xfconf-query 命令设置 Xfce 的屏幕黑屏时间 + try: + # Xfce 的屏幕黑屏时间是以秒为单位 + seconds = int(minutes) * 60 + subprocess.run([ + 'xfconf-query', '-c', 'xfce4-power-manager', + '-p', '/xfce4-power-manager/blank-on-ac', + '-s', str(seconds), '-t', 'int', '--create' + ], check=True) + print(f"Xfce屏幕黑屏时间设置为 {minutes} 分钟") + except subprocess.CalledProcessError as e: + print(f"设置Xfce屏幕黑屏时间失败: {e}") + except FileNotFoundError: + print("xfconf-query 命令未找到,请确保已安装 xfce4-power-manager。") + elif platform.system() == 'Windows': + # 如果是 Windows 系统,使用 powercfg 命令设置屏幕黑屏时间 + try: + # 设置交流电源时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-ac', str(minutes)], check=True) + # 设置电池供电时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-dc', str(minutes)], check=True) + print(f"屏幕黑屏时间设置为 {minutes} 分钟 (适用于交流电和电池供电)") + except subprocess.CalledProcessError as e: + print(f"设置屏幕黑屏时间失败: {e}") + else: + print("当前操作系统不支持此操作。") + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + else : + json_dict = json.loads(message) + return json_dict + +def modify_style_sheet(type_name : str, origin_style_sheet : str, lead_str : str, value_str : str) : + if len(value_str) == 0 : + new_style_items = "" + else : + new_style_items = "%s:%s;"%(lead_str, value_str) + style_splits = origin_style_sheet.split("{") + if len(style_splits) == 1 : + style_items_str = style_splits[0] + elif len(style_splits) == 2 : + style_items_str = style_splits[1] + else : + style_items_str = "" + style_items_str = style_items_str.replace("}", "") + + prop_splits = style_items_str.split(";") + for each_style_prop in prop_splits : + if lead_str in each_style_prop : + key_value_splits = each_style_prop.split(":") + cmp_str = key_value_splits[0] + cmp_str = cmp_str.replace(" ", "") + cmp_str = cmp_str.replace("\n", "") + if lead_str == cmp_str : + continue + + if len(each_style_prop) > 0 : + new_style_items += each_style_prop + new_style_items += ";" + + if len(type_name) == 0: + return "%s"%(new_style_items) + else : + return "%s {%s}"%(type_name, new_style_items) + +def get_key_combine_str(str1, str2) : + return str1 + "," + str2 + +def search_circuit_from_topic(topic : str) : + circuit_id = -1 + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name in topic : + circuit_id = config_circuit_id + break + if circuit_id >= 0 : + break + return circuit_id + +def get_imag_value_file_name(tip_str : str, value : int) : + file_name = get_tip_value_str(tip_str, "ImageValue", default_string = None) + try : + if isinstance(value, str) : + fvalue = float(value) + value_id = round(fvalue) + else : + value_id = value + except Exception as e : + return None + + if file_name != None : + file_name_with_value = file_name%(value_id) + imag_value_file_name = os.path.join(img_path, file_name_with_value) + else : + imag_value_file_name = None + + if imag_value_file_name != None : + if os.path.exists(imag_value_file_name) : + return imag_value_file_name.replace("\\", "/") + return None + +def get_imag_file_name(tip_str : str, key_imag : str, default_string = None) : + file_name = get_tip_value_str(tip_str, key_imag, default_string) + select_image_file_name = None + if file_name != None : + select_image_file_name = os.path.join(img_path, file_name) + if os.path.exists(select_image_file_name) : + return select_image_file_name.replace("\\", "/") + return None + +def get_select_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectImag", default_string = None) + +def get_select_icon_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectIcon", default_string = None) + +def get_bk_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageBackGround", default_string = None) + +def get_indicator_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageIndicator", default_string = None) + +def get_compare_index(main_index : int, sub_index : int) : + return (main_index + 1) * 64 + sub_index + +class UIFrameWork(QMainWindow, class_comm_mqtt_interface): + mqtt_signal : pyqtSignal = pyqtSignal(str) + + def __init__(self): + QMainWindow.__init__(self) + self.topic_message_list : list = [] + self.mutex : QMutex = QMutex() + + self.mqtt_signal.connect(self.mqtt_topic_message_process) + self.menu_list = [] + self.sort_menu_list = [] + self.menu_key_index = 0 + self.key_active = 0 + self.select_object : QWidget = None + self.wait_response_list = [] + self.mqtt_thread : class_comm_mqtt_thread= None + + self.mqtt_value_dict = {} + + self.widget_timeout_list = [] + + self.alias_dict = {} + self.alias_query_timer : QTimer = None + + self.alias_query_timer = QTimer() + self.alias_query_timer.timeout.connect(self.process_alias_query) + self.alias_query_timer.start(3000) + + self.video_visible_timer = QTimer() + self.video_visible_timer.timeout.connect(self.video_visible_timeout) + self.video_visible_timer.start(200) + + self.time_timer = QTimer() + self.time_timer.timeout.connect(self.flush_system_cycle) + self.time_timer.start(500) + + self.canvas_visible_arr = [ + False, + False, + False, + False, + False, + False, + False, + False, + False, + ] + + # QLabel list_index CameraThread + # self.canvas_label_list : QLabel = [ [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None] + # ] + # self.set_video_image_func_arr = [self.set_video_image_0, self.set_video_image_1, self.set_video_image_2, self.set_video_image_3, + # self.set_video_image_4, self.set_video_image_5, self.set_video_image_6, self.set_video_image_7, + # self.set_video_image_8 + # ] + + # 使用列表推导式动态生成 canvas_label_list + self.canvas_label_list = [[None, -1, None] for _ in range(9)] + # 使用列表推导式动态生成 set_video_image_func_arr + self.set_video_image_func_arr = [getattr(self, f'set_video_image_{i}') for i in range(9)] + + self.page = -1 + self.select_main_index = -1 + self.exist_circuit_mask = 0 + + self.check_widget_timeout_timer : QTimer = None + + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_0), self, activated=self.key_Test_process0) + QShortcut(QKeySequence(Qt.Key_1), self, activated=self.key_Test_process1) + QShortcut(QKeySequence(Qt.Key_2), self, activated=self.key_Test_process2) + QShortcut(QKeySequence(Qt.Key_3), self, activated=self.key_Test_process3) + self.bind_channel = -1 + + #虚函数, 切换到本页面时调用 + def virtual_on_page_enter(self) : + pass + + #虚函数, 退出到本页面时调用 + def virtual_on_page_leave(self) : + pass + + #虚函数, 切换到页面, 需要在派生类中实现, page=-1表示退出到上一级菜单 + def virtual_change_to_page(self, page) : + pass + + #虚函数, 画布连接到摄像头, 需要在派生类中实现。 + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + pass + + #虚函数, action处理函数, 派生类可以额外处理 + def virtual_widget_action_process(self, widget : QObject, action : str) : + return + + def set_mqtt_value(self, circuit : int, mqtt_name : str, mqtt_value) : + key = f'{circuit}+{mqtt_name}' + self.mqtt_value_dict[key] = mqtt_value + + def get_mqtt_value(self, circuit : int, mqtt_name : str) : + key = f'{circuit}+{mqtt_name}' + if key in self.mqtt_value_dict.keys() : + return self.mqtt_value_dict[key] + return None + + def modify_object_style_sheet(self, object :QWidget, lead_str : str, value_str : str) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.styleSheet() + new_style_sheet = modify_style_sheet(object_type_name, origin_style, lead_str, value_str) + object.setStyleSheet(new_style_sheet) + + def reset_object_style_sheet(self, object :QWidget) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.whatsThis() + object.setStyleSheet(origin_style) + + def load_window_ui(self, file_window_ui : str) : + if os.path.exists(file_window_ui): + uic.loadUi(file_window_ui, self) + self.load_resource_bitmap() + self.create_menu_list() + self.sort_menu_list = sorted(self.menu_list, key=lambda x: x[0]) + self.create_style_sheet_backup() + self.create_timeout_list() + self.create_alias_list() + self.update_window_circuit_mask() + self.exist_circuit_mask = self.get_circuit_mask() + self.check_widget_timeout_timer : QTimer = QTimer() + self.check_widget_timeout_timer.timeout.connect(self.process_widget_timeout_list) + self.check_widget_timeout_timer.start(100) + self.page = get_tip_page(self.statusTip()) + self.menu_selectable_object_flush() + + def get_circuit_mask(self, child_widget : QWidget = None) : + widget :QWidget = child_widget + if widget == None : + widget = self + circuit_id_mask = 0 + + for each_object in widget.children(): + child : QWidget = each_object + if hasattr(child, "statusTip") : + circuit_id = self.get_circuit_from_object(child) + if circuit_id >= 0 : + circuit_id_mask |= (0x01 << circuit_id) + circuit_id_mask |= self.get_circuit_mask(child) + return circuit_id_mask + + def update_window_circuit_mask(self) : + self.exist_circuit_mask = self.get_circuit_mask() + return + + def set_menu_main_index(self, main_index) : + self.main_index = main_index + if len(self.sort_menu_list) == 0 : + return + if self.main_index < 0 : + self.menu_key_index = 0 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + return + menu_key_index = 0 + for each_item in self.sort_menu_list : + compare_index = each_item[0] + if compare_index >= get_compare_index(main_index, 0) : + break + menu_key_index += 1 + self.menu_key_index = menu_key_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def process_alias_query(self): + if not self.mqtt_thread: + return # 如果没有 MQTT 线程,直接返回 + + for alias_unique_name, alias_value_dict in self.alias_dict.items(): # {"xxxxx,sss": 123} + if not isinstance(alias_value_dict, int) or alias_value_dict != ALIAS_QUERY_NONE: + continue # 仅处理需要查询的整数别名 + + alias_name, uniqe_name = alias_unique_name.split(",") + + # 初始化 select_object 变量 + select_object: QWidget = None + + # 将别名的值设置为等待响应状态 + self.alias_dict[alias_unique_name] = ALIAS_QUERY_WAIT_RESPOINSE + + # 发布 MQTT 消息并等待响应 + self.mqtt_publish_and_wait_response( + f"request/alias/{uniqe_name}", + json.dumps({"name": alias_name}), + select_object, + 2000, + False + ) + + def process_widget_timeout_list(self) : + list_index = 0 + for timeout_items in self.widget_timeout_list: + time_limit = timeout_items[0] + cur_time = timeout_items[1] + cur_time += 100 + if cur_time >= time_limit: + cur_time = 0 + timeout_widget : QWidget = timeout_items[2] + if isinstance(timeout_widget, QLineEdit) : + lineedit_widget : QLineEdit = timeout_widget + lineedit_widget.setText("通信超时") + elif isinstance(timeout_widget, QLabel) : + label_widget : QLabel = timeout_widget + if "canvas" in label_widget.statusTip() : + self.camera_signal_timeout(label_widget) + else : + if label_widget.isVisible() : + label_widget.setVisible(False) + #label_widget.hide() + elif isinstance(timeout_widget, QPushButton) : + button_widget : QPushButton = timeout_widget + self.reset_object_style_sheet(button_widget) + button_widget.setText("通信超时") + timeout_items[1] = cur_time + self.widget_timeout_list[list_index] = timeout_items + list_index = list_index + 1 + + def reset_widget_timeout(self, widget : QObject) : + Index = 0 + for timeout_item in self.widget_timeout_list: + cur_time = timeout_item[1] + timeout_widget : QWidget = timeout_item[2] + if timeout_widget == widget : + timeout_item[1] = 0 + self.widget_timeout_list[Index] = timeout_item + break + Index = Index + 1 + + + def connect_camera_thread(self, camera_thread : CameraThread, canvas_id : int = 0, is_visible : bool = True) : + if camera_thread == None or canvas_id < 0: + return + if canvas_id < len(self.set_video_image_func_arr) : + canvas_object : QLabel = self.search_canvas_object(canvas_id) + if canvas_object : + canvas_info_item = self.canvas_label_list[canvas_id] + + origin_camera_thread : CameraThread = canvas_info_item[2] + if origin_camera_thread != None and origin_camera_thread.is_signal_connect: + origin_camera_thread.image_signal.disconnect(self.set_video_image_func_arr[canvas_id]) + + if is_visible : + + camera_thread.signal_connect(self.set_video_image_func_arr[canvas_id]) + + list_index : int = self.get_timeout_List_index(canvas_object) + self.canvas_label_list[canvas_id] = [canvas_object, list_index, camera_thread] + else : + self.canvas_label_list[canvas_id] = [None, -1, None] + + self.canvas_visible_arr[canvas_id] = is_visible + + + + def camera_signal_timeout(self, camera_label : QLabel): + if camera_label != None : + image_path = os.path.join(img_path, 'IM05_002.png') + if os.path.exists(image_path): + image = QPixmap(image_path) + scaled_image = image.scaled(camera_label.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) + camera_label.setPixmap(scaled_image) + + def search_canvas_object(self, canvas_id = 0, child = None) : + widget :QWidget = child + if widget == None : + widget = self + child_count = 0 + for each_object in widget.children(): + child_count += 1 + child : QWidget = each_object + + if hasattr(child, "statusTip") : + tip_str : str = child.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if config_canvas_id >= 0 and config_camera_id >= 0 and config_canvas_id == canvas_id: + if isinstance(child, QLabel) : + return child + + find_canvas_object = self.search_canvas_object(canvas_id, child) + if find_canvas_object != None : + return find_canvas_object + + if child_count == 0 : + return None + + def get_canvas_prop (self, canvas_id : int= 0) : + config_camera_id = -1 + is_face_detect : int = 0 + + canvas_object : QWidget = self.search_canvas_object(canvas_id) + if canvas_object != None : + tip_str : str = canvas_object.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + is_face_detect = get_tip_face_detection(tip_str) + return config_camera_id, is_face_detect + + def load_resource_bitmap(self, child = None) : + widget :QWidget = self + if child != None : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + imag_file_name = get_bk_imag_file_name(tip_str) + if imag_file_name != None : + if isinstance(child_widget, QLabel) : + label_child_object : QLabel = child_widget + label_child_object.setScaledContents(True) + image = QPixmap(imag_file_name) + label_child_object.setPixmap(image) + elif isinstance(child_widget, QWidget) : + file_url = "url(%s)"%(imag_file_name) + self.modify_object_style_sheet(child_widget, "background-image", file_url) + self.load_resource_bitmap(child_widget) + + def create_style_sheet_backup(self, child = None) : + widget :QWidget = child + if child == None : + widget = self + for child_widget in widget.children(): + if hasattr(child_widget, "styleSheet") : + widget : QWidget = child_widget + style_sheet : str = widget.styleSheet() + widget.setWhatsThis(style_sheet) + self.create_style_sheet_backup(child_widget) + + def create_timeout_list(self, child = None) : + widget :QWidget = self + if child == None : + self.widget_timeout_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + timeout_limit_ms = get_tip_timeout(tip_str) + if timeout_limit_ms >= 0: + self.widget_timeout_list.append([timeout_limit_ms, 0, child_widget]) + self.create_timeout_list(child_widget) + + def get_timeout_List_index(self, object : QWidget) : + list_index = -1 + search_list_index = 0 + for items in self.widget_timeout_list : + child_widget : QWidget = items[2] + if child_widget == object : + list_index = search_list_index + break + search_list_index += 1 + return list_index + + def get_page_circuit(self): + if hasattr(self, "statusTip") : + return get_tip_circuit(self.statusTip()) + return -1 + + def set_page_circuit(self, circuit_id = -1) : + if hasattr(self, "statusTip") : + origin_status_tip : str = self.statusTip() + origin_tip_splits = origin_status_tip.split(",") + new_status_tip = "" + for each_str in origin_tip_splits: + if "circuit" not in each_str : + new_status_tip += each_str + new_status_tip += "," + new_status_tip += "circuit=%d"%(circuit_id) + self.setStatusTip(new_status_tip) + self.update_window_circuit_mask() + self.create_alias_list() + self.process_alias_query() + self.para_or_measure_query() + + def create_alias_list(self, child = None) : + widget :QWidget = self + if child == None : + self.alias_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + alias_str = get_tip_alias_str(tip_str) + if alias_str != None: + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None : + key_combine_str = get_key_combine_str(alias_str, unique_name) + if key_combine_str not in self.alias_dict.keys() : + self.alias_dict[key_combine_str] = ALIAS_QUERY_NONE + self.create_alias_list(child_widget) + + def create_menu_list(self, child = None) : + widget :QWidget = self + if child == None : + self.menu_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + sub_index = get_tip_menu_sub_index(tip_str) + if sub_index >= 0: + main_index = self.get_main_index_from_object(child_widget) + if main_index >= 0 : + compare_index = get_compare_index(main_index, sub_index) + else : + compare_index = sub_index + self.menu_list.append([compare_index, child_widget]) + if isinstance(child_widget, QPushButton) : + button : QPushButton = child_widget + button.clicked.connect(self.on_menu_qpush_button_click) + self.create_menu_list(child_widget) + + def on_select_object_action_process(self, select_object : QWidget) : + tip_str = select_object.statusTip() + action_str = get_tip_value_str(tip_str, "Action", None) + if action_str != None : + if "password" in tip_str : + dialog_modify_text = DialogModifyValue(self) + caption_str = "请输入密码:" + dialog_modify_text.update_modify_info("", "0000", caption_str) + input = False + + if dialog_modify_text.exec() == QDialog.Accepted: + input = True + modify_screen_time_str = dialog_modify_text.value + pass_word = system_parameter() + if modify_screen_time_str != pass_word.get_system_password() : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", "密码错误,无法修改!") + return + else: + input = True + if input : + if "CmdExecute" in action_str : + mqtt_name = get_tip_mqtt_name(tip_str) + unique_name = self.get_unique_name_from_object(select_object) + if mqtt_name != None and unique_name != None: + if len(mqtt_name) > 0 and self.mqtt_thread != None: + publish_topic = "request/action/" + unique_name + publish_message = '{"name" : "%s"}'%(mqtt_name) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, select_object, 1000) + elif "ModifySystem" in action_str: + self.on_system_param_modify(tip_str) + elif "Modify" in action_str : + if isinstance(select_object, QLineEdit) : + self.on_line_edit_modify_click(select_object) + + self.virtual_widget_action_process(select_object, action_str) + + def search_menu_match_object(self, object) : + match_object : QWidget = None + menu_index = 0 + for each_list in self.sort_menu_list : + search_object = each_list[1] + if search_object == object : + match_object = search_object + break + menu_index += 1 + return match_object, menu_index + + #刷新屏幕上的系统信息, 例如时间日期之类 + def flush_system_info(self, child = None) : + widget : QWidget= child + if child == None : + widget = self + else : + widget = child + + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + system_str = get_tip_system(tip_str) + + if system_str == "DateTime" : + qdate_time = QDateTime.currentDateTime() + time_str = qdate_time.toString("yyyy-MM-dd hh:mm:ss") + + if isinstance(child_widget, QPushButton) : + button_widget : QPushButton = child_widget + button_widget.setText(time_str) + elif isinstance(child_widget, QLineEdit) : + line_edit_widget : QLineEdit = child_widget + line_edit_widget.setText(time_str) + elif isinstance(child_widget, QLabel) : + label_widget : QLabel = child_widget + label_widget.setText(time_str) + self.flush_system_info(child_widget) + + def func_mqtt_param_modify(self, modify_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/modify/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, modify_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def func_call_back_on_mqtt_param_info(self, info_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/info/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, info_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def on_menu_qpush_button_click(self, sender : QPushButton): + sender : QPushButton = self.sender() + match_object : QWidget = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + self.menu_selectable_object_flush() + if isinstance(match_object, QPushButton) : + self.on_select_object_action_process(match_object) + + #修改系统时间与日期 + def func_modify_system_time(self, modify_str : str) : + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + set_system_time(year, month, day, hour, minute, second) + + return year, month, day, hour, minute, second + return None + + #修改系统黑屏时间 + def func_modify_screen_blanking_time(self, modify_str: str): + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 1: + minutes = int(numbers[0]) + set_screen_blanking_time(minutes) + return minutes + return None + + def on_system_param_modify(self, tip : str) : + system = get_tip_system(tip) + if system == "DateTime" : + dialog_modify_text : DialogModifyText = DialogModifyText(self) + caption_str = "修改系统时间" + cur_time = QDateTime.currentDateTime() + date_time_str = cur_time.toString("yyyy-MM-dd hh:mm:ss") + dialog_modify_text.update_modify_info(date_time_str, caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_date_time_str = dialog_modify_text.value + self.func_modify_system_time(modify_date_time_str) + for circuit_id in range(8) : + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None and self.mqtt_thread != None: + time_message = '{"name" : "SetupTime", "value" : "%s"}'%(modify_date_time_str) + self.mqtt_thread.publish("request/action/" + unique_name, time_message) + dialog_inform = DialogInform(self) + dialog_inform.information("系统时间修改", "系统时间修改成功") + elif system == "ScreenBlankingTime": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改屏幕黑屏时间(分钟)" + sbt = system_parameter() + dialog_modify_text.update_modify_info("", str(sbt.get_screen_blanking_time()), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + result = self.func_modify_screen_blanking_time(modify_screen_time_str) + sbt.change_screen_blanking_time(modify_screen_time_str) + + if result is not None: + self.BlankTimelineEdit.setText(str(result)) + dialog_inform = DialogInform(self) + dialog_inform.information("屏幕黑屏时间修改", "屏幕黑屏时间修改成功") + + elif system == "SystemPassWord": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改系统密码" + pass_word = system_parameter() + dialog_modify_text.update_modify_info("", pass_word.get_system_password(), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + pass_word.set_system_password(modify_screen_time_str) + dialog_inform = DialogInform(self) + dialog_inform.information("系统密码修改", "系统密码修改成功") + def on_line_edit_modify_click(self, sender :QLineEdit) : + match_object : QLineEdit = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + if isinstance(match_object, QLineEdit) : + self.dialog_modify_value = None + tip = match_object.statusTip() + alias_name = get_tip_alias_str(tip) + unique_name = self.get_unique_name_from_object(match_object) + if unique_name != None and alias_name != None : + key_combine_str = get_key_combine_str(alias_name, unique_name) + value_dict = utils.dict_or_object_get_attr(self.alias_dict, key_combine_str, None) + + if isinstance(value_dict, dict) : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + caption_str = get_tip_caption_str(match_object.statusTip()) + value_text = match_object.text() + dialog_modify_alias.set_alias_item_info(value_dict, value_text, caption_str) + self.dialog_modify_alias = dialog_modify_alias + + if dialog_modify_alias.exec() == QDialog.Accepted : + modify_value = dialog_modify_alias.value + self.func_mqtt_param_modify(modify_value) + else : + inform_box : DialogInform = DialogInform() + inform_box.information('别名数据未获取', 'message: %s'%(alias_name)) + else : + dialog_modify_value : DialogModifyValue = DialogModifyValue(self) + caption_str = get_tip_caption_str(match_object.statusTip()) + try : + origin_value = float(match_object.text()) + except Exception as e : + origin_value = None + inform_box : DialogInform = DialogInform() + inform_box.information('无效值', str(e)) + + if origin_value != None : + format_str = get_tip_format(tip) + dialog_modify_value.update_modify_info(format_str, origin_value, caption_str) + if dialog_modify_value.exec() == QDialog.Accepted : + modify_value = dialog_modify_value.value + self.func_mqtt_param_modify(modify_value) + def set_video_image(self, image_object : QObject, canvas_id = 0) : + if canvas_id >= len(self.canvas_label_list) : + return + camera_info_items = self.canvas_label_list[canvas_id] + camera_label: QLabel = camera_info_items[0] + timeout_list_index = camera_info_items[1] + camera_thread : CameraThread = camera_info_items[2] + + if camera_label != None: + shape = image_object.shape + width = shape[1] + height = shape[0] + if camera_label.isVisible() : + + qt_img = QImage(image_object.data, width, height, QImage.Format_RGB888) + + camera_label.setScaledContents(True) + camera_label.setPixmap(QPixmap.fromImage(qt_img)) + + if timeout_list_index >= 0 : + self.widget_timeout_list[timeout_list_index][1] = 0 + + def set_video_image_0(self, image_object : QObject) : + self.set_video_image(image_object, 0) + + def set_video_image_1(self, image_object : QObject) : + self.set_video_image(image_object, 1) + + def set_video_image_2(self, image_object : QObject) : + self.set_video_image(image_object, 2) + + def set_video_image_3(self, image_object : QObject) : + self.set_video_image(image_object, 3) + + def set_video_image_4(self, image_object : QObject) : + self.set_video_image(image_object, 4) + + def set_video_image_5(self, image_object : QObject) : + self.set_video_image(image_object, 5) + + def set_video_image_6(self, image_object : QObject) : + self.set_video_image(image_object, 6) + + def set_video_image_7(self, image_object : QObject) : + self.set_video_image(image_object, 7) + + def set_video_image_8(self, image_object : QObject) : + self.set_video_image(image_object, 8) + + def update_mqtt_value(self, circuit, json_dict) : + for json_key, json_value in json_dict.items() : + self.set_mqtt_value(circuit, json_key, json_value) + + #更新视频显示与否 + def update_canvas_camera_visible(self, child = None) : + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if isinstance(child, QLabel) : + widget_label : QLabel = child + tip_str = widget_label.statusTip() + visible_mqtt = get_tip_visible_mqtt(tip_str, None) + if visible_mqtt != None : + #该Label具有Visible控制, 检查一下是不是视频流 + canvas_id, camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if canvas_id >= 0 and camera_id >= 0 : + circuit_id = self.get_circuit_from_object(widget_label) + visible_value = self.get_mqtt_value(circuit_id, visible_mqtt) + + is_visible = False + if visible_value != None : + try : + is_visible = True if int(visible_value) > 0 else False + except Exception as e : + is_visible = False + + widget_label.setVisible(is_visible) + if is_visible != self.canvas_visible_arr[canvas_id] and canvas_id < len(self.canvas_visible_arr): + self.canvas_visible_arr[canvas_id] = is_visible + self.virtual_connect_canvas_to_camera(canvas_id, camera_id, is_visible) + + self.update_canvas_camera_visible(child) + + def video_visible_timeout(self) : + self.update_canvas_camera_visible() + + #通过json包刷新界面数据 + def flush_widgets(self, circuit, json_dict, child = None): + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if not hasattr(child, "statusTip") : + continue + tip_str : str = child.statusTip() + + mqtt_name = get_tip_mqtt_name(tip_str) + + circuit_id = self.get_circuit_from_object(each_object) + self.flush_widgets(circuit, json_dict, child) + + if circuit_id != circuit : + continue + + if mqtt_name in json_dict.keys() : + value_or_dict = json_dict[mqtt_name] + + if isinstance(value_or_dict, dict) : + value_text = utils.dict_or_object_get_attr(value_or_dict, "value", "") + else : + value_text = value_or_dict + + color_str = utils.dict_or_object_get_attr(value_or_dict, "color", None) + bk_color_str = utils.dict_or_object_get_attr(value_or_dict, "bk_color", None) + + imag_file_name = get_imag_value_file_name(tip_str, value_text) + timeout_ms = get_tip_timeout(tip_str) + if timeout_ms > 0 : + self.reset_widget_timeout(child) + + if isinstance(child, QPushButton) : + widget_button : QPushButton = child + if imag_file_name != None : + self.modify_object_style_sheet(widget_button, "border-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_button) + + if isinstance(child, QLabel) : + widget_label : QLabel = child + if imag_file_name != None : + if widget_label.isVisible() == False : + widget_label.setVisible(True) + self.modify_object_style_sheet(widget_label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_label) + widget_label.setText(value_text) + + if isinstance(child, QLineEdit) : + widget_line_edit : QLineEdit = child + alias_name = get_tip_alias_str(widget_line_edit.statusTip()) + unique_name = self.get_unique_name_from_object(widget_line_edit) + + if alias_name != None : + fvalue = float(value_text) + value = round(fvalue) + value_str = str(value) + display_text = "(%s)"%(value_str) + + alias_key_str = get_key_combine_str(alias_name, unique_name) + if alias_key_str in self.alias_dict.keys() : + alias_value_dict = self.alias_dict[alias_key_str] + if isinstance(alias_value_dict, dict) : + display_text = utils.dict_or_object_get_attr(alias_value_dict, value_str, value_text) + else : + display_text = value_text + widget_line_edit.setText(display_text) + + if bk_color_str != None : + if isinstance(child, QLineEdit) : + self.modify_object_style_sheet(child, "background-color", bk_color_str) + if color_str != None : + self.modify_object_style_sheet(child, "color", color_str) + + def get_circuit_from_object(self, object :QWidget) : + parent : QWidget= object + circuit_id = -1 + while parent != None : + if hasattr(parent, "statusTip") : + tip_str = parent.statusTip() + circuit_id = get_tip_circuit(tip_str) + if circuit_id >= 0 or parent == self: + break + parent = parent.parent() + return circuit_id + + def get_main_index_from_object(self, object :QWidget) : + parent : QWidget= object + main_index = -1 + while parent != None : + if not hasattr(parent, "statusTip") : + return -1 + + tip_str = parent.statusTip() + main_index = get_tip_main_index(tip_str) + if main_index >= 0 or parent == self: + break + parent = parent.parent() + return main_index + + def get_unique_name_from_circuit(self, circuit_id : int) : + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_circuit_id == circuit_id : + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + return circuit_unique_name + return None + + def get_unique_name_from_object(self, object :QWidget) : + circuit_id = self.get_circuit_from_object(object) + return self.get_unique_name_from_circuit(circuit_id) + + def key_increase_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_end(tip_str) + + if group_items_count == -1: + next_menu_index = (self.menu_key_index + 1) % menu_count + else: + next_menu_index = (self.menu_key_index - group_items_count + 1) % menu_count + + self.menu_key_index = next_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def key_decrease_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_start(tip_str) + if group_items_count == -1: + prev_menu_index = (self.menu_key_index - 1) % menu_count + else: + prev_menu_index = (self.menu_key_index + group_items_count - 1) % menu_count + + self.menu_key_index = prev_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + + def key_enter_process(self): + menu_count = len(self.sort_menu_list) + if menu_count == 0: + return + + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.on_select_object_action_process(self.select_object) + + def key_escape_process(self): + #在菜单第一项, 按下复位, 退出到上一页 + if self.menu_key_index == 0: + self.virtual_change_to_page(-1) + + menu_count = len(self.sort_menu_list) # 获取当前页面可交互控件个数 + if menu_count == 0: # 若注册可交互控件个数为0,则退出处理,返回 + return + + # 重置菜单选择 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_key_index = 0 + self.menu_selectable_object_flush() + + + def key_Test_process0(self): + json_dict = {"Uab" :"1111", + "Ubc" : "1111", + "Uca" : "1111", + "Uo" : "11" , + "Iab" : "1111", + "Ibc" : "1111", + "Ica" : "1111", + "Io" : "1111", + "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + } + + + self.flush_widgets(0, json_dict) + + def key_Test_process1(self): + json_dict = {"Uab" :"2222", + "Ubc" : "2222", + "Uca" : "2222", + "Uo" : "22" , + "Iab" : "2222", + "Ibc" : "2222", + "Ica" : "2222", + "Io" : "2222", + "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + + + } + self.flush_widgets(1, json_dict) + + def key_Test_process2(self): + json_dict = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + self.flush_widgets(2, json_dict) + + def key_Test_process3(self): + json_dict = {"Uab" :"33333", "Ubc" : "33333", "Uca" : "33333"} + self.flush_widgets(3, json_dict) + + def menu_selectable_object_flush(self) : + menu_count = len(self.sort_menu_list) + for i in range(menu_count): + object : QWidget = self.sort_menu_list[i][1] + is_select_object_draw = False + + if isinstance(object, QPushButton) : + button_object : QPushButton = object + image_file_name = get_select_imag_file_name(object.statusTip()) + image_icon_name = get_select_icon_file_name(object.statusTip()) + + if i == self.menu_key_index: + button_object.setFocus() + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(button_object, "border-image", file_url) + elif image_icon_name != None : + is_select_object_draw = True + button_size : QSize = button_object.size() + button_object.setIcon(QIcon(image_icon_name)) + button_object.setIconSize(button_size) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(button_object) + elif image_icon_name != None : + is_select_object_draw = True + button_object.setIcon(QIcon()) + + elif isinstance(object, QLabel) : + label_object : QLabel = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(label_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(label_object) + + elif isinstance(object, QLineEdit) : + line_object : QLineEdit = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(line_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(line_object) + + + if is_select_object_draw == False : + if i == self.menu_key_index : + self.modify_object_style_sheet(object, "background-color", COLOR_BLUE) + else : + self.reset_object_style_sheet(object) + + def response_topic_message_process(self, topic: str, + message : str, + is_timeout :bool = False, inform : bool = False) : + find_reponse_topic_msg = None + for wait_topic_msg in self.wait_response_list : + if wait_topic_msg[0] == topic : + find_reponse_topic_msg = wait_topic_msg + self.wait_response_list.remove(wait_topic_msg) + break + + if find_reponse_topic_msg == None : + return + + select_object :QWidget = find_reponse_topic_msg[2] + request_message : str = find_reponse_topic_msg[1] + + inform_box : DialogInform = None + if inform : + inform_box : DialogInform = DialogInform() + + try : + json_dict = json_load_message(message) + result = utils.dict_or_object_get_attr(json_dict, "result", 0) + result = int(result) + except Exception as e: + json_dict = None + result = 0 + print_error_msg(str(e) + "invalid json message: %s" % (message)) + + if "response/action" in topic : + if is_timeout : + inform_message = "命令执行超时" + if inform == True: + inform_box.information('命令执行超时', inform_message) + else : + inform_message = '命令执行成功' if result == 1 else '命令执行失败!!!' + if inform == True: + inform_box.information('命令执行', inform_message) + elif "response/param/modify" in topic : + if is_timeout : + inform_message = '参数修改超时' + if inform == True: + inform_box.information('参数修改超时', inform_message) + else : + inform_message = '参数修改成功' if result == 1 else '参数修改失败!!!' + if inform == True: + inform_box.information('参数修改', inform_message) + if result == 1 : + self.para_or_measure_query() + elif "response/alias" in topic : + unique_name = topic.replace("response/alias/", "") + + if is_timeout : + if json_dict != None : + alias_name = None + if "name" in json_dict.keys() : + alias_name = json_dict["name"] + + if alias_name != None : + key_str = get_key_combine_str(alias_name, unique_name) + if key_str in self.alias_dict.keys() : + if isinstance(self.alias_dict[key_str], int) : + self.alias_dict[key_str] = ALIAS_QUERY_NONE + + if inform == True: + inform_box.information('获取别名超时', message) + else : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + if isinstance(json_dict, list): + for item in json_dict: + for alias_key_name, alias_dict in item.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + else: + for alias_key_name, alias_dict in json_dict.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + + def mqtt_topic_message_process(self, msg) : + topic_msg_item = True + while topic_msg_item != None : + self.mutex.lock() + topic_msg_count = len(self.topic_message_list) + if topic_msg_count > 0: + topic_msg_item = self.topic_message_list.pop(0) + else : + topic_msg_item = None + self.mutex.unlock() + if topic_msg_item != None : + topic = topic_msg_item[0] + message = topic_msg_item[1] + try : + json_dict = json_load_message(message) + except Exception as e : + json_dict = None + print_error_msg("invalid json message : %s"%(message)) + if json_dict != None: + if "measure" in topic : + circuit_id = search_circuit_from_topic(topic) + self.update_mqtt_value(circuit_id, json_dict) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.flush_widgets(circuit_id, json_dict) + elif "param/info" in topic: + circuit_id = search_circuit_from_topic(topic) + #print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response/alarm" in topic : + circuit_id = search_circuit_from_topic(topic) + self.flush_alarminfo(circuit_id, json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response" in topic : + self.response_topic_message_process(topic, message, is_timeout = False, inform = True) + + elif "alarm/test" in topic : + circuit_id = search_circuit_from_topic(topic) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + + # 将告警信息刷新到页面 + def flush_alarminfo(self, circuit, json_dict, child = None): + + alarmTitle : QLineEdit = self.findChild(QLineEdit,"alarmTitle") + if alarmTitle != None: + display_title = "%s"%(json_dict["index"]) + alarmTitle.setText(display_title) + + alarmTime : QLineEdit = self.findChild(QLineEdit,"alarmTime") + if alarmTime != None: + display_year = "%s-"%(json_dict["AlarmYear"]) + display_month = "%s-"%(json_dict["AlarmMonth"]) + display_day = "%s"%(json_dict["AlarmDay"]) + display_hour = " %s:"%(json_dict["AlarmHour"]) + display_minute = "%s: "%(json_dict["AlarmMinute"]) + display_second = "%s"%(json_dict["AlarmSecond"]) + + disp_time = display_year + display_month + display_day + display_hour+ display_minute+ display_second + alarmTime.setText(disp_time) + + alarmMsg : QLineEdit = self.findChild(QLineEdit,"alarmMsg") + if alarmMsg != None: + display_msg = "%s"%(json_dict["AlarmCodeMsg"]) + alarmMsg.setText(display_msg) + + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0: + self.mqtt_thread = mqtt_thread + self.mqtt_thread.subscribe("response/#") + self.mqtt_thread.subscribe("param/info/#") + self.mqtt_thread.subscribe("param/modify/#") + self.mqtt_thread.subscribe("measure/#") + self.mqtt_thread.subscribe("status/#") + self.mqtt_thread.subscribe("alarm/#") + self.mqtt_thread.subscribe("response/alarm/#") + self.mqtt_thread.subscribe("action/#") + else : + self.mqtt_thread = None + + def on_message(self, mqtt_thread, topic, message) : + circuit_id = search_circuit_from_topic(topic) + if circuit_id < 0 : + return + if (self.exist_circuit_mask & (0x1 << circuit_id)) == 0 : + return + self.mutex.lock() + if len(self.topic_message_list) < 100 : + self.topic_message_list.append([topic, message]) + self.mutex.unlock() + self.mqtt_signal.emit("Refresh UI") + + def response_topic_messge_timeout(self): + timer = self.sender() + for wait_response_items in self.wait_response_list: + wait_timer : QTimer = wait_response_items[3] + _inform : bool = wait_response_items[4] + + if wait_timer == timer : + topic : str = wait_response_items[0] + message : str = wait_response_items[1] + wait_timer.stop() + self.response_topic_message_process(topic, message, is_timeout=True, inform = _inform) + break + + # def mqtt_publish_and_wait_response(self, publish_topic : str, publish_message : str, select_object : QWidget = None, timeout_ms : int = 1000, inform : bool = True) : + # if self.mqtt_thread != None : + # self.mqtt_thread.publish(publish_topic, publish_message) + + # response_topic = publish_topic.replace("request", "response") + # #开启超时定时器 + # wait_timer = QTimer() + # wait_timer.timeout.connect(self.response_topic_messge_timeout) + # wait_timer.start(timeout_ms) + # self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + def mqtt_publish_and_wait_response(self, publish_topic: str, publish_message: str, select_object: QWidget = None, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda: self.response_topic_message_timeout(response_topic)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def response_topic_message_timeout(self, response_topic): + # 处理超时事件 + for response_info in self.wait_response_list: + if response_info[0] == response_topic: + response_info[3].stop() # 停止定时器 + self.wait_response_list.remove(response_info) + # 在这里添加超时后的处理逻辑,例如通知用户请求超时 + if response_info[4]: # 检查是否需要通知 + self.inform_timeout(response_info) + break + + def inform_timeout(self, response_info): + # 通知用户请求超时的逻辑 + # response_info[2] 是 select_object + # 根据具体需求实现通知逻辑 + print(f"Request for {response_info[1]} on topic {response_info[0]} timed out.") + + def batch_mqtt_publish_and_wait_response(self, publish_list: list, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + for publish_topic, publish_message, select_object in publish_list: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda rt=response_topic: self.response_topic_message_timeout(rt)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def para_or_measure_query(self, child = None) : + widget :QWidget = self + if child == None : + self.param_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + if "ScreenBlankingTime" in tip_str : + sbt = system_parameter() + child_widget.setText(sbt.get_screen_blanking_time()) + continue + mqtt_str = get_tip_mqtt_name(tip_str) + if mqtt_str != None and mqtt_str not in self.param_dict.keys(): + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None and self.mqtt_thread != None: + self.mqtt_thread.publish("request/param/info/"+unique_name, '{"name":"%s"}'%mqtt_str) + self.param_dict[mqtt_str] = ALIAS_QUERY_NONE + self.para_or_measure_query(child_widget) + + + def flush_system_cycle(self) : + self.flush_system_info() + +if __name__ == '__main__': + + style_sheet = "QLabel {color : RED;\nbackground-color : GREEN;}" + print(style_sheet) + + new_style_items = modify_style_sheet("QLabel", style_sheet, "background-color", "WHITE") + new_style_items = modify_style_sheet("QLabel", new_style_items, "color", "YELLOW") + + print(new_style_items) + sys.exit(0) diff --git a/QT5_Project/KD_ZM_8/__init__.py b/QT5_Project/KD_ZM_8/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/KD_ZM_8/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc b/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc new file mode 100644 index 0000000..fb5868b Binary files /dev/null and b/QT5_Project/KD_ZM_8/__pycache__/UIFrameWork.cpython-311.pyc differ diff --git a/QT5_Project/KD_ZM_8/background/IM00_01B.png b/QT5_Project/KD_ZM_8/background/IM00_01B.png new file mode 100644 index 0000000..7895e62 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM00_01B.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM00_SwitchStatus_0.png b/QT5_Project/KD_ZM_8/background/IM00_SwitchStatus_0.png new file mode 100644 index 0000000..7af2bc2 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM00_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM00_SwitchStatus_1.png b/QT5_Project/KD_ZM_8/background/IM00_SwitchStatus_1.png new file mode 100644 index 0000000..3b8eec3 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM00_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM00_SwitchType_0.png b/QT5_Project/KD_ZM_8/background/IM00_SwitchType_0.png new file mode 100644 index 0000000..6d93e04 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM00_SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM00_SwitchType_1.png b/QT5_Project/KD_ZM_8/background/IM00_SwitchType_1.png new file mode 100644 index 0000000..bc57853 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM00_SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM01_01.png b/QT5_Project/KD_ZM_8/background/IM01_01.png new file mode 100644 index 0000000..ca8ba7b Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM01_01.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM01_0122.png b/QT5_Project/KD_ZM_8/background/IM01_0122.png new file mode 100644 index 0000000..1e0fc04 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM01_0122.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM02_SwitchStatus_0.png b/QT5_Project/KD_ZM_8/background/IM02_SwitchStatus_0.png new file mode 100644 index 0000000..3846172 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM02_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM02_SwitchStatus_1.png b/QT5_Project/KD_ZM_8/background/IM02_SwitchStatus_1.png new file mode 100644 index 0000000..a648e14 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM02_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM02_SwitchType_0.png b/QT5_Project/KD_ZM_8/background/IM02_SwitchType_0.png new file mode 100644 index 0000000..62cb1a4 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM02_SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM02_SwitchType_1.png b/QT5_Project/KD_ZM_8/background/IM02_SwitchType_1.png new file mode 100644 index 0000000..841ccfa Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM02_SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM03_001.png b/QT5_Project/KD_ZM_8/background/IM03_001.png new file mode 100644 index 0000000..164c3b2 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM03_001.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM03_SwitchStatus_0.png b/QT5_Project/KD_ZM_8/background/IM03_SwitchStatus_0.png new file mode 100644 index 0000000..f2796ca Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM03_SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM03_SwitchStatus_1.png b/QT5_Project/KD_ZM_8/background/IM03_SwitchStatus_1.png new file mode 100644 index 0000000..3d469ef Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM03_SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM04_00.png b/QT5_Project/KD_ZM_8/background/IM04_00.png new file mode 100644 index 0000000..8e19fb2 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM04_00.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_001.png b/QT5_Project/KD_ZM_8/background/IM05_001.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_001.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_002.png b/QT5_Project/KD_ZM_8/background/IM05_002.png new file mode 100644 index 0000000..d1c3db6 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_002.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A1.png b/QT5_Project/KD_ZM_8/background/IM05_A1.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A2.png b/QT5_Project/KD_ZM_8/background/IM05_A2.png new file mode 100644 index 0000000..ca50d84 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A2.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A3.png b/QT5_Project/KD_ZM_8/background/IM05_A3.png new file mode 100644 index 0000000..9462fc6 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A3.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A4.png b/QT5_Project/KD_ZM_8/background/IM05_A4.png new file mode 100644 index 0000000..e4d3b74 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A4.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A5.png b/QT5_Project/KD_ZM_8/background/IM05_A5.png new file mode 100644 index 0000000..85544ac Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A5.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A6.png b/QT5_Project/KD_ZM_8/background/IM05_A6.png new file mode 100644 index 0000000..bff0217 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A6.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A7.png b/QT5_Project/KD_ZM_8/background/IM05_A7.png new file mode 100644 index 0000000..a5832fc Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A7.png differ diff --git a/QT5_Project/KD_ZM_8/background/IM05_A8.png b/QT5_Project/KD_ZM_8/background/IM05_A8.png new file mode 100644 index 0000000..d8ab1f4 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IM05_A8.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_00D.png b/QT5_Project/KD_ZM_8/background/IMxx_00D.png new file mode 100644 index 0000000..b47cc71 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_00D.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_00E.png b/QT5_Project/KD_ZM_8/background/IMxx_00E.png new file mode 100644 index 0000000..f00eef7 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_00E.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_00F.png b/QT5_Project/KD_ZM_8/background/IMxx_00F.png new file mode 100644 index 0000000..28446f1 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_00F.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_0.png b/QT5_Project/KD_ZM_8/background/IMxx_A_0.png new file mode 100644 index 0000000..b2d9427 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_1.png b/QT5_Project/KD_ZM_8/background/IMxx_A_1.png new file mode 100644 index 0000000..02ccba6 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_2.png b/QT5_Project/KD_ZM_8/background/IMxx_A_2.png new file mode 100644 index 0000000..b3c036c Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_2.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_3.png b/QT5_Project/KD_ZM_8/background/IMxx_A_3.png new file mode 100644 index 0000000..4de3901 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_3.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_4.png b/QT5_Project/KD_ZM_8/background/IMxx_A_4.png new file mode 100644 index 0000000..7de2f89 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_4.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_5.png b/QT5_Project/KD_ZM_8/background/IMxx_A_5.png new file mode 100644 index 0000000..1c3cd15 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_5.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_6.png b/QT5_Project/KD_ZM_8/background/IMxx_A_6.png new file mode 100644 index 0000000..0f628d3 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_6.png differ diff --git a/QT5_Project/KD_ZM_8/background/IMxx_A_7.png b/QT5_Project/KD_ZM_8/background/IMxx_A_7.png new file mode 100644 index 0000000..003e551 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/IMxx_A_7.png differ diff --git a/QT5_Project/KD_ZM_8/background/P4_ParaSelect.png b/QT5_Project/KD_ZM_8/background/P4_ParaSelect.png new file mode 100644 index 0000000..489633e Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/P4_ParaSelect.png differ diff --git a/QT5_Project/KD_ZM_8/background/P4_ToggleSelect.png b/QT5_Project/KD_ZM_8/background/P4_ToggleSelect.png new file mode 100644 index 0000000..d190adf Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/P4_ToggleSelect.png differ diff --git a/QT5_Project/KD_ZM_8/background/SR_001.png b/QT5_Project/KD_ZM_8/background/SR_001.png new file mode 100644 index 0000000..654c93b Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/SR_001.png differ diff --git a/QT5_Project/KD_ZM_8/background/SwitchStatus_0.png b/QT5_Project/KD_ZM_8/background/SwitchStatus_0.png new file mode 100644 index 0000000..108f3f0 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/SwitchStatus_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/SwitchStatus_1.png b/QT5_Project/KD_ZM_8/background/SwitchStatus_1.png new file mode 100644 index 0000000..25bafe1 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/SwitchStatus_1.png differ diff --git a/QT5_Project/KD_ZM_8/background/SwitchType_0.png b/QT5_Project/KD_ZM_8/background/SwitchType_0.png new file mode 100644 index 0000000..3bf1062 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/SwitchType_0.png differ diff --git a/QT5_Project/KD_ZM_8/background/SwitchType_1.png b/QT5_Project/KD_ZM_8/background/SwitchType_1.png new file mode 100644 index 0000000..700b4f6 Binary files /dev/null and b/QT5_Project/KD_ZM_8/background/SwitchType_1.png differ diff --git a/QT5_Project/KD_ZM_8/image/CameraView.png b/QT5_Project/KD_ZM_8/image/CameraView.png new file mode 100644 index 0000000..9407354 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/CameraView.png differ diff --git a/QT5_Project/KD_ZM_8/image/DataView.png b/QT5_Project/KD_ZM_8/image/DataView.png new file mode 100644 index 0000000..bc1ebd9 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/DataView.png differ diff --git a/QT5_Project/KD_ZM_8/image/DeviceList.png b/QT5_Project/KD_ZM_8/image/DeviceList.png new file mode 100644 index 0000000..89192a8 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/DeviceList.png differ diff --git a/QT5_Project/KD_ZM_8/image/DeviceMenu.png b/QT5_Project/KD_ZM_8/image/DeviceMenu.png new file mode 100644 index 0000000..d537525 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/DeviceMenu.png differ diff --git a/QT5_Project/KD_ZM_8/image/FaultQuery.png b/QT5_Project/KD_ZM_8/image/FaultQuery.png new file mode 100644 index 0000000..a9736fd Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/FaultQuery.png differ diff --git a/QT5_Project/KD_ZM_8/image/FieldTestAction.png b/QT5_Project/KD_ZM_8/image/FieldTestAction.png new file mode 100644 index 0000000..37471f8 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/FieldTestAction.png differ diff --git a/QT5_Project/KD_ZM_8/image/ParamSet.png b/QT5_Project/KD_ZM_8/image/ParamSet.png new file mode 100644 index 0000000..1c40246 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/ParamSet.png differ diff --git a/QT5_Project/KD_ZM_8/image/SwitchAction.png b/QT5_Project/KD_ZM_8/image/SwitchAction.png new file mode 100644 index 0000000..ff445cb Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/SwitchAction.png differ diff --git a/QT5_Project/KD_ZM_8/image/SystemSet.png b/QT5_Project/KD_ZM_8/image/SystemSet.png new file mode 100644 index 0000000..dc91356 Binary files /dev/null and b/QT5_Project/KD_ZM_8/image/SystemSet.png differ diff --git a/QT5_Project/KD_ZM_8/testcamera.py b/QT5_Project/KD_ZM_8/testcamera.py new file mode 100644 index 0000000..f35d833 --- /dev/null +++ b/QT5_Project/KD_ZM_8/testcamera.py @@ -0,0 +1,43 @@ +import sys +import os +from PyQt5.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget +from PyQt5.QtGui import QPixmap, QImage +from PyQt5.QtCore import Qt +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +from print_color import * +class MainWindow(QWidget): + def __init__(self): + super().__init__() + self.initUI() + + def initUI(self): + self.setWindowTitle("Camera Test") + self.setGeometry(100, 100, 800, 600) + + self.label = QLabel(self) + self.label.setAlignment(Qt.AlignCenter) + + layout = QVBoxLayout() + layout.addWidget(self.label) + self.setLayout(layout) + + self.camera_thread = CameraThread("rtsp://192.168.1.205:554") + self.camera_thread.image_signal.connect(self.update_image) + self.camera_thread.start() + + def update_image(self, image): + q_image = QImage(image.data, image.shape[1], image.shape[0], QImage.Format_RGB888) + pixmap = QPixmap.fromImage(q_image) + self.label.setPixmap(pixmap.scaled(self.label.size(), Qt.KeepAspectRatio)) + + def closeEvent(self, event): + self.camera_thread.close() + self.camera_thread.wait() + event.accept() + +if __name__ == "__main__": + app = QApplication(sys.argv) + window = MainWindow() + window.show() + sys.exit(app.exec_()) diff --git a/QT5_Project/Shared_CODE/CameraThread.py b/QT5_Project/Shared_CODE/CameraThread.py new file mode 100644 index 0000000..b54e07e --- /dev/null +++ b/QT5_Project/Shared_CODE/CameraThread.py @@ -0,0 +1,443 @@ +# import sys +# import cv2 +# import os +# import time +# from PyQt5.QtCore import QThread, pyqtSignal, QObject +# import face_recognition + +# current_dir = os.path.dirname(__file__) +# share_code_dir = os.path.abspath(os.path.join(current_dir, '..', '..')) +# sys.path.append(share_code_dir) + +# from print_color import * + +# DEFAULT_VIDEO_SLEEP_MS = 20 + +# # 图像处理线程 +# class ImageProcessingThread(QThread): +# processed_image_signal = pyqtSignal(object) + +# def __init__(self): +# super().__init__() + +# def run(self): +# while True: +# # 在这里添加图像处理代码 +# # 这里暂时只是将图像传递给下一个线程 +# time.sleep(0.01) +# self.processed_image_signal.emit(None) + +# # 摄像头采集线程 +# class CameraThread(QThread): +# image_signal = pyqtSignal(object) + +# def __init__(self, camera_url, circuit_id: int = 0): +# super().__init__() + +# self.camera_url = camera_url # 摄像头url地址, 整数 或者 字符串 +# self.face_detection: bool = False + +# if isinstance(camera_url, int): +# self.camera_url_str = str(camera_url) +# else: +# self.camera_url_str = camera_url + +# self.cap: cv2.VideoCapture = None +# self.running: bool = True + +# self.fps = 0 + +# self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS +# self.cycle_ms = 0 +# self.circuit_id = circuit_id # 摄像头对应的回路, 组合开关每一个回路都有对应的摄像头 +# self.is_signal_connect = False +# self.is_emit = False + +# self.set_video_cycle_ms(2000) + +# def signal_connect(self, slot_func): +# self.image_signal.connect(slot_func) +# self.is_signal_connect = True + +# def signal_disconnect(self): +# # 判断信号是否已连接 +# if self.is_signal_connect: +# self.image_signal.disconnect() +# self.is_signal_connect = False + +# def set_video_cycle_ms(self, cycle_ms: int = 10): +# if self.cycle_limit != cycle_ms: +# if cycle_ms <= DEFAULT_VIDEO_SLEEP_MS: +# self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS +# else: +# self.cycle_limit = cycle_ms + +# # 新建函数,改变函数延时方法 +# def change_camera_url(self, camera_url: str): +# if self.circuit_id == camera_url: +# self.set_video_cycle_ms(DEFAULT_VIDEO_SLEEP_MS) +# else: +# self.set_video_cycle_ms(1000) + +# def close(self): +# if self.cap == None: # 初始化一直未完成 +# self.terminate() +# self.running = False + +# def run(self): +# process_count = 0 +# fps_time = 0 + +# while self.running == True: +# inform_msg = "cameral init start, url = " + self.camera_url_str +# print_inform_msg(inform_msg) + +# try: +# if isinstance(self.camera_url, int): +# # 在 Windows 平台下,使用默认的 cv2.VideoCapture 接口 +# self.cap = cv2.VideoCapture(self.camera_url, cv2.CAP_DSHOW) +# else: +# # 在 Linux 平台下,使用默认的 cv2.VideoCapture 接口 +# self.cap = cv2.VideoCapture(self.camera_url) + +# if self.cap != None: +# inform_msg = "cameral Init Success, url = " + self.camera_url_str +# self.is_emit = True +# print_inform_msg(inform_msg) +# else: +# inform_msg = "cameral connection timeout, url = " + self.camera_url_str +# print_inform_msg(inform_msg) + +# except Exception as e: +# self.cap = None +# inform_msg = "cameral camera Init Fail, url = " + self.camera_url_str +# print_error_msg(inform_msg) + +# base_time = time.time() + +# while self.running and self.cap != None: +# # 延时20ms +# time.sleep(DEFAULT_VIDEO_SLEEP_MS / 1000) +# if self.cycle_ms + DEFAULT_VIDEO_SLEEP_MS < self.cycle_limit: +# self.cycle_ms += DEFAULT_VIDEO_SLEEP_MS +# self.cap.grab() # 抛弃多余的帧,保持最新帧 +# continue +# else: +# self.cycle_ms = 0 + +# try: +# ret, frame = self.cap.read() +# cur_time = time.time() + +# execution_time = cur_time - base_time +# base_time = cur_time +# process_count += 1 + +# fps_time += execution_time + +# if fps_time >= 1: +# self.fps = process_count +# process_count = 0 +# fps_time = 0 + +# if execution_time < 5: +# image_object: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) +# self.image_signal.emit(image_object) +# else: # 时间差大于5秒, 表示网络可能中断过, 退出并重新连接 +# err_message = "cameral read timeout, url = " + self.camera_url_str +# print_error_msg(err_message) +# break +# except Exception as e: +# err_message = "cameral read timeout, url = " + self.camera_url_str +# self.is_emit = False +# print_error_msg(err_message) +# if self.running == True: +# time.sleep(2) +# break + +# print_inform_msg("cameral connection End") +# time.sleep(0.01) + +# if self.cap != None: +# self.cap.release() +# self.cap = None +# - * - coding:utf - 8 - * - +import sys +import cv2 +import os +import time +import subprocess +import face_recognition +import numpy as np +from PIL import Image, ImageDraw, ImageFont +from PyQt5.QtCore import QThread, pyqtSignal, QObject +from print_color import * +current_dir = os.path.dirname(__file__) +share_code_dir = os.path.abspath(os.path.join(current_dir, '..', '..')) +sys.path.append(share_code_dir) + +DEFAULT_VIDEO_SLEEP_MS = 20 + +# 定义路径常量 +npy_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data/face_data.npy')) +image_folder_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data')) +font_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'font/hanzi.ttc')) +def load_face_data(): + face_data = {} + try: + face_data = np.load(npy_file_path, allow_pickle=True).item() + print_debug_msg(f"Loaded {len(face_data)} face encodings from {npy_file_path}.") + except Exception as e: + print_error_msg(f"Error loading face encodings: {e}") + + current_images = [f for f in os.listdir(image_folder_path) if f.endswith('.jpg')] + current_image_set = set(os.path.splitext(f)[0] for f in current_images) + known_image_set = set(face_data.keys()) + + added_images = current_image_set - known_image_set + removed_images = known_image_set - current_image_set + + for image_name in added_images: + image_path = os.path.join(image_folder_path, f"{image_name}.jpg") + try: + image = face_recognition.load_image_file(image_path) + face_encodings = face_recognition.face_encodings(image) + if face_encodings: + face_data[image_name] = face_encodings[0].tolist() + print_debug_msg(f"Added encoding for {image_name}.") + else: + print_warning_msg(f"[WARNING] No face detected in {image_name}.jpg.") + except Exception as e: + print_error_msg(f"[ERROR] Error processing {image_name}.jpg: {e}") + + for removed_image in removed_images: + del face_data[removed_image] + print_debug_msg(f"Removed encoding for {removed_image}.") + + np.save(npy_file_path, face_data) + print_debug_msg(f"Updated face data saved with {len(face_data)} entries.") + return face_data + +class ImageProcessingThread(QThread): + processed_image_signal = pyqtSignal(object) + + def __init__(self, frame=None): + super().__init__() + self.frame = frame # 添加 frame 参数 + self.face_encodings = [] + self.face_names = [] + self.face_locations = [] + self.face_data = load_face_data() + self.total_image_name = list(self.face_data.keys()) + self.total_face_encoding = [np.array(self.face_data[name]) for name in self.total_image_name] + + def process_frame(self, frame): + """实时处理帧,匹配已知人脸""" + self.face_locations = face_recognition.face_locations(frame) + face_encodings = face_recognition.face_encodings(frame, self.face_locations) + names = [] + for face_encoding in face_encodings: + name = "Unknown" + face_distances = face_recognition.face_distance(self.total_face_encoding, face_encoding) + + if face_distances.size > 0: + min_distance = np.min(face_distances) + best_match_index = np.argmin(face_distances) + + if min_distance < self.dynamic_tolerance(): # 使用动态容忍度 + name = self.total_image_name[best_match_index] + + names.append(name) + + self.face_names = names + return frame + + def dynamic_tolerance(self): + # 动态调整容忍度,可以基于一些规则来调整,如帧内错误率、识别准确率等 + error_rate = self.calculate_error_rate() + if error_rate > 0.1: + return 0.5 # 高容忍度以减少错误 + else: + return 0.4 # 适中容忍度 + + def calculate_error_rate(self): + # 计算识别错误率,作为动态调整容忍度的依据 + total_faces = len(self.total_face_encoding) + unmatched_faces = sum(1 for name in self.face_names if name == "Unknown") + return unmatched_faces / total_faces if total_faces > 0 else 0 + + def set_frame(self, frame): + self.frame = frame + + def run(self): + while True: + if self.frame is not None: + self.process_frame(self.frame) + self.processed_image_signal.emit(self.frame) + time.sleep(0.01) # 控制帧率 + + +# 摄像头采集线程 +class CameraThread(QThread): + image_signal = pyqtSignal(object) + + def __init__(self, camera_url, circuit_id: int = 0): + super().__init__() + self.camera_url = camera_url + self.face_detection: bool = True + + if isinstance(camera_url, int): + self.camera_url_str = str(camera_url) + else: + self.camera_url_str = camera_url + + self.cap: cv2.VideoCapture = None + self.running: bool = True + + self.fps = 0 + self.frame_count = 0 + self.fps_time = 0 + + self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS + self.cycle_ms = 0 + self.circuit_id = circuit_id + self.is_signal_connect = False + self.is_emit = False + + self.set_video_cycle_ms(2000) + + def signal_connect(self, slot_func): + self.image_signal.connect(slot_func) + self.is_signal_connect = True + + def signal_disconnect(self): + if self.is_signal_connect: + self.image_signal.disconnect() + self.is_signal_connect = False + + def set_video_cycle_ms(self, cycle_ms: int = 10): + if self.cycle_limit != cycle_ms: + if cycle_ms <= DEFAULT_VIDEO_SLEEP_MS: + self.cycle_limit = DEFAULT_VIDEO_SLEEP_MS + else: + self.cycle_limit = cycle_ms + + def change_camera_url(self, camera_url: str): + if self.circuit_id == camera_url: + self.set_video_cycle_ms(DEFAULT_VIDEO_SLEEP_MS) + else: + self.set_video_cycle_ms(1000) + + def close(self): + if self.cap is None: + self.terminate() + self.running = False + + def run(self): + process_count = 0 + fps_time = 0 + face_thread = ImageProcessingThread() + face_thread.start() + + self.match_count = 0 # 初始化匹配帧数计数器 + + while self.running: + inform_msg = "Camera init start, URL = " + self.camera_url_str + print_inform_msg(inform_msg) + + try: + self.cap = cv2.VideoCapture(self.camera_url) # 强制使用 BGR 格式 + if self.cap.isOpened(): + inform_msg = "Camera Init Success, URL = " + self.camera_url_str + self.is_emit = True + print_inform_msg(inform_msg) + else: + inform_msg = "Camera connection timeout, URL = " + self.camera_url_str + print_error_msg(inform_msg) + + except Exception as e: + self.cap = None + inform_msg = "Camera Init Fail, URL = " + self.camera_url_str + print_error_msg(inform_msg) + + base_time = time.time() + + while self.running and self.cap: + time.sleep(DEFAULT_VIDEO_SLEEP_MS / 1000) + + if self.cycle_ms + DEFAULT_VIDEO_SLEEP_MS < self.cycle_limit: + self.cycle_ms += DEFAULT_VIDEO_SLEEP_MS + self.cap.grab() + continue + else: + self.cycle_ms = 0 + + try: + ret, frame = self.cap.read() + if not ret: + break + + face_thread.set_frame(frame) + + cur_time = time.time() + execution_time = cur_time - base_time + base_time = cur_time + process_count += 1 + + fps_time += execution_time + if fps_time >= 1: # 每隔1秒重新计算 FPS + self.fps = process_count + process_count = 0 + fps_time = 0 + + if execution_time < 5: + frame: QObject = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + for (top, right, bottom, left), name in zip(face_thread.face_locations, face_thread.face_names): + if name != "Unknown": # 只绘制已匹配的结果 + self.match_count += 1 # 计数成功匹配的帧 + # cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2) + # cv2.putText(frame, name, (left + 6, bottom - 6), cv2.FONT_HERSHEY_DUPLEX, 1.0, (255, 255, 255), 1) + + # 将OpenCV图像转换为PIL图像格式(注意要转换色彩空间,OpenCV是BGR,PIL是RGB) + pil_image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) + draw = ImageDraw.Draw(pil_image) + # 这里选择合适的中文字体文件路径,比如系统自带的宋体(不同系统路径可能有差异),并设置字体大小 + font = ImageFont.truetype(font_path, 15) + # 在指定位置绘制中文 + draw.text((left + 12, bottom + 12), name, font=font, fill=(255, 255, 255)) + # 再将PIL图像转换回OpenCV图像格式 + frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) + cv2.rectangle(frame, (left, top), (right, bottom), (0, 255, 0), 2) + else: + name = "未在人脸库中,无操作权限" + pil_image = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) + draw = ImageDraw.Draw(pil_image) + #设置字体大小 + font = ImageFont.truetype(font_path, 15) + # 在指定位置绘制中文 + draw.text((left + 12, bottom + 12), name, font=font, fill=(255, 255, 255)) + # 再将PIL图像转换回OpenCV图像格式 + frame = cv2.cvtColor(np.array(pil_image), cv2.COLOR_RGB2BGR) + cv2.rectangle(frame, (left, top), (right, bottom), (255, 0, 0), 2) + self.image_signal.emit(frame) + else: + err_message = "Camera read timeout, URL = " + self.camera_url_str + print_error_msg(err_message) + break + + except Exception as e: + err_message = "Camera read exception, URL = " + self.camera_url_str + print_error_msg(err_message) + if self.running: + time.sleep(2) + break + + if self.cap: + self.cap.release() + self.cap = None + + print_inform_msg("Camera connection ended") + time.sleep(0.01) + + + diff --git a/QT5_Project/Shared_CODE/DialogInform.py b/QT5_Project/Shared_CODE/DialogInform.py new file mode 100644 index 0000000..ccad38b --- /dev/null +++ b/QT5_Project/Shared_CODE/DialogInform.py @@ -0,0 +1,67 @@ +import sys +import os +from PyQt5.QtWidgets import QApplication, QDialog, QLabel, QLineEdit, QWidget, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject, QTimer + + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Shared_UI')) +ui_file_path = os.path.join(ui_path, "DialogInform.ui") + +class DialogInform(QDialog): + def __init__(self, parent=None): + super(DialogInform, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + label :QLabel = self.label + label.setText("") + label.setWordWrap(True) # 允许文本自动换行 + + + self.message_timer = QTimer() + self.message_timer.timeout.connect(self.close_dialog_timeout) + + self.setWindowTitle("消息提示") + self.setWindowFlag(Qt.FramelessWindowHint) + button_box : QDialogButtonBox = self.buttonBox + ok_button = button_box.button(QDialogButtonBox.Ok) + if ok_button: + ok_button.setText('确定') + else: + button_box.addButton(QDialogButtonBox.Ok) + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + def information(self, title : str, message : str, timeout_ms : int = 2000) : + self.setWindowTitle(title) + label :QLabel = self.label + label.setText(message) + self.message_timer.start(timeout_ms) + self.exec() + + def key_enter_process(self): + button_box : QDialogButtonBox = self.buttonBox + select_button = button_box.button(QDialogButtonBox.Ok) + if select_button: + select_button.click() + + def key_escape_process(self): + button_box : QDialogButtonBox = self.buttonBox + select_button = button_box.button(QDialogButtonBox.Cancel) + if select_button: + select_button.click() + + #消息超时 + def close_dialog_timeout(self): + self.key_enter_process() + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = DialogInform() + dialog.exec() + sys.exit(0) diff --git a/QT5_Project/Shared_CODE/DialogModifyAlias.py b/QT5_Project/Shared_CODE/DialogModifyAlias.py new file mode 100644 index 0000000..e03d1e5 --- /dev/null +++ b/QT5_Project/Shared_CODE/DialogModifyAlias.py @@ -0,0 +1,147 @@ +import sys +import os +from PyQt5.QtWidgets import QApplication, QWidget, QDialog, QLabel, QVBoxLayout, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject +import json +# from print_color import * + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Shared_UI')) +ui_file_path = os.path.join(ui_path, "DialogModifyAlias.ui") + +class DialogModifyAlias(QDialog): + def __init__(self, main_window, parent=None): + super(DialogModifyAlias, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + combo : QComboBox = self.comboBox + + combo.clear() + self.alias_item_dict = {} + self.main_window = main_window + + self.setWindowTitle("别名参数修改") + self.setWindowFlag(Qt.FramelessWindowHint) + self.buttonBox.button(QDialogButtonBox.Ok).setText('确定') + self.buttonBox.button(QDialogButtonBox.Cancel).setText('取消') + self.buttonBox.clicked.connect(self.dialog_button_ok_clicked) + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + home_button = self.findChild(QPushButton, "KEY_HOME") + if home_button: + home_button.clicked.connect(self.key_escape_process) + + end_button = self.findChild(QPushButton, "KEY_END") + if end_button: + end_button.clicked.connect(self.key_enter_process) + + up_button = self.findChild(QPushButton, "KEY_UP") + if up_button: + up_button.clicked.connect(self.key_increase_parameter) + + down_button = self.findChild(QPushButton, "KEY_DOWN") + if down_button: + down_button.clicked.connect(self.key_decrease_parameter) + + def set_caption_name(self, name : str) : + label : QLabel = self.label + label.setText(name) + + def key_increase_parameter(self): + combo : QComboBox = self.comboBox + index = combo.currentIndex() + index += 1 + if index >= combo.count() : + index = 0 + combo.setCurrentIndex(index) + + def key_decrease_parameter(self): + combo : QComboBox = self.comboBox + index = combo.currentIndex() + index -= 1 + if index < 0 : + index = combo.count() - 1 + combo.setCurrentIndex(index) + + def get_alias_key_str(self): + combo : QComboBox = self.comboBox + select_text = combo.currentText() + alias_key = None + for alias_key, alias_str in self.alias_item_dict.items() : + if alias_str == select_text : + return alias_key + return alias_key + + @property + def value(self): + alias_key = self.get_alias_key_str() + return alias_key + + def modify_alias_value(self, modify_str) : + if self.main_window != None : + if hasattr(self.main_window, "func_call_back_on_mqtt_param_modify") : + self.main_window.func_call_back_on_mqtt_param_modify(modify_str) + + def key_enter_process(self): + alias_key = self.get_alias_key_str() + self.modify_alias_value(alias_key) + self.buttonBox.button(QDialogButtonBox.Ok).click() + + def key_escape_process(self): + self.buttonBox.button(QDialogButtonBox.Cancel).click() + + def set_alias_item_info(self, alias_item_dict, key_value, inform_message : str = "系统参数") : + combo : QComboBox = self.comboBox + + self.alias_item_dict = alias_item_dict + combo.clear() + current_index = 0 + select_index = -1 + + self.set_caption_name(inform_message) + + for key, value_str in alias_item_dict.items() : + combo.addItem(value_str) + if key_value == key : + select_index = current_index + current_index += 1 + + if select_index >= 0 : + combo.setCurrentIndex(select_index) + else : + combo.setCurrentText(key_value) + + def dialog_button_ok_clicked(self, button): + if button == self.buttonBox.button(QDialogButtonBox.Ok) : + alias_key = self.get_alias_key_str() + self.modify_alias_value(alias_key) + +if __name__ == '__main__': + app = QApplication(sys.argv) + alias_select = {0 : "380V", 1 : "660V", 2: "1140V", 3 : "3300V"} + json_msg : str = json.dumps(alias_select, ensure_ascii=False) + # print_inform_msg(json_msg) + + alias_2 = {"alias_voltage" : {0 : "380V", 1 : "660V", 2: "1140V", 3 : "3300V"}} + json_msg2 : str = json.dumps(alias_2, ensure_ascii=False) + # print_inform_msg(json_msg2) + + + dialog = DialogModifyAlias(None) + dialog.set_alias_item_info(alias_select, 1) + dialog.show() + result = dialog.exec_() + + # if dialog.result() == QDialog.Accepted: + # print_inform_msg(dialog.get_alias_key_str()) # 输出: Button clicked + + sys.exit(0) diff --git a/QT5_Project/Shared_CODE/DialogModifyText.py b/QT5_Project/Shared_CODE/DialogModifyText.py new file mode 100644 index 0000000..5a5e744 --- /dev/null +++ b/QT5_Project/Shared_CODE/DialogModifyText.py @@ -0,0 +1,155 @@ +import sys +import os +from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit, QLabel, QWidget, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject, QTimer +from Shared_CODE.get_tip_prop import * + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Shared_UI')) +ui_file_path = os.path.join(ui_path, "DialogModifyText.ui") + +def modify_string(string, index, new_char): + string_list = list(string) + string_list[index] = new_char + modified_string = ''.join(string_list) + return modified_string + +def chr_adjust(old_chr, dif : int) : + new_chr = old_chr + if old_chr == '+': + new_chr = '-' + elif old_chr == '-': + new_chr = '+' + elif dif > 0: + new_chr = chr(ord(old_chr) + 1) + if new_chr > '9' : + new_chr = '0' + else : + new_chr = chr(ord(old_chr) - 1) + if new_chr < '0' : + new_chr = '9' + return new_chr + +class DialogModifyText(QDialog): + def __init__(self, main_window, parent=None): + super(DialogModifyText, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + + self.Text = "2019-09-10 10:22:23" + self.select_bit = 0 + self.main_window = main_window + + self.setWindowTitle("参数修改") + self.setWindowFlag(Qt.FramelessWindowHint) + self.buttonBox.button(QDialogButtonBox.Ok).setText(' ') + self.buttonBox.button(QDialogButtonBox.Cancel).setText(' ') + + self.buttonBox.clicked.connect(self.dialog_button_ok_clicked) + + modify_text = self.Text + self.update_modify_info(modify_text, "缺省多字符修改") + + #让定时器周期刷修改字符串, 防止出现焦点切换时选中消失的情况 + self.timer = QTimer(self) + self.timer.timeout.connect(self.timeout_modify_string_refresh) + self.timer.start(100) + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_decrease_parameter) + # QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + # QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + home_button = self.findChild(QPushButton, "KEY_HOME") + if home_button: + home_button.clicked.connect(self.key_escape_process) + + end_button = self.findChild(QPushButton, "KEY_END") + if end_button: + end_button.clicked.connect(self.key_enter_process) + + up_button = self.findChild(QPushButton, "KEY_UP") + if up_button: + up_button.clicked.connect(self.key_increase_parameter) + + down_button = self.findChild(QPushButton, "KEY_DOWN") + if down_button: + down_button.clicked.connect(self.key_decrease_parameter) + + @property + def value(self): + return self.Text + + def timeout_modify_string_refresh(self) : + line_modify : QLineEdit = self.lineEdit + modify_str : str = line_modify.text() + self.update_modify_string(modify_str) + + def update_modify_info(self, modify_str, caption : str) : + if hasattr(self, "label") : + label : QLabel = self.label + label.setText(caption) + self.update_modify_string(modify_str) + + def update_modify_string(self, modify_str : str) : + line_modify : QLineEdit = self.lineEdit + line_modify.setText(modify_str) + + if self.select_bit < len(modify_str) : + if modify_str[self.select_bit] == ' ': + self.key_enter_process() + + # 设置选择从第self.select_bit个字符开始,长度为1 + line_modify.setSelection(self.select_bit, 1) + + def key_increase_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, 1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_decrease_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, -1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + + def key_enter_process(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + + if self.select_bit < len(text) - 1: + self.select_bit += 1 + if not str.isdigit(text[self.select_bit]) : + self.key_enter_process() + else : + self.update_modify_string(text) + else : + self.buttonBox.button(QDialogButtonBox.Ok).click() + + def key_escape_process(self): + self.buttonBox.button(QDialogButtonBox.Cancel).click() + + def dialog_button_ok_clicked(self, button): + if button == self.buttonBox.button(QDialogButtonBox.Ok) : + line_modify : QLineEdit = self.lineEdit + self.Text = line_modify.text() + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = DialogModifyText(None) + dialog.show() + dialog.exec_() + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/Shared_CODE/DialogModifyValue.py b/QT5_Project/Shared_CODE/DialogModifyValue.py new file mode 100644 index 0000000..6f3fc93 --- /dev/null +++ b/QT5_Project/Shared_CODE/DialogModifyValue.py @@ -0,0 +1,175 @@ +import sys +import os +from PyQt5.QtWidgets import QApplication, QDialog, QLineEdit, QLabel, QWidget, QPushButton, QMessageBox, QComboBox, QDialogButtonBox, QShortcut +from PyQt5 import uic +from PyQt5.QtGui import QKeySequence +from PyQt5.QtCore import Qt, QEvent, QObject, QTimer + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))) +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../Shared_UI')) +ui_file_path = os.path.join(ui_path, "DialogModifyValue.ui") + +def modify_string(string, index, new_char): + string_list = list(string) + string_list[index] = new_char + modified_string = ''.join(string_list) + return modified_string + +def chr_adjust(old_chr, dif : int) : + new_chr = old_chr + if old_chr == '+': + new_chr = '-' + elif old_chr == '-': + new_chr = '+' + elif dif > 0: + new_chr = chr(ord(old_chr) + 1) + if new_chr > '9' : + new_chr = '0' + else : + new_chr = chr(ord(old_chr) - 1) + if new_chr < '0' : + new_chr = '9' + return new_chr + + +class DialogModifyValue(QDialog): + def __init__(self, main_window, parent=None): + super(DialogModifyValue, self).__init__(parent) + # Load UI file + uic.loadUi(ui_file_path, self) + + self.value_origin = 1000.3 + self.value_modify = 1000.3 + self.format = "%05.1f" + self.scale = 1.0 + self.offset = 0.0 + self.select_bit = 0 + self.main_window = main_window + + self.setWindowTitle("参数修改") + self.setWindowFlag(Qt.FramelessWindowHint) + ok_button = self.buttonBox.button(QDialogButtonBox.Ok) + if ok_button is None: + pass + else: + ok_button.setText('') + Cancel_button = self.buttonBox.button(QDialogButtonBox.Cancel) + if Cancel_button is None: + pass + else: + Cancel_button.setText('') + + self.buttonBox.clicked.connect(self.dialog_button_ok_clicked) + + modify_value = self.value_origin * self.scale + self.offset + self.update_modify_info(self.format, modify_value, "缺省参数修改", self.offset) + + #让定时器周期刷修改字符串, 防止出现焦点切换时选中消失的情况 + self.timer = QTimer(self) + self.timer.timeout.connect(self.timeout_modify_string_refresh) + self.timer.start(100) + + #定义4个快捷键, Key_Enter, Key_Escape经常被各类程序模块使用, 用Key_End, 与Key_Home来代替 + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + home_button = self.findChild(QPushButton, "KEY_HOME") + if home_button: + home_button.clicked.connect(self.key_escape_process) + + end_button = self.findChild(QPushButton, "KEY_END") + if end_button: + end_button.clicked.connect(self.key_enter_process) + + up_button = self.findChild(QPushButton, "KEY_UP") + if up_button: + up_button.clicked.connect(self.key_increase_parameter) + + down_button = self.findChild(QPushButton, "KEY_DOWN") + if down_button: + down_button.clicked.connect(self.key_decrease_parameter) + @property + def value(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + return text + + def timeout_modify_string_refresh(self) : + line_modify : QLineEdit = self.lineEdit + modify_str : str = line_modify.text() + self.update_modify_string(modify_str) + + def update_modify_info(self, format_str, value, caption : str, offset = 0) : + self.value_origin = value + self.format = format_str + self.offset = offset + if hasattr(self, "label") : + label : QLabel = self.label + label.setText(caption) + if self.format != "" : + modify_str = self.format%(value) + else : + modify_str = str(value) + self.update_modify_string(modify_str) + + def update_modify_string(self, modify_str : str) : + line_modify : QLineEdit = self.lineEdit + line_modify.setText(modify_str) + + if self.select_bit < len(modify_str) : + if modify_str[self.select_bit] == ' ': + self.key_enter_process() + + # 设置选择从第self.select_bit个字符开始,长度为1 + line_modify.setSelection(self.select_bit, 1) + + def key_increase_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, 1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_decrease_parameter(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + if self.select_bit < len(text) : + old_chr = text[self.select_bit] + new_chr = chr_adjust(old_chr, -1) + new_modify_text = modify_string(text, self.select_bit, new_chr) + self.update_modify_string(new_modify_text) + + def key_enter_process(self): + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + + if self.select_bit < len(text) - 1: + self.select_bit += 1 + if not str.isdigit(text[self.select_bit]) : + self.key_enter_process() + else : + self.update_modify_string(text) + else : + self.buttonBox.button(QDialogButtonBox.Ok).click() + + def key_escape_process(self): + self.buttonBox.button(QDialogButtonBox.Cancel).click() + + def dialog_button_ok_clicked(self, button): + if button == self.buttonBox.button(QDialogButtonBox.Ok) : + line_modify : QLineEdit = self.lineEdit + text : str = line_modify.text() + self.value_modify = float(text) + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = DialogModifyValue() + dialog.show() + + sys.exit(dialog.exec_()) diff --git a/QT5_Project/Shared_CODE/__init__.py b/QT5_Project/Shared_CODE/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/Shared_CODE/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc new file mode 100644 index 0000000..84048c1 Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/CameraThread.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc new file mode 100644 index 0000000..892605e Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/DialogInform.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc new file mode 100644 index 0000000..6e81536 Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/DialogModifyAlias.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc new file mode 100644 index 0000000..6c97ba4 Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/DialogModifyText.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc new file mode 100644 index 0000000..f10ee1f Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/DialogModifyValue.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..37a1170 Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/__init__.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc b/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc new file mode 100644 index 0000000..7c7c4bf Binary files /dev/null and b/QT5_Project/Shared_CODE/__pycache__/get_tip_prop.cpython-311.pyc differ diff --git a/QT5_Project/Shared_CODE/face_data/MC.jpg b/QT5_Project/Shared_CODE/face_data/MC.jpg new file mode 100644 index 0000000..cc505a3 Binary files /dev/null and b/QT5_Project/Shared_CODE/face_data/MC.jpg differ diff --git a/QT5_Project/Shared_CODE/face_data/SJX.jpg b/QT5_Project/Shared_CODE/face_data/SJX.jpg new file mode 100644 index 0000000..e011066 Binary files /dev/null and b/QT5_Project/Shared_CODE/face_data/SJX.jpg differ diff --git a/QT5_Project/Shared_CODE/face_data/face_data.npy b/QT5_Project/Shared_CODE/face_data/face_data.npy new file mode 100644 index 0000000..67b52e0 Binary files /dev/null and b/QT5_Project/Shared_CODE/face_data/face_data.npy differ diff --git a/QT5_Project/Shared_CODE/font/hanzi.ttc b/QT5_Project/Shared_CODE/font/hanzi.ttc new file mode 100644 index 0000000..dad6664 Binary files /dev/null and b/QT5_Project/Shared_CODE/font/hanzi.ttc differ diff --git a/QT5_Project/Shared_CODE/get_tip_prop.py b/QT5_Project/Shared_CODE/get_tip_prop.py new file mode 100644 index 0000000..c1501b6 --- /dev/null +++ b/QT5_Project/Shared_CODE/get_tip_prop.py @@ -0,0 +1,219 @@ +from print_color import * +import configparser +import os +import sys + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + +def get_value_from_lead_value_str(lead_value_str : str, lead_str, default_value = None) : + value = default_value + if lead_str in lead_value_str : + value_str = lead_value_str.replace(lead_str, "") + value_str = value_str.replace("=", "") + + try : + value = int(value_str) + except Exception as e : + pass + return value + +def get_tip_value_str(tip_str : str, key_str : str, default_string : str = None) : + value_str = default_string + if len(tip_str) == 0 : + return value_str + + tip_split_strs = tip_str.split(",") + for prop_str in tip_split_strs : + if key_str in prop_str : + prop_split_strs = prop_str.split("=") + full_cmp_str : str = prop_split_strs[0].replace(" ", "") + if len(prop_split_strs) >= 2 and full_cmp_str == key_str: + value_str = prop_split_strs[1] + return value_str + +def get_tip_value(tip_str : str, key_str : str, default_value : int) : + value_str = get_tip_value_str(tip_str, key_str) + value = default_value + try : + value = int(value_str) + except Exception as e : + value = default_value + return value + +def get_tip_visible_mqtt(tip_str : str, default_mqtt : str) : + value_str = get_tip_value_str(tip_str, "Visible", default_string = default_mqtt) + return value_str + +def get_tip_face_detection(tip_str : str) : + return get_tip_value(tip_str, "FaceDetect", default_value = 0) + +def get_tip_frame_box(tip_str : str) : + return get_tip_value(tip_str, "SelectBox", default_value = 0) + +def get_tip_page(tip_str : str) : + return get_tip_value(tip_str, "Page", default_value = -1) + +def get_tip_caption_str(tip_str : str) : + return get_tip_value_str(tip_str, "Caption", default_string = "") + +def get_tip_alias_str(tip_str : str) : + return get_tip_value_str(tip_str, "Alias", default_string = None) + +def get_tip_menu_sub_index(tip_str : str) : + return get_tip_value(tip_str, "Index", default_value = -1) + +def get_tip_timeout(tip_str : str) : + return get_tip_value(tip_str, "Timeout", default_value = -1) + +def get_tip_caption_index(tip_str : str) : + return get_tip_value(tip_str, "CaptionIndex", default_value = -1) + +def get_tip_format(tip_str : str) : + return get_tip_value_str(tip_str, "Format", default_string = "%1.0f") + +def get_tip_circuit(tip_str : str) : + return get_tip_value(tip_str, "circuit", default_value = -1) + +def get_tip_main_index(tip_str : str) : + return get_tip_value(tip_str, "main", default_value = -1) + +def get_tip_binding_circuit(tip_str : str) : + return get_tip_value(tip_str, "bindingcircuit", default_value = -1) + +# def get_tip_group_start(tip_str : str) : +# print_normal_msg(f"Tip String:{tip_str}") +# return get_tip_value(tip_str, "groupstart", default_value = -1) + +# def get_tip_group_end(tip_str : str) : +# print_normal_msg(f"Tip String:{tip_str}") +# return get_tip_value(tip_str, "groupend", default_value = -1) +def get_tip_group_start(tip_str: str): + # 创建一个局部变量来保存传入的参数 tip_str + local_tip_str = tip_str + # 直接返回状态提示信息中的组开始标签数量 + return get_tip_value(local_tip_str, "groupstart", default_value=-1) + +def get_tip_group_end(tip_str: str): + # 创建一个局部变量来保存传入的参数 tip_str + local_tip_str = tip_str + # 直接返回状态提示信息中的组结束标签数量 + return get_tip_value(local_tip_str, "groupend", default_value=-1) + +def get_tip_system(tip_str : str) : + return get_tip_value_str(tip_str, "System", default_string = None) + +def get_tip_password(tip_str : str) : + return get_tip_value_str(tip_str, "Password", default_string = None) + +#获取画布Id和摄像头Id +def get_tip_canvas_id_and_camera_id(tip_str : str) : + canvas_id = -1 + camera_id = -1 + if len(tip_str) == 0 : + return canvas_id, camera_id + + tip_split_strs = tip_str.split(",") + for prop_str in tip_split_strs : + if "canvas" in prop_str and "camera" in prop_str: + prop_split_strs = prop_str.split("=") + if len(prop_split_strs) >= 2 : + canvas_id = get_value_from_lead_value_str(prop_split_strs[0], "canvas", -1) + camera_id = get_value_from_lead_value_str(prop_split_strs[1], "camera", -1) + break + return canvas_id, camera_id + +def get_tip_mqtt_name(tip_str : str) : + mqtt_name = get_tip_value_str(tip_str, "mqtt", default_string = None) + if mqtt_name != None : + return mqtt_name + + prop_split_strs = tip_str.split(",") + if len(prop_split_strs[0]) == 0: + return None + elif "=" not in prop_split_strs[0] : + return prop_split_strs[0] + else : + return None +class system_parameter : + _instance = None + + def __new__(cls): + if cls._instance is None: + cls._instance = super().__new__(cls) + cls._instance.initialize() + + return cls._instance + + def initialize(self): + # 初始化属性,设置默认值 + default_config = { + 'screen_blanking_time': '360', + 'system_password': '2008', + 'language': 'zh_CN' + } + + # 如果配置文件存在,加载配置 + config = configparser.ConfigParser() + if os.path.exists("system_parameter.ini"): + try: + config.read("system_parameter.ini") + system_param = config['SystemParam'] + self.screen_blanking_time = system_param.get('blanking_time', default_config['screen_blanking_time']) + self.system_password = system_param.get('password', default_config['system_password']) + self.language = system_param.get('language', default_config['language']) + except (configparser.Error, KeyError) as e: + # 处理读取配置文件时的错误 + print(f"读取配置错误: {e}。使用默认设置。") + self.apply_defaults(default_config) + else: + self.apply_defaults(default_config) + self.write_to_ini() + + def apply_defaults(self, default_config): + """应用默认设置。""" + self.screen_blanking_time = default_config['screen_blanking_time'] + self.system_password = default_config['system_password'] + self.language = default_config['language'] + + def write_to_ini(self): + """将默认配置写入ini文件。""" + config = configparser.ConfigParser() + config['SystemParam'] = { + 'blanking_time': self.screen_blanking_time, + 'password': self.system_password, + 'language': self.language + } + with open("system_parameter.ini", 'w') as configfile: + config.write(configfile) + + + def change_screen_blanking_time(self, time): + self.screen_blanking_time = time + self.write_to_ini() + + def get_screen_blanking_time(self): + return self.screen_blanking_time + + def set_system_password(self, password): + self.system_password = password + self.write_to_ini() + + def get_system_password(self): + return self.system_password + + def set_system_language(self, language): + self.language = language + self.write_to_ini() + + def get_system_language(self): + return self.language + + # 向文件存储系统信息 + def write_to_ini(self): + system_param = configparser.ConfigParser() + system_param['SystemParam'] = {'language': self.language, + 'blanking_time': self.screen_blanking_time, + 'password': self.system_password} + with open('system_parameter.ini', 'w') as f: + system_param.write(f) + \ No newline at end of file diff --git a/QT5_Project/Shared_CODE/run.py b/QT5_Project/Shared_CODE/run.py new file mode 100644 index 0000000..bc23888 --- /dev/null +++ b/QT5_Project/Shared_CODE/run.py @@ -0,0 +1,199 @@ +# - * - coding:utf - 8 - * - +import os +from flask import Flask, request, jsonify, render_template, url_for, send_from_directory +import numpy as np +import face_recognition +from PIL import Image + +# 初始化 Flask 应用 +app = Flask(__name__) + +# 定义路径常量 +npy_file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data/face_data.npy')) +image_folder_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'face_data')) + +# 加载 face_data 数据 +def load_face_data(): + print(f"加载人脸数据: {npy_file_path}") # 打印加载数据的路径 + if os.path.exists(npy_file_path): + try: + face_data = np.load(npy_file_path, allow_pickle=True).item() + return face_data + except Exception as e: + print(f"加载人脸编码时出错: {e}") + return {} + print("人脸数据文件不存在。") + return {} + +# 保存 face_data 数据 +def save_face_data(face_data): + print(f"保存人脸数据到: {npy_file_path}") # 打印保存数据的路径 + np.save(npy_file_path, face_data) + print("人脸数据保存成功。") + +# 获取图片的 URL +def get_image_url(name): + # 使用 Flask 的自定义路由返回图片 + return url_for('serve_face_image', filename=f'{name}.jpg') + +# 获取图片的绝对路径 +def get_image_path(name): + image_path = os.path.join(image_folder_path, f'{name}.jpg') + return os.path.abspath(image_path) # 返回绝对路径 + +# 比较人脸编码之间的相似度 +def is_same_person(new_encoding, existing_encoding, threshold=0.5): + """ + 判断两个人脸编码是否属于同一个人 + threshold: 距离小于该阈值认为是同一个人 + """ + distance = np.linalg.norm(np.array(new_encoding) - np.array(existing_encoding)) + return distance < threshold + +# 检查上传的图片是否有效 +def check_image_validity(file_path): + try: + img = Image.open(file_path) + img.verify() # 验证图片是否有效 + return True + except (IOError, SyntaxError): + return False + +# 保存图片为标准的 .jpg 格式 +def save_image_as_jpeg(file, file_path): + img = Image.open(file) + img.convert("RGB").save(file_path, "JPEG") + +# 自定义路由来返回图片 +@app.route('/face_image/') +def serve_face_image(filename): + try: + return send_from_directory(image_folder_path, filename) + except Exception as e: + return jsonify({"error": "Image not found"}), 404 + +# 检查并创建 image_folder_path +if not os.path.exists(image_folder_path): + print(f"创建人脸图片文件夹: {image_folder_path}") # 打印创建的文件夹路径 + os.makedirs(image_folder_path) + +# 检查上传的图片是否有效 +def check_image_validity(file_path): + try: + img = Image.open(file_path) + img.verify() # 验证图片是否有效 + print(f"图片 {file_path} 是有效的图像文件。") + except (IOError, SyntaxError) as e: + print(f"无效的图片文件: {file_path}, 错误信息: {e}") + return False + return True + + +@app.route('/') +def index(): + print("访问首页,加载已注册人脸...") + face_data = load_face_data() + faces_and_images = [ + {"name": name, "image": get_image_url(name)} # 使用统一的函数生成路径 + for name in face_data.keys() + if os.path.exists(os.path.join(image_folder_path, f"{name}.jpg")) + ] + print(f"加载的已注册人脸: {faces_and_images}") # 打印加载的所有人脸 + return render_template('index.html', faces_and_images=faces_and_images, error_message=None) + +@app.route('/add_face', methods=['POST']) +def add_face(): + print("接收到添加人脸请求...") + face_data = load_face_data() + if 'file' not in request.files or 'name' not in request.form: + return jsonify({"error": "请求中缺少 'file' 或 'name' 参数。"}), 400 + + file = request.files['file'] + name = request.form['name'] + print(f"上传的人脸名称: {name}, 文件: {file.filename}") + + try: + image = face_recognition.load_image_file(file) + face_encodings = face_recognition.face_encodings(image) + + if not face_encodings: + return jsonify({"error": "上传的图片中没有检测到人脸。"}), 400 + + new_face_encoding = face_encodings[0] + existing_faces = [face_data[stored_name] for stored_name in face_data.keys()] + + # 检查是否有已存在的相似编码 + for existing_encoding in existing_faces: + if is_same_person(new_face_encoding, existing_encoding): + return jsonify({"error": "已有相似的人脸编码,无法添加。"}), 400 + + # 检查是否已有相同名字的图片 + file_path = os.path.join(image_folder_path, f"{name}.jpg") + if os.path.exists(file_path): + return jsonify({"error": f"'{name}' 的图片已经存在。"}), 400 + + # 保存图片为 JPEG 格式 + save_image_as_jpeg(file, file_path) + + # 检查图片是否有效 + if not check_image_validity(file_path): + return jsonify({"error": "上传的图片无效或损坏。"}), 400 + + # 将人脸编码保存 + face_data[name] = new_face_encoding.tolist() + save_face_data(face_data) + + return jsonify({"success": "人脸添加成功。"}), 200 + + except Exception as e: + return jsonify({"error": f"发生错误: {str(e)}"}), 500 + +@app.route('/delete_face', methods=['POST']) +def delete_face(): + print("接收到删除人脸请求...") + face_data = load_face_data() + name = request.form.get('name') + + if not name: + print("缺少 'name' 参数。") + return jsonify({"error": "缺少 'name' 参数。"}), 400 + + if name not in face_data: + print(f"未找到名为 '{name}' 的人脸数据。") + return jsonify({"error": f"未找到名为 '{name}' 的人脸数据。"}), 404 + + try: + # 删除面部数据 + del face_data[name] + save_face_data(face_data) + + # 删除图片 + image_path = os.path.join(image_folder_path, f"{name}.jpg") + if os.path.exists(image_path): + os.remove(image_path) + print(f"成功删除图片: {image_path}") + else: + print(f"未找到图片文件: {image_path}") + + print(f"成功删除人脸: {name}") + return jsonify({"success": f"人脸 '{name}' 删除成功。"}), 200 + + except Exception as e: + print(f"发生错误: {str(e)}") + return jsonify({"error": f"发生错误: {str(e)}"}), 500 + +@app.route('/list_faces', methods=['GET']) +def list_faces(): + print("获取已注册人脸列表...") + face_data = load_face_data() + faces_with_images = [ + {"name": name, "image": get_image_url(name)} # 使用统一的函数生成路径 + for name in face_data.keys() + if os.path.exists(os.path.join(image_folder_path, f'{name}.jpg')) + ] + print(f"已注册人脸列表: {faces_with_images}") # 打印已注册人脸 + return jsonify({"faces": faces_with_images}), 200 + +if __name__ == '__main__': + print("启动 Flask 应用...") + app.run(host='0.0.0.0', port=5000, debug=False) diff --git a/QT5_Project/Shared_CODE/templates/index.html b/QT5_Project/Shared_CODE/templates/index.html new file mode 100644 index 0000000..d51cc34 --- /dev/null +++ b/QT5_Project/Shared_CODE/templates/index.html @@ -0,0 +1,291 @@ + + + + + + 人脸识别应用 + + + + +

人脸识别应用

+ +

已注册的人脸:

+ + +
+ +
+ + +
+ + +
+ + + +
+ + + + + diff --git a/QT5_Project/Shared_UI/DialogInform.ui b/QT5_Project/Shared_UI/DialogInform.ui new file mode 100644 index 0000000..8da125d --- /dev/null +++ b/QT5_Project/Shared_UI/DialogInform.ui @@ -0,0 +1,123 @@ + + + DialogInform + + + + 0 + 0 + 587 + 290 + + + + Dialog + + + false + + + border:none; +background-color: rgba(0, 0, 0, 0); + + + + + 110 + 160 + 381 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::NoButton + + + + + + 75 + 97 + 411 + 51 + + + + + Microsoft YaHei UI + 16 + false + false + + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 0); +font: 16pt "Microsoft YaHei UI"; + + + TextLabel + + + Qt::AlignCenter + + + + + + 0 + 0 + 731 + 291 + + + + + + + img/infrom.png + + + BG + buttonBox + label + + + + + buttonBox + accepted() + DialogInform + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogInform + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/Shared_UI/DialogModifyAlias.ui b/QT5_Project/Shared_UI/DialogModifyAlias.ui new file mode 100644 index 0000000..b46a808 --- /dev/null +++ b/QT5_Project/Shared_UI/DialogModifyAlias.ui @@ -0,0 +1,148 @@ + + + DialogModifyAlias + + + Qt::ApplicationModal + + + + 0 + 0 + 587 + 290 + + + + Qt::DefaultContextMenu + + + Dialog + + + + + 190 + 180 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 259 + 97 + 241 + 51 + + + + + 16 + + + + color: rgb(255, 170, 0); +background: transparent + + + + + + 100 + 102 + 151 + 41 + + + + + 16 + + + + color: rgb(255, 170, 0); + + + 别名参数 + + + Qt::AlignCenter + + + true + + + + + + 0 + 0 + 587 + 291 + + + + + 12 + + + + + + + img/BG09_002.png + + + true + + + buttonBox + BG + comboBox + label + + + + + buttonBox + accepted() + DialogModifyAlias + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogModifyAlias + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/Shared_UI/DialogModifyText.ui b/QT5_Project/Shared_UI/DialogModifyText.ui new file mode 100644 index 0000000..f857edc --- /dev/null +++ b/QT5_Project/Shared_UI/DialogModifyText.ui @@ -0,0 +1,168 @@ + + + DialogModifyText + + + + 0 + 0 + 587 + 290 + + + + Dialog + + + + true + + + + 200 + 60 + 341 + 32 + + + + + false + PreferDefault + + + + background: transparent + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 260 + 100 + 292 + 41 + + + + + 16 + ExtraBold + + + + Qt::NoFocus + + + color: rgb(255, 170, 0); +background: transparent + + + 2024-05-24 + + + false + + + QLineEdit::Normal + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 105 + 100 + 151 + 51 + + + + + 16 + false + + + + color: rgb(255, 170, 0); + + + 参数名称 + + + true + + + + + + 0 + 0 + 587 + 291 + + + + + 12 + + + + + + + img/BG09_002.png + + + true + + + BG + buttonBox + label + lineEdit + + + + + buttonBox + rejected() + DialogModifyText + reject() + + + 316 + 260 + + + 286 + 274 + + + + + buttonBox + accepted() + DialogModifyText + accept() + + + 248 + 254 + + + 157 + 274 + + + + + diff --git a/QT5_Project/Shared_UI/DialogModifyValue.ui b/QT5_Project/Shared_UI/DialogModifyValue.ui new file mode 100644 index 0000000..6666bff --- /dev/null +++ b/QT5_Project/Shared_UI/DialogModifyValue.ui @@ -0,0 +1,160 @@ + + + DialogModifyValue + + + + 0 + 0 + 587 + 290 + + + + Dialog + + + border:none; +background-color: rgba(0, 0, 0, 0); + + + + + 220 + 60 + 341 + 32 + + + + Qt::CustomContextMenu + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 240 + 100 + 221 + 41 + + + + + 16 + + + + Qt::NoFocus + + + color: rgb(255, 170, 0); + + + 000.0 + + + Qt::AlignCenter + + + + + + 60 + 100 + 151 + 41 + + + + + 16 + + + + color: rgb(255, 170, 0); + + + 参数名称 + + + Qt::AlignCenter + + + true + + + + + + 0 + 0 + 587 + 291 + + + + + 12 + + + + + + + img/BG09_002.png + + + true + + + BG + buttonBox + lineEdit + label + + + + + buttonBox + accepted() + DialogModifyValue + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogModifyValue + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/QT5_Project/Shared_UI/img/BG09_002.png b/QT5_Project/Shared_UI/img/BG09_002.png new file mode 100644 index 0000000..144472f Binary files /dev/null and b/QT5_Project/Shared_UI/img/BG09_002.png differ diff --git a/QT5_Project/Shared_UI/img/BG09_003.png b/QT5_Project/Shared_UI/img/BG09_003.png new file mode 100644 index 0000000..7be30e1 Binary files /dev/null and b/QT5_Project/Shared_UI/img/BG09_003.png differ diff --git a/QT5_Project/Shared_UI/img/BG09_004.png b/QT5_Project/Shared_UI/img/BG09_004.png new file mode 100644 index 0000000..c945600 Binary files /dev/null and b/QT5_Project/Shared_UI/img/BG09_004.png differ diff --git a/QT5_Project/Shared_UI/img/BackUp/BG09_002.png b/QT5_Project/Shared_UI/img/BackUp/BG09_002.png new file mode 100644 index 0000000..c9b9d6a Binary files /dev/null and b/QT5_Project/Shared_UI/img/BackUp/BG09_002.png differ diff --git a/QT5_Project/Shared_UI/img/BackUp/BG09_003.png b/QT5_Project/Shared_UI/img/BackUp/BG09_003.png new file mode 100644 index 0000000..f5b43d4 Binary files /dev/null and b/QT5_Project/Shared_UI/img/BackUp/BG09_003.png differ diff --git a/QT5_Project/Shared_UI/img/BackUp/BG09_004.png b/QT5_Project/Shared_UI/img/BackUp/BG09_004.png new file mode 100644 index 0000000..078efcc Binary files /dev/null and b/QT5_Project/Shared_UI/img/BackUp/BG09_004.png differ diff --git a/QT5_Project/Shared_UI/img/infrom.png b/QT5_Project/Shared_UI/img/infrom.png new file mode 100644 index 0000000..ef9e2b2 Binary files /dev/null and b/QT5_Project/Shared_UI/img/infrom.png differ diff --git a/QT5_Project/TestProject/APPWindow.py b/QT5_Project/TestProject/APPWindow.py new file mode 100644 index 0000000..819fb21 --- /dev/null +++ b/QT5_Project/TestProject/APPWindow.py @@ -0,0 +1,762 @@ +# This Python file uses the following encoding: utf-8 +import sys +import time +from PyQt5.QtWidgets import QWidget, QLineEdit +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QWidget, QLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +from PyQt5 import uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent +from PyQt5.QtGui import QImage, QPixmap, QColor, QKeySequence +from UIFrameWork import UIFrameWork +from UIFrameWork import * +# 添加当前脚本的父级目录到 sys.path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget +from PyQt5.QtWidgets import QDesktopWidget + +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from print_color import * +from Shared_CODE.get_tip_prop import * + + +# 设置 UI 目录的路径 +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'UI')) + + +# 页面文件,动态构建 UI 文件的路径 +uiFile_P00DeviceList = os.path.join(ui_path, "P00DeviceList.ui") +uiFile_P01DeviceMenu = os.path.join(ui_path, "P01DeviceMenu.ui") +uiFile_P02DataView = os.path.join(ui_path, "P02DataView.ui") +uiFile_P03SwitchAction = os.path.join(ui_path, "P03SwitchAction.ui") +uiFile_P04ParamSet = os.path.join(ui_path, "P04ParamSet.ui") +uiFile_P05CameraView = os.path.join(ui_path, "P05CameraView.ui") +uiFile_P06FaultQuery = os.path.join(ui_path, "P06FaultQuery.ui") +uiFile_P07SystemSet = os.path.join(ui_path, "P07SystemSet.ui") +uiFile_P08FieldTestAction = os.path.join(ui_path, "P08FieldTestAction.ui") +uiFile_P11LightDeviceMenu = os.path.join(ui_path, "P11LightDeviceMenu.ui") +uiFile_P12LightDataView = os.path.join(ui_path, "P12LightDataView.ui") +uiFile_P13LightSwitchAction = os.path.join(ui_path, "P13LightSwitchAction.ui") +uiFile_P14LightParamSet = os.path.join(ui_path, "P14LightParamSet.ui") +uiFile_P16LightFaultQuery = os.path.join(ui_path, "P16LightFaultQuery.ui") +uiFile_P17LightSystemSet = os.path.join(ui_path, "P17LightSystemSet.ui") +uiFile_P18LightFieldTestAction = os.path.join(ui_path, "P18LightFieldTestAction.ui") + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#ECECEC").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() + +COLOR_VALUE_NORMAL_YELLOW = QColor("#F8C822").name() +COLOR_VALUE_NORMAL_BLUE = QColor("#4E76D4").name() +COLOR_VALUE_NORMAL_READ = QColor("#CE5D62").name() +COLOR_VALUE_NORMAL_GREEN = QColor("#83BF6E").name() + + + +def get_camera_id_and_canvas_id(action : str) : + camera_id = -1 + canvas_id = -1 + if "canvas" in action and "camera" in action : + action_splits = action.split("_") + for action_split_str in action_splits: + if "camera" in action_split_str: + camera_id = get_value_from_lead_value_str(action_split_str, "camera", -1) + elif "canvas" in action_split_str: + canvas_id = get_value_from_lead_value_str(action_split_str, "canvas", -1) + return camera_id, canvas_id + + +#根据回路选择摄像头url地址 +def search_camera_url(camera_id : int) : + cameral_url = None + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_camera_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_camera_id == camera_id : + cameral_url = utils.dict_or_object_get_attr(item_dict, "camera_url", None) + if cameral_url != None : + return cameral_url + return cameral_url + +menu_page_widget_list = [] + +class PageTemplate(UIFrameWork): # 页面模板类,包含各子页面公用功能 + def __init__(self, parent_window): + UIFrameWork.__init__(self) + self.parent_window : APPWindow = parent_window + + def connect_matched_camera_canvas(self) : + page_widget : UIFrameWork = self.parent_window.stack.currentWidget() + if page_widget != None : + for canvas_id in range(9) : + camera_id , face_detect = page_widget.get_canvas_prop(canvas_id) + if camera_id >= 0 : + self.parent_window.connect_camera_to_canvas(page_widget, camera_id, canvas_id, face_detect) + + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.parent_window.camera_thread_list) : + face_detect = 0 + canvas_object = self.search_canvas_object(canvas_id) + if canvas_object != None : + face_detect = get_tip_face_detection(canvas_object.statusTip()) + + camera_thread : CameraThread = self.parent_window.camera_thread_list[camera_id] + if camera_thread != None : + if not camera_thread.is_emit and is_visible: + self.show_camera_error(camera_id) + + if camera_thread.is_emit: + self.connect_camera_thread(camera_thread, canvas_id, is_visible) + self.parent_window.camera_signal.emit(camera_id) + camera_thread.face_detection = face_detect + + if hasattr(self, "CameraChioceLabel") : + # self.CameraChioceLabel.setStyleSheet("color: rgb(255, 255, 255); font-size: 50px;") + self.CameraChioceLabel.setText("回路" + str(camera_id+1)) + else: + self.show_camera_error(camera_id) + + def show_camera_error(self, camera_id) : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", f"视频流{camera_id+1}无法初始化或失去连接!") + + #定义虚函数, 进入页面时调用 + def virtual_on_page_enter(self) : + pass + + #定义虚函数, 退出页面时调用 + def virtual_on_page_leave(self) : + pass + + #重载虚函数, 切换页面时调用 + def virtual_change_to_page(self, page) : + if self.parent_window == None : + return + + self_page_widget : PageTemplate = self.parent_window.stack.currentWidget() + if self_page_widget == None : + return + + target_page_widget : PageTemplate = None + + if page >= 0 : + target_page_widget = self.parent_window.search_page_widget(page) + if target_page_widget in menu_page_widget_list: + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == None or pop_page_widget == target_page_widget: + break + else : + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == self : + continue + else : + target_page_widget = pop_page_widget + break + + if target_page_widget == None : + target_page_widget = self.parent_window.allpages_list[0] + + if target_page_widget != None : + menu_page_widget_list.append(target_page_widget) + self_page_widget.virtual_on_page_leave() + self.parent_window.stack.setCurrentWidget(target_page_widget) + target_page_widget.virtual_on_page_enter() + self.connect_matched_camera_canvas() + + def virtual_widget_action_process(self, widget : QWidget, action : str) : + action_splits = action.split("+") + page_id = -1 + circuit_id = -1 + main_index = -1 + add_circuit = -1 + binding_circuit = -1 + for action_split_str in action_splits : + if "SetPage" in action_split_str : + page_id = get_value_from_lead_value_str(action_split_str, "SetPage", -1) + elif "SetCircuit" in action_split_str : + circuit_id = get_value_from_lead_value_str(action_split_str, "SetCircuit", -1) + elif "SetMain" in action_split_str: + main_index = get_value_from_lead_value_str(action_split_str, "SetMain", -1) + elif "AddCircuit" in action_split_str : + add_circuit = get_value_from_lead_value_str(action_split_str, "AddCircuit", -1) + elif "SetBinding" in action_split_str : + binding_circuit = get_value_from_lead_value_str(action_split_str, "SetBinding", 1) + + + print("@Line:",inspect.currentframe().f_lineno,' = ',circuit_id,' = ',action_splits) + + if add_circuit >= 0 : + tip_str : str = page_widget.statusTip() + circuit_id = get_tip_circuit(tip_str) + circuit_id = circuit_id + 1 + + if binding_circuit > 0 : + circuit_id = self.get_circuit_from_object(widget) + + target_page_widget = self.parent_window.search_page_widget(page_id) + page_widget : PageTemplate = target_page_widget + + if page_id >= 0 : # 功能标记:执行页面跳转功能 + target_page_widget = self.parent_window.search_page_widget(page_id) + + if target_page_widget != None : + if circuit_id >= 0 : + target_page_widget.set_page_circuit(circuit_id) + self.virtual_change_to_page(page_id) + + if main_index >= 0 : # 功能标记:执行控件主索引设定 + self.set_menu_main_index(main_index) # 设置页面主索引字段
,可以跨组选择控件 + + if circuit_id >= 0 : + indicator : QLineEdit = target_page_widget.findChild(QLineEdit,"BindNum_Title") + indicator.setText("当前回路为 %d"%(circuit_id + 1)) + + # 显示提示图标 + indicator_Label : QLabel = target_page_widget.findChild(QLabel,"indicator_Label") + tip_str : str = indicator_Label.statusTip() + imag_file_name = get_imag_value_file_name(tip_str, circuit_id) + if imag_file_name != None : + self.modify_object_style_sheet(indicator_Label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(indicator_Label) + + camera_id, canvas_id = get_camera_id_and_canvas_id(action) + self.virtual_connect_canvas_to_camera(canvas_id, camera_id) + +#P00设备列表页面 +class QDeviceListPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P00DeviceList) + + # 回路1测试:开关合闸1,总开关0,无报警 + json_dict0 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"无故障","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1143", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"60", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"20", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路2测试:开关合闸1,分开关1,无报警 + json_dict1 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"开关未到位","type" : "alarm","color" : COLOR_ALARM_ERROR_TEXT}, + "Voltage" : {"value" :"1120", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"45", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"46321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路3测试:开关合闸1,总开关0,无报警 + json_dict2 = { "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1065", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"30", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"16", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"1321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路4测试:开关合闸1,总开关0,无报警 + json_dict3 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1141", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"32321", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路5测试:开关合闸1,总开关0,无报警 + json_dict4 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"2133", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"26", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"4453", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路6测试:开关合闸1,总开关0,无报警 + json_dict5 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1212", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"27", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"11212", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # 回路7测试:开关合闸1,总开关0,无报警 + json_dict6 = { "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "SwitchType" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}, + "AlarmMessage" : {"value" :"正常运行,无告警信息","type" : "alarm", "color" : COLOR_ALARM_NORMAL}, + "Voltage" : {"value" :"1564", "color" : COLOR_VALUE_NORMAL_YELLOW}, + "Current" : {"value" :"61", "color" : COLOR_VALUE_NORMAL_READ}, + "Power" : {"value" :"32", "color" : COLOR_VALUE_NORMAL_BLUE}, + "Electricity" : {"value" :"45341", "color" : COLOR_VALUE_NORMAL_GREEN}, + } + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + # self.flush_widgets(3, json_dict3) + # # self.flush_widgets(4, json_dict4) + # # self.flush_widgets(5, json_dict5) + # # self.flush_widgets(6, json_dict6) + +#P01设备列表页面 +class QDeviceMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P01DeviceMenu) + +#P02数据查看页面 +class QDataViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P02DataView) + + json_dict0 = {"Uab" :"1111", "Ubc" : "1111", "Uca" : "1111", "Uo" : "11" , "Iab" : "1111", "Ibc" : "1111", "Ica" : "1111", "Io" : "1111"} + json_dict1 = {"Uab" :"2222", "Ubc" : "2222", "Uca" : "2222", "Uo" : "22" , "Iab" : "2222", "Ibc" : "2222", "Ica" : "2222", "Io" : "2222"} + json_dict2 = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P03开关操作页面 +class QSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P03SwitchAction) + + json_dict0 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict1 = {"SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + json_dict2 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +#P04参数设置页面 +class QParamSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P04ParamSet) + + json_dict0 = {"Uab" :"1000", "Ubc" : "5", "Uca" : "50"} + json_dict1 = {"Uab" :"1111", "Ubc" : "111", "Uca" : "111"} + json_dict2 = {"Uab" :"2222", "Ubc" : "222", "Uca" : "222"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + +#P05视频查看页面 QFaultQueryPage +class QCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P05CameraView) + + def virtual_on_page_enter(self) : + self.parent_window.camera_signal.emit(0) + +#P06故障查询页面 QFaultQueryPage +class QFaultQueryPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P06FaultQuery) + self.alarm_index = 0 + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +#P07系统参数设置页面 +class QSystemSetPage(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P07SystemSet) + +#P08现场试验页面 +class QFieldTestAction(PageTemplate): + def __init__(self, parent_window): + + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P08FieldTestAction) + +# P11照明菜单选择 +class QLightMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P11LightDeviceMenu) + +# P12照明运行数据页面 +class QRunDataPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P12LightDataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P13照明开关操作页面 +class QLightSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P13LightSwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P14照明参数设置页面 +class QLightParamSetPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P14LightParamSet) + +# P16照明故障查询 +class QLightFaultQuery(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P16LightFaultQuery) + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +# P17照明系统参数 +class QLightSystemSet(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P17LightSystemSet) + +# P18现场试验页面 +class QLightFieldTestAction(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P18LightFieldTestAction) + +class APPWindow(QMainWindow): + camera_signal = pyqtSignal(int) + def __init__(self): + super().__init__() + + # 获取屏幕分辨率 + screen = QDesktopWidget().screenGeometry() + screen_width = screen.width() + screen_height = screen.height() + + self.stack = QStackedWidget(self) + self.setGeometry(0, 0, screen_width, screen_height) # 设置窗口大小为屏幕分辨率 + self.stack.setGeometry(0, 0, screen_width, screen_height) # 设置堆叠窗口大小为屏幕分辨率 + + #调试的时候用下面两行,全屏就注释 + # self.setGeometry(0, 0, 1024, 768) + # self.stack.setGeometry(0, 0, 1024, 768) + + + + self.showFullScreen() + + self.menu_sequence_list : PageTemplate = [] + self.camera_thread_list : CameraThread = [None, None, None, None, None, None, None, None, None] + self.allpages_list : PageTemplate = [] + + self.P00_DeviceList : PageTemplate = QDeviceListPage(parent_window = self) + self.P01_DeviceMenu : PageTemplate = QDeviceMenuPage(parent_window = self) + self.P02_DataView : PageTemplate = QDataViewPage(parent_window = self) + self.P03_SwitchAction : PageTemplate = QSwitchActionPage(parent_window = self) + self.P04_ParamSet : PageTemplate = QParamSetPage(parent_window = self) + self.P05_CameraView : PageTemplate = QCameraViewPage(parent_window = self) + self.P06_FaultQuery : PageTemplate = QFaultQueryPage(parent_window = self) + self.P07_SystemSet : PageTemplate = QSystemSetPage(parent_window = self) + self.P08_FieldTestAction : PageTemplate = QFieldTestAction(parent_window = self) + self.P11_DeviceMenu : PageTemplate = QLightMenuPage(parent_window = self) + self.P12_DateView : PageTemplate = QRunDataPage(parent_window = self) + self.P13_SwitchAction : PageTemplate = QLightSwitchActionPage(parent_window = self) + self.P14_ParamSet : PageTemplate = QLightParamSetPage(parent_window = self) + self.P16_LightFaultQuery : PageTemplate = QLightFaultQuery(parent_window = self) + self.P17_LightSystemSet : PageTemplate = QLightSystemSet(parent_window = self) + self.P18_LightFieldTestAction : PageTemplate = QLightFieldTestAction(parent_window = self) + + self.allpages_list.append(self.P00_DeviceList) + self.allpages_list.append(self.P01_DeviceMenu) + self.allpages_list.append(self.P02_DataView) + self.allpages_list.append(self.P03_SwitchAction) + self.allpages_list.append(self.P04_ParamSet) + self.allpages_list.append(self.P05_CameraView) + self.allpages_list.append(self.P06_FaultQuery) + self.allpages_list.append(self.P07_SystemSet) + self.allpages_list.append(self.P08_FieldTestAction) + self.allpages_list.append(self.P11_DeviceMenu) + self.allpages_list.append(self.P12_DateView) + self.allpages_list.append(self.P13_SwitchAction) + self.allpages_list.append(self.P14_ParamSet) + self.allpages_list.append(self.P16_LightFaultQuery) + self.allpages_list.append(self.P17_LightSystemSet) + self.allpages_list.append(self.P18_LightFieldTestAction) + + self.stack.addWidget(self.P00_DeviceList) + self.stack.addWidget(self.P01_DeviceMenu) + self.stack.addWidget(self.P02_DataView) + self.stack.addWidget(self.P03_SwitchAction) + self.stack.addWidget(self.P04_ParamSet) + self.stack.addWidget(self.P05_CameraView) + self.stack.addWidget(self.P06_FaultQuery) + self.stack.addWidget(self.P07_SystemSet) + self.stack.addWidget(self.P08_FieldTestAction) + self.stack.addWidget(self.P11_DeviceMenu) + self.stack.addWidget(self.P12_DateView) + self.stack.addWidget(self.P13_SwitchAction) + self.stack.addWidget(self.P14_ParamSet) + self.stack.addWidget(self.P16_LightFaultQuery) + self.stack.addWidget(self.P17_LightSystemSet) + self.stack.addWidget(self.P18_LightFieldTestAction) + + test_init = system_parameter() + set_screen_blanking_time(test_init.get_screen_blanking_time()) + + + def search_page_widget(self, page) : + for list_item in self.allpages_list: + window_page : UIFrameWork = list_item + if window_page.page == page : + return window_page + return None + + def connect_camera_to_canvas(self, page_widget : UIFrameWork, camera_id: int , canvas_id : int, face_detect : int = 0) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.camera_thread_list) : + camera_thread : CameraThread = self.camera_thread_list[camera_id] + if camera_thread != None : + page_widget.connect_camera_thread(camera_thread, canvas_id) + camera_thread.face_detection = face_detect + + def create_all_camera_thread(self) : + for camera_id in range(len(self.camera_thread_list)) : + _camera_url = search_camera_url(camera_id) + if _camera_url != None : + camera_thread = CameraThread(_camera_url, camera_id) + camera_thread.set_video_cycle_ms(10) + self.camera_thread_list[camera_id] = camera_thread + self.camera_signal.connect(camera_thread.change_camera_url) + + #摄像头与 界面进行绑定 + for index in range(self.stack.count()) : + page_widget : UIFrameWork = self.stack.widget(index) + page_widget.connect_matched_camera_canvas() + + time.sleep(0.1) + + #开启多个摄像头线程 + for camera_thread in self.camera_thread_list: + thread_to_start : CameraThread = camera_thread + if thread_to_start != None : + thread_to_start.start() + time.sleep(0.01) + + # def focus_do_inscrease(self) : + # self.stack.currentWidget().key_decrease_parameter() + + # def focus_do_decrease(self) : + # self.stack.currentWidget().key_increase_parameter() + + # def focus_do_action(self) : + # self.stack.currentWidget().key_enter_process() + + # def focus_do_escape(self) : + # self.stack.currentWidget().key_escape_process() + + # def focus_show_hide(self) : + # if self.float_button1.isHidden() : + # self.float_button1.show() + # self.float_button2.show() + # self.float_button3.show() + # self.float_button4.show() + # else : + # self.float_button1.hide() + # self.float_button2.hide() + # self.float_button3.hide() + # self.float_button4.hide() + + def get_page_currentwidget(self) : + return self.stack.currentWidget().sort_menu_list[self.stack.currentWidget().menu_key_index][1] + + def closeEvent(self, event): + # 在这里处理关闭事件 + # 例如,提示用户是否真的想要关闭 + reply = QMessageBox.question(self, '确认', '确定要退出吗?', + QMessageBox.Yes | QMessageBox.No) + if reply == QMessageBox.Yes: + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.close() + + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.wait() + + event.accept() # 接受关闭事件 + else: + event.ignore() # 忽略关闭事件 + + +if __name__ == '__main__': + #创建mqtt线程 + fvalue = float('06.00') + value = round(fvalue) + + _user_name = utils.dict_or_object_get_attr(group_config.mqtt_server, "user_name", "admin") + _password = utils.dict_or_object_get_attr(group_config.mqtt_server, "password", "admin") + _server = utils.dict_or_object_get_attr(group_config.mqtt_server, "remote", "127.0.0.1") + _port = utils.dict_or_object_get_attr(group_config.mqtt_server, "port", 1883) + + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = _server, port = _port, keep_alive = 60, user_name=_user_name, password=_password) + + app = QApplication([]) + app_main_window = APPWindow() + app_main_window.show() + app_main_window.create_all_camera_thread() + + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name != None : + global_mqtt_thread.add_unique_object(circuit_unique_name, app_main_window.allpages_list) + + global_mqtt_thread.start() + app.exec_() + global_mqtt_thread.close() + global_mqtt_thread.join() + + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/TestProject/Light_image/Light_CameraView.png b/QT5_Project/TestProject/Light_image/Light_CameraView.png new file mode 100644 index 0000000..66b618a Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Light_CameraView.png differ diff --git a/QT5_Project/TestProject/Light_image/Light_DataView.png b/QT5_Project/TestProject/Light_image/Light_DataView.png new file mode 100644 index 0000000..c96693d Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Light_DataView.png differ diff --git a/QT5_Project/TestProject/Light_image/Light_DeviceMenu.png b/QT5_Project/TestProject/Light_image/Light_DeviceMenu.png new file mode 100644 index 0000000..d287ba9 Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Light_DeviceMenu.png differ diff --git a/QT5_Project/TestProject/Light_image/Light_FieldTestAction.png b/QT5_Project/TestProject/Light_image/Light_FieldTestAction.png new file mode 100644 index 0000000..a7108d5 Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Light_FieldTestAction.png differ diff --git a/QT5_Project/TestProject/Light_image/Light_ParamSet.png b/QT5_Project/TestProject/Light_image/Light_ParamSet.png new file mode 100644 index 0000000..6768524 Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Light_ParamSet.png differ diff --git a/QT5_Project/TestProject/Light_image/Light_SystemSet.png b/QT5_Project/TestProject/Light_image/Light_SystemSet.png new file mode 100644 index 0000000..9b26d6b Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Light_SystemSet.png differ diff --git a/QT5_Project/TestProject/Light_image/Ligth_FaultQuery.png b/QT5_Project/TestProject/Light_image/Ligth_FaultQuery.png new file mode 100644 index 0000000..f983d51 Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Ligth_FaultQuery.png differ diff --git a/QT5_Project/TestProject/Light_image/Ligth_SwitchAction.png b/QT5_Project/TestProject/Light_image/Ligth_SwitchAction.png new file mode 100644 index 0000000..4693c9f Binary files /dev/null and b/QT5_Project/TestProject/Light_image/Ligth_SwitchAction.png differ diff --git a/QT5_Project/TestProject/UI/P00DeviceList.ui b/QT5_Project/TestProject/UI/P00DeviceList.ui new file mode 100644 index 0000000..afe161f --- /dev/null +++ b/QT5_Project/TestProject/UI/P00DeviceList.ui @@ -0,0 +1,3421 @@ + + + P00DeviceList + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=0 + + + + + + 0 + -1 + 1920 + 1080 + + + + + + + ../image/DeviceList.png + + + + + + 91 + 97 + 450 + 481 + + + + + + + circuit=0, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=0, Action=SetPage1+SetCircuit0+SetBinding0,SelectImag=IM00_01B.png + + + + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas0=camera0 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper + m01_SwitchStatus_0 + m02_SwitchType_0 + m03_AlarmMessage_0 + m04_Voltage + m05_Power + m06_Current + m07_Electricity + Ls01 + Ls01_2 + Ls01_3 + Ls01_4 + m03_CarMessage_7 + Video0 + + + + + 546 + 97 + 450 + 481 + + + + + + + circuit=1, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=1, Action=SetPage1+SetCircuit1+SetBinding1,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas1=camera1 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_2 + m01_SwitchStatus_1 + m02_SwitchType_1 + m03_AlarmMessage_1 + m04_Voltage_2 + m05_Power_2 + m06_Current_2 + m07_Electricity_2 + Ls01_5 + Ls01_6 + Ls01_7 + Ls01_8 + m03_CarMessage_8 + Video0_1 + + + + + 1001 + 97 + 450 + 481 + + + + + + + circuit=2, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=2,Action=SetPage1+SetCircuit2+SetBinding2,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas2=camera2 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_3 + m01_SwitchStatus_2 + m02_SwitchType_2 + m03_AlarmMessage_2 + m04_Voltage_3 + m05_Power_3 + m06_Current_3 + m07_Electricity_3 + Ls01_9 + Ls01_10 + Ls01_11 + Ls01_12 + m03_CarMessage_9 + Video0_2 + + + + + 1456 + 97 + 450 + 481 + + + + + + + circuit=3, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=3, Action=SetPage1+SetCircuit3+SetBinding3,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas3=camera3 + + + + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_4 + m01_SwitchStatus_3 + m02_SwitchType_3 + m03_AlarmMessage_3 + m04_Voltage_4 + m05_Power_4 + m06_Current_4 + m07_Electricity_4 + Ls01_13 + Ls01_14 + Ls01_15 + Ls01_16 + m03_CarMessage_10 + Video0_3 + + + + + 91 + 583 + 450 + 481 + + + + + + + circuit=4, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=4, Action=SetPage1+SetCircuit4+SetBinding4,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas4=camera4 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_5 + m01_SwitchStatus_4 + m02_SwitchType_4 + m03_AlarmMessage_4 + m04_Voltage_5 + m05_Power_5 + m06_Current_5 + m07_Electricity_5 + Ls01_17 + Ls01_18 + Ls01_19 + Ls01_20 + m03_CarMessage_11 + Video0_4 + + + + + 546 + 583 + 450 + 481 + + + + + + + circuit=5, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=5, Action=SetPage1+SetCircuit5+SetBinding5,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas5=camera5 + + + + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_6 + m01_SwitchStatus_5 + m02_SwitchType_5 + m03_AlarmMessage_5 + m04_Voltage_6 + m05_Power_6 + m06_Current_6 + m07_Electricity_6 + Ls01_21 + Ls01_22 + Ls01_23 + Ls01_24 + m03_CarMessage_12 + Video0_5 + + + + + 1001 + 583 + 450 + 481 + + + + + + + circuit=6, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=6, Action=SetPage1+SetCircuit6+SetBinding6,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 5 + 66 + 262 + 211 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 272 + 66 + 173 + 211 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM00_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 0 + 190 + 450 + 290 + + + + mqtt=VideoActive, Visible=VideoActive, canvas6=camera6 + + + + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + 150 + 348 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + m08_Jumper_7 + m01_SwitchStatus_6 + m02_SwitchType_6 + m03_AlarmMessage_6 + m04_Voltage_7 + m05_Power_7 + m06_Current_7 + m07_Electricity_7 + Ls01_25 + Ls01_26 + Ls01_27 + Ls01_28 + m03_CarMessage_13 + Video0_6 + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 3 + 72 + 144 + + + + Index=7, Action=SetPage5,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 100 + 10 + 431 + 61 + + + + + 15 + + + + + + + border:none; + + + + + + border:none; + + + + + 0 + 10 + 411 + 41 + + + + + Microsoft YaHei UI + 22 + false + false + + + + System=DateTime, Action=ModifySystem, Index=8,main=1,SelectImag=SR_001.png + + + color: rgb(166, 215, 236); +font: 22pt "Microsoft YaHei UI"; + + + 2024-5-18 + + + + + + + 1455 + 583 + 450 + 481 + + + + + + + circuit=7, main=0 + + + border:none; + + + + + + + + 0 + 0 + 450 + 481 + + + + Index=7, Action=SetPage11+SetCircuit7+SetBinding7,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 70 + 105 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 150 + 290 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + + + + 125 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 340 + 400 + 101 + 21 + + + + + 黑体 + 16 + + + + Power,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(85, 85, 255); + + + + + + Qt::AlignCenter + + + + + + 125 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(255, 128, 130); + + + + + + Qt::AlignCenter + + + + + + 340 + 445 + 101 + 21 + + + + + 黑体 + 16 + + + + Electricity,Timeout=5000 + + + background-color: rgba(255, 255, 255,0);color: rgb(0, 170, 127); + + + + + + Qt::AlignCenter + + + + + + 240 + 445 + 101 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(0, 170, 127); +font: 14pt "Microsoft YaHei UI"; + + + 电量(kWh) + + + Qt::AlignCenter + + + + + + 240 + 400 + 91 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(85, 85, 255); +font: 14pt "Microsoft YaHei UI"; + + + 功率(kW) + + + Qt::AlignCenter + + + + + + 50 + 445 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 128, 130); +font: 14pt "Microsoft YaHei UI"; + + + 电流(A) + + + Qt::AlignCenter + + + + + + 50 + 400 + 71 + 21 + + + + + Microsoft YaHei UI + 14 + false + false + + + + color: rgb(255, 170, 0); +font: 14pt "Microsoft YaHei UI"; + + + 电压(V) + + + Qt::AlignCenter + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P01DeviceMenu.ui b/QT5_Project/TestProject/UI/P01DeviceMenu.ui new file mode 100644 index 0000000..ccf9c28 --- /dev/null +++ b/QT5_Project/TestProject/UI/P01DeviceMenu.ui @@ -0,0 +1,339 @@ + + + P01DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=1 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage2+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage3+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage4+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage7+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage6+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage8+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P02DataView.ui b/QT5_Project/TestProject/UI/P02DataView.ui new file mode 100644 index 0000000..6bec13f --- /dev/null +++ b/QT5_Project/TestProject/UI/P02DataView.ui @@ -0,0 +1,1067 @@ + + + P02DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=2 + + + + + PreferDefaultHinting + + + + + + + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + true + + + + 0 + 0 + 1920 + 1080 + + + + + false + PreferDefaultHinting + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../image/DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + PreferDefaultHinting + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 276 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 277 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 330 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 385 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 440 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Io, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 300 + 330 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 300 + 386 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 300 + 440 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Uo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 274 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 331 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 388 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 550 + 442 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=Cosf, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 497 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + R, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 290 + 496 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + mqtt=AngleUoIo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 525 + 494 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 100 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Aup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 310 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 520 + 640 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cup, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 100 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Adown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 310 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Bdown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 520 + 690 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Cdown, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 104 + 40 + 161 + 171 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM02_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 260 + 40 + 141 + 171 + + + + + Arial + 12 + + + + SwitchType, ImageValue=IM02_SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + PreferDefaultHinting + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/TestProject/UI/P03SwitchAction.ui b/QT5_Project/TestProject/UI/P03SwitchAction.ui new file mode 100644 index 0000000..f622e8f --- /dev/null +++ b/QT5_Project/TestProject/UI/P03SwitchAction.ui @@ -0,0 +1,468 @@ + + + P03SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=3 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/SwitchAction.png + + + + + false + + + + 295 + 190 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 374 + 189 + 1141 + 811 + + + + + + + main=1 + + + border:none; + + + + + + + + 47 + 458 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 47 + 557 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 473 + 559 + 246 + 84 + + + + CarRetreat,Index=6,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 473 + 460 + 246 + 84 + + + + CarForward,Index=5,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 70 + 140 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 47 + 657 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 150 + 90 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 650 + 125 + 441 + 241 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::Box + + + + + + + + + 842 + 461 + 246 + 84 + + + + Index=7, Action=SetPage1,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + + 690 + 81 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + + + + 144 + 310 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=10000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P04ParamSet.ui b/QT5_Project/TestProject/UI/P04ParamSet.ui new file mode 100644 index 0000000..37256e8 --- /dev/null +++ b/QT5_Project/TestProject/UI/P04ParamSet.ui @@ -0,0 +1,1948 @@ + + + P04ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=4 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=短路倍数, Format=%04.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIa, Action=Modify, Index=11, Caption=Ia 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIb, Action=Modify, Index=12, Caption=Ib 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIc, Action=Modify, Index=13, Caption=Ic 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Io, Index=2, Action=Modify,Format=%05.1f,Caption=零序电流, Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + KD.Uo, Index=2, Action=Modify,Format=%04.0f,Caption=零序电压, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=3, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=4, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=5, Format=%05.1f, Caption=闭锁电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUo, Action=Modify, Index=6, Format=%05.1f, Caption=Uo校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIo, Action=Modify, Index=7, Format=%05.1f, Caption=Io校正值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MeasureV, Index=8, Alias=alias_measure_v, Action=Modify, Caption=检测电压,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLeakageTrip, Action=Modify, Index=9, Format=%04.1f, Caption=漏电投入延时,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectPhaseSensitivity, Index=2, Alias=alias_bool, Action=Modify, Caption=相敏保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTubeAdhesion, Index=12, Alias=alias_bool, Action=Modify, Caption=真空管粘连保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 820 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=12, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + Protect_14 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + Qt::NoFocus + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 174 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/TestProject/UI/P05CameraView.ui b/QT5_Project/TestProject/UI/P05CameraView.ui new file mode 100644 index 0000000..41c0a4f --- /dev/null +++ b/QT5_Project/TestProject/UI/P05CameraView.ui @@ -0,0 +1,656 @@ + + + P05CameraView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=5 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/CameraView.png + + + + + + 0 + 100 + 85 + 960 + + + + + + + + + + border:none; + + + + + + + + 8 + 2 + 72 + 144 + + + + Index=9, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 380 + 124 + 1165 + 720 + + + + canvas0=camera0, Timeout=5000 + + + TextLabel + + + + + + 200 + 120 + 111 + 41 + + + + + 黑体 + -1 + + + + color: rgb(177, 229, 252); font-size: 35px; + + + 回路1 + + + Qt::AlignCenter + + + + + + 90 + 890 + 1821 + 171 + + + + + + + + + + border:none; + + + + + + + + 236 + 5 + 220 + 159 + + + + Index=2, Action=canvas0_camera1, SelectImag=IM05_A2.png + + + + + + + + + + 450 + 876 + + + + + + + 10 + 5 + 220 + 159 + + + + Index=1, Action=canvas0_camera0, SelectImag=IM05_A1.png + + + + + + + + + + 450 + 876 + + + + + + + 462 + 5 + 220 + 159 + + + + Index=3, Action=canvas0_camera2, SelectImag=IM05_A3.png + + + + + + + + + + 450 + 876 + + + + + + + 688 + 5 + 220 + 159 + + + + Index=4, Action=canvas0_camera3, SelectImag=IM05_A4.png + + + + + + + + + + 450 + 876 + + + + + + + 914 + 5 + 220 + 159 + + + + Index=5, Action=canvas0_camera4, SelectImag=IM05_A5.png + + + + + + + + + + 450 + 876 + + + + + + + 1140 + 5 + 220 + 159 + + + + Index=6, Action=canvas0_camera5, SelectImag=IM05_A6.png + + + + + + + + + + 450 + 876 + + + + + + + 1366 + 5 + 220 + 159 + + + + Index=7, Action=canvas0_camera6, SelectImag=IM05_A7.png + + + + + + + + + + 450 + 876 + + + + + + + 1592 + 5 + 220 + 159 + + + + Index=8, Action=canvas0_camera7, SelectImag=IM05_A8.png + + + + + + + + + + 450 + 876 + + + + + + + 12 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas1=camera0, Timeout=5000 + + + + + + QFrame::NoFrame + + + + + + Qt::AutoText + + + background/IM05_002.png + + + false + + + Qt::AlignCenter + + + + + + 238 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas2=camera1, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 464 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas3=camera2, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 690 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas4=camera3, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 916 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas5=camera4, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 1142 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas6=camera5, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 1368 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas7=camera6, Timeout=5000 + + + + + + background/IM05_002.png + + + + + + 1594 + 23 + 216 + 139 + + + + + 200 + 135 + + + + + 400 + 300 + + + + Qt::StrongFocus + + + canvas8=camera7, Timeout=5000 + + + + + + background/IM05_002.png + + + Canvas08 + Canvas07 + Canvas06 + Canvas05 + Canvas04 + Canvas03 + Canvas02 + Canvas01 + Btn02 + Btn01 + Btn03 + Btn04 + Btn05 + Btn06 + Btn07 + Btn08 + + + + + + diff --git a/QT5_Project/TestProject/UI/P06FaultQuery.ui b/QT5_Project/TestProject/UI/P06FaultQuery.ui new file mode 100644 index 0000000..56bc3c8 --- /dev/null +++ b/QT5_Project/TestProject/UI/P06FaultQuery.ui @@ -0,0 +1,708 @@ + + + P06FaultQuery + + + + 0 + 0 + 1920 + 1076 + + + + MainWindow + + + Page=6 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 48 + 412 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 267 + 412 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 485 + 412 + 85 + 169 + + + + Index=4, Action=SetPage1, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 260 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 152 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 330 + 160 + 361 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 30 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P07SystemSet.ui b/QT5_Project/TestProject/UI/P07SystemSet.ui new file mode 100644 index 0000000..4397437 --- /dev/null +++ b/QT5_Project/TestProject/UI/P07SystemSet.ui @@ -0,0 +1,932 @@ + + + P07SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=7 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 84 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SwitchType, Action=Modify, Index=1, Alias=alias_switch_type, Caption=开关类型,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 144 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 198 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 253 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 308 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 364 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 418 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 475 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 530 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CarAlarmDelay, Action=Modify, Index=9, Format=%05.1f, Caption=小车报警延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 583 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + OffVoltageDelay, Action=Modify, Index=10, Format=%06.1f, Caption=断电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 640 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TubeDelay, Action=Modify, Index=11, Format=%06.2f, Caption=真空管粘连延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 750 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=13,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 805 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=14,SelectImag=P4_ParaSelect.png, password,groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + 270 + 695 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LoadSelect, Action=Modify, Index=12, Alias=alias_select, Caption=负载选择,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 25 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/SystemSet.png + + + P07BG + groupBox_2 + groupBox_sys_2 + indicator_Label + groupBox + + + + + diff --git a/QT5_Project/TestProject/UI/P08FieldTestAction.ui b/QT5_Project/TestProject/UI/P08FieldTestAction.ui new file mode 100644 index 0000000..8118ed6 --- /dev/null +++ b/QT5_Project/TestProject/UI/P08FieldTestAction.ui @@ -0,0 +1,391 @@ + + + P08FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=8 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../image/FieldTestAction.png + + + + + false + + + + 300 + 170 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 260 + 681 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 45 + 215 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 46 + 330 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 393 + 220 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 392 + 330 + 246 + 84 + + + + Index=5, Action=SetPage1,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + 422 + 95 + 173 + 69 + + + + + Arial + 12 + + + + SwitchType, ImageValue=SwitchType_%d.png, Timeout=5000 + + + color: rgb(30, 14, 255); + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 365 + 60 + 291 + 41 + + + + + 黑体 + 16 + + + + true + + + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + + + + false + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 154 + 72 + 144 + + + + Index=1, Action=SetPage1,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 5 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 678 + 319 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + diff --git a/QT5_Project/TestProject/UI/P11LightDeviceMenu.ui b/QT5_Project/TestProject/UI/P11LightDeviceMenu.ui new file mode 100644 index 0000000..f1da380 --- /dev/null +++ b/QT5_Project/TestProject/UI/P11LightDeviceMenu.ui @@ -0,0 +1,339 @@ + + + P11DeviceMenu + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=11 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_DeviceMenu.png + + + + + + 234 + 179 + 771 + 701 + + + + + + + main=1 + + + border:none; + + + + + + + + 400 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=7, Action=SetPage0,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 返回主页 + + + + 364 + 85 + + + + + + + 18 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=1,Action=SetPage12+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 运行数据 + + + + 364 + 85 + + + + + + + 18 + 229 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=2, Action=SetPage13+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 开关操作 + + + + 364 + 85 + + + + + + + 18 + 345 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=3, Action=SetPage14+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 20 + 460 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=4, Action=SetPage17+SetBinding,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 90 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 设备 + + + + + + 18 + 575 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=5, Action=SetPage16+SetBinding+CmdAlarmNext,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 故障查询 + + + + 364 + 85 + + + + + + + 400 + 114 + 364 + 85 + + + + + 黑体 + 29 + + + + Index=6, Action=SetPage18+SetBinding ,SelectImag=IM01_01.png + + + color: rgb(249, 136, 50); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P12LightDataView.ui b/QT5_Project/TestProject/UI/P12LightDataView.ui new file mode 100644 index 0000000..3d1180e --- /dev/null +++ b/QT5_Project/TestProject/UI/P12LightDataView.ui @@ -0,0 +1,573 @@ + + + P12DataView + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=12 + + + + + + 810 + 120 + 1071 + 841 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + + 340 + 10 + 391 + 16 + + + + cameral_url=canvas1 + + + + + + + + + 750 + 10 + 411 + 16 + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../Light_image/Light_DataView.png + + + + + false + + + + 170 + 130 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 100 + 240 + 671 + 781 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 300 + 500 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 500 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 575 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 70 + 650 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 300 + 574 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 300 + 650 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 517 + 570 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ro, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 525 + 494 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 90 + 120 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 151 + 72 + 144 + + + + Index=0, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + P02BG + TestCameraView + CameralUrlLabel + CameralUrlLabel_2 + BindNum_Title + groupBox + indicator_Label + groupBox_sys + + + + + diff --git a/QT5_Project/TestProject/UI/P13LightSwitchAction.ui b/QT5_Project/TestProject/UI/P13LightSwitchAction.ui new file mode 100644 index 0000000..3d71298 --- /dev/null +++ b/QT5_Project/TestProject/UI/P13LightSwitchAction.ui @@ -0,0 +1,345 @@ + + + P13SwitchAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=13 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_SwitchAction.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 150 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 3 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 290 + 180 + 1300 + 781 + + + + + + + main=1 + + + border:none; + + + + + + + + 147 + 490 + 246 + 84 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 411 + 493 + 246 + 84 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 500 + 170 + 310 + 170 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 674 + 493 + 246 + 84 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 581 + 98 + 281 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 940 + 490 + 246 + 84 + + + + Index=7, Action=SetPage11,SelectImag=SR_001.png, groupend=6 + + + + + + + 72 + 144 + + + + + + false + + + + 0 + 10 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备照明 + + + false + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P14LightParamSet.ui b/QT5_Project/TestProject/UI/P14LightParamSet.ui new file mode 100644 index 0000000..b620232 --- /dev/null +++ b/QT5_Project/TestProject/UI/P14LightParamSet.ui @@ -0,0 +1,1734 @@ + + + P14ParamSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=14 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=10 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=照明额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=照明短路倍数, Format=%04.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=照明短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=4, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=5, Format=%03.0f, Caption=不平衡值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=6, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=7, Caption=定时限过流, , Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=8, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIs, Action=Modify, Index=11, Caption=Is 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentIs, Action=Modify, Index=12, Caption=信号Ie Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortIs, Action=Modify, Index=13, Caption=信号短路倍数, Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrent, Action=Modify, Index=9, Caption=定时限短路, , Format=%04.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeLimitcurrentDelay, Action=Modify, Index=10, Caption=定时限短路延时, Format=%03.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 825 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=14, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=14 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=11 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=4, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=5, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1000 + 186 + 450 + 874 + + + + + + + main=12 + + + border:none; + + + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=1, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=2, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=3, Format=%05.1f, Caption=闭锁电阻,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 1455 + 170 + 450 + 874 + + + + + + + main=13 + + + border:none; + + + + + + + + 270 + 220 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=3, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 165 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectIsShort, Index=2, Alias=alias_bool, Action=Modify, Caption=信号短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 385 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=6, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 275 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=4, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 330 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=5, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 440 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 495 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=8, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 550 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 605 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 660 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 715 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 110 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 770 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + + + + 0 + 80 + 1920 + 971 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1001 + 90 + 450 + 877 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 1455 + 90 + 450 + 877 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/TestProject/UI/P16LightFaultQuery.ui b/QT5_Project/TestProject/UI/P16LightFaultQuery.ui new file mode 100644 index 0000000..3ebe32f --- /dev/null +++ b/QT5_Project/TestProject/UI/P16LightFaultQuery.ui @@ -0,0 +1,637 @@ + + + P16FaultQuery + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=16 + + + + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Ligth_FaultQuery.png + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 640 + 310 + 641 + 581 + + + + + + + main=2 + + + border:none; + + + + + + + + 51 + 410 + 85 + 169 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=IM03_001.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 270 + 410 + 85 + 169 + + + + Index=3,Action=CmdAlarmNext, SelectImag=IM03_001.png + + + + + + + 72 + 72 + + + + + + false + + + + 120 + 75 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 120 + 35 + 331 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 120 + 118 + 491 + 31 + + + + + 黑体 + 20 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 126, 21); + + + ... + + + false + + + + + + 488 + 410 + 85 + 169 + + + + Index=4, Action=SetPage11, SelectImag=IM03_001.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 650 + 485 + 671 + 291 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 260 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 260 + 82 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 27 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 81 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + 480 + 137 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(177, 229, 252); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 7 + 149 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 1 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + 320 + 170 + 421 + 91 + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 10 + 20 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + + + diff --git a/QT5_Project/TestProject/UI/P17LightSystemSet.ui b/QT5_Project/TestProject/UI/P17LightSystemSet.ui new file mode 100644 index 0000000..49e732f --- /dev/null +++ b/QT5_Project/TestProject/UI/P17LightSystemSet.ui @@ -0,0 +1,792 @@ + + + P17SystemSet + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=17 + + + + + + 91 + 187 + 450 + 874 + + + + + + + main=14 + + + border:none; + + + + + + + + 270 + 100 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Temperature, Action=Modify, Index=1, Format=%03.0f, Caption=温度设定,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 155 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=2, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 210 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=3, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 265 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=4, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 320 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=5, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 375 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=6, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 430 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=7, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 485 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=8, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 540 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=9,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 595 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=10,SelectImag=P4_ParaSelect.png, password,groupend=10 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + + 545 + 186 + 450 + 874 + + + + + + + main=15 + + + border:none; + + + + + + + + 270 + 85 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 145 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 200 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 255 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 270 + 310 + 120 + 25 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 80 + 1920 + 970 + + + + + + + + + + border:none; + + + + + + + + 547 + 90 + 450 + 877 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 180 + 36 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 92 + 90 + 450 + 877 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 9 + 24 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + 9 + 173 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + sys_P00_2 + sys_P00_3 + BindNum_Title + sys_home + sys_menu + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_SystemSet.png + + + P07BG + groupBox + groupBox_2 + groupBox_sys_2 + indicator_Label + + + + + diff --git a/QT5_Project/TestProject/UI/P18LightFieldTestAction.ui b/QT5_Project/TestProject/UI/P18LightFieldTestAction.ui new file mode 100644 index 0000000..5b0e8c0 --- /dev/null +++ b/QT5_Project/TestProject/UI/P18LightFieldTestAction.ui @@ -0,0 +1,345 @@ + + + P18FieldTestAction + + + + 0 + 0 + 1920 + 1080 + + + + MainWindow + + + Page=18 + + + + + + 0 + 0 + 1920 + 1080 + + + + + + + ../Light_image/Light_FieldTestAction.png + + + + + false + + + + 290 + 174 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + 当前设备 + + + false + + + + + + 600 + 280 + 691 + 511 + + + + + + + main=1 + + + border:none; + + + + + + + + 53 + 243 + 246 + 84 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_001.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 53 + 357 + 246 + 84 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 400 + 248 + 246 + 84 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 365 + 135 + 291 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 79 + 93 + 245 + 111 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 400 + 357 + 246 + 84 + + + + Index=5, Action=SetPage11,SelectImag=SR_001.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 1 + 412 + 88 + 636 + + + + + Arial + 12 + + + + ImageValue=IMxx_A_%d.png + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 0 + 100 + 85 + 960 + + + + + + + main=1 + + + border:none; + + + + + + + + 8 + 153 + 72 + 144 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00E.png + + + + + + + 72 + 144 + + + + + + + 8 + 4 + 72 + 144 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00F.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/TestProject/UIFrameWork.py b/QT5_Project/TestProject/UIFrameWork.py new file mode 100644 index 0000000..230b515 --- /dev/null +++ b/QT5_Project/TestProject/UIFrameWork.py @@ -0,0 +1,1584 @@ +# This Python file uses the following encoding: utf-8 +import sys +import os +import time +import inspect +import cv2 +import json +from itertools import chain +from PyQt5 import uic +from PyQt5.QtGui import QImage, QPixmap, QColor,QBrush, QKeySequence, QIcon, QPalette +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent, QSize, QDateTime +from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget, QLayout, QLabel +from PyQt5.QtWidgets import QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from Shared_CODE.DialogModifyValue import DialogModifyValue +from Shared_CODE.DialogModifyAlias import DialogModifyAlias +from Shared_CODE.DialogModifyText import DialogModifyText +from Shared_CODE.DialogInform import DialogInform +from Shared_CODE.get_tip_prop import * +from print_color import * +import time +from PyQt5.QtCore import QDateTime +import re +from datetime import datetime +import platform +import subprocess + + +# sys.path.append(sys.path[0] + "/../..") +# sys_path = sys.path[0].replace("\\", "/") + + +# 设置 img 目录的路径 +img_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'background')) + + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#31D19E").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() +COLOR_VALUE_NORMAL = QColor("#31D19E").name() + +ALIAS_QUERY_NONE = 0 +ALIAS_QUERY_WAIT_RESPOINSE = 1 + + + + +#设置系统时间 + +def is_linux(): + return platform.system() == 'Linux' + +def set_system_time(year, month, day, hour, minute, second): + if is_linux(): + try: + new_time = datetime(year, month, day, hour, minute, second).strftime("%Y-%m-%d %H:%M:%S") + subprocess.run(f'sudo timedatectl set-time "{new_time}"', shell=True, check=True) + print(f"System time updated to {new_time}") + except subprocess.CalledProcessError as e: + print(f"Failed to update system time: {e}") + else: + import ctypes + import ctypes.wintypes + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + TIME_ZONE_ID_DAYLIGHT = 2 + + class SYSTEMTIME(ctypes.Structure): + _fields_ = [ + ("wYear", ctypes.wintypes.WORD), + ("wMonth", ctypes.wintypes.WORD), + ("wDayOfWeek", ctypes.wintypes.WORD), + ("wDay", ctypes.wintypes.WORD), + ("wHour", ctypes.wintypes.WORD), + ("wMinute", ctypes.wintypes.WORD), + ("wSecond", ctypes.wintypes.WORD), + ("wMilliseconds", ctypes.wintypes.WORD), + ] + + system_time = SYSTEMTIME() + ctypes.windll.kernel32.GetSystemTime(ctypes.byref(system_time)) + + system_time.wYear = year + system_time.wMonth = month + system_time.wDay = day + system_time.wHour = hour + system_time.wMinute = minute + system_time.wSecond = second + ctypes.windll.kernel32.SetSystemTime(ctypes.byref(system_time)) + print(f"System time updated to {year}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}") +def set_screen_blanking_time(minutes): + """ + 设置屏幕黑屏时间:param minutes: 屏幕黑屏时间,以分钟为单位 + """ + if is_linux(): + # 如果是 Linux 系统,使用 xfconf-query 命令设置 Xfce 的屏幕黑屏时间 + try: + # Xfce 的屏幕黑屏时间是以秒为单位 + seconds = int(minutes) * 60 + subprocess.run([ + 'xfconf-query', '-c', 'xfce4-power-manager', + '-p', '/xfce4-power-manager/blank-on-ac', + '-s', str(seconds), '-t', 'int', '--create' + ], check=True) + print(f"Xfce屏幕黑屏时间设置为 {minutes} 分钟") + except subprocess.CalledProcessError as e: + print(f"设置Xfce屏幕黑屏时间失败: {e}") + except FileNotFoundError: + print("xfconf-query 命令未找到,请确保已安装 xfce4-power-manager。") + elif platform.system() == 'Windows': + # 如果是 Windows 系统,使用 powercfg 命令设置屏幕黑屏时间 + try: + # 设置交流电源时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-ac', str(minutes)], check=True) + # 设置电池供电时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-dc', str(minutes)], check=True) + print(f"屏幕黑屏时间设置为 {minutes} 分钟 (适用于交流电和电池供电)") + except subprocess.CalledProcessError as e: + print(f"设置屏幕黑屏时间失败: {e}") + else: + print("当前操作系统不支持此操作。") + + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + else : + json_dict = json.loads(message) + return json_dict + +def modify_style_sheet(type_name : str, origin_style_sheet : str, lead_str : str, value_str : str) : + if len(value_str) == 0 : + new_style_items = "" + else : + new_style_items = "%s:%s;"%(lead_str, value_str) + style_splits = origin_style_sheet.split("{") + if len(style_splits) == 1 : + style_items_str = style_splits[0] + elif len(style_splits) == 2 : + style_items_str = style_splits[1] + else : + style_items_str = "" + style_items_str = style_items_str.replace("}", "") + + prop_splits = style_items_str.split(";") + for each_style_prop in prop_splits : + if lead_str in each_style_prop : + key_value_splits = each_style_prop.split(":") + cmp_str = key_value_splits[0] + cmp_str = cmp_str.replace(" ", "") + cmp_str = cmp_str.replace("\n", "") + if lead_str == cmp_str : + continue + + if len(each_style_prop) > 0 : + new_style_items += each_style_prop + new_style_items += ";" + + if len(type_name) == 0: + return "%s"%(new_style_items) + else : + return "%s {%s}"%(type_name, new_style_items) + +def get_key_combine_str(str1, str2) : + return str1 + "," + str2 + +def search_circuit_from_topic(topic : str) : + circuit_id = -1 + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name in topic : + circuit_id = config_circuit_id + break + if circuit_id >= 0 : + break + return circuit_id + +def get_imag_value_file_name(tip_str : str, value : int) : + file_name = get_tip_value_str(tip_str, "ImageValue", default_string = None) + try : + if isinstance(value, str) : + fvalue = float(value) + value_id = round(fvalue) + else : + value_id = value + except Exception as e : + return None + + if file_name != None : + file_name_with_value = file_name%(value_id) + imag_value_file_name = os.path.join(img_path, file_name_with_value) + else : + imag_value_file_name = None + + if imag_value_file_name != None : + if os.path.exists(imag_value_file_name) : + return imag_value_file_name.replace("\\", "/") + return None + +def get_imag_file_name(tip_str : str, key_imag : str, default_string = None) : + file_name = get_tip_value_str(tip_str, key_imag, default_string) + select_image_file_name = None + if file_name != None : + select_image_file_name = os.path.join(img_path, file_name) + if os.path.exists(select_image_file_name) : + return select_image_file_name.replace("\\", "/") + return None + +def get_select_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectImag", default_string = None) + +def get_select_icon_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectIcon", default_string = None) + +def get_bk_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageBackGround", default_string = None) + +def get_indicator_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageIndicator", default_string = None) + +def get_compare_index(main_index : int, sub_index : int) : + return (main_index + 1) * 64 + sub_index + +class UIFrameWork(QMainWindow, class_comm_mqtt_interface): + mqtt_signal : pyqtSignal = pyqtSignal(str) + + def __init__(self): + QMainWindow.__init__(self) + self.topic_message_list : list = [] + self.mutex : QMutex = QMutex() + + self.mqtt_signal.connect(self.mqtt_topic_message_process) + self.menu_list = [] + self.sort_menu_list = [] + self.menu_key_index = 0 + self.key_active = 0 + self.select_object : QWidget = None + self.wait_response_list = [] + self.mqtt_thread : class_comm_mqtt_thread= None + + self.mqtt_value_dict = {} + + self.widget_timeout_list = [] + + self.alias_dict = {} + self.alias_query_timer : QTimer = None + + self.alias_query_timer = QTimer() + self.alias_query_timer.timeout.connect(self.process_alias_query) + self.alias_query_timer.start(3000) + + self.video_visible_timer = QTimer() + self.video_visible_timer.timeout.connect(self.video_visible_timeout) + self.video_visible_timer.start(200) + + self.time_timer = QTimer() + self.time_timer.timeout.connect(self.flush_system_cycle) + self.time_timer.start(500) + + self.canvas_visible_arr = [ + False, + False, + False, + False, + False, + False, + False, + False, + False, + ] + + # QLabel list_index CameraThread + # self.canvas_label_list : QLabel = [ [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None] + # ] + # self.set_video_image_func_arr = [self.set_video_image_0, self.set_video_image_1, self.set_video_image_2, self.set_video_image_3, + # self.set_video_image_4, self.set_video_image_5, self.set_video_image_6, self.set_video_image_7, + # self.set_video_image_8 + # ] + + # 使用列表推导式动态生成 canvas_label_list + self.canvas_label_list = [[None, -1, None] for _ in range(9)] + # 使用列表推导式动态生成 set_video_image_func_arr + self.set_video_image_func_arr = [getattr(self, f'set_video_image_{i}') for i in range(9)] + + self.page = -1 + self.select_main_index = -1 + self.exist_circuit_mask = 0 + + self.check_widget_timeout_timer : QTimer = None + + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_0), self, activated=self.key_Test_process0) + QShortcut(QKeySequence(Qt.Key_1), self, activated=self.key_Test_process1) + QShortcut(QKeySequence(Qt.Key_2), self, activated=self.key_Test_process2) + QShortcut(QKeySequence(Qt.Key_3), self, activated=self.key_Test_process3) + self.bind_channel = -1 + + #虚函数, 切换到本页面时调用 + def virtual_on_page_enter(self) : + pass + + #虚函数, 退出到本页面时调用 + def virtual_on_page_leave(self) : + pass + + #虚函数, 切换到页面, 需要在派生类中实现, page=-1表示退出到上一级菜单 + def virtual_change_to_page(self, page) : + pass + + #虚函数, 画布连接到摄像头, 需要在派生类中实现。 + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + pass + + #虚函数, action处理函数, 派生类可以额外处理 + def virtual_widget_action_process(self, widget : QObject, action : str) : + return + + def set_mqtt_value(self, circuit : int, mqtt_name : str, mqtt_value) : + key = f'{circuit}+{mqtt_name}' + self.mqtt_value_dict[key] = mqtt_value + + def get_mqtt_value(self, circuit : int, mqtt_name : str) : + key = f'{circuit}+{mqtt_name}' + if key in self.mqtt_value_dict.keys() : + return self.mqtt_value_dict[key] + return None + + def modify_object_style_sheet(self, object :QWidget, lead_str : str, value_str : str) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.styleSheet() + new_style_sheet = modify_style_sheet(object_type_name, origin_style, lead_str, value_str) + object.setStyleSheet(new_style_sheet) + + def reset_object_style_sheet(self, object :QWidget) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.whatsThis() + object.setStyleSheet(origin_style) + + def load_window_ui(self, file_window_ui : str) : + if os.path.exists(file_window_ui): + uic.loadUi(file_window_ui, self) + self.load_resource_bitmap() + self.create_menu_list() + self.sort_menu_list = sorted(self.menu_list, key=lambda x: x[0]) + self.create_style_sheet_backup() + self.create_timeout_list() + self.create_alias_list() + self.update_window_circuit_mask() + self.exist_circuit_mask = self.get_circuit_mask() + self.check_widget_timeout_timer : QTimer = QTimer() + self.check_widget_timeout_timer.timeout.connect(self.process_widget_timeout_list) + self.check_widget_timeout_timer.start(100) + self.page = get_tip_page(self.statusTip()) + self.menu_selectable_object_flush() + + def get_circuit_mask(self, child_widget : QWidget = None) : + widget :QWidget = child_widget + if widget == None : + widget = self + circuit_id_mask = 0 + + for each_object in widget.children(): + child : QWidget = each_object + if hasattr(child, "statusTip") : + circuit_id = self.get_circuit_from_object(child) + if circuit_id >= 0 : + circuit_id_mask |= (0x01 << circuit_id) + circuit_id_mask |= self.get_circuit_mask(child) + return circuit_id_mask + + def update_window_circuit_mask(self) : + self.exist_circuit_mask = self.get_circuit_mask() + return + + def set_menu_main_index(self, main_index) : + self.main_index = main_index + if len(self.sort_menu_list) == 0 : + return + if self.main_index < 0 : + self.menu_key_index = 0 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + return + menu_key_index = 0 + for each_item in self.sort_menu_list : + compare_index = each_item[0] + if compare_index >= get_compare_index(main_index, 0) : + break + menu_key_index += 1 + self.menu_key_index = menu_key_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def process_alias_query(self): + if not self.mqtt_thread: + return # 如果没有 MQTT 线程,直接返回 + + for alias_unique_name, alias_value_dict in self.alias_dict.items(): # {"xxxxx,sss": 123} + if not isinstance(alias_value_dict, int) or alias_value_dict != ALIAS_QUERY_NONE: + continue # 仅处理需要查询的整数别名 + + alias_name, uniqe_name = alias_unique_name.split(",") + + # 初始化 select_object 变量 + select_object: QWidget = None + + # 将别名的值设置为等待响应状态 + self.alias_dict[alias_unique_name] = ALIAS_QUERY_WAIT_RESPOINSE + + # 发布 MQTT 消息并等待响应 + self.mqtt_publish_and_wait_response( + f"request/alias/{uniqe_name}", + json.dumps({"name": alias_name}), + select_object, + 2000, + False + ) + + def process_widget_timeout_list(self) : + list_index = 0 + for timeout_items in self.widget_timeout_list: + time_limit = timeout_items[0] + cur_time = timeout_items[1] + cur_time += 100 + if cur_time >= time_limit: + cur_time = 0 + timeout_widget : QWidget = timeout_items[2] + if isinstance(timeout_widget, QLineEdit) : + lineedit_widget : QLineEdit = timeout_widget + lineedit_widget.setText("通信超时") + elif isinstance(timeout_widget, QLabel) : + label_widget : QLabel = timeout_widget + if "canvas" in label_widget.statusTip() : + self.camera_signal_timeout(label_widget) + else : + if label_widget.isVisible() : + label_widget.setVisible(False) + #label_widget.hide() + elif isinstance(timeout_widget, QPushButton) : + button_widget : QPushButton = timeout_widget + self.reset_object_style_sheet(button_widget) + button_widget.setText("通信超时") + timeout_items[1] = cur_time + self.widget_timeout_list[list_index] = timeout_items + list_index = list_index + 1 + + def reset_widget_timeout(self, widget : QObject) : + Index = 0 + for timeout_item in self.widget_timeout_list: + cur_time = timeout_item[1] + timeout_widget : QWidget = timeout_item[2] + if timeout_widget == widget : + timeout_item[1] = 0 + self.widget_timeout_list[Index] = timeout_item + break + Index = Index + 1 + + + def connect_camera_thread(self, camera_thread : CameraThread, canvas_id : int = 0, is_visible : bool = True) : + if camera_thread == None or canvas_id < 0: + return + if canvas_id < len(self.set_video_image_func_arr) : + canvas_object : QLabel = self.search_canvas_object(canvas_id) + if canvas_object : + canvas_info_item = self.canvas_label_list[canvas_id] + + origin_camera_thread : CameraThread = canvas_info_item[2] + if origin_camera_thread != None and origin_camera_thread.is_signal_connect: + origin_camera_thread.image_signal.disconnect(self.set_video_image_func_arr[canvas_id]) + + if is_visible : + + camera_thread.signal_connect(self.set_video_image_func_arr[canvas_id]) + + list_index : int = self.get_timeout_List_index(canvas_object) + self.canvas_label_list[canvas_id] = [canvas_object, list_index, camera_thread] + else : + self.canvas_label_list[canvas_id] = [None, -1, None] + + self.canvas_visible_arr[canvas_id] = is_visible + + + + def camera_signal_timeout(self, camera_label : QLabel): + if camera_label != None : + image_path = os.path.join(img_path, 'IM05_002.png') + if os.path.exists(image_path): + image = QPixmap(image_path) + scaled_image = image.scaled(camera_label.size(), Qt.KeepAspectRatio, Qt.SmoothTransformation) + camera_label.setPixmap(scaled_image) + + def search_canvas_object(self, canvas_id = 0, child = None) : + widget :QWidget = child + if widget == None : + widget = self + child_count = 0 + for each_object in widget.children(): + child_count += 1 + child : QWidget = each_object + + if hasattr(child, "statusTip") : + tip_str : str = child.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if config_canvas_id >= 0 and config_camera_id >= 0 and config_canvas_id == canvas_id: + if isinstance(child, QLabel) : + return child + + find_canvas_object = self.search_canvas_object(canvas_id, child) + if find_canvas_object != None : + return find_canvas_object + + if child_count == 0 : + return None + + def get_canvas_prop (self, canvas_id : int= 0) : + config_camera_id = -1 + is_face_detect : int = 0 + + canvas_object : QWidget = self.search_canvas_object(canvas_id) + if canvas_object != None : + tip_str : str = canvas_object.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + is_face_detect = get_tip_face_detection(tip_str) + return config_camera_id, is_face_detect + + def load_resource_bitmap(self, child = None) : + widget :QWidget = self + if child != None : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + imag_file_name = get_bk_imag_file_name(tip_str) + if imag_file_name != None : + if isinstance(child_widget, QLabel) : + label_child_object : QLabel = child_widget + label_child_object.setScaledContents(True) + image = QPixmap(imag_file_name) + label_child_object.setPixmap(image) + elif isinstance(child_widget, QWidget) : + file_url = "url(%s)"%(imag_file_name) + self.modify_object_style_sheet(child_widget, "background-image", file_url) + self.load_resource_bitmap(child_widget) + + def create_style_sheet_backup(self, child = None) : + widget :QWidget = child + if child == None : + widget = self + for child_widget in widget.children(): + if hasattr(child_widget, "styleSheet") : + widget : QWidget = child_widget + style_sheet : str = widget.styleSheet() + widget.setWhatsThis(style_sheet) + self.create_style_sheet_backup(child_widget) + + def create_timeout_list(self, child = None) : + widget :QWidget = self + if child == None : + self.widget_timeout_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + timeout_limit_ms = get_tip_timeout(tip_str) + if timeout_limit_ms >= 0: + self.widget_timeout_list.append([timeout_limit_ms, 0, child_widget]) + self.create_timeout_list(child_widget) + + def get_timeout_List_index(self, object : QWidget) : + list_index = -1 + search_list_index = 0 + for items in self.widget_timeout_list : + child_widget : QWidget = items[2] + if child_widget == object : + list_index = search_list_index + break + search_list_index += 1 + return list_index + + def get_page_circuit(self): + if hasattr(self, "statusTip") : + return get_tip_circuit(self.statusTip()) + return -1 + + def set_page_circuit(self, circuit_id = -1) : + if hasattr(self, "statusTip") : + origin_status_tip : str = self.statusTip() + origin_tip_splits = origin_status_tip.split(",") + new_status_tip = "" + for each_str in origin_tip_splits: + if "circuit" not in each_str : + new_status_tip += each_str + new_status_tip += "," + new_status_tip += "circuit=%d"%(circuit_id) + self.setStatusTip(new_status_tip) + self.update_window_circuit_mask() + self.create_alias_list() + self.process_alias_query() + self.para_or_measure_query() + + def create_alias_list(self, child = None) : + widget :QWidget = self + if child == None : + self.alias_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + alias_str = get_tip_alias_str(tip_str) + if alias_str != None: + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None : + key_combine_str = get_key_combine_str(alias_str, unique_name) + if key_combine_str not in self.alias_dict.keys() : + self.alias_dict[key_combine_str] = ALIAS_QUERY_NONE + self.create_alias_list(child_widget) + + def create_menu_list(self, child = None) : + widget :QWidget = self + if child == None : + self.menu_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + sub_index = get_tip_menu_sub_index(tip_str) + if sub_index >= 0: + main_index = self.get_main_index_from_object(child_widget) + if main_index >= 0 : + compare_index = get_compare_index(main_index, sub_index) + else : + compare_index = sub_index + self.menu_list.append([compare_index, child_widget]) + if isinstance(child_widget, QPushButton) : + button : QPushButton = child_widget + button.clicked.connect(self.on_menu_qpush_button_click) + self.create_menu_list(child_widget) + + def on_select_object_action_process(self, select_object : QWidget) : + tip_str = select_object.statusTip() + action_str = get_tip_value_str(tip_str, "Action", None) + if action_str != None : + if "password" in tip_str : + dialog_modify_text = DialogModifyValue(self) + caption_str = "请输入密码:" + dialog_modify_text.update_modify_info("", "0000", caption_str) + input = False + + if dialog_modify_text.exec() == QDialog.Accepted: + input = True + modify_screen_time_str = dialog_modify_text.value + pass_word = system_parameter() + if modify_screen_time_str != pass_word.get_system_password() : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", "密码错误,无法修改!") + return + else: + input = True + if input : + if "CmdExecute" in action_str : + mqtt_name = get_tip_mqtt_name(tip_str) + unique_name = self.get_unique_name_from_object(select_object) + if mqtt_name != None and unique_name != None: + if len(mqtt_name) > 0 and self.mqtt_thread != None: + publish_topic = "request/action/" + unique_name + publish_message = '{"name" : "%s"}'%(mqtt_name) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, select_object, 1000) + elif "ModifySystem" in action_str: + self.on_system_param_modify(tip_str) + elif "Modify" in action_str : + if isinstance(select_object, QLineEdit) : + self.on_line_edit_modify_click(select_object) + + self.virtual_widget_action_process(select_object, action_str) + + def search_menu_match_object(self, object) : + match_object : QWidget = None + menu_index = 0 + for each_list in self.sort_menu_list : + search_object = each_list[1] + if search_object == object : + match_object = search_object + break + menu_index += 1 + return match_object, menu_index + + #刷新屏幕上的系统信息, 例如时间日期之类 + def flush_system_info(self, child = None) : + widget : QWidget= child + if child == None : + widget = self + else : + widget = child + + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + system_str = get_tip_system(tip_str) + + if system_str == "DateTime" : + qdate_time = QDateTime.currentDateTime() + time_str = qdate_time.toString("yyyy-MM-dd hh:mm:ss") + + if isinstance(child_widget, QPushButton) : + button_widget : QPushButton = child_widget + button_widget.setText(time_str) + elif isinstance(child_widget, QLineEdit) : + line_edit_widget : QLineEdit = child_widget + line_edit_widget.setText(time_str) + elif isinstance(child_widget, QLabel) : + label_widget : QLabel = child_widget + label_widget.setText(time_str) + self.flush_system_info(child_widget) + + def func_mqtt_param_modify(self, modify_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/modify/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, modify_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def func_call_back_on_mqtt_param_info(self, info_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/info/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, info_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def on_menu_qpush_button_click(self, sender : QPushButton): + sender : QPushButton = self.sender() + match_object : QWidget = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + self.menu_selectable_object_flush() + if isinstance(match_object, QPushButton) : + self.on_select_object_action_process(match_object) + + #修改系统时间与日期 + def func_modify_system_time(self, modify_str : str) : + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + set_system_time(year, month, day, hour, minute, second) + + return year, month, day, hour, minute, second + return None + + #修改系统黑屏时间 + def func_modify_screen_blanking_time(self, modify_str: str): + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 1: + minutes = int(numbers[0]) + set_screen_blanking_time(minutes) + return minutes + return None + + def on_system_param_modify(self, tip : str) : + system = get_tip_system(tip) + if system == "DateTime" : + dialog_modify_text : DialogModifyText = DialogModifyText(self) + caption_str = "修改系统时间" + cur_time = QDateTime.currentDateTime() + date_time_str = cur_time.toString("yyyy-MM-dd hh:mm:ss") + dialog_modify_text.update_modify_info(date_time_str, caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_date_time_str = dialog_modify_text.value + self.func_modify_system_time(modify_date_time_str) + for circuit_id in range(8) : + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None and self.mqtt_thread != None: + time_message = '{"name" : "SetupTime", "value" : "%s"}'%(modify_date_time_str) + self.mqtt_thread.publish("request/action/" + unique_name, time_message) + dialog_inform = DialogInform(self) + dialog_inform.information("系统时间修改", "系统时间修改成功") + elif system == "ScreenBlankingTime": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改屏幕黑屏时间(分钟)" + sbt = system_parameter() + dialog_modify_text.update_modify_info("", str(sbt.get_screen_blanking_time()), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + result = self.func_modify_screen_blanking_time(modify_screen_time_str) + sbt.change_screen_blanking_time(modify_screen_time_str) + + if result is not None: + self.BlankTimelineEdit.setText(str(result)) + dialog_inform = DialogInform(self) + dialog_inform.information("屏幕黑屏时间修改", "屏幕黑屏时间修改成功") + + elif system == "SystemPassWord": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改系统密码" + pass_word = system_parameter() + dialog_modify_text.update_modify_info("", pass_word.get_system_password(), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + pass_word.set_system_password(modify_screen_time_str) + dialog_inform = DialogInform(self) + dialog_inform.information("系统密码修改", "系统密码修改成功") + def on_line_edit_modify_click(self, sender :QLineEdit) : + match_object : QLineEdit = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + if isinstance(match_object, QLineEdit) : + self.dialog_modify_value = None + tip = match_object.statusTip() + alias_name = get_tip_alias_str(tip) + unique_name = self.get_unique_name_from_object(match_object) + if unique_name != None and alias_name != None : + key_combine_str = get_key_combine_str(alias_name, unique_name) + value_dict = utils.dict_or_object_get_attr(self.alias_dict, key_combine_str, None) + + if isinstance(value_dict, dict) : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + caption_str = get_tip_caption_str(match_object.statusTip()) + value_text = match_object.text() + dialog_modify_alias.set_alias_item_info(value_dict, value_text, caption_str) + self.dialog_modify_alias = dialog_modify_alias + + if dialog_modify_alias.exec() == QDialog.Accepted : + modify_value = dialog_modify_alias.value + self.func_mqtt_param_modify(modify_value) + else : + inform_box : DialogInform = DialogInform() + inform_box.information('别名数据未获取', 'message: %s'%(alias_name)) + else : + dialog_modify_value : DialogModifyValue = DialogModifyValue(self) + caption_str = get_tip_caption_str(match_object.statusTip()) + try : + origin_value = float(match_object.text()) + except Exception as e : + origin_value = None + inform_box : DialogInform = DialogInform() + inform_box.information('无效值', str(e)) + + if origin_value != None : + format_str = get_tip_format(tip) + dialog_modify_value.update_modify_info(format_str, origin_value, caption_str) + if dialog_modify_value.exec() == QDialog.Accepted : + modify_value = dialog_modify_value.value + self.func_mqtt_param_modify(modify_value) + def set_video_image(self, image_object : QObject, canvas_id = 0) : + if canvas_id >= len(self.canvas_label_list) : + return + camera_info_items = self.canvas_label_list[canvas_id] + camera_label: QLabel = camera_info_items[0] + timeout_list_index = camera_info_items[1] + camera_thread : CameraThread = camera_info_items[2] + + if camera_label != None: + shape = image_object.shape + width = shape[1] + height = shape[0] + if camera_label.isVisible() : + + qt_img = QImage(image_object.data, width, height, QImage.Format_RGB888) + + camera_label.setScaledContents(True) + camera_label.setPixmap(QPixmap.fromImage(qt_img)) + + if timeout_list_index >= 0 : + self.widget_timeout_list[timeout_list_index][1] = 0 + + def set_video_image_0(self, image_object : QObject) : + self.set_video_image(image_object, 0) + + def set_video_image_1(self, image_object : QObject) : + self.set_video_image(image_object, 1) + + def set_video_image_2(self, image_object : QObject) : + self.set_video_image(image_object, 2) + + def set_video_image_3(self, image_object : QObject) : + self.set_video_image(image_object, 3) + + def set_video_image_4(self, image_object : QObject) : + self.set_video_image(image_object, 4) + + def set_video_image_5(self, image_object : QObject) : + self.set_video_image(image_object, 5) + + def set_video_image_6(self, image_object : QObject) : + self.set_video_image(image_object, 6) + + def set_video_image_7(self, image_object : QObject) : + self.set_video_image(image_object, 7) + + def set_video_image_8(self, image_object : QObject) : + self.set_video_image(image_object, 8) + + def update_mqtt_value(self, circuit, json_dict) : + for json_key, json_value in json_dict.items() : + self.set_mqtt_value(circuit, json_key, json_value) + + #更新视频显示与否 + def update_canvas_camera_visible(self, child = None) : + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if isinstance(child, QLabel) : + widget_label : QLabel = child + tip_str = widget_label.statusTip() + visible_mqtt = get_tip_visible_mqtt(tip_str, None) + if visible_mqtt != None : + #该Label具有Visible控制, 检查一下是不是视频流 + canvas_id, camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if canvas_id >= 0 and camera_id >= 0 : + circuit_id = self.get_circuit_from_object(widget_label) + visible_value = self.get_mqtt_value(circuit_id, visible_mqtt) + + is_visible = False + if visible_value != None : + try : + is_visible = True if int(visible_value) > 0 else False + except Exception as e : + is_visible = False + + widget_label.setVisible(is_visible) + if is_visible != self.canvas_visible_arr[canvas_id] and canvas_id < len(self.canvas_visible_arr): + self.canvas_visible_arr[canvas_id] = is_visible + self.virtual_connect_canvas_to_camera(canvas_id, camera_id, is_visible) + + self.update_canvas_camera_visible(child) + + def video_visible_timeout(self) : + self.update_canvas_camera_visible() + + #通过json包刷新界面数据 + def flush_widgets(self, circuit, json_dict, child = None): + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if not hasattr(child, "statusTip") : + continue + tip_str : str = child.statusTip() + + mqtt_name = get_tip_mqtt_name(tip_str) + + circuit_id = self.get_circuit_from_object(each_object) + self.flush_widgets(circuit, json_dict, child) + + if circuit_id != circuit : + continue + + if mqtt_name in json_dict.keys() : + value_or_dict = json_dict[mqtt_name] + + if isinstance(value_or_dict, dict) : + value_text = utils.dict_or_object_get_attr(value_or_dict, "value", "") + else : + value_text = value_or_dict + + color_str = utils.dict_or_object_get_attr(value_or_dict, "color", None) + bk_color_str = utils.dict_or_object_get_attr(value_or_dict, "bk_color", None) + + imag_file_name = get_imag_value_file_name(tip_str, value_text) + timeout_ms = get_tip_timeout(tip_str) + if timeout_ms > 0 : + self.reset_widget_timeout(child) + + if isinstance(child, QPushButton) : + widget_button : QPushButton = child + if imag_file_name != None : + self.modify_object_style_sheet(widget_button, "border-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_button) + + if isinstance(child, QLabel) : + widget_label : QLabel = child + if imag_file_name != None : + if widget_label.isVisible() == False : + widget_label.setVisible(True) + self.modify_object_style_sheet(widget_label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_label) + widget_label.setText(value_text) + + if isinstance(child, QLineEdit) : + widget_line_edit : QLineEdit = child + alias_name = get_tip_alias_str(widget_line_edit.statusTip()) + unique_name = self.get_unique_name_from_object(widget_line_edit) + + if alias_name != None : + fvalue = float(value_text) + value = round(fvalue) + value_str = str(value) + display_text = "(%s)"%(value_str) + + alias_key_str = get_key_combine_str(alias_name, unique_name) + if alias_key_str in self.alias_dict.keys() : + alias_value_dict = self.alias_dict[alias_key_str] + if isinstance(alias_value_dict, dict) : + display_text = utils.dict_or_object_get_attr(alias_value_dict, value_str, value_text) + else : + display_text = value_text + widget_line_edit.setText(display_text) + + if bk_color_str != None : + if isinstance(child, QLineEdit) : + self.modify_object_style_sheet(child, "background-color", bk_color_str) + if color_str != None : + self.modify_object_style_sheet(child, "color", color_str) + + def get_circuit_from_object(self, object :QWidget) : + parent : QWidget= object + circuit_id = -1 + while parent != None : + if hasattr(parent, "statusTip") : + tip_str = parent.statusTip() + circuit_id = get_tip_circuit(tip_str) + if circuit_id >= 0 or parent == self: + break + parent = parent.parent() + return circuit_id + + def get_main_index_from_object(self, object :QWidget) : + parent : QWidget= object + main_index = -1 + while parent != None : + if not hasattr(parent, "statusTip") : + return -1 + + tip_str = parent.statusTip() + main_index = get_tip_main_index(tip_str) + if main_index >= 0 or parent == self: + break + parent = parent.parent() + return main_index + + def get_unique_name_from_circuit(self, circuit_id : int) : + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_circuit_id == circuit_id : + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + return circuit_unique_name + return None + + def get_unique_name_from_object(self, object :QWidget) : + circuit_id = self.get_circuit_from_object(object) + return self.get_unique_name_from_circuit(circuit_id) + + def key_increase_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_end(tip_str) + + if group_items_count == -1: + next_menu_index = (self.menu_key_index + 1) % menu_count + else: + next_menu_index = (self.menu_key_index - group_items_count + 1) % menu_count + + self.menu_key_index = next_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def key_decrease_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_start(tip_str) + if group_items_count == -1: + prev_menu_index = (self.menu_key_index - 1) % menu_count + else: + prev_menu_index = (self.menu_key_index + group_items_count - 1) % menu_count + + self.menu_key_index = prev_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + + def key_enter_process(self): + menu_count = len(self.sort_menu_list) + if menu_count == 0: + return + + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.on_select_object_action_process(self.select_object) + + def key_escape_process(self): + #在菜单第一项, 按下复位, 退出到上一页 + if self.menu_key_index == 0: + self.virtual_change_to_page(-1) + + menu_count = len(self.sort_menu_list) # 获取当前页面可交互控件个数 + if menu_count == 0: # 若注册可交互控件个数为0,则退出处理,返回 + return + + # 重置菜单选择 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_key_index = 0 + self.menu_selectable_object_flush() + + + def key_Test_process0(self): + json_dict = {"Uab" :"1111", + "Ubc" : "1111", + "Uca" : "1111", + "Uo" : "11" , + "Iab" : "1111", + "Ibc" : "1111", + "Ica" : "1111", + "Io" : "1111", + "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + } + + + self.flush_widgets(0, json_dict) + + def key_Test_process1(self): + json_dict = {"Uab" :"2222", + "Ubc" : "2222", + "Uca" : "2222", + "Uo" : "22" , + "Iab" : "2222", + "Ibc" : "2222", + "Ica" : "2222", + "Io" : "2222", + "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + + + } + self.flush_widgets(1, json_dict) + + def key_Test_process2(self): + json_dict = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + self.flush_widgets(2, json_dict) + + def key_Test_process3(self): + json_dict = {"Uab" :"33333", "Ubc" : "33333", "Uca" : "33333"} + self.flush_widgets(3, json_dict) + + def menu_selectable_object_flush(self) : + menu_count = len(self.sort_menu_list) + for i in range(menu_count): + object : QWidget = self.sort_menu_list[i][1] + is_select_object_draw = False + + if isinstance(object, QPushButton) : + button_object : QPushButton = object + image_file_name = get_select_imag_file_name(object.statusTip()) + image_icon_name = get_select_icon_file_name(object.statusTip()) + + if i == self.menu_key_index: + button_object.setFocus() + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(button_object, "border-image", file_url) + elif image_icon_name != None : + is_select_object_draw = True + button_size : QSize = button_object.size() + button_object.setIcon(QIcon(image_icon_name)) + button_object.setIconSize(button_size) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(button_object) + elif image_icon_name != None : + is_select_object_draw = True + button_object.setIcon(QIcon()) + + elif isinstance(object, QLabel) : + label_object : QLabel = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(label_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(label_object) + + elif isinstance(object, QLineEdit) : + line_object : QLineEdit = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(line_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(line_object) + + + if is_select_object_draw == False : + if i == self.menu_key_index : + self.modify_object_style_sheet(object, "background-color", COLOR_BLUE) + else : + self.reset_object_style_sheet(object) + + def response_topic_message_process(self, topic: str, + message : str, + is_timeout :bool = False, inform : bool = False) : + find_reponse_topic_msg = None + for wait_topic_msg in self.wait_response_list : + if wait_topic_msg[0] == topic : + find_reponse_topic_msg = wait_topic_msg + self.wait_response_list.remove(wait_topic_msg) + break + + if find_reponse_topic_msg == None : + return + + select_object :QWidget = find_reponse_topic_msg[2] + request_message : str = find_reponse_topic_msg[1] + + inform_box : DialogInform = None + if inform : + inform_box : DialogInform = DialogInform() + + try : + json_dict = json_load_message(message) + result = utils.dict_or_object_get_attr(json_dict, "result", 0) + result = int(result) + except Exception as e: + json_dict = None + result = 0 + print_error_msg(str(e) + "invalid json message: %s" % (message)) + + if "response/action" in topic : + if is_timeout : + inform_message = "命令执行超时" + if inform == True: + inform_box.information('命令执行超时', inform_message) + else : + inform_message = '命令执行成功' if result == 1 else '命令执行失败!!!' + if inform == True: + inform_box.information('命令执行', inform_message) + elif "response/param/modify" in topic : + if is_timeout : + inform_message = '参数修改超时' + if inform == True: + inform_box.information('参数修改超时', inform_message) + else : + inform_message = '参数修改成功' if result == 1 else '参数修改失败!!!' + if inform == True: + inform_box.information('参数修改', inform_message) + if result == 1 : + self.para_or_measure_query() + elif "response/alias" in topic : + unique_name = topic.replace("response/alias/", "") + + if is_timeout : + if json_dict != None : + alias_name = None + if "name" in json_dict.keys() : + alias_name = json_dict["name"] + + if alias_name != None : + key_str = get_key_combine_str(alias_name, unique_name) + if key_str in self.alias_dict.keys() : + if isinstance(self.alias_dict[key_str], int) : + self.alias_dict[key_str] = ALIAS_QUERY_NONE + + if inform == True: + inform_box.information('获取别名超时', message) + else : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + if isinstance(json_dict, list): + for item in json_dict: + for alias_key_name, alias_dict in item.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + else: + for alias_key_name, alias_dict in json_dict.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + + def mqtt_topic_message_process(self, msg) : + topic_msg_item = True + while topic_msg_item != None : + self.mutex.lock() + topic_msg_count = len(self.topic_message_list) + if topic_msg_count > 0: + topic_msg_item = self.topic_message_list.pop(0) + else : + topic_msg_item = None + self.mutex.unlock() + if topic_msg_item != None : + topic = topic_msg_item[0] + message = topic_msg_item[1] + try : + json_dict = json_load_message(message) + except Exception as e : + json_dict = None + print_error_msg("invalid json message : %s"%(message)) + if json_dict != None: + if "measure" in topic : + circuit_id = search_circuit_from_topic(topic) + self.update_mqtt_value(circuit_id, json_dict) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.flush_widgets(circuit_id, json_dict) + elif "param/info" in topic: + circuit_id = search_circuit_from_topic(topic) + #print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response/alarm" in topic : + circuit_id = search_circuit_from_topic(topic) + self.flush_alarminfo(circuit_id, json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response" in topic : + self.response_topic_message_process(topic, message, is_timeout = False, inform = True) + + elif "alarm/test" in topic : + circuit_id = search_circuit_from_topic(topic) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + + # 将告警信息刷新到页面 + def flush_alarminfo(self, circuit, json_dict, child = None): + + alarmTitle : QLineEdit = self.findChild(QLineEdit,"alarmTitle") + if alarmTitle != None: + display_title = "%s"%(json_dict["index"]) + alarmTitle.setText(display_title) + + alarmTime : QLineEdit = self.findChild(QLineEdit,"alarmTime") + if alarmTime != None: + display_year = "%s-"%(json_dict["AlarmYear"]) + display_month = "%s-"%(json_dict["AlarmMonth"]) + display_day = "%s"%(json_dict["AlarmDay"]) + display_hour = " %s:"%(json_dict["AlarmHour"]) + display_minute = "%s: "%(json_dict["AlarmMinute"]) + display_second = "%s"%(json_dict["AlarmSecond"]) + + disp_time = display_year + display_month + display_day + display_hour+ display_minute+ display_second + alarmTime.setText(disp_time) + + alarmMsg : QLineEdit = self.findChild(QLineEdit,"alarmMsg") + if alarmMsg != None: + display_msg = "%s"%(json_dict["AlarmCodeMsg"]) + alarmMsg.setText(display_msg) + + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0: + self.mqtt_thread = mqtt_thread + self.mqtt_thread.subscribe("response/#") + self.mqtt_thread.subscribe("param/info/#") + self.mqtt_thread.subscribe("param/modify/#") + self.mqtt_thread.subscribe("measure/#") + self.mqtt_thread.subscribe("status/#") + self.mqtt_thread.subscribe("alarm/#") + self.mqtt_thread.subscribe("response/alarm/#") + self.mqtt_thread.subscribe("action/#") + else : + self.mqtt_thread = None + + def on_message(self, mqtt_thread, topic, message) : + circuit_id = search_circuit_from_topic(topic) + if circuit_id < 0 : + return + if (self.exist_circuit_mask & (0x1 << circuit_id)) == 0 : + return + self.mutex.lock() + if len(self.topic_message_list) < 100 : + self.topic_message_list.append([topic, message]) + self.mutex.unlock() + self.mqtt_signal.emit("Refresh UI") + + def response_topic_messge_timeout(self): + timer = self.sender() + for wait_response_items in self.wait_response_list: + wait_timer : QTimer = wait_response_items[3] + _inform : bool = wait_response_items[4] + + if wait_timer == timer : + topic : str = wait_response_items[0] + message : str = wait_response_items[1] + wait_timer.stop() + self.response_topic_message_process(topic, message, is_timeout=True, inform = _inform) + break + + # def mqtt_publish_and_wait_response(self, publish_topic : str, publish_message : str, select_object : QWidget = None, timeout_ms : int = 1000, inform : bool = True) : + # if self.mqtt_thread != None : + # self.mqtt_thread.publish(publish_topic, publish_message) + + # response_topic = publish_topic.replace("request", "response") + # #开启超时定时器 + # wait_timer = QTimer() + # wait_timer.timeout.connect(self.response_topic_messge_timeout) + # wait_timer.start(timeout_ms) + # self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + def mqtt_publish_and_wait_response(self, publish_topic: str, publish_message: str, select_object: QWidget = None, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda: self.response_topic_message_timeout(response_topic)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def response_topic_message_timeout(self, response_topic): + # 处理超时事件 + for response_info in self.wait_response_list: + if response_info[0] == response_topic: + response_info[3].stop() # 停止定时器 + self.wait_response_list.remove(response_info) + # 在这里添加超时后的处理逻辑,例如通知用户请求超时 + if response_info[4]: # 检查是否需要通知 + self.inform_timeout(response_info) + break + + def inform_timeout(self, response_info): + # 通知用户请求超时的逻辑 + # response_info[2] 是 select_object + # 根据具体需求实现通知逻辑 + print(f"Request for {response_info[1]} on topic {response_info[0]} timed out.") + + def batch_mqtt_publish_and_wait_response(self, publish_list: list, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + for publish_topic, publish_message, select_object in publish_list: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda rt=response_topic: self.response_topic_message_timeout(rt)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + + def para_or_measure_query(self, child = None) : + widget :QWidget = self + if child == None : + self.param_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + if "ScreenBlankingTime" in tip_str : + sbt = system_parameter() + child_widget.setText(sbt.get_screen_blanking_time()) + continue + mqtt_str = get_tip_mqtt_name(tip_str) + if mqtt_str != None and mqtt_str not in self.param_dict.keys(): + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None and self.mqtt_thread != None: + self.mqtt_thread.publish("request/param/info/"+unique_name, '{"name":"%s"}'%mqtt_str) + self.param_dict[mqtt_str] = ALIAS_QUERY_NONE + self.para_or_measure_query(child_widget) + + def flush_system_cycle(self) : + self.flush_system_info() + +if __name__ == '__main__': + + style_sheet = "QLabel {color : RED;\nbackground-color : GREEN;}" + print(style_sheet) + + new_style_items = modify_style_sheet("QLabel", style_sheet, "background-color", "WHITE") + new_style_items = modify_style_sheet("QLabel", new_style_items, "color", "YELLOW") + + print(new_style_items) + sys.exit(0) diff --git a/QT5_Project/TestProject/__init__.py b/QT5_Project/TestProject/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/TestProject/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/TestProject/background/IM00_01B.png b/QT5_Project/TestProject/background/IM00_01B.png new file mode 100644 index 0000000..7895e62 Binary files /dev/null and b/QT5_Project/TestProject/background/IM00_01B.png differ diff --git a/QT5_Project/TestProject/background/IM00_SwitchStatus_0.png b/QT5_Project/TestProject/background/IM00_SwitchStatus_0.png new file mode 100644 index 0000000..7af2bc2 Binary files /dev/null and b/QT5_Project/TestProject/background/IM00_SwitchStatus_0.png differ diff --git a/QT5_Project/TestProject/background/IM00_SwitchStatus_1.png b/QT5_Project/TestProject/background/IM00_SwitchStatus_1.png new file mode 100644 index 0000000..3b8eec3 Binary files /dev/null and b/QT5_Project/TestProject/background/IM00_SwitchStatus_1.png differ diff --git a/QT5_Project/TestProject/background/IM00_SwitchType_0.png b/QT5_Project/TestProject/background/IM00_SwitchType_0.png new file mode 100644 index 0000000..6d93e04 Binary files /dev/null and b/QT5_Project/TestProject/background/IM00_SwitchType_0.png differ diff --git a/QT5_Project/TestProject/background/IM00_SwitchType_1.png b/QT5_Project/TestProject/background/IM00_SwitchType_1.png new file mode 100644 index 0000000..bc57853 Binary files /dev/null and b/QT5_Project/TestProject/background/IM00_SwitchType_1.png differ diff --git a/QT5_Project/TestProject/background/IM01_01.png b/QT5_Project/TestProject/background/IM01_01.png new file mode 100644 index 0000000..ca8ba7b Binary files /dev/null and b/QT5_Project/TestProject/background/IM01_01.png differ diff --git a/QT5_Project/TestProject/background/IM01_0122.png b/QT5_Project/TestProject/background/IM01_0122.png new file mode 100644 index 0000000..1e0fc04 Binary files /dev/null and b/QT5_Project/TestProject/background/IM01_0122.png differ diff --git a/QT5_Project/TestProject/background/IM02_SwitchStatus_0.png b/QT5_Project/TestProject/background/IM02_SwitchStatus_0.png new file mode 100644 index 0000000..3846172 Binary files /dev/null and b/QT5_Project/TestProject/background/IM02_SwitchStatus_0.png differ diff --git a/QT5_Project/TestProject/background/IM02_SwitchStatus_1.png b/QT5_Project/TestProject/background/IM02_SwitchStatus_1.png new file mode 100644 index 0000000..a648e14 Binary files /dev/null and b/QT5_Project/TestProject/background/IM02_SwitchStatus_1.png differ diff --git a/QT5_Project/TestProject/background/IM02_SwitchType_0.png b/QT5_Project/TestProject/background/IM02_SwitchType_0.png new file mode 100644 index 0000000..62cb1a4 Binary files /dev/null and b/QT5_Project/TestProject/background/IM02_SwitchType_0.png differ diff --git a/QT5_Project/TestProject/background/IM02_SwitchType_1.png b/QT5_Project/TestProject/background/IM02_SwitchType_1.png new file mode 100644 index 0000000..841ccfa Binary files /dev/null and b/QT5_Project/TestProject/background/IM02_SwitchType_1.png differ diff --git a/QT5_Project/TestProject/background/IM03_001.png b/QT5_Project/TestProject/background/IM03_001.png new file mode 100644 index 0000000..164c3b2 Binary files /dev/null and b/QT5_Project/TestProject/background/IM03_001.png differ diff --git a/QT5_Project/TestProject/background/IM03_SwitchStatus_0.png b/QT5_Project/TestProject/background/IM03_SwitchStatus_0.png new file mode 100644 index 0000000..f2796ca Binary files /dev/null and b/QT5_Project/TestProject/background/IM03_SwitchStatus_0.png differ diff --git a/QT5_Project/TestProject/background/IM03_SwitchStatus_1.png b/QT5_Project/TestProject/background/IM03_SwitchStatus_1.png new file mode 100644 index 0000000..3d469ef Binary files /dev/null and b/QT5_Project/TestProject/background/IM03_SwitchStatus_1.png differ diff --git a/QT5_Project/TestProject/background/IM04_00.png b/QT5_Project/TestProject/background/IM04_00.png new file mode 100644 index 0000000..8e19fb2 Binary files /dev/null and b/QT5_Project/TestProject/background/IM04_00.png differ diff --git a/QT5_Project/TestProject/background/IM05_001.png b/QT5_Project/TestProject/background/IM05_001.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_001.png differ diff --git a/QT5_Project/TestProject/background/IM05_002.png b/QT5_Project/TestProject/background/IM05_002.png new file mode 100644 index 0000000..d1c3db6 Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_002.png differ diff --git a/QT5_Project/TestProject/background/IM05_A1.png b/QT5_Project/TestProject/background/IM05_A1.png new file mode 100644 index 0000000..78529ba Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A1.png differ diff --git a/QT5_Project/TestProject/background/IM05_A2.png b/QT5_Project/TestProject/background/IM05_A2.png new file mode 100644 index 0000000..ca50d84 Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A2.png differ diff --git a/QT5_Project/TestProject/background/IM05_A3.png b/QT5_Project/TestProject/background/IM05_A3.png new file mode 100644 index 0000000..9462fc6 Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A3.png differ diff --git a/QT5_Project/TestProject/background/IM05_A4.png b/QT5_Project/TestProject/background/IM05_A4.png new file mode 100644 index 0000000..e4d3b74 Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A4.png differ diff --git a/QT5_Project/TestProject/background/IM05_A5.png b/QT5_Project/TestProject/background/IM05_A5.png new file mode 100644 index 0000000..85544ac Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A5.png differ diff --git a/QT5_Project/TestProject/background/IM05_A6.png b/QT5_Project/TestProject/background/IM05_A6.png new file mode 100644 index 0000000..bff0217 Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A6.png differ diff --git a/QT5_Project/TestProject/background/IM05_A7.png b/QT5_Project/TestProject/background/IM05_A7.png new file mode 100644 index 0000000..a5832fc Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A7.png differ diff --git a/QT5_Project/TestProject/background/IM05_A8.png b/QT5_Project/TestProject/background/IM05_A8.png new file mode 100644 index 0000000..d8ab1f4 Binary files /dev/null and b/QT5_Project/TestProject/background/IM05_A8.png differ diff --git a/QT5_Project/TestProject/background/IMxx_00D.png b/QT5_Project/TestProject/background/IMxx_00D.png new file mode 100644 index 0000000..b47cc71 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_00D.png differ diff --git a/QT5_Project/TestProject/background/IMxx_00E.png b/QT5_Project/TestProject/background/IMxx_00E.png new file mode 100644 index 0000000..f00eef7 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_00E.png differ diff --git a/QT5_Project/TestProject/background/IMxx_00F.png b/QT5_Project/TestProject/background/IMxx_00F.png new file mode 100644 index 0000000..28446f1 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_00F.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_0.png b/QT5_Project/TestProject/background/IMxx_A_0.png new file mode 100644 index 0000000..b2d9427 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_0.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_1.png b/QT5_Project/TestProject/background/IMxx_A_1.png new file mode 100644 index 0000000..02ccba6 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_1.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_2.png b/QT5_Project/TestProject/background/IMxx_A_2.png new file mode 100644 index 0000000..b3c036c Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_2.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_3.png b/QT5_Project/TestProject/background/IMxx_A_3.png new file mode 100644 index 0000000..4de3901 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_3.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_4.png b/QT5_Project/TestProject/background/IMxx_A_4.png new file mode 100644 index 0000000..7de2f89 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_4.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_5.png b/QT5_Project/TestProject/background/IMxx_A_5.png new file mode 100644 index 0000000..1c3cd15 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_5.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_6.png b/QT5_Project/TestProject/background/IMxx_A_6.png new file mode 100644 index 0000000..0f628d3 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_6.png differ diff --git a/QT5_Project/TestProject/background/IMxx_A_7.png b/QT5_Project/TestProject/background/IMxx_A_7.png new file mode 100644 index 0000000..003e551 Binary files /dev/null and b/QT5_Project/TestProject/background/IMxx_A_7.png differ diff --git a/QT5_Project/TestProject/background/P4_ParaSelect.png b/QT5_Project/TestProject/background/P4_ParaSelect.png new file mode 100644 index 0000000..489633e Binary files /dev/null and b/QT5_Project/TestProject/background/P4_ParaSelect.png differ diff --git a/QT5_Project/TestProject/background/P4_ToggleSelect.png b/QT5_Project/TestProject/background/P4_ToggleSelect.png new file mode 100644 index 0000000..d190adf Binary files /dev/null and b/QT5_Project/TestProject/background/P4_ToggleSelect.png differ diff --git a/QT5_Project/TestProject/background/SR_001.png b/QT5_Project/TestProject/background/SR_001.png new file mode 100644 index 0000000..654c93b Binary files /dev/null and b/QT5_Project/TestProject/background/SR_001.png differ diff --git a/QT5_Project/TestProject/background/SwitchStatus_0.png b/QT5_Project/TestProject/background/SwitchStatus_0.png new file mode 100644 index 0000000..108f3f0 Binary files /dev/null and b/QT5_Project/TestProject/background/SwitchStatus_0.png differ diff --git a/QT5_Project/TestProject/background/SwitchStatus_1.png b/QT5_Project/TestProject/background/SwitchStatus_1.png new file mode 100644 index 0000000..25bafe1 Binary files /dev/null and b/QT5_Project/TestProject/background/SwitchStatus_1.png differ diff --git a/QT5_Project/TestProject/background/SwitchType_0.png b/QT5_Project/TestProject/background/SwitchType_0.png new file mode 100644 index 0000000..3bf1062 Binary files /dev/null and b/QT5_Project/TestProject/background/SwitchType_0.png differ diff --git a/QT5_Project/TestProject/background/SwitchType_1.png b/QT5_Project/TestProject/background/SwitchType_1.png new file mode 100644 index 0000000..700b4f6 Binary files /dev/null and b/QT5_Project/TestProject/background/SwitchType_1.png differ diff --git a/QT5_Project/TestProject/image/CameraView.png b/QT5_Project/TestProject/image/CameraView.png new file mode 100644 index 0000000..de6e64d Binary files /dev/null and b/QT5_Project/TestProject/image/CameraView.png differ diff --git a/QT5_Project/TestProject/image/DataView.png b/QT5_Project/TestProject/image/DataView.png new file mode 100644 index 0000000..fe6abd2 Binary files /dev/null and b/QT5_Project/TestProject/image/DataView.png differ diff --git a/QT5_Project/TestProject/image/DeviceList.png b/QT5_Project/TestProject/image/DeviceList.png new file mode 100644 index 0000000..b9746c6 Binary files /dev/null and b/QT5_Project/TestProject/image/DeviceList.png differ diff --git a/QT5_Project/TestProject/image/DeviceMenu.png b/QT5_Project/TestProject/image/DeviceMenu.png new file mode 100644 index 0000000..e080fbb Binary files /dev/null and b/QT5_Project/TestProject/image/DeviceMenu.png differ diff --git a/QT5_Project/TestProject/image/FaultQuery.png b/QT5_Project/TestProject/image/FaultQuery.png new file mode 100644 index 0000000..5ede260 Binary files /dev/null and b/QT5_Project/TestProject/image/FaultQuery.png differ diff --git a/QT5_Project/TestProject/image/FieldTestAction.png b/QT5_Project/TestProject/image/FieldTestAction.png new file mode 100644 index 0000000..c8fed05 Binary files /dev/null and b/QT5_Project/TestProject/image/FieldTestAction.png differ diff --git a/QT5_Project/TestProject/image/ParamSet.png b/QT5_Project/TestProject/image/ParamSet.png new file mode 100644 index 0000000..feb13ec Binary files /dev/null and b/QT5_Project/TestProject/image/ParamSet.png differ diff --git a/QT5_Project/TestProject/image/SwitchAction.png b/QT5_Project/TestProject/image/SwitchAction.png new file mode 100644 index 0000000..ddc38be Binary files /dev/null and b/QT5_Project/TestProject/image/SwitchAction.png differ diff --git a/QT5_Project/TestProject/image/SystemSet.png b/QT5_Project/TestProject/image/SystemSet.png new file mode 100644 index 0000000..2093ed4 Binary files /dev/null and b/QT5_Project/TestProject/image/SystemSet.png differ diff --git a/QT5_Project/ZM_4/APPWindow.py b/QT5_Project/ZM_4/APPWindow.py new file mode 100644 index 0000000..612783d --- /dev/null +++ b/QT5_Project/ZM_4/APPWindow.py @@ -0,0 +1,686 @@ +# This Python file uses the following encoding: utf-8 +import sys +import time +from PyQt5.QtWidgets import QWidget, QLineEdit +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget, QWidget, QLayout, QLabel, QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +from PyQt5 import uic +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent +from PyQt5.QtGui import QImage, QPixmap, QColor, QKeySequence +from UIFrameWork import UIFrameWork +from UIFrameWork import * +# 添加当前脚本的父级目录到 sys.path +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +from PyQt5.QtWidgets import QApplication, QMainWindow, QStackedWidget +from PyQt5.QtWidgets import QDesktopWidget + +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from print_color import * +from Shared_CODE.get_tip_prop import * + + +# 设置 UI 目录的路径 +ui_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'UI')) + + +# 页面文件,动态构建 UI 文件的路径 +uiFile_P00DeviceList = os.path.join(ui_path, "P00DeviceList.ui") +# uiFile_P01DeviceMenu = os.path.join(ui_path, "P01DeviceMenu.ui") +# uiFile_P02DataView = os.path.join(ui_path, "P02DataView.ui") +# uiFile_P03SwitchAction = os.path.join(ui_path, "P03SwitchAction.ui") +# uiFile_P04ParamSet = os.path.join(ui_path, "P04ParamSet.ui") +uiFile_P05CameraView = os.path.join(ui_path, "P05CameraView.ui") +# uiFile_P06FaultQuery = os.path.join(ui_path, "P06FaultQuery.ui") +# uiFile_P07SystemSet = os.path.join(ui_path, "P07SystemSet.ui") +uiFile_P08FieldTestAction = os.path.join(ui_path, "P08FieldTestAction.ui") +uiFile_P11LightDeviceMenu = os.path.join(ui_path, "P11LightDeviceMenu.ui") +uiFile_P12LightDataView = os.path.join(ui_path, "P12LightDataView.ui") +uiFile_P13LightSwitchAction = os.path.join(ui_path, "P13LightSwitchAction.ui") +uiFile_P14LightParamSet = os.path.join(ui_path, "P14LightParamSet.ui") +uiFile_P16LightFaultQuery = os.path.join(ui_path, "P16LightFaultQuery.ui") +uiFile_P17LightSystemSet = os.path.join(ui_path, "P17LightSystemSet.ui") +uiFile_P18LightFieldTestAction = os.path.join(ui_path, "P18LightFieldTestAction.ui") + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_CYAN = QColor("#00FFFF").name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#ECECEC").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() + +COLOR_VALUE_NORMAL_YELLOW = QColor("#F8C822").name() +COLOR_VALUE_NORMAL_BLUE = QColor("#4E76D4").name() +COLOR_VALUE_NORMAL_READ = QColor("#CE5D62").name() +COLOR_VALUE_NORMAL_GREEN = QColor("#83BF6E").name() + + + +def get_camera_id_and_canvas_id(action : str) : + camera_id = -1 + canvas_id = -1 + if "canvas" in action and "camera" in action : + action_splits = action.split("_") + for action_split_str in action_splits: + if "camera" in action_split_str: + camera_id = get_value_from_lead_value_str(action_split_str, "camera", -1) + elif "canvas" in action_split_str: + canvas_id = get_value_from_lead_value_str(action_split_str, "canvas", -1) + return camera_id, canvas_id + + +#根据回路选择摄像头url地址 +def search_camera_url(camera_id : int) : + cameral_url = None + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_camera_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_camera_id == camera_id : + cameral_url = utils.dict_or_object_get_attr(item_dict, "camera_url", None) + if cameral_url != None : + return cameral_url + return cameral_url + +menu_page_widget_list = [] + +class PageTemplate(UIFrameWork): # 页面模板类,包含各子页面公用功能 + def __init__(self, parent_window): + UIFrameWork.__init__(self) + self.parent_window : APPWindow = parent_window + + def connect_matched_camera_canvas(self) : + page_widget : UIFrameWork = self.parent_window.stack.currentWidget() + if page_widget != None : + for canvas_id in range(9) : + camera_id , face_detect = page_widget.get_canvas_prop(canvas_id) + if camera_id >= 0 : + self.parent_window.connect_camera_to_canvas(page_widget, camera_id, canvas_id, face_detect) + + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.parent_window.camera_thread_list) : + face_detect = 0 + canvas_object = self.search_canvas_object(canvas_id) + if canvas_object != None : + face_detect = get_tip_face_detection(canvas_object.statusTip()) + + camera_thread : CameraThread = self.parent_window.camera_thread_list[camera_id] + if camera_thread != None : + if not camera_thread.is_emit and is_visible: + self.show_camera_error(camera_id) + + if camera_thread.is_emit: + self.connect_camera_thread(camera_thread, canvas_id, is_visible) + self.parent_window.camera_signal.emit(camera_id) + camera_thread.face_detection = face_detect + + if hasattr(self, "CameraChioceLabel") : + # self.CameraChioceLabel.setStyleSheet("color: rgb(255, 255, 255); font-size: 50px;") + self.CameraChioceLabel.setText("回路" + str(camera_id+1)) + else: + self.show_camera_error(camera_id) + + def show_camera_error(self, camera_id) : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", f"视频流{camera_id+1}无法初始化或失去连接!") + + #定义虚函数, 进入页面时调用 + def virtual_on_page_enter(self) : + pass + + #定义虚函数, 退出页面时调用 + def virtual_on_page_leave(self) : + pass + + #重载虚函数, 切换页面时调用 + def virtual_change_to_page(self, page) : + if self.parent_window == None : + return + + self_page_widget : PageTemplate = self.parent_window.stack.currentWidget() + if self_page_widget == None : + return + + target_page_widget : PageTemplate = None + + if page >= 0 : + target_page_widget = self.parent_window.search_page_widget(page) + if target_page_widget in menu_page_widget_list: + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == None or pop_page_widget == target_page_widget: + break + else : + while len(menu_page_widget_list) > 0 : + pop_page_widget = menu_page_widget_list.pop() + if pop_page_widget == self : + continue + else : + target_page_widget = pop_page_widget + break + + if target_page_widget == None : + target_page_widget = self.parent_window.allpages_list[0] + + if target_page_widget != None : + menu_page_widget_list.append(target_page_widget) + self_page_widget.virtual_on_page_leave() + self.parent_window.stack.setCurrentWidget(target_page_widget) + target_page_widget.virtual_on_page_enter() + self.connect_matched_camera_canvas() + + def virtual_widget_action_process(self, widget : QWidget, action : str) : + action_splits = action.split("+") + page_id = -1 + circuit_id = -1 + main_index = -1 + add_circuit = -1 + binding_circuit = -1 + for action_split_str in action_splits : + if "SetPage" in action_split_str : + page_id = get_value_from_lead_value_str(action_split_str, "SetPage", -1) + elif "SetCircuit" in action_split_str : + circuit_id = get_value_from_lead_value_str(action_split_str, "SetCircuit", -1) + elif "SetMain" in action_split_str: + main_index = get_value_from_lead_value_str(action_split_str, "SetMain", -1) + elif "AddCircuit" in action_split_str : + add_circuit = get_value_from_lead_value_str(action_split_str, "AddCircuit", -1) + elif "SetBinding" in action_split_str : + binding_circuit = get_value_from_lead_value_str(action_split_str, "SetBinding", 1) + + + print("@Line:",inspect.currentframe().f_lineno,' = ',circuit_id,' = ',action_splits) + + if add_circuit >= 0 : + tip_str : str = page_widget.statusTip() + circuit_id = get_tip_circuit(tip_str) + circuit_id = circuit_id + 1 + + if binding_circuit > 0 : + circuit_id = self.get_circuit_from_object(widget) + + target_page_widget = self.parent_window.search_page_widget(page_id) + page_widget : PageTemplate = target_page_widget + + if page_id >= 0 : # 功能标记:执行页面跳转功能 + target_page_widget = self.parent_window.search_page_widget(page_id) + + if target_page_widget != None : + if circuit_id >= 0 : + target_page_widget.set_page_circuit(circuit_id) + self.virtual_change_to_page(page_id) + + if main_index >= 0 : # 功能标记:执行控件主索引设定 + self.set_menu_main_index(main_index) # 设置页面主索引字段
,可以跨组选择控件 + + if circuit_id >= 0 : + indicator : QLineEdit = target_page_widget.findChild(QLineEdit,"BindNum_Title") + indicator.setText("当前回路为 %d"%(circuit_id + 1)) + + # 显示提示图标 + # indicator_Label : QLabel = target_page_widget.findChild(QLabel,"indicator_Label") + # # tip_str : str = indicator_Label.statusTip() + # imag_file_name = get_imag_value_file_name(tip_str, circuit_id) + # if imag_file_name != None : + # self.modify_object_style_sheet(indicator_Label, "background-image", "url(%s)"%(imag_file_name)) + # else : + # self.reset_object_style_sheet(indicator_Label) + + camera_id, canvas_id = get_camera_id_and_canvas_id(action) + self.virtual_connect_canvas_to_camera(canvas_id, camera_id) + +#P00设备列表页面 +class QDeviceListPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P00DeviceList) + + +# #P01设备列表页面 +# class QDeviceMenuPage(PageTemplate): +# def __init__(self, parent_window): +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P01DeviceMenu) + +# #P02数据查看页面 +# class QDataViewPage(PageTemplate): +# def __init__(self, parent_window): +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P02DataView) + +# json_dict0 = {"Uab" :"1111", "Ubc" : "1111", "Uca" : "1111", "Uo" : "11" , "Iab" : "1111", "Ibc" : "1111", "Ica" : "1111", "Io" : "1111"} +# json_dict1 = {"Uab" :"2222", "Ubc" : "2222", "Uca" : "2222", "Uo" : "22" , "Iab" : "2222", "Ibc" : "2222", "Ica" : "2222", "Io" : "2222"} +# json_dict2 = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + +# # self.flush_widgets(0, json_dict0) +# # self.flush_widgets(1, json_dict1) +# # self.flush_widgets(2, json_dict2) + +# self.camera_str = "0" + +# def virtual_on_page_enter(self): +# children = self.findChildren(QLabel) +# for child in children: +# if child.objectName() == "TestCameraView" : +# status_str = child.statusTip() +# get_circuit = self.get_circuit_from_object(child) +# print(status_str, get_circuit) +# new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") +# self.camera_str = get_circuit +# self.parent_window.camera_signal.emit(int(get_circuit)) +# child.setStatusTip(new_status_str) + +# #P03开关操作页面 +# class QSwitchActionPage(PageTemplate): +# def __init__(self, parent_window): +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P03SwitchAction) + +# json_dict0 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} +# json_dict1 = {"SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} +# json_dict2 = {"SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED}} + +# # self.flush_widgets(0, json_dict0) +# # self.flush_widgets(1, json_dict1) +# # self.flush_widgets(2, json_dict2) + +# self.camera_str = "0" + +# def virtual_on_page_enter(self): +# children = self.findChildren(QLabel) +# for child in children: +# if child.objectName() == "TestCameraView" : +# status_str = child.statusTip() +# get_circuit = self.get_circuit_from_object(child) +# print(status_str, get_circuit) +# new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") +# self.camera_str = get_circuit +# self.parent_window.camera_signal.emit(int(get_circuit)) +# child.setStatusTip(new_status_str) + +# #P04参数设置页面 +# class QParamSetPage(PageTemplate): +# def __init__(self, parent_window): + +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P04ParamSet) + +# json_dict0 = {"Uab" :"1000", "Ubc" : "5", "Uca" : "50"} +# json_dict1 = {"Uab" :"1111", "Ubc" : "111", "Uca" : "111"} +# json_dict2 = {"Uab" :"2222", "Ubc" : "222", "Uca" : "222"} + + # self.flush_widgets(0, json_dict0) + # self.flush_widgets(1, json_dict1) + # self.flush_widgets(2, json_dict2) + +#P05视频查看页面 QFaultQueryPage +class QCameraViewPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P05CameraView) + + def virtual_on_page_enter(self) : + self.parent_window.camera_signal.emit(0) + +# #P06故障查询页面 QFaultQueryPage +# class QFaultQueryPage(PageTemplate): +# def __init__(self, parent_window): +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P06FaultQuery) +# self.alarm_index = 0 + +# def virtual_on_page_enter(self) : +# self.alarm_index = 0 +# self.query_alarm_index() +# self.timer = QTimer() +# self.timer.timeout.connect(self.query_alarm_index) +# self.timer.start(4000) + +# def virtual_on_page_leave(self) : +# self.alarm_index = 0 + +# def query_alarm_index(self): +# circuit_id = self.get_page_circuit() +# unique_name = self.get_unique_name_from_circuit(circuit_id) +# if unique_name != None : +# publish_topic = "request/alarm/" + unique_name +# publish_message = '{"index" : "%s"}'%(self.alarm_index) +# self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + +# #action 处理虚函数, 只适用于故障查询页面 +# def virtual_widget_action_process(self, widget : QWidget, action : str) : +# PageTemplate.virtual_widget_action_process(self, widget, action) +# alarm_adjust = 0 +# if "CmdAlarmNext" in action : +# alarm_adjust = 1 +# elif "CmdAlarmPrev" in action : +# alarm_adjust = -1 + +# if alarm_adjust != 0 : +# self.alarm_index = self.alarm_index + alarm_adjust +# if self.alarm_index < 0 : +# self.alarm_index = 0 +# self.query_alarm_index() + +# #P07系统参数设置页面 +# class QSystemSetPage(PageTemplate): +# def __init__(self, parent_window): + +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P07SystemSet) + +# #P08现场试验页面 +# class QFieldTestAction(PageTemplate): +# def __init__(self, parent_window): + +# PageTemplate.__init__(self, parent_window) +# self.load_window_ui(uiFile_P08FieldTestAction) + +# P11照明菜单选择 +class QLightMenuPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P11LightDeviceMenu) + +# P12照明运行数据页面 +class QRunDataPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P12LightDataView) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P13照明开关操作页面 +class QLightSwitchActionPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P13LightSwitchAction) + + self.camera_str = "0" + + def virtual_on_page_enter(self): + children = self.findChildren(QLabel) + for child in children: + if child.objectName() == "TestCameraView" : + status_str = child.statusTip() + get_circuit = self.get_circuit_from_object(child) + print(status_str, get_circuit) + new_status_str = status_str.replace(f"camera{self.camera_str}", f"camera{get_circuit}") + self.camera_str = get_circuit + self.parent_window.camera_signal.emit(int(get_circuit)) + child.setStatusTip(new_status_str) + +# P14照明参数设置页面 +class QLightParamSetPage(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P14LightParamSet) + +# P16照明故障查询 +class QLightFaultQuery(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P16LightFaultQuery) + + def virtual_on_page_enter(self) : + self.alarm_index = 0 + self.query_alarm_index() + self.timer = QTimer() + self.timer.timeout.connect(self.query_alarm_index) + self.timer.start(4000) + + def virtual_on_page_leave(self) : + self.alarm_index = 0 + + def query_alarm_index(self): + circuit_id = self.get_page_circuit() + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None : + publish_topic = "request/alarm/" + unique_name + publish_message = '{"index" : "%s"}'%(self.alarm_index) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, object, 1000) + + #action 处理虚函数, 只适用于故障查询页面 + def virtual_widget_action_process(self, widget : QWidget, action : str) : + PageTemplate.virtual_widget_action_process(self, widget, action) + alarm_adjust = 0 + if "CmdAlarmNext" in action : + alarm_adjust = 1 + elif "CmdAlarmPrev" in action : + alarm_adjust = -1 + + if alarm_adjust != 0 : + self.alarm_index = self.alarm_index + alarm_adjust + if self.alarm_index < 0 : + self.alarm_index = 0 + self.query_alarm_index() + +# P17照明系统参数 +class QLightSystemSet(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P17LightSystemSet) + +# P18现场试验页面 +class QLightFieldTestAction(PageTemplate): + def __init__(self, parent_window): + PageTemplate.__init__(self, parent_window) + self.load_window_ui(uiFile_P18LightFieldTestAction) + +class APPWindow(QMainWindow): + camera_signal = pyqtSignal(int) + def __init__(self): + super().__init__() + + # 获取屏幕分辨率 + screen = QDesktopWidget().screenGeometry() + screen_width = screen.width() + screen_height = screen.height() + + self.stack = QStackedWidget(self) + self.setGeometry(0, 0, screen_width, screen_height) # 设置窗口大小为屏幕分辨率 + self.stack.setGeometry(0, 0, screen_width, screen_height) # 设置堆叠窗口大小为屏幕分辨率 + + #调试的时候用下面两行,全屏就注释 + # self.setGeometry(0, 0, 1024, 600) + # self.stack.setGeometry(0, 0, 1024, 600) + + + + self.showFullScreen() + + self.menu_sequence_list : PageTemplate = [] + self.camera_thread_list : CameraThread = [None, None, None, None, None, None, None, None, None] + self.allpages_list : PageTemplate = [] + + self.P00_DeviceList : PageTemplate = QDeviceListPage(parent_window = self) + # self.P01_DeviceMenu : PageTemplate = QDeviceMenuPage(parent_window = self) + # self.P02_DataView : PageTemplate = QDataViewPage(parent_window = self) + # self.P03_SwitchAction : PageTemplate = QSwitchActionPage(parent_window = self) + # self.P04_ParamSet : PageTemplate = QParamSetPage(parent_window = self) + self.P05_CameraView : PageTemplate = QCameraViewPage(parent_window = self) + # self.P06_FaultQuery : PageTemplate = QFaultQueryPage(parent_window = self) + # self.P07_SystemSet : PageTemplate = QSystemSetPage(parent_window = self) + # self.P08_FieldTestAction : PageTemplate = QFieldTestAction(parent_window = self) + self.P11_DeviceMenu : PageTemplate = QLightMenuPage(parent_window = self) + self.P12_DateView : PageTemplate = QRunDataPage(parent_window = self) + self.P13_SwitchAction : PageTemplate = QLightSwitchActionPage(parent_window = self) + self.P14_ParamSet : PageTemplate = QLightParamSetPage(parent_window = self) + self.P16_LightFaultQuery : PageTemplate = QLightFaultQuery(parent_window = self) + self.P17_LightSystemSet : PageTemplate = QLightSystemSet(parent_window = self) + self.P18_LightFieldTestAction : PageTemplate = QLightFieldTestAction(parent_window = self) + + self.allpages_list.append(self.P00_DeviceList) + # self.allpages_list.append(self.P01_DeviceMenu) + # self.allpages_list.append(self.P02_DataView) + # self.allpages_list.append(self.P03_SwitchAction) + # self.allpages_list.append(self.P04_ParamSet) + self.allpages_list.append(self.P05_CameraView) + # self.allpages_list.append(self.P06_FaultQuery) + # self.allpages_list.append(self.P07_SystemSet) + # self.allpages_list.append(self.P08_FieldTestAction) + self.allpages_list.append(self.P11_DeviceMenu) + self.allpages_list.append(self.P12_DateView) + self.allpages_list.append(self.P13_SwitchAction) + self.allpages_list.append(self.P14_ParamSet) + self.allpages_list.append(self.P16_LightFaultQuery) + self.allpages_list.append(self.P17_LightSystemSet) + self.allpages_list.append(self.P18_LightFieldTestAction) + + self.stack.addWidget(self.P00_DeviceList) + # self.stack.addWidget(self.P01_DeviceMenu) + # self.stack.addWidget(self.P02_DataView) + # self.stack.addWidget(self.P03_SwitchAction) + # self.stack.addWidget(self.P04_ParamSet) + self.stack.addWidget(self.P05_CameraView) + # self.stack.addWidget(self.P06_FaultQuery) + # self.stack.addWidget(self.P07_SystemSet) + # self.stack.addWidget(self.P08_FieldTestAction) + self.stack.addWidget(self.P11_DeviceMenu) + self.stack.addWidget(self.P12_DateView) + self.stack.addWidget(self.P13_SwitchAction) + self.stack.addWidget(self.P14_ParamSet) + self.stack.addWidget(self.P16_LightFaultQuery) + self.stack.addWidget(self.P17_LightSystemSet) + self.stack.addWidget(self.P18_LightFieldTestAction) + + test_init = system_parameter() + set_screen_blanking_time(test_init.get_screen_blanking_time()) + + + def search_page_widget(self, page) : + for list_item in self.allpages_list: + window_page : UIFrameWork = list_item + if window_page.page == page : + return window_page + return None + + def connect_camera_to_canvas(self, page_widget : UIFrameWork, camera_id: int , canvas_id : int, face_detect : int = 0) : + if camera_id >= 0 and canvas_id >= 0 and canvas_id < len(self.camera_thread_list) : + camera_thread : CameraThread = self.camera_thread_list[camera_id] + if camera_thread != None : + page_widget.connect_camera_thread(camera_thread, canvas_id) + camera_thread.face_detection = face_detect + + def create_all_camera_thread(self) : + for camera_id in range(len(self.camera_thread_list)) : + _camera_url = search_camera_url(camera_id) + if _camera_url != None : + camera_thread = CameraThread(_camera_url, camera_id) + camera_thread.set_video_cycle_ms(10) + self.camera_thread_list[camera_id] = camera_thread + self.camera_signal.connect(camera_thread.change_camera_url) + + #摄像头与 界面进行绑定 + for index in range(self.stack.count()) : + page_widget : UIFrameWork = self.stack.widget(index) + page_widget.connect_matched_camera_canvas() + + time.sleep(0.1) + + #开启多个摄像头线程 + for camera_thread in self.camera_thread_list: + thread_to_start : CameraThread = camera_thread + if thread_to_start != None : + thread_to_start.start() + time.sleep(0.01) + + # def focus_do_inscrease(self) : + # self.stack.currentWidget().key_decrease_parameter() + + # def focus_do_decrease(self) : + # self.stack.currentWidget().key_increase_parameter() + + # def focus_do_action(self) : + # self.stack.currentWidget().key_enter_process() + + # def focus_do_escape(self) : + # self.stack.currentWidget().key_escape_process() + + # def focus_show_hide(self) : + # if self.float_button1.isHidden() : + # self.float_button1.show() + # self.float_button2.show() + # self.float_button3.show() + # self.float_button4.show() + # else : + # self.float_button1.hide() + # self.float_button2.hide() + # self.float_button3.hide() + # self.float_button4.hide() + + def get_page_currentwidget(self) : + return self.stack.currentWidget().sort_menu_list[self.stack.currentWidget().menu_key_index][1] + + def closeEvent(self, event): + # 在这里处理关闭事件 + # 例如,提示用户是否真的想要关闭 + reply = QMessageBox.question(self, '确认', '确定要退出吗?', + QMessageBox.Yes | QMessageBox.No) + if reply == QMessageBox.Yes: + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.close() + + for camera_thread in self.camera_thread_list: + thread_to_stop : CameraThread = camera_thread + if thread_to_stop != None : + thread_to_stop.wait() + + event.accept() # 接受关闭事件 + else: + event.ignore() # 忽略关闭事件 + + +if __name__ == '__main__': + #创建mqtt线程 + fvalue = float('06.00') + value = round(fvalue) + + _user_name = utils.dict_or_object_get_attr(group_config.mqtt_server, "user_name", "admin") + _password = utils.dict_or_object_get_attr(group_config.mqtt_server, "password", "admin") + _server = utils.dict_or_object_get_attr(group_config.mqtt_server, "remote", "127.0.0.1") + _port = utils.dict_or_object_get_attr(group_config.mqtt_server, "port", 1883) + + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = _server, port = _port, keep_alive = 60, user_name=_user_name, password=_password) + + app = QApplication([]) + app_main_window = APPWindow() + app_main_window.show() + app_main_window.create_all_camera_thread() + + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name != None : + global_mqtt_thread.add_unique_object(circuit_unique_name, app_main_window.allpages_list) + + global_mqtt_thread.start() + app.exec_() + global_mqtt_thread.close() + global_mqtt_thread.join() + + sys.exit(0) \ No newline at end of file diff --git a/QT5_Project/ZM_4/Light_image/Light_CameraView.png b/QT5_Project/ZM_4/Light_image/Light_CameraView.png new file mode 100644 index 0000000..d966815 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Light_CameraView.png differ diff --git a/QT5_Project/ZM_4/Light_image/Light_DataView.png b/QT5_Project/ZM_4/Light_image/Light_DataView.png new file mode 100644 index 0000000..a6180f9 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Light_DataView.png differ diff --git a/QT5_Project/ZM_4/Light_image/Light_DeviceMenu.png b/QT5_Project/ZM_4/Light_image/Light_DeviceMenu.png new file mode 100644 index 0000000..20778d3 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Light_DeviceMenu.png differ diff --git a/QT5_Project/ZM_4/Light_image/Light_FieldTestAction.png b/QT5_Project/ZM_4/Light_image/Light_FieldTestAction.png new file mode 100644 index 0000000..b56ab48 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Light_FieldTestAction.png differ diff --git a/QT5_Project/ZM_4/Light_image/Light_ParamSet.png b/QT5_Project/ZM_4/Light_image/Light_ParamSet.png new file mode 100644 index 0000000..6768524 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Light_ParamSet.png differ diff --git a/QT5_Project/ZM_4/Light_image/Light_SystemSet.png b/QT5_Project/ZM_4/Light_image/Light_SystemSet.png new file mode 100644 index 0000000..617e1d0 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Light_SystemSet.png differ diff --git a/QT5_Project/ZM_4/Light_image/Ligth_FaultQuery.png b/QT5_Project/ZM_4/Light_image/Ligth_FaultQuery.png new file mode 100644 index 0000000..a024eb3 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Ligth_FaultQuery.png differ diff --git a/QT5_Project/ZM_4/Light_image/Ligth_ParamSet.png b/QT5_Project/ZM_4/Light_image/Ligth_ParamSet.png new file mode 100644 index 0000000..e102722 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Ligth_ParamSet.png differ diff --git a/QT5_Project/ZM_4/Light_image/Ligth_SwitchAction.png b/QT5_Project/ZM_4/Light_image/Ligth_SwitchAction.png new file mode 100644 index 0000000..b3816a3 Binary files /dev/null and b/QT5_Project/ZM_4/Light_image/Ligth_SwitchAction.png differ diff --git a/QT5_Project/ZM_4/UI/P00DeviceList.ui b/QT5_Project/ZM_4/UI/P00DeviceList.ui new file mode 100644 index 0000000..663cef9 --- /dev/null +++ b/QT5_Project/ZM_4/UI/P00DeviceList.ui @@ -0,0 +1,934 @@ + + + P00DeviceList + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=0 + + + true + + + + + + + + + -1 + -1 + 1024 + 600 + + + + + + + ../image/DeviceList.png + + + + + + 100 + 62 + 914 + 533 + + + + + + + circuit=0, main=0 + + + border:none; + + + + + + + + 3 + 3 + 451 + 260 + + + + Index=0, Action=SetPage11+SetCircuit0+SetBinding0,SelectImag=IM00_01B.png + + + + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 238 + 9 + 211 + 62 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 146 + 176 + 300 + 35 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + Qt::AlignCenter + + + + + + 92 + 80 + 100 + 36 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(240, 201, 102); + + + + + + Qt::AlignCenter + + + + + + 318 + 80 + 100 + 36 + + + + + 黑体 + 16 + + + + OnCount, Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(144, 223, 218); + + + + + + + Qt::AlignCenter + + + + + + 92 + 126 + 100 + 36 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(220, 119, 97); + + + + + + Qt::AlignCenter + + + + + + 318 + 126 + 100 + 36 + + + + + 黑体 + 16 + + + + Ro, Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(159, 209, 141); + + + + + + Qt::AlignCenter + + + + + + 146 + 219 + 300 + 35 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + 460 + 270 + 450 + 260 + + + + canvas0=camera0, Timeout=5000 + + + + + + + + + + 558 + 62 + 457 + 266 + + + + + + + circuit=1, main=0 + + + border:none; + + + + + + + + 2 + 3 + 451 + 260 + + + + Index=1, Action=SetPage11+SetCircuit1+SetBinding1,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 238 + 9 + 211 + 62 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 146 + 176 + 300 + 35 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + Qt::AlignCenter + + + + + + 92 + 80 + 100 + 36 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(240, 201, 102); + + + + + + Qt::AlignCenter + + + + + + 318 + 80 + 100 + 36 + + + + + 黑体 + 16 + + + + OnCount, Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(144, 223, 218); + + + + + + Qt::AlignCenter + + + + + + 92 + 126 + 100 + 36 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(220, 119, 97); + + + + + + Qt::AlignCenter + + + + + + 318 + 126 + 100 + 36 + + + + + 黑体 + 16 + + + + Ro,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(159, 209, 141); + + + + + + Qt::AlignCenter + + + + + + 146 + 219 + 300 + 35 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + + 100 + 328 + 457 + 266 + + + + + + + circuit=2, main=0 + + + border:none; + + + + + + + + 3 + 3 + 451 + 260 + + + + Index=2,Action=SetPage11+SetCircuit2+SetBinding2,SelectImag=IM00_01B.png + + + background-color: rgba(0, 0, 0, 0); + + + + + + + 450 + 481 + + + + + + + 238 + 9 + 211 + 62 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + + + + 146 + 176 + 300 + 35 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + Qt::AlignCenter + + + + + + 92 + 80 + 100 + 36 + + + + + 黑体 + 16 + + + + Voltage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(240, 201, 102); + + + + + + Qt::AlignCenter + + + + + + 318 + 80 + 100 + 36 + + + + + 黑体 + 16 + + + + OnCount, Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(144, 223, 218); + + + + + + Qt::AlignCenter + + + + + + 92 + 126 + 100 + 36 + + + + + 黑体 + 16 + + + + Current,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(220, 119, 97); + + + + + + Qt::AlignCenter + + + + + + 318 + 126 + 100 + 36 + + + + + 黑体 + 16 + + + + Ro,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(159, 209, 141); + + + + + + Qt::AlignCenter + + + + + + 146 + 219 + 291 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + Qt::AlignCenter + + + + + + + 0 + 64 + 100 + 529 + + + + + + + main=1 + + + border:none; + + + + + + + + 31 + 16 + 42 + 42 + + + + Index=7, Action=SetPage5,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 100 + 10 + 431 + 61 + + + + + 15 + + + + + + + border:none; + + + + + + border:none; + + + + + + 540 + 20 + 251 + 31 + + + + + Microsoft YaHei UI + 17 + false + false + + + + System=DateTime, Action=ModifySystem, Index=8,main=1,SelectImag=SR_001.png + + + false + + + background-color: rgb(40, 40, 41); +color: rgb(231, 241, 214); +font: 17pt "Microsoft YaHei UI"; + + + 2024-5-18 13 : 14 : 59 + + + true + + + + + + + diff --git a/QT5_Project/ZM_4/UI/P05CameraView.ui b/QT5_Project/ZM_4/UI/P05CameraView.ui new file mode 100644 index 0000000..acb52b5 --- /dev/null +++ b/QT5_Project/ZM_4/UI/P05CameraView.ui @@ -0,0 +1,131 @@ + + + P05CameraView + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=5 + + + + + + + + + + + + -1 + -1 + 1024 + 600 + + + + + + + ../Light_image/Light_CameraView.png + + + + + + 0 + 60 + 60 + 391 + + + + + + + + + + border:none; + + + + + + + + 11 + 20 + 42 + 42 + + + + Index=9, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 64 + 125 + 951 + 461 + + + + canvas0=camera0, Timeout=5000 + + + + + + + + + 180 + 70 + 21 + 51 + + + + + 黑体 + 26 + + + + color: rgb(83, 106, 185); + + + 1 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + diff --git a/QT5_Project/ZM_4/UI/P11LightDeviceMenu.ui b/QT5_Project/ZM_4/UI/P11LightDeviceMenu.ui new file mode 100644 index 0000000..1f44b7c --- /dev/null +++ b/QT5_Project/ZM_4/UI/P11LightDeviceMenu.ui @@ -0,0 +1,330 @@ + + + P11DeviceMenu + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=11 + + + + + + + + + -1 + -1 + 1024 + 600 + + + + + 22 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(246, 156, 72); + + + + + + ../Light_image/Light_DeviceMenu.png + + + + + + 155 + 140 + 750 + 420 + + + + + + + main=1 + + + border:none; + + + + + + + + 117 + 28 + 256 + 61 + + + + + 黑体 + 22 + + + + Index=1,Action=SetPage12+SetBinding,SelectImag=SR_004.png + + + color: rgb(246, 156, 72); + + + 运行数据 + + + + 364 + 85 + + + + + + + 117 + 108 + 256 + 61 + + + + + 黑体 + 22 + + + + Index=2, Action=SetPage13+SetBinding,SelectImag=SR_004.png + + + color: rgb(246, 156, 72); + + + 开关操作 + + + + 364 + 85 + + + + + + + 117 + 188 + 256 + 61 + + + + + 黑体 + 22 + + + + Index=3, Action=SetPage14+SetBinding,SelectImag=SR_004.png + + + color: rgb(246, 156, 72); + + + 保护参数设置 + + + + 364 + 85 + + + + + + + 117 + 268 + 256 + 61 + + + + + 黑体 + 22 + + + + Index=4, Action=SetPage17+SetBinding,SelectImag=SR_004.png + + + color: rgb(246, 156, 72); + + + 系统参数设置 + + + + 364 + 85 + + + + + + + 398 + 28 + 256 + 61 + + + + + 黑体 + 22 + + + + Index=5, Action=SetPage16+SetBinding+CmdAlarmNext,SelectImag=SR_004.png + + + color: rgb(246, 156, 72); + + + 故障查询 + + + + 364 + 85 + + + + + + + 398 + 109 + 256 + 61 + + + + + 黑体 + 22 + + + + Index=6, Action=SetPage18+SetBinding ,SelectImag=SR_004.png + + + color: rgb(246, 156, 72); + + + 现场试验 + + + + 364 + 85 + + + + + + + + 315 + 111 + 21 + 30 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(246, 156, 72); + + + 3 + + + false + + + + + + 5 + 68 + 54 + 524 + + + + + + + main=1 + + + border:none; + + + + + + + + 7 + 13 + 40 + 40 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/ZM_4/UI/P12LightDataView.ui b/QT5_Project/ZM_4/UI/P12LightDataView.ui new file mode 100644 index 0000000..3d02c82 --- /dev/null +++ b/QT5_Project/ZM_4/UI/P12LightDataView.ui @@ -0,0 +1,868 @@ + + + P12DataView + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=12 + + + + + + 510 + 160 + 502 + 429 + + + + canvas1=camera0, Timeout=3000 + + + QFrame::NoFrame + + + + + + + + + -1 + -1 + 1024 + 600 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + ../Light_image/Light_DataView.png + + + + + false + + + + 191 + 85 + 31 + 51 + + + + + 黑体 + 36 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(220, 240, 187); + + + 3 + + + false + + + + + + 70 + 160 + 431 + 428 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 70 + 200 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uab, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 160 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ia, Timeout=5000, + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 190 + 160 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ib, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 320 + 160 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ic, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 190 + 200 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ubc, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 320 + 200 + 90 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Uca, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 133 + 4 + 291 + 83 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 204 + 240 + 80 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + OnCount, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 70 + 240 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + Ro, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + Qt::AlignCenter + + + true + + + + + + 240 + 304 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + B1_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 130 + 304 + 60 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + A1_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 130 + 340 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + A2_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 350 + 340 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + C2_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 350 + 304 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + C1_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 240 + 340 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + B2_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 350 + 377 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + C3_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 130 + 377 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + A3_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + + 240 + 377 + 61 + 25 + + + + + Arial + 14 + + + + Qt::NoFocus + + + B3_down, Timeout=5000 + + + color: rgb(177, 229, 252); + + + 0 + + + false + + + Qt::AlignCenter + + + true + + + + + false + + + + 126 + 96 + 300 + 35 + + + + + 黑体 + 16 + + + + false + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); + + + + + + Qt::AlignCenter + + + + + + + 5 + 60 + 55 + 140 + + + + + + + main=1 + + + border:none; + + + + + + + + 5 + 78 + 42 + 42 + + + + Index=0, Action=SetPage11,SelectImag=IMxx_00D.png,groupend=2 + + + + + + + 72 + 144 + + + + + + + 5 + 20 + 42 + 42 + + + + Index=1, Action=SetPage0,SelectImag=IMxx_00D.png, groupstart=2 + + + + + + + 72 + 144 + + + + + P12BG + TestCameraView + BindNum_Title + groupBox + groupBox_sys + + + + + diff --git a/QT5_Project/ZM_4/UI/P13LightSwitchAction.ui b/QT5_Project/ZM_4/UI/P13LightSwitchAction.ui new file mode 100644 index 0000000..d207ad1 --- /dev/null +++ b/QT5_Project/ZM_4/UI/P13LightSwitchAction.ui @@ -0,0 +1,406 @@ + + + P13SwitchAction + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=13 + + + + + + -1 + -1 + 1024 + 600 + + + + + + + + + + ../Light_image/Ligth_SwitchAction.png + + + + + + 5 + 60 + 55 + 140 + + + + + + + main=1 + + + border:none; + + + + + + + + 5 + 78 + 42 + 42 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 5 + 20 + 42 + 42 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 140 + 100 + 761 + 491 + + + + + + + main=1 + + + border:none; + + + + + + + + 570 + 41 + 170 + 52 + + + + SwitchOn,Index=2,Action=CmdExecute, SelectImag=SR_002.png, groupstart=6 + + + + + + + 72 + 72 + + + + + + + 570 + 98 + 170 + 52 + + + + SwitchOff,Index=3,Action=CmdExecute, SelectImag=SR_002.png + + + + + + + 72 + 72 + + + + + + + 248 + 23 + 291 + 83 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM03_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 570 + 153 + 170 + 52 + + + + SwitchOff,Index=4,Action=CmdExecute, SelectImag=SR_002.png + + + + + + + 72 + 72 + + + + + + + 250 + 112 + 281 + 41 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 570 + 432 + 170 + 52 + + + + Index=7, Action=SetPage11,SelectImag=SR_002.png, groupend=6 + + + + + + + 72 + 144 + + + + + + + 12 + 197 + 528 + 285 + + + + canvas0=camera0, Timeout=5000 + + + QFrame::Box + + + + + + + + + 250 + 163 + 281 + 31 + + + + + 黑体 + 16 + + + + CarPositionMsg,Timeout=5000 + + + background-color: rgba(255, 255, 255,0); +color: rgb(255, 170, 0); + + + + + + + + + 570 + 320 + 170 + 52 + + + + CarRetreat,Index=6,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + 570 + 262 + 170 + 52 + + + + CarForward,Index=5,Action=CmdExecute, SelectImag=SR_001.png + + + + + + + 72 + 72 + + + + + + + false + + + + 214 + 70 + 31 + 41 + + + + + 黑体 + 26 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(154, 188, 241); + + + + + + false + + + Qt::AlignCenter + + + + + + + diff --git a/QT5_Project/ZM_4/UI/P14LightParamSet.ui b/QT5_Project/ZM_4/UI/P14LightParamSet.ui new file mode 100644 index 0000000..9ad52fb --- /dev/null +++ b/QT5_Project/ZM_4/UI/P14LightParamSet.ui @@ -0,0 +1,1734 @@ + + + P14ParamSet + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=14 + + + + + + 63 + 63 + 237 + 533 + + + + + + + main=10 + + + border:none; + + + + + + + + 138 + 76 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateCurrent, Action=Modify, Index=1, Caption=额定电流,Timeout=5000, SelectImag=P4_ParaSelect.png, groupstart=15 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 104 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortLevel, Action=Modify, Index=2 , Caption=短路倍数, Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 132 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortDelay, Action=Modify, Index=3, Format=%03.0f, Caption=短路延时,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 160 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentIs, Action=Modify, Index=4, Caption=信号Ie, Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 188 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ShortIs, Action=Modify, Index=5, Caption=信号短路倍数, Format=%05.2f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 216 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIs, Action=Modify, Index=6, Caption=Is 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 244 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Sensor, Index=7, Alias=alias_sensor, Action=Modify, Caption=互感器类型, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 272 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CurrentB, Index=8, Alias=alias_current, Action=Modify, Caption=B相电流, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 356 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrent, Action=Modify, Index=11, Caption=定时限过流,Format=%01.2f,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 384 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + TimeOvercurrentDelay, Action=Modify, Index=12, Caption=定时限过流延时, Format=%05.0f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 412 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIa, Action=Modify, Index=13, Caption=Ia 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 300 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceDelay, Action=Modify, Index=9, Format=%04.1f, Caption=不平衡延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 328 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + UnbalanceLevel, Action=Modify, Index=10, Format=%03.0f, Caption=不平衡范围, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 440 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIb, Action=Modify, Index=14, Caption=Ib 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 470 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectIc, Action=Modify, Index=15, Caption=Ic 校正, Format=%05.1f, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=15 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 303 + 63 + 237 + 533 + + + + + + + main=11 + + + border:none; + + + + + + + + 138 + 76 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + RateVoltage, Action=Modify, Index=1, Alias=alias_voltage, Caption=额定电压,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 104 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayLowVoltage, Action=Modify, Index=2, Format=%05.1f, Caption=欠压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 132 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentLowVoltage, Action=Modify, Index=3, Format=%05.1f, Caption=欠压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 160 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + DelayHighVoltage, Action=Modify, Index=4, Format=%05.2f, Caption=过压延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 188 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + PercentHighVoltage, Action=Modify, Index=5, Format=%05.1f, Caption=过压比值, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 216 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUa, Action=Modify, Index=6, Format=%05.1f, Caption=Ua校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 244 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUb, Action=Modify, Index=7, Format=%05.1f, Caption=Ub校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 272 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUc, Action=Modify, Index=8, Format=%05.1f, Caption=Uc校正, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 300 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CorrectUs, Action=Modify, Index=9, Format=%05.1f, Caption=Us校正, Timeout=5000,SelectImag=P4_ParaSelect.png,groupend=9 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 544 + 63 + 237 + 533 + + + + + + + main=12 + + + border:none; + + + + + + + + 138 + 76 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + BlockResistor, Action=Modify, Index=1, Format=%05.1f, Caption=闭锁电阻,Timeout=5000,SelectImag=P4_ParaSelect.png,groupstart=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 104 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + SeriesResistor, Action=Modify, Index=2, Format=%05.1f, Caption=串联电阻,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 132 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + LeakageDelay, Action=Modify, Index=3, Format=%03.0f, Caption=漏电延时,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=3 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 782 + 63 + 237 + 533 + + + + + + + main=13 + + + border:none; + + + + + + + + 138 + 132 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectCurrentPhaseOff, Index=3, Alias=alias_bool, Action=Modify, Caption=电流断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 104 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverLoad, Index=2, Alias=alias_bool, Action=Modify, Caption=过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 216 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitOverload, Index=6, Alias=alias_bool, Action=Modify, Caption=定时限过载保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 160 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectImbalance, Index=4, Alias=alias_bool, Action=Modify, Caption=不平衡保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 188 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakage, Index=5, Alias=alias_bool, Action=Modify, Caption=漏电闭锁保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 244 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTimeLimitShortCircuit, Index=7, Alias=alias_bool, Action=Modify, Caption=定时限短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 272 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectIsShort, Index=8, Alias=alias_bool, Action=Modify, Caption=信号短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 300 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectUnderVoltage, Index=9, Alias=alias_bool, Action=Modify, Caption=欠压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 328 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectOverVoltage, Index=10, Alias=alias_bool, Action=Modify, Caption=过压保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 356 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectVoltagePhaseOff, Index=11, Alias=alias_bool, Action=Modify, Caption=电压断相保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 384 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectLeakageAction, Index=12, Alias=alias_bool, Action=Modify, Caption=漏电动作保护,SelectImag=P4_ParaSelect.png, Timeout=5000 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 76 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectShort, Index=1, Alias=alias_bool, Action=Modify, Caption=短路保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupstart=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 412 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + ProtectTemperatureAlarm, Index=13, Alias=alias_bool, Action=Modify, Caption=温度报警保护,SelectImag=P4_ParaSelect.png, Timeout=5000, groupend=13 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + Protect_1 + Protect_3 + Protect_2 + Protect_6 + Protect_4 + Protect_5 + Protect_7 + Protect_8 + Protect_9 + Protect_10 + Protect_11 + Protect_12 + Protect_13 + + + + + 0 + 0 + 1024 + 600 + + + + + + + + + + border:none; + + + + + + + + 303 + 65 + 235 + 526 + + + + Index=4, Action=SetMain11,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 543 + 65 + 235 + 526 + + + + Index=5, Action=SetMain12,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 783 + 65 + 235 + 526 + + + + groupend=4,Index=6, Action=SetMain13,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 425 + 15 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(170, 170, 255); + + + 当前设备 + + + false + + + + + + 63 + 65 + 235 + 526 + + + + groupstart=4,Index=3, Action=SetMain10,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 11 + 80 + 42 + 42 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 11 + 139 + 42 + 42 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + sys_P00_5 + sys_P00_4 + sys_P00_3 + sys_P00_2 + BindNum_Title + sys_home_2 + sys_menu_2 + + + + + -1 + -1 + 1024 + 600 + + + + + + + ../Light_image/Ligth_ParamSet.png + + + P04BG + groupBox + groupBox_2 + groupBox_3 + groupBox_4 + groupBox_sys_2 + + + + + diff --git a/QT5_Project/ZM_4/UI/P16LightFaultQuery.ui b/QT5_Project/ZM_4/UI/P16LightFaultQuery.ui new file mode 100644 index 0000000..b4c881c --- /dev/null +++ b/QT5_Project/ZM_4/UI/P16LightFaultQuery.ui @@ -0,0 +1,586 @@ + + + P16FaultQuery + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=16 + + + + + + + + + + + + -1 + -1 + 1024 + 600 + + + + + + + ../Light_image/Ligth_FaultQuery.png + + + + + + 254 + 190 + 541 + 341 + + + + + + + main=2 + + + border:none; + + + + + + + + 3 + 283 + 170 + 52 + + + + Index=2,Action=CmdAlarmPrev, SelectImag=SR_002.png, groupstart=3 + + + + + + + 72 + 72 + + + + + + + 183 + 283 + 170 + 52 + + + + Index=3,Action=CmdAlarmNext, SelectImag=SR_002.png + + + + + + + 72 + 72 + + + + + + false + + + + 140 + 58 + 391 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + .. + + + false + + + + + false + + + + 140 + 15 + 391 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(160, 206, 226); + + + ... + + + false + + + + + false + + + + 140 + 102 + 391 + 31 + + + + + 黑体 + 16 + + + + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 122, 107); + + + ... + + + false + + + + + + 364 + 283 + 170 + 52 + + + + Index=4, Action=SetPage11, SelectImag=SR_002.png, groupend=3 + + + + + + + 72 + 144 + + + + + + + + 250 + 350 + 550 + 100 + + + + + + + border:none; +background-color: rgba(255, 255, 255,0); + + + + + + + + 170 + 11 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUb, Timeout=5000 + + + color: rgb(227, 183, 33); + + + . + + + Qt::AlignCenter + + + true + + + + + + 40 + 11 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUa, Timeout=5000 + + + color: rgb(227, 183, 33); + + + 12554 + + + false + + + Qt::AlignCenter + + + true + + + + + + 40 + 65 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIa, Timeout=5000 + + + color: rgb(117, 167, 98); + + + . + + + false + + + Qt::AlignCenter + + + true + + + + + + 170 + 65 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIb, Timeout=5000 + + + color: rgb(117, 167, 98); + + + . + + + Qt::AlignCenter + + + true + + + + + + 310 + 11 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmUc, Timeout=5000 + + + color: rgb(227, 183, 33); + + + . + + + Qt::AlignCenter + + + true + + + + + + 310 + 65 + 81 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmIc, Timeout=5000 + + + color: rgb(117, 167, 98); + + + . + + + Qt::AlignCenter + + + true + + + + + + 440 + 11 + 71 + 23 + + + + + Arial + 14 + + + + Qt::NoFocus + + + AlarmRo, Timeout=5000 + + + color: rgb(60, 82, 136); + + + . + + + Qt::AlignCenter + + + true + + + + + + + 5 + 60 + 55 + 140 + + + + + + + main=1 + + + border:none; + + + + + + + + 5 + 78 + 42 + 42 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 7 + 20 + 42 + 42 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + 378 + 122 + 31 + 51 + + + + + 黑体 + 36 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(255, 122, 107); + + + 3 + + + false + + + + + + + diff --git a/QT5_Project/ZM_4/UI/P17LightSystemSet.ui b/QT5_Project/ZM_4/UI/P17LightSystemSet.ui new file mode 100644 index 0000000..fe1b240 --- /dev/null +++ b/QT5_Project/ZM_4/UI/P17LightSystemSet.ui @@ -0,0 +1,792 @@ + + + P17SystemSet + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=17 + + + + + + 63 + 63 + 237 + 533 + + + + + + + main=14 + + + border:none; + + + + + + + + 138 + 300 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Temperature, Action=Modify, Index=9, Format=%03.0f, Caption=温度设定,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 78 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Gas, Action=Modify, Index=1, Alias=alias_input, Caption=瓦斯触点,Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=11 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 104 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasDelay, Action=Modify, Index=2, Format=%06.2f, Caption=瓦斯延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 133 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + GasConcentration, Action=Modify, Index=3, Format=%05.2f, Caption=瓦斯浓度, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 161 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + Fan, Action=Modify, Index=4, Alias=alias_input, Caption=风电触点,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 189 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FanDelay, Action=Modify, Index=5, Format=%06.2f, Caption=风电延时, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 218 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + FarAndNearMode, Action=Modify, Index=6, Alias=alias_remote, Caption=远近控模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 245 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + MaintenanceMode, Action=Modify, Index=7, Alias=alias_bool, Caption=维修模式,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 357 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=ScreenBlankingTime, Action=ModifySystem, Index=11,SelectImag=P4_ParaSelect.png, password, groupend=11 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 328 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + System=SystemPassWord, Action=ModifySystem, Index=10,SelectImag=P4_ParaSelect.png, password + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + **** + + + QLineEdit::Password + + + Qt::AlignCenter + + + false + + + + + + 138 + 273 + 89 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CarAlarmDelay, Action=Modify, Index=8, Caption=小车报警延时,Timeout=5000, Format=%05.1f, SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 303 + 63 + 237 + 533 + + + + + + + main=15 + + + border:none; + + + + + + + + 138 + 76 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Address, Action=Modify, Index=1, Format=%03.0f, Caption=485地址, Timeout=5000,SelectImag=P4_ParaSelect.png, groupstart=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 104 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Baud, Action=Modify, Index=2, Alias=alias_baud, Caption=485波特率,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 132 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + 485Parity, Action=Modify, Index=3, Alias=alias_parity, Caption=485校验,Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 160 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANAddress, Action=Modify, Index=4, Format=%03.0f, Caption=CAN地址, Timeout=5000,SelectImag=P4_ParaSelect.png + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + 138 + 188 + 92 + 28 + + + + + Arial + 16 + + + + Qt::NoFocus + + + CANBaud, Action=Modify, Index=5, Alias=alias_can_baud, Caption=CAN波特率,Timeout=5000,SelectImag=P4_ParaSelect.png, groupend=5 + + + background-color: rgba(85, 170, 127,0); +color: rgb(255, 170, 127); + + + 0 + + + Qt::AlignCenter + + + false + + + + + + + 0 + 0 + 1024 + 600 + + + + + + + + + + border:none; + + + + + + + + 303 + 65 + 235 + 526 + + + + groupend=2,Index=3, Action=SetMain15,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 63 + 65 + 235 + 526 + + + + groupstart=2,Index=2, Action=SetMain14,SelectImag=IM04_00.png + + + + + + + 450 + 876 + + + + + + + 11 + 80 + 42 + 42 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 11 + 139 + 42 + 42 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 425 + 15 + 331 + 31 + + + + + 黑体 + 20 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(170, 170, 255); + + + 当前设备 + + + false + + + sys_P00_2 + sys_P00_3 + sys_home + sys_menu + BindNum_Title + + + + + -1 + -1 + 1024 + 600 + + + + + + + ../Light_image/Light_SystemSet.png + + + P07BG + groupBox + groupBox_2 + groupBox_sys_2 + + + + + diff --git a/QT5_Project/ZM_4/UI/P18LightFieldTestAction.ui b/QT5_Project/ZM_4/UI/P18LightFieldTestAction.ui new file mode 100644 index 0000000..4b54767 --- /dev/null +++ b/QT5_Project/ZM_4/UI/P18LightFieldTestAction.ui @@ -0,0 +1,311 @@ + + + P18FieldTestAction + + + + 0 + 0 + 1024 + 600 + + + + MainWindow + + + Page=18 + + + + + + -1 + -1 + 1024 + 600 + + + + + + + ../Light_image/Light_FieldTestAction.png + + + + + false + + + + 378 + 125 + 31 + 51 + + + + + 黑体 + 36 + + + + background-color: rgba(255, 238, 254,0); +color: rgb(143, 188, 109); + + + 3 + + + false + + + + + + 259 + 200 + 541 + 341 + + + + + + + main=1 + + + border:none; + + + + + + + + 48 + 176 + 170 + 52 + + + + TestShort,Index=2,Action=CmdExecute, SelectImag=SR_002.png, groupstart=4 + + + + + + + 72 + 72 + + + + + + + 48 + 250 + 170 + 52 + + + + TestIsolation,Index=3,Action=CmdExecute, SelectImag=SR_002.png + + + + + + + 72 + 72 + + + + + + + 306 + 176 + 170 + 52 + + + + TestRecover,Index=4,Action=CmdExecute, SelectImag=SR_002.png + + + + + + + 72 + 72 + + + + + + + 223 + 112 + 250 + 31 + + + + + 黑体 + 16 + + + + AlarmMessage,Timeout=5000 + + + background-color: rgba(255, 238, 254,0); +color: rgb(207, 0, 13); + + + + + + Qt::AlignCenter + + + + + + 260 + 37 + 211 + 62 + + + + + Arial + 12 + + + + SwitchStatus, ImageValue=IM00_SwitchStatus_%d.png, Timeout=5000 + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + + + Qt::AlignCenter + + + + + + 306 + 250 + 170 + 52 + + + + Index=5, Action=SetPage11,SelectImag=SR_002.png, groupend=4 + + + + + + + 72 + 144 + + + + + + + + 5 + 60 + 55 + 140 + + + + + + + main=1 + + + border:none; + + + + + + + + 5 + 78 + 42 + 42 + + + + Index=1, Action=SetPage11,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + 7 + 20 + 42 + 42 + + + + Index=0, Action=SetPage0,SelectImag=IMxx_00D.png + + + + + + + 72 + 144 + + + + + + + + + diff --git a/QT5_Project/ZM_4/UIFrameWork.py b/QT5_Project/ZM_4/UIFrameWork.py new file mode 100644 index 0000000..1b9eae9 --- /dev/null +++ b/QT5_Project/ZM_4/UIFrameWork.py @@ -0,0 +1,1623 @@ +# This Python file uses the following encoding: utf-8 +import sys +import os +import time +import inspect +import cv2 +import json +from itertools import chain +from PyQt5 import uic +from PyQt5.QtGui import QImage, QPixmap, QColor,QBrush, QKeySequence, QIcon, QPalette +from PyQt5.QtCore import Qt, QThread, pyqtSignal, QObject, QRunnable, QMutex, QTimer, QEvent, QSize, QDateTime +from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget, QLayout, QLabel +from PyQt5.QtWidgets import QLineEdit, QPushButton, QMessageBox, QShortcut, QDialog +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from Shared_CODE.CameraThread import CameraThread +import menu_utils as utils +import uart_group_config as group_config +from mqtt_device import class_comm_mqtt_thread, class_comm_mqtt_interface +from Shared_CODE.DialogModifyValue import DialogModifyValue +from Shared_CODE.DialogModifyAlias import DialogModifyAlias +from Shared_CODE.DialogModifyText import DialogModifyText +from Shared_CODE.DialogInform import DialogInform +from Shared_CODE.get_tip_prop import * +from print_color import * +import time +from PyQt5.QtCore import QDateTime +import re +from datetime import datetime +import platform +import subprocess + + +# sys.path.append(sys.path[0] + "/../..") +# sys_path = sys.path[0].replace("\\", "/") + + +# 设置 img 目录的路径 +img_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'background')) + + +COLOR_RED = QColor("#EE2D2D").name() +COLOR_GREEN = QColor(Qt.green).name() +COLOR_BLUE = QColor(Qt.blue).name() +COLOR_CYAN = QColor("#00FFFF").name() +COLOR_YELLOW = QColor(Qt.yellow).name() + +COLOR_NORMAL = QColor("#000000").name() +COLOR_ALARM_NORMAL = QColor("#31D19E").name() +COLOR_ALARM_ERROR_TEXT = QColor("#B1E5FC").name() +COLOR_ALARM_ERROR_BG = QColor("#E17176").name() +COLOR_VALUE_NORMAL = QColor("#31D19E").name() + +ALIAS_QUERY_NONE = 0 +ALIAS_QUERY_WAIT_RESPOINSE = 1 + + + + +def is_linux(): + return platform.system() == 'Linux' + +def set_system_time(year, month, day, hour, minute, second): + if is_linux(): + try: + new_time = datetime(year, month, day, hour, minute, second).strftime("%Y-%m-%d %H:%M:%S") + subprocess.run(f'sudo timedatectl set-time "{new_time}"', shell=True, check=True) + print(f"System time updated to {new_time}") + except subprocess.CalledProcessError as e: + print(f"Failed to update system time: {e}") + else: + import ctypes + import ctypes.wintypes + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + TIME_ZONE_ID_DAYLIGHT = 2 + + class SYSTEMTIME(ctypes.Structure): + _fields_ = [ + ("wYear", ctypes.wintypes.WORD), + ("wMonth", ctypes.wintypes.WORD), + ("wDayOfWeek", ctypes.wintypes.WORD), + ("wDay", ctypes.wintypes.WORD), + ("wHour", ctypes.wintypes.WORD), + ("wMinute", ctypes.wintypes.WORD), + ("wSecond", ctypes.wintypes.WORD), + ("wMilliseconds", ctypes.wintypes.WORD), + ] + + system_time = SYSTEMTIME() + ctypes.windll.kernel32.GetSystemTime(ctypes.byref(system_time)) + + system_time.wYear = year + system_time.wMonth = month + system_time.wDay = day + system_time.wHour = hour + system_time.wMinute = minute + system_time.wSecond = second + ctypes.windll.kernel32.SetSystemTime(ctypes.byref(system_time)) + print(f"System time updated to {year}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}") + +def set_screen_blanking_time(minutes): + """ + 设置屏幕黑屏时间:param minutes: 屏幕黑屏时间,以分钟为单位 + """ + if is_linux(): + # 如果是 Linux 系统,使用 xfconf-query 命令设置 Xfce 的屏幕黑屏时间 + try: + # Xfce 的屏幕黑屏时间是以秒为单位 + seconds = int(minutes) * 60 + subprocess.run([ + 'xfconf-query', '-c', 'xfce4-power-manager', + '-p', '/xfce4-power-manager/blank-on-ac', + '-s', str(seconds), '-t', 'int', '--create' + ], check=True) + print(f"Xfce屏幕黑屏时间设置为 {minutes} 分钟") + except subprocess.CalledProcessError as e: + print(f"设置Xfce屏幕黑屏时间失败: {e}") + except FileNotFoundError: + print("xfconf-query 命令未找到,请确保已安装 xfce4-power-manager。") + elif platform.system() == 'Windows': + # 如果是 Windows 系统,使用 powercfg 命令设置屏幕黑屏时间 + try: + # 设置交流电源时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-ac', str(minutes)], check=True) + # 设置电池供电时的屏幕黑屏时间 + subprocess.run(['powercfg', '-change', '-monitor-timeout-dc', str(minutes)], check=True) + print(f"屏幕黑屏时间设置为 {minutes} 分钟 (适用于交流电和电池供电)") + except subprocess.CalledProcessError as e: + print(f"设置屏幕黑屏时间失败: {e}") + else: + print("当前操作系统不支持此操作。") + + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + else : + json_dict = json.loads(message) + return json_dict + +def modify_style_sheet(type_name : str, origin_style_sheet : str, lead_str : str, value_str : str) : + if len(value_str) == 0 : + new_style_items = "" + else : + new_style_items = "%s:%s;"%(lead_str, value_str) + style_splits = origin_style_sheet.split("{") + if len(style_splits) == 1 : + style_items_str = style_splits[0] + elif len(style_splits) == 2 : + style_items_str = style_splits[1] + else : + style_items_str = "" + style_items_str = style_items_str.replace("}", "") + + prop_splits = style_items_str.split(";") + for each_style_prop in prop_splits : + if lead_str in each_style_prop : + key_value_splits = each_style_prop.split(":") + cmp_str = key_value_splits[0] + cmp_str = cmp_str.replace(" ", "") + cmp_str = cmp_str.replace("\n", "") + if lead_str == cmp_str : + continue + + if len(each_style_prop) > 0 : + new_style_items += each_style_prop + new_style_items += ";" + + if len(type_name) == 0: + return "%s"%(new_style_items) + else : + return "%s {%s}"%(type_name, new_style_items) + +def get_key_combine_str(str1, str2) : + return str1 + "," + str2 + +def search_circuit_from_topic(topic : str) : + circuit_id = -1 + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + if circuit_unique_name in topic : + circuit_id = config_circuit_id + break + if circuit_id >= 0 : + break + return circuit_id + +def get_imag_value_file_name(tip_str : str, value : int) : + file_name = get_tip_value_str(tip_str, "ImageValue", default_string = None) + try : + if isinstance(value, str) : + fvalue = float(value) + value_id = round(fvalue) + else : + value_id = value + except Exception as e : + return None + + if file_name != None : + file_name_with_value = file_name%(value_id) + imag_value_file_name = os.path.join(img_path, file_name_with_value) + else : + imag_value_file_name = None + + if imag_value_file_name != None : + if os.path.exists(imag_value_file_name) : + return imag_value_file_name.replace("\\", "/") + return None + +def get_imag_file_name(tip_str : str, key_imag : str, default_string = None) : + file_name = get_tip_value_str(tip_str, key_imag, default_string) + select_image_file_name = None + if file_name != None : + select_image_file_name = os.path.join(img_path, file_name) + if os.path.exists(select_image_file_name) : + return select_image_file_name.replace("\\", "/") + return None + +def get_select_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectImag", default_string = None) + +def get_select_icon_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "SelectIcon", default_string = None) + +def get_bk_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageBackGround", default_string = None) + +def get_indicator_imag_file_name(tip_str : str) : + return get_imag_file_name(tip_str, "ImageIndicator", default_string = None) + +def get_compare_index(main_index : int, sub_index : int) : + return (main_index + 1) * 64 + sub_index + +class UIFrameWork(QMainWindow, class_comm_mqtt_interface): + mqtt_signal : pyqtSignal = pyqtSignal(str) + + def __init__(self): + QMainWindow.__init__(self) + self.topic_message_list : list = [] + self.mutex : QMutex = QMutex() + + + self.mqtt_signal.connect(self.mqtt_topic_message_process) + self.menu_list = [] + self.sort_menu_list = [] + self.menu_key_index = 0 + self.key_active = 0 + self.select_object : QWidget = None + self.wait_response_list = [] + self.mqtt_thread : class_comm_mqtt_thread= None + + self.mqtt_value_dict = {} + + self.widget_timeout_list = [] + + self.alias_dict = {} + self.alias_query_timer : QTimer = None + + self.alias_query_timer = QTimer() + self.alias_query_timer.timeout.connect(self.process_alias_query) + self.alias_query_timer.start(3000) + + self.video_visible_timer = QTimer() + self.video_visible_timer.timeout.connect(self.video_visible_timeout) + self.video_visible_timer.start(200) + + self.time_timer = QTimer() + self.time_timer.timeout.connect(self.flush_system_cycle) + self.time_timer.start(500) + + self.canvas_visible_arr = [ + False, + False, + False, + False, + False, + False, + False, + False, + False, + ] + + # QLabel list_index CameraThread + # self.canvas_label_list : QLabel = [ [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None],[None, -1, None], [None, -1, None], [None, -1, None], + # [None, -1, None] + # ] + # self.set_video_image_func_arr = [self.set_video_image_0, self.set_video_image_1, self.set_video_image_2, self.set_video_image_3, + # self.set_video_image_4, self.set_video_image_5, self.set_video_image_6, self.set_video_image_7, + # self.set_video_image_8 + # ] + + # 使用列表推导式动态生成 canvas_label_list + self.canvas_label_list = [[None, -1, None] for _ in range(9)] + # 使用列表推导式动态生成 set_video_image_func_arr + self.set_video_image_func_arr = [getattr(self, f'set_video_image_{i}') for i in range(9)] + + self.page = -1 + self.select_main_index = -1 + self.exist_circuit_mask = 0 + + self.check_widget_timeout_timer : QTimer = None + + QShortcut(QKeySequence(Qt.Key_Up), self, activated=self.key_decrease_parameter) + QShortcut(QKeySequence(Qt.Key_Down), self, activated=self.key_increase_parameter) + QShortcut(QKeySequence(Qt.Key_PageDown), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_PageUp), self, activated=self.key_escape_process) + + QShortcut(QKeySequence(Qt.Key_End), self, activated=self.key_enter_process) + QShortcut(QKeySequence(Qt.Key_Home), self, activated=self.key_escape_process) + + # QShortcut(QKeySequence(Qt.Key_0), self, activated=self.key_Test_process0) + # QShortcut(QKeySequence(Qt.Key_1), self, activated=self.key_Test_process1) + # QShortcut(QKeySequence(Qt.Key_2), self, activated=self.key_Test_process2) + # QShortcut(QKeySequence(Qt.Key_3), self, activated=self.key_Test_process3) + self.bind_channel = -1 + + #虚函数, 切换到本页面时调用 + def virtual_on_page_enter(self) : + pass + + #虚函数, 退出到本页面时调用 + def virtual_on_page_leave(self) : + pass + + #虚函数, 切换到页面, 需要在派生类中实现, page=-1表示退出到上一级菜单 + def virtual_change_to_page(self, page) : + pass + + #虚函数, 画布连接到摄像头, 需要在派生类中实现。 + def virtual_connect_canvas_to_camera(self, canvas_id : int, camera_id : int, is_visible : bool = True) : + pass + + #虚函数, action处理函数, 派生类可以额外处理 + def virtual_widget_action_process(self, widget : QObject, action : str) : + return + + def set_mqtt_value(self, circuit : int, mqtt_name : str, mqtt_value) : + key = f'{circuit}+{mqtt_name}' + self.mqtt_value_dict[key] = mqtt_value + + def get_mqtt_value(self, circuit : int, mqtt_name : str) : + key = f'{circuit}+{mqtt_name}' + if key in self.mqtt_value_dict.keys() : + return self.mqtt_value_dict[key] + return None + + def modify_object_style_sheet(self, object :QWidget, lead_str : str, value_str : str) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.styleSheet() + new_style_sheet = modify_style_sheet(object_type_name, origin_style, lead_str, value_str) + object.setStyleSheet(new_style_sheet) + + def reset_object_style_sheet(self, object :QWidget) : + meta_object = object.metaObject() + className = meta_object.className() + object_name : str = object.objectName() + object_type_name = className + "#" + object_name + origin_style = object.whatsThis() + object.setStyleSheet(origin_style) + + def load_window_ui(self, file_window_ui : str) : + if os.path.exists(file_window_ui): + uic.loadUi(file_window_ui, self) + self.load_resource_bitmap() + self.create_menu_list() + self.sort_menu_list = sorted(self.menu_list, key=lambda x: x[0]) + self.create_style_sheet_backup() + self.create_timeout_list() + self.create_alias_list() + self.update_window_circuit_mask() + self.exist_circuit_mask = self.get_circuit_mask() + self.check_widget_timeout_timer : QTimer = QTimer() + self.check_widget_timeout_timer.timeout.connect(self.process_widget_timeout_list) + self.check_widget_timeout_timer.start(100) + self.page = get_tip_page(self.statusTip()) + self.menu_selectable_object_flush() + + def get_circuit_mask(self, child_widget : QWidget = None) : + widget :QWidget = child_widget + if widget == None : + widget = self + circuit_id_mask = 0 + + for each_object in widget.children(): + child : QWidget = each_object + if hasattr(child, "statusTip") : + circuit_id = self.get_circuit_from_object(child) + if circuit_id >= 0 : + circuit_id_mask |= (0x01 << circuit_id) + circuit_id_mask |= self.get_circuit_mask(child) + return circuit_id_mask + + def update_window_circuit_mask(self) : + self.exist_circuit_mask = self.get_circuit_mask() + return + + def set_menu_main_index(self, main_index) : + self.main_index = main_index + if len(self.sort_menu_list) == 0 : + return + if self.main_index < 0 : + self.menu_key_index = 0 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + return + menu_key_index = 0 + for each_item in self.sort_menu_list : + compare_index = each_item[0] + if compare_index >= get_compare_index(main_index, 0) : + break + menu_key_index += 1 + self.menu_key_index = menu_key_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def process_alias_query(self): + if not self.mqtt_thread: + return # 如果没有 MQTT 线程,直接返回 + + for alias_unique_name, alias_value_dict in self.alias_dict.items(): # {"xxxxx,sss": 123} + if not isinstance(alias_value_dict, int) or alias_value_dict != ALIAS_QUERY_NONE: + continue # 仅处理需要查询的整数别名 + + alias_name, uniqe_name = alias_unique_name.split(",") + + # 初始化 select_object 变量 + select_object: QWidget = None + + # 将别名的值设置为等待响应状态 + self.alias_dict[alias_unique_name] = ALIAS_QUERY_WAIT_RESPOINSE + + # 发布 MQTT 消息并等待响应 + self.mqtt_publish_and_wait_response( + f"request/alias/{uniqe_name}", + json.dumps({"name": alias_name}), + select_object, + 2000, + False + ) + + def process_widget_timeout_list(self) : + list_index = 0 + for timeout_items in self.widget_timeout_list: + time_limit = timeout_items[0] + cur_time = timeout_items[1] + cur_time += 100 + if cur_time >= time_limit: + cur_time = 0 + timeout_widget : QWidget = timeout_items[2] + if isinstance(timeout_widget, QLineEdit) : + lineedit_widget : QLineEdit = timeout_widget + # 检查 QLineEdit 的宽度 + if lineedit_widget.width() < 80: + lineedit_widget.setText("超时") + else: + lineedit_widget.setText("通信超时") + elif isinstance(timeout_widget, QLabel) : + label_widget : QLabel = timeout_widget + if "canvas" in label_widget.statusTip() : + self.camera_signal_timeout(label_widget) + else : + if label_widget.isVisible() : + label_widget.setVisible(False) + #label_widget.hide() + elif isinstance(timeout_widget, QPushButton) : + button_widget : QPushButton = timeout_widget + self.reset_object_style_sheet(button_widget) + if button_widget.width() < 80: + button_widget.setText("超时") + else: + button_widget.setText("通信超时") + + timeout_items[1] = cur_time + self.widget_timeout_list[list_index] = timeout_items + list_index = list_index + 1 + + def reset_widget_timeout(self, widget : QObject) : + Index = 0 + for timeout_item in self.widget_timeout_list: + cur_time = timeout_item[1] + timeout_widget : QWidget = timeout_item[2] + if timeout_widget == widget : + timeout_item[1] = 0 + self.widget_timeout_list[Index] = timeout_item + break + Index = Index + 1 + + + def connect_camera_thread(self, camera_thread : CameraThread, canvas_id : int = 0, is_visible : bool = True) : + if camera_thread == None or canvas_id < 0: + return + if canvas_id < len(self.set_video_image_func_arr) : + canvas_object : QLabel = self.search_canvas_object(canvas_id) + if canvas_object : + canvas_info_item = self.canvas_label_list[canvas_id] + + origin_camera_thread : CameraThread = canvas_info_item[2] + if origin_camera_thread != None and origin_camera_thread.is_signal_connect: + origin_camera_thread.image_signal.disconnect(self.set_video_image_func_arr[canvas_id]) + + if is_visible : + + camera_thread.signal_connect(self.set_video_image_func_arr[canvas_id]) + + list_index : int = self.get_timeout_List_index(canvas_object) + self.canvas_label_list[canvas_id] = [canvas_object, list_index, camera_thread] + else : + self.canvas_label_list[canvas_id] = [None, -1, None] + + self.canvas_visible_arr[canvas_id] = is_visible + + + + def camera_signal_timeout(self, camera_label : QLabel): + if camera_label != None : + pass + + def search_canvas_object(self, canvas_id = 0, child = None) : + widget :QWidget = child + if widget == None : + widget = self + child_count = 0 + for each_object in widget.children(): + child_count += 1 + child : QWidget = each_object + + if hasattr(child, "statusTip") : + tip_str : str = child.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if config_canvas_id >= 0 and config_camera_id >= 0 and config_canvas_id == canvas_id: + if isinstance(child, QLabel) : + return child + + find_canvas_object = self.search_canvas_object(canvas_id, child) + if find_canvas_object != None : + return find_canvas_object + + if child_count == 0 : + return None + + def get_canvas_prop (self, canvas_id : int= 0) : + config_camera_id = -1 + is_face_detect : int = 0 + + canvas_object : QWidget = self.search_canvas_object(canvas_id) + if canvas_object != None : + tip_str : str = canvas_object.statusTip() + config_canvas_id, config_camera_id = get_tip_canvas_id_and_camera_id(tip_str) + is_face_detect = get_tip_face_detection(tip_str) + return config_camera_id, is_face_detect + + def load_resource_bitmap(self, child = None) : + widget :QWidget = self + if child != None : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + imag_file_name = get_bk_imag_file_name(tip_str) + if imag_file_name != None : + if isinstance(child_widget, QLabel) : + label_child_object : QLabel = child_widget + label_child_object.setScaledContents(True) + image = QPixmap(imag_file_name) + label_child_object.setPixmap(image) + elif isinstance(child_widget, QWidget) : + file_url = "url(%s)"%(imag_file_name) + self.modify_object_style_sheet(child_widget, "background-image", file_url) + self.load_resource_bitmap(child_widget) + + def create_style_sheet_backup(self, child = None) : + widget :QWidget = child + if child == None : + widget = self + for child_widget in widget.children(): + if hasattr(child_widget, "styleSheet") : + widget : QWidget = child_widget + style_sheet : str = widget.styleSheet() + widget.setWhatsThis(style_sheet) + self.create_style_sheet_backup(child_widget) + + def create_timeout_list(self, child = None) : + widget :QWidget = self + if child == None : + self.widget_timeout_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + timeout_limit_ms = get_tip_timeout(tip_str) + if timeout_limit_ms >= 0: + self.widget_timeout_list.append([timeout_limit_ms, 0, child_widget]) + self.create_timeout_list(child_widget) + + def get_timeout_List_index(self, object : QWidget) : + list_index = -1 + search_list_index = 0 + for items in self.widget_timeout_list : + child_widget : QWidget = items[2] + if child_widget == object : + list_index = search_list_index + break + search_list_index += 1 + return list_index + + def get_page_circuit(self): + if hasattr(self, "statusTip") : + return get_tip_circuit(self.statusTip()) + return -1 + + def set_page_circuit(self, circuit_id = -1) : + if hasattr(self, "statusTip") : + origin_status_tip : str = self.statusTip() + origin_tip_splits = origin_status_tip.split(",") + new_status_tip = "" + for each_str in origin_tip_splits: + if "circuit" not in each_str : + new_status_tip += each_str + new_status_tip += "," + new_status_tip += "circuit=%d"%(circuit_id) + self.setStatusTip(new_status_tip) + self.update_window_circuit_mask() + self.create_alias_list() + self.process_alias_query() + self.para_or_measure_query() + + def create_alias_list(self, child = None) : + widget :QWidget = self + if child == None : + self.alias_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + alias_str = get_tip_alias_str(tip_str) + if alias_str != None: + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None : + key_combine_str = get_key_combine_str(alias_str, unique_name) + if key_combine_str not in self.alias_dict.keys() : + self.alias_dict[key_combine_str] = ALIAS_QUERY_NONE + self.create_alias_list(child_widget) + + def create_menu_list(self, child = None) : + widget :QWidget = self + if child == None : + self.menu_list = [] + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + sub_index = get_tip_menu_sub_index(tip_str) + if sub_index >= 0: + main_index = self.get_main_index_from_object(child_widget) + if main_index >= 0 : + compare_index = get_compare_index(main_index, sub_index) + else : + compare_index = sub_index + self.menu_list.append([compare_index, child_widget]) + if isinstance(child_widget, QPushButton) : + button : QPushButton = child_widget + button.clicked.connect(self.on_menu_qpush_button_click) + self.create_menu_list(child_widget) + + def on_select_object_action_process(self, select_object : QWidget) : + tip_str = select_object.statusTip() + action_str = get_tip_value_str(tip_str, "Action", None) + if action_str != None : + if "password" in tip_str : + dialog_modify_text = DialogModifyValue(self) + caption_str = "请输入密码:" + dialog_modify_text.update_modify_info("", "0000", caption_str) + input = False + + if dialog_modify_text.exec() == QDialog.Accepted: + input = True + modify_screen_time_str = dialog_modify_text.value + pass_word = system_parameter() + if modify_screen_time_str != pass_word.get_system_password() : + inform_box : DialogInform = DialogInform() + inform_box.information("提示", "密码错误,无法修改!") + return + else: + input = True + if input : + if "CmdExecute" in action_str : + mqtt_name = get_tip_mqtt_name(tip_str) + unique_name = self.get_unique_name_from_object(select_object) + if mqtt_name != None and unique_name != None: + if len(mqtt_name) > 0 and self.mqtt_thread != None: + publish_topic = "request/action/" + unique_name + publish_message = '{"name" : "%s"}'%(mqtt_name) + self.mqtt_publish_and_wait_response(publish_topic, publish_message, select_object, 1000) + elif "ModifySystem" in action_str: + self.on_system_param_modify(tip_str) + elif "Modify" in action_str : + if isinstance(select_object, QLineEdit) : + self.on_line_edit_modify_click(select_object) + + self.virtual_widget_action_process(select_object, action_str) + + def search_menu_match_object(self, object) : + match_object : QWidget = None + menu_index = 0 + for each_list in self.sort_menu_list : + search_object = each_list[1] + if search_object == object : + match_object = search_object + break + menu_index += 1 + return match_object, menu_index + + #刷新屏幕上的系统信息, 例如时间日期之类 + def flush_system_info(self, child = None) : + widget : QWidget= child + if child == None : + widget = self + else : + widget = child + + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + system_str = get_tip_system(tip_str) + + if system_str == "DateTime" : + qdate_time = QDateTime.currentDateTime() + time_str = qdate_time.toString("yyyy-MM-dd hh:mm:ss") + + if isinstance(child_widget, QPushButton) : + button_widget : QPushButton = child_widget + button_widget.setText(time_str) + elif isinstance(child_widget, QLineEdit) : + line_edit_widget : QLineEdit = child_widget + line_edit_widget.setText(time_str) + elif isinstance(child_widget, QLabel) : + label_widget : QLabel = child_widget + label_widget.setText(time_str) + self.flush_system_info(child_widget) + + def func_mqtt_param_modify(self, modify_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/modify/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, modify_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def func_call_back_on_mqtt_param_info(self, info_str : str) : + select_object : QWidget = self.select_object + if select_object == None : + return + tip = select_object.statusTip() + unique_name = self.get_unique_name_from_object(select_object) + mqtt_name = get_tip_mqtt_name(tip) + + if self.mqtt_thread != None : + request_topic = "request/param/info/" + unique_name + request_message = '{"name" : "%s", "value" : "%s"}'%(mqtt_name, info_str) + self.mqtt_publish_and_wait_response(request_topic, request_message, select_object, 1000) + + def on_menu_qpush_button_click(self, sender : QPushButton): + sender : QPushButton = self.sender() + match_object : QWidget = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + self.menu_selectable_object_flush() + if isinstance(match_object, QPushButton) : + self.on_select_object_action_process(match_object) + + #修改系统时间与日期 + def func_modify_system_time(self, modify_str : str) : + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + set_system_time(year, month, day, hour, minute, second) + + return year, month, day, hour, minute, second + return None + + #修改系统黑屏时间 + def func_modify_screen_blanking_time(self, modify_str: str): + numbers = re.findall(r'\d+', modify_str) + if len(numbers) == 1: + minutes = int(numbers[0]) + set_screen_blanking_time(minutes) + return minutes + return None + + def on_system_param_modify(self, tip : str) : + system = get_tip_system(tip) + if system == "DateTime" : + dialog_modify_text : DialogModifyText = DialogModifyText(self) + caption_str = "修改系统时间" + cur_time = QDateTime.currentDateTime() + date_time_str = cur_time.toString("yyyy-MM-dd hh:mm:ss") + dialog_modify_text.update_modify_info(date_time_str, caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_date_time_str = dialog_modify_text.value + self.func_modify_system_time(modify_date_time_str) + for circuit_id in range(8) : + unique_name = self.get_unique_name_from_circuit(circuit_id) + if unique_name != None and self.mqtt_thread != None: + time_message = '{"name" : "SetupTime", "value" : "%s"}'%(modify_date_time_str) + self.mqtt_thread.publish("request/action/" + unique_name, time_message) + dialog_inform = DialogInform(self) + dialog_inform.information("系统时间修改", "系统时间修改成功") + elif system == "ScreenBlankingTime": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改屏幕黑屏时间(分钟)" + sbt = system_parameter() + dialog_modify_text.update_modify_info("", str(sbt.get_screen_blanking_time()), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + result = self.func_modify_screen_blanking_time(modify_screen_time_str) + sbt.change_screen_blanking_time(modify_screen_time_str) + + if result is not None: + self.BlankTimelineEdit.setText(str(result)) + dialog_inform = DialogInform(self) + dialog_inform.information("屏幕黑屏时间修改", "屏幕黑屏时间修改成功") + + elif system == "SystemPassWord": + dialog_modify_text = DialogModifyValue(self) + caption_str = "修改系统密码" + pass_word = system_parameter() + dialog_modify_text.update_modify_info("", pass_word.get_system_password(), caption_str) + + if dialog_modify_text.exec() == QDialog.Accepted: + modify_screen_time_str = dialog_modify_text.value + pass_word.set_system_password(modify_screen_time_str) + dialog_inform = DialogInform(self) + dialog_inform.information("系统密码修改", "系统密码修改成功") + def on_line_edit_modify_click(self, sender :QLineEdit) : + match_object : QLineEdit = None + match_object, menu_index = self.search_menu_match_object(sender) + if match_object != None : + self.menu_key_index = menu_index + if isinstance(match_object, QLineEdit) : + self.dialog_modify_value = None + tip = match_object.statusTip() + alias_name = get_tip_alias_str(tip) + unique_name = self.get_unique_name_from_object(match_object) + if unique_name != None and alias_name != None : + key_combine_str = get_key_combine_str(alias_name, unique_name) + value_dict = utils.dict_or_object_get_attr(self.alias_dict, key_combine_str, None) + + if isinstance(value_dict, dict) : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + caption_str = get_tip_caption_str(match_object.statusTip()) + value_text = match_object.text() + dialog_modify_alias.set_alias_item_info(value_dict, value_text, caption_str) + self.dialog_modify_alias = dialog_modify_alias + + if dialog_modify_alias.exec() == QDialog.Accepted : + modify_value = dialog_modify_alias.value + self.func_mqtt_param_modify(modify_value) + else : + inform_box : DialogInform = DialogInform() + inform_box.information('别名数据未获取', 'message: %s'%(alias_name)) + else : + dialog_modify_value : DialogModifyValue = DialogModifyValue(self) + caption_str = get_tip_caption_str(match_object.statusTip()) + try : + origin_value = float(match_object.text()) + except Exception as e : + origin_value = None + inform_box : DialogInform = DialogInform() + inform_box.information('无效值', str(e)) + + if origin_value != None : + format_str = get_tip_format(tip) + dialog_modify_value.update_modify_info(format_str, origin_value, caption_str) + if dialog_modify_value.exec() == QDialog.Accepted : + modify_value = dialog_modify_value.value + self.func_mqtt_param_modify(modify_value) + def set_video_image(self, image_object : QObject, canvas_id = 0) : + if canvas_id >= len(self.canvas_label_list) : + return + camera_info_items = self.canvas_label_list[canvas_id] + camera_label: QLabel = camera_info_items[0] + timeout_list_index = camera_info_items[1] + camera_thread : CameraThread = camera_info_items[2] + + if camera_label != None: + shape = image_object.shape + width = shape[1] + height = shape[0] + if camera_label.isVisible() : + + qt_img = QImage(image_object.data, width, height, QImage.Format_RGB888) + + camera_label.setScaledContents(True) + camera_label.setPixmap(QPixmap.fromImage(qt_img)) + + if timeout_list_index >= 0 : + self.widget_timeout_list[timeout_list_index][1] = 0 + + def set_video_image_0(self, image_object : QObject) : + self.set_video_image(image_object, 0) + + def set_video_image_1(self, image_object : QObject) : + self.set_video_image(image_object, 1) + + def set_video_image_2(self, image_object : QObject) : + self.set_video_image(image_object, 2) + + def set_video_image_3(self, image_object : QObject) : + self.set_video_image(image_object, 3) + + def set_video_image_4(self, image_object : QObject) : + self.set_video_image(image_object, 4) + + def set_video_image_5(self, image_object : QObject) : + self.set_video_image(image_object, 5) + + def set_video_image_6(self, image_object : QObject) : + self.set_video_image(image_object, 6) + + def set_video_image_7(self, image_object : QObject) : + self.set_video_image(image_object, 7) + + def set_video_image_8(self, image_object : QObject) : + self.set_video_image(image_object, 8) + + def update_mqtt_value(self, circuit, json_dict) : + for json_key, json_value in json_dict.items() : + self.set_mqtt_value(circuit, json_key, json_value) + + #更新视频显示与否 + def update_canvas_camera_visible(self, child = None) : + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if isinstance(child, QLabel) : + widget_label : QLabel = child + tip_str = widget_label.statusTip() + visible_mqtt = get_tip_visible_mqtt(tip_str, None) + if visible_mqtt != None : + #该Label具有Visible控制, 检查一下是不是视频流 + canvas_id, camera_id = get_tip_canvas_id_and_camera_id(tip_str) + if canvas_id >= 0 and camera_id >= 0 : + circuit_id = self.get_circuit_from_object(widget_label) + visible_value = self.get_mqtt_value(circuit_id, visible_mqtt) + + is_visible = False + if visible_value != None : + try : + is_visible = True if int(visible_value) > 0 else False + except Exception as e : + is_visible = False + + widget_label.setVisible(is_visible) + if is_visible != self.canvas_visible_arr[canvas_id] and canvas_id < len(self.canvas_visible_arr): + self.canvas_visible_arr[canvas_id] = is_visible + self.virtual_connect_canvas_to_camera(canvas_id, camera_id, is_visible) + + self.update_canvas_camera_visible(child) + + def video_visible_timeout(self) : + self.update_canvas_camera_visible() + + #通过json包刷新界面数据 + def flush_widgets(self, circuit, json_dict, child = None): + widget :QWidget = child + if widget == None : + widget = self + + for each_object in widget.children(): + child : QWidget = each_object + + if not hasattr(child, "statusTip") : + continue + tip_str : str = child.statusTip() + + mqtt_name = get_tip_mqtt_name(tip_str) + + circuit_id = self.get_circuit_from_object(each_object) + self.flush_widgets(circuit, json_dict, child) + + if circuit_id != circuit : + continue + + if mqtt_name in json_dict.keys() : + value_or_dict = json_dict[mqtt_name] + + if isinstance(value_or_dict, dict) : + value_text = utils.dict_or_object_get_attr(value_or_dict, "value", "") + else : + value_text = value_or_dict + + color_str = utils.dict_or_object_get_attr(value_or_dict, "color", None) + bk_color_str = utils.dict_or_object_get_attr(value_or_dict, "bk_color", None) + + imag_file_name = get_imag_value_file_name(tip_str, value_text) + timeout_ms = get_tip_timeout(tip_str) + if timeout_ms > 0 : + self.reset_widget_timeout(child) + + if isinstance(child, QPushButton) : + widget_button : QPushButton = child + if imag_file_name != None : + self.modify_object_style_sheet(widget_button, "border-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_button) + + if isinstance(child, QLabel) : + widget_label : QLabel = child + if imag_file_name != None : + if widget_label.isVisible() == False : + widget_label.setVisible(True) + self.modify_object_style_sheet(widget_label, "background-image", "url(%s)"%(imag_file_name)) + else : + self.reset_object_style_sheet(widget_label) + widget_label.setText(value_text) + + if isinstance(child, QLineEdit) : + widget_line_edit : QLineEdit = child + alias_name = get_tip_alias_str(widget_line_edit.statusTip()) + unique_name = self.get_unique_name_from_object(widget_line_edit) + + if alias_name != None : + fvalue = float(value_text) + value = round(fvalue) + value_str = str(value) + display_text = "(%s)"%(value_str) + + alias_key_str = get_key_combine_str(alias_name, unique_name) + if alias_key_str in self.alias_dict.keys() : + alias_value_dict = self.alias_dict[alias_key_str] + if isinstance(alias_value_dict, dict) : + display_text = utils.dict_or_object_get_attr(alias_value_dict, value_str, value_text) + else : + display_text = value_text + widget_line_edit.setText(display_text) + + if bk_color_str != None : + if isinstance(child, QLineEdit) : + self.modify_object_style_sheet(child, "background-color", bk_color_str) + if color_str != None : + self.modify_object_style_sheet(child, "color", color_str) + + def get_circuit_from_object(self, object :QWidget) : + parent : QWidget= object + circuit_id = -1 + while parent != None : + if hasattr(parent, "statusTip") : + tip_str = parent.statusTip() + circuit_id = get_tip_circuit(tip_str) + if circuit_id >= 0 or parent == self: + break + parent = parent.parent() + return circuit_id + + def get_main_index_from_object(self, object :QWidget) : + parent : QWidget= object + main_index = -1 + while parent != None : + if not hasattr(parent, "statusTip") : + return -1 + + tip_str = parent.statusTip() + main_index = get_tip_main_index(tip_str) + if main_index >= 0 or parent == self: + break + parent = parent.parent() + return main_index + + def get_unique_name_from_circuit(self, circuit_id : int) : + for config_dict in group_config.comm_thread_config : + device_list = utils.dict_or_object_get_attr(config_dict, "device_list", None) + if device_list != None : + for item_dict in device_list : + config_circuit_id = utils.dict_or_object_get_attr(item_dict, "circuit_id", -1) + if config_circuit_id == circuit_id : + circuit_unique_name = utils.dict_or_object_get_attr(item_dict, "unique_name", None) + return circuit_unique_name + return None + + def get_unique_name_from_object(self, object :QWidget) : + circuit_id = self.get_circuit_from_object(object) + return self.get_unique_name_from_circuit(circuit_id) + + def key_increase_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_end(tip_str) + + if group_items_count == -1: + next_menu_index = (self.menu_key_index + 1) % menu_count + else: + next_menu_index = (self.menu_key_index - group_items_count + 1) % menu_count + + self.menu_key_index = next_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + def key_decrease_parameter(self): + menu_count = len(self.sort_menu_list) + + if menu_count == 0: + return + + tip_str = self.sort_menu_list[self.menu_key_index][1].statusTip() + group_items_count = get_tip_group_start(tip_str) + if group_items_count == -1: + prev_menu_index = (self.menu_key_index - 1) % menu_count + else: + prev_menu_index = (self.menu_key_index + group_items_count - 1) % menu_count + + self.menu_key_index = prev_menu_index + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_selectable_object_flush() + + + def key_enter_process(self): + menu_count = len(self.sort_menu_list) + if menu_count == 0: + return + + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.on_select_object_action_process(self.select_object) + + def key_escape_process(self): + #在菜单第一项, 按下复位, 退出到上一页 + if self.menu_key_index == 0: + self.virtual_change_to_page(-1) + + menu_count = len(self.sort_menu_list) # 获取当前页面可交互控件个数 + if menu_count == 0: # 若注册可交互控件个数为0,则退出处理,返回 + return + + # 重置菜单选择 + self.select_object = self.sort_menu_list[self.menu_key_index][1] + self.menu_key_index = 0 + self.menu_selectable_object_flush() + + + # def key_Test_process0(self): + # json_dict = {"Uab" :"1111", + # "Ubc" : "1111", + # "Uca" : "1111", + # "Uo" : "11" , + # "Iab" : "1111", + # "Ibc" : "1111", + # "Ica" : "1111", + # "Io" : "1111", + # "SwitchStatus" : {"value" :"0", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + # } + + + # self.flush_widgets(0, json_dict) + + # def key_Test_process1(self): + # json_dict = {"Uab" :"2222", + # "Ubc" : "2222", + # "Uca" : "2222", + # "Uo" : "22" , + # "Iab" : "2222", + # "Ibc" : "2222", + # "Ica" : "2222", + # "Io" : "2222", + # "SwitchStatus" : {"value" :"1", "bk_color" : COLOR_NORMAL, "color" : COLOR_RED} + + + # } + # self.flush_widgets(1, json_dict) + + # def key_Test_process2(self): + # json_dict = {"Uab" :"3333", "Ubc" : "3333", "Uca" : "3333", "Uo" : "33" , "Iab" : "3333", "Ibc" : "3333", "Ica" : "3333", "Io" : "3333"} + # self.flush_widgets(2, json_dict) + + # def key_Test_process3(self): + # json_dict = {"Uab" :"33333", "Ubc" : "33333", "Uca" : "33333"} + # self.flush_widgets(3, json_dict) + + def menu_selectable_object_flush(self) : + menu_count = len(self.sort_menu_list) + for i in range(menu_count): + object : QWidget = self.sort_menu_list[i][1] + is_select_object_draw = False + + if isinstance(object, QPushButton) : + button_object : QPushButton = object + image_file_name = get_select_imag_file_name(object.statusTip()) + image_icon_name = get_select_icon_file_name(object.statusTip()) + + if i == self.menu_key_index: + button_object.setFocus() + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(button_object, "border-image", file_url) + elif image_icon_name != None : + is_select_object_draw = True + button_size : QSize = button_object.size() + button_object.setIcon(QIcon(image_icon_name)) + button_object.setIconSize(button_size) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(button_object) + elif image_icon_name != None : + is_select_object_draw = True + button_object.setIcon(QIcon()) + + elif isinstance(object, QLabel) : + label_object : QLabel = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(label_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(label_object) + + elif isinstance(object, QLineEdit) : + line_object : QLineEdit = object + image_file_name = get_select_imag_file_name(object.statusTip()) + + if i == self.menu_key_index : + if image_file_name != None : + is_select_object_draw = True + file_url = "url(%s)"%(image_file_name) + self.modify_object_style_sheet(line_object, "border-image", file_url) + else : + if image_file_name != None : + is_select_object_draw = True + self.reset_object_style_sheet(line_object) + + + if is_select_object_draw == False : + if i == self.menu_key_index : + self.modify_object_style_sheet(object, "background-color", COLOR_CYAN) + else : + self.reset_object_style_sheet(object) + + def response_topic_message_process(self, topic: str, + message : str, + is_timeout :bool = False, inform : bool = False) : + find_reponse_topic_msg = None + for wait_topic_msg in self.wait_response_list : + if wait_topic_msg[0] == topic : + find_reponse_topic_msg = wait_topic_msg + self.wait_response_list.remove(wait_topic_msg) + break + + if find_reponse_topic_msg == None : + return + + select_object :QWidget = find_reponse_topic_msg[2] + request_message : str = find_reponse_topic_msg[1] + + inform_box : DialogInform = None + if inform : + inform_box : DialogInform = DialogInform() + + try : + json_dict = json_load_message(message) + result = utils.dict_or_object_get_attr(json_dict, "result", 0) + result = int(result) + except Exception as e: + json_dict = None + result = 0 + print_error_msg(str(e) + "invalid json message: %s" % (message)) + + if "response/action" in topic : + if is_timeout : + inform_message = "命令执行超时" + if inform == True: + inform_box.information('命令执行超时', inform_message) + else : + inform_message = '命令执行成功' if result == 1 else '命令执行失败!!!' + if inform == True: + inform_box.information('命令执行', inform_message) + elif "response/param/modify" in topic : + if is_timeout : + inform_message = '参数修改超时' + if inform == True: + inform_box.information('参数修改超时', inform_message) + else : + inform_message = '参数修改成功' if result == 1 else '参数修改失败!!!' + if inform == True: + inform_box.information('参数修改', inform_message) + if result == 1 : + self.para_or_measure_query() + elif "response/alias" in topic : + unique_name = topic.replace("response/alias/", "") + + if is_timeout : + if json_dict != None : + alias_name = None + if "name" in json_dict.keys() : + alias_name = json_dict["name"] + + if alias_name != None : + key_str = get_key_combine_str(alias_name, unique_name) + if key_str in self.alias_dict.keys() : + if isinstance(self.alias_dict[key_str], int) : + self.alias_dict[key_str] = ALIAS_QUERY_NONE + + if inform == True: + inform_box.information('获取别名超时', message) + else : + dialog_modify_alias : DialogModifyAlias = DialogModifyAlias(self) + + if isinstance(json_dict, list): + for item in json_dict: + for alias_key_name, alias_dict in item.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + else: + for alias_key_name, alias_dict in json_dict.items(): + if alias_key_name in request_message: + key_str = get_key_combine_str(alias_key_name, unique_name) + if key_str in self.alias_dict.keys(): + self.alias_dict[key_str] = alias_dict + + if isinstance(select_object, QLineEdit): + line_select_object: QLineEdit = select_object + caption_str = get_tip_value_str(select_object.statusTip(), "Caption", "") + alias_value = int(line_select_object.text()) + + dialog_modify_alias.set_alias_item_info(alias_dict, alias_value, caption_str) + self.dialog_modify_alias = dialog_modify_alias + dialog_modify_alias.exec() + break + + def mqtt_topic_message_process(self, msg) : + topic_msg_item = True + while topic_msg_item != None : + self.mutex.lock() + topic_msg_count = len(self.topic_message_list) + if topic_msg_count > 0: + topic_msg_item = self.topic_message_list.pop(0) + else : + topic_msg_item = None + self.mutex.unlock() + if topic_msg_item != None : + topic = topic_msg_item[0] + message = topic_msg_item[1] + try : + json_dict = json_load_message(message) + except Exception as e : + json_dict = None + print_error_msg("invalid json message : %s"%(message)) + if json_dict != None: + if "measure" in topic : + circuit_id = search_circuit_from_topic(topic) + self.update_mqtt_value(circuit_id, json_dict) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.flush_widgets(circuit_id, json_dict) + elif "param/info" in topic: + circuit_id = search_circuit_from_topic(topic) + #print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response/alarm" in topic : + circuit_id = search_circuit_from_topic(topic) + self.flush_alarminfo(circuit_id, json_dict) + self.update_mqtt_value(circuit_id, json_dict) + self.flush_widgets(circuit_id, json_dict) + + elif "response" in topic : + self.response_topic_message_process(topic, message, is_timeout = False, inform = True) + + elif "alarm/test" in topic : + circuit_id = search_circuit_from_topic(topic) + # print("@Line:",inspect.currentframe().f_lineno,' ',' = ',circuit_id,' = ',json_dict) + + # 将告警信息刷新到页面 + def flush_alarminfo(self, circuit, json_dict, child = None): + + alarmTitle : QLineEdit = self.findChild(QLineEdit,"alarmTitle") + if alarmTitle != None: + display_title = "%s"%(json_dict["index"]) + alarmTitle.setText(display_title) + + alarmTime : QLineEdit = self.findChild(QLineEdit,"alarmTime") + if alarmTime != None: + display_year = "%s-"%(json_dict["AlarmYear"]) + display_month = "%s-"%(json_dict["AlarmMonth"]) + display_day = "%s"%(json_dict["AlarmDay"]) + display_hour = " %s:"%(json_dict["AlarmHour"]) + display_minute = "%s: "%(json_dict["AlarmMinute"]) + display_second = "%s"%(json_dict["AlarmSecond"]) + + disp_time = display_year + display_month + display_day + display_hour+ display_minute+ display_second + alarmTime.setText(disp_time) + + alarmMsg : QLineEdit = self.findChild(QLineEdit,"alarmMsg") + if alarmMsg != None: + display_msg = "%s"%(json_dict["AlarmCodeMsg"]) + alarmMsg.setText(display_msg) + + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0: + self.mqtt_thread = mqtt_thread + self.mqtt_thread.subscribe("response/#") + self.mqtt_thread.subscribe("param/info/#") + self.mqtt_thread.subscribe("param/modify/#") + self.mqtt_thread.subscribe("measure/#") + self.mqtt_thread.subscribe("status/#") + self.mqtt_thread.subscribe("alarm/#") + self.mqtt_thread.subscribe("response/alarm/#") + self.mqtt_thread.subscribe("action/#") + self.mqtt_thread.subscribe("globalmeasure/#") + # self.mqtt_thread.subscribe("time_group/#") + else : + self.mqtt_thread = None + + def on_message(self, mqtt_thread, topic, message) : + NUMBER_OF_CIRCUITS = 3 + circuit_id = search_circuit_from_topic(topic) + if circuit_id < 0 : + return + if (self.exist_circuit_mask & (0x1 << circuit_id)) == 0 : + return + self.mutex.lock() + # 特别处理 globalmeasure 主题 + if "globalmeasure/" in topic: + if circuit_id == 2: # 如果消息是来自 circuit_0 + + for i in range(1, NUMBER_OF_CIRCUITS): + broadcast_topic = f"globalmeasure/circuit_{i}" + self.mqtt_thread.publish(broadcast_topic, message) # 发布消息到 + else: + if len(self.topic_message_list) < 100: + self.topic_message_list.append([topic, message]) # 将消息添加到列表中 + + message_str = message.decode('utf-8') + if "time_group/circuit_0" in topic: + try: + time_data = json.loads(message_str) + year = time_data["Year"] + month = time_data["Month"] + day = time_data["Day"] + hour = time_data["Hour"] + minute = time_data["Minute"] + second = time_data["Second"] + + # 检查时间数据是否完整 + if all([year, month, day, hour, minute, second]): + set_system_time(int(year), int(month), int(day), int(hour), int(minute), int(second)) + print(f"Time updated on circuit_{circuit_id} to: {year}-{month}-{day} {hour}:{minute}:{second}") + else: + print(f"Incomplete time data received on circuit_{circuit_id}") + except Exception as e: + print(f"Error processing time_group message on circuit_{circuit_id}: {e}") + + if len(self.topic_message_list) < 100 : + self.topic_message_list.append([topic, message]) + self.mutex.unlock() + self.mqtt_signal.emit("Refresh UI") + + def response_topic_messge_timeout(self): + timer = self.sender() + for wait_response_items in self.wait_response_list: + wait_timer : QTimer = wait_response_items[3] + _inform : bool = wait_response_items[4] + + if wait_timer == timer : + topic : str = wait_response_items[0] + message : str = wait_response_items[1] + wait_timer.stop() + self.response_topic_message_process(topic, message, is_timeout=True, inform = _inform) + break + + # def mqtt_publish_and_wait_response(self, publish_topic : str, publish_message : str, select_object : QWidget = None, timeout_ms : int = 1000, inform : bool = True) : + # if self.mqtt_thread != None : + # self.mqtt_thread.publish(publish_topic, publish_message) + + # response_topic = publish_topic.replace("request", "response") + # #开启超时定时器 + # wait_timer = QTimer() + # wait_timer.timeout.connect(self.response_topic_messge_timeout) + # wait_timer.start(timeout_ms) + # self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + def mqtt_publish_and_wait_response(self, publish_topic: str, publish_message: str, select_object: QWidget = None, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda: self.response_topic_message_timeout(response_topic)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + def response_topic_message_timeout(self, response_topic): + # 处理超时事件 + for response_info in self.wait_response_list: + if response_info[0] == response_topic: + response_info[3].stop() # 停止定时器 + self.wait_response_list.remove(response_info) + # 在这里添加超时后的处理逻辑,例如通知用户请求超时 + if response_info[4]: # 检查是否需要通知 + self.inform_timeout(response_info) + break + + def inform_timeout(self, response_info): + # 通知用户请求超时的逻辑 + # response_info[2] 是 select_object + # 根据具体需求实现通知逻辑 + print(f"Request for {response_info[1]} on topic {response_info[0]} timed out.") + + def batch_mqtt_publish_and_wait_response(self, publish_list: list, timeout_ms: int = 1000, inform: bool = True): + if self.mqtt_thread is not None: + for publish_topic, publish_message, select_object in publish_list: + # 发布MQTT消息 + self.mqtt_thread.publish(publish_topic, publish_message) + + # 构建响应主题 + response_topic = publish_topic.replace("request", "response") + + # 设置并启动超时定时器 + wait_timer = QTimer() + wait_timer.timeout.connect(lambda rt=response_topic: self.response_topic_message_timeout(rt)) + wait_timer.start(timeout_ms) + + # 将响应信息添加到等待列表 + self.wait_response_list.append([response_topic, publish_message, select_object, wait_timer, inform]) + + + + + def para_or_measure_query(self, child = None) : + widget :QWidget = self + if child == None : + self.param_dict = {} + else : + widget = child + for child_widget in widget.children(): + if hasattr(child_widget, "statusTip") : + tip_str : str = child_widget.statusTip() + if "ScreenBlankingTime" in tip_str : + sbt = system_parameter() + child_widget.setText(sbt.get_screen_blanking_time()) + continue + mqtt_str = get_tip_mqtt_name(tip_str) + if mqtt_str != None and mqtt_str not in self.param_dict.keys(): + unique_name = self.get_unique_name_from_object(child_widget) + if unique_name != None and self.mqtt_thread != None: + self.mqtt_thread.publish("request/param/info/"+unique_name, '{"name":"%s"}'%mqtt_str) + self.param_dict[mqtt_str] = ALIAS_QUERY_NONE + self.para_or_measure_query(child_widget) + + def flush_system_cycle(self) : + self.flush_system_info() + +if __name__ == '__main__': + + style_sheet = "QLabel {color : RED;\nbackground-color : GREEN;}" + print(style_sheet) + + new_style_items = modify_style_sheet("QLabel", style_sheet, "background-color", "WHITE") + new_style_items = modify_style_sheet("QLabel", new_style_items, "color", "YELLOW") + + print(new_style_items) + sys.exit(0) diff --git a/QT5_Project/ZM_4/__init__.py b/QT5_Project/ZM_4/__init__.py new file mode 100644 index 0000000..81c647b --- /dev/null +++ b/QT5_Project/ZM_4/__init__.py @@ -0,0 +1,5 @@ +import sys +sys_path = sys.path[0].replace("\\", "/") +sys_path_linux = sys_path + "/../.." +if sys_path_linux not in sys.path : + sys.path.append(sys_path_linux) diff --git a/QT5_Project/ZM_4/background/IM00_01B.png b/QT5_Project/ZM_4/background/IM00_01B.png new file mode 100644 index 0000000..0af205c Binary files /dev/null and b/QT5_Project/ZM_4/background/IM00_01B.png differ diff --git a/QT5_Project/ZM_4/background/IM00_01C.png b/QT5_Project/ZM_4/background/IM00_01C.png new file mode 100644 index 0000000..ec4baed Binary files /dev/null and b/QT5_Project/ZM_4/background/IM00_01C.png differ diff --git a/QT5_Project/ZM_4/background/IM00_SwitchStatus_0.png b/QT5_Project/ZM_4/background/IM00_SwitchStatus_0.png new file mode 100644 index 0000000..c47d2f2 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM00_SwitchStatus_0.png differ diff --git a/QT5_Project/ZM_4/background/IM00_SwitchStatus_1.png b/QT5_Project/ZM_4/background/IM00_SwitchStatus_1.png new file mode 100644 index 0000000..546df2e Binary files /dev/null and b/QT5_Project/ZM_4/background/IM00_SwitchStatus_1.png differ diff --git a/QT5_Project/ZM_4/background/IM01_01.png b/QT5_Project/ZM_4/background/IM01_01.png new file mode 100644 index 0000000..9b9b1cd Binary files /dev/null and b/QT5_Project/ZM_4/background/IM01_01.png differ diff --git a/QT5_Project/ZM_4/background/IM01_0122.png b/QT5_Project/ZM_4/background/IM01_0122.png new file mode 100644 index 0000000..1e0fc04 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM01_0122.png differ diff --git a/QT5_Project/ZM_4/background/IM03_001.png b/QT5_Project/ZM_4/background/IM03_001.png new file mode 100644 index 0000000..164c3b2 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM03_001.png differ diff --git a/QT5_Project/ZM_4/background/IM03_SwitchStatus_0.png b/QT5_Project/ZM_4/background/IM03_SwitchStatus_0.png new file mode 100644 index 0000000..905b60a Binary files /dev/null and b/QT5_Project/ZM_4/background/IM03_SwitchStatus_0.png differ diff --git a/QT5_Project/ZM_4/background/IM03_SwitchStatus_1.png b/QT5_Project/ZM_4/background/IM03_SwitchStatus_1.png new file mode 100644 index 0000000..d30fb0c Binary files /dev/null and b/QT5_Project/ZM_4/background/IM03_SwitchStatus_1.png differ diff --git a/QT5_Project/ZM_4/background/IM04_00.png b/QT5_Project/ZM_4/background/IM04_00.png new file mode 100644 index 0000000..fddb4cc Binary files /dev/null and b/QT5_Project/ZM_4/background/IM04_00.png differ diff --git a/QT5_Project/ZM_4/background/IM05_002.png b/QT5_Project/ZM_4/background/IM05_002.png new file mode 100644 index 0000000..d1c3db6 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM05_002.png differ diff --git a/QT5_Project/ZM_4/background/IM05_A1.png b/QT5_Project/ZM_4/background/IM05_A1.png new file mode 100644 index 0000000..a5a3588 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM05_A1.png differ diff --git a/QT5_Project/ZM_4/background/IM05_A2.png b/QT5_Project/ZM_4/background/IM05_A2.png new file mode 100644 index 0000000..c8c2a56 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM05_A2.png differ diff --git a/QT5_Project/ZM_4/background/IM05_A3.png b/QT5_Project/ZM_4/background/IM05_A3.png new file mode 100644 index 0000000..b6eac70 Binary files /dev/null and b/QT5_Project/ZM_4/background/IM05_A3.png differ diff --git a/QT5_Project/ZM_4/background/IMxx_00D.png b/QT5_Project/ZM_4/background/IMxx_00D.png new file mode 100644 index 0000000..73b3dbf Binary files /dev/null and b/QT5_Project/ZM_4/background/IMxx_00D.png differ diff --git a/QT5_Project/ZM_4/background/P4_ParaSelect.png b/QT5_Project/ZM_4/background/P4_ParaSelect.png new file mode 100644 index 0000000..489633e Binary files /dev/null and b/QT5_Project/ZM_4/background/P4_ParaSelect.png differ diff --git a/QT5_Project/ZM_4/background/SR_001.png b/QT5_Project/ZM_4/background/SR_001.png new file mode 100644 index 0000000..c7c2868 Binary files /dev/null and b/QT5_Project/ZM_4/background/SR_001.png differ diff --git a/QT5_Project/ZM_4/background/SR_002.png b/QT5_Project/ZM_4/background/SR_002.png new file mode 100644 index 0000000..6427552 Binary files /dev/null and b/QT5_Project/ZM_4/background/SR_002.png differ diff --git a/QT5_Project/ZM_4/background/SR_003.png b/QT5_Project/ZM_4/background/SR_003.png new file mode 100644 index 0000000..c9a8eca Binary files /dev/null and b/QT5_Project/ZM_4/background/SR_003.png differ diff --git a/QT5_Project/ZM_4/background/SR_004.png b/QT5_Project/ZM_4/background/SR_004.png new file mode 100644 index 0000000..98ff1c3 Binary files /dev/null and b/QT5_Project/ZM_4/background/SR_004.png differ diff --git a/QT5_Project/ZM_4/image/DeviceList.png b/QT5_Project/ZM_4/image/DeviceList.png new file mode 100644 index 0000000..871bdc1 Binary files /dev/null and b/QT5_Project/ZM_4/image/DeviceList.png differ diff --git a/SearchTree.py b/SearchTree.py new file mode 100644 index 0000000..f19d1d9 --- /dev/null +++ b/SearchTree.py @@ -0,0 +1,196 @@ +"""蒙特卡洛树搜索""" + + +import numpy as np +import copy +from config import CONFIG + + +def softmax(x): + probs = np.exp(x - np.max(x)) + probs /= np.sum(probs) + return probs + + +# 定义叶子节点 +class TreeNode(object): + """ + mcts树中的节点, 树的子节点字典中, 键为动作, 值为TreeNode。记录当前节点选择的动作, 以及选择该动作后会跳转到的下一个子节点。 + 每个节点跟踪其自身的Q, 先验概率P及其访问次数调整的u + """ + + def __init__(self, parent, prior_p): + """ + :param parent: 当前节点的父节点 + :param prior_p: 当前节点被选择的先验概率 + """ + self._parent = parent + self._children = {} # 从动作到TreeNode的映射 + self._n_visits = 0 # 当前当前节点的访问次数 + self._Q = 0 # 当前节点对应动作的平均动作价值 + self._u = 0 # 当前节点的置信上限 # PUCT算法 + self._P = prior_p + + def expand(self, action_priors): # 这里把不合法的动作概率全部设置为0 + """通过创建新子节点来展开树""" + for action, prob in action_priors: + if action not in self._children: + self._children[action] = TreeNode(self, prob) + + def select(self, c_puct): + """ + 在子节点中选择能够提供最大的Q+U的节点 + return: (action, next_node)的二元组 + """ + return max(self._children.items(), + key=lambda act_node: act_node[1].get_value(c_puct)) + + def get_value(self, c_puct): + """ + 计算并返回此节点的值, 它是节点评估Q和此节点的先验的组合 + c_puct: 控制相对影响(0, inf) + """ + self._u = (c_puct * self._P * + np.sqrt(self._parent._n_visits) / (1 + self._n_visits)) + return self._Q + self._u + + def update(self, leaf_value): + """ + 从叶节点评估中更新节点值 + leaf_value: 这个子节点的评估值来自当前玩家的视角 + """ + # 统计访问次数 + self._n_visits += 1 + # 更新Q值, 取决于所有访问次数的平均树, 使用增量式更新方式 + self._Q += 1.0 * (leaf_value - self._Q) / self._n_visits + + # 使用递归的方法对所有节点(当前节点对应的支线)进行一次更新 + def update_recursive(self, leaf_value): + """就像调用update()一样, 但是对所有直系节点进行更新""" + # 如果它不是根节点, 则应首先更新此节点的父节点 + if self._parent: + self._parent.update_recursive(-leaf_value) + self.update(leaf_value) + + def is_leaf(self): + """检查是否是叶节点, 即没有被扩展的节点""" + return self._children == {} + + def is_root(self): + return self._parent is None + + +# 蒙特卡洛搜索树 +class MCTS(object): + + def __init__(self, policy_value_fn, c_puct=5, n_playout=2000): + """policy_value_fn: 接收board的盘面状态, 返回落子概率和盘面评估得分""" + self._root = TreeNode(None, 1.0) + self._policy = policy_value_fn + self._c_puct = c_puct + self._n_playout = n_playout + + def _playout(self, state): + """ + 进行一次搜索, 根据叶节点的评估值进行反向更新树节点的参数 + 注意:state已就地修改, 因此必须提供副本 + """ + node = self._root + while True: + if node.is_leaf(): + break + # 贪心算法选择下一步行动 + action, node = node.select(self._c_puct) + state.do_move(action) + + # 使用网络评估叶子节点, 网络输出(动作, 概率)元组p的列表以及当前玩家视角的得分[-1, 1] + action_probs, leaf_value = self._policy(state) + # 查看游戏是否结束 + end, winner = state.game_end() + if not end: + node.expand(action_probs) + else: + # 对于结束状态, 将叶子节点的值换成1或-1 + if winner == -1: # Tie + leaf_value = 0.0 + else: + leaf_value = ( + 1.0 if winner == state.get_current_player_id() else -1.0 + ) + # 在本次遍历中更新节点的值和访问次数 + # 必须添加符号, 因为两个玩家共用一个搜索树 + node.update_recursive(-leaf_value) + + def get_move_probs(self, state, temp=1e-3): + """ + 按顺序运行所有搜索并返回可用的动作及其相应的概率 + state:当前游戏的状态 + temp:介于(0, 1]之间的温度参数 + """ + for n in range(self._n_playout): + state_copy = copy.deepcopy(state) + self._playout(state_copy) + + # 跟据根节点处的访问计数来计算移动概率 + act_visits= [(act, node._n_visits) + for act, node in self._root._children.items()] + acts, visits = zip(*act_visits) + act_probs = softmax(1.0 / temp * np.log(np.array(visits) + 1e-10)) + return acts, act_probs + + def update_with_move(self, last_move): + """ + 在当前的树上向前一步, 保持我们已经直到的关于子树的一切 + """ + if last_move in self._root._children: + self._root = self._root._children[last_move] + self._root._parent = None + else: + self._root = TreeNode(None, 1.0) + + def __str__(self): + return 'MCTS' + + +# 基于MCTS的AI玩家 +class MCTSPlayer(object): + + def __init__(self, policy_value_function, c_puct=5, n_playout=2000, is_selfplay=0): + self.mcts = MCTS(policy_value_function, c_puct, n_playout) + self._is_selfplay = is_selfplay + self.agent = "AI" + + def set_player_ind(self, p): + self.player = p + + # 重置搜索树 + def reset_player(self): + self.mcts.update_with_move(-1) + + def __str__(self): + return 'MCTS {}'.format(self.player) + + # 得到行动 + def get_action(self, board, temp=1e-3, return_prob=0): + # 像alphaGo_Zero论文一样使用MCTS算法返回的pi向量 + move_probs = np.zeros(2086) + + acts, probs = self.mcts.get_move_probs(board, temp) + move_probs[list(acts)] = probs + if self._is_selfplay: + # 添加Dirichlet Noise进行探索(自我对弈需要) + move = np.random.choice( + acts, + p=0.75*probs + 0.25*np.random.dirichlet(CONFIG['dirichlet'] * np.ones(len(probs))) + ) + # 更新根节点并重用搜索树 + self.mcts.update_with_move(move) + else: + # 使用默认的temp=1e-3, 它几乎相当于选择具有最高概率的移动 + move = np.random.choice(acts, p=probs) + # 重置根节点 + self.mcts.update_with_move(-1) + if return_prob: + return move, move_probs + else: + return move \ No newline at end of file diff --git a/Test/10K 热敏电阻对照表(25°为基准).doc b/Test/10K 热敏电阻对照表(25°为基准).doc new file mode 100644 index 0000000..a3817a9 Binary files /dev/null and b/Test/10K 热敏电阻对照表(25°为基准).doc differ diff --git a/Test/Temperature.py b/Test/Temperature.py new file mode 100644 index 0000000..cfef394 --- /dev/null +++ b/Test/Temperature.py @@ -0,0 +1,34 @@ +import numpy as np +from scipy.optimize import curve_fit +import matplotlib.pyplot as plt + +# 读取数据 +data = np.genfromtxt('10K 热敏电阻对照表(25°为基准).csv', delimiter=',', skip_header=1, + usecols=(0, 2), names=['Temperature', 'Rnor']) +# 提取温度和Rnor数据 +temperature = data['Temperature'] +r_nor = data['Rnor'] + + +# 定义拟合函数,这里采用二次函数作为示例 +def fit_function(x, a, b, c): + return a * x ** 2 + b * x + c + + +# 进行曲线拟合 +p0 = [1, 1, 1] # 初始猜测值 +popt, pcov = curve_fit(fit_function, temperature, r_nor, p0=p0) + +# 生成用于绘图的拟合数据 +x_fit = np.linspace(-30, 300, 400) +y_fit = fit_function(x_fit, *popt) + +# 绘制原始数据和拟合曲线 +plt.scatter(temperature, r_nor, label='Original Data') +plt.plot(x_fit, y_fit, 'r-', label='Fitted Curve') +plt.xlabel('Temperature (°C)') +plt.ylabel('Rnor (k Ohms)') +plt.title('Thermistor Resistance vs Temperature Fitting') +plt.legend() +plt.grid(True) +plt.show() \ No newline at end of file diff --git a/Test/bmp_jpg.py b/Test/bmp_jpg.py new file mode 100644 index 0000000..5819665 --- /dev/null +++ b/Test/bmp_jpg.py @@ -0,0 +1,23 @@ +import os +from PIL import Image + +# 输入目录和输出目录 +input_directory = 'E:/Jfen_work/DWIN/GUI_PUMP_ICL/132-mode' +output_directory = 'E:/Jfen_work/DWIN/GUI_PUMP_ICL/132-mode-new' + +# 确保输出目录存在 +if not os.path.exists(output_directory): + os.makedirs(output_directory) + +# 遍历输入目录中的所有文件 +for filename in os.listdir(input_directory): + if filename.endswith('.bmp'): + # 打开 .bmp 文件 + bmp_image_path = os.path.join(input_directory, filename) + with Image.open(bmp_image_path) as img: + # 创建 .jpg 文件路径 + jpg_image_path = os.path.join(output_directory, os.path.splitext(filename)[0] + '.jpg') + # 将图片转换为 RGB 模式并保存为 .jpg 文件 + img.convert('RGB').save(jpg_image_path, 'JPEG') + +print("转换完成!") diff --git a/Test/test.py b/Test/test.py new file mode 100644 index 0000000..732e751 --- /dev/null +++ b/Test/test.py @@ -0,0 +1,112 @@ +import sys +import logging +from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QLineEdit +from PyQt5.QtCore import Qt +import modbus_tk.defines as cst +from modbus_tk import modbus_tcp + +# 配置日志以十六进制形式显示报文 +logging.basicConfig() +log = logging.getLogger('modbus_tk') +log.setLevel(logging.DEBUG) + + +class ModbusControlWindow(QWidget): + def __init__(self): + super().__init__() + + self.setWindowTitle("Modbus Control Window") + self.setGeometry(100, 140, 400, 200) + + self.label_ip = QLabel("IP Address:", self) + self.label_ip.move(20, 20) + self.text_ip = QLineEdit("192.168.1.181", self) + self.text_ip.setGeometry(120, 20, 200, 20) + + self.label_device_id = QLabel("Device ID:", self) + self.label_device_id.move(20, 60) + self.text_device_id = QLineEdit("1", self) + self.text_device_id.setGeometry(120, 60, 200, 20) + + self.btn_addr646 = QPushButton("向上", self) + self.btn_addr646.move(20, 100) + self.btn_addr646.clicked.connect(lambda: self.send_modbus_command(646)) + + self.btn_addr647 = QPushButton("向下", self) + self.btn_addr647.move(120, 100) + self.btn_addr647.clicked.connect(lambda: self.send_modbus_command(647)) + + self.btn_addr648 = QPushButton("确定", self) + self.btn_addr648.move(220, 100) + self.btn_addr648.clicked.connect(lambda: self.send_modbus_command(648)) + + self.btn_addr649 = QPushButton("复位", self) + self.btn_addr649.move(320, 100) + self.btn_addr649.clicked.connect(lambda: self.send_modbus_command(649)) + + self.bin_addr628 = QPushButton("短路试验", self) + self.bin_addr628.move(20, 140) + self.bin_addr628.clicked.connect(lambda: self.send_modbus_command(628)) + + self.bin_addr629 = QPushButton("漏电试验", self) + self.bin_addr629.move(120, 140) + self.bin_addr629.clicked.connect(lambda: self.send_modbus_command(629)) + + self.bin_addr641 = QPushButton("过压试验", self) + self.bin_addr641.move(220, 140) + self.bin_addr641.clicked.connect(lambda: self.send_modbus_command(641)) + + self.bin_addr642 = QPushButton("电流断相试验", self) + self.bin_addr642.move(320, 140) + self.bin_addr642.clicked.connect(lambda: self.send_modbus_command(642)) + + self.bin_addr636 = QPushButton("小车进", self) + self.bin_addr636.move(20, 180) + self.bin_addr636.clicked.connect(lambda: self.send_modbus_command(636)) + + self.bin_addr637 = QPushButton("小车退", self) + self.bin_addr637.move(120, 180) + self.bin_addr637.clicked.connect(lambda: self.send_modbus_command(637)) + + def send_modbus_command(self, addr): + ip_address = self.text_ip.text() + device_id = int(self.text_device_id.text()) + + # 连接Modbus设备 + try: + master = modbus_tcp.TcpMaster(host=ip_address, port=502) + master.set_timeout(5.0) + except Exception as exc: + print(f"Failed to connect to Modbus device: {exc}") + return + + # 发送Modbus功能码0x05 + try: + master.execute(device_id, cst.WRITE_SINGLE_COIL, addr, output_value=1) + print(f"Modbus command to address {addr} sent successfully.") + except Exception as exc: + print(f"Failed to send Modbus command to address {addr}: {exc}") + finally: + master.close() + + def keyPressEvent(self, event): + if event.key() == Qt.Key_Up: + self.send_modbus_command(646) + elif event.key() == Qt.Key_Down: + self.send_modbus_command(647) + elif event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter: + self.send_modbus_command(648) + elif event.key() == Qt.Key_Space: + self.send_modbus_command(649) + elif event.key() == Qt.Key_A: + self.send_modbus_command(628) + else: + super().keyPressEvent(event) + + +if __name__ == "__main__": + app = QApplication(sys.argv) + window = ModbusControlWindow() + window.show() + sys.exit(app.exec_()) + \ No newline at end of file diff --git a/Test/test_cuver.py b/Test/test_cuver.py new file mode 100644 index 0000000..f2ddc89 --- /dev/null +++ b/Test/test_cuver.py @@ -0,0 +1,285 @@ +import sys +import serial +from serial.tools import list_ports +import struct +import threading +from PyQt5.QtWidgets import ( + QApplication, QWidget, QVBoxLayout, QHBoxLayout, QTextEdit, QLineEdit, QPushButton, + QComboBox, QLabel, QCheckBox +) +from PyQt5.QtCore import QTimer + +# 定义ZBUS命令类型 +class ZBUS_CMD: + ZBUS_FRAME_NODE_INFO_REQUEST = 0 + ZBUS_FRAME_NODE_ID_LOCK = 1 # 地址锁定命令 + ZBUS_FRAME_NODE_ID_UNLOCK = 2 + ZBUS_FRAME_ENTER_AUTO_BAUD = 3 + ZBUS_FRAME_FLUSH_GLOBAL_STATUS = 4 + ZBUS_FRAME_FLUSH_OUTPUT = 5 + ZBUS_FRAME_FLUSH_INPUT = 6 + ZBUS_FRAME_TOKEN_PASS = 7 # 令牌传递 + ZBUS_FRAME_MODBUS = 8 # Modbus RTU数据 + ZBUS_FRAME_CONFIG_TOKEN = 9 + ZBUS_FRAME_PATH_TO_NEXT = 10 + ZBUS_FRAME_TRANSMIT_AUTO_BAUD = 11 # 发送自动波特率帧, 方便从机配置波特率 + + ZBUS_FRAME_FILE_OPEN = 16 # 打开文件 + ZBUS_FRAME_FILE_WRITE = 17 # 写入文件数据 + ZBUS_FRAME_FILE_READ = 18 # 读取文件数据 + ZBUS_FRAME_FILE_CLOSE = 19 # 文件关闭 + + ZBUS_FRAME_CUSTOM_COMMAND = 20 # 可以自定义命令 + +# ZBUS常量 +ZBUS_LEAD_FLAG1 = 0x55 +ZBUS_LEAD_FLAG2 = 0xAA +ZBUS_LEAD_FLAG_TOKEN = 0xDC + +NODE_ID_GLOBAL = 0 +NODE_ID_CONFIG = 1 +NODE_ID_MODULE_AC12 = 2 + +STR_FORMAT_NAME = "name:" +STR_FORMAT_MODE = "mode:" +STR_FORMAT_WRITE = "write:" + +# 定义ZBUS通讯类 +class ZBUS: + def __init__(self) -> None: + self.SelfNodeId = NODE_ID_CONFIG # 配置节点Id + self.tx_frame_index = 0 # 发送帧索引 + + def ZBUS_CalculateLRC(self, buf_list): + lrc = sum(buf_list) # 使用 sum 函数简化计算 + return lrc & 0xFFFF + + def ZBUS_AssembleTxFrame(self, dest_node_id: int, source_node_id: int, frame_type: int, tx_buf: list): + # 组装一个发送帧 + frame_index = self.tx_frame_index + self.tx_frame_index += 1 + + tx_list = [] + if frame_type == ZBUS_CMD.ZBUS_FRAME_TRANSMIT_AUTO_BAUD: + tx_list = [0x55] * 32 + return bytes(tx_list) + + if frame_type == ZBUS_CMD.ZBUS_FRAME_TOKEN_PASS: + tx_list = struct.pack("BBB", ZBUS_LEAD_FLAG_TOKEN, dest_node_id, source_node_id) + return tx_list + + cmd = frame_type # 获取枚举值 + tx_list = struct.pack("BBBBBB", ZBUS_LEAD_FLAG1, ZBUS_LEAD_FLAG2, dest_node_id, source_node_id, cmd, frame_index) + if tx_buf is not None: + frame_size = len(tx_buf) + else: + frame_size = 0 + tx_list += struct.pack("B", frame_size) + if tx_buf is not None: + tx_list += bytes(tx_buf) + + lrc = self.ZBUS_CalculateLRC(tx_list) + tx_list += struct.pack(" None: + super().__init__() + + self.setWindowTitle("ZBUS 串口通讯") + self.setGeometry(100, 100, 800, 600) + + self.layout = QVBoxLayout() + self.setLayout(self.layout) + + self.text_area = QTextEdit() + self.layout.addWidget(self.text_area) + + self.receive_area = QTextEdit() + self.layout.addWidget(self.receive_area) + + self.hex_data_buffer = [] # 存储接收到的Hex数据 + self.ascii_data_buffer = [] # 存储接收到的ASCII数据 + + self.display_mode = QCheckBox("显示Hex数据") + self.display_mode.stateChanged.connect(self.switch_display_mode) + self.layout.addWidget(self.display_mode) + + self.create_widgets() + + self.bus = ZBUS() + self.ser = None # 串口对象 + self.serial_thread = None # 串口线程 + + self.timer = QTimer(self) + self.timer.timeout.connect(self.check_serial_insertion) + self.timer.start(1000) + + self.available_ports = set() # 用于存储当前可用的串口设备 + self.timer = QTimer(self) + self.timer.timeout.connect(self.check_serial_insertion) + self.timer.start(1000) + + self.check_serial_insertion() + + self.ThreadStop = False + + def switch_display_mode(self): + self.receive_area.clear() + if self.display_mode.isChecked(): # 显示Hex数据 + for line in self.hex_data_buffer: + self.receive_area.append(line) + else: # 显示ASCII数据 + for line in self.ascii_data_buffer: + self.receive_area.append(line) + + def create_widgets(self): + self.serial_port = QComboBox() + self.layout.addWidget(self.serial_port) + + self.baud_rate = QLineEdit("115200") + self.layout.addWidget(self.baud_rate) + + self.timeout = QLineEdit("0.5") + self.layout.addWidget(self.timeout) + + self.send_hello_btn = QPushButton("发送 Hello") + self.send_hello_btn.clicked.connect(self.send_hello) + self.layout.addWidget(self.send_hello_btn) + + self.send_auto_baud_btn = QPushButton("发送自动波特率帧") + self.send_auto_baud_btn.clicked.connect(self.send_auto_baud) + self.layout.addWidget(self.send_auto_baud_btn) + + self.send_lock_btn = QPushButton("发送节点ID锁定帧") + self.send_lock_btn.clicked.connect(self.send_lock) + self.layout.addWidget(self.send_lock_btn) + + self.get_node_status_btn = QPushButton("获取节点状态") + self.get_node_status_btn.clicked.connect(self.get_node_status) + self.layout.addWidget(self.get_node_status_btn) + + self.zbus_file_open_btn = QPushButton("打开文件") + self.zbus_file_open_btn.clicked.connect(self.zbus_file_open_test) + self.layout.addWidget(self.zbus_file_open_btn) + + self.send_custom_command_btn = QPushButton("发送自定义命令") + self.send_custom_command_btn.clicked.connect(self.send_custom_command) + self.layout.addWidget(self.send_custom_command_btn) + + self.open_serial_btn = QPushButton("打开串口") + self.open_serial_btn.clicked.connect(self.open_serial) + self.layout.addWidget(self.open_serial_btn) + + self.close_serial_btn = QPushButton("关闭串口") + self.close_serial_btn.clicked.connect(self.close_serial) + self.layout.addWidget(self.close_serial_btn) + + def detect_serial_ports(self): + return set(port.device for port in list_ports.comports()) + + def check_serial_insertion(self): + current_ports = self.detect_serial_ports() + if current_ports != self.available_ports: + self.available_ports = current_ports + self.serial_port.clear() + self.serial_port.addItems(sorted(self.available_ports)) + + def open_serial(self): + try: + if not self.serial_port.currentText(): + raise ValueError("请先选择一个串口") + + self.ser = serial.Serial( + port=self.serial_port.currentText(), + baudrate=int(self.baud_rate.text()), + timeout=float(self.timeout.text()) + ) + self.ThreadStop = False + + self.serial_thread = threading.Thread(target=self.serial_thread_func) + self.serial_thread.start() + + self.log_text(f"成功打开串口: {self.serial_port.currentText()}") + + except Exception as e: + self.log_text(f"打开串口失败: {str(e)}") + + def close_serial(self): + try: + if self.ser and self.ser.is_open: + self.ThreadStop = True + self.serial_thread.join() + self.ser.close() + self.log_text("串口已关闭") + + except Exception as e: + self.log_text(f"关闭串口失败: {str(e)}") + + def serial_thread_func(self): + while not self.ThreadStop: + try: + if self.ser.in_waiting > 0: + data = self.ser.readline() + decoded_data = data.decode('utf-8', errors='replace').replace('\x00', '') + self.ascii_data_buffer.append(decoded_data) + hex_data = ' '.join(f'{byte:02X}' for byte in data) + self.hex_data_buffer.append(hex_data) + + self.update_receive_area(decoded_data, hex_data) + except Exception as e: + self.log_text(f"读取串口数据失败: {str(e)}") + break + + def update_receive_area(self, ascii_data, hex_data): + if self.display_mode.isChecked(): # 显示Hex数据 + self.receive_area.append(hex_data) + else: # 显示ASCII数据 + self.receive_area.append(ascii_data) + + def send_data(self, data): + try: + if self.ser and self.ser.is_open: + self.ser.write(data) + self.log_text(f"发送数据: {data}") + else: + self.log_text("串口未打开") + except Exception as e: + self.log_text(f"发送数据失败: {str(e)}") + + def send_hello(self): + data = b'Hello' + self.send_data(data) + + def send_auto_baud(self): + data = self.bus.ZBUS_AssembleTxFrame(0, 1, ZBUS_CMD.ZBUS_FRAME_TRANSMIT_AUTO_BAUD, None) + self.send_data(data) + + def send_lock(self): + data = self.bus.ZBUS_AssembleTxFrame(0, 1, ZBUS_CMD.ZBUS_FRAME_NODE_ID_LOCK, None) + self.send_data(data) + + def get_node_status(self): + data = self.bus.ZBUS_AssembleTxFrame(0, 1, ZBUS_CMD.ZBUS_FRAME_NODE_INFO_REQUEST, None) + self.send_data(data) + + def zbus_file_open_test(self): + filename = "example.txt" + data = list(f"{STR_FORMAT_NAME}{filename}\n".encode()) + assembled_data = self.bus.ZBUS_AssembleTxFrame(0, 1, ZBUS_CMD.ZBUS_FRAME_FILE_OPEN, data) + self.send_data(assembled_data) + + def send_custom_command(self): + data = b'Custom Command' + self.send_data(data) + + def log_text(self, text): + self.text_area.append(text) + +# 启动 GUI +if __name__ == "__main__": + app = QApplication(sys.argv) + gui = SerialGUI() + gui.show() + sys.exit(app.exec_()) diff --git a/Test/test_modscan.py b/Test/test_modscan.py new file mode 100644 index 0000000..5d7de03 --- /dev/null +++ b/Test/test_modscan.py @@ -0,0 +1,343 @@ +from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, + QLineEdit, QMessageBox, QComboBox, QTableWidget, QTableWidgetItem, QSpinBox, QGroupBox, QFormLayout, QAction, QMenuBar) +from PyQt5.QtCore import Qt, QTimer +from PyQt5.QtGui import QFont, QIcon +from modbus_tk import modbus_tcp, modbus_rtu +import serial +from modbus_tk.defines import * + +class ModbusClient(QMainWindow): + def __init__(self): + super().__init__() + + self.init_ui() + self.master = None + self.timer = QTimer() + self.timer.timeout.connect(self.update_data) + + def init_ui(self): + self.setWindowTitle("Modbus 客户端") + self.setGeometry(100, 100, 900, 700) + self.setStyleSheet(""" + QWidget { + background-color: #2e2e2e; + color: #ffffff; + font-family: Arial; + font-size: 14px; + } + QGroupBox { + font-weight: bold; + font-size: 16px; + border: 1px solid #555; + border-radius: 5px; + margin-top: 10px; + } + QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 10px; + } + QLabel { + font-size: 14px; + } + QLineEdit, QComboBox, QSpinBox { + padding: 5px; + border: 1px solid #555; + border-radius: 5px; + background-color: #444; + color: #fff; + } + QPushButton { + background-color: #555; + border: 1px solid #444; + border-radius: 5px; + padding: 5px; + } + QPushButton:hover { + background-color: #666; + } + QPushButton:pressed { + background-color: #777; + } + QTableWidget { + background-color: #444; + alternate-background-color: #555; + border: 1px solid #555; + } + QHeaderView::section { + background-color: #333; + color: #fff; + padding: 5px; + border: 1px solid #444; + } + """) + + # 创建菜单栏 + menu_bar = self.menuBar() + file_menu = menu_bar.addMenu('文件') + connection_menu = menu_bar.addMenu('连接') + action_menu = menu_bar.addMenu('操作') + + # 创建文件菜单项 + exit_action = QAction('退出', self) + exit_action.triggered.connect(self.close) + file_menu.addAction(exit_action) + + # 创建连接菜单项 + connect_action = QAction('连接', self) + connect_action.triggered.connect(self.connect_modbus) + connection_menu.addAction(connect_action) + + disconnect_action = QAction('断开连接', self) + disconnect_action.triggered.connect(self.disconnect_modbus) + connection_menu.addAction(disconnect_action) + + # 创建操作菜单项 + execute_action = QAction('执行', self) + execute_action.triggered.connect(self.execute_action) + action_menu.addAction(execute_action) + + monitor_action = QAction('开始监视', self) + monitor_action.triggered.connect(self.toggle_monitoring) + action_menu.addAction(monitor_action) + + # 创建中心小部件 + central_widget = QWidget() + self.setCentralWidget(central_widget) + main_layout = QVBoxLayout(central_widget) + + # 连接部分 + connection_group = QGroupBox("连接设置") + connection_layout = QFormLayout() + + self.mode_combo = QComboBox() + self.mode_combo.addItem("TCP", "TCP") + self.mode_combo.addItem("RTU", "RTU") + self.mode_combo.currentIndexChanged.connect(self.toggle_mode) + connection_layout.addRow(QLabel("模式选择:"), self.mode_combo) + + self.ip_edit = QLineEdit() + self.ip_edit.setPlaceholderText("输入 IP 地址") + connection_layout.addRow(QLabel("IP 地址 / 串口端口:"), self.ip_edit) + + self.port_edit = QLineEdit() + self.port_edit.setPlaceholderText("输入端口号 / 波特率") + connection_layout.addRow(QLabel("端口号 / 波特率:"), self.port_edit) + + self.connect_button = QPushButton("连接") + self.connect_button.clicked.connect(self.connect_modbus) + connection_layout.addRow(self.connect_button) + + self.disconnect_button = QPushButton("断开连接") + self.disconnect_button.clicked.connect(self.disconnect_modbus) + self.disconnect_button.setEnabled(False) + connection_layout.addRow(self.disconnect_button) + + connection_group.setLayout(connection_layout) + main_layout.addWidget(connection_group) + + # 功能部分 + function_group = QGroupBox("功能选择") + function_layout = QFormLayout() + + self.function_combo = QComboBox() + self.function_combo.addItem("读线圈 (0)", READ_COILS) + self.function_combo.addItem("读输入 (1)", READ_DISCRETE_INPUTS) + self.function_combo.addItem("读保持寄存器 (3)", READ_HOLDING_REGISTERS) + self.function_combo.addItem("读输入寄存器 (4)", READ_INPUT_REGISTERS) + self.function_combo.addItem("写单个线圈 (5)", WRITE_SINGLE_COIL) + self.function_combo.addItem("写单个寄存器 (6)", WRITE_SINGLE_REGISTER) + self.function_combo.addItem("写多个寄存器 (16)", WRITE_MULTIPLE_REGISTERS) + + self.function_combo.currentIndexChanged.connect(self.update_function_description) + function_layout.addRow(QLabel("功能码:"), self.function_combo) + + self.function_description = QLabel() + function_layout.addRow(QLabel("功能描述:"), self.function_description) + + self.device_edit = QLineEdit() + self.device_edit.setPlaceholderText("输入设备地址") + function_layout.addRow(QLabel("设备地址:"), self.device_edit) + + self.address_edit = QLineEdit() + self.address_edit.setPlaceholderText("输入寄存器地址") + function_layout.addRow(QLabel("寄存器地址:"), self.address_edit) + + self.value_edit = QLineEdit() + self.value_edit.setPlaceholderText("输入写入值") + function_layout.addRow(QLabel("写入值:"), self.value_edit) + + self.execute_button = QPushButton("执行") + self.execute_button.clicked.connect(self.execute_action) + function_layout.addRow(self.execute_button) + + function_group.setLayout(function_layout) + main_layout.addWidget(function_group) + + # 数据部分 + data_group = QGroupBox("数据") + data_layout = QVBoxLayout() + + self.data_table = QTableWidget() + self.data_table.setColumnCount(2) + self.data_table.setHorizontalHeaderLabels(["地址", "值"]) + data_layout.addWidget(self.data_table) + + data_group.setLayout(data_layout) + main_layout.addWidget(data_group) + + # 实时监视部分 + monitor_group = QGroupBox("实时监视") + monitor_layout = QFormLayout() + self.monitor_interval_edit = QSpinBox() + self.monitor_interval_edit.setRange(100, 5000) # 设置监视间隔范围 + self.monitor_interval_edit.setValue(1000) # 设置默认值 + monitor_layout.addRow(QLabel("监视间隔(ms):"), self.monitor_interval_edit) + + self.start_address_edit = QLineEdit() + self.start_address_edit.setPlaceholderText("输入开始地址") + monitor_layout.addRow(QLabel("监视开始地址:"), self.start_address_edit) + + self.length_edit = QSpinBox() + self.length_edit.setRange(1, 100) + monitor_layout.addRow(QLabel("长度:"), self.length_edit) + + self.monitor_button = QPushButton("开始监视") + self.monitor_button.clicked.connect(self.toggle_monitoring) + monitor_layout.addRow(self.monitor_button) + + monitor_group.setLayout(monitor_layout) + main_layout.addWidget(monitor_group) + + self.update_function_description() + + def toggle_mode(self): + mode = self.mode_combo.currentData() + if mode == "TCP": + self.ip_edit.setPlaceholderText("输入 IP 地址") + self.port_edit.setPlaceholderText("输入端口号") + elif mode == "RTU": + self.ip_edit.setPlaceholderText("输入串口端口") + self.port_edit.setPlaceholderText("输入波特率") + + def connect_modbus(self): + mode = self.mode_combo.currentData() + try: + if mode == "TCP": + ip = self.ip_edit.text() + port = int(self.port_edit.text()) + self.master = modbus_tcp.TcpMaster(ip, port) + self.master.open() + elif mode == "RTU": + port = self.ip_edit.text() + baudrate = int(self.port_edit.text()) + self.master = modbus_rtu.RtuMaster(serial.Serial(port, baudrate)) + self.master.open() + QMessageBox.information(self, "连接", f"成功连接到 Modbus {mode} 设备。") + self.connect_button.setEnabled(False) + self.disconnect_button.setEnabled(True) + except Exception as e: + QMessageBox.critical(self, "连接错误", f"无法连接到 Modbus 设备: {e}") + + def disconnect_modbus(self): + if self.master: + self.master.close() + self.master = None + QMessageBox.information(self, "断开连接", "已断开与 Modbus 设备的连接。") + self.connect_button.setEnabled(True) + self.disconnect_button.setEnabled(False) + + def update_function_description(self): + descriptions = { + READ_COILS: "读线圈状态", + READ_DISCRETE_INPUTS: "读离散输入状态", + READ_HOLDING_REGISTERS: "读保持寄存器值", + READ_INPUT_REGISTERS: "读输入寄存器值", + WRITE_SINGLE_COIL: "写单个位", + WRITE_SINGLE_REGISTER: "写单个寄存器", + WRITE_MULTIPLE_REGISTERS: "写多个寄存器", + } + function_code = self.function_combo.currentData() + self.function_description.setText(descriptions.get(function_code, "")) + + def execute_action(self): + if not self.master: + QMessageBox.warning(self, "连接", "请先连接到 Modbus 设备。") + return + + function_code = self.function_combo.currentData() + device = int(self.device_edit.text()) + address = int(self.address_edit.text()) + + try: + if function_code in [READ_COILS, READ_DISCRETE_INPUTS]: + response = self.master.execute(device, function_code, address, 1) + data = response[0] + self.display_data({address: data}) + elif function_code in [READ_HOLDING_REGISTERS, READ_INPUT_REGISTERS]: + response = self.master.execute(device, function_code, address, 1) + data = response[0] + self.display_data({address: data}) + elif function_code == WRITE_SINGLE_COIL: + value = int(self.value_edit.text()) + if value not in [0, 1]: + raise ValueError("写线圈的值必须为0或1") + self.master.execute(device, function_code, address, output_value=value) + QMessageBox.information(self, "写入", "写入操作成功完成。") + elif function_code == WRITE_SINGLE_REGISTER: + value = int(self.value_edit.text()) + self.master.execute(device, function_code, address, output_value=value) + QMessageBox.information(self, "写入", "写入操作成功完成。") + elif function_code == WRITE_MULTIPLE_REGISTERS: + values_str = self.value_edit.text() + values = [int(val) for val in values_str.split(",")] + self.master.execute(device, function_code, address, output_value=values) + QMessageBox.information(self, "写入", "写入操作成功完成。") + except Exception as e: + QMessageBox.critical(self, "错误", f"执行操作时出错: {e}") + + def display_data(self, data): + # 批量更新表格 + self.data_table.setRowCount(len(data)) + for i, (address, value) in enumerate(data.items()): + self.data_table.setItem(i, 0, QTableWidgetItem(str(address))) + self.data_table.setItem(i, 1, QTableWidgetItem(str(value))) + + def toggle_monitoring(self): + if self.timer.isActive(): + self.timer.stop() + self.monitor_button.setText("开始监视") + else: + self.timer.start(self.monitor_interval_edit.value()) + self.monitor_button.setText("停止监视") + + def update_data(self): + if not self.master: + self.timer.stop() + self.monitor_button.setText("开始监视") + QMessageBox.warning(self, "连接", "请先连接到 Modbus 设备。") + return + + try: + device = int(self.device_edit.text()) + start_address = int(self.start_address_edit.text()) + length = self.length_edit.value() + + response = self.master.execute(device, READ_HOLDING_REGISTERS, start_address, length) + + # 将数据转换为地址-值对的字典 + data = {start_address + i: val for i, val in enumerate(response)} + + # 更新表格 + self.display_data(data) + except Exception as e: + self.timer.stop() + self.monitor_button.setText("开始监视") + QMessageBox.critical(self, "错误", f"读取数据时出错: {e}") + +if __name__ == "__main__": + app = QApplication([]) + app.setFont(QFont("Arial", 10)) # 设置全局字体 + window = ModbusClient() + window.show() + app.exec_() diff --git a/Test/video.py b/Test/video.py new file mode 100644 index 0000000..f0ececf --- /dev/null +++ b/Test/video.py @@ -0,0 +1,35 @@ +import sys +from PyQt5.QtWidgets import QApplication, QMainWindow, QTextBrowser, QWidget, QLabel, QPushButton, QFileDialog +from PyQt5.QtGui import QImage, QPixmap +from PyQt5.QtCore import QTimer, Qt +import cv2 + +class CameraWindow(QMainWindow): + def __init__(self): + super().__init__() + self.cap = cv2.VideoCapture(0) # 默认摄像头 + self.timer = QTimer() + self.initUI() + self.timer.timeout.connect(self.update_frame) + + def initUI(self): + self.setGeometry(100, 100, 640, 480) + self.setWindowTitle('Camera Feed') + self.show() + self.timer.start(20) + + def update_frame(self): + ret, frame = self.cap.read() + if ret: + height, width, _ = frame.shape + bytes_per_line = 3 * width + cv2_img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) + qt_img = QImage(cv2_img.data, width, height, bytes_per_line, QImage.Format_RGB888) + qt_img = qt_img.scaled(self.width(), self.height(), Qt.KeepAspectRatio) + self.setCentralWidget(QLabel(self)) + self.centralWidget().setPixmap(QPixmap.fromImage(qt_img)) + +if __name__ == '__main__': + app = QApplication(sys.argv) + window = CameraWindow() + sys.exit(app.exec_()) \ No newline at end of file diff --git a/TestSqlite.py b/TestSqlite.py new file mode 100644 index 0000000..12b4530 --- /dev/null +++ b/TestSqlite.py @@ -0,0 +1,144 @@ +import paho.mqtt.client as mqtt +import sqlite3 +import sys +import json +import threading +from datetime import datetime +from queue import Queue +from flask import Flask, render_template, request +from flask_socketio import SocketIO, emit +from flask import request + +app = Flask(__name__) +socketio = SocketIO(app) + +# MQTT Broker 配置 +mqtt_server = { + "remote": "192.168.1.106", + "port": 1883, + "user_name": "admin", + "password": "miler502" +} +topic = "measure/#" +database = "mqtt_messages.db" + +# 初始化数据库连接和表 +def init_db(): + with sqlite3.connect(database) as conn: + cursor = conn.cursor() + cursor.execute(''' + CREATE TABLE IF NOT EXISTS messages ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + topic TEXT NOT NULL, + alarm_id TEXT NOT NULL, + alarm_value TEXT NOT NULL, + car_position_msg TEXT NOT NULL, + timestamp DATETIME NOT NULL + ) + ''') + conn.commit() + +# 初始化数据库 +init_db() + +# 消息队列 +message_queue = Queue() + +# Function to fetch historical data from the database +def get_historical_data(topic): + with sqlite3.connect(database) as conn: + cursor = conn.cursor() + cursor.execute("SELECT * FROM messages WHERE topic=?", (topic,)) + return cursor.fetchall() + +# 后端 API +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/history/') +def history(topic): + topic = topic.replace('%2F', '/') # 修正路径中的斜杠 + historical_data = get_historical_data(topic) + return render_template('history.html', topic=topic, historical_data=historical_data) + +#有问题暂时未实现 +@app.route('/clear_history//', methods=['POST']) +def clear_history(topic): + topic = topic.replace('%3F', '/') # 修正路径中的斜杠 + try: + with sqlite3.connect(database) as conn: + cursor = conn.cursor() + cursor.execute("DELETE FROM messages WHERE topic=?", (topic,)) + conn.commit() + return 'History cleared successfully' + except Exception as e: + return f"Failed to clear history: {e}", 500 + + + +# 定时器线程函数 +def process_messages(): + while True: + try: + topic, alarm_id, alarm_value, car_position_msg = message_queue.get(timeout=3) + with sqlite3.connect(database) as conn: + cursor = conn.cursor() + current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + cursor.execute(''' + INSERT INTO messages (topic, alarm_id, alarm_value, car_position_msg, timestamp) VALUES (?, ?, ?, ?, ?) + ''', (topic, alarm_id, alarm_value, car_position_msg, current_time)) + conn.commit() + # 将消息通过 WebSocket 发送给前端 + socketio.emit('new_message', { + 'topic': topic, + 'alarm_id': alarm_id, + 'alarm_value': alarm_value, + 'car_position_msg': car_position_msg, + 'timestamp': current_time + }) + # print(f"Successfully inserted and sent message: {topic}, {alarm_id}, {alarm_value}, {car_position_msg}, {current_time}") + except Queue.Empty: + pass + except Exception as e: + print(f"Failed to insert message into database: {e}", file=sys.stderr) + +# 启动定时器线程 +threading.Thread(target=process_messages, daemon=True).start() + +# MQTT 回调函数 +def on_connect(client, userdata, flags, rc): + if rc == 0: + print("Connected successfully") + client.subscribe(topic) + else: + print(f"Connect failed with code {rc}") + +def on_message(client, userdata, msg): + try: + payload = msg.payload.decode() + data = json.loads(payload) + alarm_id = data.get("AlarmId", "") + alarm_value = data.get("AlarmMessage", {}).get("value", "") + car_position_msg = data.get("CarPositionMsg", "") + message_queue.put((msg.topic, alarm_id, alarm_value, car_position_msg)) + except Exception as e: + print(f"Failed to process message: {e}", file=sys.stderr) + +# 设置 MQTT 客户端 +client = mqtt.Client() +client.username_pw_set(mqtt_server["user_name"], mqtt_server["password"]) +client.on_connect = on_connect +client.on_message = on_message + +# 启动 Flask 应用和 MQTT 客户端 +if __name__ == '__main__': + try: + mqtt_thread = threading.Thread(target=lambda: client.connect(mqtt_server["remote"], mqtt_server["port"], 60)) + mqtt_thread.start() + client.loop_start() + socketio.run(app, host='0.0.0.0', port=5000) + except Exception as e: + print(f"Failed to start server: {e}", file=sys.stderr) + finally: + client.loop_stop() diff --git a/TestWebMsg.py b/TestWebMsg.py new file mode 100644 index 0000000..903cf12 --- /dev/null +++ b/TestWebMsg.py @@ -0,0 +1,92 @@ +import paho.mqtt.client as mqtt +import sys +import json +import threading +from datetime import datetime +from queue import Queue, Empty +from flask import Flask, render_template, request +from flask_socketio import SocketIO, emit + +app = Flask(__name__) +socketio = SocketIO(app) + +# MQTT Broker 配置 +mqtt_server = { + "remote": "192.168.1.106", + "port": 1883, + "user_name": "admin", + "password": "miler502" +} +topic = "measure/#" + +# 消息队列 +message_queue = Queue() + +# 后端 API +@app.route('/') +def index(): + return render_template('index.html') + +# 有问题暂时未实现 +@app.route('/history//', methods=['POST']) +def clear_history(topic): + return 'History feature not implemented' + +# 定时器线程函数 +def process_messages(): + while True: + try: + topic, alarm_id, alarm_value, car_position_msg = message_queue.get(timeout=3) + current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + # 将消息通过 WebSocket 发送给前端 + socketio.emit('new_message', { + 'topic': topic, + 'alarm_id': alarm_id, + 'alarm_value': alarm_value, + 'car_position_msg': car_position_msg, + 'timestamp': current_time + }) + except Empty: + pass + except Exception as e: + print(f"Failed to process message: {e}", file=sys.stderr) + +# 启动定时器线程 +threading.Thread(target=process_messages, daemon=True).start() + +# MQTT 回调函数 +def on_connect(client, userdata, flags, rc): + if rc == 0: + print("Connected successfully") + client.subscribe(topic) + else: + print(f"Connect failed with code {rc}") + +def on_message(client, userdata, msg): + try: + payload = msg.payload.decode() + data = json.loads(payload) + alarm_id = data.get("AlarmId", "") + alarm_value = data.get("AlarmMessage", {}).get("value", "") + car_position_msg = data.get("CarPositionMsg", "") + message_queue.put((msg.topic, alarm_id, alarm_value, car_position_msg)) + except Exception as e: + print(f"Failed to process message: {e}", file=sys.stderr) + +# 设置 MQTT 客户端 +client = mqtt.Client() +client.username_pw_set(mqtt_server["user_name"], mqtt_server["password"]) +client.on_connect = on_connect +client.on_message = on_message + +# 启动 Flask 应用和 MQTT 客户端 +if __name__ == '__main__': + try: + mqtt_thread = threading.Thread(target=lambda: client.connect(mqtt_server["remote"], mqtt_server["port"], 60)) + mqtt_thread.start() + client.loop_start() + socketio.run(app, host='0.0.0.0', port=5000) + except Exception as e: + print(f"Failed to start server: {e}", file=sys.stderr) + finally: + client.loop_stop() diff --git a/ZZ_9TE.py b/ZZ_9TE.py new file mode 100644 index 0000000..7489019 --- /dev/null +++ b/ZZ_9TE.py @@ -0,0 +1,649 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_page +from comm_device import class_comm_device +from comm_thread import class_comm_master_thread +from menu_base import class_device_menu +import menu_utils as utils +import comm_global +from enum import Enum +import math +from comm_modbus_device import class_modbus_comm_device +from comm_protocol_modbus import class_protocol_modbus + +from enum import Enum + +class Alarm(Enum) : + NO_ERR = 0, #无故阿 + ERR_CREEPAGE_LOCK = 1, #漏电报警 + ERR_VOLTAGE_LOW = 2, #欠压报警 + ERR_OVER_CURRENT = 3, #过流保护 + ERR_SHORT_CURRENT = 4, #短路保护 + ERR_CREEPAGE_SELECT = 5, #选择性报? + ERR_UNBANLANCE_CURRENT = 6, #三相不平衡报? + ERR_FLASH_FAIL = 7, #FLASH无法写入 + ERR_CREEPAGE_ACTIVE = 8, #漏电动作 + ERR_BREAK_PHASE = 9, #断相保护动作 + ERR_VOLTAGE_BREAK_PHASE = 10, #电压断相 + ERR_GAS_LOCK = 11, #瓦斯闭锁 + ERR_WIND_MOTOR_LOCK = 12, #风电闭锁 + ERR_VOLTAGE_OVER = 13, #过压报警 + ERR_SHORT_PHASE = 14, #相敏短路 + ERR_WATCH_DOG = 15, #看门狗保房 + ERR_SWITCH_FAIL = 16, #开关粘轿 + ERR_SWITCH_THROUGH = 17, #开关击? + ERR_SWITCH_ON_FAIL = 18, #开关合闸失? + ERR_COMM_FAIL = 19, #通讯故障 + ERR_CREEPAGE_SELECT2 = 20, #选择性报? + ERR_TEMP_IO_HIGH = 21, #IO口温度过驿 + ERR_SHORT_CURRENT_SIGNAL = 22, #信号电流短路 + ERR_REMOTE_OFF = 23, #远方分励 + ERR_REPAIR = 24, #维修状? + ERR_TEMP_ALARM = 25, #温度报警 + ERR_QUICK_CREEPAGE_ACT = 26, #快速漏电动仿 + ERR_GB_LEEK_SHORT = 27, #高爆绝缘短路 + ERR_GB_LEEK_BREAK = 28, #高爆绝缘断路 + ERR_YB_LOW_VOLTAGE_FAIL = 29, #移变低压侧失? + ERR_YB_LOW_VOLTAGE_UNREADY = 30, #移变低压侧未准备? + ERR_WS_FREQ_FAIL = 31, #瓦斯浓度超标 + ERR_HIGH_LOW_LOCK = 32, #高低压联钿 + ERR_MOTOR_ROTATE_LOCK = 33, #电机堵转 + ERR_FIX_TIME_OVER_CURRENT = 34, #定时限过泿 + ERR_FIX_TIME_SHORT_CURRENT = 35, #定时限短? + ERR_PHASE_ERROR = 36, #相序故障 + ERR_UNDER_LOAD = 37, #欠载保护 + ERR_PHASE_UNMATCH = 38, #互感器反? + ERR_EXTERNAL_ALARM = 39, #外部故障 + ERR_SENSOR_LOSS = 40, #水位传感器未? + ERR_ROTOR_SLOW = 41, + ERR_ROTOR_LOCK = 42, + ERR_POWER_LOSS = 43, #系统断电 + ERR_RSV1 = 44, + ERR_RSV2 = 45, + ERR_RSV3 = 46, + ERR_RSV4 = 47, + ERR_RSV5 = 48, + ERR_RSV6 = 49, + ERR_RSV7 = 50, + ERR_USER_ALARM1 = 51, #=50, 用户自定义故阿 + ERR_USER_ALARM2 = 52, #=51,用户自定义故阿 + ERR_USER_ALARM3 = 53,#=52,用户自定义故阿 + ERR_USER_ALARM4 = 54, #=53,用户自定义故阿 + ERR_GB_LIGHT_THREAD_SON_LOSS = 55, + ERR_GB_LIGHT_THREAD_BROTHER_LOSS = 56, + ERR_GB_LIGHT_MODULE_LOSS = 57, + ERR_GB_FORCE_LEEK_OFF = 58, + ERR_GB_FORCE_SHORT_OFF = 58, + ERR_GB_CREEPAGE_SELECT = 59, #选择性报警 + ERR_SWITCH_OUT_POSITION = 60, + ERR_DZM_CREEPAGE_ACTIVE = 61, + ERR_OIL_PRESSURE_SENSOR_FAIL = 62, + ERR_FREQ_SENSOR_EXCEED = 63, + ERR_FREQ_SENSOR_FAIL = 64, + ERR_ANALOG_SENSOR_EXCEED = 65, + ERR_ANALOG_SENSOR_FAIL = 66, + ERR_VOLTAGE_LOSS = 67, + ERR_SPEED_LOSS = 68, + ERR_GB_ZERO_VOLT_OVER = 69, #零序过压 + ERR_PT_BREAK = 70, + ERR_CT_BREAK = 71, + ERR_ZERO_OVER_VOLTAGE = 72, + ERR_ZERO_OVER_CURRENT = 73, + ERR_GAS_WARNING = 74, + ERR_TEMP_WARNING = 75, + ERR_COMM_LOSS = 76, + ERR_CAR_FAIL = 77, + ERR_WATER_LOW = 78, + ERR_SWITCH_DIDAO_IN_POSITION = 79, + ERR_SWITCH_DIDAO_MID_POSITION =80, + ERR_GB_CREEPAGE_SELECT_5 = 81, #5次谐波选漏 + ERR_FLUX_LOCK = 82, + ERR_GLOBAL_OIL_TEMP_LOCK = 83, + ERR_GLOBAL_WATER_PRESSURE_LOCK = 84, + ERR_GLOBAL_WATER_LEVEL_LOCK = 85, + ERR_GLOBAL_CURRENT_SENSOR_LOSS = 86, + ERR_GLOBAL_GAS_PERCENTAGE_LOCK = 87, + ERR_GLOBAL_GAS_SENSOR_LOSS = 88, + ERR_MEASURE_OVER_CURRENT = 89, #测量回路过流保护 + ERR_CREAPGE_BREAK = 90, + ERR_REMOTE_CREAPGE_TEST_FAIL = 91, + ERR_REMOTE_CREAPGE_TEST_SUCCESS = 92, + ERR_ISOLATE_ALARM = 93, + ERR_DIDAO_FAIL = 94, + ERR_EARTH_NOT_READY = 95, + ERR_ISOLATE_NOT_READY = 96, + + +alias_table = [ + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"3300V", 1:"6000V", 2:"10000V"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_input": {0: "常开", 1: "常闭"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_alarm": {0: "无故障", 1: "定时限短路", 2 : "定时限过流1段", 3: "定时限过流2段"}}, + {"alias_test": {0: "测试", 1: "动作"}}, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmType", + "addr": "8138", + "alias": "alias_test" + }, +] + +mqtt_pack_measure = [ + { + "name": "OnStatus", + "addr": "8162.0", + "alias": "alias_onoff", + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_STATUS, + "scale": 1.0, + "format": "%1.0f", + "mqtt" : "OnStatus", + }, + { + "name": "AlarmStatus", + "addr": "8166", + "alias": "alias_alarm", + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_ALARM, + "scale": 1.0, + "format": "%1.0f", + "mqtt" : "AlarmStatus", + }, + { + "name": "Ia", + "unit": "A", + "addr": "8156", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "mqtt" : "Ia", + }, + { + "name": "Ib", + "unit": "A", + "addr": "8157", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IB, + "mqtt" : "Ib", + }, + { + "name": "Ic", + "unit": "A", + "addr": "8158", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IC, + "mqtt" : "Ic", + }, + { + "name": "Uab", + "unit": "V", + "addr": "8153", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "mqtt" : "Uab", + }, + { + "name": "Ubc", + "unit": "V", + "addr": "8154", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UBC, + "mqtt" : "Ubc", + }, + { + "name": "Uca", + "unit": "V", + "addr": "8155", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UCA, + "mqtt" : "Uca", + }, + { + "name": "Uo", + "unit": "V", + "addr": "8152", + "format": "%1.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UO, + "mqtt" : "Uo", + }, + { + "name": "Io", + "unit": "mA", + "addr": "8151", + "format": "%1.0f", + "scale" : 1.0, + "remap_addr" : remap.COMM_REMAP_MEASURE_FLOAT_IO, + "mqtt" : "Io", + }, + { + "name": "Ro", + "unit": "K", + "addr": "8150", + "scale": 0.1, + "format": "%2.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_RO, + "mqtt" : "Ro", + }, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmType", + "addr": "8138", + "alias": "alias_test" + }, +] + + +modbus_comm_table = [ + {"name":"status", "comm_str" : "8162#4", "reg_addr":8162, "reg_count":4, "cycle": 100}, + {"name":"alarm", "comm_str" : "8120#10", "reg_addr":8120, "reg_count":10, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, + {"name":"measure", "comm_str" : "8139#35", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, + {"name":"comm_cmd", "comm_str" : "100618#32", "reg_addr":100618, "reg_count":32, "cycle": 0}, + #{"name":"key_group", "comm_str" : "8162#4", "reg_addr":1000, "reg_count":8, "cycle": 20}, + {"name":"para_group", "comm_str" : "2000#10", "reg_addr":2000, "reg_count":10, "cycle": 0}, + {"name":"time_group", "comm_str" : "2300#6", "reg_addr":2300, "reg_count":6, "cycle": 500}, + {"name":"protect_group", "comm_str" : "8174#46", "reg_addr":8174, "reg_count":46, "cycle": 0}, + #{"name":"ip_addr_group", "comm_str" : "8410#6", "reg_addr":8410, "reg_count":6, "cycle": 0}, + #{"name":"ip_group", "comm_str" : "8271#8", "reg_addr":8271, "reg_count":8, "cycle": 0}, + {"name":"inter_group", "comm_str" : "8240#10", "reg_addr":8240, "reg_count":10, "cycle": 0}, +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + + if not hasattr(comm_table_item, "name"): + return False + + #添加on_status 与 prev_on_status, 用于判断合闸状态是否发送变化 + if not hasattr(object_comm_table, 'prev_on_status'): + object_comm_table.prev_on_status = False + + if not hasattr(object_comm_table, 'prev_alarm_id'): + object_comm_table.prev_alarm_id = 0 + + onstatus = object_comm_table.read_register_u16(8162) + if onstatus == None : + return False + onstatus = onstatus & 0x1 + alarm_id = object_comm_table.read_register_u16(8166) + if alarm_id == None : + return False + + prev_on_status = object_comm_table.prev_on_status + prev_alarm_id = object_comm_table.prev_alarm_id + + if prev_on_status != onstatus : + #合分闸状态发生改变, 触发"measure"通讯组 + if comm_table_item.name == "measure" : + object_comm_table.prev_on_status =onstatus + return True + + if prev_alarm_id != alarm_id : + #故障状态发生改变, 触发"alarm"通讯组 + if comm_table_item.name == "alarm" : + object_comm_table.prev_alarm_id = alarm_id + return True + + return False + +menu_current = [ #菜单表[menu_current],存储菜单项属性字典<> + { + "name": "额定电流", + "unit": "A", + "addr": "2000", + "scale" : 0.1, + "format": "%05.1f", + "min" : 1.0, + "max" : 400.0, + "mqtt" : "Ie", + "remap_addr": remap.COMM_REMAP_PARA_CURRENT_RATE, + }, + { + "name": "短路倍数", + "unit": "倍", + "scale" : 0.01, + "format": "%05.2f", + "addr": "2001", + "mqtt" : "ShortIe", + "remap_addr": remap.COMM_REMAP_PARA_CURRENT_SHORT_MUL, + }, + { + "name": "退出", + "action": "exit", + }, +] + +CONVERT_FROM_ORIGIN_VALUE_TO_REMAP_VALUE = 0 +CONVERT_FROM_REMAP_VALUE_TO_ORIGIN_VALUE = 0 + +def func_rate_voltage_convert(value, type) : + if type == CONVERT_FROM_ORIGIN_VALUE_TO_REMAP_VALUE : + if value == 0 : + result = 380 + elif value == 1 : + result = 660 + else : + result = 1140 + else : + if value == 380 : + result = 0 + elif value == 660 : + result = 1 + else : + result = 2 + return result + +menu_voltage = [ + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "mqtt" : "Ue", + "remap_addr": remap.COMM_REMAP_PARA_RATE_VOLTAGE, + "convert": func_rate_voltage_convert, + }, + { + "name": "欠压比值", + "unit": "Ue", + "addr": "2004", + "scale" : 0.001, + "format": "%05.3f", + "mqtt" : "UnderVoltageRatio", + "remap_addr": remap.COMM_REMAP_PARA_LOW_VOLTAGE_RATIO, + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "2005", + "scale" : 0.1, + "format": "%05.1f", + "mqtt" : "UnderVoltageDelay", + "remap_addr": remap.COMM_REMAP_PARA_LOW_VOLTAGE_DELAY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm = [ + { + "name": "故障查询", + "action": "alarm_query", + }, + { + "name": "故障清除", + "action": "alarm_clear", + }, + { + "name": "退出", + "action": "exit", + }, +] + +# 缺省action处理函数 +def func_action_process(device : class_modbus_comm_device, menu_item = None) : + action_str = utils.dict_or_object_get_attr(menu_item, "action", " ") + mqtt_name = utils.dict_or_object_get_attr(menu_item, "mqtt", " ") + if action_str == "write_bit" : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", " ") + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + + if reg_count == 1: + command_value = [1] + result = device.write_bit_register(reg_addr, command_value) + if device.mqtt_thread : + device.mqtt_thread.publish("response/action/" + device.unique_name, '{"name" : "%s", "result" : %d}'%(mqtt_name, result)) + +menu_switch_cmd = [ + { + "name": "通讯合闸", + "action": "write_bit", + "addr" : "100618", + "mqtt" : "SwitchOn", + }, + { + "name": "通讯分闸", + "action": "write_bit", + "addr" : "100619", + "mqtt" : "SwitchOff", + }, + { + "name": "通讯复位", + "action": "write_bit", + "addr" : "100620", + "mqtt" : "SwitchRst", + }, +] + +menu_test = [ + { + "name": "短路试验", + "action": "write_bit", + "addr" : "100628", + "mqtt" : "TestShort", + }, + { + "name": "漏电试验", + "action": "write_bit", + "addr" : "100629", + "mqtt" : "TestIsolation", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_protect_set = [ + { + "name": "短路保护", + "alias": "alias_bool", + "addr": "8192.1", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + }, + { + "name": "反时限过流", + "alias": "alias_bool", + "addr": "8192.3", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + }, + { + "name": "瓦斯闭锁", + "alias": "alias_bool", + "addr": "8174.13", + }, + { + "name": "电压断相", + "alias": "alias_bool", + "addr": "8174.2", + }, + { + "name": "相序保护", + "alias": "alias_bool", + "addr": "8174.3", + }, + { + "name": "漏电动作", + "alias": "alias_bool", + "addr": "8174.6", + }, + { + "name": "选漏保护", + "alias": "alias_bool", + "addr": "8174.7", + }, + { + "name": "风电闭锁", + "alias": "alias_bool", + "addr": "8175.0", + }, + + { + "name": "退出", + "action": "exit", + }, +] + +menu_comm_set = [ + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + }, + { + "name": "IP设置", + "addr": "8410#2", + "action": "ip", + }, + { + "name": "IP网关", + "addr": "8412#2", + "action": "ip", + }, + { + "name": "IP掩码", + "addr": "8414#2", + "action": "ip", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "瓦斯触点", + "alias": "alias_input", + "addr": "8190", + }, + { + "name": "风电触点", + "alias": "alias_input", + "addr": "8248", + }, + { + "name": "系统日期", + "addr": "2300#3", + "action": "date", + }, + { + "name": "当前时间", + "addr": "2303#3", + "action": "time", + }, + { + "name": "退出", + "action": "exit", + }, +] + +Menu_Top = [ + { + "name": "电流设置", + "sub_menu": "menu_current", + }, + { + "name": "电压设置", + "sub_menu": "menu_voltage" + }, + { + "name": "系统设置", + "sub_menu": "menu_system" + }, + { + "name": "保护设置", + "sub_menu": "menu_protect_set" + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set" + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm" + }, + { + "name": "保护试验", + "sub_menu": "menu_test" + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_caption = [ + {"name" : "Menu_Top", "menu" : Menu_Top, "next" : Menu_Top, "prev" : Menu_Top, "caption": "主菜单", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_current", "menu" : menu_current, "next" : menu_current, "prev" : menu_current, "caption": "电流设置", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_voltage", "menu" : menu_voltage, "next" : menu_voltage, "prev" : menu_voltage, "caption": "电压设置", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "next" : menu_system, "prev" : menu_system, "caption": "系统设置", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "next" : menu_protect_set, "prev" : menu_protect_set, "caption": "保护设置", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "next" : menu_comm_set, "prev" : menu_comm_set, "caption": "通讯设置", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_alarm", "menu" : menu_alarm, "next" : menu_alarm, "prev" : menu_alarm, "caption": "故障查询", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_test", "menu" : menu_test, "next" : menu_test, "prev" : menu_test, "caption": "保护试验", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "next" : mqtt_pack_alarm, "prev" : mqtt_pack_alarm, "caption": "报警数据", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "mqtt_pack_measure", "menu" : mqtt_pack_measure, "next" : mqtt_pack_measure, "prev" : mqtt_pack_measure, "caption": "测量数据", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, + {"name" : "menu_switch_cmd", "menu" : menu_switch_cmd, "next" : menu_switch_cmd, "prev" : menu_switch_cmd, "caption": "通讯命令", "page" : menu_page.KUNLUN_GRAOUP_PAGE_MENU, "max_items" : 8}, +] + +class class_9TE_comm_device_config(class_comm_device_config): + def __init__(self): + class_comm_device_config.__init__(self) + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_top + def get_menu_top(self) : + return Menu_Top + + #@override menu_get_display_page + def menu_get_display_page(self, active_menu): + return menu_page.KUNLUN_GRAOUP_PAGE_MENU + + def get_menu_caption_info(self) : + return menu_caption + + def modify_menu_item(self, menu_item, value) : + alias_name = utils.dict_or_object_get_attr(menu_item, "alias", None) + if isinstance(alias_name, Enum) : + alias_name = alias_name.name + + is_alias = False + if alias_name != None : + is_alias = True + value = math.round(value) #别名值需要为整数 + + return False + + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_9TE_comm_device_config() diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..cf3568c --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +from print_color import * \ No newline at end of file diff --git a/appwindow.sh b/appwindow.sh new file mode 100644 index 0000000..55d97be --- /dev/null +++ b/appwindow.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# 设置路径变量 +ENV_PATH="/home/zzkj/myenv/bin/activate" +# SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/GB_ZM_4/APPWindow.py" +# SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/GB_ZM_6/APPWindow.py" +# SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/GB_ZM_8/APPWindow.py" +# SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/KD_ZM_4/APPWindow.py" +# SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/KD_ZM_6/APPWindow.py" +SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/ZM_4/APPWindow.py" +# SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/KD_GB_ZM/APPWindow.py" +#SCRIPT2_PATH="/home/zzkj/MenuPython_QT/QT5_Project/TestProject/APPWindow.py" +# 日志文件路径 +LOG_FILE="/var/log/appwindow.log" + +# 清空日志文件 +clear_log_file() { + echo "[$(date '+%y-%m-%d %H:%M:%S')] 清空日志文件" > $LOG_FILE +} + +# 激活虚拟环境 +source "$ENV_PATH" + +# 运行APPWindow.py + +python3 "$SCRIPT2_PATH" + +#打印日志显示取消下列注释 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 APPWindow.py" >> $LOG_FILE +# python3 $SCRIPT2_PATH >> $LOG_FILE 2>&1 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 完成 APPWindow.py" >> $LOG_FILE +# 检查日志文件大小是否超过10MB并清空 +# if [ $(du -m "$LOG_FILE" | cut -f1) -gt 10 ]; then + # clear_log_file +# fi + diff --git a/appwindow_rk3568_1024_600.sh b/appwindow_rk3568_1024_600.sh new file mode 100644 index 0000000..28a9e3c --- /dev/null +++ b/appwindow_rk3568_1024_600.sh @@ -0,0 +1,36 @@ +#!/bin/bash + + +SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/ZM_4/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/GB_ZM_4/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/GB_ZM_6/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/GB_ZM_8/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/KD_ZM_4/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/KD_ZM_6/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/KD_ZM_8/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/KD_GB_ZM/APPWindow.py" +# SCRIPT2_PATH="/home/linaro/MenuPython_QT/QT5_Project/TestProject/APPWindow.py" +# 日志文件路径 +#LOG_FILE="/var/log/appwindow.log" + +# 清空日志文件 +clear_log_file() { + echo "[$(date '+%y-%m-%d %H:%M:%S')] 清空日志文件" > $LOG_FILE +} + +# 激活虚拟环境 +source "$ENV_PATH" + +# 运行APPWindow.py + +python3 "$SCRIPT2_PATH" + +#打印日志显示取消下列注释 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 APPWindow.py" >> $LOG_FILE +# python3 $SCRIPT2_PATH >> $LOG_FILE 2>&1 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 完成 APPWindow.py" >> $LOG_FILE +# 检查日志文件大小是否超过10MB并清空 +# if [ $(du -m "$LOG_FILE" | cut -f1) -gt 10 ]; then + # clear_log_file +# fi + diff --git a/clean_log.sh b/clean_log.sh new file mode 100644 index 0000000..e2f998c --- /dev/null +++ b/clean_log.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# 设置最大日志文件大小 +MAX_LOG_SIZE=$((10 * 1024 * 1024)) # 10MB + +# 函数: 清理日志文件 +clean_log() { + local log_file=$1 + + # 设置日志备份文件路径 + local backup_log_file="${log_file}_$(date '+%Y-%m-%d_%H-%M-%S').log" + + if [ -f "$log_file" ]; then + local log_size=$(stat -c%s "$log_file") + if [ "$log_size" -ge "$MAX_LOG_SIZE" ]; then + mv "$log_file" "$backup_log_file" + echo "[$(date '+%Y-%m-%d %H:%M:%S')] 日志文件 $log_file 已备份并清空。" > "$log_file" + fi + fi +} + +# 清理传递的所有日志文件 +for log_file in "$@"; do + clean_log "$log_file" +done + +echo "[$(date '+%Y-%m-%d %H:%M:%S')] 清理日志脚本运行完成。" >> "/var/log/startup_script.log" diff --git a/comm_cycle_item.py b/comm_cycle_item.py new file mode 100644 index 0000000..a58e03c --- /dev/null +++ b/comm_cycle_item.py @@ -0,0 +1,49 @@ +import menu_utils as utils +from print_color import * +from comm_protocol_modbus import class_protocol_modbus + +class class_comm_cycle_item() : + def __init__(self, name = "", reg_addr = 0, reg_count = 0, cycle = 0, mqtt_pack = None, remap_addr = 0): + self.reg_addr = reg_addr + self.reg_count = reg_count + self.cycle = cycle + self.name = name + self.remain_cycle = 0 + self.comm_delay = 0 + self.comm_count = 0 + self.comm_fail_count = 0 + self.comm_success_count = 0 + self.comm_success = False + self.comm_trigger = False + self.mqtt_pack = mqtt_pack + self.remap_addr = remap_addr + self.reg_buf = [] + + def in_range(self, reg_addr, reg_count) : + reg_addr_begin = self.reg_addr + reg_addr_end = self.reg_addr + self.reg_count + if reg_addr >= reg_addr_begin and reg_addr + reg_count <= reg_addr_end : + return True + return False + + def update_item_value(self, reg_addr, reg_count, new_value) : + if self.in_range(reg_addr, reg_count) and len(self.reg_buf) : + reg_off = reg_addr - self.reg_addr + new_reg = list(self.reg_buf) + for i in range(reg_count) : + new_reg[reg_off + i] = new_value[i] + self.reg_buf = new_reg + self.comm_trigger = True + + def read_register_count(self, reg_addr, reg_count) : + reg_addr_begin = self.reg_addr + reg_addr_end = self.reg_addr + self.reg_count + result = None + if reg_addr >= reg_addr_begin and reg_addr + reg_count <= reg_addr_end : + if len(self.reg_buf) >= self.reg_count: + result = [] + reg_off = reg_addr - self.reg_addr + for i in range(reg_count): + result.append(self.reg_buf[reg_off + i]) + + return result diff --git a/comm_device.py b/comm_device.py new file mode 100644 index 0000000..e460beb --- /dev/null +++ b/comm_device.py @@ -0,0 +1,99 @@ +import struct +from comm_protocol import class_protocol + +DEFAULT_COMM_WRITE_TIMEOUT_MS = 500 + +#通讯设备基类, 派生类需要实现 device_comm_cycle函数, read_register函数, write_registers函数 +class class_comm_device() : + def __init__(self, + comm_addr = 0, + device_remap = None, + unique_name = None, + protocol : class_protocol = None) : + + self.comm_active = True + self.comm_addr = comm_addr + self.device_remap = device_remap + self.uniqut_name = unique_name + self.protocol = protocol + + #该函数为虚基类, 本身未实现read_register, 以下为实现范例, 需要在派生类中实现 + def read_register(self, reg_addr, reg_count) : + raise NotImplementedError() + + #bool write_registers(int reg_addr, reg_count, uint16_t value[]) + #该函数为虚基类, 本身未实现write_registers, 以下为实现范例, 需要在派生类中实现 + def write_register(self, reg_addr, reg_count, new_value, timeout_ms = DEFAULT_COMM_WRITE_TIMEOUT_MS) : + raise NotImplementedError() + + #bool write_bit_register(int reg_addr, uint16_t value[]) + #bool write_bit_register(int reg_addr, uint16_t value) + def write_bit_register(self, reg_addr, value, timeout_ms = DEFAULT_COMM_WRITE_TIMEOUT_MS) : + raise NotImplementedError() + + def device_comm_cycle(self) : + comm_success_count = 0 + total_comm_count = 0 + return comm_success_count, total_comm_count + + def device_comm_flush_request(self, reg_addr, reg_count, cycle = 3000) : + return True + + def device_comm_deactive(self) : + self.comm_active = False + + def device_comm_active(self) : + self.comm_active = True + + + def value_u16_to_s16(self, value) : + if value == None: + return None + svalue = value + if (svalue & 0x8000) : + svalue = -((svalue ^ 0xFFFF) + 1) + return svalue + + def value_u32_to_s32(self, value) : + if value == None: + return None + svalue = value + if (svalue & 0x80000000) : + svalue = -((svalue ^ 0xFFFFFFFF) + 1) + return svalue + + def read_register_count(self, reg_addr, reg_count) : + return self.read_register(reg_addr, reg_count) + + def read_register_u16(self, reg_addr) : + result = self.read_register_count(reg_addr, 1) + if result : + result = (result[0] & 0xFFFF) + return result + + def read_register_s16(self, reg_addr) : + result = self.read_register_u16(reg_addr) + sign_result = self.value_u16_to_s16(result) + return sign_result + + def read_register_u32(self, reg_addr, big_endian = 0) : + result = self.read_register_count(reg_addr, 2) + if result : + if big_endian: + result = (result[1] & 0xFFFF) | ((result[0] & 0xFFFF) << 16) + else : + result = (result[0] & 0xFFFF) | ((result[1] & 0xFFFF) << 16) + return result + + def read_register_s32(self, reg_addr, big_endian = 0) : + result = self.read_register_u32(reg_addr, big_endian) + sign_value = self.value_u32_to_s32(result) + return sign_value + + def read_register_f32(self, reg_addr, big_endian = 0) : + result = self.read_register_u32(reg_addr, big_endian) + fvalue = None + if result : + bytes = struct.pack('BBBB', result & 0xFF, (result >> 8) & 0xFF, (result >> 16) & 0xFF, (result >> 24) & 0xFF) + fvalue = struct.unpack("= reg_addr_begin and reg_addr + reg_count <= reg_addr_end : + return True + return False + + def update_item_value(self, reg_addr, reg_count, new_value) : + if self.in_range(reg_addr, reg_count) and len(self.reg_buf) : + reg_off = reg_addr - self.reg_addr + new_reg = list(self.reg_buf) + for i in range(reg_count) : + new_reg[reg_off + i] = new_value[i] + self.reg_buf = new_reg + self.comm_trigger = True + + def read_register_count(self, reg_addr, reg_count) : + reg_addr_begin = self.reg_addr + reg_addr_end = self.reg_addr + self.reg_count + result = None + if reg_addr >= reg_addr_begin and reg_addr + reg_count <= reg_addr_end : + if len(self.reg_buf) >= self.reg_count: + result = [] + reg_off = reg_addr - self.reg_addr + for i in range(reg_count): + result.append(self.reg_buf[reg_off + i]) + + return result + +#为了防止阻塞 mqtt订阅流程, 采用class_mqtt_process_thread线程来处理 接收到的主题与消息 +class class_mqtt_process_thread(Thread): + def __init__(self, + parent_device, + topic : str = None, + message : str = None, + ): + + Thread.__init__(self) + self.topic = topic + self.message = message + self.parent_device : class_modbus_comm_device = parent_device + + def run(self): + self.parent_device.on_process_topic_message(self.topic, self.message) + +#modbus通讯设备, 管理modbus主机通讯, 实现mqtt客户端 +class class_modbus_comm_device(class_comm_device, class_comm_mqtt_interface) : + def __init__(self, + comm_addr = 0, + device_remap = None, + comm_table = None, + func_comm_trigger = None, + mqtt_thread : class_comm_mqtt_thread = None, + protocol : class_protocol_modbus = None, + mqtt_info_object : class_mqtt_info_object = None, + unique_name = None, + action_process_func = None, #action处理函数 + request_alarm_func = None, #故障查询函数 + alias_table = None): + class_comm_device.__init__(self, comm_addr, device_remap, unique_name) + class_comm_mqtt_interface.__init__(self) + + self.comm_loop_count = 0 + self.comm_index = 0 + self.mqtt_thread = mqtt_thread + self.comm_device_comm_active = True #设置该设备是否需要通讯 + self.comm_fail_delay = 0 #通讯延时 + self.func_comm_trigger = func_comm_trigger + self.protocol : class_protocol_modbus = protocol + self.mqtt_info_object : class_mqtt_info_object = mqtt_info_object + self.unique_name : str = unique_name + self.action_process_func = action_process_func + self.request_alarm_func = request_alarm_func + self.alias_table = alias_table + + self.comm_table = comm_table + self.comm_table_item_list : class_comm_table_item = [] #list of class_comm_table_item + self.create_comm_item_list(comm_table) + + def modbus_regs_flush(self, reg_addr, reg_count, values) : + for each in self.comm_table_item_list: + comm_item : class_comm_table_item = each + comm_item.update_item_value(reg_addr, reg_count, values) + + def create_comm_item_list(self, comm_table : class_comm_table_item) : + self.comm_table_item_list = [] + if comm_table != None : + for comm_item_dict in comm_table : + _name = utils.dict_or_object_get_attr(comm_item_dict, "name", " ") + _reg_addr = utils.dict_or_object_get_attr(comm_item_dict, "reg_addr", 0) + _reg_count = utils.dict_or_object_get_attr(comm_item_dict, "reg_count", 0) + _cycle = utils.dict_or_object_get_attr(comm_item_dict, "cycle", 0) + _mqtt_pack = utils.dict_or_object_get_attr(comm_item_dict, "mqtt_pack", None) + self.comm_table_item_list.append(class_comm_table_item(name = _name, + reg_addr =_reg_addr, + reg_count = _reg_count, + cycle = _cycle, + mqtt_pack = _mqtt_pack)) + + #@override, mqtt on connect + def on_connect(self, mqtt_thread, userdata, flags, rc) : + if rc == 0 : + #获取线程类 (class_comm_mqtt_thread) + mqtt_comm_thread : class_comm_mqtt_thread= mqtt_thread + #订阅相关主题, 获取参数, 修改参数, 获取测量值, 获取报警信息 + mqtt_comm_thread.subscribe("request/param/info/#") + mqtt_comm_thread.subscribe("request/param/modify/#") + mqtt_comm_thread.subscribe("request/measure/#") + mqtt_comm_thread.subscribe("request/status/#") + mqtt_comm_thread.subscribe("request/alarm/#") + mqtt_comm_thread.subscribe("request/action/#") + mqtt_comm_thread.subscribe("request/alias/#") + + def alias_table_convert(self) : + new_list_dict = [] + + for each_dict in self.alias_table : + for key_info, value_dict in each_dict.items() : + if isinstance(key_info, Enum) : + name = key_info.name + else : + name = key_info + + new_dict = {} + for dict_key, dict_value in value_dict.items() : + if isinstance(dict_key, Enum) : + dict_key_value = dict_key.value[0] + else : + dict_key_value = dict_key + + new_dict[dict_key_value] = dict_value + + new_list_dict.append({name : new_dict}) + + return new_list_dict + + #该函数在线程里面调用, 不会阻塞mqtt处理订阅的消息 + def on_process_topic_message(self, topic, message) : + try : + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + else : + json_dict = json.loads(message.encode('utf-8')) + print_normal_msg(f"有效的mqtt(topic = {topic}, message = {message})") + except Exception as e: + print_error_msg(f"{str(e)}无效的mqtt(topic = {topic}, message = {message})") + json_dict = None + + mqtt_info_name = utils.dict_or_object_get_attr(json_dict, "name", None) + value_str = utils.dict_or_object_get_attr(json_dict, "value", math.nan) + + + # if mqtt_info_name != None : + # mqtt_menu_item = self.mqtt_info_object.search_menu_item(mqtt_info_name) + # else : + # mqtt_menu_item = None + if mqtt_info_name != None: + mqtt_menu_item = self.mqtt_info_object.search_menu_item(mqtt_info_name) + else : + mqtt_menu_item = None + print_normal_msg(f"执行操作: topic={topic}, mqtt_info_name={mqtt_info_name}") + + if "request/alias" in topic : #获取别名 + new_alias_table = self.alias_table_convert() + if mqtt_info_name == None : + msg : str = json.dumps(new_alias_table, ensure_ascii=False) + if self.mqtt_thread != None : + self.mqtt_thread.publish("response/alias/" + self.unique_name, msg) + else : + search_dict = None + for each_dict in new_alias_table : + if mqtt_info_name in each_dict.keys() : + search_dict = each_dict + break + if search_dict : + msg : str = json.dumps(search_dict, ensure_ascii=False) + else : + msg : str = '{"%s" : None}'%(mqtt_info_name) + if self.mqtt_thread != None : + self.mqtt_thread.publish("response/alias/" + self.unique_name, msg) + elif "request/alarm" in topic: #故障查询 + if self.request_alarm_func != None: + fvalue = utils.dict_or_object_get_attr(json_dict, "index", math.nan) + if isinstance(fvalue, str) : + fvalue = float(fvalue) + if fvalue != math.nan : + alarm_index = round(fvalue) + self.request_alarm_func(self, alarm_index) + elif "request/action" in topic : + if self.action_process_func : + self.action_process_func(self, mqtt_menu_item, value_str) + + elif "request/param/info" in topic: #读取参数 + _scale = utils.dict_or_object_get_attr(mqtt_menu_item, "scale", 1.0) + _offset = utils.dict_or_object_get_attr(mqtt_menu_item, "offset", 0.0) + _comm_str = utils.dict_or_object_get_attr(mqtt_menu_item, "addr", None) + _alias_name = utils.dict_or_object_get_attr(mqtt_menu_item, "alias", None) + if isinstance(_alias_name, Enum): + _alias_name = _alias_name.name + + _format = utils.dict_or_object_get_attr(mqtt_menu_item, "format", "%f") + _fvalue = math.nan + + if _comm_str : + _fvalue = self.protocol.read_float(device_addr = self.comm_addr, + comm_str = _comm_str, + scale = _scale, + offset = _offset + ) + # if _alias_name != None : + # # if _fvalue == None or _fvalue == math.nan: + # # _format_str = "NAN" + # if _fvalue is None or math.isnan(_fvalue): + # _fvalue = 0 + # else : + # _format_str = "%d"%(round(_fvalue)) + # if self.mqtt_thread != None : + # self.mqtt_thread.publish("response/param/info/" + self.unique_name, '{"%s" : {"alias" : "%s", "value": "%s"}}'%(mqtt_info_name, _alias_name, _format_str)) + # else : + # _format_str = _format%(_fvalue) + # if self.mqtt_thread != None : + # self.mqtt_thread.publish("response/param/info/" + self.unique_name, '{"%s" : "%s"}'%(mqtt_info_name, _format_str)) + # else: + # print_warning_msg(f"未处理的请求:{topic, json_dict}") + if _alias_name is not None: + # 处理 _fvalue 的情况 + if _fvalue is None or math.isnan(_fvalue): + _fvalue = 0 + _format_str = "%d" % (round(_fvalue)) + else: + # 当 _alias_name 为 None 时处理 + _format_str = _format % (_fvalue) if _fvalue is not None and not math.isnan(_fvalue) else "UNKNOWN" + + # 发布消息 + if self.mqtt_thread is not None: + if _alias_name is not None: + self.mqtt_thread.publish("response/param/info/" + self.unique_name, + '{"%s" : {"alias" : "%s", "value": "%s"}}' % (mqtt_info_name, _alias_name, _format_str)) + else: + self.mqtt_thread.publish("response/param/info/" + self.unique_name, + '{"%s" : "%s"}' % (mqtt_info_name, _format_str)) + else: + print_warning_msg(f"未处理的请求:{topic, message}") + + + + elif "request/param/modify" in topic : #写入参数 + + mqtt_menu_item = self.comm_item_item_adjust(mqtt_menu_item) + scale = utils.dict_or_object_get_attr(mqtt_menu_item, "scale", 1.0) + format_str = utils.dict_or_object_get_attr(mqtt_menu_item, "format", "%1.0f") + offset = utils.dict_or_object_get_attr(mqtt_menu_item, "offset", 0.0) + _comm_str = utils.dict_or_object_get_attr(mqtt_menu_item, "addr", None) + + _fvalue = value_str + if isinstance(_fvalue, str) : + modify_fvalue = float(_fvalue) + else : + modify_fvalue = _fvalue + + _fvalue_origin = modify_fvalue / scale - offset + if _comm_str : + result = self.protocol.write_float(device_addr = self.comm_addr, + comm_str = _comm_str, + fvalue = _fvalue_origin) + if self.mqtt_thread != None : + self.mqtt_thread.publish("response/param/modify/" + self.unique_name, '{"name" : "%s", "result":%d}'%(mqtt_info_name, result)) + else: + print_warning_msg(f"未处理的请求:{topic, json_dict}") + elif mqtt_menu_item == None : + print_warning_msg(f"mqtt无法找到对应信息项(topic = {topic}, message = {json_dict})") + else : + pass + + #@override, mqtt subscirbe message process + def on_message(self, mqtt_thread, topic, message) : + if self.mqtt_info_object == None : + return False + if "request/alias" in topic : #获得别名不需要协议通讯, 此处直接处理即可 + self.on_process_topic_message(topic, message) + elif "request" in topic : + new_thread : class_mqtt_process_thread = class_mqtt_process_thread(self, topic, message) + new_thread.start() + return True + + #通过通讯字符串与scale类型, 获取浮点格式实际值, 通讯失败时返回None + def comm_item_get_value_float(self, comm_addr_str, scale = 1.0, offset = 0) : + reg_value = None + + if comm_addr_str != None: + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_addr_str) + is_float = True if "#f" in comm_addr_str else False + is_big_endian = True if "#>" in comm_addr_str else False + is_sign = True if "#s" in comm_addr_str else False + + if reg_count == 1 : + if is_sign : + reg_value = self.read_register_s16(reg_addr) + else : + reg_value = self.read_register_u16(reg_addr) + if reg_count == 2 : + if is_float : + reg_value = self.read_register_f32(reg_addr, is_big_endian) + elif is_sign : + reg_value = self.read_register_s32(reg_addr, is_big_endian) + else : + reg_value = self.read_register_u32(reg_addr, is_big_endian) + + if bit >= 0 and reg_value != None: + reg_value = (reg_value >> bit) + reg_value = reg_value & (0xFFFFFFFF >> (32 - reg_count)) + + if reg_value != None : + reg_value = reg_value * scale + offset + + return reg_value + + #有些菜单项的scale, format或其他属性可以动态调节, 返回调整后的菜单项或 原菜单项 + def comm_item_item_adjust(self, menu_item) : + adjust_menu_item = None + func_item_adjust = utils.dict_or_object_get_attr(menu_item, "adjust", None) + if func_item_adjust != None : + adjust_menu_item = func_item_adjust(self, menu_item) + if adjust_menu_item == None : + adjust_menu_item = menu_item + return adjust_menu_item + + #通过菜单项中 特定的回调函数, 使每个菜单项可以独立处理一些任务, 比如添加自定义key, value + def comm_call_menu_item_func(self, menu_item_dict, mqtt_dict : dict = None) : + call_func = utils.dict_or_object_get_attr(menu_item_dict, "call", None) + if call_func != None : + call_func(self, menu_item_dict, mqtt_dict) + + #通过菜单项中 获取浮点格式实际值, reg_value在通讯失败时返回None, 需要额外检查 + def comm_get_value_from_menu_item(self, menu_item_dict) : + menu_item_dict = self.comm_item_item_adjust(menu_item_dict) + scale = utils.dict_or_object_get_attr(menu_item_dict, "scale", 1.0) + offset = utils.dict_or_object_get_attr(menu_item_dict, "offset", 0.0) + comm_addr_str = utils.dict_or_object_get_attr(menu_item_dict, "addr", None) + reg_value = self.comm_item_get_value_float(comm_addr_str, scale, offset) + return reg_value + + #通过mqtt名称中 获取浮点格式实际值, reg_value在通讯失败时返回None, 需要额外检查 + def comm_get_value_from_mqtt_name(self, mqtt_name : str) : + if mqtt_name in self.mqtt_info_object.mqtt_dict.keys() : + mqtt_menu_item = self.mqtt_info_object.mqtt_dict[mqtt_name] + return self.comm_get_value_from_menu_item(mqtt_menu_item) + return None + + #触发一组mqtt菜单组的 key, value字典 + def comm_item_trigger_mqtt_pack(self, mqtt_pack) : + if mqtt_pack == None : + return None + mqtt_dict = {} + for pack_item_dict in mqtt_pack : + self.comm_call_menu_item_func(pack_item_dict, mqtt_dict) + reg_value = self.comm_get_value_from_menu_item(pack_item_dict) + format_str = utils.dict_or_object_get_attr(pack_item_dict, "format", "%1.0f") + mqtt_name = utils.dict_or_object_get_attr(pack_item_dict, "mqtt", None) + min_value = utils.dict_or_object_get_attr(pack_item_dict, "min", None) + max_value = utils.dict_or_object_get_attr(pack_item_dict, "max", None) + + # 检查是否有最小值和最大值的约束,并验证 reg_value 是否在范围内 + if reg_value is not None: + if min_value is not None and reg_value < min_value: + reg_value = min_value # 如果小于最小值,设为最小值 + if max_value is not None and reg_value > max_value: + reg_value = max_value # 如果大于最大值,设为最大值 + + if mqtt_name != None and reg_value != None: + mqtt_dict[mqtt_name] = format_str%(reg_value) + return mqtt_dict + + def trigger_comm(self, name): + for item in self.comm_table_item_list: + comm_table_item : class_comm_table_item = item + if comm_table_item.name == name : + comm_table_item.comm_trigger = True + return + + def read_register_count(self, reg_addr, reg_count) : + result = None + for item in self.comm_table_item_list : + comm_table_item : class_comm_table_item = item + + if comm_table_item.in_range(reg_addr, reg_count) : + if comm_table_item.reg_buf == None : + comm_table_item.comm_trigger = True + elif len(comm_table_item.reg_buf) == 0 : + comm_table_item.comm_trigger = True + else : + result = comm_table_item.read_register_count(reg_addr, reg_count) + if result != None : + break + return result + + #@device_comm_flush_request override + def device_comm_flush_request(self, reg_addr, reg_count, cycle = 3000) : + for item in self.comm_table_item_list : + comm_table_item : class_comm_table_item = item + if comm_table_item.in_range(reg_addr, reg_count) : + if comm_table_item.flush_request_delay == 0 : + comm_table_item.flush_request_delay = cycle + + #@read_register override + def read_register(self, comm_str) : + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if reg_count == 0: + return None + return self.read_register_count(reg_addr, reg_count) + + #@read_register override + #bool write_register(int reg_addr, reg_count, uint16_t value[]) + def write_register(self, reg_addr, reg_count, new_value, timeout_ms = comm_device.DEFAULT_COMM_WRITE_TIMEOUT_MS) : + try: + _protocol : class_protocol_modbus = self.protocol + + _old_timeout = _protocol.get_timeout() + _protocol.set_timeout(timeout_ms / BASE_FAIL_DELAY) + + write_result = _protocol.modbus_write_regs(self.comm_addr, + reg_addr, + reg_count, + new_value, + ) + + if write_result == True: + for item in self.comm_table_item_list : + comm_item : class_comm_table_item = item + if comm_item.in_range(reg_addr, reg_count) : + comm_item.update_item_value(reg_addr, reg_count, new_value) + + except Exception : + write_result = False + finally : + _protocol.set_timeout(_old_timeout) + + return write_result + + #bool write_bit_register(int reg_addr, uint16_t value[]) + #bool write_bit_register(int reg_addr, uint16_t value) + def write_bit_register(self, reg_addr, value, timeout_ms = comm_device.DEFAULT_COMM_WRITE_TIMEOUT_MS) : + write_result = False + + _protocol : class_protocol_modbus = self.protocol + try : + old_timeout = _protocol.get_timeout() + _protocol.set_timeout(timeout_ms / BASE_FAIL_DELAY) + _protocol.modbus_write_regs(self.comm_addr, + reg_addr % 100000 + 100000, + len(value), + value) + + write_result = True + except Exception as e: + write_result = False + print_error_msg(f"modbus寄存器无法写入{str(e)}") + finally : + _protocol.set_timeout(old_timeout) + + return write_result + + #@override cycle function + def update_time_difference(self, table_item): + cur_time = time.time() # 获取当前时间 + time_dif = cur_time - table_item.base_time # 计算时间差 + table_item.base_time = cur_time # 更新基准时间 + return time_dif * BASE_FAIL_DELAY # 返回时间差(毫秒) + + def should_trigger_comm(self, table_item, time_dif_ms): + comm_trigger = False # 初始化通信触发标志为False + if self.func_comm_trigger: + comm_trigger = self.func_comm_trigger(self, table_item) # 调用通信触发函数 + + if table_item.remain_cycle > time_dif_ms: + table_item.remain_cycle -= time_dif_ms # 减少剩余周期 + else: + table_item.remain_cycle = table_item.cycle + table_item.comm_fail_delay + self.comm_fail_delay # 重新计算剩余周期 + if table_item.cycle > 0 or (table_item.cycle == 0 and not table_item.comm_success): + comm_trigger = True # 如果周期大于0或周期为0但上次通信不成功,则触发通信 + + if table_item.flush_request_delay > 0: + if table_item.flush_request_delay > time_dif_ms: + table_item.flush_request_delay -= time_dif_ms # 减少刷新请求延迟 + else: + table_item.flush_request_delay = 0 # 重置刷新请求延迟 + comm_trigger = True # 触发通信 + + if not comm_trigger: + comm_trigger = table_item.comm_trigger # 如果前面没有触发通信,则使用通信触发标志 + + return comm_trigger # 返回是否触发通信 + + def execute_communication(self, table_item): + read_result = [] # 初始化读取结果 + timeout_ms = getattr(table_item, "通信超时", DEFAULT_TIMEOUT) # 获取超时时间,默认500ms + _protocol = self.protocol # 获取协议对象 + + try: + old_timeout = _protocol.get_timeout() # 保存旧的超时时间 + _protocol.set_timeout(timeout_ms / BASE_FAIL_DELAY) # 设置新的超时时间 + + read_result = _protocol.modbus_read_regs(self.comm_addr, table_item.reg_addr, table_item.reg_count) # 执行Modbus读取 + if len(read_result) != table_item.reg_count: + read_result = [] # 如果读取结果数量不匹配,视为读取失败 + except Exception as e: + print_error_msg("周期读异常: ", e, f"modbus_read_regs(addr={self.comm_addr}, reg={table_item.reg_addr}, count={table_item.reg_count})") # 打印错误信息 + finally: + _protocol.set_timeout(old_timeout) # 恢复旧的超时时间 + + return read_result # 返回读取结果 + + def handle_comm_result(self, table_item, read_result): + if not read_result: # 如果读取结果为空,表示通信失败 + self.handle_comm_failure(table_item) + else: # 否则通信成功 + self.handle_comm_success(table_item, read_result) + + table_item.comm_trigger = False # 重置通信触发标志 + + def handle_comm_failure(self, table_item): + table_item.comm_fail_count += 1 # 增加通信失败计数 + table_item.comm_fail_delay = self.limit_delay(table_item.comm_fail_delay + BASE_FAIL_DELAY, MAX_FAIL_DELAY) # 增加并限制通信失败延迟 + self.comm_fail_delay = self.limit_delay(self.comm_fail_delay + BASE_GLOBAL_FAIL_DELAY, 60000) # 增加并限制全局通信失败延迟 + table_item.comm_success = False # 标记通信失败 + + def limit_delay(self, delay, max_delay): + """限制延迟不超过最大值""" + return min(delay, max_delay) + + + + def handle_comm_success(self, table_item, read_result): + table_item.comm_fail_delay = 0 # 重置通信失败延迟 + self.comm_fail_delay = 0 # 重置全局通信失败延迟 + table_item.reg_buf = read_result # 更新寄存器缓存 + table_item.comm_success = True # 标记通信成功 + table_item.comm_success_count += 1 # 增加成功计数 + + if table_item.mqtt_pack: + self.publish_mqtt_message(table_item) # 发布MQTT消息 + + def publish_mqtt_message(self, table_item): + json_topic = f"{table_item.name}/{self.unique_name}" # 构建MQTT主题 + msg_dict = self.comm_item_trigger_mqtt_pack(table_item.mqtt_pack) # 触发MQTT打包 + + if msg_dict: + json_message = json.dumps(msg_dict, ensure_ascii=False) # 序列化消息字典 + if self.mqtt_thread: + self.mqtt_thread.publish(json_topic, json_message) # 发布MQTT消息 + + + def device_comm_cycle(self): + comm_success_count = 0 # 初始化成功计数 + total_comm_count = 0 # 初始化总计数 + + if self.comm_table is None: + return comm_success_count, total_comm_count # 如果通信表为空,提前返回 + + for item in self.comm_table_item_list: + table_item = item # 获取表项 + if table_item.reg_count == 0: + continue # 如果寄存器计数为0,跳过此表项 + + time_dif_ms = self.update_time_difference(table_item) # 更新时间差 + comm_trigger = self.should_trigger_comm(table_item, time_dif_ms) # 检查是否应触发通信 + + if comm_trigger: + total_comm_count += 1 # 增加总通信计数 + read_result = self.execute_communication(table_item) # 执行通信 + + if read_result: + comm_success_count += 1 # 如果读取成功,增加成功计数 + + self.handle_comm_result(table_item, read_result) # 处理通信结果 + + return comm_success_count, total_comm_count # 返回成功计数和总计数 diff --git a/comm_protocol.py b/comm_protocol.py new file mode 100644 index 0000000..e14c0a3 --- /dev/null +++ b/comm_protocol.py @@ -0,0 +1,45 @@ +import string +import modbus_tk.defines as cst +from modbus_tk import modbus_rtu, modbus_tcp, modbus +from print_color import * +import enum as Enum + +#所有协议基类 +class class_protocol() : + def __init__(self, protocol_name) : + self.protocol_name = protocol_name + self.mode : string = None + self.timeout = 5.0 + return + + def set_timeout(self, timeout = 5.0) : + self.timeout = timeout + + def open(self, mode : string) : + self.mode = mode + print_error_msg("class_protocol派生类未实现open函数") + raise NotImplementedError() + + def close(self) : + print_error_msg("class_protocol派生类未实现close函数") + raise NotImplementedError() + + #返回 math.nan 表示读取失败, 否则读取成功 + def read_float(self, device_addr : int, comm_str : string, scale : float = 1.0, offset : float = 0.0) -> float: + raise NotImplementedError() + + #返回 False 表示读取失败 + #返回 True 表示读取成功 + def write_float(self, device_addr : int, comm_str : string, fvalue : float, scale : float = 1.0, offset : float = 0.0) -> bool: + raise NotImplementedError() + + #读取comm_str地址开始的连续地址count个数, 地址连续 + #返回 math.nan 表示读取失败, 否则读取成功 + def read_float_arr(self, device_addr : int, comm_str : string, count : int) : + raise NotImplementedError() + + #写入comm_str地址开始的连续地址 写入总个数由 len(fvalue_arr)决定 + #返回 False 表示读取失败, 否则读取成功 + def write_float_arr(self, device_addr : int, comm_str : string, fvalue_arr : list) -> bool: + raise NotImplementedError() + \ No newline at end of file diff --git a/comm_protocol_modbus.py b/comm_protocol_modbus.py new file mode 100644 index 0000000..558097e --- /dev/null +++ b/comm_protocol_modbus.py @@ -0,0 +1,656 @@ +#modbus协议处理 +import sys +import string +import json +import serial +import time +import menu_utils as utils +import string +import struct +import math +import modbus_tk.defines as cst +from modbus_tk import modbus_rtu, modbus_tcp, modbus +from print_color import * +from comm_protocol import class_protocol +from comm_thread import class_comm_master_thread +from threading import Thread, Lock +from modbus_tk.exceptions import( + ModbusError, ModbusFunctionNotSupportedError, DuplicatedKeyError, MissingKeyError, InvalidModbusBlockError, + InvalidArgumentError, OverlapModbusBlockError, OutOfModbusBlockError, ModbusInvalidResponseError, + ModbusInvalidRequestError +) + +def json_load_message(message) : + json_dict = {} + if isinstance(message, bytes) : + json_dict = json.loads(message.decode('utf-8')) + elif isinstance(message, str) : + json_dict = json.loads(message.encode('utf-8')) + return json_dict + +#从通讯字符串中取出寄存器地址,位地址,个数 +# 以下为允许的Modbus通讯地址信息 +#"8000#2" 从8000地址开始,连续取两个寄存器 +#"8000#2#s" 从8000地址开始,连续取两个寄存器, #s 代表有符号数, 缺省为无符号数 +#"8000" 或 "8000#1" 8000地址, 1个寄存器 +#"8000.2#3" 取8000地址的第2位开始取 3个位的数据 +#"8000#2#f#>" 8000地址开始,连续取两个寄存器, #> 大端模式, #f 浮点数, +#"8000#2#f" 或 "8000#2#f#<" 8000地址开始,连续取两个寄存器, #< 小端模式(缺省模式), #f 浮点数, 单精度 +#"8000#4#f" 或 "8000#4#f#<" 8000地址开始,连续取4个寄存器, #< 小端模式(缺省模式), #f 浮点数, 双精度 +#"100618" 位地址618, 超过100000就表示是位地址 +def get_modbus_comm_info(addr_string : string) : #tuple(int, int, int, bool, bool, bool) + reg_addr = 0 + reg_bit = -1 + reg_count = 0 + + is_sign = True if "#s" in addr_string else False + is_float = True if "#f" in addr_string else False + is_big_endian = True if "#>" in addr_string else False + + info_splits = addr_string.split("#") # 使用'#'作为分隔符 + if info_splits != None : + reg_bit_str : string = info_splits[0] + reg_bit_splits = reg_bit_str.split('.') + + if len(reg_bit_splits) == 2 : + reg_addr = int(reg_bit_splits[0]) + reg_bit = int(reg_bit_splits[1]) + else : + reg_addr = int(reg_bit_splits[0]) + reg_bit = -1 + + if len(info_splits) >= 2: + reg_count = int(info_splits[1]) + else : + reg_count = 1 + + return (reg_addr, reg_bit, reg_count, is_float, is_big_endian, is_sign) + +#modbus协议基类, 无法独立工作, 需要派生类实现对应函数 +class class_protocol_modbus(class_protocol) : + #protocol_port_name = "COM1", "dev/tty1" 之类的设备 + def __init__(self, protocol_name) : + class_protocol.__init__(self, protocol_name) + self.mode : string = None #协议open时的mode字符串 + self.master : modbus.Master = None #modbus主机 + self.last_errcode = 0 #协议最后一次故障代码 + self.timeout = 1.0 + self.mutex = Lock() + return + + def set_modbus_master(self, master : modbus.Master) : + if self.master != None : + self.master.close() + self.master = master + if self.master != None : + self.master.set_timeout(self.timeout) + + #reg_value最大为64位数据, reg_count最大为4 + def modbus_value_to_list(self, reg_value, reg_count, is_big_endian = False) -> list : + result = [] + if reg_count == 1 : + result.append(reg_value & 0xFFFF) + elif reg_count == 2: + if is_big_endian : + result.append((reg_value >> 16) & 0xFFFF) + result.append((reg_value >> 0) & 0xFFFF) + else : + result.append((reg_value >> 0) & 0xFFFF) + result.append((reg_value >> 16) & 0xFFFF) + elif reg_count == 3: + if is_big_endian : + result.append((reg_value >> 32) & 0xFFFF) + result.append((reg_value >> 16) & 0xFFFF) + result.append((reg_value >> 0) & 0xFFFF) + else : + result.append((reg_value >> 0) & 0xFFFF) + result.append((reg_value >> 16) & 0xFFFF) + result.append((reg_value >> 32) & 0xFFFF) + elif reg_count == 4: + if is_big_endian : + result.append((reg_value >> 48) & 0xFFFF) + result.append((reg_value >> 32) & 0xFFFF) + result.append((reg_value >> 16) & 0xFFFF) + result.append((reg_value >> 0) & 0xFFFF) + else : + result.append((reg_value >> 0) & 0xFFFF) + result.append((reg_value >> 16) & 0xFFFF) + result.append((reg_value >> 32) & 0xFFFF) + result.append((reg_value >> 48) & 0xFFFF) + + return result + + def modbus_list_to_value(self, read_regs : tuple, is_big_endian : bool = False) -> int: + read_reg_cunt = len(read_regs) + read_value = 0 + + if read_reg_cunt == 4 : + if is_big_endian : + read_value = (read_regs[0] << 48) | (read_regs[1] << 32) | (read_regs[2] << 16) | (read_regs[3] << 0) + else : + read_value = (read_regs[0] << 0) | (read_regs[1] << 16) | (read_regs[2] << 32) | (read_regs[3] << 48) + if read_reg_cunt == 3 : + if is_big_endian : + read_value = (read_regs[0] << 32) | (read_regs[1] << 16) | (read_regs[2] << 0) + else : + read_value = (read_regs[0] << 0) | (read_regs[1] << 16) | (read_regs[2] << 32) + elif read_reg_cunt == 2 : + if is_big_endian : + read_value = (read_regs[0] << 16) | (read_regs[1] << 0) + else : + read_value = (read_regs[0] << 0) | (read_regs[1] << 16) + elif read_reg_cunt == 1 : + read_value = read_regs[0] + + return read_value + + + + def modbus_read_regs(self, device_addr, reg_addr, reg_count) -> tuple: + result_tuple = [] + try: + self.mutex.acquire() + + if self.master is None: + raise Exception("Call set_modbus_master() first to init protocol master") + + read_reg_count = reg_count + is_bit_addr = reg_addr >= 100000 + func_code = cst.READ_COILS if is_bit_addr else cst.READ_HOLDING_REGISTERS + result_tuple = self.master.execute(slave=device_addr, + function_code=func_code, + starting_address=reg_addr % 100000, + quantity_of_x=read_reg_count) + except ModbusError as e: + self.last_errcode = e.get_exception_code() + err_msg = f"Modbus 读寄存器错误: {str(e)}, modbus 读寄存器(addr={device_addr}, reg={reg_addr}, count={reg_count})" + print_error_msg(err_msg) + raise + except Exception as e: + err_msg = f"其他错误: {str(e)}" + print_error_msg(err_msg) + raise + finally: + self.mutex.release() + + return result_tuple + + #reg_addr >= 100000 时为写 位地址, 否则写保持寄存器 + #values 传入整数或浮点数时, 表示写单个寄存器, 或 强制单个位, + #强制单个位时,modbus-tk会转化成0xFF00, 0x0000, 要是其他值时,需要修改modbus-tk底层库 + def modbus_write_regs(self, device_addr, reg_addr, reg_count, values) -> bool : + try : + success = False + + self.mutex.acquire() + + if self.master == None : + raise Exception("Call set_modbus_master() first to init protocol master") + + if isinstance(values, float) : + reg_value = (int)(round(values)) + values = [reg_value] + elif isinstance(values, int) : + reg_value = (int)(values) + values = [reg_value] + + if len(values) != reg_count or reg_count == 0: + raise Exception("error, value size %d not match to reg_count"%(len(values))) + + is_bit_addr = True if reg_addr >= 100000 else False + + if len(values) >= 2 : + func_code = cst.WRITE_MULTIPLE_COILS if is_bit_addr else cst.WRITE_MULTIPLE_REGISTERS + self.master.execute(slave = device_addr, + function_code = func_code, + starting_address = reg_addr % 100000, + quantity_of_x = len(values), + output_value= values) + else : + func_code = cst.WRITE_SINGLE_COIL if is_bit_addr else cst.WRITE_SINGLE_REGISTER + if func_code == cst.WRITE_SINGLE_COIL : + write_value= values[0] & 0xFFFF + else : + write_value = values[0] + + self.master.execute(slave = device_addr, + function_code = func_code, + starting_address = reg_addr % 100000, + quantity_of_x = len(values), + output_value= write_value) + success = True + except ModbusError as e: + self.last_errcode = e.get_exception_code() + print_error_msg(f"modbus写寄存器错误: {str(e)}, modbus写寄存器(addr={device_addr}, reg={reg_addr}, count={reg_count})") + success = False + except Exception as e: + success = False + print_error_msg(f"其他错误: {str(e)}") + finally: + self.mutex.release() + return success + + def modbus_read_float(self, device_addr, comm_str :string, scale = 1.0, offset = 0.0) -> float: + fvalue = math.nan + try : + reg_addr, reg_bit, reg_count, is_float, is_big_endian, is_sign = get_modbus_comm_info(comm_str) + if self.master == None : + raise Exception("Call set_modbus_master() first to init protocol master") + + read_reg_count = reg_count + if reg_bit >= 0 : + read_reg_count = 1 + (int)((reg_bit + reg_count - 1) / 16) + + result = self.modbus_read_regs(device_addr, reg_addr, read_reg_count) + + if read_reg_count == 4 : + if is_big_endian : + read_value = (result[0] << 48) | (result[1] << 32) | (result[2] << 16) | (result[3] << 0) + else : + read_value = (result[0] << 0) | (result[1] << 16) | (result[2] << 32) | (result[3] << 48) + if is_sign : + read_value = utils.value_u64_to_s64(read_value) + elif read_reg_count == 3 : + if is_big_endian : + read_value = (result[0] << 32) | (result[1] << 16) | (result[2] << 0) + else : + read_value = (result[0] << 0) | (result[1] << 16) | (result[2] << 32) + elif read_reg_count == 2 : + if is_big_endian : + read_value = (result[0] << 16) | (result[1] << 0) + else : + read_value = (result[0] << 0) | (result[1] << 16) + if is_sign : + read_value = utils.value_u32_to_s32(read_value) + elif read_reg_count == 1 : + read_value = result[0] + if is_sign : + read_value = utils.value_u16_to_s16(read_value) + else : + raise Exception("目前只支持读取(1,2,3,4)个寄存器个数") + + if reg_bit >= 0 : + read_value = (read_value >> reg_bit) & (0xFFFFFFFF >> (32 - reg_count)) + + if is_float : + fvalue = math.nan + if read_reg_count == 2: + bytes = struct.pack('BBBB', read_value & 0xFF, (read_value >> 8) & 0xFF, (read_value >> 16) & 0xFF, (read_value >> 24) & 0xFF) + fvalue = struct.unpack("> 8) & 0xFF, (low_part >> 16) & 0xFF, (low_part >> 24) & 0xFF) + high_part = (read_value >> 32) & 0xFFFFFFFF + high_bytes = struct.pack('BBBB', high_part & 0xFF, (high_part >> 8) & 0xFF, (high_part >> 16) & 0xFF, (high_part >> 24) & 0xFF) + bytes = low_bytes + high_bytes + fvalue = struct.unpack(" tuple(float) + fvalue = math.nan + total_reg_count = 0 + + try : + reg_addr, reg_bit, reg_count, is_float, is_big_endian, is_sign = get_modbus_comm_info(comm_str) + if self.master == None : + raise Exception("Call set_modbus_master() first to init protocol master") + + float_result_arr = [] + read_reg_count = reg_count + if reg_bit >= 0 : + raise Exception("multi read for reg.bit is not support") + + #读连续寄存器数据, 再添加到浮点数 数组列表 + total_reg_count = read_reg_count * count + result = self.modbus_read_regs(device_addr, reg_addr, total_reg_count) + + for i in range(count) : + if read_reg_count == 4 : + if is_big_endian : + read_value = (result[0] << 48) | (result[1] << 32) | (result[2] << 16) | (result[3] << 0) + else : + read_value = (result[0] << 0) | (result[1] << 16) | (result[2] << 32) | (result[3] << 48) + if is_sign : + read_value = utils.value_u64_to_s64(read_value) + elif read_reg_count == 3 : + if is_big_endian : + read_value = (result[0] << 32) | (result[1] << 16) | (result[2] << 0) + else : + read_value = (result[0] << 0) | (result[1] << 16) | (result[2] << 32) + elif read_reg_count == 2 : + if is_big_endian : + read_value = (result[0] << 16) | (result[1] << 0) + else : + read_value = (result[0] << 0) | (result[1] << 16) + if is_sign : + read_value = utils.value_u32_to_s32(read_value) + elif read_reg_count == 1 : + read_value = result[0] + if is_sign : + read_value = utils.value_u16_to_s16(read_value) + else : + raise Exception("目前只支持读取(1,2,3,4)个寄存器个数") + + if is_float : + fvalue = math.nan + if read_reg_count == 2: + bytes = struct.pack('BBBB', read_value & 0xFF, (read_value >> 8) & 0xFF, (read_value >> 16) & 0xFF, (read_value >> 24) & 0xFF) + fvalue = struct.unpack("> 8) & 0xFF, (low_part >> 16) & 0xFF, (low_part >> 24) & 0xFF) + high_part = (read_value >> 32) & 0xFFFFFFFF + high_bytes = struct.pack('BBBB', high_part & 0xFF, (high_part >> 8) & 0xFF, (high_part >> 16) & 0xFF, (high_part >> 24) & 0xFF) + bytes = low_bytes + high_bytes + fvalue = struct.unpack(" bool: + success = False + write_value = 0 + is_writing = False + is_reading = False + + try : + reg_addr, reg_bit, reg_count, is_float, is_big_endian, is_sign = get_modbus_comm_info(comm_str) + if self.master == None : + raise Exception("Call set_modbus_master() first to init protocol master") + + fvalue_origin = round((fvalue - offset) / scale, 0) + + write_reg_count = reg_count + if reg_bit >= 0 : + write_reg_count = 1 + (int)((reg_bit + reg_count - 1) / 16) + + if write_reg_count > 4 : #寄存器个数大于4个, 目前不支持 + raise Exception("write_reg_count is more than 4") + + write_reg_values = [] #定义空列表 + + if reg_addr >= 100000 and reg_addr < 200000 : #位数据 + if fvalue > 0 : + write_reg_values.append(1) + else : + write_reg_values.append(0) + elif reg_bit >= 0 : + if write_reg_count > 2 : + raise Exception("register count is > 2") + is_reading = True + read_regs = self.modbus_read_regs(device_addr, reg_addr, write_reg_count) + is_reading = False + + origin_read_value = self.modbus_list_to_value(read_regs, is_big_endian) + + write_value = (int)(fvalue_origin) + bit_mask = (0xFFFFFFFF >> (32 - reg_count)) + set_mask = write_value & bit_mask + + modify_value = origin_read_value + modify_value = modify_value & ~(bit_mask << reg_bit) + modify_value = modify_value | (set_mask << reg_bit) + + write_reg_values = self.modbus_value_to_list(modify_value, write_reg_count, is_big_endian) + elif is_float : + if is_big_endian : + format_pack = ">d" if write_reg_count == 4 else ">f" + else : + format_pack = " bool: + success = False + is_writing = False + is_read = False + + try : + reg_addr, reg_bit, reg_count, is_float, is_big_endian, is_sign = get_modbus_comm_info(comm_str) + if self.master == None : + raise Exception("Call set_modbus_master() first to init protocol master") + + write_reg_values = [] + write_reg_count = reg_count + + if reg_bit >= 0 : + raise Exception("multi write for reg.bit is not support") + + if write_reg_count > 4 : #单次写入寄存器个数大于4个, 目前不支持 + raise Exception("write_reg_count is more than 4") + + for fvalue_origin in fvalue_arr: + if reg_addr >= 100000 and reg_addr < 200000 : #位数据 + if fvalue_origin > 0 : + write_reg_values.append(1) + else : + write_reg_values.append(0) + elif is_float : + if is_big_endian : + format_pack = ">d" if write_reg_count == 4 else ">f" + else : + format_pack = " float: + return self.modbus_read_float(device_addr, comm_str, scale, offset) + + #@override 返回 False 表示读取失败, 否则读取成功 + def write_float(self, device_addr, comm_str, fvalue, scale = 1.0, offset = 0.0) -> bool: + return self.modbus_write_float(device_addr, comm_str, fvalue, scale, offset) + + #@override + #读取comm_str地址开始的连续地址count个数, 地址连续 + #返回 math.nan 表示读取失败, 否则读取成功 + def read_float_arr(self, device_addr : int, comm_str : string, count : int) : + return self.modbus_read_float_arr(device_addr, comm_str, count) + + #@override + #写入comm_str地址开始的连续地址 写入总个数由 len(fvalue_arr)决定 + #返回 False 表示读取失败, 否则读取成功 + def write_float_arr(self, device_addr : int, comm_str : string, fvalue_arr : list) -> bool: + return self.modbus_write_float_arr(device_addr, comm_str, fvalue_arr) + + +#串口Modbus_rtu主机类 +class class_protocol_modbus_rtu(class_protocol_modbus) : + def __init__(self, protocol_name = "modbus_rtu") : + class_protocol_modbus.__init__(self, protocol_name) + self.comm_parity = serial.PARITY_NONE + self.comm_bytesize = serial.EIGHTBITS + self.comm_stopbits = serial.STOPBITS_ONE + self.is_open = False + self.comm_uart = None + self.rtu_master : modbus_rtu.RtuMaster = None + return + + #@override + #parity('N', 'E', 'O', 'M', 'S') 选其一, 含义分别代表 ("无校验", "偶校验", "奇校验", "校验1", "校验0"), 缺省为无校验 + #stop(1, 1.5, 2)选其一, 含义分别代表 ("1个停止位", "1.5个停止位", "2个停止位"), 缺省为1个停止位 + #bit(5, 6, 7, 8)选其一, 含义分别代表 ("5位数据", "6位数据", "7位数据","8位数据"), 缺省为8位数据 + #baud(50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200)选其一, 缺省为9600位数据 + #mode 需要是一个json字符串, exam: "{"name" : 'COM1', "baud" : 115200, "parity" :'E', "stop" : 1}" 代表COM1, 115200波特率, 偶校验, 1停止位 + def open(self, mode : string) : + try : + class_protocol_modbus.mode = mode + mode_dict = json_load_message(mode) + + print_inform_msg(f"打开: 协议名称:{self.protocol_name} ,工作端口:{self.mode}") + except Exception as e: + print_error_msg(f"错误modbus rtu信息:{str(e)}") + mode_dict = None + + if mode_dict : + self.comm_port_name = utils.dict_or_object_get_attr(mode_dict, "name", "COM1") + self.comm_parity = utils.dict_or_object_get_attr(mode_dict, "parity", serial.PARITY_NONE) + self.comm_baud = utils.dict_or_object_get_attr(mode_dict, "baud", 9600) + self.comm_stopbits = utils.dict_or_object_get_attr(mode_dict, "stop", serial.STOPBITS_ONE) + self.comm_bytesize = utils.dict_or_object_get_attr(mode_dict, "bit", serial.EIGHTBITS) + + try : + self.comm_uart = serial.Serial(port= self.comm_port_name, + baudrate= self.comm_baud, + bytesize= self.comm_bytesize, + parity=self.comm_parity, + stopbits=self.comm_stopbits) + + self.rtu_master = modbus_rtu.RtuMaster(self.comm_uart) + self.set_modbus_master(self.rtu_master) + self.set_timeout(self.timeout) + self.is_open = True + except Exception as e: + print_error_msg(f"错误modbus rtu信息:{str(e)}") + self.comm_uart = None + self.is_open = False + + #@override 关闭到modbus rtu 对应的串口 + def close(self) : + if self.is_open : + try : + print_inform_msg(f"关闭 : 协议名称:{self.protocol_name} ,工作端口:{self.mode}") + if self.rtu_master : + self.rtu_master.close() + if self.comm_uart : + self.comm_uart.close() + except Exception as e: + print_error_msg(f"错误关闭modbus rtu信息:{str(e)}") + pass + finally : + self.rtu_master = None + self.comm_uart = None + self.is_open = False + +#以太网Modbus_tcp主机类 +class class_protocol_modbus_tcp(class_protocol_modbus) : + def __init__(self, protocol_name = "modbus_tcp") : + class_protocol_modbus.__init__(self, protocol_name) + self.ip_str = "127.0.0.1" + self.port = 502 + self.tcp_master : modbus_tcp.TcpMaster = None + + return + + #ip: 服务器ip地址, 缺省"127.0.0.1" + #port: 服务器端口, 缺省502 + #timeout: 超时时间, 缺省 5.0S + #mode 需要是一个json字符串, exam: '{"ip" : '192.168.1.201', "port" : 502, "timeout": 5.0}' 代表192.168.1.201, 502端口, 通讯超时 5.0S + def open(self, mode: str): + try: + self.mode = mode + print_inform_msg(f"打开 Modbus TCP: 协议名称:{self.protocol_name} ,工作端口:{self.mode}") + mode_dict = json_load_message(mode) + except json.decoder.JSONDecodeError as e: + print_error_msg(f"解析模式失败: {str(e)}") + mode_dict = None + except Exception as e: + print_error_msg(f"错误打开 Modbus TCP 信息: {str(e)}") + mode_dict = None + + if mode_dict: + self.ip_str = utils.dict_or_object_get_attr(mode_dict, "ip", "127.0.0.1") + self.port = utils.dict_or_object_get_attr(mode_dict, "port", 502) + if "timeout" in mode_dict: + self.timeout = mode_dict["timeout"] + + try: + self.tcp_master = modbus_tcp.TcpMaster(host=self.ip_str, port=self.port, timeout_in_sec=self.timeout) + self.set_modbus_master(self.tcp_master) + self.tcp_master.open() + self.is_open = True + except Exception as e: + print_error_msg(f"打开 Modbus TCP 失败: {str(e)} IP地址:{self.ip_str} ,端口号:{self.port}") + self.is_open = False + + + #关闭到modbus tcp服务器的连接 + def close(self): + if self.is_open or self.tcp_master is not None: + try: + if self.tcp_master: + print_inform_msg(f"关闭 Modbus TCP: 协议名称:{self.protocol_name} ,工作端口:{self.mode}") + self.tcp_master.close() + except Exception as e: + print_error_msg(f"错误关闭 Modbus TCP 信息: {str(e)}") + pass + finally: + self.tcp_master = None + self.is_open = False + print_inform_msg("已断开与 Modbus TCP 服务器的连接") + + + +if __name__ == "__main__": + protocol_modbus_rtu = class_protocol_modbus_rtu("modbus_rtu") + protocol_modbus_rtu.open('{"name" : "COM2", "baud":115200, "parity" :"E", "stop" : 1}') + protocol_modbus_rtu.close() + + protocol_modbus_tcp : class_protocol_modbus_tcp = class_protocol_modbus_tcp("modbus_tcp") + protocol_modbus_tcp.open('{"ip" : "127.0.0.1", "port" : 502, "timeout" : 4.0}') + protocol_modbus_tcp.close() diff --git a/comm_remap.py b/comm_remap.py new file mode 100644 index 0000000..a7831d0 --- /dev/null +++ b/comm_remap.py @@ -0,0 +1,19 @@ + +COMM_REMAP_MEASURE_SWITCH_STATUS = 0 +COMM_REMAP_MEASURE_SWITCH_ALARM = 2 +COMM_REMAP_MEASURE_FLOAT_IA = 4 +COMM_REMAP_MEASURE_FLOAT_IB = 5 +COMM_REMAP_MEASURE_FLOAT_IC = 6 +COMM_REMAP_MEASURE_FLOAT_UAB = 10 +COMM_REMAP_MEASURE_FLOAT_UBC = 12 +COMM_REMAP_MEASURE_FLOAT_UCA = 14 +COMM_REMAP_MEASURE_FLOAT_RO = 16 +COMM_REMAP_MEASURE_FLOAT_IO = 18 +COMM_REMAP_MEASURE_FLOAT_UO = 20 + + +COMM_REMAP_PARA_CURRENT_RATE = 1000 +COMM_REMAP_PARA_CURRENT_SHORT_MUL = 1002 +COMM_REMAP_PARA_RATE_VOLTAGE = 1004 +COMM_REMAP_PARA_LOW_VOLTAGE_RATIO = 1006 +COMM_REMAP_PARA_LOW_VOLTAGE_DELAY = 1008 \ No newline at end of file diff --git a/comm_thread.py b/comm_thread.py new file mode 100644 index 0000000..8db1f4a --- /dev/null +++ b/comm_thread.py @@ -0,0 +1,78 @@ +import threading +from threading import Thread +import time +import menu_utils as utils +from comm_device import class_comm_device +from print_color import * + +class class_comm_master_thread(Thread): + thread_object_id = 0 + CHECK_INTERVAL = 0.05 # 检查间隔(秒) + MAX_FAIL_TIME = 5 # 最大失败时间(秒) + + def __init__(self, + device_comm_object_list=None, + thread_name="device"): + super().__init__() + self.stop_request = False + self.device_comm_object_list = device_comm_object_list if device_comm_object_list is not None else [] + + if thread_name is None: + thread_name = "device" + str(class_comm_master_thread.thread_object_id) + class_comm_master_thread.thread_object_id += 1 + + self.thread_name = thread_name + + def close(self): + self.stop_request = True + + def run(self): + print_inform_msg(f"{self.thread_name} modbus 主线程启动") + + total_fail_time = 0 + base_time = time.time() + + while not self.stop_request: + comm_success_count = 0 + total_comm_count = 0 + + for device in self.device_comm_object_list: + try: + if device.comm_active: + success_count, comm_count = device.device_comm_cycle() + comm_success_count += success_count + total_comm_count += comm_count + except Exception as err: + print_error_msg(err) + + cur_time = time.time() + + if comm_success_count > 0: + total_fail_time = 0 + elif total_comm_count > 0: + total_fail_time += cur_time - base_time + base_time = cur_time + + if total_fail_time >= self.MAX_FAIL_TIME: + self.reconnect_devices() + total_fail_time = 0 + + time.sleep(self.CHECK_INTERVAL) + + print_error_msg(f"{self.thread_name} modbus 主线程停止") + + def reconnect_devices(self): + """重新连接所有设备的协议""" + for device in self.device_comm_object_list: + try: + device.protocol.close() + except Exception as err: + print_error_msg(f"关闭协议时出错: {err}") + + for device in self.device_comm_object_list: + try: + device.protocol.open(device.protocol.mode) + except Exception as err: + print_error_msg(f"重新打开协议时出错: {err}") + + print_warning_msg("与保护器连接超时, 重新进行连接") diff --git a/config.py b/config.py new file mode 100644 index 0000000..b5af9f2 --- /dev/null +++ b/config.py @@ -0,0 +1,2 @@ + +CONFIG = {'kill_action' : 100} \ No newline at end of file diff --git a/device_conf.py b/device_conf.py new file mode 100644 index 0000000..05284b3 --- /dev/null +++ b/device_conf.py @@ -0,0 +1,127 @@ +import menu_page +import menu_utils as utils + + +def func_comm_test_leak_exam(object_device, topic_item, topic, message) : + return None + +def func_comm_table_trigger_item_exam(object_comm_table, comm_table_item) : + return False + + +exam_menu_alias_table = [ + {"alias_bool": {0:"关闭", 1:"打开"}}, +] + +exam_mqtt_topic_table = [ + {"name": "test_exam", "execute": func_comm_test_leak_exam}, +] + +exam_measure_pack = [ + { + "name": "OnStatus", + "addr": "8162.0", + "alias": "alias_onoff", + }, +] + +exam_comm_table = [ + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": "exam_measure_pack"}, +] + +exam_menu_top = [ + { + "name": "退出", + "action": "exit", + }, +] + +exam_menu_caption = [ + {"name" : "exam_menu_top", "menu" : exam_menu_top, "next" : exam_menu_top, "prev" : exam_menu_top, "caption": "测试菜单", "page" : 10, "max_items" : 8}, +] + +#通讯设备配置基类, 不同的modbus设备需要重载各个函数 +class class_comm_device_config : + def __init__(self): + pass + + #获取别名表 + def get_alias_table(self) : + return exam_menu_alias_table + + #获取通讯数据表, 及触发函数 + def get_comm_table(self) : + return exam_comm_table, func_comm_table_trigger_item_exam + + #获取主菜单 + def get_menu_top(self) : + return exam_menu_top + + #获取mqtt表, 实现mqtt通讯 + def get_mqtt_table(self) : + return exam_mqtt_topic_table + + #获取昆仑通态显示页面 + def menu_get_display_page(self, active_menu): + return menu_page.KUNLUN_GRAOUP_PAGE_MENU + + def get_menu_caption_info(self) : + return exam_menu_caption + + def modify_menu_item(self, menu_item, value) : + return False + #获取菜单相关信息 + def search_menu_info(self, menu_name) : + search_dict = None + list_caption_info = self.get_menu_caption_info() + for menu_dict in list_caption_info : + if "name" in menu_dict.keys() : + if menu_dict["name"] == menu_name : + search_dict = menu_dict + break + return search_dict + + #获取菜单相关信息 + def search_object_menu_info(self, menu_object) : + search_dict = None + list_caption_info = self.get_menu_caption_info() + for menu_dict in list_caption_info : + search_menu_object = utils.dict_or_object_get_attr(menu_dict, "menu", None) + if search_menu_object == menu_object : + search_dict = menu_dict + break + return search_dict + + #获取自身菜单 + def get_menu(self, menu_name) : + if menu_name != None : + search_dict = self.search_menu_info(menu_name) + if search_dict != None : + return utils.dict_or_object_get_attr(search_dict, "menu", None) + return None + + #获取自身菜单 + def get_menu_name(self, menu_object) : + menu_name = None + search_dict = self.search_object_menu_info(menu_object) + if search_dict != None : + menu_name = utils.dict_or_object_get_attr(search_dict, "name", None) + return menu_name + + #获取下一个兄弟菜单 + def get_menu_next(self, menu_name) : + search_dict = self.search_menu_info(menu_name) + menu_name = utils.dict_or_object_get_attr(search_dict, "next", None) + return self.get_menu(menu_name) + + #获取上一个兄弟菜单 + def get_menu_next(self, menu_name) : + search_dict = self.search_menu_info(menu_name) + menu_name = utils.dict_or_object_get_attr(search_dict, "prev", None) + return self.get_menu(menu_name) + + #获取菜单显示页面 + def get_menu_page(self, menu_name) : + search_dict = self.search_menu_info(menu_name) + page = utils.dict_or_object_get_attr(search_dict, "page", menu_page.KUNLUN_GRAOUP_PAGE_MENU) + return page \ No newline at end of file diff --git a/face_flask.sh b/face_flask.sh new file mode 100644 index 0000000..df1e2c0 --- /dev/null +++ b/face_flask.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# 设置路径变量 +ENV_PATH="/home/zzkj/myenv/bin/activate" +FACE_PATH="/home/zzkj/MenuPython_QT/QT5_Project/Shared_CODE/run.py" + +# 激活虚拟环境 +source "$ENV_PATH" + +python3 "$FACE_PATH" + + diff --git a/menu_base.py b/menu_base.py new file mode 100644 index 0000000..48cd637 --- /dev/null +++ b/menu_base.py @@ -0,0 +1,106 @@ +from device_conf import class_comm_device_config + +class class_menu_layer_info() : + def __init__(self, + menu_acitve : dict = None, + config: class_comm_device_config = None) : + + self.menu_display_start = 0 + self.menu_select = 0 + self.menu_active = menu_acitve + self.config = config + + if menu_acitve == None: + self.menu_item_count = 0 + else : + self.menu_item_count = len(menu_acitve) + +class class_device_menu() : + def __init__(self, + device_remap = 0, + device_config : class_comm_device_config = None): + + self.config = device_config + self.menu_table = None if device_config == None else device_config.get_menu_top() + self.alias_table = None if device_config == None else device_config.get_alias_table() + self.mqtt_table = None if device_config == None else device_config.get_mqtt_table() + if device_config == None : + self.comm_table = None + self.func_comm_table_trigger_item = None + else : + self.comm_table, self.func_comm_table_trigger_item = device_config.get_comm_table() + + self.device_remap = device_remap + self.menu_layers : dict = [] + self.menu_layer_index = 0 + menu_layer_item = class_menu_layer_info(self.menu_table, self.config) + self.menu_layers.append(menu_layer_item) + + #更新菜单配置信息, 当设备发送变化时,菜单也会同步发生变化 + def menu_update_device_config(self, device_config : class_comm_device_config) : + self.config = device_config + if device_config == None : + self.menu_table = None + self.alias_table = None + self.mqtt_table = None + self.comm_table = None + self.func_comm_table_trigger_item = None + else : + self.menu_table = device_config.get_menu_top() + self.alias_table = device_config.get_alias_table() + self.mqtt_table = device_config.get_mqtt_table() + self.comm_table, self.func_comm_table_trigger_item = device_config.get_comm_table() + + #修改菜单remap地址 + def menu_update_device_remap_addr(self, device_remap) : + self.device_remap = device_remap + + + #获取菜单层级信息 + def menu_get_layer_info(self) : + return self.menu_layers[self.menu_layer_index] + + #获取当前的活动菜单 + def menu_get_active_menu(self) : + active_layer : class_menu_layer_info = self.menu_get_layer_info() + menu_active = active_layer.menu_active + return menu_active + + #获取选中的有效菜单相 + def menu_get_active_item(self) : + active_layer : class_menu_layer_info = self.menu_get_layer_info() + menu_active = active_layer.menu_active + menu_item = None + if menu_active != None : + if active_layer.menu_select < len(menu_active) : + menu_item = menu_active[active_layer.menu_select] + return menu_item + + #返回上一层菜单 + def menu_return_to_upper_layer(self) : + if self.menu_layer_index > 0 : + self.menu_layer_index -= 1 + self.menu_layers.pop(-1) + + active_layer : class_menu_layer_info = self.menu_get_layer_info() + if active_layer.config != self.config : + self.menu_update_device_config(active_layer.config) + return active_layer + + #返回最上一层菜单 + def menu_return_to_most_upper_layer(self) : + while self.menu_layer_index > 0 : + self.menu_layer_index -= 1 + self.menu_layers.pop(-1) + + active_layer : class_menu_layer_info = self.menu_get_layer_info() + if active_layer.config != self.config : + self.menu_update_device_config(active_layer.config) + return self.menu_get_layer_info() + + #进入下一层菜单 + def menu_enter_sub_menu(self, sub_menu) : + self.menu_layer_index += 1 + menu_layers = class_menu_layer_info(sub_menu, self.config) + self.menu_layers.append(menu_layers) + return self.menu_get_layer_info() diff --git a/menu_group.py b/menu_group.py new file mode 100644 index 0000000..5e47274 --- /dev/null +++ b/menu_group.py @@ -0,0 +1,726 @@ +import modbus_tk.defines as cst +from modbus_tk import modbus_tcp, hooks, modbus +import menu_utils as utils +import menu_key_def as KEYDEF +import ZZ_9TE as device_9TE +import struct +from threading import Thread +from typing import Tuple +from device_conf import class_comm_device_config +from comm_device import class_comm_device +from menu_base import class_menu_layer_info, class_device_menu +import menu_page +import modbus_server +from modbus_server import class_modbus_tcp_server +import comm_global +from comm_thread import class_comm_master_thread + +DEFAULT_EMPTY_STR = " " +MAX_NUMS_OF_STRING = 20 #每个字符串占用寄存器数 +MAX_NUMS_OF_MENU_LINE = MAX_NUMS_OF_STRING * 2 +MAX_NUMS_OF_MODIFY_STRING = 20 + + +MENU_PAGE_DYNAMIC_MENU =1 +MENU_PAGE_ALARM =2 + +class class_menu_group(Thread, class_device_menu) : + def __init__(self, + device_remap = 0, + max_menu_lines = 8, + comm_config : class_comm_device_config = None, + modbus_tcp_server : class_modbus_tcp_server = None): + + Thread.__init__(self) + class_device_menu.__init__(self, device_remap, comm_config) + + self.modbus_tcp_server = modbus_tcp_server + self.max_menu_lines = max_menu_lines + self.server = None + + self.menu_reg_count = 10000 + self.menu_active = None if self.config == None else self.config.get_menu_top() + return + + def menu_get_regsiter_addr(self, row, col) : + if col == 1: + addr = modbus_server.REGISTER_MENU_STRING_ROW0_COL1 + row * MAX_NUMS_OF_STRING + else : + addr = modbus_server.REGISTER_MENU_STRING_ROW0_COL0 + row * MAX_NUMS_OF_STRING + return addr + + def register_menu_string_fill(self, addr, menu_str, max_count) : + index = 0 + for chr in menu_str : + self.update_server_register(addr + index, ord(chr)) + if index >= max_count - 1: + break + index += 1 + self.update_server_register(addr + index, 0) + + def menu_display_string(self, row, col, menu_str) : + addr = self.menu_get_regsiter_addr(row, col) + self.register_menu_string_fill(addr, menu_str, MAX_NUMS_OF_STRING) + + def menu_display_modify_caption_string(self, menu_str) : + addr = modbus_server.REGISTER_MENU_MODIFY_CAPTION_STRING + self.register_menu_string_fill(addr, menu_str, MAX_NUMS_OF_MODIFY_STRING) + + def menu_display_modify_string(self, menu_str) : + addr = modbus_server.REGISTER_MENU_MODIFY_STRING + self.register_menu_string_fill(addr, menu_str, MAX_NUMS_OF_MODIFY_STRING) + + def menu_display_modify_select_string(self, menu_str) : + addr = modbus_server.REGISTER_MENU_MODIFY_SELECT_STRING + self.register_menu_string_fill(addr, menu_str, MAX_NUMS_OF_MODIFY_STRING) + + def menu_get_value_regs(self, menu_item) : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", None) + value = None + comm_thread : class_comm_master_thread= None + comm_device : class_comm_device = None + comm_device, comm_thread, device_menu = comm_global.search_device_remap_infos(self.device_remap) + + if comm_str != None: + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if comm_thread == None or reg_count == 0: + value = None + elif bit >= 0: + start_index = int(bit / 16) + end_index = int((bit + reg_count + 15) / 16) + reg_items = end_index - start_index + value = comm_device.read_register_count(reg_addr + start_index, reg_items) + #value = comm_thread.comm_hold_register_read(comm_addr, reg_addr + start_index, reg_items) + comm_device.device_comm_flush_request(reg_addr + start_index, reg_items, cycle = 3000) + else : + value = comm_device.read_register_count(reg_addr, reg_count) + #value = comm_thread.comm_hold_register_read(comm_addr, reg_addr, reg_count) + + #刷新请求 + comm_device.device_comm_flush_request(reg_addr, reg_count, cycle = 3000) + return value + + def menu_get_value_scale_float(self, menu_item) : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", None) + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + value = self.menu_get_value_regs(menu_item) + is_big_endian = self.menu_data_is_big_endian(menu_item) + is_float = self.menu_data_is_float(menu_item) + + new_value = None + if value != None : + if len(value) == 2: + if is_big_endian: + new_value = value[1] + (value[0] << 16) + else : + new_value = value[0] + (value[1] << 16) + + if is_float : + bytes = struct.pack('BBBB', new_value & 0xFF, (new_value >> 8) & 0xFF, (new_value >> 16) & 0xFF, (new_value >> 24) & 0xFF) + new_value = struct.unpack("= 0 and new_value != None and is_float == False: + bit = bit % 16 + new_value = (new_value >> bit) & (0xFFFFFFFF >> (32 - reg_count)) + + if new_value != None : + scale = utils.dict_or_object_get_attr(menu_item, "scale", 1.0) + new_value = new_value * scale + return new_value + + def menu_get_value(self, menu_item) : + return self.menu_get_value_scale_float(menu_item) + + def menu_write_value(self, menu_item, new_value) : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", None) + if comm_str != None and new_value != None: + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + + comm_thread : class_comm_master_thread = None + comm_device : class_comm_device = None + comm_device, comm_thread, device_menu = comm_global.search_device_remap_infos(self.device_remap) + + if comm_thread != None and comm_device != None and reg_count == len(new_value) : + return comm_thread.comm_hold_register_write(comm_device.comm_addr, reg_addr, reg_count, new_value) + return False + + def menu_get_value_string(self, menu_item) : + value_str = None + value = None + format_str = utils.dict_or_object_get_attr(menu_item, "format", "%f") + is_big_endian = self.menu_data_is_big_endian(menu_item) + action_str = utils.dict_or_object_get_attr(menu_item, "action", None) + + if action_str == "time" : + value = self.menu_get_value_regs(menu_item) + value_str = self.menu_get_time_string(value) + elif action_str == "date" : + value = self.menu_get_value_regs(menu_item) + value_str = self.menu_get_date_string(value) + elif action_str == "ip" : + value = self.menu_get_value_regs(menu_item) + value_str = self.menu_get_ip_string(value, is_big_endian) + elif action_str != None: + return None + else : + new_value = self.menu_get_value_scale_float(menu_item) + if new_value != None : + value_str = format_str%(new_value) + + return value_str + + def menu_display_page(self, page) : + self.update_server_register(modbus_server.REGISTER_MENU_DISPLAY_PAGE, page) + + def menu_popup_modify_status_change(self, active = False) : + self.update_server_register(modbus_server.REGISTER_MENU_POPUP_MODIFY_ACTIVE, int(active)) + + def menu_remap_addr_flush(self, menu_table) : + if menu_table == None: + return + for menu_item in menu_table: + sub_menu_name = utils.dict_or_object_get_attr(menu_item, "sub_menu", None) + sub_menu = self.config.get_menu(sub_menu_name) + + if sub_menu : + #子菜单递归调用 + self.menu_remap_addr_flush(sub_menu) + continue + remap_addr = utils.dict_or_object_get_attr(menu_item, "remap_addr", None) + if remap_addr != None : + #需要加上设备重映射基础地址 + remap_addr += self.device_remap + new_value = self.menu_get_value_scale_float(menu_item) + if type(new_value) == float: + reg_values = [] + bs = struct.pack('f', new_value) + reg_values.append(bs[0] | bs[1] << 8) + reg_values.append(bs[2] | bs[3] << 8) + self.update_server_register(remap_addr, reg_values) + + def menu_top_remap_addr_flush(self) : + self.menu_remap_addr_flush(self.menu_table) + + def menu_display(self): + menu_count = 0 + row = 0 + col = 0 + active_layer : class_menu_layer_info = self.menu_get_layer_info() + menu_active = active_layer.menu_active + + menu_index = 0 + for menu_item in menu_active : + if menu_index < active_layer.menu_display_start: + menu_index += 1 + continue + + caption = DEFAULT_EMPTY_STR + if "name" in menu_item.keys() : + caption = menu_item["name"] + col = 0 + self.menu_display_string(row, col, caption) + + sub_menu_name = utils.dict_or_object_get_attr(menu_item, "sub_menu", None) + sub_menu = self.config.get_menu(sub_menu_name) + + if sub_menu != None: + self.menu_display_string(row, col + 1, " ") + else : + alias_str = self.menu_get_alias_value_string(menu_item) + if alias_str : + self.menu_display_string(row, col + 1, alias_str) + else : + value_str = self.menu_get_value_string(menu_item) + if value_str != None : + unit_str = utils.dict_or_object_get_attr(menu_item, "unit", DEFAULT_EMPTY_STR) + value_str = value_str + " " + unit_str + self.menu_display_string(row, col + 1, value_str) + else : + self.menu_display_string(row, col + 1, DEFAULT_EMPTY_STR) + + row = row + 1 + menu_count += 1 + if menu_count >= self.max_menu_lines : + break + + while row < self.max_menu_lines : + self.menu_display_string(row, 0, DEFAULT_EMPTY_STR) + self.menu_display_string(row, 1, DEFAULT_EMPTY_STR) + row += 1 + + def menu_get_alias_dict(self, alias_name) : + alias_value_dict = None + if alias_name != None and self.alias_table != None: + for alias_dict in self.alias_table : + if alias_name in alias_dict.keys() : + alias_value_dict = alias_dict[alias_name] + return alias_value_dict + + def menu_get_alias_value_string(self, menu_item) : + alias = utils.dict_or_object_get_attr(menu_item, "alias", None) + if alias == None : + return None + + alias_dict = self.menu_get_alias_dict(alias) + if alias_dict == None : + return None + + value = self.menu_get_value_scale_float(menu_item) + alias_value_str = None + if alias_dict != None and value != None: + alias_value = int(value) + if alias_value in alias_dict.keys() : + alias_value_str = alias_dict[alias_value] + return alias_value_str + + def menu_modify_value_string(self, value_string, unit_string = DEFAULT_EMPTY_STR, caption_string = DEFAULT_EMPTY_STR) : + sel_bit = 0 + if value_string == None: + return None + + modify_value_string = value_string + key = KEYDEF.MENU_PACK_KEY_NULL + while True : + key = comm_global.g_key_thread.menu_wait_key(0.1) + value_string_display = modify_value_string + if key == KEYDEF.MENU_PACK_KEY_RESET_OR_UP or key == KEYDEF.MENU_PACK_KEY_ESCAPE : + break + if key == KEYDEF.MENU_PACK_KEY_DOWN : + if str.isdigit(modify_value_string[sel_bit]) : + modify_value_list = list(modify_value_string) + modify_value_list[sel_bit] = chr(ord(modify_value_list[sel_bit]) - 1) + if modify_value_list[sel_bit] < '0': + modify_value_list[sel_bit] = '9' + modify_value_string = ''.join(modify_value_list) + + elif key == KEYDEF.MENU_PACK_KEY_UP : + if str.isdigit(modify_value_string[sel_bit]) : + modify_value_list = list(modify_value_string) + modify_value_list[sel_bit] = chr(ord(modify_value_list[sel_bit]) + 1) + if modify_value_list[sel_bit] > '9': + modify_value_list[sel_bit] = '0' + modify_value_string = ''.join(modify_value_list) + + elif key == KEYDEF.MENU_PACK_KEY_ENTER_OR_RIGHT or key == KEYDEF.MENU_PACK_KEY_RIGHT: + while sel_bit < len(modify_value_string): + sel_bit += 1 + if sel_bit >= len(modify_value_string) : + key = KEYDEF.MENU_PACK_KEY_ENTER + break + if str.isdigit(modify_value_string[sel_bit]) : + break + if sel_bit >= len(modify_value_string): + break + + value_string_list = list(value_string_display) + value_string_list[sel_bit] = ' ' + value_string_display = ''.join(value_string_list) + + value_string_display_select = modify_value_string[0 : sel_bit + 1] + + self.menu_display_modify_caption_string(caption_string) + self.menu_display_modify_string(value_string_display + unit_string) + self.menu_display_modify_select_string(value_string_display_select) + + if key == KEYDEF.MENU_PACK_KEY_ENTER or key == KEYDEF.MENU_PACK_KEY_ENTER_OR_RIGHT: + return modify_value_string + return value_string + + def menu_modify_date_menu_item(self, menu_item) : + origin_value = self.menu_get_value_regs(menu_item) + value_string = self.menu_get_value_string(menu_item) + unit_string = utils.dict_or_object_get_attr(menu_item, "unit", DEFAULT_EMPTY_STR) + new_value_string:str = self.menu_modify_value_string(value_string, unit_string) + if new_value_string != value_string : + date_str = new_value_string.split('-') + new_value = origin_value + + if len(date_str) == 3: + new_value = [] + year = int(date_str[0]) + month = int(date_str[1]) + day = int(date_str[2]) + new_value.append(year) + new_value.append(month) + new_value.append(day) + return new_value, True + else : + return origin_value, False + + def menu_modify_time_menu_item(self, menu_item) : + origin_value = self.menu_get_value_regs(menu_item) + value_string = self.menu_get_value_string(menu_item) + unit_string = utils.dict_or_object_get_attr(menu_item, "unit", DEFAULT_EMPTY_STR) + new_value_string:str = self.menu_modify_value_string(value_string, unit_string) + if new_value_string != value_string : + date_str = new_value_string.split(':') + new_value = origin_value + + if len(date_str) == 3: + new_value = [] + hour = int(date_str[0]) + minute = int(date_str[1]) + second = int(date_str[2]) + new_value.append(hour) + new_value.append(minute) + new_value.append(second) + return new_value, True + else : + return origin_value, False + + def menu_get_date_string(self, date_value) : + value_string = None + if date_value != None: + if len(date_value) == 3 : + year = date_value[0] + month = date_value[1] + day = date_value[2] + value_string = "%04d-%02d-%02d"%(year, month, day) + return value_string + + def menu_get_time_string(self, time_value) : + value_string = None + if time_value != None : + if len(time_value) == 3 : + hour = time_value[0] + minute = time_value[1] + second = time_value[2] + value_string = "%02d:%02d:%02d"%(hour, minute, second) + return value_string + + def menu_get_ip_string(self, ip_value, is_big_endian = False) : + value_string:str = None + if ip_value != None: + if len(ip_value) == 2: + if is_big_endian: + str_ip1 = "%03d"%(((ip_value[1] >> 0) & 0xFF),) + str_ip2 = "%03d"%(((ip_value[1] >> 8) & 0xFF),) + str_ip3 = "%03d"%(((ip_value[0] >> 16) & 0xFF),) + str_ip4 = "%03d"%(((ip_value[0] >> 24) & 0xFF),) + else : + str_ip1 = "%03d"%(((ip_value[0] >> 0) & 0xFF),) + str_ip2 = "%03d"%(((ip_value[0] >> 8) & 0xFF),) + str_ip3 = "%03d"%(((ip_value[1] >> 16) & 0xFF),) + str_ip4 = "%03d"%(((ip_value[1] >> 24) & 0xFF),) + value_string = "%s.%s.%s.%s"%(str_ip1, str_ip2, str_ip3, str_ip4) + return value_string + + def menu_get_ip_value(self, ip_str:str) : + ip = ip_str.split(sep = '.') + ip_value = [] + + if len(ip) == 4 : + ip0 = int(ip[0]) + ip1 = int(ip[1]) + ip2 = int(ip[2]) + ip3 = int(ip[3]) + ip_value.append((ip0 << 0) | (ip1 << 8)) + ip_value.append((ip2 << 16) | (ip3 << 24)) + return ip_value + + def menu_data_is_big_endian(self, menu_item) : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", DEFAULT_EMPTY_STR) + is_big_endian = False + if comm_str : + if "#>" in comm_str : + is_big_endian = True + return is_big_endian + + def menu_data_is_float(self, menu_item) : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", DEFAULT_EMPTY_STR) + is_float = False + if comm_str : + if "#f" in comm_str : + is_float = True + return is_float + + def menu_modify_ip_menu_item(self, menu_item) : + origin_value = self.menu_get_value_regs(menu_item) + is_big_endian = self.menu_data_is_big_endian(menu_item) + + value_string:str = self.menu_get_ip_string(origin_value, is_big_endian) + unit_string = DEFAULT_EMPTY_STR + new_value_string = self.menu_modify_value_string(value_string, unit_string) + if new_value_string != value_string : + new_value = self.menu_get_ip_value(new_value_string) + return new_value, True + else : + return origin_value, False + + def menu_update_modify_regs(self, menu_item, old_value_regs, modify_value) : + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", DEFAULT_EMPTY_STR) + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + scale = utils.dict_or_object_get_attr(menu_item, "scale", 1.0) + is_float = self.menu_data_is_float(menu_item) + is_big_endian = self.menu_data_is_big_endian(menu_item) + + if modify_value == None : + return old_value_regs + + modify_regs = None + if len(old_value_regs) == 2: + modify_regs = [] + modify_value = modify_value / scale + + if is_float : + #把浮点数转换成4字节数, 然后转化成32位整数 + bs = struct.pack("f", modify_value) + modify_value = bs[0] | (bs[1] << 8) | (bs[2] << 16) | (bs[3] << 24) + else : + modify_value = int(modify_value) + + if bit >= 0: + if is_big_endian : + old_value = (old_value_regs[0] << 16) | old_value_regs[1] + else : + old_value = (old_value_regs[1] << 16) | old_value_regs[0] + + clear_mask = (0xFFFFFFFF >> (32 - reg_count)) << bit + set_mask = (modify_value << bit) & clear_mask + modify_value = (old_value & ~clear_mask) | set_mask + + if is_big_endian : + modify_regs.append((modify_value >> 16) & 0xFFFF) + modify_regs.append(modify_value & 0xFFFF) + else : + modify_regs.append(modify_value & 0xFFFF) + modify_regs.append((modify_value >> 16) & 0xFFFF) + elif len(old_value_regs) == 1: + modify_regs = [] + modify_value = int(modify_value / scale) + if bit >= 0: + old_value = old_value_regs[0] + clear_mask = (0xFFFFFFFF >> (32 - reg_count)) << bit + set_mask = (modify_value << bit) & clear_mask + modify_value = (old_value & ~clear_mask) | set_mask + modify_regs.append(int(modify_value) & 0xFFFF) + + return modify_regs + + def menu_modify_normal_menu_item(self, menu_item) ->Tuple[list, bool]: + old_value_regs = self.menu_get_value_regs(menu_item) + value_string = self.menu_get_value_string(menu_item) + + new_value_string = value_string + if value_string != None: + unit_string = utils.dict_or_object_get_attr(menu_item, "unit", DEFAULT_EMPTY_STR) + new_value_string = self.menu_modify_value_string(value_string, unit_string) + + if new_value_string != value_string and value_string != None: + modify_value = float(new_value_string) + new_value_regs = self.menu_update_modify_regs(menu_item, old_value_regs, modify_value) + return new_value_regs, True + else : + return old_value_regs, False + + def menu_modify_alias_menu_item(self, menu_item): + alias = utils.dict_or_object_get_attr(menu_item, "alias", None) + alias_dict = self.menu_get_alias_dict(alias) + old_value_regs = self.menu_get_value_regs(menu_item) + + if old_value_regs == None: + return old_value_regs, False + + fvalue = self.menu_get_value_scale_float(menu_item) + alias_value = int(fvalue) + + alias_value_index = -1 + search_index = 0 + for item in alias_dict.keys(): + if item == alias_value : + alias_value_index = search_index + break + search_index += 1 + + if alias_value_index < 0 : + return old_value_regs, False + + while True : + key = comm_global.g_key_thread.menu_wait_key(0.1) + + if key == KEYDEF.MENU_PACK_KEY_DOWN : + alias_value_index += 1 + if alias_value_index >= len(alias_dict) : + alias_value_index = 0 + + elif key == KEYDEF.MENU_PACK_KEY_UP : + alias_value_index -= 1 + if alias_value_index < 0 : + alias_value_index = len(alias_dict) - 1 + + new_alias_value = None + new_alias_str = DEFAULT_EMPTY_STR + + search_index = 0 + for new_alias_value, new_alias_str in alias_dict.items() : + if search_index == alias_value_index : + break + search_index += 1 + + self.menu_display_modify_string(new_alias_str) + self.menu_display_modify_select_string(new_alias_str) + + if key == KEYDEF.MENU_PACK_KEY_ENTER or key == KEYDEF.MENU_PACK_KEY_ENTER_OR_RIGHT : + new_value_regs = self.menu_update_modify_regs(menu_item, old_value_regs, new_alias_value) + is_modified = True if (new_value_regs != old_value_regs) else False + return new_value_regs, is_modified + if key == KEYDEF.MENU_PACK_KEY_RESET_OR_UP: + return old_value_regs, False + + def _menu_adjust_select_item(self, increase) : + active_layer : class_menu_layer_info = self.menu_get_layer_info() + + active_layer.menu_select += increase + if increase > 0 and active_layer.menu_select >= active_layer.menu_item_count : + active_layer.menu_select = 0 + + if active_layer.menu_select < 0 : + active_layer.menu_select = active_layer.menu_item_count - 1 + + if active_layer.menu_display_start + self.max_menu_lines <= active_layer.menu_select : + active_layer.menu_display_start = active_layer.menu_select - self.max_menu_lines + 1 + + if active_layer.menu_select < active_layer.menu_display_start : + active_layer.menu_display_start = active_layer.menu_select + + def menu_process(self, key = KEYDEF.MENU_PACK_KEY_NULL) -> Tuple[bool] : + active_layer : class_menu_layer_info = self.menu_get_layer_info() + if active_layer == None : + return False + + result = False + + select_row = active_layer.menu_select - active_layer.menu_display_start + if select_row >= 0: + self.update_server_register(modbus_server.REGISTER_MENU_ITEM_SELECT_MASK, 0x01 << select_row) + if key == KEYDEF.MENU_PACK_KEY_UP : + self._menu_adjust_select_item(-1) + self.update_server_register(modbus_server.REGISTER_MENU_ITEM_SELECT_MASK, 0x01 << select_row) + elif key == KEYDEF.MENU_PACK_KEY_DOWN : + self._menu_adjust_select_item(1) + self.update_server_register(modbus_server.REGISTER_MENU_ITEM_SELECT_MASK, 0x01 << select_row) + elif key == KEYDEF.MENU_PACK_KEY_RESET_OR_UP or key == KEYDEF.MENU_PACK_KEY_ESCAPE: + self.menu_return_to_upper_layer() + elif key == KEYDEF.MENU_PACK_KEY_ENTER_OR_RIGHT or key == KEYDEF.MENU_PACK_KEY_ENTER : + menu_item = self.menu_get_active_item() + + #地址映射有效, 修改映射地址 + device_remap = utils.dict_or_object_get_attr(menu_item, "device_remap", None) + if device_remap != None: + self.menu_update_device_remap_addr(device_remap) + + function = utils.dict_or_object_get_attr(menu_item, "function", None) + if function != None : + device_menu = self + result = function(device_menu, menu_item) + if result : + return True + + sub_menu_name = utils.dict_or_object_get_attr(menu_item, "sub_menu", None) + sub_menu = self.config.get_menu(sub_menu_name) + + if sub_menu : + self.menu_enter_sub_menu(sub_menu) + return True + + format_str = utils.dict_or_object_get_attr(menu_item, "format", None) + + action_str = utils.dict_or_object_get_attr(menu_item, "action", None) + if action_str == "exit" : + self.menu_return_to_upper_layer() + return True + elif action_str == "exit2" : + self.menu_return_to_most_upper_layer() + return True + + self.menu_popup_modify_status_change(active = True) + changed = False + new_value = None + + if action_str == "time": + new_value, changed = self.menu_modify_time_menu_item(menu_item) + elif action_str == "date" : + new_value, changed = self.menu_modify_date_menu_item(menu_item) + elif action_str == "ip" : + new_value, changed = self.menu_modify_ip_menu_item(menu_item) + elif action_str != None : + return False + else : + alias = utils.dict_or_object_get_attr(menu_item, "alias", None) + if alias != None : + new_value, changed = self.menu_modify_alias_menu_item(menu_item) + else: + new_value, changed = self.menu_modify_normal_menu_item(menu_item) + + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", DEFAULT_EMPTY_STR) + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + + if changed and new_value != None: + comm_device :class_comm_device = None + + comm_device, comm_thread, device_menu = comm_global.search_device_remap_infos(self.device_remap) + if comm_thread != None and comm_device != None and reg_count > 0: + result = comm_device.write_register(reg_addr, reg_count, new_value) + #result = comm_thread.comm_hold_register_write(comm_addr, reg_addr, reg_count, new_value) + + self.menu_popup_modify_status_change(active = False) + return result + + def update_server_register(self, addr, value) : + if self.modbus_tcp_server : + self.modbus_tcp_server.update_server_register(addr, value) + + def run(self) : + while True: + key = comm_global.g_key_thread.menu_wait_key(0.1) + + page = None + active_menu = self.menu_get_active_menu() + if self.config != None : + page = self.config.menu_get_display_page(active_menu) + if page == None : + page = menu_page.KUNLUN_GRAOUP_PAGE_MENU + + self.menu_display_page(page) + self.menu_process(key) + self.menu_display() + +''' +可使用的函数: +创建从站: server.add_slave(slave_id) + slave_id(int):从站id +为从站添加存储区: slave.add_block(block_name, block_type, starting_address, size) + + block_name(str):block名 + block_type(int):block类型,COILS = 1,DISCRETE_INPUTS = 2,HOLDING_REGISTERS = 3,ANALOG_INPUTS = 4 + starting_address(int):起始地址 + size(int):block大小 +设置block值:slave.set_values(block_name, address, values) + block_name(str):block名 + address(int):开始修改的地址 + values(a list or a tuple or a number):要修改的一个(a number)或多个(a list or a tuple)值 +获取block值:slave.get_values(block_name, address, size) + block_name(str):block名 + address(int):开始获取的地址 + size(int):要获取的值的数量 +''' + +if __name__ == '__main__': + comm_device_config: class_comm_device_config = device_9TE.comm_device_config + _slave_addr = 2 + + _device_remap = 2000 + + _modbus_tcp_server = class_modbus_tcp_server(slave_addr = _slave_addr, + slave_ip= "192.168.1.54", + slave_port = 502) + + object_menu_group = class_menu_group(device_remap =_device_remap, + comm_config = comm_device_config, + modbus_tcp_server = _modbus_tcp_server, + max_menu_lines = 8) + + object_menu_group.start() + diff --git a/menu_high.py b/menu_high.py new file mode 100644 index 0000000..9cf5d6a --- /dev/null +++ b/menu_high.py @@ -0,0 +1,2539 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_utils as uitls +from enum import Enum +from datetime import datetime +import time +import menu_utils as utils +import json +import re +from enum import Enum +from comm_modbus_device import class_modbus_comm_device + +now_time = datetime.now() +current_time = now_time.strftime("(%y/%m/%d)") +VERSION_DATE = current_time + +class StrInfo(Enum): + STR_MAX_VALUE = 0, #"最大值" + STR_MIN_VALUE = 1, #"最小值" + STR_SET_VALUE = 2, #"设定值" + STR_VALUE_EXCEED = 3, #"设定值越界" + STR_ZERO_PHASE = 4, #"有功相位" + STR_INPUT_PASSWORD = 5, #"请输入系统密码 + STR_SYSTEM_PASSWORD = 6, #"系统密码" + STR_PASSWORD_ERR = 7, #"密码错误" + STR_SHORT_PHASE_MODIFY =8, #"短路倍数\n恢复缺省" + STR_SWITCH_TYPE_MODIFY =9, #"漏电延时\n恢复缺省" + STR_SOFT_VERSION =10, #"软件版本" + STR_NO_RECORD =11, #"无记录" + STR_ENTER_TO_CLEAR =12, #"确定清除" + STR_ESC_TO_CANCEL =13, #"ESC取消" + STR_CLEAR_FINISH =14, #"清除成功" + STR_ESC_TO_EXIT =15, #"ESC退出 + STR_INPUT_NEW_PASSWORD =16, #"请设置新密码" + STR_NOT_POSSIBLE_TO_MODIFY =17, #"不可修改" + STR_CAPACITOR_MEASURE =18, #"电容检测 + STR_CAPACITOR_EQUAL =19, #"电容" + STR_LEEKAGE_MEASURE =20, #"检测中.." + STR_TEST_ACTIVE =21, #"测试状态 + STR_POWER_ON=22, #"合闸" + STR_POWER_OFF=23, #"分闸" + STR_FAIL=24, #"失效" + STR_NORMAL=25, #"正常" + STR_MEASURE_CURRENT=26, #"实测电流" + STR_RATE_CURRENT=27, #"额定电流" + STR_ANGLE=28, #"角度" + STR_AVERAGE_CURRENT=29, #"平均电流" + STR_MAX_CURRENT=30, #"最大电流 + STR_LOW_VOLTAGE_RATE=31, #"欠压值 + STR_MEASURE_VOLTAGE=32, #"实测电压" + STR_ZERO_CURRENT=33, #"零序电流" + STR_ZERO_VOLTAGE=34, #"零序电压" + STR_RECORD=35, #"记录" + STR_LEEAKGE_LOCK_VALUE=36, #"闭锁设定值" + STR_LEEAKGE_ACTIVE_VALUE=37, #"动作设定值" + STR_MEASURE_RESISTOR=38, #"电阻测量值" + STR_FRONT_CIRCUIT=39, #"前机" + STR_NEXT_CIRCUIT=40, #"后机" + STR_RATE_VOLTAGE=41, #"额定电压" + STR_PARA_MODIFY_ERROR=42, #"参数修改失败" + STR_LEEKAGE_RES_FINISH=43, #"闭锁电阻检测完" + STR_LEEKAGE_RES_MEASURE=44, #"闭锁电阻检测中" + STR_SFJ_MONITOR=45, #"双风机磁力监控" + STR_CL_MONITOR=46, #"磁力监控系统" + STR_CL_DB_MONITOR=47, #"双回路磁力监控" + STR_YB_MONITOR=48, #"移变低压侧" + STR_KUI_DIAN_MONITOR=49, #"馈电开关监控" + STR_TYPE=50, #"类型:" + STR_TOP_SWITCH=51, #"总开关" + STR_BOTTOM_SWITCH=52, #"分开关" + STR_COS_V=53, #"COS(ΦaΦbΦc)" + STR_POWER_VI=54, #"有功功率" + STR_POWER_VI_T=55, #"电量" + STR_FRONT_POWER_ON=56, #"前机合" + STR_NEXT_POWER_ON=57, #"后机合" + STR_FRONT_POWER_OFF=58, #"前机分" + STR_NEXT_POWER_OFF=59, #"后机分" + STR_FRONT_RESISTOR=60, #"前机电阻:" + STR_NEXT_RESISTOR=61, #"后机电阻:" + STR_WORK_MODE=62, #"模式:" + STR_LEEKAGE_RES=63, #"漏电电阻" + STR_REVERSE_VOLTAGE=64, #"反电动势\n注意安全" + STR_LIGHT=65, #"照明" + STR_SIGNAL=66, #"信号" + STR_SWITCH_STATUS=67, #"开关状态" + STR_POWER_ON_COUNTS=68, #"合闸次数" + STR_SETTING=69, #"设定值" + STR_POW_U=70, #"无功功率" + STR_TEST_FAIL=71, #"测试不正确" + STR_LEAKAGE_TEST_FAIL=72, #"漏电测试不正确" + STR_DETECT_FAIL_WHEN_POWER_ON=73, #"合闸时不能检测" + STR_LINK=74, #"联机系统" + STR_SINGLE=75, #"单机系统" + STR_STATUS=76, #"状态" + STR_MAIN_FIRST=77, #"主机优先" + STR_MAIN_BAK_SAME=78, #"主辅对等" + STR_MAIN_BAK_SWITCH=79, #"主辅轮动" + STR_SWITCH_DISABLE=80, #"局扇模式" + STR_MAIN=81, #"主机" + STR_BACKUP=82, #"备机" + STR_SINGLE_CIRCUIT_FRONT=83, #"单前机" + STR_SINGLE_CIRCUIT_NEXT=84, #"单后机" + STR_DOUBLE_CIRCUIT=85, #"双回路" + STR_WATER_PUMP_ON=86, #"水泵已开阀" + STR_WATER_PUMP_OFF=87, #"水泵已关阀" + STR_SWITCH_FAIL=88, #"粘连" + STR_SWITCH_THROUGH_2=89, #"击穿" + STR_GB_MONITOR=90, #"高压真空配电装置" + STR_GB_PROTECT_SYSTEM=91, #"综合保护监控系统" + STR_YBGY_MONITOR=92, #"移变高压侧" + STR_ERROR=93, #"故障" + STR_TEMPERATURE=94, #"温度" + STR_NEXT_CURRENT=95, #"后机电流" + STR_FRONT_CURRENT=96, #"前机电流" + STR_FJ_WS_LOCK=97, #"风机处瓦斯闭锁" + STR_GZM_WS_LOCK=98, #"工作面瓦斯闭锁" + STR_CURRENT=99, #"电流" + STR_VOLTAGE=100, #"电压" + STR_MONITOR_RES=101, #"监视电阻" + STR_SWITCH_THROUGH_SIMPLE=102, #"击穿" + STR_LINK_FAIL=103, #"联机失败" + STR_RES_OFF=104, #"漏电临界值" + STR_ANOTHER_REPAIR=105, #"另台维修请勿停机" + STR_WS_INTENSITY=106, #"瓦斯浓度" + STR_HIGH_VOLT=107, #"高压" + STR_AUTO=108, #"自动" + STR_MANUAL=109, #"手动" + STR_FREQUENCY=110, #"频率" + STR_FWD_ON=111, #正向启动 + STR_RVS_ON=112, #反向启动 + STR_TEMPERATURE_UNIT=113, #温度单位 + STR_POWER_LOSS=114, + STR_CALIBRATE_SUCCESS=115, #标定成功 + STR_ISOLATE_RES=116, #绝缘电阻 + STR_WATER_MONITOR=117, #水位控制排水监控系统 + STR_SWTICH_PROTECTOR=118, #ZDB-200电动机保护器 + STR_INDEPENDENT=119, #独立模式 + STR_DEPENDENT=120, #联动模式 + STR_OUT_POSITION=121, + STR_IN_POSITION=122, + STR_QUIT_IN_POSITION=123, + STR_RUN_DATA=124, + STR_WATER_MODE=125, + STR_INV_MODE=126, + STR_ISOLATE_RESISTOR_LOW=127, + STR_SWITCH=128, + STR_DIDAO=129, + STR_REMOTE=130, + STR_LOCAL=131, + STR_ONE_KEY_LOCK=132, + STR_COMM_FAIL=133, + +class Alarm(Enum): + ERR_NONE = 0, + ERR_CREEPAGE_LOCK = 1, #漏电报警 + ERR_VOLTAGE_LOW = 2, #欠压报警 + ERR_OVER_CURRENT = 3, #过流保护 + ERR_SHORT_CURRENT = 4, #短路保护 + ERR_CREEPAGE_SELECT = 5, #选漏 + ERR_UNBANLANCE_CURRENT = 6, #三相不平衡 + ERR_FLASH_FAIL = 7, #FLASH无法写入 + ERR_CREEPAGE_ACTIVE = 8, #漏电动作 + ERR_BREAK_PHASE = 9, #断相保护动作 + ERR_VOLTAGE_BREAK_PHASE = 10, #电压断相 + ERR_GAS_LOCK = 11, #瓦斯闭锁 + ERR_WIND_MOTOR_LOCK = 12, #风电闭锁 + ERR_VOLTAGE_OVER = 13, #过压报警 + ERR_SHORT_PHASE = 14, #相敏短路 + ERR_WATCH_DOG = 15, #看门狗保房 + ERR_SWITCH_FAIL = 16, #开关粘轿 + ERR_SWITCH_THROUGH = 17, #开关击? + ERR_SWITCH_ON_FAIL = 18, #开关合闸失? + ERR_COMM_FAIL = 19, #通讯故障 + ERR_CREEPAGE_SELECT2 = 20, #选择性报? + ERR_TEMP_IO_HIGH = 21, #IO口温度过驿 + ERR_SHORT_CURRENT_SIGNAL = 22, #信号电流短路 + ERR_REMOTE_OFF = 23, #远方分励 + ERR_REPAIR = 24, #维修状? + ERR_TEMP_ALARM = 25, #温度报警 + ERR_QUICK_CREEPAGE_ACT = 26, #快速漏电动仿 + ERR_GB_LEEK_SHORT = 27, #高爆绝缘短路 + ERR_GB_LEEK_BREAK = 28, #高爆绝缘断路 + ERR_YB_LOW_VOLTAGE_FAIL = 29, #移变低压侧失? + ERR_YB_LOW_VOLTAGE_UNREADY = 30, #移变低压侧未准备? + ERR_WS_FREQ_FAIL = 31, #瓦斯浓度超标 + ERR_HIGH_LOW_LOCK = 32, #高低压联钿 + ERR_MOTOR_ROTATE_LOCK = 33, #电机堵转 + ERR_FIX_TIME_OVER_CURRENT = 34, #定时限过泿 + ERR_FIX_TIME_SHORT_CURRENT = 35, #定时限短? + ERR_PHASE_ERROR = 36, #相序故障 + ERR_UNDER_LOAD = 37, #欠载保护 + ERR_PHASE_UNMATCH = 38, #互感器反? + ERR_EXTERNAL_ALARM = 39, #外部故障 + ERR_SENSOR_LOSS = 40, #水位传感器未? + ERR_ROTOR_SLOW = 41, + ERR_ROTOR_LOCK = 42, + ERR_POWER_LOSS = 43, #系统断电 + ERR_RSV1 = 44, + ERR_RSV2 = 45, + ERR_RSV3 = 46, + ERR_RSV4 = 47, + ERR_RSV5 = 48, + ERR_RSV6 = 49, + ERR_RSV7 = 50, + ERR_USER_ALARM1 = 51, #50,用户自定义故阿 + ERR_USER_ALARM2 = 52, #51,用户自定义故阿 + ERR_USER_ALARM3 = 53, #52,用户自定义故阿 + ERR_USER_ALARM4 = 54, #53,用户自定义故阿 + ERR_GB_LIGHT_THREAD_SON_LOSS = 55, + ERR_GB_LIGHT_THREAD_BROTHER_LOSS = 56, + ERR_GB_LIGHT_MODULE_LOSS = 57, + ERR_GB_FORCE_LEEK_OFF = 58, + ERR_GB_FORCE_SHORT_OFF = 59, + ERR_GB_CREEPAGE_SELECT = 60, #选择性报警 + ERR_SWITCH_OUT_POSITION = 61, + ERR_DZM_CREEPAGE_ACTIVE = 62, + ERR_OIL_PRESSURE_SENSOR_FAIL = 63, + ERR_FREQ_SENSOR_EXCEED = 64, + ERR_FREQ_SENSOR_FAIL = 65, + ERR_ANALOG_SENSOR_EXCEED = 66, + ERR_ANALOG_SENSOR_FAIL = 67, + ERR_VOLTAGE_LOSS = 68, + ERR_SPEED_LOSS = 69, + ERR_GB_ZERO_VOLT_OVER = 70, #零序过压 + ERR_PT_BREAK = 71, + ERR_CT_BREAK = 72, + ERR_ZERO_OVER_VOLTAGE = 73, + ERR_ZERO_OVER_CURRENT = 74, + ERR_GAS_WARNING = 75, + ERR_TEMP_WARNING = 76, + ERR_COMM_LOSS = 77, + ERR_CAR_FAIL = 78, + ERR_WATER_LOW = 79, + ERR_SWITCH_DIDAO_IN_POSITION = 80, + ERR_SWITCH_DIDAO_MID_POSITION = 81, + ERR_GB_CREEPAGE_SELECT_5 = 82, #5次谐波选漏 + ERR_FLUX_LOCK = 83, + ERR_GLOBAL_OIL_TEMP_LOCK = 84, + ERR_GLOBAL_WATER_PRESSURE_LOCK = 85, + ERR_GLOBAL_WATER_LEVEL_LOCK = 86, + ERR_GLOBAL_CURRENT_SENSOR_LOSS = 87, + ERR_GLOBAL_GAS_PERCENTAGE_LOCK = 88, + ERR_GLOBAL_GAS_SENSOR_LOSS = 89, + ERR_MEASURE_OVER_CURRENT = 90, #测量回路过流保护 + ERR_CREAPGE_BREAK = 91, + ERR_REMOTE_CREAPGE_TEST_FAIL = 92, + ERR_REMOTE_CREAPGE_TEST_SUCCESS = 93, + + + +class Alias(Enum): + alias_alarm = 0, + alias_str = 1, + alias_company = 2, + alias_bool = 3, + alias_voltage = 4, + alias_parity = 5, + alias_baud = 6, + alias_input = 7, + alias_onoff = 8, + alias_test = 9, + alias_can_baud = 10, + alias_measure_v = 11, + alias_switch_type = 12, + alias_work_mode = 13, + alias_us_phase = 14, + alias_sensor = 15, + alias_table = 16, + alias_remote = 17, + alias_current = 18, + alias_eth = 19, + alias_lcd = 20, + alias_dev = 21, + alias_fyj = 22, + alias_alarm_type = 23, + alias_car_position = 24, + +class Menu(Enum): + menu_current = 0, + menu_test = 1, + +alias_table = [ + {Alias.alias_alarm: {Alarm.ERR_NONE: "无故障", + Alarm.ERR_CREEPAGE_LOCK: "漏电闭锁", + Alarm.ERR_VOLTAGE_LOW: "欠压", + Alarm.ERR_OVER_CURRENT : "过流保护", #过流保护 + Alarm.ERR_SHORT_CURRENT : "短路保护", #短路保护 + Alarm.ERR_CREEPAGE_SELECT : "选漏", #选漏 + Alarm.ERR_UNBANLANCE_CURRENT : "三相不平衡", #三相不平衡报? + Alarm.ERR_FLASH_FAIL : "FLASH无法写入", #FLASH无法写入 + Alarm.ERR_CREEPAGE_ACTIVE : "漏电动作", #漏电动作 + Alarm.ERR_BREAK_PHASE : "电流断相", #断相保护动作 + Alarm.ERR_VOLTAGE_BREAK_PHASE : "电压断相", #电压断相 + Alarm.ERR_GAS_LOCK : "瓦斯闭锁", #瓦斯闭锁 + Alarm.ERR_WIND_MOTOR_LOCK : "风电闭锁", #风电闭锁 + Alarm.ERR_VOLTAGE_OVER : "过压", #过压报警 + Alarm.ERR_SHORT_PHASE : "相敏短路", #相敏短路 + Alarm.ERR_WATCH_DOG : "看门狗重启", #看门狗保房 + Alarm.ERR_SWITCH_FAIL : "真空管粘连", #真空管粘连 + Alarm.ERR_SWITCH_THROUGH : "真空管击穿", #真空管击穿 + Alarm.ERR_SWITCH_ON_FAIL : "合闸失败", #合闸失败 + Alarm.ERR_COMM_FAIL : "通讯失败", #通讯失败 + Alarm.ERR_CREEPAGE_SELECT2 : "选 漏", #选 漏 + Alarm.ERR_TEMP_IO_HIGH : "温度过高", #温度过高 + Alarm.ERR_SHORT_CURRENT_SIGNAL : "信号电流短路", #信号电流短路 + Alarm.ERR_REMOTE_OFF : "远方分励", #远方分励 + Alarm.ERR_REPAIR : "维修状态", #维修状态 + Alarm.ERR_TEMP_ALARM : "温度报警", #温度报警 + Alarm.ERR_QUICK_CREEPAGE_ACT : "漏电 动作", #快速漏电 动作 + Alarm.ERR_GB_LEEK_SHORT : "绝缘短路", #绝缘短路 + Alarm.ERR_GB_LEEK_BREAK : "绝缘断路", #绝缘断路 + Alarm.ERR_YB_LOW_VOLTAGE_FAIL : "低压侧故障", #低压侧故障 + Alarm.ERR_YB_LOW_VOLTAGE_UNREADY : "低压侧未准备好", #低压侧未准备好 + Alarm.ERR_WS_FREQ_FAIL : "瓦斯浓度超标", #瓦斯浓度超标 + Alarm.ERR_HIGH_LOW_LOCK : "高低压联锁", #高低压联锁 + Alarm.ERR_MOTOR_ROTATE_LOCK : "电机堵转", #电机堵转 + Alarm.ERR_FIX_TIME_OVER_CURRENT : "定时限过流", #定时限过流 + Alarm.ERR_FIX_TIME_SHORT_CURRENT : "定时限短路", #定时限短路? + Alarm.ERR_PHASE_ERROR : "相序故障", #相序故障 + Alarm.ERR_UNDER_LOAD : "欠载保护", #欠载保护 + Alarm.ERR_EXTERNAL_ALARM : "外部故障", #外部故障 + Alarm.ERR_POWER_LOSS : "系统断电", #系统断电 + Alarm.ERR_USER_ALARM1 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_USER_ALARM2 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_GB_LIGHT_THREAD_SON_LOSS : "光纤子节点丢失", + Alarm.ERR_GB_LIGHT_THREAD_BROTHER_LOSS : "光纤兄弟节点丢失", + Alarm.ERR_GB_LIGHT_MODULE_LOSS : "无光纤模块", + Alarm.ERR_GB_FORCE_LEEK_OFF : "光纤漏电越级跳", + Alarm.ERR_GB_FORCE_SHORT_OFF : "光纤短路越级跳", + Alarm.ERR_GB_CREEPAGE_SELECT : "漏电", #选择性报警 + Alarm.ERR_SWITCH_OUT_POSITION : "开关未推到位", + Alarm.ERR_DZM_CREEPAGE_ACTIVE : "漏电动作", + Alarm.ERR_OIL_PRESSURE_SENSOR_FAIL : "油压传感器未接入", + Alarm.ERR_FREQ_SENSOR_EXCEED : "频率传感器超限", + Alarm.ERR_FREQ_SENSOR_FAIL : "频率传感器未接入", + Alarm.ERR_ANALOG_SENSOR_EXCEED : "模拟量传感器超限", + Alarm.ERR_ANALOG_SENSOR_FAIL : "模拟量传感器未接入", + Alarm.ERR_VOLTAGE_LOSS : "失压故障", + Alarm.ERR_SPEED_LOSS : "失速故障", + Alarm.ERR_GB_ZERO_VOLT_OVER : "零序过压", + Alarm.ERR_PT_BREAK : "PT断线", + Alarm.ERR_CT_BREAK : "CT断线", + Alarm.ERR_ZERO_OVER_VOLTAGE : "零序过压", + Alarm.ERR_ZERO_OVER_CURRENT : "零序过流", + Alarm.ERR_GAS_WARNING : "轻瓦斯告警", + Alarm.ERR_TEMP_WARNING : "温度异常", + Alarm.ERR_COMM_LOSS : "通讯中断", + Alarm.ERR_CAR_FAIL : "手车控制器故障", + Alarm.ERR_WATER_LOW : "循环泵无水故障", + Alarm.ERR_SWITCH_DIDAO_IN_POSITION: "地刀合闸保护中", + Alarm.ERR_SWITCH_DIDAO_MID_POSITION: "地刀未到位", + Alarm.ERR_GB_CREEPAGE_SELECT_5: "5次谐波选漏", + Alarm.ERR_FLUX_LOCK: "流量闭锁", + Alarm.ERR_GLOBAL_OIL_TEMP_LOCK: "油温闭锁", + Alarm.ERR_GLOBAL_WATER_PRESSURE_LOCK: "水压闭锁", + Alarm.ERR_GLOBAL_WATER_LEVEL_LOCK: "液位闭锁", + Alarm.ERR_GLOBAL_CURRENT_SENSOR_LOSS: "互感器未接入", + Alarm.ERR_GLOBAL_GAS_PERCENTAGE_LOCK: "瓦斯浓度闭锁", + Alarm.ERR_GLOBAL_GAS_SENSOR_LOSS: "瓦斯断线", + Alarm.ERR_MEASURE_OVER_CURRENT: "测量回路过流", + Alarm.ERR_CREAPGE_BREAK: "接地开路", + Alarm.ERR_REMOTE_CREAPGE_TEST_FAIL: "漏电测试失败", + Alarm.ERR_REMOTE_CREAPGE_TEST_SUCCESS: "漏电测试成功", + } + }, + + {"alias_str" : { StrInfo.STR_MAX_VALUE :"最大值", + StrInfo.STR_MIN_VALUE :"最小值", + StrInfo.STR_SET_VALUE :"设定值", + StrInfo.STR_VALUE_EXCEED :"设定值越界", + StrInfo.STR_ZERO_PHASE :"有功相位", + StrInfo.STR_INPUT_PASSWORD :"请输入系统密码", + StrInfo.STR_SYSTEM_PASSWORD :"系统密码", + StrInfo.STR_PASSWORD_ERR :"密码错误", + StrInfo.STR_SHORT_PHASE_MODIFY :"短路倍数\n恢复缺省", + StrInfo.STR_SWITCH_TYPE_MODIFY :"漏电延时\n恢复缺省", + StrInfo.STR_SOFT_VERSION:"软件版本", + StrInfo.STR_NO_RECORD :"无记录", + StrInfo.STR_ENTER_TO_CLEAR:"确定清除", + StrInfo.STR_ESC_TO_CANCEL:"ESC取消", + StrInfo.STR_CLEAR_FINISH :"清除成功", + StrInfo.STR_ESC_TO_EXIT :"ESC退出", + StrInfo.STR_INPUT_NEW_PASSWORD :"请设置新密码", + StrInfo.STR_NOT_POSSIBLE_TO_MODIFY :"不可修改", + StrInfo.STR_CAPACITOR_MEASURE :"电容检测", + StrInfo.STR_CAPACITOR_EQUAL :"电容", + StrInfo.STR_LEEKAGE_MEASURE :"检测中..", + StrInfo.STR_TEST_ACTIVE :"测试状态", + StrInfo.STR_POWER_ON :"合闸", + StrInfo.STR_POWER_OFF :"分闸", + StrInfo.STR_FAIL :"失效", + StrInfo.STR_NORMAL :"正常", + StrInfo.STR_MEASURE_CURRENT :"实测电流", + StrInfo.STR_RATE_CURRENT :"额定电流", + StrInfo.STR_ANGLE :"角度", + StrInfo.STR_AVERAGE_CURRENT :"平均电流", + StrInfo.STR_MAX_CURRENT :"最大电流", + StrInfo.STR_LOW_VOLTAGE_RATE :"欠压值", + StrInfo.STR_MEASURE_VOLTAGE :"实测电压", + StrInfo.STR_ZERO_CURRENT :"零序电流", + StrInfo.STR_ZERO_VOLTAGE :"零序电压", + StrInfo.STR_RECORD :"记录", + StrInfo.STR_LEEAKGE_LOCK_VALUE :"闭锁设定值", + StrInfo.STR_LEEAKGE_ACTIVE_VALUE :"动作设定值", + StrInfo.STR_MEASURE_RESISTOR :"电阻测量值", + StrInfo.STR_FRONT_CIRCUIT :"前机", + StrInfo.STR_NEXT_CIRCUIT :"后机", + StrInfo.STR_RATE_VOLTAGE :"额定电压", + StrInfo.STR_PARA_MODIFY_ERROR :"参数修改失败", + StrInfo.STR_LEEKAGE_RES_FINISH :"闭锁电阻检测完", + StrInfo.STR_LEEKAGE_RES_MEASURE :"闭锁电阻检测中", + StrInfo.STR_SFJ_MONITOR :"双风机磁力监控", + StrInfo.STR_CL_MONITOR :"磁力监控系统", + StrInfo.STR_CL_DB_MONITOR :"双回路磁力监控", + StrInfo.STR_YB_MONITOR :"移变低压侧", + StrInfo.STR_KUI_DIAN_MONITOR :"馈电开关监控", + StrInfo.STR_TYPE :"类型:", + StrInfo.STR_TOP_SWITCH :"总开关", + StrInfo.STR_BOTTOM_SWITCH :"分开关", + StrInfo.STR_COS_V :"COS(ΦaΦbΦc)", + StrInfo.STR_POWER_VI :"有功功率", + StrInfo.STR_POWER_VI_T :"电量", + StrInfo.STR_FRONT_POWER_ON :"前机合", + StrInfo.STR_NEXT_POWER_ON :"后机合", + StrInfo.STR_FRONT_POWER_OFF :"前机分", + StrInfo.STR_NEXT_POWER_OFF :"后机分", + StrInfo.STR_FRONT_RESISTOR :"前机电阻:", + StrInfo.STR_NEXT_RESISTOR :"后机电阻:", + StrInfo.STR_WORK_MODE :"模式:", + StrInfo.STR_LEEKAGE_RES :"漏电电阻", + StrInfo.STR_REVERSE_VOLTAGE :"反电动势\n注意安全", + StrInfo.STR_LIGHT :"照明", + StrInfo.STR_SIGNAL :"信号", + StrInfo.STR_SWITCH_STATUS :"开关状态", + StrInfo.STR_POWER_ON_COUNTS :"合闸次数", + StrInfo.STR_SETTING :"设定值", + StrInfo.STR_POW_U :"无功功率", + StrInfo.STR_TEST_FAIL :"测试不正确", + StrInfo.STR_LEAKAGE_TEST_FAIL :"漏电测试不正确", + StrInfo.STR_DETECT_FAIL_WHEN_POWER_ON :"合闸时不能检测", + StrInfo.STR_LINK :"联机系统", + StrInfo.STR_SINGLE :"单机系统", + StrInfo.STR_STATUS :"状态", + StrInfo.STR_MAIN_FIRST :"主机优先", + StrInfo.STR_MAIN_BAK_SAME :"主辅对等", + StrInfo.STR_MAIN_BAK_SWITCH :"主辅轮动", + StrInfo.STR_SWITCH_DISABLE :"局扇模式", + StrInfo.STR_MAIN :"主机", + StrInfo.STR_BACKUP :"备机", + StrInfo.STR_SINGLE_CIRCUIT_FRONT :"单前机", + StrInfo.STR_SINGLE_CIRCUIT_NEXT :"单后机", + StrInfo.STR_DOUBLE_CIRCUIT :"双回路", + StrInfo.STR_WATER_PUMP_ON :"水泵已开阀", + StrInfo.STR_WATER_PUMP_OFF :"水泵已关阀", + StrInfo.STR_SWITCH_FAIL :"粘连", + StrInfo.STR_SWITCH_THROUGH_2 :"击穿", + StrInfo.STR_GB_MONITOR :"高压真空配电装置", + StrInfo.STR_GB_PROTECT_SYSTEM :"综合保护监控系统", + StrInfo.STR_YBGY_MONITOR :"移变高压侧", + StrInfo.STR_ERROR :"故障", + StrInfo.STR_TEMPERATURE:"温度", + StrInfo.STR_NEXT_CURRENT :"后机电流", + StrInfo.STR_FRONT_CURRENT :"前机电流", + StrInfo.STR_FJ_WS_LOCK :"风机处瓦斯闭锁", + StrInfo.STR_GZM_WS_LOCK :"工作面瓦斯闭锁", + StrInfo.STR_CURRENT :"电流", + StrInfo.STR_VOLTAGE:"电压", + StrInfo.STR_MONITOR_RES :"监视电阻", + StrInfo.STR_SWITCH_THROUGH_SIMPLE :"击穿", + StrInfo.STR_LINK_FAIL :"联机失败", + StrInfo.STR_RES_OFF :"漏电临界值", + StrInfo.STR_ANOTHER_REPAIR :"另台维修请勿停机", + StrInfo.STR_WS_INTENSITY :"瓦斯浓度", + StrInfo.STR_HIGH_VOLT :"高压", + StrInfo.STR_AUTO :"自动", + StrInfo.STR_MANUAL :"手动", + StrInfo.STR_FREQUENCY :"频率", + StrInfo.STR_FWD_ON :"正向启动", + StrInfo.STR_RVS_ON :"反向启动", + StrInfo.STR_TEMPERATURE_UNIT : "℃", + StrInfo.STR_POWER_LOSS :"系统断电", + StrInfo.STR_CALIBRATE_SUCCESS :"标定成功", + StrInfo.STR_ISOLATE_RES :"绝缘电阻", + StrInfo.STR_WATER_MONITOR :"水位控制排水监控系统", + StrInfo.STR_SWTICH_PROTECTOR :"ZDB-200电动机保护器", + StrInfo.STR_INDEPENDENT :"独立模式", + StrInfo.STR_DEPENDENT :"联动模式", + StrInfo.STR_OUT_POSITION : "未到位", + StrInfo.STR_IN_POSITION : "进到位", + StrInfo.STR_QUIT_IN_POSITION : "退到位", + StrInfo.STR_RUN_DATA : "运行数据", + StrInfo.STR_WATER_MODE : "水位", + StrInfo.STR_INV_MODE : "可逆", + StrInfo.STR_ISOLATE_RESISTOR_LOW : "绝缘电阻降低", + StrInfo.STR_SWITCH : "开关", + StrInfo.STR_DIDAO : "地刀", + StrInfo.STR_REMOTE : "程控", + StrInfo.STR_LOCAL : "就地", + StrInfo.STR_ONE_KEY_LOCK : "闭锁中", + StrInfo.STR_COMM_FAIL : "通讯失败", + }}, + + {"alias_company": {0: "浙江志展智能科技", + 1: "华荣科技", + } + }, + {"alias_sensor" : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "1500 A", 25: "2000 A", 26: "2500 A" ,27: "5 A"}}, + + {"alias_measure_v": {0: "正电压", 1: "负电压"}}, + {"alias_overvoltage": {0: "警告不跳闸", 1: "报警跳闸"}}, + {"alias_leakage": {0: "电流型", 1: "电压型", 2: "功率型", 3: "方向型"}}, + {"alias_select": {0: "工频负载", 1:"变频负载"}}, + {"alias_powerselect":{0:"Uab", 1:"Uba", 2:"Ubc", 3:"Ucb", 4:"Uca", 5:"Uac"}}, + {"alias_powercalculation":{0:"Uabc", 1:"Us"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"3300V", 1:"6000V", 2:"10000V"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_input": {0: "常开", 1: "常闭"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_test": {0: "模拟测试", 1: "继电器测试"}}, + {"alias_can_baud": {0: "1000K", 1: "800K", 2: "500K", 3: "250K", 4: "125K", 5: "100K", 6: "50K", 7: "20K", 8: "10K", 9: "AUTO"}}, + {Alias.alias_measure_v: {0: "正电压", 1: "负电压"}}, + {Alias.alias_switch_type : {0: "总开关", 1: "分开关"}}, + {"alias_work_mode": {0: "水位模式", 1: "磁力模式", 2: "正反转模式", 3: "联控模式"}}, + {"alias_us_phase": {0: "Uab_ABC", 1: "Uab_ACB", 2: "Ubc_ABC", 3: "Ubc_ACB", 4: "Uca_ABC", 5: "Uca_ACB"}}, + {Alias.alias_sensor : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "2500 A", 25: "5 A"}}, + {"alias_table": {0: "0", 1: "1", 2: "2", 3: "3"}}, + {"alias_remote": {0: "就地", 1: "程控"}}, + # {"alias_current": {0: "测量模式", 1: "平均模式"}}, + {"alias_current": {0: "三相测量", 1: "两相平均", 2: "两相测量"}}, + {Alias.alias_eth : {0: "无", 1: "一代以太网", 2: "二代以太网"}}, + {Alias.alias_lcd : {0: "一体迪文屏", 1: "分体迪文屏", 2: "大彩屏", 3 : "昆仑通态屏"}}, + {Alias.alias_fyj : {0: "无", 1: "FYJ", 2: "FYJ2", 3 : "FYJ4"}}, + {Alias.alias_dev : {0: "馈电", 1: "高爆", 2: "移变", 3 : "双风机", 4 : "磁力", + 5 : "双磁力", 6 : "照明", 7 : "移变高压侧", 8: "双高爆", + 9: "组合馈电", 10: "双照明", 11 : "ZZ630"}}, + {"alias_alarm_type": {0: "试验", 1: "动作"}}, + {"alias_car_position": {0: "小车未到位", 1 : "小车试验位", 2: "小车工作位", 3 : "位置信号异常"}}, +] + +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + + +def get_alias_value_str(alias_str, alias_value) : + alias_value_msg = None + compare_value = int(alias_value) + + for alias_dict in alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + if alias_name == alias_str : + for each_value_dict in value_dict.items(): + if isinstance(each_value_dict[0], Enum) : + key_value = each_value_dict[0].value[0] + else : + key_value = each_value_dict[0] + key_string = each_value_dict[1] + + if int(key_value) == compare_value : + alias_value_msg = key_string + return alias_value_msg + return alias_value_msg + +def func_adjust_current_menu_item(device : class_modbus_comm_device, menu_item) : + #获得互感器类型, 根据互感器类型来调整 scale, format, 让电流可以正确显示与设置 + sensor_type = device.comm_get_value_from_mqtt_name("Sensor") + sensor_current = 400 + + if sensor_type != None : + value_str = get_alias_value_str("alias_sensor", sensor_type) + if value_str != None : + value_str_no_unit = value_str.replace("A", "") + sensor_current = int(value_str_no_unit) + + #80A 以下电流互感器, 显示一位小数点 + if sensor_current <= 80 : + new_item = menu_item + new_item["scale"] = 0.1 + new_item["format"] = "%1.1f" + return new_item + else : + return menu_item + +def func_caculate_Cosf(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + format_str = utils.dict_or_object_get_attr(menu_item, "format", "%1.0f") + try : + cosa = device.comm_get_value_from_mqtt_name("Cosa") + cosb = device.comm_get_value_from_mqtt_name("Cosb") + cosc = device.comm_get_value_from_mqtt_name("Cosc") + cosf = (cosa + cosb + cosc) / 3 + except Exception as e : + cosf = 0.0 + Cosf_str = format_str%(cosf) + mqtt_dict["Cosf"] = Cosf_str + +#视频触发 +def func_video_trigger(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + value = device.comm_get_value_from_menu_item(menu_item) + if value == None : + #通讯未建立 + return + + value = round(value) + in_position = (value >> 10) & 0x1 + out_position = (value >> 9) & 0x1 + now_time = time.time() + if hasattr(device, "MqttVideoActive") == False: + #动态添加视频触发所需的变量 + device.MqttVideoActive = False + device.MqttVideoBaseTime = now_time + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + if in_position != device.DI_SwitchInPosition or out_position != device.DI_SwitchQuitPosition: + #开关进到位与 开关退到位信号, 当这两个状态发生变化时, 触发20秒的视频 + device.MqttVideoActive = True + device.MqttVideoBaseTime = now_time + mqtt_dict["VideoActive"] = "1" + if device.MqttVideoActive : + #视频延时20后主动关闭视频显示 + if now_time - device.MqttVideoBaseTime > 20.0 : + mqtt_dict["VideoActive"] = "0" + device.MqttVideoActive = False + + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + +COLOR_RED = "#EE2D2D" +COLOR_GREEN = "#83BF6E" + +def func_process_car_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + car_pos_value = device.comm_get_value_from_menu_item(menu_item) + if car_pos_value == None or mqtt_dict == None: + return + car_msg = get_alias_value_str("alias_car_position", car_pos_value) + if car_msg != None : + mqtt_dict["CarPositionMsg"] = car_msg + +def func_process_alarm_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + alarm_id = device.comm_get_value_from_menu_item(menu_item) + if alarm_id == None or mqtt_dict == None: + #通讯未建立 + return + alarm_msg = get_alias_value_str("alias_alarm", alarm_id) + if alarm_msg != None : + alarm_msg_dict = {} + if alarm_id > 0 : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_RED + else : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_GREEN + + mqtt_dict["AlarmMessage"] = alarm_msg_dict + +mqtt_video_trigger = [ + { + "name": "视频触发", + "addr": "8015", + "call" : func_video_trigger, + }, +] + +mqtt_time_update = [ + { + "name": "Year", + "addr": "2300", + "format" : "%04.0f", + "mqtt" : "Year", + }, + { + "name": "Month", + "addr": "2301", + "format" : "%02.0f", + "mqtt" : "Month", + }, + { + "name": "Day", + "addr": "2302", + "format" : "%02.0f", + "mqtt" : "Day", + }, + { + "name": "Hour", + "addr": "2303", + "format" : "%02.0f", + "mqtt" : "Hour", + }, + { + "name": "Minute", + "addr": "2304", + "format" : "%02.0f", + "mqtt" : "Minute", + }, + { + "name": "Second", + "addr": "2305", + "format" : "%02.0f", + "mqtt" : "Second", + }, + { + "name": "SetupTime", + "addr": "2305", + "mqtt" : "SetupTime", + "action" : "SetupTime", + }, +] + +mqtt_pack_param = [ + #系统设置 + { + "name": "电源选择", + "addr": "8441", + "alias" : "alias_powerselect", + "mqtt" : "PowerSelect", + }, + { + "name": "功率计算", + "addr": "8488", + "alias" : "alias_powercalculation", + "mqtt" : "PowerCalculation", + }, + { + "name": "瓦斯触点", + "addr": "8190", + "alias" : "alias_input", + "mqtt" : "Gas", + }, + { + "name": "瓦斯延时", + "addr": "8191", + "scale" : 0.01, + "format": "%06.2f", + "mqtt" : "GasDelay", + }, + { + "name": "瓦斯浓度", + "addr": "8237", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "GasConcentration", + }, + { + "name": "风电触点", + "addr": "8248", + "alias" : "alias_input", + "mqtt" : "Fan", + }, + { + "name": "风电延时", + "addr": "8234", + "scale" : 0.01, + "format": "%06.2f", + "mqtt" : "FanDelay", + }, + { + "name": "远近控模式", + "addr": "8558", + "alias" : "alias_remote", + "mqtt" : "FarAndNearMode", + }, + { + "name": "维修模式", + "addr": "8565", + "alias" : "alias_bool", + "mqtt" : "MaintenanceMode", + }, + { + "name": "小车报警延时", + "addr": "8576", + "scale" : 0.1, + "format": "%05.1f", + "mqtt" : "CarAlarmDelay", + }, + + { + "name": "断电延时", + "addr": "8249", + "format": "%06.1f", + "scale" : 0.1, + "mqtt" : "OffVoltageDelay", + }, + + #电流参数 + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "scale" : 1.0, + "format": "%04.0f", + "action": "rate_current", + "mqtt" : "RateCurrent", + "adjust" : func_adjust_current_menu_item, + }, + + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + "mqtt" : "ShortLevel", + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + "mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" :"alias_sensor", + "addr": "8207", + "mqtt" : "Sensor", + }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + "mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + "mqtt" : "UnbalanceDelay", + }, + { + "name": "定时限过流", + "unit": "Ie", + "addr": "8239", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeOvercurrent", + }, + { + "name": "定时限过流延时", + "unit": "ms", + "addr": "8240", + "scale" : 1, + "format": "%05.0f", + "mqtt" : "TimeOvercurrentDelay", + }, + { + "name": "定时限短路", + "unit": "Ie", + "addr": "8523", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeLimitcurrent", + }, + { + "name": "定时限短路延时", + "unit": "ms", + "addr": "8524", + "scale" : 1, + "format": "%03.0f", + "mqtt" : "TimeLimitcurrentDelay", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIc", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + "mqtt" : "CurrentB" + }, + + #电压参数 + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "mqtt" : "RateVoltage", + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + "mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + "mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayHighVoltage", + }, + { + "name": "失压延时", + "unit": "s", + "addr": "8577", + "scale" : 0.1, + "format": "%04.1f", + "min" : 0.0, + "max" : 10.0, + "mqtt" : "DelayUnderVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUs", + }, + + + #漏电参数 + { + "name": "零序电流", + "addr": "2007", + "unit": "A", + "scale" : 0.01, + "format" : "%05.2f", + "mqtt" : "GB.Io", + "action" : "Visible_GB", #高爆模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 0.1, + "format" : "%05.0f", + "mqtt" : "GB.Uo", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "mqtt" : "LeakageDelay", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "SeriesResistor" + }, + { + "name": "漏电方式", + "alias": "alias_leakage", + "addr": "8458", + "mqtt" : "LeakageSelect" + }, + { + "name": "绝缘监视延时", + "addr": "8443", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "mqtt" : "DelayInsulationMonitor" + }, + { + "name": "零序过压延时", + "addr": "8561", + "unit": "S", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "DelayZeroOverVoltage" + }, + { + "name": "零序过压选型", + "alias": "alias_overvoltage", + "addr": "8562", + "mqtt" : "SelectZeroOverVoltage" + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + "mqtt" : "CorrectUo" + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + "mqtt" : "CorrectIo" + }, + + + #保护参数投入 + { + "name": "短路保护", + "alias": "alias_bool", + "addr": "8192.1", + "mqtt" : "ProtectShort", + }, + { + "name": "过载保护", + "alias": "alias_bool", + "addr": "8192.3", + "mqtt" : "ProtectOverLoad", + }, + { + "name": "电流断相保护", + "alias": "alias_bool", + "addr": "8192.4", + "mqtt" : "ProtectCurrentPhaseOff", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + "mqtt" : "ProtectImbalance", + }, + { + "name": "定时限过载保护", + "alias": "alias_bool", + "addr": "8192.11", + "mqtt" : "ProtectTimeLimitOverload" + }, + { + "name": "定时限短路保护", + "alias": "alias_bool", + "addr": "8192.12", + "mqtt" : "ProtectTimeLimitShortCircuit", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + "mqtt" : "ProtectUnderVoltage", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + "mqtt" : "ProtectOverVoltage", + }, + { + "name": "失压保护", + "alias": "alias_bool", + "addr": "8402.9", + "mqtt" : "ProtectLossVoltage", + }, + { + "name": "电压断相保护", + "alias": "alias_bool", + "addr": "8174.2", + "mqtt" : "ProtectVoltagePhaseOff", + }, + { + "name": "漏电动作保护", + "alias": "alias_bool", + "addr": "8405.2", + "mqtt" : "ProtectLeakageAction", + }, + { + "name": "零序过压保护", + "alias": "alias_bool", + "addr": "8405.4", + "mqtt" : "ProtectZeroOverVoltage", + }, + { + "name": "绝缘监视保护", + "alias": "alias_bool", + "addr": "8405.1", + "mqtt" : "ProtectMonitor" + }, + { + "name": "温度报警保护", + "alias": "alias_bool", + "addr": "8174.8", + "mqtt" : "ProtectTemperatureAlarm", + }, + + #通讯设置 + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + "mqtt" : "485Address", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + "mqtt" : "485Baud", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + "mqtt" : "485Parity", + }, + { + "name": "CAN地址", + "format": "%03.0f", + "addr": "8440", + "mqtt" : "CANAddress", + }, + { + "name": "CAN波特率", + "alias": "alias_can_baud", + "addr": "8439", + "mqtt" : "CANBaud", + }, +] + +mqtt_pack_measure = [ + { + "name": "SwitchStatus", + "addr": "8162.0", + "alias": Alias.alias_onoff, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_STATUS, + "measure" : True, + "mqtt" : "SwitchStatus", + }, + { + "name": "AlarmId", + "addr": "8166", + "alias": Alias.alias_alarm, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_ALARM, + "measure" : True, + "mqtt" : "AlarmId", + }, + { + "name": "AlarmMessage", + "addr": "8166", + "alias": Alias.alias_alarm, + "call" : func_process_alarm_message, + }, + { + "name": "CarPositionMsg", + "addr": "8015.10#2", + "alias": Alias.alias_car_position, + "call" : func_process_car_message, + }, + { + "name": "Ia", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Ia", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "unit": "A", + "addr": "8157", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IB, + "measure" : True, + "mqtt" : "Ib", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "unit": "A", + "addr": "8158", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IC, + "measure" : True, + "mqtt" : "Ic", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Voltage", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Voltage", + }, + { + "name": "Current", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Current", + }, + { + "name": "Power", + "unit": "kw", + "addr": "8167", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Power", + }, + { + "name": "Electricity", + "unit": "kwh", + "addr": "8160#2", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Electricity", + }, + { + "name": "Uab", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Uab", + }, + { + "name": "Ubc", + "unit": "V", + "addr": "8154", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UBC, + "measure" : True, + "mqtt" : "Ubc", + }, + { + "name": "Uca", + "unit": "V", + "addr": "8155", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UCA, + "measure" : True, + "mqtt" : "Uca", + }, + { + "name": "Uo", + "unit": "V", + "addr": "8152", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UO, + "measure" : True, + "mqtt" : "Uo", + }, + { + "name": "Io", + "unit": "mA", + "addr": "8151", + "format": "%05.1f", + "scale" : 1.0, + "remap_addr" : remap.COMM_REMAP_MEASURE_FLOAT_IO, + "measure" : True, + "mqtt" : "Io", + }, + { + "name": "R", + "unit": "K", + "addr": "8150", + "scale": 0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_RO, + "measure" : True, + "mqtt" : "R", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%06.0f", + "property": MENU_PROPERTY_READ_ONLY, + "mqtt" : "OnCount", + }, + { + "name": "Cosa", + "addr": "8172#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "mqtt" : "Cosa", + }, + { + "name": "Cosb", + "addr": "8171#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "mqtt" : "Cosb", + }, + { + "name": "Cosc", + "addr": "8170#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "mqtt" : "Cosc", + }, + { + "name": "Cosf", + "addr": "8171#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "call" : func_caculate_Cosf, + }, + { + "name": "AngleUoIo", + "addr": "8149", + "format": "%04.2f", + "measure" : True, + "mqtt" : "AngleUoIo", + }, + { + "name": "A相上", + "addr": "8056", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Aup", + }, + + { + "name": "B相上", + "addr": "8057", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Bup", + }, + { + "name": "C相上", + "addr": "8058", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Cup", + }, + { + "name": "A相下", + "addr": "8059", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Adown", + }, + { + "name": "B相下", + "addr": "8060", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Bdown", + }, + { + "name": "C相下", + "addr": "8061", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Cdown", + }, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmCode", + "addr": "8121", + "alias": "alias_alarm", + "mqtt" : "AlarmCode", + }, + { + "name": "AlarmTest", + "addr": "8138", + "alias": "alias_alarm_type", + "format" : "%1.0f", + "mqtt" : "AlarmTest", + }, + { + "name": "Ua", + "addr": "8122", + "format" : "%1.0f", + "mqtt" : "AlarmUa", + }, + { + "name": "Ub", + "addr": "8123", + "format" : "%1.0f", + "mqtt" : "AlarmUb", + }, + { + "name": "Uc", + "addr": "8124", + "format" : "%1.0f", + "mqtt" : "AlarmUc", + }, + { + "name": "Ia", + "addr": "8125", + "format" : "%1.0f", + "mqtt": "AlarmIa", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "addr": "8126", + "format" : "%1.0f", + "mqtt": "AlarmIb", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "addr": "8127", + "format" : "%1.0f", + "mqtt": "AlarmIc", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ro", + "addr": "8128", + "format" : "%5.1f", + "scale" : 0.1, + "mqtt": "AlarmRo", + }, + { + "name": "Io", + "addr": "8129", + "format" : "%1.1f", + "scale" : 0.1, + "mqtt": "AlarmIo", + }, + { + "name": "Uo", + "addr": "8130", + "format" : "%5.0f", + "scale" : 1.0, + "mqtt": "AlarmUo", + }, + { + "name": "Year", + "addr": "8131", + "format" : "%4.0f", + "mqtt": "AlarmYear", + }, + { + "name": "Month", + "addr": "8132", + "format" : "%2.0f", + "mqtt": "AlarmMonth", + }, + { + "name": "Day", + "addr": "8133", + "format" : "%2.0f", + "mqtt": "AlarmDay", + }, + { + "name": "Hour", + "addr": "8134", + "format" : "%2.0f", + "mqtt": "AlarmHour", + }, + { + "name": "Minute", + "addr": "8135", + "format" : "%2.0f", + "mqtt": "AlarmMinute", + }, + { + "name": "Second", + "addr": "8136", + "format" : "%2.0f", + "mqtt": "AlarmSecond", + }, +] + +menu_data = [ + { + "name": "数据页面", + "sub_menu": "menu_curve_physical", + }, +] + +#曲线菜单 +menu_curve_physical = [ + { + "name": "物理曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#曲线菜单 +menu_curve_adc = [ + { + "name": "ADC曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#谐波菜单 +menu_curve_harmonic = [ + { + "name": "谐波曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +# modbus_comm_table = [ +# {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, +# {"name":"measure", "reg_addr":8000, "reg_count":62, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, +# {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, +# {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, +# #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, +# # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, +# {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000}, +# {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, +# {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, +# {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, +# {"name":"param/info", "reg_addr":8435, "reg_count":10, "cycle": 3000}, +# {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, +# #{"name":"global_status", "reg_addr":3200, "reg_count":6, "cycle": 400}, +# ] +modbus_comm_table = [ + {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, + {"name":"measure", "reg_addr":8000, "reg_count":62, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, + #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, + # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000}, + {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, + {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, + {"name":"param/info", "reg_addr":8485, "reg_count":15, "cycle": 3000}, + {"name":"param/info", "reg_addr":8520, "reg_count":20, "cycle": 3000}, + {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, + {"name":"param/info", "reg_addr":8435, "reg_count":25, "cycle": 3000}, + {"name":"param/info", "reg_addr":8400, "reg_count":30, "cycle": 3000}, + {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, + #{"name":"global_status", "reg_addr":3200, "reg_count":6, "cycle": 400}, +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + if not hasattr(comm_table_item, "name"): + return False + return False + +menu_current = [ #菜单表[menu_current],存储菜单项属性字典<> + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "action": "rate_current", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + #"mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" : Alias.alias_sensor, + "addr": "8207", + }, + # { + # "name": "反时限表", + # "alias" :"alias_table", + # "addr": "8178", + # }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + #"mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + #"mqtt" : "UnbalanceDelay", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIc", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_voltage = [ + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "default": 0, + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + #"mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + #"mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUs", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm_display = [ + { + "name": "当前故障", + "action" : "Idle", + }, +] + +menu_alarm_curve = [ + { + "name": "录波曲线", + "action" : "Idle", + }, +] + +menu_alarm_history = [ + { + "name": "故障查询", + "action" : "Idle", + }, +] + +menu_alarm = [ + { + "name": "故障查询", + "sub_menu": "menu_alarm_history", + }, + { + "name": "故障清除", + "action": "alarm_clear", + }, + { + "name": "合闸清零", + "action": "clear_oncount", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + #"mqtt" : "OnCount", + }, + { + "name": "电量清除", + "action": "clear_kwh", + }, + { + "name": "累计时间清除", + "action": "clear_time", + }, + { + "name": "累计合闸时间", + "addr": "8016#2", + "unit": "Min", + "scale": 0.0166666666666667, + "format": "%07.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_test = [ + { + "name": "短路试验", + "action": "test", + "addr" : "100628", + "mqtt" : "TestShort", + }, + { + "name": "漏电试验", + "action": "test", + "addr" : "100629", + "mqtt" : "TestIsolation", + }, + { + "name": "过压试验", + "action": "test", + "addr" : "100641", + "mqtt" : "TestOverVoltage", + }, + { + "name": "电流断相试验", + "action": "test", + "addr" : "100642", + "mqtt" : "TestBreak", + }, + + { + "name": "复归", + "action": "test", + "addr" : "100649", + "mqtt" : "TestRecover", + }, + + { + "name": "漏电试验配置", + "alias" : "alias_test", + "addr": "8265", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_protect_set = [ + { + "name": "短路保护", + "alias": Alias.alias_bool, + "addr": "8192.1", + #"mqtt" : "ProtectShort", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + #"mqtt" : "ProtectUnbalance", + }, + { + "name": "反时限过流", + "alias": "alias_bool", + "addr": "8192.3", + #"mqtt" : "ProtectOverCurrent", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + #"mqtt" : "ProtectHighVotage", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + #"mqtt" : "ProtectLowVotage", + }, + # { + # "name": "电压断相", + # "alias": "alias_bool", + # "addr": "8174.2", + # }, + # { + # "name": "相序保护", + # "alias": "alias_bool", + # "addr": "8174.3", + # }, + { + "name": "漏电闭锁", + "alias": "alias_bool", + "addr": "8192.10", + #"mqtt" : "ProtectIsolationLock", + }, + { + "name": "漏电动作", + "alias": "alias_bool", + "addr": "8174.6", + #"mqtt" : "ProtectIsolationAction", + }, + # { + # "name": "选漏保护", + # "alias": "alias_bool", + # "addr": "8174.7", + # }, + { + "name": "风电闭锁", + "alias": "alias_bool", + "addr": "8175.0", + #"mqtt" : "ProtectWindMotor", + }, + { + "name": "瓦斯闭锁", + "alias": "alias_bool", + "addr": "8174.13", + #"mqtt" : "ProtectGasLock", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_comm_set = [ + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + }, + # { + # "name": "CAN地址", + # }, + # { + # "name": "CAN波特率", + # "alias": "alias_can_baud", + # }, + { + "name": "IP设置", + "addr": "8271#2", + "action": "ip", + }, + { + "name": "IP网关", + "addr": "8273#2", + "action": "ip", + }, + { + "name": "IP掩码", + "addr": "8275#2", + "action": "ip", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "工作模式", + "addr": "8231", + "alias": "alias_work_mode", + "property": MENU_PROPERTY_ENGINEER, + "action" : "Visible_CL", #磁力模式显示菜单 + }, + { + "name": "开关类型", + "alias": "alias_switch_type", + "addr": "8210", + "action" : "Visible_KD", #馈电模式显示菜单 + }, + { + "name": "控制模式", + "alias": "alias_remote", + "addr": "8262", + }, + { + "name": "瓦斯触点", + "alias": "alias_input", + "addr": "8190", + }, + { + "name": "瓦斯延时", + "unit": "S", + "addr": "8191", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "风电触点", + "alias": "alias_input", + "addr": "8248", + }, + { + "name": "风电延时", + "unit": "S", + "addr": "8234", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "高水位延时", + "addr": "8267", + "unit": "S", + "scale": 0.1, + "format": "%04.1f", + "action" : "Visible_CL_WATER", #水位磁力模式显示 + }, + { + "name": "正反转延时", + "addr": "8266", + "unit": "ms", + "scale": 1.0, + "format": "%04.0f", + "action" : "Visible_CL_INV", #正反转磁力模式显示 + }, + { + "name": "维修模式", + "addr": "8260", + "alias": "alias_bool", + }, + # { + # "name": "温度设定", + # "unit": "℃", + # "addr": "2030", + # "format": "%+03.0f", + # }, + { + "name": "系统日期", + "addr": "2300#3", + "action": "date", + }, + { + "name": "当前时间", + "addr": "2303#3", + "action": "time", + }, + { + "name": "软件版本", + "addr": "8180", + "unit" : VERSION_DATE, + "scale": 0.01, + "format": "%.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统密码", + "addr": "8181", + "format": "%04.0f", + "action": "password", + }, + { + "name": "Us相位", + "alias": "alias_us_phase", + "addr": "8269", + }, + { + "name": "重启", + "action": "restart", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_switch_cmd = [ + { + "name": "通讯合闸", + "action": "write_bit", + "addr" : "100618", + "mqtt" : "SwitchOn", + }, + { + "name": "通讯分闸", + "action": "write_bit", + "addr" : "100619", + "mqtt" : "SwitchOff", + }, + { + "name": "通讯复位", + "action": "write_bit", + "addr" : "100620", + "mqtt" : "SwitchRst", + }, + { + "name": "小车进控制", + "addr" : "100636", + "mqtt" : "CarForward", + }, + { + "name": "小车退控制", + "addr" : "100637", + "mqtt" : "CarRetreat", + }, + +] + +memu_setting = [ + { + "name": "电流设置", + "sub_menu": Menu.menu_current, + }, + { + "name": "电压设置", + "sub_menu": "menu_voltage" + }, + { + "name": "漏电设置", + "sub_menu": "menu_leak" + }, + { + "name": "系统设置", + "sub_menu": "menu_system" + }, + { + "name": "保护设置", + "sub_menu": "menu_protect_set" + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set" + }, + { + "name": "保护试验", + "sub_menu": Menu.menu_test #"menu_test" + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm" + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_leak = [ + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + #"mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + #"mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "A", + "scale" : 0.01, + "format" : "%05.2f", + # "mqtt" : "GB.Io", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%05.2f", + # "mqtt" : "GB.Uo", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0 + }, + { + "name": "检测电压", + "addr": "8253", + "alias": Alias.alias_measure_v, + }, + { + "name": "退出", + "action": "exit", + }, +] + +calibrate = [ + { + "name": "999校正", + "action": "calibrate999", + "mqtt" : "Calibrate999", + }, + { + "name": "0欧校正", + "action": "calibrate0", + "mqtt" : "Calibrate0", + }, + { + "name": "以太网模块", + "alias": Alias.alias_eth, + "addr" : "8280", + }, + { + "name": "LCD模块", + "alias": Alias.alias_lcd, + "addr" : "8281", + }, + { + "name": "防越级模块", + "alias": Alias.alias_fyj, + "addr" : "8282", + }, + { + "name": "设备型号", + "alias": Alias.alias_dev, + "addr" : "8270", + }, + { + "name": "退出", + "action": "exit", + }, +] + +startup = [ + { + "name": "退出", + }, +] + +menu_main = [ + { + "name": "设置", + "sub_menu": "memu_setting", + }, + { + "name": "数据", + "sub_menu": "menu_data", + }, + { + "name": "报警", + "sub_menu": "menu_alarm_display", + }, + { + "name": "标定", + "sub_menu": "calibrate", + "property": MENU_PROPERTY_ENGINEER, + }, +] + +mqtt_topic_subscribe = None + +MENU_STARTUP_PAGE = 150 +MENU_DISPLAY_PAGE = 2 +MENU_ALARM_PAGE = 3 +MENU_DATA_PAGE = 120 +MENU_CL_MAIN_PAGE = 90 +MENU_KD_MAIN_PAGE = 20 +MENU_KD_MAIN_PAGE_LANGUAGE = 21 +MENU_CURVE_PAGE = 10 +MENU_ADC_CURVE_PAGE = 18 +MENU_HARNOMIC_CURVE_PAGE = 19 + +menu_caption = [ + {"name" : "startup", "menu" : startup, "caption": "启动页面", "page" : MENU_STARTUP_PAGE, "max_items" : 1}, + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : MENU_KD_MAIN_PAGE, "max_items" : 4}, + {"name" : "menu_leak", "menu" : menu_leak, "caption": "漏电设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "memu_setting", "menu" : memu_setting, "caption": "参数设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_current", "menu" : menu_current, "caption": "电流设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_voltage", "menu" : menu_voltage, "caption": "电压设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "故障查询", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm_display", "menu" : menu_alarm_display, "caption": "当前故障", "page" : MENU_ALARM_PAGE, "prev": menu_alarm_curve, "next": menu_alarm_curve, "max_items" : 1}, + {"name" : "menu_alarm_curve", "menu" : menu_alarm_curve, "caption": "曲线故障", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_alarm_display, "next": menu_alarm_display, "max_items" : 1}, + + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "故障查询", "page" : MENU_ALARM_PAGE, "max_items" : 1}, + {"name" : "menu_test", "menu" : menu_test, "caption": "保护试验", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_measure", "menu" : mqtt_pack_measure, "caption": "测量数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_data", "menu" : menu_data, "caption": "数据页面", "page" : MENU_DATA_PAGE, "max_items" : 8}, + {"name" : "menu_curve_physical", "menu" : menu_curve_physical, "caption": "物理曲线", "page" : MENU_CURVE_PAGE, "prev": menu_curve_harmonic, "next": menu_curve_adc, "max_items" : 8}, + {"name" : "menu_curve_adc", "menu" : menu_curve_adc, "caption": "ADC曲线", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_curve_physical, "next": menu_curve_harmonic, "max_items" : 8}, + {"name" : "menu_curve_harmonic", "menu" : menu_curve_harmonic, "caption": "谐波曲线", "page" : MENU_HARNOMIC_CURVE_PAGE, "prev": menu_curve_adc, "next": menu_curve_physical, "max_items" : 8}, + {"name" : "calibrate", "menu" : calibrate, "caption": "标定页面", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_switch_cmd", "menu" : menu_switch_cmd, "caption": "通讯操作", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_param", "menu" : mqtt_pack_param, "caption": "参数刷新", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_video_trigger", "menu" : mqtt_video_trigger, "caption": "视频触发", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + + {"name" : "mqtt_time_update", "menu" : mqtt_time_update, "caption": "时钟设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, +] + + +# mqtt 故障查询函数 +def func_alarm_query(device : class_modbus_comm_device, alarm_index = 0) : + result = device.protocol.modbus_write_regs(device.comm_addr, 8120, 1, alarm_index) + time.sleep(0.05) + alarm_regs = device.protocol.modbus_read_regs(device.comm_addr, 8121, 20) + if alarm_regs != None : + device.modbus_regs_flush(8121, 20, alarm_regs) + + msg_alarm_dict = device.comm_item_trigger_mqtt_pack(mqtt_pack_alarm) + + err_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmCode", 0) + err_code = int(err_code) + test_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmTest", 0) + test_code = int(test_code) + + + test_value_str = get_alias_value_str("alias_alarm_type", test_code) + if test_value_str == None: + test_value_str = " " + err_code_str = get_alias_value_str("alias_alarm", err_code) + if err_code_str == None: + err_code_str = " " + msg_alarm_dict["AlarmCodeMsg"] = err_code_str + msg_alarm_dict["AlarmTestMsg"] = test_value_str + msg_alarm_dict["index"] = alarm_index + msg : str = json.dumps(msg_alarm_dict, ensure_ascii=False) + + if device.mqtt_thread : + device.mqtt_thread.publish("response/alarm/" + device.unique_name, msg) + +# mqtt action处理函数 +def func_action_process(device : class_modbus_comm_device, menu_item = None, value_str : str = None) : + action_str = utils.dict_or_object_get_attr(menu_item, "action", " ") + mqtt_name = utils.dict_or_object_get_attr(menu_item, "mqtt", " ") + result = None + + if action_str == "SetupTime" : #设置保护器时间 + numbers = re.findall(r'\d+', value_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + device.protocol.modbus_write_regs(device.comm_addr, 2300, 6, (year, month, day, hour, minute, second)) + pass + if action_str == "calibrate999" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2007) + if action_str == "calibrate0" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2006) + if action_str == "write_bit" or action_str == "test": + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", " ") + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if reg_count == 1: + command_value = [1] + result = device.write_bit_register(reg_addr, command_value) + + if device.mqtt_thread and result != None: + device.mqtt_thread.publish("response/action/" + device.unique_name, '{"name" : "%s", "result" : %d}'%(mqtt_name, result)) + + +class class_menu_comm_device_config(class_comm_device_config): + def __init__(self): + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_top + def get_menu_top(self) : + return menu_main + + def get_menu_caption_info(self) : + return menu_caption + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + def is_gb2312(self) : + return False + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_menu_comm_device_config() diff --git a/menu_key.py b/menu_key.py new file mode 100644 index 0000000..8c50818 --- /dev/null +++ b/menu_key.py @@ -0,0 +1,95 @@ +import sys +import threading +from threading import Thread +import keyboard +import time +import menu_key_def as KEYDEF + +class class_menu_key_thread(Thread): + def __init__(self, parent = None) : + Thread.__init__(self) + self.key_left = False + self.key_right = False + self.key_up = False + self.key_down = False + self.key_enter = False + self.key_reset = False + self.stop_request = False + + self.key_left_count = 0 + self.key_right_count = 0 + self.key_up_count = 0 + self.key_down_count = 0 + self.key_enter_count = 0 + self.key_reset_count = 0 + self.key_event = threading.Event() + + def menu_wait_key(self, timeout) : + self.key_event.wait(timeout) + self.key_event.clear() + + if self.key_enter : + self.key_enter = False + return KEYDEF.MENU_PACK_KEY_ENTER_OR_RIGHT + if self.key_reset : + self.key_reset = False + return KEYDEF.MENU_PACK_KEY_ESCAPE + if self.key_up : + self.key_up = False + return KEYDEF.MENU_PACK_KEY_UP + if self.key_down : + self.key_down = False + return KEYDEF.MENU_PACK_KEY_DOWN + if self.key_left : + self.key_left = False + return KEYDEF.MENU_PACK_KEY_LEFT + if self.key_right : + self.key_right = False + return KEYDEF.MENU_PACK_KEY_RIGHT + + return KEYDEF.MENU_PACK_KEY_NULL + + def thread_stop(self) : + self.stop_request = True + return + + def key_up_press(self) : + self.key_up_count += 1 + self.key_up = True + self.key_event.set() + + def key_down_press(self) : + self.key_down_count += 1 + self.key_down = True + self.key_event.set() + + def key_enter_press(self) : + self.key_enter_count += 1 + self.key_enter = True + self.key_event.set() + + def key_reset_press(self) : + self.key_reset_count += 1 + self.key_reset = True + self.key_event.set() + + def key_right_press(self) : + self.key_right_count += 1 + self.key_right = True + self.key_event.set() + + def key_left_press(self) : + self.key_left_count += 1 + self.key_left = True + self.key_event.set() + + def run(self) : + keyboard.add_hotkey('ctrl + right', self.key_left_press, args=(), suppress=False) + keyboard.add_hotkey('ctrl + left', self.key_right_press, args=(), suppress=False) + keyboard.add_hotkey('ctrl + up', self.key_up_press, args=(), suppress=False) + keyboard.add_hotkey('ctrl + down', self.key_down_press, args=(), suppress=False) + keyboard.add_hotkey('ctrl + enter', self.key_enter_press, args=(), suppress=False) + keyboard.add_hotkey('ctrl + q', self.key_reset_press, args=(), suppress=False) + + while self.stop_request == False: + time.sleep(0.5) diff --git a/menu_key2.py b/menu_key2.py new file mode 100644 index 0000000..9c74cf1 --- /dev/null +++ b/menu_key2.py @@ -0,0 +1,54 @@ +import threading +import time +import gpiod +import menu_key_def as KEYDEF + +class class_menu_key_thread(threading.Thread): + def __init__(self, parent=None): + super().__init__() + self.stop_request = False + self.chip = None + pass + + def run(self): + if self.chip is None: + print("GPIO chip not initialized, skipping thread execution") + return + + while not self.stop_request: + time.sleep(0.02) # Adjust sleep time if necessary + + # Process button presses + for index, line in enumerate(self.lines): + if line.get_value(): + self.handle_key_press(index) + + def handle_key_press(self, index): + # Handle button press based on index + pass + + def key_up_press(self): + # Handle key press for UP button + pass + + def key_down_press(self): + # Handle key press for DOWN button + pass + + def key_enter_press(self): + # Handle key press for ENTER button + pass + + def key_reset_press(self): + # Handle key press for RESET button + pass + + def stop(self): + # Stop the thread + self.stop_request = True + self.join() + + def menu_wait_key(self, timeout): + # Placeholder for waiting for a key press with timeout + pass + diff --git a/menu_key_def.py b/menu_key_def.py new file mode 100644 index 0000000..c287259 --- /dev/null +++ b/menu_key_def.py @@ -0,0 +1,33 @@ + +MENU_PACK_KEY_NULL = 0 +MENU_PACK_KEY_BACKSPACE =8 +MENU_PACK_KEY_TAB =9 +MENU_PACK_KEY_BACKTAB =10 +MENU_PACK_KEY_ENTER =13 +MENU_PACK_KEY_LEFT =16 +MENU_PACK_KEY_UP =17 +MENU_PACK_KEY_RIGHT =18 +MENU_PACK_KEY_DOWN =19 +MENU_PACK_KEY_HOME =23 +MENU_PACK_KEY_END =24 +MENU_PACK_KEY_SHIFT =25 +MENU_PACK_KEY_CONTROL =26 +MENU_PACK_KEY_ESCAPE =27 +MENU_PACK_KEY_INSERT =29 +MENU_PACK_KEY_DELETE =30 +MENU_PACK_KEY_SPACE =32 +MENU_PACK_KEY_PGUP =33 +MENU_PACK_KEY_PGDOWN =34 +MENU_PACK_KEY_RESET_OR_UP =35 +MENU_PACK_KEY_ENTER_OR_RIGHT =37 +MENU_PACK_KEY_DOT = '.' +MENU_PACK_KEY_0 =0x30 +MENU_PACK_KEY_1 =0x31 +MENU_PACK_KEY_2 =0x32 +MENU_PACK_KEY_3 =0x33 +MENU_PACK_KEY_4 =0x34 +MENU_PACK_KEY_5 =0x35 +MENU_PACK_KEY_6 =0x36 +MENU_PACK_KEY_7 =0x37 +MENU_PACK_KEY_8 =0x38 +MENU_PACK_KEY_9 =0x39 diff --git a/menu_light.py b/menu_light.py new file mode 100644 index 0000000..786cbe9 --- /dev/null +++ b/menu_light.py @@ -0,0 +1,2465 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_utils as uitls +from enum import Enum +from datetime import datetime +import time +import menu_utils as utils +import json +import re +from enum import Enum +from comm_modbus_device import class_modbus_comm_device + +now_time = datetime.now() +current_time = now_time.strftime("(%y/%m/%d)") +VERSION_DATE = current_time + +class StrInfo(Enum): + STR_MAX_VALUE = 0, #"最大值" + STR_MIN_VALUE = 1, #"最小值" + STR_SET_VALUE = 2, #"设定值" + STR_VALUE_EXCEED = 3, #"设定值越界" + STR_ZERO_PHASE = 4, #"有功相位" + STR_INPUT_PASSWORD = 5, #"请输入系统密码 + STR_SYSTEM_PASSWORD = 6, #"系统密码" + STR_PASSWORD_ERR = 7, #"密码错误" + STR_SHORT_PHASE_MODIFY =8, #"短路倍数\n恢复缺省" + STR_SWITCH_TYPE_MODIFY =9, #"漏电延时\n恢复缺省" + STR_SOFT_VERSION =10, #"软件版本" + STR_NO_RECORD =11, #"无记录" + STR_ENTER_TO_CLEAR =12, #"确定清除" + STR_ESC_TO_CANCEL =13, #"ESC取消" + STR_CLEAR_FINISH =14, #"清除成功" + STR_ESC_TO_EXIT =15, #"ESC退出 + STR_INPUT_NEW_PASSWORD =16, #"请设置新密码" + STR_NOT_POSSIBLE_TO_MODIFY =17, #"不可修改" + STR_CAPACITOR_MEASURE =18, #"电容检测 + STR_CAPACITOR_EQUAL =19, #"电容" + STR_LEEKAGE_MEASURE =20, #"检测中.." + STR_TEST_ACTIVE =21, #"测试状态 + STR_POWER_ON=22, #"合闸" + STR_POWER_OFF=23, #"分闸" + STR_FAIL=24, #"失效" + STR_NORMAL=25, #"正常" + STR_MEASURE_CURRENT=26, #"实测电流" + STR_RATE_CURRENT=27, #"额定电流" + STR_ANGLE=28, #"角度" + STR_AVERAGE_CURRENT=29, #"平均电流" + STR_MAX_CURRENT=30, #"最大电流 + STR_LOW_VOLTAGE_RATE=31, #"欠压值 + STR_MEASURE_VOLTAGE=32, #"实测电压" + STR_ZERO_CURRENT=33, #"零序电流" + STR_ZERO_VOLTAGE=34, #"零序电压" + STR_RECORD=35, #"记录" + STR_LEEAKGE_LOCK_VALUE=36, #"闭锁设定值" + STR_LEEAKGE_ACTIVE_VALUE=37, #"动作设定值" + STR_MEASURE_RESISTOR=38, #"电阻测量值" + STR_FRONT_CIRCUIT=39, #"前机" + STR_NEXT_CIRCUIT=40, #"后机" + STR_RATE_VOLTAGE=41, #"额定电压" + STR_PARA_MODIFY_ERROR=42, #"参数修改失败" + STR_LEEKAGE_RES_FINISH=43, #"闭锁电阻检测完" + STR_LEEKAGE_RES_MEASURE=44, #"闭锁电阻检测中" + STR_SFJ_MONITOR=45, #"双风机磁力监控" + STR_CL_MONITOR=46, #"磁力监控系统" + STR_CL_DB_MONITOR=47, #"双回路磁力监控" + STR_YB_MONITOR=48, #"移变低压侧" + STR_KUI_DIAN_MONITOR=49, #"馈电开关监控" + STR_TYPE=50, #"类型:" + STR_TOP_SWITCH=51, #"总开关" + STR_BOTTOM_SWITCH=52, #"分开关" + STR_COS_V=53, #"COS(ΦaΦbΦc)" + STR_POWER_VI=54, #"有功功率" + STR_POWER_VI_T=55, #"电量" + STR_FRONT_POWER_ON=56, #"前机合" + STR_NEXT_POWER_ON=57, #"后机合" + STR_FRONT_POWER_OFF=58, #"前机分" + STR_NEXT_POWER_OFF=59, #"后机分" + STR_FRONT_RESISTOR=60, #"前机电阻:" + STR_NEXT_RESISTOR=61, #"后机电阻:" + STR_WORK_MODE=62, #"模式:" + STR_LEEKAGE_RES=63, #"漏电电阻" + STR_REVERSE_VOLTAGE=64, #"反电动势\n注意安全" + STR_LIGHT=65, #"照明" + STR_SIGNAL=66, #"信号" + STR_SWITCH_STATUS=67, #"开关状态" + STR_POWER_ON_COUNTS=68, #"合闸次数" + STR_SETTING=69, #"设定值" + STR_POW_U=70, #"无功功率" + STR_TEST_FAIL=71, #"测试不正确" + STR_LEAKAGE_TEST_FAIL=72, #"漏电测试不正确" + STR_DETECT_FAIL_WHEN_POWER_ON=73, #"合闸时不能检测" + STR_LINK=74, #"联机系统" + STR_SINGLE=75, #"单机系统" + STR_STATUS=76, #"状态" + STR_MAIN_FIRST=77, #"主机优先" + STR_MAIN_BAK_SAME=78, #"主辅对等" + STR_MAIN_BAK_SWITCH=79, #"主辅轮动" + STR_SWITCH_DISABLE=80, #"局扇模式" + STR_MAIN=81, #"主机" + STR_BACKUP=82, #"备机" + STR_SINGLE_CIRCUIT_FRONT=83, #"单前机" + STR_SINGLE_CIRCUIT_NEXT=84, #"单后机" + STR_DOUBLE_CIRCUIT=85, #"双回路" + STR_WATER_PUMP_ON=86, #"水泵已开阀" + STR_WATER_PUMP_OFF=87, #"水泵已关阀" + STR_SWITCH_FAIL=88, #"粘连" + STR_SWITCH_THROUGH_2=89, #"击穿" + STR_GB_MONITOR=90, #"高压真空配电装置" + STR_GB_PROTECT_SYSTEM=91, #"综合保护监控系统" + STR_YBGY_MONITOR=92, #"移变高压侧" + STR_ERROR=93, #"故障" + STR_TEMPERATURE=94, #"温度" + STR_NEXT_CURRENT=95, #"后机电流" + STR_FRONT_CURRENT=96, #"前机电流" + STR_FJ_WS_LOCK=97, #"风机处瓦斯闭锁" + STR_GZM_WS_LOCK=98, #"工作面瓦斯闭锁" + STR_CURRENT=99, #"电流" + STR_VOLTAGE=100, #"电压" + STR_MONITOR_RES=101, #"监视电阻" + STR_SWITCH_THROUGH_SIMPLE=102, #"击穿" + STR_LINK_FAIL=103, #"联机失败" + STR_RES_OFF=104, #"漏电临界值" + STR_ANOTHER_REPAIR=105, #"另台维修请勿停机" + STR_WS_INTENSITY=106, #"瓦斯浓度" + STR_HIGH_VOLT=107, #"高压" + STR_AUTO=108, #"自动" + STR_MANUAL=109, #"手动" + STR_FREQUENCY=110, #"频率" + STR_FWD_ON=111, #正向启动 + STR_RVS_ON=112, #反向启动 + STR_TEMPERATURE_UNIT=113, #温度单位 + STR_POWER_LOSS=114, + STR_CALIBRATE_SUCCESS=115, #标定成功 + STR_ISOLATE_RES=116, #绝缘电阻 + STR_WATER_MONITOR=117, #水位控制排水监控系统 + STR_SWTICH_PROTECTOR=118, #ZDB-200电动机保护器 + STR_INDEPENDENT=119, #独立模式 + STR_DEPENDENT=120, #联动模式 + STR_OUT_POSITION=121, + STR_IN_POSITION=122, + STR_QUIT_IN_POSITION=123, + STR_RUN_DATA=124, + STR_WATER_MODE=125, + STR_INV_MODE=126, + STR_ISOLATE_RESISTOR_LOW=127, + STR_SWITCH=128, + STR_DIDAO=129, + STR_REMOTE=130, + STR_LOCAL=131, + STR_ONE_KEY_LOCK=132, + STR_COMM_FAIL=133, + +class Alarm(Enum): + ERR_NONE = 0, + ERR_CREEPAGE_LOCK = 1, #漏电报警 + ERR_VOLTAGE_LOW = 2, #欠压报警 + ERR_OVER_CURRENT = 3, #过流保护 + ERR_SHORT_CURRENT = 4, #短路保护 + ERR_CREEPAGE_SELECT = 5, #选漏 + ERR_UNBANLANCE_CURRENT = 6, #三相不平衡 + ERR_FLASH_FAIL = 7, #FLASH无法写入 + ERR_CREEPAGE_ACTIVE = 8, #漏电动作 + ERR_BREAK_PHASE = 9, #断相保护动作 + ERR_VOLTAGE_BREAK_PHASE = 10, #电压断相 + ERR_GAS_LOCK = 11, #瓦斯闭锁 + ERR_WIND_MOTOR_LOCK = 12, #风电闭锁 + ERR_VOLTAGE_OVER = 13, #过压报警 + ERR_SHORT_PHASE = 14, #相敏短路 + ERR_WATCH_DOG = 15, #看门狗保房 + ERR_SWITCH_FAIL = 16, #开关粘轿 + ERR_SWITCH_THROUGH = 17, #开关击? + ERR_SWITCH_ON_FAIL = 18, #开关合闸失? + ERR_COMM_FAIL = 19, #通讯故障 + ERR_CREEPAGE_SELECT2 = 20, #选择性报? + ERR_TEMP_IO_HIGH = 21, #IO口温度过驿 + ERR_SHORT_CURRENT_SIGNAL = 22, #信号电流短路 + ERR_REMOTE_OFF = 23, #远方分励 + ERR_REPAIR = 24, #维修状? + ERR_TEMP_ALARM = 25, #温度报警 + ERR_QUICK_CREEPAGE_ACT = 26, #快速漏电动仿 + ERR_GB_LEEK_SHORT = 27, #高爆绝缘短路 + ERR_GB_LEEK_BREAK = 28, #高爆绝缘断路 + ERR_YB_LOW_VOLTAGE_FAIL = 29, #移变低压侧失? + ERR_YB_LOW_VOLTAGE_UNREADY = 30, #移变低压侧未准备? + ERR_WS_FREQ_FAIL = 31, #瓦斯浓度超标 + ERR_HIGH_LOW_LOCK = 32, #高低压联钿 + ERR_MOTOR_ROTATE_LOCK = 33, #电机堵转 + ERR_FIX_TIME_OVER_CURRENT = 34, #定时限过泿 + ERR_FIX_TIME_SHORT_CURRENT = 35, #定时限短? + ERR_PHASE_ERROR = 36, #相序故障 + ERR_UNDER_LOAD = 37, #欠载保护 + ERR_PHASE_UNMATCH = 38, #互感器反? + ERR_EXTERNAL_ALARM = 39, #外部故障 + ERR_SENSOR_LOSS = 40, #水位传感器未? + ERR_ROTOR_SLOW = 41, + ERR_ROTOR_LOCK = 42, + ERR_POWER_LOSS = 43, #系统断电 + ERR_RSV1 = 44, + ERR_RSV2 = 45, + ERR_RSV3 = 46, + ERR_RSV4 = 47, + ERR_RSV5 = 48, + ERR_RSV6 = 49, + ERR_RSV7 = 50, + ERR_USER_ALARM1 = 51, #50,用户自定义故阿 + ERR_USER_ALARM2 = 52, #51,用户自定义故阿 + ERR_USER_ALARM3 = 53, #52,用户自定义故阿 + ERR_USER_ALARM4 = 54, #53,用户自定义故阿 + ERR_GB_LIGHT_THREAD_SON_LOSS = 55, + ERR_GB_LIGHT_THREAD_BROTHER_LOSS = 56, + ERR_GB_LIGHT_MODULE_LOSS = 57, + ERR_GB_FORCE_LEEK_OFF = 58, + ERR_GB_FORCE_SHORT_OFF = 59, + ERR_GB_CREEPAGE_SELECT = 60, #选择性报警 + ERR_SWITCH_OUT_POSITION = 61, + ERR_DZM_CREEPAGE_ACTIVE = 62, + ERR_OIL_PRESSURE_SENSOR_FAIL = 63, + ERR_FREQ_SENSOR_EXCEED = 64, + ERR_FREQ_SENSOR_FAIL = 65, + ERR_ANALOG_SENSOR_EXCEED = 66, + ERR_ANALOG_SENSOR_FAIL = 67, + ERR_VOLTAGE_LOSS = 68, + ERR_SPEED_LOSS = 69, + ERR_GB_ZERO_VOLT_OVER = 70, #零序过压 + ERR_PT_BREAK = 71, + ERR_CT_BREAK = 72, + ERR_ZERO_OVER_VOLTAGE = 73, + ERR_ZERO_OVER_CURRENT = 74, + ERR_GAS_WARNING = 75, + ERR_TEMP_WARNING = 76, + ERR_COMM_LOSS = 77, + ERR_CAR_FAIL = 78, + ERR_WATER_LOW = 79, + ERR_SWITCH_DIDAO_IN_POSITION = 80, + ERR_SWITCH_DIDAO_MID_POSITION = 81, + ERR_GB_CREEPAGE_SELECT_5 = 82, #5次谐波选漏 + ERR_FLUX_LOCK = 83, + ERR_GLOBAL_OIL_TEMP_LOCK = 84, + ERR_GLOBAL_WATER_PRESSURE_LOCK = 85, + ERR_GLOBAL_WATER_LEVEL_LOCK = 86, + ERR_GLOBAL_CURRENT_SENSOR_LOSS = 87, + ERR_GLOBAL_GAS_PERCENTAGE_LOCK = 88, + ERR_GLOBAL_GAS_SENSOR_LOSS = 89, + ERR_MEASURE_OVER_CURRENT = 90, #测量回路过流保护 + ERR_CREAPGE_BREAK = 91, + ERR_REMOTE_CREAPGE_TEST_FAIL = 92, + ERR_REMOTE_CREAPGE_TEST_SUCCESS = 93, + + + +class Alias(Enum): + alias_alarm = 0, + alias_str = 1, + alias_company = 2, + alias_bool = 3, + alias_voltage = 4, + alias_parity = 5, + alias_baud = 6, + alias_input = 7, + alias_onoff = 8, + alias_test = 9, + alias_can_baud = 10, + alias_measure_v = 11, + alias_switch_type = 12, + alias_work_mode = 13, + alias_us_phase = 14, + alias_sensor = 15, + alias_table = 16, + alias_remote = 17, + alias_current = 18, + alias_eth = 19, + alias_lcd = 20, + alias_dev = 21, + alias_fyj = 22, + alias_alarm_type = 23, + alias_car_position = 24, + +class Menu(Enum): + menu_current = 0, + menu_test = 1, + +alias_table = [ + {Alias.alias_alarm: {Alarm.ERR_NONE: "无故障", + Alarm.ERR_CREEPAGE_LOCK: "照明闭锁", + Alarm.ERR_VOLTAGE_LOW: "欠压", + Alarm.ERR_OVER_CURRENT : "照明过载", #过流保护 + Alarm.ERR_SHORT_CURRENT : "短路保护", #短路保护 + Alarm.ERR_CREEPAGE_SELECT : "选漏", #选漏 + Alarm.ERR_UNBANLANCE_CURRENT : "三相不平衡", #三相不平衡报? + Alarm.ERR_FLASH_FAIL : "FLASH无法写入", #FLASH无法写入 + Alarm.ERR_CREEPAGE_ACTIVE : "漏电动作", #漏电动作 + Alarm.ERR_BREAK_PHASE : "照明电流断相", #断相保护动作 + Alarm.ERR_VOLTAGE_BREAK_PHASE : "电压断相", #电压断相 + Alarm.ERR_GAS_LOCK : "瓦斯闭锁", #瓦斯闭锁 + Alarm.ERR_WIND_MOTOR_LOCK : "风电闭锁", #风电闭锁 + Alarm.ERR_VOLTAGE_OVER : "过压", #过压报警 + Alarm.ERR_SHORT_PHASE : "相敏短路", #相敏短路 + Alarm.ERR_WATCH_DOG : "看门狗重启", #看门狗保房 + Alarm.ERR_SWITCH_FAIL : "真空管粘连", #真空管粘连 + Alarm.ERR_SWITCH_THROUGH : "真空管击穿", #真空管击穿 + Alarm.ERR_SWITCH_ON_FAIL : "合闸失败", #合闸失败 + Alarm.ERR_COMM_FAIL : "通讯失败", #通讯失败 + Alarm.ERR_CREEPAGE_SELECT2 : "选 漏", #选 漏 + Alarm.ERR_TEMP_IO_HIGH : "温度过高", #温度过高 + Alarm.ERR_SHORT_CURRENT_SIGNAL : "信号电流短路", #信号电流短路 + Alarm.ERR_REMOTE_OFF : "远方分励", #远方分励 + Alarm.ERR_REPAIR : "维修状态", #维修状态 + Alarm.ERR_TEMP_ALARM : "温度报警", #温度报警 + Alarm.ERR_QUICK_CREEPAGE_ACT : "漏电 动作", #快速漏电 动作 + Alarm.ERR_GB_LEEK_SHORT : "绝缘短路", #绝缘短路 + Alarm.ERR_GB_LEEK_BREAK : "绝缘断路", #绝缘断路 + Alarm.ERR_YB_LOW_VOLTAGE_FAIL : "低压侧故障", #低压侧故障 + Alarm.ERR_YB_LOW_VOLTAGE_UNREADY : "低压侧未准备好", #低压侧未准备好 + Alarm.ERR_WS_FREQ_FAIL : "瓦斯浓度超标", #瓦斯浓度超标 + Alarm.ERR_HIGH_LOW_LOCK : "高低压联锁", #高低压联锁 + Alarm.ERR_MOTOR_ROTATE_LOCK : "电机堵转", #电机堵转 + Alarm.ERR_FIX_TIME_OVER_CURRENT : "定时限过流", #定时限过流 + Alarm.ERR_FIX_TIME_SHORT_CURRENT : "定时限短路", #定时限短路? + Alarm.ERR_PHASE_ERROR : "相序故障", #相序故障 + Alarm.ERR_UNDER_LOAD : "欠载保护", #欠载保护 + Alarm.ERR_EXTERNAL_ALARM : "外部故障", #外部故障 + Alarm.ERR_POWER_LOSS : "系统断电", #系统断电 + Alarm.ERR_USER_ALARM1 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_USER_ALARM2 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_GB_LIGHT_THREAD_SON_LOSS : "光纤子节点丢失", + Alarm.ERR_GB_LIGHT_THREAD_BROTHER_LOSS : "光纤兄弟节点丢失", + Alarm.ERR_GB_LIGHT_MODULE_LOSS : "无光纤模块", + Alarm.ERR_GB_FORCE_LEEK_OFF : "光纤漏电越级跳", + Alarm.ERR_GB_FORCE_SHORT_OFF : "光纤短路越级跳", + Alarm.ERR_GB_CREEPAGE_SELECT : "漏电", #选择性报警 + Alarm.ERR_SWITCH_OUT_POSITION : "开关未推到位", + Alarm.ERR_DZM_CREEPAGE_ACTIVE : "漏电动作", + Alarm.ERR_OIL_PRESSURE_SENSOR_FAIL : "油压传感器未接入", + Alarm.ERR_FREQ_SENSOR_EXCEED : "频率传感器超限", + Alarm.ERR_FREQ_SENSOR_FAIL : "频率传感器未接入", + Alarm.ERR_ANALOG_SENSOR_EXCEED : "模拟量传感器超限", + Alarm.ERR_ANALOG_SENSOR_FAIL : "模拟量传感器未接入", + Alarm.ERR_VOLTAGE_LOSS : "失压故障", + Alarm.ERR_SPEED_LOSS : "失速故障", + Alarm.ERR_GB_ZERO_VOLT_OVER : "零序过压", + Alarm.ERR_PT_BREAK : "PT断线", + Alarm.ERR_CT_BREAK : "CT断线", + Alarm.ERR_ZERO_OVER_VOLTAGE : "零序过压", + Alarm.ERR_ZERO_OVER_CURRENT : "零序过流", + Alarm.ERR_GAS_WARNING : "轻瓦斯告警", + Alarm.ERR_TEMP_WARNING : "温度异常", + Alarm.ERR_COMM_LOSS : "通讯中断", + Alarm.ERR_CAR_FAIL : "手车控制器故障", + Alarm.ERR_WATER_LOW : "循环泵无水故障", + Alarm.ERR_SWITCH_DIDAO_IN_POSITION: "地刀合闸保护中", + Alarm.ERR_SWITCH_DIDAO_MID_POSITION: "地刀未到位", + Alarm.ERR_GB_CREEPAGE_SELECT_5: "5次谐波选漏", + Alarm.ERR_FLUX_LOCK: "流量闭锁", + Alarm.ERR_GLOBAL_OIL_TEMP_LOCK: "油温闭锁", + Alarm.ERR_GLOBAL_WATER_PRESSURE_LOCK: "水压闭锁", + Alarm.ERR_GLOBAL_WATER_LEVEL_LOCK: "液位闭锁", + Alarm.ERR_GLOBAL_CURRENT_SENSOR_LOSS: "互感器未接入", + Alarm.ERR_GLOBAL_GAS_PERCENTAGE_LOCK: "瓦斯浓度闭锁", + Alarm.ERR_GLOBAL_GAS_SENSOR_LOSS: "瓦斯断线", + Alarm.ERR_MEASURE_OVER_CURRENT: "测量回路过流", + Alarm.ERR_CREAPGE_BREAK: "接地开路", + Alarm.ERR_REMOTE_CREAPGE_TEST_FAIL: "漏电测试失败", + Alarm.ERR_REMOTE_CREAPGE_TEST_SUCCESS: "漏电测试成功", + } + }, + + {"alias_str" : { StrInfo.STR_MAX_VALUE :"最大值", + StrInfo.STR_MIN_VALUE :"最小值", + StrInfo.STR_SET_VALUE :"设定值", + StrInfo.STR_VALUE_EXCEED :"设定值越界", + StrInfo.STR_ZERO_PHASE :"有功相位", + StrInfo.STR_INPUT_PASSWORD :"请输入系统密码", + StrInfo.STR_SYSTEM_PASSWORD :"系统密码", + StrInfo.STR_PASSWORD_ERR :"密码错误", + StrInfo.STR_SHORT_PHASE_MODIFY :"短路倍数\n恢复缺省", + StrInfo.STR_SWITCH_TYPE_MODIFY :"漏电延时\n恢复缺省", + StrInfo.STR_SOFT_VERSION:"软件版本", + StrInfo.STR_NO_RECORD :"无记录", + StrInfo.STR_ENTER_TO_CLEAR:"确定清除", + StrInfo.STR_ESC_TO_CANCEL:"ESC取消", + StrInfo.STR_CLEAR_FINISH :"清除成功", + StrInfo.STR_ESC_TO_EXIT :"ESC退出", + StrInfo.STR_INPUT_NEW_PASSWORD :"请设置新密码", + StrInfo.STR_NOT_POSSIBLE_TO_MODIFY :"不可修改", + StrInfo.STR_CAPACITOR_MEASURE :"电容检测", + StrInfo.STR_CAPACITOR_EQUAL :"电容", + StrInfo.STR_LEEKAGE_MEASURE :"检测中..", + StrInfo.STR_TEST_ACTIVE :"测试状态", + StrInfo.STR_POWER_ON :"合闸", + StrInfo.STR_POWER_OFF :"分闸", + StrInfo.STR_FAIL :"失效", + StrInfo.STR_NORMAL :"正常", + StrInfo.STR_MEASURE_CURRENT :"实测电流", + StrInfo.STR_RATE_CURRENT :"额定电流", + StrInfo.STR_ANGLE :"角度", + StrInfo.STR_AVERAGE_CURRENT :"平均电流", + StrInfo.STR_MAX_CURRENT :"最大电流", + StrInfo.STR_LOW_VOLTAGE_RATE :"欠压值", + StrInfo.STR_MEASURE_VOLTAGE :"实测电压", + StrInfo.STR_ZERO_CURRENT :"零序电流", + StrInfo.STR_ZERO_VOLTAGE :"零序电压", + StrInfo.STR_RECORD :"记录", + StrInfo.STR_LEEAKGE_LOCK_VALUE :"闭锁设定值", + StrInfo.STR_LEEAKGE_ACTIVE_VALUE :"动作设定值", + StrInfo.STR_MEASURE_RESISTOR :"电阻测量值", + StrInfo.STR_FRONT_CIRCUIT :"前机", + StrInfo.STR_NEXT_CIRCUIT :"后机", + StrInfo.STR_RATE_VOLTAGE :"额定电压", + StrInfo.STR_PARA_MODIFY_ERROR :"参数修改失败", + StrInfo.STR_LEEKAGE_RES_FINISH :"闭锁电阻检测完", + StrInfo.STR_LEEKAGE_RES_MEASURE :"闭锁电阻检测中", + StrInfo.STR_SFJ_MONITOR :"双风机磁力监控", + StrInfo.STR_CL_MONITOR :"磁力监控系统", + StrInfo.STR_CL_DB_MONITOR :"双回路磁力监控", + StrInfo.STR_YB_MONITOR :"移变低压侧", + StrInfo.STR_KUI_DIAN_MONITOR :"馈电开关监控", + StrInfo.STR_TYPE :"类型:", + StrInfo.STR_TOP_SWITCH :"总开关", + StrInfo.STR_BOTTOM_SWITCH :"分开关", + StrInfo.STR_COS_V :"COS(ΦaΦbΦc)", + StrInfo.STR_POWER_VI :"有功功率", + StrInfo.STR_POWER_VI_T :"电量", + StrInfo.STR_FRONT_POWER_ON :"前机合", + StrInfo.STR_NEXT_POWER_ON :"后机合", + StrInfo.STR_FRONT_POWER_OFF :"前机分", + StrInfo.STR_NEXT_POWER_OFF :"后机分", + StrInfo.STR_FRONT_RESISTOR :"前机电阻:", + StrInfo.STR_NEXT_RESISTOR :"后机电阻:", + StrInfo.STR_WORK_MODE :"模式:", + StrInfo.STR_LEEKAGE_RES :"漏电电阻", + StrInfo.STR_REVERSE_VOLTAGE :"反电动势\n注意安全", + StrInfo.STR_LIGHT :"照明", + StrInfo.STR_SIGNAL :"信号", + StrInfo.STR_SWITCH_STATUS :"开关状态", + StrInfo.STR_POWER_ON_COUNTS :"合闸次数", + StrInfo.STR_SETTING :"设定值", + StrInfo.STR_POW_U :"无功功率", + StrInfo.STR_TEST_FAIL :"测试不正确", + StrInfo.STR_LEAKAGE_TEST_FAIL :"漏电测试不正确", + StrInfo.STR_DETECT_FAIL_WHEN_POWER_ON :"合闸时不能检测", + StrInfo.STR_LINK :"联机系统", + StrInfo.STR_SINGLE :"单机系统", + StrInfo.STR_STATUS :"状态", + StrInfo.STR_MAIN_FIRST :"主机优先", + StrInfo.STR_MAIN_BAK_SAME :"主辅对等", + StrInfo.STR_MAIN_BAK_SWITCH :"主辅轮动", + StrInfo.STR_SWITCH_DISABLE :"局扇模式", + StrInfo.STR_MAIN :"主机", + StrInfo.STR_BACKUP :"备机", + StrInfo.STR_SINGLE_CIRCUIT_FRONT :"单前机", + StrInfo.STR_SINGLE_CIRCUIT_NEXT :"单后机", + StrInfo.STR_DOUBLE_CIRCUIT :"双回路", + StrInfo.STR_WATER_PUMP_ON :"水泵已开阀", + StrInfo.STR_WATER_PUMP_OFF :"水泵已关阀", + StrInfo.STR_SWITCH_FAIL :"粘连", + StrInfo.STR_SWITCH_THROUGH_2 :"击穿", + StrInfo.STR_GB_MONITOR :"高压真空配电装置", + StrInfo.STR_GB_PROTECT_SYSTEM :"综合保护监控系统", + StrInfo.STR_YBGY_MONITOR :"移变高压侧", + StrInfo.STR_ERROR :"故障", + StrInfo.STR_TEMPERATURE:"温度", + StrInfo.STR_NEXT_CURRENT :"后机电流", + StrInfo.STR_FRONT_CURRENT :"前机电流", + StrInfo.STR_FJ_WS_LOCK :"风机处瓦斯闭锁", + StrInfo.STR_GZM_WS_LOCK :"工作面瓦斯闭锁", + StrInfo.STR_CURRENT :"电流", + StrInfo.STR_VOLTAGE:"电压", + StrInfo.STR_MONITOR_RES :"监视电阻", + StrInfo.STR_SWITCH_THROUGH_SIMPLE :"击穿", + StrInfo.STR_LINK_FAIL :"联机失败", + StrInfo.STR_RES_OFF :"漏电临界值", + StrInfo.STR_ANOTHER_REPAIR :"另台维修请勿停机", + StrInfo.STR_WS_INTENSITY :"瓦斯浓度", + StrInfo.STR_HIGH_VOLT :"高压", + StrInfo.STR_AUTO :"自动", + StrInfo.STR_MANUAL :"手动", + StrInfo.STR_FREQUENCY :"频率", + StrInfo.STR_FWD_ON :"正向启动", + StrInfo.STR_RVS_ON :"反向启动", + StrInfo.STR_TEMPERATURE_UNIT : "℃", + StrInfo.STR_POWER_LOSS :"系统断电", + StrInfo.STR_CALIBRATE_SUCCESS :"标定成功", + StrInfo.STR_ISOLATE_RES :"绝缘电阻", + StrInfo.STR_WATER_MONITOR :"水位控制排水监控系统", + StrInfo.STR_SWTICH_PROTECTOR :"ZDB-200电动机保护器", + StrInfo.STR_INDEPENDENT :"独立模式", + StrInfo.STR_DEPENDENT :"联动模式", + StrInfo.STR_OUT_POSITION : "未到位", + StrInfo.STR_IN_POSITION : "进到位", + StrInfo.STR_QUIT_IN_POSITION : "退到位", + StrInfo.STR_RUN_DATA : "运行数据", + StrInfo.STR_WATER_MODE : "水位", + StrInfo.STR_INV_MODE : "可逆", + StrInfo.STR_ISOLATE_RESISTOR_LOW : "绝缘电阻降低", + StrInfo.STR_SWITCH : "开关", + StrInfo.STR_DIDAO : "地刀", + StrInfo.STR_REMOTE : "程控", + StrInfo.STR_LOCAL : "就地", + StrInfo.STR_ONE_KEY_LOCK : "闭锁中", + StrInfo.STR_COMM_FAIL : "通讯失败", + }}, + + {"alias_company": {0: "浙江志展智能科技", + 1: "华荣科技", + } + }, + {"alias_sensor" : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "1500 A", 25: "2000 A", 26: "2500 A" ,27: "5 A"}}, + {"alias_switch_type" : {0: "总开关", 1: "分开关"}}, + {"alias_measure_v": {0: "正电压", 1: "负电压"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"380V", 1:"660V", 2:"1140V", 3:"3300V", 4:"100V", 5:"127V", 6:"220V", 7:"440V"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_input": {0: "常开", 1: "常闭"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_test": {0: "模拟测试", 1: "继电器测试"}}, + {"alias_can_baud": {0: "1000K", 1: "800K", 2: "500K", 3: "250K", 4: "125K", 5: "100K", 6: "50K", 7: "20K", 8: "10K", 9: "AUTO"}}, + {Alias.alias_measure_v: {0: "正电压", 1: "负电压"}}, + {Alias.alias_switch_type : {0: "总开关", 1: "分开关"}}, + {"alias_work_mode": {0: "水位模式", 1: "磁力模式", 2: "正反转模式", 3: "联控模式"}}, + {"alias_us_phase": {0: "Uab_ABC", 1: "Uab_ACB", 2: "Ubc_ABC", 3: "Ubc_ACB", 4: "Uca_ABC", 5: "Uca_ACB"}}, + {Alias.alias_sensor : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "2500 A", 25: "5 A"}}, + {"alias_table": {0: "0", 1: "1", 2: "2", 3: "3"}}, + {"alias_remote": {0: "就地", 1: "程控"}}, + {"alias_current": {0: "三相测量", 1: "两相平均", 2: "两相测量"}}, + + {Alias.alias_eth : {0: "无", 1: "一代以太网", 2: "二代以太网"}}, + {Alias.alias_lcd : {0: "一体迪文屏", 1: "分体迪文屏", 2: "大彩屏", 3 : "昆仑通态屏"}}, + {Alias.alias_fyj : {0: "无", 1: "FYJ", 2: "FYJ2", 3 : "FYJ4"}}, + {Alias.alias_dev : {0: "馈电", 1: "高爆", 2: "移变", 3 : "双风机", 4 : "磁力", + 5 : "双磁力", 6 : "照明", 7 : "移变高压侧", 8: "双高爆", + 9: "组合馈电", 10: "双照明", 11 : "ZZ630"}}, + {"alias_alarm_type": {0: "试验", 1: "动作"}}, + {"alias_car_position": {0: "小车未到位", 1 : "小车试验位", 2: "小车工作位", 3 : "位置信号异常"}}, +] + +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + + +def get_alias_value_str(alias_str, alias_value) : + alias_value_msg = None + compare_value = int(alias_value) + + for alias_dict in alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + if alias_name == alias_str : + for each_value_dict in value_dict.items(): + if isinstance(each_value_dict[0], Enum) : + key_value = each_value_dict[0].value[0] + else : + key_value = each_value_dict[0] + key_string = each_value_dict[1] + + if int(key_value) == compare_value : + alias_value_msg = key_string + return alias_value_msg + return alias_value_msg + +def func_adjust_current_menu_item(device : class_modbus_comm_device, menu_item) : + #获得互感器类型, 根据互感器类型来调整 scale, format, 让电流可以正确显示与设置 + sensor_type = device.comm_get_value_from_mqtt_name("Sensor") + sensor_current = 400 + + if sensor_type != None : + value_str = get_alias_value_str("alias_sensor", sensor_type) + if value_str != None : + value_str_no_unit = value_str.replace("A", "") + sensor_current = int(value_str_no_unit) + + #80A 以下电流互感器, 显示一位小数点 + if sensor_current <= 80 : + new_item = menu_item + new_item["scale"] = 0.1 + new_item["format"] = "%1.1f" + return new_item + else : + return menu_item + +# def func_caculate_Is(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : +# format_str = utils.dict_or_object_get_attr(menu_item, "format", "%4.2f") +# try : +# Ia = device.comm_get_value_from_mqtt_name("Ia") +# Ib = device.comm_get_value_from_mqtt_name("Ib") +# Ic = device.comm_get_value_from_mqtt_name("Ic") +# Is = (Ia + Ib + Ic) / 3 +# except Exception as e : +# Is = 0.00 +# Is_str = format_str%(Is) +# mqtt_dict["Is"] = Is_str + +#视频触发 +def func_video_trigger(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + value = device.comm_get_value_from_menu_item(menu_item) + if value == None : + #通讯未建立 + return + + value = round(value) + in_position = (value >> 10) & 0x1 + out_position = (value >> 9) & 0x1 + now_time = time.time() + if hasattr(device, "MqttVideoActive") == False: + #动态添加视频触发所需的变量 + device.MqttVideoActive = False + device.MqttVideoBaseTime = now_time + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + if in_position != device.DI_SwitchInPosition or out_position != device.DI_SwitchQuitPosition: + #开关进到位与 开关退到位信号, 当这两个状态发生变化时, 触发20秒的视频 + device.MqttVideoActive = True + device.MqttVideoBaseTime = now_time + mqtt_dict["VideoActive"] = "1" + if device.MqttVideoActive : + #视频延时20后主动关闭视频显示 + if now_time - device.MqttVideoBaseTime > 20.0 : + mqtt_dict["VideoActive"] = "0" + device.MqttVideoActive = False + + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + +COLOR_RED = "#EE2D2D" +COLOR_GREEN = "#83BF6E" + +def func_process_car_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + car_pos_value = device.comm_get_value_from_menu_item(menu_item) + if car_pos_value == None or mqtt_dict == None: + return + car_msg = get_alias_value_str("alias_car_position", car_pos_value) + if car_msg != None : + mqtt_dict["CarPositionMsg"] = car_msg + +def func_process_alarm_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + alarm_id = device.comm_get_value_from_menu_item(menu_item) + if alarm_id == None or mqtt_dict == None: + #通讯未建立 + return + alarm_msg = get_alias_value_str("alias_alarm", alarm_id) + if alarm_msg != None : + alarm_msg_dict = {} + if alarm_id > 0 : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_RED + else : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_GREEN + + mqtt_dict["AlarmMessage"] = alarm_msg_dict + +mqtt_video_trigger = [ + { + "name": "视频触发", + "addr": "8015", + "call" : func_video_trigger, + }, +] + +mqtt_time_update = [ + { + "name": "Year", + "addr": "2300", + "format" : "%04.0f", + "mqtt" : "Year", + }, + { + "name": "Month", + "addr": "2301", + "format" : "%02.0f", + "mqtt" : "Month", + }, + { + "name": "Day", + "addr": "2302", + "format" : "%02.0f", + "mqtt" : "Day", + }, + { + "name": "Hour", + "addr": "2303", + "format" : "%02.0f", + "mqtt" : "Hour", + }, + { + "name": "Minute", + "addr": "2304", + "format" : "%02.0f", + "mqtt" : "Minute", + }, + { + "name": "Second", + "addr": "2305", + "format" : "%02.0f", + "mqtt" : "Second", + }, + { + "name": "SetupTime", + "addr": "2305", + "mqtt" : "SetupTime", + "action" : "SetupTime", + }, +] + +mqtt_pack_param = [ + #系统设置 + { + "name": "温度设定", + "addr": "8423", + "scale" : 1, + "format": "%03.0f", + "mqtt" : "Temperature", + }, + { + "name": "瓦斯触点", + "addr": "8190", + "alias" : "alias_input", + "mqtt" : "Gas", + }, + { + "name": "瓦斯延时", + "addr": "8191", + "scale" : 0.01, + "format": "%06.2f", + "mqtt" : "GasDelay", + }, + { + "name": "瓦斯浓度", + "addr": "8237", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "GasConcentration", + }, + { + "name": "风电触点", + "addr": "8248", + "alias" : "alias_input", + "mqtt" : "Fan", + }, + { + "name": "风电延时", + "addr": "8234", + "scale" : 0.01, + "format": "%06.2f", + "mqtt" : "FanDelay", + }, + { + "name": "远近控模式", + "addr": "8558", + "alias" : "alias_remote", + "mqtt" : "FarAndNearMode", + }, + { + "name": "维修模式", + "addr": "8565", + "alias" : "alias_bool", + "mqtt" : "MaintenanceMode", + }, + + + #电流参数 + { + "name": "照明额定电流", + "unit": "A", + "addr": "8200", + "scale" : 1.0, + "format": "%04.0f", + "action": "rate_current", + "mqtt" : "RateCurrent", + "adjust" : func_adjust_current_menu_item, + }, + + { + "name": "照明短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + "mqtt" : "ShortLevel", + }, + { + "name": "照明短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + "mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" :"alias_sensor", + "addr": "8207", + "mqtt" : "Sensor", + }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + "mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + "mqtt" : "UnbalanceDelay", + }, + { + "name": "定时限过流", + "unit": "Ie", + "addr": "8239", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeOvercurrent", + }, + { + "name": "定时限过流延时", + "unit": "ms", + "addr": "8240", + "scale" : 1, + "format": "%05.0f", + "mqtt" : "TimeOvercurrentDelay", + }, + { + "name": "定时限短路", + "unit": "Ie", + "addr": "8523", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeLimitcurrent", + }, + { + "name": "定时限短路延时", + "unit": "ms", + "addr": "8524", + "scale" : 1, + "format": "%04.0f", + "mqtt" : "TimeLimitcurrentDelay", + }, + { + "name": "Is 校正", + "unit": "%", + "scale" : 0.1, + "format": "%04.2f", + "addr": "8494", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIs", + }, + { + "name": "信号Ie", + "unit": "A", + "addr": "8492", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "CurrentIs", + }, + { + "name": "信号短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8493", + "mqtt" : "ShortIs", + }, + + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + "mqtt" : "CurrentB" + }, + + + #电压参数 + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "mqtt" : "RateVoltage", + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + "mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + "mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUs", + }, + + + #漏电参数 + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + "mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "mqtt" : "LeakageDelay", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "SeriesResistor" + }, + { + "name": "照明闭锁值", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "mqtt" : "BlockResistor" + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + "mqtt" : "CorrectUo" + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + "mqtt" : "CorrectIo" + }, + { + "name": "检测电压", + "addr": "8253", + "alias": "alias_measure_v", + "mqtt" : "MeasureV" + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0, + "mqtt" : "DelayLeakageTrip" + }, + + #保护参数投入 + { + "name": "短路保护", + "alias": "alias_bool", + "addr": "8192.1", + "mqtt" : "ProtectShort", + }, + { + "name": "信号短路保护", + "alias": "alias_bool", + "addr": "8175.15", + "mqtt" : "ProtectIsShort", + }, + { + "name": "过载保护", + "alias": "alias_bool", + "addr": "8192.3", + "mqtt" : "ProtectOverLoad", + }, + { + "name": "电流断相保护", + "alias": "alias_bool", + "addr": "8192.4", + "mqtt" : "ProtectCurrentPhaseOff", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + "mqtt" : "ProtectImbalance", + }, + { + "name": "漏电闭锁保护", + "alias": "alias_bool", + "addr": "8192.10", + "mqtt" : "ProtectLeakage" + }, + { + "name": "定时限过载保护", + "alias": "alias_bool", + "addr": "8192.11", + "mqtt" : "ProtectTimeLimitOverload" + }, + { + "name": "定时限短路保护", + "alias": "alias_bool", + "addr": "8192.12", + "mqtt" : "ProtectTimeLimitShortCircuit", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + "mqtt" : "ProtectUnderVoltage", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + "mqtt" : "ProtectOverVoltage", + }, + { + "name": "电压断相保护", + "alias": "alias_bool", + "addr": "8174.2", + "mqtt" : "ProtectVoltagePhaseOff", + }, + { + "name": "漏电动作保护", + "alias": "alias_bool", + "addr": "8174.6", + "mqtt" : "ProtectLeakageAction", + }, + { + "name": "温度报警保护", + "alias": "alias_bool", + "addr": "8174.8", + "mqtt" : "ProtectTemperatureAlarm", + }, + + #通讯设置 + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + "mqtt" : "485Address", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + "mqtt" : "485Baud", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + "mqtt" : "485Parity", + }, + { + "name": "CAN地址", + "format": "%03.0f", + "addr": "8440", + "mqtt" : "CANAddress", + }, + { + "name": "CAN波特率", + "alias": "alias_can_baud", + "addr": "8439", + "mqtt" : "CANBaud", + }, +] + +mqtt_pack_measure = [ + { + "name": "SwitchStatus", + "addr": "8162.0", + "alias": Alias.alias_onoff, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_STATUS, + "measure" : True, + "mqtt" : "SwitchStatus", + }, + { + "name": "AlarmId", + "addr": "8166", + "alias": Alias.alias_alarm, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_ALARM, + "measure" : True, + "mqtt" : "AlarmId", + }, + { + "name": "AlarmMessage", + "addr": "8166", + "alias": Alias.alias_alarm, + "call" : func_process_alarm_message, + }, + { + "name": "CarPositionMsg", + "addr": "8015.10#2", + "alias": Alias.alias_car_position, + "call" : func_process_car_message, + }, + { + "name": "Ia", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Ia", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "unit": "A", + "addr": "8157", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IB, + "measure" : True, + "mqtt" : "Ib", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "unit": "A", + "addr": "8158", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IC, + "measure" : True, + "mqtt" : "Ic", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Is", + "unit": "A", + "addr": "8142", + "format": "%05.2f", + "measure" : True, + "mqtt" : "Is", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Voltage", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Voltage", + }, + { + "name": "Current", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Current", + }, + { + "name": "Power", + "unit": "kw", + "addr": "8167", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Power", + }, + { + "name": "Electricity", + "unit": "kwh", + "addr": "8160#2", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Electricity", + }, + { + "name": "Uab", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Uab", + }, + { + "name": "Ubc", + "unit": "V", + "addr": "8154", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UBC, + "measure" : True, + "mqtt" : "Ubc", + }, + { + "name": "Uca", + "unit": "V", + "addr": "8155", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UCA, + "measure" : True, + "mqtt" : "Uca", + }, + # { + # "name": "Uo", + # "unit": "V", + # "addr": "8152", + # "format": "%05.1f", + # "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UO, + # "measure" : True, + # "mqtt" : "Uo", + # }, + # { + # "name": "Io", + # "unit": "mA", + # "addr": "8151", + # "format": "%05.1f", + # "scale" : 1.0, + # "remap_addr" : remap.COMM_REMAP_MEASURE_FLOAT_IO, + # "measure" : True, + # "mqtt" : "Io", + # }, + { + "name": "Ro", + "unit": "K", + "addr": "8150", + "scale": 0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_RO, + "measure" : True, + "mqtt" : "Ro", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%06.0f", + "property": MENU_PROPERTY_READ_ONLY, + "mqtt" : "OnCount", + }, + + # { + # "name": "Is", + # "addr": "8171", + # "scale": 0.01, + # "format": "%04.2f", + # "measure" : True, + # "call" : func_caculate_Is, + # }, + + # { + # "name": "A相上", + # "addr": "8056", + # "format": "%05.1f", + # "measure" : True, + # "mqtt" : "Aup", + # }, + + # { + # "name": "B相上", + # "addr": "8057", + # "format": "%05.1f", + # "measure" : True, + # "mqtt" : "Bup", + # }, + # { + # "name": "C相上", + # "addr": "8058", + # "format": "%05.1f", + # "measure" : True, + # "mqtt" : "Cup", + # }, + # { + # "name": "A相下", + # "addr": "8059", + # "format": "%05.1f", + # "measure" : True, + # "mqtt" : "Adown", + # }, + # { + # "name": "B相下", + # "addr": "8060", + # "format": "%05.1f", + # "measure" : True, + # "mqtt" : "Bdown", + # }, + # { + # "name": "C相下", + # "addr": "8061", + # "format": "%05.1f", + # "measure" : True, + # "mqtt" : "Cdown", + # }, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmCode", + "addr": "8121", + "alias": "alias_alarm", + "mqtt" : "AlarmCode", + }, + { + "name": "AlarmTest", + "addr": "8138", + "alias": "alias_alarm_type", + "format" : "%1.0f", + "mqtt" : "AlarmTest", + }, + { + "name": "Ua", + "addr": "8122", + "format" : "%1.0f", + "mqtt" : "AlarmUa", + }, + { + "name": "Ub", + "addr": "8123", + "format" : "%1.0f", + "mqtt" : "AlarmUb", + }, + { + "name": "Uc", + "addr": "8124", + "format" : "%1.0f", + "mqtt" : "AlarmUc", + }, + { + "name": "Ia", + "addr": "8125", + "format" : "%1.0f", + "mqtt": "AlarmIa", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "addr": "8126", + "format" : "%1.0f", + "mqtt": "AlarmIb", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "addr": "8127", + "format" : "%1.0f", + "mqtt": "AlarmIc", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ro", + "addr": "8128", + "format" : "%5.1f", + "scale" : 0.1, + "mqtt": "AlarmRo", + }, + { + "name": "Is", + "addr": "8142", + "format": "%05.2f", + "mqtt" : "AlarmIs", + "adjust" : func_adjust_current_menu_item, + }, + # { + # "name": "Io", + # "addr": "8129", + # "format" : "%1.1f", + # "scale" : 0.1, + # "mqtt": "AlarmIo", + # }, + # { + # "name": "Uo", + # "addr": "8130", + # "format" : "%5.0f", + # "scale" : 1.0, + # "mqtt": "AlarmUo", + # }, + { + "name": "Year", + "addr": "8131", + "format" : "%4.0f", + "mqtt": "AlarmYear", + }, + { + "name": "Month", + "addr": "8132", + "format" : "%2.0f", + "mqtt": "AlarmMonth", + }, + { + "name": "Day", + "addr": "8133", + "format" : "%2.0f", + "mqtt": "AlarmDay", + }, + { + "name": "Hour", + "addr": "8134", + "format" : "%2.0f", + "mqtt": "AlarmHour", + }, + { + "name": "Minute", + "addr": "8135", + "format" : "%2.0f", + "mqtt": "AlarmMinute", + }, + { + "name": "Second", + "addr": "8136", + "format" : "%2.0f", + "mqtt": "AlarmSecond", + }, +] + +menu_data = [ + { + "name": "数据页面", + "sub_menu": "menu_curve_physical", + }, +] + +#曲线菜单 +menu_curve_physical = [ + { + "name": "物理曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#曲线菜单 +menu_curve_adc = [ + { + "name": "ADC曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#谐波菜单 +menu_curve_harmonic = [ + { + "name": "谐波曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +modbus_comm_table = [ + {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, + {"name":"measure", "reg_addr":8000, "reg_count":62, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, + #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, + # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000}, + {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, + {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, + {"name":"param/info", "reg_addr":8490, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8520, "reg_count":20, "cycle": 3000}, + {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, + {"name":"param/info", "reg_addr":8435, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8420, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, + #{"name":"global_status", "reg_addr":3200, "reg_count":6, "cycle": 400}, +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + if not hasattr(comm_table_item, "name"): + return False + return False + +menu_current = [ #菜单表[menu_current],存储菜单项属性字典<> + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "action": "rate_current", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + #"mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" : Alias.alias_sensor, + "addr": "8207", + }, + # { + # "name": "反时限表", + # "alias" :"alias_table", + # "addr": "8178", + # }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + #"mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + #"mqtt" : "UnbalanceDelay", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIc", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_voltage = [ + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "default": 0, + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + #"mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + #"mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUs", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm_display = [ + { + "name": "当前故障", + "action" : "Idle", + }, +] + +menu_alarm_curve = [ + { + "name": "录波曲线", + "action" : "Idle", + }, +] + +menu_alarm_history = [ + { + "name": "故障查询", + "action" : "Idle", + }, +] + +menu_alarm = [ + { + "name": "故障查询", + "sub_menu": "menu_alarm_history", + }, + { + "name": "故障清除", + "action": "alarm_clear", + }, + { + "name": "合闸清零", + "action": "clear_oncount", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + #"mqtt" : "OnCount", + }, + { + "name": "电量清除", + "action": "clear_kwh", + }, + { + "name": "累计时间清除", + "action": "clear_time", + }, + { + "name": "累计合闸时间", + "addr": "8016#2", + "unit": "Min", + "scale": 0.0166666666666667, + "format": "%07.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_test = [ + { + "name": "短路试验", + "action": "test", + "addr" : "100628", + "mqtt" : "TestShort", + }, + { + "name": "漏电试验", + "action": "test", + "addr" : "100629", + "mqtt" : "TestIsolation", + }, + { + "name": "过压试验", + "action": "test", + "addr" : "100641", + "mqtt" : "TestOverVoltage", + }, + { + "name": "电流断相试验", + "action": "test", + "addr" : "100642", + "mqtt" : "TestBreak", + }, + + { + "name": "复归", + "action": "test", + "addr" : "100649", + "mqtt" : "TestRecover", + }, + + { + "name": "漏电试验配置", + "alias" : "alias_test", + "addr": "8265", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_protect_set = [ + { + "name": "短路保护", + "alias": Alias.alias_bool, + "addr": "8192.1", + #"mqtt" : "ProtectShort", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + #"mqtt" : "ProtectUnbalance", + }, + { + "name": "反时限过流", + "alias": "alias_bool", + "addr": "8192.3", + #"mqtt" : "ProtectOverCurrent", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + #"mqtt" : "ProtectHighVotage", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + #"mqtt" : "ProtectLowVotage", + }, + # { + # "name": "电压断相", + # "alias": "alias_bool", + # "addr": "8174.2", + # }, + # { + # "name": "相序保护", + # "alias": "alias_bool", + # "addr": "8174.3", + # }, + { + "name": "漏电闭锁", + "alias": "alias_bool", + "addr": "8192.10", + #"mqtt" : "ProtectIsolationLock", + }, + { + "name": "漏电动作", + "alias": "alias_bool", + "addr": "8174.6", + #"mqtt" : "ProtectIsolationAction", + }, + # { + # "name": "选漏保护", + # "alias": "alias_bool", + # "addr": "8174.7", + # }, + { + "name": "风电闭锁", + "alias": "alias_bool", + "addr": "8175.0", + #"mqtt" : "ProtectWindMotor", + }, + { + "name": "瓦斯闭锁", + "alias": "alias_bool", + "addr": "8174.13", + #"mqtt" : "ProtectGasLock", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_comm_set = [ + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + }, + # { + # "name": "CAN地址", + # }, + # { + # "name": "CAN波特率", + # "alias": "alias_can_baud", + # }, + { + "name": "IP设置", + "addr": "8271#2", + "action": "ip", + }, + { + "name": "IP网关", + "addr": "8273#2", + "action": "ip", + }, + { + "name": "IP掩码", + "addr": "8275#2", + "action": "ip", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "工作模式", + "addr": "8231", + "alias": "alias_work_mode", + "property": MENU_PROPERTY_ENGINEER, + "action" : "Visible_CL", #磁力模式显示菜单 + }, + { + "name": "开关类型", + "alias": "alias_switch_type", + "addr": "8210", + "action" : "Visible_KD", #馈电模式显示菜单 + }, + { + "name": "控制模式", + "alias": "alias_remote", + "addr": "8262", + }, + { + "name": "瓦斯触点", + "alias": "alias_input", + "addr": "8190", + }, + { + "name": "瓦斯延时", + "unit": "S", + "addr": "8191", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "风电触点", + "alias": "alias_input", + "addr": "8248", + }, + { + "name": "风电延时", + "unit": "S", + "addr": "8234", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "高水位延时", + "addr": "8267", + "unit": "S", + "scale": 0.1, + "format": "%04.1f", + "action" : "Visible_CL_WATER", #水位磁力模式显示 + }, + { + "name": "正反转延时", + "addr": "8266", + "unit": "ms", + "scale": 1.0, + "format": "%04.0f", + "action" : "Visible_CL_INV", #正反转磁力模式显示 + }, + { + "name": "维修模式", + "addr": "8260", + "alias": "alias_bool", + }, + # { + # "name": "温度设定", + # "unit": "℃", + # "addr": "2030", + # "format": "%+03.0f", + # }, + { + "name": "系统日期", + "addr": "2300#3", + "action": "date", + }, + { + "name": "当前时间", + "addr": "2303#3", + "action": "time", + }, + { + "name": "软件版本", + "addr": "8180", + "unit" : VERSION_DATE, + "scale": 0.01, + "format": "%.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统密码", + "addr": "8181", + "format": "%04.0f", + "action": "password", + }, + { + "name": "Us相位", + "alias": "alias_us_phase", + "addr": "8269", + }, + { + "name": "重启", + "action": "restart", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_switch_cmd = [ + { + "name": "通讯合闸", + "action": "write_bit", + "addr" : "100618", + "mqtt" : "SwitchOn", + }, + { + "name": "通讯分闸", + "action": "write_bit", + "addr" : "100619", + "mqtt" : "SwitchOff", + }, + { + "name": "通讯复位", + "action": "write_bit", + "addr" : "100620", + "mqtt" : "SwitchRst", + }, + { + "name": "小车进控制", + "addr" : "100636", + "mqtt" : "CarForward", + }, + { + "name": "小车退控制", + "addr" : "100637", + "mqtt" : "CarRetreat", + }, + +] + +memu_setting = [ + { + "name": "电流设置", + "sub_menu": Menu.menu_current, + }, + { + "name": "电压设置", + "sub_menu": "menu_voltage" + }, + { + "name": "漏电设置", + "sub_menu": "menu_leak" + }, + { + "name": "系统设置", + "sub_menu": "menu_system" + }, + { + "name": "保护设置", + "sub_menu": "menu_protect_set" + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set" + }, + { + "name": "保护试验", + "sub_menu": Menu.menu_test #"menu_test" + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm" + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_leak = [ + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + #"mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + #"mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "A", + "scale" : 0.01, + "format" : "%05.2f", + "mqtt" : "GB.Io", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%05.2f", + "mqtt" : "GB.Uo", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0 + }, + { + "name": "检测电压", + "addr": "8253", + "alias": Alias.alias_measure_v, + }, + { + "name": "退出", + "action": "exit", + }, +] + +calibrate = [ + { + "name": "999校正", + "action": "calibrate999", + "mqtt" : "Calibrate999", + }, + { + "name": "0欧校正", + "action": "calibrate0", + "mqtt" : "Calibrate0", + }, + { + "name": "以太网模块", + "alias": Alias.alias_eth, + "addr" : "8280", + }, + { + "name": "LCD模块", + "alias": Alias.alias_lcd, + "addr" : "8281", + }, + { + "name": "防越级模块", + "alias": Alias.alias_fyj, + "addr" : "8282", + }, + { + "name": "设备型号", + "alias": Alias.alias_dev, + "addr" : "8270", + }, + { + "name": "退出", + "action": "exit", + }, +] + +startup = [ + { + "name": "退出", + }, +] + +menu_main = [ + { + "name": "设置", + "sub_menu": "memu_setting", + }, + { + "name": "数据", + "sub_menu": "menu_data", + }, + { + "name": "报警", + "sub_menu": "menu_alarm_display", + }, + { + "name": "标定", + "sub_menu": "calibrate", + "property": MENU_PROPERTY_ENGINEER, + }, +] + +mqtt_topic_subscribe = None + +MENU_STARTUP_PAGE = 150 +MENU_DISPLAY_PAGE = 2 +MENU_ALARM_PAGE = 3 +MENU_DATA_PAGE = 120 +MENU_CL_MAIN_PAGE = 90 +MENU_KD_MAIN_PAGE = 20 +MENU_KD_MAIN_PAGE_LANGUAGE = 21 +MENU_CURVE_PAGE = 10 +MENU_ADC_CURVE_PAGE = 18 +MENU_HARNOMIC_CURVE_PAGE = 19 + +menu_caption = [ + {"name" : "startup", "menu" : startup, "caption": "启动页面", "page" : MENU_STARTUP_PAGE, "max_items" : 1}, + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : MENU_KD_MAIN_PAGE, "max_items" : 4}, + {"name" : "menu_leak", "menu" : menu_leak, "caption": "漏电设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "memu_setting", "menu" : memu_setting, "caption": "参数设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_current", "menu" : menu_current, "caption": "电流设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_voltage", "menu" : menu_voltage, "caption": "电压设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "故障查询", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm_display", "menu" : menu_alarm_display, "caption": "当前故障", "page" : MENU_ALARM_PAGE, "prev": menu_alarm_curve, "next": menu_alarm_curve, "max_items" : 1}, + {"name" : "menu_alarm_curve", "menu" : menu_alarm_curve, "caption": "曲线故障", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_alarm_display, "next": menu_alarm_display, "max_items" : 1}, + + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "故障查询", "page" : MENU_ALARM_PAGE, "max_items" : 1}, + {"name" : "menu_test", "menu" : menu_test, "caption": "保护试验", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_measure", "menu" : mqtt_pack_measure, "caption": "测量数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_data", "menu" : menu_data, "caption": "数据页面", "page" : MENU_DATA_PAGE, "max_items" : 8}, + {"name" : "menu_curve_physical", "menu" : menu_curve_physical, "caption": "物理曲线", "page" : MENU_CURVE_PAGE, "prev": menu_curve_harmonic, "next": menu_curve_adc, "max_items" : 8}, + {"name" : "menu_curve_adc", "menu" : menu_curve_adc, "caption": "ADC曲线", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_curve_physical, "next": menu_curve_harmonic, "max_items" : 8}, + {"name" : "menu_curve_harmonic", "menu" : menu_curve_harmonic, "caption": "谐波曲线", "page" : MENU_HARNOMIC_CURVE_PAGE, "prev": menu_curve_adc, "next": menu_curve_physical, "max_items" : 8}, + {"name" : "calibrate", "menu" : calibrate, "caption": "标定页面", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_switch_cmd", "menu" : menu_switch_cmd, "caption": "通讯操作", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_param", "menu" : mqtt_pack_param, "caption": "参数刷新", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_video_trigger", "menu" : mqtt_video_trigger, "caption": "视频触发", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + + {"name" : "mqtt_time_update", "menu" : mqtt_time_update, "caption": "时钟设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, +] + + +# mqtt 故障查询函数 +def func_alarm_query(device : class_modbus_comm_device, alarm_index = 0) : + result = device.protocol.modbus_write_regs(device.comm_addr, 8120, 1, alarm_index) + time.sleep(0.05) + alarm_regs = device.protocol.modbus_read_regs(device.comm_addr, 8121, 20) + if alarm_regs != None : + device.modbus_regs_flush(8121, 20, alarm_regs) + + msg_alarm_dict = device.comm_item_trigger_mqtt_pack(mqtt_pack_alarm) + + err_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmCode", 0) + err_code = int(err_code) + test_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmTest", 0) + test_code = int(test_code) + + + test_value_str = get_alias_value_str("alias_alarm_type", test_code) + if test_value_str == None: + test_value_str = " " + err_code_str = get_alias_value_str("alias_alarm", err_code) + if err_code_str == None: + err_code_str = " " + msg_alarm_dict["AlarmCodeMsg"] = err_code_str + msg_alarm_dict["AlarmTestMsg"] = test_value_str + msg_alarm_dict["index"] = alarm_index + msg : str = json.dumps(msg_alarm_dict, ensure_ascii=False) + + if device.mqtt_thread : + device.mqtt_thread.publish("response/alarm/" + device.unique_name, msg) + +# mqtt action处理函数 +def func_action_process(device : class_modbus_comm_device, menu_item = None, value_str : str = None) : + action_str = utils.dict_or_object_get_attr(menu_item, "action", " ") + mqtt_name = utils.dict_or_object_get_attr(menu_item, "mqtt", " ") + result = None + + if action_str == "SetupTime" : #设置保护器时间 + numbers = re.findall(r'\d+', value_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + device.protocol.modbus_write_regs(device.comm_addr, 2300, 6, (year, month, day, hour, minute, second)) + pass + if action_str == "calibrate999" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2007) + if action_str == "calibrate0" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2006) + if action_str == "write_bit" or action_str == "test": + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", " ") + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if reg_count == 1: + command_value = [1] + result = device.write_bit_register(reg_addr, command_value) + + if device.mqtt_thread and result != None: + device.mqtt_thread.publish("response/action/" + device.unique_name, '{"name" : "%s", "result" : %d}'%(mqtt_name, result)) + + +class class_menu_comm_device_config(class_comm_device_config): + def __init__(self): + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_top + def get_menu_top(self) : + return menu_main + + def get_menu_caption_info(self) : + return menu_caption + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + def is_gb2312(self) : + return False + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_menu_comm_device_config() diff --git a/menu_light_7.py b/menu_light_7.py new file mode 100644 index 0000000..a98e1a6 --- /dev/null +++ b/menu_light_7.py @@ -0,0 +1,2491 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_utils as uitls +from enum import Enum +from datetime import datetime +import time +import menu_utils as utils +import json +import re +from enum import Enum +from comm_modbus_device import class_modbus_comm_device + +now_time = datetime.now() +current_time = now_time.strftime("(%y/%m/%d)") +VERSION_DATE = current_time + +class StrInfo(Enum): + STR_MAX_VALUE = 0, #"最大值" + STR_MIN_VALUE = 1, #"最小值" + STR_SET_VALUE = 2, #"设定值" + STR_VALUE_EXCEED = 3, #"设定值越界" + STR_ZERO_PHASE = 4, #"有功相位" + STR_INPUT_PASSWORD = 5, #"请输入系统密码 + STR_SYSTEM_PASSWORD = 6, #"系统密码" + STR_PASSWORD_ERR = 7, #"密码错误" + STR_SHORT_PHASE_MODIFY =8, #"短路倍数\n恢复缺省" + STR_SWITCH_TYPE_MODIFY =9, #"漏电延时\n恢复缺省" + STR_SOFT_VERSION =10, #"软件版本" + STR_NO_RECORD =11, #"无记录" + STR_ENTER_TO_CLEAR =12, #"确定清除" + STR_ESC_TO_CANCEL =13, #"ESC取消" + STR_CLEAR_FINISH =14, #"清除成功" + STR_ESC_TO_EXIT =15, #"ESC退出 + STR_INPUT_NEW_PASSWORD =16, #"请设置新密码" + STR_NOT_POSSIBLE_TO_MODIFY =17, #"不可修改" + STR_CAPACITOR_MEASURE =18, #"电容检测 + STR_CAPACITOR_EQUAL =19, #"电容" + STR_LEEKAGE_MEASURE =20, #"检测中.." + STR_TEST_ACTIVE =21, #"测试状态 + STR_POWER_ON=22, #"合闸" + STR_POWER_OFF=23, #"分闸" + STR_FAIL=24, #"失效" + STR_NORMAL=25, #"正常" + STR_MEASURE_CURRENT=26, #"实测电流" + STR_RATE_CURRENT=27, #"额定电流" + STR_ANGLE=28, #"角度" + STR_AVERAGE_CURRENT=29, #"平均电流" + STR_MAX_CURRENT=30, #"最大电流 + STR_LOW_VOLTAGE_RATE=31, #"欠压值 + STR_MEASURE_VOLTAGE=32, #"实测电压" + STR_ZERO_CURRENT=33, #"零序电流" + STR_ZERO_VOLTAGE=34, #"零序电压" + STR_RECORD=35, #"记录" + STR_LEEAKGE_LOCK_VALUE=36, #"闭锁设定值" + STR_LEEAKGE_ACTIVE_VALUE=37, #"动作设定值" + STR_MEASURE_RESISTOR=38, #"电阻测量值" + STR_FRONT_CIRCUIT=39, #"前机" + STR_NEXT_CIRCUIT=40, #"后机" + STR_RATE_VOLTAGE=41, #"额定电压" + STR_PARA_MODIFY_ERROR=42, #"参数修改失败" + STR_LEEKAGE_RES_FINISH=43, #"闭锁电阻检测完" + STR_LEEKAGE_RES_MEASURE=44, #"闭锁电阻检测中" + STR_SFJ_MONITOR=45, #"双风机磁力监控" + STR_CL_MONITOR=46, #"磁力监控系统" + STR_CL_DB_MONITOR=47, #"双回路磁力监控" + STR_YB_MONITOR=48, #"移变低压侧" + STR_KUI_DIAN_MONITOR=49, #"馈电开关监控" + STR_TYPE=50, #"类型:" + STR_TOP_SWITCH=51, #"总开关" + STR_BOTTOM_SWITCH=52, #"分开关" + STR_COS_V=53, #"COS(ΦaΦbΦc)" + STR_POWER_VI=54, #"有功功率" + STR_POWER_VI_T=55, #"电量" + STR_FRONT_POWER_ON=56, #"前机合" + STR_NEXT_POWER_ON=57, #"后机合" + STR_FRONT_POWER_OFF=58, #"前机分" + STR_NEXT_POWER_OFF=59, #"后机分" + STR_FRONT_RESISTOR=60, #"前机电阻:" + STR_NEXT_RESISTOR=61, #"后机电阻:" + STR_WORK_MODE=62, #"模式:" + STR_LEEKAGE_RES=63, #"漏电电阻" + STR_REVERSE_VOLTAGE=64, #"反电动势\n注意安全" + STR_LIGHT=65, #"照明" + STR_SIGNAL=66, #"信号" + STR_SWITCH_STATUS=67, #"开关状态" + STR_POWER_ON_COUNTS=68, #"合闸次数" + STR_SETTING=69, #"设定值" + STR_POW_U=70, #"无功功率" + STR_TEST_FAIL=71, #"测试不正确" + STR_LEAKAGE_TEST_FAIL=72, #"漏电测试不正确" + STR_DETECT_FAIL_WHEN_POWER_ON=73, #"合闸时不能检测" + STR_LINK=74, #"联机系统" + STR_SINGLE=75, #"单机系统" + STR_STATUS=76, #"状态" + STR_MAIN_FIRST=77, #"主机优先" + STR_MAIN_BAK_SAME=78, #"主辅对等" + STR_MAIN_BAK_SWITCH=79, #"主辅轮动" + STR_SWITCH_DISABLE=80, #"局扇模式" + STR_MAIN=81, #"主机" + STR_BACKUP=82, #"备机" + STR_SINGLE_CIRCUIT_FRONT=83, #"单前机" + STR_SINGLE_CIRCUIT_NEXT=84, #"单后机" + STR_DOUBLE_CIRCUIT=85, #"双回路" + STR_WATER_PUMP_ON=86, #"水泵已开阀" + STR_WATER_PUMP_OFF=87, #"水泵已关阀" + STR_SWITCH_FAIL=88, #"粘连" + STR_SWITCH_THROUGH_2=89, #"击穿" + STR_GB_MONITOR=90, #"高压真空配电装置" + STR_GB_PROTECT_SYSTEM=91, #"综合保护监控系统" + STR_YBGY_MONITOR=92, #"移变高压侧" + STR_ERROR=93, #"故障" + STR_TEMPERATURE=94, #"温度" + STR_NEXT_CURRENT=95, #"后机电流" + STR_FRONT_CURRENT=96, #"前机电流" + STR_FJ_WS_LOCK=97, #"风机处瓦斯闭锁" + STR_GZM_WS_LOCK=98, #"工作面瓦斯闭锁" + STR_CURRENT=99, #"电流" + STR_VOLTAGE=100, #"电压" + STR_MONITOR_RES=101, #"监视电阻" + STR_SWITCH_THROUGH_SIMPLE=102, #"击穿" + STR_LINK_FAIL=103, #"联机失败" + STR_RES_OFF=104, #"漏电临界值" + STR_ANOTHER_REPAIR=105, #"另台维修请勿停机" + STR_WS_INTENSITY=106, #"瓦斯浓度" + STR_HIGH_VOLT=107, #"高压" + STR_AUTO=108, #"自动" + STR_MANUAL=109, #"手动" + STR_FREQUENCY=110, #"频率" + STR_FWD_ON=111, #正向启动 + STR_RVS_ON=112, #反向启动 + STR_TEMPERATURE_UNIT=113, #温度单位 + STR_POWER_LOSS=114, + STR_CALIBRATE_SUCCESS=115, #标定成功 + STR_ISOLATE_RES=116, #绝缘电阻 + STR_WATER_MONITOR=117, #水位控制排水监控系统 + STR_SWTICH_PROTECTOR=118, #ZDB-200电动机保护器 + STR_INDEPENDENT=119, #独立模式 + STR_DEPENDENT=120, #联动模式 + STR_OUT_POSITION=121, + STR_IN_POSITION=122, + STR_QUIT_IN_POSITION=123, + STR_RUN_DATA=124, + STR_WATER_MODE=125, + STR_INV_MODE=126, + STR_ISOLATE_RESISTOR_LOW=127, + STR_SWITCH=128, + STR_DIDAO=129, + STR_REMOTE=130, + STR_LOCAL=131, + STR_ONE_KEY_LOCK=132, + STR_COMM_FAIL=133, + +class Alarm(Enum): + ERR_NONE = 0, + ERR_CREEPAGE_LOCK = 1, #漏电报警 + ERR_VOLTAGE_LOW = 2, #欠压报警 + ERR_OVER_CURRENT = 3, #过流保护 + ERR_SHORT_CURRENT = 4, #短路保护 + ERR_CREEPAGE_SELECT = 5, #选漏 + ERR_UNBANLANCE_CURRENT = 6, #三相不平衡 + ERR_FLASH_FAIL = 7, #FLASH无法写入 + ERR_CREEPAGE_ACTIVE = 8, #漏电动作 + ERR_BREAK_PHASE = 9, #断相保护动作 + ERR_VOLTAGE_BREAK_PHASE = 10, #电压断相 + ERR_GAS_LOCK = 11, #瓦斯闭锁 + ERR_WIND_MOTOR_LOCK = 12, #风电闭锁 + ERR_VOLTAGE_OVER = 13, #过压报警 + ERR_SHORT_PHASE = 14, #相敏短路 + ERR_WATCH_DOG = 15, #看门狗保房 + ERR_SWITCH_FAIL = 16, #开关粘轿 + ERR_SWITCH_THROUGH = 17, #开关击? + ERR_SWITCH_ON_FAIL = 18, #开关合闸失? + ERR_COMM_FAIL = 19, #通讯故障 + ERR_CREEPAGE_SELECT2 = 20, #选择性报? + ERR_TEMP_IO_HIGH = 21, #IO口温度过驿 + ERR_SHORT_CURRENT_SIGNAL = 22, #信号电流短路 + ERR_REMOTE_OFF = 23, #远方分励 + ERR_REPAIR = 24, #维修状? + ERR_TEMP_ALARM = 25, #温度报警 + ERR_QUICK_CREEPAGE_ACT = 26, #快速漏电动仿 + ERR_GB_LEEK_SHORT = 27, #高爆绝缘短路 + ERR_GB_LEEK_BREAK = 28, #高爆绝缘断路 + ERR_YB_LOW_VOLTAGE_FAIL = 29, #移变低压侧失? + ERR_YB_LOW_VOLTAGE_UNREADY = 30, #移变低压侧未准备? + ERR_WS_FREQ_FAIL = 31, #瓦斯浓度超标 + ERR_HIGH_LOW_LOCK = 32, #高低压联钿 + ERR_MOTOR_ROTATE_LOCK = 33, #电机堵转 + ERR_FIX_TIME_OVER_CURRENT = 34, #定时限过泿 + ERR_FIX_TIME_SHORT_CURRENT = 35, #定时限短? + ERR_PHASE_ERROR = 36, #相序故障 + ERR_UNDER_LOAD = 37, #欠载保护 + ERR_PHASE_UNMATCH = 38, #互感器反? + ERR_EXTERNAL_ALARM = 39, #外部故障 + ERR_SENSOR_LOSS = 40, #水位传感器未? + ERR_ROTOR_SLOW = 41, + ERR_ROTOR_LOCK = 42, + ERR_POWER_LOSS = 43, #系统断电 + ERR_RSV1 = 44, + ERR_RSV2 = 45, + ERR_RSV3 = 46, + ERR_RSV4 = 47, + ERR_RSV5 = 48, + ERR_RSV6 = 49, + ERR_RSV7 = 50, + ERR_USER_ALARM1 = 51, #50,用户自定义故阿 + ERR_USER_ALARM2 = 52, #51,用户自定义故阿 + ERR_USER_ALARM3 = 53, #52,用户自定义故阿 + ERR_USER_ALARM4 = 54, #53,用户自定义故阿 + ERR_GB_LIGHT_THREAD_SON_LOSS = 55, + ERR_GB_LIGHT_THREAD_BROTHER_LOSS = 56, + ERR_GB_LIGHT_MODULE_LOSS = 57, + ERR_GB_FORCE_LEEK_OFF = 58, + ERR_GB_FORCE_SHORT_OFF = 59, + ERR_GB_CREEPAGE_SELECT = 60, #选择性报警 + ERR_SWITCH_OUT_POSITION = 61, + ERR_DZM_CREEPAGE_ACTIVE = 62, + ERR_OIL_PRESSURE_SENSOR_FAIL = 63, + ERR_FREQ_SENSOR_EXCEED = 64, + ERR_FREQ_SENSOR_FAIL = 65, + ERR_ANALOG_SENSOR_EXCEED = 66, + ERR_ANALOG_SENSOR_FAIL = 67, + ERR_VOLTAGE_LOSS = 68, + ERR_SPEED_LOSS = 69, + ERR_GB_ZERO_VOLT_OVER = 70, #零序过压 + ERR_PT_BREAK = 71, + ERR_CT_BREAK = 72, + ERR_ZERO_OVER_VOLTAGE = 73, + ERR_ZERO_OVER_CURRENT = 74, + ERR_GAS_WARNING = 75, + ERR_TEMP_WARNING = 76, + ERR_COMM_LOSS = 77, + ERR_CAR_FAIL = 78, + ERR_WATER_LOW = 79, + ERR_SWITCH_DIDAO_IN_POSITION = 80, + ERR_SWITCH_DIDAO_MID_POSITION = 81, + ERR_GB_CREEPAGE_SELECT_5 = 82, #5次谐波选漏 + ERR_FLUX_LOCK = 83, + ERR_GLOBAL_OIL_TEMP_LOCK = 84, + ERR_GLOBAL_WATER_PRESSURE_LOCK = 85, + ERR_GLOBAL_WATER_LEVEL_LOCK = 86, + ERR_GLOBAL_CURRENT_SENSOR_LOSS = 87, + ERR_GLOBAL_GAS_PERCENTAGE_LOCK = 88, + ERR_GLOBAL_GAS_SENSOR_LOSS = 89, + ERR_MEASURE_OVER_CURRENT = 90, #测量回路过流保护 + ERR_CREAPGE_BREAK = 91, + ERR_REMOTE_CREAPGE_TEST_FAIL = 92, + ERR_REMOTE_CREAPGE_TEST_SUCCESS = 93, + + + +class Alias(Enum): + alias_alarm = 0, + alias_str = 1, + alias_company = 2, + alias_bool = 3, + alias_voltage = 4, + alias_parity = 5, + alias_baud = 6, + alias_input = 7, + alias_onoff = 8, + alias_test = 9, + alias_can_baud = 10, + alias_measure_v = 11, + alias_switch_type = 12, + alias_work_mode = 13, + alias_us_phase = 14, + alias_sensor = 15, + alias_table = 16, + alias_remote = 17, + alias_current = 18, + alias_eth = 19, + alias_lcd = 20, + alias_dev = 21, + alias_fyj = 22, + alias_alarm_type = 23, + alias_car_position = 24, + +class Menu(Enum): + menu_current = 0, + menu_test = 1, + +alias_table = [ + {Alias.alias_alarm: {Alarm.ERR_NONE: "无故障", + Alarm.ERR_CREEPAGE_LOCK: "照明闭锁", + Alarm.ERR_VOLTAGE_LOW: "欠压", + Alarm.ERR_OVER_CURRENT : "照明过载", #过流保护 + Alarm.ERR_SHORT_CURRENT : "短路保护", #短路保护 + Alarm.ERR_CREEPAGE_SELECT : "选漏", #选漏 + Alarm.ERR_UNBANLANCE_CURRENT : "三相不平衡", #三相不平衡报? + Alarm.ERR_FLASH_FAIL : "FLASH无法写入", #FLASH无法写入 + Alarm.ERR_CREEPAGE_ACTIVE : "漏电动作", #漏电动作 + Alarm.ERR_BREAK_PHASE : "照明电流断相", #断相保护动作 + Alarm.ERR_VOLTAGE_BREAK_PHASE : "电压断相", #电压断相 + Alarm.ERR_GAS_LOCK : "瓦斯闭锁", #瓦斯闭锁 + Alarm.ERR_WIND_MOTOR_LOCK : "风电闭锁", #风电闭锁 + Alarm.ERR_VOLTAGE_OVER : "过压", #过压报警 + Alarm.ERR_SHORT_PHASE : "相敏短路", #相敏短路 + Alarm.ERR_WATCH_DOG : "看门狗重启", #看门狗保房 + Alarm.ERR_SWITCH_FAIL : "真空管粘连", #真空管粘连 + Alarm.ERR_SWITCH_THROUGH : "真空管击穿", #真空管击穿 + Alarm.ERR_SWITCH_ON_FAIL : "合闸失败", #合闸失败 + Alarm.ERR_COMM_FAIL : "通讯失败", #通讯失败 + Alarm.ERR_CREEPAGE_SELECT2 : "选 漏", #选 漏 + Alarm.ERR_TEMP_IO_HIGH : "温度过高", #温度过高 + Alarm.ERR_SHORT_CURRENT_SIGNAL : "信号电流短路", #信号电流短路 + Alarm.ERR_REMOTE_OFF : "远方分励", #远方分励 + Alarm.ERR_REPAIR : "维修状态", #维修状态 + Alarm.ERR_TEMP_ALARM : "温度报警", #温度报警 + Alarm.ERR_QUICK_CREEPAGE_ACT : "漏电 动作", #快速漏电 动作 + Alarm.ERR_GB_LEEK_SHORT : "绝缘短路", #绝缘短路 + Alarm.ERR_GB_LEEK_BREAK : "绝缘断路", #绝缘断路 + Alarm.ERR_YB_LOW_VOLTAGE_FAIL : "低压侧故障", #低压侧故障 + Alarm.ERR_YB_LOW_VOLTAGE_UNREADY : "低压侧未准备好", #低压侧未准备好 + Alarm.ERR_WS_FREQ_FAIL : "瓦斯浓度超标", #瓦斯浓度超标 + Alarm.ERR_HIGH_LOW_LOCK : "高低压联锁", #高低压联锁 + Alarm.ERR_MOTOR_ROTATE_LOCK : "电机堵转", #电机堵转 + Alarm.ERR_FIX_TIME_OVER_CURRENT : "定时限过流", #定时限过流 + Alarm.ERR_FIX_TIME_SHORT_CURRENT : "定时限短路", #定时限短路? + Alarm.ERR_PHASE_ERROR : "相序故障", #相序故障 + Alarm.ERR_UNDER_LOAD : "欠载保护", #欠载保护 + Alarm.ERR_EXTERNAL_ALARM : "外部故障", #外部故障 + Alarm.ERR_POWER_LOSS : "系统断电", #系统断电 + Alarm.ERR_USER_ALARM1 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_USER_ALARM2 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_GB_LIGHT_THREAD_SON_LOSS : "光纤子节点丢失", + Alarm.ERR_GB_LIGHT_THREAD_BROTHER_LOSS : "光纤兄弟节点丢失", + Alarm.ERR_GB_LIGHT_MODULE_LOSS : "无光纤模块", + Alarm.ERR_GB_FORCE_LEEK_OFF : "光纤漏电越级跳", + Alarm.ERR_GB_FORCE_SHORT_OFF : "光纤短路越级跳", + Alarm.ERR_GB_CREEPAGE_SELECT : "漏电", #选择性报警 + Alarm.ERR_SWITCH_OUT_POSITION : "开关未推到位", + Alarm.ERR_DZM_CREEPAGE_ACTIVE : "漏电动作", + Alarm.ERR_OIL_PRESSURE_SENSOR_FAIL : "油压传感器未接入", + Alarm.ERR_FREQ_SENSOR_EXCEED : "频率传感器超限", + Alarm.ERR_FREQ_SENSOR_FAIL : "频率传感器未接入", + Alarm.ERR_ANALOG_SENSOR_EXCEED : "模拟量传感器超限", + Alarm.ERR_ANALOG_SENSOR_FAIL : "模拟量传感器未接入", + Alarm.ERR_VOLTAGE_LOSS : "失压故障", + Alarm.ERR_SPEED_LOSS : "失速故障", + Alarm.ERR_GB_ZERO_VOLT_OVER : "零序过压", + Alarm.ERR_PT_BREAK : "PT断线", + Alarm.ERR_CT_BREAK : "CT断线", + Alarm.ERR_ZERO_OVER_VOLTAGE : "零序过压", + Alarm.ERR_ZERO_OVER_CURRENT : "零序过流", + Alarm.ERR_GAS_WARNING : "轻瓦斯告警", + Alarm.ERR_TEMP_WARNING : "温度异常", + Alarm.ERR_COMM_LOSS : "通讯中断", + Alarm.ERR_CAR_FAIL : "手车控制器故障", + Alarm.ERR_WATER_LOW : "循环泵无水故障", + Alarm.ERR_SWITCH_DIDAO_IN_POSITION: "地刀合闸保护中", + Alarm.ERR_SWITCH_DIDAO_MID_POSITION: "地刀未到位", + Alarm.ERR_GB_CREEPAGE_SELECT_5: "5次谐波选漏", + Alarm.ERR_FLUX_LOCK: "流量闭锁", + Alarm.ERR_GLOBAL_OIL_TEMP_LOCK: "油温闭锁", + Alarm.ERR_GLOBAL_WATER_PRESSURE_LOCK: "水压闭锁", + Alarm.ERR_GLOBAL_WATER_LEVEL_LOCK: "液位闭锁", + Alarm.ERR_GLOBAL_CURRENT_SENSOR_LOSS: "互感器未接入", + Alarm.ERR_GLOBAL_GAS_PERCENTAGE_LOCK: "瓦斯浓度闭锁", + Alarm.ERR_GLOBAL_GAS_SENSOR_LOSS: "瓦斯断线", + Alarm.ERR_MEASURE_OVER_CURRENT: "测量回路过流", + Alarm.ERR_CREAPGE_BREAK: "接地开路", + Alarm.ERR_REMOTE_CREAPGE_TEST_FAIL: "漏电测试失败", + Alarm.ERR_REMOTE_CREAPGE_TEST_SUCCESS: "漏电测试成功", + } + }, + + {"alias_str" : { StrInfo.STR_MAX_VALUE :"最大值", + StrInfo.STR_MIN_VALUE :"最小值", + StrInfo.STR_SET_VALUE :"设定值", + StrInfo.STR_VALUE_EXCEED :"设定值越界", + StrInfo.STR_ZERO_PHASE :"有功相位", + StrInfo.STR_INPUT_PASSWORD :"请输入系统密码", + StrInfo.STR_SYSTEM_PASSWORD :"系统密码", + StrInfo.STR_PASSWORD_ERR :"密码错误", + StrInfo.STR_SHORT_PHASE_MODIFY :"短路倍数\n恢复缺省", + StrInfo.STR_SWITCH_TYPE_MODIFY :"漏电延时\n恢复缺省", + StrInfo.STR_SOFT_VERSION:"软件版本", + StrInfo.STR_NO_RECORD :"无记录", + StrInfo.STR_ENTER_TO_CLEAR:"确定清除", + StrInfo.STR_ESC_TO_CANCEL:"ESC取消", + StrInfo.STR_CLEAR_FINISH :"清除成功", + StrInfo.STR_ESC_TO_EXIT :"ESC退出", + StrInfo.STR_INPUT_NEW_PASSWORD :"请设置新密码", + StrInfo.STR_NOT_POSSIBLE_TO_MODIFY :"不可修改", + StrInfo.STR_CAPACITOR_MEASURE :"电容检测", + StrInfo.STR_CAPACITOR_EQUAL :"电容", + StrInfo.STR_LEEKAGE_MEASURE :"检测中..", + StrInfo.STR_TEST_ACTIVE :"测试状态", + StrInfo.STR_POWER_ON :"合闸", + StrInfo.STR_POWER_OFF :"分闸", + StrInfo.STR_FAIL :"失效", + StrInfo.STR_NORMAL :"正常", + StrInfo.STR_MEASURE_CURRENT :"实测电流", + StrInfo.STR_RATE_CURRENT :"额定电流", + StrInfo.STR_ANGLE :"角度", + StrInfo.STR_AVERAGE_CURRENT :"平均电流", + StrInfo.STR_MAX_CURRENT :"最大电流", + StrInfo.STR_LOW_VOLTAGE_RATE :"欠压值", + StrInfo.STR_MEASURE_VOLTAGE :"实测电压", + StrInfo.STR_ZERO_CURRENT :"零序电流", + StrInfo.STR_ZERO_VOLTAGE :"零序电压", + StrInfo.STR_RECORD :"记录", + StrInfo.STR_LEEAKGE_LOCK_VALUE :"闭锁设定值", + StrInfo.STR_LEEAKGE_ACTIVE_VALUE :"动作设定值", + StrInfo.STR_MEASURE_RESISTOR :"电阻测量值", + StrInfo.STR_FRONT_CIRCUIT :"前机", + StrInfo.STR_NEXT_CIRCUIT :"后机", + StrInfo.STR_RATE_VOLTAGE :"额定电压", + StrInfo.STR_PARA_MODIFY_ERROR :"参数修改失败", + StrInfo.STR_LEEKAGE_RES_FINISH :"闭锁电阻检测完", + StrInfo.STR_LEEKAGE_RES_MEASURE :"闭锁电阻检测中", + StrInfo.STR_SFJ_MONITOR :"双风机磁力监控", + StrInfo.STR_CL_MONITOR :"磁力监控系统", + StrInfo.STR_CL_DB_MONITOR :"双回路磁力监控", + StrInfo.STR_YB_MONITOR :"移变低压侧", + StrInfo.STR_KUI_DIAN_MONITOR :"馈电开关监控", + StrInfo.STR_TYPE :"类型:", + StrInfo.STR_TOP_SWITCH :"总开关", + StrInfo.STR_BOTTOM_SWITCH :"分开关", + StrInfo.STR_COS_V :"COS(ΦaΦbΦc)", + StrInfo.STR_POWER_VI :"有功功率", + StrInfo.STR_POWER_VI_T :"电量", + StrInfo.STR_FRONT_POWER_ON :"前机合", + StrInfo.STR_NEXT_POWER_ON :"后机合", + StrInfo.STR_FRONT_POWER_OFF :"前机分", + StrInfo.STR_NEXT_POWER_OFF :"后机分", + StrInfo.STR_FRONT_RESISTOR :"前机电阻:", + StrInfo.STR_NEXT_RESISTOR :"后机电阻:", + StrInfo.STR_WORK_MODE :"模式:", + StrInfo.STR_LEEKAGE_RES :"漏电电阻", + StrInfo.STR_REVERSE_VOLTAGE :"反电动势\n注意安全", + StrInfo.STR_LIGHT :"照明", + StrInfo.STR_SIGNAL :"信号", + StrInfo.STR_SWITCH_STATUS :"开关状态", + StrInfo.STR_POWER_ON_COUNTS :"合闸次数", + StrInfo.STR_SETTING :"设定值", + StrInfo.STR_POW_U :"无功功率", + StrInfo.STR_TEST_FAIL :"测试不正确", + StrInfo.STR_LEAKAGE_TEST_FAIL :"漏电测试不正确", + StrInfo.STR_DETECT_FAIL_WHEN_POWER_ON :"合闸时不能检测", + StrInfo.STR_LINK :"联机系统", + StrInfo.STR_SINGLE :"单机系统", + StrInfo.STR_STATUS :"状态", + StrInfo.STR_MAIN_FIRST :"主机优先", + StrInfo.STR_MAIN_BAK_SAME :"主辅对等", + StrInfo.STR_MAIN_BAK_SWITCH :"主辅轮动", + StrInfo.STR_SWITCH_DISABLE :"局扇模式", + StrInfo.STR_MAIN :"主机", + StrInfo.STR_BACKUP :"备机", + StrInfo.STR_SINGLE_CIRCUIT_FRONT :"单前机", + StrInfo.STR_SINGLE_CIRCUIT_NEXT :"单后机", + StrInfo.STR_DOUBLE_CIRCUIT :"双回路", + StrInfo.STR_WATER_PUMP_ON :"水泵已开阀", + StrInfo.STR_WATER_PUMP_OFF :"水泵已关阀", + StrInfo.STR_SWITCH_FAIL :"粘连", + StrInfo.STR_SWITCH_THROUGH_2 :"击穿", + StrInfo.STR_GB_MONITOR :"高压真空配电装置", + StrInfo.STR_GB_PROTECT_SYSTEM :"综合保护监控系统", + StrInfo.STR_YBGY_MONITOR :"移变高压侧", + StrInfo.STR_ERROR :"故障", + StrInfo.STR_TEMPERATURE:"温度", + StrInfo.STR_NEXT_CURRENT :"后机电流", + StrInfo.STR_FRONT_CURRENT :"前机电流", + StrInfo.STR_FJ_WS_LOCK :"风机处瓦斯闭锁", + StrInfo.STR_GZM_WS_LOCK :"工作面瓦斯闭锁", + StrInfo.STR_CURRENT :"电流", + StrInfo.STR_VOLTAGE:"电压", + StrInfo.STR_MONITOR_RES :"监视电阻", + StrInfo.STR_SWITCH_THROUGH_SIMPLE :"击穿", + StrInfo.STR_LINK_FAIL :"联机失败", + StrInfo.STR_RES_OFF :"漏电临界值", + StrInfo.STR_ANOTHER_REPAIR :"另台维修请勿停机", + StrInfo.STR_WS_INTENSITY :"瓦斯浓度", + StrInfo.STR_HIGH_VOLT :"高压", + StrInfo.STR_AUTO :"自动", + StrInfo.STR_MANUAL :"手动", + StrInfo.STR_FREQUENCY :"频率", + StrInfo.STR_FWD_ON :"正向启动", + StrInfo.STR_RVS_ON :"反向启动", + StrInfo.STR_TEMPERATURE_UNIT : "℃", + StrInfo.STR_POWER_LOSS :"系统断电", + StrInfo.STR_CALIBRATE_SUCCESS :"标定成功", + StrInfo.STR_ISOLATE_RES :"绝缘电阻", + StrInfo.STR_WATER_MONITOR :"水位控制排水监控系统", + StrInfo.STR_SWTICH_PROTECTOR :"ZDB-200电动机保护器", + StrInfo.STR_INDEPENDENT :"独立模式", + StrInfo.STR_DEPENDENT :"联动模式", + StrInfo.STR_OUT_POSITION : "未到位", + StrInfo.STR_IN_POSITION : "进到位", + StrInfo.STR_QUIT_IN_POSITION : "退到位", + StrInfo.STR_RUN_DATA : "运行数据", + StrInfo.STR_WATER_MODE : "水位", + StrInfo.STR_INV_MODE : "可逆", + StrInfo.STR_ISOLATE_RESISTOR_LOW : "绝缘电阻降低", + StrInfo.STR_SWITCH : "开关", + StrInfo.STR_DIDAO : "地刀", + StrInfo.STR_REMOTE : "程控", + StrInfo.STR_LOCAL : "就地", + StrInfo.STR_ONE_KEY_LOCK : "闭锁中", + StrInfo.STR_COMM_FAIL : "通讯失败", + }}, + + {"alias_company": {0: "浙江志展智能科技", + 1: "华荣科技", + } + }, + {"alias_sensor" : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "1500 A", 25: "2000 A", 26: "2500 A" ,27: "4000 A", 28:"5 A"} + }, + {"alias_switch_type" : {0: "总开关", 1: "分开关"}}, + {"alias_measure_v": {0: "正电压", 1: "负电压"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"380V", 1:"660V", 2:"1140V", 3:"3300V", 4:"100V", 5:"127V", 6:"220V", 7:"440V"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_input": {0: "常开", 1: "常闭"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_test": {0: "模拟测试", 1: "继电器测试"}}, + {"alias_can_baud": {0: "1000K", 1: "800K", 2: "500K", 3: "250K", 4: "125K", 5: "100K", 6: "50K", 7: "20K", 8: "10K", 9: "AUTO"}}, + {Alias.alias_measure_v: {0: "正电压", 1: "负电压"}}, + {Alias.alias_switch_type : {0: "总开关", 1: "分开关"}}, + {"alias_work_mode": {0: "水位模式", 1: "磁力模式", 2: "正反转模式", 3: "联控模式"}}, + {"alias_us_phase": {0: "Uab_ABC", 1: "Uab_ACB", 2: "Ubc_ABC", 3: "Ubc_ACB", 4: "Uca_ABC", 5: "Uca_ACB"}}, + {Alias.alias_sensor : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "2500 A", 25: "5 A"}}, + {"alias_table": {0: "0", 1: "1", 2: "2", 3: "3"}}, + {"alias_remote": {0: "就地", 1: "程控"}}, + {"alias_current": {0: "三相测量", 1: "两相平均", 2: "两相测量"}}, + + {Alias.alias_eth : {0: "无", 1: "一代以太网", 2: "二代以太网"}}, + {Alias.alias_lcd : {0: "一体迪文屏", 1: "分体迪文屏", 2: "大彩屏", 3 : "昆仑通态屏"}}, + {Alias.alias_fyj : {0: "无", 1: "FYJ", 2: "FYJ2", 3 : "FYJ4"}}, + {Alias.alias_dev : {0: "馈电", 1: "高爆", 2: "移变", 3 : "双风机", 4 : "磁力", + 5 : "双磁力", 6 : "照明", 7 : "移变高压侧", 8: "双高爆", + 9: "组合馈电", 10: "双照明", 11 : "ZZ630"}}, + {"alias_alarm_type": {0: "试验", 1: "动作"}}, + {"alias_car_position": {0: "小车未到位", 1 : "小车试验位", 2: "小车工作位", 3 : "位置信号异常"}}, +] + +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + + +def get_alias_value_str(alias_str, alias_value) : + alias_value_msg = None + compare_value = int(alias_value) + + for alias_dict in alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + if alias_name == alias_str : + for each_value_dict in value_dict.items(): + if isinstance(each_value_dict[0], Enum) : + key_value = each_value_dict[0].value[0] + else : + key_value = each_value_dict[0] + key_string = each_value_dict[1] + + if int(key_value) == compare_value : + alias_value_msg = key_string + return alias_value_msg + return alias_value_msg + +def func_adjust_current_menu_item(device : class_modbus_comm_device, menu_item) : + #获得互感器类型, 根据互感器类型来调整 scale, format, 让电流可以正确显示与设置 + sensor_type = device.comm_get_value_from_mqtt_name("Sensor") + sensor_current = 400 + + if sensor_type != None : + value_str = get_alias_value_str("alias_sensor", sensor_type) + if value_str != None : + value_str_no_unit = value_str.replace("A", "") + sensor_current = int(value_str_no_unit) + + #80A 以下电流互感器, 显示一位小数点 + if sensor_current <= 80 : + new_item = menu_item + new_item["scale"] = 0.1 + new_item["format"] = "%1.1f" + return new_item + else : + return menu_item + +# def func_caculate_Is(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : +# format_str = utils.dict_or_object_get_attr(menu_item, "format", "%4.2f") +# try : +# Ia = device.comm_get_value_from_mqtt_name("Ia") +# Ib = device.comm_get_value_from_mqtt_name("Ib") +# Ic = device.comm_get_value_from_mqtt_name("Ic") +# Is = (Ia + Ib + Ic) / 3 +# except Exception as e : +# Is = 0.00 +# Is_str = format_str%(Is) +# mqtt_dict["Is"] = Is_str + +#视频触发 +def func_video_trigger(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + value = device.comm_get_value_from_menu_item(menu_item) + if value == None : + #通讯未建立 + return + + value = round(value) + in_position = (value >> 10) & 0x1 + out_position = (value >> 9) & 0x1 + now_time = time.time() + if hasattr(device, "MqttVideoActive") == False: + #动态添加视频触发所需的变量 + device.MqttVideoActive = False + device.MqttVideoBaseTime = now_time + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + if in_position != device.DI_SwitchInPosition or out_position != device.DI_SwitchQuitPosition: + #开关进到位与 开关退到位信号, 当这两个状态发生变化时, 触发20秒的视频 + device.MqttVideoActive = True + device.MqttVideoBaseTime = now_time + mqtt_dict["VideoActive"] = "1" + if device.MqttVideoActive : + #视频延时20后主动关闭视频显示 + if now_time - device.MqttVideoBaseTime > 20.0 : + mqtt_dict["VideoActive"] = "0" + device.MqttVideoActive = False + + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + +COLOR_RED = "#EE2D2D" +COLOR_GREEN = "#83BF6E" + +def func_process_car_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + car_pos_value = device.comm_get_value_from_menu_item(menu_item) + if car_pos_value == None or mqtt_dict == None: + return + car_msg = get_alias_value_str("alias_car_position", car_pos_value) + if car_msg != None : + mqtt_dict["CarPositionMsg"] = car_msg + +def func_process_alarm_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + alarm_id = device.comm_get_value_from_menu_item(menu_item) + if alarm_id == None or mqtt_dict == None: + #通讯未建立 + return + alarm_msg = get_alias_value_str("alias_alarm", alarm_id) + if alarm_msg != None : + alarm_msg_dict = {} + if alarm_id > 0 : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_RED + else : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_GREEN + + mqtt_dict["AlarmMessage"] = alarm_msg_dict + +mqtt_video_trigger = [ + { + "name": "视频触发", + "addr": "8015", + "call" : func_video_trigger, + }, +] + +mqtt_time_update = [ + { + "name": "Year", + "addr": "2300", + "format" : "%04.0f", + "mqtt" : "Year", + }, + { + "name": "Month", + "addr": "2301", + "format" : "%02.0f", + "mqtt" : "Month", + }, + { + "name": "Day", + "addr": "2302", + "format" : "%02.0f", + "mqtt" : "Day", + }, + { + "name": "Hour", + "addr": "2303", + "format" : "%02.0f", + "mqtt" : "Hour", + }, + { + "name": "Minute", + "addr": "2304", + "format" : "%02.0f", + "mqtt" : "Minute", + }, + { + "name": "Second", + "addr": "2305", + "format" : "%02.0f", + "mqtt" : "Second", + }, + { + "name": "SetupTime", + "addr": "2305", + "mqtt" : "SetupTime", + "action" : "SetupTime", + }, +] + +mqtt_pack_param = [ + #电流参数 + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "scale" : 1.0, + "format": "%04.0f", + "action": "rate_current", + "mqtt" : "RateCurrent", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.00, + "max" : 10.00, + "mqtt" : "ShortLevel", + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 300.0, + "mqtt" : "ShortDelay", + }, + { + "name": "信号Ie", + "unit": "A", + "addr": "8600", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "CurrentIs", + }, + { + "name": "信号短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8601", + "mqtt" : "ShortIs", + }, + { + "name": "Is 校正", + "unit": "%", + "scale" : 0.1, + "format": "%04.2f", + "addr": "8602", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIs", + }, + { + "name": "互感器类型", + "alias" :"alias_sensor", + "addr": "8207", + "mqtt" : "Sensor", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + "mqtt" : "CurrentB" + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + "mqtt" : "UnbalanceDelay", + }, + { + "name": "不平衡范围", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10, + "max" : 99, + "mqtt" : "UnbalanceLevel", + }, + { + "name": "定时限过流", + "unit": "Ie", + "addr": "8239", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeOvercurrent", + }, + { + "name": "定时限过流延时", + "unit": "ms", + "addr": "8240", + "scale" : 1, + "format": "%05.0f", + "mqtt" : "TimeOvercurrentDelay", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIc", + }, + #电压参数 + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "mqtt" : "RateVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayLowVoltage", + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 10.0, + "max" : 100.0, + "mqtt" : "PercentLowVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayHighVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 200.0, + "mqtt" : "PercentHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUs", + }, + + + #漏电参数 + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "BlockResistor" + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "SeriesResistor" + }, + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "mqtt" : "LeakageDelay", + }, + #保护参数投入 + { + "name": "短路保护", + "alias": "alias_bool", + "addr": "8192.1", + "mqtt" : "ProtectShort", + }, + { + "name": "过载保护", + "alias": "alias_bool", + "addr": "8192.3", + "mqtt" : "ProtectOverLoad", + }, + { + "name": "电流断相保护", + "alias": "alias_bool", + "addr": "8192.4", + "mqtt" : "ProtectCurrentPhaseOff", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + "mqtt" : "ProtectImbalance", + }, + { + "name": "漏电闭锁保护", + "alias": "alias_bool", + "addr": "8192.10", + "mqtt" : "ProtectLeakage" + }, + { + "name": "定时限过载保护", + "alias": "alias_bool", + "addr": "8192.11", + "mqtt" : "ProtectTimeLimitOverload" + }, + { + "name": "定时限短路保护", + "alias": "alias_bool", + "addr": "8192.12", + "mqtt" : "ProtectTimeLimitShortCircuit", + }, + { + "name": "信号短路保护", + "alias": "alias_bool", + "addr": "8175.15", + "mqtt" : "ProtectIsShort", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + "mqtt" : "ProtectUnderVoltage", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + "mqtt" : "ProtectOverVoltage", + }, + { + "name": "电压断相保护", + "alias": "alias_bool", + "addr": "8174.2", + "mqtt" : "ProtectVoltagePhaseOff", + }, + { + "name": "漏电动作保护", + "alias": "alias_bool", + "addr": "8174.6", + "mqtt" : "ProtectLeakageAction", + }, + { + "name": "温度报警保护", + "alias": "alias_bool", + "addr": "8174.8", + "mqtt" : "ProtectTemperatureAlarm", + }, + #系统设置 + { + "name": "瓦斯触点", + "addr": "8190", + "alias" : "alias_input", + "mqtt" : "Gas", + }, + { + "name": "瓦斯延时", + "addr": "8191", + "scale" : 0.01, + "format": "%06.2f", + "min" : 0.00, + "max" : 60.00, + "mqtt" : "GasDelay", + }, + { + "name": "瓦斯浓度", + "addr": "8237", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "GasConcentration", + }, + { + "name": "风电触点", + "addr": "8248", + "alias" : "alias_input", + "mqtt" : "Fan", + }, + { + "name": "风电延时", + "addr": "8234", + "scale" : 0.01, + "format": "%06.2f", + "min" : 0.00, + "max" : 60.00, + "mqtt" : "FanDelay", + }, + { + "name": "远近控模式", + "addr": "8558", + "alias" : "alias_remote", + "mqtt" : "FarAndNearMode", + }, + { + "name": "维修模式", + "addr": "8565", + "alias" : "alias_bool", + "mqtt" : "MaintenanceMode", + }, + { + "name": "小车报警延时", + "addr": "8576", + "scale" : 0.1, + "format": "%05.1f", + "mqtt" : "CarAlarmDelay", + }, + { + "name": "温度设定", + "addr": "8423", + "scale" : 1, + "format": "%03.0f", + "mqtt" : "Temperature", + }, + #通讯设置 + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + "mqtt" : "485Address", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + "mqtt" : "485Baud", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + "mqtt" : "485Parity", + }, + { + "name": "CAN地址", + "format": "%03.0f", + "addr": "8440", + "mqtt" : "CANAddress", + }, + { + "name": "CAN波特率", + "alias": "alias_can_baud", + "addr": "8439", + "mqtt" : "CANBaud", + }, +] + +mqtt_pack_measure = [ + { + "name": "SwitchStatus", + "addr": "8162.0", + "alias": Alias.alias_onoff, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_STATUS, + "measure" : True, + "mqtt" : "SwitchStatus", + }, + { + "name": "AlarmId", + "addr": "8166", + "alias": Alias.alias_alarm, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_ALARM, + "measure" : True, + "mqtt" : "AlarmId", + }, + { + "name": "AlarmMessage", + "addr": "8166", + "alias": Alias.alias_alarm, + "call" : func_process_alarm_message, + }, + { + "name": "CarPositionMsg", + "addr": "8015.10#2", + "alias": Alias.alias_car_position, + "call" : func_process_car_message, + }, + { + "name": "Ia", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Ia", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "unit": "A", + "addr": "8157", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IB, + "measure" : True, + "mqtt" : "Ib", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "unit": "A", + "addr": "8158", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IC, + "measure" : True, + "mqtt" : "Ic", + "adjust" : func_adjust_current_menu_item, + }, + # { + # "name": "Is", + # "unit": "A", + # "addr": "8142", + # "format": "%05.2f", + # "measure" : True, + # "mqtt" : "Is", + # "adjust" : func_adjust_current_menu_item, + # }, + { + "name": "Voltage", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Voltage", + }, + { + "name": "Current", + "unit": "A", + "addr": "8156", + "scale":0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + # "adjust" : func_adjust_current_menu_item, + "mqtt" : "Current", + }, + { + "name": "Power", + "unit": "kw", + "addr": "8167", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Power", + }, + { + "name": "Electricity", + "unit": "kwh", + "addr": "8160#2", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Electricity", + }, + { + "name": "Uab", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Uab", + }, + { + "name": "Ubc", + "unit": "V", + "addr": "8154", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UBC, + "measure" : True, + "mqtt" : "Ubc", + }, + { + "name": "Uca", + "unit": "V", + "addr": "8155", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UCA, + "measure" : True, + "mqtt" : "Uca", + }, + # { + # "name": "Uo", + # "unit": "V", + # "addr": "8152", + # "format": "%05.1f", + # "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UO, + # "measure" : True, + # "mqtt" : "Uo", + # }, + # { + # "name": "Io", + # "unit": "mA", + # "addr": "8151", + # "format": "%05.1f", + # "scale" : 1.0, + # "remap_addr" : remap.COMM_REMAP_MEASURE_FLOAT_IO, + # "measure" : True, + # "mqtt" : "Io", + # }, + { + "name": "Ro", + "unit": "K", + "addr": "8150", + "scale": 0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_RO, + "measure" : True, + "mqtt" : "Ro", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%06.0f", + "property": MENU_PROPERTY_READ_ONLY, + "mqtt" : "OnCount", + }, + + # { + # "name": "Is", + # "addr": "8171", + # "scale": 0.01, + # "format": "%04.2f", + # "measure" : True, + # "call" : func_caculate_Is, + # }, +] +mqtt_pack_globalmeasure = [ + # { + # "name": "A相上触头", + # "addr": "8056#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "A_up", + # }, + + # { + # "name": "B相上触头", + # "addr": "8057#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "B_up", + # }, + # { + # "name": "C相上触头", + # "addr": "8058#s", + # "scale": 0.1, + # "format": "%05.1f", + # "glboalmeasure" : True, + # "mqtt" : "C_up", + # }, + # { + # "name": "A相下触头1", + # "addr": "8059#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "A1_down", + # }, + # { + # "name": "B相下触头1", + # "addr": "8060#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "B1_down", + # }, + # { + # "name": "C相下触头1", + # "addr": "8061#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "C1_down", + # }, + # { + # "name": "A相下触头2", + # "addr": "8051#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "A2_down", + # }, + + # { + # "name": "B相下触头2", + # "addr": "8052#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "B2_down", + # }, + # { + # "name": "C相下触头2", + # "addr": "8053#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "C2_down", + # }, + # { + # "name": "A相下触头3", + # "addr": "8045#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "A3_down", + # }, + # { + # "name": "B相下触头3", + # "addr": "8046#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "B3_down", + # }, + # { + # "name": "C相下触头3", + # "addr": "8047#s", + # "scale": 0.1, + # "format": "%05.1f", + # "globalmeasure" : True, + # "mqtt" : "C3_down", + # }, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmCode", + "addr": "8121", + "alias": "alias_alarm", + "mqtt" : "AlarmCode", + }, + { + "name": "AlarmTest", + "addr": "8138", + "alias": "alias_alarm_type", + "format" : "%1.0f", + "mqtt" : "AlarmTest", + }, + { + "name": "Ua", + "addr": "8122", + "format" : "%1.0f", + "mqtt" : "AlarmUa", + }, + { + "name": "Ub", + "addr": "8123", + "format" : "%1.0f", + "mqtt" : "AlarmUb", + }, + { + "name": "Uc", + "addr": "8124", + "format" : "%1.0f", + "mqtt" : "AlarmUc", + }, + { + "name": "Ia", + "addr": "8125", + "format" : "%1.0f", + "mqtt": "AlarmIa", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "addr": "8126", + "format" : "%1.0f", + "mqtt": "AlarmIb", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "addr": "8127", + "format" : "%1.0f", + "mqtt": "AlarmIc", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ro", + "addr": "8128", + "format" : "%5.1f", + "scale" : 0.1, + "mqtt": "AlarmRo", + }, + { + "name": "Is", + "addr": "8142", + "format": "%05.2f", + "mqtt" : "AlarmIs", + "adjust" : func_adjust_current_menu_item, + }, + # { + # "name": "Io", + # "addr": "8129", + # "format" : "%1.1f", + # "scale" : 0.1, + # "mqtt": "AlarmIo", + # }, + # { + # "name": "Uo", + # "addr": "8130", + # "format" : "%5.0f", + # "scale" : 1.0, + # "mqtt": "AlarmUo", + # }, + { + "name": "Year", + "addr": "8131", + "format" : "%4.0f", + "mqtt": "AlarmYear", + }, + { + "name": "Month", + "addr": "8132", + "format" : "%2.0f", + "mqtt": "AlarmMonth", + }, + { + "name": "Day", + "addr": "8133", + "format" : "%2.0f", + "mqtt": "AlarmDay", + }, + { + "name": "Hour", + "addr": "8134", + "format" : "%2.0f", + "mqtt": "AlarmHour", + }, + { + "name": "Minute", + "addr": "8135", + "format" : "%2.0f", + "mqtt": "AlarmMinute", + }, + { + "name": "Second", + "addr": "8136", + "format" : "%2.0f", + "mqtt": "AlarmSecond", + }, +] + +menu_data = [ + { + "name": "数据页面", + "sub_menu": "menu_curve_physical", + }, +] + +#曲线菜单 +menu_curve_physical = [ + { + "name": "物理曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#曲线菜单 +menu_curve_adc = [ + { + "name": "ADC曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#谐波菜单 +menu_curve_harmonic = [ + { + "name": "谐波曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +modbus_comm_table = [ + {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, + {"name":"measure", "reg_addr":8000, "reg_count":50, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, + {"name":"globalmeasure","reg_addr":8050, "reg_count":20, "cycle": 500, "mqtt_pack": mqtt_pack_globalmeasure}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, + #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, + # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000, "mqtt_pack": mqtt_time_update}, + {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, + {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, + {"name":"param/info", "reg_addr":8490, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8520, "reg_count":20, "cycle": 3000}, + {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, + {"name":"param/info", "reg_addr":8435, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8420, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, + {"name":"param/info", "reg_addr":8595, "reg_count":10, "cycle": 3000}, + +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + if not hasattr(comm_table_item, "name"): + return False + return False + +menu_current = [ #菜单表[menu_current],存储菜单项属性字典<> + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "action": "rate_current", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + #"mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" : Alias.alias_sensor, + "addr": "8207", + }, + # { + # "name": "反时限表", + # "alias" :"alias_table", + # "addr": "8178", + # }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + #"mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + #"mqtt" : "UnbalanceDelay", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIc", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_voltage = [ + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "default": 0, + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + #"mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + #"mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUs", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm_display = [ + { + "name": "当前故障", + "action" : "Idle", + }, +] + +menu_alarm_curve = [ + { + "name": "录波曲线", + "action" : "Idle", + }, +] + +menu_alarm_history = [ + { + "name": "故障查询", + "action" : "Idle", + }, +] + +menu_alarm = [ + { + "name": "故障查询", + "sub_menu": "menu_alarm_history", + }, + { + "name": "故障清除", + "action": "alarm_clear", + }, + { + "name": "合闸清零", + "action": "clear_oncount", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + #"mqtt" : "OnCount", + }, + { + "name": "电量清除", + "action": "clear_kwh", + }, + { + "name": "累计时间清除", + "action": "clear_time", + }, + { + "name": "累计合闸时间", + "addr": "8016#2", + "unit": "Min", + "scale": 0.0166666666666667, + "format": "%07.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_test = [ + { + "name": "短路试验", + "action": "test", + "addr" : "100628", + "mqtt" : "TestShort", + }, + { + "name": "漏电试验", + "action": "test", + "addr" : "100629", + "mqtt" : "TestIsolation", + }, + { + "name": "过压试验", + "action": "test", + "addr" : "100641", + "mqtt" : "TestOverVoltage", + }, + { + "name": "电流断相试验", + "action": "test", + "addr" : "100642", + "mqtt" : "TestBreak", + }, + + { + "name": "复归", + "action": "test", + "addr" : "100649", + "mqtt" : "TestRecover", + }, + + { + "name": "漏电试验配置", + "alias" : "alias_test", + "addr": "8265", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_protect_set = [ + { + "name": "短路保护", + "alias": Alias.alias_bool, + "addr": "8192.1", + #"mqtt" : "ProtectShort", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + #"mqtt" : "ProtectUnbalance", + }, + { + "name": "反时限过流", + "alias": "alias_bool", + "addr": "8192.3", + #"mqtt" : "ProtectOverCurrent", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + #"mqtt" : "ProtectHighVotage", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + #"mqtt" : "ProtectLowVotage", + }, + # { + # "name": "电压断相", + # "alias": "alias_bool", + # "addr": "8174.2", + # }, + # { + # "name": "相序保护", + # "alias": "alias_bool", + # "addr": "8174.3", + # }, + { + "name": "漏电闭锁", + "alias": "alias_bool", + "addr": "8192.10", + #"mqtt" : "ProtectIsolationLock", + }, + { + "name": "漏电动作", + "alias": "alias_bool", + "addr": "8174.6", + #"mqtt" : "ProtectIsolationAction", + }, + # { + # "name": "选漏保护", + # "alias": "alias_bool", + # "addr": "8174.7", + # }, + { + "name": "风电闭锁", + "alias": "alias_bool", + "addr": "8175.0", + #"mqtt" : "ProtectWindMotor", + }, + { + "name": "瓦斯闭锁", + "alias": "alias_bool", + "addr": "8174.13", + #"mqtt" : "ProtectGasLock", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_comm_set = [ + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + }, + # { + # "name": "CAN地址", + # }, + # { + # "name": "CAN波特率", + # "alias": "alias_can_baud", + # }, + { + "name": "IP设置", + "addr": "8271#2", + "action": "ip", + }, + { + "name": "IP网关", + "addr": "8273#2", + "action": "ip", + }, + { + "name": "IP掩码", + "addr": "8275#2", + "action": "ip", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "工作模式", + "addr": "8231", + "alias": "alias_work_mode", + "property": MENU_PROPERTY_ENGINEER, + "action" : "Visible_CL", #磁力模式显示菜单 + }, + { + "name": "开关类型", + "alias": "alias_switch_type", + "addr": "8210", + "action" : "Visible_KD", #馈电模式显示菜单 + }, + { + "name": "控制模式", + "alias": "alias_remote", + "addr": "8262", + }, + { + "name": "瓦斯触点", + "alias": "alias_input", + "addr": "8190", + }, + { + "name": "瓦斯延时", + "unit": "S", + "addr": "8191", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "风电触点", + "alias": "alias_input", + "addr": "8248", + }, + { + "name": "风电延时", + "unit": "S", + "addr": "8234", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "高水位延时", + "addr": "8267", + "unit": "S", + "scale": 0.1, + "format": "%04.1f", + "action" : "Visible_CL_WATER", #水位磁力模式显示 + }, + { + "name": "正反转延时", + "addr": "8266", + "unit": "ms", + "scale": 1.0, + "format": "%04.0f", + "action" : "Visible_CL_INV", #正反转磁力模式显示 + }, + { + "name": "维修模式", + "addr": "8260", + "alias": "alias_bool", + }, + # { + # "name": "温度设定", + # "unit": "℃", + # "addr": "2030", + # "format": "%+03.0f", + # }, + { + "name": "系统日期", + "addr": "2300#3", + "action": "date", + }, + { + "name": "当前时间", + "addr": "2303#3", + "action": "time", + }, + { + "name": "软件版本", + "addr": "8180", + "unit" : VERSION_DATE, + "scale": 0.01, + "format": "%.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统密码", + "addr": "8181", + "format": "%04.0f", + "action": "password", + }, + { + "name": "Us相位", + "alias": "alias_us_phase", + "addr": "8269", + }, + { + "name": "重启", + "action": "restart", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_switch_cmd = [ + { + "name": "通讯合闸", + "action": "write_bit", + "addr" : "100618", + "mqtt" : "SwitchOn", + }, + { + "name": "通讯分闸", + "action": "write_bit", + "addr" : "100619", + "mqtt" : "SwitchOff", + }, + { + "name": "通讯复位", + "action": "write_bit", + "addr" : "100620", + "mqtt" : "SwitchRst", + }, + { + "name": "小车进控制", + "action": "write_bit", + "addr" : "100636", + "mqtt" : "CarForward", + }, + { + "name": "小车退控制", + "action": "write_bit", + "addr" : "100637", + "mqtt" : "CarRetreat", + }, + +] + +memu_setting = [ + { + "name": "电流设置", + "sub_menu": Menu.menu_current, + }, + { + "name": "电压设置", + "sub_menu": "menu_voltage" + }, + { + "name": "漏电设置", + "sub_menu": "menu_leak" + }, + { + "name": "系统设置", + "sub_menu": "menu_system" + }, + { + "name": "保护设置", + "sub_menu": "menu_protect_set" + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set" + }, + { + "name": "保护试验", + "sub_menu": Menu.menu_test #"menu_test" + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm" + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_leak = [ + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + #"mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + #"mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "A", + "scale" : 0.01, + "format" : "%05.2f", + "mqtt" : "GB.Io", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%05.2f", + "mqtt" : "GB.Uo", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0 + }, + { + "name": "检测电压", + "addr": "8253", + "alias": Alias.alias_measure_v, + }, + { + "name": "退出", + "action": "exit", + }, +] + +calibrate = [ + { + "name": "999校正", + "action": "calibrate999", + "mqtt" : "Calibrate999", + }, + { + "name": "0欧校正", + "action": "calibrate0", + "mqtt" : "Calibrate0", + }, + { + "name": "以太网模块", + "alias": Alias.alias_eth, + "addr" : "8280", + }, + { + "name": "LCD模块", + "alias": Alias.alias_lcd, + "addr" : "8281", + }, + { + "name": "防越级模块", + "alias": Alias.alias_fyj, + "addr" : "8282", + }, + { + "name": "设备型号", + "alias": Alias.alias_dev, + "addr" : "8270", + }, + { + "name": "退出", + "action": "exit", + }, +] + +startup = [ + { + "name": "退出", + }, +] + +menu_main = [ + { + "name": "设置", + "sub_menu": "memu_setting", + }, + { + "name": "数据", + "sub_menu": "menu_data", + }, + { + "name": "报警", + "sub_menu": "menu_alarm_display", + }, + { + "name": "标定", + "sub_menu": "calibrate", + "property": MENU_PROPERTY_ENGINEER, + }, +] + +mqtt_topic_subscribe = None + +MENU_STARTUP_PAGE = 150 +MENU_DISPLAY_PAGE = 2 +MENU_ALARM_PAGE = 3 +MENU_DATA_PAGE = 120 +MENU_CL_MAIN_PAGE = 90 +MENU_KD_MAIN_PAGE = 20 +MENU_KD_MAIN_PAGE_LANGUAGE = 21 +MENU_CURVE_PAGE = 10 +MENU_ADC_CURVE_PAGE = 18 +MENU_HARNOMIC_CURVE_PAGE = 19 + +menu_caption = [ + {"name" : "startup", "menu" : startup, "caption": "启动页面", "page" : MENU_STARTUP_PAGE, "max_items" : 1}, + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : MENU_KD_MAIN_PAGE, "max_items" : 4}, + {"name" : "menu_leak", "menu" : menu_leak, "caption": "漏电设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "memu_setting", "menu" : memu_setting, "caption": "参数设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_current", "menu" : menu_current, "caption": "电流设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_voltage", "menu" : menu_voltage, "caption": "电压设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "故障查询", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm_display", "menu" : menu_alarm_display, "caption": "当前故障", "page" : MENU_ALARM_PAGE, "prev": menu_alarm_curve, "next": menu_alarm_curve, "max_items" : 1}, + {"name" : "menu_alarm_curve", "menu" : menu_alarm_curve, "caption": "曲线故障", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_alarm_display, "next": menu_alarm_display, "max_items" : 1}, + + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "故障查询", "page" : MENU_ALARM_PAGE, "max_items" : 1}, + {"name" : "menu_test", "menu" : menu_test, "caption": "保护试验", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_measure", "menu" : mqtt_pack_measure, "caption": "测量数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_data", "menu" : menu_data, "caption": "数据页面", "page" : MENU_DATA_PAGE, "max_items" : 8}, + {"name" : "menu_curve_physical", "menu" : menu_curve_physical, "caption": "物理曲线", "page" : MENU_CURVE_PAGE, "prev": menu_curve_harmonic, "next": menu_curve_adc, "max_items" : 8}, + {"name" : "menu_curve_adc", "menu" : menu_curve_adc, "caption": "ADC曲线", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_curve_physical, "next": menu_curve_harmonic, "max_items" : 8}, + {"name" : "menu_curve_harmonic", "menu" : menu_curve_harmonic, "caption": "谐波曲线", "page" : MENU_HARNOMIC_CURVE_PAGE, "prev": menu_curve_adc, "next": menu_curve_physical, "max_items" : 8}, + {"name" : "calibrate", "menu" : calibrate, "caption": "标定页面", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_switch_cmd", "menu" : menu_switch_cmd, "caption": "通讯操作", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_param", "menu" : mqtt_pack_param, "caption": "参数刷新", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_video_trigger", "menu" : mqtt_video_trigger, "caption": "视频触发", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_globalmeasure", "menu" : mqtt_pack_globalmeasure, "caption": "测温数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_time_update", "menu" : mqtt_time_update, "caption": "时钟设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, +] + + +# mqtt 故障查询函数 +def func_alarm_query(device : class_modbus_comm_device, alarm_index = 0) : + result = device.protocol.modbus_write_regs(device.comm_addr, 8120, 1, alarm_index) + time.sleep(0.05) + alarm_regs = device.protocol.modbus_read_regs(device.comm_addr, 8121, 20) + if alarm_regs != None : + device.modbus_regs_flush(8121, 20, alarm_regs) + + msg_alarm_dict = device.comm_item_trigger_mqtt_pack(mqtt_pack_alarm) + + err_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmCode", 0) + err_code = int(err_code) + test_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmTest", 0) + test_code = int(test_code) + + + test_value_str = get_alias_value_str("alias_alarm_type", test_code) + if test_value_str == None: + test_value_str = " " + err_code_str = get_alias_value_str("alias_alarm", err_code) + if err_code_str == None: + err_code_str = " " + msg_alarm_dict["AlarmCodeMsg"] = err_code_str + msg_alarm_dict["AlarmTestMsg"] = test_value_str + msg_alarm_dict["index"] = alarm_index + msg : str = json.dumps(msg_alarm_dict, ensure_ascii=False) + + if device.mqtt_thread : + device.mqtt_thread.publish("response/alarm/" + device.unique_name, msg) + +# mqtt action处理函数 +def func_action_process(device : class_modbus_comm_device, menu_item = None, value_str : str = None) : + action_str = utils.dict_or_object_get_attr(menu_item, "action", " ") + mqtt_name = utils.dict_or_object_get_attr(menu_item, "mqtt", " ") + result = None + + if action_str == "SetupTime" : #设置保护器时间 + numbers = re.findall(r'\d+', value_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + device.protocol.modbus_write_regs(device.comm_addr, 2300, 6, (year, month, day, hour, minute, second)) + pass + if action_str == "calibrate999" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2007) + if action_str == "calibrate0" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2006) + if action_str == "write_bit" or action_str == "test": + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", " ") + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if reg_count == 1: + command_value = [1] + result = device.write_bit_register(reg_addr, command_value) + + if device.mqtt_thread and result != None: + device.mqtt_thread.publish("response/action/" + device.unique_name, '{"name" : "%s", "result" : %d}'%(mqtt_name, result)) + + +class class_menu_comm_device_config(class_comm_device_config): + def __init__(self): + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_top + def get_menu_top(self) : + return menu_main + + def get_menu_caption_info(self) : + return menu_caption + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + def is_gb2312(self) : + return False + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_menu_comm_device_config() diff --git a/menu_light_7_inch.py b/menu_light_7_inch.py new file mode 100644 index 0000000..bf1d60d --- /dev/null +++ b/menu_light_7_inch.py @@ -0,0 +1,2491 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_utils as uitls +from enum import Enum +from datetime import datetime +import time +import menu_utils as utils +import json +import re +from enum import Enum +from comm_modbus_device import class_modbus_comm_device + +now_time = datetime.now() +current_time = now_time.strftime("(%y/%m/%d)") +VERSION_DATE = current_time + +class StrInfo(Enum): + STR_MAX_VALUE = 0, #"最大值" + STR_MIN_VALUE = 1, #"最小值" + STR_SET_VALUE = 2, #"设定值" + STR_VALUE_EXCEED = 3, #"设定值越界" + STR_ZERO_PHASE = 4, #"有功相位" + STR_INPUT_PASSWORD = 5, #"请输入系统密码 + STR_SYSTEM_PASSWORD = 6, #"系统密码" + STR_PASSWORD_ERR = 7, #"密码错误" + STR_SHORT_PHASE_MODIFY =8, #"短路倍数\n恢复缺省" + STR_SWITCH_TYPE_MODIFY =9, #"漏电延时\n恢复缺省" + STR_SOFT_VERSION =10, #"软件版本" + STR_NO_RECORD =11, #"无记录" + STR_ENTER_TO_CLEAR =12, #"确定清除" + STR_ESC_TO_CANCEL =13, #"ESC取消" + STR_CLEAR_FINISH =14, #"清除成功" + STR_ESC_TO_EXIT =15, #"ESC退出 + STR_INPUT_NEW_PASSWORD =16, #"请设置新密码" + STR_NOT_POSSIBLE_TO_MODIFY =17, #"不可修改" + STR_CAPACITOR_MEASURE =18, #"电容检测 + STR_CAPACITOR_EQUAL =19, #"电容" + STR_LEEKAGE_MEASURE =20, #"检测中.." + STR_TEST_ACTIVE =21, #"测试状态 + STR_POWER_ON=22, #"合闸" + STR_POWER_OFF=23, #"分闸" + STR_FAIL=24, #"失效" + STR_NORMAL=25, #"正常" + STR_MEASURE_CURRENT=26, #"实测电流" + STR_RATE_CURRENT=27, #"额定电流" + STR_ANGLE=28, #"角度" + STR_AVERAGE_CURRENT=29, #"平均电流" + STR_MAX_CURRENT=30, #"最大电流 + STR_LOW_VOLTAGE_RATE=31, #"欠压值 + STR_MEASURE_VOLTAGE=32, #"实测电压" + STR_ZERO_CURRENT=33, #"零序电流" + STR_ZERO_VOLTAGE=34, #"零序电压" + STR_RECORD=35, #"记录" + STR_LEEAKGE_LOCK_VALUE=36, #"闭锁设定值" + STR_LEEAKGE_ACTIVE_VALUE=37, #"动作设定值" + STR_MEASURE_RESISTOR=38, #"电阻测量值" + STR_FRONT_CIRCUIT=39, #"前机" + STR_NEXT_CIRCUIT=40, #"后机" + STR_RATE_VOLTAGE=41, #"额定电压" + STR_PARA_MODIFY_ERROR=42, #"参数修改失败" + STR_LEEKAGE_RES_FINISH=43, #"闭锁电阻检测完" + STR_LEEKAGE_RES_MEASURE=44, #"闭锁电阻检测中" + STR_SFJ_MONITOR=45, #"双风机磁力监控" + STR_CL_MONITOR=46, #"磁力监控系统" + STR_CL_DB_MONITOR=47, #"双回路磁力监控" + STR_YB_MONITOR=48, #"移变低压侧" + STR_KUI_DIAN_MONITOR=49, #"馈电开关监控" + STR_TYPE=50, #"类型:" + STR_TOP_SWITCH=51, #"总开关" + STR_BOTTOM_SWITCH=52, #"分开关" + STR_COS_V=53, #"COS(ΦaΦbΦc)" + STR_POWER_VI=54, #"有功功率" + STR_POWER_VI_T=55, #"电量" + STR_FRONT_POWER_ON=56, #"前机合" + STR_NEXT_POWER_ON=57, #"后机合" + STR_FRONT_POWER_OFF=58, #"前机分" + STR_NEXT_POWER_OFF=59, #"后机分" + STR_FRONT_RESISTOR=60, #"前机电阻:" + STR_NEXT_RESISTOR=61, #"后机电阻:" + STR_WORK_MODE=62, #"模式:" + STR_LEEKAGE_RES=63, #"漏电电阻" + STR_REVERSE_VOLTAGE=64, #"反电动势\n注意安全" + STR_LIGHT=65, #"照明" + STR_SIGNAL=66, #"信号" + STR_SWITCH_STATUS=67, #"开关状态" + STR_POWER_ON_COUNTS=68, #"合闸次数" + STR_SETTING=69, #"设定值" + STR_POW_U=70, #"无功功率" + STR_TEST_FAIL=71, #"测试不正确" + STR_LEAKAGE_TEST_FAIL=72, #"漏电测试不正确" + STR_DETECT_FAIL_WHEN_POWER_ON=73, #"合闸时不能检测" + STR_LINK=74, #"联机系统" + STR_SINGLE=75, #"单机系统" + STR_STATUS=76, #"状态" + STR_MAIN_FIRST=77, #"主机优先" + STR_MAIN_BAK_SAME=78, #"主辅对等" + STR_MAIN_BAK_SWITCH=79, #"主辅轮动" + STR_SWITCH_DISABLE=80, #"局扇模式" + STR_MAIN=81, #"主机" + STR_BACKUP=82, #"备机" + STR_SINGLE_CIRCUIT_FRONT=83, #"单前机" + STR_SINGLE_CIRCUIT_NEXT=84, #"单后机" + STR_DOUBLE_CIRCUIT=85, #"双回路" + STR_WATER_PUMP_ON=86, #"水泵已开阀" + STR_WATER_PUMP_OFF=87, #"水泵已关阀" + STR_SWITCH_FAIL=88, #"粘连" + STR_SWITCH_THROUGH_2=89, #"击穿" + STR_GB_MONITOR=90, #"高压真空配电装置" + STR_GB_PROTECT_SYSTEM=91, #"综合保护监控系统" + STR_YBGY_MONITOR=92, #"移变高压侧" + STR_ERROR=93, #"故障" + STR_TEMPERATURE=94, #"温度" + STR_NEXT_CURRENT=95, #"后机电流" + STR_FRONT_CURRENT=96, #"前机电流" + STR_FJ_WS_LOCK=97, #"风机处瓦斯闭锁" + STR_GZM_WS_LOCK=98, #"工作面瓦斯闭锁" + STR_CURRENT=99, #"电流" + STR_VOLTAGE=100, #"电压" + STR_MONITOR_RES=101, #"监视电阻" + STR_SWITCH_THROUGH_SIMPLE=102, #"击穿" + STR_LINK_FAIL=103, #"联机失败" + STR_RES_OFF=104, #"漏电临界值" + STR_ANOTHER_REPAIR=105, #"另台维修请勿停机" + STR_WS_INTENSITY=106, #"瓦斯浓度" + STR_HIGH_VOLT=107, #"高压" + STR_AUTO=108, #"自动" + STR_MANUAL=109, #"手动" + STR_FREQUENCY=110, #"频率" + STR_FWD_ON=111, #正向启动 + STR_RVS_ON=112, #反向启动 + STR_TEMPERATURE_UNIT=113, #温度单位 + STR_POWER_LOSS=114, + STR_CALIBRATE_SUCCESS=115, #标定成功 + STR_ISOLATE_RES=116, #绝缘电阻 + STR_WATER_MONITOR=117, #水位控制排水监控系统 + STR_SWTICH_PROTECTOR=118, #ZDB-200电动机保护器 + STR_INDEPENDENT=119, #独立模式 + STR_DEPENDENT=120, #联动模式 + STR_OUT_POSITION=121, + STR_IN_POSITION=122, + STR_QUIT_IN_POSITION=123, + STR_RUN_DATA=124, + STR_WATER_MODE=125, + STR_INV_MODE=126, + STR_ISOLATE_RESISTOR_LOW=127, + STR_SWITCH=128, + STR_DIDAO=129, + STR_REMOTE=130, + STR_LOCAL=131, + STR_ONE_KEY_LOCK=132, + STR_COMM_FAIL=133, + +class Alarm(Enum): + ERR_NONE = 0, + ERR_CREEPAGE_LOCK = 1, #漏电报警 + ERR_VOLTAGE_LOW = 2, #欠压报警 + ERR_OVER_CURRENT = 3, #过流保护 + ERR_SHORT_CURRENT = 4, #短路保护 + ERR_CREEPAGE_SELECT = 5, #选漏 + ERR_UNBANLANCE_CURRENT = 6, #三相不平衡 + ERR_FLASH_FAIL = 7, #FLASH无法写入 + ERR_CREEPAGE_ACTIVE = 8, #漏电动作 + ERR_BREAK_PHASE = 9, #断相保护动作 + ERR_VOLTAGE_BREAK_PHASE = 10, #电压断相 + ERR_GAS_LOCK = 11, #瓦斯闭锁 + ERR_WIND_MOTOR_LOCK = 12, #风电闭锁 + ERR_VOLTAGE_OVER = 13, #过压报警 + ERR_SHORT_PHASE = 14, #相敏短路 + ERR_WATCH_DOG = 15, #看门狗保房 + ERR_SWITCH_FAIL = 16, #开关粘轿 + ERR_SWITCH_THROUGH = 17, #开关击? + ERR_SWITCH_ON_FAIL = 18, #开关合闸失? + ERR_COMM_FAIL = 19, #通讯故障 + ERR_CREEPAGE_SELECT2 = 20, #选择性报? + ERR_TEMP_IO_HIGH = 21, #IO口温度过驿 + ERR_SHORT_CURRENT_SIGNAL = 22, #信号电流短路 + ERR_REMOTE_OFF = 23, #远方分励 + ERR_REPAIR = 24, #维修状? + ERR_TEMP_ALARM = 25, #温度报警 + ERR_QUICK_CREEPAGE_ACT = 26, #快速漏电动仿 + ERR_GB_LEEK_SHORT = 27, #高爆绝缘短路 + ERR_GB_LEEK_BREAK = 28, #高爆绝缘断路 + ERR_YB_LOW_VOLTAGE_FAIL = 29, #移变低压侧失? + ERR_YB_LOW_VOLTAGE_UNREADY = 30, #移变低压侧未准备? + ERR_WS_FREQ_FAIL = 31, #瓦斯浓度超标 + ERR_HIGH_LOW_LOCK = 32, #高低压联钿 + ERR_MOTOR_ROTATE_LOCK = 33, #电机堵转 + ERR_FIX_TIME_OVER_CURRENT = 34, #定时限过泿 + ERR_FIX_TIME_SHORT_CURRENT = 35, #定时限短? + ERR_PHASE_ERROR = 36, #相序故障 + ERR_UNDER_LOAD = 37, #欠载保护 + ERR_PHASE_UNMATCH = 38, #互感器反? + ERR_EXTERNAL_ALARM = 39, #外部故障 + ERR_SENSOR_LOSS = 40, #水位传感器未? + ERR_ROTOR_SLOW = 41, + ERR_ROTOR_LOCK = 42, + ERR_POWER_LOSS = 43, #系统断电 + ERR_RSV1 = 44, + ERR_RSV2 = 45, + ERR_RSV3 = 46, + ERR_RSV4 = 47, + ERR_RSV5 = 48, + ERR_RSV6 = 49, + ERR_RSV7 = 50, + ERR_USER_ALARM1 = 51, #50,用户自定义故阿 + ERR_USER_ALARM2 = 52, #51,用户自定义故阿 + ERR_USER_ALARM3 = 53, #52,用户自定义故阿 + ERR_USER_ALARM4 = 54, #53,用户自定义故阿 + ERR_GB_LIGHT_THREAD_SON_LOSS = 55, + ERR_GB_LIGHT_THREAD_BROTHER_LOSS = 56, + ERR_GB_LIGHT_MODULE_LOSS = 57, + ERR_GB_FORCE_LEEK_OFF = 58, + ERR_GB_FORCE_SHORT_OFF = 59, + ERR_GB_CREEPAGE_SELECT = 60, #选择性报警 + ERR_SWITCH_OUT_POSITION = 61, + ERR_DZM_CREEPAGE_ACTIVE = 62, + ERR_OIL_PRESSURE_SENSOR_FAIL = 63, + ERR_FREQ_SENSOR_EXCEED = 64, + ERR_FREQ_SENSOR_FAIL = 65, + ERR_ANALOG_SENSOR_EXCEED = 66, + ERR_ANALOG_SENSOR_FAIL = 67, + ERR_VOLTAGE_LOSS = 68, + ERR_SPEED_LOSS = 69, + ERR_GB_ZERO_VOLT_OVER = 70, #零序过压 + ERR_PT_BREAK = 71, + ERR_CT_BREAK = 72, + ERR_ZERO_OVER_VOLTAGE = 73, + ERR_ZERO_OVER_CURRENT = 74, + ERR_GAS_WARNING = 75, + ERR_TEMP_WARNING = 76, + ERR_COMM_LOSS = 77, + ERR_CAR_FAIL = 78, + ERR_WATER_LOW = 79, + ERR_SWITCH_DIDAO_IN_POSITION = 80, + ERR_SWITCH_DIDAO_MID_POSITION = 81, + ERR_GB_CREEPAGE_SELECT_5 = 82, #5次谐波选漏 + ERR_FLUX_LOCK = 83, + ERR_GLOBAL_OIL_TEMP_LOCK = 84, + ERR_GLOBAL_WATER_PRESSURE_LOCK = 85, + ERR_GLOBAL_WATER_LEVEL_LOCK = 86, + ERR_GLOBAL_CURRENT_SENSOR_LOSS = 87, + ERR_GLOBAL_GAS_PERCENTAGE_LOCK = 88, + ERR_GLOBAL_GAS_SENSOR_LOSS = 89, + ERR_MEASURE_OVER_CURRENT = 90, #测量回路过流保护 + ERR_CREAPGE_BREAK = 91, + ERR_REMOTE_CREAPGE_TEST_FAIL = 92, + ERR_REMOTE_CREAPGE_TEST_SUCCESS = 93, + + + +class Alias(Enum): + alias_alarm = 0, + alias_str = 1, + alias_company = 2, + alias_bool = 3, + alias_voltage = 4, + alias_parity = 5, + alias_baud = 6, + alias_input = 7, + alias_onoff = 8, + alias_test = 9, + alias_can_baud = 10, + alias_measure_v = 11, + alias_switch_type = 12, + alias_work_mode = 13, + alias_us_phase = 14, + alias_sensor = 15, + alias_table = 16, + alias_remote = 17, + alias_current = 18, + alias_eth = 19, + alias_lcd = 20, + alias_dev = 21, + alias_fyj = 22, + alias_alarm_type = 23, + alias_car_position = 24, + +class Menu(Enum): + menu_current = 0, + menu_test = 1, + +alias_table = [ + {Alias.alias_alarm: {Alarm.ERR_NONE: "无故障", + Alarm.ERR_CREEPAGE_LOCK: "照明闭锁", + Alarm.ERR_VOLTAGE_LOW: "欠压", + Alarm.ERR_OVER_CURRENT : "照明过载", #过流保护 + Alarm.ERR_SHORT_CURRENT : "短路保护", #短路保护 + Alarm.ERR_CREEPAGE_SELECT : "选漏", #选漏 + Alarm.ERR_UNBANLANCE_CURRENT : "三相不平衡", #三相不平衡报? + Alarm.ERR_FLASH_FAIL : "FLASH无法写入", #FLASH无法写入 + Alarm.ERR_CREEPAGE_ACTIVE : "漏电动作", #漏电动作 + Alarm.ERR_BREAK_PHASE : "照明电流断相", #断相保护动作 + Alarm.ERR_VOLTAGE_BREAK_PHASE : "电压断相", #电压断相 + Alarm.ERR_GAS_LOCK : "瓦斯闭锁", #瓦斯闭锁 + Alarm.ERR_WIND_MOTOR_LOCK : "风电闭锁", #风电闭锁 + Alarm.ERR_VOLTAGE_OVER : "过压", #过压报警 + Alarm.ERR_SHORT_PHASE : "相敏短路", #相敏短路 + Alarm.ERR_WATCH_DOG : "看门狗重启", #看门狗保房 + Alarm.ERR_SWITCH_FAIL : "真空管粘连", #真空管粘连 + Alarm.ERR_SWITCH_THROUGH : "真空管击穿", #真空管击穿 + Alarm.ERR_SWITCH_ON_FAIL : "合闸失败", #合闸失败 + Alarm.ERR_COMM_FAIL : "通讯失败", #通讯失败 + Alarm.ERR_CREEPAGE_SELECT2 : "选 漏", #选 漏 + Alarm.ERR_TEMP_IO_HIGH : "温度过高", #温度过高 + Alarm.ERR_SHORT_CURRENT_SIGNAL : "信号电流短路", #信号电流短路 + Alarm.ERR_REMOTE_OFF : "远方分励", #远方分励 + Alarm.ERR_REPAIR : "维修状态", #维修状态 + Alarm.ERR_TEMP_ALARM : "温度报警", #温度报警 + Alarm.ERR_QUICK_CREEPAGE_ACT : "漏电 动作", #快速漏电 动作 + Alarm.ERR_GB_LEEK_SHORT : "绝缘短路", #绝缘短路 + Alarm.ERR_GB_LEEK_BREAK : "绝缘断路", #绝缘断路 + Alarm.ERR_YB_LOW_VOLTAGE_FAIL : "低压侧故障", #低压侧故障 + Alarm.ERR_YB_LOW_VOLTAGE_UNREADY : "低压侧未准备好", #低压侧未准备好 + Alarm.ERR_WS_FREQ_FAIL : "瓦斯浓度超标", #瓦斯浓度超标 + Alarm.ERR_HIGH_LOW_LOCK : "高低压联锁", #高低压联锁 + Alarm.ERR_MOTOR_ROTATE_LOCK : "电机堵转", #电机堵转 + Alarm.ERR_FIX_TIME_OVER_CURRENT : "定时限过流", #定时限过流 + Alarm.ERR_FIX_TIME_SHORT_CURRENT : "定时限短路", #定时限短路? + Alarm.ERR_PHASE_ERROR : "相序故障", #相序故障 + Alarm.ERR_UNDER_LOAD : "欠载保护", #欠载保护 + Alarm.ERR_EXTERNAL_ALARM : "外部故障", #外部故障 + Alarm.ERR_POWER_LOSS : "系统断电", #系统断电 + Alarm.ERR_USER_ALARM1 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_USER_ALARM2 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_GB_LIGHT_THREAD_SON_LOSS : "光纤子节点丢失", + Alarm.ERR_GB_LIGHT_THREAD_BROTHER_LOSS : "光纤兄弟节点丢失", + Alarm.ERR_GB_LIGHT_MODULE_LOSS : "无光纤模块", + Alarm.ERR_GB_FORCE_LEEK_OFF : "光纤漏电越级跳", + Alarm.ERR_GB_FORCE_SHORT_OFF : "光纤短路越级跳", + Alarm.ERR_GB_CREEPAGE_SELECT : "漏电", #选择性报警 + Alarm.ERR_SWITCH_OUT_POSITION : "开关未推到位", + Alarm.ERR_DZM_CREEPAGE_ACTIVE : "漏电动作", + Alarm.ERR_OIL_PRESSURE_SENSOR_FAIL : "油压传感器未接入", + Alarm.ERR_FREQ_SENSOR_EXCEED : "频率传感器超限", + Alarm.ERR_FREQ_SENSOR_FAIL : "频率传感器未接入", + Alarm.ERR_ANALOG_SENSOR_EXCEED : "模拟量传感器超限", + Alarm.ERR_ANALOG_SENSOR_FAIL : "模拟量传感器未接入", + Alarm.ERR_VOLTAGE_LOSS : "失压故障", + Alarm.ERR_SPEED_LOSS : "失速故障", + Alarm.ERR_GB_ZERO_VOLT_OVER : "零序过压", + Alarm.ERR_PT_BREAK : "PT断线", + Alarm.ERR_CT_BREAK : "CT断线", + Alarm.ERR_ZERO_OVER_VOLTAGE : "零序过压", + Alarm.ERR_ZERO_OVER_CURRENT : "零序过流", + Alarm.ERR_GAS_WARNING : "轻瓦斯告警", + Alarm.ERR_TEMP_WARNING : "温度异常", + Alarm.ERR_COMM_LOSS : "通讯中断", + Alarm.ERR_CAR_FAIL : "手车控制器故障", + Alarm.ERR_WATER_LOW : "循环泵无水故障", + Alarm.ERR_SWITCH_DIDAO_IN_POSITION: "地刀合闸保护中", + Alarm.ERR_SWITCH_DIDAO_MID_POSITION: "地刀未到位", + Alarm.ERR_GB_CREEPAGE_SELECT_5: "5次谐波选漏", + Alarm.ERR_FLUX_LOCK: "流量闭锁", + Alarm.ERR_GLOBAL_OIL_TEMP_LOCK: "油温闭锁", + Alarm.ERR_GLOBAL_WATER_PRESSURE_LOCK: "水压闭锁", + Alarm.ERR_GLOBAL_WATER_LEVEL_LOCK: "液位闭锁", + Alarm.ERR_GLOBAL_CURRENT_SENSOR_LOSS: "互感器未接入", + Alarm.ERR_GLOBAL_GAS_PERCENTAGE_LOCK: "瓦斯浓度闭锁", + Alarm.ERR_GLOBAL_GAS_SENSOR_LOSS: "瓦斯断线", + Alarm.ERR_MEASURE_OVER_CURRENT: "测量回路过流", + Alarm.ERR_CREAPGE_BREAK: "接地开路", + Alarm.ERR_REMOTE_CREAPGE_TEST_FAIL: "漏电测试失败", + Alarm.ERR_REMOTE_CREAPGE_TEST_SUCCESS: "漏电测试成功", + } + }, + + {"alias_str" : { StrInfo.STR_MAX_VALUE :"最大值", + StrInfo.STR_MIN_VALUE :"最小值", + StrInfo.STR_SET_VALUE :"设定值", + StrInfo.STR_VALUE_EXCEED :"设定值越界", + StrInfo.STR_ZERO_PHASE :"有功相位", + StrInfo.STR_INPUT_PASSWORD :"请输入系统密码", + StrInfo.STR_SYSTEM_PASSWORD :"系统密码", + StrInfo.STR_PASSWORD_ERR :"密码错误", + StrInfo.STR_SHORT_PHASE_MODIFY :"短路倍数\n恢复缺省", + StrInfo.STR_SWITCH_TYPE_MODIFY :"漏电延时\n恢复缺省", + StrInfo.STR_SOFT_VERSION:"软件版本", + StrInfo.STR_NO_RECORD :"无记录", + StrInfo.STR_ENTER_TO_CLEAR:"确定清除", + StrInfo.STR_ESC_TO_CANCEL:"ESC取消", + StrInfo.STR_CLEAR_FINISH :"清除成功", + StrInfo.STR_ESC_TO_EXIT :"ESC退出", + StrInfo.STR_INPUT_NEW_PASSWORD :"请设置新密码", + StrInfo.STR_NOT_POSSIBLE_TO_MODIFY :"不可修改", + StrInfo.STR_CAPACITOR_MEASURE :"电容检测", + StrInfo.STR_CAPACITOR_EQUAL :"电容", + StrInfo.STR_LEEKAGE_MEASURE :"检测中..", + StrInfo.STR_TEST_ACTIVE :"测试状态", + StrInfo.STR_POWER_ON :"合闸", + StrInfo.STR_POWER_OFF :"分闸", + StrInfo.STR_FAIL :"失效", + StrInfo.STR_NORMAL :"正常", + StrInfo.STR_MEASURE_CURRENT :"实测电流", + StrInfo.STR_RATE_CURRENT :"额定电流", + StrInfo.STR_ANGLE :"角度", + StrInfo.STR_AVERAGE_CURRENT :"平均电流", + StrInfo.STR_MAX_CURRENT :"最大电流", + StrInfo.STR_LOW_VOLTAGE_RATE :"欠压值", + StrInfo.STR_MEASURE_VOLTAGE :"实测电压", + StrInfo.STR_ZERO_CURRENT :"零序电流", + StrInfo.STR_ZERO_VOLTAGE :"零序电压", + StrInfo.STR_RECORD :"记录", + StrInfo.STR_LEEAKGE_LOCK_VALUE :"闭锁设定值", + StrInfo.STR_LEEAKGE_ACTIVE_VALUE :"动作设定值", + StrInfo.STR_MEASURE_RESISTOR :"电阻测量值", + StrInfo.STR_FRONT_CIRCUIT :"前机", + StrInfo.STR_NEXT_CIRCUIT :"后机", + StrInfo.STR_RATE_VOLTAGE :"额定电压", + StrInfo.STR_PARA_MODIFY_ERROR :"参数修改失败", + StrInfo.STR_LEEKAGE_RES_FINISH :"闭锁电阻检测完", + StrInfo.STR_LEEKAGE_RES_MEASURE :"闭锁电阻检测中", + StrInfo.STR_SFJ_MONITOR :"双风机磁力监控", + StrInfo.STR_CL_MONITOR :"磁力监控系统", + StrInfo.STR_CL_DB_MONITOR :"双回路磁力监控", + StrInfo.STR_YB_MONITOR :"移变低压侧", + StrInfo.STR_KUI_DIAN_MONITOR :"馈电开关监控", + StrInfo.STR_TYPE :"类型:", + StrInfo.STR_TOP_SWITCH :"总开关", + StrInfo.STR_BOTTOM_SWITCH :"分开关", + StrInfo.STR_COS_V :"COS(ΦaΦbΦc)", + StrInfo.STR_POWER_VI :"有功功率", + StrInfo.STR_POWER_VI_T :"电量", + StrInfo.STR_FRONT_POWER_ON :"前机合", + StrInfo.STR_NEXT_POWER_ON :"后机合", + StrInfo.STR_FRONT_POWER_OFF :"前机分", + StrInfo.STR_NEXT_POWER_OFF :"后机分", + StrInfo.STR_FRONT_RESISTOR :"前机电阻:", + StrInfo.STR_NEXT_RESISTOR :"后机电阻:", + StrInfo.STR_WORK_MODE :"模式:", + StrInfo.STR_LEEKAGE_RES :"漏电电阻", + StrInfo.STR_REVERSE_VOLTAGE :"反电动势\n注意安全", + StrInfo.STR_LIGHT :"照明", + StrInfo.STR_SIGNAL :"信号", + StrInfo.STR_SWITCH_STATUS :"开关状态", + StrInfo.STR_POWER_ON_COUNTS :"合闸次数", + StrInfo.STR_SETTING :"设定值", + StrInfo.STR_POW_U :"无功功率", + StrInfo.STR_TEST_FAIL :"测试不正确", + StrInfo.STR_LEAKAGE_TEST_FAIL :"漏电测试不正确", + StrInfo.STR_DETECT_FAIL_WHEN_POWER_ON :"合闸时不能检测", + StrInfo.STR_LINK :"联机系统", + StrInfo.STR_SINGLE :"单机系统", + StrInfo.STR_STATUS :"状态", + StrInfo.STR_MAIN_FIRST :"主机优先", + StrInfo.STR_MAIN_BAK_SAME :"主辅对等", + StrInfo.STR_MAIN_BAK_SWITCH :"主辅轮动", + StrInfo.STR_SWITCH_DISABLE :"局扇模式", + StrInfo.STR_MAIN :"主机", + StrInfo.STR_BACKUP :"备机", + StrInfo.STR_SINGLE_CIRCUIT_FRONT :"单前机", + StrInfo.STR_SINGLE_CIRCUIT_NEXT :"单后机", + StrInfo.STR_DOUBLE_CIRCUIT :"双回路", + StrInfo.STR_WATER_PUMP_ON :"水泵已开阀", + StrInfo.STR_WATER_PUMP_OFF :"水泵已关阀", + StrInfo.STR_SWITCH_FAIL :"粘连", + StrInfo.STR_SWITCH_THROUGH_2 :"击穿", + StrInfo.STR_GB_MONITOR :"高压真空配电装置", + StrInfo.STR_GB_PROTECT_SYSTEM :"综合保护监控系统", + StrInfo.STR_YBGY_MONITOR :"移变高压侧", + StrInfo.STR_ERROR :"故障", + StrInfo.STR_TEMPERATURE:"温度", + StrInfo.STR_NEXT_CURRENT :"后机电流", + StrInfo.STR_FRONT_CURRENT :"前机电流", + StrInfo.STR_FJ_WS_LOCK :"风机处瓦斯闭锁", + StrInfo.STR_GZM_WS_LOCK :"工作面瓦斯闭锁", + StrInfo.STR_CURRENT :"电流", + StrInfo.STR_VOLTAGE:"电压", + StrInfo.STR_MONITOR_RES :"监视电阻", + StrInfo.STR_SWITCH_THROUGH_SIMPLE :"击穿", + StrInfo.STR_LINK_FAIL :"联机失败", + StrInfo.STR_RES_OFF :"漏电临界值", + StrInfo.STR_ANOTHER_REPAIR :"另台维修请勿停机", + StrInfo.STR_WS_INTENSITY :"瓦斯浓度", + StrInfo.STR_HIGH_VOLT :"高压", + StrInfo.STR_AUTO :"自动", + StrInfo.STR_MANUAL :"手动", + StrInfo.STR_FREQUENCY :"频率", + StrInfo.STR_FWD_ON :"正向启动", + StrInfo.STR_RVS_ON :"反向启动", + StrInfo.STR_TEMPERATURE_UNIT : "℃", + StrInfo.STR_POWER_LOSS :"系统断电", + StrInfo.STR_CALIBRATE_SUCCESS :"标定成功", + StrInfo.STR_ISOLATE_RES :"绝缘电阻", + StrInfo.STR_WATER_MONITOR :"水位控制排水监控系统", + StrInfo.STR_SWTICH_PROTECTOR :"ZDB-200电动机保护器", + StrInfo.STR_INDEPENDENT :"独立模式", + StrInfo.STR_DEPENDENT :"联动模式", + StrInfo.STR_OUT_POSITION : "未到位", + StrInfo.STR_IN_POSITION : "进到位", + StrInfo.STR_QUIT_IN_POSITION : "退到位", + StrInfo.STR_RUN_DATA : "运行数据", + StrInfo.STR_WATER_MODE : "水位", + StrInfo.STR_INV_MODE : "可逆", + StrInfo.STR_ISOLATE_RESISTOR_LOW : "绝缘电阻降低", + StrInfo.STR_SWITCH : "开关", + StrInfo.STR_DIDAO : "地刀", + StrInfo.STR_REMOTE : "程控", + StrInfo.STR_LOCAL : "就地", + StrInfo.STR_ONE_KEY_LOCK : "闭锁中", + StrInfo.STR_COMM_FAIL : "通讯失败", + }}, + + {"alias_company": {0: "浙江志展智能科技", + 1: "华荣科技", + } + }, + {"alias_sensor" : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "1500 A", 25: "2000 A", 26: "2500 A" ,27: "4000 A", 28:"5 A"} + }, + {"alias_switch_type" : {0: "总开关", 1: "分开关"}}, + {"alias_measure_v": {0: "正电压", 1: "负电压"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"380V", 1:"660V", 2:"1140V", 3:"3300V", 4:"100V", 5:"127V", 6:"220V", 7:"440V"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_input": {0: "常开", 1: "常闭"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_test": {0: "模拟测试", 1: "继电器测试"}}, + {"alias_can_baud": {0: "1000K", 1: "800K", 2: "500K", 3: "250K", 4: "125K", 5: "100K", 6: "50K", 7: "20K", 8: "10K", 9: "AUTO"}}, + {Alias.alias_measure_v: {0: "正电压", 1: "负电压"}}, + {Alias.alias_switch_type : {0: "总开关", 1: "分开关"}}, + {"alias_work_mode": {0: "水位模式", 1: "磁力模式", 2: "正反转模式", 3: "联控模式"}}, + {"alias_us_phase": {0: "Uab_ABC", 1: "Uab_ACB", 2: "Ubc_ABC", 3: "Ubc_ACB", 4: "Uca_ABC", 5: "Uca_ACB"}}, + {Alias.alias_sensor : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "2500 A", 25: "5 A"}}, + {"alias_table": {0: "0", 1: "1", 2: "2", 3: "3"}}, + {"alias_remote": {0: "就地", 1: "程控"}}, + {"alias_current": {0: "三相测量", 1: "两相平均", 2: "两相测量"}}, + + {Alias.alias_eth : {0: "无", 1: "一代以太网", 2: "二代以太网"}}, + {Alias.alias_lcd : {0: "一体迪文屏", 1: "分体迪文屏", 2: "大彩屏", 3 : "昆仑通态屏"}}, + {Alias.alias_fyj : {0: "无", 1: "FYJ", 2: "FYJ2", 3 : "FYJ4"}}, + {Alias.alias_dev : {0: "馈电", 1: "高爆", 2: "移变", 3 : "双风机", 4 : "磁力", + 5 : "双磁力", 6 : "照明", 7 : "移变高压侧", 8: "双高爆", + 9: "组合馈电", 10: "双照明", 11 : "ZZ630"}}, + {"alias_alarm_type": {0: "试验", 1: "动作"}}, + {"alias_car_position": {0: "小车未到位", 1 : "小车试验位", 2: "小车工作位", 3 : "位置信号异常"}}, +] + +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + + +def get_alias_value_str(alias_str, alias_value) : + alias_value_msg = None + compare_value = int(alias_value) + + for alias_dict in alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + if alias_name == alias_str : + for each_value_dict in value_dict.items(): + if isinstance(each_value_dict[0], Enum) : + key_value = each_value_dict[0].value[0] + else : + key_value = each_value_dict[0] + key_string = each_value_dict[1] + + if int(key_value) == compare_value : + alias_value_msg = key_string + return alias_value_msg + return alias_value_msg + +def func_adjust_current_menu_item(device : class_modbus_comm_device, menu_item) : + #获得互感器类型, 根据互感器类型来调整 scale, format, 让电流可以正确显示与设置 + sensor_type = device.comm_get_value_from_mqtt_name("Sensor") + sensor_current = 400 + + if sensor_type != None : + value_str = get_alias_value_str("alias_sensor", sensor_type) + if value_str != None : + value_str_no_unit = value_str.replace("A", "") + sensor_current = int(value_str_no_unit) + + #80A 以下电流互感器, 显示一位小数点 + if sensor_current <= 80 : + new_item = menu_item + new_item["scale"] = 0.1 + new_item["format"] = "%1.1f" + return new_item + else : + return menu_item + +# def func_caculate_Is(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : +# format_str = utils.dict_or_object_get_attr(menu_item, "format", "%4.2f") +# try : +# Ia = device.comm_get_value_from_mqtt_name("Ia") +# Ib = device.comm_get_value_from_mqtt_name("Ib") +# Ic = device.comm_get_value_from_mqtt_name("Ic") +# Is = (Ia + Ib + Ic) / 3 +# except Exception as e : +# Is = 0.00 +# Is_str = format_str%(Is) +# mqtt_dict["Is"] = Is_str + +#视频触发 +def func_video_trigger(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + value = device.comm_get_value_from_menu_item(menu_item) + if value == None : + #通讯未建立 + return + + value = round(value) + in_position = (value >> 10) & 0x1 + out_position = (value >> 9) & 0x1 + now_time = time.time() + if hasattr(device, "MqttVideoActive") == False: + #动态添加视频触发所需的变量 + device.MqttVideoActive = False + device.MqttVideoBaseTime = now_time + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + if in_position != device.DI_SwitchInPosition or out_position != device.DI_SwitchQuitPosition: + #开关进到位与 开关退到位信号, 当这两个状态发生变化时, 触发20秒的视频 + device.MqttVideoActive = True + device.MqttVideoBaseTime = now_time + mqtt_dict["VideoActive"] = "1" + if device.MqttVideoActive : + #视频延时20后主动关闭视频显示 + if now_time - device.MqttVideoBaseTime > 20.0 : + mqtt_dict["VideoActive"] = "0" + device.MqttVideoActive = False + + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + +COLOR_RED = "#EE2D2D" +COLOR_GREEN = "#83BF6E" + +def func_process_car_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + car_pos_value = device.comm_get_value_from_menu_item(menu_item) + if car_pos_value == None or mqtt_dict == None: + return + car_msg = get_alias_value_str("alias_car_position", car_pos_value) + if car_msg != None : + mqtt_dict["CarPositionMsg"] = car_msg + +def func_process_alarm_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + alarm_id = device.comm_get_value_from_menu_item(menu_item) + if alarm_id == None or mqtt_dict == None: + #通讯未建立 + return + alarm_msg = get_alias_value_str("alias_alarm", alarm_id) + if alarm_msg != None : + alarm_msg_dict = {} + if alarm_id > 0 : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_RED + else : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_GREEN + + mqtt_dict["AlarmMessage"] = alarm_msg_dict + +mqtt_video_trigger = [ + { + "name": "视频触发", + "addr": "8015", + "call" : func_video_trigger, + }, +] + +mqtt_time_update = [ + { + "name": "Year", + "addr": "2300", + "format" : "%04.0f", + "mqtt" : "Year", + }, + { + "name": "Month", + "addr": "2301", + "format" : "%02.0f", + "mqtt" : "Month", + }, + { + "name": "Day", + "addr": "2302", + "format" : "%02.0f", + "mqtt" : "Day", + }, + { + "name": "Hour", + "addr": "2303", + "format" : "%02.0f", + "mqtt" : "Hour", + }, + { + "name": "Minute", + "addr": "2304", + "format" : "%02.0f", + "mqtt" : "Minute", + }, + { + "name": "Second", + "addr": "2305", + "format" : "%02.0f", + "mqtt" : "Second", + }, + { + "name": "SetupTime", + "addr": "2305", + "mqtt" : "SetupTime", + "action" : "SetupTime", + }, +] + +mqtt_pack_param = [ + #电流参数 + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "scale" : 1.0, + "format": "%04.0f", + "action": "rate_current", + "mqtt" : "RateCurrent", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.00, + "max" : 10.00, + "mqtt" : "ShortLevel", + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 300.0, + "mqtt" : "ShortDelay", + }, + { + "name": "信号Ie", + "unit": "A", + "addr": "8600", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "CurrentIs", + }, + { + "name": "信号短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8601", + "mqtt" : "ShortIs", + }, + { + "name": "Is 校正", + "unit": "%", + "scale" : 0.1, + "format": "%04.2f", + "addr": "8602", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIs", + }, + { + "name": "互感器类型", + "alias" :"alias_sensor", + "addr": "8207", + "mqtt" : "Sensor", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + "mqtt" : "CurrentB" + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + "mqtt" : "UnbalanceDelay", + }, + { + "name": "不平衡范围", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10, + "max" : 99, + "mqtt" : "UnbalanceLevel", + }, + { + "name": "定时限过流", + "unit": "Ie", + "addr": "8239", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeOvercurrent", + }, + { + "name": "定时限过流延时", + "unit": "ms", + "addr": "8240", + "scale" : 1, + "format": "%05.0f", + "mqtt" : "TimeOvercurrentDelay", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIc", + }, + #电压参数 + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "mqtt" : "RateVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayLowVoltage", + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 10.0, + "max" : 100.0, + "mqtt" : "PercentLowVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayHighVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 200.0, + "mqtt" : "PercentHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUs", + }, + + + #漏电参数 + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "BlockResistor" + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "SeriesResistor" + }, + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "mqtt" : "LeakageDelay", + }, + #保护参数投入 + { + "name": "短路保护", + "alias": "alias_bool", + "addr": "8192.1", + "mqtt" : "ProtectShort", + }, + { + "name": "过载保护", + "alias": "alias_bool", + "addr": "8192.3", + "mqtt" : "ProtectOverLoad", + }, + { + "name": "电流断相保护", + "alias": "alias_bool", + "addr": "8192.4", + "mqtt" : "ProtectCurrentPhaseOff", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + "mqtt" : "ProtectImbalance", + }, + { + "name": "漏电闭锁保护", + "alias": "alias_bool", + "addr": "8192.10", + "mqtt" : "ProtectLeakage" + }, + { + "name": "定时限过载保护", + "alias": "alias_bool", + "addr": "8192.11", + "mqtt" : "ProtectTimeLimitOverload" + }, + { + "name": "定时限短路保护", + "alias": "alias_bool", + "addr": "8192.12", + "mqtt" : "ProtectTimeLimitShortCircuit", + }, + { + "name": "信号短路保护", + "alias": "alias_bool", + "addr": "8175.15", + "mqtt" : "ProtectIsShort", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + "mqtt" : "ProtectUnderVoltage", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + "mqtt" : "ProtectOverVoltage", + }, + { + "name": "电压断相保护", + "alias": "alias_bool", + "addr": "8174.2", + "mqtt" : "ProtectVoltagePhaseOff", + }, + { + "name": "漏电动作保护", + "alias": "alias_bool", + "addr": "8174.6", + "mqtt" : "ProtectLeakageAction", + }, + { + "name": "温度报警保护", + "alias": "alias_bool", + "addr": "8174.8", + "mqtt" : "ProtectTemperatureAlarm", + }, + #系统设置 + { + "name": "瓦斯触点", + "addr": "8190", + "alias" : "alias_input", + "mqtt" : "Gas", + }, + { + "name": "瓦斯延时", + "addr": "8191", + "scale" : 0.01, + "format": "%06.2f", + "min" : 0.00, + "max" : 60.00, + "mqtt" : "GasDelay", + }, + { + "name": "瓦斯浓度", + "addr": "8237", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "GasConcentration", + }, + { + "name": "风电触点", + "addr": "8248", + "alias" : "alias_input", + "mqtt" : "Fan", + }, + { + "name": "风电延时", + "addr": "8234", + "scale" : 0.01, + "format": "%06.2f", + "min" : 0.00, + "max" : 60.00, + "mqtt" : "FanDelay", + }, + { + "name": "远近控模式", + "addr": "8558", + "alias" : "alias_remote", + "mqtt" : "FarAndNearMode", + }, + { + "name": "维修模式", + "addr": "8565", + "alias" : "alias_bool", + "mqtt" : "MaintenanceMode", + }, + { + "name": "小车报警延时", + "addr": "8576", + "scale" : 0.1, + "format": "%05.1f", + "mqtt" : "CarAlarmDelay", + }, + { + "name": "温度设定", + "addr": "8423", + "scale" : 1, + "format": "%03.0f", + "mqtt" : "Temperature", + }, + #通讯设置 + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + "mqtt" : "485Address", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + "mqtt" : "485Baud", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + "mqtt" : "485Parity", + }, + { + "name": "CAN地址", + "format": "%03.0f", + "addr": "8440", + "mqtt" : "CANAddress", + }, + { + "name": "CAN波特率", + "alias": "alias_can_baud", + "addr": "8439", + "mqtt" : "CANBaud", + }, +] + +mqtt_pack_measure = [ + { + "name": "SwitchStatus", + "addr": "8162.0", + "alias": Alias.alias_onoff, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_STATUS, + "measure" : True, + "mqtt" : "SwitchStatus", + }, + { + "name": "AlarmId", + "addr": "8166", + "alias": Alias.alias_alarm, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_ALARM, + "measure" : True, + "mqtt" : "AlarmId", + }, + { + "name": "AlarmMessage", + "addr": "8166", + "alias": Alias.alias_alarm, + "call" : func_process_alarm_message, + }, + { + "name": "CarPositionMsg", + "addr": "8015.10#2", + "alias": Alias.alias_car_position, + "call" : func_process_car_message, + }, + { + "name": "Ia", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Ia", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "unit": "A", + "addr": "8157", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IB, + "measure" : True, + "mqtt" : "Ib", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "unit": "A", + "addr": "8158", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IC, + "measure" : True, + "mqtt" : "Ic", + "adjust" : func_adjust_current_menu_item, + }, + # { + # "name": "Is", + # "unit": "A", + # "addr": "8142", + # "format": "%05.2f", + # "measure" : True, + # "mqtt" : "Is", + # "adjust" : func_adjust_current_menu_item, + # }, + { + "name": "Voltage", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Voltage", + }, + { + "name": "Current", + "unit": "A", + "addr": "8156", + "scale":0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + # "adjust" : func_adjust_current_menu_item, + "mqtt" : "Current", + }, + { + "name": "Power", + "unit": "kw", + "addr": "8167", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Power", + }, + { + "name": "Electricity", + "unit": "kwh", + "addr": "8160#2", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Electricity", + }, + { + "name": "Uab", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Uab", + }, + { + "name": "Ubc", + "unit": "V", + "addr": "8154", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UBC, + "measure" : True, + "mqtt" : "Ubc", + }, + { + "name": "Uca", + "unit": "V", + "addr": "8155", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UCA, + "measure" : True, + "mqtt" : "Uca", + }, + # { + # "name": "Uo", + # "unit": "V", + # "addr": "8152", + # "format": "%05.1f", + # "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UO, + # "measure" : True, + # "mqtt" : "Uo", + # }, + # { + # "name": "Io", + # "unit": "mA", + # "addr": "8151", + # "format": "%05.1f", + # "scale" : 1.0, + # "remap_addr" : remap.COMM_REMAP_MEASURE_FLOAT_IO, + # "measure" : True, + # "mqtt" : "Io", + # }, + { + "name": "Ro", + "unit": "K", + "addr": "8150", + "scale": 0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_RO, + "measure" : True, + "mqtt" : "Ro", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%06.0f", + "property": MENU_PROPERTY_READ_ONLY, + "mqtt" : "OnCount", + }, + + # { + # "name": "Is", + # "addr": "8171", + # "scale": 0.01, + # "format": "%04.2f", + # "measure" : True, + # "call" : func_caculate_Is, + # }, +] +mqtt_pack_globalmeasure = [ + { + "name": "A相上触头", + "addr": "8056#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "A_up", + }, + + { + "name": "B相上触头", + "addr": "8057#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "B_up", + }, + { + "name": "C相上触头", + "addr": "8058#s", + "scale": 0.1, + "format": "%05.1f", + "glboalmeasure" : True, + "mqtt" : "C_up", + }, + { + "name": "A相下触头1", + "addr": "8059#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "A1_down", + }, + { + "name": "B相下触头1", + "addr": "8060#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "B1_down", + }, + { + "name": "C相下触头1", + "addr": "8061#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "C1_down", + }, + { + "name": "A相下触头2", + "addr": "8051#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "A2_down", + }, + + { + "name": "B相下触头2", + "addr": "8052#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "B2_down", + }, + { + "name": "C相下触头2", + "addr": "8053#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "C2_down", + }, + { + "name": "A相下触头3", + "addr": "8045#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "A3_down", + }, + { + "name": "B相下触头3", + "addr": "8046#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "B3_down", + }, + { + "name": "C相下触头3", + "addr": "8047#s", + "scale": 0.1, + "format": "%05.1f", + "globalmeasure" : True, + "mqtt" : "C3_down", + }, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmCode", + "addr": "8121", + "alias": "alias_alarm", + "mqtt" : "AlarmCode", + }, + { + "name": "AlarmTest", + "addr": "8138", + "alias": "alias_alarm_type", + "format" : "%1.0f", + "mqtt" : "AlarmTest", + }, + { + "name": "Ua", + "addr": "8122", + "format" : "%1.0f", + "mqtt" : "AlarmUa", + }, + { + "name": "Ub", + "addr": "8123", + "format" : "%1.0f", + "mqtt" : "AlarmUb", + }, + { + "name": "Uc", + "addr": "8124", + "format" : "%1.0f", + "mqtt" : "AlarmUc", + }, + { + "name": "Ia", + "addr": "8125", + "format" : "%1.0f", + "mqtt": "AlarmIa", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "addr": "8126", + "format" : "%1.0f", + "mqtt": "AlarmIb", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "addr": "8127", + "format" : "%1.0f", + "mqtt": "AlarmIc", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ro", + "addr": "8128", + "format" : "%5.1f", + "scale" : 0.1, + "mqtt": "AlarmRo", + }, + { + "name": "Is", + "addr": "8142", + "format": "%05.2f", + "mqtt" : "AlarmIs", + "adjust" : func_adjust_current_menu_item, + }, + # { + # "name": "Io", + # "addr": "8129", + # "format" : "%1.1f", + # "scale" : 0.1, + # "mqtt": "AlarmIo", + # }, + # { + # "name": "Uo", + # "addr": "8130", + # "format" : "%5.0f", + # "scale" : 1.0, + # "mqtt": "AlarmUo", + # }, + { + "name": "Year", + "addr": "8131", + "format" : "%4.0f", + "mqtt": "AlarmYear", + }, + { + "name": "Month", + "addr": "8132", + "format" : "%2.0f", + "mqtt": "AlarmMonth", + }, + { + "name": "Day", + "addr": "8133", + "format" : "%2.0f", + "mqtt": "AlarmDay", + }, + { + "name": "Hour", + "addr": "8134", + "format" : "%2.0f", + "mqtt": "AlarmHour", + }, + { + "name": "Minute", + "addr": "8135", + "format" : "%2.0f", + "mqtt": "AlarmMinute", + }, + { + "name": "Second", + "addr": "8136", + "format" : "%2.0f", + "mqtt": "AlarmSecond", + }, +] + +menu_data = [ + { + "name": "数据页面", + "sub_menu": "menu_curve_physical", + }, +] + +#曲线菜单 +menu_curve_physical = [ + { + "name": "物理曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#曲线菜单 +menu_curve_adc = [ + { + "name": "ADC曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#谐波菜单 +menu_curve_harmonic = [ + { + "name": "谐波曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +modbus_comm_table = [ + {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, + {"name":"measure", "reg_addr":8000, "reg_count":50, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, + {"name":"globalmeasure","reg_addr":8050, "reg_count":20, "cycle": 500, "mqtt_pack": mqtt_pack_globalmeasure}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, + #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, + # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000, "mqtt_pack": mqtt_time_update}, + {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, + {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, + {"name":"param/info", "reg_addr":8490, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8520, "reg_count":20, "cycle": 3000}, + {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, + {"name":"param/info", "reg_addr":8435, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8420, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, + {"name":"param/info", "reg_addr":8595, "reg_count":10, "cycle": 3000}, + +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + if not hasattr(comm_table_item, "name"): + return False + return False + +menu_current = [ #菜单表[menu_current],存储菜单项属性字典<> + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "action": "rate_current", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + #"mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" : Alias.alias_sensor, + "addr": "8207", + }, + # { + # "name": "反时限表", + # "alias" :"alias_table", + # "addr": "8178", + # }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + #"mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + #"mqtt" : "UnbalanceDelay", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIc", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_voltage = [ + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "default": 0, + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + #"mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + #"mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUs", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm_display = [ + { + "name": "当前故障", + "action" : "Idle", + }, +] + +menu_alarm_curve = [ + { + "name": "录波曲线", + "action" : "Idle", + }, +] + +menu_alarm_history = [ + { + "name": "故障查询", + "action" : "Idle", + }, +] + +menu_alarm = [ + { + "name": "故障查询", + "sub_menu": "menu_alarm_history", + }, + { + "name": "故障清除", + "action": "alarm_clear", + }, + { + "name": "合闸清零", + "action": "clear_oncount", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + #"mqtt" : "OnCount", + }, + { + "name": "电量清除", + "action": "clear_kwh", + }, + { + "name": "累计时间清除", + "action": "clear_time", + }, + { + "name": "累计合闸时间", + "addr": "8016#2", + "unit": "Min", + "scale": 0.0166666666666667, + "format": "%07.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_test = [ + { + "name": "短路试验", + "action": "test", + "addr" : "100628", + "mqtt" : "TestShort", + }, + { + "name": "漏电试验", + "action": "test", + "addr" : "100629", + "mqtt" : "TestIsolation", + }, + { + "name": "过压试验", + "action": "test", + "addr" : "100641", + "mqtt" : "TestOverVoltage", + }, + { + "name": "电流断相试验", + "action": "test", + "addr" : "100642", + "mqtt" : "TestBreak", + }, + + { + "name": "复归", + "action": "test", + "addr" : "100649", + "mqtt" : "TestRecover", + }, + + { + "name": "漏电试验配置", + "alias" : "alias_test", + "addr": "8265", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_protect_set = [ + { + "name": "短路保护", + "alias": Alias.alias_bool, + "addr": "8192.1", + #"mqtt" : "ProtectShort", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + #"mqtt" : "ProtectUnbalance", + }, + { + "name": "反时限过流", + "alias": "alias_bool", + "addr": "8192.3", + #"mqtt" : "ProtectOverCurrent", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + #"mqtt" : "ProtectHighVotage", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + #"mqtt" : "ProtectLowVotage", + }, + # { + # "name": "电压断相", + # "alias": "alias_bool", + # "addr": "8174.2", + # }, + # { + # "name": "相序保护", + # "alias": "alias_bool", + # "addr": "8174.3", + # }, + { + "name": "漏电闭锁", + "alias": "alias_bool", + "addr": "8192.10", + #"mqtt" : "ProtectIsolationLock", + }, + { + "name": "漏电动作", + "alias": "alias_bool", + "addr": "8174.6", + #"mqtt" : "ProtectIsolationAction", + }, + # { + # "name": "选漏保护", + # "alias": "alias_bool", + # "addr": "8174.7", + # }, + { + "name": "风电闭锁", + "alias": "alias_bool", + "addr": "8175.0", + #"mqtt" : "ProtectWindMotor", + }, + { + "name": "瓦斯闭锁", + "alias": "alias_bool", + "addr": "8174.13", + #"mqtt" : "ProtectGasLock", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_comm_set = [ + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + }, + # { + # "name": "CAN地址", + # }, + # { + # "name": "CAN波特率", + # "alias": "alias_can_baud", + # }, + { + "name": "IP设置", + "addr": "8271#2", + "action": "ip", + }, + { + "name": "IP网关", + "addr": "8273#2", + "action": "ip", + }, + { + "name": "IP掩码", + "addr": "8275#2", + "action": "ip", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "工作模式", + "addr": "8231", + "alias": "alias_work_mode", + "property": MENU_PROPERTY_ENGINEER, + "action" : "Visible_CL", #磁力模式显示菜单 + }, + { + "name": "开关类型", + "alias": "alias_switch_type", + "addr": "8210", + "action" : "Visible_KD", #馈电模式显示菜单 + }, + { + "name": "控制模式", + "alias": "alias_remote", + "addr": "8262", + }, + { + "name": "瓦斯触点", + "alias": "alias_input", + "addr": "8190", + }, + { + "name": "瓦斯延时", + "unit": "S", + "addr": "8191", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "风电触点", + "alias": "alias_input", + "addr": "8248", + }, + { + "name": "风电延时", + "unit": "S", + "addr": "8234", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "高水位延时", + "addr": "8267", + "unit": "S", + "scale": 0.1, + "format": "%04.1f", + "action" : "Visible_CL_WATER", #水位磁力模式显示 + }, + { + "name": "正反转延时", + "addr": "8266", + "unit": "ms", + "scale": 1.0, + "format": "%04.0f", + "action" : "Visible_CL_INV", #正反转磁力模式显示 + }, + { + "name": "维修模式", + "addr": "8260", + "alias": "alias_bool", + }, + # { + # "name": "温度设定", + # "unit": "℃", + # "addr": "2030", + # "format": "%+03.0f", + # }, + { + "name": "系统日期", + "addr": "2300#3", + "action": "date", + }, + { + "name": "当前时间", + "addr": "2303#3", + "action": "time", + }, + { + "name": "软件版本", + "addr": "8180", + "unit" : VERSION_DATE, + "scale": 0.01, + "format": "%.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统密码", + "addr": "8181", + "format": "%04.0f", + "action": "password", + }, + { + "name": "Us相位", + "alias": "alias_us_phase", + "addr": "8269", + }, + { + "name": "重启", + "action": "restart", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_switch_cmd = [ + { + "name": "通讯合闸", + "action": "write_bit", + "addr" : "100618", + "mqtt" : "SwitchOn", + }, + { + "name": "通讯分闸", + "action": "write_bit", + "addr" : "100619", + "mqtt" : "SwitchOff", + }, + { + "name": "通讯复位", + "action": "write_bit", + "addr" : "100620", + "mqtt" : "SwitchRst", + }, + { + "name": "小车进控制", + "action": "write_bit", + "addr" : "100636", + "mqtt" : "CarForward", + }, + { + "name": "小车退控制", + "action": "write_bit", + "addr" : "100637", + "mqtt" : "CarRetreat", + }, + +] + +memu_setting = [ + { + "name": "电流设置", + "sub_menu": Menu.menu_current, + }, + { + "name": "电压设置", + "sub_menu": "menu_voltage" + }, + { + "name": "漏电设置", + "sub_menu": "menu_leak" + }, + { + "name": "系统设置", + "sub_menu": "menu_system" + }, + { + "name": "保护设置", + "sub_menu": "menu_protect_set" + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set" + }, + { + "name": "保护试验", + "sub_menu": Menu.menu_test #"menu_test" + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm" + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_leak = [ + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + #"mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + #"mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "A", + "scale" : 0.01, + "format" : "%05.2f", + "mqtt" : "GB.Io", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%05.2f", + "mqtt" : "GB.Uo", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0 + }, + { + "name": "检测电压", + "addr": "8253", + "alias": Alias.alias_measure_v, + }, + { + "name": "退出", + "action": "exit", + }, +] + +calibrate = [ + { + "name": "999校正", + "action": "calibrate999", + "mqtt" : "Calibrate999", + }, + { + "name": "0欧校正", + "action": "calibrate0", + "mqtt" : "Calibrate0", + }, + { + "name": "以太网模块", + "alias": Alias.alias_eth, + "addr" : "8280", + }, + { + "name": "LCD模块", + "alias": Alias.alias_lcd, + "addr" : "8281", + }, + { + "name": "防越级模块", + "alias": Alias.alias_fyj, + "addr" : "8282", + }, + { + "name": "设备型号", + "alias": Alias.alias_dev, + "addr" : "8270", + }, + { + "name": "退出", + "action": "exit", + }, +] + +startup = [ + { + "name": "退出", + }, +] + +menu_main = [ + { + "name": "设置", + "sub_menu": "memu_setting", + }, + { + "name": "数据", + "sub_menu": "menu_data", + }, + { + "name": "报警", + "sub_menu": "menu_alarm_display", + }, + { + "name": "标定", + "sub_menu": "calibrate", + "property": MENU_PROPERTY_ENGINEER, + }, +] + +mqtt_topic_subscribe = None + +MENU_STARTUP_PAGE = 150 +MENU_DISPLAY_PAGE = 2 +MENU_ALARM_PAGE = 3 +MENU_DATA_PAGE = 120 +MENU_CL_MAIN_PAGE = 90 +MENU_KD_MAIN_PAGE = 20 +MENU_KD_MAIN_PAGE_LANGUAGE = 21 +MENU_CURVE_PAGE = 10 +MENU_ADC_CURVE_PAGE = 18 +MENU_HARNOMIC_CURVE_PAGE = 19 + +menu_caption = [ + {"name" : "startup", "menu" : startup, "caption": "启动页面", "page" : MENU_STARTUP_PAGE, "max_items" : 1}, + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : MENU_KD_MAIN_PAGE, "max_items" : 4}, + {"name" : "menu_leak", "menu" : menu_leak, "caption": "漏电设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "memu_setting", "menu" : memu_setting, "caption": "参数设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_current", "menu" : menu_current, "caption": "电流设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_voltage", "menu" : menu_voltage, "caption": "电压设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "故障查询", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm_display", "menu" : menu_alarm_display, "caption": "当前故障", "page" : MENU_ALARM_PAGE, "prev": menu_alarm_curve, "next": menu_alarm_curve, "max_items" : 1}, + {"name" : "menu_alarm_curve", "menu" : menu_alarm_curve, "caption": "曲线故障", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_alarm_display, "next": menu_alarm_display, "max_items" : 1}, + + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "故障查询", "page" : MENU_ALARM_PAGE, "max_items" : 1}, + {"name" : "menu_test", "menu" : menu_test, "caption": "保护试验", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_measure", "menu" : mqtt_pack_measure, "caption": "测量数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_data", "menu" : menu_data, "caption": "数据页面", "page" : MENU_DATA_PAGE, "max_items" : 8}, + {"name" : "menu_curve_physical", "menu" : menu_curve_physical, "caption": "物理曲线", "page" : MENU_CURVE_PAGE, "prev": menu_curve_harmonic, "next": menu_curve_adc, "max_items" : 8}, + {"name" : "menu_curve_adc", "menu" : menu_curve_adc, "caption": "ADC曲线", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_curve_physical, "next": menu_curve_harmonic, "max_items" : 8}, + {"name" : "menu_curve_harmonic", "menu" : menu_curve_harmonic, "caption": "谐波曲线", "page" : MENU_HARNOMIC_CURVE_PAGE, "prev": menu_curve_adc, "next": menu_curve_physical, "max_items" : 8}, + {"name" : "calibrate", "menu" : calibrate, "caption": "标定页面", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_switch_cmd", "menu" : menu_switch_cmd, "caption": "通讯操作", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_param", "menu" : mqtt_pack_param, "caption": "参数刷新", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_video_trigger", "menu" : mqtt_video_trigger, "caption": "视频触发", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_globalmeasure", "menu" : mqtt_pack_globalmeasure, "caption": "测温数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_time_update", "menu" : mqtt_time_update, "caption": "时钟设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, +] + + +# mqtt 故障查询函数 +def func_alarm_query(device : class_modbus_comm_device, alarm_index = 0) : + result = device.protocol.modbus_write_regs(device.comm_addr, 8120, 1, alarm_index) + time.sleep(0.05) + alarm_regs = device.protocol.modbus_read_regs(device.comm_addr, 8121, 20) + if alarm_regs != None : + device.modbus_regs_flush(8121, 20, alarm_regs) + + msg_alarm_dict = device.comm_item_trigger_mqtt_pack(mqtt_pack_alarm) + + err_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmCode", 0) + err_code = int(err_code) + test_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmTest", 0) + test_code = int(test_code) + + + test_value_str = get_alias_value_str("alias_alarm_type", test_code) + if test_value_str == None: + test_value_str = " " + err_code_str = get_alias_value_str("alias_alarm", err_code) + if err_code_str == None: + err_code_str = " " + msg_alarm_dict["AlarmCodeMsg"] = err_code_str + msg_alarm_dict["AlarmTestMsg"] = test_value_str + msg_alarm_dict["index"] = alarm_index + msg : str = json.dumps(msg_alarm_dict, ensure_ascii=False) + + if device.mqtt_thread : + device.mqtt_thread.publish("response/alarm/" + device.unique_name, msg) + +# mqtt action处理函数 +def func_action_process(device : class_modbus_comm_device, menu_item = None, value_str : str = None) : + action_str = utils.dict_or_object_get_attr(menu_item, "action", " ") + mqtt_name = utils.dict_or_object_get_attr(menu_item, "mqtt", " ") + result = None + + if action_str == "SetupTime" : #设置保护器时间 + numbers = re.findall(r'\d+', value_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + device.protocol.modbus_write_regs(device.comm_addr, 2300, 6, (year, month, day, hour, minute, second)) + pass + if action_str == "calibrate999" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2007) + if action_str == "calibrate0" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2006) + if action_str == "write_bit" or action_str == "test": + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", " ") + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if reg_count == 1: + command_value = [1] + result = device.write_bit_register(reg_addr, command_value) + + if device.mqtt_thread and result != None: + device.mqtt_thread.publish("response/action/" + device.unique_name, '{"name" : "%s", "result" : %d}'%(mqtt_name, result)) + + +class class_menu_comm_device_config(class_comm_device_config): + def __init__(self): + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_top + def get_menu_top(self) : + return menu_main + + def get_menu_caption_info(self) : + return menu_caption + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + def is_gb2312(self) : + return False + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_menu_comm_device_config() diff --git a/menu_mine.py b/menu_mine.py new file mode 100644 index 0000000..054c7d2 --- /dev/null +++ b/menu_mine.py @@ -0,0 +1,2536 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_utils as uitls +from enum import Enum +from datetime import datetime +import time +import menu_utils as utils +import json +import re +from enum import Enum +from comm_modbus_device import class_modbus_comm_device + +now_time = datetime.now() +current_time = now_time.strftime("(%y/%m/%d)") +VERSION_DATE = current_time + +class StrInfo(Enum): + STR_MAX_VALUE = 0, #"最大值" + STR_MIN_VALUE = 1, #"最小值" + STR_SET_VALUE = 2, #"设定值" + STR_VALUE_EXCEED = 3, #"设定值越界" + STR_ZERO_PHASE = 4, #"有功相位" + STR_INPUT_PASSWORD = 5, #"请输入系统密码 + STR_SYSTEM_PASSWORD = 6, #"系统密码" + STR_PASSWORD_ERR = 7, #"密码错误" + STR_SHORT_PHASE_MODIFY =8, #"短路倍数\n恢复缺省" + STR_SWITCH_TYPE_MODIFY =9, #"漏电延时\n恢复缺省" + STR_SOFT_VERSION =10, #"软件版本" + STR_NO_RECORD =11, #"无记录" + STR_ENTER_TO_CLEAR =12, #"确定清除" + STR_ESC_TO_CANCEL =13, #"ESC取消" + STR_CLEAR_FINISH =14, #"清除成功" + STR_ESC_TO_EXIT =15, #"ESC退出 + STR_INPUT_NEW_PASSWORD =16, #"请设置新密码" + STR_NOT_POSSIBLE_TO_MODIFY =17, #"不可修改" + STR_CAPACITOR_MEASURE =18, #"电容检测 + STR_CAPACITOR_EQUAL =19, #"电容" + STR_LEEKAGE_MEASURE =20, #"检测中.." + STR_TEST_ACTIVE =21, #"测试状态 + STR_POWER_ON=22, #"合闸" + STR_POWER_OFF=23, #"分闸" + STR_FAIL=24, #"失效" + STR_NORMAL=25, #"正常" + STR_MEASURE_CURRENT=26, #"实测电流" + STR_RATE_CURRENT=27, #"额定电流" + STR_ANGLE=28, #"角度" + STR_AVERAGE_CURRENT=29, #"平均电流" + STR_MAX_CURRENT=30, #"最大电流 + STR_LOW_VOLTAGE_RATE=31, #"欠压值 + STR_MEASURE_VOLTAGE=32, #"实测电压" + STR_ZERO_CURRENT=33, #"零序电流" + STR_ZERO_VOLTAGE=34, #"零序电压" + STR_RECORD=35, #"记录" + STR_LEEAKGE_LOCK_VALUE=36, #"闭锁设定值" + STR_LEEAKGE_ACTIVE_VALUE=37, #"动作设定值" + STR_MEASURE_RESISTOR=38, #"电阻测量值" + STR_FRONT_CIRCUIT=39, #"前机" + STR_NEXT_CIRCUIT=40, #"后机" + STR_RATE_VOLTAGE=41, #"额定电压" + STR_PARA_MODIFY_ERROR=42, #"参数修改失败" + STR_LEEKAGE_RES_FINISH=43, #"闭锁电阻检测完" + STR_LEEKAGE_RES_MEASURE=44, #"闭锁电阻检测中" + STR_SFJ_MONITOR=45, #"双风机磁力监控" + STR_CL_MONITOR=46, #"磁力监控系统" + STR_CL_DB_MONITOR=47, #"双回路磁力监控" + STR_YB_MONITOR=48, #"移变低压侧" + STR_KUI_DIAN_MONITOR=49, #"馈电开关监控" + STR_TYPE=50, #"类型:" + STR_TOP_SWITCH=51, #"总开关" + STR_BOTTOM_SWITCH=52, #"分开关" + STR_COS_V=53, #"COS(ΦaΦbΦc)" + STR_POWER_VI=54, #"有功功率" + STR_POWER_VI_T=55, #"电量" + STR_FRONT_POWER_ON=56, #"前机合" + STR_NEXT_POWER_ON=57, #"后机合" + STR_FRONT_POWER_OFF=58, #"前机分" + STR_NEXT_POWER_OFF=59, #"后机分" + STR_FRONT_RESISTOR=60, #"前机电阻:" + STR_NEXT_RESISTOR=61, #"后机电阻:" + STR_WORK_MODE=62, #"模式:" + STR_LEEKAGE_RES=63, #"漏电电阻" + STR_REVERSE_VOLTAGE=64, #"反电动势\n注意安全" + STR_LIGHT=65, #"照明" + STR_SIGNAL=66, #"信号" + STR_SWITCH_STATUS=67, #"开关状态" + STR_POWER_ON_COUNTS=68, #"合闸次数" + STR_SETTING=69, #"设定值" + STR_POW_U=70, #"无功功率" + STR_TEST_FAIL=71, #"测试不正确" + STR_LEAKAGE_TEST_FAIL=72, #"漏电测试不正确" + STR_DETECT_FAIL_WHEN_POWER_ON=73, #"合闸时不能检测" + STR_LINK=74, #"联机系统" + STR_SINGLE=75, #"单机系统" + STR_STATUS=76, #"状态" + STR_MAIN_FIRST=77, #"主机优先" + STR_MAIN_BAK_SAME=78, #"主辅对等" + STR_MAIN_BAK_SWITCH=79, #"主辅轮动" + STR_SWITCH_DISABLE=80, #"局扇模式" + STR_MAIN=81, #"主机" + STR_BACKUP=82, #"备机" + STR_SINGLE_CIRCUIT_FRONT=83, #"单前机" + STR_SINGLE_CIRCUIT_NEXT=84, #"单后机" + STR_DOUBLE_CIRCUIT=85, #"双回路" + STR_WATER_PUMP_ON=86, #"水泵已开阀" + STR_WATER_PUMP_OFF=87, #"水泵已关阀" + STR_SWITCH_FAIL=88, #"粘连" + STR_SWITCH_THROUGH_2=89, #"击穿" + STR_GB_MONITOR=90, #"高压真空配电装置" + STR_GB_PROTECT_SYSTEM=91, #"综合保护监控系统" + STR_YBGY_MONITOR=92, #"移变高压侧" + STR_ERROR=93, #"故障" + STR_TEMPERATURE=94, #"温度" + STR_NEXT_CURRENT=95, #"后机电流" + STR_FRONT_CURRENT=96, #"前机电流" + STR_FJ_WS_LOCK=97, #"风机处瓦斯闭锁" + STR_GZM_WS_LOCK=98, #"工作面瓦斯闭锁" + STR_CURRENT=99, #"电流" + STR_VOLTAGE=100, #"电压" + STR_MONITOR_RES=101, #"监视电阻" + STR_SWITCH_THROUGH_SIMPLE=102, #"击穿" + STR_LINK_FAIL=103, #"联机失败" + STR_RES_OFF=104, #"漏电临界值" + STR_ANOTHER_REPAIR=105, #"另台维修请勿停机" + STR_WS_INTENSITY=106, #"瓦斯浓度" + STR_HIGH_VOLT=107, #"高压" + STR_AUTO=108, #"自动" + STR_MANUAL=109, #"手动" + STR_FREQUENCY=110, #"频率" + STR_FWD_ON=111, #正向启动 + STR_RVS_ON=112, #反向启动 + STR_TEMPERATURE_UNIT=113, #温度单位 + STR_POWER_LOSS=114, + STR_CALIBRATE_SUCCESS=115, #标定成功 + STR_ISOLATE_RES=116, #绝缘电阻 + STR_WATER_MONITOR=117, #水位控制排水监控系统 + STR_SWTICH_PROTECTOR=118, #ZDB-200电动机保护器 + STR_INDEPENDENT=119, #独立模式 + STR_DEPENDENT=120, #联动模式 + STR_OUT_POSITION=121, + STR_IN_POSITION=122, + STR_QUIT_IN_POSITION=123, + STR_RUN_DATA=124, + STR_WATER_MODE=125, + STR_INV_MODE=126, + STR_ISOLATE_RESISTOR_LOW=127, + STR_SWITCH=128, + STR_DIDAO=129, + STR_REMOTE=130, + STR_LOCAL=131, + STR_ONE_KEY_LOCK=132, + STR_COMM_FAIL=133, + +class Alarm(Enum): + ERR_NONE = 0, + ERR_CREEPAGE_LOCK = 1, #漏电报警 + ERR_VOLTAGE_LOW = 2, #欠压报警 + ERR_OVER_CURRENT = 3, #过流保护 + ERR_SHORT_CURRENT = 4, #短路保护 + ERR_CREEPAGE_SELECT = 5, #选漏 + ERR_UNBANLANCE_CURRENT = 6, #三相不平衡 + ERR_FLASH_FAIL = 7, #FLASH无法写入 + ERR_CREEPAGE_ACTIVE = 8, #漏电动作 + ERR_BREAK_PHASE = 9, #断相保护动作 + ERR_VOLTAGE_BREAK_PHASE = 10, #电压断相 + ERR_GAS_LOCK = 11, #瓦斯闭锁 + ERR_WIND_MOTOR_LOCK = 12, #风电闭锁 + ERR_VOLTAGE_OVER = 13, #过压报警 + ERR_SHORT_PHASE = 14, #相敏短路 + ERR_WATCH_DOG = 15, #看门狗保房 + ERR_SWITCH_FAIL = 16, #开关粘轿 + ERR_SWITCH_THROUGH = 17, #开关击? + ERR_SWITCH_ON_FAIL = 18, #开关合闸失? + ERR_COMM_FAIL = 19, #通讯故障 + ERR_CREEPAGE_SELECT2 = 20, #选择性报? + ERR_TEMP_IO_HIGH = 21, #IO口温度过驿 + ERR_SHORT_CURRENT_SIGNAL = 22, #信号电流短路 + ERR_REMOTE_OFF = 23, #远方分励 + ERR_REPAIR = 24, #维修状? + ERR_TEMP_ALARM = 25, #温度报警 + ERR_QUICK_CREEPAGE_ACT = 26, #快速漏电动仿 + ERR_GB_LEEK_SHORT = 27, #高爆绝缘短路 + ERR_GB_LEEK_BREAK = 28, #高爆绝缘断路 + ERR_YB_LOW_VOLTAGE_FAIL = 29, #移变低压侧失? + ERR_YB_LOW_VOLTAGE_UNREADY = 30, #移变低压侧未准备? + ERR_WS_FREQ_FAIL = 31, #瓦斯浓度超标 + ERR_HIGH_LOW_LOCK = 32, #高低压联钿 + ERR_MOTOR_ROTATE_LOCK = 33, #电机堵转 + ERR_FIX_TIME_OVER_CURRENT = 34, #定时限过泿 + ERR_FIX_TIME_SHORT_CURRENT = 35, #定时限短? + ERR_PHASE_ERROR = 36, #相序故障 + ERR_UNDER_LOAD = 37, #欠载保护 + ERR_PHASE_UNMATCH = 38, #互感器反? + ERR_EXTERNAL_ALARM = 39, #外部故障 + ERR_SENSOR_LOSS = 40, #水位传感器未? + ERR_ROTOR_SLOW = 41, + ERR_ROTOR_LOCK = 42, + ERR_POWER_LOSS = 43, #系统断电 + ERR_RSV1 = 44, + ERR_RSV2 = 45, + ERR_RSV3 = 46, + ERR_RSV4 = 47, + ERR_RSV5 = 48, + ERR_RSV6 = 49, + ERR_RSV7 = 50, + ERR_USER_ALARM1 = 51, #50,用户自定义故阿 + ERR_USER_ALARM2 = 52, #51,用户自定义故阿 + ERR_USER_ALARM3 = 53, #52,用户自定义故阿 + ERR_USER_ALARM4 = 54, #53,用户自定义故阿 + ERR_GB_LIGHT_THREAD_SON_LOSS = 55, + ERR_GB_LIGHT_THREAD_BROTHER_LOSS = 56, + ERR_GB_LIGHT_MODULE_LOSS = 57, + ERR_GB_FORCE_LEEK_OFF = 58, + ERR_GB_FORCE_SHORT_OFF = 59, + ERR_GB_CREEPAGE_SELECT = 60, #选择性报警 + ERR_SWITCH_OUT_POSITION = 61, + ERR_DZM_CREEPAGE_ACTIVE = 62, + ERR_OIL_PRESSURE_SENSOR_FAIL = 63, + ERR_FREQ_SENSOR_EXCEED = 64, + ERR_FREQ_SENSOR_FAIL = 65, + ERR_ANALOG_SENSOR_EXCEED = 66, + ERR_ANALOG_SENSOR_FAIL = 67, + ERR_VOLTAGE_LOSS = 68, + ERR_SPEED_LOSS = 69, + ERR_GB_ZERO_VOLT_OVER = 70, #零序过压 + ERR_PT_BREAK = 71, + ERR_CT_BREAK = 72, + ERR_ZERO_OVER_VOLTAGE = 73, + ERR_ZERO_OVER_CURRENT = 74, + ERR_GAS_WARNING = 75, + ERR_TEMP_WARNING = 76, + ERR_COMM_LOSS = 77, + ERR_CAR_FAIL = 78, + ERR_WATER_LOW = 79, + ERR_SWITCH_DIDAO_IN_POSITION = 80, + ERR_SWITCH_DIDAO_MID_POSITION = 81, + ERR_GB_CREEPAGE_SELECT_5 = 82, #5次谐波选漏 + ERR_FLUX_LOCK = 83, + ERR_GLOBAL_OIL_TEMP_LOCK = 84, + ERR_GLOBAL_WATER_PRESSURE_LOCK = 85, + ERR_GLOBAL_WATER_LEVEL_LOCK = 86, + ERR_GLOBAL_CURRENT_SENSOR_LOSS = 87, + ERR_GLOBAL_GAS_PERCENTAGE_LOCK = 88, + ERR_GLOBAL_GAS_SENSOR_LOSS = 89, + ERR_MEASURE_OVER_CURRENT = 90, #测量回路过流保护 + ERR_CREAPGE_BREAK = 91, + ERR_REMOTE_CREAPGE_TEST_FAIL = 92, + ERR_REMOTE_CREAPGE_TEST_SUCCESS = 93, + + + +class Alias(Enum): + alias_alarm = 0, + alias_str = 1, + alias_company = 2, + alias_bool = 3, + alias_voltage = 4, + alias_parity = 5, + alias_baud = 6, + alias_input = 7, + alias_onoff = 8, + alias_test = 9, + alias_can_baud = 10, + alias_measure_v = 11, + alias_switch_type = 12, + alias_work_mode = 13, + alias_us_phase = 14, + alias_sensor = 15, + alias_table = 16, + alias_remote = 17, + alias_current = 18, + alias_eth = 19, + alias_lcd = 20, + alias_dev = 21, + alias_fyj = 22, + alias_alarm_type = 23, + alias_car_position = 24, + +class Menu(Enum): + menu_current = 0, + menu_test = 1, + +alias_table = [ + {Alias.alias_alarm: {Alarm.ERR_NONE: "无故障", + Alarm.ERR_CREEPAGE_LOCK: "漏电闭锁", + Alarm.ERR_VOLTAGE_LOW: "欠压", + Alarm.ERR_OVER_CURRENT : "过流保护", #过流保护 + Alarm.ERR_SHORT_CURRENT : "短路保护", #短路保护 + Alarm.ERR_CREEPAGE_SELECT : "选漏", #选漏 + Alarm.ERR_UNBANLANCE_CURRENT : "三相不平衡", #三相不平衡报? + Alarm.ERR_FLASH_FAIL : "FLASH无法写入", #FLASH无法写入 + Alarm.ERR_CREEPAGE_ACTIVE : "漏电动作", #漏电动作 + Alarm.ERR_BREAK_PHASE : "电流断相", #断相保护动作 + Alarm.ERR_VOLTAGE_BREAK_PHASE : "电压断相", #电压断相 + Alarm.ERR_GAS_LOCK : "瓦斯闭锁", #瓦斯闭锁 + Alarm.ERR_WIND_MOTOR_LOCK : "风电闭锁", #风电闭锁 + Alarm.ERR_VOLTAGE_OVER : "过压", #过压报警 + Alarm.ERR_SHORT_PHASE : "相敏短路", #相敏短路 + Alarm.ERR_WATCH_DOG : "看门狗重启", #看门狗保房 + Alarm.ERR_SWITCH_FAIL : "真空管粘连", #真空管粘连 + Alarm.ERR_SWITCH_THROUGH : "真空管击穿", #真空管击穿 + Alarm.ERR_SWITCH_ON_FAIL : "合闸失败", #合闸失败 + Alarm.ERR_COMM_FAIL : "通讯失败", #通讯失败 + Alarm.ERR_CREEPAGE_SELECT2 : "选 漏", #选 漏 + Alarm.ERR_TEMP_IO_HIGH : "温度过高", #温度过高 + Alarm.ERR_SHORT_CURRENT_SIGNAL : "信号电流短路", #信号电流短路 + Alarm.ERR_REMOTE_OFF : "远方分励", #远方分励 + Alarm.ERR_REPAIR : "维修状态", #维修状态 + Alarm.ERR_TEMP_ALARM : "温度报警", #温度报警 + Alarm.ERR_QUICK_CREEPAGE_ACT : "漏电 动作", #快速漏电 动作 + Alarm.ERR_GB_LEEK_SHORT : "绝缘短路", #绝缘短路 + Alarm.ERR_GB_LEEK_BREAK : "绝缘断路", #绝缘断路 + Alarm.ERR_YB_LOW_VOLTAGE_FAIL : "低压侧故障", #低压侧故障 + Alarm.ERR_YB_LOW_VOLTAGE_UNREADY : "低压侧未准备好", #低压侧未准备好 + Alarm.ERR_WS_FREQ_FAIL : "瓦斯浓度超标", #瓦斯浓度超标 + Alarm.ERR_HIGH_LOW_LOCK : "高低压联锁", #高低压联锁 + Alarm.ERR_MOTOR_ROTATE_LOCK : "电机堵转", #电机堵转 + Alarm.ERR_FIX_TIME_OVER_CURRENT : "定时限过流", #定时限过流 + Alarm.ERR_FIX_TIME_SHORT_CURRENT : "定时限短路", #定时限短路? + Alarm.ERR_PHASE_ERROR : "相序故障", #相序故障 + Alarm.ERR_UNDER_LOAD : "欠载保护", #欠载保护 + Alarm.ERR_EXTERNAL_ALARM : "外部故障", #外部故障 + Alarm.ERR_POWER_LOSS : "系统断电", #系统断电 + Alarm.ERR_USER_ALARM1 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_USER_ALARM2 : "触头温度超标", #用户自定义故阿 + Alarm.ERR_GB_LIGHT_THREAD_SON_LOSS : "光纤子节点丢失", + Alarm.ERR_GB_LIGHT_THREAD_BROTHER_LOSS : "光纤兄弟节点丢失", + Alarm.ERR_GB_LIGHT_MODULE_LOSS : "无光纤模块", + Alarm.ERR_GB_FORCE_LEEK_OFF : "光纤漏电越级跳", + Alarm.ERR_GB_FORCE_SHORT_OFF : "光纤短路越级跳", + Alarm.ERR_GB_CREEPAGE_SELECT : "漏电", #选择性报警 + Alarm.ERR_SWITCH_OUT_POSITION : "开关未推到位", + Alarm.ERR_DZM_CREEPAGE_ACTIVE : "漏电动作", + Alarm.ERR_OIL_PRESSURE_SENSOR_FAIL : "油压传感器未接入", + Alarm.ERR_FREQ_SENSOR_EXCEED : "频率传感器超限", + Alarm.ERR_FREQ_SENSOR_FAIL : "频率传感器未接入", + Alarm.ERR_ANALOG_SENSOR_EXCEED : "模拟量传感器超限", + Alarm.ERR_ANALOG_SENSOR_FAIL : "模拟量传感器未接入", + Alarm.ERR_VOLTAGE_LOSS : "失压故障", + Alarm.ERR_SPEED_LOSS : "失速故障", + Alarm.ERR_GB_ZERO_VOLT_OVER : "零序过压", + Alarm.ERR_PT_BREAK : "PT断线", + Alarm.ERR_CT_BREAK : "CT断线", + Alarm.ERR_ZERO_OVER_VOLTAGE : "零序过压", + Alarm.ERR_ZERO_OVER_CURRENT : "零序过流", + Alarm.ERR_GAS_WARNING : "轻瓦斯告警", + Alarm.ERR_TEMP_WARNING : "温度异常", + Alarm.ERR_COMM_LOSS : "通讯中断", + Alarm.ERR_CAR_FAIL : "手车控制器故障", + Alarm.ERR_WATER_LOW : "循环泵无水故障", + Alarm.ERR_SWITCH_DIDAO_IN_POSITION: "地刀合闸保护中", + Alarm.ERR_SWITCH_DIDAO_MID_POSITION: "地刀未到位", + Alarm.ERR_GB_CREEPAGE_SELECT_5: "5次谐波选漏", + Alarm.ERR_FLUX_LOCK: "流量闭锁", + Alarm.ERR_GLOBAL_OIL_TEMP_LOCK: "油温闭锁", + Alarm.ERR_GLOBAL_WATER_PRESSURE_LOCK: "水压闭锁", + Alarm.ERR_GLOBAL_WATER_LEVEL_LOCK: "液位闭锁", + Alarm.ERR_GLOBAL_CURRENT_SENSOR_LOSS: "互感器未接入", + Alarm.ERR_GLOBAL_GAS_PERCENTAGE_LOCK: "瓦斯浓度闭锁", + Alarm.ERR_GLOBAL_GAS_SENSOR_LOSS: "瓦斯断线", + Alarm.ERR_MEASURE_OVER_CURRENT: "测量回路过流", + Alarm.ERR_CREAPGE_BREAK: "接地开路", + Alarm.ERR_REMOTE_CREAPGE_TEST_FAIL: "漏电测试失败", + Alarm.ERR_REMOTE_CREAPGE_TEST_SUCCESS: "漏电测试成功", + } + }, + + {"alias_str" : { StrInfo.STR_MAX_VALUE :"最大值", + StrInfo.STR_MIN_VALUE :"最小值", + StrInfo.STR_SET_VALUE :"设定值", + StrInfo.STR_VALUE_EXCEED :"设定值越界", + StrInfo.STR_ZERO_PHASE :"有功相位", + StrInfo.STR_INPUT_PASSWORD :"请输入系统密码", + StrInfo.STR_SYSTEM_PASSWORD :"系统密码", + StrInfo.STR_PASSWORD_ERR :"密码错误", + StrInfo.STR_SHORT_PHASE_MODIFY :"短路倍数\n恢复缺省", + StrInfo.STR_SWITCH_TYPE_MODIFY :"漏电延时\n恢复缺省", + StrInfo.STR_SOFT_VERSION:"软件版本", + StrInfo.STR_NO_RECORD :"无记录", + StrInfo.STR_ENTER_TO_CLEAR:"确定清除", + StrInfo.STR_ESC_TO_CANCEL:"ESC取消", + StrInfo.STR_CLEAR_FINISH :"清除成功", + StrInfo.STR_ESC_TO_EXIT :"ESC退出", + StrInfo.STR_INPUT_NEW_PASSWORD :"请设置新密码", + StrInfo.STR_NOT_POSSIBLE_TO_MODIFY :"不可修改", + StrInfo.STR_CAPACITOR_MEASURE :"电容检测", + StrInfo.STR_CAPACITOR_EQUAL :"电容", + StrInfo.STR_LEEKAGE_MEASURE :"检测中..", + StrInfo.STR_TEST_ACTIVE :"测试状态", + StrInfo.STR_POWER_ON :"合闸", + StrInfo.STR_POWER_OFF :"分闸", + StrInfo.STR_FAIL :"失效", + StrInfo.STR_NORMAL :"正常", + StrInfo.STR_MEASURE_CURRENT :"实测电流", + StrInfo.STR_RATE_CURRENT :"额定电流", + StrInfo.STR_ANGLE :"角度", + StrInfo.STR_AVERAGE_CURRENT :"平均电流", + StrInfo.STR_MAX_CURRENT :"最大电流", + StrInfo.STR_LOW_VOLTAGE_RATE :"欠压值", + StrInfo.STR_MEASURE_VOLTAGE :"实测电压", + StrInfo.STR_ZERO_CURRENT :"零序电流", + StrInfo.STR_ZERO_VOLTAGE :"零序电压", + StrInfo.STR_RECORD :"记录", + StrInfo.STR_LEEAKGE_LOCK_VALUE :"闭锁设定值", + StrInfo.STR_LEEAKGE_ACTIVE_VALUE :"动作设定值", + StrInfo.STR_MEASURE_RESISTOR :"电阻测量值", + StrInfo.STR_FRONT_CIRCUIT :"前机", + StrInfo.STR_NEXT_CIRCUIT :"后机", + StrInfo.STR_RATE_VOLTAGE :"额定电压", + StrInfo.STR_PARA_MODIFY_ERROR :"参数修改失败", + StrInfo.STR_LEEKAGE_RES_FINISH :"闭锁电阻检测完", + StrInfo.STR_LEEKAGE_RES_MEASURE :"闭锁电阻检测中", + StrInfo.STR_SFJ_MONITOR :"双风机磁力监控", + StrInfo.STR_CL_MONITOR :"磁力监控系统", + StrInfo.STR_CL_DB_MONITOR :"双回路磁力监控", + StrInfo.STR_YB_MONITOR :"移变低压侧", + StrInfo.STR_KUI_DIAN_MONITOR :"馈电开关监控", + StrInfo.STR_TYPE :"类型:", + StrInfo.STR_TOP_SWITCH :"总开关", + StrInfo.STR_BOTTOM_SWITCH :"分开关", + StrInfo.STR_COS_V :"COS(ΦaΦbΦc)", + StrInfo.STR_POWER_VI :"有功功率", + StrInfo.STR_POWER_VI_T :"电量", + StrInfo.STR_FRONT_POWER_ON :"前机合", + StrInfo.STR_NEXT_POWER_ON :"后机合", + StrInfo.STR_FRONT_POWER_OFF :"前机分", + StrInfo.STR_NEXT_POWER_OFF :"后机分", + StrInfo.STR_FRONT_RESISTOR :"前机电阻:", + StrInfo.STR_NEXT_RESISTOR :"后机电阻:", + StrInfo.STR_WORK_MODE :"模式:", + StrInfo.STR_LEEKAGE_RES :"漏电电阻", + StrInfo.STR_REVERSE_VOLTAGE :"反电动势\n注意安全", + StrInfo.STR_LIGHT :"照明", + StrInfo.STR_SIGNAL :"信号", + StrInfo.STR_SWITCH_STATUS :"开关状态", + StrInfo.STR_POWER_ON_COUNTS :"合闸次数", + StrInfo.STR_SETTING :"设定值", + StrInfo.STR_POW_U :"无功功率", + StrInfo.STR_TEST_FAIL :"测试不正确", + StrInfo.STR_LEAKAGE_TEST_FAIL :"漏电测试不正确", + StrInfo.STR_DETECT_FAIL_WHEN_POWER_ON :"合闸时不能检测", + StrInfo.STR_LINK :"联机系统", + StrInfo.STR_SINGLE :"单机系统", + StrInfo.STR_STATUS :"状态", + StrInfo.STR_MAIN_FIRST :"主机优先", + StrInfo.STR_MAIN_BAK_SAME :"主辅对等", + StrInfo.STR_MAIN_BAK_SWITCH :"主辅轮动", + StrInfo.STR_SWITCH_DISABLE :"局扇模式", + StrInfo.STR_MAIN :"主机", + StrInfo.STR_BACKUP :"备机", + StrInfo.STR_SINGLE_CIRCUIT_FRONT :"单前机", + StrInfo.STR_SINGLE_CIRCUIT_NEXT :"单后机", + StrInfo.STR_DOUBLE_CIRCUIT :"双回路", + StrInfo.STR_WATER_PUMP_ON :"水泵已开阀", + StrInfo.STR_WATER_PUMP_OFF :"水泵已关阀", + StrInfo.STR_SWITCH_FAIL :"粘连", + StrInfo.STR_SWITCH_THROUGH_2 :"击穿", + StrInfo.STR_GB_MONITOR :"高压真空配电装置", + StrInfo.STR_GB_PROTECT_SYSTEM :"综合保护监控系统", + StrInfo.STR_YBGY_MONITOR :"移变高压侧", + StrInfo.STR_ERROR :"故障", + StrInfo.STR_TEMPERATURE:"温度", + StrInfo.STR_NEXT_CURRENT :"后机电流", + StrInfo.STR_FRONT_CURRENT :"前机电流", + StrInfo.STR_FJ_WS_LOCK :"风机处瓦斯闭锁", + StrInfo.STR_GZM_WS_LOCK :"工作面瓦斯闭锁", + StrInfo.STR_CURRENT :"电流", + StrInfo.STR_VOLTAGE:"电压", + StrInfo.STR_MONITOR_RES :"监视电阻", + StrInfo.STR_SWITCH_THROUGH_SIMPLE :"击穿", + StrInfo.STR_LINK_FAIL :"联机失败", + StrInfo.STR_RES_OFF :"漏电临界值", + StrInfo.STR_ANOTHER_REPAIR :"另台维修请勿停机", + StrInfo.STR_WS_INTENSITY :"瓦斯浓度", + StrInfo.STR_HIGH_VOLT :"高压", + StrInfo.STR_AUTO :"自动", + StrInfo.STR_MANUAL :"手动", + StrInfo.STR_FREQUENCY :"频率", + StrInfo.STR_FWD_ON :"正向启动", + StrInfo.STR_RVS_ON :"反向启动", + StrInfo.STR_TEMPERATURE_UNIT : "℃", + StrInfo.STR_POWER_LOSS :"系统断电", + StrInfo.STR_CALIBRATE_SUCCESS :"标定成功", + StrInfo.STR_ISOLATE_RES :"绝缘电阻", + StrInfo.STR_WATER_MONITOR :"水位控制排水监控系统", + StrInfo.STR_SWTICH_PROTECTOR :"ZDB-200电动机保护器", + StrInfo.STR_INDEPENDENT :"独立模式", + StrInfo.STR_DEPENDENT :"联动模式", + StrInfo.STR_OUT_POSITION : "未到位", + StrInfo.STR_IN_POSITION : "进到位", + StrInfo.STR_QUIT_IN_POSITION : "退到位", + StrInfo.STR_RUN_DATA : "运行数据", + StrInfo.STR_WATER_MODE : "水位", + StrInfo.STR_INV_MODE : "可逆", + StrInfo.STR_ISOLATE_RESISTOR_LOW : "绝缘电阻降低", + StrInfo.STR_SWITCH : "开关", + StrInfo.STR_DIDAO : "地刀", + StrInfo.STR_REMOTE : "程控", + StrInfo.STR_LOCAL : "就地", + StrInfo.STR_ONE_KEY_LOCK : "闭锁中", + StrInfo.STR_COMM_FAIL : "通讯失败", + }}, + + {"alias_company": {0: "浙江志展智能科技", + 1: "华荣科技", + } + }, + {"alias_sensor" : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "1500 A", 25: "2000 A", 26: "2500 A" ,27: "5 A"}}, + {"alias_switch_type" : {0: "总开关", 1: "分开关"}}, + {"alias_measure_v": {0: "正电压", 1: "负电压"}}, + {"alias_select": {0: "工频负载", 1:"变频负载"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"380V", 1:"660V", 2:"1140V", 3:"3300V", 4:"100V", 5:"127V", 6:"220V", 7:"440V"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_input": {0: "常开", 1: "常闭"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_test": {0: "模拟测试", 1: "继电器测试"}}, + {"alias_can_baud": {0: "1000K", 1: "800K", 2: "500K", 3: "250K", 4: "125K", 5: "100K", 6: "50K", 7: "20K", 8: "10K", 9: "AUTO"}}, + {Alias.alias_measure_v: {0: "正电压", 1: "负电压"}}, + {Alias.alias_switch_type : {0: "总开关", 1: "分开关"}}, + {"alias_work_mode": {0: "水位模式", 1: "磁力模式", 2: "正反转模式", 3: "联控模式"}}, + {"alias_us_phase": {0: "Uab_ABC", 1: "Uab_ACB", 2: "Ubc_ABC", 3: "Ubc_ACB", 4: "Uca_ABC", 5: "Uca_ACB"}}, + {Alias.alias_sensor : {0: "10 A", 1: "30 A", 2: "50 A", 3: "75 A", 4: "80 A", 5: "100 A", + 6: "120 A", 7: "150 A", 8: "200 A", 9: "300 A", 10: "315 A", 11: "400 A", + 12: "500 A", 13: "600 A", 14: "630 A", 15: "800 A", 16: "1000 A", 17: "1250 A", + 18: "1300 A", 19: "1600 A", 20: "160 A", 21: "250 A", 22: "750 A", 23: "1200 A", + 24: "2500 A", 25: "5 A"}}, + {"alias_table": {0: "0", 1: "1", 2: "2", 3: "3"}}, + {"alias_remote": {0: "就地", 1: "程控"}}, + {"alias_current": {0: "测量模式", 1: "平均模式"}}, + + {Alias.alias_eth : {0: "无", 1: "一代以太网", 2: "二代以太网"}}, + {Alias.alias_lcd : {0: "一体迪文屏", 1: "分体迪文屏", 2: "大彩屏", 3 : "昆仑通态屏"}}, + {Alias.alias_fyj : {0: "无", 1: "FYJ", 2: "FYJ2", 3 : "FYJ4"}}, + {Alias.alias_dev : {0: "馈电", 1: "高爆", 2: "移变", 3 : "双风机", 4 : "磁力", + 5 : "双磁力", 6 : "照明", 7 : "移变高压侧", 8: "双高爆", + 9: "组合馈电", 10: "双照明", 11 : "ZZ630"}}, + {"alias_alarm_type": {0: "试验", 1: "动作"}}, + {"alias_car_position": {0: "小车未到位", 1 : "小车试验位", 2: "小车工作位", 3 : "位置信号异常"}}, +] + +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + + +def get_alias_value_str(alias_str, alias_value) : + alias_value_msg = None + compare_value = int(alias_value) + + for alias_dict in alias_table : + for alias_name, value_dict in alias_dict.items(): + if isinstance(alias_name, Enum): + alias_name = alias_name.name + + if alias_name == alias_str : + for each_value_dict in value_dict.items(): + if isinstance(each_value_dict[0], Enum) : + key_value = each_value_dict[0].value[0] + else : + key_value = each_value_dict[0] + key_string = each_value_dict[1] + + if int(key_value) == compare_value : + alias_value_msg = key_string + return alias_value_msg + return alias_value_msg + +def func_adjust_current_menu_item(device : class_modbus_comm_device, menu_item) : + #获得互感器类型, 根据互感器类型来调整 scale, format, 让电流可以正确显示与设置 + sensor_type = device.comm_get_value_from_mqtt_name("Sensor") + sensor_current = 400 + + if sensor_type != None : + value_str = get_alias_value_str("alias_sensor", sensor_type) + if value_str != None : + value_str_no_unit = value_str.replace("A", "") + sensor_current = int(value_str_no_unit) + + #80A 以下电流互感器, 显示一位小数点 + if sensor_current <= 80 : + new_item = menu_item + new_item["scale"] = 0.1 + new_item["format"] = "%1.1f" + return new_item + else : + return menu_item + +def func_caculate_Cosf(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + format_str = utils.dict_or_object_get_attr(menu_item, "format", "%1.0f") + try : + cosa = device.comm_get_value_from_mqtt_name("Cosa") + cosb = device.comm_get_value_from_mqtt_name("Cosb") + cosc = device.comm_get_value_from_mqtt_name("Cosc") + cosf = (cosa + cosb + cosc) / 3 + except Exception as e : + cosf = 0.0 + Cosf_str = format_str%(cosf) + mqtt_dict["Cosf"] = Cosf_str + +#视频触发 +def func_video_trigger(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + value = device.comm_get_value_from_menu_item(menu_item) + if value == None : + #通讯未建立 + return + + value = round(value) + in_position = (value >> 10) & 0x1 + out_position = (value >> 9) & 0x1 + now_time = time.time() + if hasattr(device, "MqttVideoActive") == False: + #动态添加视频触发所需的变量 + device.MqttVideoActive = False + device.MqttVideoBaseTime = now_time + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + if in_position != device.DI_SwitchInPosition or out_position != device.DI_SwitchQuitPosition: + #开关进到位与 开关退到位信号, 当这两个状态发生变化时, 触发20秒的视频 + device.MqttVideoActive = True + device.MqttVideoBaseTime = now_time + mqtt_dict["VideoActive"] = "1" + if device.MqttVideoActive : + #视频延时20后主动关闭视频显示 + if now_time - device.MqttVideoBaseTime > 20.0 : + mqtt_dict["VideoActive"] = "0" + device.MqttVideoActive = False + + device.DI_SwitchInPosition = in_position + device.DI_SwitchQuitPosition = out_position + + +COLOR_RED = "#EE2D2D" +COLOR_GREEN = "#83BF6E" + +def func_process_car_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + car_pos_value = device.comm_get_value_from_menu_item(menu_item) + if car_pos_value == None or mqtt_dict == None: + return + car_msg = get_alias_value_str("alias_car_position", car_pos_value) + if car_msg != None : + mqtt_dict["CarPositionMsg"] = car_msg + +def func_process_alarm_message(device : class_modbus_comm_device, menu_item, mqtt_dict : dict = None) : + alarm_id = device.comm_get_value_from_menu_item(menu_item) + if alarm_id == None or mqtt_dict == None: + #通讯未建立 + return + alarm_msg = get_alias_value_str("alias_alarm", alarm_id) + if alarm_msg != None : + alarm_msg_dict = {} + if alarm_id > 0 : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_RED + else : + alarm_msg_dict["value"] = alarm_msg + alarm_msg_dict["color"] = COLOR_GREEN + + mqtt_dict["AlarmMessage"] = alarm_msg_dict + +mqtt_video_trigger = [ + { + "name": "视频触发", + "addr": "8015", + "call" : func_video_trigger, + }, +] + +mqtt_time_update = [ + { + "name": "Year", + "addr": "2300", + "format" : "%04.0f", + "mqtt" : "Year", + }, + { + "name": "Month", + "addr": "2301", + "format" : "%02.0f", + "mqtt" : "Month", + }, + { + "name": "Day", + "addr": "2302", + "format" : "%02.0f", + "mqtt" : "Day", + }, + { + "name": "Hour", + "addr": "2303", + "format" : "%02.0f", + "mqtt" : "Hour", + }, + { + "name": "Minute", + "addr": "2304", + "format" : "%02.0f", + "mqtt" : "Minute", + }, + { + "name": "Second", + "addr": "2305", + "format" : "%02.0f", + "mqtt" : "Second", + }, + { + "name": "SetupTime", + "addr": "2305", + "mqtt" : "SetupTime", + "action" : "SetupTime", + }, +] + +mqtt_pack_param = [ + #系统设置 + { + "name": "开关类型", + "addr": "8210", + "alias" : "alias_switch_type", + "mqtt" : "SwitchType", + }, + { + "name": "瓦斯触点", + "addr": "8190", + "alias" : "alias_input", + "mqtt" : "Gas", + }, + { + "name": "瓦斯延时", + "addr": "8191", + "scale" : 0.01, + "format": "%06.2f", + "mqtt" : "GasDelay", + }, + { + "name": "瓦斯浓度", + "addr": "8237", + "scale" : 0.01, + "format": "%05.2f", + "mqtt" : "GasConcentration", + }, + { + "name": "风电触点", + "addr": "8248", + "alias" : "alias_input", + "mqtt" : "Fan", + }, + { + "name": "风电延时", + "addr": "8234", + "scale" : 0.01, + "format": "%06.2f", + "mqtt" : "FanDelay", + }, + { + "name": "远近控模式", + "addr": "8558", + "alias" : "alias_remote", + "mqtt" : "FarAndNearMode", + }, + { + "name": "维修模式", + "addr": "8565", + "alias" : "alias_bool", + "mqtt" : "MaintenanceMode", + }, + { + "name": "小车报警延时", + "addr": "8576", + "scale" : 0.1, + "format": "%05.1f", + "mqtt" : "CarAlarmDelay", + }, + + { + "name": "断电延时", + "addr": "8249", + "format": "%06.1f", + "scale" : 0.1, + "mqtt" : "OffVoltageDelay", + }, + { + "name": "真空管粘连延时", + "addr": "8209", + "format": "%05.2f", + "scale" : 0.01, + "mqtt" : "TubeDelay", + }, + { + "name": "负载选择", + "alias": "alias_select", + "addr": "8254", + "mqtt" : "LoadSelect", + }, + { + "name": "温度设定", + "addr": "8423", + "scale" : 1, + "format": "%03.0f", + "mqtt" : "Temperature", + }, + { + "name": "触头温度设定", + "addr": "8496", + "scale" : 0.1, + "format": "%05.1f", + "mqtt" : "TemperatureContact", + }, + #电流参数 + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "scale" : 1.0, + "format": "%04.0f", + "action": "rate_current", + "mqtt" : "RateCurrent", + "adjust" : func_adjust_current_menu_item, + }, + + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + "mqtt" : "ShortLevel", + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + "mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" :"alias_sensor", + "addr": "8207", + "mqtt" : "Sensor", + }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + "mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + "mqtt" : "UnbalanceDelay", + }, + { + "name": "定时限过流", + "unit": "Ie", + "addr": "8239", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeOvercurrent", + }, + { + "name": "定时限过流延时", + "unit": "ms", + "addr": "8240", + "scale" : 1, + "format": "%05.0f", + "mqtt" : "TimeOvercurrentDelay", + }, + { + "name": "定时限短路", + "unit": "Ie", + "addr": "8523", + "scale" : 0.01, + "format": "%04.2f", + "mqtt" : "TimeLimitcurrent", + }, + { + "name": "定时限短路延时", + "unit": "ms", + "addr": "8524", + "scale" : 1, + "format": "%03.0f", + "mqtt" : "TimeLimitcurrentDelay", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectIc", + }, + + + #电压参数 + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "mqtt" : "RateVoltage", + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + "mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + "mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + "mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + "mqtt" : "CorrectUs", + }, + + + #漏电参数 + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + "mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "mqtt" : "LeakageDelay", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "mqtt" : "SeriesResistor" + }, + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "mqtt" : "BlockResistor" + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + "mqtt" : "CorrectUo" + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + "mqtt" : "CorrectIo" + }, + { + "name": "检测电压", + "addr": "8253", + "alias": "alias_measure_v", + "mqtt" : "MeasureV" + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0, + "mqtt" : "DelayLeakageTrip" + }, + + #保护参数投入 + { + "name": "短路保护", + "alias": "alias_bool", + "addr": "8192.1", + "mqtt" : "ProtectShort", + }, + { + "name": "相敏保护", + "alias": "alias_bool", + "addr": "8192.13", + "mqtt" : "ProtectPhaseSensitivity", + }, + { + "name": "过载保护", + "alias": "alias_bool", + "addr": "8192.3", + "mqtt" : "ProtectOverLoad", + }, + { + "name": "电流断相保护", + "alias": "alias_bool", + "addr": "8192.4", + "mqtt" : "ProtectCurrentPhaseOff", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + "mqtt" : "ProtectImbalance", + }, + { + "name": "漏电闭锁保护", + "alias": "alias_bool", + "addr": "8192.10", + "mqtt" : "ProtectLeakage" + }, + { + "name": "定时限过载保护", + "alias": "alias_bool", + "addr": "8192.11", + "mqtt" : "ProtectTimeLimitOverload" + }, + { + "name": "定时限短路保护", + "alias": "alias_bool", + "addr": "8192.12", + "mqtt" : "ProtectTimeLimitShortCircuit", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + "mqtt" : "ProtectUnderVoltage", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + "mqtt" : "ProtectOverVoltage", + }, + { + "name": "电压断相保护", + "alias": "alias_bool", + "addr": "8174.2", + "mqtt" : "ProtectVoltagePhaseOff", + }, + { + "name": "漏电动作保护", + "alias": "alias_bool", + "addr": "8174.6", + "mqtt" : "ProtectLeakageAction", + }, + { + "name": "真空管粘连保护", + "alias": "alias_bool", + "addr": "8174.15", + "mqtt" : "ProtectTubeAdhesion", + }, + { + "name": "温度报警保护", + "alias": "alias_bool", + "addr": "8174.8", + "mqtt" : "ProtectTemperatureAlarm", + }, + + #通讯设置 + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + "mqtt" : "485Address", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + "mqtt" : "485Baud", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + "mqtt" : "485Parity", + }, + { + "name": "CAN地址", + "format": "%03.0f", + "addr": "8440", + "mqtt" : "CANAddress", + }, + { + "name": "CAN波特率", + "alias": "alias_can_baud", + "addr": "8439", + "mqtt" : "CANBaud", + }, +] + +mqtt_pack_measure = [ + { + "name": "SwitchStatus", + "addr": "8162.0", + "alias": Alias.alias_onoff, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_STATUS, + "measure" : True, + "mqtt" : "SwitchStatus", + }, + { + "name": "AlarmId", + "addr": "8166", + "alias": Alias.alias_alarm, + "remap_addr": remap.COMM_REMAP_MEASURE_SWITCH_ALARM, + "measure" : True, + "mqtt" : "AlarmId", + }, + { + "name": "AlarmMessage", + "addr": "8166", + "alias": Alias.alias_alarm, + "call" : func_process_alarm_message, + }, + { + "name": "CarPositionMsg", + "addr": "8015.10#2", + "alias": Alias.alias_car_position, + "call" : func_process_car_message, + }, + { + "name": "Ia", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Ia", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "unit": "A", + "addr": "8157", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IB, + "measure" : True, + "mqtt" : "Ib", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "unit": "A", + "addr": "8158", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IC, + "measure" : True, + "mqtt" : "Ic", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Voltage", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Voltage", + }, + { + "name": "Current", + "unit": "A", + "addr": "8156", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_IA, + "measure" : True, + "mqtt" : "Current", + }, + { + "name": "Power", + "unit": "kw", + "addr": "8167", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Power", + }, + { + "name": "Electricity", + "unit": "kwh", + "addr": "8160#2", + "format": "%07.0f", + "measure" : True, + "mqtt" : "Electricity", + }, + { + "name": "Uab", + "unit": "V", + "addr": "8153", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UAB, + "measure" : True, + "mqtt" : "Uab", + }, + { + "name": "Ubc", + "unit": "V", + "addr": "8154", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UBC, + "measure" : True, + "mqtt" : "Ubc", + }, + { + "name": "Uca", + "unit": "V", + "addr": "8155", + "format": "%05.0f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UCA, + "measure" : True, + "mqtt" : "Uca", + }, + { + "name": "Uo", + "unit": "V", + "addr": "8152", + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_UO, + "measure" : True, + "mqtt" : "Uo", + }, + { + "name": "Io", + "unit": "mA", + "addr": "8151", + "format": "%05.1f", + "scale" : 1.0, + "remap_addr" : remap.COMM_REMAP_MEASURE_FLOAT_IO, + "measure" : True, + "mqtt" : "Io", + }, + { + "name": "R", + "unit": "K", + "addr": "8150", + "scale": 0.1, + "format": "%05.1f", + "remap_addr": remap.COMM_REMAP_MEASURE_FLOAT_RO, + "measure" : True, + "mqtt" : "R", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%06.0f", + "property": MENU_PROPERTY_READ_ONLY, + "mqtt" : "OnCount", + }, + { + "name": "Cosa", + "addr": "8172#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "mqtt" : "Cosa", + }, + { + "name": "Cosb", + "addr": "8171#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "mqtt" : "Cosb", + }, + { + "name": "Cosc", + "addr": "8170#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "mqtt" : "Cosc", + }, + { + "name": "Cosf", + "addr": "8171#s", + "scale": 0.01, + "format": "%04.2f", + "measure" : True, + "call" : func_caculate_Cosf, + }, + { + "name": "AngleUoIo", + "addr": "8149", + "format": "%04.2f", + "measure" : True, + "mqtt" : "AngleUoIo", + }, + { + "name": "A相上", + "addr": "8056#s", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Aup", + }, + + { + "name": "B相上", + "addr": "8057#s", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Bup", + }, + { + "name": "C相上", + "addr": "8058#s", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Cup", + }, + { + "name": "A相下", + "addr": "8059#s", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Adown", + }, + { + "name": "B相下", + "addr": "8060#s", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Bdown", + }, + { + "name": "C相下", + "addr": "8061#s", + "format": "%05.1f", + "measure" : True, + "mqtt" : "Cdown", + }, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmCode", + "addr": "8121", + "alias": "alias_alarm", + "mqtt" : "AlarmCode", + }, + { + "name": "AlarmTest", + "addr": "8138", + "alias": "alias_alarm_type", + "format" : "%1.0f", + "mqtt" : "AlarmTest", + }, + { + "name": "Ua", + "addr": "8122", + "format" : "%1.0f", + "mqtt" : "AlarmUa", + }, + { + "name": "Ub", + "addr": "8123", + "format" : "%1.0f", + "mqtt" : "AlarmUb", + }, + { + "name": "Uc", + "addr": "8124", + "format" : "%1.0f", + "mqtt" : "AlarmUc", + }, + { + "name": "Ia", + "addr": "8125", + "format" : "%1.0f", + "mqtt": "AlarmIa", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ib", + "addr": "8126", + "format" : "%1.0f", + "mqtt": "AlarmIb", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ic", + "addr": "8127", + "format" : "%1.0f", + "mqtt": "AlarmIc", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "Ro", + "addr": "8128", + "format" : "%5.1f", + "scale" : 0.1, + "mqtt": "AlarmRo", + }, + { + "name": "Io", + "addr": "8129", + "format" : "%1.1f", + "scale" : 0.1, + "mqtt": "AlarmIo", + }, + { + "name": "Uo", + "addr": "8130", + "format" : "%5.0f", + "scale" : 1.0, + "mqtt": "AlarmUo", + }, + { + "name": "Year", + "addr": "8131", + "format" : "%4.0f", + "mqtt": "AlarmYear", + }, + { + "name": "Month", + "addr": "8132", + "format" : "%2.0f", + "mqtt": "AlarmMonth", + }, + { + "name": "Day", + "addr": "8133", + "format" : "%2.0f", + "mqtt": "AlarmDay", + }, + { + "name": "Hour", + "addr": "8134", + "format" : "%2.0f", + "mqtt": "AlarmHour", + }, + { + "name": "Minute", + "addr": "8135", + "format" : "%2.0f", + "mqtt": "AlarmMinute", + }, + { + "name": "Second", + "addr": "8136", + "format" : "%2.0f", + "mqtt": "AlarmSecond", + }, +] + +menu_data = [ + { + "name": "数据页面", + "sub_menu": "menu_curve_physical", + }, +] + +#曲线菜单 +menu_curve_physical = [ + { + "name": "物理曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#曲线菜单 +menu_curve_adc = [ + { + "name": "ADC曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +#谐波菜单 +menu_curve_harmonic = [ + { + "name": "谐波曲线", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "Idle", + }, +] + +# modbus_comm_table = [ +# {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, +# {"name":"measure", "reg_addr":8000, "reg_count":62, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, +# {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, +# {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, +# #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, +# # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, +# {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000}, +# {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, +# {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, +# {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, +# {"name":"param/info", "reg_addr":8435, "reg_count":10, "cycle": 3000}, +# {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, +# #{"name":"global_status", "reg_addr":3200, "reg_count":6, "cycle": 400}, +# ] +modbus_comm_table = [ + {"name":"alarm", "reg_addr":8120, "reg_count":25, "cycle": 0, "mqtt_pack": mqtt_pack_alarm}, + {"name":"measure", "reg_addr":8000, "reg_count":62, "cycle": 500, "mqtt_pack": mqtt_video_trigger}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": mqtt_pack_measure}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 100}, + #{"name":"key_group", "reg_addr":1000, "reg_count":18, "cycle": 20}, + # {"name":"para_group", "reg_addr":2000, "reg_count":32, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 1000}, + {"name":"param/info", "reg_addr":8174, "reg_count":96, "cycle": 3000, "mqtt_pack" : mqtt_pack_param}, + {"name":"param/info", "reg_addr":8180, "reg_count":60, "cycle": 3000}, + {"name":"param/info", "reg_addr":8490, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8520, "reg_count":20, "cycle": 3000}, + {"name":"param/info", "reg_addr":8550, "reg_count":30, "cycle": 3000}, + {"name":"param/info", "reg_addr":8435, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":8420, "reg_count":10, "cycle": 3000}, + {"name":"param/info", "reg_addr":2000, "reg_count":32, "cycle": 3000}, + #{"name":"global_status", "reg_addr":3200, "reg_count":6, "cycle": 400}, +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + if not hasattr(comm_table_item, "name"): + return False + return False + +menu_current = [ #菜单表[menu_current],存储菜单项属性字典<> + { + "name": "额定电流", + "unit": "A", + "addr": "8200", + "action": "rate_current", + "adjust" : func_adjust_current_menu_item, + }, + { + "name": "短路倍数", + "unit": "Ie", + "scale" : 0.01, + "format": "%05.2f", + "addr": "8201", + "min" : 1.0, + "max" : 10.0, + }, + { + "name": "短路延时", + "unit": "ms", + "scale" : 1.0, + "format": "%03.0f", + "addr": "8198", + "min" : 0.0, + "max" : 200.0, + #"mqtt" : "ShortDelay", + }, + { + "name": "互感器类型", + "alias" : Alias.alias_sensor, + "addr": "8207", + }, + # { + # "name": "反时限表", + # "alias" :"alias_table", + # "addr": "8178", + # }, + { + "name": "不平衡值", + "unit": "%", + "addr": "8213", + "scale" : 1.0, + "format": "%03.0f", + "min" : 10.0, + "max" : 100.0, + #"mqtt" : "UnbalanceLevel", + }, + { + "name": "不平衡延时", + "unit": "s", + "addr": "8197", + "scale" : 0.1, + "format": "%04.1f", + #"mqtt" : "UnbalanceDelay", + }, + { + "name": "B相电流", + "alias": "alias_current", + "addr": "8244", + }, + { + "name": "Ia 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8217", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIa", + }, + { + "name": "Ib 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8218", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIb", + }, + { + "name": "Ic 校正", + "unit": "%", + "scale" : 0.1, + "format": "%05.1f", + "addr": "8219", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectIc", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_voltage = [ + { + "name": "额定电压", + "addr": "8211", + "alias": "alias_voltage", + "default": 0, + }, + { + "name": "欠压比值", + "unit": "%", + "addr": "8202", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 100.0, + #"mqtt" : "PercentLowVoltage", + }, + { + "name": "欠压延时", + "unit": "s", + "addr": "8177", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayLowVoltage", + }, + { + "name": "过压比值", + "unit": "%", + "addr": "8224", + "scale" : 0.1, + "format": "%05.1f", + "min" : 100.0, + "max" : 150.0, + #"mqtt" : "PercentHighVoltage", + }, + { + "name": "过压延时", + "unit": "s", + "addr": "8176", + "scale" : 0.01, + "format": "%05.2f", + "min" : 0.1, + "max" : 60.0, + #"mqtt" : "DelayHighVoltage", + }, + { + "name": "Ua校正", + "unit": "%", + "addr": "8220", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUa", + }, + { + "name": "Ub校正", + "unit": "%", + "addr": "8221", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUb", + }, + { + "name": "Uc校正", + "unit": "%", + "addr": "8222", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUc", + }, + { + "name": "Us校正", + "unit": "%", + "addr": "8214", + "scale" : 0.1, + "format": "%05.1f", + "min" : 60.0, + "max" : 130.0, + #"mqtt" : "CorrectUs", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm_display = [ + { + "name": "当前故障", + "action" : "Idle", + }, +] + +menu_alarm_curve = [ + { + "name": "录波曲线", + "action" : "Idle", + }, +] + +menu_alarm_history = [ + { + "name": "故障查询", + "action" : "Idle", + }, +] + +menu_alarm = [ + { + "name": "故障查询", + "sub_menu": "menu_alarm_history", + }, + { + "name": "故障清除", + "action": "alarm_clear", + }, + { + "name": "合闸清零", + "action": "clear_oncount", + }, + { + "name": "合闸次数", + "addr": "8169", + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + #"mqtt" : "OnCount", + }, + { + "name": "电量清除", + "action": "clear_kwh", + }, + { + "name": "累计时间清除", + "action": "clear_time", + }, + { + "name": "累计合闸时间", + "addr": "8016#2", + "unit": "Min", + "scale": 0.0166666666666667, + "format": "%07.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_test = [ + { + "name": "短路试验", + "action": "test", + "addr" : "100628", + "mqtt" : "TestShort", + }, + { + "name": "漏电试验", + "action": "test", + "addr" : "100629", + "mqtt" : "TestIsolation", + }, + { + "name": "过压试验", + "action": "test", + "addr" : "100641", + "mqtt" : "TestOverVoltage", + }, + { + "name": "电流断相试验", + "action": "test", + "addr" : "100642", + "mqtt" : "TestBreak", + }, + + { + "name": "复归", + "action": "test", + "addr" : "100649", + "mqtt" : "TestRecover", + }, + + { + "name": "漏电试验配置", + "alias" : "alias_test", + "addr": "8265", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_protect_set = [ + { + "name": "短路保护", + "alias": Alias.alias_bool, + "addr": "8192.1", + #"mqtt" : "ProtectShort", + }, + { + "name": "不平衡保护", + "alias": "alias_bool", + "addr": "8192.2", + #"mqtt" : "ProtectUnbalance", + }, + { + "name": "反时限过流", + "alias": "alias_bool", + "addr": "8192.3", + #"mqtt" : "ProtectOverCurrent", + }, + { + "name": "过压保护", + "alias": "alias_bool", + "addr": "8174.0", + #"mqtt" : "ProtectHighVotage", + }, + { + "name": "欠压保护", + "alias": "alias_bool", + "addr": "8174.1", + #"mqtt" : "ProtectLowVotage", + }, + # { + # "name": "电压断相", + # "alias": "alias_bool", + # "addr": "8174.2", + # }, + # { + # "name": "相序保护", + # "alias": "alias_bool", + # "addr": "8174.3", + # }, + { + "name": "漏电闭锁", + "alias": "alias_bool", + "addr": "8192.10", + #"mqtt" : "ProtectIsolationLock", + }, + { + "name": "漏电动作", + "alias": "alias_bool", + "addr": "8174.6", + #"mqtt" : "ProtectIsolationAction", + }, + # { + # "name": "选漏保护", + # "alias": "alias_bool", + # "addr": "8174.7", + # }, + { + "name": "风电闭锁", + "alias": "alias_bool", + "addr": "8175.0", + #"mqtt" : "ProtectWindMotor", + }, + { + "name": "瓦斯闭锁", + "alias": "alias_bool", + "addr": "8174.13", + #"mqtt" : "ProtectGasLock", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_comm_set = [ + { + "name": "485地址", + "addr": "8212", + "format": "%03.0f", + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "8188", + }, + { + "name": "485校验", + "alias": "alias_parity", + "addr": "8194", + }, + # { + # "name": "CAN地址", + # }, + # { + # "name": "CAN波特率", + # "alias": "alias_can_baud", + # }, + { + "name": "IP设置", + "addr": "8271#2", + "action": "ip", + }, + { + "name": "IP网关", + "addr": "8273#2", + "action": "ip", + }, + { + "name": "IP掩码", + "addr": "8275#2", + "action": "ip", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "工作模式", + "addr": "8231", + "alias": "alias_work_mode", + "property": MENU_PROPERTY_ENGINEER, + "action" : "Visible_CL", #磁力模式显示菜单 + }, + { + "name": "开关类型", + "alias": "alias_switch_type", + "addr": "8210", + "action" : "Visible_KD", #馈电模式显示菜单 + }, + { + "name": "控制模式", + "alias": "alias_remote", + "addr": "8262", + }, + { + "name": "瓦斯触点", + "alias": "alias_input", + "addr": "8190", + }, + { + "name": "瓦斯延时", + "unit": "S", + "addr": "8191", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "风电触点", + "alias": "alias_input", + "addr": "8248", + }, + { + "name": "风电延时", + "unit": "S", + "addr": "8234", + "scale": 0.01, + "format": "%05.2f", + }, + { + "name": "高水位延时", + "addr": "8267", + "unit": "S", + "scale": 0.1, + "format": "%04.1f", + "action" : "Visible_CL_WATER", #水位磁力模式显示 + }, + { + "name": "正反转延时", + "addr": "8266", + "unit": "ms", + "scale": 1.0, + "format": "%04.0f", + "action" : "Visible_CL_INV", #正反转磁力模式显示 + }, + { + "name": "维修模式", + "addr": "8260", + "alias": "alias_bool", + }, + # { + # "name": "温度设定", + # "unit": "℃", + # "addr": "2030", + # "format": "%+03.0f", + # }, + { + "name": "系统日期", + "addr": "2300#3", + "action": "date", + }, + { + "name": "当前时间", + "addr": "2303#3", + "action": "time", + }, + { + "name": "软件版本", + "addr": "8180", + "unit" : VERSION_DATE, + "scale": 0.01, + "format": "%.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统密码", + "addr": "8181", + "format": "%04.0f", + "action": "password", + }, + { + "name": "Us相位", + "alias": "alias_us_phase", + "addr": "8269", + }, + { + "name": "重启", + "action": "restart", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_switch_cmd = [ + { + "name": "通讯合闸", + "action": "write_bit", + "addr" : "100618", + "mqtt" : "SwitchOn", + }, + { + "name": "通讯分闸", + "action": "write_bit", + "addr" : "100619", + "mqtt" : "SwitchOff", + }, + { + "name": "通讯复位", + "action": "write_bit", + "addr" : "100620", + "mqtt" : "SwitchRst", + }, + { + "name": "小车进控制", + "addr" : "100636", + "mqtt" : "CarForward", + }, + { + "name": "小车退控制", + "addr" : "100637", + "mqtt" : "CarRetreat", + }, + +] + +memu_setting = [ + { + "name": "电流设置", + "sub_menu": Menu.menu_current, + }, + { + "name": "电压设置", + "sub_menu": "menu_voltage" + }, + { + "name": "漏电设置", + "sub_menu": "menu_leak" + }, + { + "name": "系统设置", + "sub_menu": "menu_system" + }, + { + "name": "保护设置", + "sub_menu": "menu_protect_set" + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set" + }, + { + "name": "保护试验", + "sub_menu": Menu.menu_test #"menu_test" + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm" + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_leak = [ + { + "name": "漏电延时", + "addr": "8205", + "unit": "ms", + "scale" : 1.0, + "format" : "%03.0f", + "action" : "Visible_KD_GB", #馈电, 高爆模式所需菜单 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "mA", + "scale" : 0.1, + "format" : "%05.1f", + #"mqtt" : "KD.Io", + "action" : "Visible_KD", #馈电模式所需菜单 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%04.0f", + #"mqtt" : "KD.Uo", + "action" : "Visible_KD", #馈电模式菜单有效 + }, + { + "name": "零序电流", + "addr": "2007", + "unit": "A", + "scale" : 0.01, + "format" : "%05.2f", + "mqtt" : "GB.Io", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "零序电压", + "addr": "2008", + "unit": "V", + "scale" : 1.0, + "format" : "%05.2f", + "mqtt" : "GB.Uo", + "action" : "Visible_GB", #高爆模式菜单有效 + }, + { + "name": "Uo校正值", + "addr": "8187", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "Io校正值", + "addr": "8196", + "unit": "%", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Visible_KD_GB", #馈电与高爆模式菜单有效 + }, + { + "name": "闭锁电阻", + "addr": "8204", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + }, + { + "name": "串联电阻", + "addr": "8236", + "unit": "K", + "scale" : 0.1, + "format" : "%05.1f", + }, + { + "name": "漏电投入延时", + "addr": "8252", + "unit": "S", + "scale" : 0.1, + "format" : "%04.1f", + "action" : "Hide_GB", #高爆模式下隐藏菜单 + "default": 3.0 + }, + { + "name": "检测电压", + "addr": "8253", + "alias": Alias.alias_measure_v, + }, + { + "name": "退出", + "action": "exit", + }, +] + +calibrate = [ + { + "name": "999校正", + "action": "calibrate999", + "mqtt" : "Calibrate999", + }, + { + "name": "0欧校正", + "action": "calibrate0", + "mqtt" : "Calibrate0", + }, + { + "name": "以太网模块", + "alias": Alias.alias_eth, + "addr" : "8280", + }, + { + "name": "LCD模块", + "alias": Alias.alias_lcd, + "addr" : "8281", + }, + { + "name": "防越级模块", + "alias": Alias.alias_fyj, + "addr" : "8282", + }, + { + "name": "设备型号", + "alias": Alias.alias_dev, + "addr" : "8270", + }, + { + "name": "退出", + "action": "exit", + }, +] + +startup = [ + { + "name": "退出", + }, +] + +menu_main = [ + { + "name": "设置", + "sub_menu": "memu_setting", + }, + { + "name": "数据", + "sub_menu": "menu_data", + }, + { + "name": "报警", + "sub_menu": "menu_alarm_display", + }, + { + "name": "标定", + "sub_menu": "calibrate", + "property": MENU_PROPERTY_ENGINEER, + }, +] + +mqtt_topic_subscribe = None + +MENU_STARTUP_PAGE = 150 +MENU_DISPLAY_PAGE = 2 +MENU_ALARM_PAGE = 3 +MENU_DATA_PAGE = 120 +MENU_CL_MAIN_PAGE = 90 +MENU_KD_MAIN_PAGE = 20 +MENU_KD_MAIN_PAGE_LANGUAGE = 21 +MENU_CURVE_PAGE = 10 +MENU_ADC_CURVE_PAGE = 18 +MENU_HARNOMIC_CURVE_PAGE = 19 + +menu_caption = [ + {"name" : "startup", "menu" : startup, "caption": "启动页面", "page" : MENU_STARTUP_PAGE, "max_items" : 1}, + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : MENU_KD_MAIN_PAGE, "max_items" : 4}, + {"name" : "menu_leak", "menu" : menu_leak, "caption": "漏电设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "memu_setting", "menu" : memu_setting, "caption": "参数设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_current", "menu" : menu_current, "caption": "电流设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_voltage", "menu" : menu_voltage, "caption": "电压设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "故障查询", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_alarm_display", "menu" : menu_alarm_display, "caption": "当前故障", "page" : MENU_ALARM_PAGE, "prev": menu_alarm_curve, "next": menu_alarm_curve, "max_items" : 1}, + {"name" : "menu_alarm_curve", "menu" : menu_alarm_curve, "caption": "曲线故障", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_alarm_display, "next": menu_alarm_display, "max_items" : 1}, + + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "故障查询", "page" : MENU_ALARM_PAGE, "max_items" : 1}, + {"name" : "menu_test", "menu" : menu_test, "caption": "保护试验", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_measure", "menu" : mqtt_pack_measure, "caption": "测量数据", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_data", "menu" : menu_data, "caption": "数据页面", "page" : MENU_DATA_PAGE, "max_items" : 8}, + {"name" : "menu_curve_physical", "menu" : menu_curve_physical, "caption": "物理曲线", "page" : MENU_CURVE_PAGE, "prev": menu_curve_harmonic, "next": menu_curve_adc, "max_items" : 8}, + {"name" : "menu_curve_adc", "menu" : menu_curve_adc, "caption": "ADC曲线", "page" : MENU_ADC_CURVE_PAGE, "prev": menu_curve_physical, "next": menu_curve_harmonic, "max_items" : 8}, + {"name" : "menu_curve_harmonic", "menu" : menu_curve_harmonic, "caption": "谐波曲线", "page" : MENU_HARNOMIC_CURVE_PAGE, "prev": menu_curve_adc, "next": menu_curve_physical, "max_items" : 8}, + {"name" : "calibrate", "menu" : calibrate, "caption": "标定页面", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "menu_switch_cmd", "menu" : menu_switch_cmd, "caption": "通讯操作", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_pack_param", "menu" : mqtt_pack_param, "caption": "参数刷新", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + {"name" : "mqtt_video_trigger", "menu" : mqtt_video_trigger, "caption": "视频触发", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, + + {"name" : "mqtt_time_update", "menu" : mqtt_time_update, "caption": "时钟设置", "page" : MENU_DISPLAY_PAGE, "max_items" : 8}, +] + + +# mqtt 故障查询函数 +def func_alarm_query(device : class_modbus_comm_device, alarm_index = 0) : + result = device.protocol.modbus_write_regs(device.comm_addr, 8120, 1, alarm_index) + time.sleep(0.05) + alarm_regs = device.protocol.modbus_read_regs(device.comm_addr, 8121, 20) + if alarm_regs != None : + device.modbus_regs_flush(8121, 20, alarm_regs) + + msg_alarm_dict = device.comm_item_trigger_mqtt_pack(mqtt_pack_alarm) + + err_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmCode", 0) + err_code = int(err_code) + test_code = utils.dict_or_object_get_attr(msg_alarm_dict, "AlarmTest", 0) + test_code = int(test_code) + + + test_value_str = get_alias_value_str("alias_alarm_type", test_code) + if test_value_str == None: + test_value_str = " " + err_code_str = get_alias_value_str("alias_alarm", err_code) + if err_code_str == None: + err_code_str = " " + msg_alarm_dict["AlarmCodeMsg"] = err_code_str + msg_alarm_dict["AlarmTestMsg"] = test_value_str + msg_alarm_dict["index"] = alarm_index + msg : str = json.dumps(msg_alarm_dict, ensure_ascii=False) + + if device.mqtt_thread : + device.mqtt_thread.publish("response/alarm/" + device.unique_name, msg) + +# mqtt action处理函数 +def func_action_process(device : class_modbus_comm_device, menu_item = None, value_str : str = None) : + action_str = utils.dict_or_object_get_attr(menu_item, "action", " ") + mqtt_name = utils.dict_or_object_get_attr(menu_item, "mqtt", " ") + result = None + + if action_str == "SetupTime" : #设置保护器时间 + numbers = re.findall(r'\d+', value_str) + if len(numbers) == 6 : + year = int(numbers[0]) + month = int(numbers[1]) + day = int(numbers[2]) + hour = int(numbers[3]) + minute = int(numbers[4]) + second = int(numbers[5]) + device.protocol.modbus_write_regs(device.comm_addr, 2300, 6, (year, month, day, hour, minute, second)) + pass + if action_str == "calibrate999" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2007) + if action_str == "calibrate0" : + result = device.protocol.modbus_write_regs(device.comm_addr, 8255, 0x2006) + if action_str == "write_bit" or action_str == "test": + comm_str = utils.dict_or_object_get_attr(menu_item, "addr", " ") + reg_addr, bit, reg_count = utils.comm_str_unpack(comm_str) + if reg_count == 1: + command_value = [1] + result = device.write_bit_register(reg_addr, command_value) + + if device.mqtt_thread and result != None: + device.mqtt_thread.publish("response/action/" + device.unique_name, '{"name" : "%s", "result" : %d}'%(mqtt_name, result)) + + +class class_menu_comm_device_config(class_comm_device_config): + def __init__(self): + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_top + def get_menu_top(self) : + return menu_main + + def get_menu_caption_info(self) : + return menu_caption + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + def is_gb2312(self) : + return False + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_menu_comm_device_config() diff --git a/menu_page.py b/menu_page.py new file mode 100644 index 0000000..bb8b38e --- /dev/null +++ b/menu_page.py @@ -0,0 +1,6 @@ +#昆仑通态组合页面设计 + +KUNLUN_GRAOUP_PAGE_MAIN = 20 #主选择菜单页面 +KUNLUN_GRAOUP_PAGE_MENU = 5 #文字菜单页面 +KUNLUN_GRAOUP_PAGE_ALARM = 7 #报警页面 +KUNLUN_GRAOUP_PAGE_DEVICE_KD = 21 #馈电页面 diff --git a/menu_pump_hor_panda.py b/menu_pump_hor_panda.py new file mode 100644 index 0000000..c5c30f5 --- /dev/null +++ b/menu_pump_hor_panda.py @@ -0,0 +1,5663 @@ +#调峰功能 地址 +#额定频率 地址 + + + +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_page +from comm_device import class_comm_device +from comm_thread import class_comm_master_thread +from menu_base import class_device_menu +import menu_utils as utils +import comm_global +from enum import Enum + +FREQ_ALARM_BASE = 70 +USER_GLOBAL_ALARM_BASE = 32 #//Total 16 Global Alarm +USER_LOCAL_ALARM_BASE = 200 #//Total 16 Local Alarm +USER_GLOBAL_WARNING_BASE = 216 #//Total 16 Global Warning +USER_LOCAL_WARNING_BASE = 232 #//Total 16 Local Warning + +#Propery of menu item +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + +STR_SensorFailCause = "1. 传感器故障@2. 模拟量口故障@3. 通信电缆的接线不正确,或发生短路、断线" +STR_SensorFailProcess = "1. 更换传感器@2. 更换电机@3. 检查传感器是否断线或损坏。" +STR_FreqErrRef = "详见变频器说明书" +EMPTY_STRING = " " + +class StrInfo(Enum) : + STR_INPUT_PASSWORD = 0, #// //请输入密码 + STR_COMM_FAIL = 1, #// //通讯故障 + STR_ENTER_TO_CLEAR = 2, #// //按确认清除 + STR_ESC_TO_CANCEL = 3, #// //按退出取消 + STR_CLEAR_FINISH = 4, #// //清除完成 + STR_MIN_VALUE = 5, #// + STR_MAX_VALUE = 6, #// + STR_NO_RECORD = 7, #// + STR_VALUE_EXCEED = 8, #// + STR_SET_VALUE = 9, #// + STR_INFORM_OK = 10, #// + STR_CHECK_VOLTAGE = 11, #// + STR_CHECK_SENSOR = 12, #// + STR_CHECK_PIPE_IN = 13, #// + STR_CHECK_NONE = 14, #// + STR_CHECK_RSV = 15, #// + STR_CHECK_VOLTAGE_PHASE = 16, #// + STR_CHECK_PIPE_BROKE = 17, #// + STR_CHECK_WATER_SIGNAL = 18, #// + STR_CHECK_PID_PARA = 19, #// + STR_CHECK_HARD_ERROR = 20, #// + STR_CHECK_LOAD = 21, #// + STR_CHECK_POWER_INPUT = 22, #// + STR_CHECK_POWER_OUTPUT = 23, #// + STR_CHECK_FREQ_ACC_DEC_TIME = 24, #// + STR_CHECK_TEMPERATURE = 25, #// + STR_CHECK_FREQ_COMMUNICATE = 26, #// + STR_CHECK_MAIN_PUMP_LOST = 27, #// + STR_CHECK_FREQ_CONVERTER = 28, #// + STR_CHECK_CAN_COMM = 29, #// + STR_CHECK_FREQ_EXTERNAL_ALARM = 30, #// + STR_CHECK_FREQ_POWER = 31, #// + STR_CHECK_ALARM_RESET = 32, #// + STR_CHECK_PUMP_ID_CONFLICT = 33, #// + STR_CHECK_PRESSURE_LOW_IO = 34, #// + STR_CHECK_PRESSURE_HIGH_IO = 35, #// + STR_CHECK_WATER_CONTAINER_SIGNAL = 36, #// + STR_CHECK_MOTOR_TEMPERATURE_OR_SENSOR = 37, #// + STR_CHECK_BUS_POWER_SHORT = 38, #// + STR_PUMP_NOT_FOUNT = 39, #// + STR_PUMP_UPDATE_FAIL = 40, #// + STR_PUMP_UPDATE_SUCCESS = 41, #// + STR_PUMP_UPDATE_TIMEOUT = 42, #// + STR_PUMP_READ_FAIL = 43, #// + STR_PUMP_READ_SUCCESS = 44, #// + STR_PUMP_READ_TIMEOUT = 45, #// + +class AlarmInfo(Enum) : + + ALARM_FREE = 0, + ALARM_PIPE_BROKE = 1, #//爆管保护 + ALARM_NO_WATER_EXIST = 2, #//无水停机 + ALARM_WATER_PRESSURE_HIGH = 3, #//水压过高保护 + ALARM_OVER_VOLTAGE = 4, #//供电电压过高 + ALARM_UNDER_VOLTAGE = 5, #//供电电压过低 + ALARM_BOARD_HARDWARE = 6, #//硬件故障 + ALARM_IO_NO_WATER_EXIST = 7, #//市政或水箱无水停机 + #//传感器故障子故障 + ALARM_SENSOR_PRESS_IN = 8, #//入口压力传感器故障 + ALARM_SENSOR_PRESS_OUT = 9, #//出口压力传感器故障 + ALARM_SENSOR_FLUX = 10, #//流量传感器故障 + ALARM_SENSOR_PH = 11, #//PH值传感器故障 + ALARM_SENSOR_WATER_CLEAR = 12, #//浊度传感器故障 + ALARM_SENSOR_REMAIN_CL = 13, #//余氯传感器故障 + ALARM_NEG_PRESSURE = 14, #//负压报警 + ALARM_VACUMM_PRESSURE = 15, #//真空报警 + + ALARM_SENSOR_WATER_LEVEL = 16, #//水位传感器故障 + ALARM_WATER_PRESSURE_LOW = 17, #//水位过低提示 + ALARM_SENSOR_FLUX_IN = 18, #//输入流量传感器故警 + ALARM_SENSOR_IN_VALVE_FEEDBACK = 19, #//输入阀反馈 + ALARM_SENSOR_NOIZE = 20, + ALARM_SENSOR_HUMIDITY = 21, + + ALARM_IO_LEAK_WATER = 22, + ALARM_IO_SMOKE = 23, + ALARM_IO_EXTERNALERROR = 24, #//外部故障 + + ALARM_SENSOR_WATER_LEVEL2 = 25, #//水位传感器2故障 + ALARM_SENSOR_IN_VALVE_FEEDBACK2 = 26, #//开度反馈传感器2故障 + ALARM_SENSOR_TEMPERATURE = 27, #//温度传感器故障 + ALARM_SENSOR_TEMPERATURE2 = 28, #//站内温度传感器故障 + ALARM_SENSOR_TEMPERATURE3 = 29, #//夹层温度传感器故障 + ALARM_SENSOR_WATER_LEVEL3 = 30, + + USER_GLOBAL_ALARM_0 = USER_GLOBAL_ALARM_BASE + 0, #水箱液位低报警 + USER_GLOBAL_ALARM_1 = USER_GLOBAL_ALARM_BASE + 1, + USER_GLOBAL_ALARM_2 = USER_GLOBAL_ALARM_BASE + 2, + USER_GLOBAL_ALARM_3 = USER_GLOBAL_ALARM_BASE + 3, + USER_GLOBAL_ALARM_4 = USER_GLOBAL_ALARM_BASE + 4, + USER_GLOBAL_ALARM_5 = USER_GLOBAL_ALARM_BASE + 5, + USER_GLOBAL_ALARM_6 = USER_GLOBAL_ALARM_BASE + 6, + USER_GLOBAL_ALARM_7 = USER_GLOBAL_ALARM_BASE + 7, + USER_GLOBAL_ALARM_8 = USER_GLOBAL_ALARM_BASE + 8, + USER_GLOBAL_ALARM_9 = USER_GLOBAL_ALARM_BASE + 9, + USER_GLOBAL_ALARM_10 = USER_GLOBAL_ALARM_BASE + 10, + USER_GLOBAL_ALARM_11 = USER_GLOBAL_ALARM_BASE + 11, + USER_GLOBAL_ALARM_12 = USER_GLOBAL_ALARM_BASE + 12, + USER_GLOBAL_ALARM_13 = USER_GLOBAL_ALARM_BASE + 13, + USER_GLOBAL_ALARM_14 = USER_GLOBAL_ALARM_BASE + 14, + USER_GLOBAL_ALARM_15 = USER_GLOBAL_ALARM_BASE + 15, + + #//每台泵子故障 + ALARM_COMM_FREQ_CONVERTER = 54, #//变频器通讯故障 + ALARM_COMM_TOUCH_BOARD = 55, #//触控板通讯故障 + ALARM_COMM_MAIN_BOARD = 56, #//主控板通讯故障 + ALARM_PUMP_AIR_SWITCH_OFF = 57, #//空开跳闸 + ALARM_MAIN_PUMP_LOST = 58, #//主泵丢失 + ALARM_PUMP_RESET_DELAY = 59, #//泵处于故障复位状态 + ALARM_COMMAND_EXECUTE_FAIL = 60, #//泵命令执行失败 + ALARM_FREQ_PARAMETER_SET = 61, #//变频参数设置故障 + ALARM_PUMP_ADDR_ID_CONFLICT = 62, #//泵号冲突 + ALARM_PUMP_MOTOR_TEMPERATURE_HIGH = 63, + ALARM_BUS_POWER_SHORT = 64, #//总线电源短路 + ALARM_POWER_LOST = 65, #//电源丢失 + ALARM_AUTO_REMOTE_DISABLE = 66, #//自动停止信号有效 + + ALARM_FREQ_U_PROTECT = FREQ_ALARM_BASE + 0, #//变频器U相保护 + ALARM_FREQ_V_PROTECT = FREQ_ALARM_BASE + 1, #//变频器V相保护 + ALARM_FREQ_W_PROTECT = FREQ_ALARM_BASE + 2, #//变频器W相保护 + ALARM_FREQ_ACCELERATE_OVER_CURRENT = FREQ_ALARM_BASE + 3, #//变频器加速过流 + ALARM_FREQ_DECELERATE_OVER_CURRENT = FREQ_ALARM_BASE + 4, #//变频器减速过流 + ALARM_FREQ_FIX_SPEED_OVER_CURRENT = FREQ_ALARM_BASE + 5, #//变频器恒速过流 + ALARM_FREQ_ACCELERATE_OVER_VOLTAGE = FREQ_ALARM_BASE + 6, #//变频器加速过电压 + ALARM_FREQ_DECELERATE_OVER_VOLTAGE = FREQ_ALARM_BASE + 7, #//变频器减速过电压 + ALARM_FREQ_FIX_SPEED_OVER_VOLTAGE = FREQ_ALARM_BASE + 8, #//变频器恒速过电压 + ALARM_FREQ_DC_VOLTAGE_LOW = FREQ_ALARM_BASE + 9, #//变频器母线电压低 + ALARM_FREQ_MOTOR_OVER_LOAD = FREQ_ALARM_BASE + 10, #//变频器电机过热 + ALARM_FREQ_OVER_LOAD = FREQ_ALARM_BASE + 11, #//变频器过载 + ALARM_FREQ_INPUT_MISS_PHASE = FREQ_ALARM_BASE + 12, #//变频器输入缺相 + ALARM_FREQ_OUTPUT_MISS_PHASE = FREQ_ALARM_BASE + 13, #//变频器输出缺相 + ALARM_FREQ_MODULE_TEMP_HIGH = FREQ_ALARM_BASE + 14, #//变频器温度过高 + ALARM_FREQ_RSV45 = FREQ_ALARM_BASE + 15, #//保留 + ALARM_FREQ_EXTERNAL = FREQ_ALARM_BASE + 16, #//变频器外部故障 + ALARM_FREQ_COMMUNICATION = FREQ_ALARM_BASE + 17, #//变频器通讯故障 + ALARM_FREQ_CURRENT_MEASURE = FREQ_ALARM_BASE + 18, #//变频器电流检测回路故障 + ALARM_FREQ_SELF_STUDY = FREQ_ALARM_BASE + 19, #//变频器学习故障 + ALARM_FREQ_EEPROM = FREQ_ALARM_BASE + 20, #//变频器EEPROM故障 + ALARM_FREQ_PID_FAIL = FREQ_ALARM_BASE + 21, #//变频器PID调节故障 + ALARM_FREQ_STOP_UNIT = FREQ_ALARM_BASE + 22, #//变频器制动单元故障 + ALARM_FREQ_RSV53 = FREQ_ALARM_BASE + 23, #//保留 + ALARM_FREQ_SHORT_GROUND = FREQ_ALARM_BASE + 24, #//变频器对地短路 + + #// V1000C变频器故障 + #// ALARM_FREQ_MEMOBUS = 100, #//CE (MEMOBUS通信故障) #// AlarmStatus5.MEMOBUSCommuFault, MinorAlarm1.CommAlarm, AlarmStatus1.CommAlarm, MinorAlarm3.CommunicationErr + ALARM_FREQ_CONTROL_FAULT = 101, #// CF (控制故障) #// AlarmStatus5.ControlFault + ALARM_FREQ_CURRENT_BASE = 102, #// CoF (电流偏�?故障�? #// AlarmStatus7.CurrentBiasFault + ALARM_FREQ_ADC_FAULT = 103, #// CPF02 (A/D �?换器故障�? + ALARM_FREQ_PWM_DATA_ERR = 104, #// CPF03 (PWM 数据异常�? + ALARM_FREQ_EEPROM_DATA_ERR = 105, #// CPF06 (EEPROM 数据异常�? + ALARM_FREQ_TERMINAL_FAULT = 106, #// CPF07 (�??子电�?板通信故障�? + ALARM_FREQ_EEPROM_COMM_FAULT = 107, #// CPF08 (EEPROM 串�?�通信故障�? + ALARM_FREQ_RAM_FAULT = 108, #// CPF11 (RAM 故障�? + ALARM_FREQ_FLASH_FAULT = 109, #// CPF12 (闪存故障) + ALARM_FREQ_MONITOR = 110, #// CPF13 (监视故障) #// + ALARM_FREQ_CTRL_CIRCUIT = 111, #// CPF14 (控制回�?故障�? + ALARM_FREQ_CLOCK_FAULT = 112, #// CPF16 (时钟故障) + ALARM_FREQ_INTERRUPT_FAULT = 113, #// CPF17 (中�?故障�? + ALARM_FREQ_PWM_FBDATA_ERR = 114, #// CPF23 (PWM 反�?�数�?异常�? + ALARM_FREQ_CAPACITY_SIGNAL = 115, #// CPF24 (变频器容量信号故障�? + ALARM_FREQ_TERMINAL_NOT_CONNECT = 116, #// CPF25 (未连接�?子电�?板) + ALARM_FREQ_MONITOR_DEVICE = 117, #// E5/CPF13 (监视�?�置故障�? + ALARM_FREQ_EXTERN_FAULT_S1 = 118, #// EF1 (�?�部故�??(输入�??�?S1))#// AlarmStatus7.ExternalFault1, MinorAlarm5.ExternalFault1 + ALARM_FREQ_EXTERN_FAULT_S2 = 119, #// EF2 (�?�部故�??(输入�??�?S2))#// AlarmStatus7.ExternalFault2, MinorAlarm5.ExternalFault2 + ALARM_FREQ_EXTERN_FAULT_S3 = 120, #// EF3 (�?�部故�??(输入�??�?S3))#// AlarmStatus4.ExternalFault3, MinorAlarm2.ExternalFault3 + ALARM_FREQ_EXTERN_FAULT_S4 = 121, #// EF4 (�?�部故�??(输入�??�?S4))#// AlarmStatus4.ExternalFault4, MinorAlarm2.ExternalFault4 + ALARM_FREQ_EXTERN_FAULT_S5 = 122, #// EF5 (�?�部故�??(输入�??�?S5))#// AlarmStatus4.ExternalFault5, MinorAlarm2.ExternalFault5 + ALARM_FREQ_EXTERN_FAULT_S6 = 123, #// EF6 (�?�部故�??(输入�??�?S6))#// AlarmStatus4.ExternalFault6, MinorAlarm2.ExternalFault6 + ALARM_FREQ_EEPROMW_WRITE_ERR = 124, #// Err (EEPROM 写入不当�?#// AlarmStatus4.EEPROMWriteError + ALARM_FREQ_PIDFB_OVERTOP = 125, #// FbH (PID 反�?�超值) #// AlarmStatus7.PIDFeedbackOvertop, MinorAlarm4.PIDFeedbackOvertop + ALARM_FREQ_PID_FB_LOST = 126, #// FbL (PID 反丧�?/ AlarmStatus5.PID_FeedbackLost, MinorAlarm4.PID_FeedbackLost + ALARM_FREQ_GROUND_FALUT = 127, #// GF (接地短�?�? + ALARM_FREQ_OUT_PHASE_LOST = 128, #// LF (输出缺相) + ALARM_FREQ_OUT_IMBALANCE = 129, #// LF2 (输出电流失衡) + ALARM_FREQ_NODE_SETUP_ERR = 130, #// nSE(Node Setup 故障�? + ALARM_FREQ_OVER_CURRENT = 131, #// oC (过电流�? + ALARM_FREQ_FIN_OVER_HEAT = 132, #// oH/oH1 (散�?片过�?�? + ALARM_FREQ_MOTOR_OVERHEAT1 = 133, #// oH3 (电机过�?警�??(PTC 输入)) + ALARM_FREQ_MOTOR_OVERHEAT2 = 134, #// oH4 (电机过�?故�??(PTC 输入)) + ALARM_FREQ_MOTOR_OVERLOAD = 135, #// oL1 (电机过载) + ALARM_FREQ_VFD_OVERLOAD = 136, #// oL2 (变频器过载�? + ALARM_FREQ_OVER_TORQUE1 = 137, #// oL3 (过�?矩�?��?1�? + ALARM_FREQ_OVER_TORQUE2 = 138, #// oL4 (过�?矩�?��?2�? + ALARM_FREQ_MECHAN_AGING1 = 139, #// oL5 (机械老化检�?1�? + ALARM_FREQ_BREAK_OVERLOAD = 140, #// oL7 (高滑差制动电机过载保护�? + ALARM_FREQ_OVER_VOLTAGE = 141, #// ov (主回路过电压) + ALARM_FREQ_VOLTAGE_FAULT = 142, #// PF (主回路电压故障�? + ALARM_FREQ_BRAKE_TRANS = 143, #// rr (内�?制动晶体管故障�?? + ALARM_FREQ_OUT_SHORT = 144, #// SC (输出短�?或IGBT故障�? + ALARM_FREQ_SPEED_SEARCH = 145, #// SEr (速度搜索重试故障�? + ALARM_FREQ_DISORDER = 146, #// STo (失调�?�出) + ALARM_FREQ_LACK_OF_TORQUE1 = 147, #// UL3 (转矩不�?1�? + ALARM_FREQ_LACK_OF_TORQUE2 = 148, #// UL4 (转矩不�?2�? + ALARM_FREQ_MECHAN_AGING2 = 149, #// UL5 (机械老化检�?2�? + ALARM_FREQ_MAJOR_UNDERVOLTAGE = 150, #// Uv/Uv1 (主回路欠电压) + ALARM_FREQ_CTRL_POW_FAULT = 151, #// Uv2 (控制电源故障) + ALARM_FREQ_PREVENT_SHOCK = 152, #// Uv3 (冲击防止回�?故障�? + + ALARM_FREQ_CONTROL1_ERR = 153, #//CPF18 + ALARM_FREQ_CONTROL2_ERR = 154, #//CPF19 + ALARM_FREQ_HARD1_ERR = 155, #//CPF20 + ALARM_FREQ_HARD2_ERR = 156, #//CPF21 + ALARM_FREQ_ADC_ERR = 157, #//CPF22 + + + ALARM_FREQ_BASE_BLOCK = 160, #// 变频器基极封锁(bb) + ALARM_FREQ_COMM_WAITING = 161, #// 通信等待中(CALL) + ALARM_FREQ_RST_WHEN_RUN = 162, #// 运行指令输入中复位(CrST) + ALARM_FREQ_COMM_CYCLE_ERR = 163, #// 通信周期设定错误(CyC) + ALARM_FREQ_DRIVE_DISABLE = 164, #// Drive Disable中(dnE) + ALARM_FREQ_CW_CCW_CMD = 165, #// 正反转指令同时输入(EF) + ALARM_FREQ_CURRENT_WARNING = 166, #// 电流警告(HCA) + ALARM_FREQ_MAINTAIN_FAN = 167, #// 冷却风扇维护时期(LT-1) + ALARM_FREQ_MAINTAIN_CAP = 168, #// 电容器维护时期(LT-2) + ALARM_FREQ_MAINTAIN_RELAY = 169, #// 冲击电流防止继电器维护时期(LT-3) + ALARM_FREQ_MAINTAIN_IGBT_50 = 170, #// IGBT维护时期(50%)(LT-4) + ALARM_FREQ_VFD_OH_ALERT = 171, #// 变频器过热预警(oH2) + ALARM_FREQ_MOTOR_OVERHEAT = 172, #// 电机过热(oH3) + ALARM_FREQ_RSV173 = 173, #// 保留 + ALARM_FREQ_RSV174 = 174, #// 保留 + ALARM_FREQ_MOBUS_TEST_OK = 175, #// MEMOBUS通信测试模式正常(PASS) + ALARM_FREQ_SWITCH_WHEN_RUN = 176, #// 运行中输入电机切换指令(rUn) + ALARM_FREQ_MOBUS_TEST_ERR = 177, #// MEMOBUS通信测试模式故障(SE) + ALARM_FREQ_MAINTAIN_IGBT_90 = 178, #// IGBT维护时期(90%)(TrPC) + ALARM_FREQ_RSV179 = 179, #// 保留 + ALARM_FREQ_RSV180 = 180, #// 保留 + ALARM_FREQ_CAPACITY_SET_ERR = 181, #// oPE01 变频器容量的设定故障(oPE01) + ALARM_FREQ_PARA_RANGE_ERR = 182, #// oPE02 参数设定范围不当(oPE02) + ALARM_FREQ_DIN_SELECT_ERR = 183, #// oPE03 多功能输入的选择不当(oPE03) + ALARM_FREQ_AIN_SELECT_ERR = 184, #// oPE07 多功能模拟量输入的选择不当(oPE07) + ALARM_FREQ_PARA_SELECT_ERR = 185, #// oPE08 参数选择不当(oPE08) + ALARM_FREQ_PID_SELECT_ERR = 186, #// oPE09 PID控制的选择不当(oPE09) + ALARM_FREQ_VF_DATA_SET_ERR = 187, #// oPE10 V/f数据的设定不当(oPE10) + ALARM_FREQ_CARRIER_SET_ERR = 188, #// oPE11 载波频率的设定不当(oPE11) + + USER_LOCAL_ALARM_0 = USER_LOCAL_ALARM_BASE + 0, + USER_LOCAL_ALARM_1 = USER_LOCAL_ALARM_BASE + 1, + USER_LOCAL_ALARM_2 = USER_LOCAL_ALARM_BASE + 2, + USER_LOCAL_ALARM_3 = USER_LOCAL_ALARM_BASE + 3, + USER_LOCAL_ALARM_4 = USER_LOCAL_ALARM_BASE + 4, + USER_LOCAL_ALARM_5 = USER_LOCAL_ALARM_BASE + 5, + USER_LOCAL_ALARM_6 = USER_LOCAL_ALARM_BASE + 6, + USER_LOCAL_ALARM_7 = USER_LOCAL_ALARM_BASE + 7, + USER_LOCAL_ALARM_8 = USER_LOCAL_ALARM_BASE + 8, + USER_LOCAL_ALARM_9 = USER_LOCAL_ALARM_BASE + 9, + USER_LOCAL_ALARM_10 = USER_LOCAL_ALARM_BASE + 10, + USER_LOCAL_ALARM_11 = USER_LOCAL_ALARM_BASE + 11, + USER_LOCAL_ALARM_12 = USER_LOCAL_ALARM_BASE + 12, + USER_LOCAL_ALARM_13 = USER_LOCAL_ALARM_BASE + 13, + USER_LOCAL_ALARM_14 = USER_LOCAL_ALARM_BASE + 14, + USER_LOCAL_ALARM_15 = USER_LOCAL_ALARM_BASE + 15, + + USER_GLOBAL_WARNING_0 = USER_GLOBAL_WARNING_BASE + 0, + USER_GLOBAL_WARNING_1 = USER_GLOBAL_WARNING_BASE + 1, + USER_GLOBAL_WARNING_2 = USER_GLOBAL_WARNING_BASE + 2, + USER_GLOBAL_WARNING_3 = USER_GLOBAL_WARNING_BASE + 3, + USER_GLOBAL_WARNING_4 = USER_GLOBAL_WARNING_BASE + 4, + USER_GLOBAL_WARNING_5 = USER_GLOBAL_WARNING_BASE + 5, + USER_GLOBAL_WARNING_6 = USER_GLOBAL_WARNING_BASE + 6, + USER_GLOBAL_WARNING_7 = USER_GLOBAL_WARNING_BASE + 7, + USER_GLOBAL_WARNING_8 = USER_GLOBAL_WARNING_BASE + 8, + USER_GLOBAL_WARNING_9 = USER_GLOBAL_WARNING_BASE + 9, + USER_GLOBAL_WARNING_10 = USER_GLOBAL_WARNING_BASE + 10, + USER_GLOBAL_WARNING_11 = USER_GLOBAL_WARNING_BASE + 11, + USER_GLOBAL_WARNING_12 = USER_GLOBAL_WARNING_BASE + 12, + USER_GLOBAL_WARNING_13 = USER_GLOBAL_WARNING_BASE + 13, + USER_GLOBAL_WARNING_14 = USER_GLOBAL_WARNING_BASE + 14, + USER_GLOBAL_WARNING_15 = USER_GLOBAL_WARNING_BASE + 15, + + USER_LOCAL_WARNING_0 = USER_LOCAL_WARNING_BASE + 0, + USER_LOCAL_WARNING_1 = USER_LOCAL_WARNING_BASE + 1, + USER_LOCAL_WARNING_2 = USER_LOCAL_WARNING_BASE + 2, + USER_LOCAL_WARNING_3 = USER_LOCAL_WARNING_BASE + 3, + USER_LOCAL_WARNING_4 = USER_LOCAL_WARNING_BASE + 4, + USER_LOCAL_WARNING_5 = USER_LOCAL_WARNING_BASE + 5, + USER_LOCAL_WARNING_6 = USER_LOCAL_WARNING_BASE + 6, + USER_LOCAL_WARNING_7 = USER_LOCAL_WARNING_BASE + 7, + USER_LOCAL_WARNING_8 = USER_LOCAL_WARNING_BASE + 8, + USER_LOCAL_WARNING_9 = USER_LOCAL_WARNING_BASE + 9, + USER_LOCAL_WARNING_10 = USER_LOCAL_WARNING_BASE + 10, + USER_LOCAL_WARNING_11 = USER_LOCAL_WARNING_BASE + 11, + USER_LOCAL_WARNING_12 = USER_LOCAL_WARNING_BASE + 12, + USER_LOCAL_WARNING_13 = USER_LOCAL_WARNING_BASE + 13, + USER_LOCAL_WARNING_14 = USER_LOCAL_WARNING_BASE + 14, + USER_LOCAL_WARNING_15 = USER_LOCAL_WARNING_BASE + 15, + + ALARM_MAX = 0x8000, + +alias_table = [ + + + {"alias_str" : { + StrInfo.STR_INPUT_PASSWORD: "请输入密码", + StrInfo.STR_COMM_FAIL : "通讯故障", #// //通讯故障 + StrInfo.STR_ENTER_TO_CLEAR : "按确认清除", #// //按确认清除 + StrInfo.STR_ESC_TO_CANCEL : "按退出取消", #// //按退出取消 + StrInfo.STR_CLEAR_FINISH : "清除完成", #// //清除完成 + StrInfo.STR_MIN_VALUE : "最小值", #// + StrInfo.STR_MAX_VALUE : "最大值", #// + StrInfo.STR_NO_RECORD : "无记录", #// + StrInfo.STR_VALUE_EXCEED : "设定值越限", #// + StrInfo.STR_SET_VALUE : "设定值", #// + StrInfo.STR_INFORM_OK : "通知正常", #// + StrInfo.STR_CHECK_VOLTAGE : "检测输入电压", #// + StrInfo.STR_CHECK_SENSOR : "检测传感器", #// + StrInfo.STR_CHECK_PIPE_IN : "检测输入管道", #// + StrInfo.STR_CHECK_NONE : "无需处理", #// + StrInfo.STR_CHECK_RSV : "未知故障, 请咨询设备厂家", #// + StrInfo.STR_CHECK_VOLTAGE_PHASE : "电压相序故障", #// + StrInfo.STR_CHECK_PIPE_BROKE : "检查爆管", #// + StrInfo.STR_CHECK_WATER_SIGNAL : "检查水位型号", #// + StrInfo.STR_CHECK_PID_PARA : "检查PID参数, 或流量变化过大", #// + StrInfo.STR_CHECK_HARD_ERROR : "尝试重启, 如无效需寄回原厂返修", #// + StrInfo.STR_CHECK_LOAD : "检查水泵负载情况", #// + StrInfo.STR_CHECK_POWER_INPUT : "检查三相电源输入接线情况", #// + StrInfo.STR_CHECK_POWER_OUTPUT : "检查三相电源输出接线是否短路", #// + StrInfo.STR_CHECK_FREQ_ACC_DEC_TIME : "检查变频器加速或减速时间是否过小", #// + StrInfo.STR_CHECK_TEMPERATURE : "检查变频器通风散热情况", #// + StrInfo.STR_CHECK_FREQ_COMMUNICATE : "检查本台水泵供电是否正常", #// + StrInfo.STR_CHECK_MAIN_PUMP_LOST : "检查CAN通讯线连接. 检查1号泵是否存在", #// + StrInfo.STR_CHECK_FREQ_CONVERTER : "检查变频器是否允许通讯", #// + StrInfo.STR_CHECK_CAN_COMM : "检查CAN通讯", #// + StrInfo.STR_CHECK_FREQ_EXTERNAL_ALARM : "检查变频器与主控板接口线", #// + StrInfo.STR_CHECK_FREQ_POWER : "检查变频器供电情况", #// + StrInfo.STR_CHECK_ALARM_RESET : "故障复位中,请稍候", #// + StrInfo.STR_CHECK_PUMP_ID_CONFLICT : "检查CAN地址冲突", #// + StrInfo.STR_CHECK_PRESSURE_LOW_IO : "检查电压力节点低", #// + StrInfo.STR_CHECK_PRESSURE_HIGH_IO : "检查电压力节点高", #// + StrInfo.STR_CHECK_WATER_CONTAINER_SIGNAL : "检查水箱信号", #// + StrInfo.STR_CHECK_MOTOR_TEMPERATURE_OR_SENSOR : "电机温度过高,检查电机散热风扇或水冷回路是否正常", #// + StrInfo.STR_CHECK_BUS_POWER_SHORT : "检查总线电源是否存在短路", #// + StrInfo.STR_PUMP_NOT_FOUNT : "泵没有找到", #// + StrInfo.STR_PUMP_UPDATE_FAIL : "泵数据更新失败", #// + StrInfo.STR_PUMP_UPDATE_SUCCESS : "泵数据更新成功", #// + StrInfo.STR_PUMP_UPDATE_TIMEOUT : "泵数据更新超时", #// + StrInfo.STR_PUMP_READ_FAIL : "泵数据读取失败", #// + StrInfo.STR_PUMP_READ_SUCCESS : "泵数据读取成功", #// + StrInfo.STR_PUMP_READ_TIMEOUT : "泵数据读取超时", #// + }}, + + + + {"alias_alarm_str": + { + AlarmInfo.ALARM_FREE : "无故障", + AlarmInfo.ALARM_PIPE_BROKE : "爆管保护", + AlarmInfo.ALARM_NO_WATER_EXIST : "市政或水箱无水停机", + AlarmInfo.ALARM_WATER_PRESSURE_HIGH : "超压保护", + AlarmInfo.ALARM_OVER_VOLTAGE : "供电电压过高", + AlarmInfo.ALARM_UNDER_VOLTAGE : "供电电压过低", + AlarmInfo.ALARM_BOARD_HARDWARE : "硬件故障", + AlarmInfo.ALARM_IO_NO_WATER_EXIST : "IO无水停机", + AlarmInfo.ALARM_SENSOR_PRESS_IN : "入口压力传感器故障", + AlarmInfo.ALARM_SENSOR_PRESS_OUT : "出口压力传感器故障", + AlarmInfo.ALARM_SENSOR_FLUX : "流量传感器故障", + AlarmInfo.ALARM_SENSOR_PH : "PH值传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_CLEAR : "浊度传感器故障", + AlarmInfo.ALARM_SENSOR_REMAIN_CL : "余氯传感器故障", + AlarmInfo.ALARM_NEG_PRESSURE : "负压保护", + AlarmInfo.ALARM_VACUMM_PRESSURE : "真空保护", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL : "液位1传感器故障", + AlarmInfo.ALARM_WATER_PRESSURE_LOW : "电接点压力低信号有效", + AlarmInfo.ALARM_SENSOR_FLUX_IN : "输入流量传感器故障", + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK : "输入阀反馈故障", + AlarmInfo.ALARM_SENSOR_NOIZE : "噪音传感器故障", + AlarmInfo.ALARM_SENSOR_HUMIDITY : "湿度传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL2 : "液位2传感器故障", + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK2 : "开度反馈2传感器故障", + AlarmInfo.ALARM_IO_LEAK_WATER : "漏水报警", + AlarmInfo.ALARM_IO_SMOKE : "烟感报警", + AlarmInfo.ALARM_IO_EXTERNALERROR : "外部故障报警", + AlarmInfo.ALARM_SENSOR_HUMIDITY : "湿度传感器故障", + AlarmInfo.ALARM_SENSOR_TEMPERATURE : "水温传感器故障", + AlarmInfo.ALARM_SENSOR_TEMPERATURE2 : "站内温度传感器故障", + AlarmInfo.ALARM_SENSOR_TEMPERATURE3 : "夹层温度传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL3 : "液位3传感器故障", + + AlarmInfo.ALARM_COMM_FREQ_CONVERTER : "变频器通讯故障", + AlarmInfo.ALARM_COMM_TOUCH_BOARD : "触控板通讯故障", + AlarmInfo.ALARM_COMM_MAIN_BOARD : "主控板通讯故障", + AlarmInfo.ALARM_PUMP_AIR_SWITCH_OFF : "空开跳闸", + AlarmInfo.ALARM_MAIN_PUMP_LOST : "主泵丢失", + AlarmInfo.ALARM_PUMP_RESET_DELAY : "泵处于故障复位状态", + AlarmInfo.ALARM_COMMAND_EXECUTE_FAIL : "泵命令执行失败", + AlarmInfo.ALARM_FREQ_PARAMETER_SET : "变频器参数设置故障", + AlarmInfo.ALARM_PUMP_ADDR_ID_CONFLICT : "泵号冲突", + AlarmInfo.ALARM_PUMP_MOTOR_TEMPERATURE_HIGH : "电机温度过高", + AlarmInfo.ALARM_BUS_POWER_SHORT : "通信电源短路", + AlarmInfo.ALARM_POWER_LOST : "本机内部失电", + + AlarmInfo.ALARM_FREQ_U_PROTECT : "变频器U相保护", #//"30 //STR_ALARM_FREQ_U_PROTECT + AlarmInfo.ALARM_FREQ_V_PROTECT : "变频器V相保护", #//"31 //STR_ALARM_FREQ_V_PROTECT + AlarmInfo.ALARM_FREQ_W_PROTECT : "变频器W相保护", #//"32 //STR_ALARM_FREQ_W_PROTECT + AlarmInfo.ALARM_FREQ_ACCELERATE_OVER_CURRENT : "变频器加速过流保护", #//"33 //STR_ALARM_FREQ_ACCELERATE_OVER_CURRENT + AlarmInfo.ALARM_FREQ_DECELERATE_OVER_CURRENT : "变频器减速过流保护", #//"34 //STR_ALARM_FREQ_DECELERATE_OVER_CURRENT + AlarmInfo.ALARM_FREQ_FIX_SPEED_OVER_CURRENT : "变频器定速过流保护", #//"35 //STR_ALARM_FREQ_FIX_SPEED_OVER_CURRENT + AlarmInfo.ALARM_FREQ_ACCELERATE_OVER_VOLTAGE : "变频器加速过压保护", #//"36 //STR_ALARM_FREQ_ACCELERATE_OVER_VOLTAGE + AlarmInfo.ALARM_FREQ_DECELERATE_OVER_VOLTAGE : "变频器减速过压保护", #//"37 //STR_ALARM_FREQ_DECELERATE_OVER_VOLTAGE + AlarmInfo.ALARM_FREQ_FIX_SPEED_OVER_VOLTAGE : "变频器定速过压保护", #//"38 //STR_ALARM_FREQ_FIX_SPEED_OVER_VOLTAGE + AlarmInfo.ALARM_FREQ_DC_VOLTAGE_LOW : "变频器母线电压低", #//"39 //STR_ALARM_FREQ_DC_VOLTAGE_LOW + AlarmInfo.ALARM_FREQ_MOTOR_OVER_LOAD : "变频器电机过载", #//"40 //STR_ALARM_FREQ_MOTOR_OVER_LOAD + AlarmInfo.ALARM_FREQ_OVER_LOAD : "变频器过载", #//"41 //STR_ALARM_FREQ_OVER_LOAD + AlarmInfo.ALARM_FREQ_INPUT_MISS_PHASE : "变频器输入缺相", #//"42 //STR_ALARM_FREQ_INPUT_MISS_PHASE + AlarmInfo.ALARM_FREQ_OUTPUT_MISS_PHASE : "变频器输出缺相", #//"43 //STR_ALARM_FREQ_OUTPUT_MISS_PHASE + AlarmInfo.ALARM_FREQ_MODULE_TEMP_HIGH : "变频器温度过高", #//"44 //STR_ALARM_FREQ_MODULE_TEMP_HIGH + AlarmInfo.ALARM_FREQ_RSV45 : "保留", #//"45 //STR_ALARM_FREQ_RSV45 + AlarmInfo.ALARM_FREQ_EXTERNAL : "变频器外部故障", #//"46 //STR_ALARM_FREQ_EXTERNAL + AlarmInfo.ALARM_FREQ_COMMUNICATION : "变频器通讯故障", #//"47 //STR_ALARM_FREQ_COMMUNICATION + AlarmInfo.ALARM_FREQ_CURRENT_MEASURE : "变频器电流检测回路故障", #//"48 //STR_ALARM_FREQ_CURRENT_MEASURE + AlarmInfo.ALARM_FREQ_SELF_STUDY : "变频器自学习故障", #//"49 //STR_ALARM_FREQ_SELF_STUDY + AlarmInfo.ALARM_FREQ_EEPROM : "变频器EEPROM故障", #//"50 //STR_ALARM_FREQ_EEPROM + AlarmInfo.ALARM_FREQ_PID_FAIL : "变频器PID调节故障", #//"51 //STR_ALARM_FREQ_PID_FAIL + AlarmInfo.ALARM_FREQ_STOP_UNIT : "变频器制动单元故障", #//"52 //STR_ALARM_FREQ_STOP_UNIT + AlarmInfo.ALARM_FREQ_RSV53 : "保留", #//"53 //STR_ALARM_FREQ_RSV53 + + AlarmInfo.ALARM_FREQ_CURRENT_BASE : "电流偏置故障(CoF)", # //102 + AlarmInfo.ALARM_FREQ_ADC_FAULT : "A/D 转换器故障(CPF02)", # //103 + AlarmInfo.ALARM_FREQ_PWM_DATA_ERR : "PWM 数据异常(CPF03)", # //104 + AlarmInfo.ALARM_FREQ_EEPROM_DATA_ERR : "EEPROM 数据异常(CPF06)", # //105 + AlarmInfo.ALARM_FREQ_TERMINAL_FAULT : "端子电路板通信故障(CPF07)", # //106 + AlarmInfo.ALARM_FREQ_EEPROM_COMM_FAULT : "EEPROM 串行通信故障(CPF08)", # //107 + AlarmInfo.ALARM_FREQ_RAM_FAULT : "RAM 故障(CPF11)", # //108 + AlarmInfo.ALARM_FREQ_FLASH_FAULT : "闪存故障(CPF12)", # //109 + AlarmInfo.ALARM_FREQ_MONITOR : "监视故障(CPF13)", # //110 + AlarmInfo.ALARM_FREQ_CTRL_CIRCUIT : "控制回路故障(CPF14)", # //111 + AlarmInfo.ALARM_FREQ_CLOCK_FAULT : "时钟故障(CPF16)", # //112 + AlarmInfo.ALARM_FREQ_INTERRUPT_FAULT : "中断故障(CPF17)", # //113 + AlarmInfo.ALARM_FREQ_PWM_FBDATA_ERR : "PWM 反馈数据异常(CPF23)", # //114 + AlarmInfo.ALARM_FREQ_CAPACITY_SIGNAL : "变频器容量信号故障(CPF24)", # //115 + AlarmInfo.ALARM_FREQ_TERMINAL_NOT_CONNECT : "未连接端子电路板(CPF25)", # //116 + AlarmInfo.ALARM_FREQ_MONITOR_DEVICE : "监视装置故障(E5/CPF13)", # //117 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S1 : "外部故障(输入端子S1)(EF1)", # //118 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S2 : "外部故障(输入端子S2)(EF2)", # //119 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S3 : "外部故障(输入端子S3)(EF3)", # //120 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S4 : "外部故障(输入端子S4)(EF4)", # //121 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S5 : "外部故障(输入端子S5)(EF5)", # //122 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S6 : "外部故障(输入端子S6)(EF6)", # //123 + AlarmInfo.ALARM_FREQ_EEPROMW_WRITE_ERR : "EEPROM 写入不当(Err)", # //124 + AlarmInfo.ALARM_FREQ_PIDFB_OVERTOP : "PID 反馈超值(FbH)", # //125 + AlarmInfo.ALARM_FREQ_PID_FB_LOST : "PID 反馈丧失(FbH)", # //126 + AlarmInfo.ALARM_FREQ_GROUND_FALUT : "接地短路(GF)", # //127 + AlarmInfo.ALARM_FREQ_OUT_PHASE_LOST : "输出缺相(LF)", # //128 + AlarmInfo.ALARM_FREQ_OUT_IMBALANCE : "输出电流失衡(LF)", # //129 + AlarmInfo.ALARM_FREQ_NODE_SETUP_ERR : "Node Setup 故障(LF)", # //130 + AlarmInfo.ALARM_FREQ_OVER_CURRENT : "过电流(oC)", # //131 + AlarmInfo.ALARM_FREQ_FIN_OVER_HEAT : "散热片过热(oH/oH1)", # //132 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT1 : "电机过热警告(PTC 输入)(oH3)", # //133 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT2 : "电机过热故障(PTC 输入)(oH4)", # //134 + AlarmInfo.ALARM_FREQ_MOTOR_OVERLOAD : "电机过载(oL1)", # //135 + AlarmInfo.ALARM_FREQ_VFD_OVERLOAD : "变频器过载(oL2)", # //136 + AlarmInfo.ALARM_FREQ_OVER_TORQUE1 : "过转矩检出1(oL3)", # //137 + AlarmInfo.ALARM_FREQ_OVER_TORQUE2 : "过转矩检出2(oL4)", # //138 + AlarmInfo.ALARM_FREQ_MECHAN_AGING1 : "机械老化检出1(oL5)", # //139 + AlarmInfo.ALARM_FREQ_BREAK_OVERLOAD : "高滑差制动电机过载保护(oL7)", # //140 + AlarmInfo.ALARM_FREQ_OVER_VOLTAGE : "主回路过电压(ov)", # //141 + AlarmInfo.ALARM_FREQ_VOLTAGE_FAULT : "主回路电压故障(PF)", # //142 + AlarmInfo.ALARM_FREQ_BRAKE_TRANS : "内置制动晶体管故障(rr)", # //143 + AlarmInfo.ALARM_FREQ_OUT_SHORT : "输出短路或IGBT故障(SC)", # //144 + AlarmInfo.ALARM_FREQ_SPEED_SEARCH : "速度搜索重试故障(SC)", # //145 + AlarmInfo.ALARM_FREQ_DISORDER : "失调检出(STo)", # //146 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE1 : "转矩不足1(UL3)", # //147 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE2 : "转矩不足2(UL4)", # //148 + AlarmInfo.ALARM_FREQ_MECHAN_AGING2 : "机械老化检出2(UL5)", # //149 + AlarmInfo.ALARM_FREQ_MAJOR_UNDERVOLTAGE : "主回路欠电压(Uv/Uv1)", # //150 + AlarmInfo.ALARM_FREQ_CTRL_POW_FAULT : "控制电源故障(Uv2)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL1_ERR : "控制回路故障(CPF18)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL2_ERR : "控制回路故障(CPF19)", # //151 + AlarmInfo.ALARM_FREQ_HARD1_ERR : "硬件故障(CPF20)", # //151 + AlarmInfo.ALARM_FREQ_HARD2_ERR : "硬件故障(CPF21)", # //151 + AlarmInfo.ALARM_FREQ_ADC_ERR : "ADC故障(CPF22)", # //151 + AlarmInfo.ALARM_FREQ_PREVENT_SHOCK : "冲击防止回路故障(Uv3)", # //152 + AlarmInfo.ALARM_FREQ_BASE_BLOCK : "变频器基极封锁(bb)", # //160 + AlarmInfo.ALARM_FREQ_COMM_WAITING : "通信等待中(CALL)", # //161 + AlarmInfo.ALARM_FREQ_RST_WHEN_RUN : "运行指令输入中复位(CrST)", # //162 + AlarmInfo.ALARM_FREQ_COMM_CYCLE_ERR : "通信周期设定错误(CyC)", # //163 + AlarmInfo.ALARM_FREQ_DRIVE_DISABLE : "Drive Disable中(dnE)", # //164 + AlarmInfo.ALARM_FREQ_CW_CCW_CMD : "正反转指令同时输入(EF)", # //165: " + AlarmInfo.ALARM_FREQ_CURRENT_WARNING : "电流警告(HCA)", # //166 + AlarmInfo.ALARM_FREQ_MAINTAIN_FAN : "冷却风扇维护时期(LT-1)", # //167 + AlarmInfo.ALARM_FREQ_MAINTAIN_CAP : "电容器维护时期(LT-2)", # //168 + AlarmInfo.ALARM_FREQ_MAINTAIN_RELAY : "冲击电流防止继电器维护时期(LT-3)", # //169 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_50 : "IGBT维护时期(50%)(LT-4)", # //170 + AlarmInfo.ALARM_FREQ_VFD_OH_ALERT : "变频器过热预警(oH2)", # //171 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT : "电机过热(oH3)", # //172 + AlarmInfo.ALARM_FREQ_RSV173 : "保留", # //173 + AlarmInfo.ALARM_FREQ_RSV174 : "保留", # //174 + + AlarmInfo.ALARM_FREQ_MOBUS_TEST_OK : "MEMOBUS通信测试模式正常(PASS)", # //175 + AlarmInfo.ALARM_FREQ_SWITCH_WHEN_RUN : "运行中输入电机切换指令(rUn)", # //176 + AlarmInfo.ALARM_FREQ_MOBUS_TEST_ERR : "MEMOBUS通信测试模式故障(SE)", # //177 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_90 : "IGBT维护时期(90%)(TrPC)", # //178 + AlarmInfo.ALARM_FREQ_RSV179 : "保留", # //179 + AlarmInfo.ALARM_FREQ_RSV180 : "保留", # //180 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : "变频器容量的设定故障(oPE01)", # //181 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : "参数设定范围不当(oPE02)", # //182 + AlarmInfo.ALARM_FREQ_DIN_SELECT_ERR : "多功能输入的选择不当(oPE03)", # //183 + AlarmInfo.ALARM_FREQ_AIN_SELECT_ERR : "多功能模拟量输入的选择不当(oPE07)", # //184 + AlarmInfo.ALARM_FREQ_PARA_SELECT_ERR : "参数选择不当(oPE08)", # //182 + AlarmInfo.ALARM_FREQ_PID_SELECT_ERR : "PID控制的选择不当(oPE09)", # //183 + AlarmInfo.ALARM_FREQ_VF_DATA_SET_ERR : "V/f数据的设定不当(oPE10)", # //184 + AlarmInfo.ALARM_FREQ_CARRIER_SET_ERR : "载波频率的设定不当(oPE11)", # //182 + + AlarmInfo.USER_GLOBAL_ALARM_0 : "1#水箱液位低报警", #全局报警0", + AlarmInfo.USER_GLOBAL_ALARM_1 : "1#液位传感器未接入", + AlarmInfo.USER_GLOBAL_ALARM_2 : "2#液位传感器未接入", + AlarmInfo.USER_GLOBAL_ALARM_3 : "1#2#液位同时低", + AlarmInfo.USER_GLOBAL_ALARM_4 : "输入压力传感器无效", + AlarmInfo.USER_GLOBAL_ALARM_5 : "水箱无水同时进压低", + AlarmInfo.USER_GLOBAL_ALARM_6 : "全局报警6", + AlarmInfo.USER_GLOBAL_ALARM_7 : "全局报警7", + AlarmInfo.USER_GLOBAL_ALARM_8 : "全局报警8", + AlarmInfo.USER_GLOBAL_ALARM_9 : "全局报警9", + AlarmInfo.USER_GLOBAL_ALARM_10 : "全局报警10", + AlarmInfo.USER_GLOBAL_ALARM_11 : "全局报警11", + AlarmInfo.USER_GLOBAL_ALARM_12 : "全局报警12", + AlarmInfo.USER_GLOBAL_ALARM_13 : "全局报警13", + AlarmInfo.USER_GLOBAL_ALARM_14 : "全局报警14", + AlarmInfo.USER_GLOBAL_ALARM_15 : "全局报警15", + + AlarmInfo.USER_GLOBAL_WARNING_0 : "1#水箱液位低警告", + AlarmInfo.USER_GLOBAL_WARNING_1 : "2#水箱液位低警告", + AlarmInfo.USER_GLOBAL_WARNING_2 : "全局警告2", + AlarmInfo.USER_GLOBAL_WARNING_3 : "全局警告3", + AlarmInfo.USER_GLOBAL_WARNING_4 : "全局警告4", + AlarmInfo.USER_GLOBAL_WARNING_5 : "全局警告5", + AlarmInfo.USER_GLOBAL_WARNING_6 : "全局警告6", + AlarmInfo.USER_GLOBAL_WARNING_7 : "全局警告7", + AlarmInfo.USER_GLOBAL_WARNING_8 : "全局警告8", + AlarmInfo.USER_GLOBAL_WARNING_9 : "全局警告9", + AlarmInfo.USER_GLOBAL_WARNING_10 : "全局警告10", + AlarmInfo.USER_GLOBAL_WARNING_11 : "全局警告11", + AlarmInfo.USER_GLOBAL_WARNING_12 : "全局警告12", + AlarmInfo.USER_GLOBAL_WARNING_13 : "全局警告13", + AlarmInfo.USER_GLOBAL_WARNING_14 : "全局警告14", + AlarmInfo.USER_GLOBAL_WARNING_15 : "全局警告15", + + AlarmInfo.USER_LOCAL_WARNING_0 : "本机警告0", + AlarmInfo.USER_LOCAL_WARNING_1 : "本机警告1", + AlarmInfo.USER_LOCAL_WARNING_2 : "本机警告2", + AlarmInfo.USER_LOCAL_WARNING_3 : "本机警告3", + AlarmInfo.USER_LOCAL_WARNING_4 : "本机警告4", + AlarmInfo.USER_LOCAL_WARNING_5 : "本机警告5", + AlarmInfo.USER_LOCAL_WARNING_6 : "本机警告6", + AlarmInfo.USER_LOCAL_WARNING_7 : "本机警告7", + AlarmInfo.USER_LOCAL_WARNING_8 : "本机警告8", + AlarmInfo.USER_LOCAL_WARNING_9 : "本机警告9", + AlarmInfo.USER_LOCAL_WARNING_10 : "本机警告10", + AlarmInfo.USER_LOCAL_WARNING_11 : "本机警告11", + AlarmInfo.USER_LOCAL_WARNING_12 : "本机警告12", + AlarmInfo.USER_LOCAL_WARNING_13 : "本机警告13", + AlarmInfo.USER_LOCAL_WARNING_14 : "本机警告14", + AlarmInfo.USER_LOCAL_WARNING_15 : "本机警告15", + }}, + + {"alias_alarm_cause": + { + AlarmInfo.ALARM_FREE : "无", + AlarmInfo.ALARM_PIPE_BROKE : "1. 系统管路泄漏@2. 输出压力传感器故障@3. 阀门开度太大", + AlarmInfo.ALARM_NO_WATER_EXIST : "1. 进水口无水或水压极低@2. 线路松动@3. 进水压力低于设定值@4. 模拟量异常或未校正,导到实系统压力值与实际压不一个致@5. 传感器故障", + AlarmInfo.ALARM_WATER_PRESSURE_HIGH : "1. 出水口水压过高@2. 线路松动@3. 电接点压力表设置不合理或故障4. 最低转速过高@5. 模拟量异常或未校正,导到系统压力值与实际压不一个致@6. 传感器故障", + AlarmInfo.ALARM_OVER_VOLTAGE : "1. 380V某一相(或几相)电压过高@2. 变频器故障", + AlarmInfo.ALARM_UNDER_VOLTAGE : "1. 380V某一相(或几相)电压过低@2. 变频器故障", + AlarmInfo.ALARM_BOARD_HARDWARE : "1. 需专业人员检修或更换控制器", + AlarmInfo.ALARM_IO_NO_WATER_EXIST : "1. 进水口无水或水箱浮球低位", + AlarmInfo.ALARM_SENSOR_PRESS_IN : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_PRESS_OUT : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_FLUX : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_PH : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_WATER_CLEAR : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_REMAIN_CL : STR_SensorFailCause, + AlarmInfo.ALARM_NEG_PRESSURE : "1. 进水口无水或水压极低@2. 线路松动@3. 进水压力低于设定值,@4. 模拟量异常或未校正,导到系统压力值与实际压不一个致@5. 传感器故障", + AlarmInfo.ALARM_VACUMM_PRESSURE : "1. 进水口无水或水压极低@2. 线路松动@3. 进水压力低于设定值,@4. 模拟量异常或未校正,导到实系统压力值与实际压不一个致@5. 传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL : STR_SensorFailCause, + AlarmInfo.ALARM_WATER_PRESSURE_LOW : "1. 并非故障,仅作提示@2. 电接点压力表低压设定值过大", + AlarmInfo.ALARM_SENSOR_FLUX_IN : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK : "1. 调节阀故障@2. 模拟量口故障@3. 通信电缆的接线不正确,或发生短路、断线", + AlarmInfo.ALARM_SENSOR_NOIZE : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL2 : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK2 : STR_SensorFailCause, + AlarmInfo.ALARM_IO_LEAK_WATER : "1. 检测到漏水信号", + AlarmInfo.ALARM_IO_SMOKE : "1. 检测到烟感信号", + AlarmInfo.ALARM_IO_EXTERNALERROR : "1. 检测到外部故障信号", + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_TEMPERATURE : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_TEMPERATURE2 : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_TEMPERATURE3 : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL3 : STR_SensorFailCause, + + AlarmInfo.ALARM_COMM_FREQ_CONVERTER : "1. 通信电缆断线、接触不良@2. 通信参数不匹配@3. 受到干扰@4. 变频器型号选择错误", + AlarmInfo.ALARM_COMM_TOUCH_BOARD : EMPTY_STRING, + AlarmInfo.ALARM_COMM_MAIN_BOARD : "1. 线路松动、硬件故障、干扰", + AlarmInfo.ALARM_PUMP_AIR_SWITCH_OFF : EMPTY_STRING, + AlarmInfo.ALARM_MAIN_PUMP_LOST : "1. 未设置1号泵@2. 1号泵未上电@3. 1号泵已损坏@4.通信电缆的接线短路或断线@5.干扰导致通信数据发生故障", + AlarmInfo.ALARM_PUMP_RESET_DELAY : EMPTY_STRING, + AlarmInfo.ALARM_COMMAND_EXECUTE_FAIL : EMPTY_STRING, + AlarmInfo.ALARM_FREQ_PARAMETER_SET : EMPTY_STRING, + AlarmInfo.ALARM_PUMP_ADDR_ID_CONFLICT : "1. 设置了两台相同泵号", + AlarmInfo.ALARM_PUMP_MOTOR_TEMPERATURE_HIGH : "1. 冷却水量少@2. 电机故障", + AlarmInfo.ALARM_BUS_POWER_SHORT : "1. 通信电缆的接线不正确,或发生短路", + AlarmInfo.ALARM_POWER_LOST : "1. 380V电源未上电 ", + + AlarmInfo.ALARM_FREQ_CURRENT_BASE : STR_FreqErrRef, #//电流偏置故障(CoF)", # //102 + AlarmInfo.ALARM_FREQ_ADC_FAULT : STR_FreqErrRef, #//A/D 转换器故障(CPF02)", # //103 + AlarmInfo.ALARM_FREQ_PWM_DATA_ERR : STR_FreqErrRef, #//PWM 数据异常(CPF03)", # //104 + AlarmInfo.ALARM_FREQ_EEPROM_DATA_ERR : STR_FreqErrRef, #//EEPROM 数据异常(CPF06)", # //105 + AlarmInfo.ALARM_FREQ_TERMINAL_FAULT : STR_FreqErrRef, #//端子电路板通信故障(CPF07)", # //106 + AlarmInfo.ALARM_FREQ_EEPROM_COMM_FAULT : STR_FreqErrRef, #//EEPROM 串行通信故障(CPF08)", # //107 + AlarmInfo.ALARM_FREQ_RAM_FAULT : STR_FreqErrRef, #//RAM 故障(CPF11)", # //108 + AlarmInfo.ALARM_FREQ_FLASH_FAULT : STR_FreqErrRef, #//闪存故障(CPF12)", # //109 + AlarmInfo.ALARM_FREQ_MONITOR : STR_FreqErrRef, #//监视故障(CPF13)", # //110 + AlarmInfo.ALARM_FREQ_CTRL_CIRCUIT : STR_FreqErrRef, #//控制回路故障(CPF14)", # //111 + AlarmInfo.ALARM_FREQ_CLOCK_FAULT : STR_FreqErrRef, #//时钟故障(CPF16)", # //112 + AlarmInfo.ALARM_FREQ_INTERRUPT_FAULT : STR_FreqErrRef, #//中断故障(CPF17)", # //113 + AlarmInfo.ALARM_FREQ_PWM_FBDATA_ERR : STR_FreqErrRef, #//PWM 反馈数据异常(CPF23)", # //114 + AlarmInfo.ALARM_FREQ_CAPACITY_SIGNAL : STR_FreqErrRef, #//变频器容量信号故障(CPF24)", # //115 + AlarmInfo.ALARM_FREQ_TERMINAL_NOT_CONNECT : STR_FreqErrRef, #//未连接端子电路板(CPF25)", # //116 + AlarmInfo.ALARM_FREQ_MONITOR_DEVICE : STR_FreqErrRef, #//监视装置故障(E5/CPF13)", # //117 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S1 : STR_FreqErrRef, #//外部故障(输入端子S1)(EF1)", # //118 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S2 : STR_FreqErrRef, #//外部故障(输入端子S2)(EF2)", # //119 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S3 : STR_FreqErrRef, #//外部故障(输入端子S3)(EF3)", # //120 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S4 : STR_FreqErrRef, #//外部故障(输入端子S4)(EF4)", # //121 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S5 : STR_FreqErrRef, #//外部故障(输入端子S5)(EF5)", # //122 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S6 : STR_FreqErrRef, #//外部故障(输入端子S6)(EF6)", # //123 + AlarmInfo.ALARM_FREQ_EEPROMW_WRITE_ERR : STR_FreqErrRef, #//EEPROM 写入不当(Err)", # //124 + AlarmInfo.ALARM_FREQ_PIDFB_OVERTOP : STR_FreqErrRef, #//PID 反馈超值(FbH)", # //125 + AlarmInfo.ALARM_FREQ_PID_FB_LOST : STR_FreqErrRef, #//PID 反馈丧失(FbH)", # //126 + AlarmInfo.ALARM_FREQ_GROUND_FALUT : STR_FreqErrRef, #//接地短路(GF)", # //127 + AlarmInfo.ALARM_FREQ_OUT_PHASE_LOST : STR_FreqErrRef, #//输出缺相(LF)", # //128 + AlarmInfo.ALARM_FREQ_OUT_IMBALANCE : STR_FreqErrRef, #//输出电流失衡(LF)", # //129 + AlarmInfo.ALARM_FREQ_NODE_SETUP_ERR : STR_FreqErrRef, #//Node Setup 故障(LF)", # //130 + AlarmInfo.ALARM_FREQ_OVER_CURRENT : STR_FreqErrRef, #//过电流(oC)", # //131 + AlarmInfo.ALARM_FREQ_FIN_OVER_HEAT : STR_FreqErrRef, #//散热片过热(oH/oH1)", # //132 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT1 : STR_FreqErrRef, #//电机过热警告(PTC 输入)(oH3)", # //133 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT2 : STR_FreqErrRef, #//电机过热故障(PTC 输入)(oH4)", # //134 + AlarmInfo.ALARM_FREQ_MOTOR_OVERLOAD : STR_FreqErrRef, #//电机过载(oL1)", # //135 + AlarmInfo.ALARM_FREQ_VFD_OVERLOAD : STR_FreqErrRef, #//变频器过载(oL2)", # //136 + AlarmInfo.ALARM_FREQ_OVER_TORQUE1 : STR_FreqErrRef, #//过转矩检出1(oL3)", # //137 + AlarmInfo.ALARM_FREQ_OVER_TORQUE2 : STR_FreqErrRef, #//过转矩检出2(oL4)", # //138 + AlarmInfo.ALARM_FREQ_MECHAN_AGING1 : STR_FreqErrRef, #//机械老化检出1(oL5)", # //139 + AlarmInfo.ALARM_FREQ_BREAK_OVERLOAD : STR_FreqErrRef, #//高滑差制动电机过载保护(oL7)", # //140 + AlarmInfo.ALARM_FREQ_OVER_VOLTAGE : STR_FreqErrRef, #//主回路过电压(ov)", # //141 + AlarmInfo.ALARM_FREQ_VOLTAGE_FAULT : STR_FreqErrRef, #//主回路电压故障(PF)", # //142 + AlarmInfo.ALARM_FREQ_BRAKE_TRANS : STR_FreqErrRef, #//内置制动晶体管故障(rr)", # //143 + AlarmInfo.ALARM_FREQ_OUT_SHORT : STR_FreqErrRef, #//输出短路或IGBT故障(SC)", # //144 + AlarmInfo.ALARM_FREQ_SPEED_SEARCH : STR_FreqErrRef, #//速度搜索重试故障(SC)", # //145 + AlarmInfo.ALARM_FREQ_DISORDER : STR_FreqErrRef, #//失调检出(STo)", # //146 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE1 : STR_FreqErrRef, #//转矩不足1(UL3)", # //147 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE2 : STR_FreqErrRef, #//转矩不足2(UL4)", # //148 + AlarmInfo.ALARM_FREQ_MECHAN_AGING2 : STR_FreqErrRef, #//机械老化检出2(UL5)", # //149 + AlarmInfo.ALARM_FREQ_MAJOR_UNDERVOLTAGE : STR_FreqErrRef, #//主回路欠电压(Uv/Uv1)", # //150 + AlarmInfo.ALARM_FREQ_CTRL_POW_FAULT : STR_FreqErrRef, #//控制电源故障(Uv2)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL1_ERR : STR_FreqErrRef, #//控制回路故障(CPF18)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL2_ERR : STR_FreqErrRef, #//控制回路故障(CPF19)", # //151 + AlarmInfo.ALARM_FREQ_HARD1_ERR : STR_FreqErrRef, #//硬件故障(CPF20)", # //151 + AlarmInfo.ALARM_FREQ_HARD2_ERR : STR_FreqErrRef, #//硬件故障(CPF21)", # //151 + AlarmInfo.ALARM_FREQ_ADC_ERR : STR_FreqErrRef, #//ADC故障(CPF22)", # //151 + AlarmInfo.ALARM_FREQ_PREVENT_SHOCK : STR_FreqErrRef, #//冲击防止回路故障(Uv3)", # //152 + AlarmInfo.ALARM_FREQ_BASE_BLOCK : STR_FreqErrRef, #//变频器基极封锁(bb)", # //160 + AlarmInfo.ALARM_FREQ_COMM_WAITING : STR_FreqErrRef, #//通信等待中(CALL)", # //161 + AlarmInfo.ALARM_FREQ_RST_WHEN_RUN : STR_FreqErrRef, #//运行指令输入中复位(CrST)", # //162 + AlarmInfo.ALARM_FREQ_COMM_CYCLE_ERR : STR_FreqErrRef, #//通信周期设定错误(CyC)", # //163 + AlarmInfo.ALARM_FREQ_DRIVE_DISABLE : STR_FreqErrRef, #//Drive Disable中(dnE)", # //164 + AlarmInfo.ALARM_FREQ_CW_CCW_CMD : STR_FreqErrRef, #//正反转指令同时输入(EF)", # //165 + AlarmInfo.ALARM_FREQ_CURRENT_WARNING : STR_FreqErrRef, #//电流警告(HCA)", # //166 + AlarmInfo.ALARM_FREQ_MAINTAIN_FAN : STR_FreqErrRef, #//冷却风扇维护时期(LT-1)", # //167 + AlarmInfo.ALARM_FREQ_MAINTAIN_CAP : STR_FreqErrRef, #//电容器维护时期(LT-2)", # //168 + AlarmInfo.ALARM_FREQ_MAINTAIN_RELAY : STR_FreqErrRef, #//冲击电流防止继电器维护时期(LT-3)", # //169 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_50 : STR_FreqErrRef, #//IGBT维护时期(50%)(LT-4)", # //170 + AlarmInfo.ALARM_FREQ_VFD_OH_ALERT : STR_FreqErrRef, #//变频器过热预警(oH2)", # //171 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT : STR_FreqErrRef, #//电机过热(oH3)", # //172 + AlarmInfo.ALARM_FREQ_RSV173 : STR_FreqErrRef, #//保留", # //173 + AlarmInfo.ALARM_FREQ_RSV174 : STR_FreqErrRef, #//保留", # //174 + + AlarmInfo.ALARM_FREQ_MOBUS_TEST_OK : "正在进行通信测试", # //175 + AlarmInfo.ALARM_FREQ_SWITCH_WHEN_RUN : STR_FreqErrRef, #//运行中输入电机切换指令(rUn)", # //176 + AlarmInfo.ALARM_FREQ_MOBUS_TEST_ERR : STR_FreqErrRef, #//MEMOBUS通信测试模式故障(SE)", # //177 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_90 : STR_FreqErrRef, #//IGBT维护时期(90%)(TrPC)", # //178 + AlarmInfo.ALARM_FREQ_RSV179 : STR_FreqErrRef, #//保留", # //179 + AlarmInfo.ALARM_FREQ_RSV180 : STR_FreqErrRef, #//保留", # //180 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//变频器容量的设定故障(oPE01)", # //181 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//参数设定范围不当(oPE02)", # //182 + AlarmInfo.ALARM_FREQ_DIN_SELECT_ERR : STR_FreqErrRef, #//多功能输入的选择不当(oPE03)", # //183 + AlarmInfo.ALARM_FREQ_AIN_SELECT_ERR : STR_FreqErrRef, #//多功能模拟量输入的选择不当(oPE07)", # //184 + AlarmInfo.ALARM_FREQ_PARA_SELECT_ERR : STR_FreqErrRef, #//参数选择不当(oPE08)", # //182 + AlarmInfo.ALARM_FREQ_PID_SELECT_ERR : STR_FreqErrRef, #//PID控制的选择不当(oPE09)", # //183 + AlarmInfo.ALARM_FREQ_VF_DATA_SET_ERR : STR_FreqErrRef, #//V/f数据的设定不当(oPE10)", # //184 + AlarmInfo.ALARM_FREQ_CARRIER_SET_ERR : STR_FreqErrRef, #//载波频率的设定不当(oPE11)", # //182 + + AlarmInfo.USER_GLOBAL_ALARM_0 : "1#水箱液位低于无水液位", #全局报警0", + AlarmInfo.USER_GLOBAL_ALARM_1 : "1#水箱无液位传感器输入", + AlarmInfo.USER_GLOBAL_ALARM_2 : "2#水箱无液位传感器输入", + AlarmInfo.USER_GLOBAL_ALARM_3 : "1#水箱液位低, 2#水箱液位低", + AlarmInfo.USER_GLOBAL_ALARM_4 : "输入压力传感器未配置或损坏", + AlarmInfo.USER_GLOBAL_ALARM_5 : "1.水箱液位低于无水液位@2. 同时进水压力低于进压关阀压力 ", + AlarmInfo.USER_GLOBAL_ALARM_6 : "全局报警6", + AlarmInfo.USER_GLOBAL_ALARM_7 : "全局报警7", + AlarmInfo.USER_GLOBAL_ALARM_8 : "全局报警8", + AlarmInfo.USER_GLOBAL_ALARM_9 : "全局报警9", + AlarmInfo.USER_GLOBAL_ALARM_10 : "全局报警10", + AlarmInfo.USER_GLOBAL_ALARM_11 : "全局报警11", + AlarmInfo.USER_GLOBAL_ALARM_12 : "全局报警12", + AlarmInfo.USER_GLOBAL_ALARM_13 : "全局报警13", + AlarmInfo.USER_GLOBAL_ALARM_14 : "全局报警14", + AlarmInfo.USER_GLOBAL_ALARM_15 : "全局报警15", + + AlarmInfo.USER_GLOBAL_WARNING_0 : "1#水箱液位低于无水液位", + AlarmInfo.USER_GLOBAL_WARNING_1 : "2#水箱液位低于无水液位", + AlarmInfo.USER_GLOBAL_WARNING_2 : "全局警告2", + AlarmInfo.USER_GLOBAL_WARNING_3 : "全局警告3", + AlarmInfo.USER_GLOBAL_WARNING_4 : "全局警告4", + AlarmInfo.USER_GLOBAL_WARNING_5 : "全局警告5", + AlarmInfo.USER_GLOBAL_WARNING_6 : "全局警告6", + AlarmInfo.USER_GLOBAL_WARNING_7 : "全局警告7", + AlarmInfo.USER_GLOBAL_WARNING_8 : "全局警告8", + AlarmInfo.USER_GLOBAL_WARNING_9 : "全局警告9", + AlarmInfo.USER_GLOBAL_WARNING_10 : "全局警告10", + AlarmInfo.USER_GLOBAL_WARNING_11 : "全局警告11", + AlarmInfo.USER_GLOBAL_WARNING_12 : "全局警告12", + AlarmInfo.USER_GLOBAL_WARNING_13 : "全局警告13", + AlarmInfo.USER_GLOBAL_WARNING_14 : "全局警告14", + AlarmInfo.USER_GLOBAL_WARNING_15 : "全局警告15", + + }}, + + {"alias_alarm_help": + { + AlarmInfo.ALARM_FREE : "无", + AlarmInfo.ALARM_PIPE_BROKE : "1. 管路修复@2. 检查传感器线路及更换传感器@3. 配置更大流量的泵或减少阀门开度", + AlarmInfo.ALARM_NO_WATER_EXIST : "1. 有水后自动解除故障@2. 检查传感器线路@3. @4. 出水压力显示是否正常,进行参数校正@5. 检查进水压力传感器是否正常", + AlarmInfo.ALARM_WATER_PRESSURE_HIGH : "1. 水压降低后自动解除@2. 检查传感器线路@3. 检查出水电接点压力表是否正常。n\4. 变频器最小频率是否合理。@5. 出水压力显示是否正常,进行参数校正@6. 出水传感器是否正常。", + AlarmInfo.ALARM_OVER_VOLTAGE : "1. 检查380V三相电压@2. 更换变频器", + AlarmInfo.ALARM_UNDER_VOLTAGE : "1. 检查380V三相电压@2. 更换变频器", + AlarmInfo.ALARM_BOARD_HARDWARE : "1. 更换电机", + AlarmInfo.ALARM_IO_NO_WATER_EXIST : "1. 有水后自动解除故障 @2检查无水信号IO点 @3检查水箱液位传感器", + AlarmInfo.ALARM_SENSOR_PRESS_IN : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_PRESS_OUT : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_FLUX : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_PH : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_WATER_CLEAR : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_REMAIN_CL : STR_SensorFailProcess, + AlarmInfo.ALARM_NEG_PRESSURE : "1. 有水后自动解除故障@2. 检查传感器线路@3. 检查设置是否合理,@4. 出水压力显示是否正常,进行参数校正@5. 检查进水压力传感器是否正常", + AlarmInfo.ALARM_VACUMM_PRESSURE : "1. 有水后自动解除故障@2. 检查传感器线路@3. 检查设置是否合理,@4. 出水压力显示是否正常,进行参数校正@5. 检查进水压力传感器是否正常", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL : STR_SensorFailProcess, + AlarmInfo.ALARM_WATER_PRESSURE_LOW : "1. 无需处理@2. 检查电接点压力表设定值", + AlarmInfo.ALARM_SENSOR_FLUX_IN : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK : "1. 更换调节阀@2. 更换电机@3. 检查调节阀是否断线或损坏。", + AlarmInfo.ALARM_SENSOR_NOIZE : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL2 : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK2 : STR_SensorFailProcess, + AlarmInfo.ALARM_IO_LEAK_WATER : "1. 漏水信号消除后自动解除故障", + AlarmInfo.ALARM_IO_SMOKE : "1. 烟感信号消除后自动解除故障", + AlarmInfo.ALARM_IO_EXTERNALERROR : "1. 外部故障信号消除后自动解除故障", + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_TEMPERATURE : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_TEMPERATURE2 : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_TEMPERATURE3 : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL3 : STR_SensorFailProcess, + + AlarmInfo.ALARM_COMM_FREQ_CONVERTER : "1. 检查通信电缆和接线@2. 检查波特率等通信参数的设置@3. 排除干扰,详见说明书@4. 修改 系统信息>变频器型号", + AlarmInfo.ALARM_COMM_TOUCH_BOARD : EMPTY_STRING, + AlarmInfo.ALARM_COMM_MAIN_BOARD : "1. 检查是否存在干扰现象。", + AlarmInfo.ALARM_PUMP_AIR_SWITCH_OFF : EMPTY_STRING, + AlarmInfo.ALARM_MAIN_PUMP_LOST : "1. 设置一台水泵为1号泵@2. 检查电源@3. 把原1号泵断开连接, 重新设置一台1号泵@4. 检查CAN通讯线束@5. 确认抗干扰对策的状况。@6. 检查控制回路的接线、主回路接地线", + AlarmInfo.ALARM_PUMP_RESET_DELAY : EMPTY_STRING, + AlarmInfo.ALARM_COMMAND_EXECUTE_FAIL : EMPTY_STRING, + AlarmInfo.ALARM_FREQ_PARAMETER_SET : EMPTY_STRING, + AlarmInfo.ALARM_PUMP_ADDR_ID_CONFLICT : "1. 检查泵号设置", + AlarmInfo.ALARM_PUMP_MOTOR_TEMPERATURE_HIGH : "1. 调整减压阀,加大冷却水流量@2. 清洗减压阀过滤网@3. 更换电机", + AlarmInfo.ALARM_BUS_POWER_SHORT : "1. 检查CAN通讯线束", + AlarmInfo.ALARM_POWER_LOST : "1. 检查380V电源是否打开@2.检查线路是否松动", + + AlarmInfo.ALARM_FREQ_CURRENT_BASE : STR_FreqErrRef, #//电流偏置故障(CoF)", # //102 + AlarmInfo.ALARM_FREQ_ADC_FAULT : STR_FreqErrRef, #//A/D 转换器故障(CPF02)", # //103 + AlarmInfo.ALARM_FREQ_PWM_DATA_ERR : STR_FreqErrRef, #//PWM 数据异常(CPF03)", # //104 + AlarmInfo.ALARM_FREQ_EEPROM_DATA_ERR : STR_FreqErrRef, #//EEPROM 数据异常(CPF06)", # //105 + AlarmInfo.ALARM_FREQ_TERMINAL_FAULT : STR_FreqErrRef, #//端子电路板通信故障(CPF07)", # //106 + AlarmInfo.ALARM_FREQ_EEPROM_COMM_FAULT : STR_FreqErrRef, #//EEPROM 串行通信故障(CPF08)", # //107 + AlarmInfo.ALARM_FREQ_RAM_FAULT : STR_FreqErrRef, #//RAM 故障(CPF11)", # //108 + AlarmInfo.ALARM_FREQ_FLASH_FAULT : STR_FreqErrRef, #//闪存故障(CPF12)", # //109 + AlarmInfo.ALARM_FREQ_MONITOR : STR_FreqErrRef, #//监视故障(CPF13)", # //110 + AlarmInfo.ALARM_FREQ_CTRL_CIRCUIT : STR_FreqErrRef, #//控制回路故障(CPF14)", # //111 + AlarmInfo.ALARM_FREQ_CLOCK_FAULT : STR_FreqErrRef, #//时钟故障(CPF16)", # //112 + AlarmInfo.ALARM_FREQ_INTERRUPT_FAULT : STR_FreqErrRef, #//中断故障(CPF17)", # //113 + AlarmInfo.ALARM_FREQ_PWM_FBDATA_ERR : STR_FreqErrRef, #//PWM 反馈数据异常(CPF23)", # //114 + AlarmInfo.ALARM_FREQ_CAPACITY_SIGNAL : STR_FreqErrRef, #//变频器容量信号故障(CPF24)", # //115 + AlarmInfo.ALARM_FREQ_TERMINAL_NOT_CONNECT : STR_FreqErrRef, #//未连接端子电路板(CPF25)", # //116 + AlarmInfo.ALARM_FREQ_MONITOR_DEVICE : STR_FreqErrRef, #//监视装置故障(E5/CPF13)", # //117 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S1 : STR_FreqErrRef, #//外部故障(输入端子S1)(EF1)", # //118 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S2 : STR_FreqErrRef, #//外部故障(输入端子S2)(EF2)", # //119 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S3 : STR_FreqErrRef, #//外部故障(输入端子S3)(EF3)", # //120 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S4 : STR_FreqErrRef, #//外部故障(输入端子S4)(EF4)", # //121 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S5 : STR_FreqErrRef, #//外部故障(输入端子S5)(EF5)", # //122 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S6 : STR_FreqErrRef, #//外部故障(输入端子S6)(EF6)", # //123 + AlarmInfo.ALARM_FREQ_EEPROMW_WRITE_ERR : STR_FreqErrRef, #//EEPROM 写入不当(Err)", # //124 + AlarmInfo.ALARM_FREQ_PIDFB_OVERTOP : STR_FreqErrRef, #//PID 反馈超值(FbH)", # //125 + AlarmInfo.ALARM_FREQ_PID_FB_LOST : STR_FreqErrRef, #//PID 反馈丧失(FbH)", # //126 + AlarmInfo.ALARM_FREQ_GROUND_FALUT : STR_FreqErrRef, #//接地短路(GF)", # //127 + AlarmInfo.ALARM_FREQ_OUT_PHASE_LOST : STR_FreqErrRef, #//输出缺相(LF)", # //128 + AlarmInfo.ALARM_FREQ_OUT_IMBALANCE : STR_FreqErrRef, #//输出电流失衡(LF)", # //129 + AlarmInfo.ALARM_FREQ_NODE_SETUP_ERR : STR_FreqErrRef, #//Node Setup 故障(LF)", # //130 + AlarmInfo.ALARM_FREQ_OVER_CURRENT : STR_FreqErrRef, #//过电流(oC)", # //131 + AlarmInfo.ALARM_FREQ_FIN_OVER_HEAT : STR_FreqErrRef, #//散热片过热(oH/oH1)", # //132 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT1 : STR_FreqErrRef, #//电机过热警告(PTC 输入)(oH3)", # //133 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT2 : STR_FreqErrRef, #//电机过热故障(PTC 输入)(oH4)", # //134 + AlarmInfo.ALARM_FREQ_MOTOR_OVERLOAD : STR_FreqErrRef, #//电机过载(oL1)", # //135 + AlarmInfo.ALARM_FREQ_VFD_OVERLOAD : STR_FreqErrRef, #//变频器过载(oL2)", # //136 + AlarmInfo.ALARM_FREQ_OVER_TORQUE1 : STR_FreqErrRef, #//过转矩检出1(oL3)", # //137 + AlarmInfo.ALARM_FREQ_OVER_TORQUE2 : STR_FreqErrRef, #//过转矩检出2(oL4)", # //138 + AlarmInfo.ALARM_FREQ_MECHAN_AGING1 : STR_FreqErrRef, #//机械老化检出1(oL5)", # //139 + AlarmInfo.ALARM_FREQ_BREAK_OVERLOAD : STR_FreqErrRef, #//高滑差制动电机过载保护(oL7)", # //140 + AlarmInfo.ALARM_FREQ_OVER_VOLTAGE : STR_FreqErrRef, #//主回路过电压(ov)", # //141 + AlarmInfo.ALARM_FREQ_VOLTAGE_FAULT : STR_FreqErrRef, #//主回路电压故障(PF)", # //142 + AlarmInfo.ALARM_FREQ_BRAKE_TRANS : STR_FreqErrRef, #//内置制动晶体管故障(rr)", # //143 + AlarmInfo.ALARM_FREQ_OUT_SHORT : STR_FreqErrRef, #//输出短路或IGBT故障(SC)", # //144 + AlarmInfo.ALARM_FREQ_SPEED_SEARCH : STR_FreqErrRef, #//速度搜索重试故障(SC)", # //145 + AlarmInfo.ALARM_FREQ_DISORDER : STR_FreqErrRef, #//失调检出(STo)", # //146 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE1 : STR_FreqErrRef, #//转矩不足1(UL3)", # //147 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE2 : STR_FreqErrRef, #//转矩不足2(UL4)", # //148 + AlarmInfo.ALARM_FREQ_MECHAN_AGING2 : STR_FreqErrRef, #//机械老化检出2(UL5)", # //149 + AlarmInfo.ALARM_FREQ_MAJOR_UNDERVOLTAGE : STR_FreqErrRef, #//主回路欠电压(Uv/Uv1)", # //150 + AlarmInfo.ALARM_FREQ_CTRL_POW_FAULT : STR_FreqErrRef, #//控制电源故障(Uv2)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL1_ERR : STR_FreqErrRef, #//控制回路故障(CPF18)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL2_ERR : STR_FreqErrRef, #//控制回路故障(CPF19)", # //151 + AlarmInfo.ALARM_FREQ_HARD1_ERR : STR_FreqErrRef, #//硬件故障(CPF20)", # //151 + AlarmInfo.ALARM_FREQ_HARD2_ERR : STR_FreqErrRef, #//硬件故障(CPF21)", # //151 + AlarmInfo.ALARM_FREQ_ADC_ERR : STR_FreqErrRef, #//ADC故障(CPF22)", # //151 + AlarmInfo.ALARM_FREQ_PREVENT_SHOCK : STR_FreqErrRef, #//冲击防止回路故障(Uv3)", # //152 + AlarmInfo.ALARM_FREQ_BASE_BLOCK : STR_FreqErrRef, #//变频器基极封锁(bb)", # //160 + AlarmInfo.ALARM_FREQ_COMM_WAITING : STR_FreqErrRef, #//通信等待中(CALL)", # //161 + AlarmInfo.ALARM_FREQ_RST_WHEN_RUN : STR_FreqErrRef, #//运行指令输入中复位(CrST)", # //162 + AlarmInfo.ALARM_FREQ_COMM_CYCLE_ERR : STR_FreqErrRef, #//通信周期设定错误(CyC)", # //163 + AlarmInfo.ALARM_FREQ_DRIVE_DISABLE : STR_FreqErrRef, #//Drive Disable中(dnE)", # //164 + AlarmInfo.ALARM_FREQ_CW_CCW_CMD : STR_FreqErrRef, #//正反转指令同时输入(EF)", # //165 + AlarmInfo.ALARM_FREQ_CURRENT_WARNING : STR_FreqErrRef, #//电流警告(HCA)", # //166 + AlarmInfo.ALARM_FREQ_MAINTAIN_FAN : STR_FreqErrRef, #//冷却风扇维护时期(LT-1)", # //167 + AlarmInfo.ALARM_FREQ_MAINTAIN_CAP : STR_FreqErrRef, #//电容器维护时期(LT-2)", # //168 + AlarmInfo.ALARM_FREQ_MAINTAIN_RELAY : STR_FreqErrRef, #//冲击电流防止继电器维护时期(LT-3)", # //169 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_50 : STR_FreqErrRef, #//IGBT维护时期(50%)(LT-4)", # //170 + AlarmInfo.ALARM_FREQ_VFD_OH_ALERT : STR_FreqErrRef, #//变频器过热预警(oH2)", # //171 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT : STR_FreqErrRef, #//电机过热(oH3)", # //172 + AlarmInfo.ALARM_FREQ_RSV173 : STR_FreqErrRef, #//保留", # //173 + AlarmInfo.ALARM_FREQ_RSV174 : STR_FreqErrRef, #//保留", # //174 + + AlarmInfo.ALARM_FREQ_MOBUS_TEST_OK : "不必采取对策(并非警报)", # //175 + AlarmInfo.ALARM_FREQ_SWITCH_WHEN_RUN : STR_FreqErrRef, #//运行中输入电机切换指令(rUn)", # //176 + AlarmInfo.ALARM_FREQ_MOBUS_TEST_ERR : STR_FreqErrRef, #//MEMOBUS通信测试模式故障(SE)", # //177 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_90 : STR_FreqErrRef, #//IGBT维护时期(90%)(TrPC)", # //178 + AlarmInfo.ALARM_FREQ_RSV179 : STR_FreqErrRef, #//保留", # //179 + AlarmInfo.ALARM_FREQ_RSV180 : STR_FreqErrRef, #//保留", # //180 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//变频器容量的设定故障(oPE01)", # //181 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//参数设定范围不当(oPE02)", # //182 + AlarmInfo.ALARM_FREQ_DIN_SELECT_ERR : STR_FreqErrRef, #//多功能输入的选择不当(oPE03)", # //183 + AlarmInfo.ALARM_FREQ_AIN_SELECT_ERR : STR_FreqErrRef, #//多功能模拟量输入的选择不当(oPE07)", # //184 + AlarmInfo.ALARM_FREQ_PARA_SELECT_ERR : STR_FreqErrRef, #//参数选择不当(oPE08)", # //182 + AlarmInfo.ALARM_FREQ_PID_SELECT_ERR : STR_FreqErrRef, #//PID控制的选择不当(oPE09)", # //183 + AlarmInfo.ALARM_FREQ_VF_DATA_SET_ERR : STR_FreqErrRef, #//V/f数据的设定不当(oPE10)", # //184 + AlarmInfo.ALARM_FREQ_CARRIER_SET_ERR : STR_FreqErrRef, #//载波频率的设定不当(oPE11)", # //182 + + AlarmInfo.USER_GLOBAL_ALARM_0 : "1. PLC程序跳到非水箱程序@2. 调整水箱液位无水配置@3. 检测水箱是否真的无水@4. 水箱加水", + AlarmInfo.USER_GLOBAL_ALARM_1 : "1. 检查1#水箱的液位状态", + AlarmInfo.USER_GLOBAL_ALARM_2 : "1. 检查2#水箱的液位状态", + AlarmInfo.USER_GLOBAL_ALARM_3 : "1. 同时检查两个水箱的液位状态@2. 更换水箱液位传感器@3. 检查水箱进水阀", + AlarmInfo.USER_GLOBAL_ALARM_4 : "1. 检查或更换输入压力传感器 @2. 正确配置输入压力传感器", + AlarmInfo.USER_GLOBAL_ALARM_5 : "1. 检查水箱液位与进水压力 @2. 等待进水压力超过开阀压力", + AlarmInfo.USER_GLOBAL_ALARM_6 : "全局报警6", + AlarmInfo.USER_GLOBAL_ALARM_7 : "全局报警7", + AlarmInfo.USER_GLOBAL_ALARM_8 : "全局报警8", + AlarmInfo.USER_GLOBAL_ALARM_9 : "全局报警9", + AlarmInfo.USER_GLOBAL_ALARM_10 : "全局报警10", + AlarmInfo.USER_GLOBAL_ALARM_11 : "全局报警11", + AlarmInfo.USER_GLOBAL_ALARM_12 : "全局报警12", + AlarmInfo.USER_GLOBAL_ALARM_13 : "全局报警13", + AlarmInfo.USER_GLOBAL_ALARM_14 : "全局报警14", + AlarmInfo.USER_GLOBAL_ALARM_15 : "全局报警15", + + AlarmInfo.USER_GLOBAL_WARNING_0 : "检查1#水箱液位情况", + AlarmInfo.USER_GLOBAL_WARNING_1 : "检查2#水箱液位情况", + AlarmInfo.USER_GLOBAL_WARNING_2 : "全局警告2", + AlarmInfo.USER_GLOBAL_WARNING_3 : "全局警告3", + AlarmInfo.USER_GLOBAL_WARNING_4 : "全局警告4", + AlarmInfo.USER_GLOBAL_WARNING_5 : "全局警告5", + AlarmInfo.USER_GLOBAL_WARNING_6 : "全局警告6", + AlarmInfo.USER_GLOBAL_WARNING_7 : "全局警告7", + AlarmInfo.USER_GLOBAL_WARNING_8 : "全局警告8", + AlarmInfo.USER_GLOBAL_WARNING_9 : "全局警告9", + AlarmInfo.USER_GLOBAL_WARNING_10 : "全局警告10", + AlarmInfo.USER_GLOBAL_WARNING_11 : "全局警告11", + AlarmInfo.USER_GLOBAL_WARNING_12 : "全局警告12", + AlarmInfo.USER_GLOBAL_WARNING_13 : "全局警告13", + AlarmInfo.USER_GLOBAL_WARNING_14 : "全局警告14", + AlarmInfo.USER_GLOBAL_WARNING_15 : "全局警告15", + }}, + #模拟量输入固定为第0项 + {"alias_aiinput": {0: "保留", + 1:"输出压力", + 2:"输入压力", + 3:"液位信号", + 4:"调节阀反馈", + 5:"输出流量", + 6:"温度", + 7:"余氯信息", + 8:"浊度信息", + 9:"PH信息", + 10:"输入流量", + 11:"保留11", + 12:"保留12", + 13:"PAI0", + 14:"PAI1", + 15:"夹层温度", + 16:"站内温度", + 17:"开度反馈2", + 18:"液位2", + 19:"噪音", + 20:"湿度", + 21:"液位3", + }}, + + {"alias_user_alarm": {0:"关闭", 1:"打开"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_voltage": {0:"380V", 1:"660V", 2:"1140V"}}, + {"alias_converter": {0: "V1000", 1: "MD380", 2: "S3100A",3: "MD80", 4: "WIDM100"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_485stop": {0: "1", 1: "2"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_can_baud": {0: "1M", 1: "800K", 2: "500K", 3: "250K", 4:"125K", 5:"100K", 6:"50K", 7:"20K", 8:"10K"}}, + {"alias_NoNC": {0: "常开", 1: "常闭"}}, + {"alias_bluetooth": {0: "未连接", 1: "连接"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_alarm": {0: "无故障", 1: "定时限短路", 2 : "定时限过流1段", 3: "定时限过流2段"}}, + {"alias_test": {0: "测试", 1: "动作"}}, + {"alias_workmode2": {0: "手动", 1: "自动"}}, + {"alias_comm": {0: "保留", 1: "脚本", 2: "调试"}}, + {"alias_priority": {0: "相等优先级", 1: "主泵优先", 2: "辅泵优先"}}, + {"alias_pidmode": {0: "自定义", 1: "轻载", 2: "中载", 3: "重载"}}, + {"alias_pid": {0: "NULL", 1: "P", 2: "I", 3: "PI", 4: "D", 5: "PD", 6: "ID", 7: "PID"}}, + {"alias_language": {0: "中文", 1: "英文"}}, + {"alias_PX": {0: "正常", 1: "关闭"}}, + {"alias_devicestatus": {0: "本地停止", 1: "本地自动", 2: "远程控制", 3: "远程急停"}}, + {"alias_alarmstatus": {0: "正常", 1: "报警"}}, + {"alias_Energymeter": {0: "0-停用", 1: "1-安科瑞电表", 2: "2-斯菲尔电表"}}, + {"alias_plc": {0:"0-调试程序", + 1:"1-调峰程序", + 2:"2-GPRS+流量计", + 3:"3-双水箱", + 4:"4-箱式无负压", + 5:"5-爆管阀门控制", + 6:"6-单水箱", + 7:"7-翰林国际小区", + 8:"8-兼容全功能", + 9:"9-楼顶水箱", + 10: "10-保留", + 11: "11-保留"}}, + {"alias_plc_pin": {0:"0-保留脚位", + 1:"1-初始脚位", + 2:"2-GPRS+流量计", + 3:"3-双水箱脚位", + 4:"4-箱式无负压脚位", + 5:"5-爆管阀门脚位", + 6:"6-单水箱脚位", + 7:"7-翰林国际小区脚位", + 8:"8-兼容全功能脚位", + 9:"9-楼顶水箱脚位", + 10: "10-保留脚位", + 11: "11-保留脚位"}}, + + {"alias_aioutput": {0:"保留", + 1:"市政水箱切换阀", + 2:"1#水箱补水阀", + 3:"2#水箱补水阀", + 4:"1#水箱出水阀", + 5:"3#水箱补水阀", + }}, + + {"alias_input": {0:"未使用", + 1:"电接点压力低", + 2:"电接点压力高", + 3:"市政无水信号", + 4:"1#浮球无水", + 7:"漏水信号", + 8:"烟感信号", + 9:"外部故障", + 10:"2#浮球无水", + 11:"门禁信号", + 12:"无水信号常闭", + 24:"1#浮球高位", #M163.0 + 25:"1#开阀到位", #M163.1 + 26:"1#关阀到位", #M163.2 + 27:"1#阀门故障信号", #M163.3 + 28:"1#浮球低位", #M163.4 + + 32:"2#浮球高位", #M164.0 + 33:"2#开阀到位", #m164.1 + 34:"2#关阀到位", #M164.2 + 35:"2#阀门故障信号", #M164.3 + 36:"2#浮球低位", #M164.4 + + 38:"爆管开阀到位", + 39:"爆管关阀到位", + 43:"进压开阀到位", + 44:"进压关阀到位", + 47:"切换开阀到位", + 48:"切换关阀到位", + 49:"3#浮球高位", + 50:"3#开阀到位", + 51:"3#关阀到位", + 52:"3#阀门故障信号", + 53:"3#楼顶浮球低", + 54:"1#楼顶浮球低", + 55:"2#楼顶浮球低"}}, + + {"alias_output": {0:"未使用", + 17: "Y0.0", + 18: "Y0.1", + 20: "Y0.3", + 29 : "1#水箱开阀", + 30:"1#水箱关阀", + 31: "2#水箱开阀", + 32: "2#水箱关阀", + 33: "爆管开阀", + 34:"爆管关阀", + 35:"进压开阀", + 36:"进压关阀", + 37: "风机开关", + 38: "加热开关", + 39:"空调开关", + 40:"切换装置开阀", + 41: "切换装置关阀", + 42: "照明开关", + 43: "开门输出", + 44:"关门输出", + 45:"紫外消毒输出", + 46: "3#水箱开阀", + 47: "3#水箱关阀"}}, + {"alias_temp_wet": {0:"0-停用", + 1:"1-RS_WS_N01"}}, + {"alias_noise": {0:"0-停用", + 1:"1-RS-ZS-N01"}}, + + {"alias_flowmeter": {0:"0-停用", + 1:"1-迪纳声流量计", + 2:"2-熊猫PWM流量计", + 3:"3-科龙IFC300流量计", + 4:"4-星空XKD99Z流量计", + 5:"5-熊猫PMF流量计", + 6:"6-户表流量计"}}, + + {"alias_waterquality": {0:"0-停用", 1:"1-天健TMS3000"}}, + {"alias_tempmiddle": {0:"0-停用", 1:"1-壁挂王字壳"}}, + {"alias_valve_output" : {0: "未动作", 1: "开阀输出", 2: "关阀输出"}}, + {"alias_valve_status" : {0: "未到位", 1: "已到位"}}, + {"alias_run_function" : {0: "关闭", 1: "自动", 2: "手动"}}, + {"alias_PumpName" : {0: "1号泵", 1: "2号泵", 2: "3号泵", 3: "4号泵", 4: "5号泵", 5: "6号泵", 6: "7号泵", 7: "8号泵"}}, + {"alias_anaolog_mode": {0:"4-20mA", 1:"0-10V"}}, + {"alias_pressure_in_select": {0: "市政输入", 1: "水箱输入"}} +] + + +def func_comm_switch_on(object_device : class_comm_device, topic_item, topic, message) : + object_list = object_device.parent + value = 1 + result = object_list.comm_single_bit_write(object_device.comm_addr, 618, 1, value) + return result + +def func_comm_switch_off(object_device, topic_item, topic, message) : + object_list = object_device.parent + value = 1 + result = object_list.comm_single_bit_write(object_device.comm_addr, 619, 1, value) + return result + +def func_comm_switch_rst(object_device, topic_item, topic, message) : + object_list = object_device.parent + value = 1 + result = object_list.comm_single_bit_write(object_device.comm_addr, 620, 1, value) + return result + +def func_comm_test_leak(object_device, topic_item, topic, message) : + return None + +#mqtt 执行的开关命令, 可通过远程发送该命令 +mqtt_topic_subscribe = [ + {"name": "通讯分闸", "execute": func_comm_switch_on}, + {"name": "通讯合闸", "execute": func_comm_switch_off}, + {"name": "故障复位", "execute": func_comm_switch_rst}, + {"name": "漏电试验", "execute": func_comm_test_leak}, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmType", + "addr": "8138", + "alias": "alias_test" + }, +] + +dynamic_page_main = [ + { + "name": "进水压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40023", + "format": "%05.2f", + }, + { + "name": "水箱液位", + "unit": "m", + "scale" : 0.01, + "addr": "40029", + "format": "%05.2f", + }, + { + "name": "实际压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40025", + "format": "%05.2f", + }, + { + "name": "设定压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40416", + "format": "%05.2f", + }, + { + "name": "工作电流", + "unit": "A", + "scale" : 0.1, + "addr": "40049", + "format": "%04.1f", + }, + { + "name": "瞬时功率", + "unit": "kW", + "scale" : 0.1, + "addr": "40007", + "format": "%04.1f", + }, +] + +modbus_comm_table = [ + {"name":"status", "reg_addr":8162, "reg_count":4, "cycle": 100}, + {"name":"alarm", "reg_addr":8120, "reg_count":10, "cycle": 0, "mqtt_pack": "mqtt_pack_alarm"}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": "dynamic_page_main"}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 0}, + {"name":"para_group", "reg_addr":2000, "reg_count":10, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 500}, + {"name":"protect_group", "reg_addr":8174, "reg_count":26, "cycle": 0}, + {"name":"ip_addr_group", "reg_addr":8410, "reg_count":6, "cycle": 0}, + {"name":"inter_group", "reg_addr":8240, "reg_count":10, "cycle": 0}, +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + return False + + + +menu_normal_set = [ + { + "name": "给定压力", + "unit": "Mpa", + "addr": "40415", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "上限压差", #"压力上限", + "unit": "Mpa", + "addr": "40417", #"2419", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "下限压差", #"压力下限", + "unit": "Mpa", + "addr": "40418", #"2418", + "scale" : 0.001, + "format": "%05.3f", + }, + # { + # "name": "唤醒压差", + # "addr": "40318", + # "scale": 0.001, + # "unit": "Mpa", + # "format": "%05.3f", + # }, + { + "name": "休眠功率*", + "addr": "44203", + "scale": 0.01, + "unit": "kW", + "format": "%05.2f", + "action": "SelfPumpOffset8", + }, + { + "name": "超压报警", + "unit": "Mpa", + "addr": "40289", + "scale" : 0.001, + "format": "%05.3f", + }, + # { + # "name": "定时切换", + # "unit": "Min", + # "addr": "40282", + # "scale" : 1.0, + # "format": "%04.0f", + # }, + { + "name": "泵号", + "addr": "40194", + "scale" : 1.0, + "format": "%1.0f", + }, + { + "name": "水泵台数", + "addr": "40283", + "scale" : 1.0, + "format": "%1.0f", + "min" : 1, + "max" : 6, + }, + { + "name": "最大台数", #爆管台数 + "addr": "40285", + "scale" : 1.0, + "format": "%1.0f", + "min" : 1, + "max" : 6, + }, + { + "name": "辅泵编号", + "addr": "40284", + "scale" : 1.0, + "format": "%1.0f", + }, + { + "name": "进水压力", + "alias" : "alias_bool", + "addr": "40226", + }, + { + "name": "水箱液位传感器", + "alias" : "alias_bool", + "addr": "40258", + }, + { + "name": "参数同步", + "action": "sync_3", + }, +] + +menu_func_set = [ + { + "name": "水箱1配置", + "sub_menu": "menu_tank1", + }, + { + "name": "水箱2配置", + "sub_menu": "menu_tank2", + }, + { + "name": "泵组进压阀", + "sub_menu": "menu_pump_inletvalve", + }, + { + "name": "水箱市政切换设置", + "sub_menu": "menu_tank_switch", + }, + { + "name": "分时压力", + "sub_menu": "menu_time_pressure", + }, + { + "name": "程序功能", + "alias": "alias_plc", + "addr": "43983", + "action": "reboot_global", + }, + { + "name": "GPRS泵号", + "format": "%1.0f", + "addr": "54201", #"48402", + }, + # { + # "name": "通讯设置", + # "sub_menu": "menu_comm_set", + # }, + { + "name": "流量计型号", + "alias": "alias_flowmeter", + "addr": "54200", #"48400", + }, + { + "name": "流量计泵号", + "format": "%1.0f", + "addr": "54205", #"48410", + }, + # { + # "name": "调峰功能", + # "alias": "alias_bool", + # "addr": "40000", + # }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_run_set = [ + { + "name": "加泵频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40278", + }, + { + "name": "减泵频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40279", + }, + { + "name": "加泵功率", + "addr": "40276", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + + { + "name": "减泵功率", + "addr": "40277", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + { + "name": "加泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "40280", + }, + { + "name": "减泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40273", + }, + { + "name": "休眠频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40316", + }, + { + "name": "休眠延时", + "scale" : 0.1, + "unit" : "S", + "format": "%06.1f", + "addr": "40317", + }, + { + "name": "休眠功率*", + "addr": "44203", + "scale": 0.01, + "unit": "kW", + "format": "%05.2f", + "action": "SelfPumpOffset8", + }, + { + "name": "功率均衡", + "alias": "alias_bool", + "addr": "40391", + }, + { + "name": "均衡死区", + "addr": "40388", + "unit": "%", + "scale": 0.1, + "format": "%05.1f", + }, + { + "name": "定时换泵", + "alias": "alias_bool", + "addr": "40281.0", + }, + { + "name": "换泵周期", + "addr": "40282", + "unit": "Min", + "format": "%05.0f", + }, + +] + +menu_protect_set = [ + # { + # "name": "超压保护", + # "alias": "alias_bool", + # "addr": "40289.2", + # }, + { + "name": "超压报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40289", + }, + { + "name": "负压保护", + "alias": "alias_bool", + "addr": "40288.5", + }, + { + "name": "负压报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40290", + }, + { + "name": "真空报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40291", + }, + { + "name": "负压解除", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40292", + }, + { + "name": "真空解除", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40305", + }, + { + "name": "无水液位", + "scale" : 0.01, + "unit" : "m", + "format": "%04.2f", + "addr": "40293", + }, + { + "name": "无水解除", + "scale" : 0.01, + "unit" : "m", + "format": "%04.2f", + "addr": "40294", + }, + { + "name": "防冻时间", + "addr": "40403", + "unit": "S", + "format": "%04.0f", + }, + { + "name": "防冻周期", + "addr": "40404", + "unit": "Min", + "format": "%04.0f", + }, +] + +menu_data_pump = [ + { + "name": "水泵台数", + "addr": "40283", + "scale" : 1.0, + "format": "%1.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "辅泵编号", + "addr": "40284", + "scale" : 1.0, + "format": "%1.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "总电量", + "scale" : 1.0, + "unit" : "kwh", + "format": "%1.0f", + "addr": "53932#2", #"47864#2", "40010#2", GD7864 + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispInverseCtrl_59102.12", #10205.4 M205.4 电表通讯成功 + }, + { + "name": "总功率", + "scale" : 0.1, + "unit" : "kW", + "format": "%1.1f", + "addr": "50585", #"40012", GW1170 + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispInverseCtrl_59102.12", #10205.4 M205.4 电表通讯成功 + }, + { + "name": "电表电量", + "scale" : 1.0, + "unit" : "kwh", + "format": "%1.0f", + "addr": "53932#2", #"47864#2", "40010#2", GD7864 + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_59102.12", #10205.4 M205.4 电表通讯成功 + }, + { + "name": "电表功率", + "scale" : 0.1, + "unit" : "kW", + "format": "%1.1f", + "addr": "50585", #"40012", GW1170 + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_59102.12", #10205.4 M205.4 电表通讯成功 + }, + { + "name": "入水压力", + "scale" : 0.001, + "unit" : "Mpa", + "format": "%1.3f", + "addr": "40023", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A2", + }, + { + "name": "出水压力", + "scale" : 0.001, + "unit" : "Mpa", + "format": "%1.3f", + "addr": "40025", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A1", + }, + { + "name": "1#液位", + "unit": "m", + "scale" : 0.01, + "addr": "56329", #"39955", + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A3", + }, + { + "name": "2#液位", + "unit": "m", + "scale" : 0.01, + "addr": "56291", #"39970", + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A18", + }, + { + "name": "3#液位", + "unit": "m", + "scale" : 0.01, + "addr": "56283", #"39973", + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A21", + }, + { + "name": "输出流量", + "unit": "m³/h", + "scale" : 0.01, + "addr": "56060#2", #FD120 + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A5", + }, + { + "name": "输出累计", + "unit": "m³", + "scale" : 0.001, + "addr": "56072#2", #FD144 + "format": "%1.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A5", + }, + { + "name": "输入流量", + "unit": "m³/h", + "scale" : 0.01, + "addr": "56070#2", #FD140 + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A10", + }, + { + "name": "输入累计", + "unit": "m³", + "scale" : 0.001, + "addr": "56074#2", #FD148 + "format": "%1.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A10", + }, + { + "name": "阀门开度", + "unit": "%", + "scale" : 0.1, + "addr": "56299", + "format": "%1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A4", + }, + + { + "name": "开度2", + "unit": "%", + "scale" : 0.1, + "addr": "56289", + "format": "%1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A17", + }, + { + "name": "余氯值", + "unit": "mg/L", + "scale" : 0.01, + "addr": "56317", + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A7", + }, + { + "name": "浊度值", + "unit": "NTU", + "scale" : 0.01, + "addr": "56319", + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A8", + }, + { + "name": "PH值", + "unit": "", + "scale" : 0.01, + "addr": "56321", + "format": "%1.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A9", + }, + { + "name": "水温", + "unit": "℃", + "scale" : 0.1, + "addr": "56469", + "format": "%+1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A6", + }, + { + "name": "噪音分贝", + "unit": "DB", + "scale" : 0.1, + "addr": "56295", + "format": "%1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A19", + }, + { + "name": "站内湿度", + "unit": "%", + "scale" : 0.1, + "addr": "56293", + "format": "%1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A20", + }, + { + "name": "站内温度", + "unit": "℃", + "scale" : 0.1, + "addr": "56287", + "format": "%+1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A16", + }, + { + "name": "夹层温度", + "unit": "℃", + "scale" : 0.1, + "addr": "56285", + "format": "%+1.1f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A15", + }, +] + +menu_data_Native1 = [ + { + "name": "当前泵号*", + "addr": "40194", + "scale" : 1.0, + "format": "%1.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "本次运行*", + "unit" : "Min", + "format": "%05.0f", + "addr": "40042#2", #"56342#2", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset16", + }, + { + "name": "累计运行*", + "scale" : 0.016667, + "unit" : "h", + "format": "%6.0f", + "addr": "40044#2", #"56344#2", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset16", + }, + { + "name": "当前频率*", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40041", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset16", + }, + { + "name": "当前转速*", + "scale" : 1, + "unit" : "rpm", + "format": "%06.0f", + "addr": "56233", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "母线电压*", + "scale" : 0.1, + "unit" : "V", + "format": "%05.1f", + "addr": "40050", #"46350", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "变频温度*", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "40048", #"56348", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset16", + }, + { + "name": "电机温度*", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "56346", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "当前功率*", + "scale" : 0.01, + "unit" : "kW", + "format": "%05.2f", + "addr": "40051", #"45351", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定功率*", + "scale" : 0.01, + "unit" : "kW", + "format": "%05.2f", + "addr": "44017", + "action": "SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "输出电流*", + "scale" : 0.1, + "unit" : "A", + "format": "%05.1f", + "addr": "40049", #"56349", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定电流*", + "scale" : 0.1, + "unit" : "A", + "format": "%05.2f", + "addr": "44018", #"56834", + "action": "SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, +] +menu_data_Native2 = [ + { + "name": "泵电量*", + "scale" : 1.0, + "unit" : "kwh", + "format": "%07.0f", + "addr": "40008#2", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "泵功率*", + "scale" : 0.01, + "unit" : "kw", + "format": "%05.2f", + "addr": "40007", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "加速时间*", + "unit": "S", + "addr": "44013", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "减速时间*", + "unit": "S", + "addr": "44014", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "频率上限*", + "unit": "Hz", + "addr": "44015", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "频率下限*", + "unit": "Hz", + "addr": "44016", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "蓝牙状态", + "alias": "alias_bluetooth", + "addr": "40270", + "property": MENU_PROPERTY_READ_ONLY, + }, + + { + "name": "通讯地址*", + "addr": "43000", + "scale": 1.0, + "format": "%03.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "通讯1*", + "alias": "alias_comm", + "addr": "43005", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "通讯2*", + "alias": "alias_comm", + "addr": "43006", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水泵流量*", + "addr": "48033", + "scale": 0.1, + "unit": "m³/h", + "format": "%04.1f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水泵扬程*", + "addr": "48032", + "unit": "m", + "format": "%04.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_data_user = [ + { + "name": "漏水PX0", + "alias": "alias_PX", + "addr": "47612", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "烟感PX1", + "alias": "alias_PX", + "addr": "47614", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "故障PX2", + "alias": "alias_PX", + "addr": "47616", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "门禁PX4", + "alias": "alias_PX", + "addr": "47618", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱长度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54000", #"48000", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱宽度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54001", #"48002", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱高度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54002", #"48004", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱容积", + "scale" : 0.01, + "unit" : "m³", + "format": "%05.2f", + "addr": "46004", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱面积", + "scale" : 0.01, + "unit" : "㎡", + "format": "%05.2f", + "addr": "46022", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱功能", + "addr": "54061", #"48122", + "alias": "alias_run_function", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "阀门动作", #默认120.0s + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54062", #"48124", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "储水总量", + "scale" : 0.01, + "unit" : "m³", + "format": "%05.2f", + "addr": "46008", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +cur_curve = [ + { + "name": "退出", + "action": "exit", + }, +] + +menu_quick_tag = [ + { + "name": "泵组工作时间统计", + "sub_menu" : "menu_statistic", + }, + { + "name": "故障查询", + "sub_menu" : "menu_alarm_history", + }, + { + "name": "压力曲线", + "sub_menu" : "cur_curve", + }, + { + "name": "通信设置", + "sub_menu" : "menu_comm_set", + }, + { + "name": "信号配置", + "sub_menu" : "memu_sensor_engineer", + }, + { + "name": "用户参数", + "sub_menu" : "menu_parameter", + }, + { + "name": "联机设置", + "sub_menu" : "menu_link", + }, + { + "name": "工程师菜单", + "sub_menu" : "menu_full_set", + }, + { + "name": "重启", + "action": "reboot", + }, +] + +menu_time_pressure = [ + { + "name": "分时段压力使能", + "addr": "40281.3", + "alias": "alias_bool", + }, + { + "name": "分时段1", + "addr": "40320#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力1", + "addr": "40320", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段2", + "addr": "40328#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力2", + "addr": "40328", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段3", + "addr": "40336#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力3", + "addr": "40336", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段4", + "addr": "40344#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力4", + "addr": "40344", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段5", + "addr": "40352#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力5", + "addr": "40352", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段6", + "addr": "40360#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力6", + "addr": "40360", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段7", + "addr": "40368#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力7", + "addr": "40368", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段8", + "addr": "40376#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力8", + "addr": "40376", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, +] + +menu_hand_adjust = [ + { + "name": "只写页", + }, +] + +disp_hand_adjust = [ #手动控制页面 + { + "name": "OutPressure", + "format": "%4.0f", + "addr": "40025", + }, + { + "name": "FreqSet", #手动设定频率 + "format": "%5.0f", + "addr": "44010", + "action": "SelfPumpOffset24", + }, + { + "name": "FreqCur", #变频器当前频率频率 + "format": "%5.0f", + "addr": "40041", + "action": "SelfPumpOffset16", + }, +] + +menu_link = [ + { + "name": "1#模式", + "alias": "alias_workmode2", + "addr": "44009.1#2", + "action" : "work_mode" + }, + { + "name": "2#模式", + "alias": "alias_workmode2", + "addr": "44033.1#2", + "action" : "work_mode" + }, + { + "name": "3#模式", + "alias": "alias_workmode2", + "addr": "44057.1#2", + "action" : "work_mode" + }, + { + "name": "4#模式", + "alias": "alias_workmode2", + "addr": "44081.1#2", + "action" : "work_mode" + }, + { + "name": "5#模式", + "alias": "alias_workmode2", + "addr": "44105.1#2", + "action" : "work_mode" + }, + { + "name": "6#模式", + "alias": "alias_workmode2", + "addr": "44129.1#2", + "action" : "work_mode" + }, +] + + +menu_alarm_history = [ + { + "name": "泵组故障查询", + "action": "alarm_pump_-1", + }, + { + "name": "泵1故障查询", + "action": "alarm_pump_0", + }, + { + "name": "泵2故障查询", + "action": "alarm_pump_1", + }, + { + "name": "泵3故障查询", + "action": "alarm_pump_2", + }, + { + "name": "泵4故障查询", + "action": "alarm_pump_3", + }, + { + "name": "泵5故障查询", + "action": "alarm_pump_4", + }, + { + "name": "泵6故障查询", + "action": "alarm_pump_5", + }, + { + "name": "清除故障", + "sub_menu": "menu_alarm_clear", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_alarm = [ + { + "name": "清除本次故障", + "action": "alarm_clear", + }, + { + "name": "历史故障查询", + "sub_menu": "menu_alarm_history", + }, +] + +menu_curve_history = [ + { + "name": "只读页", + }, +] + +menu_comm_set = [ + { + "name": "485地址*", + "addr": "43000", + "scale": 1.0, + "format": "%03.0f", + }, + { + "name": "485波特率1*", + "alias": "alias_baud", + "addr": "43001", + }, + { + "name": "485校验1*", + "alias": "alias_parity", + "addr": "43002", + }, + { + "name": "485波特率2*", + "alias": "alias_baud", + "addr": "43003", + }, + { + "name": "485校验2*", + "alias": "alias_parity", + "addr": "43004", + }, + { + "name": "485设备1*", + "alias": "alias_comm", + "addr": "43005", + }, + { + "name": "485设备2*", + "alias": "alias_comm", + "addr": "43006", + }, + { + "name": "IP地址*", + "addr": "43009#2", + "action" : "ip", + }, + { + "name": "子网掩码*", + "action": "ip", + "addr": "43011#2", + }, + { + "name": "IP网关*", + "action": "ip", + "addr": "43013#2", + }, + { + "name": "蓝牙*", + "addr": "48028", + "alias" : "alias_bool", + }, + { + "name": "蓝牙地址*", + "action": "bluetooth_addr", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_parameter = [ + { + "name": "GPRS泵号", + "addr": "54201", #"48402", + "scale": 1.0, + "format": "%01.0f", + }, + { + "name": "PLC通讯主机泵号", + "format": "%1.0f", + "addr": "54205", #48410 + }, + { + "name": "PLC电度表选择", + "alias": "alias_Energymeter", + "addr": "54206", #48412 + }, + { + "name": "PLC输出流量计", + "alias": "alias_flowmeter", + "addr": "54200", #48400 + }, + { + "name": "PLC输入流量计", + "alias": "alias_flowmeter", + "addr": "54202", #48404 + }, + { + "name": "PLC水质分析仪", + "format": "%1.0f", + "addr": "54208", #48416 + "alias": "alias_waterquality", + }, + { + "name": "PLC温湿度选型", + "alias": "alias_temp_wet", + "addr": "54209", #48418 + }, + { + "name": "PLC夹层温度", + "alias": "alias_tempmiddle", + "addr": "54211", #48422 + }, + { + "name": "PLC噪声变送器", + "alias": "alias_noise", + "addr": "54212", #48424 + }, + { + "name": "脚位配置", + "alias": "alias_plc_pin", + "addr": "54130", #48260 + "action": "reboot_global", + }, + + # { + # "name": "脚本输出流量计*", + # "alias": "alias_flowmeter", + # "addr": "54151", #"48302", + # "action" : "SelfPumpOffset8", + # "action": "reboot_global", + # }, + # { + # "name": "脚本输入流量计*", + # "alias": "alias_flowmeter", + # "addr": "54152",#48304 + # "action" : "SelfPumpOffset8", + # "action": "reboot_global", + # }, + # { + # "name": "脚本电表选择*", + # "alias": "alias_Energymeter", + # "addr": "54156", #48312 + # "action" : "SelfPumpOffset8", + # "action": "reboot_global", + # }, + + # { + # "name": "脚本温湿度选型*", + # "alias": "alias_temp_wet", + # "addr": "54150", #48300 + # "action" : "SelfPumpOffset8", + # }, + # { + # "name": "脚本噪声变送器*", + # "alias": "alias_noise", + # "addr": "54153", #48306 + # "action" : "SelfPumpOffset8", + # }, + # { + # "name": "脚本水质分析仪*", + # "alias": "alias_waterquality", + # "addr": "54154", #48308 + # "action" : "SelfPumpOffset8", + # }, + # { + # "name": "脚本夹层温度*", + # "alias": "alias_tempmiddle", + # "addr": "54155", #48310 + # "action" : "SelfPumpOffset8", + # }, + { + "name": "退出", + "action": "exit", + }, +] +menu_temp_control = [ + { + "name": "空调功能", + "addr": "54088", #"48176", + "alias": "alias_run_function", + }, + { + "name": "空调上限温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54085", #"48170", + }, + { + "name": "空调下限温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54086", #"48172", + }, + { + "name": "空调开启时长", + "scale" : 1.0, + "unit" : "Min", + "format": "%06.0f", + "addr": "54087", #"48174", + }, + { + "name": "手动空调开启*", + "action" : "KeyEnterTrigger_DispCtrl_54088.1",#48176.1 + "addr": "59060.12", #"10121.4", + }, + { + "name": "手动空调关闭*", + "action" : "KeyEnterTrigger_DispCtrl_54088.1", + "addr": "59060.13", #"10121.5", + }, + { + "name": "加热器功能", + "addr": "54082", #"48164", + "alias": "alias_run_function", + }, + { + "name": "加热开启温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54080", #"48160", + }, + { + "name": "加热关闭温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54081", #"48162", + }, + { + "name": "手动加热开启*", + "action" : "KeyEnterTrigger_DispCtrl_54082.1",#48164.1 + "addr": "59060.10", #"10121.2", + }, + { + "name": "手动加热关闭*", + "action" : "KeyEnterTrigger_DispCtrl_54082.1", + "addr": "59060.11", #"10121.3", + }, +] +menu_tank1 = [ + { + "name": "液位1传感器", + "alias": "alias_bool", + "addr": "40258", #400 = FW600 + 516 = FW1116 + }, + { + "name": "1#液位", + "unit": "m", + "scale" : 0.01, + "addr": "56329", #"39955", + "format": "%05.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A3", + }, + { + "name": "1#水箱功能", + "addr": "54061", #"48122", + "alias": "alias_run_function", + }, + { + "name": "1#手动开阀", + "addr": "59060.0", #"10120.0", + "action" : "KeyEnterTrigger_DispCtrl_54061.1",#48122.1 + }, + { + "name": "1#手动关阀", + "addr": "59060.1", #"10120.1", + "action" : "KeyEnterTrigger_DispCtrl_54061.1", + }, + { + "name": "1#开阀输出", + "addr": "59086.13", #"10173.5", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "1#关阀输出", + "addr": "59086.14", #"10173.6", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "1#开阀到位", + "addr": "59122.3", #"10244.3", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "1#关阀到位", + "addr": "59122.4", #"10244.4", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "1#阀门动作时长", #默认120.0s + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54062", #"48124", + }, + { + "name": "1#开阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56595", #"1190", + }, + { + "name": "1#关阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56596", #"1192", + }, + { + "name": "无水液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56593", #"1186", + }, + { + "name": "无水解除", + "scale" : 0.01, + "unit" : "m", + "format": "%04.2f", + "addr": "40294", + }, + { + "name": "水箱长度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54000", #"48000", + }, + { + "name": "水箱宽度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54001", #"48002", + }, + { + "name": "水箱高度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54002", #"48004", + }, +] +menu_tank2 = [ + { + "name": "液位2传感器", + "alias" : "alias_bool", + "addr": "43942", + }, + { + "name": "2#液位", + "unit": "m", + "scale" : 0.01, + "addr": "56291", #"39970", + "format": "%05.2f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "Visible_A18", + }, + { + "name": "2#水箱功能", + "addr": "54056", #"48112", + "alias": "alias_run_function", + }, + { + "name": "2#手动开阀", + "addr": "59060.2", #"10120.2", + "action" : "KeyEnterTrigger_DispCtrl_54056.1",#48112.1 + }, + { + "name": "2#手动关阀", + "addr": "59060.3", #"10120.3", + "action" : "KeyEnterTrigger_DispCtrl_54056.1", + }, + + { + "name": "2#开阀输出", + "addr": "59086.15", #"10173.7", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "2#关阀输出", + "addr": "59087.0", #"10174.0", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + + { + "name": "2#开阀到位", + "addr": "59082.1", #"10164.1", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "2#关阀到位", + "addr": "59082.2", #"10164.2", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + }, + { + "name": "2#阀门动作时长", #默认120s + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54057", #"48114", + }, + { + "name": "2#开阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54054", #"48108", + }, + { + "name": "2#关阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54055", #"48110", + }, +] +menu_tank3 = [ + { + "name": "3#水箱功能", + "addr": "54073", #"48146", + "alias": "alias_run_function", + }, + { + "name": "3#手动开阀", + "addr": "59059.8", #"10119.0", + "action" : "KeyEnterTrigger_DispCtrl_54073.1",#48146.1 + }, + { + "name": "3#手动关阀", + "addr": "59059.9", #"10119.1", + "action" : "KeyEnterTrigger_DispCtrl_54073.1", + }, + { + "name": "3#阀门动作时长", #默认120s + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54084", #"48168", + }, + { + "name": "3#开阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54074", #"48148", + }, + { + "name": "3#关阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54083", #"48166", + }, +] +menu_tank_switch = [ + { + "name": "水箱市政切换", + "addr": "54100", #"48200", + "alias": "alias_run_function", + }, + { + "name": "切换手动开阀", + "addr": "59061.2", #"10122.2", + "action" : "KeyEnterTrigger_DispCtrl_54100.1",#48200.1 + }, + { + "name": "切换手动关阀", + "addr": "59061.3", #"10122.3", + "action" : "KeyEnterTrigger_DispCtrl_54100.1", + }, + { + "name": "切换开阀输出", + "addr": "59087.8", #"10175.0", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54100", + }, + { + "name": "切换关阀输出", + "addr": "59087.9", #"10175.1", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54100", + }, + { + "name": "切换开阀到位", + "addr": "59082.15", #"10165.7", + "alias": "alias_valve_status", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54100", + }, + { + "name": "切换关阀到位", + "addr": "59083.0", #"10166.0", + "alias": "alias_valve_status", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54100", + }, + { + "name": "阀门动作延时", + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54117", #"48234", + }, + { + "name": "时段一始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54108", #"48216", + }, + { + "name": "时段一终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54109", #"48218", + }, + { + "name": "时段二始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54110", #"48220", + }, + { + "name": "时段二终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54111", #"48222", + }, + { + "name": "时段三始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54112", #"48224", + }, + { + "name": "时段三终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54113", #"48226", + }, + { + "name": "时段四始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54114", #48228", + }, + { + "name": "时段四终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54115", #"48230", + }, +] +menu_pump_inletvalve = [ + { + "name": "进压阀门功能", + "addr": "54069", #"48138", + "alias": "alias_run_function", + }, + { + "name": "进水压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40023", + "format": "%05.2f", + }, + { + "name": "手动进压开阀", + "addr": "59060.6", #"10120.6", + "action" : "KeyEnterTrigger_DispCtrl_54069.1", #48138.1 + }, + { + "name": "手动进压关阀", + "addr": "59060.7", #"10120.7", + "action" : "KeyEnterTrigger_DispCtrl_54069.1", #48138.1 + }, + { + "name": "进压开阀输出", + "addr": "59087.3", #"10174.3", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54069", + }, + { + "name": "进压关阀输出", + "addr": "59087.4", #"10174.4", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54069", + }, + { + "name": "开阀到位状态", + "alias": "alias_valve_status", + "addr": "59082.11", #"10165.3", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54069", #48138 + }, + { + "name": "关阀到位状态", + "alias": "alias_valve_status", + "addr": "59082.12", #"10165.4", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54069", #48138 + }, + { + "name": "进水有效延时", + "scale" : 0.001, + "unit" : "S", + "format": "%06.3f", + "min" : 1.0, + "max" : 65.535, + "addr": "54068", #"48136", + }, + { + "name": "开阀压力值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "54066", #"48132", + }, + { + "name": "关阀压力值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "54065", #"48130", + }, + { + "name": "阀门动作时长", + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54067", #"48134", + }, +] + +menu_explosion_valve = [ + { + "name": "爆管阀门功能", + "addr": "54072", #"48144", + "alias": "alias_run_function", + }, + { + "name": "手动爆管开阀", + "addr": "59060.4", #"10120.4", + "action" : "KeyEnterTrigger_DispCtrl_54072.1", #48144.1 + }, + { + "name": "手动爆管关阀", + "addr": "59060.5", #"10120.5", + "action" : "KeyEnterTrigger_DispCtrl_54072.1", #48144.1 + }, + { + "name": "漏水信号", + "addr": "59080.7", #"10160.7", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54072", #48144 + }, + { + "name": "爆管开阀输出", + "addr": "59087.1", #"10174.1", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54072", #48144 + }, + { + "name": "爆管关阀输出", + "addr": "59087.2", #"10174.2", + "alias" : "alias_bool", + "property" : MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54072", #48144 + }, + { + "name": "爆管开阀到位", + "alias": "alias_valve_status", + "addr": "59082.6", #"10164.6", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54072", #48144 + }, + { + "name": "爆管关阀到位", + "alias": "alias_valve_status", + "addr": "59082.7", #"10164.7", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54072", #48144 + }, + { + "name": "阀门工作时长", + "scale" : 0.1, + "unit" : "S", + "format": "%05.1f", + "addr": "54071", #"48142", + }, + { + "name": "爆管信号延时", + "unit" : "ms", + "format": "%05.0f", + "addr": "54070", #"48140", + }, +] + +menu_peripheral = [ + { + "name": "照明功能", + "addr": "54095", #"48190", + "alias": "alias_run_function", + }, + { + "name": "照明手动开", + "addr": "59061.0", #"10122.0", + "action" : "KeyEnterTrigger_DispCtrl_54095.1",#48190.1 + }, + { + "name": "照明手动关", + "addr": "59061.1", #10122.1", + "action" : "KeyEnterTrigger_DispCtrl_54095.1", + }, + { + "name": "门禁功能", + "alias": "alias_run_function", + "addr": "54105", #"48210", + }, + { + "name": "门禁手动开", + "addr": "59060.14", #"10121.6", + "action" : "KeyEnterTrigger_DispCtrl_54105.1",#48210.1 + }, + { + "name": "门禁手动关", + "addr": "59060.15", #"10121.7", + "action" : "KeyEnterTrigger_DispCtrl_54105.1", + }, +] +menu_fan_arefaction = [ + { + "name": "风机功能", + "addr": "54079", #"48158", + "alias": "alias_run_function", + }, + { + "name": "风机开启温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54075", #"48150", + }, + { + "name": "风机关闭温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54076", #"48152", + }, + { + "name": "风机手动开", + "addr": "59060.8", #"10121.0", + "action" : "KeyEnterTrigger_DispCtrl_54079.1",#48158.1 + }, + { + "name": "风机手动关", + "addr": "59060.9", #"10121.1", + "action" : "KeyEnterTrigger_DispCtrl_54079.1", + }, + { + "name": "除湿机功能", + "addr": "54092", #"48184", + "alias": "alias_run_function", + }, + { + "name": "除湿机开启湿度", + "scale" : 0.1, + "unit" : "%", + "format": "%05.1f", + "addr": "54090", #"48180", + }, + { + "name": "除湿机关闭湿度", + "scale" : 0.1, + "unit" : "%", + "format": "%05.1f", + "addr": "54091", #"48182", + }, + { + "name": "除湿机手动开", + "addr": "59060.14", #"10121.6", + "action" : "KeyEnterTrigger_DispCtrl_54092.1",#48184.1 + }, + { + "name": "除湿机手动关", + "addr": "59060.15", #"10121.7", + "action" : "KeyEnterTrigger_DispCtrl_54092.1", + }, +] + +menu_pin_configure = [ + { + "name": "X0.1(X1)*", + "alias": "alias_input", + "addr": "44265", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.3(X3)*", + "alias": "alias_input", + "addr": "44267", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.4(X4)*", + "alias": "alias_input", + "addr": "44268", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.5(X5)*", + "addr": "44269", + "alias": "alias_input", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.6(X6)*", + "alias": "alias_input", + "addr": "44270", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "Y0.0(A1-B1)*", + "alias": "alias_output", + "addr": "44272", + "action" : "SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y0.1(A2-B2)*", + "alias": "alias_output", + "addr": "44273", + "action" : "SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y0.3(A4-B4)*", + "alias": "alias_output", + "addr": "44275", + "action" : "SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_statistic = [ + + { + "name": "所有泵统计", + "action": "pumps_statistic", + }, + { + "name": "当前压力曲线", + "sub_menu": "cur_curve", + }, + { + "name": "当前工作时间", + "addr": "40042#2", + "unit": "Min", + "format": "%09.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset16", + }, + { + "name": "累计工作时间", + "addr": "40044#2", + "unit": "Min", + "format": "%09.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset16", + }, + { + "name": "累计工作次数", + "addr": "40054#2", + "unit": "次", + "format": "%09.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset16", + }, + { + "name": "累计清零", + "action": "clear_acc_time", + "property": MENU_PROPERTY_ENGINEER, + }, + { + "name": "累计电量清零", + "action": "clear_kwh", + "property": MENU_PROPERTY_ENGINEER, + }, + + { + "name": "退出", + "action": "exit", + }, +] + +menu_system = [ + { + "name": "硬件版本*", + "addr": "48013", + "scale" : 0.01, + "format": "%05.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统版本*", + "addr": "48031", + "scale" : 0.01, + "format": "%04.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "PLC版本*", + "addr": "50499", #"40998", + "scale" : 0.01, + "format": "%04.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "序列号*", + "addr": "44024#2", + "format": "%09.0f", + "action" : "SerialId_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "系统日期", + "addr": "40408#3", + "action" : "date", + }, + { + "name": "当前时间", + "addr": "40411#3", + "action" : "time", + }, + { + "name": "语言*", + "addr": "48014", + "alias": "alias_language", + }, + { + "name": "提示音*", + "addr": "48029", + "alias" : "alias_bool", + }, + { + "name": "锁定键盘*", + "action" : "lock", + }, + { + "name": "背光亮度*", + "addr": "48009", + "unit": "%", + "min": 10, + "max": 100, + "format": "%03.0f", + }, + { + "name": "背光延时*", + "addr": "48008", + "unit": "S", + "format": "%04.0f", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_protect = [ + { + "name": "负压保护", + "alias": "alias_bool", + "addr": "40288.5", + }, + { + "name": "负压报警值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40290", + }, + { + "name": "真空报警值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40291", + }, + { + "name": "负压报警解除值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40292", + }, + { + "name": "真空报警解除值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40305", + }, + { + "name": "超压报警", + "unit": "Mpa", + "addr": "40289", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "爆管保护", + "alias": "alias_bool", + "addr": "40288.8", + }, + { + "name": "爆管停机压力", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40297", + }, + { + "name": "爆管停机延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40298", + }, + { + "name": "电机温度上限", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "40392", + }, + { + "name": "水箱无水保护", + "alias": "alias_bool", + "addr": "40289.7", #FW600 + 598.7 = FW1198.7 + }, + { + "name": "无水液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56593", + }, + { + "name": "无水解除", + "scale" : 0.01, + "unit" : "m", + "format": "%04.2f", + "addr": "40294", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_sleep_set = [ + { + "name": "休眠功率*", + "addr": "44203", + "scale": 0.01, + "unit": "kW", + "format": "%05.2f", + "action": "SelfPumpOffset8", + }, + { + "name": "休眠频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40316", + }, + { + "name": "休眠延时", + "addr": "40317", + "scale": 0.1, + "unit": "S", + "format": "%06.1f", + }, + { + "name": "休眠提升时间*", + "addr": "44206", + "scale": 0.1, + "unit": "S", + "format": "%05.1f", + "action" : "SelfPumpOffset8", + }, + { + "name": "唤醒延时", + "addr": "40319", + "scale": 0.01, + "unit": "S", + "format": "%05.2f", + }, + { + "name": "唤醒压差", + "addr": "40318", + "scale": 0.001, + "unit": "Mpa", + "format": "%05.3f", + }, + + + { + "name": "退出", + "action": "exit", + }, +] +menu_pump_adjust_set = [ + { + "name": "减泵压差", + "scale" : 0.001, + "unit" : "Mpa", + "format": "%05.3f", + "addr": "40274", + }, + { + "name": "加泵压差", + "scale": 0.001, + "unit": "Mpa", + "format": "%05.3f", + "addr": "40275", + }, + { + "name": "休眠加泵压差", #频率在休眠频率以下时的加泵压力差,可以加快加泵速度。 + "scale": 0.001, + "unit": "Mpa", + "format": "%05.3f", + "addr": "40306", + }, + { + "name": "加泵延时", + "addr": "40280", + "scale": 0.1, + "unit": "S", + "format": "%05.1f", + }, + { + "name": "减泵延时", + "addr": "40273", + "scale": 0.1, + "unit": "S", + "format": "%04.1f", + }, + { + "name": "功率到达加泵", + "addr": "40272.0", + "alias": "alias_bool", + }, + { + "name": "加泵功率", + "addr": "40276", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + { + "name": "功率到达减泵", + "addr": "40272.1", + "alias": "alias_bool", + }, + { + "name": "减泵功率", + "addr": "40277", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + { + "name": "频率到达加泵", + "addr": "40272.2", + "alias": "alias_bool", + }, + { + "name": "加泵频率", + "addr": "40278", + "scale": 0.01, + "unit": "Hz", + "format": "%06.2f", + }, + { + "name": "频率到达减泵", + "addr": "40272.3", + "alias": "alias_bool", + }, + { + "name": "减泵频率", + "addr": "40279", + "scale": 0.01, + "unit": "Hz", + "format": "%06.2f", + }, + + { + "name": "退出", + "action": "exit", + }, +] +menu_pid_set = [ + { + "name": "启动PID类型", + "addr": "40304", + "alias": "alias_pid", + }, + { + "name": "启动PID Kp", + "addr": "40307", + "scale": 0.001, + "format": "%05.3f", + }, + { + "name": "启动PID Ti", + "addr": "40308", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "启动PID Td", + "addr": "40309", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "动态PID类型", + "addr": "40395", + "alias": "alias_pid", + }, + { + "name": "动态PID Kp", + "addr": "40396", + "scale": 0.001, + "format": "%05.3f", + }, + { + "name": "动态PID Ti", + "addr": "40397", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "动态PID Td", + "addr": "40398", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "动态PID进入", + "addr": "40394", + "scale": 0.01, + "unit": "%", + "format": "%05.2f", + }, + { + "name": "动态PID退出", + "addr": "40393", + "scale": 0.01, + "unit": "%", + "format": "%05.2f", + }, + { + "name": "PID死区", + "addr": "40314", + "scale": 0.01, + "unit": "%", + "format": "%06.2f", + }, + { + "name": "PID调节周期", + "addr": "40311", + "unit": "ms", + "format": "%04.0f", + }, + { + "name": "PID负载", + "addr": "40406", + "alias": "alias_pidmode", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_winter_set = [ + { + "name": "防冻使能", + "alias": "alias_bool", + "addr": "40401", + }, + { + "name": "运行频率/下限", + "addr": "40402", + "unit": "%", + "format": "%03.0f", + }, + { + "name": "防冻运行时间", + "addr": "40403", + "unit": "S", + "format": "%04.0f", + }, + { + "name": "防冻周期", + "addr": "40404", + "unit": "Min", + "format": "%04.0f", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_pumpgroup = [ + { + "name": "加减泵设置", + "sub_menu": "menu_pump_adjust_set", + }, + { + "name": "休眠设置", + "sub_menu": "menu_sleep_set", + }, + { + "name": "常用设置", + "sub_menu": "menu_normal_set", + }, + { + "name": "功能设置", + "sub_menu": "menu_func_set", + }, + + { + "name": "主辅设置", + "sub_menu": "menu_host_set", + }, + { + "name": "防冻设置", + "sub_menu": "menu_winter_set", + }, + + { + "name": "程序功能", + "alias": "alias_plc", + "addr": "43983", + "action": "reboot_global", + }, + + { + "name": "参数同步", + "action": "sync_3", + }, + { + "name": "定时换泵", + "alias": "alias_bool", + "addr": "40281.0", + }, + { + "name": "定时换泵周期", + "addr": "40282", + "unit": "Min", + "format": "%05.0f", + "min": 10, + "max": 480, + "default": 360, + }, + { + "name": "换泵冷却时间", + "addr": "40303", + "scale": 1.0, + "unit": "Min", + "format": "%05.0f", + }, + { + "name": "水泵流量*", + "addr": "48033", + "scale": 0.1, + "unit": "m³/h", + "format": "%04.1f", + }, + { + "name": "水泵扬程*", + "addr": "48032", + "unit": "m", + "format": "%04.0f", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_full_set = [ #工程师菜单的专属设置 + { + "name": "信号配置", + "sub_menu": "memu_sensor_engineer", + }, + { + "name": "泵组PID配置", + "sub_menu": "menu_pid_set", + }, + { + "name": "变频器参数", + "sub_menu": "menu_freq_convert", + }, + { + "name": "系统信息", + "sub_menu": "menu_system_engineer", + }, + { + "name": "模拟量传感器", + "sub_menu": "memu_sensor_config", + }, + { + "name": "数字IO测试", + "sub_menu": "test_io", + }, + { + "name": "模拟IO测试", + "sub_menu": "test_aio", + }, + { + "name": "用户参数", + "sub_menu": "menu_parameter", + }, + { + "name": "重启", + "action": "reboot", + }, + # { + # "name": "常规设置", + # "sub_menu": "menu_system", + # }, + + # { + # "name": "设置", + # "sub_menu": "menu_normal_set", + # }, + { + "name": "退出", + "action": "exit", + }, +] + +memu_sensor_engineer = [ #工程师菜单的专属设置 + { + "name": "开关量输入配置", + "sub_menu": "menu_io_in", + }, + { + "name": "开关量输出配置", + "sub_menu": "menu_io_out", + }, + { + "name": "模拟量输入配置", + "sub_menu": "menu_aio_in", + }, + { + "name": "模拟量输出配置", + "sub_menu": "menu_aio_out", + }, + { + "name": "AI1 AD值", + "addr": "56206", #FW412 + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "AI3 AD值", + "addr": "56208", #FW416 + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "AI4 AD值", + "addr": "56209", #FW418 + "format": "%05.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_io_out= [ + { + "name": "A1-B1*", + "alias": "alias_output", + "addr": "44272", + "action": "SelfPumpOffset22", + }, + { + "name": "A2-B2*", + "alias": "alias_output", + "addr": "44273", + "action": "SelfPumpOffset22", + }, + { + "name": "A4-B4", + "alias": "alias_output", + "addr": "44275", + "action": "SelfPumpOffset22", + }, +] +menu_io_in= [ + { + "name": "X1*", + "alias": "alias_input", + "addr": "44265", + "action": "SelfPumpOffset22", + }, + #{ + # "name": "X2*", + # "alias": "alias_input", + # "addr": "44266", + # "action": "SelfPumpOffset22", + #}, + { + "name": "X3*", + "alias": "alias_input", + "addr": "44267", + "action": "SelfPumpOffset22", + }, + { + "name": "X4*", + "alias": "alias_input", + "addr": "44268", + "action": "SelfPumpOffset22", + }, + { + "name": "X5*", + "alias": "alias_input", + "addr": "44269", + "action": "SelfPumpOffset22", + }, + { + "name": "X6*", + "alias": "alias_input", + "addr": "44270", + "action": "SelfPumpOffset22", + }, +] +menu_aio_out= [ + { + "name": "AO2*", + "alias": "alias_aioutput", + "addr": "44285", + "action": "SelfPumpOffset22", + }, + { + "name": "AO2 4mA*", + "addr": "48053", + "format": "%04.0f", + "min" : 0, + "max" : 4095, + }, + { + "name": "AO2 20mA*", + "addr": "48054", + "format": "%04.0f", + "min" : 0, + "max" : 4095, + }, +] +menu_aio_in= [ + { + "name": "AI1*", + "alias": "alias_aiinput", + "addr": "44280", + "action" : "SelfPumpOffset22" + }, + { + "name": "AI3*", + "alias": "alias_aiinput", + "addr": "44282", + "action" : "SelfPumpOffset22" + }, + { + "name": "AI4*", + "alias": "alias_aiinput", + "addr": "44283", + "action" : "SelfPumpOffset22" + }, + { + "name": "AI1配置", + "sub_menu": "menu_aio_set1", + }, + { + "name": "AI3配置", + "sub_menu": "menu_aio_set2", + }, + { + "name": "AI4配置", + "sub_menu": "menu_aio_set3", + }, + { + "name": "AO校正", + "sub_menu": "menu_ao_cal", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_aio_set1= [ + { + "name": "当前AD值", + "format" : "%05.0f", + "addr": "56206", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "AD值10V", + "format": "%04.0f", + "addr": "48047", + }, + { + "name": "设为AD值10V", + "action":"AI_Calibrate0", + }, + { + "name": "AI1模式", + "addr": "44271.0", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, + { + "name": "退出", + "action": "exit", + }, +] + + +menu_aio_set2= [ + { + "name": "当前AD值", + "format" : "%05.0f", + "addr": "56208", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "AD值10V", + "format": "%04.0f", + "addr": "48049", + }, + { + "name": "设为AD值10V", + "action":"AI_Calibrate2", + }, + { + "name": "AI3模式", + "addr": "44271.1", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_aio_set3= [ + { + "name": "当前AD值", + "format" : "%05.0f", + "addr": "56209", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "AD值10V", + "format": "%04.0f", + "addr": "48050", + }, + { + "name": "设为AD值10V", + "action":"AI_Calibrate3", + }, + { + "name": "AI1模式", + "addr": "44271.2", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_ao_cal = [ + { + "name": "模拟量输出", + "format" : "%05.0f", + "addr": "48061", + "min" : 0, + "max" : 32000, + "action":"AO_Calibrate", + }, + { + "name": "4mA输出标定", + "action":"AO_Calibrate4mA", + }, + { + "name": "20mA输出标定", + "action":"AO_Calibrate20mA", + }, + { + "name": "AO1模式", + "addr": "44271.3", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, + { + "name": "退出", + "action": "exit", + }, +] + +# menu_pump_engineer = [ #工程师菜单的专属设置 + +# ] +menu_freq_convert = [ + { + "name": "自动复位限制", + "addr": "40301", + "unit": "次", + "format": "%02.0f", + }, + { + "name": "累计复位次数", + "addr": "40197", + "unit": "次", + "format": "%02.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "加速时间*", + "unit": "S", + "addr": "44013", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "减速时间*", + "unit": "S", + "addr": "44014", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "启动时间*", + "unit": "S", + "addr": "44020", + "scale" : 0.1, + "format": "%05.1f", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "载波频率*", + "unit": "kHz", + "scale" : 0.1, + "format": "%04.1f", + "addr": "44019", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "频率上限*", + "unit": "Hz", + "addr": "44015", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "频率下限*", + "unit": "Hz", + "addr": "44016", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "额定频率*", + "unit": "Hz", + "addr": "44012", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定功率*", + "unit": "Kw", + "addr": "56833", + "scale" : 0.01, + "format": "%05.2f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定电流*", + "unit": "A", + "addr": "56834", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_system_engineer = [ #工程师菜单的专属设置 + # { + # "name": "变频器选择", + # "alias" : "alias_converter", + # "addr": "48012", + # }, + # { + # "name": "权限管理", + # "action": "admin", + # }, + { + "name": "系统密码*", + "addr": "48041", + "format" :"%04.0f", + "action": "password", + }, + { + "name": "恢复出厂设置", + "sub_menu": "menu_factory_default", + }, + { + "name": "备份还原点1", + "sub_menu": "menu_save_restore1", + }, + { + "name": "备份还原点2", + "sub_menu": "menu_save_restore2", + }, + { + "name": "序列号*", + "addr": "48002#2", + "format": "%10.0f", + "action": "SerialId_Modify", + }, + { + "name": "累计运行*", + "scale" : 0.016667, + "unit" : "h", + "format": "%07.0f", + "addr": "40044#2", #"56344#2", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_ENGINEER, + }, + { + "name": "退出", + "action": "exit", + }, +] +#显示1台泵 +menu_run_data1 = [ + { + "name": "转速*", + }, + { + "name": "电流*", + }, + { + "name": "功率*", + }, + { + "name": "时间*", + }, +] + +#显示2台泵 +menu_run_data2 = [ + { + "name": "转速*", + }, + { + "name": "电流*", + }, + { + "name": "功率*", + }, + { + "name": "时间*", + }, +] + +#显示3台泵 +menu_run_data3 = [ + { + "name": "转速*", + }, + { + "name": "电流*", + }, + { + "name": "功率*", + }, + { + "name": "时间*", + }, +] + +#模拟IO测试 +test_aio = [ + { + "name": "AO2", + "addr" : "48060", + "scale" : 0.1, + "format" : "%05.1f", + "unit" : "%", + }, +] + +#数字IO测试 +test_io = [ + { + "name": "Y1", + "addr" : "44272", + "alias" : "alias_output", + "action" : "TestY0_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y2", + "addr" : "44273", + "alias" : "alias_output", + "action" : "TestY1_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y3", + "addr" : "44275", + "alias" : "alias_output", + "action" : "TestY3_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X1", + "addr" : "44265", + "alias" : "alias_input", + "action" : "TestX1_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X2", + "addr" : "44266", + "alias" : "alias_input", + "action" : "TestX2_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X3", + "addr" : "44267", + "alias" : "alias_input", + "action" : "TestX3_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X4", + "addr" : "44268", + "alias" : "alias_input", + "action" : "TestX4_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X5", + "addr" : "44269", + "alias" : "alias_input", + "action" : "TestX5_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X6", + "addr" : "44270", + "alias" : "alias_input", + "action" : "TestX6_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + + +menu_pressure_in = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40226", # FW600 + 452 = FW1052 + }, + { + "name": "全局值", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40023", + }, + { + "name": "本机值*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "56124", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40022", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40230", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40229", + }, + { + "name": "量程下限*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40228", + }, + { + "name": "量程上限*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40227", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_pressure_out = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40234", #FW600 + 468 = FW1068 + }, + { + "name": "全局值", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40025", + }, + { + "name": "本机值*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "56123", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40024", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40238", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40237", + }, + { + "name": "量程下限*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40236", + }, + { + "name": "量程上限*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40235", + }, + { + "name": "退出", + "action": "exit", + }, +] + + +menu_valve_opening = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43910", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "39999", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "56126", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "39998", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43914", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43913", + }, + { + "name": "量程下限*", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "43912", + }, + { + "name": "量程上限*", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "43911", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_water_level2 = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43942", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56291", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56140", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56290", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43946", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43945", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43944", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43943", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_water_level3 = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43974", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56285", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56143", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56284", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43978", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43977", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43976", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43975", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_temp = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40250", + }, + { + "name": "全局值", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "40169#s", + }, + { + "name": "本机值*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56128#s", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40168", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40254", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40253", + }, + { + "name": "量程下限*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "40252#s", + }, + { + "name": "量程上限*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "40251#s", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_temp_inside = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43958", + }, + { + "name": "全局值", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56287#s", + }, + { + "name": "本机值*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56138#s", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56286", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43962", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43961", + }, + { + "name": "量程下限*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43960#s", + }, + { + "name": "量程上限*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43959#s", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_temp_middle = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43966", + }, + { + "name": "全局值", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56285#s", + }, + { + "name": "本机值*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56137#s", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56284", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43970", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43969", + }, + { + "name": "量程下限*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43968#s", + }, + { + "name": "量程上限*", + "format": "%+06.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43967#s", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_water_level= [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40258", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40029", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56125", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40028", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40262", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40261", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40260", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40259", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_valve_opening2 = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43950", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "56289", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "56140", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56288", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43954", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43953", + }, + { + "name": "量程下限*", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "43952", + }, + { + "name": "量程上限*", + "format": "%05.1f", + "scale": 0.1, + "unit": "%", + "addr": "43951", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_chlorine = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40202", + }, + + { + "name": "本机值*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "56129", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40016", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40206", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40205", + }, + { + "name": "量程下限*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40204", + }, + { + "name": "量程上限*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40203", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_dirty = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40210", + }, + { + "name": "本机值*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "56130", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40018", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40214", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40213", + }, + { + "name": "量程下限*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40212", + }, + { + "name": "量程上限*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40211", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_flow_out = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40242", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "40027", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "56127", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40026", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40246", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40245", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "40244", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "40243", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_flow_in = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43918", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "56297", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "56132", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56296", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43922", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43921", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "43920", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "43919", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_ph_sensor = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40218", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "addr": "40021", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "addr": "56131", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40020", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40222", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40221", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "addr": "40220", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "addr": "40219", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_wet_sensor = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43926", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "56293", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "56142", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56292", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43930", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43929", + }, + { + "name": "量程下限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "43928", + }, + { + "name": "量程上限*", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "43927", + }, + { + "name": "退出", + "action": "exit", + }, +] +menu_sound_sensor = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43934", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "56295", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "56141", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56294", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43938", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43937", + }, + { + "name": "量程下限*", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "43936", + }, + { + "name": "量程上限*", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "43935", + }, + { + "name": "退出", + "action": "exit", + }, +] + +#信号配置 +memu_sensor_config = [ + { + "name": "输入压力传感器", + "sub_menu": "menu_pressure_in", + }, + { + "name": "输出压力传感器", + "sub_menu": "menu_pressure_out", + }, + { + "name": "输入流量传感器", + "sub_menu": "menu_flow_in", + }, + { + "name": "输出流量传感器", + "sub_menu": "menu_flow_out", + }, + { + "name": "水箱液位1", + "sub_menu": "menu_water_level", + }, + { + "name": "水箱液位2", + "sub_menu": "menu_water_level2", + }, + { + "name": "水箱液位3", + "sub_menu": "menu_water_level3", + }, + { + "name": "调节阀开度反馈", + "sub_menu": "menu_valve_opening", + }, + { + "name": "开度反馈2", + "sub_menu": "menu_valve_opening2", + }, + { + "name": "温度传感器", + "sub_menu": "menu_temp", + }, + { + "name": "站内温度传感器", + "sub_menu": "menu_temp_inside", + }, + { + "name": "夹层温度传感器", + "sub_menu": "menu_temp_middle", + }, + { + "name": "余氯传感器", + "sub_menu": "menu_chlorine", + }, + { + "name": "浊度传感器", + "sub_menu": "menu_dirty", + }, + { + "name": "PH传感器", + "sub_menu": "menu_ph_sensor", + }, + { + "name": "湿度传感器", + "sub_menu": "menu_wet_sensor", + }, + { + "name": "噪音传感器", + "sub_menu": "menu_sound_sensor", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_main = [ + { + "name": "设置", + "sub_menu": "menu_normal_set", + }, + { + "name": "数据", + "sub_menu": "menu_data_pump" + }, + { + "name": "模式", + "sub_menu": "menu_mode" + }, + { + "name": "菜单", + "sub_menu": "menu_normal_menu" + }, +] +menu_normal_menu = [ #普通菜单页面 + { + "name": "系统信息", + "sub_menu": "menu_system", + }, + { + "name": "泵组配置", + "sub_menu": "menu_pumpgroup", + }, + { + "name": "保护设置", + "sub_menu": "menu_protect", + }, + { + "name": "故障查询", + "sub_menu": "menu_alarm", + }, + { + "name": "通信设置", + "sub_menu": "menu_comm_set", + }, + { + "name": "用户参数", + "sub_menu": "menu_parameter", + }, + { + "name": "工程师菜单", + "sub_menu": "menu_full_set", + }, + { + "name": "恢复出厂设置", + "sub_menu": "menu_factory_default", + }, + { + "name": "重启", + "action": "reboot", + }, + + { + "name": "退出", + "action": "exit", + }, +] + +menu_script_desc = [ + { + "name": "脚本 V1.08", + }, + { + "name": "输出流量:10, 输入流量:11", + }, + { + "name": "噪声传感器: 通讯地址=7", + }, + { + "name": "温湿度传感器: 通讯地址=8", + }, + { + "name": "水质分析仪: 通讯地址=5", + }, + { + "name": "夹层温度: 通讯地址=9", + }, + { + "name": "电度表: 通讯地址=6", + }, +] + +menu_factory_default = [ + { + "name": "恢复到本机", + "action": "self_restore_0", + }, + { + "name": "恢复到全局", + "action": "global_restore_0", + }, + { + "name": "退 出", + "action": "exit", + }, +] + +menu_save_restore1 = [ + { + "name": "保存", + "action": "save_1", + }, + { + "name": "恢复到本机", + "action": "self_restore_1", + }, + { + "name": "恢复到全局", + "action": "global_restore_1", + }, + { + "name": "退 出", + "action": "exit", + }, +] + +menu_save_restore2 = [ + { + "name": "保存", + "action": "save_2", + }, + { + "name": "恢复到本机", + "action": "self_restore_2", + }, + { + "name": "恢复到全局", + "action": "global_restore_2", + }, + { + "name": "退 出", + "action": "exit", + }, +] + +display_main = [ + { + "name": "PumpName", + "alias": "alias_PumpName", + "addr" : "48000", #PumpId + }, + { + "name": "PressureOutMax", #输出压力上限 + "format": "%4.0f", + "addr" : "40235", + }, + { + "name": "设定压力", + "addr": "40416", + "format": "%4.0f", + }, +] + +menu_host_set = [ + { + "name": "主辅泵优先级", + "addr": "40299", + "alias": "alias_priority", + }, + { + "name": "辅泵编号", + "addr": "40284", + "scale" : 1.0, + "format": "%1.0f", + }, + { + "name": "辅泵切换延时", + "addr": "40300", + "scale": 0.1, + "unit": "S", + "format": "%05.1f", + }, + { + "name": "辅泵切换功率", + "addr": "40302", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + { + "name": "参数同步", + "action": "sync_3", + }, + { + "name": "退出", + "action": "exit", + }, +] + +menu_caption = [ + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : 2, "max_items" : 4, "next" : menu_link, "prev": menu_hand_adjust, "display": display_main}, + {"name" : "display_main", "menu" : display_main, "caption": "display_main", "page" : 2, "max_items" : 4}, + {"name" : "menu_link", "menu" : menu_link, "caption": "联机设置", "page" : 4, "max_items" : 6, "next" : menu_run_data1, "prev" : menu_main}, + {"name" : "menu_run_data1", "menu" : menu_run_data1, "caption": "数据页1", "page" : 3, "max_items" : 1, "next" : menu_alarm, "prev" : menu_link}, + {"name" : "menu_run_data2", "menu" : menu_run_data2, "caption": "数据页2", "page" : 13, "max_items" : 1, "next" : menu_alarm, "prev" : menu_link}, + {"name" : "menu_run_data3", "menu" : menu_run_data3, "caption": "数据页3", "page" : 23, "max_items" : 1, "next" : menu_alarm, "prev" : menu_link}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "报警显示", "page" : 5, "max_items" : 2, "next" : menu_curve_history, "prev" : menu_run_data1}, + {"name" : "menu_curve_history", "menu" : menu_curve_history, "caption": "历史曲线", "page" : 25, "max_items" : 1, "next" : menu_hand_adjust, "prev" : menu_alarm}, + {"name" : "menu_hand_adjust", "menu" : menu_hand_adjust, "caption": "手动调速", "page" : 15, "max_items" : 1, "next" : menu_main, "prev" : menu_curve_history, "display": disp_hand_adjust}, + {"name" : "disp_hand_adjust", "menu" : disp_hand_adjust, "caption": "显示调速", "page" : 15, "max_items" : 1}, + + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "历史故障", "page" : 11, "max_items" : 8}, + {"name" : "dynamic_page_main", "menu" : dynamic_page_main, "caption": "测量数据", "page" : 2, "max_items" : 4}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : 5, "max_items" : 8}, + {"name" : "menu_sleep_set", "menu" : menu_sleep_set, "caption": "休眠设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_winter_set", "menu" : menu_winter_set, "caption": "防冻设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_pump_adjust_set", "menu" : menu_pump_adjust_set, "caption": "加减泵设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_pumpgroup", "menu" : menu_pumpgroup, "caption": "泵组配置", "page" : 11, "max_items" : 8}, + {"name" : "memu_sensor_config", "menu" : memu_sensor_config, "caption": "模拟量传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统信息", "page" : 11, "max_items" : 8}, + {"name" : "menu_protect", "menu" : menu_protect, "caption": "保护设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_full_set", "menu" : menu_full_set, "caption": "工程师菜单", "page" : 11, "max_items" : 8}, + {"name" : "menu_normal_menu", "menu" : menu_normal_menu, "caption": "普通菜单", "page" : 11, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_statistic", "menu" : menu_statistic, "caption": "统计信息", "page" : 11, "max_items" : 8}, + {"name" : "menu_time_pressure", "menu" : menu_time_pressure, "caption": "分时段压力", "page" : 11, "max_items" : 8}, + {"name" : "cur_curve", "menu" : cur_curve, "caption": "当前压力", "page" : 12, "max_items" : 1}, + {"name" : "menu_io_out", "menu" : menu_io_out, "caption": "开关量输出配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_io_in", "menu" : menu_io_in, "caption": "开关量输入配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_out", "menu" : menu_aio_out, "caption": "模拟量输出配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_in", "menu" : menu_aio_in, "caption": "模拟量输入配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_set1", "menu" : menu_aio_set1, "caption": "模拟输入校正1", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_set2", "menu" : menu_aio_set2, "caption": "模拟输入校正2", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_set3", "menu" : menu_aio_set3, "caption": "模拟输入校正3", "page" : 11, "max_items" : 8}, + {"name" : "menu_ao_cal", "menu" : menu_ao_cal, "caption": "模拟输出标定", "page" : 11, "max_items" : 8}, + + #工程师菜单 + {"name" : "menu_freq_convert", "menu" : menu_freq_convert, "caption": "变频器参数", "page" : 11, "max_items" : 8}, + {"name" : "memu_sensor_engineer","menu" : memu_sensor_engineer,"caption": "信号配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_system_engineer","menu" : menu_system_engineer,"caption": "系统信息", "page" : 11, "max_items" : 8}, + #{"name" : "menu_pump_engineer", "menu" : menu_pump_engineer, "caption": "泵组PID配置", "page" : 11, "max_items" : 8}, + {"name" : "test_io", "menu" : test_io, "caption": "数字IO测试", "page" : 7, "max_items" : 9}, + {"name" : "test_aio", "menu" : test_aio, "caption": "模拟IO测试", "page" : 8, "max_items" : 1}, + {"name" : "menu_factory_default", "menu" : menu_factory_default, "caption": "恢复出厂设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_save_restore1", "menu" : menu_save_restore1, "caption": "备份还原点1", "page" : 11, "max_items" : 8}, + {"name" : "menu_save_restore2", "menu" : menu_save_restore2, "caption": "备份还原点2", "page" : 11, "max_items" : 8}, + {"name" : "menu_pid_set", "menu" : menu_pid_set, "caption": "泵组PID配置", "page" : 11, "max_items" : 8}, + + #传感器 + {"name" : "menu_pressure_in", "menu" : menu_pressure_in, "caption": "输入压力传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_pressure_out", "menu" : menu_pressure_out, "caption": "输出压力传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_water_level", "menu" : menu_water_level, "caption": "水箱液位传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_water_level2", "menu" : menu_water_level2, "caption": "水箱液位2", "page" : 11, "max_items" : 8}, + {"name" : "menu_water_level3", "menu" : menu_water_level3, "caption": "水箱液位3", "page" : 11, "max_items" : 8}, + {"name" : "menu_temp", "menu" : menu_temp, "caption": "温度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_temp_inside", "menu" : menu_temp_inside, "caption": "站内温度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_temp_middle", "menu" : menu_temp_middle, "caption": "夹层温度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_valve_opening", "menu" : menu_valve_opening, "caption": "调节阀开度反馈", "page" : 11, "max_items" : 8}, + {"name" : "menu_valve_opening2", "menu" : menu_valve_opening2,"caption": "开度反馈2", "page" : 11, "max_items" : 8}, + {"name" : "menu_flow_out", "menu" : menu_flow_out, "caption": "输出流量传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_flow_in", "menu" : menu_flow_in, "caption": "输入流量传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_chlorine", "menu" : menu_chlorine, "caption": "余氯传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_dirty", "menu" : menu_dirty, "caption": "浊度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_ph_sensor", "menu" : menu_ph_sensor, "caption": "PH传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_wet_sensor", "menu" : menu_wet_sensor, "caption": "湿度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_sound_sensor", "menu" : menu_sound_sensor, "caption": "噪音传感器", "page" : 11, "max_items" : 8}, + #设置页面 + {"name" : "menu_quick_tag", "menu" : menu_quick_tag, "caption": "快捷入口", "page" : 11, "max_items" : 8, "next" : menu_normal_set, "prev" : menu_protect_set}, + {"name" : "menu_normal_set", "menu" : menu_normal_set, "caption": "常用设置", "page" : 6, "max_items" : 12, "next" : menu_run_set, "prev" : menu_quick_tag}, + {"name" : "menu_run_set", "menu" : menu_run_set, "caption": "运行设置", "page" : 6, "max_items" : 12, "next" : menu_func_set, "prev" : menu_normal_set}, + {"name" : "menu_func_set", "menu" : menu_func_set, "caption": "功能设置", "page" : 11, "max_items" : 8, "next" : menu_protect_set, "prev" : menu_run_set}, + {"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : 6, "max_items" : 12, "next" : menu_quick_tag, "prev" : menu_func_set}, + + {"name" : "menu_host_set", "menu" : menu_host_set, "caption": "主辅设置", "page" : 11, "max_items" : 8}, + #数据页面 + {"name" : "menu_data_pump", "menu" : menu_data_pump, "caption": "泵组数据", "page" : 19, "max_items" : 12, "next" : menu_data_Native1, "prev" : menu_data_user}, + {"name" : "menu_data_Native1", "menu" : menu_data_Native1, "caption": "本机数据1", "page" : 19, "max_items" : 12, "next" : menu_data_Native2, "prev" : menu_data_pump}, + {"name" : "menu_data_Native2", "menu" : menu_data_Native2, "caption": "本机数据2", "page" : 19, "max_items" : 12, "next" : menu_data_user, "prev" : menu_data_Native1}, + {"name" : "menu_data_user", "menu" : menu_data_user, "caption": "用户数据", "page" : 19, "max_items" : 12, "next" : menu_data_pump, "prev" : menu_data_Native2}, + #用户参数页面 + {"name" : "menu_parameter", "menu" : menu_parameter, "caption": "用户参数", "page" : 11, "max_items" : 8, "next" : menu_temp_control, "prev" : menu_pin_configure}, + {"name" : "menu_temp_control", "menu" : menu_temp_control, "caption": "调温配置", "page" : 11, "max_items" : 8, "next" : menu_tank1, "prev" : menu_parameter}, + {"name" : "menu_tank1", "menu" : menu_tank1, "caption": "1#水箱", "page" : 11, "max_items" : 8, "next" : menu_tank2, "prev" : menu_temp_control}, + {"name" : "menu_tank2", "menu" : menu_tank2, "caption": "2#水箱", "page" : 11, "max_items" : 8, "next" : menu_tank3, "prev" : menu_tank1}, + {"name" : "menu_tank3", "menu" : menu_tank3, "caption": "3#水箱", "page" : 11, "max_items" : 8, "next" : menu_tank_switch, "prev" : menu_tank2}, + {"name" : "menu_tank_switch", "menu" : menu_tank_switch, "caption": "箱罐切换", "page" : 11, "max_items" : 8, "next" : menu_pump_inletvalve, "prev" : menu_tank3}, + {"name" : "menu_pump_inletvalve","menu" : menu_pump_inletvalve,"caption": "泵组进压阀门", "page" : 11, "max_items" : 8, "next" : menu_explosion_valve, "prev" : menu_tank_switch}, + {"name" : "menu_explosion_valve","menu" : menu_explosion_valve,"caption": "爆管阀门", "page" : 11, "max_items" : 8, "next" : menu_peripheral, "prev" : menu_pump_inletvalve}, + {"name" : "menu_peripheral", "menu" : menu_peripheral, "caption": "其他外设", "page" : 11, "max_items" : 8, "next" : menu_fan_arefaction, "prev" : menu_explosion_valve}, + {"name" : "menu_fan_arefaction", "menu" : menu_fan_arefaction,"caption": "风机除湿", "page" : 11, "max_items" : 8, "next" : menu_pin_configure, "prev" : menu_peripheral}, + {"name" : "menu_pin_configure", "menu" : menu_pin_configure, "caption": "引脚配置", "page" : 11, "max_items" : 8, "next" : menu_script_desc, "prev" : menu_fan_arefaction}, + {"name" : "menu_script_desc", "menu" : menu_script_desc, "caption": "脚本描述", "page" : 14, "max_items" : 8, "next" : menu_parameter, "prev" : menu_pin_configure}, +] + +class class_pump_comm_device_config(class_comm_device_config): + def __init__(self): + class_comm_device_config.__init__(self) + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_main + def get_menu_top(self) : + return menu_main + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + #@override menu_get_display_page + def menu_get_display_page(self, active_menu): + return menu_page.KUNLUN_GRAOUP_PAGE_MENU + + def get_menu_caption_info(self) : + return menu_caption + + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_pump_comm_device_config() diff --git a/menu_pump_ver_wolong.py b/menu_pump_ver_wolong.py new file mode 100644 index 0000000..e68b99b --- /dev/null +++ b/menu_pump_ver_wolong.py @@ -0,0 +1,5203 @@ +from device_conf import class_comm_device_config +import comm_remap as remap +import menu_page +from comm_device import class_comm_device +from comm_thread import class_comm_master_thread +from menu_base import class_device_menu +import menu_utils as utils +import comm_global +from enum import Enum + + +FREQ_ALARM_BASE = 70 +USER_GLOBAL_ALARM_BASE = 32 #//Total 16 Global Alarm +USER_LOCAL_ALARM_BASE = 200 #//Total 16 Local Alarm +USER_GLOBAL_WARNING_BASE = 216 #//Total 16 Global Warning +USER_LOCAL_WARNING_BASE = 232 #//Total 16 Local Warning + +#Propery of menu item +MENU_PROPERTY_READ_ONLY = 0 +MENU_PROPERTY_USER = 1 +MENU_PROPERTY_ENGINEER = 2 +MENU_PROPERTY_WRITE_ONLY = 3 + +STR_SensorFailCause = "1. 传感器故障@2. 模拟量口故障@3. 通信电缆的接线不正确,或发生短路、断线" +STR_SensorFailProcess = "1. 更换传感器@2. 更换电机@3. 检查传感器是否断线或损坏。" +STR_FreqErrRef = "详见变频器说明书" +EMPTY_STRING = " " + +class StrInfo(Enum) : + STR_INPUT_PASSWORD = 0, #// //请输入密码 + STR_COMM_FAIL = 1, #// //通讯故障 + STR_ENTER_TO_CLEAR = 2, #// //按确认清除 + STR_ESC_TO_CANCEL = 3, #// //按退出取消 + STR_CLEAR_FINISH = 4, #// //清除完成 + STR_MIN_VALUE = 5, #// + STR_MAX_VALUE = 6, #// + STR_NO_RECORD = 7, #// + STR_VALUE_EXCEED = 8, #// + STR_SET_VALUE = 9, #// + STR_INFORM_OK = 10, #// + STR_CHECK_VOLTAGE = 11, #// + STR_CHECK_SENSOR = 12, #// + STR_CHECK_PIPE_IN = 13, #// + STR_CHECK_NONE = 14, #// + STR_CHECK_RSV = 15, #// + STR_CHECK_VOLTAGE_PHASE = 16, #// + STR_CHECK_PIPE_BROKE = 17, #// + STR_CHECK_WATER_SIGNAL = 18, #// + STR_CHECK_PID_PARA = 19, #// + STR_CHECK_HARD_ERROR = 20, #// + STR_CHECK_LOAD = 21, #// + STR_CHECK_POWER_INPUT = 22, #// + STR_CHECK_POWER_OUTPUT = 23, #// + STR_CHECK_FREQ_ACC_DEC_TIME = 24, #// + STR_CHECK_TEMPERATURE = 25, #// + STR_CHECK_FREQ_COMMUNICATE = 26, #// + STR_CHECK_MAIN_PUMP_LOST = 27, #// + STR_CHECK_FREQ_CONVERTER = 28, #// + STR_CHECK_CAN_COMM = 29, #// + STR_CHECK_FREQ_EXTERNAL_ALARM = 30, #// + STR_CHECK_FREQ_POWER = 31, #// + STR_CHECK_ALARM_RESET = 32, #// + STR_CHECK_PUMP_ID_CONFLICT = 33, #// + STR_CHECK_PRESSURE_LOW_IO = 34, #// + STR_CHECK_PRESSURE_HIGH_IO = 35, #// + STR_CHECK_WATER_CONTAINER_SIGNAL = 36, #// + STR_CHECK_MOTOR_TEMPERATURE_OR_SENSOR = 37, #// + STR_CHECK_BUS_POWER_SHORT = 38, #// + STR_PUMP_NOT_FOUNT = 39, #// + STR_PUMP_UPDATE_FAIL = 40, #// + STR_PUMP_UPDATE_SUCCESS = 41, #// + STR_PUMP_UPDATE_TIMEOUT = 42, #// + STR_PUMP_READ_FAIL = 43, #// + STR_PUMP_READ_SUCCESS = 44, #// + STR_PUMP_READ_TIMEOUT = 45, #// + +class AlarmInfo(Enum) : + + ALARM_FREE = 0, + ALARM_PIPE_BROKE = 1, #//爆管保护 + ALARM_NO_WATER_EXIST = 2, #//无水停机 + ALARM_WATER_PRESSURE_HIGH = 3, #//水压过高保护 + ALARM_OVER_VOLTAGE = 4, #//供电电压过高 + ALARM_UNDER_VOLTAGE = 5, #//供电电压过低 + ALARM_BOARD_HARDWARE = 6, #//硬件故障 + ALARM_IO_NO_WATER_EXIST = 7, #//市政无水停机 + #//传感器故障子故障 + ALARM_SENSOR_PRESS_IN = 8, #//入口压力传感器故障 + ALARM_SENSOR_PRESS_OUT = 9, #//出口压力传感器故障 + ALARM_SENSOR_FLUX = 10, #//流量传感器故障 + ALARM_SENSOR_PH = 11, #//PH值传感器故障 + ALARM_SENSOR_WATER_CLEAR = 12, #//浊度传感器故障 + ALARM_SENSOR_REMAIN_CL = 13, #//余氯传感器故障 + ALARM_NEG_PRESSURE = 14, #//负压报警 + ALARM_VACUMM_PRESSURE = 15, #//真空报警 + + ALARM_SENSOR_WATER_LEVEL = 16, #//水位传感器故障 + ALARM_WATER_PRESSURE_LOW = 17, #//水位过低提示 + ALARM_SENSOR_FLUX_IN = 18, #//输入流量传感器故警 + ALARM_SENSOR_IN_VALVE_FEEDBACK = 19, #//输入阀反馈 + ALARM_SENSOR_NOIZE = 20, + ALARM_SENSOR_HUMIDITY = 21, + + ALARM_IO_LEAK_WATER = 22, + ALARM_IO_SMOKE = 23, + ALARM_IO_EXTERNALERROR = 24, #//外部故障 + + ALARM_SENSOR_WATER_LEVEL2 = 25, #//水位传感器2故障 + ALARM_SENSOR_IN_VALVE_FEEDBACK2 = 26, #//开度反馈传感器2故障 + ALARM_SENSOR_TEMPERATURE = 27, #//温度传感器故障 + ALARM_SENSOR_TEMPERATURE2 = 28, #//站内温度传感器故障 + ALARM_SENSOR_TEMPERATURE3 = 29, #//夹层温度传感器故障 + ALARM_SENSOR_WATER_LEVEL3 = 30, + + USER_GLOBAL_ALARM_0 = USER_GLOBAL_ALARM_BASE + 0, + USER_GLOBAL_ALARM_1 = USER_GLOBAL_ALARM_BASE + 1, + USER_GLOBAL_ALARM_2 = USER_GLOBAL_ALARM_BASE + 2, + USER_GLOBAL_ALARM_3 = USER_GLOBAL_ALARM_BASE + 3, + USER_GLOBAL_ALARM_4 = USER_GLOBAL_ALARM_BASE + 4, + USER_GLOBAL_ALARM_5 = USER_GLOBAL_ALARM_BASE + 5, + USER_GLOBAL_ALARM_6 = USER_GLOBAL_ALARM_BASE + 6, + USER_GLOBAL_ALARM_7 = USER_GLOBAL_ALARM_BASE + 7, + USER_GLOBAL_ALARM_8 = USER_GLOBAL_ALARM_BASE + 8, + USER_GLOBAL_ALARM_9 = USER_GLOBAL_ALARM_BASE + 9, + USER_GLOBAL_ALARM_10 = USER_GLOBAL_ALARM_BASE + 10, + USER_GLOBAL_ALARM_11 = USER_GLOBAL_ALARM_BASE + 11, + USER_GLOBAL_ALARM_12 = USER_GLOBAL_ALARM_BASE + 12, + USER_GLOBAL_ALARM_13 = USER_GLOBAL_ALARM_BASE + 13, + USER_GLOBAL_ALARM_14 = USER_GLOBAL_ALARM_BASE + 14, + USER_GLOBAL_ALARM_15 = USER_GLOBAL_ALARM_BASE + 15, + + #//每台泵子故障 + ALARM_COMM_FREQ_CONVERTER = 54, #//变频器通讯故障 + ALARM_COMM_TOUCH_BOARD = 55, #//触控板通讯故障 + ALARM_COMM_MAIN_BOARD = 56, #//主控板通讯故障 + ALARM_PUMP_AIR_SWITCH_OFF = 57, #//空开跳闸 + ALARM_MAIN_PUMP_LOST = 58, #//主泵丢失 + ALARM_PUMP_RESET_DELAY = 59, #//泵处于故障复位状态 + ALARM_COMMAND_EXECUTE_FAIL = 60, #//泵命令执行失败 + ALARM_FREQ_PARAMETER_SET = 61, #//变频参数设置故障 + ALARM_PUMP_ADDR_ID_CONFLICT = 62, #//泵号冲突 + ALARM_PUMP_MOTOR_TEMPERATURE_HIGH = 63, + ALARM_BUS_POWER_SHORT = 64, #//总线电源短路 + ALARM_POWER_LOST = 65, #//电源丢失 + ALARM_AUTO_REMOTE_DISABLE = 66, #//自动停止信号有效 + + ALARM_FREQ_U_PROTECT = FREQ_ALARM_BASE + 0, #//变频器U相保护 + ALARM_FREQ_V_PROTECT = FREQ_ALARM_BASE + 1, #//变频器V相保护 + ALARM_FREQ_W_PROTECT = FREQ_ALARM_BASE + 2, #//变频器W相保护 + ALARM_FREQ_ACCELERATE_OVER_CURRENT = FREQ_ALARM_BASE + 3, #//变频器加速过流 + ALARM_FREQ_DECELERATE_OVER_CURRENT = FREQ_ALARM_BASE + 4, #//变频器减速过流 + ALARM_FREQ_FIX_SPEED_OVER_CURRENT = FREQ_ALARM_BASE + 5, #//变频器恒速过流 + ALARM_FREQ_ACCELERATE_OVER_VOLTAGE = FREQ_ALARM_BASE + 6, #//变频器加速过电压 + ALARM_FREQ_DECELERATE_OVER_VOLTAGE = FREQ_ALARM_BASE + 7, #//变频器减速过电压 + ALARM_FREQ_FIX_SPEED_OVER_VOLTAGE = FREQ_ALARM_BASE + 8, #//变频器恒速过电压 + ALARM_FREQ_DC_VOLTAGE_LOW = FREQ_ALARM_BASE + 9, #//变频器母线电压低 + ALARM_FREQ_MOTOR_OVER_LOAD = FREQ_ALARM_BASE + 10, #//变频器电机过热 + ALARM_FREQ_OVER_LOAD = FREQ_ALARM_BASE + 11, #//变频器过载 + ALARM_FREQ_INPUT_MISS_PHASE = FREQ_ALARM_BASE + 12, #//变频器输入缺相 + ALARM_FREQ_OUTPUT_MISS_PHASE = FREQ_ALARM_BASE + 13, #//变频器输出缺相 + ALARM_FREQ_MODULE_TEMP_HIGH = FREQ_ALARM_BASE + 14, #//变频器温度过高 + ALARM_FREQ_RSV45 = FREQ_ALARM_BASE + 15, #//保留 + ALARM_FREQ_EXTERNAL = FREQ_ALARM_BASE + 16, #//变频器外部故障 + ALARM_FREQ_COMMUNICATION = FREQ_ALARM_BASE + 17, #//变频器通讯故障 + ALARM_FREQ_CURRENT_MEASURE = FREQ_ALARM_BASE + 18, #//变频器电流检测回路故障 + ALARM_FREQ_SELF_STUDY = FREQ_ALARM_BASE + 19, #//变频器学习故障 + ALARM_FREQ_EEPROM = FREQ_ALARM_BASE + 20, #//变频器EEPROM故障 + ALARM_FREQ_PID_FAIL = FREQ_ALARM_BASE + 21, #//变频器PID调节故障 + ALARM_FREQ_STOP_UNIT = FREQ_ALARM_BASE + 22, #//变频器制动单元故障 + ALARM_FREQ_RSV53 = FREQ_ALARM_BASE + 23, #//保留 + ALARM_FREQ_SHORT_GROUND = FREQ_ALARM_BASE + 24, #//变频器对地短路 + + #// V1000C变频器故障 + #// ALARM_FREQ_MEMOBUS = 100, #//CE (MEMOBUS通信故障) #// AlarmStatus5.MEMOBUSCommuFault, MinorAlarm1.CommAlarm, AlarmStatus1.CommAlarm, MinorAlarm3.CommunicationErr + ALARM_FREQ_CONTROL_FAULT = 101, #// CF (控制故障) #// AlarmStatus5.ControlFault + ALARM_FREQ_CURRENT_BASE = 102, #// CoF (电流偏�?故障�? #// AlarmStatus7.CurrentBiasFault + ALARM_FREQ_ADC_FAULT = 103, #// CPF02 (A/D �?换器故障�? + ALARM_FREQ_PWM_DATA_ERR = 104, #// CPF03 (PWM 数据异常�? + ALARM_FREQ_EEPROM_DATA_ERR = 105, #// CPF06 (EEPROM 数据异常�? + ALARM_FREQ_TERMINAL_FAULT = 106, #// CPF07 (�??子电�?板通信故障�? + ALARM_FREQ_EEPROM_COMM_FAULT = 107, #// CPF08 (EEPROM 串�?�通信故障�? + ALARM_FREQ_RAM_FAULT = 108, #// CPF11 (RAM 故障�? + ALARM_FREQ_FLASH_FAULT = 109, #// CPF12 (闪存故障) + ALARM_FREQ_MONITOR = 110, #// CPF13 (监视故障) #// + ALARM_FREQ_CTRL_CIRCUIT = 111, #// CPF14 (控制回�?故障�? + ALARM_FREQ_CLOCK_FAULT = 112, #// CPF16 (时钟故障) + ALARM_FREQ_INTERRUPT_FAULT = 113, #// CPF17 (中�?故障�? + ALARM_FREQ_PWM_FBDATA_ERR = 114, #// CPF23 (PWM 反�?�数�?异常�? + ALARM_FREQ_CAPACITY_SIGNAL = 115, #// CPF24 (变频器容量信号故障�? + ALARM_FREQ_TERMINAL_NOT_CONNECT = 116, #// CPF25 (未连接�?子电�?板) + ALARM_FREQ_MONITOR_DEVICE = 117, #// E5/CPF13 (监视�?�置故障�? + ALARM_FREQ_EXTERN_FAULT_S1 = 118, #// EF1 (�?�部故�??(输入�??�?S1))#// AlarmStatus7.ExternalFault1, MinorAlarm5.ExternalFault1 + ALARM_FREQ_EXTERN_FAULT_S2 = 119, #// EF2 (�?�部故�??(输入�??�?S2))#// AlarmStatus7.ExternalFault2, MinorAlarm5.ExternalFault2 + ALARM_FREQ_EXTERN_FAULT_S3 = 120, #// EF3 (�?�部故�??(输入�??�?S3))#// AlarmStatus4.ExternalFault3, MinorAlarm2.ExternalFault3 + ALARM_FREQ_EXTERN_FAULT_S4 = 121, #// EF4 (�?�部故�??(输入�??�?S4))#// AlarmStatus4.ExternalFault4, MinorAlarm2.ExternalFault4 + ALARM_FREQ_EXTERN_FAULT_S5 = 122, #// EF5 (�?�部故�??(输入�??�?S5))#// AlarmStatus4.ExternalFault5, MinorAlarm2.ExternalFault5 + ALARM_FREQ_EXTERN_FAULT_S6 = 123, #// EF6 (�?�部故�??(输入�??�?S6))#// AlarmStatus4.ExternalFault6, MinorAlarm2.ExternalFault6 + ALARM_FREQ_EEPROMW_WRITE_ERR = 124, #// Err (EEPROM 写入不当�?#// AlarmStatus4.EEPROMWriteError + ALARM_FREQ_PIDFB_OVERTOP = 125, #// FbH (PID 反�?�超值) #// AlarmStatus7.PIDFeedbackOvertop, MinorAlarm4.PIDFeedbackOvertop + ALARM_FREQ_PID_FB_LOST = 126, #// FbL (PID 反丧�?/ AlarmStatus5.PID_FeedbackLost, MinorAlarm4.PID_FeedbackLost + ALARM_FREQ_GROUND_FALUT = 127, #// GF (接地短�?�? + ALARM_FREQ_OUT_PHASE_LOST = 128, #// LF (输出缺相) + ALARM_FREQ_OUT_IMBALANCE = 129, #// LF2 (输出电流失衡) + ALARM_FREQ_NODE_SETUP_ERR = 130, #// nSE(Node Setup 故障�? + ALARM_FREQ_OVER_CURRENT = 131, #// oC (过电流�? + ALARM_FREQ_FIN_OVER_HEAT = 132, #// oH/oH1 (散�?片过�?�? + ALARM_FREQ_MOTOR_OVERHEAT1 = 133, #// oH3 (电机过�?警�??(PTC 输入)) + ALARM_FREQ_MOTOR_OVERHEAT2 = 134, #// oH4 (电机过�?故�??(PTC 输入)) + ALARM_FREQ_MOTOR_OVERLOAD = 135, #// oL1 (电机过载) + ALARM_FREQ_VFD_OVERLOAD = 136, #// oL2 (变频器过载�? + ALARM_FREQ_OVER_TORQUE1 = 137, #// oL3 (过�?矩�?��?1�? + ALARM_FREQ_OVER_TORQUE2 = 138, #// oL4 (过�?矩�?��?2�? + ALARM_FREQ_MECHAN_AGING1 = 139, #// oL5 (机械老化检�?1�? + ALARM_FREQ_BREAK_OVERLOAD = 140, #// oL7 (高滑差制动电机过载保护�? + ALARM_FREQ_OVER_VOLTAGE = 141, #// ov (主回路过电压) + ALARM_FREQ_VOLTAGE_FAULT = 142, #// PF (主回路电压故障�? + ALARM_FREQ_BRAKE_TRANS = 143, #// rr (内�?制动晶体管故障�?? + ALARM_FREQ_OUT_SHORT = 144, #// SC (输出短�?或IGBT故障�? + ALARM_FREQ_SPEED_SEARCH = 145, #// SEr (速度搜索重试故障�? + ALARM_FREQ_DISORDER = 146, #// STo (失调�?�出) + ALARM_FREQ_LACK_OF_TORQUE1 = 147, #// UL3 (转矩不�?1�? + ALARM_FREQ_LACK_OF_TORQUE2 = 148, #// UL4 (转矩不�?2�? + ALARM_FREQ_MECHAN_AGING2 = 149, #// UL5 (机械老化检�?2�? + ALARM_FREQ_MAJOR_UNDERVOLTAGE = 150, #// Uv/Uv1 (主回路欠电压) + ALARM_FREQ_CTRL_POW_FAULT = 151, #// Uv2 (控制电源故障) + ALARM_FREQ_PREVENT_SHOCK = 152, #// Uv3 (冲击防止回�?故障�? + + ALARM_FREQ_CONTROL1_ERR = 153, #//CPF18 + ALARM_FREQ_CONTROL2_ERR = 154, #//CPF19 + ALARM_FREQ_HARD1_ERR = 155, #//CPF20 + ALARM_FREQ_HARD2_ERR = 156, #//CPF21 + ALARM_FREQ_ADC_ERR = 157, #//CPF22 + + + ALARM_FREQ_BASE_BLOCK = 160, #// 变频器基极封锁(bb) + ALARM_FREQ_COMM_WAITING = 161, #// 通信等待中(CALL) + ALARM_FREQ_RST_WHEN_RUN = 162, #// 运行指令输入中复位(CrST) + ALARM_FREQ_COMM_CYCLE_ERR = 163, #// 通信周期设定错误(CyC) + ALARM_FREQ_DRIVE_DISABLE = 164, #// Drive Disable中(dnE) + ALARM_FREQ_CW_CCW_CMD = 165, #// 正反转指令同时输入(EF) + ALARM_FREQ_CURRENT_WARNING = 166, #// 电流警告(HCA) + ALARM_FREQ_MAINTAIN_FAN = 167, #// 冷却风扇维护时期(LT-1) + ALARM_FREQ_MAINTAIN_CAP = 168, #// 电容器维护时期(LT-2) + ALARM_FREQ_MAINTAIN_RELAY = 169, #// 冲击电流防止继电器维护时期(LT-3) + ALARM_FREQ_MAINTAIN_IGBT_50 = 170, #// IGBT维护时期(50%)(LT-4) + ALARM_FREQ_VFD_OH_ALERT = 171, #// 变频器过热预警(oH2) + ALARM_FREQ_MOTOR_OVERHEAT = 172, #// 电机过热(oH3) + ALARM_FREQ_RSV173 = 173, #// 保留 + ALARM_FREQ_RSV174 = 174, #// 保留 + ALARM_FREQ_MOBUS_TEST_OK = 175, #// MEMOBUS通信测试模式正常(PASS) + ALARM_FREQ_SWITCH_WHEN_RUN = 176, #// 运行中输入电机切换指令(rUn) + ALARM_FREQ_MOBUS_TEST_ERR = 177, #// MEMOBUS通信测试模式故障(SE) + ALARM_FREQ_MAINTAIN_IGBT_90 = 178, #// IGBT维护时期(90%)(TrPC) + ALARM_FREQ_RSV179 = 179, #// 保留 + ALARM_FREQ_RSV180 = 180, #// 保留 + ALARM_FREQ_CAPACITY_SET_ERR = 181, #// oPE01 变频器容量的设定故障(oPE01) + ALARM_FREQ_PARA_RANGE_ERR = 182, #// oPE02 参数设定范围不当(oPE02) + ALARM_FREQ_DIN_SELECT_ERR = 183, #// oPE03 多功能输入的选择不当(oPE03) + ALARM_FREQ_AIN_SELECT_ERR = 184, #// oPE07 多功能模拟量输入的选择不当(oPE07) + ALARM_FREQ_PARA_SELECT_ERR = 185, #// oPE08 参数选择不当(oPE08) + ALARM_FREQ_PID_SELECT_ERR = 186, #// oPE09 PID控制的选择不当(oPE09) + ALARM_FREQ_VF_DATA_SET_ERR = 187, #// oPE10 V/f数据的设定不当(oPE10) + ALARM_FREQ_CARRIER_SET_ERR = 188, #// oPE11 载波频率的设定不当(oPE11) + + USER_LOCAL_ALARM_0 = USER_LOCAL_ALARM_BASE + 0, + USER_LOCAL_ALARM_1 = USER_LOCAL_ALARM_BASE + 1, + USER_LOCAL_ALARM_2 = USER_LOCAL_ALARM_BASE + 2, + USER_LOCAL_ALARM_3 = USER_LOCAL_ALARM_BASE + 3, + USER_LOCAL_ALARM_4 = USER_LOCAL_ALARM_BASE + 4, + USER_LOCAL_ALARM_5 = USER_LOCAL_ALARM_BASE + 5, + USER_LOCAL_ALARM_6 = USER_LOCAL_ALARM_BASE + 6, + USER_LOCAL_ALARM_7 = USER_LOCAL_ALARM_BASE + 7, + USER_LOCAL_ALARM_8 = USER_LOCAL_ALARM_BASE + 8, + USER_LOCAL_ALARM_9 = USER_LOCAL_ALARM_BASE + 9, + USER_LOCAL_ALARM_10 = USER_LOCAL_ALARM_BASE + 10, + USER_LOCAL_ALARM_11 = USER_LOCAL_ALARM_BASE + 11, + USER_LOCAL_ALARM_12 = USER_LOCAL_ALARM_BASE + 12, + USER_LOCAL_ALARM_13 = USER_LOCAL_ALARM_BASE + 13, + USER_LOCAL_ALARM_14 = USER_LOCAL_ALARM_BASE + 14, + USER_LOCAL_ALARM_15 = USER_LOCAL_ALARM_BASE + 15, + + USER_GLOBAL_WARNING_0 = USER_GLOBAL_WARNING_BASE + 0, + USER_GLOBAL_WARNING_1 = USER_GLOBAL_WARNING_BASE + 1, + USER_GLOBAL_WARNING_2 = USER_GLOBAL_WARNING_BASE + 2, + USER_GLOBAL_WARNING_3 = USER_GLOBAL_WARNING_BASE + 3, + USER_GLOBAL_WARNING_4 = USER_GLOBAL_WARNING_BASE + 4, + USER_GLOBAL_WARNING_5 = USER_GLOBAL_WARNING_BASE + 5, + USER_GLOBAL_WARNING_6 = USER_GLOBAL_WARNING_BASE + 6, + USER_GLOBAL_WARNING_7 = USER_GLOBAL_WARNING_BASE + 7, + USER_GLOBAL_WARNING_8 = USER_GLOBAL_WARNING_BASE + 8, + USER_GLOBAL_WARNING_9 = USER_GLOBAL_WARNING_BASE + 9, + USER_GLOBAL_WARNING_10 = USER_GLOBAL_WARNING_BASE + 10, + USER_GLOBAL_WARNING_11 = USER_GLOBAL_WARNING_BASE + 11, + USER_GLOBAL_WARNING_12 = USER_GLOBAL_WARNING_BASE + 12, + USER_GLOBAL_WARNING_13 = USER_GLOBAL_WARNING_BASE + 13, + USER_GLOBAL_WARNING_14 = USER_GLOBAL_WARNING_BASE + 14, + USER_GLOBAL_WARNING_15 = USER_GLOBAL_WARNING_BASE + 15, + + USER_LOCAL_WARNING_0 = USER_LOCAL_WARNING_BASE + 0, + USER_LOCAL_WARNING_1 = USER_LOCAL_WARNING_BASE + 1, + USER_LOCAL_WARNING_2 = USER_LOCAL_WARNING_BASE + 2, + USER_LOCAL_WARNING_3 = USER_LOCAL_WARNING_BASE + 3, + USER_LOCAL_WARNING_4 = USER_LOCAL_WARNING_BASE + 4, + USER_LOCAL_WARNING_5 = USER_LOCAL_WARNING_BASE + 5, + USER_LOCAL_WARNING_6 = USER_LOCAL_WARNING_BASE + 6, + USER_LOCAL_WARNING_7 = USER_LOCAL_WARNING_BASE + 7, + USER_LOCAL_WARNING_8 = USER_LOCAL_WARNING_BASE + 8, + USER_LOCAL_WARNING_9 = USER_LOCAL_WARNING_BASE + 9, + USER_LOCAL_WARNING_10 = USER_LOCAL_WARNING_BASE + 10, + USER_LOCAL_WARNING_11 = USER_LOCAL_WARNING_BASE + 11, + USER_LOCAL_WARNING_12 = USER_LOCAL_WARNING_BASE + 12, + USER_LOCAL_WARNING_13 = USER_LOCAL_WARNING_BASE + 13, + USER_LOCAL_WARNING_14 = USER_LOCAL_WARNING_BASE + 14, + USER_LOCAL_WARNING_15 = USER_LOCAL_WARNING_BASE + 15, + + ALARM_MAX = 0x8000, + +alias_table = [ + #模拟量输入固定为第0项 + {"alias_aiinput": {0: "无功能", + 1:"出口压力", + 2:"入口压力", + #3:"液位信号", + #4:"调节阀反馈", + #5:"输出流量", + #6:"温度", + #7:"余氯信息", + #8:"浊度信息", + #9:"PH信息", + #10:"输入流量", + #11:"保留11", + #12:"保留12", + #13:"PAI0", + #14:"PAI1", + #15:"夹层温度", + #16:"站内温度", + #17:"开度反馈2", + #18:"液位2", + #19:"噪音", + #20:"湿度", + #21:"液位3", + 22:"频率输入"}}, + #模拟量输出固定为第1项 + {"alias_aioutput": {0:"无功能", + #1:"市政出水阀", + #2:"1#水箱补水阀", + #3:"2#水箱补水阀", + #4:"1#水箱出水阀", + #5:"AO1", + #6:"AO2", + 7:"运行频率", + 8:"输出电流", + 9:"通讯设定"}}, + + {"alias_str" : { + StrInfo.STR_INPUT_PASSWORD: "请输入密码", + StrInfo.STR_COMM_FAIL : "通讯故障", #// //通讯故障 + StrInfo.STR_ENTER_TO_CLEAR : "按确认清除", #// //按确认清除 + StrInfo.STR_ESC_TO_CANCEL : "按退出取消", #// //按退出取消 + StrInfo.STR_CLEAR_FINISH : "清除完成", #// //清除完成 + StrInfo.STR_MIN_VALUE : "最小值", #// + StrInfo.STR_MAX_VALUE : "最大值", #// + StrInfo.STR_NO_RECORD : "无记录", #// + StrInfo.STR_VALUE_EXCEED : "设定值越限", #// + StrInfo.STR_SET_VALUE : "设定值", #// + StrInfo.STR_INFORM_OK : "通知正常", #// + StrInfo.STR_CHECK_VOLTAGE : "检测输入电压", #// + StrInfo.STR_CHECK_SENSOR : "检测传感器", #// + StrInfo.STR_CHECK_PIPE_IN : "检测输入管道", #// + StrInfo.STR_CHECK_NONE : "无需处理", #// + StrInfo.STR_CHECK_RSV : "未知故障, 请咨询设备厂家", #// + StrInfo.STR_CHECK_VOLTAGE_PHASE : "电压相序故障", #// + StrInfo.STR_CHECK_PIPE_BROKE : "检查爆管", #// + StrInfo.STR_CHECK_WATER_SIGNAL : "检查水位型号", #// + StrInfo.STR_CHECK_PID_PARA : "检查PID参数, 或流量变化过大", #// + StrInfo.STR_CHECK_HARD_ERROR : "尝试重启, 如无效需寄回原厂返修", #// + StrInfo.STR_CHECK_LOAD : "检查水泵负载情况", #// + StrInfo.STR_CHECK_POWER_INPUT : "检查三相电源输入接线情况", #// + StrInfo.STR_CHECK_POWER_OUTPUT : "检查三相电源输出接线是否短路", #// + StrInfo.STR_CHECK_FREQ_ACC_DEC_TIME : "检查变频器加速或减速时间是否过小", #// + StrInfo.STR_CHECK_TEMPERATURE : "检查变频器通风散热情况", #// + StrInfo.STR_CHECK_FREQ_COMMUNICATE : "检查本台水泵供电是否正常", #// + StrInfo.STR_CHECK_MAIN_PUMP_LOST : "检查CAN通讯线连接. 检查1号泵是否存在", #// + StrInfo.STR_CHECK_FREQ_CONVERTER : "检查变频器是否允许通讯", #// + StrInfo.STR_CHECK_CAN_COMM : "检查CAN通讯", #// + StrInfo.STR_CHECK_FREQ_EXTERNAL_ALARM : "检查变频器与主控板接口线", #// + StrInfo.STR_CHECK_FREQ_POWER : "检查变频器供电情况", #// + StrInfo.STR_CHECK_ALARM_RESET : "故障复位中,请稍候", #// + StrInfo.STR_CHECK_PUMP_ID_CONFLICT : "检查CAN地址冲突", #// + StrInfo.STR_CHECK_PRESSURE_LOW_IO : "检查电压力节点低", #// + StrInfo.STR_CHECK_PRESSURE_HIGH_IO : "检查电压力节点高", #// + StrInfo.STR_CHECK_WATER_CONTAINER_SIGNAL : "检查水箱信号", #// + StrInfo.STR_CHECK_MOTOR_TEMPERATURE_OR_SENSOR : "电机温度过高,检查电机散热风扇或水冷回路是否正常", #// + StrInfo.STR_CHECK_BUS_POWER_SHORT : "检查总线电源是否存在短路", #// + StrInfo.STR_PUMP_NOT_FOUNT : "泵没有找到", #// + StrInfo.STR_PUMP_UPDATE_FAIL : "泵数据更新失败", #// + StrInfo.STR_PUMP_UPDATE_SUCCESS : "泵数据更新成功", #// + StrInfo.STR_PUMP_UPDATE_TIMEOUT : "泵数据更新超时", #// + StrInfo.STR_PUMP_READ_FAIL : "泵数据读取失败", #// + StrInfo.STR_PUMP_READ_SUCCESS : "泵数据读取成功", #// + StrInfo.STR_PUMP_READ_TIMEOUT : "泵数据读取超时", #// + }}, + + + + {"alias_alarm_str": + { + AlarmInfo.ALARM_FREE : "无故障", + AlarmInfo.ALARM_PIPE_BROKE : "爆管保护", + AlarmInfo.ALARM_NO_WATER_EXIST : "无水停机", + AlarmInfo.ALARM_WATER_PRESSURE_HIGH : "超压保护", + AlarmInfo.ALARM_OVER_VOLTAGE : "供电电压过高", + AlarmInfo.ALARM_UNDER_VOLTAGE : "供电电压过低", + AlarmInfo.ALARM_BOARD_HARDWARE : "硬件故障", + AlarmInfo.ALARM_IO_NO_WATER_EXIST : "市政无水停机", + AlarmInfo.ALARM_SENSOR_PRESS_IN : "入口压力传感器故障", + AlarmInfo.ALARM_SENSOR_PRESS_OUT : "出口压力传感器故障", + AlarmInfo.ALARM_SENSOR_FLUX : "流量传感器故障", + AlarmInfo.ALARM_SENSOR_PH : "PH值传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_CLEAR : "浊度传感器故障", + AlarmInfo.ALARM_SENSOR_REMAIN_CL : "余氯传感器故障", + AlarmInfo.ALARM_NEG_PRESSURE : "负压保护", + AlarmInfo.ALARM_VACUMM_PRESSURE : "真空保护", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL : "水位传感器故障", + AlarmInfo.ALARM_WATER_PRESSURE_LOW : "电接点压力低信号有效", + AlarmInfo.ALARM_SENSOR_FLUX_IN : "输入流量传感器故障", + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK : "输入阀反馈故障", + AlarmInfo.ALARM_SENSOR_NOIZE : "噪音传感器故障", + AlarmInfo.ALARM_SENSOR_HUMIDITY : "湿度传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL2 : "液位2传感器故障", + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK2 : "开度反馈2传感器故障", + AlarmInfo.ALARM_IO_LEAK_WATER : "漏水报警", + AlarmInfo.ALARM_IO_SMOKE : "烟感报警", + AlarmInfo.ALARM_IO_EXTERNALERROR : "外部故障报警", + AlarmInfo.ALARM_SENSOR_HUMIDITY : "湿度传感器故障", + AlarmInfo.ALARM_SENSOR_TEMPERATURE : "水温传感器故障", + AlarmInfo.ALARM_SENSOR_TEMPERATURE2 : "站内温度传感器故障", + AlarmInfo.ALARM_SENSOR_TEMPERATURE3 : "夹层温度传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL3 : "液位3传感器故障", + + AlarmInfo.ALARM_COMM_FREQ_CONVERTER : "变频器通讯故障", + AlarmInfo.ALARM_COMM_TOUCH_BOARD : "触控板通讯故障", + AlarmInfo.ALARM_COMM_MAIN_BOARD : "主控板通讯故障", + AlarmInfo.ALARM_PUMP_AIR_SWITCH_OFF : "空开跳闸", + AlarmInfo.ALARM_MAIN_PUMP_LOST : "主泵丢失", + AlarmInfo.ALARM_PUMP_RESET_DELAY : "泵处于故障复位状态", + AlarmInfo.ALARM_COMMAND_EXECUTE_FAIL : "泵命令执行失败", + AlarmInfo.ALARM_FREQ_PARAMETER_SET : "变频器参数设置故障", + AlarmInfo.ALARM_PUMP_ADDR_ID_CONFLICT : "泵号冲突", + AlarmInfo.ALARM_PUMP_MOTOR_TEMPERATURE_HIGH : "电机温度过高", + AlarmInfo.ALARM_BUS_POWER_SHORT : "通信电源短路", + AlarmInfo.ALARM_POWER_LOST : "本机内部失电", + AlarmInfo.ALARM_AUTO_REMOTE_DISABLE : "检测到自动停止信号", + + + AlarmInfo.ALARM_FREQ_U_PROTECT : "变频器U相保护", #//"30 //STR_ALARM_FREQ_U_PROTECT + AlarmInfo.ALARM_FREQ_V_PROTECT : "变频器V相保护", #//"31 //STR_ALARM_FREQ_V_PROTECT + AlarmInfo.ALARM_FREQ_W_PROTECT : "变频器W相保护", #//"32 //STR_ALARM_FREQ_W_PROTECT + AlarmInfo.ALARM_FREQ_ACCELERATE_OVER_CURRENT : "变频器加速过流保护", #//"33 //STR_ALARM_FREQ_ACCELERATE_OVER_CURRENT + AlarmInfo.ALARM_FREQ_DECELERATE_OVER_CURRENT : "变频器减速过流保护", #//"34 //STR_ALARM_FREQ_DECELERATE_OVER_CURRENT + AlarmInfo.ALARM_FREQ_FIX_SPEED_OVER_CURRENT : "变频器定速过流保护", #//"35 //STR_ALARM_FREQ_FIX_SPEED_OVER_CURRENT + AlarmInfo.ALARM_FREQ_ACCELERATE_OVER_VOLTAGE : "变频器加速过压保护", #//"36 //STR_ALARM_FREQ_ACCELERATE_OVER_VOLTAGE + AlarmInfo.ALARM_FREQ_DECELERATE_OVER_VOLTAGE : "变频器减速过压保护", #//"37 //STR_ALARM_FREQ_DECELERATE_OVER_VOLTAGE + AlarmInfo.ALARM_FREQ_FIX_SPEED_OVER_VOLTAGE : "变频器定速过压保护", #//"38 //STR_ALARM_FREQ_FIX_SPEED_OVER_VOLTAGE + AlarmInfo.ALARM_FREQ_DC_VOLTAGE_LOW : "变频器母线电压低", #//"39 //STR_ALARM_FREQ_DC_VOLTAGE_LOW + AlarmInfo.ALARM_FREQ_MOTOR_OVER_LOAD : "变频器电机过载", #//"40 //STR_ALARM_FREQ_MOTOR_OVER_LOAD + AlarmInfo.ALARM_FREQ_OVER_LOAD : "变频器过载", #//"41 //STR_ALARM_FREQ_OVER_LOAD + AlarmInfo.ALARM_FREQ_INPUT_MISS_PHASE : "变频器输入缺相", #//"42 //STR_ALARM_FREQ_INPUT_MISS_PHASE + AlarmInfo.ALARM_FREQ_OUTPUT_MISS_PHASE : "变频器输出缺相", #//"43 //STR_ALARM_FREQ_OUTPUT_MISS_PHASE + AlarmInfo.ALARM_FREQ_MODULE_TEMP_HIGH : "变频器温度过高", #//"44 //STR_ALARM_FREQ_MODULE_TEMP_HIGH + AlarmInfo.ALARM_FREQ_RSV45 : "保留", #//"45 //STR_ALARM_FREQ_RSV45 + AlarmInfo.ALARM_FREQ_EXTERNAL : "变频器外部故障", #//"46 //STR_ALARM_FREQ_EXTERNAL + AlarmInfo.ALARM_FREQ_COMMUNICATION : "变频器通讯故障", #//"47 //STR_ALARM_FREQ_COMMUNICATION + AlarmInfo.ALARM_FREQ_CURRENT_MEASURE : "变频器电流检测回路故障", #//"48 //STR_ALARM_FREQ_CURRENT_MEASURE + AlarmInfo.ALARM_FREQ_SELF_STUDY : "变频器自学习故障", #//"49 //STR_ALARM_FREQ_SELF_STUDY + AlarmInfo.ALARM_FREQ_EEPROM : "变频器EEPROM故障", #//"50 //STR_ALARM_FREQ_EEPROM + AlarmInfo.ALARM_FREQ_PID_FAIL : "变频器PID调节故障", #//"51 //STR_ALARM_FREQ_PID_FAIL + AlarmInfo.ALARM_FREQ_STOP_UNIT : "变频器制动单元故障", #//"52 //STR_ALARM_FREQ_STOP_UNIT + AlarmInfo.ALARM_FREQ_RSV53 : "保留", #//"53 //STR_ALARM_FREQ_RSV53 + + AlarmInfo.ALARM_FREQ_CURRENT_BASE : "电流偏置故障(CoF)", # //102 + AlarmInfo.ALARM_FREQ_ADC_FAULT : "A/D 转换器故障(CPF02)", # //103 + AlarmInfo.ALARM_FREQ_PWM_DATA_ERR : "PWM 数据异常(CPF03)", # //104 + AlarmInfo.ALARM_FREQ_EEPROM_DATA_ERR : "EEPROM 数据异常(CPF06)", # //105 + AlarmInfo.ALARM_FREQ_TERMINAL_FAULT : "端子电路板通信故障(CPF07)", # //106 + AlarmInfo.ALARM_FREQ_EEPROM_COMM_FAULT : "EEPROM 串行通信故障(CPF08)", # //107 + AlarmInfo.ALARM_FREQ_RAM_FAULT : "RAM 故障(CPF11)", # //108 + AlarmInfo.ALARM_FREQ_FLASH_FAULT : "闪存故障(CPF12)", # //109 + AlarmInfo.ALARM_FREQ_MONITOR : "监视故障(CPF13)", # //110 + AlarmInfo.ALARM_FREQ_CTRL_CIRCUIT : "控制回路故障(CPF14)", # //111 + AlarmInfo.ALARM_FREQ_CLOCK_FAULT : "时钟故障(CPF16)", # //112 + AlarmInfo.ALARM_FREQ_INTERRUPT_FAULT : "中断故障(CPF17)", # //113 + AlarmInfo.ALARM_FREQ_PWM_FBDATA_ERR : "PWM 反馈数据异常(CPF23)", # //114 + AlarmInfo.ALARM_FREQ_CAPACITY_SIGNAL : "变频器容量信号故障(CPF24)", # //115 + AlarmInfo.ALARM_FREQ_TERMINAL_NOT_CONNECT : "未连接端子电路板(CPF25)", # //116 + AlarmInfo.ALARM_FREQ_MONITOR_DEVICE : "监视装置故障(E5/CPF13)", # //117 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S1 : "外部故障(输入端子S1)(EF1)", # //118 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S2 : "外部故障(输入端子S2)(EF2)", # //119 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S3 : "外部故障(输入端子S3)(EF3)", # //120 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S4 : "外部故障(输入端子S4)(EF4)", # //121 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S5 : "外部故障(输入端子S5)(EF5)", # //122 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S6 : "外部故障(输入端子S6)(EF6)", # //123 + AlarmInfo.ALARM_FREQ_EEPROMW_WRITE_ERR : "EEPROM 写入不当(Err)", # //124 + AlarmInfo.ALARM_FREQ_PIDFB_OVERTOP : "PID 反馈超值(FbH)", # //125 + AlarmInfo.ALARM_FREQ_PID_FB_LOST : "PID 反馈丧失(FbH)", # //126 + AlarmInfo.ALARM_FREQ_GROUND_FALUT : "接地短路(GF)", # //127 + AlarmInfo.ALARM_FREQ_OUT_PHASE_LOST : "输出缺相(LF)", # //128 + AlarmInfo.ALARM_FREQ_OUT_IMBALANCE : "输出电流失衡(LF)", # //129 + AlarmInfo.ALARM_FREQ_NODE_SETUP_ERR : "Node Setup 故障(LF)", # //130 + AlarmInfo.ALARM_FREQ_OVER_CURRENT : "过电流(oC)", # //131 + AlarmInfo.ALARM_FREQ_FIN_OVER_HEAT : "散热片过热(oH/oH1)", # //132 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT1 : "电机过热警告(PTC 输入)(oH3)", # //133 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT2 : "电机过热故障(PTC 输入)(oH4)", # //134 + AlarmInfo.ALARM_FREQ_MOTOR_OVERLOAD : "电机过载(oL1)", # //135 + AlarmInfo.ALARM_FREQ_VFD_OVERLOAD : "变频器过载(oL2)", # //136 + AlarmInfo.ALARM_FREQ_OVER_TORQUE1 : "过转矩检出1(oL3)", # //137 + AlarmInfo.ALARM_FREQ_OVER_TORQUE2 : "过转矩检出2(oL4)", # //138 + AlarmInfo.ALARM_FREQ_MECHAN_AGING1 : "机械老化检出1(oL5)", # //139 + AlarmInfo.ALARM_FREQ_BREAK_OVERLOAD : "高滑差制动电机过载保护(oL7)", # //140 + AlarmInfo.ALARM_FREQ_OVER_VOLTAGE : "主回路过电压(ov)", # //141 + AlarmInfo.ALARM_FREQ_VOLTAGE_FAULT : "主回路电压故障(PF)", # //142 + AlarmInfo.ALARM_FREQ_BRAKE_TRANS : "内置制动晶体管故障(rr)", # //143 + AlarmInfo.ALARM_FREQ_OUT_SHORT : "输出短路或IGBT故障(SC)", # //144 + AlarmInfo.ALARM_FREQ_SPEED_SEARCH : "速度搜索重试故障(SC)", # //145 + AlarmInfo.ALARM_FREQ_DISORDER : "失调检出(STo)", # //146 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE1 : "转矩不足1(UL3)", # //147 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE2 : "转矩不足2(UL4)", # //148 + AlarmInfo.ALARM_FREQ_MECHAN_AGING2 : "机械老化检出2(UL5)", # //149 + AlarmInfo.ALARM_FREQ_MAJOR_UNDERVOLTAGE : "主回路欠电压(Uv/Uv1)", # //150 + AlarmInfo.ALARM_FREQ_CTRL_POW_FAULT : "控制电源故障(Uv2)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL1_ERR : "控制回路故障(CPF18)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL2_ERR : "控制回路故障(CPF19)", # //151 + AlarmInfo.ALARM_FREQ_HARD1_ERR : "硬件故障(CPF20)", # //151 + AlarmInfo.ALARM_FREQ_HARD2_ERR : "硬件故障(CPF21)", # //151 + AlarmInfo.ALARM_FREQ_ADC_ERR : "ADC故障(CPF22)", # //151 + AlarmInfo.ALARM_FREQ_PREVENT_SHOCK : "冲击防止回路故障(Uv3)", # //152 + AlarmInfo.ALARM_FREQ_BASE_BLOCK : "变频器基极封锁(bb)", # //160 + AlarmInfo.ALARM_FREQ_COMM_WAITING : "通信等待中(CALL)", # //161 + AlarmInfo.ALARM_FREQ_RST_WHEN_RUN : "运行指令输入中复位(CrST)", # //162 + AlarmInfo.ALARM_FREQ_COMM_CYCLE_ERR : "通信周期设定错误(CyC)", # //163 + AlarmInfo.ALARM_FREQ_DRIVE_DISABLE : "Drive Disable中(dnE)", # //164 + AlarmInfo.ALARM_FREQ_CW_CCW_CMD : "正反转指令同时输入(EF)", # //165: " + AlarmInfo.ALARM_FREQ_CURRENT_WARNING : "电流警告(HCA)", # //166 + AlarmInfo.ALARM_FREQ_MAINTAIN_FAN : "冷却风扇维护时期(LT-1)", # //167 + AlarmInfo.ALARM_FREQ_MAINTAIN_CAP : "电容器维护时期(LT-2)", # //168 + AlarmInfo.ALARM_FREQ_MAINTAIN_RELAY : "冲击电流防止继电器维护时期(LT-3)", # //169 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_50 : "IGBT维护时期(50%)(LT-4)", # //170 + AlarmInfo.ALARM_FREQ_VFD_OH_ALERT : "变频器过热预警(oH2)", # //171 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT : "电机过热(oH3)", # //172 + AlarmInfo.ALARM_FREQ_RSV173 : "保留", # //173 + AlarmInfo.ALARM_FREQ_RSV174 : "保留", # //174 + + AlarmInfo.ALARM_FREQ_MOBUS_TEST_OK : "MEMOBUS通信测试模式正常(PASS)", # //175 + AlarmInfo.ALARM_FREQ_SWITCH_WHEN_RUN : "运行中输入电机切换指令(rUn)", # //176 + AlarmInfo.ALARM_FREQ_MOBUS_TEST_ERR : "MEMOBUS通信测试模式故障(SE)", # //177 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_90 : "IGBT维护时期(90%)(TrPC)", # //178 + AlarmInfo.ALARM_FREQ_RSV179 : "保留", # //179 + AlarmInfo.ALARM_FREQ_RSV180 : "保留", # //180 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : "变频器容量的设定故障(oPE01)", # //181 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : "参数设定范围不当(oPE02)", # //182 + AlarmInfo.ALARM_FREQ_DIN_SELECT_ERR : "多功能输入的选择不当(oPE03)", # //183 + AlarmInfo.ALARM_FREQ_AIN_SELECT_ERR : "多功能模拟量输入的选择不当(oPE07)", # //184 + AlarmInfo.ALARM_FREQ_PARA_SELECT_ERR : "参数选择不当(oPE08)", # //182 + AlarmInfo.ALARM_FREQ_PID_SELECT_ERR : "PID控制的选择不当(oPE09)", # //183 + AlarmInfo.ALARM_FREQ_VF_DATA_SET_ERR : "V/f数据的设定不当(oPE10)", # //184 + AlarmInfo.ALARM_FREQ_CARRIER_SET_ERR : "载波频率的设定不当(oPE11)", # //182 + + AlarmInfo.USER_LOCAL_ALARM_0 : "本机报警0", + AlarmInfo.USER_LOCAL_ALARM_1 : "本机报警1", + AlarmInfo.USER_LOCAL_ALARM_2 : "本机报警2", + AlarmInfo.USER_LOCAL_ALARM_3 : "本机报警3", + AlarmInfo.USER_LOCAL_ALARM_4 : "本机报警4", + AlarmInfo.USER_LOCAL_ALARM_5 : "本机报警5", + AlarmInfo.USER_LOCAL_ALARM_6 : "本机报警6", + AlarmInfo.USER_LOCAL_ALARM_7 : "本机报警7", + AlarmInfo.USER_LOCAL_ALARM_8 : "本机报警8", + AlarmInfo.USER_LOCAL_ALARM_9 : "本机报警9", + AlarmInfo.USER_LOCAL_ALARM_10 : "本机报警10", + AlarmInfo.USER_LOCAL_ALARM_11 : "本机报警11", + AlarmInfo.USER_LOCAL_ALARM_12 : "本机报警12", + AlarmInfo.USER_LOCAL_ALARM_13 : "本机报警13", + AlarmInfo.USER_LOCAL_ALARM_14 : "本机报警14", + AlarmInfo.USER_LOCAL_ALARM_15 : "本机报警15", + + AlarmInfo.USER_GLOBAL_ALARM_0 : "全局报警0", + AlarmInfo.USER_GLOBAL_ALARM_1 : "全局报警1", + AlarmInfo.USER_GLOBAL_ALARM_2 : "全局报警2", + AlarmInfo.USER_GLOBAL_ALARM_3 : "全局报警3", + AlarmInfo.USER_GLOBAL_ALARM_4 : "全局报警4", + AlarmInfo.USER_GLOBAL_ALARM_5 : "全局报警5", + AlarmInfo.USER_GLOBAL_ALARM_6 : "全局报警6", + AlarmInfo.USER_GLOBAL_ALARM_7 : "全局报警7", + AlarmInfo.USER_GLOBAL_ALARM_8 : "全局报警8", + AlarmInfo.USER_GLOBAL_ALARM_9 : "全局报警9", + AlarmInfo.USER_GLOBAL_ALARM_10 : "全局报警10", + AlarmInfo.USER_GLOBAL_ALARM_11 : "全局报警11", + AlarmInfo.USER_GLOBAL_ALARM_12 : "全局报警12", + AlarmInfo.USER_GLOBAL_ALARM_13 : "全局报警13", + AlarmInfo.USER_GLOBAL_ALARM_14 : "全局报警14", + AlarmInfo.USER_GLOBAL_ALARM_15 : "全局报警15", + + AlarmInfo.USER_LOCAL_WARNING_0 : "本机警告0", + AlarmInfo.USER_LOCAL_WARNING_1 : "本机警告1", + AlarmInfo.USER_LOCAL_WARNING_2 : "本机警告2", + AlarmInfo.USER_LOCAL_WARNING_3 : "本机警告3", + AlarmInfo.USER_LOCAL_WARNING_4 : "本机警告4", + AlarmInfo.USER_LOCAL_WARNING_5 : "本机警告5", + AlarmInfo.USER_LOCAL_WARNING_6 : "本机警告6", + AlarmInfo.USER_LOCAL_WARNING_7 : "本机警告7", + AlarmInfo.USER_LOCAL_WARNING_8 : "本机警告8", + AlarmInfo.USER_LOCAL_WARNING_9 : "本机警告9", + AlarmInfo.USER_LOCAL_WARNING_10 : "本机警告10", + AlarmInfo.USER_LOCAL_WARNING_11 : "本机警告11", + AlarmInfo.USER_LOCAL_WARNING_12 : "本机警告12", + AlarmInfo.USER_LOCAL_WARNING_13 : "本机警告13", + AlarmInfo.USER_LOCAL_WARNING_14 : "本机警告14", + AlarmInfo.USER_LOCAL_WARNING_15 : "本机警告15", + }}, + + {"alias_alarm_cause": + { + AlarmInfo.ALARM_FREE : "无", + AlarmInfo.ALARM_PIPE_BROKE : "1. 系统管路泄漏@2. 输出压力传感器故障@3. 阀门开度太大", + AlarmInfo.ALARM_NO_WATER_EXIST : "1. 进水口无水或水压极低@2. 线路松动@3. 进水压力低于设定值@4. 模拟量异常或未校正,导到实系统压力值与实际压不一个致@5. 传感器故障", + AlarmInfo.ALARM_WATER_PRESSURE_HIGH : "1. 出水口水压过高@2. 线路松动@3. 电接点压力表设置不合理或故障4. 最低转速过高@5. 模拟量异常或未校正,导到系统压力值与实际压不一个致@6. 传感器故障", + AlarmInfo.ALARM_OVER_VOLTAGE : "1. 380V某一相(或几相)电压过高@2. 变频器故障", + AlarmInfo.ALARM_UNDER_VOLTAGE : "1. 380V某一相(或几相)电压过低@2. 变频器故障", + AlarmInfo.ALARM_BOARD_HARDWARE : "1. 需专业人员检修或更换控制器", + AlarmInfo.ALARM_IO_NO_WATER_EXIST : "1. 进水口无水或水压极低", + AlarmInfo.ALARM_SENSOR_PRESS_IN : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_PRESS_OUT : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_FLUX : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_PH : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_WATER_CLEAR : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_REMAIN_CL : STR_SensorFailCause, + AlarmInfo.ALARM_NEG_PRESSURE : "1. 进水口无水或水压极低@2. 线路松动@3. 进水压力低于设定值,@4. 模拟量异常或未校正,导到系统压力值与实际压不一个致@5. 传感器故障", + AlarmInfo.ALARM_VACUMM_PRESSURE : "1. 进水口无水或水压极低@2. 线路松动@3. 进水压力低于设定值,@4. 模拟量异常或未校正,导到实系统压力值与实际压不一个致@5. 传感器故障", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL : STR_SensorFailCause, + AlarmInfo.ALARM_WATER_PRESSURE_LOW : "1. 并非故障,仅作提示@2. 电接点压力表低压设定值过大", + AlarmInfo.ALARM_SENSOR_FLUX_IN : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK : "1. 调节阀故障@2. 模拟量口故障@3. 通信电缆的接线不正确,或发生短路、断线", + AlarmInfo.ALARM_SENSOR_NOIZE : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL2 : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK2 : STR_SensorFailCause, + AlarmInfo.ALARM_IO_LEAK_WATER : "1. 检测到漏水信号", + AlarmInfo.ALARM_IO_SMOKE : "1. 检测到烟感信号", + AlarmInfo.ALARM_IO_EXTERNALERROR : "1. 检测到外部故障信号", + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_TEMPERATURE : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_TEMPERATURE2 : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_TEMPERATURE3 : STR_SensorFailCause, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL3 : STR_SensorFailCause, + + AlarmInfo.ALARM_COMM_FREQ_CONVERTER : "1. 通信电缆断线、接触不良@2. 通信参数不匹配@3. 受到干扰@4. 变频器型号选择错误", + AlarmInfo.ALARM_COMM_TOUCH_BOARD : EMPTY_STRING, + AlarmInfo.ALARM_COMM_MAIN_BOARD : "1. 线路松动、硬件故障、干扰", + AlarmInfo.ALARM_PUMP_AIR_SWITCH_OFF : EMPTY_STRING, + AlarmInfo.ALARM_MAIN_PUMP_LOST : "1. 未设置1号泵@2. 1号泵未上电@3. 1号泵已损坏@4.通信电缆的接线短路或断线@5.干扰导致通信数据发生故障", + AlarmInfo.ALARM_PUMP_RESET_DELAY : EMPTY_STRING, + AlarmInfo.ALARM_COMMAND_EXECUTE_FAIL : EMPTY_STRING, + AlarmInfo.ALARM_FREQ_PARAMETER_SET : EMPTY_STRING, + AlarmInfo.ALARM_PUMP_ADDR_ID_CONFLICT : "1. 设置了两台相同泵号", + AlarmInfo.ALARM_PUMP_MOTOR_TEMPERATURE_HIGH : "1. 冷却水量少@2. 电机故障", + AlarmInfo.ALARM_BUS_POWER_SHORT : "1. 通信电缆的接线不正确,或发生短路", + AlarmInfo.ALARM_POWER_LOST : "1. 380V电源未上电 ", + AlarmInfo.ALARM_AUTO_REMOTE_DISABLE : "1. 取消自动停止信号 @2. IO配置取消自动停止配置", + + AlarmInfo.ALARM_FREQ_CURRENT_BASE : STR_FreqErrRef, #//电流偏置故障(CoF)", # //102 + AlarmInfo.ALARM_FREQ_ADC_FAULT : STR_FreqErrRef, #//A/D 转换器故障(CPF02)", # //103 + AlarmInfo.ALARM_FREQ_PWM_DATA_ERR : STR_FreqErrRef, #//PWM 数据异常(CPF03)", # //104 + AlarmInfo.ALARM_FREQ_EEPROM_DATA_ERR : STR_FreqErrRef, #//EEPROM 数据异常(CPF06)", # //105 + AlarmInfo.ALARM_FREQ_TERMINAL_FAULT : STR_FreqErrRef, #//端子电路板通信故障(CPF07)", # //106 + AlarmInfo.ALARM_FREQ_EEPROM_COMM_FAULT : STR_FreqErrRef, #//EEPROM 串行通信故障(CPF08)", # //107 + AlarmInfo.ALARM_FREQ_RAM_FAULT : STR_FreqErrRef, #//RAM 故障(CPF11)", # //108 + AlarmInfo.ALARM_FREQ_FLASH_FAULT : STR_FreqErrRef, #//闪存故障(CPF12)", # //109 + AlarmInfo.ALARM_FREQ_MONITOR : STR_FreqErrRef, #//监视故障(CPF13)", # //110 + AlarmInfo.ALARM_FREQ_CTRL_CIRCUIT : STR_FreqErrRef, #//控制回路故障(CPF14)", # //111 + AlarmInfo.ALARM_FREQ_CLOCK_FAULT : STR_FreqErrRef, #//时钟故障(CPF16)", # //112 + AlarmInfo.ALARM_FREQ_INTERRUPT_FAULT : STR_FreqErrRef, #//中断故障(CPF17)", # //113 + AlarmInfo.ALARM_FREQ_PWM_FBDATA_ERR : STR_FreqErrRef, #//PWM 反馈数据异常(CPF23)", # //114 + AlarmInfo.ALARM_FREQ_CAPACITY_SIGNAL : STR_FreqErrRef, #//变频器容量信号故障(CPF24)", # //115 + AlarmInfo.ALARM_FREQ_TERMINAL_NOT_CONNECT : STR_FreqErrRef, #//未连接端子电路板(CPF25)", # //116 + AlarmInfo.ALARM_FREQ_MONITOR_DEVICE : STR_FreqErrRef, #//监视装置故障(E5/CPF13)", # //117 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S1 : STR_FreqErrRef, #//外部故障(输入端子S1)(EF1)", # //118 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S2 : STR_FreqErrRef, #//外部故障(输入端子S2)(EF2)", # //119 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S3 : STR_FreqErrRef, #//外部故障(输入端子S3)(EF3)", # //120 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S4 : STR_FreqErrRef, #//外部故障(输入端子S4)(EF4)", # //121 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S5 : STR_FreqErrRef, #//外部故障(输入端子S5)(EF5)", # //122 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S6 : STR_FreqErrRef, #//外部故障(输入端子S6)(EF6)", # //123 + AlarmInfo.ALARM_FREQ_EEPROMW_WRITE_ERR : STR_FreqErrRef, #//EEPROM 写入不当(Err)", # //124 + AlarmInfo.ALARM_FREQ_PIDFB_OVERTOP : STR_FreqErrRef, #//PID 反馈超值(FbH)", # //125 + AlarmInfo.ALARM_FREQ_PID_FB_LOST : STR_FreqErrRef, #//PID 反馈丧失(FbH)", # //126 + AlarmInfo.ALARM_FREQ_GROUND_FALUT : STR_FreqErrRef, #//接地短路(GF)", # //127 + AlarmInfo.ALARM_FREQ_OUT_PHASE_LOST : STR_FreqErrRef, #//输出缺相(LF)", # //128 + AlarmInfo.ALARM_FREQ_OUT_IMBALANCE : STR_FreqErrRef, #//输出电流失衡(LF)", # //129 + AlarmInfo.ALARM_FREQ_NODE_SETUP_ERR : STR_FreqErrRef, #//Node Setup 故障(LF)", # //130 + AlarmInfo.ALARM_FREQ_OVER_CURRENT : STR_FreqErrRef, #//过电流(oC)", # //131 + AlarmInfo.ALARM_FREQ_FIN_OVER_HEAT : STR_FreqErrRef, #//散热片过热(oH/oH1)", # //132 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT1 : STR_FreqErrRef, #//电机过热警告(PTC 输入)(oH3)", # //133 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT2 : STR_FreqErrRef, #//电机过热故障(PTC 输入)(oH4)", # //134 + AlarmInfo.ALARM_FREQ_MOTOR_OVERLOAD : STR_FreqErrRef, #//电机过载(oL1)", # //135 + AlarmInfo.ALARM_FREQ_VFD_OVERLOAD : STR_FreqErrRef, #//变频器过载(oL2)", # //136 + AlarmInfo.ALARM_FREQ_OVER_TORQUE1 : STR_FreqErrRef, #//过转矩检出1(oL3)", # //137 + AlarmInfo.ALARM_FREQ_OVER_TORQUE2 : STR_FreqErrRef, #//过转矩检出2(oL4)", # //138 + AlarmInfo.ALARM_FREQ_MECHAN_AGING1 : STR_FreqErrRef, #//机械老化检出1(oL5)", # //139 + AlarmInfo.ALARM_FREQ_BREAK_OVERLOAD : STR_FreqErrRef, #//高滑差制动电机过载保护(oL7)", # //140 + AlarmInfo.ALARM_FREQ_OVER_VOLTAGE : STR_FreqErrRef, #//主回路过电压(ov)", # //141 + AlarmInfo.ALARM_FREQ_VOLTAGE_FAULT : STR_FreqErrRef, #//主回路电压故障(PF)", # //142 + AlarmInfo.ALARM_FREQ_BRAKE_TRANS : STR_FreqErrRef, #//内置制动晶体管故障(rr)", # //143 + AlarmInfo.ALARM_FREQ_OUT_SHORT : STR_FreqErrRef, #//输出短路或IGBT故障(SC)", # //144 + AlarmInfo.ALARM_FREQ_SPEED_SEARCH : STR_FreqErrRef, #//速度搜索重试故障(SC)", # //145 + AlarmInfo.ALARM_FREQ_DISORDER : STR_FreqErrRef, #//失调检出(STo)", # //146 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE1 : STR_FreqErrRef, #//转矩不足1(UL3)", # //147 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE2 : STR_FreqErrRef, #//转矩不足2(UL4)", # //148 + AlarmInfo.ALARM_FREQ_MECHAN_AGING2 : STR_FreqErrRef, #//机械老化检出2(UL5)", # //149 + AlarmInfo.ALARM_FREQ_MAJOR_UNDERVOLTAGE : STR_FreqErrRef, #//主回路欠电压(Uv/Uv1)", # //150 + AlarmInfo.ALARM_FREQ_CTRL_POW_FAULT : STR_FreqErrRef, #//控制电源故障(Uv2)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL1_ERR : STR_FreqErrRef, #//控制回路故障(CPF18)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL2_ERR : STR_FreqErrRef, #//控制回路故障(CPF19)", # //151 + AlarmInfo.ALARM_FREQ_HARD1_ERR : STR_FreqErrRef, #//硬件故障(CPF20)", # //151 + AlarmInfo.ALARM_FREQ_HARD2_ERR : STR_FreqErrRef, #//硬件故障(CPF21)", # //151 + AlarmInfo.ALARM_FREQ_ADC_ERR : STR_FreqErrRef, #//ADC故障(CPF22)", # //151 + AlarmInfo.ALARM_FREQ_PREVENT_SHOCK : STR_FreqErrRef, #//冲击防止回路故障(Uv3)", # //152 + AlarmInfo.ALARM_FREQ_BASE_BLOCK : STR_FreqErrRef, #//变频器基极封锁(bb)", # //160 + AlarmInfo.ALARM_FREQ_COMM_WAITING : STR_FreqErrRef, #//通信等待中(CALL)", # //161 + AlarmInfo.ALARM_FREQ_RST_WHEN_RUN : STR_FreqErrRef, #//运行指令输入中复位(CrST)", # //162 + AlarmInfo.ALARM_FREQ_COMM_CYCLE_ERR : STR_FreqErrRef, #//通信周期设定错误(CyC)", # //163 + AlarmInfo.ALARM_FREQ_DRIVE_DISABLE : STR_FreqErrRef, #//Drive Disable中(dnE)", # //164 + AlarmInfo.ALARM_FREQ_CW_CCW_CMD : STR_FreqErrRef, #//正反转指令同时输入(EF)", # //165 + AlarmInfo.ALARM_FREQ_CURRENT_WARNING : STR_FreqErrRef, #//电流警告(HCA)", # //166 + AlarmInfo.ALARM_FREQ_MAINTAIN_FAN : STR_FreqErrRef, #//冷却风扇维护时期(LT-1)", # //167 + AlarmInfo.ALARM_FREQ_MAINTAIN_CAP : STR_FreqErrRef, #//电容器维护时期(LT-2)", # //168 + AlarmInfo.ALARM_FREQ_MAINTAIN_RELAY : STR_FreqErrRef, #//冲击电流防止继电器维护时期(LT-3)", # //169 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_50 : STR_FreqErrRef, #//IGBT维护时期(50%)(LT-4)", # //170 + AlarmInfo.ALARM_FREQ_VFD_OH_ALERT : STR_FreqErrRef, #//变频器过热预警(oH2)", # //171 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT : STR_FreqErrRef, #//电机过热(oH3)", # //172 + AlarmInfo.ALARM_FREQ_RSV173 : STR_FreqErrRef, #//保留", # //173 + AlarmInfo.ALARM_FREQ_RSV174 : STR_FreqErrRef, #//保留", # //174 + + AlarmInfo.ALARM_FREQ_MOBUS_TEST_OK : "正在进行通信测试", # //175 + AlarmInfo.ALARM_FREQ_SWITCH_WHEN_RUN : STR_FreqErrRef, #//运行中输入电机切换指令(rUn)", # //176 + AlarmInfo.ALARM_FREQ_MOBUS_TEST_ERR : STR_FreqErrRef, #//MEMOBUS通信测试模式故障(SE)", # //177 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_90 : STR_FreqErrRef, #//IGBT维护时期(90%)(TrPC)", # //178 + AlarmInfo.ALARM_FREQ_RSV179 : STR_FreqErrRef, #//保留", # //179 + AlarmInfo.ALARM_FREQ_RSV180 : STR_FreqErrRef, #//保留", # //180 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//变频器容量的设定故障(oPE01)", # //181 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//参数设定范围不当(oPE02)", # //182 + AlarmInfo.ALARM_FREQ_DIN_SELECT_ERR : STR_FreqErrRef, #//多功能输入的选择不当(oPE03)", # //183 + AlarmInfo.ALARM_FREQ_AIN_SELECT_ERR : STR_FreqErrRef, #//多功能模拟量输入的选择不当(oPE07)", # //184 + AlarmInfo.ALARM_FREQ_PARA_SELECT_ERR : STR_FreqErrRef, #//参数选择不当(oPE08)", # //182 + AlarmInfo.ALARM_FREQ_PID_SELECT_ERR : STR_FreqErrRef, #//PID控制的选择不当(oPE09)", # //183 + AlarmInfo.ALARM_FREQ_VF_DATA_SET_ERR : STR_FreqErrRef, #//V/f数据的设定不当(oPE10)", # //184 + AlarmInfo.ALARM_FREQ_CARRIER_SET_ERR : STR_FreqErrRef, #//载波频率的设定不当(oPE11)", # //182 + + }}, + + {"alias_alarm_help": + { + AlarmInfo.ALARM_FREE : "无", + AlarmInfo.ALARM_PIPE_BROKE : "1. 管路修复@2. 检查传感器线路及更换传感器@3. 配置更大流量的泵或减少阀门开度", + AlarmInfo.ALARM_NO_WATER_EXIST : "1. 有水后自动解除故障@2. 检查传感器线路@3. @4. 出水压力显示是否正常,进行参数校正@5. 检查进水压力传感器是否正常", + AlarmInfo.ALARM_WATER_PRESSURE_HIGH : "1. 水压降低后自动解除@2. 检查传感器线路@3. 检查出水电接点压力表是否正常。n\4. 变频器最小频率是否合理。@5. 出水压力显示是否正常,进行参数校正@6. 出水传感器是否正常。", + AlarmInfo.ALARM_OVER_VOLTAGE : "1. 检查380V三相电压@2. 更换变频器", + AlarmInfo.ALARM_UNDER_VOLTAGE : "1. 检查380V三相电压@2. 更换变频器", + AlarmInfo.ALARM_BOARD_HARDWARE : "1. 更换电机", + AlarmInfo.ALARM_IO_NO_WATER_EXIST : "1. 有水后自动解除故障", + AlarmInfo.ALARM_SENSOR_PRESS_IN : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_PRESS_OUT : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_FLUX : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_PH : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_WATER_CLEAR : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_REMAIN_CL : STR_SensorFailProcess, + AlarmInfo.ALARM_NEG_PRESSURE : "1. 有水后自动解除故障@2. 检查传感器线路@3. 检查设置是否合理,@4. 出水压力显示是否正常,进行参数校正@5. 检查进水压力传感器是否正常", + AlarmInfo.ALARM_VACUMM_PRESSURE : "1. 有水后自动解除故障@2. 检查传感器线路@3. 检查设置是否合理,@4. 出水压力显示是否正常,进行参数校正@5. 检查进水压力传感器是否正常", + AlarmInfo.ALARM_SENSOR_WATER_LEVEL : STR_SensorFailProcess, + AlarmInfo.ALARM_WATER_PRESSURE_LOW : "1. 无需处理@2. 检查电接点压力表设定值", + AlarmInfo.ALARM_SENSOR_FLUX_IN : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK : "1. 更换调节阀@2. 更换电机@3. 检查调节阀是否断线或损坏。", + AlarmInfo.ALARM_SENSOR_NOIZE : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL2 : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_IN_VALVE_FEEDBACK2 : STR_SensorFailProcess, + AlarmInfo.ALARM_IO_LEAK_WATER : "1. 漏水信号消除后自动解除故障", + AlarmInfo.ALARM_IO_SMOKE : "1. 烟感信号消除后自动解除故障", + AlarmInfo.ALARM_IO_EXTERNALERROR : "1. 外部故障信号消除后自动解除故障", + AlarmInfo.ALARM_SENSOR_HUMIDITY : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_TEMPERATURE : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_TEMPERATURE2 : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_TEMPERATURE3 : STR_SensorFailProcess, + AlarmInfo.ALARM_SENSOR_WATER_LEVEL3 : STR_SensorFailProcess, + + AlarmInfo.ALARM_COMM_FREQ_CONVERTER : "1. 检查通信电缆和接线@2. 检查波特率等通信参数的设置@3. 排除干扰,详见说明书@4. 修改 系统信息>变频器型号", + AlarmInfo.ALARM_COMM_TOUCH_BOARD : EMPTY_STRING, + AlarmInfo.ALARM_COMM_MAIN_BOARD : "1. 检查是否存在干扰现象。", + AlarmInfo.ALARM_PUMP_AIR_SWITCH_OFF : EMPTY_STRING, + AlarmInfo.ALARM_MAIN_PUMP_LOST : "1. 设置一台水泵为1号泵@2. 检查电源@3. 把原1号泵断开连接, 重新设置一台1号泵@4. 检查CAN通讯线束@5. 确认抗干扰对策的状况。@6. 检查控制回路的接线、主回路接地线", + AlarmInfo.ALARM_PUMP_RESET_DELAY : EMPTY_STRING, + AlarmInfo.ALARM_COMMAND_EXECUTE_FAIL : EMPTY_STRING, + AlarmInfo.ALARM_FREQ_PARAMETER_SET : EMPTY_STRING, + AlarmInfo.ALARM_PUMP_ADDR_ID_CONFLICT : "1. 检查泵号设置", + AlarmInfo.ALARM_PUMP_MOTOR_TEMPERATURE_HIGH : "1. 调整减压阀,加大冷却水流量@2. 清洗减压阀过滤网@3. 更换电机", + AlarmInfo.ALARM_BUS_POWER_SHORT : "1. 检查CAN通讯线束", + AlarmInfo.ALARM_POWER_LOST : "1. 检查380V电源是否打开@2.检查线路是否松动", + AlarmInfo.ALARM_AUTO_REMOTE_DISABLE : "1. 把泵改成手动状态, 解除故障", + + AlarmInfo.ALARM_FREQ_CURRENT_BASE : STR_FreqErrRef, #//电流偏置故障(CoF)", # //102 + AlarmInfo.ALARM_FREQ_ADC_FAULT : STR_FreqErrRef, #//A/D 转换器故障(CPF02)", # //103 + AlarmInfo.ALARM_FREQ_PWM_DATA_ERR : STR_FreqErrRef, #//PWM 数据异常(CPF03)", # //104 + AlarmInfo.ALARM_FREQ_EEPROM_DATA_ERR : STR_FreqErrRef, #//EEPROM 数据异常(CPF06)", # //105 + AlarmInfo.ALARM_FREQ_TERMINAL_FAULT : STR_FreqErrRef, #//端子电路板通信故障(CPF07)", # //106 + AlarmInfo.ALARM_FREQ_EEPROM_COMM_FAULT : STR_FreqErrRef, #//EEPROM 串行通信故障(CPF08)", # //107 + AlarmInfo.ALARM_FREQ_RAM_FAULT : STR_FreqErrRef, #//RAM 故障(CPF11)", # //108 + AlarmInfo.ALARM_FREQ_FLASH_FAULT : STR_FreqErrRef, #//闪存故障(CPF12)", # //109 + AlarmInfo.ALARM_FREQ_MONITOR : STR_FreqErrRef, #//监视故障(CPF13)", # //110 + AlarmInfo.ALARM_FREQ_CTRL_CIRCUIT : STR_FreqErrRef, #//控制回路故障(CPF14)", # //111 + AlarmInfo.ALARM_FREQ_CLOCK_FAULT : STR_FreqErrRef, #//时钟故障(CPF16)", # //112 + AlarmInfo.ALARM_FREQ_INTERRUPT_FAULT : STR_FreqErrRef, #//中断故障(CPF17)", # //113 + AlarmInfo.ALARM_FREQ_PWM_FBDATA_ERR : STR_FreqErrRef, #//PWM 反馈数据异常(CPF23)", # //114 + AlarmInfo.ALARM_FREQ_CAPACITY_SIGNAL : STR_FreqErrRef, #//变频器容量信号故障(CPF24)", # //115 + AlarmInfo.ALARM_FREQ_TERMINAL_NOT_CONNECT : STR_FreqErrRef, #//未连接端子电路板(CPF25)", # //116 + AlarmInfo.ALARM_FREQ_MONITOR_DEVICE : STR_FreqErrRef, #//监视装置故障(E5/CPF13)", # //117 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S1 : STR_FreqErrRef, #//外部故障(输入端子S1)(EF1)", # //118 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S2 : STR_FreqErrRef, #//外部故障(输入端子S2)(EF2)", # //119 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S3 : STR_FreqErrRef, #//外部故障(输入端子S3)(EF3)", # //120 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S4 : STR_FreqErrRef, #//外部故障(输入端子S4)(EF4)", # //121 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S5 : STR_FreqErrRef, #//外部故障(输入端子S5)(EF5)", # //122 + AlarmInfo.ALARM_FREQ_EXTERN_FAULT_S6 : STR_FreqErrRef, #//外部故障(输入端子S6)(EF6)", # //123 + AlarmInfo.ALARM_FREQ_EEPROMW_WRITE_ERR : STR_FreqErrRef, #//EEPROM 写入不当(Err)", # //124 + AlarmInfo.ALARM_FREQ_PIDFB_OVERTOP : STR_FreqErrRef, #//PID 反馈超值(FbH)", # //125 + AlarmInfo.ALARM_FREQ_PID_FB_LOST : STR_FreqErrRef, #//PID 反馈丧失(FbH)", # //126 + AlarmInfo.ALARM_FREQ_GROUND_FALUT : STR_FreqErrRef, #//接地短路(GF)", # //127 + AlarmInfo.ALARM_FREQ_OUT_PHASE_LOST : STR_FreqErrRef, #//输出缺相(LF)", # //128 + AlarmInfo.ALARM_FREQ_OUT_IMBALANCE : STR_FreqErrRef, #//输出电流失衡(LF)", # //129 + AlarmInfo.ALARM_FREQ_NODE_SETUP_ERR : STR_FreqErrRef, #//Node Setup 故障(LF)", # //130 + AlarmInfo.ALARM_FREQ_OVER_CURRENT : STR_FreqErrRef, #//过电流(oC)", # //131 + AlarmInfo.ALARM_FREQ_FIN_OVER_HEAT : STR_FreqErrRef, #//散热片过热(oH/oH1)", # //132 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT1 : STR_FreqErrRef, #//电机过热警告(PTC 输入)(oH3)", # //133 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT2 : STR_FreqErrRef, #//电机过热故障(PTC 输入)(oH4)", # //134 + AlarmInfo.ALARM_FREQ_MOTOR_OVERLOAD : STR_FreqErrRef, #//电机过载(oL1)", # //135 + AlarmInfo.ALARM_FREQ_VFD_OVERLOAD : STR_FreqErrRef, #//变频器过载(oL2)", # //136 + AlarmInfo.ALARM_FREQ_OVER_TORQUE1 : STR_FreqErrRef, #//过转矩检出1(oL3)", # //137 + AlarmInfo.ALARM_FREQ_OVER_TORQUE2 : STR_FreqErrRef, #//过转矩检出2(oL4)", # //138 + AlarmInfo.ALARM_FREQ_MECHAN_AGING1 : STR_FreqErrRef, #//机械老化检出1(oL5)", # //139 + AlarmInfo.ALARM_FREQ_BREAK_OVERLOAD : STR_FreqErrRef, #//高滑差制动电机过载保护(oL7)", # //140 + AlarmInfo.ALARM_FREQ_OVER_VOLTAGE : STR_FreqErrRef, #//主回路过电压(ov)", # //141 + AlarmInfo.ALARM_FREQ_VOLTAGE_FAULT : STR_FreqErrRef, #//主回路电压故障(PF)", # //142 + AlarmInfo.ALARM_FREQ_BRAKE_TRANS : STR_FreqErrRef, #//内置制动晶体管故障(rr)", # //143 + AlarmInfo.ALARM_FREQ_OUT_SHORT : STR_FreqErrRef, #//输出短路或IGBT故障(SC)", # //144 + AlarmInfo.ALARM_FREQ_SPEED_SEARCH : STR_FreqErrRef, #//速度搜索重试故障(SC)", # //145 + AlarmInfo.ALARM_FREQ_DISORDER : STR_FreqErrRef, #//失调检出(STo)", # //146 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE1 : STR_FreqErrRef, #//转矩不足1(UL3)", # //147 + AlarmInfo.ALARM_FREQ_LACK_OF_TORQUE2 : STR_FreqErrRef, #//转矩不足2(UL4)", # //148 + AlarmInfo.ALARM_FREQ_MECHAN_AGING2 : STR_FreqErrRef, #//机械老化检出2(UL5)", # //149 + AlarmInfo.ALARM_FREQ_MAJOR_UNDERVOLTAGE : STR_FreqErrRef, #//主回路欠电压(Uv/Uv1)", # //150 + AlarmInfo.ALARM_FREQ_CTRL_POW_FAULT : STR_FreqErrRef, #//控制电源故障(Uv2)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL1_ERR : STR_FreqErrRef, #//控制回路故障(CPF18)", # //151 + AlarmInfo.ALARM_FREQ_CONTROL2_ERR : STR_FreqErrRef, #//控制回路故障(CPF19)", # //151 + AlarmInfo.ALARM_FREQ_HARD1_ERR : STR_FreqErrRef, #//硬件故障(CPF20)", # //151 + AlarmInfo.ALARM_FREQ_HARD2_ERR : STR_FreqErrRef, #//硬件故障(CPF21)", # //151 + AlarmInfo.ALARM_FREQ_ADC_ERR : STR_FreqErrRef, #//ADC故障(CPF22)", # //151 + AlarmInfo.ALARM_FREQ_PREVENT_SHOCK : STR_FreqErrRef, #//冲击防止回路故障(Uv3)", # //152 + AlarmInfo.ALARM_FREQ_BASE_BLOCK : STR_FreqErrRef, #//变频器基极封锁(bb)", # //160 + AlarmInfo.ALARM_FREQ_COMM_WAITING : STR_FreqErrRef, #//通信等待中(CALL)", # //161 + AlarmInfo.ALARM_FREQ_RST_WHEN_RUN : STR_FreqErrRef, #//运行指令输入中复位(CrST)", # //162 + AlarmInfo.ALARM_FREQ_COMM_CYCLE_ERR : STR_FreqErrRef, #//通信周期设定错误(CyC)", # //163 + AlarmInfo.ALARM_FREQ_DRIVE_DISABLE : STR_FreqErrRef, #//Drive Disable中(dnE)", # //164 + AlarmInfo.ALARM_FREQ_CW_CCW_CMD : STR_FreqErrRef, #//正反转指令同时输入(EF)", # //165 + AlarmInfo.ALARM_FREQ_CURRENT_WARNING : STR_FreqErrRef, #//电流警告(HCA)", # //166 + AlarmInfo.ALARM_FREQ_MAINTAIN_FAN : STR_FreqErrRef, #//冷却风扇维护时期(LT-1)", # //167 + AlarmInfo.ALARM_FREQ_MAINTAIN_CAP : STR_FreqErrRef, #//电容器维护时期(LT-2)", # //168 + AlarmInfo.ALARM_FREQ_MAINTAIN_RELAY : STR_FreqErrRef, #//冲击电流防止继电器维护时期(LT-3)", # //169 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_50 : STR_FreqErrRef, #//IGBT维护时期(50%)(LT-4)", # //170 + AlarmInfo.ALARM_FREQ_VFD_OH_ALERT : STR_FreqErrRef, #//变频器过热预警(oH2)", # //171 + AlarmInfo.ALARM_FREQ_MOTOR_OVERHEAT : STR_FreqErrRef, #//电机过热(oH3)", # //172 + AlarmInfo.ALARM_FREQ_RSV173 : STR_FreqErrRef, #//保留", # //173 + AlarmInfo.ALARM_FREQ_RSV174 : STR_FreqErrRef, #//保留", # //174 + + AlarmInfo.ALARM_FREQ_MOBUS_TEST_OK : "不必采取对策(并非警报)", # //175 + AlarmInfo.ALARM_FREQ_SWITCH_WHEN_RUN : STR_FreqErrRef, #//运行中输入电机切换指令(rUn)", # //176 + AlarmInfo.ALARM_FREQ_MOBUS_TEST_ERR : STR_FreqErrRef, #//MEMOBUS通信测试模式故障(SE)", # //177 + AlarmInfo.ALARM_FREQ_MAINTAIN_IGBT_90 : STR_FreqErrRef, #//IGBT维护时期(90%)(TrPC)", # //178 + AlarmInfo.ALARM_FREQ_RSV179 : STR_FreqErrRef, #//保留", # //179 + AlarmInfo.ALARM_FREQ_RSV180 : STR_FreqErrRef, #//保留", # //180 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//变频器容量的设定故障(oPE01)", # //181 + AlarmInfo.ALARM_FREQ_CAPACITY_SET_ERR : STR_FreqErrRef, #//参数设定范围不当(oPE02)", # //182 + AlarmInfo.ALARM_FREQ_DIN_SELECT_ERR : STR_FreqErrRef, #//多功能输入的选择不当(oPE03)", # //183 + AlarmInfo.ALARM_FREQ_AIN_SELECT_ERR : STR_FreqErrRef, #//多功能模拟量输入的选择不当(oPE07)", # //184 + AlarmInfo.ALARM_FREQ_PARA_SELECT_ERR : STR_FreqErrRef, #//参数选择不当(oPE08)", # //182 + AlarmInfo.ALARM_FREQ_PID_SELECT_ERR : STR_FreqErrRef, #//PID控制的选择不当(oPE09)", # //183 + AlarmInfo.ALARM_FREQ_VF_DATA_SET_ERR : STR_FreqErrRef, #//V/f数据的设定不当(oPE10)", # //184 + AlarmInfo.ALARM_FREQ_CARRIER_SET_ERR : STR_FreqErrRef, #//载波频率的设定不当(oPE11)", # //182 + }}, + + {"alias_user_alarm": {0:"关闭", 1:"打开"}}, + {"alias_bool": {0:"关闭", 1:"打开"}}, + {"alias_mainpump": {0:"允许", 1:"禁止"}}, + {"alias_inverse_enable": {0:"允许反转", 1:"禁止反转"}}, + {"alias_voltage": {0:"380V", 1:"660V", 2:"1140V"}}, + {"alias_converter": {0: "V1000", 1: "MD380", 2: "S3100A",3: "MD80", 4: "WIDM100"}}, + {"alias_parity": {0: "无校验", 1: "奇校验", 2: "偶校验"}}, + {"alias_485stop": {0: "1", 1: "2"}}, + {"alias_baud": {0: "1200", 1: "2400", 2: "4800", 3: "9600", 4:"19200", 5:"38400", 6:"51200", 7:"115200"}}, + {"alias_can_baud": {0: "1M", 1: "800K", 2: "500K", 3: "250K", 4:"125K", 5:"100K", 6:"50K", 7:"20K", 8:"10K"}}, + {"alias_NoNC": {0: "常开", 1: "常闭"}}, + {"alias_bluetooth": {0: "未连接", 1: "连接"}}, + {"alias_onoff": {0: "分闸", 1: "合闸"}}, + {"alias_alarm": {0: "无故障", 1: "定时限短路", 2 : "定时限过流1段", 3: "定时限过流2段"}}, + {"alias_test": {0: "测试", 1: "动作"}}, + {"alias_workmode": {0: "手动停止", 1: "手动运行", 2: "自动暂停", 3: "自动运行", 4: "远控暂停", 5: "远控运行"}}, + {"alias_workmode2": {0: "手动", 1: "自动", 2: "远控"}}, + {"alias_comm": {0: "保留", 1: "脚本", 2:"调试", 3: "桥接"}}, + {"alias_priority": {0: "无优先级", 1: "主泵优先", 2: "辅泵优先"}}, + {"alias_pidmode": {0: "自定义", 1: "轻载", 2: "中载", 3: "重载"}}, + {"alias_pid": {0: "NULL", 1: "P", 2: "I", 3: "PI", 4: "D", 5: "PD", 6: "ID", 7: "PID"}}, + {"alias_language": {0: "中文", 1: "英文"}}, + {"alias_PX": {0: "正常", 1: "关闭"}}, + {"alias_devicestatus": {0: "本地停止", 1: "本地自动", 2: "远程控制", 3: "远程急停"}}, + {"alias_alarmstatus": {0: "正常", 1: "报警"}}, + {"alias_Energymeter": {0: "停用", 1: "安科瑞电表"}}, + {"alias_plc": {0:"0-调试程序", + 1:"1-调峰程序", + 2:"2-GPRS+流量计", + 3:"3-双水箱", + 4:"4-1#进压阀门控制", + 5:"5-2#爆管阀门控制", + 6:"6-1#单水箱", + 7:"7-翰林国际小区", + 8:"8-兼容全功能", + 9:"9-楼顶水箱", + 10: "10-保留", + 11: "11-保留"}}, + {"alias_plc_pin": {0:"0-保留脚位", + 1:"1-初始脚位", + 2:"2-GPRS+流量计", + 3:"3-双水箱脚位", + 4:"4-1#进压阀门脚位", + 5:"5-2#爆管阀门脚位", + 6:"6-1#单水箱脚位", + 7:"7-翰林国际小区脚位", + 8:"8-兼容全功能脚位", + 9:"9-楼顶水箱脚位", + 10: "10-保留脚位", + 11: "11-保留脚位"}}, + + {"alias_input": {0:"无功能", + #1:"电接点压力低", + #2:"电接点压力高", + 3:"缺水信号", #原市政无水 + #4:"1#浮球低位", + #7:"漏水信号", + #8:"烟感信号", + 9:"外部故障", + #10:"2#浮球低位", + #11:"门禁信号", + #12:"无水信号常闭", + 13:"自动/远程模式切换", + #24:"1#浮球高位", + #25:"1#开阀到位", + #26:"1#关阀到位", + #27:"1#阀门故障信号", + #29: "自动输入", + #32:"2#浮球高位", + #33:"2#开阀到位", + #34:"2#关阀到位", + #35:"2#阀门故障信号", + #38:"爆管开阀到位", + #39:"爆管关阀到位", + #43:"进压开阀到位", + #44:"进压关阀到位", + #47:"切换开阀到位", + #48:"切换关阀到位", + #49:"3#浮球高位", + #50:"3#开阀到位", + #51:"3#关阀到位", + #52:"3#阀门故障信号", + #53:"3#楼顶浮球低", + #54:"1#楼顶浮球低", + #55:"2#楼顶浮球低", + 64:"正转运行", + #65:"反转运行", + #66:"自由停机", + 67:"减速停机", + 68:"故障复位", + 69: "自动/远程停止", + }}, + + {"alias_output": {0:"无输出", + #17: "Y0.0", + #18: "Y0.1", + #20: "Y0.3", + #29 : "1#水箱开阀", + #30:"1#水箱关阀", + #31: "2#水箱开阀", + #32: "2#水箱关阀", + #33: "爆管开阀", + #34:"爆管关阀", + #35:"进压开阀", + #36:"进压关阀", + #37: "风机开关", + #38: "加热开关", + #39:"空调开关", + #40:"切换装置开阀", + #41: "切换装置关阀", + #42: "照明开关", + #43: "开门输出", + #44:"关门输出", + #45:"紫外消毒输出", + #46: "3#水箱开阀", + #47: "3#水箱关阀", + 48: "一体机运行中", + 49: "故障输出", + 50: "变频器故障", + 51: "超压报警", + 52: "低压报警", + 53: "爆管报警"}}, + {"alias_aio_out": {0:"未使用", + 1:"市政切换智能阀", + 2:"1#水箱智能阀", + 3:"2#水箱智能阀"}}, + {"alias_temp_wet": {0:"0-停用", + 1:"1-RS_WS_N01"}}, + {"alias_sonud": {0:"0-停用", + 1:"1-RS_WS_N01"}}, + {"alias_flowmeter": {0:"0-迪纳声流量计", + 1:"1-熊猫PWM流量计", + 2:"2-科龙IFC300流量计", + 3:"3-星空XKD99Z流量计", + 4:"4-熊猫PMF流量计"}}, + {"alias_waterquality": {0:"0-停用", 1:"1-天健TMS3000"}}, + {"alias_tempmiddle": {0:"0-停用", 1:"1-壁挂王字壳"}}, + {"alias_valve_output" : {0: "未动作", 1: "开阀输出", 2: "关阀输出"}}, + {"alias_valve_status" : {0: "未到位", 1: "已到位"}}, + {"alias_run_function" : {0: "关闭", 1: "自动", 2: "手动"}}, + {"alias_PumpName" : {0: "1号泵", 1: "2号泵", 2: "3号泵", 3: "4号泵", 4: "5号泵", 5: "6号泵", 6: "7号泵", 7: "8号泵"}}, + {"alias_anaolog_mode": {0:"4-20mA", 1:"0-10V"}}, + {"alias_sp": {0:"减速停车", 1:"自由停车"}},#停机方式 + {"alias_output_dir": {0:"默认方向", 1:"默认方向相反"}}, #反转控制 + {"alias_mode_config": {0:"菜单控制", 1:"输入DI控制"}}, #模式配置 + {"alias_freq_select": {0:"通讯给定", 1:"AI1给定" , 2:"AI2给定"}}, #指定远控频率 + {"alias_command_select": {0:"通讯启停", 1:"端子启停"}}, #指定远控启停 + {"alias_command": {0:"通讯停止", 1:"正转启动", 2:"反转启动"}}, #远控命令 + {"alias_di_polarity": {0:"常开", 1:"常闭"}}, +] + + +def func_comm_switch_on(object_device : class_comm_device, topic_item, topic, message) : + object_list = object_device.parent + value = 1 + result = object_list.comm_single_bit_write(object_device.comm_addr, 618, 1, value) + return result + +def func_comm_switch_off(object_device, topic_item, topic, message) : + object_list = object_device.parent + value = 1 + result = object_list.comm_single_bit_write(object_device.comm_addr, 619, 1, value) + return result + +def func_comm_switch_rst(object_device, topic_item, topic, message) : + object_list = object_device.parent + value = 1 + result = object_list.comm_single_bit_write(object_device.comm_addr, 620, 1, value) + return result + +def func_comm_test_leak(object_device, topic_item, topic, message) : + return None + +#mqtt 执行的开关命令, 可通过远程发送该命令 +mqtt_topic_subscribe = [ + {"name": "通讯分闸", "execute": func_comm_switch_on}, + {"name": "通讯合闸", "execute": func_comm_switch_off}, + {"name": "故障复位", "execute": func_comm_switch_rst}, + {"name": "漏电试验", "execute": func_comm_test_leak}, +] + +mqtt_pack_alarm = [ + { + "name": "AlarmType", + "addr": "8138", + "alias": "alias_test" + }, +] + +dynamic_page_main = [ + { + "name": "进水压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40023", + "format": "%05.2f", + }, + { + "name": "水箱液位", + "unit": "m", + "scale" : 0.01, + "addr": "40029", + "format": "%05.2f", + }, + { + "name": "实际压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40025", + "format": "%05.2f", + }, + { + "name": "设定压力", + "unit": "Mpa", + "scale" : 0.001, + "addr": "40416", + "format": "%05.2f", + }, + { + "name": "工作电流", + "unit": "A", + "scale" : 0.01, + "addr": "40049", + "format": "%05.2f", + }, + { + "name": "瞬时功率", + "unit": "kW", + "scale" : 0.01, + "addr": "40007", + "format": "%05.2f", + }, +] + +modbus_comm_table = [ + {"name":"status", "reg_addr":8162, "reg_count":4, "cycle": 100}, + {"name":"alarm", "reg_addr":8120, "reg_count":10, "cycle": 0, "mqtt_pack": "mqtt_pack_alarm"}, + {"name":"measure", "reg_addr":8139, "reg_count":35, "cycle": 200, "mqtt_pack": "dynamic_page_main"}, + {"name":"comm_cmd", "reg_addr":100618, "reg_count":32, "cycle": 0}, + {"name":"para_group", "reg_addr":2000, "reg_count":10, "cycle": 0}, + {"name":"time_group", "reg_addr":2300, "reg_count":6, "cycle": 500}, + {"name":"protect_group", "reg_addr":8174, "reg_count":26, "cycle": 0}, + {"name":"ip_addr_group", "reg_addr":8410, "reg_count":6, "cycle": 0}, + {"name":"inter_group", "reg_addr":8240, "reg_count":10, "cycle": 0}, +] + +def func_comm_table_trigger_check(object_comm_table, comm_table_item) : + return False + + + +menu_normal_set = [ + { + "name": "设定压力", + "unit": "Mpa", + "addr": "40415", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "停止压力", #原先为最高压力, 上限压力 + "unit": "Mpa", + "addr": "2419", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "下限压力", #原先为下限压力 + "unit": "Mpa", + "addr": "2418", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "唤醒压力", #原先为唤醒压力 + "unit": "Mpa", + "addr": "2829", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "超压报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40289", + }, + { + "name": "加泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40280", + }, + { + "name": "减泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40273", + }, + #{ + # "name": "加速时间", + # "scale" : 0.1, + # "unit" : "S", + # "format": "%04.1f", + # "addr": "44013", + # "property": MENU_PROPERTY_READ_ONLY, + #}, + #{ + # "name": "减速时间", + # "scale" : 0.1, + # "unit" : "S", + # "format": "%04.1f", + # "addr": "44014", + # "property": MENU_PROPERTY_READ_ONLY, + #}, + + #{ + # "name": "最大频率", + # "scale" : 0.01, + # "unit" : "Hz", + # "format": "%06.2f", + # "addr": "43991", + #}, + #{ + # "name": "最小频率", + # "scale" : 0.01, + # "unit" : "Hz", + # "format": "%06.2f", + # "addr": "43992", + #}, + + { + "name": "换泵时间",#定时切换 + "unit": "Min", + "addr": "40282", + "scale" : 1.0, + "format": "%04.0f", + }, + { + "name": "当前泵号", + "addr": "40194", + "scale" : 1.0, + "format": "%1.0f", + }, + { + "name": "水泵台数", + "addr": "40283", + "scale" : 1.0, + "format": "%1.0f", + "min" : 1, + "max" : 6, + }, + { + "name": "进水信号", + "addr": "40226", + "alias" : "alias_bool", + }, + { + "name": "出水信号", + "addr": "40234", + "alias" : "alias_bool", + }, + +] + +menu_func_set = [ + { + "name": "泵组水箱液位", + "alias": "alias_bool", + "addr": "40259", + }, + { + "name": "水箱1配置", + "sub_menu": "menu_tank1", + }, + { + "name": "水箱2配置", + "sub_menu": "menu_tank2", + }, + { + "name": "泵组进压阀", + "sub_menu": "menu_pump_inletvalve", + }, + { + "name": "分时压力", + "sub_menu": "menu_time_pressure", + }, + { + "name": "程序功能", + "alias": "alias_plc", + "addr": "43983", + }, + { + "name": "GPRS泵号", + "format": "%1.0f", + "addr": "54201", #"48402", + }, + { + "name": "通讯设置", + "sub_menu": "menu_comm_set", + }, + { + "name": "流量计型号", + "alias": "alias_flowmeter", + "addr": "54200", #"48400", + }, + { + "name": "流量计泵号", + "format": "%1.0f", + "addr": "54205", #"48410", + }, + { + "name": "调峰功能", + "alias": "alias_bool", + "addr": "40000", + }, + { + "name": "切换装置", + "alias": "alias_bool", + "addr": "40000", + }, +] + +menu_run_set = [ + { + "name": "加泵频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40278", + }, + { + "name": "减泵频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40279", + }, + { + "name": "加泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40280", + }, + { + "name": "减泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40273", + }, + { + "name": "休眠频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40316", + }, + { + "name": "休眠延时", + "scale" : 0.1, + "unit" : "S", + "format": "%06.1f", + "addr": "40317", + }, + { + "name": "休眠功率*", + "addr": "44203", + "scale": 0.01, + "unit": "kW", + "format": "%05.2f", + "action": "SelfPumpOffset8", + }, + { + "name": "功率均衡", + "alias": "alias_bool", + "addr": "40391", + }, + { + "name": "均衡死区", + "addr": "40388", + "unit": "%", + "scale": 0.1, + "format": "%05.1f", + }, + { + "name": "最大频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "43992", + }, + { + "name": "最小频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "43993", + }, +] + + +menu_protect_set = [ + # { + # "name": "超压保护", + # "alias": "alias_bool", + # "addr": "40288.1", + # }, + { + "name": "超压报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40289", + }, + { + "name": "负压保护", + "alias": "alias_bool", + "addr": "40288.5", + }, + { + "name": "负压报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40290", + }, + { + "name": "真空报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40291", + }, + { + "name": "负压解除", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40292", + }, + { + "name": "真空解除", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40305", + }, + { + "name": "液位保护", + "alias": "alias_bool", + "addr": "40288.8", + }, + { + "name": "水箱1液位低", + "scale" : 0.01, + "unit" : "m", + "format": "%04.2f", + "addr": "40293", + }, + { + "name": "液位1解除", + "scale" : 0.01, + "unit" : "m", + "format": "%04.2f", + "addr": "40294", + }, +] + +menu_data_Native = [ + { + "name": "总电量", + "scale" : 0.01, + "unit" : "kwh", + "format": "%9.2f", + "addr": "40010#2", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "总功率", + "scale" : 0.01, + "unit" : "kW", + "format": "%05.2f", + "addr": "40012", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "泵电量", + "scale" : 0.01, + "unit" : "kwh", + "format": "%9.2f", + "addr": "40008#2", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "泵功率", + "scale" : 0.01, + "unit" : "kw", + "format": "%05.2f", + "addr": "40007", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "入水压力", + "scale" : 0.001, + "unit" : "Mpa", + "format": "%05.3f", + "addr": "40023", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "出水压力", + "scale" : 0.001, + "unit" : "Mpa", + "format": "%05.3f", + "addr": "40025", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_data_pump = [ + { + "name": "当前泵号*", + "addr": "40194", + "scale" : 1.0, + "format": "%1.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "本次运行*", + "unit" : "Min", + "format": "%05.0f", + "addr": "40042#2", #"56342#2", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset16", + }, + { + "name": "累计运行*", + "scale" : 0.016667, + "unit" : "h", + "format": "%6.0f", + "addr": "40044#2", #"56344#2", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset16", + }, + { + "name": "当前频率*", #变频器当前频率频率 + "format": "%5.2f", + "scale" : 0.01, + "addr": "40041", + "unit": "Hz", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "当前转速*", + "unit" : "rpm", + "format": "%05.0f", + "addr": "56233", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "输出电流*", + "scale" : 0.01, + "unit" : "A", + "format": "%05.2f", + "addr": "40049", #"56349", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "输出功率*", + "scale" : 0.01, + "unit" : "kW", + "format": "%05.2f", + "addr": "40051", #"45351", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "母线电压*", + "scale" : 0.1, + "unit" : "V", + "format": "%05.1f", + "addr": "40050", #"46350", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "IGBT温度*", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "40048", #"56348", + "action": "SelfPumpOffset16", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定电流*", + "scale" : 0.01, + "unit" : "A", + "format": "%05.2f", + "addr": "44018", #"56834", + "action": "SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定功率*", + "unit": "Kw", + "addr": "44017", + "scale" : 0.01, + "format": "%05.2f", + "action": "SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "软件版本*", + "addr": "48031", + "scale" : 0.01, + "format": "%04.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "硬件版本*", + "addr": "48013", + "scale" : 0.01, + "format": "%05.2f", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_data_user = [ + + { + "name": "漏水PX0", + "alias": "alias_PX", + "addr": "47612", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "烟感PX1", + "alias": "alias_PX", + "addr": "47614", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "故障PX2", + "alias": "alias_PX", + "addr": "47616", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "门禁PX4", + "alias": "alias_PX", + "addr": "47618", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱容积", + "scale" : 0.01, + "unit" : "m³", + "format": "%05.2f", + "addr": "46004", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "水箱面积", + "scale" : 0.01, + "unit" : "㎡", + "format": "%05.2f", + "addr": "46022", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "储水总量", + "scale" : 0.01, + "unit" : "m³", + "format": "%05.2f", + "addr": "46008", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +cur_curve = [ + +] + +menu_quick_tag = [ + { + "name": "泵组工作时间统计", + "sub_menu" : "menu_statistic", + }, + { + "name": "故障查询", + "sub_menu" : "menu_alarm_history", + }, + { + "name": "压力曲线", + "sub_menu" : "cur_curve", + }, + { + "name": "通信设置", + "sub_menu" : "menu_comm_set", + }, + { + "name": "信号配置", + "sub_menu" : "memu_sensor_engineer", + }, + { + "name": "联机设置", + "sub_menu" : "menu_link", + }, + { + "name": "工程师菜单", + "sub_menu" : "menu_full_set", + }, + { + "name": "重启", + "action": "reboot", + }, +] + +menu_time_pressure = [ + { + "name": "分时段压力使能", + "addr": "40281.3", + "alias": "alias_bool", + }, + { + "name": "分时段1", + "addr": "40320#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力1", + "addr": "40320", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段2", + "addr": "40328#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力2", + "addr": "40328", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段3", + "addr": "40336#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力3", + "addr": "40336", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段4", + "addr": "40344#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力4", + "addr": "40344", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段5", + "addr": "40352#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力5", + "addr": "40352", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段6", + "addr": "40360#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力6", + "addr": "40360", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段7", + "addr": "40368#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力7", + "addr": "40368", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, + { + "name": "分时段8", + "addr": "40376#8", + "action": "pressure_time_ctrl", + }, + { + "name": "分时段压力8", + "addr": "40376", + "scale": 0.001, + "format": "%05.3f", + "unit": "Mpa", + }, +] + +menu_hand_adjust = [ + { + "name": "只写页", + }, +] + +disp_hand_adjust = [ + { + "name": "OutPressure", + "format": "%4.0f", + "addr": "40025", + }, + { + "name": "FreqSet", #手动设定频率 + "format": "%5.0f", + "addr": "44010", + "action": "SelfPumpOffset24", + }, + { + "name": "FreqCur", #变频器当前频率频率 + "format": "%5.0f", + "addr": "40041", + "action": "SelfPumpOffset16", + }, +] + +menu_link = [ + { + "name": "1#模式", + "alias": "alias_workmode2", + "addr": "44009.1#2", + "action" : "work_mode" + }, + { + "name": "2#模式", + "alias": "alias_workmode2", + "addr": "44033.1#2", + "action" : "work_mode" + }, + { + "name": "3#模式", + "alias": "alias_workmode2", + "addr": "44057.1#2", + "action" : "work_mode" + }, + { + "name": "4#模式", + "alias": "alias_workmode2", + "addr": "44081.1#2", + "action" : "work_mode" + }, + { + "name": "5#模式", + "alias": "alias_workmode2", + "addr": "44105.1#2", + "action" : "work_mode" + }, + { + "name": "6#模式", + "alias": "alias_workmode2", + "addr": "44129.1#2", + "action" : "work_mode" + }, +] + + +menu_alarm_history = [ + { + "name": "泵组故障查询", + "action": "alarm_pump_-1", + }, + { + "name": "泵1故障查询", + "action": "alarm_pump_0", + }, + { + "name": "泵2故障查询", + "action": "alarm_pump_1", + }, + { + "name": "泵3故障查询", + "action": "alarm_pump_2", + }, + { + "name": "泵4故障查询", + "action": "alarm_pump_3", + }, + { + "name": "泵5故障查询", + "action": "alarm_pump_4", + }, + { + "name": "泵6故障查询", + "action": "alarm_pump_5", + }, + { + "name": "清除故障", + "sub_menu": "menu_alarm_clear", + }, +] +menu_alarm_clear = [ + { + "name": "清除本次故障", + "action": "alarm_clear", + }, + { + "name": "清除所有故障", + "action": "alarm_clear", + }, +] + +menu_alarm = [ + { + "name": "清除本次故障", + "action": "alarm_clear", + }, + { + "name": "历史故障查询", + "sub_menu": "menu_alarm_history", + }, +] + +menu_curve_history = [ + { + "name": "只读页", + }, +] + +menu_comm_485 = [ + { + "name": "485地址", + "addr": "43000", + "scale": 1.0, + "format": "%03.0f", + "min": 1, + "max": 200, + }, + { + "name": "485波特率", + "alias": "alias_baud", + "addr": "43001", + }, + { + "name": "485校验方式", + "alias": "alias_parity", + "addr": "43002", + }, + { + "name": "485停止位", + "alias": "alias_485stop", + "addr": "43007", + }, + + { + "name": "485设备1", + "alias": "alias_comm", + "addr": "43005", + }, +] + +menu_comm_can = [ + { + "name": "CAN地址", + "addr": "40000", + "scale": 1.0, + "format": "%03.0f", + }, + { + "name": "CAN波特率", + "alias": "alias_can_baud", + "addr": "43015", + }, +] + +menu_comm_set = [ + { + "name": "485通讯配置", + "sub_menu": "menu_comm_485", + }, + { + "name": "CAN通讯配置", + "sub_menu": "menu_comm_can", + }, + { + "name": "通讯DI给定*", + "alias": "alias_bool", + "addr" : "48121", + }, + { + "name": "通讯DI数据*", + "addr" : "48122", + "format": "%05.0f", + "scale" : 1.0, + }, +] + +menu_parameter = [ + { + "name": "GPRS泵号", + "addr": "54201", #"48402", + "scale": 1.0, + "format": "%01.0f", + }, + { + "name": "脚本输出流量计*", + "alias": "alias_flowmeter", + "addr": "54151", #"48302", + }, + { + "name": "脚本输入流量计*", + "alias": "alias_flowmeter", + "addr": "54152",#48304 + }, + { + "name": "流量计接入泵", + "format": "%1.0f", + "addr": "54205", #48410 + }, + { + "name": "脚本电表选择*", + "alias": "alias_Energymeter", + "addr": "54156", #48312 + }, + { + "name": "电度表接入泵", + "format": "%1.0f", + "addr": "54207", #48414 + }, + { + "name": "脚位配置", + "alias": "alias_plc_pin", + "addr": "54130", #48260 + }, + { + "name": "模拟输出*", + "alias": "alias_aioutput", + "addr": "54157",#48314 + "action" : "SelfPumpOffset8" + }, + { + "name": "脚本温湿度选型*", + "alias": "alias_temp_wet", + "addr": "54150", #48300 + }, + { + "name": "脚本噪声变送器*", + "alias": "alias_sonud", + "addr": "54153", #48306 + }, + { + "name": "脚本水质分析仪*", + "alias": "alias_waterquality", + "addr": "54154", #48308 + }, + { + "name": "脚本夹层温度*", + "alias": "alias_tempmiddle", + "addr": "54155", #48310 + }, +] +menu_temp_control = [ + { + "name": "空调功能", + "addr": "54088", #"48176", + "alias": "alias_run_function", + }, + { + "name": "空调上限温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54085", #"48170", + }, + { + "name": "空调下限温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54086", #"48172", + }, + { + "name": "空调开启时长", + "scale" : 1.0, + "unit" : "Min", + "format": "%06.0f", + "addr": "54087", #"48174", + }, + { + "name": "手动空调开启*", + "action" : "KeyEnterTrigger_DispCtrl_54088.1",#48176.1 + "addr": "59060.12", #"10121.4", + }, + { + "name": "手动空调关闭*", + "action" : "KeyEnterTrigger_DispCtrl_54088.1", + "addr": "59060.13", #"10121.5", + }, + { + "name": "加热器功能", + "addr": "54082", #"48164", + "alias": "alias_run_function", + }, + { + "name": "加热开启温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54080", #"48160", + }, + { + "name": "加热关闭温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54081", #"48162", + }, + { + "name": "手动加热开启*", + "action" : "KeyEnterTrigger_DispCtrl_54082.1",#48164.1 + "addr": "59060.10", #"10121.2", + }, + { + "name": "手动加热关闭*", + "action" : "KeyEnterTrigger_DispCtrl_54082.1", + "addr": "59060.11", #"10121.3", + }, +] +menu_tank1 = [ + { + "name": "1#水箱功能", + "addr": "54061", #"48122", + "alias": "alias_run_function", + }, + { + "name": "1#手动开阀", + "addr": "59060.0", #"10120.0", + "action" : "KeyEnterTrigger_DispCtrl_54061.1",#48122.1 + }, + { + "name": "1#手动关阀", + "addr": "59060.1", #"10120.1", + "action" : "KeyEnterTrigger_DispCtrl_54061.1", + }, + { + "name": "1#阀门动作时长", #默认120s + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54062", #"48124", + }, + { + "name": "1#开阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56595", #"1190", + }, + { + "name": "1#关阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56596", #"1192", + }, + { + "name": "无水液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56593", #"1186", + }, + { + "name": "无水解除液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "56598", #"1188", + }, + { + "name": "水箱长度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54000", #"48000", + }, + { + "name": "水箱宽度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54001", #"48002", + }, + { + "name": "水箱高度", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54002", #"48004", + }, +] +menu_tank2 = [ + { + "name": "2#水箱功能", + "addr": "54056", #"48112", + "alias": "alias_run_function", + }, + { + "name": "2#手动开阀", + "addr": "59060.2", #"10120.2", + "action" : "KeyEnterTrigger_DispCtrl_54056.1",#48112.1 + }, + { + "name": "2#手动关阀", + "addr": "59060.3", #"10120.3", + "action" : "KeyEnterTrigger_DispCtrl_54056.1", + }, + { + "name": "2#阀门动作时长", #默认120s + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54057", #"48114", + }, + { + "name": "2#开阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54054", #"48108", + }, + { + "name": "2#关阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54055", #"48110", + }, +] +menu_tank3 = [ + { + "name": "3#水箱功能", + "addr": "54073", #"48146", + "alias": "alias_run_function", + }, + { + "name": "3#手动开阀", + "addr": "59059.8", #"10119.0", + "action" : "KeyEnterTrigger_DispCtrl_54073.1",#48146.1 + }, + { + "name": "3#手动关阀", + "addr": "59059.9", #"10119.1", + "action" : "KeyEnterTrigger_DispCtrl_54073.1", + }, + { + "name": "3#阀门动作时长", #默认120s + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54084", #"48168", + }, + { + "name": "3#开阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54074", #"48148", + }, + { + "name": "3#关阀液位", + "scale" : 0.01, + "unit" : "m", + "format": "%05.2f", + "addr": "54083", #"48166", + }, +] +menu_tank_switch = [ + { + "name": "水箱市政切换", + "addr": "54100", #"48200", + "alias": "alias_run_function", + }, + { + "name": "切换手动开阀", + "addr": "59056.2", #"10122.2", + "action" : "KeyEnterTrigger_DispCtrl_54100.1",#48200.1 + }, + { + "name": "切换手动关阀", + "addr": "59056.3", #"10122.3", + "action" : "KeyEnterTrigger_DispCtrl_54100.1", + }, + { + "name": "阀门动作延时", + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54117", #"48234", + }, + { + "name": "时段一始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54108", #"48216", + }, + { + "name": "时段一终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54109", #"48218", + }, + { + "name": "时段二始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54110", #"48220", + }, + { + "name": "时段二终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54111", #"48222", + }, + { + "name": "时段三始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54112", #"48224", + }, + { + "name": "时段三终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54113", #"48226", + }, + { + "name": "时段四始", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54114", #48228", + }, + { + "name": "时段四终", + "scale" : 0.01, + "unit" : "时:分", + "min" : "00#00", + "max" : "23#59", + "format": "%05.2f", + "addr": "54115", #"48230", + }, +] +menu_pump_inletvalve = [ + { + "name": "进水阀门功能", + "addr": "54069", #"48138", + "alias": "alias_run_function", + }, + { + "name": "手动进压开阀", + "addr": "59060.6", #"10120.6", + "action" : "KeyEnterTrigger_DispCtrl_54069.1", #48138.1 + }, + { + "name": "手动进压关阀", + "addr": "59060.7", #"10120.7", + "action" : "KeyEnterTrigger_DispCtrl_54069.1", #48138.1 + }, + { + "name": "进水开阀状态", + "addr": "59119.8#2", #"10239.0#2", + "alias": "alias_valve_output", + "action" : "DispCtrl_54069", #48138 + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "开阀到位状态", + "alias": "alias_valve_status", + "addr": "59082.11", #"10165.3", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54069", #48138 + }, + { + "name": "关阀到位状态", + "alias": "alias_valve_status", + "addr": "59082.12", #"10165.4", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "DispCtrl_54069", #48138 + }, + { + "name": "进水有效延时", + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54068", #"48136", + }, + { + "name": "开阀压力值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "54066", #"48132", + }, + { + "name": "关阀压力值", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "54065", #"48130", + }, + { + "name": "阀门动作时长", + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54067", #"48134", + }, +] +menu_explosion_valve = [ + { + "name": "爆管阀门功能", + "addr": "54072", #"48144", + "alias": "alias_run_function", + }, + { + "name": "手动爆管开阀", + "addr": "59060.4", #"10120.4", + "action" : "KeyEnterTrigger_DispCtrl_54072.1",#48144.1 + }, + { + "name": "手动爆管关阀", + "addr": "59060.5", #"10120.5", + "action" : "KeyEnterTrigger_DispCtrl_54072.1", + }, + { + "name": "阀门工作时长", + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54071", #"48142", + }, + { + "name": "爆管延时信号", + "scale" : 0.001, + "unit" : "S", + "format": "%07.3f", + "addr": "54070", #"48140", + }, +] +menu_peripheral = [ + { + "name": "照明功能", + "addr": "54095", #"48190", + "alias": "alias_run_function", + }, + { + "name": "照明手动开", + "addr": "59061.0", #"10122.0", + "action" : "KeyEnterTrigger_DispCtrl_54095.1",#48190.1 + }, + { + "name": "照明手动关", + "addr": "59061.1", #10122.1", + "action" : "KeyEnterTrigger_DispCtrl_54095.1", + }, + { + "name": "门禁功能", + "alias": "alias_run_function", + "addr": "54105", #"48210", + }, + { + "name": "门禁手动开", + "addr": "59060.12", #"10121.4", + "action" : "KeyEnterTrigger_DispCtrl_54105.1",#48210.1 + }, + { + "name": "门禁手动关", + "addr": "59060.13", #"10121.5", + "action" : "KeyEnterTrigger_DispCtrl_54105.1", + }, +] +menu_fan_arefaction = [ + { + "name": "风机功能", + "addr": "54079", #"48158", + "alias": "alias_run_function", + }, + { + "name": "风机开启温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54075", #"48150", + }, + { + "name": "风机关闭温度", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "54076", #"48152", + }, + { + "name": "风机手动开", + "addr": "59060.8", #"10121.0", + "action" : "KeyEnterTrigger_DispCtrl_54079.1",#48158.1 + }, + { + "name": "风机手动关", + "addr": "59060.9", #"10121.1", + "action" : "KeyEnterTrigger_DispCtrl_54079.1", + }, + { + "name": "除湿机功能", + "addr": "54092", #"48184", + "alias": "alias_run_function", + }, + { + "name": "除湿机开启湿度", + "scale" : 0.1, + "unit" : "%", + "format": "%05.1f", + "addr": "54090", #"48180", + }, + { + "name": "除湿机关闭湿度", + "scale" : 0.1, + "unit" : "%", + "format": "%05.1f", + "addr": "54091", #"48182", + }, + { + "name": "除湿机手动开", + "addr": "59060.14", #"10121.6", + "action" : "KeyEnterTrigger_DispCtrl_54092.1",#48184.1 + }, + { + "name": "除湿机手动关", + "addr": "59060.15", #"10121.7", + "action" : "KeyEnterTrigger_DispCtrl_54092.1", + }, +] + +menu_pin_configure = [ + { + "name": "X0.1(X1)*", + "alias": "alias_input", + "addr": "44265", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.3(X3)*", + "alias": "alias_input", + "addr": "44267", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.4(X4)*", + "alias": "alias_input", + "addr": "44268", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.5(X5)*", + "addr": "44269", + "alias": "alias_input", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "X0.6(X6)*", + "alias": "alias_input", + "addr": "44270", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset22", + }, + { + "name": "Y0.0(A1-B1)*", + "alias": "alias_output", + "addr": "44272", + "action" : "SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y0.1(A2-B2)*", + "alias": "alias_output", + "addr": "44273", + "action" : "SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y0.3(A4-B4)*", + "alias": "alias_output", + "addr": "44275", + "action" : "SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_statistic = [ + { + "name": "当前工作时间", + "addr": "40042#2", + "unit": "Min", + "format": "%09.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset16", + }, + { + "name": "累计工作时间", + "addr": "40044#2", + "unit": "Min", + "format": "%09.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset16", + }, + { + "name": "工作次数", + "addr": "40054#2", + "unit": "次", + "format": "%09.0f", + "property": MENU_PROPERTY_READ_ONLY, + "action" : "SelfPumpOffset16", + }, + { + "name": "累计时间清零", + "action": "clear_acc_time", + }, + { + "name": "累计电量清零", + "action": "clear_kwh", + }, + { + "name": "所有泵统计", + "action": "pumps_statistic", + }, + { + "name": "当前压力曲线", + "sub_menu": "cur_curve", + }, + +] + +menu_system = [ + { + "name": "当前泵号", + "addr": "40194", + "scale" : 1.0, + "format": "%1.0f", + }, + { + "name": "日期设置", + "addr": "40408#3", + "action" : "date", + }, + { + "name": "当前时间", + "addr": "40411#3", + "action" : "time", + }, + { + "name": "参数同步", + "action": "sync_3", + }, + { + "name": "参数全局还原", + "action": "backall", + }, + { + "name": "恢复出厂设置", + "sub_menu": "menu_factory_default", + "action" : "SavePoint_0" + }, + + { + "name": "提示音*", + "addr": "48029", + "alias" : "alias_bool", + }, + { + "name": "锁定键盘*", + "action" : "lock", + }, + { + "name": "背光亮度*", + "addr": "48009", + "unit": "%", + "min": 10, + "max": 100, + "format": "%03.0f", + }, + { + "name": "背光延时*", + "addr": "48008", + "unit": "S", + "format": "%04.0f", + }, + { + "name": "系统密码*", + "addr": "48041", + "format" :"%04.0f", + "action": "password", + }, + { + "name": "主泵允许*", + "alias": "alias_mainpump", + "addr": "44030.0", + "action": "SelfPumpOffset24", + }, + { + "name": "累计时间清零", + "action": "clear_acc_time", + }, + { + "name": "累计电量清零", + "action": "clear_kwh", + }, + #{ + # "name": "其他", + # "sub_menu": "menu_other", + #}, + { + "name": "重启", + "action": "reboot", + }, +] + +menu_other = [ + { + "name": "统计信息", + "sub_menu": "menu_statistic", + }, + { + "name": "历史曲线", + "sub_menu": "menu_curve_history", + }, + { + "name": "用户参数", + "sub_menu": "menu_parameter", + }, + { + "name": "程序功能", + "alias": "alias_plc", + "addr": "43983", + }, + { + "name": "快捷入口", + "sub_menu": "menu_quick_tag", + }, + { + "name": "模拟量传感器", + "sub_menu": "memu_sensor_config", + }, +] + +menu_protect = [ + { + "name": "压力保护配置", + "sub_menu": "menu_protect_low", + }, + { + "name": "爆管保护配置", + "sub_menu": "menu_protect_ex", + }, + { + "name": "电机温度上限", + "scale" : 0.1, + "unit" : "℃", + "format": "%05.1f", + "addr": "40392", + }, +] + +menu_protect_low = [ + { + "name": "负压保护使能", + "alias": "alias_bool", + "addr": "40288.5", + }, + { + "name": "负压报警压力", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40290", + }, + { + "name": "真空报警压力", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40291", + }, + { + "name": "负压报警解除压力", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40292", + }, + { + "name": "真空报警解除压力", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40305", + }, + { + "name": "超压报警", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40289", + }, +] +menu_protect_ex = [ + # { + # "name": "爆管保护使能", + # "alias": "alias_bool", + # "addr": "40414.8", + # }, + { + "name": "爆管保护", + "alias": "alias_bool", + "addr": "40288.8", + }, + { + "name": "爆管停机压力", + "scale" : 0.001, + "unit" : "MPa", + "format": "%05.3f", + "addr": "40297", + }, + { + "name": "爆管停机延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40298", + }, +] + +menu_sleep_set = [ + { + "name": "休眠频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40316", + }, + { + "name": "休眠延时", + "addr": "40317", + "scale": 0.1, + "unit": "S", + "format": "%06.1f", + }, + { + "name": "唤醒压差", + "addr": "40318", + "scale": 0.001, + "unit": "Mpa", + "format": "%05.3f", + }, + { + "name": "唤醒延时", + "addr": "40319", + "scale": 0.01, + "unit": "S", + "format": "%05.2f", + }, + { + "name": "休眠功率*", + "addr": "44203", + "scale": 0.01, + "unit": "kW", + "format": "%05.2f", + "action": "SelfPumpOffset8", + }, + { + "name": "休眠提升时间*", + "addr": "44206", + "scale": 0.1, + "unit": "S", + "format": "%05.1f", + "action" : "SelfPumpOffset8", + }, +] + +menu_addreduce_set = [ + { + "name": "加泵频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40278", + }, + { + "name": "减泵频率", + "scale" : 0.01, + "unit" : "Hz", + "format": "%06.2f", + "addr": "40279", + }, + { + "name": "加泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40280", + }, + { + "name": "减泵延时", + "scale" : 0.1, + "unit" : "S", + "format": "%04.1f", + "addr": "40273", + }, + { + "name": "减泵压差", + "scale" : 0.001, + "unit" : "Mpa", + "format": "%05.3f", + "addr": "40274", + }, + { + "name": "加泵压差", + "scale": 0.001, + "unit": "Mpa", + "format": "%05.3f", + "addr": "40275", + }, + { + "name": "加泵压差2", #频率在休眠频率以下时的加泵压力差,可以加快加泵速度。 + "scale": 0.001, + "unit": "Mpa", + "format": "%05.3f", + "addr": "40306", + }, + { + "name": "频率加泵使能", + "addr": "40272.2", + "alias": "alias_bool", + }, + { + "name": "频率减泵使能", + "addr": "40272.3", + "alias": "alias_bool", + }, + { + "name": "功率加泵使能", + "addr": "40272.0", + "alias": "alias_bool", + }, + { + "name": "加泵功率*", + "addr": "40276", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + { + "name": "减泵功率使能", + "addr": "40272.1", + "alias": "alias_bool", + }, + { + "name": "减泵功率*", + "addr": "40277", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, +] +menu_pid_set = [ + { + "name": "PID调节周期", + "addr": "40311", + "unit": "ms", + "format": "%04.0f", + }, + { + "name": "启动PID类型", + "addr": "40304", + "alias": "alias_pid", + }, + { + "name": "启动PID Kp", + "addr": "40307", + "scale": 0.001, + "format": "%05.3f", + }, + { + "name": "启动PID Ti", + "addr": "40308", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "启动PID Td", + "addr": "40309", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "动态PID类型", + "addr": "40395", + "alias": "alias_pid", + }, + { + "name": "动态PID Kp", + "addr": "40396", + "scale": 0.001, + "format": "%05.3f", + }, + { + "name": "动态PID Ti", + "addr": "40397", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "动态PID Td", + "addr": "40398", + "scale": 0.01, + "unit": "S", + "format": "%06.2f", + }, + { + "name": "动态PID进入", + "addr": "40394", + "scale": 0.01, + "unit": "%", + "format": "%05.2f", + }, + { + "name": "动态PID退出", + "addr": "40393", + "scale": 0.01, + "unit": "%", + "format": "%05.2f", + }, + { + "name": "PID死区", + "addr": "40314", + "scale": 0.01, + "unit": "%", + "format": "%06.2f", + }, + { + "name": "PID选择组", + "addr": "40406", + "alias": "alias_pidmode", + }, + +] +menu_winter_set = [ + { + "name": "防冻使能", + "alias": "alias_bool", + "addr": "40401", + }, + { + "name": "运行频率/下限", + "addr": "40402", + "unit": "%", + "format": "%03.0f", + }, + { + "name": "防冻运行时间", + "addr": "40403", + "unit": "S", + "format": "%04.0f", + }, + { + "name": "防冻周期", + "addr": "40404", + "unit": "Min", + "format": "%04.0f", + }, +] + +menu_pumpgroup = [ + { + "name": "设定压力", + "unit": "Mpa", + "addr": "40415", + "scale" : 0.001, + "format": "%05.3f", + }, + { + "name": "基本参数设置", + "sub_menu": "menu_basic_set", + }, + { + "name": "定时换泵设置", + "sub_menu": "menu_time_switch", + }, + { + "name": "分时段设置", + "sub_menu": "menu_time_pressure", + }, + { + "name": "休眠设置", + "sub_menu": "menu_sleep_set", + }, + { + "name": "加减泵设置", + "sub_menu": "menu_addreduce_set", + }, + { + "name": "PID参数设置", + "sub_menu": "menu_pid_set", + }, + { + "name": "防冻设置", + "sub_menu": "menu_winter_set", + }, +] +menu_time_switch = [ + { + "name": "定时换泵使能", + "alias": "alias_bool", + "addr": "40281.0", + }, + + { + "name": "换泵时间", + "addr": "40282", + "unit": "Min", + "format": "%05.0f", + }, + { + "name": "换泵冷却时间", + "addr": "40303", + "scale": 1.0, + "unit": "Min", + "format": "%05.0f", + }, +] +menu_basic_set = [ + { + "name": "水泵台数", + "addr": "40283", + "scale" : 1.0, + "format": "%1.0f", + "min" : 1, + "max" : 6, + }, + { + "name": "爆管台数", + "addr": "40285", + "scale" : 1.0, + "format": "%1.0f", + "min" : 1, + "max" : 6, + }, + { + "name": "功率均衡", + "addr": "40391", + "alias": "alias_bool" + }, + { + "name": "均衡死区", + "addr": "40388", + "unit": "%", + "scale": 0.1, + "format": "%05.1f", + }, + { + "name": "辅泵编号", + "addr": "40284", + "scale" : 1.0, + "format": "%1.0f", + }, + { + "name": "主辅泵优先级", + "addr": "40299", + "alias": "alias_priority", + }, + { + "name": "辅泵切换功率", + "addr": "40302", + "scale": 0.01, + "unit": "KW", + "format": "%05.2f", + }, + +] + +menu_full_set = [ #工程师菜单的专属设置 + { + "name": "信号配置", + "sub_menu": "memu_sensor_engineer", + }, + { + "name": "泵组配置", + "sub_menu": "menu_pump_engineer", + }, + { + "name": "变频器参数", + "sub_menu": "menu_freq_convert", + }, + { + "name": "系统信息", + "sub_menu": "menu_system_engineer", + }, + { + "name": "数字IO测试", + "sub_menu": "test_io", + }, + { + "name": "模拟IO测试", + "sub_menu": "test_aio", + }, + { + "name": "用户参数", + "sub_menu": "menu_parameter", + }, + { + "name": "重启", + "action": "reboot", + }, + { + "name": "系统设置", + "sub_menu": "menu_system", + }, + { + "name": "普通设置", + "sub_menu": "menu_normal_set", + }, + { + "name": "功能设置", + "sub_menu": "menu_func_set", + }, + { + "name": "快捷入口", + "sub_menu": "menu_quick_tag", + }, + { + "name": "模拟量传感器", + "sub_menu": "memu_sensor_config", + }, +] + +memu_sensor_engineer = [ #工程师菜单的专属设置 + { + "name": "开关量输入配置", + "sub_menu": "menu_io_in", + }, + { + "name": "开关量输出配置", + "sub_menu": "menu_io_out", + }, + { + "name": "模拟量输入配置", + "sub_menu": "menu_aio_in", + }, + { + "name": "模拟量输出配置", + "sub_menu": "menu_aio_out", + }, + { + "name": "入口压力传感器", + "sub_menu": "menu_pressure_in", + }, + { + "name": "出口压力传感器", + "sub_menu": "menu_pressure_out", + }, + { + "name": "IO端子调试", + "sub_menu": "io_test", + }, +] + +menu_remote = [ + { + "name": "远控频率*", + "addr": "48124", + "alias" : "alias_freq_select", + }, + { + "name": "远控启停*", + "addr": "48123", + "alias" : "alias_command_select", + }, + { + "name": "远控命令*", + "addr": "56204", #"48122", + "alias" : "alias_command", + }, +] + +io_test = [ + { + "name": "数字IO调试", + "sub_menu": "test_io", + }, + { + "name": "模拟IO调试", + "sub_menu": "test_aio", + }, +] + +menu_io_out= [ + { + "name": "T/A*", + "alias": "alias_output", + "addr": "44272", + "action": "SelfPumpOffset22", + }, + { + "name": "T/B*", + "alias": "alias_output", + "addr": "44273", + "action": "SelfPumpOffset22", + }, + { + "name": "T/C*", + "alias": "alias_output", + "addr": "44275", + "action": "SelfPumpOffset22", + }, + { + "name": "T/A 极性*", + "addr": "44271.5", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "T/B 极性*", + "addr": "44271.6", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "T/C 极性*", + "addr": "44271.7", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "输出状态*", #3组继电器输出状态 + "addr": "40196.0#3", + "scale": 1.0, + "format": "%05.0f", + #"action": "Binary_%b", #二进制输出,显示3位 + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_io_polarity = [ + { + "name": "DI1极性*", + "addr": "44271.9", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "DI2极性*", + "addr": "44271.11", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "DI3极性*", + "addr": "44271.12", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "DI4极性*", + "addr": "44271.13", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, + { + "name": "DI5极性*", + "addr": "44271.14", + "alias": "alias_di_polarity", + "action": "SelfPumpOffset22", + }, +] + +menu_io_in= [ + { + "name": "D1*", + "alias": "alias_input", + "addr": "44265", + "action": "SelfPumpOffset22", + }, + + { + "name": "D2*", + "alias": "alias_input", + "addr": "44267", + "action": "SelfPumpOffset22", + }, + { + "name": "D3*", + "alias": "alias_input", + "addr": "44268", + "action": "SelfPumpOffset22", + }, + { + "name": "D4*", + "alias": "alias_input", + "addr": "44269", + "action": "SelfPumpOffset22", + }, + { + "name": "D5*", + "alias": "alias_input", + "addr": "44270", + "action": "SelfPumpOffset22", + }, + { + "name": "DI极性配置", + "sub_menu": "menu_io_polarity", + }, +] + +menu_aio_out= [ + { + "name": "AO1*", + "alias": "alias_aioutput", + "addr": "44285", + "action": "SelfPumpOffset22", + }, + { + "name": "AO1 4mA*", + "addr": "48053", + "format": "%04.0f", + "min" : 0, + "max" : 4095, + }, + { + "name": "AO1 20mA*", + "addr": "48054", + "format": "%04.0f", + "min" : 0, + "max" : 4095, + }, + { + "name": "AO校正", + "sub_menu": "menu_ao_cal", + }, +] +menu_aio_in= [ + { + "name": "AI1*", + "alias": "alias_aiinput", + "addr": "44282", + "action" : "SelfPumpOffset22" + }, + { + "name": "AI2*", + "alias": "alias_aiinput", + "addr": "44283", + "action" : "SelfPumpOffset22" + }, + { + "name": "AI1标定", + "sub_menu": "menu_aio_set2", + }, + { + "name": "AI2标定", + "sub_menu": "menu_aio_set3", + }, + { + "name": "AI1频率设置", + "sub_menu": "menu_chlorine", + }, + { + "name": "AI2频率设置", + "sub_menu": "menu_dirty", + }, +] + + + + +menu_aio_set2= [ + { + "name": "当前AD值", + "format" : "%05.0f", + "addr": "56208", + "property": MENU_PROPERTY_READ_ONLY, + }, + + { + "name": "设为AD值10V", + "action":"AI_Calibrate2", + }, + { + "name": "AI1模式", + "addr": "44271.1", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, +] + +menu_aio_set3= [ + { + "name": "当前AD值", + "format" : "%05.0f", + "addr": "56209", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "设为AD值10V", + "action":"AI_Calibrate3", + }, + { + "name": "AI2模式", + "addr": "44271.2", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, +] + +menu_ao_cal = [ + { + "name": "模拟量输出", + "format" : "%05.0f", + "addr": "48061", + "min" : 0, + "max" : 32000, + "action":"AO_Calibrate", + }, + { + "name": "4mA输出标定", + "action":"AO_Calibrate4mA", + }, + { + "name": "20mA输出标定", + "action":"AO_Calibrate20mA", + }, + { + "name": "AO1模式", + "addr": "44271.3", + "alias": "alias_anaolog_mode", + "action": "SelfPumpOffset22", + }, + +] + +menu_pump_engineer = [ #工程师菜单的专属设置 + { + "name": "PID参数设置", + "sub_menu": "menu_pid_set", + }, + { + "name": "定时换泵时间", + "addr": "40282", + "unit": "Min", + "format": "%05.0f", + }, + { + "name": "换泵冷却时间", + "addr": "40303", + "scale": 1.0, + "unit": "Min", + "format": "%05.0f", + }, + { + "name": "水泵流量*", + "addr": "48033", + "scale": 0.1, + "unit": "m³/h", + "format": "%04.1f", + }, + { + "name": "水泵扬程*", + "addr": "48032", + "unit": "m", + "format": "%04.0f", + }, +] + +freq_control_vector = [ + { + "name": "电动转矩上限*", + "min": 0, + "max": 200.0, + "scale" : 0.1, + "format": "%05.1f", + "addr": "48067", + "unit": "%", + "action": "FreqParaStop", #停泵时修改 + }, + { + "name": "制动转矩上限*", + "min": 0, + "max": 200.0, + "scale" : 0.1, + "format": "%05.1f", + "addr": "48068", + "unit": "%", + "action": "FreqParaStop", #停泵时修改 + }, +] + +freq_convert_data = [ + { + "name": "额定功率*", + "scale" : 0.01, + "unit" : "kW", + "format": "%05.2f", + "addr": "56833", + "action": "SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定电流*", + "scale" : 0.01, + "unit" : "A", + "format": "%05.2f", + "addr": "56834", + "action": "SelfPumpOffset24", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "额定转速*", + "scale" : 1.0, + "unit" : "rpm", + "format": "%04.0f", + "addr": "44031", + "property": MENU_PROPERTY_READ_ONLY, + "action": "SelfPumpOffset24", + }, +] + +freq_convert_sp = [ + { + "name": "停机方式*", + "alias": "alias_sp", + "addr": "48064", + "action": "FreqParaStop", #停泵时修改 + }, + { + "name": "反转控制*", + "alias": "alias_output_dir", + "addr": "48065", + "action": "FreqParaStop", #停泵时修改 + }, + { + "name": "反转使能*", + "alias": "alias_inverse_enable", + "addr": "48066", + "action": "FreqParaStop", #停泵时修改 + }, +] + +freq_convert_set = [ + { + "name": "加速时间*", + "unit": "S", + "addr": "44013", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", #停泵时修改 + }, + { + "name": "减速时间*", + "unit": "S", + "addr": "44014", + "scale" : 0.1, + "format": "%04.1f", + "action": "FreqParaStop_SelfPumpOffset24", #停泵时修改 + }, + { + "name": "频率上限*", + "unit": "Hz", + "addr": "44015", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", #停泵时修改 + }, + { + "name": "频率下限*", + "unit": "Hz", + "addr": "44016", + "scale" : 0.01, + "format": "%06.2f", + "action": "FreqParaStop_SelfPumpOffset24", + }, + { + "name": "载波频率*", + "unit": "kHz", + "scale" : 0.1, + "format": "%04.1f", + "addr": "44019", + "min" : 2.0, + "max" : 16.0, + "action": "FreqParaStop_SelfPumpOffset24", #停泵时修改 + }, + { + "name": "低速载波频率*", + "unit": "kHz", + "scale" : 0.1, + "format": "%04.1f", + "addr": "48063", + "min" : 0.8, + "max" : 16.0, + "action": "FreqParaStop", #停泵时修改 + }, + { + "name": "随机PWM*", + "min": 0, + "max": 10, + "format": "%02.0f", + "addr": "48062", + "action": "FreqParaStop", #停泵时修改 + }, + { + "name": "启动时间*", + "unit": "S", + "addr": "44020", + "scale" : 0.1, + "format": "%05.1f", + "action": "SelfPumpOffset24", #停泵时修改 + }, +] + +menu_freq_convert = [ + { + "name": "电机参数*", + "sub_menu": "freq_convert_data", + }, + { + "name": "启停控制*", + "sub_menu": "freq_convert_sp", + }, + { + "name": "基本设置*", + "sub_menu": "freq_convert_set", + }, + { + "name": "矢量控制*", + "sub_menu": "freq_control_vector", + }, + { + "name": "远控配置*", + "sub_menu": "menu_remote", + }, + { + "name": "自动复位限制", + "addr": "40301", + "unit": "次", + "format": "%02.0f", + }, + { + "name": "累计复位次数", + "addr": "40197", + "unit": "次", + "format": "%02.0f", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + +menu_system_engineer = [ #工程师菜单的专属设置 + { + "name": "变频器选择", + "alias" : "alias_converter", + "addr": "48012", + }, + { + "name": "权限管理", + "action": "admin", + }, + { + "name": "恢复出厂设置", + "sub_menu": "menu_factory_default", + "action" : "SavePoint_0" + }, + { + "name": "备份还原点1", + "sub_menu": "menu_save_restore1", + "action" : "SavePoint_1" + }, + { + "name": "备份还原点2", + "sub_menu": "menu_save_restore2", + "action" : "SavePoint_2" + }, + { + "name": "程序升级", + "action": "updata", + }, + { + "name": "程序蓝牙升级", + "action": "bluetooth_updata", + }, + { + "name": "参数全局还原", + "action": "backall", + }, +] +#显示1台泵 +menu_run_data1 = [ + { + "name": "转速*", + }, + { + "name": "电流*", + }, + { + "name": "功率*", + }, + { + "name": "时间*", + }, +] + +#显示2台泵 +menu_run_data2 = [ + { + "name": "转速*", + }, + { + "name": "电流*", + }, + { + "name": "功率*", + }, + { + "name": "时间*", + }, +] + +#显示3台泵 +menu_run_data3 = [ + { + "name": "转速*", + }, + { + "name": "电流*", + }, + { + "name": "功率*", + }, + { + "name": "时间*", + }, +] + +#模拟IO测试 +test_aio = [ + { + "name": "AO2", + "addr" : "48060", + "scale" : 0.1, + "format" : "%05.1f", + "unit" : "%", + }, +] + +#数字IO测试 +test_io = [ + { + "name": "Y1", + "addr" : "44272", + "alias" : "alias_output", + "action" : "TestY0_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y2", + "addr" : "44273", + "alias" : "alias_output", + "action" : "TestY1_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "Y3", + "addr" : "44275", + "alias" : "alias_output", + "action" : "TestY3_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X1", + "addr" : "44265", + "alias" : "alias_input", + "action" : "TestX1_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X2", + "addr" : "44266", + "alias" : "alias_input", + "action" : "TestX2_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X3", + "addr" : "44267", + "alias" : "alias_input", + "action" : "TestX3_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X4", + "addr" : "44268", + "alias" : "alias_input", + "action" : "TestX4_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X5", + "addr" : "44269", + "alias" : "alias_input", + "action" : "TestX5_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, + { + "name": "X6", + "addr" : "44270", + "alias" : "alias_input", + "action" : "TestX6_SelfPumpOffset22", + "property": MENU_PROPERTY_READ_ONLY, + }, +] + + +menu_pressure_in = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40226", + }, + { + "name": "全局值", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40023", + }, + { + "name": "本机值*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "56124", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40022", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40230", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40229", + }, + { + "name": "量程下限", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40228", + }, + { + "name": "量程上限", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40227", + }, +] + +menu_pressure_out = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40234", + }, + { + "name": "全局值", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40025", + }, + { + "name": "本机值*", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "56123", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40024", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40238", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40237", + }, + { + "name": "量程下限", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40236", + }, + { + "name": "量程上限", + "format": "%05.3f", + "scale": 0.001, + "unit": "Mpa", + "addr": "40235", + }, +] + + +menu_water_level = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40210", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40029", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56125", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40028", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40214", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40213", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40212", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40211", + }, +] + +menu_water_level2 = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43942", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56291", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56140", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56290", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43946", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43945", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43944", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43943", + }, +] +menu_water_level3 = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43974", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56285", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56143", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56284", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43978", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43977", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43976", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43975", + }, +] +menu_temp = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40250", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "40169", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56128", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40168", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40254", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40253", + }, + { + "name": "量程下限", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "40252", + }, + { + "name": "量程上限", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "40251", + }, +] + +menu_temp_inside = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43958", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56287", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56138", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56286", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43962", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43961", + }, + { + "name": "量程下限", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43960", + }, + { + "name": "量程上限", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43959", + }, +] + +menu_temp_middle = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43966", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56285", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "56137", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56284", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43970", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43969", + }, + { + "name": "量程下限", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43968", + }, + { + "name": "量程上限", + "format": "%05.1f", + "scale": 0.1, + "unit": "℃", + "addr": "43967", + }, +] + +menu_valve_opening = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40258", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56299", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56126", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56298", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40262", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40261", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40260", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "40259", + }, +] +menu_valve_opening2 = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43950", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "56289", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "56140", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56288", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43954", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43953", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "43952", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "%", + "addr": "43951", + }, +] +menu_chlorine = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40202", + }, + + { + "name": "本机值*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "56129", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40016", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40206", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40205", + }, + { + "name": "量程下限", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40204", + }, + { + "name": "量程上限", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40203", + }, +] +menu_dirty = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40210", + }, + { + "name": "本机值*", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "56130", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40018", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40214", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40213", + }, + { + "name": "量程下限", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40212", + }, + { + "name": "量程上限", + "format": "%06.2f", + "scale": 0.01, + "unit": "%", + "addr": "40211", + }, +] +menu_flow_out = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40242", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "40027", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "56127", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40026", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40246", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40245", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "40244", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "40243", + }, +] +menu_flow_in = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43918", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "56297", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "56132", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56296", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43922", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43921", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "43920", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m³/h", + "addr": "43919", + }, +] +menu_ph_sensor = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "40218", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "addr": "40021", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "addr": "56131", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "40020", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "40222", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "40221", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "addr": "40220", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "addr": "40219", + }, +] +menu_wet_sensor = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43926", + }, + { + "name": "全局值", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56293", + }, + { + "name": "本机值*", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "56142", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56292", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43930", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43929", + }, + { + "name": "量程下限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43928", + }, + { + "name": "量程上限", + "format": "%05.2f", + "scale": 0.01, + "unit": "m", + "addr": "43927", + }, +] +menu_sound_sensor = [ + { + "name": "配置", + "alias" : "alias_bool", + "addr": "43934", + }, + { + "name": "全局值", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "56295", + }, + { + "name": "本机值*", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "56141", + }, + { + "name": "AD值*", + "format": "%05.0f", + "addr": "56294", + }, + { + "name": "ADMin*", + "format": "%05.0f", + "addr": "43938", + }, + { + "name": "ADMax*", + "format": "%05.0f", + "addr": "43937", + }, + { + "name": "量程下限", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "43936", + }, + { + "name": "量程上限", + "format": "%05.1f", + "scale": 0.1, + "unit": "db", + "addr": "43935", + }, +] + +#信号配置 +memu_sensor_config = [ + { + "name": "入口压力传感器", + "sub_menu": "menu_pressure_in", + }, + { + "name": "出口压力传感器", + "sub_menu": "menu_pressure_out", + }, + { + "name": "输入流量传感器", + "sub_menu": "menu_flow_in", + }, + { + "name": "输出流量传感器", + "sub_menu": "menu_flow_out", + }, + { + "name": "水箱液位1", + "sub_menu": "menu_water_level", + }, + { + "name": "水箱液位2", + "sub_menu": "menu_water_level2", + }, + { + "name": "水箱液位3", + "sub_menu": "menu_water_level3", + }, + { + "name": "调节阀开度反馈", + "sub_menu": "menu_valve_opening", + }, + { + "name": "开度反馈2", + "sub_menu": "menu_valve_opening2", + }, + { + "name": "温度传感器", + "sub_menu": "menu_temp", + }, + { + "name": "站内温度传感器", + "sub_menu": "menu_temp_inside", + }, + { + "name": "夹层温度传感器", + "sub_menu": "menu_temp_middle", + }, + { + "name": "余氯传感器", + "sub_menu": "menu_chlorine", + }, + { + "name": "浊度传感器", + "sub_menu": "menu_dirty", + }, + { + "name": "PH传感器", + "sub_menu": "menu_ph_sensor", + }, + { + "name": "湿度传感器", + "sub_menu": "menu_wet_sensor", + }, + { + "name": "噪音传感器", + "sub_menu": "menu_sound_sensor", + }, + +] + +menu_mode = [ + { + "name": "模式配置*", + "alias": "alias_mode_config", + "addr": "40000", + }, +] + +menu_main = [ + #{ + # "name": "设置", + # "sub_menu": "menu_normal_set", + #}, + { + "name": "数据", + "sub_menu": "menu_data_pump" + }, + { + "name": "模式", + "sub_menu": "menu_link" + }, + { + "name": "菜单", + "sub_menu": "menu_normal_menu" + }, +] +menu_normal_menu = [ #普通菜单页面 + { + "name": "常用设置", + "sub_menu": "menu_normal_set", + }, + { + "name": "信号配置", + "sub_menu": "memu_sensor_engineer", + }, + { + "name": "泵组配置", + "sub_menu": "menu_pumpgroup", + }, + { + "name": "保护配置", + "sub_menu": "menu_protect", + }, + { + "name": "变频器参数", + "sub_menu": "menu_freq_convert", + }, + { + "name": "通讯配置", + "sub_menu": "menu_comm_set", + }, + { + "name": "故障配置", + "sub_menu": "menu_alarm_history", + }, + { + "name": "系统设置", + "sub_menu": "menu_system", + }, +] + +menu_script_desc = [ + { + "name": "脚本 V1.08", + }, + { + "name": "输出流量:10, 输入流量:11", + }, + { + "name": "噪声传感器: 通讯地址=7", + }, + { + "name": "温湿度传感器: 通讯地址=8", + }, + { + "name": "水质分析仪: 通讯地址=5", + }, + { + "name": "夹层温度: 通讯地址=9", + }, + { + "name": "电度表: 通讯地址=6", + }, +] + +menu_factory_default = [ + { + "name": "恢复到本机", + "action": "self_restore_0", + }, + { + "name": "恢复到全局", + "action": "global_restore_0", + }, + { + "name": "退 出", + "action": "exit", + }, +] + +menu_save_restore1 = [ + { + "name": "保存", + "action": "save_1", + }, + { + "name": "恢复到本机", + "action": "self_restore_1", + }, + { + "name": "恢复到全局", + "action": "global_restore_1", + }, + { + "name": "退 出", + "action": "exit", + }, +] + +menu_save_restore2 = [ + { + "name": "保存", + "action": "save_2", + }, + { + "name": "恢复到本机", + "action": "self_restore_2", + }, + { + "name": "恢复到全局", + "action": "global_restore_2", + }, + { + "name": "退 出", + "action": "exit", + }, +] + +display_main = [ + { + "name": "PumpName", + "alias": "alias_PumpName", + "addr" : "48000", #PumpId + }, + { + "name": "PressureOutMax", #出口压力上限 + "format": "%4.0f", + "addr" : "40235", + }, + { + "name": "设定压力", + "addr": "40416", + "format": "%4.0f", + }, +] + +menu_caption = [ + {"name" : "menu_main", "menu" : menu_main, "caption": "主菜单", "page" : 2, "max_items" : 4, "next" : menu_run_data1, "prev": menu_hand_adjust, "display": display_main}, + {"name" : "display_main", "menu" : display_main, "caption": "display_main", "page" : 2, "max_items" : 4}, + #{"name" : "menu_link", "menu" : menu_link, "caption": "联机设置", "page" : 4, "max_items" : 6, "next" : menu_run_data1, "prev" : menu_main}, + {"name" : "menu_run_data1", "menu" : menu_run_data1, "caption": "数据页1", "page" : 3, "max_items" : 1, "next" : menu_alarm, "prev" : menu_main}, + {"name" : "menu_run_data2", "menu" : menu_run_data2, "caption": "数据页2", "page" : 13, "max_items" : 1, "next" : menu_alarm, "prev" : menu_main}, + {"name" : "menu_run_data3", "menu" : menu_run_data3, "caption": "数据页3", "page" : 23, "max_items" : 1, "next" : menu_alarm, "prev" : menu_main}, + {"name" : "menu_alarm", "menu" : menu_alarm, "caption": "报警显示", "page" : 5, "max_items" : 2, "next" : menu_curve_history, "prev" : menu_run_data1}, + {"name" : "menu_curve_history", "menu" : menu_curve_history, "caption": "当前曲线", "page" : 12, "max_items" : 1, "next" : menu_hand_adjust, "prev" : menu_alarm}, #25改成12, 显示当前页面 + {"name" : "menu_hand_adjust", "menu" : menu_hand_adjust, "caption": "手动调速", "page" : 15, "max_items" : 1, "next" : menu_main, "prev" : menu_curve_history, "display": disp_hand_adjust}, + + {"name" : "menu_link", "menu" : menu_link, "caption": "模式切换", "page" : 4, "max_items" : 6}, + + {"name" : "disp_hand_adjust", "menu" : disp_hand_adjust, "caption": "显示调速", "page" : 15, "max_items" : 1}, + {"name" : "menu_alarm_clear", "menu" : menu_alarm_clear, "caption": "清除故障", "page" : 11, "max_items" : 8}, + {"name" : "menu_alarm_history", "menu" : menu_alarm_history, "caption": "历史故障", "page" : 11, "max_items" : 8}, + {"name" : "dynamic_page_main", "menu" : dynamic_page_main, "caption": "测量数据", "page" : 2, "max_items" : 4}, + {"name" : "mqtt_pack_alarm", "menu" : mqtt_pack_alarm, "caption": "报警数据", "page" : 5, "max_items" : 8}, + {"name" : "menu_sleep_set", "menu" : menu_sleep_set, "caption": "休眠设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_winter_set", "menu" : menu_winter_set, "caption": "防冻设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_addreduce_set", "menu" : menu_addreduce_set, "caption": "加减泵设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_pid_set", "menu" : menu_pid_set, "caption": "PID参数设定", "page" : 11, "max_items" : 8}, + #{"name" : "menu_pumpgroup", "menu" : menu_pumpgroup, "caption": "泵组配置", "page" : 11, "max_items" : 8}, + {"name" : "memu_sensor_config", "menu" : memu_sensor_config, "caption": "模拟量传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_system", "menu" : menu_system, "caption": "系统信息", "page" : 11, "max_items" : 8}, + #{"name" : "menu_protect", "menu" : menu_protect, "caption": "保护设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_full_set", "menu" : menu_full_set, "caption": "工程师菜单", "page" : 11, "max_items" : 8}, + {"name" : "menu_normal_menu", "menu" : menu_normal_menu, "caption": "普通菜单", "page" : 11, "max_items" : 8}, + #{"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_statistic", "menu" : menu_statistic, "caption": "统计信息", "page" : 11, "max_items" : 8}, + {"name" : "menu_time_pressure", "menu" : menu_time_pressure, "caption": "分时段压力", "page" : 11, "max_items" : 8}, + {"name" : "cur_curve", "menu" : cur_curve, "caption": "当前压力", "page" : 12, "max_items" : 1}, + {"name" : "menu_io_out", "menu" : menu_io_out, "caption": "开关量输出配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_io_in", "menu" : menu_io_in, "caption": "开关量输入配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_io_polarity", "menu" : menu_io_polarity, "caption": "开关量极性配置", "page" : 11, "max_items" : 8}, + + {"name" : "menu_aio_out", "menu" : menu_aio_out, "caption": "模拟量输出配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_in", "menu" : menu_aio_in, "caption": "模拟量输入配置", "page" : 11, "max_items" : 8}, + #{"name" : "menu_aio_set1", "menu" : menu_aio_set1, "caption": "模拟输入校正1", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_set2", "menu" : menu_aio_set2, "caption": "模拟输入校正1", "page" : 11, "max_items" : 8}, + {"name" : "menu_aio_set3", "menu" : menu_aio_set3, "caption": "模拟输入校正2", "page" : 11, "max_items" : 8}, + {"name" : "menu_ao_cal", "menu" : menu_ao_cal, "caption": "模拟输出标定", "page" : 11, "max_items" : 8}, + {"name" : "menu_time_switch", "menu" : menu_time_switch, "caption": "定时换泵设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_basic_set", "menu" : menu_basic_set, "caption": "基本参数设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_protect_low", "menu" : menu_protect_low, "caption": "压力保护设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_protect_ex", "menu" : menu_protect_ex, "caption": "爆管保护设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_comm_485", "menu" : menu_comm_485, "caption": "485 通讯配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_comm_can", "menu" : menu_comm_can, "caption": "CAN 通讯配置", "page" : 11, "max_items" : 8}, + + #卧龙普通菜单 + {"name" : "menu_normal_set", "menu" : menu_normal_set, "caption": "常用设置", "page" : 6, "max_items" : 12}, + {"name" : "memu_sensor_engineer","menu" : memu_sensor_engineer,"caption": "信号配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_pumpgroup", "menu" : menu_pumpgroup, "caption": "泵组配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_protect", "menu" : menu_protect, "caption": "保护设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_comm_set", "menu" : menu_comm_set, "caption": "通讯设置", "page" : 11, "max_items" : 8}, + #{"name" : "menu_alarm", "menu" : menu_alarm, "caption": "报警显示", "page" : 5, "max_items" : 2}, + #{"name" : "menu_system", "menu" : menu_system, "caption": "系统设置", "page" : 11, "max_items" : 8}, + + #变频器菜单 + {"name" : "menu_freq_convert", "menu" : menu_freq_convert, "caption": "变频器参数", "page" : 11, "max_items" : 8}, + {"name" : "freq_convert_data", "menu" : freq_convert_data, "caption": "电机参数", "page" : 11, "max_items" : 8}, + {"name" : "freq_convert_sp", "menu" : freq_convert_sp, "caption": "启停控制", "page" : 11, "max_items" : 8}, + {"name" : "freq_convert_set", "menu" : freq_convert_set, "caption": "基本设置", "page" : 11, "max_items" : 8}, + + #工程师菜单 + #{"name" : "menu_freq_convert", "menu" : menu_freq_convert, "caption": "变频器参数", "page" : 11, "max_items" : 8}, + #{"name" : "memu_sensor_engineer","menu" : memu_sensor_engineer,"caption": "信号配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_system_engineer", "menu" : menu_system_engineer,"caption": "系统信息", "page" : 11, "max_items" : 8}, + {"name" : "menu_pump_engineer", "menu" : menu_pump_engineer,"caption": "泵组配置", "page" : 11, "max_items" : 8}, + {"name" : "menu_remote", "menu" : menu_remote, "caption": "远控配置", "page" : 11, "max_items" : 8}, + {"name" : "io_test", "menu" : io_test, "caption": "IO端子调试", "page" : 11, "max_items" : 8}, + {"name" : "test_io", "menu" : test_io, "caption": "数字IO调试", "page" : 7, "max_items" : 9}, + {"name" : "test_aio", "menu" : test_aio, "caption": "模拟IO调试", "page" : 8, "max_items" : 1}, + {"name" : "menu_factory_default", "menu" : menu_factory_default,"caption": "恢复出厂设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_save_restore1", "menu" : menu_save_restore1,"caption": "备份还原点1", "page" : 11, "max_items" : 8}, + {"name" : "menu_save_restore2", "menu" : menu_save_restore2,"caption": "备份还原点2", "page" : 11, "max_items" : 8}, + + #传感器 + {"name" : "menu_pressure_in", "menu" : menu_pressure_in, "caption": "入口压力传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_pressure_out", "menu" : menu_pressure_out, "caption": "出口压力传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_water_level", "menu" : menu_water_level, "caption": "水箱液位传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_water_level2", "menu" : menu_water_level2, "caption": "水箱液位2", "page" : 11, "max_items" : 8}, + {"name" : "menu_water_level3", "menu" : menu_water_level3, "caption": "水箱液位3", "page" : 11, "max_items" : 8}, + {"name" : "menu_temp", "menu" : menu_temp, "caption": "温度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_temp_inside", "menu" : menu_temp_inside, "caption": "站内温度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_temp_middle", "menu" : menu_temp_middle, "caption": "夹层温度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_valve_opening", "menu" : menu_valve_opening, "caption": "调节阀开度反馈", "page" : 11, "max_items" : 8}, + {"name" : "menu_valve_opening2", "menu" : menu_valve_opening2,"caption": "开度反馈2", "page" : 11, "max_items" : 8}, + {"name" : "menu_flow_out", "menu" : menu_flow_out, "caption": "输出流量传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_flow_in", "menu" : menu_flow_in, "caption": "输入流量传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_chlorine", "menu" : menu_chlorine, "caption": "AI1频率设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_dirty", "menu" : menu_dirty, "caption": "AI2频率设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_ph_sensor", "menu" : menu_ph_sensor, "caption": "PH传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_wet_sensor", "menu" : menu_wet_sensor, "caption": "湿度传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_sound_sensor", "menu" : menu_sound_sensor, "caption": "噪音传感器", "page" : 11, "max_items" : 8}, + {"name" : "menu_mode", "menu" : menu_mode, "caption": "工作模式", "page" : 11, "max_items" : 8}, + + + #设置页面 + {"name" : "menu_func_set", "menu" : menu_func_set, "caption": "功能设置", "page" : 11, "max_items" : 8}, + {"name" : "menu_quick_tag", "menu" : menu_quick_tag, "caption": "快捷入口", "page" : 11, "max_items" : 8}, + #{"name" : "menu_normal_set", "menu" : menu_normal_set, "caption": "常用设置", "page" : 6, "max_items" : 12, "next" : menu_func_set, "prev" : menu_quick_tag}, + #{"name" : "menu_func_set", "menu" : menu_func_set, "caption": "功能设置", "page" : 11, "max_items" : 8, "next" : menu_run_set, "prev" : menu_normal_set}, + #{"name" : "menu_run_set", "menu" : menu_run_set, "caption": "运行设置", "page" : 6, "max_items" : 12, "next" : menu_protect_set, "prev" : menu_func_set}, + #{"name" : "menu_protect_set", "menu" : menu_protect_set, "caption": "保护设置", "page" : 6, "max_items" : 12, "next" : menu_quick_tag, "prev" : menu_run_set}, + #{"name" : "menu_quick_tag", "menu" : menu_quick_tag, "caption": "快捷入口", "page" : 11, "max_items" : 8, "next" : menu_normal_set, "prev" : menu_protect_set}, + #数据页面 + {"name" : "menu_data_pump", "menu" : menu_data_pump, "caption": "本机数据", "page" : 6, "max_items" : 12, "next" : menu_data_Native}, + {"name" : "menu_data_Native", "menu" : menu_data_Native, "caption": "系统数据", "page" : 6, "max_items" : 12, "prev" : menu_data_pump}, + #{"name" : "menu_data_user", "menu" : menu_data_user, "caption": "用户数据", "page" : 6, "max_items" : 12, "next" : menu_data_pump, "prev" : menu_data_Native}, + #用户参数页面 + {"name" : "menu_parameter", "menu" : menu_parameter, "caption": "用户参数", "page" : 11, "max_items" : 8, "next" : menu_temp_control, "prev" : menu_pin_configure}, + {"name" : "menu_temp_control", "menu" : menu_temp_control, "caption": "调温配置", "page" : 11, "max_items" : 8, "next" : menu_tank1, "prev" : menu_parameter}, + {"name" : "menu_tank1", "menu" : menu_tank1, "caption": "1#水箱", "page" : 11, "max_items" : 8, "next" : menu_tank2, "prev" : menu_temp_control}, + {"name" : "menu_tank2", "menu" : menu_tank2, "caption": "2#水箱", "page" : 11, "max_items" : 8, "next" : menu_tank3, "prev" : menu_tank1}, + {"name" : "menu_tank3", "menu" : menu_tank3, "caption": "3#水箱", "page" : 11, "max_items" : 8, "next" : menu_tank_switch, "prev" : menu_tank2}, + {"name" : "menu_tank_switch", "menu" : menu_tank_switch, "caption": "箱罐切换", "page" : 11, "max_items" : 8, "next" : menu_pump_inletvalve, "prev" : menu_tank3}, + {"name" : "menu_pump_inletvalve","menu" : menu_pump_inletvalve,"caption": "泵组进水阀门", "page" : 11, "max_items" : 8, "next" : menu_explosion_valve, "prev" : menu_tank_switch}, + {"name" : "menu_explosion_valve","menu" : menu_explosion_valve,"caption": "爆管阀门", "page" : 11, "max_items" : 8, "next" : menu_peripheral, "prev" : menu_pump_inletvalve}, + {"name" : "menu_peripheral", "menu" : menu_peripheral, "caption": "其他外设", "page" : 11, "max_items" : 8, "next" : menu_fan_arefaction, "prev" : menu_explosion_valve}, + {"name" : "menu_fan_arefaction", "menu" : menu_fan_arefaction,"caption": "风机除湿", "page" : 11, "max_items" : 8, "next" : menu_pin_configure, "prev" : menu_peripheral}, + {"name" : "menu_pin_configure", "menu" : menu_pin_configure, "caption": "引脚配置", "page" : 11, "max_items" : 8, "next" : menu_script_desc, "prev" : menu_fan_arefaction}, + {"name" : "menu_script_desc", "menu" : menu_script_desc, "caption": "脚本描述", "page" : 14, "max_items" : 8, "next" : menu_parameter, "prev" : menu_pin_configure}, + + {"name" : "menu_other", "menu" : menu_other, "caption": "其他", "page" : 11, "max_items" : 8}, + {"name" : "freq_control_vector", "menu" : freq_control_vector, "caption": "矢量控制", "page" : 11, "max_items" : 8}, +] + +class class_pump_comm_device_config(class_comm_device_config): + def __init__(self): + class_comm_device_config.__init__(self) + pass + + #@override get_alias_table + def get_alias_table(self) : + return alias_table + + #@override get_comm_table + def get_comm_table(self) : + return modbus_comm_table, func_comm_table_trigger_check + + #@override get_menu_main + def get_menu_top(self) : + return menu_main + + #@override get_mqtt_table + def get_mqtt_table(self) : + return mqtt_topic_subscribe + + #@override menu_get_display_page + def menu_get_display_page(self, active_menu): + return menu_page.KUNLUN_GRAOUP_PAGE_MENU + + def get_menu_caption_info(self) : + return menu_caption + + +#comm_device_config的名字不要更改, 创建通讯配置类 +comm_device_config = class_pump_comm_device_config() diff --git a/menu_utils.py b/menu_utils.py new file mode 100644 index 0000000..e85dd43 --- /dev/null +++ b/menu_utils.py @@ -0,0 +1,109 @@ +import re +import sys +import inspect +import enum as Enum + +def find_variable_name(value): + frame = inspect.currentframe() + try: + for var_name, var_value in frame.f_back.f_locals.items(): + if var_value is value: + return var_name + finally: + del frame + + +def dict_or_object_get_attr(dict_or_object, name, default_attr) : + if dict_or_object == None or name == None: + return default_attr + + if type(dict_or_object) == dict : + if name in dict_or_object.keys(): + return dict_or_object[name] + return default_attr + + return getattr(dict_or_object, name, default_attr) + +def value_u64_to_s64(value) : + svalue = value + if (svalue >> 63) & 0x1 : + svalue = -((svalue ^ 0xFFFFFFFFFFFFFFFF) + 1) + return svalue + +def value_u32_to_s32(value) : + svalue = value + if (svalue & 0x80000000) : + svalue = -((svalue ^ 0xFFFFFFFF) + 1) + return svalue + +def value_u16_to_s16(value) : + svalue = value + if (svalue & 0x8000) : + svalue = -((svalue ^ 0xFFFF) + 1) + return svalue + +''' +正则表达式 +^:匹配字符串开头。 +$:匹配字符串结尾。 +.:匹配任意字符。 +*:匹配前面的字符零次或多次。 ++:匹配前面的字符一次或多次。 +?:匹配前面的字符零次或一次。 +[]:匹配括号中列举的任意一个字符。 +[^]:匹配除了括号中列举的字符以外的任意一个字符。 +():标记一个子表达式的开始和结束位置。 +\s: 包含空格 +\S: 不包含空格 +\d: 包含数字 +\D: 不包含数字 +''' +def comm_str_unpack(comm_str) : + pattern_bit_regs = "(\d+)\.(\d+)((\s*)#(\s*)(\d+))*" + pattern_regs = "(\d+)((\s*)#(\s*)(\d+))*" + + reg_addr = 0 + reg_count = 0 + bit = -1 + + bit_reg_result = None + reg_result = None + + if comm_str == None : + return reg_addr, bit, reg_count + + #[8000.2 # 3] or [8000.2] + bit_reg_result = re.search(pattern_bit_regs, comm_str) + if bit_reg_result : + match_str = bit_reg_result.string + bit_result_value = re.findall('\d+', match_str) + item_count = len(bit_result_value) + + if item_count >= 2 : + reg_addr = int(bit_result_value[0]) + bit = int(bit_result_value[1]) + if item_count == 3: + reg_count = int(bit_result_value[2]) + else : + reg_count = 1 + + #[8000 # 2] or [8000] + reg_result = None + if bit_reg_result == None: + reg_result = re.search(pattern_regs, comm_str) + + if reg_result != None: + match_str = reg_result.string + reg_result_value = re.findall('\d+', match_str) + item = len(reg_result_value) + + if item >= 1 : + reg_addr = int(reg_result_value[0]) + + if item == 2 : + reg_count = int(reg_result_value[1]) + else : + reg_count = 1 + + return reg_addr, bit, reg_count + diff --git a/modbus_server.py b/modbus_server.py new file mode 100644 index 0000000..f997c56 --- /dev/null +++ b/modbus_server.py @@ -0,0 +1,75 @@ +import modbus_tk.defines as cst +from modbus_tk import modbus_tcp, hooks, modbus + +REGISTER_MENU_DISPLAY_PAGE = 1000 +REGISTER_MENU_ITEM_SELECT_MASK = 1001 +REGISTER_MENU_POPUP_MODIFY_ACTIVE = 1002 +REGISTER_MENU_MOVIE_ACTIVE_ID = 1003 +REGISTER_MENU_POSITION_STATUS = 1004 +REGISTER_MENU_STRING_ROW0_COL1 = 1240 +REGISTER_MENU_STRING_ROW0_COL0 = 1080 +REGISTER_MENU_MODIFY_CAPTION_STRING = 1020 +REGISTER_MENU_MODIFY_STRING = 1040 +REGISTER_MENU_MODIFY_SELECT_STRING = 1060 + +BLOCK_REGISTER = '3' +BLOCK_COIL = '0' + +class class_modbus_tcp_server() : + def __init__(self, + slave_addr = 2, + slave_ip= "127.0.0.1", + slave_port = 502): + self.slave_addr = slave_addr + self.slave_ip = slave_ip + self.slave_port = slave_port + + self.slave_station = None + self._connect() + + # 创建从站总服务器 + server = modbus_tcp.TcpServer(address=self.slave_ip, port = self.slave_port, timeout_in_sec = 0.5) # address必须设置,port默认为502 + + # 创建从站 + self.slave_station : modbus.Slave = server.add_slave(self.slave_addr) + + # 为从站添加存储区 + self.slave_station.add_block(BLOCK_REGISTER, cst.HOLDING_REGISTERS, starting_address = 0, size = 65536) + self.slave_station.add_block(BLOCK_COIL, cst.COILS, starting_address = 0, size = 65536) + + server.start() + def _connect(self): + try: + # 创建从站总服务器 + self.server = modbus_tcp.TcpServer(address=self.slave_ip, port=self.slave_port, timeout_in_sec=0.5) + # 创建从站 + self.slave_station = self.server.add_slave(self.slave_addr) + # 为从站添加存储区 + self.slave_station.add_block(BLOCK_REGISTER, cst.HOLDING_REGISTERS, starting_address=0, size=65536) + self.slave_station.add_block(BLOCK_COIL, cst.COILS, starting_address=0, size=65536) + + self.server.start() + print("Modbus TCP 服务器连接成功!") + except Exception as e: + print("Modbus TCP 服务器连接失败:", e) + def is_connected(self): + return self.server != None + + def update_server_register(self, addr, value): + if self.slave_station: + self.slave_station.set_values(BLOCK_REGISTER, addr, value) + + def reconnect(self): + print("正在重启 Modbus TCP 服务器...") + self.stop() + self._connect() + + def stop(self): + if self.server: + self.server.stop() + self.server = None + print("Modbus TCP 服务器停止...") + + def update_server_register(self, addr, value) : + if self.slave_station : + self.slave_station.set_values(BLOCK_REGISTER, addr, value) diff --git a/mqtt_device.py b/mqtt_device.py new file mode 100644 index 0000000..84ea794 --- /dev/null +++ b/mqtt_device.py @@ -0,0 +1,218 @@ +import threading +import time +import string +from threading import Thread +import menu_utils as utils +import paho.mqtt.client as mqtt +from print_color import * + + +#mqtt 消息处理基类, mqtt消息处理 +class class_comm_mqtt_interface : + def __init__(self, name = "mqtt handler"): + self.name = name + + def on_message(self, mqtt_thread, topic, message) : + return + + def on_connect(self, mqtt_thread, userdata, flags, rc) : + return + +#mqtt服务器连接处理 +def mqtt_on_connect(client, userdata, flags, rc): + if rc == 0: + # 连接成功 + print_normal_msg("Mqtt 服务器连接成功") + elif rc == 1: + # 协议版本错误 + print_error_msg("协议版本错误") + elif rc == 2: + # 无效的客户端标识 + print_error_msg("无效的客户端标识") + elif rc == 3: + # 服务器无法使用 + print_error_msg("Mqtt 服务器无法使用") + elif rc == 4: + # 错误的用户名或密码 + print_error_msg("错误的用户名或密码") + elif rc == 5: + # 未经授权 + print_error_msg("未经授权") + + #获取线程类 (class_comm_mqtt_thread) + mqtt_thread : class_comm_mqtt_thread= userdata + unique_object : class_comm_mqtt_interface = None + + #遍历所有unique_object, 通知其 on_connect 事件 + for unique_object in mqtt_thread.unique_object_dict.values() : + if isinstance(unique_object, list) : #unique_object 可能是列表, 所以需要遍历 + for each_object in unique_object: + if hasattr(each_object, "on_connect") : + each_object.on_connect(mqtt_thread, userdata, flags, rc) + elif hasattr(unique_object, "on_connect") : + unique_object.on_connect(mqtt_thread, userdata, flags, rc) + +#mqtt接收到主题, 通过主题中包含的 unique_name, 定位到 uniuqe_object, 并调用 unique_object.on_message 函数 +def mqtt_on_message(client, userdata, message): + #print("mqtt message:", message.topic, message.payload.decode("utf-8")) + + #获取线程类 (class_comm_mqtt_thread) + mqtt_thread : class_comm_mqtt_thread= userdata + + unique_object : class_comm_mqtt_interface = None + for unique_name, search_unique_object in mqtt_thread.unique_object_dict.items() : + if unique_name in message.topic : + unique_object = search_unique_object + break + + #mqtt线程本身无法处理对应的主题消息, 由mqtt 所对应的unique_object处理 + if unique_object != None : + if isinstance(unique_object, list) : #unique_object 可能是列表, 所以需要遍历 + for each_object in unique_object: + if hasattr(each_object, "on_message") : + each_object.on_message(mqtt_thread, message.topic, message.payload) + elif hasattr(unique_object, "on_message") : + unique_object.on_message(mqtt_thread, message.topic, message.payload) + +class class_comm_mqtt_thread(Thread): + def __init__(self, user_name = "admin", password = "admin") : + Thread.__init__(self) + self.client = None + + self.subscribe_list = [] + self.publish_list = [] + self.publish_list_lock = threading.Lock() + self.condition = threading.Condition() + self.stop_request = False + + self.server = "127.0.0.1" + self.port = 1883 + self.user_name = user_name + self.password = password + self.keepalive = 60 + + self.unique_object_dict = {} #key = unique_name, value = device_object + return + + #unique_object: 为unique_object_subscribe_name对应的object, 在回调 + def add_unique_object(self, unique_name : string, unique_object : class_comm_mqtt_interface) : + self.unique_object_dict[unique_name] = unique_object + + #topic 中 需要包含 + def subscribe(self, topic : string) : + if self.is_connect() and self.client: + if topic not in self.subscribe_list : + self.subscribe_list.append(topic) + self.client.subscribe(topic) + + def set_mqtt_server(self, server = "127.0.0.1", port = 1883, keep_alive = 60.0, user_name = "admin", password = "admin") : + self.server = server + self.port = port + self.user_name = user_name + self.password = password + self.keepalive = keep_alive + + #用于判断 mqtt_thread是否已经连接 + def is_connect(self) : + if self.client == None : + return False + return self.client.is_connected() + + def open(self): + try : + self.client = mqtt.Client() + self.client.user_data_set(self) + self.client.on_connect = mqtt_on_connect + self.client.on_message = mqtt_on_message + self.client.username_pw_set(self.user_name, self.password) + self.client.connect(self.server, self.port, self.keepalive) + except Exception as e : + print_error_msg(str(e) + "mqtt_server: ip=%s, port = %d"%(self.server, self.port)) + if self.client: # 如果self.client已经被初始化了,则断开连接 + self.client.disconnect() + self.client = None + return None # 添加返回语句,告知调用者连接失败 + return self.client + + def close(self): + self.stop_request = True + + def publish(self, topic, message) : + if self.is_connect : + self.publish_list_lock.acquire() + self.publish_list.append([topic, message]) + self.publish_list_lock.release() + + self.condition.acquire() + self.condition.notify() + self.condition.release() + return + + def publish_wait(self, topic, message, timeout) : + if self.is_connect : + self.publish_list_lock.acquire() + self.publish_list.insert(0, [topic, message]) + self.publish_list_lock.release() + self.condition.acquire() + self.condition.notify() + self.condition.release() + return + + def run(self): + while self.stop_request == False : + print_warning_msg("mqtt 线程启动, 服务器端口:server = %s:%d"%(self.server, self.port)) + + wait_open_timeout = 0 + self.subscribe_list = [] #取消订阅列表, 连接后重新订阅 + + while self.client == None and self.stop_request == False: + if wait_open_timeout == 0 : + print_warning_msg("mqtt连接中, 服务器端口:server = %s:%d"%(self.server, self.port)) + self.open() + + if self.client == None : + time.sleep(0.1) + wait_open_timeout += 0.1 + if wait_open_timeout >= 5.0 : + wait_open_timeout = 0 + + time.sleep(0.2) + + if self.client : + self.client.loop_start() + time.sleep(0.2) + + while self.stop_request == False and self.client.is_connected() : + topic = None + topic_message = None + + self.publish_list_lock.acquire() + if len(self.publish_list) > 0 : + topic_message = self.publish_list.pop(0) + topic = topic_message[0] + message = topic_message[1] + self.publish_list_lock.release() + + if topic != None and message != None : + self.client.publish(topic, message) + + self.condition.acquire() + if len(self.publish_list) == 0: + self.condition.wait(timeout = 0.1) + self.condition.release() + + self.client.loop_stop() + self.client.disconnect() + self.client = None + + print_warning_msg("mqtt连接断开, 准备重启mqtt连接") + print_error_msg("mqtt 线程停止") + +if __name__ == "__main__": + object_mqtt1 = class_comm_mqtt_interface("object1 handler") + object_mqtt2 = class_comm_mqtt_interface("object2 handler") + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server(server = "127.0.0.1", port = 1883, keep_alive = 60, user_name="admin", password="admin") + global_mqtt_thread.add_unique_object("object1", object_mqtt1) + global_mqtt_thread.add_unique_object("object2", object_mqtt2) + global_mqtt_thread.start() diff --git a/mqtt_messages.db b/mqtt_messages.db new file mode 100644 index 0000000..3cc4c9f Binary files /dev/null and b/mqtt_messages.db differ diff --git a/mqtt_object.py b/mqtt_object.py new file mode 100644 index 0000000..fbbd612 --- /dev/null +++ b/mqtt_object.py @@ -0,0 +1,102 @@ +import menu_utils as utils +import json +from mqtt_device import class_comm_mqtt_interface, class_comm_mqtt_thread +from device_conf import class_comm_device_config +import string +from enum import Enum +import math +from print_color import * + +#创建mqtt 消息属性字典, +class class_mqtt_info_object (class_comm_mqtt_interface): + def __init__(self, device_name): + class_comm_mqtt_interface.__init__(self) + self.mqtt_dict = {} + + device_config_info = __import__(device_name) + + self.device_config : class_comm_device_config = device_config_info.comm_device_config + self.menu_description = self.device_config.get_menu_caption_info() + + menu_process_list = [] + for item_dict in self.menu_description : + if "menu" in item_dict.keys() : + menu_object = item_dict["menu"] + self.__create_mqtt_dict__(menu_object, menu_process_list) + + #创建mqtt索引, 用于定位mqtt消息相关的菜单属性, 内部函数, 外部不要调用 + def __create_mqtt_dict__(self, menu_object, menu_process_list: list): #创建菜单对应的各项mqtt信息,包含菜单内部的子菜单的各项mqtt信息 + if menu_object == None : + return + if menu_object in menu_process_list : #防止递归进入无限循环 + return + + menu_process_list.append(menu_object) #添加到处理队列中,可以防止menu_object重复处理 + + for menu_item in menu_object : #遍历菜单内部的各个菜单项 + if "mqtt" in menu_item.keys() : #该项菜单具有mqtt属性 + mqtt_info_name = menu_item["mqtt"] #获取mqtt的信息名称, mqtt的消息中包含该信息时,可快速定位该 菜单项 + if mqtt_info_name not in self.mqtt_dict.keys() : #mqtt信息需要具有唯一性, + self.mqtt_dict[mqtt_info_name] = menu_item #把mqtt信息与 菜单项 进行(key, value)绑定. key = mqtt信息, value为菜单项 + else : + print_error_msg("Error, 菜单项有相同的mqtt字段(%s)"%(mqtt_info_name)) + + if "sub_menu" in menu_item.keys() : + sub_menu_name = menu_item["sub_menu"] + if isinstance(sub_menu_name, Enum): + sub_menu_name = sub_menu_name.name + + sub_menu_object = self.search_menu_group_object(sub_menu_name) + self.__create_mqtt_dict__(sub_menu_object, menu_process_list) #递归调用, 直到处理完所有子菜单项 + + #通过菜单名搜索到菜单项 + def search_menu_item(self, mqtt_info_name : string) : + if mqtt_info_name in self.mqtt_dict.keys() : + return self.mqtt_dict[mqtt_info_name] + else : + return None + + #通过菜单名字来查找菜单组对象, 每个菜单组包含若干个菜单项 + def search_menu_group_object(self, menu_group_name) : + menu_group_object = None + for item_dict in self.menu_description: + menu_item_name = utils.dict_or_object_get_attr(item_dict, "name", None) + if menu_item_name == menu_group_name : + menu_group_object = utils.dict_or_object_get_attr(item_dict, "menu", None) + break + return menu_group_object + + +#定义mqtt信息组:所有设备的mqtt信息 都集中于该类 +class class_mqtt_info_object_group(): + def __init__(self): + self.device_mqtt_info_dict : class_mqtt_info_object = {} + + def create_mqtt_info_object(self, device_name) ->class_mqtt_info_object: + try : + mqtt_info_object = None + + if device_name not in self.device_mqtt_info_dict.keys() : + new_mqtt_info = class_mqtt_info_object(device_name) + self.device_mqtt_info_dict[device_name] = new_mqtt_info + mqtt_info_object = self.get_mqtt_info_object(device_name) + except Exception as e: + print_error_msg(str(e)) + mqtt_info_object = None + finally : + return mqtt_info_object + + def get_mqtt_info_object(self, device_name) ->class_mqtt_info_object: + matched_mqtt_info = None + if device_name in self.device_mqtt_info_dict.keys() : + matched_mqtt_info = self.device_mqtt_info_dict[device_name] + + return matched_mqtt_info + + def search_mqtt_menu_item_info(self, device_name, mqtt_info_name) : + if mqtt_info_name in self.device_mqtt_info_dict.keys() : + mqtt_info_object : class_mqtt_info_object = self.device_mqtt_info_dict[device_name] + menu_item = mqtt_info_object.search_menu_item(mqtt_info_name) + return menu_item + return None + diff --git a/print_color.py b/print_color.py new file mode 100644 index 0000000..3738742 --- /dev/null +++ b/print_color.py @@ -0,0 +1,41 @@ +from colorama import init, Fore, Back, Style +from threading import Lock +import datetime + +init() # 初始化colorama +print_mutex = Lock() + +def print_normal_msg(*args, **kwargs) : + current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + print_mutex.acquire() + print(current_time, *args, **kwargs, end='') + print(Style.RESET_ALL) + print_mutex.release() + +def print_warning_msg(*args, **kwargs) : + current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + print_mutex.acquire() + print(current_time, Fore.LIGHTMAGENTA_EX, *args, **kwargs, end='') + print(Style.RESET_ALL) + print_mutex.release() + +def print_inform_msg(*args, **kwargs) : + current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + print_mutex.acquire() + print(current_time, Fore.YELLOW, *args, **kwargs, end='') + print(Style.RESET_ALL) + print_mutex.release() + +def print_error_msg(*args, **kwargs) : + current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + print_mutex.acquire() + print(current_time, Fore.RED, *args, **kwargs, end='') + print(Style.RESET_ALL) + print_mutex.release() + +def print_debug_msg(*args, **kwargs) : + current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") + print_mutex.acquire() + print(current_time, Fore.BLUE, *args, **kwargs, end='') + print(Style.RESET_ALL) + print_mutex.release() \ No newline at end of file diff --git a/run_python_script.sh b/run_python_script.sh new file mode 100644 index 0000000..5e8fa9f --- /dev/null +++ b/run_python_script.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# 设置错误处理机制 +set -e + +# 设置日志文件路径 +LOG_FILE="/var/log/startup_script.log" +UART_LOG_FILE="/var/log/uart_script.log" +APPWINDOW_LOG_FILE="/var/log/appwindow_script.log" + +# 设置路径变量 +ENV_PATH="/home/zzkj/myenv/bin/activate" +UART_PORT_PATH="/home/zzkj/MenuPython_QT/uart_port.sh" +APPWINDOW_PATH="/home/zzkj/MenuPython_QT/appwindow.sh" +FACE_FLASK_PATH="/home/zzkj/MenuPython_QT/face_flask.sh" +CLEAN_LOGS_PATH="/home/zzkj/MenuPython_QT/clean_log.sh" + + +# 运行清理日志脚本 +bash $CLEAN_LOGS_PATH "$LOG_FILE" "$UART_LOG_FILE" "$APPWINDOW_LOG_FILE" + +# 打印启动信息 +echo -e "启动python脚本......" + +# # 发送通知 +# notify-send "脚本运行" "Python脚本运行......" + +# 启动第一个终端运行uart_port.sh +echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 uart_port.sh 在后台" >> $LOG_FILE +bash $UART_PORT_PATH & +bash $FACE_FLASK_PATH & +# 启动第二个终端运行appwindow.sh +echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 appwindow.sh 在前台" >> $LOG_FILE +bash $APPWINDOW_PATH + + +# 发送完成通知 +# notify-send "脚本运行" "python脚本运行成功!" + +# 打印完成信息 +echo -e "所有脚本运行成功!!!" + diff --git a/run_python_script_rk3568_1024_600.sh b/run_python_script_rk3568_1024_600.sh new file mode 100644 index 0000000..95f3743 --- /dev/null +++ b/run_python_script_rk3568_1024_600.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# 设置错误处理机制 +set -e + +# 设置日志文件路径 +# LOG_FILE="/var/log/startup_script.log" +# UART_LOG_FILE="/var/log/uart_script.log" +# APPWINDOW_LOG_FILE="/var/log/appwindow_script.log" + +# 设置路径变量 +# ENV_PATH="/home/linaro/myenv/bin/activate" +UART_PORT_PATH="/home/linaro/MenuPython_QT/uart_port_rk3568_1024_600.sh" +APPWINDOW_PATH="/home/linaro/MenuPython_QT/appwindow_rk3568_1024_600.sh" +# CLEAN_LOGS_PATH="/home/linaro/MenuPython_QT/clean_log.sh" + + +# 运行清理日志脚本 +# bash $CLEAN_LOGS_PATH "$LOG_FILE" "$UART_LOG_FILE" "$APPWINDOW_LOG_FILE" + +# 打印启动信息 +# echo -e "启动python脚本......" + +# # 发送通知 +# notify-send "脚本运行" "Python脚本运行......" + +# 启动第一个终端运行uart_port.sh +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 uart_port.sh 在后台" >> $LOG_FILE +bash $UART_PORT_PATH & + +# 启动第二个终端运行appwindow.sh +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 appwindow.sh 在前台" >> $LOG_FILE +bash $APPWINDOW_PATH + +# 发送完成通知 +# notify-send "脚本运行" "python脚本运行成功!" + +# 打印完成信息 +# echo -e "所有脚本运行成功!!!" + diff --git a/system_parameter.ini b/system_parameter.ini new file mode 100644 index 0000000..cf1b138 --- /dev/null +++ b/system_parameter.ini @@ -0,0 +1,5 @@ +[SystemParam] +language = zh_CN +blanking_time = 360 +password = 2008 + diff --git a/templates/Index.html b/templates/Index.html new file mode 100644 index 0000000..54938dd --- /dev/null +++ b/templates/Index.html @@ -0,0 +1,99 @@ + + + + + + 实时报警显示 + + + + +

实时报警显示

+
+ +
+ + + + diff --git a/templates/history.html b/templates/history.html new file mode 100644 index 0000000..dc2993c --- /dev/null +++ b/templates/history.html @@ -0,0 +1,51 @@ + + + + + + 历史报警 + + + +

历史数据: {{ topic }}

+
+ {% for message in historical_data %} +
+

报警编号: {{ message[2] }}

+

报警信息: {{ message[3] }}

+

小车状态: {{ message[4] }}

+

时间: {{ message[5] }}

+
+ {% endfor %} +
+
+ +
+ + diff --git a/uart_group_config.py b/uart_group_config.py new file mode 100644 index 0000000..7305212 --- /dev/null +++ b/uart_group_config.py @@ -0,0 +1,58 @@ +mqtt_server = {"remote":"192.168.1.59", "port":1883, "user_name": "admin", "password": "miler502"} +# mqtt_server = {"remote":"192.168.1.70", "port":1883, "user_name": "admin", "password": "miler502"} +# mqtt_server = {"remote":"127.0.0.1", "port":1883, "user_name": "admin", "password": "miler502"} + + +#UART列表可以有多个设备, unique_name 应用于MQTT协议, 用于区分设备 +uart_list1 = [ + {"device_name":"ZZ_9TE", "comm_addr": 2, "device_remap" : 6000, "unique_name": "circuit_1", "circuit_id" : 3, "camera_url" : "rtsp://192.168.1.205:554"}, + {"device_name":"ZZ_9TE", "comm_addr" :2, "device_remap" : 8000, "unique_name": "circuit_2", "circuit_id" : 4, "camera_url" : "rtsp://192.168.1.84:8554/live/stream"}, +] + +#TCP列表只有一个设备, unique_name 应用于MQTT协议, 用于区分设备 +tcp_list1 = [ + {"device_name":"menu_mine", "comm_addr": 1, "device_remap" : 2000, "unique_name": "circuit_0", "circuit_id" : 0, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +#TCP列表只有一个设备, unique_name 应用于MQTT协议, 用于区分设备 +tcp_list2 = [ + {"device_name":"menu_light_7", "comm_addr": 2, "device_remap" : 4000, "unique_name": "circuit_1", "circuit_id" : 1, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +#TCP列表只有一个设备, unique_name 应用于MQTT协议, 用于区分设备 +tcp_list3 = [ + {"device_name":"menu_light_7_inch", "comm_addr": 3, "device_remap" : 6000, "unique_name": "circuit_2", "circuit_id" : 2, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +# 增加足够多的回路以测试 +tcp_list4 = [ + {"device_name":"menu_high", "comm_addr": 4, "device_remap" : 8000, "unique_name": "circuit_3", "circuit_id" : 3, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +tcp_list5 = [ + {"device_name":"menu_high", "comm_addr": 5, "device_remap" : 8000, "unique_name": "circuit_4", "circuit_id" : 4, "camera_url" :"rtsp://192.168.1.205:554"} +] + +tcp_list6 = [ + {"device_name":"menu_high", "comm_addr": 6, "device_remap" : 8000, "unique_name": "circuit_5", "circuit_id" : 5, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +tcp_list7 = [ + {"device_name":"menu_mine", "comm_addr": 7, "device_remap" : 8000, "unique_name": "circuit_6", "circuit_id" : 6, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +tcp_list8 = [ + {"device_name":"menu_light", "comm_addr": 8, "device_remap" : 8000, "unique_name": "circuit_7", "circuit_id" : 7, "camera_url" : "rtsp://192.168.1.205:554"}, +] + +#每一项配置都会创建一个通讯线程, device_list为该通讯线程的设备列表 +comm_thread_config = [ + {"protocol" : "modbus_tcp", "device_list": tcp_list1, "mode" : '{"ip": "192.168.1.182", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list2, "mode" : '{"ip": "192.168.1.182", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list3, "mode" : '{"ip": "192.168.1.183", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list4, "mode" : '{"ip": "192.168.1.184", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list5, "mode" : '{"ip": "192.168.1.185", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list6, "mode" : '{"ip": "192.168.1.186", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list7, "mode" : '{"ip": "192.168.1.187", "port": 502}'}, + # {"protocol" : "modbus_tcp", "device_list": tcp_list8, "mode" : '{"ip": "192.168.1.188", "port": 502}'}, +] diff --git a/uart_port.py b/uart_port.py new file mode 100644 index 0000000..6116df2 --- /dev/null +++ b/uart_port.py @@ -0,0 +1,160 @@ +import struct +import uart_group_config as uart +import time +import serial +import menu_utils as utils +from modbus_tk import modbus_rtu, modbus_tcp +import json +from mqtt_device import class_comm_mqtt_interface, class_comm_mqtt_thread +from comm_protocol_modbus import class_protocol_modbus_rtu, class_protocol_modbus_tcp +from comm_device import class_comm_device +from device_conf import class_comm_device_config +from menu_group import class_menu_group +from modbus_server import class_modbus_tcp_server +from comm_modbus_device import class_modbus_comm_device +import comm_global +from print_color import * +from mqtt_object import class_mqtt_info_object_group, class_mqtt_info_object +import keyboard +from comm_thread import class_comm_master_thread + +# 常量 +DEFAULT_COMM_WRITE_TIMEOUT_MS = 500 +DEFAULT_MODBUS_SERVER_IP = "127.0.0.1" + +# 初始化 MQTT 信息组 +mqtt_info_group = class_mqtt_info_object_group() + +#初始化 Modbus TCP 服务器 +def initialize_modbus_server(slave_addr, ip, port): + + return class_modbus_tcp_server(slave_addr=slave_addr, slave_ip=ip, slave_port=port) +#获取 MQTT 服务器配置 +def get_mqtt_server_config(): + + user_name = utils.dict_or_object_get_attr(uart.mqtt_server, "user_name", "admin") + password = utils.dict_or_object_get_attr(uart.mqtt_server, "password", "admin") + server = utils.dict_or_object_get_attr(uart.mqtt_server, "remote", "127.0.0.1") + port = utils.dict_or_object_get_attr(uart.mqtt_server, "port", 1883) + return user_name, password, server, port +#创建并返回通讯主线程列表 +def create_comm_master_thread_list(): + comm_master_thread_list = [] + + for object_config_list in uart.comm_thread_config: + try: + protocol_name = utils.dict_or_object_get_attr(object_config_list, "protocol", None) + mode = utils.dict_or_object_get_attr(object_config_list, "mode", None) + + _protocol = None + if protocol_name == "modbus_rtu": + _protocol = class_protocol_modbus_rtu("modbus_rtu") + elif protocol_name == "modbus_tcp": + _protocol = class_protocol_modbus_tcp("modbus_tcp") + + if _protocol is None or mode is None: + continue + + _protocol.open(mode) + + _device_list = utils.dict_or_object_get_attr(object_config_list, "device_list", None) + _device_comm_object_list = [] + + if _device_list: + for device_list_item_dict in _device_list: + try: + _unique_name = utils.dict_or_object_get_attr(device_list_item_dict, "unique_name", None) + _device_name = utils.dict_or_object_get_attr(device_list_item_dict, "device_name", None) + _comm_addr = utils.dict_or_object_get_attr(device_list_item_dict, "comm_addr", None) + _device_remap = utils.dict_or_object_get_attr(device_list_item_dict, "device_remap", None) + + if _unique_name is None or _device_name is None or _comm_addr is None or _device_remap is None: + continue + + device_object = __import__(_device_name) + + config = getattr(device_object, "comm_device_config", None) + _func_action_process = getattr(device_object, "func_action_process", None) + _func_alarm_query = getattr(device_object, "func_alarm_query", None) + + if config: + _comm_table, _function = config.get_comm_table() + _alias_table = config.get_alias_table() + + _mqtt_info_object = mqtt_info_group.create_mqtt_info_object(device_name=_device_name) + _unique_object = class_modbus_comm_device( + comm_addr=_comm_addr, + comm_table=_comm_table, + device_remap=_device_remap, + mqtt_thread=global_mqtt_thread, + protocol=_protocol, + mqtt_info_object=_mqtt_info_object, + unique_name=_unique_name, + action_process_func=_func_action_process, + request_alarm_func=_func_alarm_query, + alias_table=_alias_table + ) + + global_mqtt_thread.add_unique_object(unique_name=_unique_name, unique_object=_unique_object) + _device_comm_object_list.append(_unique_object) + except Exception as e: + print_error_msg(f"Failed to configure device: {_device_name}. Error: {str(e)}") + + if _device_comm_object_list: + _comm_thread = class_comm_master_thread( + device_comm_object_list=_device_comm_object_list, + thread_name=_unique_name + ) + comm_master_thread_list.append(_comm_thread) + except Exception as e: + print_error_msg(f"Failed to configure communication thread. Error: {str(e)}") + + return comm_master_thread_list + +#主函数,初始化并运行应用程序 +def main(): + + _slave_addr = 2 + comm_global.g_key_thread.start() + + _modbus_tcp_server = initialize_modbus_server(_slave_addr, DEFAULT_MODBUS_SERVER_IP, 502) + + _user_name, _password, _server, _port = get_mqtt_server_config() + + # 创建并配置 MQTT 线程 + global global_mqtt_thread + global_mqtt_thread = class_comm_mqtt_thread() + global_mqtt_thread.set_mqtt_server( + server=_server, + port=_port, + keep_alive=60, + user_name=_user_name, + password=_password + ) + + # 创建通讯主线程 + comm_master_thread_list = create_comm_master_thread_list() + + # 启动 MQTT 和通讯主线程 + global_mqtt_thread.start() + for comm_thread in comm_master_thread_list: + comm_thread.start() + + while True: + # 定期检查 Modbus TCP 连接状态并重连 + if not _modbus_tcp_server.is_connected(): + print("Modbus TCP 服务器断线重连中...") + _modbus_tcp_server.reconnect() + time.sleep(1) # 延迟一段时间后再次检查 + time.sleep(10) # 每隔 10 秒检查一次连接状态 + + # 清理并关闭线程 + global_mqtt_thread.close() + for comm_thread in comm_master_thread_list: + comm_thread.close() + for comm_thread in comm_master_thread_list: + comm_thread.join() + global_mqtt_thread.join() + +if __name__ == "__main__": + main() diff --git a/uart_port.sh b/uart_port.sh new file mode 100644 index 0000000..9748043 --- /dev/null +++ b/uart_port.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# 设置路径变量 +ENV_PATH="/home/zzkj/myenv/bin/activate" +SCRIPT1_PATH="/home/zzkj/MenuPython_QT/uart_port.py" + +# 日志文件路径 +LOG_FILE="/var/log/uart_port.log" + +# 清空日志文件 +clear_log_file() { + echo "[$(date '+%y-%m-%d %H:%M:%S')] 清空日志文件" > "$LOG_FILE" +} + +# 激活虚拟环境 +source "$ENV_PATH" + +# 运行uart_port.py +python3 "$SCRIPT1_PATH" + +#打印日志显示取消下列注释 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 uart_port.py" >> "$LOG_FILE" +# python3 "$SCRIPT1_PATH" >> "$LOG_FILE" 2>&1 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 完成 uart_port.py" >> "$LOG_FILE" +# # 检查日志文件大小是否超过10mb并清空 +# if [ $(du -m "$LOG_FILE" | cut -f1) -gt 10 ]; then +# clear_log_file +# fi + diff --git a/uart_port_rk3568_1024_600.sh b/uart_port_rk3568_1024_600.sh new file mode 100644 index 0000000..aaa62c3 --- /dev/null +++ b/uart_port_rk3568_1024_600.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# 设置路径变量 +# ENV_PATH="/home/linaro/myenv/bin/activate" +SCRIPT1_PATH="/home/linaro/MenuPython_QT/uart_port.py" + +# 日志文件路径 +# LOG_FILE="/var/log/uart_port.log" + +# # 清空日志文件 +# clear_log_file() { +# echo "[$(date '+%y-%m-%d %H:%M:%S')] 清空日志文件" > "$LOG_FILE" +# } + +# # 激活虚拟环境 +# source "$ENV_PATH" + +# 运行uart_port.py +python3 "$SCRIPT1_PATH" + +#打印日志显示取消下列注释 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 uart_port.py" >> "$LOG_FILE" +# python3 "$SCRIPT1_PATH" >> "$LOG_FILE" 2>&1 +# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 完成 uart_port.py" >> "$LOG_FILE" +# # 检查日志文件大小是否超过10mb并清空 +# if [ $(du -m "$LOG_FILE" | cut -f1) -gt 10 ]; then +# clear_log_file +# fi +