From e8a27bb203fe2aff70390a5eca002d7438da9b0f Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期三, 22 十月 2025 14:24:34 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/SGMeasurement/CCLinkPerformance/PerformanceMelsec.h |  414 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 207 insertions(+), 207 deletions(-)

diff --git a/SourceCode/Bond/SGMeasurement/CCLinkPerformance/PerformanceMelsec.h b/SourceCode/Bond/SGMeasurement/CCLinkPerformance/PerformanceMelsec.h
index d7586f6..836f4da 100644
--- a/SourceCode/Bond/SGMeasurement/CCLinkPerformance/PerformanceMelsec.h
+++ b/SourceCode/Bond/SGMeasurement/CCLinkPerformance/PerformanceMelsec.h
@@ -1,4 +1,4 @@
-#ifndef PERFORMANCE_MELSEC_H
+锘�#ifndef PERFORMANCE_MELSEC_H
 #define PERFORMANCE_MELSEC_H
 
 #include "Mdfunc.h"
@@ -12,151 +12,151 @@
 #include <sstream>
 #include <unordered_map>
 
-// 连接参数
-#define PLC_MAX_RETRY 3        // 最大重试次数:在与PLC通信时,如果发生通信错误,将最多重试3次
-#define PLC_TIMEOUT 500        // 超时时间(毫秒):每次通信操作的超时等待时间为500毫秒
+// 杩炴帴鍙傛暟
+#define PLC_MAX_RETRY 3        // 鏈�澶ч噸璇曟鏁帮細鍦ㄤ笌PLC閫氫俊鏃讹紝濡傛灉鍙戠敓閫氫俊閿欒锛屽皢鏈�澶氶噸璇�3娆�
+#define PLC_TIMEOUT 500        // 瓒呮椂鏃堕棿锛堟绉掞級锛氭瘡娆¢�氫俊鎿嶄綔鐨勮秴鏃剁瓑寰呮椂闂翠负500姣
 
 /*
- * 网络通道:指定通信所使用的网络通道号,通常在多通道通信中设置
- * 51 到 54 是 MELSECNET/H 的 1-4 通道
- * 81 到 84 是 CC-Link 的 1-4 通道
- * 151 到 154 是 CC-Link IE 控制器网络的 1-4 通道
- * 181 到 184 是 CC-Link IE 现场网络的 1-4 通道
- * 281 到 284 是 CC-Link IE TSN 网络的 1-4 通道
+ * 缃戠粶閫氶亾锛氭寚瀹氶�氫俊鎵�浣跨敤鐨勭綉缁滈�氶亾鍙凤紝閫氬父鍦ㄥ閫氶亾閫氫俊涓缃�
+ * 51 鍒� 54 鏄� MELSECNET/H 鐨� 1-4 閫氶亾
+ * 81 鍒� 84 鏄� CC-Link 鐨� 1-4 閫氶亾
+ * 151 鍒� 154 鏄� CC-Link IE 鎺у埗鍣ㄧ綉缁滅殑 1-4 閫氶亾
+ * 181 鍒� 184 鏄� CC-Link IE 鐜板満缃戠粶鐨� 1-4 閫氶亾
+ * 281 鍒� 284 鏄� CC-Link IE TSN 缃戠粶鐨� 1-4 閫氶亾
  **/
-#define MELSECNET_CHANNEL(x) (50 + (x))           // x 范围:1~4
-#define CC_LINK_CHANNEL(x) (80 + (x))			  // x 范围:1~4
-#define CC_LINK_IE_CONTROL_CHANNEL(x) (150 + (x)) // x 范围:1~4
-#define CC_LINK_IE_FIELD_CHANNEL(x) (180 + (x))   // x 范围:1~4
-#define CC_LINK_IE_TSN_CHANNEL(x) (280 + (x))     // x 范围:1~4
+#define MELSECNET_CHANNEL(x) (50 + (x))           // x 鑼冨洿锛�1~4
+#define CC_LINK_CHANNEL(x) (80 + (x))			  // x 鑼冨洿锛�1~4
+#define CC_LINK_IE_CONTROL_CHANNEL(x) (150 + (x)) // x 鑼冨洿锛�1~4
+#define CC_LINK_IE_FIELD_CHANNEL(x) (180 + (x))   // x 鑼冨洿锛�1~4
+#define CC_LINK_IE_TSN_CHANNEL(x) (280 + (x))     // x 鑼冨洿锛�1~4
 
- // 自定义错误码
-#define ERROR_CODE_UNKNOWN				0x00010000 // 未知
-#define ERROR_CODE_NOT_CONNECTED		0x00020000 // 未连接
-#define ERROR_CODE_INVALID_PARAM		0x00030000 // 参数无效
-#define ERROR_CODE_INVALID_DATA			0x00040000 // 数据无效
-#define ERROR_CODE_STATION_OUT_OF_RANGE 0x00050000 // 站号超出范围
-#define ERROR_CODE_GROUP_OUT_OF_RANGE   0x00060000 // 组号超出范围
-#define ERROR_CODE_NETWORK_OUT_OF_RANGE 0x00070000 // 网络号超出范围
+ // 鑷畾涔夐敊璇爜
+#define ERROR_CODE_UNKNOWN				0x00010000 // 鏈煡
+#define ERROR_CODE_NOT_CONNECTED		0x00020000 // 鏈繛鎺�
+#define ERROR_CODE_INVALID_PARAM		0x00030000 // 鍙傛暟鏃犳晥
+#define ERROR_CODE_INVALID_DATA			0x00040000 // 鏁版嵁鏃犳晥
+#define ERROR_CODE_STATION_OUT_OF_RANGE 0x00050000 // 绔欏彿瓒呭嚭鑼冨洿
+#define ERROR_CODE_GROUP_OUT_OF_RANGE   0x00060000 // 缁勫彿瓒呭嚭鑼冨洿
+#define ERROR_CODE_NETWORK_OUT_OF_RANGE 0x00070000 // 缃戠粶鍙疯秴鍑鸿寖鍥�
 
