Browse Source

修改 : 按照南网文件修改自动化参数;

lch 8 months ago
parent
commit
61b1054e70

+ 2 - 1
README.md

@@ -54,4 +54,5 @@
 
 # 202512(22-28)
 01. 修改 : 对接开入量数据;
-02. 增加 : ch423s驱动;
+02. 增加 : ch423s驱动;
+03. 修改 : 按照南网文件修改自动化参数;

+ 99 - 69
dtu/dtu_main_t536/app/IECComm.c

@@ -2499,76 +2499,104 @@ int  iec_get_fixedset_csv(RMT_FIXED_TABLE *pfixedset)
 
 void  iec_init_fixedset(void *pt,RMT_FIXED_TABLE *pfixedset,bool b104)
 {
-	int i;
-	WORD num,no;
-	num=0;	
-	for(i=0;i<FIXEDSET_TABLE_NUMBER;i++)
-	{
-		pfixedset->set[num].type=tfixedsettable[i].index;
-		switch(tfixedsettable[i].index)
-		{
-			case FIXED_SET_CRC:
-				pfixedset->set[num].str[0]=(BYTE)(m_CodeCrc);
-				pfixedset->set[num].str[1]=(BYTE)(m_CodeCrc>>8);
-				pfixedset->set[num].len=2;
-				break;
-			case FIXED_SET_MAC1:
-			case FIXED_SET_MAC2:
-				no=tfixedsettable[i].index-FIXED_SET_MAC1;
-				rt_if_mac_get(no,pfixedset->set[num].str);
-				pfixedset->set[num].len=6;
-				break;
-			case FIXED_SET_SVR: // 软件版本
-				sprintf(pfixedset->set[num].str,"SV%02d.%03d",VER_NUM/1000,VER_NUM%1000);
-				pfixedset->set[num].len=strlen(pfixedset->set[num].str);
-				break;
+    int i;
+    WORD num, no;
+    u8 str_temp[32];
+    char ca_buf[16];
 
-			case FIXED_SET_ID: 
-				if(env_get_info(ENV_PID))
-				{
-					strcpy(pfixedset->set[num].str,env_get_info(ENV_PID));
-					
-				}
-				else
-				{
-					strcpy(pfixedset->set[num].str,"");
-				}
-				pfixedset->set[num].len=strlen(pfixedset->set[num].str);
-				break;				
-			case FIXED_SET_COM:
-				if(b104)
-				{
-					strcpy(pfixedset->set[num].str,"2016版扩展104");
-				}
-				else
-				{
-					IEC101_DEF *pt101=(IEC101_DEF *)pt;
-					if(tRunPara.tUartPara[pt101->chnl].wProtocol==PROTOCOL_101_PH)
-					{
-						strcpy(pfixedset->set[num].str,"2016版扩展平衡式101");
-					}
-					else
-					{
-						strcpy(pfixedset->set[num].str,"2016版扩展非平衡式101");
-					}
-				}
-				pfixedset->set[num].len=strlen(pfixedset->set[num].str);
-				break;
-			case FIXED_SET_CPT:
-				strcpy(pfixedset->set[num].str,VER_TIME);
-				pfixedset->set[num].len=strlen(pfixedset->set[num].str);
-				break;
-			default:	
-				strcpy(pfixedset->set[num].str,tfixedsettable[i].vstr);
-				pfixedset->set[num].len=strlen(tfixedsettable[i].vstr);
-		}
-		pfixedset->set[num].di=tfixedsettable[i].di;
-		pfixedset->set[num].unit=tfixedsettable[i].unit;
-		num++;
-	}
-	pfixedset->num=num;
-	iec_get_fixedset_csv(pfixedset);  // 从csv文件中更新相关固定参数信息
-	
+    num = 0;
+    for (i = 0; i < FIXEDSET_TABLE_NUMBER; i++)
+    {
+        pfixedset->set[num].type = tfixedsettable[i].index;
+        pfixedset->set[num].len = 0;
+        pfixedset->set[num].str[0] = 0;
+#if !defined CPU_FUXI
+        switch (tfixedsettable[i].index)
+        {
+        case FIXED_SET_CRC:
+            pfixedset->set[num].str[0] = (BYTE)(m_CodeCrc);
+            pfixedset->set[num].str[1] = (BYTE)(m_CodeCrc >> 8);
+            pfixedset->set[num].len = 2;
+            break;
+        case FIXED_SET_MAC1:
+        case FIXED_SET_MAC2:
+            no = tfixedsettable[i].index - FIXED_SET_MAC1;
+            rt_if_mac_get(no, pfixedset->set[num].str);
+            pfixedset->set[num].len = 6;
+            break;
+        case FIXED_SET_SVR: // 软件版本
+            sprintf(pfixedset->set[num].str, "SV%02d.%03d", VER_NUM / 1000, VER_NUM % 1000);
+            pfixedset->set[num].len = strlen(pfixedset->set[num].str);
+            break;
+
+        case FIXED_SET_ID:
+            if (env_get_info(ENV_PID))
+            {
+                strcpy(pfixedset->set[num].str, env_get_info(ENV_PID));
+            }
+            else
+            {
+                strcpy(pfixedset->set[num].str, "");
+            }
+            pfixedset->set[num].len = strlen(pfixedset->set[num].str);
+            break;
+        case FIXED_SET_COM:
+            if (b104)
+            {
+                strcpy(pfixedset->set[num].str, "2016版扩展104");
+            }
+            else
+            {
+                IEC101_DEF *pt101 = (IEC101_DEF *)pt;
+                if (tRunPara.tUartPara[pt101->chnl].wProtocol == PROTOCOL_101_PH)
+                {
+                    strcpy(pfixedset->set[num].str, "2016版扩展平衡式101");
+                }
+                else
+                {
+                    strcpy(pfixedset->set[num].str, "2016版扩展非平衡式101");
+                }
+            }
+            pfixedset->set[num].len = strlen(pfixedset->set[num].str);
+            break;
+        case FIXED_SET_CPT:
+            strcpy(pfixedset->set[num].str, VER_TIME);
+            pfixedset->set[num].len = strlen(pfixedset->set[num].str);
+            break;
+        default:
+            strcpy(pfixedset->set[num].str, tfixedsettable[i].vstr);
+            pfixedset->set[num].len = strlen(tfixedsettable[i].vstr);
+        }
+#else
+        switch (tfixedsettable[i].index)
+        {
+        case FIXED_SET_SVR: // 软件版本
+            sprintf(pfixedset->set[num].str, "SV%02d.%03d", (VER_NUM >> 16) & 0XFF, VER_NUM & 0XFFF);
+            pfixedset->set[num].len = strlen(pfixedset->set[num].str);
+            break;
+
+        case FIXED_SET_CRC:
+            pfixedset->set[num].str[0] = (BYTE)(m_CodeCrc);
+            pfixedset->set[num].str[1] = (BYTE)(m_CodeCrc >> 8);
+            pfixedset->set[num].len = 2;
+            break;
+
+        case FIXED_SET_CPT:
+            strcpy(pfixedset->set[num].str, VER_TIME);
+            pfixedset->set[num].len = strlen(pfixedset->set[num].str);
+            break;
+
+        default:
+            strcpy(pfixedset->set[num].str, tfixedsettable[i].vstr);
+            pfixedset->set[num].len = strlen(tfixedsettable[i].vstr);
+        }
+#endif
+        pfixedset->set[num].di = tfixedsettable[i].di;
+        pfixedset->set[num].unit = tfixedsettable[i].unit;
+        num++;
+    }
+    pfixedset->num = num;
+    iec_get_fixedset_csv(pfixedset); // 从csv文件中更新相关固定参数信息
 }
 
 int enc_unicode_to_utf8_one(unsigned short unic, unsigned char *pOutput)
