五步十阁 - MCCB调试工具
type: channel
link: http://8.129.33.146/index.php/category/MCCB调试工具
items: MCCB调试工具

MCCB调试工具
type: item
date: 2022-05-08T22:05:00+08:00
description: 之前因个人爱好，开发了个MCCB的调试工具，现在用不到了，不忍放硬盘吃灰，就拿出来分享一下。一.整体结构采用Qt开发。基于RS485串口总线通信。采用占有式，占用485总线。二.基本定义1.基础信息定义#pragma once #include <stdint.h> #include <type_traits> #include <QString> #define Mccb_XD_Name "Mccb_XD" #define Mccb_Normal_Name "Mccb_Normal" #define Mccb_Ptlk_Name "Mccb_ElPro" #define Packet_Max_Length 300 #define CMD_READ_DATA 0x11 #define CMD_READ_DATA_NEXT 0x12 #define CMD_READ_COMM_ADDR 0x13 #define CMD_WRITE_DATA 0x14 #define CMD_WRITE_COMM_ADDR 0x15 #define CMD_READ_ALARM 0x19 #define CMD_CTRL 0x1C #define Event_Record_Max 1 namespace Mccb { template <typename Enumeration> auto EnumtoValue(Enumeration const value) -> typename std::underlying_type<Enumeration>::type { return static_cast<typename std::underlying_type<Enumeration>::type>(value); } //返回值 enum class retack :int32_t { PacketNotOver = 0, //帧结构 packetErr, PacketSumCheckErr, packetOk, OkNoNext, //帧内容 OkNeedNext, UpdatePacketErr, RemoteCtrlErr, CommSpeedChangeErr, PasswordErr, NoneRequestData, illegalData, }; //A.2.1 当前变量 enum class DI : uint32_t { /*电压*/ Ua = 0x02010100, Ub = 0x02010200, Uc = 0x02010300, U = 0x0201FF00, /*电流*/ Ia = 0x02020100, Ib = 0x02020200, Ic = 0x02020300, I = 0x0202FF00, /*当前剩余电流*/ IresidualNowMaxPhase = 0x02900000, //当前剩余电流最大相 IresidualNow = 0x02900100, //当前剩余电流值 Iresidual = 0x0290FF00, /*当前额定剩余电流定值*/ Iei_residual = 0x02910100, Iet_residual = 0x02910200, Ie_residual = 0x0291FF00, /*电流*/ IwDirect = 0x02920100, Iwa = 0x02920200, Iwb = 0x02920300, Iwc = 0x02920400, Iw = 0x0292FF00, /*电能*/ Et = 0x00010000, //当前正向有功总电能 EtSub = 0x00020000, Ea = 0x00150000, ESuba = 0x00160000, Eb = 0x00290000, ESubb = 0x002A0000, Ec = 0x003D0000, ESubc = 0x003E0000, /*有功功率*/ Pt = 0x02030000, Pa = 0x02030100, Pb = 0x02030200, Pc = 0x02030300, P = 0x0203FF00, /*无功功率*/ Qt = 0x02040000, Qa = 0x02040100, Qb = 0x02040200, Qc = 0x02040300, Q = 0x0204FF00, /*功率因数*/ Pft = 0x02060000, Pfa = 0x02060100, Pfb = 0x02060200, Pfc = 0x02060300, Pf = 0x0206FF00, /*谐波*/ HVa_1 = 0x020A0101, HVb_1 = 0x020A0201, HVc_1 = …