-// 板块类型
+// 鏉垮潡绫诲瀷
 enum class BoardType {
-	UNKNOWN = -1,										// 未知类型
+	UNKNOWN = -1,										// 鏈煡绫诲瀷
 	MELSECNET_H = MELSECNET_CHANNEL(1),					// MELSECNET/H
 	CC_LINK_VER_2 = CC_LINK_CHANNEL(1),					// CC-Link Ver. 2
-	CC_LINK_IE_CONTROL = CC_LINK_IE_CONTROL_CHANNEL(1),	// CC-Link IE 控制网络
-	CC_LINK_IE_FIELD = CC_LINK_IE_FIELD_CHANNEL(1),     // CC-Link IE 现场网络
+	CC_LINK_IE_CONTROL = CC_LINK_IE_CONTROL_CHANNEL(1),	// CC-Link IE 鎺у埗缃戠粶
+	CC_LINK_IE_FIELD = CC_LINK_IE_FIELD_CHANNEL(1),     // CC-Link IE 鐜板満缃戠粶
 	CC_LINK_IE_TSN = CC_LINK_IE_TSN_CHANNEL(1)          // CC-Link IE TSN
 };
 
-// 软元件类型枚举
+// 杞厓浠剁被鍨嬫灇涓�
 enum class DeviceType {
 	/*
-	 * ER、LX、LY、LB、LW、LSB、LSW和SPG软元件都是范围型
-	 * ER:DevER0~256
-	 * LX:DevLX1~255,DevLX(x)	(DevX*1000+(x))
-	 * LY:DevLY1~255,DevLY(x)	(DevY*1000+(x))
-	 * LB:DevLB1~255,DevLB(x)	(DevB*1000+(x))
-	 * LW:DevLW1~255,DevLW(x)	(DevW*1000+(x))
-	 * LSB:DevLSB1~255,DevLSB(x) (DevQSB*1000+(x))
-	 * LSW:DevLSW1~255,DevLSW(x) (DevQSW*1000+(x))
-	 * SPG:DevSPG0~255,DevSPG(x) (29*1000+(x))
-	 * 扩展文件寄存器代码指定(10进制数)的后3位数及软元件名指定的数值中,应指定块No.(0~256)
-	 * 链接直接软元件代码指定(10进制数)的后3位数及软元件名指定的数值中,应指定网络No.(1~255)
-	 * 智能功能模块软元件代码指定(10进制数)的后3位数及软元件名指定的数值中,应指定(起始I/ONo.÷16)的值
-	 * 扩展文件寄存器和链接直接软元件在随机读取(mdRandR、mdRandREx)函数中,即使指定实际不存在的软元件也有可能正常结束
-	 * MAIL和MAILMC在SEND功能及RECV功能中,与软元件访问一样,指定各功能对应的软元件类型,进行数据的发送(mdSend、mdSendEx)或数据的读取(mdReceive、mdReceiveEx)
+	 * ER銆丩X銆丩Y銆丩B銆丩W銆丩SB銆丩SW鍜孲PG杞厓浠堕兘鏄寖鍥村瀷
+	 * ER锛欴evER0锝�256
+	 * LX锛欴evLX1锝�255锛孌evLX(x)	(DevX*1000+(x))
+	 * LY锛欴evLY1锝�255锛孌evLY(x)	(DevY*1000+(x))
+	 * LB锛欴evLB1锝�255锛孌evLB(x)	(DevB*1000+(x))
+	 * LW锛欴evLW1锝�255锛孌evLW(x)	(DevW*1000+(x))
+	 * LSB锛欴evLSB1锝�255锛孌evLSB(x) (DevQSB*1000+(x))
+	 * LSW锛欴evLSW1锝�255锛孌evLSW(x) (DevQSW*1000+(x))
+	 * SPG锛欴evSPG0锝�255锛孌evSPG(x) (29*1000+(x))
+	 * 鎵╁睍鏂囦欢瀵勫瓨鍣ㄤ唬鐮佹寚瀹�(10杩涘埗鏁�)鐨勫悗3浣嶆暟鍙婅蒋鍏冧欢鍚嶆寚瀹氱殑鏁板�间腑锛屽簲鎸囧畾鍧桸o.(0锝�256)
+	 * 閾炬帴鐩存帴杞厓浠朵唬鐮佹寚瀹�(10杩涘埗鏁�)鐨勫悗3浣嶆暟鍙婅蒋鍏冧欢鍚嶆寚瀹氱殑鏁板�间腑锛屽簲鎸囧畾缃戠粶No.(1锝�255)
+	 * 鏅鸿兘鍔熻兘妯″潡杞厓浠朵唬鐮佹寚瀹�(10杩涘埗鏁�)鐨勫悗3浣嶆暟鍙婅蒋鍏冧欢鍚嶆寚瀹氱殑鏁板�间腑锛屽簲鎸囧畾(璧峰I/ONo.梅16)鐨勫��
+	 * 鎵╁睍鏂囦欢瀵勫瓨鍣ㄥ拰閾炬帴鐩存帴杞厓浠跺湪闅忔満璇诲彇(mdRandR銆乵dRandREx)鍑芥暟涓紝鍗充娇鎸囧畾瀹為檯涓嶅瓨鍦ㄧ殑杞厓浠朵篃鏈夊彲鑳芥甯哥粨鏉�
+	 * MAIL鍜孧AILMC鍦⊿END鍔熻兘鍙奟ECV鍔熻兘涓紝涓庤蒋鍏冧欢璁块棶涓�鏍凤紝鎸囧畾鍚勫姛鑳藉搴旂殑杞厓浠剁被鍨嬶紝杩涜鏁版嵁鐨勫彂閫�(mdSend銆乵dSendEx)鎴栨暟鎹殑璇诲彇(mdReceive銆乵dReceiveEx)
 	 **/
 
-	X = 0x0001,      // 输入 (位)
-	Y = 0x0002,      // 输出 (位)
-	L = 0x0003,      // 锁存继电器 (位)
-	M = 0x0004,      // 内部继电器 (位)
-	SM = 0x0005,     // 特殊继电器 (位)
-	F = 0x0006,      // 报警器 (位)
-	TT = 0x0007,     // 定时器 (触点) (位)
-	TC = 0x0008,     // 计数器 (线圈) (位)
-	CT = 0x0009,     // 计数器 (触点) (位)
-	CC = 0x000A,     // 计数器 (线圈) (字)
-	TN = 0x000B,     // 定时器 (当前值) (字)
-	CN = 0x000C,     // 计数器 (当前值) (字)
-	D = 0x000D,      // 数据寄存器 (字)
-	SD = 0x000E,     // 特殊寄存器 (字)
-	TM = 0x000F,     // 定时器 (设置值主) (字)
-	TS = 0x0010,     // 定时器 (设置值主1) (字)
-	TS2 = 0x3E82,    // 定时器 (设置值主2) (字)
-	TS3 = 0x3E83,    // 定时器 (设置值主3) (字)
-	CM = 0x0011,     // 计数器 (设置值主) (字)
-	CS = 0x0012,     // 计数器 (设置值主1) (字)
-	CS2 = 0x4652,    // 计数器 (设置值主2) (字)
-	CS3 = 0x4653,    // 计数器 (设置值主3) (字)
-	A = 0x0013,      // 累加器 (字)
-	Z = 0x0014,      // 变址寄存器 (字)
-	V = 0x0015,      // 变址寄存器 (字)
-	R = 0x0016,      // 文件寄存器 (块切换方式) (字)
-	ER = 0x55F0,     // 扩展文件寄存器 (块切换方式) (0x55F0~0x56F0) (字) (在随机读取(mdRandR、mdRandREx)函数中,即使指定实际不存在的软元件也有可能正常结束。(读取数据不正确。))
-	ZR = 0x00DC,     // 文件寄存器 (连号访问方式) (字)
-	B = 0x0017,      // 链接继电器 (位)
-	W = 0x0018,      // 链接寄存器 (字)
-	QSB = 0x0019,    // 链接特殊继电器 (位)
-	STT = 0x001A,    // 累计定时器 (触点) (位)
-	STC = 0x001B,    // 累计定时器 (线圈) (位)
-	QSW = 0x001C,    // 链接特殊寄存器 (字)
-	QV = 0x001E,     // 变址继电器 (位)
-	MRB = 0x0021,	 // 随机访问缓冲 (字)
-	STN = 0x0023,    // 累计定时器 (当前值) (字)
-	LZ = 0x0026,     // 超长变址寄存器 (双字)
-	RD = 0x0027,     // 刷新数据寄存器 (字)
-	LTT = 0x0029,    // 超长定时器 (触点) (位)
-	LTC = 0x002A,    // 超长定时器 (线圈) (位)
-	LTN = 0x002B,    // 超长定时器 (当前值) (双字)
-	LCT = 0x002C,    // 超长计数器 (触点) (位)
-	LCC = 0x002D,    // 超长计数器 (线圈) (位)
-	LCN = 0x002E,    // 超长计数器 (当前值) (双字)
-	LSTT = 0x002F,   // 超长累计定时器 (触点) (位)
-	LSTC = 0x0030,   // 超长累计定时器 (线圈) (位)
-	LSTN = 0x0031,   // 超长累计定时器 (当前值) (双字)
-	SPB = 0x0032,	 // 缓冲存储器 (字)
-	MAIL = 0x0065,   // 特殊软元件类型:邮件类型 (10进制 101)
-	MAILMC = 0x0066, // 特殊软元件类型:无确认邮件 (10进制 102)
-	LX = 0x03E8,     // 链接直接软元件 (链接输入) (0x03E9~0x04E7) (位)
-	LY = 0x07D0,     // 链接直接软元件 (链接输出) (0x07D1~0x08CF) (位)
-	LB = 0x59D8,     // 链接直接软元件 (链接继电器) (0x59D9~0x5AD7) (位)
-	LW = 0x5DC0,     // 链接直接软元件 (链接寄存器) (0x5DC1~0x5EBF) (字)
-	LSB = 0x61A8,    // 链接直接软元件 (链接特殊继电器) (0x61A9~0x62A7) (位)
-	LSW = 0x6D60,    // 链接直接软元件 (链接特殊寄存器) (0x6D61~0x6E5F) (字)
-	SPG = 0x7147,    // 智能功能模块软元件 (0x7148~0x7247) (字)
+	X = 0x0001,      // 杈撳叆 (浣�)
+	Y = 0x0002,      // 杈撳嚭 (浣�)
+	L = 0x0003,      // 閿佸瓨缁х數鍣� (浣�)
+	M = 0x0004,      // 鍐呴儴缁х數鍣� (浣�)
+	SM = 0x0005,     // 鐗规畩缁х數鍣� (浣�)
+	F = 0x0006,      // 鎶ヨ鍣� (浣�)
+	TT = 0x0007,     // 瀹氭椂鍣� (瑙︾偣) (浣�)
+	TC = 0x0008,     // 璁℃暟鍣� (绾垮湀) (浣�)
+	CT = 0x0009,     // 璁℃暟鍣� (瑙︾偣) (浣�)
+	CC = 0x000A,     // 璁℃暟鍣� (绾垮湀) (瀛�)
+	TN = 0x000B,     // 瀹氭椂鍣� (褰撳墠鍊�) (瀛�)
+	CN = 0x000C,     // 璁℃暟鍣� (褰撳墠鍊�) (瀛�)
+	D = 0x000D,      // 鏁版嵁瀵勫瓨鍣� (瀛�)
+	SD = 0x000E,     // 鐗规畩瀵勫瓨鍣� (瀛�)
+	TM = 0x000F,     // 瀹氭椂鍣� (璁剧疆鍊间富) (瀛�)
+	TS = 0x0010,     // 瀹氭椂鍣� (璁剧疆鍊间富1) (瀛�)
+	TS2 = 0x3E82,    // 瀹氭椂鍣� (璁剧疆鍊间富2) (瀛�)
+	TS3 = 0x3E83,    // 瀹氭椂鍣� (璁剧疆鍊间富3) (瀛�)
+	CM = 0x0011,     // 璁℃暟鍣� (璁剧疆鍊间富) (瀛�)
+	CS = 0x0012,     // 璁℃暟鍣� (璁剧疆鍊间富1) (瀛�)
+	CS2 = 0x4652,    // 璁℃暟鍣� (璁剧疆鍊间富2) (瀛�)
+	CS3 = 0x4653,    // 璁℃暟鍣� (璁剧疆鍊间富3) (瀛�)
+	A = 0x0013,      // 绱姞鍣� (瀛�)
+	Z = 0x0014,      // 鍙樺潃瀵勫瓨鍣� (瀛�)
+	V = 0x0015,      // 鍙樺潃瀵勫瓨鍣� (瀛�)
+	R = 0x0016,      // 鏂囦欢瀵勫瓨鍣� (鍧楀垏鎹㈡柟寮�) (瀛�)
+	ER = 0x55F0,     // 鎵╁睍鏂囦欢瀵勫瓨鍣� (鍧楀垏鎹㈡柟寮�) (0x55F0锝�0x56F0) (瀛�) (鍦ㄩ殢鏈鸿鍙�(mdRandR銆乵dRandREx)鍑芥暟涓紝鍗充娇鎸囧畾瀹為檯涓嶅瓨鍦ㄧ殑杞厓浠朵篃鏈夊彲鑳芥甯哥粨鏉熴��(璇诲彇鏁版嵁涓嶆纭��))
+	ZR = 0x00DC,     // 鏂囦欢瀵勫瓨鍣� (杩炲彿璁块棶鏂瑰紡) (瀛�)
+	B = 0x0017,      // 閾炬帴缁х數鍣� (浣�)
+	W = 0x0018,      // 閾炬帴瀵勫瓨鍣� (瀛�)
+	QSB = 0x0019,    // 閾炬帴鐗规畩缁х數鍣� (浣�)
+	STT = 0x001A,    // 绱瀹氭椂鍣� (瑙︾偣) (浣�)
+	STC = 0x001B,    // 绱瀹氭椂鍣� (绾垮湀) (浣�)
+	QSW = 0x001C,    // 閾炬帴鐗规畩瀵勫瓨鍣� (瀛�)
+	QV = 0x001E,     // 鍙樺潃缁х數鍣� (浣�)
+	MRB = 0x0021,	 // 闅忔満璁块棶缂撳啿 (瀛�)
+	STN = 0x0023,    // 绱瀹氭椂鍣� (褰撳墠鍊�) (瀛�)
+	LZ = 0x0026,     // 瓒呴暱鍙樺潃瀵勫瓨鍣� (鍙屽瓧)
+	RD = 0x0027,     // 鍒锋柊鏁版嵁瀵勫瓨鍣� (瀛�)
+	LTT = 0x0029,    // 瓒呴暱瀹氭椂鍣� (瑙︾偣) (浣�)
+	LTC = 0x002A,    // 瓒呴暱瀹氭椂鍣� (绾垮湀) (浣�)
+	LTN = 0x002B,    // 瓒呴暱瀹氭椂鍣� (褰撳墠鍊�) (鍙屽瓧)
+	LCT = 0x002C,    // 瓒呴暱璁℃暟鍣� (瑙︾偣) (浣�)
+	LCC = 0x002D,    // 瓒呴暱璁℃暟鍣� (绾垮湀) (浣�)
+	LCN = 0x002E,    // 瓒呴暱璁℃暟鍣� (褰撳墠鍊�) (鍙屽瓧)
+	LSTT = 0x002F,   // 瓒呴暱绱瀹氭椂鍣� (瑙︾偣) (浣�)
+	LSTC = 0x0030,   // 瓒呴暱绱瀹氭椂鍣� (绾垮湀) (浣�)
+	LSTN = 0x0031,   // 瓒呴暱绱瀹氭椂鍣� (褰撳墠鍊�) (鍙屽瓧)
+	SPB = 0x0032,	 // 缂撳啿瀛樺偍鍣� (瀛�)
+	MAIL = 0x0065,   // 鐗规畩杞厓浠剁被鍨嬶細閭欢绫诲瀷 (10杩涘埗 101)
+	MAILMC = 0x0066, // 鐗规畩杞厓浠剁被鍨嬶細鏃犵‘璁ら偖浠� (10杩涘埗 102)
+	LX = 0x03E8,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴杈撳叆) (0x03E9锝�0x04E7) (浣�)
+	LY = 0x07D0,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴杈撳嚭) (0x07D1锝�0x08CF) (浣�)
+	LB = 0x59D8,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴缁х數鍣�) (0x59D9锝�0x5AD7) (浣�)
+	LW = 0x5DC0,     // 閾炬帴鐩存帴杞厓浠� (閾炬帴瀵勫瓨鍣�) (0x5DC1锝�0x5EBF) (瀛�)
+	LSB = 0x61A8,    // 閾炬帴鐩存帴杞厓浠� (閾炬帴鐗规畩缁х數鍣�) (0x61A9锝�0x62A7) (浣�)
+	LSW = 0x6D60,    // 閾炬帴鐩存帴杞厓浠� (閾炬帴鐗规畩瀵勫瓨鍣�) (0x6D61锝�0x6E5F) (瀛�)
+	SPG = 0x7147,    // 鏅鸿兘鍔熻兘妯″潡杞厓浠� (0x7148锝�0x7247) (瀛�)
 };
 