@@ -4481,6 +4509,7 @@ void iec_printfixedset(void)
 		{
 			rt_printf("\r\n%04x  %-24s%04x",tfixedsettable[i].di,tfixedsettable[i].name,(tfixedset.set[i].str[0]+(tfixedset.set[i].str[1]<<8)));
 		}
+#if !defined CPU_FUXI
 		else if(index==FIXED_SET_MAC1||index==FIXED_SET_MAC2) //  软件版本号
 		{
 			rt_printf("\r\n%04x  %-24s%02x-%02x-%02x-%02x-%02x-%02x",tfixedsettable[i].di,tfixedsettable[i].name,
@@ -4488,6 +4517,7 @@ void iec_printfixedset(void)
 
 		}
 		else
+#endif
 		{
 			rt_printf("\r\n%04x  %-24s%s",tfixedset.set[i].di,tfixedsettable[i].name,tfixedset.set[i].str);
 		}

+ 1 - 1
dtu/dtu_main_t536/app/IECComm.h

@@ -313,7 +313,7 @@ typedef struct RMT_SET_DAT_DEF
 }RMT_SET_DATA;
 
 
-#define  RMT_FIXED_SET_NUM 14 // ¹Ì¶¨¶¨Öµ
+#define  RMT_FIXED_SET_NUM FIXED_SET_MAX // ¹Ì¶¨¶¨Öµ
 
 typedef struct RMT_SET_VAL
 {

+ 1 - 1
dtu/dtu_main_t536/app/defineSys.h

@@ -12,7 +12,7 @@
 #ifndef _DEFINE_SYS_H
 #define _DEFINE_SYS_H
 
-#define DEVICE_VERSION_INFORMATION "NW24_20251224_002" // NW2022意思是按照22年南网标准文件(总调)来做的
+#define DEVICE_VERSION_INFORMATION "NW24_20251225_003" // NW2022意思是按照22年南网标准文件(总调)来做的
 
 #ifdef ___defineSys____//!!!此宏定义不开启,以下宏不直接开启,只用于注释显示
 

+ 108 - 84
dtu/dtu_main_t536/app/set.c

@@ -25,6 +25,8 @@
 #include <linux/kmod.h>
 #endif
 
+#define FIXED_ARGS_NUM		7
+
 #define MAX_3(x,y,z) (x>y?(x>z?x:z):(y>z?y:z))
 #define MIN_3(x,y,z) (((x>y?y:x)>z)?z:(x>y?y:x))
 
@@ -1665,32 +1667,39 @@ const int RMT_SET_TABLE_NUMBER  = sizeof( tRmtsettable ) / sizeof(tRmtsettable[0
 
 const  TFIXEDSETTABLE tfixedsettable[]=         //
 {
-#ifdef defined GD_AREA_ZHONGSHAN || defined GD_AREA_ZHONGSHAN_2020
-	{FIXED_SET_EQU, 	0x8001, STR_R,	"D30",						"终端类型",},
-	{FIXED_SET_SYS, 	0x8002, STR_R,	"Linux 2.6.29.1",			"操作系统",},
-	{FIXED_SET_MAU, 	0x5077, STR_R,	"", 						"  制造商",},
-	{FIXED_SET_HVR, 	0x5079, STR_R,	"HV01.02",					"硬件版本",},
-	{FIXED_SET_SVR, 	0x507A, STR_R,	"", 						"软件版本",},
-	{FIXED_SET_CRC, 	0x8006, USHORT_R,"",						"软件校验",},
-	{FIXED_SET_COM, 	0x507B, STR_R,	"101-2016,104-2016",		"通信规约",},
-	{FIXED_SET_TPE, 	0x5078, STR_R,	"DFTU-8000",				"出厂型号",},
-	{FIXED_SET_ID,		0x5076, STR_R,	"", 						"终端ID号",},
-#else
+#if !defined CPU_FUXI
 	{FIXED_SET_EQU,		0x8001,	STR_R,	"D30",						"终端类型",},
-	{FIXED_SET_SYS,		0x8002,	STR_R,	"Linux 2.6.29.1",			"操作系统",},
+	{FIXED_SET_SYS,		0x8002,	STR_R,	"Linux 5.10.214",			"操作系统",},
 	{FIXED_SET_MAU,		0x8003,	STR_R,	"",							"  制造商",},
 	{FIXED_SET_HVR,		0x8004,	STR_R,	"HV01.02",					"硬件版本",},
 	{FIXED_SET_SVR,		0x8005,	STR_R,	"",							"软件版本",},
 	{FIXED_SET_CRC,		0x8006,	USHORT_R,"",						"软件校验",},
 	{FIXED_SET_COM,		0x8007,	STR_R,	"101-2016,104-2016",		"通信规约",},
-	{FIXED_SET_TPE,		0x8008,	STR_R,	"DFTU-8000",				"出厂型号",},
+	{FIXED_SET_TPE,		0x8008,	STR_R,	"CSP-6000",				    "出厂型号",},
 	{FIXED_SET_ID,		0x8009,	STR_R,	"",							"终端ID号",},
-#endif
 	{FIXED_SET_MAC1,	0x800A,	STR_R,	"",							"网卡1MAC",},
 	{FIXED_SET_MAC2,	0x800B,	STR_R,	"",							"网卡2MAC",},
 	{FIXED_SET_PTRATE,	0x800C, STR_R,	"100", 						"PT变比",},
 	{FIXED_SET_CTRATE,	0x800D, STR_R,	"120", 						"CT变比",},
-	{FIXED_SET_CPT,		0x800E, STR_R,	"", 						"编译时间",},
+#else
+    {FIXED_SET_ID,              0x8001,     STR_R,      "",         "终端ID",},
+    {FIXED_SET_MAU,             0x8002,     STR_R,      "",         "终端厂商",},
+    {FIXED_SET_TPE,             0x8003,     STR_R,      "",         "终端型号",},
+    {FIXED_SET_HVR,             0x8004,     STR_R,      "HV01.00",  "终端硬件版本",},
+    {FIXED_SET_SVR,             0x8005,     STR_R,      "SV01.00",  "终端软件版本",},
+    {FIXED_SET_COM,             0x8006,     UINT_R,     "104",      "规约参数",},
+    {FIXED_SET_EQU_ADDR,        0x8007,     UINT_R,     "1",        "终端逻辑地址",},
+    {FIXED_SET_YC_DEAD_ZONE,    0x8008,     FLOAT_R,    "2",        "遥测死区",},
+    {FIXED_SET_DI_AS_TIME,      0x8009,     FLOAT_R,    "20",       "开入量采集防抖时间",},
+    {FIXED_SET_BAAC,            0x800a,     FLOAT_R,    "2",        "蓄电池自动活化周期",},
+    {FIXED_SET_IP_M1,           0x800b,     STR_R,      "",         "主站侧IP1地址",},
+    {FIXED_SET_IP_M2,           0x800c,     STR_R,      "",         "主站侧IP2地址",},
+    {FIXED_SET_IP_M3,           0x800d,     STR_R,      "",         "主站侧IP3地址",},
+    {FIXED_SET_IP_M4,           0x800e,     STR_R,      "",         "主站侧IP4地址",},
+    {FIXED_SET_CRC,             0x800f,     STR_R,      "",         "软件校验",},
+    {FIXED_SET_MAN,             0x8010,     STR_R,      "",         "终端名称",},
+	{FIXED_SET_CPT,		        0x8011,     STR_R,      "",         "编译时间",},
+#endif
 };
 
 const int FIXEDSET_TABLE_NUMBER	= sizeof( tfixedsettable ) / sizeof(tfixedsettable[0]);
@@ -1738,88 +1747,104 @@ const int REMOTE_NUM = (sizeof(g_three_remote_func)/sizeof(g_three_remote_func[0
 // 得到一个固定参数的值
 int set_get_fixed_arg(int index,char *buf,int len)
 {
-	RMT_FIXED_TABLE tfixedset;	
-	int i;
-	 
-	iec_init_fixedset(&g_t104[0],&tfixedset,true);  // 获取固定定值
-	
-	// 检查参数
-	if(index < 0 || index >=RMT_FIXED_SET_NUM) //FIXEDSET_TABLE_NUMBER)
-	{
-		return -1;
-	}
-	if(buf==NULL || len < 32)
-	{
-		return -2;
-	}
+    RMT_FIXED_TABLE tfixedset;
+    int i;
 
-	memset(buf,0,len);
+    iec_init_fixedset(&g_t104[0], &tfixedset, true); // 获取固定定值
 
-	len--;
-	for(i=0;i<RMT_FIXED_SET_NUM;i++)
-	{
-		if(index == tfixedset.set[i].type)
-		{
-			switch(index)
-			{
-				case FIXED_SET_CRC: // 软件校验。
-					sprintf(buf,"%04x",(tfixedset.set[i].str[0]+(tfixedset.set[i].str[1]<<8)));		
-				break;
-				case FIXED_SET_MAC1: 
-				case FIXED_SET_MAC2: 
-					sprintf(buf,"%02x-%02x-%02x-%02x-%02x-%02x",tfixedset.set[i].str[0],tfixedset.set[i].str[1],tfixedset.set[i].str[2],tfixedset.set[i].str[3],tfixedset.set[i].str[4],tfixedset.set[i].str[5]);
-				break;
-				default:
-					strncpy(buf,tfixedset.set[i].str,len);
-				break;
-			}
+    // 检查参数
+    if (index < 0 || index >= FIXEDSET_TABLE_NUMBER) // FIXEDSET_TABLE_NUMBER)
+    {
+        return -1;
+    }
+    if (buf == NULL || len < 32)
+    {
+        return -2;
+    }
 
-			return 0;
-	
-			
-		}
-		
-	}
+    memset(buf, 0, len);
 
+    len--;
+#if !defined CPU_FUXI
+    for (i = 0; i < RMT_FIXED_SET_NUM; i++)
+    {
+        if (index == tfixedset.set[i].type)
+        {
+            switch (index)
+            {
+            case FIXED_SET_CRC: // 软件校验。
+                sprintf(buf, "%04x", (tfixedset.set[i].str[0] + (tfixedset.set[i].str[1] << 8)));
+                break;
 
-	return -3;
+#if !defined CPU_FUXI
+            case FIXED_SET_MAC1:
+            case FIXED_SET_MAC2:
+                sprintf(buf, "%02x-%02x-%02x-%02x-%02x-%02x", tfixedset.set[i].str[0], tfixedset.set[i].str[1], tfixedset.set[i].str[2], tfixedset.set[i].str[3], tfixedset.set[i].str[4], tfixedset.set[i].str[5]);
+                break;
+#endif
+
+            default:
+                strncpy(buf, tfixedset.set[i].str, len);
+                break;
+            }
+
+            return 0;
+        }
+    }
+    return -3;
+#else
+    for (i = 0; i < RMT_FIXED_SET_NUM; i++)
+    {
+        if (index == tfixedset.set[i].type)
+        {
+            switch (index)
+            {
+            case FIXED_SET_CRC: // 软件校验。
+                sprintf(buf, "%04x", (tfixedset.set[i].str[0] + (tfixedset.set[i].str[1] << 8)));
+                break;
+
+            default:
+                strncpy(buf, tfixedset.set[i].str, len);
+                break;
+            }
+        }
+    }
+    return 0;
+#endif
 }
 
 // 得到固定参数字符串,维护工具接口用
-#define FIXED_ARGS_NUM		6
 int set_get_fixed_args_sz(int index,char *buf,int len)
 {
-	int i,len_line,len_all,num;
-	char sz[64],arg[64];
-
-	len_all = 0;
-	num = 0;
-	for(i=index*FIXED_ARGS_NUM;i<FIXEDSET_TABLE_NUMBER&&num<FIXED_ARGS_NUM;i++,num++)
-	{
-		set_get_fixed_arg(tfixedsettable[i].index,arg,64);
-		len_line = sprintf(sz,"%s[%04x]:%s\r\n",tfixedsettable[i].name,tfixedsettable[i].di,arg);;
-		
-		strncpy(buf+len_all,sz,len-len_all);
+    int i, len_line, len_all, num;
+    char sz[64], arg[64];
 
-		len_all += len_line;
-		if(len_all >= len)
-		{
-			buf[len- 1] =0;
-			return len;
-		}
-		
-	}
+    len_all = 0;
+    num = 0;
+    for (i = index * FIXED_ARGS_NUM; i < FIXEDSET_TABLE_NUMBER && num < FIXED_ARGS_NUM; i++, num++)
+    {
+        set_get_fixed_arg(i, arg, 64);
+        len_line = sprintf(sz, "%s[%04x]:%s\r\n", tfixedsettable[i].name, tfixedsettable[i].di, arg);
 
-	// 删除最后的回车换行
-	if(len_all > 2)
-	{
-		len_all -= 2;
-	}
-	buf[len_all] =0;
-	return len_all+1;
-}
+        strncpy(buf + len_all, sz, len - len_all);
 
+        len_all += len_line;
+        // dp_err_n_c("index = %ld, i = %d, len_all = %d, len_line = %d, arg: %s, sz: %s", index, i, len_all, len_line, arg, sz);
+        if (len_all >= len)
+        {
+            buf[len - 1] = 0;
+            return len;
+        }
+    }
 
+    // 删除最后的回车换行
+    if (len_all > 2)
+    {
+        len_all -= 2;
+    }
+    buf[len_all] = 0;
+    return len_all + 1;
+}
 
 /*********************eep操作通用函数:包含装置型号及CRC信息*******************/
 
@@ -2168,7 +2193,6 @@ void get_yx_ac(u8 index, u32 type)
 返回值: 成功时返回1,否则,0
 函数扇入清单:
 ***************************************************************************/
-extern  const qs08 g_e_k[];
 bool MakeRunSet(bool bFirst)
 {
     TSET *ptSet;

+ 21 - 1
dtu/dtu_main_t536/app/set.h

@@ -1859,6 +1859,7 @@ typedef struct
 // 通用定值
 enum
 {
+#if !defined CPU_FUXI
     FIXED_SET_EQU = 0, // 终端类型
     FIXED_SET_SYS,     // 终端操作系统
     FIXED_SET_MAU,     // 终端制造商
@@ -1872,7 +1873,26 @@ enum
     FIXED_SET_MAC2,    // 终端网卡2MAC地址
     FIXED_SET_PTRATE,  // PT变比
     FIXED_SET_CTRATE,  // CT变比
-    FIXED_SET_CPT,     // 编译时间
+#else
+    FIXED_SET_ID = 0,       // 终端ID
+    FIXED_SET_MAU,          // 终端厂商
+    FIXED_SET_TPE,          // 终端型号
+    FIXED_SET_HVR,          // 终端硬件版本
+    FIXED_SET_SVR,          // 终端软件版本
+    FIXED_SET_COM,          // 规约参数
+    FIXED_SET_EQU_ADDR,     // 终端逻辑地址
+    FIXED_SET_YC_DEAD_ZONE, // 遥测死区
+    FIXED_SET_DI_AS_TIME,   // 开入量采集防抖时间
+    FIXED_SET_BAAC,         // 蓄电池自动活化周期
+    FIXED_SET_IP_M1,        // 主站侧IP1地址
+    FIXED_SET_IP_M2,        // 主站侧IP2地址
+    FIXED_SET_IP_M3,        // 主站侧IP3地址
+    FIXED_SET_IP_M4,        // 主站侧IP4地址
+    FIXED_SET_CRC,          // 软件校验
+    FIXED_SET_MAN,          // 终端名称
+    FIXED_SET_CPT,          // 编译时间
+#endif
+    FIXED_SET_MAX,
 };
 
 // 整定值参数表结构