|
|
|
|
/****************************************************************************
|
|
|
|
|
** File name : HTIEC104.h
|
|
|
|
|
** Description : define 104 worker thread group
|
|
|
|
|
** Create date : 2018.09.01
|
|
|
|
|
** Auther by : Liuyx
|
|
|
|
|
** Version info : V1.0.01
|
|
|
|
|
** Copyrigth By: xi'an huatek, Inc Co., Ltd
|
|
|
|
|
** Update record:
|
|
|
|
|
** DATE AUTHER DESC
|
|
|
|
|
** -------------------------------------------------------------------------
|
|
|
|
|
** 2018.09.01 Liuyx first build
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
//#include <string.h>
|
|
|
|
|
#include "HTGlobal.h"
|
|
|
|
|
#include "HTIEC104.h"
|
|
|
|
|
|
|
|
|
|
static const char *_FILE_ = "HTIEC104.cpp";
|
|
|
|
|
static FILE *fpIec = NULL; // iec104 config file handle.
|
|
|
|
|
static ST_IEC104_CONF g_iec_conf;
|
|
|
|
|
static time_t g_Internal_time;
|
|
|
|
|
|
|
|
|
|
list<ST_RECVPKG> g_list_pack;
|
|
|
|
|
mutex g_list_pack_mutex;
|
|
|
|
|
|
|
|
|
|
list<ST_DB_DATA> g_list_dbset;
|
|
|
|
|
mutex g_list_dbset_mutex;
|
|
|
|
|
|
|
|
|
|
list<ST_IECPOINT_TABLE> g_list_origin;
|
|
|
|
|
mutex g_list_origin_mutex;
|
|
|
|
|
|
|
|
|
|
list<ST_IECPOINT_TABLE> g_list_pingce;
|
|
|
|
|
mutex g_list_pingce_mutex;
|
|
|
|
|
|
|
|
|
|
list<ST_IECPOINT_TABLE> g_list_warn;
|
|
|
|
|
mutex g_list_warn_mutex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mutex g_sendno_mutex;
|
|
|
|
|
|
|
|
|
|
CIEC104::CIEC104()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
CIEC104::~CIEC104()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
static void vPrtListCount()
|
|
|
|
|
{
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_list_pack count:%d", g_list_pack.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_list_dbset count:%d", g_list_dbset.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_list_origin count:%d", g_list_origin.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_list_pingce count:%d", g_list_pingce.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_list_warn count:%d", g_list_warn.size());
|
|
|
|
|
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_map_thres_byq count:%d", g_map_thres_byq.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_map_relation count:%d", g_map_relation.size());
|
|
|
|
|
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_map_iec count:%d", g_map_iec.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_map_sadr count:%d", g_map_sadr.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_map_img_thres count:%d", g_map_img_thres.size());
|
|
|
|
|
vPrtLogMsg(LOG_WARNG, RET_OK, "-----> g_map_sadr count:%d", g_map_sadr.size());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/*************************************************************************
|
|
|
|
|
Function iniGetString
|
|
|
|
|
Rectives a character string from the specified section in the
|
|
|
|
|
specified inifile
|
|
|
|
|
Param In :
|
|
|
|
|
pszSection : address of section
|
|
|
|
|
pszEntry : address of entry
|
|
|
|
|
uiBufLen : size of destination buffer
|
|
|
|
|
pszFileName: address of inifile name
|
|
|
|
|
Param Out :
|
|
|
|
|
pszRetBuf : destination buffer
|
|
|
|
|
Return Code :
|
|
|
|
|
0 : success
|
|
|
|
|
<0 : failed
|
|
|
|
|
*************************************************************************/
|
|
|
|
|
static int iGetString(const char *pszSection, const char *pszEntry, char *pszRetBuf, unsigned int uiBufLen)
|
|
|
|
|
{
|
|
|
|
|
//FILE *fpIni;
|
|
|
|
|
char szBuf[DEF_BUFFER_1K + 1], *psz1, *psz2, *psz;
|
|
|
|
|
int iSectFlag, iLen;
|
|
|
|
|
|
|
|
|
|
if (fpIec == NULL) {
|
|
|
|
|
if ((fpIec = fopen(IEC_CONFIMG_FILE, "r")) == NULL)
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
fseek(fpIec, 0, SEEK_SET);
|
|
|
|
|
/*** check section ***/
|
|
|
|
|
iSectFlag = 0;
|
|
|
|
|
while (!feof(fpIec)) {
|
|
|
|
|
if (fgets(szBuf, DEF_BUFFER_1K, fpIec) == NULL) break;
|
|
|
|
|
psz = szBuf;
|
|
|
|
|
|
|
|
|
|
while (*psz != '[' && *psz != '#' && *psz != '\0') psz++;
|
|
|
|
|
if (*psz != '[') continue;
|
|
|
|
|
psz++;
|
|
|
|
|
while (*psz == ' ' || *psz == '\t') psz++;
|
|
|
|
|
psz1 = psz;
|
|
|
|
|
while (*psz != ']' && *psz != '\0') psz++;
|
|
|
|
|
if (*psz == '\0') continue;
|
|
|
|
|
while (*(psz - 1) == ' ' || *(psz - 1) == '\t') psz--;
|
|
|
|
|
*psz = '\0';
|
|
|
|
|
if (!strcmp(psz1, pszSection)) {
|
|
|
|
|
iSectFlag = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}/*** while ***/
|
|
|
|
|
if (!iSectFlag) {
|
|
|
|
|
//fclose(fpIni);
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*** check entry ***/
|
|
|
|
|
while (!feof(fpIec)) {
|
|
|
|
|
if (fgets(szBuf, DEF_BUFFER_1K, fpIec) == NULL) break;
|
|
|
|
|
psz = szBuf;
|
|
|
|
|
while (*psz == ' ' || *psz == '\t') psz++;
|
|
|
|
|
if (*psz == '#' || *psz == '\0') continue;
|
|
|
|
|
if (*psz == '[') break;
|
|
|
|
|
|
|
|
|
|
psz1 = psz;
|
|
|
|
|
while (*psz != '=' && *psz != '\0') psz++;
|
|
|
|
|
if (*psz == '\0') continue;
|
|
|
|
|
psz2 = psz + 1;
|
|
|
|
|
if (psz1 == psz) continue;
|
|
|
|
|
while (*(psz - 1) == ' ' || *(psz - 1) == '\t') psz--;
|
|
|
|
|
*psz = '\0';
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
if (strcmp(psz1, pszEntry)) continue;
|
|
|
|
|
#else
|
|
|
|
|
if (strcasecmp(psz1, pszEntry)) continue;
|
|
|
|
|
#endif
|
|
|
|
|
//fclose(fpIni);
|
|
|
|
|
|
|
|
|
|
psz = psz2;
|
|
|
|
|
while (*psz == ' ' || *psz == '\t') psz++;
|
|
|
|
|
psz2 = psz;
|
|
|
|
|
while (*psz != '#' && *psz != '\0' && !(*psz == '/' && (*(psz + 1) == '*' || *(psz + 1) == '/'))) psz++;
|
|
|
|
|
while (*(psz - 1) == ' ' || *(psz - 1) == '\t' || *(psz - 1) == 0x0a || *(psz - 1) == 0x0d)
|
|
|
|
|
{
|
|
|
|
|
*(psz - 1) = '\0';
|
|
|
|
|
psz--;
|
|
|
|
|
}
|
|
|
|
|
//*psz= '\0';
|
|
|
|
|
iLen = strlen(psz2);
|
|
|
|
|
if (psz2[iLen - 1] == 0x0a || psz2[iLen - 1] == 0x0d) psz2[iLen - 1] = 0x00;
|
|
|
|
|
if (iLen == 0) return (0); //return (-1); // 参数未设置,即参数值为空的情况
|
|
|
|
|
if (iLen > (int)uiBufLen) iLen = uiBufLen;
|
|
|
|
|
memcpy(pszRetBuf, psz2, iLen);
|
|
|
|
|
*(pszRetBuf + iLen) = '\0';
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
//fclose(fpIni);
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
static void setSadrMatchRelations(unsigned int key, ST_SADR_MATCH *pstAdr)
|
|
|
|
|
{
|
|
|
|
|
ST_SADR_MATCH stAdr;
|
|
|
|
|
memset(&stAdr, 0x00, sizeof(ST_SADR_MATCH));
|
|
|
|
|
|
|
|
|
|
if (key <= 0) return; // key=0时,表示104配置文件中无此点表地址、地址为空的情况
|
|
|
|
|
stAdr.eqm_type = pstAdr->eqm_type;
|
|
|
|
|
stAdr.count = pstAdr->count;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr = (ST_MATCH_LIST*)calloc(pstAdr->count, sizeof(ST_MATCH_LIST));
|
|
|
|
|
memcpy(stAdr.psadr, pstAdr->psadr, (pstAdr->count * sizeof(ST_MATCH_LIST)));
|
|
|
|
|
|
|
|
|
|
mutex_lock(g_map_sadr_mutex);
|
|
|
|
|
g_map_sadr.insert(map<unsigned int, ST_SADR_MATCH>::value_type(key, stAdr));
|
|
|
|
|
mutex_unlock(g_map_sadr_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 加IEC104业务配置文件数据
|
|
|
|
|
static bool iGetIEC104Conf()
|
|
|
|
|
{
|
|
|
|
|
int iRet = -1, i;
|
|
|
|
|
char szTmp[512], szSection[128];
|
|
|
|
|
|
|
|
|
|
memset(&g_iec_conf, 0x00, sizeof(ST_IEC104_CONF)); // 初始化IEC104配置.
|
|
|
|
|
// 打开配置文件,准备加载配置参数
|
|
|
|
|
if (fpIec == NULL) {
|
|
|
|
|
if ((fpIec = fopen(IEC_CONFIMG_FILE, "r")) == NULL) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, errno, "open config file: %s failed!", HT_CONFIMG_FILE);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取变压器配置项的个数
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_DEVCOUNT", "iec_byq_count", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get iec_byq_count parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.iec_byq_count = (unsigned int)atoi(szTmp);
|
|
|
|
|
// 申请变压器设备编码缓冲区
|
|
|
|
|
g_iec_conf.pstByqCode = (ST_BYQ_EQM_CODE*)calloc(g_iec_conf.iec_byq_count, sizeof(ST_BYQ_EQM_CODE));
|
|
|
|
|
if (!g_iec_conf.pstByqCode) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "calloc byq_eqm_code cache size: %d failed!", g_iec_conf.iec_byq_count * sizeof(ST_BYQ_EQM_CODE));
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取断路器配置项的个数
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_DEVCOUNT", "iec_break_count", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get iec_break_count parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.iec_break_count = (unsigned int)atoi(szTmp);
|
|
|
|
|
// 申请断路器设备编码缓冲区
|
|
|
|
|
g_iec_conf.pstBrkCode = (ST_BREAK_EQM_CODE*)calloc(g_iec_conf.iec_break_count, sizeof(ST_BREAK_EQM_CODE));
|
|
|
|
|
if (!g_iec_conf.pstBrkCode) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "calloc brk_eqm_code cache size: %d failed!", g_iec_conf.iec_break_count * sizeof(ST_BREAK_EQM_CODE));
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// 获取站点ID配置项
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_DEVCOUNT", "iec_site_id", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get iec_site_id parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
strcpy((char*)g_iec_conf.site_id , szTmp);
|
|
|
|
|
|
|
|
|
|
vPrtLogMsg(LOG_DEBUG, 0, "get iec_byq_count config count: byq_cnt:%d,gis_cnt:%d,site_id:%s",
|
|
|
|
|
g_iec_conf.iec_byq_count, g_iec_conf.iec_break_count, szTmp);
|
|
|
|
|
|
|
|
|
|
// 104时间保存间隔时间(s)
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("COMM_SAVE_INTERNAL", "DATA_SAVE_INTERNAL", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get DATA_SAVE_INTERNAL parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.save_internal = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
// 获取公共地址配置
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "iec_global_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get iec_global_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.iec_global_addr = (unsigned short)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
// 获取YC地址配置
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "yx_start_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get yx_start_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.yx_start_addr = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "yx_stop_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get yx_stop_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.yx_stop_addr = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
// 获取JB地址配置
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "jb_start_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get jb_start_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.jb_start_addr = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "jb_stop_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get jb_stop_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.jb_stop_addr = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
// 获取YC地址配置
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "yc_start_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get yc_start_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.yc_start_addr = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString("IEC_OBJS_ADDR", "yc_stop_addr", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get yc_stop_addr parameter failed!");
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.yc_stop_addr = (unsigned int)atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取BYQ配置各项参数
|
|
|
|
|
for (i = 0; i < (int)g_iec_conf.iec_byq_count; i++)
|
|
|
|
|
{
|
|
|
|
|
snprintf(szSection, sizeof(szSection), "IEC_BYQ_CODE_%02d", i + 1);
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "EQM_CODE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: EQM_CODE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
strcpy((char*)g_iec_conf.pstByqCode[i].szEqmCode, szTmp);
|
|
|
|
|
|
|
|
|
|
// 主变高压侧电压、电流点位HIGH_VOLTAGE, HIGH_CURRENT = 16387
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "HIGH_VOLTAGE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: HIGH_VOLTAGE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiHighVoltage = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "HIGH_CURRENT", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: HIGH_CURRENT parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiHighCurrent = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//主变低压(出口)侧电压、电流点位 LOW_VOLTAGE = 16700 LOW_CURRENT = 16701
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "LOW_VOLTAGE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: LOW_VOLTAGE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiLowVoltage = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "LOW_CURRENT", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: LOW_CURRENT parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiLowCurrent = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//# 运行工况点位
|
|
|
|
|
//# 主变冷却水进口压力点位 COOL_WATER_PRESS_ENTRY = 16365
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "COOL_WATER_PRESS_ENTRY", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: COOL_WATER_PRESS_ENTRY parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiCoolWaterPressEntry = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变冷却水出口压力点位 COOL_WATER_PRESS_OUTER = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "COOL_WATER_PRESS_OUTER", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: COOL_WATER_PRESS_OUTER parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiCoolWaterPressOuter = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变冷却水进口温度点位 COOL_WATER_TEMP_ENTRY = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "COOL_WATER_TEMP_ENTRY", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: COOL_WATER_TEMP_ENTRY parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiCoolWaterTempEntry = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变冷却水出口温度点位 COOL_WATER_TEMP_OUTER = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "COOL_WATER_TEMP_OUTER", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: COOL_WATER_TEMP_OUTER parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiCoolWaterTempOuter = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//# 主变油进口压力点位 OIL_PRESS_ENTRY = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_PRESS_ENTRY", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_PRESS_ENTRY parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilPressEntry = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变油出口压力点位 OIL_PRESS_OUTER = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_PRESS_OUTER", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_PRESS_OUTER parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilPressOuter = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//# 主变油进口温度点位 OIL_TEMP_ENTRY = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_TEMP_ENTRY", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_TEMP_ENTRY parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilTempEntry = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变油出口温度点位 OIL_TEMP_OUTER = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_TEMP_OUTER", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_TEMP_OUTER parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilTempOuter = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变绕组温度点位 WINDING_TEMPERATURE = 16366
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "WINDING_TEMPERATURE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: WINDING_TEMPERATURE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiWindingTemp = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//# 主变油温点位 OIL_TEMPERATURE = 16405
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_TEMPERATURE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_TEMPERATURE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilTemperature = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变顶层油温点位 OIL_TOP_TEMPERATURE = 16405
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_TOP_TEMPERATURE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_TOP_TEMPERATURE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilTopTemp = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变油位点位 OIL_POSITION = 16406
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_POSITION", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_POSITION parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilPosition = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
//# 主变油枕油位点位 OIL_OILPILLOW_OILLEVEL = 16406
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "OIL_OILPILLOW_OILLEVEL", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: OIL_OILPILLOW_OILLEVEL parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstByqCode[i].uiOilPillowLevel = atoi(szTmp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取断路器配置各项参数
|
|
|
|
|
for (i = 0; i < (int)g_iec_conf.iec_break_count; i++)
|
|
|
|
|
{
|
|
|
|
|
ST_BREAK_EQM_CODE stGisState;
|
|
|
|
|
|
|
|
|
|
memset(&stGisState, 0x00, sizeof(ST_BREAK_EQM_CODE));
|
|
|
|
|
|
|
|
|
|
snprintf(szSection, sizeof(szSection), "IEC_BREAK_CODE_%02d", i + 1);
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "EQM_CODE_A", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: EQM_CODE_A parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
strcpy((char*)g_iec_conf.pstBrkCode[i].szEqmCodeA, szTmp);
|
|
|
|
|
strcpy((char*)stGisState.szEqmCodeA, szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "EQM_CODE_B", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: EQM_CODE_B parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
strcpy((char*)g_iec_conf.pstBrkCode[i].szEqmCodeB, szTmp);
|
|
|
|
|
strcpy((char*)stGisState.szEqmCodeB, szTmp);
|
|
|
|
|
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "EQM_CODE_C", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: EQM_CODE_C parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
strcpy((char*)g_iec_conf.pstBrkCode[i].szEqmCodeC, szTmp);
|
|
|
|
|
strcpy((char*)stGisState.szEqmCodeC, szTmp);
|
|
|
|
|
|
|
|
|
|
// 断开状态点位,开关的遥信点位
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "STATE_SIGNAL", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: STATE_SIGNAL parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstBrkCode[i].uiStateSadr = atoi(szTmp);
|
|
|
|
|
stGisState.uiStateSadr = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
// 断开电压点位
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "ABORT_VOLTAGE", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: ABORT_VOLTAGE parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstBrkCode[i].uiAbortVoltage = atoi(szTmp);
|
|
|
|
|
stGisState.uiAbortVoltage = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
// 断开电流点位
|
|
|
|
|
memset(szTmp, 0x00, sizeof(szTmp));
|
|
|
|
|
if ((iRet = iGetString(szSection, "ABORT_CURRENT", szTmp, sizeof(szTmp))) < 0) {
|
|
|
|
|
vPrtLogMsg(LOG_ERROR, iRet, "get %s: ABORT_CURRENT parameter failed", szSection);
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
g_iec_conf.pstBrkCode[i].uiAbortCurrent = atoi(szTmp);
|
|
|
|
|
stGisState.uiAbortCurrent = atoi(szTmp);
|
|
|
|
|
|
|
|
|
|
mutex_lock(g_map_gis_state_mutex); // 断路器遥信状态下,对应其电流电压点位
|
|
|
|
|
g_map_gis_state.insert(map<unsigned int, ST_BREAK_EQM_CODE>::value_type(stGisState.uiStateSadr, stGisState));
|
|
|
|
|
mutex_unlock(g_map_gis_state_mutex);
|
|
|
|
|
}
|
|
|
|
|
fclose(fpIec);
|
|
|
|
|
|
|
|
|
|
// 根据配置,建立点表地址匹配关系map
|
|
|
|
|
for (i = 0; i < (int)g_iec_conf.iec_byq_count; i++)
|
|
|
|
|
{
|
|
|
|
|
// 主变高压侧电流电压匹配关系
|
|
|
|
|
ST_SADR_MATCH stAdr;
|
|
|
|
|
memset(&stAdr, 0x00, sizeof(ST_SADR_MATCH));
|
|
|
|
|
stAdr.eqm_type = 1;
|
|
|
|
|
stAdr.count = 2;
|
|
|
|
|
stAdr.psadr = (ST_MATCH_LIST*)calloc(stAdr.count, sizeof(ST_MATCH_LIST));
|
|
|
|
|
stAdr.psadr[0].group = 1; // 高压侧电流、电压组
|
|
|
|
|
stAdr.psadr[0].btype = 1; // 高压侧电流
|
|
|
|
|
stAdr.psadr[0].sadr = g_iec_conf.pstByqCode[i].uiHighCurrent;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[1].group = 1; // 高压侧电流、电压组
|
|
|
|
|
stAdr.psadr[1].btype = 2; // 高压侧电压
|
|
|
|
|
stAdr.psadr[1].sadr = g_iec_conf.pstByqCode[i].uiHighVoltage;
|
|
|
|
|
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiHighVoltage, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiHighCurrent, &stAdr);
|
|
|
|
|
if (stAdr.psadr) free(stAdr.psadr);
|
|
|
|
|
stAdr.psadr = NULL;
|
|
|
|
|
|
|
|
|
|
// 主变低压侧电流电压匹配关系
|
|
|
|
|
stAdr.psadr = (ST_MATCH_LIST*)calloc(stAdr.count, sizeof(ST_MATCH_LIST));
|
|
|
|
|
stAdr.psadr[0].group = 2; // 低压侧电流、电压组
|
|
|
|
|
stAdr.psadr[0].btype = 1; //低压侧电流
|
|
|
|
|
stAdr.psadr[0].sadr = g_iec_conf.pstByqCode[i].uiLowCurrent;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[1].group = 2; // 低压侧电流、电压组
|
|
|
|
|
stAdr.psadr[1].btype = 2; //低压侧电压
|
|
|
|
|
stAdr.psadr[1].sadr = g_iec_conf.pstByqCode[i].uiLowVoltage;
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiLowVoltage, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiLowCurrent, &stAdr);
|
|
|
|
|
if (stAdr.psadr) free(stAdr.psadr);
|
|
|
|
|
stAdr.psadr = NULL;
|
|
|
|
|
|
|
|
|
|
// 运行工况
|
|
|
|
|
stAdr.eqm_type = 1;
|
|
|
|
|
stAdr.count = 13;
|
|
|
|
|
stAdr.psadr = (ST_MATCH_LIST*)calloc(stAdr.count, sizeof(ST_MATCH_LIST));
|
|
|
|
|
stAdr.psadr[0].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[0].btype = 1; // 进口水压力
|
|
|
|
|
stAdr.psadr[0].sadr = g_iec_conf.pstByqCode[i].uiCoolWaterPressEntry;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[1].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[1].btype = 2; // 出口水压力
|
|
|
|
|
stAdr.psadr[1].sadr = g_iec_conf.pstByqCode[i].uiCoolWaterPressOuter;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[2].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[2].btype = 3; // 主变本体油位数
|
|
|
|
|
stAdr.psadr[2].sadr = g_iec_conf.pstByqCode[i].uiOilPosition;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[3].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[3].btype = 4; // 主变本体油温数
|
|
|
|
|
stAdr.psadr[3].sadr = g_iec_conf.pstByqCode[i].uiOilTemperature;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[4].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[4].btype = 5; // 进口水温度
|
|
|
|
|
stAdr.psadr[4].sadr = g_iec_conf.pstByqCode[i].uiCoolWaterTempEntry;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[5].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[5].btype = 6; // 出口水温度
|
|
|
|
|
stAdr.psadr[5].sadr = g_iec_conf.pstByqCode[i].uiCoolWaterTempOuter;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[6].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[6].btype = 7; // 进口油压力
|
|
|
|
|
stAdr.psadr[6].sadr = g_iec_conf.pstByqCode[i].uiOilPressEntry;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[7].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[7].btype = 8; // 出口油压力
|
|
|
|
|
stAdr.psadr[7].sadr = g_iec_conf.pstByqCode[i].uiOilPressOuter;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[8].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[8].btype = 9; // 进口油温度
|
|
|
|
|
stAdr.psadr[8].sadr = g_iec_conf.pstByqCode[i].uiOilTempEntry;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[9].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[9].btype = 10; // 出口油温度
|
|
|
|
|
stAdr.psadr[9].sadr = g_iec_conf.pstByqCode[i].uiOilTempOuter;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[10].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[10].btype = 11; // 油枕油位
|
|
|
|
|
stAdr.psadr[10].sadr = g_iec_conf.pstByqCode[i].uiOilPillowLevel;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[11].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[11].btype = 12; // 顶层油温度
|
|
|
|
|
stAdr.psadr[11].sadr = g_iec_conf.pstByqCode[i].uiOilTopTemp;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[12].group = 3; // 运行工况组
|
|
|
|
|
stAdr.psadr[12].btype = 13; // 绕组温度
|
|
|
|
|
stAdr.psadr[12].sadr = g_iec_conf.pstByqCode[i].uiWindingTemp;
|
|
|
|
|
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiCoolWaterPressEntry, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiCoolWaterPressOuter, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilPosition, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilTemperature, &stAdr);
|
|
|
|
|
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiCoolWaterTempEntry, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiCoolWaterTempOuter, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilPressEntry, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilPressOuter, &stAdr);
|
|
|
|
|
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilTempEntry, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilTempOuter, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilPillowLevel, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiOilTopTemp, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstByqCode[i].uiWindingTemp, &stAdr);
|
|
|
|
|
if (stAdr.psadr) free(stAdr.psadr);
|
|
|
|
|
stAdr.psadr = NULL;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < (int)g_iec_conf.iec_break_count; i++)
|
|
|
|
|
{
|
|
|
|
|
ST_SADR_MATCH stAdr;
|
|
|
|
|
memset(&stAdr, 0x00, sizeof(ST_SADR_MATCH));
|
|
|
|
|
stAdr.eqm_type = 2;
|
|
|
|
|
stAdr.count = 2;
|
|
|
|
|
stAdr.psadr = (ST_MATCH_LIST*)calloc(stAdr.count, sizeof(ST_MATCH_LIST));
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[0].group = 4;
|
|
|
|
|
stAdr.psadr[0].btype = 1; // 断开电流
|
|
|
|
|
stAdr.psadr[0].sadr = g_iec_conf.pstBrkCode[i].uiAbortCurrent;
|
|
|
|
|
|
|
|
|
|
stAdr.psadr[1].group = 4;
|
|
|
|
|
stAdr.psadr[1].btype = 2; // 断开电压
|
|
|
|
|
stAdr.psadr[1].sadr = g_iec_conf.pstBrkCode[i].uiAbortVoltage;
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstBrkCode[i].uiAbortVoltage, &stAdr);
|
|
|
|
|
setSadrMatchRelations(g_iec_conf.pstBrkCode[i].uiAbortCurrent, &stAdr);
|
|
|
|
|
if (stAdr.psadr) free(stAdr.psadr);
|
|
|
|
|
stAdr.psadr = NULL;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 打印IEC104配置参数
|
|
|
|
|
static void showIEC104Conf()
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
vPrtLogMsg(LOG_DEBUG, RET_OK, "---> IEC104_CONF: iec_byq_count = %d, iec_break_count = %d", g_iec_conf.iec_byq_count, g_iec_conf.iec_break_count);
|
|
|
|
|
vPrtLogMsg(L
|