-// 数据类型
+// 鏁版嵁绫诲瀷
 enum class DataType {
-	BIT = 1,   // 位 (1位)
-	WORD = 2,  // 字 (16位)
-	DWORD = 4  // 双字 (32位)
+	BIT = 1,   // 浣� (1浣�)
+	WORD = 2,  // 瀛� (16浣�)
+	DWORD = 4  // 鍙屽瓧 (32浣�)
 };
 
-// 控制代码
+// 鎺у埗浠g爜
 enum class ControlCode {
-	RUN = 0,   // 远程 RUN
-	STOP = 1,  // 远程 STOP
-	PAUSE = 2  // 远程 PAUSE
+	RUN = 0,   // 杩滅▼ RUN
+	STOP = 1,  // 杩滅▼ STOP
+	PAUSE = 2  // 杩滅▼ PAUSE
 };
 
-// 版本信息
+// 鐗堟湰淇℃伅
 struct BoardVersion {
-	char fixedValue[2];       // 固定值
-	char checksum[2];         // 校验和
-	char swVersion[2];        // 软件版本
-	char date[6];             // 日期 (格式 YYMMDD)
-	uint32_t reserved;        // 保留区域 (4 字节)
-	char swModel[16];         // 软件型号
-	char hwModel[16];         // 硬件型号
-	char twoPortMemory[2];    // 两端口存储器占用容量
-	char twoPortAttribute[2]; // 两端口属性
-	char availableBias[2];    // 可使用偏置
-	char moduleType[10];      // 机型类型
+	char fixedValue[2];       // 鍥哄畾鍊�
+	char checksum[2];         // 鏍¢獙鍜�
+	char swVersion[2];        // 杞欢鐗堟湰
+	char date[6];             // 鏃ユ湡 (鏍煎紡 YYMMDD)
+	uint32_t reserved;        // 淇濈暀鍖哄煙 (4 瀛楄妭)
+	char swModel[16];         // 杞欢鍨嬪彿
+	char hwModel[16];         // 纭欢鍨嬪彿
+	char twoPortMemory[2];    // 涓ょ鍙e瓨鍌ㄥ櫒鍗犵敤瀹归噺
+	char twoPortAttribute[2]; // 涓ょ鍙e睘鎬�
+	char availableBias[2];    // 鍙娇鐢ㄥ亸缃�
+	char moduleType[10];      // 鏈哄瀷绫诲瀷
 
-	// 输出结构体内容为字符串 (便于调试)
+	// 杈撳嚭缁撴瀯浣撳唴瀹逛负瀛楃涓� (渚夸簬璋冭瘯)
 	std::string toString() const {
 		std::ostringstream oss;
 		oss << "Fixed Value: " << fixedValue[0] << fixedValue[1] << "\n"
@@ -174,18 +174,18 @@
 	}
 };
 
-// 站点标识符,默认使用本站
+// 绔欑偣鏍囪瘑绗︼紝榛樿浣跨敤鏈珯
 struct StationIdentifier {
 	/*
 	 * [Network No.]
-	 * 0 表示本站
-	 * 1~239 表示普通网络号
+	 * 0 琛ㄧず鏈珯
+	 * 1~239 琛ㄧず鏅�氱綉缁滃彿
 	 **/
 
 	 /*
 	  * [Station No.]
-	  * MELSECNET/H:1~64 表示其他站点,255 表示本站
-	  * CC-Link 系列网络的范围类似,区别在于站号的取值范围
+	  * MELSECNET/H锛�1~64 琛ㄧず鍏朵粬绔欑偣锛�255 琛ㄧず鏈珯
+	  * CC-Link 绯诲垪缃戠粶鐨勮寖鍥寸被浼硷紝鍖哄埆鍦ㄤ簬绔欏彿鐨勫彇鍊艰寖鍥�
 	  * MELSECNET/H             : 1~64(Other stations),255(Own station)
 	  * CC-Link                 : 0~63(Other stations),255(Own station)
 	  * CC-Link IE Controller   : 1~120(Other stations),255(Own station)
@@ -194,15 +194,15 @@
 	  **/
 
 	  /*
-	   * 高 8 位(网络号): 指定设备所属的网络
-	   * 低 8 位(站点号): 指定设备在网络中的编号
-	   * 用一个参数传递设备的网络号和站点号时: nSt = station.nStNo | ((station.nNetNo << 8) & 0xFF00);
+	   * 楂� 8 浣嶏紙缃戠粶鍙凤級锛� 鎸囧畾璁惧鎵�灞炵殑缃戠粶
+	   * 浣� 8 浣嶏紙绔欑偣鍙凤級锛� 鎸囧畾璁惧鍦ㄧ綉缁滀腑鐨勭紪鍙�
+	   * 鐢ㄤ竴涓弬鏁颁紶閫掕澶囩殑缃戠粶鍙峰拰绔欑偣鍙锋椂: nSt = station.nStNo | ((station.nNetNo << 8) & 0xFF00);
 	   **/
 
-	short nNetNo = 0;    // 网络编号:PLC所连接的网络编号,0表示默认网络
-	short nStNo = 255;   // 站点编号:指定与PLC连接的站点编号,255通常表示广播或所有站点
+	short nNetNo = 0;    // 缃戠粶缂栧彿锛歅LC鎵�杩炴帴鐨勭綉缁滅紪鍙凤紝0琛ㄧず榛樿缃戠粶
+	short nStNo = 255;   // 绔欑偣缂栧彿锛氭寚瀹氫笌PLC杩炴帴鐨勭珯鐐圭紪鍙凤紝255閫氬父琛ㄧず骞挎挱鎴栨墍鏈夌珯鐐�
 
-	// 自定义构造函数,覆盖默认值
+	// 鑷畾涔夋瀯閫犲嚱鏁帮紝瑕嗙洊榛樿鍊�
 	explicit StationIdentifier(const short net, const short st) : nNetNo(net), nStNo(st) {}
 
 	StationIdentifier() 
@@ -211,24 +211,24 @@
 		nStNo = 255;
 	}
 
-	// 将“网络号”和“站点号”组合成一个最终编码
+	// 灏嗏�滅綉缁滃彿鈥濆拰鈥滅珯鐐瑰彿鈥濈粍鍚堟垚涓�涓渶缁堢紪鐮�
 	short StationIdentifier::toNetworkStationCode() const {
 		return static_cast<short>(nStNo | ((nNetNo << 8) & 0xFF00));
 	}
 
-	// 重载 < 运算符(用于排序或比较,通常用于 map 或 set 中作为 key)
+	// 閲嶈浇 < 杩愮畻绗︼紙鐢ㄤ簬鎺掑簭鎴栨瘮杈冿紝閫氬父鐢ㄤ簬 map 鎴� set 涓綔涓� key锛�
 	bool operator<(const StationIdentifier& other) const {
 		return std::tie(nNetNo, nStNo) <
 			std::tie(other.nNetNo, other.nStNo);
 	}
 
-	// 重载 == 运算符(用于相等比较)
+	// 閲嶈浇 == 杩愮畻绗︼紙鐢ㄤ簬鐩哥瓑姣旇緝锛�
 	bool operator==(const StationIdentifier& other) const {
 		return std::tie(nNetNo, nStNo) ==
 			std::tie(other.nNetNo, other.nStNo);
 	}
 
-	// 重载 = 运算符(用于赋值)
+	// 閲嶈浇 = 杩愮畻绗︼紙鐢ㄤ簬璧嬪�硷級
 	StationIdentifier& operator=(const StationIdentifier& other) {
 		if (this != &other) {
 			nNetNo = other.nNetNo;
@@ -238,16 +238,16 @@
 	}
 };
 
-// 板状态
+// 鏉跨姸鎬�
 struct BoardStatus {
-	short nStationValue = 0;    // 站号的设备值 (buf[0])
-	short nGroupValue = 0;      // 组 No. 的设备值 (buf[1])
-	short nNetworkValue = 0;    // 网络 No. 的设备值 (buf[2])
-	short nReserved1 = 0;       // 保留字段 (buf[3])
-	short nReserved2 = 0;       // 保留字段 (buf[4])
-	short nReserved3 = 0;       // 保留字段 (buf[5])
+	short nStationValue = 0;    // 绔欏彿鐨勮澶囧�� (buf[0])
+	short nGroupValue = 0;      // 缁� No. 鐨勮澶囧�� (buf[1])
+	short nNetworkValue = 0;    // 缃戠粶 No. 鐨勮澶囧�� (buf[2])
+	short nReserved1 = 0;       // 淇濈暀瀛楁 (buf[3])
+	short nReserved2 = 0;       // 淇濈暀瀛楁 (buf[4])
+	short nReserved3 = 0;       // 淇濈暀瀛楁 (buf[5])
 
-	// 将数组映射到结构体
+	// 灏嗘暟缁勬槧灏勫埌缁撴瀯浣�
 	static BoardStatus fromBuffer(const short buf[6]) {
 		return {
 			buf[0],
@@ -259,7 +259,7 @@
 		};
 	}
 
-	// 将结构体内容映射到数组
+	// 灏嗙粨鏋勪綋鍐呭鏄犲皠鍒版暟缁�
 	void toBuffer(short buf[6]) const {
 		buf[0] = nStationValue;
 		buf[1] = nGroupValue;
@@ -269,7 +269,7 @@
 		buf[5] = nReserved3;
 	}
 
-	// 调试输出
+	// 璋冭瘯杈撳嚭
 	std::string toString() const {
 		std::ostringstream oss;
 		oss << "Station Value: " << nStationValue << "\n"
@@ -282,12 +282,12 @@
 	}
 };
 
-// 事件详情
+// 浜嬩欢璇︽儏
 struct EventDetails {
-	short nEventNo;  					// 发生的事件号
-	std::array<short, 4> details; 		// 存储事件详情信息
+	short nEventNo;  					// 鍙戠敓鐨勪簨浠跺彿
+	std::array<short, 4> details; 		// 瀛樺偍浜嬩欢璇︽儏淇℃伅
 
-	// 解析事件详情,返回格式化字符串
+	// 瑙f瀽浜嬩欢璇︽儏锛岃繑鍥炴牸寮忓寲瀛楃涓�
 	std::string toString() const {
 		std::ostringstream oss;
 		oss << "Details[0]: " << details[0] << ", "
@@ -298,33 +298,33 @@
 	}
 };
 
-// SoftElement 结构体定义
+// SoftElement 缁撴瀯浣撳畾涔�
 struct SoftElement {
-	short nType;         // 软元件类型
-	short nElementCount; // 点数
-	long nStartNo;       // 起始软元件编号
+	short nType;         // 杞厓浠剁被鍨�
+	short nElementCount; // 鐐规暟
+	long nStartNo;       // 璧峰杞厓浠剁紪鍙�
 };
 
-// 错误信息
+// 閿欒淇℃伅
 struct ErrorInfo {
-	int nErrorCode = 0;              // 错误码
-	std::string strErrorMessageCn;   // 中文描述
-	std::string strErrorMessageEn;   // 英文描述
+	int nErrorCode = 0;              // 閿欒鐮�
+	std::string strErrorMessageCn;   // 涓枃鎻忚堪
+	std::string strErrorMessageEn;   // 鑻辨枃鎻忚堪
 
-	// 将结构体序列化为字符串
+	// 灏嗙粨鏋勪綋搴忓垪鍖栦负瀛楃涓�
 	std::string toString() const {
 		std::ostringstream oss;
 		oss << nErrorCode << "|" << strErrorMessageCn << "|" << strErrorMessageEn;
 		return oss.str();
 	}
 
-	// 从字符串反序列化为结构体
+	// 浠庡瓧绗︿覆鍙嶅簭鍒楀寲涓虹粨鏋勪綋
 	static ErrorInfo fromString(const std::string& line) {
 		ErrorInfo info;
 		std::istringstream iss(line);
 		std::string token;
 
-		// 使用分隔符 "|" 解析字符串
+		// 浣跨敤鍒嗛殧绗� "|" 瑙f瀽瀛楃涓�
 		std::getline(iss, token, '|');
 		info.nErrorCode = std::stoi(token);
 
@@ -338,47 +338,47 @@
 	}
 };
 
-using BitContainer = std::vector<bool>;			// 每个元素存储 1  位
-using WordContainer = std::vector<uint16_t>;	// 每个元素存储 16 位
-using DWordContainer = std::vector<uint32_t>;	// 每个元素存储 32 位
+using BitContainer = std::vector<bool>;			// 姣忎釜鍏冪礌瀛樺偍 1  浣�
+using WordContainer = std::vector<uint16_t>;	// 姣忎釜鍏冪礌瀛樺偍 16 浣�
+using DWordContainer = std::vector<uint32_t>;	// 姣忎釜鍏冪礌瀛樺偍 32 浣�
 
-// CPerformanceMelsec 类声明
+// CPerformanceMelsec 绫诲0鏄�
 class CPerformanceMelsec {
 public:
-	// 获取最近的错误信息
+	// 鑾峰彇鏈�杩戠殑閿欒淇℃伅
 	std::string GetLastError() const;
 
-	// 错误信息加载与保存接口
-	static bool LoadErrorInfoFromFile(const std::string& filename);  // 从文件加载错误信息
-	static bool SaveErrorInfoToFile(const std::string& filename);    // 保存错误信息到文件
+	// 閿欒淇℃伅鍔犺浇涓庝繚瀛樻帴鍙�
+	static bool LoadErrorInfoFromFile(const std::string& filename);  // 浠庢枃浠跺姞杞介敊璇俊鎭�
+	static bool SaveErrorInfoToFile(const std::string& filename);    // 淇濆瓨閿欒淇℃伅鍒版枃浠�
 
-	// 连接/断开
+	// 杩炴帴/鏂紑
 	int Connect(short nChannel, short nMode = -1);
 	int Disconnect();
 
-	// 初始化可编程控制器软元件信息表
+	// 鍒濆鍖栧彲缂栫▼鎺у埗鍣ㄨ蒋鍏冧欢淇℃伅琛�
 	int InitializeController();
 
-	//	获取版本信息
+	//	鑾峰彇鐗堟湰淇℃伅
 	int GetBoardVersion(BoardVersion& version);
 
-	// 板复位
+	// 鏉垮浣�
 	int BoardReset();
 
-	// 板LED读取
+	// 鏉縇ED璇诲彇
 	int ReadBoardLed(std::vector<short>& vecLedBuffer);
 
-	// 读取目标站点CPU类型
+	// 璇诲彇鐩爣绔欑偣CPU绫诲瀷
 	int ReadCPUCode(const StationIdentifier& station, short& nCPUCode);
 
-	// 板模式获取/设置
+	// 鏉挎ā寮忚幏鍙�/璁剧疆
 	int SetBoardMode(short nMode);
 	int GetBoardMode(short& nMode);
 
-	// 获取板状态
+	// 鑾峰彇鏉跨姸鎬�
 	int GetBoardStatus(BoardStatus& status);
 
-	// 读写数据
+	// 璇诲啓鏁版嵁
 	int ReadData(const StationIdentifier& station, long nDevType, long nDevNo, long nSize, std::vector<short>& vecData);
 	int ReadBitData(const StationIdentifier& station, DeviceType enDevType, short nDevNo, short nBitCount, BitContainer& vecData);
 	int ReadWordData(const StationIdentifier& station, DeviceType enDevType, short nDevNo, short nWordCount, WordContainer& vecData);
@@ -388,7 +388,7 @@
 	int WriteWordData(const StationIdentifier& station, DeviceType enDevType, short nDevNo, const WordContainer& vecData);
 	int WriteDWordData(const StationIdentifier& station, DeviceType enDevType, short nDevNo, const DWordContainer& vecData);
 
-	// 扩展读写数据
+	// 鎵╁睍璇诲啓鏁版嵁
 	long ReadDataEx(const StationIdentifier& station, long nDevType, long nDevNo, long nSize, std::vector<char>& vecData);
 	long ReadBitDataEx(const StationIdentifier& station, DeviceType enDevType, long nDevNo, long nBitCount, BitContainer& vecData);
 	long ReadWordDataEx(const StationIdentifier& station, DeviceType enDevType, long nDevNo, long nWordCount, WordContainer& vecData);
@@ -398,56 +398,56 @@
 	long WriteWordDataEx(const StationIdentifier& station, DeviceType enDevType, long nDevNo, const WordContainer& vecData);
 	long WriteDWordDataEx(const StationIdentifier& station, DeviceType enDevType, long nDevNo, const DWordContainer& vecData);
 
-	// 扩展软元件随机读写(支持多个软元件)
+	// 鎵╁睍杞厓浠堕殢鏈鸿鍐欙紙鏀寔澶氫釜杞厓浠讹級
 	long ReadRandomDataEx(const StationIdentifier& station, const std::vector<SoftElement>& vecSoftElements, std::vector<char>& vecData);
 	long WriteRandomDataEx(const StationIdentifier& station, const std::vector<SoftElement>& vecSoftElements, const std::vector<char>& vecData);
 
-	// 远程设备站/远程站的缓冲存储器读写
+	// 杩滅▼璁惧绔�/杩滅▼绔欑殑缂撳啿瀛樺偍鍣ㄨ鍐�
 	long ReadRemoteBuffer(const StationIdentifier& station, long nOffset, long nSize, std::vector<char>& vecData);
 	long WriteRemoteBuffer(const StationIdentifier& station, long nOffset, const std::vector<char>& vecData);
 	long ReadRemoteBufferByIp(const std::string& strIP, long nOffset, long nSize, std::vector<char>& vecData);
 	long WriteRemoteBufferByIp(const std::string& strIP, long nOffset, const std::vector<char>& vecData);
 
-	// 设置/复位对象站的指定位软元件
+	// 璁剧疆/澶嶄綅瀵硅薄绔欑殑鎸囧畾浣嶈蒋鍏冧欢
 	int SetBitDevice(const StationIdentifier& station, DeviceType enDevType, short nDevNo);
 	int ResetBitDevice(const StationIdentifier& station, DeviceType enDevType, short enDevNo);
 
-	// 扩展设置/复位对象站的指定位软元件
+	// 鎵╁睍璁剧疆/澶嶄綅瀵硅薄绔欑殑鎸囧畾浣嶈蒋鍏冧欢
 	long SetBitDeviceEx(const StationIdentifier& station, DeviceType enDevType, long nDevNo);
 	long ResetBitDeviceEx(const StationIdentifier& station, DeviceType enDevType, long nDevNo);
 
-	// 执行对象站的CPU
+	// 鎵ц瀵硅薄绔欑殑CPU
 	int ControlCPU(const StationIdentifier& station, ControlCode enControlCode);
 
-	// 事件等待,vecEventNumbers[0, 64],nTimeoutMs[-1, 2147483647]
-	// 同时发生了多个事件的情况下,首先检测出其中一个事件。 再次执行了本函数的情况下检测出其它事件。
+	// 浜嬩欢绛夊緟锛寁ecEventNumbers[0, 64]锛宯TimeoutMs[-1, 2147483647]
+	// 鍚屾椂鍙戠敓浜嗗涓簨浠剁殑鎯呭喌涓嬶紝棣栧厛妫�娴嬪嚭鍏朵腑涓�涓簨浠躲�� 鍐嶆鎵ц浜嗘湰鍑芥暟鐨勬儏鍐典笅妫�娴嬪嚭鍏跺畠浜嬩欢銆�
 	int WaitForBoardEvent(std::vector<short> vecEventNumbers, int nTimeoutMs, EventDetails& details);
 
 private:
-	// 锁定与解锁(多线程同步保护)
+	// 閿佸畾涓庤В閿侊紙澶氱嚎绋嬪悓姝ヤ繚鎶わ級
 	void Lock() { m_mtx.lock(); }
 	void Unlock() { m_mtx.unlock(); }
 
 protected:
-	// 构造函数/析构函数
+	// 鏋勯�犲嚱鏁�/鏋愭瀯鍑芥暟
 	explicit CPerformanceMelsec(BoardType enBoardType);
 	virtual ~CPerformanceMelsec();
 
-	// 辅助函数
-	void UpdateLastError(int nCode);						 		// 更新最近的错误信息
-	int ValidateStation(const StationIdentifier& station) const; 	// 检查连接状态和站点参数有效性
+	// 杈呭姪鍑芥暟
+	void UpdateLastError(int nCode);						 		// 鏇存柊鏈�杩戠殑閿欒淇℃伅
+	int ValidateStation(const StationIdentifier& station) const; 	// 妫�鏌ヨ繛鎺ョ姸鎬佸拰绔欑偣鍙傛暟鏈夋晥鎬�
 	int ValidateStationAndSize(const StationIdentifier& station, short nCount) const;
 
-	// 静态辅助函数
-	static void Delay(unsigned int nDelayMs);						// 延时,并且转发窗口消息
-	static BoardType FindBoardTypeByChannel(int nChannel);			// 查找板块类型
-	static short CombineStation(const StationIdentifier& station);  // 合并网络号和站点号
-	static short CalculateDeviceType(const StationIdentifier& station, DeviceType enDevType); // 计算软元件类型
+	// 闈欐�佽緟鍔╁嚱鏁�
+	static void Delay(unsigned int nDelayMs);						// 寤舵椂锛屽苟涓旇浆鍙戠獥鍙f秷鎭�
+	static BoardType FindBoardTypeByChannel(int nChannel);			// 鏌ユ壘鏉垮潡绫诲瀷
+	static short CombineStation(const StationIdentifier& station);  // 鍚堝苟缃戠粶鍙峰拰绔欑偣鍙�
+	static short CalculateDeviceType(const StationIdentifier& station, DeviceType enDevType); // 璁$畻杞厓浠剁被鍨�
 
-	// IP转换
+	// IP杞崲
 	static bool ConvertIpStringToUint32(const std::string& strIP, uint32_t& nIP);
 
-	// 容器转换
+	// 瀹瑰櫒杞崲
 	static void ConvertCharToShort(const std::vector<char>& vecChar, std::vector<short>& vecShort);
 	static void ConvertShortToChar(const std::vector<short>& vecShort, std::vector<char>& vecChar);
 	static void ConvertUint8ToShort(const std::vector<uint8_t>& vecUint8, std::vector<short>& vecShort);
@@ -455,7 +455,7 @@
 	static void ConvertUint32ToShort(const std::vector<uint32_t>& vecUint32, std::vector<short>& vecShort);
 	static void ConvertShortToUint32(const std::vector<short>& vecShort, std::vector<uint32_t>& vecUint32);
 
-	// 模板辅助函数
+	// 妯℃澘杈呭姪鍑芥暟
 	template <typename T>
 	int ValidateStationAndData(const StationIdentifier& station, const std::vector<T>& vecData);
 
@@ -465,15 +465,15 @@
 	template <typename T, typename U>
 	void ConvertHighToLow(const std::vector<T>& vecHigh, std::vector<U>& vecLow);
 
-	// 成员变量
-	std::mutex m_mtx;                       // 互斥锁保护
-	BoardType m_enBoardType;				// 板块类型
-	long m_nPath;                           // 通信路径
-	std::atomic<bool> m_bConnected;         // 是否已连接
-	std::string m_strLastError;             // 最近一次错误信息
+	// 鎴愬憳鍙橀噺
+	std::mutex m_mtx;                       // 浜掓枼閿佷繚鎶�
+	BoardType m_enBoardType;				// 鏉垮潡绫诲瀷
+	long m_nPath;                           // 閫氫俊璺緞
+	std::atomic<bool> m_bConnected;         // 鏄惁宸茶繛鎺�
+	std::string m_strLastError;             // 鏈�杩戜竴娆¢敊璇俊鎭�
 
-	// 静态成员变量
-	static std::unordered_map<int, std::string> m_mapError; // 错误码映射表
+	// 闈欐�佹垚鍛樺彉閲�
+	static std::unordered_map<int, std::string> m_mapError; // 閿欒鐮佹槧灏勮〃
 };
 
 #endif // PERFORMANCE_MELSEC_H
\ No newline at end of file

--
Gitblit v1.9.3