[ref]同步711
This commit is contained in:
parent
28236be4eb
commit
4d85df836b
117
product/src/fes/fes/DebugMbCommunicator.cpp
Normal file
117
product/src/fes/fes/DebugMbCommunicator.cpp
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#include "DebugMbCommunicator.h"
|
||||||
|
#include "czmq.h"
|
||||||
|
#include "common/Common.h"
|
||||||
|
#include "pub_logger_api/logger.h"
|
||||||
|
#include "pub_utility_api/CharUtil.h"
|
||||||
|
|
||||||
|
#define ZMQ_FES_CLIENT_IDENTITY "fes"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace iot_public;
|
||||||
|
|
||||||
|
class CDebugMbCommunicatorInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CDebugMbCommunicatorInfo() {
|
||||||
|
m_pServer = NULL;
|
||||||
|
m_pPoller = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
zsock_t *m_pServer;
|
||||||
|
zpoller_t *m_pPoller;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CDebugMbCommunicator::CDebugMbCommunicator()
|
||||||
|
{
|
||||||
|
m_pCommInfo = new CDebugMbCommunicatorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
CDebugMbCommunicator::~CDebugMbCommunicator()
|
||||||
|
{
|
||||||
|
if(m_pCommInfo != NULL)
|
||||||
|
{
|
||||||
|
closeServer();
|
||||||
|
delete m_pCommInfo;
|
||||||
|
m_pCommInfo = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDebugMbCommunicator::init(const int &nPort)
|
||||||
|
{
|
||||||
|
if(iotSuccess != initServer(nPort))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDebugMbCommunicator::recvMsg(std::string &strMsg, const int &nTimeoutMs)
|
||||||
|
{
|
||||||
|
zsock_t *pReader = (zsock_t *)zpoller_wait(m_pCommInfo->m_pPoller,nTimeoutMs);
|
||||||
|
if(pReader == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
zmsg_t *msg = zmsg_recv (m_pCommInfo->m_pServer);
|
||||||
|
zframe_t *last = zmsg_last(msg);
|
||||||
|
strMsg.append((char*)zframe_data(last),zframe_size(last));
|
||||||
|
zmsg_destroy(&msg);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CDebugMbCommunicator::sendMsg(const string &strMsg)
|
||||||
|
{
|
||||||
|
zmsg_t *sendMsg = zmsg_new ();
|
||||||
|
zmsg_addstr(sendMsg,ZMQ_FES_CLIENT_IDENTITY);
|
||||||
|
zmsg_addmem(sendMsg,(void*)strMsg.data(),strMsg.size());
|
||||||
|
int nRet = zmsg_send(&sendMsg,m_pCommInfo->m_pServer);
|
||||||
|
zmsg_destroy(&sendMsg);
|
||||||
|
|
||||||
|
return (nRet >=0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CDebugMbCommunicator::initServer(const int &nPort)
|
||||||
|
{
|
||||||
|
m_pCommInfo->m_pServer = zsock_new(ZMQ_ROUTER);
|
||||||
|
if(m_pCommInfo->m_pServer == NULL)
|
||||||
|
{
|
||||||
|
LOGERROR("CFesSimServerThread: 创建ROUTER失败");
|
||||||
|
return iotFailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strEndpoints = "tcp://*:" + IntToString(nPort);
|
||||||
|
int nRet = zsock_bind(m_pCommInfo->m_pServer,strEndpoints.c_str());
|
||||||
|
if(nRet < 0)
|
||||||
|
{
|
||||||
|
LOGERROR("CFesSimServerThread: bind failed. endpoints=%s",strEndpoints.c_str());
|
||||||
|
closeServer();
|
||||||
|
return iotFailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pCommInfo->m_pPoller = zpoller_new (m_pCommInfo->m_pServer, NULL);
|
||||||
|
zpoller_set_nonstop (m_pCommInfo->m_pPoller, true);
|
||||||
|
|
||||||
|
LOGINFO("CFesSimServerThread: 绑定成功. endpoints=%s",strEndpoints.c_str());
|
||||||
|
return iotSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CDebugMbCommunicator::closeServer()
|
||||||
|
{
|
||||||
|
if(m_pCommInfo->m_pPoller != NULL)
|
||||||
|
{
|
||||||
|
zpoller_destroy(&m_pCommInfo->m_pPoller);
|
||||||
|
m_pCommInfo->m_pPoller = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_pCommInfo->m_pServer != NULL)
|
||||||
|
{
|
||||||
|
zsock_destroy(&m_pCommInfo->m_pServer);
|
||||||
|
m_pCommInfo->m_pServer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return iotSuccess;
|
||||||
|
}
|
||||||
26
product/src/fes/fes/DebugMbCommunicator.h
Normal file
26
product/src/fes/fes/DebugMbCommunicator.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef DEBUGMBCOMMUNICATOR_H
|
||||||
|
#define DEBUGMBCOMMUNICATOR_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class CDebugMbCommunicatorInfo;
|
||||||
|
|
||||||
|
class CDebugMbCommunicator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CDebugMbCommunicator();
|
||||||
|
virtual ~CDebugMbCommunicator();
|
||||||
|
|
||||||
|
bool init(const int &nPort);
|
||||||
|
bool recvMsg(std::string &strMsg,const int &nTimeoutMs);
|
||||||
|
bool sendMsg(const std::string &strMsg);
|
||||||
|
int closeServer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int initServer(const int &nPort);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CDebugMbCommunicatorInfo *m_pCommInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DEBUGMBCOMMUNICATOR_H
|
||||||
3595
product/src/fes/fes/DebugThread.cpp
Normal file
3595
product/src/fes/fes/DebugThread.cpp
Normal file
File diff suppressed because it is too large
Load Diff
175
product/src/fes/fes/DebugThread.h
Normal file
175
product/src/fes/fes/DebugThread.h
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
#ifndef DEBUGTHREAD_H
|
||||||
|
#define DEBUGTHREAD_H
|
||||||
|
|
||||||
|
#include "pub_utility_api/TimerThreadBase.h"
|
||||||
|
#include "DebugMbCommunicator.h"
|
||||||
|
#include "FesDebugTool.pb.h"
|
||||||
|
#include "FesBase.h"
|
||||||
|
|
||||||
|
class CDebugThread : public iot_public::CTimerThreadBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CDebugThread(CFesBase *pFesBase);
|
||||||
|
virtual ~CDebugThread();
|
||||||
|
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
int init(const int &nPort);
|
||||||
|
|
||||||
|
private:
|
||||||
|
//客户端断开后停止刷新数据
|
||||||
|
void stopRefreshMonData();
|
||||||
|
|
||||||
|
void handleMessage();
|
||||||
|
|
||||||
|
void onRecvHeartbeatReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvConnectReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvDisconnectReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvChanParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvRtuParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvRtuInfoReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvAiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvAiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvDiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvDiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvAccParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvAccValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvMiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvMiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//模拟量仿真
|
||||||
|
void onRecvSimAiStartSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSimAiStopSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//数字量仿真
|
||||||
|
void onRecvSimDiStartSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSimDiStopSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//混合量仿真
|
||||||
|
void onRecvSimMiStartSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSimMiStopSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//累积量仿真
|
||||||
|
void onRecvSimAccStartSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSimAccStopSimReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//事件仿真
|
||||||
|
void onRecvSimEventCreateReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//控制仿真
|
||||||
|
void onRecvSimAoControlReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSimDoControlReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSimMoControlReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//数据转发
|
||||||
|
void onRecvFwRtuInfoReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvFwAiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvFwAiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvFwDiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvFwDiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvFwDDiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvFwDDiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvFwMiParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvFwMiValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
void onRecvFwAccParamReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvFwAccValueReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//事件监视
|
||||||
|
void onRecvSoeEventReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvChanEventReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvSoeMemEventReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
|
||||||
|
//通道监视
|
||||||
|
void onRecvChanMonStartReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvChanMonStopReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void onRecvChanMonClearReq(const iot_idl::FesDebugToolReqMsg &objRecvMsg);
|
||||||
|
void reportChanMonInfo();
|
||||||
|
std::string* buildChanMonInfo(SFesSimServerChanMonBuf &chanBuf);
|
||||||
|
|
||||||
|
void simulate();
|
||||||
|
void periodSimulate();
|
||||||
|
|
||||||
|
//单次模拟
|
||||||
|
void oneTimeSimulate();
|
||||||
|
void oneTimeSimulateAi();
|
||||||
|
void oneTimeSimulateDi();
|
||||||
|
void oneTimeSimulateMi();
|
||||||
|
void oneTimeSimulateAcc();
|
||||||
|
//周期性模拟
|
||||||
|
void periodSimulateAi();
|
||||||
|
void periodSimulateDi();
|
||||||
|
void periodSimulateMi();
|
||||||
|
void periodSimulateAcc();
|
||||||
|
|
||||||
|
float getAiSimValue(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateSingleAi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateRtuAi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateAllAi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
|
||||||
|
int getDiSimValue(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateSingleDi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateRtuDi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateAllDi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
|
||||||
|
int getMiSimValue(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateSingleMi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateRtuMi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateAllMi(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
|
||||||
|
double getAccSimValue(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateSingleAcc(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateRtuAcc(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
void simulateAllAcc(const iot_idl::FesDebugToolValueSimSetReqMsg &simParam);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CDebugMbCommunicator m_objMbComm;
|
||||||
|
CFesBase* m_pFesBase;
|
||||||
|
|
||||||
|
int64 m_lLastSimScanTime; //上一次执行仿真的时间,单位毫秒
|
||||||
|
boost::mutex m_mutexSimParam; //保护仿真参数
|
||||||
|
|
||||||
|
//模拟量仿真相关参数
|
||||||
|
bool m_bAiSimRunning; //模拟量正在仿真标识
|
||||||
|
float m_fLastAiSimValue; //上一次仿真值,用于线性仿真中
|
||||||
|
float m_fAiSimStepValue; //步进值
|
||||||
|
int64 m_lAiLastSimTime; //最后一次仿真数据变化的时间,单位毫秒
|
||||||
|
iot_idl::FesDebugToolValueSimSetReqMsg m_stAiSimParam; //模拟量仿真参数
|
||||||
|
|
||||||
|
//数字量仿真相关参数
|
||||||
|
bool m_bDiSimRunning; //数字量正在仿真标识
|
||||||
|
int m_nLastDiSimValue; //上一次仿真值,用于线性仿真中
|
||||||
|
// int m_nDiSimStepValue; //步进值
|
||||||
|
int64 m_lDiLastSimTime; //最后一次仿真数据变化的时间,单位毫秒
|
||||||
|
iot_idl::FesDebugToolValueSimSetReqMsg m_stDiSimParam; //数字量仿真参数
|
||||||
|
|
||||||
|
//混合量仿真相关参数
|
||||||
|
bool m_bMiSimRunning; //混合量正在仿真标识
|
||||||
|
int m_nLastMiSimValue; //上一次仿真值,用于线性仿真中
|
||||||
|
int m_nMiSimStepValue; //步进值
|
||||||
|
int64 m_lMiLastSimTime; //最后一次仿真数据变化的时间,单位毫秒
|
||||||
|
iot_idl::FesDebugToolValueSimSetReqMsg m_stMiSimParam; //混合量仿真参数
|
||||||
|
|
||||||
|
//累计量仿真相关参数
|
||||||
|
bool m_bAccSimRunning; //累计量正在仿真标识
|
||||||
|
double m_dLastAccSimValue; //上一次仿真值,用于线性仿真中
|
||||||
|
double m_dAccSimStepValue; //步进值
|
||||||
|
int64 m_lAccLastSimTime; //最后一次仿真数据变化的时间,单位毫秒
|
||||||
|
iot_idl::FesDebugToolValueSimSetReqMsg m_stAccSimParam; //累计量仿真参数
|
||||||
|
|
||||||
|
//通道监视
|
||||||
|
int m_nCurMonChanNo; //当前监视的通道
|
||||||
|
int64 m_lLastHeartbeatTime; //最后一次心跳包时间
|
||||||
|
bool m_bHasClient; //当前是否有客户端在连接
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<CDebugThread> CDebugThreadPtr;
|
||||||
|
|
||||||
|
#endif // DEBUGTHREAD_H
|
||||||
@ -9,7 +9,6 @@
|
|||||||
2020-12-30 thxiao StopThread() 在调用m_ptrFesChanManageThread->quit()前,以最快速度通知规约退出
|
2020-12-30 thxiao StopThread() 在调用m_ptrFesChanManageThread->quit()前,以最快速度通知规约退出
|
||||||
2021-12-02 thxiao 加载DLL的文件名改为绝对路径
|
2021-12-02 thxiao 加载DLL的文件名改为绝对路径
|
||||||
2022-07-11 thxiao 修改实例的名字为"fes"
|
2022-07-11 thxiao 修改实例的名字为"fes"
|
||||||
2023-11-25 thxiao 转发数据处理改为分多个线程处理数据
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
//#include <dlfcn.h>
|
//#include <dlfcn.h>
|
||||||
@ -45,6 +44,7 @@ int g_FesChgAnaSendCyc=200; //变化数据发送周期
|
|||||||
int g_FesChgAccSendCyc=300; //变化数据发送周期
|
int g_FesChgAccSendCyc=300; //变化数据发送周期
|
||||||
int g_FesChgMixSendCyc=200; //变化数据发送周期
|
int g_FesChgMixSendCyc=200; //变化数据发送周期
|
||||||
int g_FesEventSendCyc =500; //变化数据发送周期
|
int g_FesEventSendCyc =500; //变化数据发送周期
|
||||||
|
const int CN_FES_DebugPort_Offset = 100; //当前为了2种调试端口并存,增加一个偏移量
|
||||||
|
|
||||||
CFesApp::CFesApp()
|
CFesApp::CFesApp()
|
||||||
{
|
{
|
||||||
@ -52,13 +52,7 @@ CFesApp::CFesApp()
|
|||||||
m_ptrProcManage = NULL;
|
m_ptrProcManage = NULL;
|
||||||
m_ptrReduSwitchManage = NULL;
|
m_ptrReduSwitchManage = NULL;
|
||||||
m_ptrRedundantMng = NULL;
|
m_ptrRedundantMng = NULL;
|
||||||
|
m_ptrFesSimServerThread = NULL;
|
||||||
m_ptrFesRxFesDataThread = NULL;
|
|
||||||
m_ptrFesRxDPDataThread = NULL;
|
|
||||||
m_ptrAnaWorkThread = NULL;
|
|
||||||
m_ptrDigWorkThread = NULL;
|
|
||||||
m_ptrAccWorkThread = NULL;
|
|
||||||
m_ptrMixWorkThread = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFesApp::~CFesApp()
|
CFesApp::~CFesApp()
|
||||||
@ -241,27 +235,14 @@ bool CFesApp::start(int argc, char *argv[], int &/*nStatus*/)
|
|||||||
Param.ptrFesFwTxControlCmdThread = m_ptrFesFwTxControlCmdThread;
|
Param.ptrFesFwTxControlCmdThread = m_ptrFesFwTxControlCmdThread;
|
||||||
|
|
||||||
if (m_CFesBase.FesRxFesDataThreadFlag)
|
if (m_CFesBase.FesRxFesDataThreadFlag)
|
||||||
{
|
|
||||||
Param.ptrFesRxFesDataThread = m_ptrFesRxFesDataThread;
|
Param.ptrFesRxFesDataThread = m_ptrFesRxFesDataThread;
|
||||||
Param.ptrAnaWorkThread = m_ptrAnaWorkThread;
|
|
||||||
Param.ptrDigWorkThread = m_ptrDigWorkThread;
|
|
||||||
Param.ptrAccWorkThread = m_ptrAccWorkThread;
|
|
||||||
Param.ptrMixWorkThread = m_ptrMixWorkThread;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Param.ptrFesRxFesDataThread = NULL;
|
Param.ptrFesRxFesDataThread = NULL;
|
||||||
Param.ptrAnaWorkThread = NULL;
|
|
||||||
Param.ptrDigWorkThread = NULL;
|
|
||||||
Param.ptrAccWorkThread = NULL;
|
|
||||||
Param.ptrMixWorkThread = NULL;
|
|
||||||
}
|
|
||||||
if (m_CFesBase.FesRxDPDataThreadFlag)
|
if (m_CFesBase.FesRxDPDataThreadFlag)
|
||||||
Param.ptrFesRxDPDataThread = m_ptrFesRxDPDataThread;
|
Param.ptrFesRxDPDataThread = m_ptrFesRxDPDataThread;
|
||||||
else
|
else
|
||||||
Param.ptrFesRxDPDataThread = NULL;
|
Param.ptrFesRxDPDataThread = NULL;
|
||||||
|
|
||||||
|
|
||||||
/******转发相关线程*************************************************/
|
/******转发相关线程*************************************************/
|
||||||
|
|
||||||
m_ptrReduSwitchManage->Init(Param);
|
m_ptrReduSwitchManage->Init(Param);
|
||||||
@ -421,12 +402,25 @@ bool CFesApp::InitThread()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 使用CDebugThread替代CFesSimServerThread,停止使用旧的调试类
|
||||||
m_ptrFesSimServerThread = boost::make_shared<CFesSimServerThread>(&m_CFesBase);
|
m_ptrFesSimServerThread = boost::make_shared<CFesSimServerThread>(&m_CFesBase);
|
||||||
if (m_ptrFesSimServerThread == NULL)
|
if (m_ptrFesSimServerThread == NULL)
|
||||||
{
|
{
|
||||||
LOGERROR("m_ptrFesSimServerThread 创建失败");
|
LOGERROR("m_ptrFesSimServerThread 创建失败");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
LOGINFO("FesSimServerThread AppName=%s AppId=%d NetPortNo=%d",m_strAppLabel.c_str(),m_ProcessInfo.nAppId,FesSimServerPortNo);
|
||||||
|
m_ptrFesSimServerThread->Init(FesSimServerPortNo,CN_FesServerMaxConnects);//Init Server net PortNo
|
||||||
|
*/
|
||||||
|
|
||||||
|
int FesSimServerPortNo = CN_FesSimServerBasePortNo+m_ProcessInfo.nAppId;
|
||||||
|
|
||||||
|
m_ptrDebugThread = boost::make_shared<CDebugThread>(&m_CFesBase);
|
||||||
|
if(m_ptrDebugThread == NULL)
|
||||||
|
{
|
||||||
|
LOGERROR("m_ptrDebugThread 创建失败");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_ptrFesFwRxControlCmdThread = boost::make_shared<CFesFwRxControlCmdThread>(m_ProcessInfo.nDomainId, m_ProcessInfo.nAppId,&m_CFesBase);
|
m_ptrFesFwRxControlCmdThread = boost::make_shared<CFesFwRxControlCmdThread>(m_ProcessInfo.nDomainId, m_ProcessInfo.nAppId,&m_CFesBase);
|
||||||
if (m_ptrFesFwRxControlCmdThread == NULL)
|
if (m_ptrFesFwRxControlCmdThread == NULL)
|
||||||
@ -442,85 +436,14 @@ bool CFesApp::InitThread()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_CFesBase.FesRxFesDataThreadFlag)
|
m_ptrFesRxFesDataThread = boost::make_shared<CFesRxFesDataThread>(m_ProcessInfo.nDomainId, m_ProcessInfo.nAppId,&m_CFesBase);
|
||||||
{
|
|
||||||
|
|
||||||
//创建数据接收缓冲;
|
|
||||||
//==============================================================================================
|
|
||||||
m_ptrPacketQueue = boost::make_shared<CPacketQueue>();
|
|
||||||
if (m_ptrPacketQueue == NULL)
|
|
||||||
{
|
|
||||||
LOGERROR("CPacketQueue::initialize(), make_shared<CPacketQueue> fail!\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ptrFesRxFesDataThread = boost::make_shared<CFesRxFesDataThread>(m_ProcessInfo.nDomainId, m_ProcessInfo.nAppId, &m_CFesBase, m_ptrPacketQueue);
|
|
||||||
if (m_ptrFesRxFesDataThread == NULL)
|
if (m_ptrFesRxFesDataThread == NULL)
|
||||||
{
|
{
|
||||||
LOGERROR("m_ptrFesRxFesDataThread 创建失败");
|
LOGERROR("m_ptrFesRxFesDataThread 创建失败");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化模拟量数据处理线程
|
m_ptrFesRxDPDataThread = boost::make_shared<CFesRxDPDataThread>(m_ProcessInfo.nDomainId, m_ProcessInfo.nAppId,&m_CFesBase);
|
||||||
//==============================================================================================
|
|
||||||
m_ptrAnaWorkThread = boost::make_shared<CAnaWorkThread>(&m_CFesBase, m_ptrPacketQueue);
|
|
||||||
if (m_ptrAnaWorkThread == NULL)
|
|
||||||
{
|
|
||||||
LOGERROR("m_ptrAnaWorkThread,创建模拟量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (false == m_ptrAnaWorkThread->initialize())
|
|
||||||
{
|
|
||||||
LOGERROR("初始化模拟量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化数字量数据处理线程
|
|
||||||
//==============================================================================================
|
|
||||||
m_ptrDigWorkThread = boost::make_shared<CDigWorkThread>(&m_CFesBase, m_ptrPacketQueue);
|
|
||||||
if (m_ptrDigWorkThread == NULL)
|
|
||||||
{
|
|
||||||
LOGERROR("m_ptrDigWorkThread,创建数字量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (false == m_ptrDigWorkThread->initialize())
|
|
||||||
{
|
|
||||||
LOGERROR("初始化数字量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化累计量数据处理线程
|
|
||||||
//==============================================================================================
|
|
||||||
m_ptrAccWorkThread = boost::make_shared<CAccWorkThread>(&m_CFesBase, m_ptrPacketQueue);
|
|
||||||
if (m_ptrAccWorkThread == NULL)
|
|
||||||
{
|
|
||||||
LOGERROR("m_ptrAnaWorkThread,创建累计量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (false == m_ptrAccWorkThread->initialize())
|
|
||||||
{
|
|
||||||
LOGERROR("初始化累计量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化混合量数据处理线程
|
|
||||||
//==============================================================================================
|
|
||||||
m_ptrMixWorkThread = boost::make_shared<CMixWorkThread>(&m_CFesBase, m_ptrPacketQueue);
|
|
||||||
if (m_ptrMixWorkThread == NULL)
|
|
||||||
{
|
|
||||||
LOGERROR("m_ptrMixWorkThread,创建混合量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (false == m_ptrMixWorkThread->initialize())
|
|
||||||
{
|
|
||||||
LOGERROR("初始化混合量工作线程失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_CFesBase.FesRxDPDataThreadFlag)
|
|
||||||
{
|
|
||||||
m_ptrFesRxDPDataThread = boost::make_shared<CFesRxDPDataThread>(m_ProcessInfo.nDomainId, m_ProcessInfo.nAppId, &m_CFesBase);
|
|
||||||
if (m_ptrFesRxDPDataThread == NULL)
|
if (m_ptrFesRxDPDataThread == NULL)
|
||||||
{
|
{
|
||||||
LOGERROR("m_ptrFesRxDPDataThread 创建失败");
|
LOGERROR("m_ptrFesRxDPDataThread 创建失败");
|
||||||
@ -531,12 +454,12 @@ bool CFesApp::InitThread()
|
|||||||
LOGERROR("m_ptrFesRxDPDataThread ::initialize() fail!\n");
|
LOGERROR("m_ptrFesRxDPDataThread ::initialize() fail!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int FesSimServerPortNo = CN_FesSimServerBasePortNo+m_ProcessInfo.nAppId;
|
if(m_ptrDebugThread->init(FesSimServerPortNo + CN_FES_DebugPort_Offset) != iotSuccess)
|
||||||
LOGINFO("FesSimServerThread AppName=%s AppId=%d NetPortNo=%d",m_strAppLabel.c_str(),m_ProcessInfo.nAppId,FesSimServerPortNo);
|
{
|
||||||
m_ptrFesSimServerThread->Init(FesSimServerPortNo,CN_FesServerMaxConnects);//Init Server net PortNo
|
LOGERROR("m_ptrDebugThread initialize fail");
|
||||||
// m_ptrFesSimServerThread->resume();
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LOGINFO("InitThread() 创建成功!");
|
LOGINFO("InitThread() 创建成功!");
|
||||||
|
|
||||||
@ -608,6 +531,13 @@ void CFesApp::StopThread()
|
|||||||
LOGDEBUG("CFesApp::StopThread m_ptrFesSimServerThread stop ok");
|
LOGDEBUG("CFesApp::StopThread m_ptrFesSimServerThread stop ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(m_ptrDebugThread != NULL)
|
||||||
|
{
|
||||||
|
m_ptrDebugThread->quit();
|
||||||
|
m_ptrDebugThread.reset();
|
||||||
|
LOGDEBUG("CFesApp::StopThread m_ptrDebugThread stop ok");
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ptrFesFwRxControlCmdThread != NULL)
|
if (m_ptrFesFwRxControlCmdThread != NULL)
|
||||||
{
|
{
|
||||||
m_ptrFesFwRxControlCmdThread->quit();
|
m_ptrFesFwRxControlCmdThread->quit();
|
||||||
@ -644,31 +574,6 @@ void CFesApp::StopThread()
|
|||||||
m_ptrAlmApiForApp = NULL;
|
m_ptrAlmApiForApp = NULL;
|
||||||
LOGINFO("CFesApp::StopThread():释放报警处理工作线程成功! \n");
|
LOGINFO("CFesApp::StopThread():释放报警处理工作线程成功! \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ptrAnaWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrAnaWorkThread->quit();
|
|
||||||
m_ptrAnaWorkThread.reset();
|
|
||||||
LOGDEBUG("CFesApp::StopThread m_ptrAnaWorkThread stop ok");
|
|
||||||
}
|
|
||||||
if (m_ptrDigWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrDigWorkThread->quit();
|
|
||||||
m_ptrDigWorkThread.reset();
|
|
||||||
LOGDEBUG("CFesApp::StopThread m_ptrDigWorkThread stop ok");
|
|
||||||
}
|
|
||||||
if (m_ptrAccWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrAccWorkThread->quit();
|
|
||||||
m_ptrAccWorkThread.reset();
|
|
||||||
LOGDEBUG("CFesApp::StopThread m_ptrAccWorkThread stop ok");
|
|
||||||
}
|
|
||||||
if (m_ptrMixWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrMixWorkThread->quit();
|
|
||||||
m_ptrMixWorkThread.reset();
|
|
||||||
LOGDEBUG("CFesApp::StopThread m_ptrMixWorkThread stop ok");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,19 +14,13 @@
|
|||||||
#include "FesDataSyncThread.h"
|
#include "FesDataSyncThread.h"
|
||||||
#include "FesChanManageThread.h"
|
#include "FesChanManageThread.h"
|
||||||
#include "FesRedundantManage.h"
|
#include "FesRedundantManage.h"
|
||||||
|
#include "DebugThread.h"
|
||||||
#include "FesSimServerThread.h"
|
#include "FesSimServerThread.h"
|
||||||
#include "FesWaveFormThread.h"
|
#include "FesWaveFormThread.h"
|
||||||
#include "FesFwRxControlCmdThread.h"
|
#include "FesFwRxControlCmdThread.h"
|
||||||
#include "FesFwTxControlCmdThread.h"
|
#include "FesFwTxControlCmdThread.h"
|
||||||
#include "FesRxFesDataThread.h"
|
#include "FesRxFesDataThread.h"
|
||||||
#include "FesRxDPDataThread.h"
|
#include "FesRxDPDataThread.h"
|
||||||
#include "PacketQueue.h"
|
|
||||||
#include "AnaWorkThread.h"
|
|
||||||
#include "DigWorkThread.h"
|
|
||||||
#include "AccWorkThread.h"
|
|
||||||
#include "MixWorkThread.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CFesApp:public iot_public::CBaseService,iot_sys::CProcessQuitInterface
|
class CFesApp:public iot_public::CBaseService,iot_sys::CProcessQuitInterface
|
||||||
{
|
{
|
||||||
@ -35,7 +29,6 @@ public:
|
|||||||
~CFesApp();
|
~CFesApp();
|
||||||
|
|
||||||
CFesBase m_CFesBase;
|
CFesBase m_CFesBase;
|
||||||
CPacketQueuePtr m_ptrPacketQueue; //消息缓存类
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@brief 解析命令行参数 CMsgQueueBuffer;
|
@brief 解析命令行参数 CMsgQueueBuffer;
|
||||||
@ -85,16 +78,12 @@ private:
|
|||||||
CFesDataSyncThreadPtr m_PtrFesDataSyncThread;
|
CFesDataSyncThreadPtr m_PtrFesDataSyncThread;
|
||||||
CFesChanManageThreadPtr m_ptrFesChanManageThread;
|
CFesChanManageThreadPtr m_ptrFesChanManageThread;
|
||||||
CFesSimServerThreadPtr m_ptrFesSimServerThread;
|
CFesSimServerThreadPtr m_ptrFesSimServerThread;
|
||||||
|
CDebugThreadPtr m_ptrDebugThread;
|
||||||
CFesWaveFormThreadPtr m_ptrFesWaveFormThread;
|
CFesWaveFormThreadPtr m_ptrFesWaveFormThread;
|
||||||
CFesFwRxControlCmdThreadPtr m_ptrFesFwRxControlCmdThread;
|
CFesFwRxControlCmdThreadPtr m_ptrFesFwRxControlCmdThread;
|
||||||
CFesFwTxControlCmdThreadPtr m_ptrFesFwTxControlCmdThread;
|
CFesFwTxControlCmdThreadPtr m_ptrFesFwTxControlCmdThread;
|
||||||
CFesRxFesDataThreadPtr m_ptrFesRxFesDataThread;
|
CFesRxFesDataThreadPtr m_ptrFesRxFesDataThread;
|
||||||
CFesRxDPDataThreadPtr m_ptrFesRxDPDataThread;
|
CFesRxDPDataThreadPtr m_ptrFesRxDPDataThread;
|
||||||
CAnaWorkThreadPtr m_ptrAnaWorkThread;
|
|
||||||
CDigWorkThreadPtr m_ptrDigWorkThread;
|
|
||||||
CAccWorkThreadPtr m_ptrAccWorkThread;
|
|
||||||
CMixWorkThreadPtr m_ptrMixWorkThread;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CFesApp::InitThread
|
* @brief CFesApp::InitThread
|
||||||
|
|||||||
@ -236,7 +236,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
LOGERROR("CFesBase::InitBaseData, RdbLocationTable.selectNoCondition error!");
|
LOGERROR("CFesBase::InitBaseData, RdbLocationTable.selectNoCondition error!");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
m_LocationNum = VecLocationParam.size();
|
m_LocationNum = static_cast<int>(VecLocationParam.size());
|
||||||
if(m_LocationNum>0)
|
if(m_LocationNum>0)
|
||||||
{
|
{
|
||||||
for(i=0;i<m_LocationNum;i++)
|
for(i=0;i<m_LocationNum;i++)
|
||||||
@ -274,6 +274,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecColumn.push_back("res_para_int2");
|
vecColumn.push_back("res_para_int2");
|
||||||
vecColumn.push_back("res_para_int3");
|
vecColumn.push_back("res_para_int3");
|
||||||
vecColumn.push_back("res_para_str1");
|
vecColumn.push_back("res_para_str1");
|
||||||
|
vecColumn.push_back("res_para_str2"); //< 字符串类型预留参数
|
||||||
vecColumn.push_back("is_used_lb");
|
vecColumn.push_back("is_used_lb");
|
||||||
vecColumn.push_back("controldisable");
|
vecColumn.push_back("controldisable");
|
||||||
vecColumn.push_back("cleardataenable");
|
vecColumn.push_back("cleardataenable");
|
||||||
@ -284,7 +285,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
LOGERROR("CFesBase::InitBaseData, RdbRtuTable.selectNoCondition error!");
|
LOGERROR("CFesBase::InitBaseData, RdbRtuTable.selectNoCondition error!");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
m_RtuNum = VecRtuParam.size();
|
m_RtuNum = static_cast<int>(VecRtuParam.size());
|
||||||
if(m_RtuNum>0)
|
if(m_RtuNum>0)
|
||||||
{
|
{
|
||||||
for(i=0;i<m_RtuNum;i++)
|
for(i=0;i<m_RtuNum;i++)
|
||||||
@ -310,6 +311,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
RtuPtr->m_Param.ResParam2 = VecRtuParam[i].ResParam2;
|
RtuPtr->m_Param.ResParam2 = VecRtuParam[i].ResParam2;
|
||||||
RtuPtr->m_Param.ResParam3 = VecRtuParam[i].ResParam3;
|
RtuPtr->m_Param.ResParam3 = VecRtuParam[i].ResParam3;
|
||||||
memcpy(RtuPtr->m_Param.DevType,VecRtuParam[i].DevType,CN_FesMaxTagSize);
|
memcpy(RtuPtr->m_Param.DevType,VecRtuParam[i].DevType,CN_FesMaxTagSize);
|
||||||
|
memcpy(RtuPtr->m_Param.szResParam1,VecRtuParam[i].szResParam1,sizeof(RtuPtr->m_Param.szResParam1));
|
||||||
RtuPtr->m_Param.WaveEnable = VecRtuParam[i].WaveEnable;
|
RtuPtr->m_Param.WaveEnable = VecRtuParam[i].WaveEnable;
|
||||||
RtuPtr->m_Param.ControlDisable = VecRtuParam[i].ControlDisable;
|
RtuPtr->m_Param.ControlDisable = VecRtuParam[i].ControlDisable;
|
||||||
RtuPtr->m_Param.ClearDataEnable = VecRtuParam[i].ClearDataEnable;
|
RtuPtr->m_Param.ClearDataEnable = VecRtuParam[i].ClearDataEnable;
|
||||||
@ -333,6 +335,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecDevInfoColumn.push_back("dev_id");//DEVID
|
vecDevInfoColumn.push_back("dev_id");//DEVID
|
||||||
vecDevInfoColumn.push_back("dev_desc"); //DEV DESC
|
vecDevInfoColumn.push_back("dev_desc"); //DEV DESC
|
||||||
vecDevInfoColumn.push_back("tag_name"); //DEV tagname
|
vecDevInfoColumn.push_back("tag_name"); //DEV tagname
|
||||||
|
vecDevInfoColumn.push_back("para_str1"); //< 字符串类型预留参数
|
||||||
ret = RdbDevInfoTable.open(m_strAppLabel.c_str(), RT_FES_DEV_INFO_TBL);
|
ret = RdbDevInfoTable.open(m_strAppLabel.c_str(), RT_FES_DEV_INFO_TBL);
|
||||||
if (ret == false)
|
if (ret == false)
|
||||||
{
|
{
|
||||||
@ -348,7 +351,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
RtuPtr->m_DevInfo.RtuNo = RtuPtr->m_Param.RtuNo;
|
RtuPtr->m_DevInfo.RtuNo = RtuPtr->m_Param.RtuNo;
|
||||||
if (VecDevInfo.size() > 0)
|
if (VecDevInfo.size() > 0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_DevInfo.DevNum = VecDevInfo.size();
|
RtuPtr->m_DevInfo.DevNum = static_cast<int>(VecDevInfo.size());
|
||||||
RtuPtr->m_DevInfo.pDev = (SFesRtuDevParam*)malloc(RtuPtr->m_DevInfo.DevNum * sizeof(SFesRtuDevParam));
|
RtuPtr->m_DevInfo.pDev = (SFesRtuDevParam*)malloc(RtuPtr->m_DevInfo.DevNum * sizeof(SFesRtuDevParam));
|
||||||
if (RtuPtr->m_DevInfo.pDev == NULL)
|
if (RtuPtr->m_DevInfo.pDev == NULL)
|
||||||
{
|
{
|
||||||
@ -364,6 +367,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pDevParam->DevId = VecDevInfo[j].DevID;
|
pDevParam->DevId = VecDevInfo[j].DevID;
|
||||||
memcpy(pDevParam->TagName, VecDevInfo[j].TagName, CN_FesMaxTagSize);
|
memcpy(pDevParam->TagName, VecDevInfo[j].TagName, CN_FesMaxTagSize);
|
||||||
memcpy(pDevParam->DevDesc, VecDevInfo[j].DevDesc, CN_FesMaxNameSize);
|
memcpy(pDevParam->DevDesc, VecDevInfo[j].DevDesc, CN_FesMaxNameSize);
|
||||||
|
memcpy(pDevParam->szResParam1, VecDevInfo[j].szResParam1, sizeof(pDevParam->szResParam1));
|
||||||
//把描述中的“.”更换成“_”。
|
//把描述中的“.”更换成“_”。
|
||||||
char *pChar;
|
char *pChar;
|
||||||
pChar = strchr(pDevParam->DevDesc, '.');
|
pChar = strchr(pDevParam->DevDesc, '.');
|
||||||
@ -375,7 +379,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
|
|
||||||
//2020-01-05 把右边空格去掉
|
//2020-01-05 把右边空格去掉
|
||||||
//LOGDEBUG("1 pDevParam->DevDesc=%s!!!!!!", pDevParam->DevDesc);
|
//LOGDEBUG("1 pDevParam->DevDesc=%s!!!!!!", pDevParam->DevDesc);
|
||||||
int len = strlen(pDevParam->DevDesc);
|
int len = static_cast<int>(strlen(pDevParam->DevDesc));
|
||||||
char *p = pDevParam->DevDesc + len - 1;
|
char *p = pDevParam->DevDesc + len - 1;
|
||||||
while ((p >= pDevParam->DevDesc) && (*p == ' '))
|
while ((p >= pDevParam->DevDesc) && (*p == ' '))
|
||||||
{
|
{
|
||||||
@ -423,6 +427,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecAiColumn.push_back("res_para_int6");
|
vecAiColumn.push_back("res_para_int6");
|
||||||
vecAiColumn.push_back("res_para_int7");
|
vecAiColumn.push_back("res_para_int7");
|
||||||
vecAiColumn.push_back("res_para_int8");
|
vecAiColumn.push_back("res_para_int8");
|
||||||
|
vecAiColumn.push_back("res_para_str1");
|
||||||
|
|
||||||
ret = RdbAiTable.open(m_strAppLabel.c_str(),RT_FES_AI_TBL);
|
ret = RdbAiTable.open(m_strAppLabel.c_str(),RT_FES_AI_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
@ -438,7 +443,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxAiPoints = 0;
|
RtuPtr->m_MaxAiPoints = 0;
|
||||||
count = VecAiParam.size();
|
count = static_cast<int>(VecAiParam.size());
|
||||||
//LOGDEBUG("RTU%d VecAiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
//LOGDEBUG("RTU%d VecAiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
@ -496,6 +501,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pAi->Param6 = VecAiParam[j].Param6;
|
pAi->Param6 = VecAiParam[j].Param6;
|
||||||
pAi->Param7 = VecAiParam[j].Param7;
|
pAi->Param7 = VecAiParam[j].Param7;
|
||||||
pAi->Param8 = VecAiParam[j].Param8;
|
pAi->Param8 = VecAiParam[j].Param8;
|
||||||
|
strcpy(pAi->szResParam1, VecAiParam[j].szResParam1);
|
||||||
|
|
||||||
pAi->JudgeFlag = CN_SFesAiJudge_Limit | CN_SFesAiJudge_Deadband;
|
pAi->JudgeFlag = CN_SFesAiJudge_Limit | CN_SFesAiJudge_Deadband;
|
||||||
if (pAi->DeadBandType == CN_FesDeadbandType_Percent)
|
if (pAi->DeadBandType == CN_FesDeadbandType_Percent)
|
||||||
@ -560,6 +566,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecDiColumn.push_back("res_para_int6");
|
vecDiColumn.push_back("res_para_int6");
|
||||||
vecDiColumn.push_back("res_para_int7");
|
vecDiColumn.push_back("res_para_int7");
|
||||||
vecDiColumn.push_back("res_para_int8");
|
vecDiColumn.push_back("res_para_int8");
|
||||||
|
vecDiColumn.push_back("res_para_str1");
|
||||||
vecDiColumn.push_back("attr");
|
vecDiColumn.push_back("attr");
|
||||||
vecDiColumn.push_back("ass_dig");
|
vecDiColumn.push_back("ass_dig");
|
||||||
ret = RdbDiTable.open(m_strAppLabel.c_str(), RT_FES_DI_TBL);
|
ret = RdbDiTable.open(m_strAppLabel.c_str(), RT_FES_DI_TBL);
|
||||||
@ -575,7 +582,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxDiPoints = 0;
|
RtuPtr->m_MaxDiPoints = 0;
|
||||||
count = VecDiParam.size();
|
count = static_cast<int>(VecDiParam.size());
|
||||||
//LOGDEBUG("RTU%d VecDiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
//LOGDEBUG("RTU%d VecDiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
@ -611,6 +618,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pDi->Param6 = VecDiParam[j].Param6;
|
pDi->Param6 = VecDiParam[j].Param6;
|
||||||
pDi->Param7 = VecDiParam[j].Param7;
|
pDi->Param7 = VecDiParam[j].Param7;
|
||||||
pDi->Param8 = VecDiParam[j].Param8;
|
pDi->Param8 = VecDiParam[j].Param8;
|
||||||
|
strcpy(pDi->szResParam1, VecDiParam[j].szResParam1);
|
||||||
pDi->Attribute = VecDiParam[j].Attribute;
|
pDi->Attribute = VecDiParam[j].Attribute;
|
||||||
pDi->RelateDI = VecDiParam[j].RelateDI;
|
pDi->RelateDI = VecDiParam[j].RelateDI;
|
||||||
pDi->Status |= CN_FesValueComDown;//2020-09-10 thxiao 点初始状态为通信中断
|
pDi->Status |= CN_FesValueComDown;//2020-09-10 thxiao 点初始状态为通信中断
|
||||||
@ -658,6 +666,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecAccColumn.push_back("res_para_int6");
|
vecAccColumn.push_back("res_para_int6");
|
||||||
vecAccColumn.push_back("res_para_int7");
|
vecAccColumn.push_back("res_para_int7");
|
||||||
vecAccColumn.push_back("res_para_int8");
|
vecAccColumn.push_back("res_para_int8");
|
||||||
|
vecAccColumn.push_back("res_para_str1");
|
||||||
ret = RdbAccTable.open(m_strAppLabel.c_str(), RT_FES_ACC_TBL);
|
ret = RdbAccTable.open(m_strAppLabel.c_str(), RT_FES_ACC_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
{
|
{
|
||||||
@ -671,7 +680,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxAccPoints = 0;
|
RtuPtr->m_MaxAccPoints = 0;
|
||||||
count = VecAccParam.size();
|
count = static_cast<int>(VecAccParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxAccPoints = VecAccParam[count-1].PointNo+1;
|
RtuPtr->m_MaxAccPoints = VecAccParam[count-1].PointNo+1;
|
||||||
@ -694,8 +703,8 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
strcpy(pAcc->PointTagName, VecAccParam[j].PointTagName);
|
strcpy(pAcc->PointTagName, VecAccParam[j].PointTagName);
|
||||||
strcpy(pAcc->PointDesc, VecAccParam[j].PointDesc);
|
strcpy(pAcc->PointDesc, VecAccParam[j].PointDesc);
|
||||||
pAcc->DevId = GetDevIdByDevTag(RtuPtr, VecAccParam[j].DevTagName);//2020-12-17 thxiao 增加DevId
|
pAcc->DevId = GetDevIdByDevTag(RtuPtr, VecAccParam[j].DevTagName);//2020-12-17 thxiao 增加DevId
|
||||||
pAcc->Base = (float)VecAccParam[j].Base;
|
pAcc->Base = static_cast<float>(VecAccParam[j].Base);
|
||||||
pAcc->Coeff = (float)VecAccParam[j].Coeff;
|
pAcc->Coeff = VecAccParam[j].Coeff;
|
||||||
pAcc->Param1 = VecAccParam[j].Param1;
|
pAcc->Param1 = VecAccParam[j].Param1;
|
||||||
pAcc->Param2 = VecAccParam[j].Param2;
|
pAcc->Param2 = VecAccParam[j].Param2;
|
||||||
pAcc->Param3 = VecAccParam[j].Param3;
|
pAcc->Param3 = VecAccParam[j].Param3;
|
||||||
@ -704,6 +713,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pAcc->Param6 = VecAccParam[j].Param6;
|
pAcc->Param6 = VecAccParam[j].Param6;
|
||||||
pAcc->Param7 = VecAccParam[j].Param7;
|
pAcc->Param7 = VecAccParam[j].Param7;
|
||||||
pAcc->Param8 = VecAccParam[j].Param8;
|
pAcc->Param8 = VecAccParam[j].Param8;
|
||||||
|
strcpy(pAcc->szResParam1, VecAccParam[j].szResParam1);
|
||||||
pAcc->Status |= CN_FesValueComDown;//2020-09-10 thxiao 点初始状态为通信中断
|
pAcc->Status |= CN_FesValueComDown;//2020-09-10 thxiao 点初始状态为通信中断
|
||||||
pAcc->Used = 1;
|
pAcc->Used = 1;
|
||||||
}
|
}
|
||||||
@ -751,6 +761,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecMiColumn.push_back("res_para_int6");
|
vecMiColumn.push_back("res_para_int6");
|
||||||
vecMiColumn.push_back("res_para_int7");
|
vecMiColumn.push_back("res_para_int7");
|
||||||
vecMiColumn.push_back("res_para_int8");
|
vecMiColumn.push_back("res_para_int8");
|
||||||
|
vecMiColumn.push_back("res_para_str1");
|
||||||
ret = RdbMiTable.open(m_strAppLabel.c_str(), RT_FES_MI_TBL);
|
ret = RdbMiTable.open(m_strAppLabel.c_str(), RT_FES_MI_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
{
|
{
|
||||||
@ -764,7 +775,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxMiPoints = 0;
|
RtuPtr->m_MaxMiPoints = 0;
|
||||||
count = VecMiParam.size();
|
count = static_cast<int>(VecMiParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxMiPoints = VecMiParam[count-1].PointNo+1;
|
RtuPtr->m_MaxMiPoints = VecMiParam[count-1].PointNo+1;
|
||||||
@ -799,6 +810,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pMi->Param6 = VecMiParam[j].Param6;
|
pMi->Param6 = VecMiParam[j].Param6;
|
||||||
pMi->Param7 = VecMiParam[j].Param7;
|
pMi->Param7 = VecMiParam[j].Param7;
|
||||||
pMi->Param8 = VecMiParam[j].Param8;
|
pMi->Param8 = VecMiParam[j].Param8;
|
||||||
|
strcpy(pMi->szResParam1, VecMiParam[j].szResParam1);
|
||||||
pMi->Status |= CN_FesValueComDown;//2020-09-10 thxiao 点初始状态为通信中断
|
pMi->Status |= CN_FesValueComDown;//2020-09-10 thxiao 点初始状态为通信中断
|
||||||
pMi->Used = 1;
|
pMi->Used = 1;
|
||||||
}
|
}
|
||||||
@ -831,7 +843,6 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecDoColumn.push_back("description");
|
vecDoColumn.push_back("description");
|
||||||
vecDoColumn.push_back("dev_tag");
|
vecDoColumn.push_back("dev_tag");
|
||||||
vecDoColumn.push_back("revers");
|
vecDoColumn.push_back("revers");
|
||||||
|
|
||||||
vecDoColumn.push_back("res_para_int1");
|
vecDoColumn.push_back("res_para_int1");
|
||||||
vecDoColumn.push_back("res_para_int2");
|
vecDoColumn.push_back("res_para_int2");
|
||||||
vecDoColumn.push_back("res_para_int3");
|
vecDoColumn.push_back("res_para_int3");
|
||||||
@ -840,6 +851,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecDoColumn.push_back("res_para_int6");
|
vecDoColumn.push_back("res_para_int6");
|
||||||
vecDoColumn.push_back("res_para_int7");
|
vecDoColumn.push_back("res_para_int7");
|
||||||
vecDoColumn.push_back("res_para_int8");
|
vecDoColumn.push_back("res_para_int8");
|
||||||
|
vecDoColumn.push_back("res_para_str1");
|
||||||
vecDoColumn.push_back("attr");
|
vecDoColumn.push_back("attr");
|
||||||
vecDoColumn.push_back("ctrl_type");
|
vecDoColumn.push_back("ctrl_type");
|
||||||
|
|
||||||
@ -856,7 +868,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxDoPoints = 0;
|
RtuPtr->m_MaxDoPoints = 0;
|
||||||
count = VecDoParam.size();
|
count = static_cast<int>(VecDoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxDoPoints = VecDoParam[count-1].PointNo+1;
|
RtuPtr->m_MaxDoPoints = VecDoParam[count-1].PointNo+1;
|
||||||
@ -885,6 +897,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pDo->Param6 = VecDoParam[j].Param6;
|
pDo->Param6 = VecDoParam[j].Param6;
|
||||||
pDo->Param7 = VecDoParam[j].Param7;
|
pDo->Param7 = VecDoParam[j].Param7;
|
||||||
pDo->Param8 = VecDoParam[j].Param8;
|
pDo->Param8 = VecDoParam[j].Param8;
|
||||||
|
strcpy(pDo->szResParam1, VecDoParam[j].szResParam1);
|
||||||
pDo->Attribute = VecDoParam[j].Attribute;
|
pDo->Attribute = VecDoParam[j].Attribute;
|
||||||
pDo->ControlParam = VecDoParam[j].ControlParam;
|
pDo->ControlParam = VecDoParam[j].ControlParam;
|
||||||
pDo->Used = 1;
|
pDo->Used = 1;
|
||||||
@ -930,6 +943,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecAoColumn.push_back("res_para_int6");
|
vecAoColumn.push_back("res_para_int6");
|
||||||
vecAoColumn.push_back("res_para_int7");
|
vecAoColumn.push_back("res_para_int7");
|
||||||
vecAoColumn.push_back("res_para_int8");
|
vecAoColumn.push_back("res_para_int8");
|
||||||
|
vecAoColumn.push_back("res_para_str1");
|
||||||
ret = RdbAoTable.open(m_strAppLabel.c_str(), RT_FES_AO_TBL);
|
ret = RdbAoTable.open(m_strAppLabel.c_str(), RT_FES_AO_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
{
|
{
|
||||||
@ -943,7 +957,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxAoPoints = 0;
|
RtuPtr->m_MaxAoPoints = 0;
|
||||||
count = VecAoParam.size();
|
count = static_cast<int>(VecAoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxAoPoints = VecAoParam[count-1].PointNo+1;
|
RtuPtr->m_MaxAoPoints = VecAoParam[count-1].PointNo+1;
|
||||||
@ -975,6 +989,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pAo->Param6 = VecAoParam[j].Param6;
|
pAo->Param6 = VecAoParam[j].Param6;
|
||||||
pAo->Param7 = VecAoParam[j].Param7;
|
pAo->Param7 = VecAoParam[j].Param7;
|
||||||
pAo->Param8 = VecAoParam[j].Param8;
|
pAo->Param8 = VecAoParam[j].Param8;
|
||||||
|
strcpy(pAo->szResParam1, VecAoParam[j].szResParam1);
|
||||||
pAo->Used = 1;
|
pAo->Used = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1016,6 +1031,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecMoColumn.push_back("res_para_int6");
|
vecMoColumn.push_back("res_para_int6");
|
||||||
vecMoColumn.push_back("res_para_int7");
|
vecMoColumn.push_back("res_para_int7");
|
||||||
vecMoColumn.push_back("res_para_int8");
|
vecMoColumn.push_back("res_para_int8");
|
||||||
|
vecMoColumn.push_back("res_para_str1");
|
||||||
ret = RdbMoTable.open(m_strAppLabel.c_str(), RT_FES_MO_TBL);
|
ret = RdbMoTable.open(m_strAppLabel.c_str(), RT_FES_MO_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
{
|
{
|
||||||
@ -1029,7 +1045,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxMoPoints = 0;
|
RtuPtr->m_MaxMoPoints = 0;
|
||||||
count = VecMoParam.size();
|
count = static_cast<int>(VecMoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxMoPoints = VecMoParam[count-1].PointNo+1;
|
RtuPtr->m_MaxMoPoints = VecMoParam[count-1].PointNo+1;
|
||||||
@ -1061,6 +1077,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pMo->Param6 = VecMoParam[j].Param6;
|
pMo->Param6 = VecMoParam[j].Param6;
|
||||||
pMo->Param7 = VecMoParam[j].Param7;
|
pMo->Param7 = VecMoParam[j].Param7;
|
||||||
pMo->Param8 = VecMoParam[j].Param8;
|
pMo->Param8 = VecMoParam[j].Param8;
|
||||||
|
strcpy(pMo->szResParam1, VecMoParam[j].szResParam1);
|
||||||
pMo->Used = 1;
|
pMo->Used = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1106,6 +1123,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecDzColumn.push_back("res_para_int6");
|
vecDzColumn.push_back("res_para_int6");
|
||||||
vecDzColumn.push_back("res_para_int7");
|
vecDzColumn.push_back("res_para_int7");
|
||||||
vecDzColumn.push_back("res_para_int8");
|
vecDzColumn.push_back("res_para_int8");
|
||||||
|
vecDzColumn.push_back("res_para_str1");
|
||||||
|
|
||||||
ret = RdbDzTable.open(m_strAppLabel.c_str(), RT_FES_SETTING_TBL);
|
ret = RdbDzTable.open(m_strAppLabel.c_str(), RT_FES_SETTING_TBL);
|
||||||
if (ret == false)
|
if (ret == false)
|
||||||
@ -1120,9 +1138,8 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxDzPoints = 0;
|
RtuPtr->m_MaxDzPoints = 0;
|
||||||
count = VecDzParam.size();
|
count = static_cast<int>(VecDzParam.size());
|
||||||
if (RtuPtr->m_Param.RtuNo == 169)
|
|
||||||
int aa = 0;
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxDzPoints = VecDzParam[count - 1].PointNo + 1;
|
RtuPtr->m_MaxDzPoints = VecDzParam[count - 1].PointNo + 1;
|
||||||
@ -1157,6 +1174,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pDz->Param6 = VecDzParam[j].Param6;
|
pDz->Param6 = VecDzParam[j].Param6;
|
||||||
pDz->Param7 = VecDzParam[j].Param7;
|
pDz->Param7 = VecDzParam[j].Param7;
|
||||||
pDz->Param8 = VecDzParam[j].Param8;
|
pDz->Param8 = VecDzParam[j].Param8;
|
||||||
|
strcpy(pDz->szResParam1,VecDzParam[j].szResParam1);
|
||||||
pDz->Used = 1;
|
pDz->Used = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1201,6 +1219,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecBlockColumn.push_back("para_int2");
|
vecBlockColumn.push_back("para_int2");
|
||||||
vecBlockColumn.push_back("para_int3");//2021-04-28 thxiao
|
vecBlockColumn.push_back("para_int3");//2021-04-28 thxiao
|
||||||
vecBlockColumn.push_back("para_int4");
|
vecBlockColumn.push_back("para_int4");
|
||||||
|
vecBlockColumn.push_back("para_str1");
|
||||||
vecBlockColumn.push_back("is_enable");
|
vecBlockColumn.push_back("is_enable");
|
||||||
ret = RdbDataBlockTable.open(m_strAppLabel.c_str(), RT_FES_DATA_BLOCK_TBL);
|
ret = RdbDataBlockTable.open(m_strAppLabel.c_str(), RT_FES_DATA_BLOCK_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
@ -1214,7 +1233,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
LOGERROR("CFesBase::InitBaseData, RdbDataBlockTable.selectOneCondition error!");
|
LOGERROR("CFesBase::InitBaseData, RdbDataBlockTable.selectOneCondition error!");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
RtuPtr->m_Param.ModbusCmdBuf.num = VecDataBlock.size();
|
RtuPtr->m_Param.ModbusCmdBuf.num = static_cast<int>(VecDataBlock.size());
|
||||||
BlockSeqNo = 0;
|
BlockSeqNo = 0;
|
||||||
RtuPtr->m_Param.ModbusCmdBuf.readx = 0;
|
RtuPtr->m_Param.ModbusCmdBuf.readx = 0;
|
||||||
RtuPtr->m_Param.ModbusCmdBuf.writex = 0;
|
RtuPtr->m_Param.ModbusCmdBuf.writex = 0;
|
||||||
@ -1242,6 +1261,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
pCmd->Param2 = VecDataBlock[k].Param2;
|
pCmd->Param2 = VecDataBlock[k].Param2;
|
||||||
pCmd->Param3 = VecDataBlock[k].Param3;
|
pCmd->Param3 = VecDataBlock[k].Param3;
|
||||||
pCmd->Param4 = VecDataBlock[k].Param4;
|
pCmd->Param4 = VecDataBlock[k].Param4;
|
||||||
|
strcpy(pCmd->szResParam1,VecDataBlock[k].szResParam1);
|
||||||
pCmd->Used = VecDataBlock[k].Used;
|
pCmd->Used = VecDataBlock[k].Used;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1288,7 +1308,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
//2020-01-05 把右边空格去掉
|
//2020-01-05 把右边空格去掉
|
||||||
//LOGDEBUG("1 RtuPtr->m_Param.LocationDesc=%s!!!!!!", RtuPtr->m_Param.LocationDesc);
|
//LOGDEBUG("1 RtuPtr->m_Param.LocationDesc=%s!!!!!!", RtuPtr->m_Param.LocationDesc);
|
||||||
|
|
||||||
int len = strlen(RtuPtr->m_Param.LocationDesc);
|
int len = static_cast<int>(strlen(RtuPtr->m_Param.LocationDesc));
|
||||||
char *p = RtuPtr->m_Param.LocationDesc + len - 1;
|
char *p = RtuPtr->m_Param.LocationDesc + len - 1;
|
||||||
while ((p >= RtuPtr->m_Param.LocationDesc) && (*p == ' '))
|
while ((p >= RtuPtr->m_Param.LocationDesc) && (*p == ' '))
|
||||||
{
|
{
|
||||||
@ -1314,7 +1334,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
|
|
||||||
|
|
||||||
//init MAP
|
//init MAP
|
||||||
m_RtuNum = m_vectCFesRtuPtr.size();
|
m_RtuNum = static_cast<int>(m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<m_RtuNum;i++)
|
for(i=0;i<m_RtuNum;i++)
|
||||||
{
|
{
|
||||||
m_mapRtu[m_vectCFesRtuPtr[i]->m_Param.RtuNo] = m_vectCFesRtuPtr[i];
|
m_mapRtu[m_vectCFesRtuPtr[i]->m_Param.RtuNo] = m_vectCFesRtuPtr[i];
|
||||||
@ -1368,6 +1388,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecChanColumn.push_back("res_para_int2");
|
vecChanColumn.push_back("res_para_int2");
|
||||||
vecChanColumn.push_back("res_para_int3");
|
vecChanColumn.push_back("res_para_int3");
|
||||||
vecChanColumn.push_back("res_para_int4");
|
vecChanColumn.push_back("res_para_int4");
|
||||||
|
vecChanColumn.push_back("res_para_str1");
|
||||||
//vecChanColumn.push_back("com_name");
|
//vecChanColumn.push_back("com_name");
|
||||||
vecChanColumn.push_back("baud");
|
vecChanColumn.push_back("baud");
|
||||||
vecChanColumn.push_back("parity");
|
vecChanColumn.push_back("parity");
|
||||||
@ -1375,8 +1396,6 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
vecChanColumn.push_back("stopbit");
|
vecChanColumn.push_back("stopbit");
|
||||||
vecChanColumn.push_back("alarm_enable");
|
vecChanColumn.push_back("alarm_enable");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ret = RdbChanTable.open(m_strAppLabel.c_str(),RT_FES_CHAN_TBL);
|
ret = RdbChanTable.open(m_strAppLabel.c_str(),RT_FES_CHAN_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
{
|
{
|
||||||
@ -1389,7 +1408,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
LOGERROR("CFesBase::InitBaseData, RdbChanTable.selectOneCondition error!");
|
LOGERROR("CFesBase::InitBaseData, RdbChanTable.selectOneCondition error!");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
m_ChanNum = VecChanParam.size();
|
m_ChanNum = static_cast<int>(VecChanParam.size());
|
||||||
if(m_ChanNum>0)
|
if(m_ChanNum>0)
|
||||||
{
|
{
|
||||||
for(i=0;i<m_ChanNum;i++)
|
for(i=0;i<m_ChanNum;i++)
|
||||||
@ -1446,6 +1465,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
ChanPtr->m_Param.ResParam2=VecChanParam[i].ResParam2;
|
ChanPtr->m_Param.ResParam2=VecChanParam[i].ResParam2;
|
||||||
ChanPtr->m_Param.SetTimeEnable=VecChanParam[i].ResParam3;
|
ChanPtr->m_Param.SetTimeEnable=VecChanParam[i].ResParam3;
|
||||||
ChanPtr->m_Param.LocalPortNo=VecChanParam[i].ResParam4;
|
ChanPtr->m_Param.LocalPortNo=VecChanParam[i].ResParam4;
|
||||||
|
strcpy(ChanPtr->m_Param.szResParam1,VecChanParam[i].szResParam1);
|
||||||
|
|
||||||
ChanPtr->m_Param.AlarmEnable = VecChanParam[i].AlarmEnable;
|
ChanPtr->m_Param.AlarmEnable = VecChanParam[i].AlarmEnable;
|
||||||
//分配通道空间
|
//分配通道空间
|
||||||
@ -1523,7 +1543,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
m_vectCFesChanPtr.push_back(ChanPtr);
|
m_vectCFesChanPtr.push_back(ChanPtr);
|
||||||
}
|
}
|
||||||
//init chan map
|
//init chan map
|
||||||
m_ChanNum = m_vectCFesChanPtr.size();
|
m_ChanNum = static_cast<int>(m_vectCFesChanPtr.size());
|
||||||
for (i = 0; i < static_cast<int>(m_vectCFesChanPtr.size()); i++)
|
for (i = 0; i < static_cast<int>(m_vectCFesChanPtr.size()); i++)
|
||||||
{
|
{
|
||||||
m_mapChan[m_vectCFesChanPtr[i]->m_Param.ChanNo] = m_vectCFesChanPtr[i];
|
m_mapChan[m_vectCFesChanPtr[i]->m_Param.ChanNo] = m_vectCFesChanPtr[i];
|
||||||
@ -1558,7 +1578,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = VecProtocolParam.size();
|
count = static_cast<int>(VecProtocolParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
@ -1568,7 +1588,7 @@ int CFesBase::InitBaseData(int flag)
|
|||||||
m_ProtocolNum = CN_FesMaxProtocolNum;
|
m_ProtocolNum = CN_FesMaxProtocolNum;
|
||||||
LOGERROR("CFesBase::InitBaseData, m_ProtocolNum %d exceed %d!",m_ProtocolNum,CN_FesMaxProtocolNum);
|
LOGERROR("CFesBase::InitBaseData, m_ProtocolNum %d exceed %d!",m_ProtocolNum,CN_FesMaxProtocolNum);
|
||||||
}
|
}
|
||||||
char tempStr[CN_FesMaxNameSize];
|
|
||||||
for (i = 0; i < static_cast<int>(VecProtocolParam.size()); i++)
|
for (i = 0; i < static_cast<int>(VecProtocolParam.size()); i++)
|
||||||
{
|
{
|
||||||
index = VecProtocolParam[i].ProtocolId;
|
index = VecProtocolParam[i].ProtocolId;
|
||||||
@ -1907,10 +1927,8 @@ void CFesBase::WriteWaveFormBuf(int num,SFesWaveForm *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesBase::GetWaveFormNum()
|
int CFesBase::GetWaveFormNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_WaveFormMutex);
|
boost::mutex::scoped_lock lock(m_WaveFormMutex);
|
||||||
num = m_WaveFormBuf.size();
|
int num = static_cast<int>(m_WaveFormBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1968,7 +1986,7 @@ void CFesBase::FwRtuInit()
|
|||||||
CFesChanPtr chanPtr;
|
CFesChanPtr chanPtr;
|
||||||
|
|
||||||
//把转发通道对应的有效RTU地址,填入转发RTU映射表
|
//把转发通道对应的有效RTU地址,填入转发RTU映射表
|
||||||
num = m_vectCFesRtuPtr.size();
|
num = static_cast<int>(m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<num;i++)
|
for(i=0;i<num;i++)
|
||||||
{
|
{
|
||||||
if(m_vectCFesRtuPtr[i]->m_Param.Used)
|
if(m_vectCFesRtuPtr[i]->m_Param.Used)
|
||||||
@ -1994,7 +2012,6 @@ bool CFesBase::ProtocolRtuInitByParam1(char* ProtocolName)
|
|||||||
int i,num,ProtocolId,found;
|
int i,num,ProtocolId,found;
|
||||||
CFesChanPtr chanPtr;
|
CFesChanPtr chanPtr;
|
||||||
|
|
||||||
char tempStr[CN_FesMaxNameSize];
|
|
||||||
found = 0;
|
found = 0;
|
||||||
for (i = 0; i < CN_FesMaxProtocolNum; i++)
|
for (i = 0; i < CN_FesMaxProtocolNum; i++)
|
||||||
{
|
{
|
||||||
@ -2012,7 +2029,7 @@ bool CFesBase::ProtocolRtuInitByParam1(char* ProtocolName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//把转发通道对应的有效RTU地址,填入转发RTU映射表
|
//把转发通道对应的有效RTU地址,填入转发RTU映射表
|
||||||
num = m_vectCFesRtuPtr.size();
|
num = static_cast<int>(m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<num;i++)
|
for(i=0;i<num;i++)
|
||||||
{
|
{
|
||||||
if(m_vectCFesRtuPtr[i]->m_Param.Used)
|
if(m_vectCFesRtuPtr[i]->m_Param.Used)
|
||||||
@ -2099,7 +2116,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
LOGERROR("RdbAiTable::close error");
|
LOGERROR("RdbAiTable::close error");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
count = VecAiParam.size();
|
count = static_cast<int>(VecAiParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxAiIndex = VecAiParam[count-1].Param1+1;
|
RtuPtr->m_MaxAiIndex = VecAiParam[count-1].Param1+1;
|
||||||
@ -2179,7 +2196,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
LOGERROR("RdbDiTable::close error");
|
LOGERROR("RdbDiTable::close error");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
count = VecDiParam.size();
|
count = static_cast<int>(VecDiParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxDiIndex = VecDiParam[count-1].Param1+1;
|
RtuPtr->m_MaxDiIndex = VecDiParam[count-1].Param1+1;
|
||||||
@ -2258,7 +2275,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = VecAccParam.size();
|
count = static_cast<int>(VecAccParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxAccIndex = VecAccParam[count-1].Param1+1;
|
RtuPtr->m_MaxAccIndex = VecAccParam[count-1].Param1+1;
|
||||||
@ -2336,10 +2353,11 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
LOGERROR("RdbMiTable::close error");
|
LOGERROR("RdbMiTable::close error");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
count = VecMiParam.size();
|
count = static_cast<int>(VecMiParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxMiIndex = VecMiParam[count-1].Param1+1;
|
RtuPtr->m_MaxMiIndex = VecMiParam[count-1].Param1+1;
|
||||||
|
RtuPtr->m_MinMiIndex = VecMiParam[0].Param1; //记录规约参数1最小值,以便快速判断接收到的协议报文中地址需要解析
|
||||||
if (RtuPtr->m_MaxMiIndex > 0)
|
if (RtuPtr->m_MaxMiIndex > 0)
|
||||||
{
|
{
|
||||||
//动态分配数据空间
|
//动态分配数据空间
|
||||||
@ -2380,6 +2398,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxMiIndex = 0;
|
RtuPtr->m_MaxMiIndex = 0;
|
||||||
|
RtuPtr->m_MinMiIndex = -1;
|
||||||
LOGDEBUG("RtuNo:%d Mi protocol point mapping create failed.\n", RtuPtr->m_Param.RtuNo);
|
LOGDEBUG("RtuNo:%d Mi protocol point mapping create failed.\n", RtuPtr->m_Param.RtuNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2415,7 +2434,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
LOGERROR("RdbDoTable::close error");
|
LOGERROR("RdbDoTable::close error");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
count = VecDoParam.size();
|
count = static_cast<int>(VecDoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxDoIndex = VecDoParam[count-1].Param1+1;
|
RtuPtr->m_MaxDoIndex = VecDoParam[count-1].Param1+1;
|
||||||
@ -2493,7 +2512,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
LOGERROR("RdbAoTable::close error");
|
LOGERROR("RdbAoTable::close error");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
count = VecAoParam.size();
|
count = static_cast<int>(VecAoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxAoIndex = VecAoParam[count-1].Param1+1;
|
RtuPtr->m_MaxAoIndex = VecAoParam[count-1].Param1+1;
|
||||||
@ -2571,7 +2590,7 @@ bool CFesBase::InitProtocolPointMapping(CFesRtuPtr RtuPtr)
|
|||||||
LOGERROR("RdbMoTable::close error");
|
LOGERROR("RdbMoTable::close error");
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
}
|
}
|
||||||
count = VecMoParam.size();
|
count = static_cast<int>(VecMoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxMoIndex = VecMoParam[count-1].Param1+1;
|
RtuPtr->m_MaxMoIndex = VecMoParam[count-1].Param1+1;
|
||||||
@ -3121,7 +3140,6 @@ void CFesBase::FwAiInit(CFesRtuPtr FwRtuPtr, int MappingIndex)
|
|||||||
PubPoint.SrcLocationID = pFwAi->SrcLocationID;
|
PubPoint.SrcLocationID = pFwAi->SrcLocationID;
|
||||||
PubPoint.SrcSubSystem = pFwAi->SrcSubSystem;
|
PubPoint.SrcSubSystem = pFwAi->SrcSubSystem;
|
||||||
strcpy(PubPoint.DPTagName, pFwAi->DPTagName);
|
strcpy(PubPoint.DPTagName, pFwAi->DPTagName);
|
||||||
PubPoint.FesRtuNo = pFwAi->FesRtuNo;
|
|
||||||
PubPoint.SrcPointNo = pFwAi->DpSeqNo;
|
PubPoint.SrcPointNo = pFwAi->DpSeqNo;
|
||||||
PubPoint.FesRtuNo = pFwAi->FesRtuNo;
|
PubPoint.FesRtuNo = pFwAi->FesRtuNo;
|
||||||
PubPoint.FwMapping[0].MappingIndex = MappingIndex;
|
PubPoint.FwMapping[0].MappingIndex = MappingIndex;
|
||||||
@ -3342,11 +3360,10 @@ void CFesBase::FwDataInit()
|
|||||||
{
|
{
|
||||||
int i, num ;
|
int i, num ;
|
||||||
CFesChanPtr chanPtr;
|
CFesChanPtr chanPtr;
|
||||||
CFesRtuPtr rtuPtr;
|
|
||||||
CFesRtuPtr FwRtuPtr;
|
CFesRtuPtr FwRtuPtr;
|
||||||
|
|
||||||
//把转发通道对应的有效RTU地址,填入转发RTU映射表
|
//把转发通道对应的有效RTU地址,填入转发RTU映射表
|
||||||
num = m_vectCFesRtuPtr.size();
|
num = static_cast<int>(m_vectCFesRtuPtr.size());
|
||||||
for (i = 0; i<num; i++)
|
for (i = 0; i<num; i++)
|
||||||
{
|
{
|
||||||
if (m_vectCFesRtuPtr[i]->m_Param.Used)
|
if (m_vectCFesRtuPtr[i]->m_Param.Used)
|
||||||
@ -3410,7 +3427,7 @@ int CFesBase::GetFesFwMappingIndex(CFesRtuPtr RtuPtr)
|
|||||||
* 通过TagName,获取非本FES转发点SFesFwPubAi
|
* 通过TagName,获取非本FES转发点SFesFwPubAi
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubAi* CFesBase::GetFesFwPubFesAi(std::string TagName)
|
SFesFwPubAi* CFesBase::GetFesFwPubFesAi(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubAi>::iterator it;
|
std::map<std::string, SFesFwPubAi>::iterator it;
|
||||||
|
|
||||||
@ -3426,7 +3443,7 @@ SFesFwPubAi* CFesBase::GetFesFwPubFesAi(std::string TagName)
|
|||||||
* 通过TagName,获取DP转发点GetFesFwPubDpAi
|
* 通过TagName,获取DP转发点GetFesFwPubDpAi
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubAi* CFesBase::GetFesFwPubDpAi(std::string TagName)
|
SFesFwPubAi* CFesBase::GetFesFwPubDpAi(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubAi>::iterator it;
|
std::map<std::string, SFesFwPubAi>::iterator it;
|
||||||
|
|
||||||
@ -3443,7 +3460,7 @@ SFesFwPubAi* CFesBase::GetFesFwPubDpAi(std::string TagName)
|
|||||||
* 通过TagName,获取非本FES转发点SFesFwPubDi
|
* 通过TagName,获取非本FES转发点SFesFwPubDi
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubDi* CFesBase::GetFesFwPubFesDi(std::string TagName)
|
SFesFwPubDi* CFesBase::GetFesFwPubFesDi(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubDi>::iterator it;
|
std::map<std::string, SFesFwPubDi>::iterator it;
|
||||||
|
|
||||||
@ -3459,7 +3476,7 @@ SFesFwPubDi* CFesBase::GetFesFwPubFesDi(std::string TagName)
|
|||||||
* 通过TagName,获取DP转发点GetFesFwPubDpDi
|
* 通过TagName,获取DP转发点GetFesFwPubDpDi
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubDi* CFesBase::GetFesFwPubDpDi(std::string TagName)
|
SFesFwPubDi* CFesBase::GetFesFwPubDpDi(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubDi>::iterator it;
|
std::map<std::string, SFesFwPubDi>::iterator it;
|
||||||
|
|
||||||
@ -3475,7 +3492,7 @@ SFesFwPubDi* CFesBase::GetFesFwPubDpDi(std::string TagName)
|
|||||||
* 通过TagName,获取非本FES转发点SFesFwPubAcc
|
* 通过TagName,获取非本FES转发点SFesFwPubAcc
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubAcc* CFesBase::GetFesFwPubFesAcc(std::string TagName)
|
SFesFwPubAcc* CFesBase::GetFesFwPubFesAcc(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubAcc>::iterator it;
|
std::map<std::string, SFesFwPubAcc>::iterator it;
|
||||||
|
|
||||||
@ -3491,7 +3508,7 @@ SFesFwPubAcc* CFesBase::GetFesFwPubFesAcc(std::string TagName)
|
|||||||
* 通过TagName,获取DP转发点SFesFwPubAcc
|
* 通过TagName,获取DP转发点SFesFwPubAcc
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubAcc* CFesBase::GetFesFwPubDpAcc(std::string TagName)
|
SFesFwPubAcc* CFesBase::GetFesFwPubDpAcc(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubAcc>::iterator it;
|
std::map<std::string, SFesFwPubAcc>::iterator it;
|
||||||
|
|
||||||
@ -3508,7 +3525,7 @@ SFesFwPubAcc* CFesBase::GetFesFwPubDpAcc(std::string TagName)
|
|||||||
* 通过TagName,获取非本FES转发点SFesFwPubMi
|
* 通过TagName,获取非本FES转发点SFesFwPubMi
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubMi* CFesBase::GetFesFwPubFesMi(std::string TagName)
|
SFesFwPubMi* CFesBase::GetFesFwPubFesMi(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubMi>::iterator it;
|
std::map<std::string, SFesFwPubMi>::iterator it;
|
||||||
|
|
||||||
@ -3524,7 +3541,7 @@ SFesFwPubMi* CFesBase::GetFesFwPubFesMi(std::string TagName)
|
|||||||
* 通过TagName,获取DP转发点SFesFwPubMi
|
* 通过TagName,获取DP转发点SFesFwPubMi
|
||||||
* @param TagName 点TagName
|
* @param TagName 点TagName
|
||||||
*/
|
*/
|
||||||
SFesFwPubMi* CFesBase::GetFesFwPubDpMi(std::string TagName)
|
SFesFwPubMi* CFesBase::GetFesFwPubDpMi(const std::string &TagName)
|
||||||
{
|
{
|
||||||
std::map<std::string, SFesFwPubMi>::iterator it;
|
std::map<std::string, SFesFwPubMi>::iterator it;
|
||||||
|
|
||||||
@ -3550,7 +3567,7 @@ void CFesBase::WriteSoeEventBuf(CFesRtuPtr curRtuPtr, int num, SFesSoeEvent *bu
|
|||||||
CFesRtuPtr rtuPtr;
|
CFesRtuPtr rtuPtr;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(curRtuPtr->m_EventMutex);
|
boost::mutex::scoped_lock lock(curRtuPtr->m_EventMutex);
|
||||||
count = curRtuPtr->SoeEventBuf.size();
|
count = static_cast<int>(curRtuPtr->SoeEventBuf.size());
|
||||||
if ((count + num) > curRtuPtr->DiMaxChgNum)
|
if ((count + num) > curRtuPtr->DiMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -3567,7 +3584,7 @@ void CFesBase::WriteSoeEventBuf(CFesRtuPtr curRtuPtr, int num, SFesSoeEvent *bu
|
|||||||
{
|
{
|
||||||
curRtuPtr->SoeEventBuf.push(buffer[i]);
|
curRtuPtr->SoeEventBuf.push(buffer[i]);
|
||||||
//2019-09-06 thxiao 方便查找事件,增加记录
|
//2019-09-06 thxiao 方便查找事件,增加记录
|
||||||
LOGINFO("SOE RtuNo:%d PointNo=%d TagName:%s value=%d ms=[%" PRId64 "] count=%d",
|
LOGTRACE("SOE RtuNo:%d PointNo=%d TagName:%s value=%d ms=[%" PRId64 "] count=%d",
|
||||||
curRtuPtr->m_Param.RtuNo, buffer[i].PointNo,buffer[i].TagName, buffer[i].Value, buffer[i].time,m_SoeCount);
|
curRtuPtr->m_Param.RtuNo, buffer[i].PointNo,buffer[i].TagName, buffer[i].Value, buffer[i].time,m_SoeCount);
|
||||||
m_SoeCount++;
|
m_SoeCount++;
|
||||||
}
|
}
|
||||||
@ -3621,7 +3638,7 @@ void CFesBase::WriteChgDiValue(CFesRtuPtr curRtuPtr,int num, SFesChgDi *buffer)
|
|||||||
SFesFwChgDi ChgValue;
|
SFesFwChgDi ChgValue;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(curRtuPtr->m_DiChgMutex);
|
boost::mutex::scoped_lock lock(curRtuPtr->m_DiChgMutex);
|
||||||
count = curRtuPtr->DiChgBuf.size();
|
count = static_cast<int>(curRtuPtr->DiChgBuf.size());
|
||||||
if ((count + num) > curRtuPtr->DiMaxChgNum)
|
if ((count + num) > curRtuPtr->DiMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -3638,7 +3655,7 @@ void CFesBase::WriteChgDiValue(CFesRtuPtr curRtuPtr,int num, SFesChgDi *buffer)
|
|||||||
{
|
{
|
||||||
curRtuPtr->DiChgBuf.push(buffer[i]);
|
curRtuPtr->DiChgBuf.push(buffer[i]);
|
||||||
//2019-09-06 thxiao 方便查找事件,增加记录
|
//2019-09-06 thxiao 方便查找事件,增加记录
|
||||||
LOGINFO("DI change RtuNo:%d PointNo=%d TagName:%s value=%d ms=[%" PRId64 "] count=%d",
|
LOGTRACE("DI change RtuNo:%d PointNo=%d TagName:%s value=%d ms=[%" PRId64 "] count=%d",
|
||||||
curRtuPtr->m_Param.RtuNo, buffer[i].PointNo, buffer[i].TagName, buffer[i].Value, buffer[i].time,m_DiChgCount);
|
curRtuPtr->m_Param.RtuNo, buffer[i].PointNo, buffer[i].TagName, buffer[i].Value, buffer[i].time,m_DiChgCount);
|
||||||
m_DiChgCount++;
|
m_DiChgCount++;
|
||||||
}
|
}
|
||||||
@ -3693,7 +3710,7 @@ void CFesBase::WriteChgAiValue(CFesRtuPtr curRtuPtr, int num, SFesChgAi *buffer
|
|||||||
SFesFwChgAi ChgValue;
|
SFesFwChgAi ChgValue;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(curRtuPtr->m_AiChgMutex);
|
boost::mutex::scoped_lock lock(curRtuPtr->m_AiChgMutex);
|
||||||
count = curRtuPtr->AiChgBuf.size();
|
count = static_cast<int>(curRtuPtr->AiChgBuf.size());
|
||||||
if ((count + num) > curRtuPtr->AiMaxChgNum)
|
if ((count + num) > curRtuPtr->AiMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -3728,6 +3745,8 @@ void CFesBase::WriteChgAiValue(CFesRtuPtr curRtuPtr, int num, SFesChgAi *buffer
|
|||||||
ChgValue.Status = buffer[i].Status;
|
ChgValue.Status = buffer[i].Status;
|
||||||
ChgValue.Value = buffer[i].Value;
|
ChgValue.Value = buffer[i].Value;
|
||||||
ChgValue.time = buffer[i].time;
|
ChgValue.time = buffer[i].time;
|
||||||
|
|
||||||
|
float fNewValue = 0.0f;
|
||||||
for (j = 0; j < pAi->FwMapNum; j++)
|
for (j = 0; j < pAi->FwMapNum; j++)
|
||||||
{
|
{
|
||||||
index = pAi->FwMapping[j].MappingIndex;
|
index = pAi->FwMapping[j].MappingIndex;
|
||||||
@ -3735,8 +3754,11 @@ void CFesBase::WriteChgAiValue(CFesRtuPtr curRtuPtr, int num, SFesChgAi *buffer
|
|||||||
{
|
{
|
||||||
FwEvent.RemoteNo = pAi->FwMapping[j].RemoteNo;
|
FwEvent.RemoteNo = pAi->FwMapping[j].RemoteNo;
|
||||||
ChgValue.RemoteNo = FwEvent.RemoteNo;
|
ChgValue.RemoteNo = FwEvent.RemoteNo;
|
||||||
|
if(rtuPtr->UpdataFwAiValue(ChgValue,fNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
FwEvent.Value = fNewValue;
|
||||||
rtuPtr->WriteFwAiBuf(FwEvent);
|
rtuPtr->WriteFwAiBuf(FwEvent);
|
||||||
rtuPtr->UpdataFwAiValue(ChgValue);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3760,7 +3782,7 @@ void CFesBase::WriteChgAccValue(CFesRtuPtr curRtuPtr, int num, SFesChgAcc *buff
|
|||||||
SFesFwChgAcc ChgValue;
|
SFesFwChgAcc ChgValue;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(curRtuPtr->m_AccChgMutex);
|
boost::mutex::scoped_lock lock(curRtuPtr->m_AccChgMutex);
|
||||||
int count = curRtuPtr->AccChgBuf.size();
|
int count = static_cast<int>(curRtuPtr->AccChgBuf.size());
|
||||||
if ((count + num) > curRtuPtr->AccMaxChgNum)
|
if ((count + num) > curRtuPtr->AccMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -3795,6 +3817,8 @@ void CFesBase::WriteChgAccValue(CFesRtuPtr curRtuPtr, int num, SFesChgAcc *buff
|
|||||||
ChgValue.Value = buffer[i].Value;
|
ChgValue.Value = buffer[i].Value;
|
||||||
ChgValue.time = buffer[i].time;
|
ChgValue.time = buffer[i].time;
|
||||||
FwEvent.time = buffer[i].time;
|
FwEvent.time = buffer[i].time;
|
||||||
|
|
||||||
|
double dNewValue = 0.0;
|
||||||
for (j = 0; j < pAcc->FwMapNum; j++)
|
for (j = 0; j < pAcc->FwMapNum; j++)
|
||||||
{
|
{
|
||||||
index = pAcc->FwMapping[j].MappingIndex;
|
index = pAcc->FwMapping[j].MappingIndex;
|
||||||
@ -3802,8 +3826,12 @@ void CFesBase::WriteChgAccValue(CFesRtuPtr curRtuPtr, int num, SFesChgAcc *buff
|
|||||||
{
|
{
|
||||||
FwEvent.RemoteNo = pAcc->FwMapping[j].RemoteNo;
|
FwEvent.RemoteNo = pAcc->FwMapping[j].RemoteNo;
|
||||||
ChgValue.RemoteNo = FwEvent.RemoteNo;
|
ChgValue.RemoteNo = FwEvent.RemoteNo;
|
||||||
|
|
||||||
|
if(rtuPtr->UpdataFwAccValue(ChgValue,dNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
FwEvent.Value = dNewValue;
|
||||||
rtuPtr->WriteFwAccBuf(FwEvent);
|
rtuPtr->WriteFwAccBuf(FwEvent);
|
||||||
rtuPtr->UpdataFwAccValue(ChgValue);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3827,7 +3855,7 @@ void CFesBase::WriteChgMiValue(CFesRtuPtr curRtuPtr, int num, SFesChgMi *buffer
|
|||||||
SFesFwChgMi ChgValue;
|
SFesFwChgMi ChgValue;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(curRtuPtr->m_MiChgMutex);
|
boost::mutex::scoped_lock lock(curRtuPtr->m_MiChgMutex);
|
||||||
int count = curRtuPtr->MiChgBuf.size();
|
int count = static_cast<int>(curRtuPtr->MiChgBuf.size());
|
||||||
if ((count + num) > curRtuPtr->MiMaxChgNum)
|
if ((count + num) > curRtuPtr->MiMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -3862,6 +3890,8 @@ void CFesBase::WriteChgMiValue(CFesRtuPtr curRtuPtr, int num, SFesChgMi *buffer
|
|||||||
ChgValue.Status = buffer[i].Status;
|
ChgValue.Status = buffer[i].Status;
|
||||||
ChgValue.Value = buffer[i].Value;
|
ChgValue.Value = buffer[i].Value;
|
||||||
ChgValue.time = buffer[i].time;
|
ChgValue.time = buffer[i].time;
|
||||||
|
|
||||||
|
int nNewValue = 0;
|
||||||
for (j = 0; j < pMi->FwMapNum; j++)
|
for (j = 0; j < pMi->FwMapNum; j++)
|
||||||
{
|
{
|
||||||
index = pMi->FwMapping[j].MappingIndex;
|
index = pMi->FwMapping[j].MappingIndex;
|
||||||
@ -3869,8 +3899,12 @@ void CFesBase::WriteChgMiValue(CFesRtuPtr curRtuPtr, int num, SFesChgMi *buffer
|
|||||||
{
|
{
|
||||||
FwEvent.RemoteNo = pMi->FwMapping[j].RemoteNo;
|
FwEvent.RemoteNo = pMi->FwMapping[j].RemoteNo;
|
||||||
ChgValue.RemoteNo = FwEvent.RemoteNo;
|
ChgValue.RemoteNo = FwEvent.RemoteNo;
|
||||||
|
|
||||||
|
if(rtuPtr->UpdataFwMiValue(ChgValue,nNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
FwEvent.Value = nNewValue;
|
||||||
rtuPtr->WriteFwMiBuf(FwEvent);
|
rtuPtr->WriteFwMiBuf(FwEvent);
|
||||||
rtuPtr->UpdataFwMiValue(ChgValue);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4134,7 +4168,6 @@ int CFesBase::ReadFwMoRespBusCmd(int num, SFesFwMoBusCmd *buffer)
|
|||||||
int CFesBase::GetProtocolID(char* ProtocolName)
|
int CFesBase::GetProtocolID(char* ProtocolName)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char tempStr[CN_FesMaxNameSize];
|
|
||||||
for (i = 0; i < CN_FesMaxProtocolNum; i++)
|
for (i = 0; i < CN_FesMaxProtocolNum; i++)
|
||||||
{
|
{
|
||||||
if (strstr(m_protoclName[i].Name, ProtocolName) != NULL)
|
if (strstr(m_protoclName[i].Name, ProtocolName) != NULL)
|
||||||
@ -4539,7 +4572,7 @@ void CFesBase::WriteWuFangChgDoStatusBuf(int num, SFesFwChgDo *buffer)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_FwCtrlMutex);
|
boost::mutex::scoped_lock lock(m_FwCtrlMutex);
|
||||||
int count = m_FwDoChgStatusBuf.size();
|
int count = static_cast<int>(m_FwDoChgStatusBuf.size());
|
||||||
if ((count + num) > 10000)
|
if ((count + num) > 10000)
|
||||||
{
|
{
|
||||||
LOGERROR("FwDoChgStatusBuf overflow 10000");
|
LOGERROR("FwDoChgStatusBuf overflow 10000");
|
||||||
@ -4838,7 +4871,7 @@ void CFesBase::WriteSoeStrEventBuf(CFesRtuPtr curRtuPtr, int num, SFesSoeStrEve
|
|||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(curRtuPtr->m_EventMutex);
|
boost::mutex::scoped_lock lock(curRtuPtr->m_EventMutex);
|
||||||
count = curRtuPtr->SoeStrEventBuf.size();
|
count = static_cast<int>(curRtuPtr->SoeStrEventBuf.size());
|
||||||
if ((count + num) > curRtuPtr->DiMaxChgNum)
|
if ((count + num) > curRtuPtr->DiMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -4918,10 +4951,8 @@ void CFesBase::WriteChanEventBuf(int num, SFesChanEvent *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesBase::GetChanEventNum()
|
int CFesBase::GetChanEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = m_ChanEventBuf.size();
|
int num = static_cast<int>(m_ChanEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4976,7 +5007,7 @@ void CFesBase::SetFwDiData(CFesRtuPtr FwRtuPtr,int StartChanNo,int EndChanNo)
|
|||||||
|
|
||||||
if (StartChanNo == -1)//所有的DI数据都转发
|
if (StartChanNo == -1)//所有的DI数据都转发
|
||||||
{
|
{
|
||||||
num = m_vectCFesChanPtr.size();
|
num = static_cast<int>(m_vectCFesChanPtr.size());
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if ((m_vectCFesChanPtr[i]->m_Param.Used) && (m_vectCFesChanPtr[i]->m_Param.CommProperty == CN_FesComProperty_Collect))
|
if ((m_vectCFesChanPtr[i]->m_Param.Used) && (m_vectCFesChanPtr[i]->m_Param.CommProperty == CN_FesComProperty_Collect))
|
||||||
@ -5005,7 +5036,7 @@ void CFesBase::SetFwDiData(CFesRtuPtr FwRtuPtr,int StartChanNo,int EndChanNo)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = m_vectCFesChanPtr.size();
|
num = static_cast<int>(m_vectCFesChanPtr.size());
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if ((m_vectCFesChanPtr[i]->m_Param.Used)&&(m_vectCFesChanPtr[i]->m_Param.CommProperty==CN_FesComProperty_Collect)
|
if ((m_vectCFesChanPtr[i]->m_Param.Used)&&(m_vectCFesChanPtr[i]->m_Param.CommProperty==CN_FesComProperty_Collect)
|
||||||
|
|||||||
@ -20,11 +20,9 @@
|
|||||||
2021-10-18 thxiao CheckChanStatus()不再判断通道下是否有RTU,主备通道状态都更新
|
2021-10-18 thxiao CheckChanStatus()不再判断通道下是否有RTU,主备通道状态都更新
|
||||||
2021-12-02 thxiao 备用通道无效,则下一通道。
|
2021-12-02 thxiao 备用通道无效,则下一通道。
|
||||||
2021-12-24 thxiao CheckChanStatus()主机才报告事件
|
2021-12-24 thxiao CheckChanStatus()主机才报告事件
|
||||||
2022-09-28 thxiao 每天随机把转发标志设置1小时为false,让通信中断1小时
|
|
||||||
*/
|
*/
|
||||||
#include "FesChanManageThread.h"
|
#include "FesChanManageThread.h"
|
||||||
#include "pub_utility_api/TimeUtil.h"
|
#include "pub_utility_api/TimeUtil.h"
|
||||||
#include "pub_utility_api/CommonConfigParse.h"
|
|
||||||
//#include "FesRtu.h"
|
//#include "FesRtu.h"
|
||||||
|
|
||||||
using namespace iot_public;
|
using namespace iot_public;
|
||||||
@ -53,21 +51,6 @@ CTimerThreadBase("FesChanManageThread", 100)
|
|||||||
m_timerCount = 0;
|
m_timerCount = 0;
|
||||||
m_lastOfflineSecTime = getMonotonicMsec();
|
m_lastOfflineSecTime = getMonotonicMsec();
|
||||||
|
|
||||||
//2022-09-28 thxiao 每天随机把转发标志设置1小时为false,让通信中断1小时
|
|
||||||
m_IsMainFesZf = g_IsMainFes;
|
|
||||||
m_ComDownMSec = getMonotonicMsec(); //启动时间
|
|
||||||
m_ComDownStepHighLimit=108000000; //计数偏移量,最大偏移值>24h 30*60*60*1000=108000000
|
|
||||||
m_ComDownStepLowLimit=86400000; //计数偏移量,最小偏移值>24h 24*60*60*1000=86400000
|
|
||||||
m_ComDownStep=1020000; //偏移值步长17*60*1000=1020000
|
|
||||||
m_ComDownOffSet = m_ComDownStepLowLimit; //当前偏移值是个有步长的偏移量,到达最高值时,返回最低值继续循环。
|
|
||||||
m_ComDownStepCount=0; //偏移值计数
|
|
||||||
m_ComDownKeepMsec = 3600000; //停止持续时间 3600*1000=3600000
|
|
||||||
m_ComDownStartMSec = m_ComDownMSec+ m_ComDownOffSet; //停止时间
|
|
||||||
m_ComDownStopMSec = m_ComDownStartMSec + m_ComDownKeepMsec; //停止时间
|
|
||||||
m_lastCheckDogTimes = 0;
|
|
||||||
ReadConfigParam();
|
|
||||||
m_ptrDogAuth = iot_sys::getDogAuthInstance();
|
|
||||||
LOGDEBUG("current=%lld m_ComDownOffSet=%lld m_ComDownStartMSec=%lld m_ComDownStopMSec=%lld", m_ComDownMSec, m_ComDownOffSet, m_ComDownStartMSec, m_ComDownStopMSec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFesChanManageThread::~CFesChanManageThread()
|
CFesChanManageThread::~CFesChanManageThread()
|
||||||
@ -100,7 +83,7 @@ void CFesChanManageThread::execute()
|
|||||||
{
|
{
|
||||||
CFesChanPtr ptrMainFesChan; //CHAN数据区
|
CFesChanPtr ptrMainFesChan; //CHAN数据区
|
||||||
int ChanNo, MainChanNo,i;
|
int ChanNo, MainChanNo,i;
|
||||||
int64 curmsec ;
|
int64 curmsec;
|
||||||
|
|
||||||
if (m_timerCount++ >= m_timerCountReset)
|
if (m_timerCount++ >= m_timerCountReset)
|
||||||
{
|
{
|
||||||
@ -124,26 +107,9 @@ void CFesChanManageThread::execute()
|
|||||||
//检查通道状态,同时计算通道误码率
|
//检查通道状态,同时计算通道误码率
|
||||||
CheckChanStatus();
|
CheckChanStatus();
|
||||||
|
|
||||||
if(m_BreakDownFlag) //通信控制
|
|
||||||
{
|
|
||||||
if ((curmsec - m_lastCheckDogTimes) >60*1000)//:狗校验失败情况,定时停止转发功能,检查周期 1分钟
|
|
||||||
{
|
|
||||||
if(m_ptrDogAuth->checkAuthStatus() != AUTH_STATUS_OK) //狗异常
|
|
||||||
{
|
|
||||||
SetIsMainFesZf();
|
|
||||||
}
|
|
||||||
else //狗正常
|
|
||||||
{
|
|
||||||
m_IsMainFesZf = g_IsMainFes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //不控制
|
|
||||||
{
|
|
||||||
m_IsMainFesZf = g_IsMainFes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (g_IsMainFes != g_IsMainFesOld)
|
if (g_IsMainFes != g_IsMainFesOld)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_ptrCFesBase->m_ProtocolNum; i++)
|
for (int i = 0; i < m_ptrCFesBase->m_ProtocolNum; i++)
|
||||||
@ -159,7 +125,6 @@ void CFesChanManageThread::execute()
|
|||||||
g_IsMainFesOld = g_IsMainFes;
|
g_IsMainFesOld = g_IsMainFes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < (int)m_ptrCFesBase->m_vectCFesChanPtr.size(); i++)
|
for (i = 0; i < (int)m_ptrCFesBase->m_vectCFesChanPtr.size(); i++)
|
||||||
{
|
{
|
||||||
ptrMainFesChan = m_ptrCFesBase->m_vectCFesChanPtr[i];
|
ptrMainFesChan = m_ptrCFesBase->m_vectCFesChanPtr[i];
|
||||||
@ -284,8 +249,7 @@ void CFesChanManageThread::execute()
|
|||||||
ptrMainFesChan->m_CurrentChanIndex = 0;
|
ptrMainFesChan->m_CurrentChanIndex = 0;
|
||||||
}
|
}
|
||||||
//FES在主机状态下,需要打开所有通道
|
//FES在主机状态下,需要打开所有通道
|
||||||
//if (g_IsMainFes == true)
|
if(g_IsMainFes == true)
|
||||||
if ((m_IsMainFesZf == true)&&(g_IsMainFes == true))
|
|
||||||
{
|
{
|
||||||
CFesChanPtr ptrCurrentChan; //current CHAN数据区
|
CFesChanPtr ptrCurrentChan; //current CHAN数据区
|
||||||
ptrCurrentChan = m_ptrCFesBase->GetChanDataByChanNo(ChanNo);
|
ptrCurrentChan = m_ptrCFesBase->GetChanDataByChanNo(ChanNo);
|
||||||
@ -334,6 +298,8 @@ void CFesChanManageThread::execute()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -767,76 +733,3 @@ void CFesChanManageThread::NotifyExitSystem()
|
|||||||
}
|
}
|
||||||
LOGDEBUG("已通知%d个规约模块退出", count);
|
LOGDEBUG("已通知%d个规约模块退出", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief CFesChanManageThread::SetIsMainFesZf
|
|
||||||
*
|
|
||||||
* 每天随机把转发标志设置1小时为false.
|
|
||||||
*
|
|
||||||
* @param
|
|
||||||
*/
|
|
||||||
|
|
||||||
void CFesChanManageThread::SetIsMainFesZf()
|
|
||||||
{
|
|
||||||
int64 lMsec;
|
|
||||||
|
|
||||||
lMsec = getMonotonicMsec();
|
|
||||||
if (lMsec > m_ComDownStopMSec)//
|
|
||||||
{
|
|
||||||
m_ComDownOffSet = m_ComDownStepLowLimit + m_ComDownStep*m_ComDownStepCount;//当前偏移值
|
|
||||||
m_ComDownStepCount++;
|
|
||||||
m_ComDownStartMSec = lMsec + m_ComDownOffSet; //启动时间
|
|
||||||
m_ComDownStopMSec = m_ComDownStartMSec + m_ComDownKeepMsec; //停止时间
|
|
||||||
if (m_ComDownOffSet > m_ComDownStepHighLimit)
|
|
||||||
{
|
|
||||||
m_ComDownStepCount = 0;
|
|
||||||
m_ComDownOffSet = m_ComDownStepLowLimit;
|
|
||||||
}
|
|
||||||
LOGDEBUG("current=%lld m_ComDownOffSet=%lld m_ComDownStartMSec=%lld m_ComDownStopMSec=%lld", lMsec,m_ComDownOffSet, m_ComDownStartMSec, m_ComDownStopMSec);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((lMsec>m_ComDownStartMSec)&&(lMsec<m_ComDownStopMSec))
|
|
||||||
{
|
|
||||||
if (m_IsMainFesZf == true)
|
|
||||||
{
|
|
||||||
m_IsMainFesZf = false;
|
|
||||||
LOGDEBUG("g_IsMainFesZf change!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if((m_IsMainFesZf == true)&&(g_IsMainFes==true))
|
|
||||||
{
|
|
||||||
LOGDEBUG("g_IsMainFesZf recover!");
|
|
||||||
}
|
|
||||||
m_IsMainFesZf = g_IsMainFes;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CFesChanManageThread::ReadConfigParam()
|
|
||||||
{
|
|
||||||
CCommonConfigParse config;
|
|
||||||
int ivalue;
|
|
||||||
char strName[48];
|
|
||||||
|
|
||||||
//管理机全局参数默认配置
|
|
||||||
m_BreakDownFlag = 0;
|
|
||||||
if(config.load("../../data/fes/","fesConfig.xml")==iotFailed)
|
|
||||||
{
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(strName,"FESSYS");
|
|
||||||
if(config.getIntValue(strName,"chan_controlCom",ivalue) == iotSuccess)
|
|
||||||
{
|
|
||||||
m_BreakDownFlag = ivalue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_BreakDownFlag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return iotSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
#include "FesBase.h"
|
#include "FesBase.h"
|
||||||
#include "pub_sysinfo_api/SysInfoBase.h"
|
#include "pub_sysinfo_api/SysInfoBase.h"
|
||||||
#include "rdb_api/RdbTableMng.h"
|
#include "rdb_api/RdbTableMng.h"
|
||||||
#include "sys_dog_auth_api/DogAuthInterface.h"
|
|
||||||
|
|
||||||
class CFesChanManageThread : public iot_public::CTimerThreadBase
|
class CFesChanManageThread : public iot_public::CTimerThreadBase
|
||||||
{
|
{
|
||||||
@ -41,13 +40,9 @@ public:
|
|||||||
virtual void beforeQuit();
|
virtual void beforeQuit();
|
||||||
|
|
||||||
void NotifyExitSystem();
|
void NotifyExitSystem();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
iot_dbms::CRdbTableMngPtr m_ptrRdbTableMng;
|
iot_dbms::CRdbTableMngPtr m_ptrRdbTableMng;
|
||||||
iot_public::SRunAppInfo m_stRunAppInfo ;
|
iot_public::SRunAppInfo m_stRunAppInfo ;
|
||||||
iot_sys::CDogAuthInterfacePtr m_ptrDogAuth;
|
|
||||||
CFesBase *m_ptrCFesBase;
|
CFesBase *m_ptrCFesBase;
|
||||||
|
|
||||||
//设备离线监视相关变量
|
//设备离线监视相关变量
|
||||||
@ -58,22 +53,6 @@ private:
|
|||||||
|
|
||||||
void CheckChanStatus();
|
void CheckChanStatus();
|
||||||
|
|
||||||
//2022-09-28 thxiao 每天随机把转发标志设置1小时为false,让通信中断1小时
|
|
||||||
bool m_IsMainFesZf;
|
|
||||||
int64 m_ComDownMSec; //启动时间
|
|
||||||
int64 m_ComDownStepHighLimit; //最大偏移值
|
|
||||||
int64 m_ComDownStepLowLimit; //最小偏移值
|
|
||||||
int64 m_ComDownStep; //偏移值步长
|
|
||||||
int64 m_ComDownOffSet; //当前偏移值
|
|
||||||
int m_ComDownStepCount; //偏移值计数
|
|
||||||
int64 m_ComDownStartMSec; //启动时间
|
|
||||||
int64 m_ComDownStopMSec; //停止时间
|
|
||||||
int64 m_ComDownKeepMsec; //持续时间
|
|
||||||
int64 m_lastCheckDogTimes; //上传检查狗状态时间
|
|
||||||
void SetIsMainFesZf();
|
|
||||||
int m_BreakDownFlag;
|
|
||||||
int ReadConfigParam();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<CFesChanManageThread> CFesChanManageThreadPtr;
|
typedef boost::shared_ptr<CFesChanManageThread> CFesChanManageThreadPtr;
|
||||||
|
|||||||
@ -249,7 +249,7 @@ int CFesDataSyncThread::RtuDiAllResp()
|
|||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
|
|
||||||
count = m_ptrCFesBase->m_vectCFesRtuPtr.size();
|
count = static_cast<int>(m_ptrCFesBase->m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<count;i++)
|
for(i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
||||||
@ -328,7 +328,7 @@ int CFesDataSyncThread::RtuDDiAllResp()
|
|||||||
if (m_ptrCFesBase == NULL)
|
if (m_ptrCFesBase == NULL)
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
|
|
||||||
count = m_ptrCFesBase->m_vectCFesRtuPtr.size();
|
count = static_cast<int>(m_ptrCFesBase->m_vectCFesRtuPtr.size());
|
||||||
for (i = 0; i<count; i++)
|
for (i = 0; i<count; i++)
|
||||||
{
|
{
|
||||||
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
||||||
@ -389,12 +389,11 @@ int CFesDataSyncThread::RtuAiAllResp()
|
|||||||
{
|
{
|
||||||
int i,j,retNum,count;
|
int i,j,retNum,count;
|
||||||
CFesRtuPtr ptrCFesRtu;
|
CFesRtuPtr ptrCFesRtu;
|
||||||
CFesChanPtr pChan;
|
|
||||||
|
|
||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
|
|
||||||
count = m_ptrCFesBase->m_vectCFesRtuPtr.size();
|
count = static_cast<int>(m_ptrCFesBase->m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<count;i++)
|
for(i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
||||||
@ -469,7 +468,7 @@ int CFesDataSyncThread::RtuAccAllResp()
|
|||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
|
|
||||||
count = m_ptrCFesBase->m_vectCFesRtuPtr.size();
|
count = static_cast<int>(m_ptrCFesBase->m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<count;i++)
|
for(i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
||||||
@ -507,7 +506,7 @@ int CFesDataSyncThread::RtuAccAllResp()
|
|||||||
pRtuAccValue = m_pAccValue+j;
|
pRtuAccValue = m_pAccValue+j;
|
||||||
pAccValue = respPkg.add_stpivalue();
|
pAccValue = respPkg.add_stpivalue();
|
||||||
pAccValue->set_npointno(pRtuAccValue->PointNo);
|
pAccValue->set_npointno(pRtuAccValue->PointNo);
|
||||||
pAccValue->set_nvalue(pRtuAccValue->Value);
|
pAccValue->set_dvalue(pRtuAccValue->Value);
|
||||||
pAccValue->set_ustatus(pRtuAccValue->Status);
|
pAccValue->set_ustatus(pRtuAccValue->Status);
|
||||||
pAccValue->set_ultime(pRtuAccValue->time);
|
pAccValue->set_ultime(pRtuAccValue->time);
|
||||||
}
|
}
|
||||||
@ -545,7 +544,7 @@ int CFesDataSyncThread::RtuMiAllResp()
|
|||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
return iotFailed;
|
return iotFailed;
|
||||||
|
|
||||||
count = m_ptrCFesBase->m_vectCFesRtuPtr.size();
|
count = static_cast<int>(m_ptrCFesBase->m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<count;i++)
|
for(i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
ptrCFesRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
||||||
@ -638,7 +637,7 @@ int CFesDataSyncThread::RtuDiResp(const std::string &RecvStr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesDiValue diValue = respPkg.stdivalue(i);
|
const SFesDiValue &diValue = respPkg.stdivalue(i);
|
||||||
SFesFwChgDi RtuDiValue;
|
SFesFwChgDi RtuDiValue;
|
||||||
RtuDiValue.RemoteNo = diValue.npointno();
|
RtuDiValue.RemoteNo = diValue.npointno();
|
||||||
RtuDiValue.Value = diValue.nvalue();
|
RtuDiValue.Value = diValue.nvalue();
|
||||||
@ -659,7 +658,7 @@ int CFesDataSyncThread::RtuDiResp(const std::string &RecvStr)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesDiValue diValue = respPkg.stdivalue(i);
|
const SFesDiValue &diValue = respPkg.stdivalue(i);
|
||||||
pRtuDiValue = m_pDiValue + i;
|
pRtuDiValue = m_pDiValue + i;
|
||||||
pRtuDiValue->PointNo = diValue.npointno();
|
pRtuDiValue->PointNo = diValue.npointno();
|
||||||
pRtuDiValue->Value = diValue.nvalue();
|
pRtuDiValue->Value = diValue.nvalue();
|
||||||
@ -697,7 +696,7 @@ int CFesDataSyncThread::RtuDDiResp(const std::string &RecvStr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesDiValue diValue = respPkg.stdivalue(i);
|
const SFesDiValue &diValue = respPkg.stdivalue(i);
|
||||||
SFesFwChgDi RtuDiValue;
|
SFesFwChgDi RtuDiValue;
|
||||||
RtuDiValue.RemoteNo = diValue.npointno();
|
RtuDiValue.RemoteNo = diValue.npointno();
|
||||||
RtuDiValue.Value = diValue.nvalue();
|
RtuDiValue.Value = diValue.nvalue();
|
||||||
@ -740,13 +739,15 @@ int CFesDataSyncThread::RtuAiResp(const std::string &RecvStr)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesAiValue aiValue = respPkg.staivalue(i);
|
const SFesAiValue &aiValue = respPkg.staivalue(i);
|
||||||
SFesFwChgAi RtuAiValue;
|
SFesFwChgAi RtuAiValue;
|
||||||
RtuAiValue.RemoteNo = aiValue.npointno();
|
RtuAiValue.RemoteNo = aiValue.npointno();
|
||||||
RtuAiValue.Value = aiValue.fvalue();
|
RtuAiValue.Value = aiValue.fvalue();
|
||||||
RtuAiValue.Status = aiValue.ustatus();
|
RtuAiValue.Status = aiValue.ustatus();
|
||||||
RtuAiValue.time = aiValue.ultime();
|
RtuAiValue.time = aiValue.ultime();
|
||||||
ptrCFesRtu->UpdataFwAiValue(RtuAiValue);
|
//< 直接更新,因为这是从内存中同步过来的,也就是发送的已经是经过系数变换的
|
||||||
|
float fNewValue = 0.0f;
|
||||||
|
ptrCFesRtu->UpdataFwAiValue(RtuAiValue,fNewValue,eDirectUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -761,7 +762,7 @@ int CFesDataSyncThread::RtuAiResp(const std::string &RecvStr)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesAiValue aiValue = respPkg.staivalue(i);
|
const SFesAiValue &aiValue = respPkg.staivalue(i);
|
||||||
pRtuAiValue = m_pAiValue + i;
|
pRtuAiValue = m_pAiValue + i;
|
||||||
pRtuAiValue->PointNo = aiValue.npointno();
|
pRtuAiValue->PointNo = aiValue.npointno();
|
||||||
pRtuAiValue->Value = aiValue.fvalue();
|
pRtuAiValue->Value = aiValue.fvalue();
|
||||||
@ -804,15 +805,16 @@ int CFesDataSyncThread::RtuAccResp(const std::string &RecvStr)
|
|||||||
|
|
||||||
if (ptrCFesRtu->m_RtuProperty == CN_Fes_RTU_Forward)//2020-01-10 thxiao 增加转发数据同步
|
if (ptrCFesRtu->m_RtuProperty == CN_Fes_RTU_Forward)//2020-01-10 thxiao 增加转发数据同步
|
||||||
{
|
{
|
||||||
|
double dNewValue = 0.0;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesPiValue accValue = respPkg.stpivalue(i);
|
const SFesPiValue &accValue = respPkg.stpivalue(i);
|
||||||
SFesFwChgAcc RtuAccValue;
|
SFesFwChgAcc RtuAccValue;
|
||||||
RtuAccValue.RemoteNo = accValue.npointno();
|
RtuAccValue.RemoteNo = accValue.npointno();
|
||||||
RtuAccValue.Value = accValue.nvalue();
|
RtuAccValue.Value = accValue.dvalue();
|
||||||
RtuAccValue.Status = accValue.ustatus();
|
RtuAccValue.Status = accValue.ustatus();
|
||||||
RtuAccValue.time = accValue.ultime();
|
RtuAccValue.time = accValue.ultime();
|
||||||
ptrCFesRtu->UpdataFwAccValue(RtuAccValue);
|
ptrCFesRtu->UpdataFwAccValue(RtuAccValue,dNewValue,eDirectUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -827,10 +829,10 @@ int CFesDataSyncThread::RtuAccResp(const std::string &RecvStr)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesPiValue accValue = respPkg.stpivalue(i);
|
const SFesPiValue &accValue = respPkg.stpivalue(i);
|
||||||
pRtuAccValue = m_pAccValue + i;
|
pRtuAccValue = m_pAccValue + i;
|
||||||
pRtuAccValue->PointNo = accValue.npointno();
|
pRtuAccValue->PointNo = accValue.npointno();
|
||||||
pRtuAccValue->Value = accValue.nvalue();
|
pRtuAccValue->Value = accValue.dvalue();
|
||||||
pRtuAccValue->Status = accValue.ustatus();
|
pRtuAccValue->Status = accValue.ustatus();
|
||||||
pRtuAccValue->time = accValue.ultime();
|
pRtuAccValue->time = accValue.ultime();
|
||||||
}
|
}
|
||||||
@ -865,15 +867,16 @@ int CFesDataSyncThread::RtuMiResp(const std::string &RecvStr)
|
|||||||
|
|
||||||
if (ptrCFesRtu->m_RtuProperty == CN_Fes_RTU_Forward)//2020-01-10 thxiao 增加转发数据同步
|
if (ptrCFesRtu->m_RtuProperty == CN_Fes_RTU_Forward)//2020-01-10 thxiao 增加转发数据同步
|
||||||
{
|
{
|
||||||
|
int nNewValue = 0;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesMiValue miValue = respPkg.stmivalue(i);
|
const SFesMiValue &miValue = respPkg.stmivalue(i);
|
||||||
SFesFwChgMi RtuMiValue;
|
SFesFwChgMi RtuMiValue;
|
||||||
RtuMiValue.RemoteNo = miValue.npointno();
|
RtuMiValue.RemoteNo = miValue.npointno();
|
||||||
RtuMiValue.Value = miValue.nvalue();
|
RtuMiValue.Value = miValue.nvalue();
|
||||||
RtuMiValue.Status = miValue.ustatus();
|
RtuMiValue.Status = miValue.ustatus();
|
||||||
RtuMiValue.time = miValue.ultime();
|
RtuMiValue.time = miValue.ultime();
|
||||||
ptrCFesRtu->UpdataFwMiValue(RtuMiValue);
|
ptrCFesRtu->UpdataFwMiValue(RtuMiValue,nNewValue,eDirectUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -888,7 +891,7 @@ int CFesDataSyncThread::RtuMiResp(const std::string &RecvStr)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
SFesMiValue miValue = respPkg.stmivalue(i);
|
const SFesMiValue &miValue = respPkg.stmivalue(i);
|
||||||
pRtuMiValue = m_pMiValue + i;
|
pRtuMiValue = m_pMiValue + i;
|
||||||
pRtuMiValue->PointNo = miValue.npointno();
|
pRtuMiValue->PointNo = miValue.npointno();
|
||||||
pRtuMiValue->Value = miValue.nvalue();
|
pRtuMiValue->Value = miValue.nvalue();
|
||||||
@ -918,7 +921,7 @@ void CFesDataSyncThread::SendRtuDataReq()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
rtuNo = -1;
|
rtuNo = -1;
|
||||||
count = m_ptrCFesBase->m_vectCFesRtuPtr.size();
|
count = static_cast<int>(m_ptrCFesBase->m_vectCFesRtuPtr.size());
|
||||||
for(i=0;i<count;i++)
|
for(i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
pRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
pRtu = m_ptrCFesBase->m_vectCFesRtuPtr[i];
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void CFesForwarding::GetRdbFwAiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
vecFwAiColumn.push_back("res_para_int5");
|
vecFwAiColumn.push_back("res_para_int5");
|
||||||
vecFwAiColumn.push_back("res_para_int6");
|
vecFwAiColumn.push_back("res_para_int6");
|
||||||
vecFwAiColumn.push_back("res_para_int7");
|
vecFwAiColumn.push_back("res_para_int7");
|
||||||
vecFwAiColumn.push_back("res_para_str64");
|
vecFwAiColumn.push_back("res_para_str1");
|
||||||
vecFwAiColumn.push_back("src_type");
|
vecFwAiColumn.push_back("src_type");
|
||||||
|
|
||||||
ret = RdbFwAiTable.open(m_strAppLabel.c_str(),RT_FES_FW_AI_TBL);
|
ret = RdbFwAiTable.open(m_strAppLabel.c_str(),RT_FES_FW_AI_TBL);
|
||||||
@ -84,8 +84,8 @@ void CFesForwarding::GetRdbFwAiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwAiPoints = 0;
|
RtuPtr->m_MaxFwAiPoints = 0;
|
||||||
count = VecFwAiParam.size();
|
count = static_cast<int>(VecFwAiParam.size());
|
||||||
//LOGDEBUG("RTU%d VecFwAiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
// LOGINFO("RTU%d VecFwAiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxFwAiPoints = VecFwAiParam[count-1].RemoteNo +1;
|
RtuPtr->m_MaxFwAiPoints = VecFwAiParam[count-1].RemoteNo +1;
|
||||||
@ -107,10 +107,10 @@ void CFesForwarding::GetRdbFwAiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
pFwAi->FesRtuNo = VecFwAiParam[j].FesRtuNo; //采集rtu号
|
pFwAi->FesRtuNo = VecFwAiParam[j].FesRtuNo; //采集rtu号
|
||||||
pFwAi->FesPointNo = VecFwAiParam[j].FesPointNo; //采集点号
|
pFwAi->FesPointNo = VecFwAiParam[j].FesPointNo; //采集点号
|
||||||
pFwAi->DpSeqNo = VecFwAiParam[j].DpSeqNo; //远动序号
|
pFwAi->DpSeqNo = VecFwAiParam[j].DpSeqNo; //远动序号
|
||||||
pFwAi->Coeff = (float)VecFwAiParam[j].Coeff; //系数
|
pFwAi->Coeff = VecFwAiParam[j].Coeff; //系数
|
||||||
pFwAi->Base = (float)VecFwAiParam[j].Base; //修正值
|
pFwAi->Base = VecFwAiParam[j].Base; //修正值
|
||||||
pFwAi->DeadBandType = (float)VecFwAiParam[j].DeadBandType;
|
pFwAi->DeadBandType = VecFwAiParam[j].DeadBandType;
|
||||||
pFwAi->DeadBand = (float)VecFwAiParam[j].DeadBand; //死区值
|
pFwAi->DeadBand = VecFwAiParam[j].DeadBand; //死区值
|
||||||
pFwAi->Property = VecFwAiParam[j].Property; //属性
|
pFwAi->Property = VecFwAiParam[j].Property; //属性
|
||||||
pFwAi->SrcLocationID = VecFwAiParam[j].SrcLocationID; //所属厂站
|
pFwAi->SrcLocationID = VecFwAiParam[j].SrcLocationID; //所属厂站
|
||||||
pFwAi->SrcSubSystem = VecFwAiParam[j].SrcSubSystem; //所属专业
|
pFwAi->SrcSubSystem = VecFwAiParam[j].SrcSubSystem; //所属专业
|
||||||
@ -121,11 +121,13 @@ void CFesForwarding::GetRdbFwAiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
pFwAi->ResParam5 = VecFwAiParam[j].ResParam5; //备用参数1
|
pFwAi->ResParam5 = VecFwAiParam[j].ResParam5; //备用参数1
|
||||||
pFwAi->ResParam6 = VecFwAiParam[j].ResParam6; //备用参数1
|
pFwAi->ResParam6 = VecFwAiParam[j].ResParam6; //备用参数1
|
||||||
pFwAi->ResParam7 = VecFwAiParam[j].ResParam7; //备用参数1
|
pFwAi->ResParam7 = VecFwAiParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwAi->StrParam, VecFwAiParam[j].StrParam);
|
strcpy(pFwAi->szResParam1, VecFwAiParam[j].szResParam1);
|
||||||
pFwAi->SrcType = VecFwAiParam[j].SrcType; //备用参数1
|
pFwAi->SrcType = VecFwAiParam[j].SrcType; //备用参数1
|
||||||
pFwAi->Used=1; //点有效标志
|
pFwAi->Used=1; //点有效标志
|
||||||
//LOGDEBUG("@@@@@@@@@@@@ RtuNo:%d TagName:%s DPTagName:%s Desc:%s SrcType:%d", RtuPtr->m_Param.RtuNo, pFwAi->TagName, pFwAi->DPTagName, pFwAi->PointDesc, pFwAi->SrcType)
|
//LOGDEBUG("@@@@@@@@@@@@ RtuNo:%d TagName:%s DPTagName:%s Desc:%s SrcType:%d", RtuPtr->m_Param.RtuNo, pFwAi->TagName, pFwAi->DPTagName, pFwAi->PointDesc, pFwAi->SrcType)
|
||||||
|
|
||||||
|
// 根据死区类型计算实际的死区值,避免运行时每次都判断死区类型
|
||||||
|
UpdateDeadBandValue(pFwAi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -182,7 +184,7 @@ void CFesForwarding::GetRdbFwSDiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabe
|
|||||||
vecFwDiColumn.push_back("res_para_int5");
|
vecFwDiColumn.push_back("res_para_int5");
|
||||||
vecFwDiColumn.push_back("res_para_int6");
|
vecFwDiColumn.push_back("res_para_int6");
|
||||||
vecFwDiColumn.push_back("res_para_int7");
|
vecFwDiColumn.push_back("res_para_int7");
|
||||||
vecFwDiColumn.push_back("res_para_str64");
|
vecFwDiColumn.push_back("res_para_str1");
|
||||||
vecFwDiColumn.push_back("src_type");
|
vecFwDiColumn.push_back("src_type");
|
||||||
ret = RdbFwDiTable.open(m_strAppLabel.c_str(), RT_FES_FW_SDI_TBL);
|
ret = RdbFwDiTable.open(m_strAppLabel.c_str(), RT_FES_FW_SDI_TBL);
|
||||||
if(ret==false)
|
if(ret==false)
|
||||||
@ -203,7 +205,7 @@ void CFesForwarding::GetRdbFwSDiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwDiPoints = 0;
|
RtuPtr->m_MaxFwDiPoints = 0;
|
||||||
count = VecFwDiParam.size();
|
count = static_cast<int>(VecFwDiParam.size());
|
||||||
//LOGDEBUG("RTU%d VecFwDiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
//LOGDEBUG("RTU%d VecFwDiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
@ -236,7 +238,7 @@ void CFesForwarding::GetRdbFwSDiTable(CFesRtuPtr RtuPtr,std::string m_strAppLabe
|
|||||||
pFwDi->ResParam5 = VecFwDiParam[j].ResParam5; //备用参数1
|
pFwDi->ResParam5 = VecFwDiParam[j].ResParam5; //备用参数1
|
||||||
pFwDi->ResParam6 = VecFwDiParam[j].ResParam6; //备用参数1
|
pFwDi->ResParam6 = VecFwDiParam[j].ResParam6; //备用参数1
|
||||||
pFwDi->ResParam7 = VecFwDiParam[j].ResParam7; //备用参数1
|
pFwDi->ResParam7 = VecFwDiParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwDi->StrParam, VecFwDiParam[j].StrParam);
|
strcpy(pFwDi->szResParam1, VecFwDiParam[j].szResParam1);
|
||||||
pFwDi->SrcType = VecFwDiParam[j].SrcType; //备用参数1
|
pFwDi->SrcType = VecFwDiParam[j].SrcType; //备用参数1
|
||||||
pFwDi->DORemoteNo = -1;
|
pFwDi->DORemoteNo = -1;
|
||||||
pFwDi->Used = 1; //点有效标志
|
pFwDi->Used = 1; //点有效标志
|
||||||
@ -299,7 +301,7 @@ void CFesForwarding::GetRdbFwDDiTable(CFesRtuPtr RtuPtr, std::string m_strAppLab
|
|||||||
vecFwDiColumn.push_back("res_para_int5");
|
vecFwDiColumn.push_back("res_para_int5");
|
||||||
vecFwDiColumn.push_back("res_para_int6");
|
vecFwDiColumn.push_back("res_para_int6");
|
||||||
vecFwDiColumn.push_back("res_para_int7");
|
vecFwDiColumn.push_back("res_para_int7");
|
||||||
vecFwDiColumn.push_back("res_para_str64");
|
vecFwDiColumn.push_back("res_para_str1");
|
||||||
vecFwDiColumn.push_back("src_type");
|
vecFwDiColumn.push_back("src_type");
|
||||||
ret = RdbFwDiTable.open(m_strAppLabel.c_str(), RT_FES_FW_DDI_TBL);
|
ret = RdbFwDiTable.open(m_strAppLabel.c_str(), RT_FES_FW_DDI_TBL);
|
||||||
if (ret == false)
|
if (ret == false)
|
||||||
@ -320,7 +322,7 @@ void CFesForwarding::GetRdbFwDDiTable(CFesRtuPtr RtuPtr, std::string m_strAppLab
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwDDiPoints = 0;
|
RtuPtr->m_MaxFwDDiPoints = 0;
|
||||||
count = VecFwDiParam.size();
|
count = static_cast<int>(VecFwDiParam.size());
|
||||||
//LOGDEBUG("RTU%d VecFwDiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
//LOGDEBUG("RTU%d VecFwDiParam.size():%d",RtuPtr->m_Param.RtuNo,count);
|
||||||
if (count>0)
|
if (count>0)
|
||||||
{
|
{
|
||||||
@ -353,7 +355,7 @@ void CFesForwarding::GetRdbFwDDiTable(CFesRtuPtr RtuPtr, std::string m_strAppLab
|
|||||||
pFwDi->ResParam5 = VecFwDiParam[j].ResParam5; //备用参数1
|
pFwDi->ResParam5 = VecFwDiParam[j].ResParam5; //备用参数1
|
||||||
pFwDi->ResParam6 = VecFwDiParam[j].ResParam6; //备用参数1
|
pFwDi->ResParam6 = VecFwDiParam[j].ResParam6; //备用参数1
|
||||||
pFwDi->ResParam7 = VecFwDiParam[j].ResParam7; //备用参数1
|
pFwDi->ResParam7 = VecFwDiParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwDi->StrParam, VecFwDiParam[j].StrParam);
|
strcpy(pFwDi->szResParam1, VecFwDiParam[j].szResParam1);
|
||||||
pFwDi->SrcType = VecFwDiParam[j].SrcType; //备用参数1
|
pFwDi->SrcType = VecFwDiParam[j].SrcType; //备用参数1
|
||||||
pFwDi->Used = 1; //点有效标志
|
pFwDi->Used = 1; //点有效标志
|
||||||
// RtuNum = 0;
|
// RtuNum = 0;
|
||||||
@ -417,7 +419,7 @@ void CFesForwarding::GetRdbFwAccTable(CFesRtuPtr RtuPtr,std::string m_strAppLabe
|
|||||||
vecFwAccColumn.push_back("res_para_int5");
|
vecFwAccColumn.push_back("res_para_int5");
|
||||||
vecFwAccColumn.push_back("res_para_int6");
|
vecFwAccColumn.push_back("res_para_int6");
|
||||||
vecFwAccColumn.push_back("res_para_int7");
|
vecFwAccColumn.push_back("res_para_int7");
|
||||||
vecFwAccColumn.push_back("res_para_str64");
|
vecFwAccColumn.push_back("res_para_str1");
|
||||||
vecFwAccColumn.push_back("src_type");
|
vecFwAccColumn.push_back("src_type");
|
||||||
|
|
||||||
ret = RdbFwAccTable.open(m_strAppLabel.c_str(),RT_FES_FW_ACC_TBL);
|
ret = RdbFwAccTable.open(m_strAppLabel.c_str(),RT_FES_FW_ACC_TBL);
|
||||||
@ -440,7 +442,7 @@ void CFesForwarding::GetRdbFwAccTable(CFesRtuPtr RtuPtr,std::string m_strAppLabe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwAccPoints = 0;
|
RtuPtr->m_MaxFwAccPoints = 0;
|
||||||
count = VecFwAccParam.size();
|
count = static_cast<int>(VecFwAccParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxFwAccPoints = VecFwAccParam[count-1].RemoteNo +1;
|
RtuPtr->m_MaxFwAccPoints = VecFwAccParam[count-1].RemoteNo +1;
|
||||||
@ -475,7 +477,7 @@ void CFesForwarding::GetRdbFwAccTable(CFesRtuPtr RtuPtr,std::string m_strAppLabe
|
|||||||
pFwAcc->ResParam5 = VecFwAccParam[j].ResParam5; //备用参数1
|
pFwAcc->ResParam5 = VecFwAccParam[j].ResParam5; //备用参数1
|
||||||
pFwAcc->ResParam6 = VecFwAccParam[j].ResParam6; //备用参数1
|
pFwAcc->ResParam6 = VecFwAccParam[j].ResParam6; //备用参数1
|
||||||
pFwAcc->ResParam7 = VecFwAccParam[j].ResParam7; //备用参数1
|
pFwAcc->ResParam7 = VecFwAccParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwAcc->StrParam, VecFwAccParam[j].StrParam);
|
strcpy(pFwAcc->szResParam1, VecFwAccParam[j].szResParam1);
|
||||||
pFwAcc->SrcType = VecFwAccParam[j].SrcType; //备用参数1
|
pFwAcc->SrcType = VecFwAccParam[j].SrcType; //备用参数1
|
||||||
pFwAcc->Used = 1; //点有效标志
|
pFwAcc->Used = 1; //点有效标志
|
||||||
}
|
}
|
||||||
@ -536,7 +538,7 @@ void CFesForwarding::GetRdbFwMiTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
vecFwMiColumn.push_back("res_para_int5");
|
vecFwMiColumn.push_back("res_para_int5");
|
||||||
vecFwMiColumn.push_back("res_para_int6");
|
vecFwMiColumn.push_back("res_para_int6");
|
||||||
vecFwMiColumn.push_back("res_para_int7");
|
vecFwMiColumn.push_back("res_para_int7");
|
||||||
vecFwMiColumn.push_back("res_para_str64");
|
vecFwMiColumn.push_back("res_para_str1");
|
||||||
vecFwMiColumn.push_back("src_type");
|
vecFwMiColumn.push_back("src_type");
|
||||||
|
|
||||||
ret = RdbFwMiTable.open(m_strAppLabel.c_str(), RT_FES_FW_MI_TBL);
|
ret = RdbFwMiTable.open(m_strAppLabel.c_str(), RT_FES_FW_MI_TBL);
|
||||||
@ -558,7 +560,7 @@ void CFesForwarding::GetRdbFwMiTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwMiPoints = 0;
|
RtuPtr->m_MaxFwMiPoints = 0;
|
||||||
count = VecFwMiParam.size();
|
count = static_cast<int>(VecFwMiParam.size());
|
||||||
if (count>0)
|
if (count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxFwMiPoints = VecFwMiParam[count - 1].RemoteNo + 1;
|
RtuPtr->m_MaxFwMiPoints = VecFwMiParam[count - 1].RemoteNo + 1;
|
||||||
@ -593,7 +595,7 @@ void CFesForwarding::GetRdbFwMiTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
pFwMi->ResParam5 = VecFwMiParam[j].ResParam5; //备用参数1
|
pFwMi->ResParam5 = VecFwMiParam[j].ResParam5; //备用参数1
|
||||||
pFwMi->ResParam6 = VecFwMiParam[j].ResParam6; //备用参数1
|
pFwMi->ResParam6 = VecFwMiParam[j].ResParam6; //备用参数1
|
||||||
pFwMi->ResParam7 = VecFwMiParam[j].ResParam7; //备用参数1
|
pFwMi->ResParam7 = VecFwMiParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwMi->StrParam, VecFwMiParam[j].StrParam);
|
strcpy(pFwMi->szResParam1, VecFwMiParam[j].szResParam1);
|
||||||
pFwMi->SrcType = VecFwMiParam[j].SrcType; //备用参数1
|
pFwMi->SrcType = VecFwMiParam[j].SrcType; //备用参数1
|
||||||
pFwMi->Used = 1; //点有效标志
|
pFwMi->Used = 1; //点有效标志
|
||||||
}
|
}
|
||||||
@ -654,7 +656,7 @@ void CFesForwarding::GetRdbFwAoTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
vecFwAoColumn.push_back("res_para_int5");
|
vecFwAoColumn.push_back("res_para_int5");
|
||||||
vecFwAoColumn.push_back("res_para_int6");
|
vecFwAoColumn.push_back("res_para_int6");
|
||||||
vecFwAoColumn.push_back("res_para_int7");
|
vecFwAoColumn.push_back("res_para_int7");
|
||||||
vecFwAoColumn.push_back("res_para_str64");
|
vecFwAoColumn.push_back("res_para_str1");
|
||||||
vecFwAoColumn.push_back("src_type");
|
vecFwAoColumn.push_back("src_type");
|
||||||
|
|
||||||
ret = RdbFwAoTable.open(m_strAppLabel.c_str(),RT_FES_FW_AO_TBL);
|
ret = RdbFwAoTable.open(m_strAppLabel.c_str(),RT_FES_FW_AO_TBL);
|
||||||
@ -675,7 +677,7 @@ void CFesForwarding::GetRdbFwAoTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwAoPoints = 0;
|
RtuPtr->m_MaxFwAoPoints = 0;
|
||||||
count = VecFwAoParam.size();
|
count = static_cast<int>(VecFwAoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxFwAoPoints = VecFwAoParam[count-1].RemoteNo +1;
|
RtuPtr->m_MaxFwAoPoints = VecFwAoParam[count-1].RemoteNo +1;
|
||||||
@ -709,7 +711,7 @@ void CFesForwarding::GetRdbFwAoTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
pFwAo->ResParam5 = VecFwAoParam[j].ResParam5; //备用参数1
|
pFwAo->ResParam5 = VecFwAoParam[j].ResParam5; //备用参数1
|
||||||
pFwAo->ResParam6 = VecFwAoParam[j].ResParam6; //备用参数1
|
pFwAo->ResParam6 = VecFwAoParam[j].ResParam6; //备用参数1
|
||||||
pFwAo->ResParam7 = VecFwAoParam[j].ResParam7; //备用参数1
|
pFwAo->ResParam7 = VecFwAoParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwAo->StrParam, VecFwAoParam[j].StrParam);
|
strcpy(pFwAo->szResParam1, VecFwAoParam[j].szResParam1);
|
||||||
pFwAo->SrcType = VecFwAoParam[j].SrcType; //备用参数1
|
pFwAo->SrcType = VecFwAoParam[j].SrcType; //备用参数1
|
||||||
|
|
||||||
pFwAo->Used=1; //点有效标志
|
pFwAo->Used=1; //点有效标志
|
||||||
@ -771,7 +773,7 @@ void CFesForwarding::GetRdbFwDoTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
vecFwDoColumn.push_back("res_para_int5");
|
vecFwDoColumn.push_back("res_para_int5");
|
||||||
vecFwDoColumn.push_back("res_para_int6");
|
vecFwDoColumn.push_back("res_para_int6");
|
||||||
vecFwDoColumn.push_back("res_para_int7");
|
vecFwDoColumn.push_back("res_para_int7");
|
||||||
vecFwDoColumn.push_back("res_para_str64");
|
vecFwDoColumn.push_back("res_para_str1");
|
||||||
vecFwDoColumn.push_back("src_type");
|
vecFwDoColumn.push_back("src_type");
|
||||||
|
|
||||||
ret = RdbFwDoTable.open(m_strAppLabel.c_str(),RT_FES_FW_DO_TBL);
|
ret = RdbFwDoTable.open(m_strAppLabel.c_str(),RT_FES_FW_DO_TBL);
|
||||||
@ -792,7 +794,7 @@ void CFesForwarding::GetRdbFwDoTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwDoPoints = 0;
|
RtuPtr->m_MaxFwDoPoints = 0;
|
||||||
count = VecFwDoParam.size();
|
count = static_cast<int>(VecFwDoParam.size());
|
||||||
if(count>0)
|
if(count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxFwDoPoints = VecFwDoParam[count-1].RemoteNo +1;
|
RtuPtr->m_MaxFwDoPoints = VecFwDoParam[count-1].RemoteNo +1;
|
||||||
@ -829,7 +831,7 @@ void CFesForwarding::GetRdbFwDoTable(CFesRtuPtr RtuPtr,std::string m_strAppLabel
|
|||||||
pFwDo->ResParam5 = VecFwDoParam[j].ResParam5; //备用参数1
|
pFwDo->ResParam5 = VecFwDoParam[j].ResParam5; //备用参数1
|
||||||
pFwDo->ResParam6 = VecFwDoParam[j].ResParam6; //备用参数1
|
pFwDo->ResParam6 = VecFwDoParam[j].ResParam6; //备用参数1
|
||||||
pFwDo->ResParam7 = VecFwDoParam[j].ResParam7; //备用参数1
|
pFwDo->ResParam7 = VecFwDoParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwDo->StrParam, VecFwDoParam[j].StrParam);
|
strcpy(pFwDo->szResParam1, VecFwDoParam[j].szResParam1);
|
||||||
pFwDo->SrcType = VecFwDoParam[j].SrcType; //备用参数1
|
pFwDo->SrcType = VecFwDoParam[j].SrcType; //备用参数1
|
||||||
pFwDo->DIRemoteNo = -1;
|
pFwDo->DIRemoteNo = -1;
|
||||||
pFwDo->WfBlockedTimeout=0; //五防闭锁时间
|
pFwDo->WfBlockedTimeout=0; //五防闭锁时间
|
||||||
@ -891,7 +893,7 @@ void CFesForwarding::GetRdbFwMoTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
vecFwMoColumn.push_back("res_para_int5");
|
vecFwMoColumn.push_back("res_para_int5");
|
||||||
vecFwMoColumn.push_back("res_para_int6");
|
vecFwMoColumn.push_back("res_para_int6");
|
||||||
vecFwMoColumn.push_back("res_para_int7");
|
vecFwMoColumn.push_back("res_para_int7");
|
||||||
vecFwMoColumn.push_back("res_para_str64");
|
vecFwMoColumn.push_back("res_para_str1");
|
||||||
vecFwMoColumn.push_back("src_type");
|
vecFwMoColumn.push_back("src_type");
|
||||||
|
|
||||||
ret = RdbFwMoTable.open(m_strAppLabel.c_str(), RT_FES_FW_MO_TBL);
|
ret = RdbFwMoTable.open(m_strAppLabel.c_str(), RT_FES_FW_MO_TBL);
|
||||||
@ -912,7 +914,7 @@ void CFesForwarding::GetRdbFwMoTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RtuPtr->m_MaxFwMoPoints = 0;
|
RtuPtr->m_MaxFwMoPoints = 0;
|
||||||
count = VecFwMoParam.size();
|
count = static_cast<int>(VecFwMoParam.size());
|
||||||
if (count>0)
|
if (count>0)
|
||||||
{
|
{
|
||||||
RtuPtr->m_MaxFwMoPoints = VecFwMoParam[count - 1].RemoteNo + 1;
|
RtuPtr->m_MaxFwMoPoints = VecFwMoParam[count - 1].RemoteNo + 1;
|
||||||
@ -944,7 +946,7 @@ void CFesForwarding::GetRdbFwMoTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
pFwMo->ResParam5 = VecFwMoParam[j].ResParam5; //备用参数1
|
pFwMo->ResParam5 = VecFwMoParam[j].ResParam5; //备用参数1
|
||||||
pFwMo->ResParam6 = VecFwMoParam[j].ResParam6; //备用参数1
|
pFwMo->ResParam6 = VecFwMoParam[j].ResParam6; //备用参数1
|
||||||
pFwMo->ResParam7 = VecFwMoParam[j].ResParam7; //备用参数1
|
pFwMo->ResParam7 = VecFwMoParam[j].ResParam7; //备用参数1
|
||||||
strcpy(pFwMo->StrParam, VecFwMoParam[j].StrParam);
|
strcpy(pFwMo->szResParam1, VecFwMoParam[j].szResParam1);
|
||||||
pFwMo->SrcType = VecFwMoParam[j].SrcType; //备用参数1
|
pFwMo->SrcType = VecFwMoParam[j].SrcType; //备用参数1
|
||||||
|
|
||||||
pFwMo->Used = 1; //点有效标志
|
pFwMo->Used = 1; //点有效标志
|
||||||
@ -971,6 +973,25 @@ void CFesForwarding::GetRdbFwMoTable(CFesRtuPtr RtuPtr, std::string m_strAppLabe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFesForwarding::UpdateDeadBandValue(SFesFwAi *pFwAi)
|
||||||
|
{
|
||||||
|
switch (pFwAi->DeadBandType) {
|
||||||
|
case CN_FesDeadbandType_Abs:
|
||||||
|
pFwAi->RealDeadBandValue = static_cast<float>(pFwAi->DeadBand);
|
||||||
|
break;
|
||||||
|
case CN_FesDeadbandType_Percent: //< 因为转发配置中没有上下限值,所以暂时不支持百分比死区类型
|
||||||
|
case CN_FesDeadbandType_None:
|
||||||
|
default:
|
||||||
|
pFwAi->RealDeadBandValue = CN_FesFwAIChangeScale;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pFwAi->RealDeadBandValue < CN_FesFwAIChangeScale)
|
||||||
|
{
|
||||||
|
pFwAi->RealDeadBandValue = CN_FesFwAIChangeScale; //< 避免配置负数,同时承担浮点数的精度判断
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFesForwarding::InitFesConllectRtu(CFesRtuPtr RtuPtr,std::string m_strAppLabel)
|
void CFesForwarding::InitFesConllectRtu(CFesRtuPtr RtuPtr,std::string m_strAppLabel)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -62,6 +62,12 @@ private:
|
|||||||
*/
|
*/
|
||||||
void GetRdbFwMoTable(CFesRtuPtr RtuPtr, std::string m_strAppLabel);
|
void GetRdbFwMoTable(CFesRtuPtr RtuPtr, std::string m_strAppLabel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesBase::UpdateDeadBandValue
|
||||||
|
* 根据死区类型计算出实际的死区值,避免运行时每次判断死区类型
|
||||||
|
* @return 无
|
||||||
|
*/
|
||||||
|
void UpdateDeadBandValue(SFesFwAi *pFwAi);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -68,31 +68,31 @@ void CFesFwRxControlCmdThread::execute()
|
|||||||
switch (nMsgType)
|
switch (nMsgType)
|
||||||
{
|
{
|
||||||
case MT_FESFW_DO_REQ:
|
case MT_FESFW_DO_REQ:
|
||||||
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxDoReq(CtrlPkg);
|
RxDoReq(CtrlPkg);
|
||||||
break;
|
break;
|
||||||
case MT_FESFW_AO_REQ:
|
case MT_FESFW_AO_REQ:
|
||||||
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxAoReq(CtrlPkg);
|
RxAoReq(CtrlPkg);
|
||||||
break;
|
break;
|
||||||
case MT_FESFW_MO_REQ:
|
case MT_FESFW_MO_REQ:
|
||||||
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxMoReq(CtrlPkg);
|
RxMoReq(CtrlPkg);
|
||||||
break;
|
break;
|
||||||
case MT_FESFW_DO_RESP:
|
case MT_FESFW_DO_RESP:
|
||||||
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxDoResp(CtrlPkg);
|
RxDoResp(CtrlPkg);
|
||||||
break;
|
break;
|
||||||
case MT_FESFW_AO_RESP:
|
case MT_FESFW_AO_RESP:
|
||||||
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxAoResp(CtrlPkg);
|
RxAoResp(CtrlPkg);
|
||||||
break;
|
break;
|
||||||
case MT_FESFW_MO_RESP:
|
case MT_FESFW_MO_RESP:
|
||||||
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(CtrlPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxMoResp(CtrlPkg);
|
RxMoResp(CtrlPkg);
|
||||||
break;
|
break;
|
||||||
case MT_FESWUFANG_STATUS_REPORT:
|
case MT_FESWUFANG_STATUS_REPORT:
|
||||||
if(StatusPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if(StatusPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
RxWuFangStatusReport(StatusPkg);
|
RxWuFangStatusReport(StatusPkg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
@history
|
@history
|
||||||
2019-10-17 thxiao 由主机状态=>备机状态,停止部分线程,同时对应的线程也做了数据清理等处理
|
2019-10-17 thxiao 由主机状态=>备机状态,停止部分线程,同时对应的线程也做了数据清理等处理
|
||||||
2020-02-25 thxiao 在非主非备的情况下(开门狗叫),FES按备机方式处理
|
2020-02-25 thxiao 在非主非备的情况下(开门狗叫),FES按备机方式处理
|
||||||
2023-11-25 thxiao 转发数据处理改为分多个线程处理数据
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include "FesRedundantManage.h"
|
#include "FesRedundantManage.h"
|
||||||
@ -93,10 +92,6 @@ void CFesRedundantManage::Init(SRedundantManageThreadParam &Param )
|
|||||||
m_ptrFesFwTxControlCmdThread = Param.ptrFesFwTxControlCmdThread;
|
m_ptrFesFwTxControlCmdThread = Param.ptrFesFwTxControlCmdThread;
|
||||||
m_ptrFesRxFesDataThread = Param.ptrFesRxFesDataThread;
|
m_ptrFesRxFesDataThread = Param.ptrFesRxFesDataThread;
|
||||||
m_ptrFesRxDPDataThread = Param.ptrFesRxDPDataThread;
|
m_ptrFesRxDPDataThread = Param.ptrFesRxDPDataThread;
|
||||||
m_ptrAnaWorkThread = Param.ptrAnaWorkThread;
|
|
||||||
m_ptrDigWorkThread = Param.ptrDigWorkThread;
|
|
||||||
m_ptrAccWorkThread = Param.ptrAccWorkThread;
|
|
||||||
m_ptrMixWorkThread = Param.ptrMixWorkThread;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -152,22 +147,6 @@ void CFesRedundantManage::ResumeThread()
|
|||||||
m_ptrFesRxDPDataThread->resume();
|
m_ptrFesRxDPDataThread->resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ptrAnaWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrAnaWorkThread->resume();
|
|
||||||
}
|
|
||||||
if (m_ptrDigWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrDigWorkThread->resume();
|
|
||||||
}
|
|
||||||
if (m_ptrAccWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrAccWorkThread->resume();
|
|
||||||
}
|
|
||||||
if (m_ptrMixWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrMixWorkThread->resume();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -236,21 +215,4 @@ void CFesRedundantManage::SuspendThread()
|
|||||||
m_ptrFesRxDPDataThread->setSlave();
|
m_ptrFesRxDPDataThread->setSlave();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ptrAnaWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrAnaWorkThread->suspend();
|
|
||||||
}
|
|
||||||
if (m_ptrDigWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrDigWorkThread->suspend();
|
|
||||||
}
|
|
||||||
if (m_ptrAccWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrAccWorkThread->suspend();
|
|
||||||
}
|
|
||||||
if (m_ptrMixWorkThread != NULL)
|
|
||||||
{
|
|
||||||
m_ptrMixWorkThread->suspend();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,10 +19,6 @@
|
|||||||
#include "FesFwTxControlCmdThread.h"
|
#include "FesFwTxControlCmdThread.h"
|
||||||
#include "FesRxFesDataThread.h"
|
#include "FesRxFesDataThread.h"
|
||||||
#include "FesRxDPDataThread.h"
|
#include "FesRxDPDataThread.h"
|
||||||
#include "AnaWorkThread.h"
|
|
||||||
#include "DigWorkThread.h"
|
|
||||||
#include "AccWorkThread.h"
|
|
||||||
#include "MixWorkThread.h"
|
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
CFesRxDataUpDateThreadPtr ptrFesRxDataUpDateThread;
|
CFesRxDataUpDateThreadPtr ptrFesRxDataUpDateThread;
|
||||||
@ -37,10 +33,6 @@ typedef struct{
|
|||||||
CFesFwTxControlCmdThreadPtr ptrFesFwTxControlCmdThread;
|
CFesFwTxControlCmdThreadPtr ptrFesFwTxControlCmdThread;
|
||||||
CFesRxFesDataThreadPtr ptrFesRxFesDataThread;
|
CFesRxFesDataThreadPtr ptrFesRxFesDataThread;
|
||||||
CFesRxDPDataThreadPtr ptrFesRxDPDataThread;
|
CFesRxDPDataThreadPtr ptrFesRxDPDataThread;
|
||||||
CAnaWorkThreadPtr ptrAnaWorkThread;
|
|
||||||
CDigWorkThreadPtr ptrDigWorkThread;
|
|
||||||
CAccWorkThreadPtr ptrAccWorkThread;
|
|
||||||
CMixWorkThreadPtr ptrMixWorkThread;
|
|
||||||
}SRedundantManageThreadParam;
|
}SRedundantManageThreadParam;
|
||||||
|
|
||||||
class CFesRedundantManage :
|
class CFesRedundantManage :
|
||||||
@ -110,10 +102,6 @@ private:
|
|||||||
CFesFwTxControlCmdThreadPtr m_ptrFesFwTxControlCmdThread;
|
CFesFwTxControlCmdThreadPtr m_ptrFesFwTxControlCmdThread;
|
||||||
CFesRxFesDataThreadPtr m_ptrFesRxFesDataThread;
|
CFesRxFesDataThreadPtr m_ptrFesRxFesDataThread;
|
||||||
CFesRxDPDataThreadPtr m_ptrFesRxDPDataThread;
|
CFesRxDPDataThreadPtr m_ptrFesRxDPDataThread;
|
||||||
CAnaWorkThreadPtr m_ptrAnaWorkThread;
|
|
||||||
CDigWorkThreadPtr m_ptrDigWorkThread;
|
|
||||||
CAccWorkThreadPtr m_ptrAccWorkThread;
|
|
||||||
CMixWorkThreadPtr m_ptrMixWorkThread;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef boost::shared_ptr<CFesRedundantManage> CFesRedundantManagePtr;
|
typedef boost::shared_ptr<CFesRedundantManage> CFesRedundantManagePtr;
|
||||||
|
|||||||
@ -72,6 +72,7 @@ CFesRtu::CFesRtu()
|
|||||||
m_MaxDiIndex = 0;
|
m_MaxDiIndex = 0;
|
||||||
m_MaxAccIndex = 0;
|
m_MaxAccIndex = 0;
|
||||||
m_MaxMiIndex = 0;
|
m_MaxMiIndex = 0;
|
||||||
|
m_MinMiIndex = -1;//实际混合量最小索引,即规约参数1最小值,-1表示没有或者无效
|
||||||
m_MaxAoIndex = 0;
|
m_MaxAoIndex = 0;
|
||||||
m_MaxDoIndex = 0;
|
m_MaxDoIndex = 0;
|
||||||
m_MaxMoIndex = 0;
|
m_MaxMoIndex = 0;
|
||||||
@ -357,10 +358,8 @@ SFesMo* CFesRtu::GetMoByPointNo(int PointNo)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRtuDiChgNum()
|
int CFesRtu::GetRtuDiChgNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
||||||
num = DiChgBuf.size();
|
int num = static_cast<int>(DiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,10 +370,8 @@ int CFesRtu::GetRtuDiChgNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRtuAiChgNum()
|
int CFesRtu::GetRtuAiChgNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
||||||
num = AiChgBuf.size();
|
int num = static_cast<int>(AiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,10 +382,8 @@ int CFesRtu::GetRtuAiChgNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRtuAccChgNum()
|
int CFesRtu::GetRtuAccChgNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
||||||
num = AccChgBuf.size();
|
int num = static_cast<int>(AccChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,10 +394,8 @@ int CFesRtu::GetRtuAccChgNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRtuMiChgNum()
|
int CFesRtu::GetRtuMiChgNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
||||||
num = MiChgBuf.size();
|
int num = static_cast<int>(MiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,10 +780,8 @@ int CFesRtu::ReadMiValue(int num,SFesAllMi *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetSoeEventNum()
|
int CFesRtu::GetSoeEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = SoeEventBuf.size();
|
int num = static_cast<int>(SoeEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,10 +792,8 @@ int CFesRtu::GetSoeEventNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetChanEventNum()
|
int CFesRtu::GetChanEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = ChanEventBuf.size();
|
int num = static_cast<int>(ChanEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,10 +805,8 @@ int CFesRtu::GetChanEventNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRtuEventNum()
|
int CFesRtu::GetRtuEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = RtuEventBuf.size();
|
int num = static_cast<int>(RtuEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,11 +1010,8 @@ void CFesRtu::WriteRxDoCmdBuf(int num,SFesRxDoCmd *buffer)
|
|||||||
*/
|
*/
|
||||||
void CFesRtu::WriteRxAoCmdBuf(int num,SFesRxAoCmd *buffer)
|
void CFesRtu::WriteRxAoCmdBuf(int num,SFesRxAoCmd *buffer)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
for(i=0;i<num;i++)
|
for(int i=0;i<num;i++)
|
||||||
{
|
{
|
||||||
RxAoCmdBuf.push(buffer[i]);
|
RxAoCmdBuf.push(buffer[i]);
|
||||||
}
|
}
|
||||||
@ -1093,10 +1077,8 @@ void CFesRtu::WriteRxDefCmdBuf(int num,SFesRxDefCmd *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetTxDoCmdNum()
|
int CFesRtu::GetTxDoCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = TxDoCmdBuf.size();
|
int num = static_cast<int>(TxDoCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,10 +1089,8 @@ int CFesRtu::GetTxDoCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetTxAoCmdNum()
|
int CFesRtu::GetTxAoCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = TxAoCmdBuf.size();
|
int num = static_cast<int>(TxAoCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,10 +1101,8 @@ int CFesRtu::GetTxAoCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetTxmMoCmdNum()
|
int CFesRtu::GetTxmMoCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = TxMoCmdBuf.size();
|
int num = static_cast<int>(TxMoCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1135,10 +1113,8 @@ int CFesRtu::GetTxmMoCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetTxSettingCmdNum()
|
int CFesRtu::GetTxSettingCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = TxSettingCmdBuf.size();
|
int num = static_cast<int>(TxSettingCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1149,10 +1125,8 @@ int CFesRtu::GetTxSettingCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetTxDefCmdNum()
|
int CFesRtu::GetTxDefCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = TxDefCmdBuf.size();
|
int num = static_cast<int>(TxDefCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1288,7 +1262,6 @@ int CFesRtu::ReadTxDefCmd(int num,SFesTxDefCmd *buffer)
|
|||||||
return tempNum;
|
return tempNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CFesRtu::WriteChanEventBuf
|
* @brief CFesRtu::WriteChanEventBuf
|
||||||
* 写入CHAN EVENT缓冲区内容
|
* 写入CHAN EVENT缓冲区内容
|
||||||
@ -1315,10 +1288,8 @@ void CFesRtu::WriteChanEventBuf(int num,SFesChanEvent *buffer)
|
|||||||
void CFesRtu::WriteSoeEventBuf(int num,SFesSoeEvent *buffer)
|
void CFesRtu::WriteSoeEventBuf(int num,SFesSoeEvent *buffer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CFesRtuPtr rtuPtr;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
int count = SoeEventBuf.size();
|
int count = static_cast<int>(SoeEventBuf.size());
|
||||||
if ((count + num) > DiMaxChgNum)
|
if ((count + num) > DiMaxChgNum)
|
||||||
{
|
{
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
@ -1365,10 +1336,8 @@ void CFesRtu::WriteRtuEventBuf(int num,SFesRtuEvent *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRxDoCmdNum()
|
int CFesRtu::GetRxDoCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = RxDoCmdBuf.size();
|
int num = static_cast<int>(RxDoCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1379,10 +1348,8 @@ int CFesRtu::GetRxDoCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRxAoCmdNum()
|
int CFesRtu::GetRxAoCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = RxAoCmdBuf.size();
|
int num = static_cast<int>(RxAoCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1393,10 +1360,8 @@ int CFesRtu::GetRxAoCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRxMoCmdNum()
|
int CFesRtu::GetRxMoCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = RxMoCmdBuf.size();
|
int num = static_cast<int>(RxMoCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1407,10 +1372,8 @@ int CFesRtu::GetRxMoCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRxSettingCmdNum()
|
int CFesRtu::GetRxSettingCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = RxSettingCmdBuf.size();
|
int num = static_cast<int>(RxSettingCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1421,10 +1384,8 @@ int CFesRtu::GetRxSettingCmdNum()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetRxDefCmdNum()
|
int CFesRtu::GetRxDefCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = RxDefCmdBuf.size();
|
int num = static_cast<int>(RxDefCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1628,7 +1589,6 @@ void CFesRtu::WriteTxDefCmdBuf(int num,SFesTxDefCmd *buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CFesRtu::WriteTxSettingCmdBuf
|
* @brief CFesRtu::WriteTxSettingCmdBuf
|
||||||
* FES(规约模块)返回Setting命令结果,写入FES发送Setting命令缓存区
|
* FES(规约模块)返回Setting命令结果,写入FES发送Setting命令缓存区
|
||||||
@ -1679,7 +1639,7 @@ void CFesRtu::WriteChgAiValue(int num,SFesChgAi *buffer)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
||||||
int count = AiChgBuf.size();
|
int count = static_cast<int>(AiChgBuf.size());
|
||||||
if((count+num)>AiMaxChgNum)
|
if((count+num)>AiMaxChgNum)
|
||||||
{
|
{
|
||||||
LOGERROR("RTU%d AiChgBuf overflow AiMaxChgNum=%d ",m_Param.RtuNo,AiMaxChgNum);
|
LOGERROR("RTU%d AiChgBuf overflow AiMaxChgNum=%d ",m_Param.RtuNo,AiMaxChgNum);
|
||||||
@ -1702,7 +1662,7 @@ void CFesRtu::WriteChgAccValue(int num,SFesChgAcc *buffer)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
||||||
int count = AccChgBuf.size();
|
int count = static_cast<int>(AccChgBuf.size());
|
||||||
if((count+num)>AccMaxChgNum)
|
if((count+num)>AccMaxChgNum)
|
||||||
{
|
{
|
||||||
LOGERROR("RTU%d AccChgBuf overflow AccMaxChgNum=%d ",m_Param.RtuNo,AccMaxChgNum);
|
LOGERROR("RTU%d AccChgBuf overflow AccMaxChgNum=%d ",m_Param.RtuNo,AccMaxChgNum);
|
||||||
@ -1725,7 +1685,7 @@ void CFesRtu::WriteChgMiValue(int num,SFesChgMi *buffer)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
||||||
int count = MiChgBuf.size();
|
int count = static_cast<int>(MiChgBuf.size());
|
||||||
if((count+num)>MiMaxChgNum)
|
if((count+num)>MiMaxChgNum)
|
||||||
{
|
{
|
||||||
LOGERROR("RTU%d MiChgBuf overflow MiMaxChgNum=%d ",m_Param.RtuNo,MiMaxChgNum);
|
LOGERROR("RTU%d MiChgBuf overflow MiMaxChgNum=%d ",m_Param.RtuNo,MiMaxChgNum);
|
||||||
@ -1864,8 +1824,8 @@ void CFesRtu::WriteRtuAccValueAndRetChg(int num,SFesRtuAccValue *buffer,int *ret
|
|||||||
{
|
{
|
||||||
int i,count;
|
int i,count;
|
||||||
SFesAcc *pAcc;
|
SFesAcc *pAcc;
|
||||||
uint64 value;
|
//uint64 value;
|
||||||
double fdValue;
|
double dvalue;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AccMutex);
|
boost::mutex::scoped_lock lock(m_AccMutex);
|
||||||
count = 0;
|
count = 0;
|
||||||
@ -1874,9 +1834,10 @@ void CFesRtu::WriteRtuAccValueAndRetChg(int num,SFesRtuAccValue *buffer,int *ret
|
|||||||
if(buffer[i].PointNo < m_MaxAccPoints)
|
if(buffer[i].PointNo < m_MaxAccPoints)
|
||||||
{
|
{
|
||||||
pAcc = m_pAcc+buffer[i].PointNo;
|
pAcc = m_pAcc+buffer[i].PointNo;
|
||||||
fdValue = (double)buffer[i].Value*pAcc->Coeff+pAcc->Base;
|
//fdValue = (double)buffer[i].Value*pAcc->Coeff+pAcc->Base;
|
||||||
value = fdValue;
|
dvalue = buffer[i].Value*(pAcc->Coeff)+pAcc->Base;
|
||||||
if(((int64)value) != pAcc->Value)
|
//value = fdValue;
|
||||||
|
if(dvalue != pAcc->Value)
|
||||||
{
|
{
|
||||||
//2019-08-23 thxiao 第一次启动时,HMI数据上传慢,所以不再判断是否更新过。
|
//2019-08-23 thxiao 第一次启动时,HMI数据上传慢,所以不再判断是否更新过。
|
||||||
//if(pAcc->Status&CN_FesValueUpdate)//更新过的点才能报告变化
|
//if(pAcc->Status&CN_FesValueUpdate)//更新过的点才能报告变化
|
||||||
@ -1884,14 +1845,14 @@ void CFesRtu::WriteRtuAccValueAndRetChg(int num,SFesRtuAccValue *buffer,int *ret
|
|||||||
memcpy(ChgBuffer[count].TableName,pAcc->TableName,CN_FesMaxTableNameSize);
|
memcpy(ChgBuffer[count].TableName,pAcc->TableName,CN_FesMaxTableNameSize);
|
||||||
memcpy(ChgBuffer[count].ColumnName,pAcc->ColumnName,CN_FesMaxColumnNameSize);
|
memcpy(ChgBuffer[count].ColumnName,pAcc->ColumnName,CN_FesMaxColumnNameSize);
|
||||||
memcpy(ChgBuffer[count].TagName,pAcc->TagName,CN_FesMaxTagSize);
|
memcpy(ChgBuffer[count].TagName,pAcc->TagName,CN_FesMaxTagSize);
|
||||||
ChgBuffer[count].Value=value;
|
ChgBuffer[count].Value=dvalue;
|
||||||
ChgBuffer[count].Status = buffer[i].Status;
|
ChgBuffer[count].Status = buffer[i].Status;
|
||||||
ChgBuffer[count].time = buffer[i].time;
|
ChgBuffer[count].time = buffer[i].time;
|
||||||
ChgBuffer[count].RtuNo = m_Param.RtuNo;
|
ChgBuffer[count].RtuNo = m_Param.RtuNo;
|
||||||
ChgBuffer[count].PointNo = pAcc->PointNo;
|
ChgBuffer[count].PointNo = pAcc->PointNo;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
pAcc->Value = value;
|
pAcc->Value = dvalue;
|
||||||
pAcc->Status = buffer[i].Status;
|
pAcc->Status = buffer[i].Status;
|
||||||
pAcc->time = buffer[i].time;
|
pAcc->time = buffer[i].time;
|
||||||
}
|
}
|
||||||
@ -2021,6 +1982,7 @@ void CFesRtu::WriteRtuPointsComStatus(int comStatus)
|
|||||||
{
|
{
|
||||||
if ((pDi->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 判断原来的通信状态确实发生了状态变化,才置上全局标志
|
if ((pDi->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 判断原来的通信状态确实发生了状态变化,才置上全局标志
|
||||||
{
|
{
|
||||||
|
pDi->Status = 0; //置为值未更新状态,防止重连成功时,上一次的值被上传
|
||||||
pDi->Status |= status;
|
pDi->Status |= status;
|
||||||
pointCount++;
|
pointCount++;
|
||||||
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
||||||
@ -2063,6 +2025,7 @@ void CFesRtu::WriteRtuPointsComStatus(int comStatus)
|
|||||||
{
|
{
|
||||||
if ((pAi->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 判断原来的通信状态确实发生了状态变化,才置上全局标志
|
if ((pAi->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 判断原来的通信状态确实发生了状态变化,才置上全局标志
|
||||||
{
|
{
|
||||||
|
pAi->Status = 0; //置为值未更新状态,防止重连成功时,上一次的值被上传
|
||||||
pAi->Status |= status;
|
pAi->Status |= status;
|
||||||
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
||||||
{
|
{
|
||||||
@ -2109,6 +2072,7 @@ void CFesRtu::WriteRtuPointsComStatus(int comStatus)
|
|||||||
{
|
{
|
||||||
if ((pAcc->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 有状态变化才置标志
|
if ((pAcc->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 有状态变化才置标志
|
||||||
{
|
{
|
||||||
|
pAcc->Status = 0; //置为值未更新状态,防止重连成功时,上一次的值被上传
|
||||||
pAcc->Status |= status;
|
pAcc->Status |= status;
|
||||||
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
||||||
pAcc->Value = 0;
|
pAcc->Value = 0;
|
||||||
@ -2149,6 +2113,7 @@ void CFesRtu::WriteRtuPointsComStatus(int comStatus)
|
|||||||
{
|
{
|
||||||
if ((pMi->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 有状态变化才置标志
|
if ((pMi->Status&CN_FesValueComDown) == 0x00)//2021-06-08 thxiao 有状态变化才置标志
|
||||||
{
|
{
|
||||||
|
pMi->Status = 0; //置为值未更新状态,防止重连成功时,上一次的值被上传
|
||||||
pMi->Status |= status;
|
pMi->Status |= status;
|
||||||
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
if (m_Param.ClearDataEnable&CN_Fes_Comdown_Clear)
|
||||||
pMi->Value = 0;
|
pMi->Value = 0;
|
||||||
@ -2250,10 +2215,8 @@ int CFesRtu::ReadFwDoRespCmd(int num, SFesFwDoRespCmd *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwDoRespCmdNum()
|
int CFesRtu::GetFwDoRespCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = FwDoRespCmdBuf.size();
|
int num = static_cast<int>(FwDoRespCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2306,7 +2269,7 @@ void CFesRtu::SetAiFwFlag(int PointNo, int MappingIndex, int RemoteNo)
|
|||||||
pAi->FwMapNum++;
|
pAi->FwMapNum++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOGERROR("RTU:%d PointNo:%d Di 超出最大转发映射次数,映射失败。转发MappingIndex:%d RemoteNo:%d ", m_Param.RtuNo, PointNo, MappingIndex, RemoteNo);
|
LOGERROR("RTU:%d PointNo:%d Ai 超出最大转发映射次数,映射失败。转发MappingIndex:%d RemoteNo:%d ", m_Param.RtuNo, PointNo, MappingIndex, RemoteNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2367,15 +2330,13 @@ void CFesRtu::SetMiFwFlag(int PointNo, int MappingIndex, int RemoteNo)
|
|||||||
* 写入转发SOE EVENT缓冲区内容
|
* 写入转发SOE EVENT缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwSoeEventBuf(SFesFwSoeEvent buffer)
|
void CFesRtu::WriteFwSoeEventBuf(const SFesFwSoeEvent &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwSoeChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwSoeChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
count = FwSoeEventBuf.size();
|
int count = static_cast<int>(FwSoeEventBuf.size());
|
||||||
if(count>FwDiMaxChgNum)
|
if(count>FwDiMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwSoeEventBuf.front(); //从头开始读取数据
|
//FwSoeEventBuf.front(); //从头开始读取数据
|
||||||
@ -2384,7 +2345,7 @@ void CFesRtu::WriteFwSoeEventBuf(SFesFwSoeEvent buffer)
|
|||||||
}
|
}
|
||||||
FwSoeEventBuf.push(buffer);
|
FwSoeEventBuf.push(buffer);
|
||||||
//2019-09-06 thxiao 方便查找事件,增加记录
|
//2019-09-06 thxiao 方便查找事件,增加记录
|
||||||
LOGINFO("SOE RtuNo:%d RemoteNo=%d value=%d ms=[%" PRId64 "] .", m_Param.RtuNo, buffer.RemoteNo,buffer.Value, buffer.time);
|
LOGTRACE("SOE RtuNo:%d RemoteNo=%d value=%d ms=[%" PRId64 "] .", m_Param.RtuNo, buffer.RemoteNo,buffer.Value, buffer.time);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2393,15 +2354,13 @@ void CFesRtu::WriteFwSoeEventBuf(SFesFwSoeEvent buffer)
|
|||||||
* 写入转发DSOE EVENT缓冲区内容
|
* 写入转发DSOE EVENT缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwDSoeEventBuf(SFesFwSoeEvent buffer)
|
void CFesRtu::WriteFwDSoeEventBuf(const SFesFwSoeEvent &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwDSoeChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwDSoeChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
count = FwDSoeEventBuf.size();
|
int count = static_cast<int>(FwDSoeEventBuf.size());
|
||||||
if (count>FwDiMaxChgNum)
|
if (count>FwDiMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwDSoeEventBuf.front(); //从头开始读取数据
|
//FwDSoeEventBuf.front(); //从头开始读取数据
|
||||||
@ -2410,7 +2369,7 @@ void CFesRtu::WriteFwDSoeEventBuf(SFesFwSoeEvent buffer)
|
|||||||
}
|
}
|
||||||
FwDSoeEventBuf.push(buffer);
|
FwDSoeEventBuf.push(buffer);
|
||||||
//2019-09-06 thxiao 方便查找事件,增加记录
|
//2019-09-06 thxiao 方便查找事件,增加记录
|
||||||
LOGINFO("DSOE RtuNo:%d RemoteNo=%d value=%d ms=%ld", m_Param.RtuNo, buffer.RemoteNo, buffer.Value, buffer.time);
|
LOGTRACE("DSOE RtuNo:%d RemoteNo=%d value=%d ms=%ld", m_Param.RtuNo, buffer.RemoteNo, buffer.Value, buffer.time);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2419,15 +2378,13 @@ void CFesRtu::WriteFwDSoeEventBuf(SFesFwSoeEvent buffer)
|
|||||||
* 写入转发DI变化缓冲区内容
|
* 写入转发DI变化缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwDiBuf(SFesFwChgDi buffer)
|
void CFesRtu::WriteFwDiBuf(const SFesFwChgDi &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwDiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwDiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
||||||
count = FwDiChgBuf.size();
|
int count = static_cast<int>(FwDiChgBuf.size());
|
||||||
if (count>FwDiMaxChgNum)
|
if (count>FwDiMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwDiChgBuf.front(); //从头开始读取数据
|
//FwDiChgBuf.front(); //从头开始读取数据
|
||||||
@ -2436,7 +2393,7 @@ void CFesRtu::WriteFwDiBuf(SFesFwChgDi buffer)
|
|||||||
}
|
}
|
||||||
FwDiChgBuf.push(buffer);
|
FwDiChgBuf.push(buffer);
|
||||||
//2019-09-06 thxiao 方便查找事件,增加记录
|
//2019-09-06 thxiao 方便查找事件,增加记录
|
||||||
LOGINFO("转发DI变位 RtuNo:%d RemoteNo=%d value=%d ms=[%" PRId64 "] .", m_Param.RtuNo, buffer.RemoteNo, buffer.Value, buffer.time);
|
LOGTRACE("转发DI变位 RtuNo:%d RemoteNo=%d value=%d ms=[%" PRId64 "] .", m_Param.RtuNo, buffer.RemoteNo, buffer.Value, buffer.time);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2445,15 +2402,13 @@ void CFesRtu::WriteFwDiBuf(SFesFwChgDi buffer)
|
|||||||
* 写入转发DDI变化缓冲区内容
|
* 写入转发DDI变化缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwDDiBuf(SFesFwChgDi buffer)
|
void CFesRtu::WriteFwDDiBuf(const SFesFwChgDi &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwDDiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwDDiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
||||||
count = FwDDiChgBuf.size();
|
int count = static_cast<int>(FwDDiChgBuf.size());
|
||||||
if (count > FwDDiMaxChgNum)
|
if (count > FwDDiMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwDDiChgBuf.front(); //从头开始读取数据
|
//FwDDiChgBuf.front(); //从头开始读取数据
|
||||||
@ -2462,7 +2417,7 @@ void CFesRtu::WriteFwDDiBuf(SFesFwChgDi buffer)
|
|||||||
}
|
}
|
||||||
FwDDiChgBuf.push(buffer);
|
FwDDiChgBuf.push(buffer);
|
||||||
//2019-09-06 thxiao 方便查找事件,增加记录
|
//2019-09-06 thxiao 方便查找事件,增加记录
|
||||||
LOGINFO("转发DDI变位 RtuNo:%d RemoteNo=%d value=%d ms=%ld", m_Param.RtuNo, buffer.RemoteNo, buffer.Value, buffer.time);
|
LOGTRACE("转发DDI变位 RtuNo:%d RemoteNo=%d value=%d ms=%ld", m_Param.RtuNo, buffer.RemoteNo, buffer.Value, buffer.time);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2471,15 +2426,13 @@ void CFesRtu::WriteFwDDiBuf(SFesFwChgDi buffer)
|
|||||||
* 写入转发Ai变化缓冲区内容
|
* 写入转发Ai变化缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwAiBuf(SFesFwChgAi buffer)
|
void CFesRtu::WriteFwAiBuf(const SFesFwChgAi &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwAiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwAiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
||||||
count = FwAiChgBuf.size();
|
int count = static_cast<int>(FwAiChgBuf.size());
|
||||||
if (count > FwAiMaxChgNum)
|
if (count > FwAiMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwAiChgBuf.front(); //从头开始读取数据
|
//FwAiChgBuf.front(); //从头开始读取数据
|
||||||
@ -2494,15 +2447,13 @@ void CFesRtu::WriteFwAiBuf(SFesFwChgAi buffer)
|
|||||||
* 写入转发Acc变化缓冲区内容
|
* 写入转发Acc变化缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwAccBuf(SFesFwChgAcc buffer)
|
void CFesRtu::WriteFwAccBuf(const SFesFwChgAcc &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwAccChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwAccChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
||||||
count = FwAccChgBuf.size();
|
int count = static_cast<int>(FwAccChgBuf.size());
|
||||||
if (count > FwAccMaxChgNum)
|
if (count > FwAccMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwAccChgBuf.front(); //从头开始读取数据
|
//FwAccChgBuf.front(); //从头开始读取数据
|
||||||
@ -2518,15 +2469,13 @@ void CFesRtu::WriteFwAccBuf(SFesFwChgAcc buffer)
|
|||||||
* 写入转发Mi变化缓冲区内容
|
* 写入转发Mi变化缓冲区内容
|
||||||
* @param buffer 写入数据
|
* @param buffer 写入数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteFwMiBuf(SFesFwChgMi buffer)
|
void CFesRtu::WriteFwMiBuf(const SFesFwChgMi &buffer)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
if (FwMiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
if (FwMiChgStop)//有些从站协议不支持变化报告,该标志可以用来控制是否填写对应的变化缓冲区。
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
||||||
count = FwMiChgBuf.size();
|
int count = static_cast<int>(FwMiChgBuf.size());
|
||||||
if (count > FwMiMaxChgNum)
|
if (count > FwMiMaxChgNum)
|
||||||
{
|
{
|
||||||
//FwMiChgBuf.front(); //从头开始读取数据
|
//FwMiChgBuf.front(); //从头开始读取数据
|
||||||
@ -2544,10 +2493,8 @@ void CFesRtu::WriteFwMiBuf(SFesFwChgMi buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwSOEEventNum()
|
int CFesRtu::GetFwSOEEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = FwSoeEventBuf.size();
|
int num = static_cast<int>(FwSoeEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2626,10 +2573,8 @@ int CFesRtu::ReadFwAoRespCmd(int num, SFesFwAoRespCmd *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwAoRespCmdNum()
|
int CFesRtu::GetFwAoRespCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = FwAoRespCmdBuf.size();
|
int num = static_cast<int>(FwAoRespCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2683,10 +2628,8 @@ int CFesRtu::ReadFwMoRespCmd(int num,SFesFwMoRespCmd *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwMoRespCmdNum()
|
int CFesRtu::GetFwMoRespCmdNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
num = FwMoRespCmdBuf.size();
|
int num = static_cast<int>(FwMoRespCmdBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2819,10 +2762,8 @@ void CFesRtu::ClearBuf()
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwChgAiNum()
|
int CFesRtu::GetFwChgAiNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
boost::mutex::scoped_lock lock(m_AiChgMutex);
|
||||||
num = FwAiChgBuf.size();
|
int num = static_cast<int>(FwAiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2857,10 +2798,8 @@ int CFesRtu::ReadFwChgAi(int num, SFesFwChgAi *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwChgDiNum()
|
int CFesRtu::GetFwChgDiNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
||||||
num = FwDiChgBuf.size();
|
int num = static_cast<int>(FwDiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2895,10 +2834,8 @@ int CFesRtu::ReadFwChgDi(int num, SFesFwChgDi *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwChgDDiNum()
|
int CFesRtu::GetFwChgDDiNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
boost::mutex::scoped_lock lock(m_DiChgMutex);
|
||||||
num = FwDDiChgBuf.size();
|
int num = static_cast<int>(FwDDiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2934,10 +2871,8 @@ int CFesRtu::ReadFwChgDDi(int num, SFesFwChgDi *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwChgAccNum()
|
int CFesRtu::GetFwChgAccNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
boost::mutex::scoped_lock lock(m_AccChgMutex);
|
||||||
num = FwAccChgBuf.size();
|
int num = static_cast<int>(FwAccChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2972,10 +2907,8 @@ int CFesRtu::ReadFwChgAcc(int num, SFesFwChgAcc *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwChgMiNum()
|
int CFesRtu::GetFwChgMiNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
boost::mutex::scoped_lock lock(m_MiChgMutex);
|
||||||
num = FwMiChgBuf.size();
|
int num = static_cast<int>(FwMiChgBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3011,10 +2944,8 @@ int CFesRtu::ReadFwChgMi(int num, SFesFwChgMi *buffer)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetFwDSOEEventNum()
|
int CFesRtu::GetFwDSOEEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = FwDSoeEventBuf.size();
|
int num = static_cast<int>(FwDSoeEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3051,7 +2982,7 @@ int CFesRtu::ReadFwDSOEEvent(int num, SFesFwSoeEvent *buffer)
|
|||||||
* 第一次更新不认为是变化数据
|
* 第一次更新不认为是变化数据
|
||||||
* @return true:更新 false:没更新
|
* @return true:更新 false:没更新
|
||||||
*/
|
*/
|
||||||
bool CFesRtu::UpdataFwDiValue(SFesFwChgDi DiValue,int updateMode)
|
bool CFesRtu::UpdataFwDiValue(const SFesFwChgDi &DiValue,int updateMode)
|
||||||
{
|
{
|
||||||
SFesFwDi *pDi;
|
SFesFwDi *pDi;
|
||||||
|
|
||||||
@ -3105,7 +3036,7 @@ int CFesRtu::ReadFwDSOEEvent(int num, SFesFwSoeEvent *buffer)
|
|||||||
|
|
||||||
* @return true:更新 false:没更新
|
* @return true:更新 false:没更新
|
||||||
*/
|
*/
|
||||||
bool CFesRtu::UpdataFwDDiValue(SFesFwChgDi DiValue, int updateMode)
|
bool CFesRtu::UpdataFwDDiValue(const SFesFwChgDi &DiValue, int updateMode)
|
||||||
{
|
{
|
||||||
SFesFwDi *pDi;
|
SFesFwDi *pDi;
|
||||||
|
|
||||||
@ -3158,51 +3089,40 @@ int CFesRtu::ReadFwDSOEEvent(int num, SFesFwSoeEvent *buffer)
|
|||||||
* @param updateMode 更新模式 1:判断后更新(DP to FES) 0:直接更新,不需要判断(默认)(FES to FES)
|
* @param updateMode 更新模式 1:判断后更新(DP to FES) 0:直接更新,不需要判断(默认)(FES to FES)
|
||||||
* @return true:更新 false:没更新
|
* @return true:更新 false:没更新
|
||||||
*/
|
*/
|
||||||
bool CFesRtu::UpdataFwAiValue(SFesFwChgAi AiValue,int updateMode)
|
bool CFesRtu::UpdataFwAiValue(const SFesFwChgAi &AiValue, float &fNewValue,EnumUpdateFwCacheMode eUpdateMode)
|
||||||
{
|
{
|
||||||
SFesFwAi *pAi;
|
if(AiValue.RemoteNo >= m_MaxFwAiPoints || AiValue.RemoteNo < 0)
|
||||||
int changeFlag = 0;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//boost::mutex::scoped_lock lock(m_AiChgMutex);
|
|
||||||
boost::mutex::scoped_lock lock(m_AiMutex);//2023-02-15 thxiao 转发数据读写时使用同一个锁,所以改为m_AiMutex
|
boost::mutex::scoped_lock lock(m_AiMutex);//2023-02-15 thxiao 转发数据读写时使用同一个锁,所以改为m_AiMutex
|
||||||
if ((AiValue.RemoteNo < m_MaxFwAiPoints) && (AiValue.RemoteNo >= 0))
|
SFesFwAi *pAi = m_pFwAi + AiValue.RemoteNo;
|
||||||
{
|
//< 强制更新模式直接更新,不进行系数和死区判断
|
||||||
pAi = m_pFwAi + AiValue.RemoteNo;
|
if(eUpdateMode == eDirectUpdate)
|
||||||
if (updateMode)
|
|
||||||
{
|
|
||||||
if ((fabs(pAi->Value) < CN_FesFloatCompare) && (fabs(AiValue.Value) < CN_FesFloatCompare))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (fabs(pAi->Value*AiValue.Value) < CN_FesFloatCompare)
|
|
||||||
changeFlag = 1;
|
|
||||||
|
|
||||||
else if ((fabs(pAi->Value / AiValue.Value) < (1 - CN_FesFwAIChangeScale))
|
|
||||||
||(fabs(pAi->Value / AiValue.Value) > (1 + CN_FesFwAIChangeScale)))
|
|
||||||
changeFlag = 1;
|
|
||||||
|
|
||||||
if (changeFlag)
|
|
||||||
{
|
{
|
||||||
pAi->Value = AiValue.Value;
|
pAi->Value = AiValue.Value;
|
||||||
pAi->Status = AiValue.Status;
|
pAi->Status = AiValue.Status;
|
||||||
pAi->time = AiValue.time;
|
pAi->time = AiValue.time;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//< 超过5分钟或者超过死区更新一次
|
||||||
|
fNewValue = static_cast<float>(AiValue.Value * pAi->Coeff + pAi->Base); //< 进行基值和K值变换
|
||||||
|
if( eUpdateMode == eWithoutDeadbandUpdate ||
|
||||||
|
fabs(pAi->Value - fNewValue) >= pAi->RealDeadBandValue ||
|
||||||
|
(AiValue.time - pAi->time) > 5 * SEC_PER_MIN * MSEC_PER_SEC )
|
||||||
|
{
|
||||||
|
pAi->Value = fNewValue;
|
||||||
|
pAi->Status = AiValue.Status;
|
||||||
|
pAi->time = AiValue.time;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
pAi->Value = AiValue.Value;
|
|
||||||
pAi->Status = AiValue.Status;
|
|
||||||
pAi->time = AiValue.time;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CFesRtu::UpdataFwAccValue
|
* @brief CFesRtu::UpdataFwAccValue
|
||||||
@ -3211,36 +3131,32 @@ int CFesRtu::ReadFwDSOEEvent(int num, SFesFwSoeEvent *buffer)
|
|||||||
* @param updateMode 更新模式 1:判断后更新(DP to FES) 0:直接更新,不需要判断(默认)(FES to FES)
|
* @param updateMode 更新模式 1:判断后更新(DP to FES) 0:直接更新,不需要判断(默认)(FES to FES)
|
||||||
* @return true:更新 false:没更新
|
* @return true:更新 false:没更新
|
||||||
*/
|
*/
|
||||||
bool CFesRtu::UpdataFwAccValue(SFesFwChgAcc AccValue, int updateMode)
|
bool CFesRtu::UpdataFwAccValue(const SFesFwChgAcc &AccValue, double &dNewValue,EnumUpdateFwCacheMode eUpdateMode)
|
||||||
{
|
{
|
||||||
SFesFwAcc *pAcc;
|
if(AccValue.RemoteNo >= m_MaxFwAccPoints || AccValue.RemoteNo < 0)
|
||||||
|
|
||||||
//boost::mutex::scoped_lock lock(m_AccChgMutex);
|
|
||||||
boost::mutex::scoped_lock lock(m_AccMutex);//2023-02-15 thxiao 转发数据读写时使用同一个锁,所以改为m_AccMutex
|
|
||||||
if ((AccValue.RemoteNo < m_MaxFwAccPoints) && (AccValue.RemoteNo >= 0))
|
|
||||||
{
|
{
|
||||||
pAcc = m_pFwAcc + AccValue.RemoteNo;
|
|
||||||
if (updateMode)
|
|
||||||
{
|
|
||||||
if (pAcc->Value != AccValue.Value)
|
|
||||||
{
|
|
||||||
pAcc->Value = AccValue.Value;
|
|
||||||
pAcc->Status = AccValue.Status;
|
|
||||||
pAcc->time = AccValue.time;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
boost::mutex::scoped_lock lock(m_AccMutex);//2023-02-15 thxiao 转发数据读写时使用同一个锁,所以改为m_AccMutex
|
||||||
|
SFesFwAcc *pAcc = m_pFwAcc + AccValue.RemoteNo;
|
||||||
|
if(eUpdateMode == eDirectUpdate)
|
||||||
{
|
{
|
||||||
pAcc->Value = AccValue.Value;
|
pAcc->Value = AccValue.Value;
|
||||||
pAcc->Status = AccValue.Status;
|
pAcc->Status = AccValue.Status;
|
||||||
pAcc->time = AccValue.time;
|
pAcc->time = AccValue.time;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dNewValue = AccValue.Value * pAcc->Coeff + pAcc->Base;
|
||||||
|
if( fabs(dNewValue - pAcc->Value) >= CN_FesFloatCompare )
|
||||||
|
{
|
||||||
|
pAcc->Value = dNewValue;
|
||||||
|
pAcc->Status = AccValue.Status;
|
||||||
|
pAcc->time = AccValue.time;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3251,36 +3167,32 @@ int CFesRtu::ReadFwDSOEEvent(int num, SFesFwSoeEvent *buffer)
|
|||||||
* @param updateMode 更新模式 1:判断后更新(DP to FES) 0:直接更新,不需要判断(默认)(FES to FES)
|
* @param updateMode 更新模式 1:判断后更新(DP to FES) 0:直接更新,不需要判断(默认)(FES to FES)
|
||||||
* @return true:更新 false:没更新
|
* @return true:更新 false:没更新
|
||||||
*/
|
*/
|
||||||
bool CFesRtu::UpdataFwMiValue(SFesFwChgMi MiValue,int updateMode)
|
bool CFesRtu::UpdataFwMiValue(const SFesFwChgMi &MiValue,int &nNewValue, EnumUpdateFwCacheMode eUpdateMode)
|
||||||
{
|
{
|
||||||
SFesFwMi *pMi;
|
if(MiValue.RemoteNo >= m_MaxFwMiPoints || MiValue.RemoteNo < 0)
|
||||||
|
|
||||||
//boost::mutex::scoped_lock lock(m_MiChgMutex);
|
|
||||||
boost::mutex::scoped_lock lock(m_MiMutex);//2023-02-15 thxiao 转发数据读写时使用同一个锁,所以改为m_MiMutex
|
|
||||||
if ((MiValue.RemoteNo < m_MaxFwMiPoints) && (MiValue.RemoteNo >= 0))
|
|
||||||
{
|
{
|
||||||
pMi = m_pFwMi + MiValue.RemoteNo;
|
|
||||||
if (updateMode)
|
|
||||||
{
|
|
||||||
if (pMi->Value != MiValue.Value)
|
|
||||||
{
|
|
||||||
pMi->Value = MiValue.Value;
|
|
||||||
pMi->Status = MiValue.Status;
|
|
||||||
pMi->time = MiValue.time;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
boost::mutex::scoped_lock lock(m_MiMutex);//2023-02-15 thxiao 转发数据读写时使用同一个锁,所以改为m_MiMutex
|
||||||
|
SFesFwMi *pMi = m_pFwMi + MiValue.RemoteNo;
|
||||||
|
if(eUpdateMode == eDirectUpdate)
|
||||||
{
|
{
|
||||||
pMi->Value = MiValue.Value;
|
pMi->Value = MiValue.Value;
|
||||||
pMi->Status = MiValue.Status;
|
pMi->Status = MiValue.Status;
|
||||||
pMi->time = MiValue.time;
|
pMi->time = MiValue.time;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nNewValue = static_cast<int>(MiValue.Value * pMi->Coeff + pMi->Base);
|
||||||
|
if (pMi->Value != nNewValue)
|
||||||
|
{
|
||||||
|
pMi->Value = nNewValue;
|
||||||
|
pMi->Status = MiValue.Status;
|
||||||
|
pMi->time = MiValue.time;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3737,7 +3649,7 @@ void CFesRtu::ClearFwDSoeEventBuf()
|
|||||||
* @brief CFesRtu::WriteVirtualValue
|
* @brief CFesRtu::WriteVirtualValue
|
||||||
* 写入虚拟数据
|
* 写入虚拟数据
|
||||||
*/
|
*/
|
||||||
void CFesRtu::WriteVirtualValue(SFesVirtualValue Value)
|
void CFesRtu::WriteVirtualValue(const SFesVirtualValue &Value)
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_CmdMutex);
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
VirtualValueBuf.push(Value);
|
VirtualValueBuf.push(Value);
|
||||||
@ -3876,10 +3788,8 @@ int CFesRtu::GetMiPointNoByDevId(int DevId, std::vector<int>& PointNo)
|
|||||||
*/
|
*/
|
||||||
int CFesRtu::GetSoeStrEventNum()
|
int CFesRtu::GetSoeStrEventNum()
|
||||||
{
|
{
|
||||||
int num;
|
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_EventMutex);
|
boost::mutex::scoped_lock lock(m_EventMutex);
|
||||||
num = SoeStrEventBuf.size();
|
int num = static_cast<int>(SoeStrEventBuf.size());
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3999,3 +3909,57 @@ void CFesRtu::WriteRtuPointsComDown()
|
|||||||
m_MiStatusChangeReportFlag = 1;
|
m_MiStatusChangeReportFlag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFesRtu::writeJsonFormatReqCmd(const rapidjson::Value &jsonCmd)
|
||||||
|
{
|
||||||
|
//<rapidjson中基本都是浅拷贝,比如赋值都会造成原值失效,一定注意
|
||||||
|
RapidJsonDocPtr ptrDoc = boost::make_shared<rapidjson::Document>();
|
||||||
|
ptrDoc->CopyFrom(jsonCmd,ptrDoc->GetAllocator());
|
||||||
|
|
||||||
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
|
if(m_jsonFormatReqCmdBuf.size() > CN_Fes_MaxCmdBufSize)
|
||||||
|
{
|
||||||
|
m_jsonFormatReqCmdBuf.pop();
|
||||||
|
}
|
||||||
|
m_jsonFormatReqCmdBuf.push(ptrDoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRtu::readJsonFormatReqCmd(std::queue<RapidJsonDocPtr> &dequeJsonCmd)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
|
dequeJsonCmd.swap(m_jsonFormatReqCmdBuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t CFesRtu::getJsonFormatReqCmdSize()
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
|
return m_jsonFormatReqCmdBuf.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRtu::clearJsonFormatReqCmdBuf()
|
||||||
|
{
|
||||||
|
std::queue<RapidJsonDocPtr> dequeJsonCmd;
|
||||||
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
|
m_jsonFormatReqCmdBuf.swap(dequeJsonCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRtu::writeJsonFormatReplayCmd(const std::string &strCmd)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
|
if(m_jsonFormatReplayCmdBuf.size() > CN_Fes_MaxCmdBufSize)
|
||||||
|
{
|
||||||
|
m_jsonFormatReplayCmdBuf.pop();
|
||||||
|
}
|
||||||
|
m_jsonFormatReplayCmdBuf.push(strCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRtu::ReadStringFormatRespCmd
|
||||||
|
* 读取发送自定义命令缓冲区内容
|
||||||
|
* @param dequeStrCmd 返回控制命令
|
||||||
|
*/
|
||||||
|
void CFesRtu::readJsonFormatReplayCmd(std::queue<std::string> &strCmds)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_CmdMutex);
|
||||||
|
strCmds.swap(m_jsonFormatReplayCmdBuf);
|
||||||
|
}
|
||||||
|
|||||||
@ -9,14 +9,15 @@
|
|||||||
*/
|
*/
|
||||||
#include "FesRxControlCmdThread.h"
|
#include "FesRxControlCmdThread.h"
|
||||||
#include "MessageChannel.h"
|
#include "MessageChannel.h"
|
||||||
#include "FesMessage.pb.h"
|
|
||||||
|
|
||||||
using namespace iot_net;
|
using namespace iot_net;
|
||||||
using namespace iot_public;
|
using namespace iot_public;
|
||||||
using namespace iot_idl;
|
using namespace iot_idl;
|
||||||
|
|
||||||
|
#define CN_JSON_KEY_RTUNAME "rtu_name"
|
||||||
|
|
||||||
CFesRxControlCmdThread::CFesRxControlCmdThread(int iDomainID, int iAppID ,void* FesBaseAddr):
|
CFesRxControlCmdThread::CFesRxControlCmdThread(int iDomainID, int iAppID ,void* FesBaseAddr):
|
||||||
CTimerThreadBase("FesRxControlCmdThread",20)
|
CTimerThreadBase("FesRxControlCmdThread",0)
|
||||||
{
|
{
|
||||||
m_ptrRxCommunicator = new CMbCommunicator("FesRxControlCmdThread");
|
m_ptrRxCommunicator = new CMbCommunicator("FesRxControlCmdThread");
|
||||||
m_pRxData = NULL;
|
m_pRxData = NULL;
|
||||||
@ -63,41 +64,53 @@ int CFesRxControlCmdThread::beforeExecute()
|
|||||||
*/
|
*/
|
||||||
void CFesRxControlCmdThread::execute()
|
void CFesRxControlCmdThread::execute()
|
||||||
{
|
{
|
||||||
std::string RecvStr;
|
|
||||||
|
|
||||||
if(m_ptrRxCommunicator==NULL)
|
if(m_ptrRxCommunicator==NULL)
|
||||||
|
{
|
||||||
|
m_nRunPeriodMsec = 100; //<防止异常时线程死循环
|
||||||
|
LOGERROR("CFesRxControlCmdThread::execute m_ptrRxCommunicator is null");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//接收消息
|
//接收消息
|
||||||
CMbMessage msgRcv;
|
CMbMessage msgRcv;
|
||||||
int nMsgType;
|
int nMsgType;
|
||||||
if (m_ptrRxCommunicator->recvMsg(msgRcv))
|
if (m_ptrRxCommunicator->recvMsg(msgRcv,100)) //< 通过接收消息超时防止线程空转
|
||||||
{
|
{
|
||||||
|
//std::string RecvStr;
|
||||||
nMsgType = msgRcv.getMsgType();
|
nMsgType = msgRcv.getMsgType();
|
||||||
LOGDEBUG("Received a message: nMsgType=%d\n",nMsgType);
|
LOGTRACE("Received a message: nMsgType=%d\n",nMsgType);
|
||||||
RecvStr.resize(msgRcv.getDataSize()+1);
|
//RecvStr.resize(msgRcv.getDataSize()+1);
|
||||||
memcpy((void*)RecvStr.c_str(),(void *)msgRcv.getDataPtr(),msgRcv.getDataSize());
|
//((void*)RecvStr.c_str(),(void *)msgRcv.getDataPtr(),msgRcv.getDataSize());
|
||||||
|
|
||||||
switch (nMsgType)
|
switch (nMsgType)
|
||||||
{
|
{
|
||||||
case MT_FES_DO_SELECT:
|
case MT_FES_DO_SELECT:
|
||||||
case MT_FES_DO_EXECUTE:
|
case MT_FES_DO_EXECUTE:
|
||||||
case MT_FES_DO_CANCEL:
|
case MT_FES_DO_CANCEL:
|
||||||
case MT_FES_DO_PREVENT:
|
case MT_FES_DO_PREVENT:
|
||||||
RxDoControl(RecvStr,nMsgType);
|
RxDoControl(msgRcv.getDataPtr(), msgRcv.getDataSize(),nMsgType);
|
||||||
break;
|
break;
|
||||||
case MT_FES_AO_EXECUTE:
|
case MT_FES_AO_EXECUTE:
|
||||||
RxAoControl(RecvStr,nMsgType);
|
RxAoControl(msgRcv.getDataPtr(), msgRcv.getDataSize(),nMsgType);
|
||||||
break;
|
break;
|
||||||
|
case MT_FES_MO_SELECT:
|
||||||
case MT_FES_MO_EXECUTE:
|
case MT_FES_MO_EXECUTE:
|
||||||
RxMoControl(RecvStr,nMsgType);
|
case MT_FES_MO_CANCEL:
|
||||||
|
RxMoControl(msgRcv.getDataPtr(), msgRcv.getDataSize(),nMsgType);
|
||||||
break;
|
break;
|
||||||
case MT_FES_SETTING_READ:
|
case MT_FES_SETTING_READ:
|
||||||
case MT_FES_SETTING_DOWN:
|
case MT_FES_SETTING_DOWN:
|
||||||
case MT_FES_SETTING_ACK:
|
case MT_FES_SETTING_ACK:
|
||||||
RxSettingControl(RecvStr,nMsgType);
|
RxSettingControl(msgRcv.getDataPtr(), msgRcv.getDataSize(),nMsgType);
|
||||||
break;
|
break;
|
||||||
case MT_FES_DEFINE_CMD:
|
case MT_FES_DEFINE_CMD:
|
||||||
RxDefCmdControl(RecvStr);
|
RxDefCmdControl(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
||||||
|
break;
|
||||||
|
case MT_FES_BATCH_PNT_CMD:
|
||||||
|
RxBatchPntCmd(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
||||||
|
break;
|
||||||
|
case MT_FES_JSON_RTU_CMD_REQ:
|
||||||
|
handleJsonFormatRtuCmd(msgRcv);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGERROR("CFesRxControlCmdThread::execute() Error message type:%d \n",nMsgType);
|
LOGERROR("CFesRxControlCmdThread::execute() Error message type:%d \n",nMsgType);
|
||||||
@ -126,73 +139,23 @@ void CFesRxControlCmdThread::afterExecute()
|
|||||||
* @param RecvStr 接收到的消息数据
|
* @param RecvStr 接收到的消息数据
|
||||||
* @param msgType 消息类型
|
* @param msgType 消息类型
|
||||||
*/
|
*/
|
||||||
void CFesRxControlCmdThread::RxDoControl(const std::string &RecvStr,const int &msgType)
|
void CFesRxControlCmdThread::RxDoControl(const void* data,size_t dataSize,const int &msgType)
|
||||||
{
|
{
|
||||||
SFesRxDoCmd cmd;
|
boost::ignore_unused_variable_warning(msgType);
|
||||||
CFesRtuPtr ptrCFesRtu;
|
|
||||||
SFesDoRequestPkg DoReqPkg;
|
|
||||||
|
|
||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get protocbuf data
|
|
||||||
memset(&cmd,0,sizeof(SFesRxDoCmd));
|
|
||||||
DoReqPkg.ParseFromString(RecvStr);
|
|
||||||
strcpy(cmd.TableName,(const char *)DoReqPkg.strapptablename().c_str());
|
|
||||||
strcpy(cmd.ColumnName,(const char *)DoReqPkg.strappcolumnname().c_str());
|
|
||||||
strcpy(cmd.TagName,(const char *)DoReqPkg.strapptagname().c_str());
|
|
||||||
strcpy(cmd.RtuName,(const char *)DoReqPkg.strrtuname().c_str());
|
|
||||||
cmd.PointID = DoReqPkg.norder();
|
|
||||||
cmd.iValue = DoReqPkg.naction();
|
|
||||||
switch(msgType)
|
|
||||||
{
|
|
||||||
case MT_FES_DO_SELECT:
|
|
||||||
cmd.CtrlActType = CN_ControlSelect;
|
|
||||||
break;
|
|
||||||
case MT_FES_DO_CANCEL:
|
|
||||||
cmd.CtrlActType = CN_ControlAbort;
|
|
||||||
break;
|
|
||||||
case MT_FES_DO_PREVENT:
|
|
||||||
cmd.CtrlActType = CN_ControlPrevent;
|
|
||||||
break;
|
|
||||||
case MT_FES_DO_EXECUTE:
|
|
||||||
cmd.CtrlActType = CN_ControlExecute;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGERROR("CFesRxControlCmdThread::RxDoControl invaild msgType:%d ",msgType);
|
|
||||||
break;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.TagtState = DoReqPkg.niftagtstate();
|
SFesDoRequestPkg DoReqPkg;
|
||||||
if(DoReqPkg.has_lpara1()==true)
|
if(!DoReqPkg.ParseFromArray(data,static_cast<int>(dataSize)))
|
||||||
cmd.Param1 = DoReqPkg.lpara1();
|
|
||||||
if(DoReqPkg.has_lpara2()==true)
|
|
||||||
cmd.Param2 = DoReqPkg.lpara2();
|
|
||||||
if(DoReqPkg.has_fpara()==true)
|
|
||||||
cmd.Param1 = DoReqPkg.fpara();
|
|
||||||
if(DoReqPkg.has_strpara()==true)
|
|
||||||
{
|
{
|
||||||
int strLen;
|
LOGERROR("CFesRxControlCmdThread::RxDoControl parse recv msg failed");
|
||||||
if(DoReqPkg.strpara().size()>(CN_FesControlStrParamSize-1))
|
return;
|
||||||
strLen = CN_FesControlStrParamSize-1;
|
|
||||||
else
|
|
||||||
strLen = DoReqPkg.strpara().size();
|
|
||||||
memcpy(cmd.strParam,(const char *)DoReqPkg.strpara().c_str(),strLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(cmd.RtuName);
|
|
||||||
if(ptrCFesRtu!=NULL)
|
|
||||||
{
|
|
||||||
cmd.RtuNo = ptrCFesRtu->m_Param.RtuNo;//2019-3-4 thxiao 转发规约需要RtuNo,所以此处加上。
|
|
||||||
LOGDEBUG("RxDoControl() RTUNo:%d PointNo:%d CtrlActType:%d iValue:%d",cmd.RtuNo,cmd.PointID,cmd.CtrlActType,cmd.iValue);
|
|
||||||
ptrCFesRtu->WriteRxDoCmdBuf(1,&cmd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGERROR("RxDoControl() can not find RTU:%s",cmd.RtuName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addDoControl(DoReqPkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,63 +163,23 @@ void CFesRxControlCmdThread::RxDoControl(const std::string &RecvStr,const int &m
|
|||||||
* 接收AO控制命令,并把命令转发到RTU对应的命令缓存区
|
* 接收AO控制命令,并把命令转发到RTU对应的命令缓存区
|
||||||
* @param RecvStr 接收到的消息数据
|
* @param RecvStr 接收到的消息数据
|
||||||
*/
|
*/
|
||||||
void CFesRxControlCmdThread::RxAoControl(const std::string &RecvStr,const int &msgType)
|
void CFesRxControlCmdThread::RxAoControl(const void* data,size_t dataSize,const int &msgType)
|
||||||
{
|
{
|
||||||
CFesRtuPtr ptrCFesRtu;
|
boost::ignore_unused_variable_warning(msgType);
|
||||||
SFesRxAoCmd cmd;
|
|
||||||
SFesAoRequestPkg AoReqPkg;
|
|
||||||
|
|
||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get protocbuf data
|
|
||||||
memset(&cmd,0,sizeof(SFesRxAoCmd));
|
|
||||||
AoReqPkg.ParseFromString(RecvStr);
|
|
||||||
strcpy(cmd.TableName,(const char *)AoReqPkg.strapptablename().c_str());
|
|
||||||
strcpy(cmd.ColumnName,(const char *)AoReqPkg.strappcolumnname().c_str());
|
|
||||||
strcpy(cmd.TagName,(const char *)AoReqPkg.strapptagname().c_str());
|
|
||||||
strcpy(cmd.RtuName,(const char *)AoReqPkg.strrtuname().c_str());
|
|
||||||
cmd.PointID = AoReqPkg.norder();
|
|
||||||
cmd.fValue = AoReqPkg.fvalue();
|
|
||||||
//cmd.CtrlActType = AoReqPkg.nctrltype();
|
|
||||||
|
|
||||||
switch(msgType)
|
|
||||||
{
|
|
||||||
case MT_FES_AO_EXECUTE:
|
|
||||||
cmd.CtrlActType = CN_ControlExecute;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGERROR("CFesRxControlCmdThread::RxDoControl invaild msgType:%d ",msgType);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.TagtState = AoReqPkg.niftagtstate();
|
SFesAoRequestPkg AoReqPkg;
|
||||||
if(AoReqPkg.has_lpara1()==true)
|
if(!AoReqPkg.ParseFromArray(data,static_cast<int>(dataSize)))
|
||||||
cmd.Param1 = AoReqPkg.lpara1();
|
|
||||||
if(AoReqPkg.has_lpara2()==true)
|
|
||||||
cmd.Param2 = AoReqPkg.lpara2();
|
|
||||||
if(AoReqPkg.has_fpara()==true)
|
|
||||||
cmd.Param1 = AoReqPkg.fpara();
|
|
||||||
if(AoReqPkg.has_strpara()==true)
|
|
||||||
{
|
{
|
||||||
int strLen;
|
LOGERROR("CFesRxControlCmdThread::RxAoControl parse recv msg failed");
|
||||||
if(AoReqPkg.strpara().size()>(CN_FesControlStrParamSize-1))
|
return;
|
||||||
strLen = CN_FesControlStrParamSize-1;
|
|
||||||
else
|
|
||||||
strLen = AoReqPkg.strpara().size();
|
|
||||||
memcpy(cmd.strParam,(const char *)AoReqPkg.strpara().c_str(),strLen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(cmd.RtuName);
|
addAoControl(AoReqPkg);
|
||||||
if(ptrCFesRtu!=NULL)
|
|
||||||
{
|
|
||||||
cmd.RtuNo = ptrCFesRtu->m_Param.RtuNo;//2019-03-18 thxiao 转发规约需要RtuNo,所以此处加上。
|
|
||||||
ptrCFesRtu->WriteRxAoCmdBuf(1,&cmd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGERROR("CFesRxControlCmdThread::RxAoControl can not find RTU:%s",cmd.RtuName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -264,71 +187,23 @@ void CFesRxControlCmdThread::RxAoControl(const std::string &RecvStr,const int &m
|
|||||||
* 接收MO控制命令,并把命令转发到RTU对应的命令缓存区
|
* 接收MO控制命令,并把命令转发到RTU对应的命令缓存区
|
||||||
* @param RecvStr 接收到的消息数据
|
* @param RecvStr 接收到的消息数据
|
||||||
*/
|
*/
|
||||||
void CFesRxControlCmdThread::RxMoControl(const std::string &RecvStr,const int &msgType)
|
void CFesRxControlCmdThread::RxMoControl(const void* data,size_t dataSize,const int &msgType)
|
||||||
{
|
{
|
||||||
CFesRtuPtr ptrCFesRtu;
|
boost::ignore_unused_variable_warning(msgType);
|
||||||
SFesRxMoCmd cmd;
|
|
||||||
SFesMoRequestPkg MoReqPkg;
|
|
||||||
|
|
||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// get protocbuf data
|
|
||||||
memset(&cmd,0,sizeof(cmd));
|
|
||||||
MoReqPkg.ParseFromString(RecvStr);
|
|
||||||
strcpy(cmd.TableName,(const char *)MoReqPkg.strapptablename().c_str());
|
|
||||||
strcpy(cmd.ColumnName,(const char *)MoReqPkg.strappcolumnname().c_str());
|
|
||||||
strcpy(cmd.TagName,(const char *)MoReqPkg.strapptagname().c_str());
|
|
||||||
strcpy(cmd.RtuName,(const char *)MoReqPkg.strrtuname().c_str());
|
|
||||||
cmd.PointID = MoReqPkg.norder();
|
|
||||||
cmd.iValue = MoReqPkg.nvalue();
|
|
||||||
//cmd.CtrlActType = MoReqPkg.nctrltype();
|
|
||||||
switch(msgType)
|
|
||||||
{
|
|
||||||
|
|
||||||
case MT_FES_MO_SELECT:
|
|
||||||
cmd.CtrlActType = CN_ControlSelect;
|
|
||||||
break;
|
|
||||||
case MT_FES_MO_CANCEL:
|
|
||||||
cmd.CtrlActType = CN_ControlAbort;
|
|
||||||
break;
|
|
||||||
case MT_FES_MO_PREVENT:
|
|
||||||
cmd.CtrlActType = CN_ControlPrevent;
|
|
||||||
break;
|
|
||||||
case MT_FES_MO_EXECUTE:
|
|
||||||
cmd.CtrlActType = CN_ControlExecute;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOGERROR("CFesRxControlCmdThread::RxDoControl invaild msgType:%d ",msgType);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.TagtState = MoReqPkg.niftagtstate();
|
SFesMoRequestPkg MoReqPkg;
|
||||||
if(MoReqPkg.has_lpara1()==true)
|
if(!MoReqPkg.ParseFromArray(data,static_cast<int>(dataSize)))
|
||||||
cmd.Param1 = MoReqPkg.lpara1();
|
|
||||||
if(MoReqPkg.has_lpara2()==true)
|
|
||||||
cmd.Param2 = MoReqPkg.lpara2();
|
|
||||||
if(MoReqPkg.has_fpara()==true)
|
|
||||||
cmd.Param1 = MoReqPkg.fpara();
|
|
||||||
if(MoReqPkg.has_strpara()==true)
|
|
||||||
{
|
{
|
||||||
int strLen;
|
LOGERROR("CFesRxControlCmdThread::RxMoControl parse recv msg failed");
|
||||||
if(MoReqPkg.strpara().size()>(CN_FesControlStrParamSize-1))
|
return;
|
||||||
strLen = CN_FesControlStrParamSize-1;
|
|
||||||
else
|
|
||||||
strLen = MoReqPkg.strpara().size();
|
|
||||||
memcpy(cmd.strParam,(const char *)MoReqPkg.strpara().c_str(),strLen);
|
|
||||||
}
|
|
||||||
ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(cmd.RtuName);
|
|
||||||
if(ptrCFesRtu!=NULL)
|
|
||||||
{
|
|
||||||
cmd.RtuNo = ptrCFesRtu->m_Param.RtuNo;//2019-03-18 thxiao 转发规约需要RtuNo,所以此处加上。
|
|
||||||
ptrCFesRtu->WriteRxMoCmdBuf(1,&cmd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGERROR("CFesRxControlCmdThread::RxMoControl can not find RTU:%s",cmd.RtuName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addMoControl(MoReqPkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -339,7 +214,7 @@ void CFesRxControlCmdThread::RxMoControl(const std::string &RecvStr,const int &m
|
|||||||
* @param pData 接收到的命令数据
|
* @param pData 接收到的命令数据
|
||||||
* @param DataSize 接收到的命令数据长度
|
* @param DataSize 接收到的命令数据长度
|
||||||
*/
|
*/
|
||||||
void CFesRxControlCmdThread::RxSettingControl(const std::string &RecvStr,const int &msgType)
|
void CFesRxControlCmdThread::RxSettingControl(const void* data,size_t dataSize,const int &msgType)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
SFesRxSettingCmd cmd;
|
SFesRxSettingCmd cmd;
|
||||||
@ -351,7 +226,7 @@ void CFesRxControlCmdThread::RxSettingControl(const std::string &RecvStr,const i
|
|||||||
|
|
||||||
// get protocbuf data
|
// get protocbuf data
|
||||||
memset(&cmd,0,sizeof(SFesRxSettingCmd));
|
memset(&cmd,0,sizeof(SFesRxSettingCmd));
|
||||||
SettingPkg.ParseFromString(RecvStr);
|
SettingPkg.ParseFromArray(data,static_cast<int>(dataSize));
|
||||||
cmd.RtuNo = SettingPkg.nrtuno();
|
cmd.RtuNo = SettingPkg.nrtuno();
|
||||||
cmd.DevId = SettingPkg.ndevid();
|
cmd.DevId = SettingPkg.ndevid();
|
||||||
|
|
||||||
@ -406,7 +281,7 @@ void CFesRxControlCmdThread::RxSettingControl(const std::string &RecvStr,const i
|
|||||||
* @param pData 接收到的命令数据
|
* @param pData 接收到的命令数据
|
||||||
* @param DataSize 接收到的命令数据长度
|
* @param DataSize 接收到的命令数据长度
|
||||||
*/
|
*/
|
||||||
void CFesRxControlCmdThread::RxDefCmdControl(const std::string &RecvStr)
|
void CFesRxControlCmdThread::RxDefCmdControl(const void* data,size_t dataSize)
|
||||||
{
|
{
|
||||||
int i,count;
|
int i,count;
|
||||||
SFesRxDefCmd cmd;
|
SFesRxDefCmd cmd;
|
||||||
@ -418,7 +293,7 @@ void CFesRxControlCmdThread::RxDefCmdControl(const std::string &RecvStr)
|
|||||||
|
|
||||||
// get protocbuf data
|
// get protocbuf data
|
||||||
//memset(&cmd,0,sizeof(SFesRxDefCmd));
|
//memset(&cmd,0,sizeof(SFesRxDefCmd));
|
||||||
CmddefPkg.ParseFromString(RecvStr);
|
CmddefPkg.ParseFromArray(data,static_cast<int>(dataSize));
|
||||||
strcpy(cmd.TableName,(const char *)CmddefPkg.strapptablename().c_str());
|
strcpy(cmd.TableName,(const char *)CmddefPkg.strapptablename().c_str());
|
||||||
strcpy(cmd.ColumnName,(const char *)CmddefPkg.strappcolumnname().c_str());
|
strcpy(cmd.ColumnName,(const char *)CmddefPkg.strappcolumnname().c_str());
|
||||||
strcpy(cmd.TagName,(const char *)CmddefPkg.strapptagname().c_str());
|
strcpy(cmd.TagName,(const char *)CmddefPkg.strapptagname().c_str());
|
||||||
@ -449,6 +324,284 @@ void CFesRxControlCmdThread::RxDefCmdControl(const std::string &RecvStr)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFesRxControlCmdThread::RxBatchPntCmd(const void* data,size_t dataSize)
|
||||||
|
{
|
||||||
|
if(m_ptrCFesBase==NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SFesCtrlRequestSeq vecReq;
|
||||||
|
if(!vecReq.ParseFromArray(data,static_cast<int>(dataSize)))
|
||||||
|
{
|
||||||
|
LOGERROR("CFesRxControlCmdThread::RxBatchPntCmd parse recv msg failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int nAo = 0; nAo < vecReq.ao_seq_size(); nAo++)
|
||||||
|
{
|
||||||
|
addAoControl(vecReq.ao_seq(nAo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRxControlCmdThread::addDoControl(const SFesDoRequestPkg &doReq)
|
||||||
|
{
|
||||||
|
SFesRxDoCmd cmd;
|
||||||
|
strcpy(cmd.TableName,(const char *)doReq.strapptablename().c_str());
|
||||||
|
strcpy(cmd.ColumnName,(const char *)doReq.strappcolumnname().c_str());
|
||||||
|
strcpy(cmd.TagName,(const char *)doReq.strapptagname().c_str());
|
||||||
|
strcpy(cmd.RtuName,(const char *)doReq.strrtuname().c_str());
|
||||||
|
cmd.PointID = doReq.norder();
|
||||||
|
cmd.iValue = doReq.naction();
|
||||||
|
//DoReqPkg.nctrltype()的值与msgType一致
|
||||||
|
switch(doReq.nctrltype())
|
||||||
|
{
|
||||||
|
case MT_FES_DO_SELECT:
|
||||||
|
cmd.CtrlActType = CN_ControlSelect;
|
||||||
|
break;
|
||||||
|
case MT_FES_DO_CANCEL:
|
||||||
|
cmd.CtrlActType = CN_ControlAbort;
|
||||||
|
break;
|
||||||
|
case MT_FES_DO_PREVENT:
|
||||||
|
cmd.CtrlActType = CN_ControlPrevent;
|
||||||
|
break;
|
||||||
|
case MT_FES_DO_EXECUTE:
|
||||||
|
cmd.CtrlActType = CN_ControlExecute;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOGERROR("CFesRxControlCmdThread::addDoControl invaild msgType:%d ",doReq.nctrltype());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.TagtState = doReq.niftagtstate();
|
||||||
|
if(doReq.has_lpara1())
|
||||||
|
{
|
||||||
|
cmd.Param1 = doReq.lpara1();
|
||||||
|
}
|
||||||
|
if(doReq.has_lpara2())
|
||||||
|
{
|
||||||
|
cmd.Param2 = doReq.lpara2();
|
||||||
|
}
|
||||||
|
if(doReq.has_fpara())
|
||||||
|
{
|
||||||
|
cmd.fParam = doReq.fpara();
|
||||||
|
}
|
||||||
|
if(doReq.has_strpara())
|
||||||
|
{
|
||||||
|
int strLen;
|
||||||
|
if(doReq.strpara().size()>(CN_FesControlStrParamSize-1))
|
||||||
|
strLen = CN_FesControlStrParamSize-1;
|
||||||
|
else
|
||||||
|
strLen = static_cast<int>(doReq.strpara().size());
|
||||||
|
memcpy(cmd.strParam,(const char *)doReq.strpara().c_str(),strLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesRtuPtr ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(cmd.RtuName);
|
||||||
|
if(ptrCFesRtu!=NULL)
|
||||||
|
{
|
||||||
|
cmd.RtuNo = ptrCFesRtu->m_Param.RtuNo;//2019-3-4 thxiao 转发规约需要RtuNo,所以此处加上。
|
||||||
|
LOGTRACE("addDoControl() RTUNo:%d PointNo:%d CtrlActType:%d iValue:%d",cmd.RtuNo,cmd.PointID,cmd.CtrlActType,cmd.iValue);
|
||||||
|
ptrCFesRtu->WriteRxDoCmdBuf(1,&cmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGERROR("addDoControl() can not find RTU:%s",cmd.RtuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRxControlCmdThread::addAoControl(const iot_idl::SFesAoRequestPkg &aoReq)
|
||||||
|
{
|
||||||
|
SFesRxAoCmd cmd;
|
||||||
|
strcpy(cmd.TableName,(const char *)aoReq.strapptablename().c_str());
|
||||||
|
strcpy(cmd.ColumnName,(const char *)aoReq.strappcolumnname().c_str());
|
||||||
|
strcpy(cmd.TagName,(const char *)aoReq.strapptagname().c_str());
|
||||||
|
strcpy(cmd.RtuName,(const char *)aoReq.strrtuname().c_str());
|
||||||
|
cmd.PointID = aoReq.norder();
|
||||||
|
cmd.fValue = aoReq.fvalue();
|
||||||
|
//aoReq.nctrltype(); //控制类型:选择、执行、取消,与消息类型一致
|
||||||
|
|
||||||
|
switch(aoReq.nctrltype())
|
||||||
|
{
|
||||||
|
case MT_FES_AO_EXECUTE:
|
||||||
|
cmd.CtrlActType = CN_ControlExecute;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOGERROR("CFesRxControlCmdThread::addAoControl invaild msgType:%d ",aoReq.nctrltype());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.TagtState = aoReq.niftagtstate();
|
||||||
|
if(aoReq.has_lpara1())
|
||||||
|
{
|
||||||
|
cmd.Param1 = aoReq.lpara1();
|
||||||
|
}
|
||||||
|
if(aoReq.has_lpara2())
|
||||||
|
{
|
||||||
|
cmd.Param2 = aoReq.lpara2();
|
||||||
|
}
|
||||||
|
if(aoReq.has_fpara())
|
||||||
|
{
|
||||||
|
cmd.fParam = aoReq.fpara();
|
||||||
|
}
|
||||||
|
if(aoReq.has_strpara())
|
||||||
|
{
|
||||||
|
int strLen;
|
||||||
|
if(aoReq.strpara().size()>(CN_FesControlStrParamSize-1))
|
||||||
|
strLen = CN_FesControlStrParamSize-1;
|
||||||
|
else
|
||||||
|
strLen = static_cast<int>(aoReq.strpara().size());
|
||||||
|
memcpy(cmd.strParam,(const char *)aoReq.strpara().c_str(),strLen);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFesRtuPtr ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(cmd.RtuName);
|
||||||
|
if(ptrCFesRtu != NULL)
|
||||||
|
{
|
||||||
|
cmd.RtuNo = ptrCFesRtu->m_Param.RtuNo;//2019-03-18 thxiao 转发规约需要RtuNo,所以此处加上。
|
||||||
|
ptrCFesRtu->WriteRxAoCmdBuf(1,&cmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGERROR("CFesRxControlCmdThread::addAoControl can not find RTU:%s",cmd.RtuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRxControlCmdThread::addMoControl(const SFesMoRequestPkg &moReq)
|
||||||
|
{
|
||||||
|
SFesRxMoCmd cmd;
|
||||||
|
strcpy(cmd.TableName,(const char *)moReq.strapptablename().c_str());
|
||||||
|
strcpy(cmd.ColumnName,(const char *)moReq.strappcolumnname().c_str());
|
||||||
|
strcpy(cmd.TagName,(const char *)moReq.strapptagname().c_str());
|
||||||
|
strcpy(cmd.RtuName,(const char *)moReq.strrtuname().c_str());
|
||||||
|
cmd.PointID = moReq.norder();
|
||||||
|
cmd.iValue = moReq.nvalue();
|
||||||
|
//< moReq.nctrltype() 与消息类型一致
|
||||||
|
switch(moReq.nctrltype())
|
||||||
|
{
|
||||||
|
case MT_FES_MO_SELECT:
|
||||||
|
cmd.CtrlActType = CN_ControlSelect;
|
||||||
|
break;
|
||||||
|
case MT_FES_MO_CANCEL:
|
||||||
|
cmd.CtrlActType = CN_ControlAbort;
|
||||||
|
break;
|
||||||
|
case MT_FES_MO_PREVENT:
|
||||||
|
cmd.CtrlActType = CN_ControlPrevent;
|
||||||
|
break;
|
||||||
|
case MT_FES_MO_EXECUTE:
|
||||||
|
cmd.CtrlActType = CN_ControlExecute;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOGERROR("CFesRxControlCmdThread::RxDoControl invaild msgType:%d ",moReq.nctrltype());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.TagtState = moReq.niftagtstate();
|
||||||
|
if(moReq.has_lpara1())
|
||||||
|
{
|
||||||
|
cmd.Param1 = moReq.lpara1();
|
||||||
|
}
|
||||||
|
if(moReq.has_lpara2())
|
||||||
|
{
|
||||||
|
cmd.Param2 = moReq.lpara2();
|
||||||
|
}
|
||||||
|
if(moReq.has_fpara())
|
||||||
|
{
|
||||||
|
cmd.fParam = moReq.fpara();
|
||||||
|
}
|
||||||
|
if(moReq.has_strpara())
|
||||||
|
{
|
||||||
|
int strLen;
|
||||||
|
if(moReq.strpara().size()>(CN_FesControlStrParamSize-1))
|
||||||
|
strLen = CN_FesControlStrParamSize-1;
|
||||||
|
else
|
||||||
|
strLen = static_cast<int>(moReq.strpara().size());
|
||||||
|
memcpy(cmd.strParam,(const char *)moReq.strpara().c_str(),strLen);
|
||||||
|
}
|
||||||
|
CFesRtuPtr ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(cmd.RtuName);
|
||||||
|
if(ptrCFesRtu!=NULL)
|
||||||
|
{
|
||||||
|
cmd.RtuNo = ptrCFesRtu->m_Param.RtuNo;//2019-03-18 thxiao 转发规约需要RtuNo,所以此处加上。
|
||||||
|
ptrCFesRtu->WriteRxMoCmdBuf(1,&cmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGERROR("CFesRxControlCmdThread::addMoControl can not find RTU:%s",cmd.RtuName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRxControlCmdThread::handleJsonFormatRtuCmd(const CMbMessage &stMsg)
|
||||||
|
{
|
||||||
|
LOGTRACE("handleJsonFormatRtuCmd: recv json cmd=%s",stMsg.printInfoToStr().c_str());
|
||||||
|
|
||||||
|
if(m_ptrCFesBase==NULL)
|
||||||
|
{
|
||||||
|
LOGERROR("m_ptrCFesBase is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rapidjson::Document doc;
|
||||||
|
if( doc.Parse((const char *)stMsg.getDataPtr(),stMsg.getDataSize()).HasParseError() )
|
||||||
|
{
|
||||||
|
string strMsg((const char*)stMsg.getDataPtr(),stMsg.getDataSize());
|
||||||
|
LOGERROR("handleJsonFormatCmd: parse json cmd failed ,error=%d. cmd=\n%s",
|
||||||
|
doc.GetParseError(),strMsg.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(doc.IsObject())
|
||||||
|
{
|
||||||
|
addJsonFormatRtuCmd(doc);
|
||||||
|
}
|
||||||
|
else if(doc.IsArray())
|
||||||
|
{
|
||||||
|
for(size_t i = 0; i < doc.Size();i++)
|
||||||
|
{
|
||||||
|
const rapidjson::Value& arrValue = doc[i];
|
||||||
|
if(arrValue.IsObject())
|
||||||
|
{
|
||||||
|
addJsonFormatRtuCmd(arrValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGERROR("handleJsonFormatCmd: the element is not object format.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string strMsg((const char *)stMsg.getDataPtr(),stMsg.getDataSize());
|
||||||
|
LOGERROR("handleJsonFormatCmd: invalid json format.str=\n%s",strMsg.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFesRxControlCmdThread::addJsonFormatRtuCmd(const rapidjson::Value &value)
|
||||||
|
{
|
||||||
|
const rapidjson::Value::ConstMemberIterator &iterInfo = value.FindMember(CN_JSON_KEY_RTUNAME);
|
||||||
|
if(iterInfo == value.MemberEnd())
|
||||||
|
{
|
||||||
|
LOGERROR("addJsonFormatRtuCmd: has not key : %s",CN_JSON_KEY_RTUNAME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rapidjson::Value& rtuValue = iterInfo->value;
|
||||||
|
|
||||||
|
if(!rtuValue.IsString())
|
||||||
|
{
|
||||||
|
LOGERROR("addJsonFormatRtuCmd: rtu_name is not a string. type=%d",rtuValue.GetType());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string strRtuName = rtuValue.GetString();
|
||||||
|
CFesRtuPtr ptrCFesRtu = m_ptrCFesBase->GetRtuDataByRtuTag(const_cast<char*>(strRtuName.c_str()));
|
||||||
|
if(ptrCFesRtu != NULL)
|
||||||
|
{
|
||||||
|
LOGDEBUG("addJsonFormatRtuCmd: recv json cmd. rtu_name=%s",strRtuName.c_str());
|
||||||
|
ptrCFesRtu->writeJsonFormatReqCmd(value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGERROR("addJsonFormatRtuCmd can not find RTU:%s",strRtuName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//订阅消息通道
|
//订阅消息通道
|
||||||
int CFesRxControlCmdThread::subMessage()
|
int CFesRxControlCmdThread::subMessage()
|
||||||
|
|||||||
@ -3,8 +3,18 @@
|
|||||||
#include "FesDef.h"
|
#include "FesDef.h"
|
||||||
#include "FesBase.h"
|
#include "FesBase.h"
|
||||||
#include "net/net_msg_bus_api/MsgBusApi.h"
|
#include "net/net_msg_bus_api/MsgBusApi.h"
|
||||||
|
#include "FesMessage.pb.h"
|
||||||
|
|
||||||
using namespace iot_net;
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable: 4003)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "rapidjson/document.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
class CFesRxControlCmdThread : public iot_public::CTimerThreadBase
|
class CFesRxControlCmdThread : public iot_public::CTimerThreadBase
|
||||||
{
|
{
|
||||||
@ -31,19 +41,26 @@ public:
|
|||||||
int unsubMessage();
|
int unsubMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMbCommunicator *m_ptrRxCommunicator;
|
iot_net::CMbCommunicator *m_ptrRxCommunicator;
|
||||||
byte *m_pRxData;
|
byte *m_pRxData;
|
||||||
int m_iDomainID;
|
int m_iDomainID;
|
||||||
int m_iAppID;
|
int m_iAppID;
|
||||||
int m_iChannelID;
|
int m_iChannelID;
|
||||||
CFesBase *m_ptrCFesBase;
|
CFesBase *m_ptrCFesBase;
|
||||||
|
|
||||||
void RxDoControl(const std::string &RecvStr,const int &msgType);
|
void RxDoControl(const void* data,size_t dataSize,const int &msgType);
|
||||||
void RxAoControl(const std::string &RecvStr,const int &msgType);
|
void RxAoControl(const void* data,size_t dataSize,const int &msgType);
|
||||||
void RxMoControl(const std::string &RecvStr,const int &msgType);
|
void RxMoControl(const void* data,size_t dataSize,const int &msgType);
|
||||||
void RxSettingControl(const std::string &RecvStr,const int &msgType);
|
void RxSettingControl(const void* data,size_t dataSize,const int &msgType);
|
||||||
void RxDefCmdControl(const std::string &RecvStr);
|
void RxDefCmdControl(const void* data,size_t dataSize);
|
||||||
|
void RxBatchPntCmd(const void* data,size_t dataSize);
|
||||||
|
|
||||||
|
void addDoControl(const iot_idl::SFesDoRequestPkg &doReq);
|
||||||
|
void addAoControl(const iot_idl::SFesAoRequestPkg &aoReq);
|
||||||
|
void addMoControl(const iot_idl::SFesMoRequestPkg &moReq);
|
||||||
|
|
||||||
|
void handleJsonFormatRtuCmd(const iot_net::CMbMessage &stMsg);
|
||||||
|
void addJsonFormatRtuCmd(const rapidjson::Value &value);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::shared_ptr<CFesRxControlCmdThread> CFesRxControlCmdThreadPtr;
|
typedef boost::shared_ptr<CFesRxControlCmdThread> CFesRxControlCmdThreadPtr;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ using namespace iot_idl;
|
|||||||
using namespace iot_service;
|
using namespace iot_service;
|
||||||
|
|
||||||
CFesRxDPDataThread::CFesRxDPDataThread(int iDomainID, int iAppID ,void* FesBaseAddr):
|
CFesRxDPDataThread::CFesRxDPDataThread(int iDomainID, int iAppID ,void* FesBaseAddr):
|
||||||
CTimerThreadBase("FesRxDPDataThread",30)
|
CTimerThreadBase("FesRxDPDataThread",0)
|
||||||
{
|
{
|
||||||
m_ptrRxCommunicator = new CMbCommunicator("FesRxDPDataThread");
|
m_ptrRxCommunicator = new CMbCommunicator("FesRxDPDataThread");
|
||||||
m_iDomainID = iDomainID;
|
m_iDomainID = iDomainID;
|
||||||
@ -132,7 +132,6 @@ int CFesRxDPDataThread::unsubMessage()
|
|||||||
*/
|
*/
|
||||||
int CFesRxDPDataThread::readFromBus()
|
int CFesRxDPDataThread::readFromBus()
|
||||||
{
|
{
|
||||||
std::string RecvStr;
|
|
||||||
CMbMessage msgRcv;
|
CMbMessage msgRcv;
|
||||||
|
|
||||||
if (m_ptrRxCommunicator == NULL)
|
if (m_ptrRxCommunicator == NULL)
|
||||||
@ -140,14 +139,14 @@ int CFesRxDPDataThread::readFromBus()
|
|||||||
|
|
||||||
//1.从消息总线接收消息,没有消息返回FALSE
|
//1.从消息总线接收消息,没有消息返回FALSE
|
||||||
//====================================================================================
|
//====================================================================================
|
||||||
if (m_ptrRxCommunicator->recvMsg(msgRcv))
|
if (m_ptrRxCommunicator->recvMsg(msgRcv,100))
|
||||||
{
|
{
|
||||||
int nMessageType = msgRcv.getMsgType();
|
int nMessageType = msgRcv.getMsgType();
|
||||||
//LOGDEBUG("readFromBus nMessageType=%d ", nMessageType);
|
//LOGDEBUG("readFromBus nMessageType=%d ", nMessageType);
|
||||||
if (nMessageType == MT_DP_CHANGE_DATA)
|
if (nMessageType == MT_DP_CHANGE_DATA)
|
||||||
{
|
{
|
||||||
SRealTimeDataPkg ChangeDataPkg;
|
SRealTimeDataPkg ChangeDataPkg;
|
||||||
if (true == ChangeDataPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize()))
|
if (true == ChangeDataPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) ))
|
||||||
{
|
{
|
||||||
if (iotFailed == RxDiChangeData(ChangeDataPkg))
|
if (iotFailed == RxDiChangeData(ChangeDataPkg))
|
||||||
{
|
{
|
||||||
@ -200,12 +199,10 @@ int CFesRxDPDataThread::RxDiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
if (nChangeNum > 0)
|
if (nChangeNum > 0)
|
||||||
{
|
{
|
||||||
mSec = getUTCTimeMsec();
|
mSec = getUTCTimeMsec();
|
||||||
SDiRealTimeData diStru;
|
|
||||||
std::string strTagName = "";
|
|
||||||
for (i = 0; i < nChangeNum; i++)
|
for (i = 0; i < nChangeNum; i++)
|
||||||
{
|
{
|
||||||
diStru = ChangeDataPkg.stdirtd(i);
|
const SDiRealTimeData &diStru = ChangeDataPkg.stdirtd(i);
|
||||||
strTagName = diStru.strtagname();
|
const std::string &strTagName = diStru.strtagname();
|
||||||
|
|
||||||
if ((pPubDi = m_ptrCFesBase->GetFesFwPubDpDi(strTagName)) == NULL)
|
if ((pPubDi = m_ptrCFesBase->GetFesFwPubDpDi(strTagName)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -282,23 +279,16 @@ int CFesRxDPDataThread::RxDiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
*/
|
*/
|
||||||
int CFesRxDPDataThread::RxAiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
int CFesRxDPDataThread::RxAiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
||||||
{
|
{
|
||||||
int i,j;
|
|
||||||
CFesRtuPtr ptrFwRtu;
|
CFesRtuPtr ptrFwRtu;
|
||||||
SFesFwChgAi ChangeInfo;
|
SFesFwChgAi ChangeInfo;
|
||||||
SFesFwPubAi *pPubAi = NULL;
|
SFesFwPubAi *pPubAi = NULL;
|
||||||
uint64 mSec;
|
uint64 mSec = getUTCTimeMsec();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int nChangeNum = ChangeDataPkg.stairtd_size();
|
|
||||||
if (nChangeNum > 0)
|
|
||||||
{
|
|
||||||
mSec = getUTCTimeMsec();
|
|
||||||
::iot_idl::SAiRealTimeData aiStru;
|
|
||||||
std::string strTagName = "";
|
std::string strTagName = "";
|
||||||
for (i = 0; i < nChangeNum; i++)
|
|
||||||
|
int nChangeNum = ChangeDataPkg.stairtd_size();
|
||||||
|
for (int i = 0; i < nChangeNum; i++)
|
||||||
{
|
{
|
||||||
aiStru = ChangeDataPkg.stairtd(i);
|
const iot_idl::SAiRealTimeData &aiStru = ChangeDataPkg.stairtd(i);
|
||||||
strTagName = aiStru.strtagname();
|
strTagName = aiStru.strtagname();
|
||||||
|
|
||||||
if ((pPubAi = m_ptrCFesBase->GetFesFwPubDpAi(strTagName)) == NULL)
|
if ((pPubAi = m_ptrCFesBase->GetFesFwPubDpAi(strTagName)) == NULL)
|
||||||
@ -309,29 +299,25 @@ int CFesRxDPDataThread::RxAiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
pPubAi->time = mSec;
|
pPubAi->time = mSec;
|
||||||
ChangeInfo.RtuNo = pPubAi->FesRtuNo;
|
ChangeInfo.RtuNo = pPubAi->FesRtuNo;
|
||||||
ChangeInfo.PointNo = pPubAi->SrcPointNo;
|
ChangeInfo.PointNo = pPubAi->SrcPointNo;
|
||||||
ChangeInfo.Value = pPubAi->Value;
|
|
||||||
ChangeInfo.Status = pPubAi->Status;
|
ChangeInfo.Status = pPubAi->Status;
|
||||||
ChangeInfo.time = pPubAi->time;
|
ChangeInfo.time = pPubAi->time;
|
||||||
for (j = 0; j < pPubAi->FwMapNum; j++)
|
|
||||||
|
float fNewValue = 0.0f;
|
||||||
|
for (int j = 0; j < pPubAi->FwMapNum; j++)
|
||||||
{
|
{
|
||||||
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAi->FwMapping[j].MappingIndex)) == NULL)
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAi->FwMapping[j].MappingIndex)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
ChangeInfo.RemoteNo = pPubAi->FwMapping[j].RemoteNo;
|
ChangeInfo.RemoteNo = pPubAi->FwMapping[j].RemoteNo;
|
||||||
if(ptrFwRtu->UpdataFwAiValue(ChangeInfo,1))
|
ChangeInfo.Value = pPubAi->Value; //< 每次要设置为原始值,因为ChangeInfo在下面可能会被修改
|
||||||
|
|
||||||
|
if(ptrFwRtu->UpdataFwAiValue(ChangeInfo,fNewValue,eNormalUpdate)) //< fNewValue值会被更新
|
||||||
|
{
|
||||||
|
ChangeInfo.Value = fNewValue;
|
||||||
ptrFwRtu->WriteFwAiBuf(ChangeInfo);
|
ptrFwRtu->WriteFwAiBuf(ChangeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (std::exception &ex)
|
|
||||||
{
|
|
||||||
LOGERROR("RxAiChangeData Fail,errNo=%s",ex.what());
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,20 +334,13 @@ int CFesRxDPDataThread::RxAccChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
CFesRtuPtr ptrFwRtu;
|
CFesRtuPtr ptrFwRtu;
|
||||||
SFesFwChgAcc ChangeInfo;
|
SFesFwChgAcc ChangeInfo;
|
||||||
SFesFwPubAcc *pPubAcc = NULL;
|
SFesFwPubAcc *pPubAcc = NULL;
|
||||||
uint64 mSec;
|
uint64 mSec = getUTCTimeMsec();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int nChangeNum = ChangeDataPkg.stpirtd_size();
|
int nChangeNum = ChangeDataPkg.stpirtd_size();
|
||||||
if (nChangeNum > 0)
|
|
||||||
{
|
|
||||||
::iot_idl::SPiRealTimeData piStru;
|
|
||||||
std::string strTagName = "";
|
|
||||||
mSec = getUTCTimeMsec();
|
|
||||||
for (i = 0; i < nChangeNum; i++)
|
for (i = 0; i < nChangeNum; i++)
|
||||||
{
|
{
|
||||||
piStru = ChangeDataPkg.stpirtd(i);
|
const iot_idl::SPiRealTimeData &piStru = ChangeDataPkg.stpirtd(i);
|
||||||
strTagName = piStru.strtagname();
|
const std::string &strTagName = piStru.strtagname();
|
||||||
|
|
||||||
if ((pPubAcc = m_ptrCFesBase->GetFesFwPubDpAcc(strTagName)) == NULL)
|
if ((pPubAcc = m_ptrCFesBase->GetFesFwPubDpAcc(strTagName)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -371,31 +350,26 @@ int CFesRxDPDataThread::RxAccChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
pPubAcc->time = mSec;
|
pPubAcc->time = mSec;
|
||||||
ChangeInfo.RtuNo = pPubAcc->FesRtuNo;
|
ChangeInfo.RtuNo = pPubAcc->FesRtuNo;
|
||||||
ChangeInfo.PointNo = pPubAcc->SrcPointNo;
|
ChangeInfo.PointNo = pPubAcc->SrcPointNo;
|
||||||
ChangeInfo.Value = pPubAcc->Value;
|
|
||||||
ChangeInfo.Status = pPubAcc->Status;
|
ChangeInfo.Status = pPubAcc->Status;
|
||||||
ChangeInfo.time = pPubAcc->time;
|
ChangeInfo.time = pPubAcc->time;
|
||||||
|
|
||||||
|
double dNewValue = 0.0;
|
||||||
for (j = 0; j < pPubAcc->FwMapNum; j++)
|
for (j = 0; j < pPubAcc->FwMapNum; j++)
|
||||||
{
|
{
|
||||||
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAcc->FwMapping[j].MappingIndex)) == NULL)
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAcc->FwMapping[j].MappingIndex)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
ChangeInfo.RemoteNo = pPubAcc->FwMapping[j].RemoteNo;
|
ChangeInfo.RemoteNo = pPubAcc->FwMapping[j].RemoteNo;
|
||||||
if(ptrFwRtu->UpdataFwAccValue(ChangeInfo,1))
|
ChangeInfo.Value = pPubAcc->Value; //< 每次要重新赋值
|
||||||
|
|
||||||
|
if(ptrFwRtu->UpdataFwAccValue(ChangeInfo,dNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
ChangeInfo.Value = dNewValue;
|
||||||
ptrFwRtu->WriteFwAccBuf(ChangeInfo);
|
ptrFwRtu->WriteFwAccBuf(ChangeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (std::exception &ex)
|
|
||||||
{
|
|
||||||
LOGERROR("RxAccChangeData Fail,errNo=%s",ex.what());
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
return iotSuccess;
|
|
||||||
|
|
||||||
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -407,24 +381,16 @@ int CFesRxDPDataThread::RxAccChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
*/
|
*/
|
||||||
int CFesRxDPDataThread::RxMiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
int CFesRxDPDataThread::RxMiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
||||||
{
|
{
|
||||||
int j;
|
|
||||||
CFesRtuPtr ptrFwRtu;
|
CFesRtuPtr ptrFwRtu;
|
||||||
SFesFwChgMi ChangeInfo;
|
SFesFwChgMi ChangeInfo;
|
||||||
SFesFwPubMi *pPubMi = NULL;
|
SFesFwPubMi *pPubMi = NULL;
|
||||||
uint64 mSec;
|
uint64 mSec = getUTCTimeMsec();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int nChangeNum = ChangeDataPkg.stmirtd_size();
|
int nChangeNum = ChangeDataPkg.stmirtd_size();
|
||||||
if (nChangeNum > 0)
|
|
||||||
{
|
|
||||||
::iot_idl::SMiRealTimeData miStru;
|
|
||||||
std::string strTagName = "";
|
|
||||||
mSec = getUTCTimeMsec();
|
|
||||||
for (int i = 0; i < nChangeNum; i++)
|
for (int i = 0; i < nChangeNum; i++)
|
||||||
{
|
{
|
||||||
miStru = ChangeDataPkg.stmirtd(i);
|
const iot_idl::SMiRealTimeData &miStru = ChangeDataPkg.stmirtd(i);
|
||||||
strTagName = miStru.strtagname();
|
const std::string &strTagName = miStru.strtagname();
|
||||||
if ((pPubMi = m_ptrCFesBase->GetFesFwPubDpMi(strTagName)) == NULL)
|
if ((pPubMi = m_ptrCFesBase->GetFesFwPubDpMi(strTagName)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -433,29 +399,25 @@ int CFesRxDPDataThread::RxMiChangeData(const SRealTimeDataPkg & ChangeDataPkg)
|
|||||||
pPubMi->time = mSec;
|
pPubMi->time = mSec;
|
||||||
ChangeInfo.RtuNo = pPubMi->FesRtuNo;
|
ChangeInfo.RtuNo = pPubMi->FesRtuNo;
|
||||||
ChangeInfo.PointNo = pPubMi->SrcPointNo;
|
ChangeInfo.PointNo = pPubMi->SrcPointNo;
|
||||||
ChangeInfo.Value = pPubMi->Value;
|
|
||||||
ChangeInfo.Status = pPubMi->Status;
|
ChangeInfo.Status = pPubMi->Status;
|
||||||
ChangeInfo.time = pPubMi->time;
|
ChangeInfo.time = pPubMi->time;
|
||||||
for (j = 0; j < pPubMi->FwMapNum; j++)
|
|
||||||
|
int nNewValue = 0;
|
||||||
|
for (int j = 0; j < pPubMi->FwMapNum; j++)
|
||||||
{
|
{
|
||||||
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubMi->FwMapping[j].MappingIndex)) == NULL)
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubMi->FwMapping[j].MappingIndex)) == NULL)
|
||||||
continue;
|
continue;
|
||||||
ChangeInfo.RemoteNo = pPubMi->FwMapping[j].RemoteNo;
|
ChangeInfo.RemoteNo = pPubMi->FwMapping[j].RemoteNo;
|
||||||
if(ptrFwRtu->UpdataFwMiValue(ChangeInfo,1))
|
ChangeInfo.Value = pPubMi->Value;
|
||||||
|
|
||||||
|
if(ptrFwRtu->UpdataFwMiValue(ChangeInfo,nNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
ChangeInfo.Value = nNewValue;
|
||||||
ptrFwRtu->WriteFwMiBuf(ChangeInfo);
|
ptrFwRtu->WriteFwMiBuf(ChangeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (std::exception &ex)
|
|
||||||
{
|
|
||||||
LOGERROR("RxMiChangeData Fail,errNo=%s",ex.what());
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
return iotFailed;
|
|
||||||
}
|
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -476,7 +476,7 @@ void CFesRxDataUpDateThread::AccAllResp()
|
|||||||
pAccWithoutTm->set_strappcolumnname(pAcc->ColumnName);
|
pAccWithoutTm->set_strappcolumnname(pAcc->ColumnName);
|
||||||
pAccWithoutTm->set_strapptagname(pAcc->TagName);
|
pAccWithoutTm->set_strapptagname(pAcc->TagName);
|
||||||
pAccWithoutTm->set_ustatus(pAcc->Status);
|
pAccWithoutTm->set_ustatus(pAcc->Status);
|
||||||
pAccWithoutTm->set_nvalue(pAcc->Value);
|
pAccWithoutTm->set_dvalue(pAcc->Value);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -944,7 +944,7 @@ void CFesRxDataUpDateThread::AccChangeStatusReport()
|
|||||||
pAccWithoutTm->set_strappcolumnname(pAcc->ColumnName);
|
pAccWithoutTm->set_strappcolumnname(pAcc->ColumnName);
|
||||||
pAccWithoutTm->set_strapptagname(pAcc->TagName);
|
pAccWithoutTm->set_strapptagname(pAcc->TagName);
|
||||||
pAccWithoutTm->set_ustatus(pAcc->Status);
|
pAccWithoutTm->set_ustatus(pAcc->Status);
|
||||||
pAccWithoutTm->set_nvalue(pAcc->Value);
|
pAccWithoutTm->set_dvalue(pAcc->Value);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,6 @@
|
|||||||
@brief 接收非本FES的AI\DI\ACC\MI数据
|
@brief 接收非本FES的AI\DI\ACC\MI数据
|
||||||
|
|
||||||
@author thxiao
|
@author thxiao
|
||||||
2023-11-25 tthxiao
|
|
||||||
长江存储项目需要从多个PSCADA把数据转发到PSCADA1,接收的消息很多,来不及处理,导致消息堆积,内存不断增长。
|
|
||||||
改为不停接收消息,分多个线程处理数据。接收消息满时,把老消息删除,保证内存不增长。
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include "FesRxFesDataThread.h"
|
#include "FesRxFesDataThread.h"
|
||||||
#include "MessageChannel.h"
|
#include "MessageChannel.h"
|
||||||
@ -15,21 +11,21 @@ using namespace iot_net;
|
|||||||
using namespace iot_public;
|
using namespace iot_public;
|
||||||
using namespace iot_idl;
|
using namespace iot_idl;
|
||||||
|
|
||||||
CFesRxFesDataThread::CFesRxFesDataThread(int iDomainID, int iAppID ,void* FesBaseAddr, CPacketQueuePtr ptrPacketQueue):
|
CFesRxFesDataThread::CFesRxFesDataThread(int iDomainID, int iAppID ,void* FesBaseAddr):
|
||||||
CTimerThreadBase("FesRxFesDataThread",0)
|
CTimerThreadBase("FesRxFesDataThread",30)
|
||||||
{
|
{
|
||||||
m_ptrRxCommunicator = new CMbCommunicator("FesRxFesDataThread");
|
m_ptrRxCommunicator = new CMbCommunicator("FesRxFesDataThread");
|
||||||
m_iDomainID = iDomainID;
|
m_iDomainID = iDomainID;
|
||||||
m_iAppID= iAppID;
|
m_iAppID= iAppID;
|
||||||
m_ptrCFesBase = (CFesBase*)FesBaseAddr;
|
m_ptrCFesBase = (CFesBase*)FesBaseAddr;
|
||||||
m_ptrPacketQueue = ptrPacketQueue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFesRxFesDataThread::~CFesRxFesDataThread()
|
CFesRxFesDataThread::~CFesRxFesDataThread()
|
||||||
{
|
{
|
||||||
delete m_ptrRxCommunicator;
|
delete m_ptrRxCommunicator;
|
||||||
m_ptrRxCommunicator = NULL;
|
m_ptrRxCommunicator = NULL;
|
||||||
m_ptrPacketQueue.reset();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,143 +128,585 @@ bool CFesRxFesDataThread::readFromBus()
|
|||||||
{
|
{
|
||||||
std::string RecvStr;
|
std::string RecvStr;
|
||||||
CMbMessage msgRcv;
|
CMbMessage msgRcv;
|
||||||
int nMsgType,count;
|
int nMsgType;
|
||||||
bool bRetCode = false;
|
|
||||||
|
|
||||||
if (m_ptrRxCommunicator == NULL)
|
if (m_ptrRxCommunicator == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
count = 0;
|
|
||||||
while (count < 20)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
//1.从消息总线接收消息,没有消息返回FALSE
|
//1.从消息总线接收消息,没有消息返回FALSE
|
||||||
if (m_ptrRxCommunicator->recvMsg(msgRcv, 50) == false)
|
//====================================================================================
|
||||||
|
if (m_ptrRxCommunicator->recvMsg(msgRcv))
|
||||||
{
|
{
|
||||||
continue;
|
|
||||||
}
|
|
||||||
nMsgType = msgRcv.getMsgType();
|
nMsgType = msgRcv.getMsgType();
|
||||||
switch (nMsgType)
|
switch(nMsgType)
|
||||||
{
|
{
|
||||||
case MT_FES_DI_CHANGE:
|
case MT_FES_DI_CHANGE:
|
||||||
{
|
{
|
||||||
SFesChangeDiPkg ChangeDiPkg;
|
SFesChangeDiPkg ChangeDiPkg;
|
||||||
bRetCode = ChangeDiPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
ChangeDiPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxDiChangeData(ChangeDiPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::ChangeDiPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesChangeDigPkg(ChangeDiPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_DI_UPDATE:
|
case MT_FES_DI_UPDATE:
|
||||||
{
|
{
|
||||||
SFesUpdateDiPkg UpdateDiPkg;
|
SFesUpdateDiPkg UpdateDiPkg;
|
||||||
bRetCode = UpdateDiPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
UpdateDiPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxDiUpdataData(UpdateDiPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::UpdateDiPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesUpdateDigPkg(UpdateDiPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_SOE_EVENT:
|
case MT_FES_SOE_EVENT:
|
||||||
{
|
{
|
||||||
SFesSoeEventPkg SoePkg;
|
SFesSoeEventPkg SoePkg;
|
||||||
bRetCode = SoePkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
SoePkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxSOEData(SoePkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::SoePkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesSoeEventPkg(SoePkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_AI_CHANGE:
|
case MT_FES_AI_CHANGE:
|
||||||
{
|
{
|
||||||
SFesChangeAiPkg ChangeAiPkg;
|
SFesChangeAiPkg ChangeAiPkg;
|
||||||
bRetCode = ChangeAiPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
ChangeAiPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxAiChangeData(ChangeAiPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::ChangeAiPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesChangeAnaPkg(ChangeAiPkg);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
|
||||||
case MT_FES_AI_UPDATE:
|
case MT_FES_AI_UPDATE:
|
||||||
{
|
{
|
||||||
SFesUpdateAiPkg UpdateAiPkg;
|
SFesUpdateAiPkg UpdateAiPkg;
|
||||||
UpdateAiPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
UpdateAiPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxAiUpdataData(UpdateAiPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::UpdateAiPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesUpdateAnaPkg(UpdateAiPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_PI_CHANGE:
|
case MT_FES_PI_CHANGE:
|
||||||
{
|
{
|
||||||
SFesChangePiPkg ChangeAccPkg;
|
SFesChangePiPkg ChanageAccPkg;
|
||||||
bRetCode = ChangeAccPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
ChanageAccPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxAccChangeData(ChanageAccPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("parseFesPackage::ChangeAccPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesChangeAccPkg(ChangeAccPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_PI_UPDATE:
|
case MT_FES_PI_UPDATE:
|
||||||
{
|
{
|
||||||
SFesUpdatePiPkg UpdateAccPkg;
|
SFesUpdatePiPkg UpdateAccPkg;
|
||||||
bRetCode = UpdateAccPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
UpdateAccPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxAccUpdataData(UpdateAccPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::UpdateAccPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesUpdateAccPkg(UpdateAccPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_MI_CHANGE:
|
case MT_FES_MI_CHANGE:
|
||||||
{
|
{
|
||||||
SFesChangeMiPkg ChangeMiPkg;
|
SFesChangeMiPkg ChangeMiPkg;
|
||||||
bRetCode = ChangeMiPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
ChangeMiPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxMiChangeData(ChangeMiPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::ChangeMiPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesChangeMixPkg(ChangeMiPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case MT_FES_MI_UPDATE:
|
case MT_FES_MI_UPDATE:
|
||||||
{
|
{
|
||||||
SFesUpdateMiPkg UpdateMiPkg;
|
SFesUpdateMiPkg UpdateMiPkg;
|
||||||
bRetCode = UpdateMiPkg.ParseFromArray(msgRcv.getDataPtr(), msgRcv.getDataSize());
|
UpdateMiPkg.ParseFromArray(msgRcv.getDataPtr(), static_cast<int>(msgRcv.getDataSize()) );
|
||||||
if (!bRetCode)
|
RxMiUpdataData(UpdateMiPkg);
|
||||||
{
|
|
||||||
LOGDEBUG("readFromBus::UpdateMiPkg解析错误!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_ptrPacketQueue->addFesUpdateMixPkg(UpdateMiPkg);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
// LOGDEBUG("readFromBus::MsgType = %d 消息类型不支持!", nMsgType);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxDiChangeData
|
||||||
|
* 接收DI变化数据。
|
||||||
|
*
|
||||||
|
* @param stChangeDiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxDiChangeData(const SFesChangeDiPkg &ChangeDiPkg)
|
||||||
|
{
|
||||||
|
int nChangeNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgDi ChangeInfo;
|
||||||
|
|
||||||
|
nChangeNum = ChangeDiPkg.stdidata_size();
|
||||||
|
|
||||||
|
if (nChangeNum > 0)
|
||||||
|
{
|
||||||
|
LOGDEBUG("RxDiChangeData:收到变化数据报文,数目[%d],时间[%" PRId64 "].", nChangeNum, (int64)ChangeDiPkg.stdidata(0).ultime());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nLoop = 0; nLoop < nChangeNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubDi *pPubDi = NULL;
|
||||||
|
|
||||||
|
const SFesDiDataWithTm &stDiData = ChangeDiPkg.stdidata(nLoop);
|
||||||
|
const std::string &TagName = stDiData.strapptagname();
|
||||||
|
if ((pPubDi = m_ptrCFesBase->GetFesFwPubFesDi(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((int64)stDiData.ultime() < 0)
|
||||||
|
{
|
||||||
|
LOGERROR("tag_name = %s, times = [%" PRId64 "] < 0 error!", TagName.c_str(), stDiData.ultime());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pPubDi->Value = 0x01 & stDiData.nvalue();
|
||||||
|
pPubDi->Status = 0xffff & stDiData.ustatus();
|
||||||
|
pPubDi->time = stDiData.ultime();
|
||||||
|
ChangeInfo.RtuNo = pPubDi->FesRtuNo;
|
||||||
|
ChangeInfo.PointNo = pPubDi->SrcPointNo;
|
||||||
|
ChangeInfo.Value = pPubDi->Value;
|
||||||
|
ChangeInfo.Status = pPubDi->Status;
|
||||||
|
ChangeInfo.time = pPubDi->time;
|
||||||
|
for (i = 0; i < pPubDi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubDi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubDi->FwMapping[i].RemoteNo;
|
||||||
|
ptrFwRtu->WriteFwDiBuf(ChangeInfo);
|
||||||
|
ptrFwRtu->UpdataFwDiValue(ChangeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxSOEData
|
||||||
|
* 接收DI变化数据。
|
||||||
|
*
|
||||||
|
* @param SFesSoeEventPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxSOEData(const SFesSoeEventPkg &SOEPkg)
|
||||||
|
{
|
||||||
|
int nChangeNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwSoeEvent ChangeInfo;
|
||||||
|
|
||||||
|
nChangeNum = SOEPkg.stsoeevent_size();
|
||||||
|
|
||||||
|
if (nChangeNum > 0)
|
||||||
|
{
|
||||||
|
LOGDEBUG("RxSOEData:收到变化数据报文,数目[%d],时间[%" PRId64 "].", nChangeNum, (int64)SOEPkg.stsoeevent(0).ultime());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nLoop = 0; nLoop < nChangeNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubDi *pPubDi = NULL;
|
||||||
|
|
||||||
|
const SFesSoeEventInfo &stSoeEvent = SOEPkg.stsoeevent(nLoop);
|
||||||
|
const std::string &TagName = stSoeEvent.strapptagname();
|
||||||
|
if ((pPubDi = m_ptrCFesBase->GetFesFwPubFesDi(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
if ((int64)stSoeEvent.ultime() < 0)
|
||||||
|
{
|
||||||
|
LOGERROR("tag_name = %s, times = [%" PRId64 "] < 0 error!", TagName.c_str(), stSoeEvent.ultime());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ChangeInfo.RtuNo = pPubDi->FesRtuNo;
|
||||||
|
ChangeInfo.PointNo = pPubDi->SrcPointNo;
|
||||||
|
ChangeInfo.Value = 0x01 & stSoeEvent.nvalue();
|
||||||
|
ChangeInfo.Status = 0xffff & stSoeEvent.ustatus();
|
||||||
|
ChangeInfo.time = stSoeEvent.ultime();
|
||||||
|
//SOE事件故障描述忽略不处理
|
||||||
|
|
||||||
|
for (i = 0; i < pPubDi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubDi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubDi->FwMapping[i].RemoteNo;
|
||||||
|
ptrFwRtu->WriteFwSoeEventBuf(ChangeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxAiChangeData
|
||||||
|
* 接收AI变化数据。
|
||||||
|
*
|
||||||
|
* @param stChangeAiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxAiChangeData(const SFesChangeAiPkg &ChangeAiPkg)
|
||||||
|
{
|
||||||
|
int nChangeNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgAi ChangeInfo;
|
||||||
|
|
||||||
|
nChangeNum = ChangeAiPkg.staidata_size();
|
||||||
|
|
||||||
|
if (nChangeNum > 0)
|
||||||
|
{
|
||||||
|
LOGTRACE("RxAiChangeData:收到变化数据报文,数目[%d],时间[%" PRId64 "].", nChangeNum, (int64)ChangeAiPkg.staidata(0).ultime());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nLoop = 0; nLoop < nChangeNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubAi *pPubAi = NULL;
|
||||||
|
|
||||||
|
const SFesAiDataWithTm &stAiData = ChangeAiPkg.staidata(nLoop);
|
||||||
|
const std::string &TagName = stAiData.strapptagname();
|
||||||
|
if ((pPubAi = m_ptrCFesBase->GetFesFwPubFesAi(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((int64)stAiData.ultime() < 0)
|
||||||
|
{
|
||||||
|
LOGERROR("tag_name = %s, times = [%" PRId64 "]< 0 error!", TagName.c_str(), stAiData.ultime());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pPubAi->Value = stAiData.fvalue();
|
||||||
|
pPubAi->Status = stAiData.ustatus();
|
||||||
|
pPubAi->time = stAiData.ultime();
|
||||||
|
ChangeInfo.RtuNo = pPubAi->FesRtuNo;
|
||||||
|
ChangeInfo.PointNo = pPubAi->SrcPointNo;
|
||||||
|
ChangeInfo.Status = pPubAi->Status;
|
||||||
|
ChangeInfo.time = pPubAi->time;
|
||||||
|
|
||||||
|
float fNewValue = 0.0f;
|
||||||
|
for (i = 0; i < pPubAi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubAi->FwMapping[i].RemoteNo;
|
||||||
|
ChangeInfo.Value = pPubAi->Value; //< 每次必须重新赋值,因为ChangeInfo的Value会被更新
|
||||||
|
|
||||||
|
if(ptrFwRtu->UpdataFwAiValue(ChangeInfo,fNewValue,eNormalUpdate)) //< fNewValue值会被更新
|
||||||
|
{
|
||||||
|
ChangeInfo.Value = fNewValue;
|
||||||
|
ptrFwRtu->WriteFwAiBuf(ChangeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxAccChangeData
|
||||||
|
* 接收ACC变化数据。
|
||||||
|
*
|
||||||
|
* @param stChangePiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxAccChangeData(const SFesChangePiPkg &ChangeAccPkg)
|
||||||
|
{
|
||||||
|
int nChangeNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgAcc ChangeInfo;
|
||||||
|
|
||||||
|
nChangeNum = ChangeAccPkg.stpidata_size();
|
||||||
|
|
||||||
|
if (nChangeNum > 0)
|
||||||
|
{
|
||||||
|
LOGTRACE("RxAccChangeData:收到变化数据报文,数目[%d],时间[%" PRId64 "].", nChangeNum, (int64)ChangeAccPkg.stpidata(0).ultime());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nLoop = 0; nLoop < nChangeNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubAcc *pPubAcc = NULL;
|
||||||
|
|
||||||
|
const SFesPiDataWithTm &stAccData = ChangeAccPkg.stpidata(nLoop);
|
||||||
|
const std::string &TagName = stAccData.strapptagname();
|
||||||
|
if ((pPubAcc = m_ptrCFesBase->GetFesFwPubFesAcc(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((int64)stAccData.ultime() < 0)
|
||||||
|
{
|
||||||
|
LOGERROR("tag_name = %s, times = [%" PRId64 "] < 0 error!", TagName.c_str(), stAccData.ultime());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pPubAcc->Value = stAccData.dvalue();
|
||||||
|
pPubAcc->Status = stAccData.ustatus();
|
||||||
|
pPubAcc->time = stAccData.ultime();
|
||||||
|
ChangeInfo.RtuNo = pPubAcc->FesRtuNo;
|
||||||
|
ChangeInfo.PointNo = pPubAcc->SrcPointNo;
|
||||||
|
ChangeInfo.Status = pPubAcc->Status;
|
||||||
|
ChangeInfo.time = pPubAcc->time;
|
||||||
|
|
||||||
|
double dNewValue = 0.0;
|
||||||
|
for (i = 0; i < pPubAcc->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAcc->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubAcc->FwMapping[i].RemoteNo;
|
||||||
|
ChangeInfo.Value = pPubAcc->Value; //< 每次要重新赋值
|
||||||
|
|
||||||
|
if(ptrFwRtu->UpdataFwAccValue(ChangeInfo,dNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
ChangeInfo.Value = dNewValue;
|
||||||
|
ptrFwRtu->WriteFwAccBuf(ChangeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxMiChangeData
|
||||||
|
* 接收MI变化数据。
|
||||||
|
*
|
||||||
|
* @param stChangeMiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxMiChangeData(const SFesChangeMiPkg &ChangeMiPkg)
|
||||||
|
{
|
||||||
|
int nChangeNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgMi ChangeInfo;
|
||||||
|
|
||||||
|
nChangeNum = ChangeMiPkg.stmidata_size();
|
||||||
|
if (nChangeNum > 0)
|
||||||
|
{
|
||||||
|
LOGTRACE("RxMiChangeData:收到变化数据报文,数目[%d],时间[%" PRId64 "].", nChangeNum, (int64)ChangeMiPkg.stmidata(0).ultime());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nLoop = 0; nLoop < nChangeNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubMi *pPubMi = NULL;
|
||||||
|
|
||||||
|
const SFesMiDataWithTm &MiData = ChangeMiPkg.stmidata(nLoop);
|
||||||
|
const std::string &TagName = MiData.strapptagname();
|
||||||
|
if ((pPubMi = m_ptrCFesBase->GetFesFwPubFesMi(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((int64)MiData.ultime() < 0)
|
||||||
|
{
|
||||||
|
LOGERROR("tag_name = %s, times = [%" PRId64 "] < 0 error!", TagName.c_str(), MiData.ultime());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pPubMi->Value = MiData.nvalue();
|
||||||
|
pPubMi->Status = MiData.ustatus();
|
||||||
|
pPubMi->time = MiData.ultime();
|
||||||
|
ChangeInfo.RtuNo = pPubMi->FesRtuNo;
|
||||||
|
ChangeInfo.PointNo = pPubMi->SrcPointNo;
|
||||||
|
ChangeInfo.Status = pPubMi->Status;
|
||||||
|
ChangeInfo.time = pPubMi->time;
|
||||||
|
|
||||||
|
int nNewValue = 0;
|
||||||
|
for (i = 0; i < pPubMi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubMi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubMi->FwMapping[i].RemoteNo;
|
||||||
|
ChangeInfo.Value = pPubMi->Value; //< 每次要重新赋值
|
||||||
|
|
||||||
|
if(ptrFwRtu->UpdataFwMiValue(ChangeInfo,nNewValue,eNormalUpdate))
|
||||||
|
{
|
||||||
|
ChangeInfo.Value = nNewValue;
|
||||||
|
ptrFwRtu->WriteFwMiBuf(ChangeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxDiUpdataData
|
||||||
|
* 接收DI全数据。
|
||||||
|
*
|
||||||
|
* @param UpdateDiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxDiUpdataData(const SFesUpdateDiPkg &UpdateDiPkg)
|
||||||
|
{
|
||||||
|
int nNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgDi ChangeInfo;
|
||||||
|
uint64 mSec;
|
||||||
|
|
||||||
|
nNum = UpdateDiPkg.stdidata_size();
|
||||||
|
|
||||||
|
if (nNum > 0)
|
||||||
|
{
|
||||||
|
LOGDEBUG("RxDiChangeData:收到全数据报文,数目[%d]", nNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSec = getUTCTimeMsec();
|
||||||
|
for (nLoop = 0; nLoop < nNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubDi *pPubDi = NULL;
|
||||||
|
|
||||||
|
const SFesDiDataWithoutTm &DiData = UpdateDiPkg.stdidata(nLoop);
|
||||||
|
const std::string &strTagName = DiData.strapptagname();
|
||||||
|
if ((pPubDi = m_ptrCFesBase->GetFesFwPubFesDi(strTagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pPubDi->Value = 0x01 & DiData.nvalue();
|
||||||
|
pPubDi->Status = DiData.ustatus();
|
||||||
|
pPubDi->time = mSec;
|
||||||
|
ChangeInfo.Value = pPubDi->Value;
|
||||||
|
ChangeInfo.Status = pPubDi->Status;
|
||||||
|
ChangeInfo.time = pPubDi->time;
|
||||||
|
|
||||||
|
for (i = 0; i < pPubDi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubDi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubDi->FwMapping[i].RemoteNo;
|
||||||
|
ptrFwRtu->UpdataFwDiValue(ChangeInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxAiUpdataData
|
||||||
|
* 接收Ai全数据。
|
||||||
|
*
|
||||||
|
* @param UpdateAiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxAiUpdataData(const SFesUpdateAiPkg &UpdateAiPkg)
|
||||||
|
{
|
||||||
|
int nNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgAi ChangeInfo;
|
||||||
|
uint64 mSec;
|
||||||
|
|
||||||
|
nNum = UpdateAiPkg.staidata_size();
|
||||||
|
|
||||||
|
if (nNum > 0)
|
||||||
|
{
|
||||||
|
LOGTRACE("RxAiChangeData:收到全数据报文,数目[%d]", nNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSec = getUTCTimeMsec();
|
||||||
|
for (nLoop = 0; nLoop < nNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubAi *pPubAi = NULL;
|
||||||
|
|
||||||
|
const SFesAiDataWithoutTm &AiData = UpdateAiPkg.staidata(nLoop);
|
||||||
|
const std::string &TagName = AiData.strapptagname();
|
||||||
|
if ((pPubAi = m_ptrCFesBase->GetFesFwPubFesAi(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pPubAi->Value = AiData.fvalue();
|
||||||
|
pPubAi->Status = AiData.ustatus();
|
||||||
|
pPubAi->time = mSec;
|
||||||
|
ChangeInfo.Value = pPubAi->Value;
|
||||||
|
ChangeInfo.Status = pPubAi->Status;
|
||||||
|
ChangeInfo.time = pPubAi->time;
|
||||||
|
float fNewValue = 0.0f;
|
||||||
|
for (i = 0; i < pPubAi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubAi->FwMapping[i].RemoteNo;
|
||||||
|
ptrFwRtu->UpdataFwAiValue(ChangeInfo,fNewValue,eWithoutDeadbandUpdate); //< fNewValue的值会被更新
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxAccUpdataData
|
||||||
|
* 接收ACC全数据。
|
||||||
|
*
|
||||||
|
* @param UpdateAccPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxAccUpdataData(const SFesUpdatePiPkg &UpdateAccPkg)
|
||||||
|
{
|
||||||
|
int nNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgAcc ChangeInfo;
|
||||||
|
uint64 mSec;
|
||||||
|
|
||||||
|
nNum = UpdateAccPkg.stpidata_size();
|
||||||
|
|
||||||
|
if (nNum > 0)
|
||||||
|
{
|
||||||
|
LOGTRACE("RxAccChangeData:收到全数据报文,数目[%d]", nNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSec = getUTCTimeMsec();
|
||||||
|
for (nLoop = 0; nLoop < nNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubAcc *pPubAcc = NULL;
|
||||||
|
|
||||||
|
const SFesPiDataWithoutTm &AccData = UpdateAccPkg.stpidata(nLoop);
|
||||||
|
const std::string &TagName = AccData.strapptagname();
|
||||||
|
if ((pPubAcc = m_ptrCFesBase->GetFesFwPubFesAcc(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pPubAcc->Value = AccData.dvalue();
|
||||||
|
pPubAcc->Status = AccData.ustatus();
|
||||||
|
pPubAcc->time = mSec;
|
||||||
|
ChangeInfo.Value = pPubAcc->Value;
|
||||||
|
ChangeInfo.Status = pPubAcc->Status;
|
||||||
|
ChangeInfo.time = pPubAcc->time;
|
||||||
|
|
||||||
|
double dNewValue = 0.0;
|
||||||
|
for (i = 0; i < pPubAcc->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubAcc->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubAcc->FwMapping[i].RemoteNo;
|
||||||
|
ptrFwRtu->UpdataFwAccValue(ChangeInfo,dNewValue,eWithoutDeadbandUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CFesRxFesDataThread::RxMiUpdataData
|
||||||
|
* 接收Mi全数据。
|
||||||
|
*
|
||||||
|
* @param UpdateMiPkg 接收到的数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void CFesRxFesDataThread::RxMiUpdataData(const SFesUpdateMiPkg &UpdateMiPkg)
|
||||||
|
{
|
||||||
|
int nNum;
|
||||||
|
int nLoop = 0;
|
||||||
|
int i;
|
||||||
|
CFesRtuPtr ptrFwRtu;
|
||||||
|
SFesFwChgMi ChangeInfo;
|
||||||
|
uint64 mSec;
|
||||||
|
|
||||||
|
nNum = UpdateMiPkg.stmidata_size();
|
||||||
|
|
||||||
|
if (nNum > 0)
|
||||||
|
{
|
||||||
|
LOGTRACE("RxMiChangeData:收到全数据报文,数目[%d]", nNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
mSec = getUTCTimeMsec();
|
||||||
|
for (nLoop = 0; nLoop < nNum; nLoop++)
|
||||||
|
{
|
||||||
|
SFesFwPubMi *pPubMi = NULL;
|
||||||
|
|
||||||
|
const SFesMiDataWithoutTm &MiData = UpdateMiPkg.stmidata(nLoop);
|
||||||
|
const std::string &TagName = MiData.strapptagname();
|
||||||
|
if ((pPubMi = m_ptrCFesBase->GetFesFwPubFesMi(TagName)) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pPubMi->Value = MiData.nvalue();
|
||||||
|
pPubMi->Status = MiData.ustatus();
|
||||||
|
pPubMi->time = mSec;
|
||||||
|
ChangeInfo.Value = pPubMi->Value;
|
||||||
|
ChangeInfo.Status = pPubMi->Status;
|
||||||
|
ChangeInfo.time = pPubMi->time;
|
||||||
|
|
||||||
|
int nNewValue = 0;
|
||||||
|
for (i = 0; i < pPubMi->FwMapNum; i++)
|
||||||
|
{
|
||||||
|
if ((ptrFwRtu = m_ptrCFesBase->GetFwRtuByMappingIndex(pPubMi->FwMapping[i].MappingIndex)) == NULL)
|
||||||
|
continue;
|
||||||
|
ChangeInfo.RemoteNo = pPubMi->FwMapping[i].RemoteNo;
|
||||||
|
ptrFwRtu->UpdataFwMiValue(ChangeInfo,nNewValue,eWithoutDeadbandUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置为主
|
//设置为主
|
||||||
@ -284,146 +722,3 @@ int CFesRxFesDataThread::setSlave()
|
|||||||
unsubMessage();
|
unsubMessage();
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief 前置实时数据处理(变化数据/全数据/报警/SOE/各种事件)
|
|
||||||
@param 无
|
|
||||||
@return 无
|
|
||||||
@retval
|
|
||||||
*/
|
|
||||||
int CFesRxFesDataThread::parseFesPackage(const iot_net::CMbMessage &objRecvMsg)
|
|
||||||
{
|
|
||||||
//int64 t1,t2;
|
|
||||||
bool bRetCode = false;
|
|
||||||
int nMessageType = objRecvMsg.getMsgType();
|
|
||||||
|
|
||||||
LOGDEBUG("parseFesPackage, Recv a Message Type=%d ", nMessageType);
|
|
||||||
|
|
||||||
switch (nMessageType)
|
|
||||||
{
|
|
||||||
case MT_FES_DI_CHANGE://DI Change Data
|
|
||||||
{
|
|
||||||
SFesChangeDiPkg objFesChanageDiPkg;
|
|
||||||
//t1 = getUTCTimeMsec() ;
|
|
||||||
bRetCode = objFesChanageDiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
//t2 = getUTCTimeMsec() ;
|
|
||||||
//LOGINFO("parseFesPackage:解析变化数字量 num=%d,用时=%d(ms)",objFesChanageDiPkg.stdidata_size(),t2-t1);
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesChanageDiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesChangeDigPkg(objFesChanageDiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_DI_UPDATE://DI UPDATE Data
|
|
||||||
{
|
|
||||||
SFesUpdateDiPkg objFesUpdateDiPkg;
|
|
||||||
//t1 = getUTCTimeMsec() ;
|
|
||||||
bRetCode = objFesUpdateDiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
//t2 = getUTCTimeMsec() ;
|
|
||||||
//LOGINFO("parseFesPackage:解析数字量全数据 num=%d,用时=%d(ms)",objFesUpdateDiPkg.stdidata_size(),t2-t1);
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesUpdateDiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesUpdateDigPkg(objFesUpdateDiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_AI_CHANGE://AI Change Data
|
|
||||||
{
|
|
||||||
SFesChangeAiPkg objFesChanageAiPkg;
|
|
||||||
bRetCode = objFesChanageAiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesChanageAiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesChangeAnaPkg(objFesChanageAiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_AI_UPDATE://AI UPDATE Data
|
|
||||||
{
|
|
||||||
SFesUpdateAiPkg objFesUpdateAiPkg;
|
|
||||||
bRetCode = objFesUpdateAiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesUpdateAiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesUpdateAnaPkg(objFesUpdateAiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_MI_CHANGE://MI Change Data
|
|
||||||
{
|
|
||||||
SFesChangeMiPkg objFesChanageMiPkg;
|
|
||||||
bRetCode = objFesChanageMiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesChanageMiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesChangeMixPkg(objFesChanageMiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_MI_UPDATE://MI UPDATE Data
|
|
||||||
{
|
|
||||||
SFesUpdateMiPkg objFesUpdateMiPkg;
|
|
||||||
bRetCode = objFesUpdateMiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesUpdateMiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesUpdateMixPkg(objFesUpdateMiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_PI_CHANGE://PI Change Data
|
|
||||||
{
|
|
||||||
SFesChangePiPkg objFesChangePiPkg;
|
|
||||||
bRetCode = objFesChangePiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesChangePiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesChangeAccPkg(objFesChangePiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_PI_UPDATE://PI UPDATE Data
|
|
||||||
{
|
|
||||||
SFesUpdatePiPkg objFesUpdatePiPkg;
|
|
||||||
bRetCode = objFesUpdatePiPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesUpdatePiPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesUpdateAccPkg(objFesUpdatePiPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case MT_FES_SOE_EVENT: //SOE事件信息
|
|
||||||
{
|
|
||||||
SFesSoeEventPkg objFesSoeEventPkg;
|
|
||||||
bRetCode = objFesSoeEventPkg.ParseFromArray(objRecvMsg.getDataPtr(), objRecvMsg.getDataSize());
|
|
||||||
if (!bRetCode)
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::objFesSoeEventPkg解析错误!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
m_ptrPacketQueue->addFesSoeEventPkg(objFesSoeEventPkg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
LOGWARN("parseFesPackage::MsgType = %d 消息类型不支持!", nMessageType);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}// end switch
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
#include "FesBase.h"
|
#include "FesBase.h"
|
||||||
#include "net/net_msg_bus_api/MsgBusApi.h"
|
#include "net/net_msg_bus_api/MsgBusApi.h"
|
||||||
#include "FesMessage.pb.h"
|
#include "FesMessage.pb.h"
|
||||||
#include "PacketQueue.h"
|
|
||||||
#include <queue>
|
|
||||||
|
|
||||||
using namespace iot_net;
|
using namespace iot_net;
|
||||||
using namespace iot_idl;
|
using namespace iot_idl;
|
||||||
@ -13,7 +11,7 @@ using namespace iot_idl;
|
|||||||
class CFesRxFesDataThread : public iot_public::CTimerThreadBase
|
class CFesRxFesDataThread : public iot_public::CTimerThreadBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CFesRxFesDataThread(int iDomainID, int iAppID, void* BaseDataAddr, CPacketQueuePtr ptrPacketQueue);
|
CFesRxFesDataThread(int iDomainID, int iAppID, void* BaseDataAddr);
|
||||||
virtual ~CFesRxFesDataThread();
|
virtual ~CFesRxFesDataThread();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,12 +42,15 @@ private:
|
|||||||
CFesBase *m_ptrCFesBase;
|
CFesBase *m_ptrCFesBase;
|
||||||
|
|
||||||
bool readFromBus();
|
bool readFromBus();
|
||||||
|
void RxDiChangeData(const iot_idl::SFesChangeDiPkg &stChangeDiPkg);
|
||||||
CPacketQueuePtr m_ptrPacketQueue; //消息缓存类
|
void RxAiChangeData(const iot_idl::SFesChangeAiPkg &stChangeAiPkg);
|
||||||
|
void RxAccChangeData(const iot_idl::SFesChangePiPkg &stChangeAccPkg);
|
||||||
int parseFesPackage(const iot_net::CMbMessage &objRecvMsg);
|
void RxMiChangeData(const iot_idl::SFesChangeMiPkg &stChangeMiPkg);
|
||||||
|
void RxDiUpdataData(const SFesUpdateDiPkg &UpdateDiPkg);
|
||||||
|
void RxAiUpdataData(const SFesUpdateAiPkg &UpdateAiPkg);
|
||||||
|
void RxAccUpdataData(const SFesUpdatePiPkg &UpdateAccPkg);
|
||||||
|
void RxMiUpdataData(const SFesUpdateMiPkg &UpdateMiPkg);
|
||||||
|
void RxSOEData(const SFesSoeEventPkg &SOEPkg);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -404,7 +404,7 @@ int CFesSimServerThread::RxData(unsigned char *Data,int MaxLen)
|
|||||||
TcpClose(m_AcceptSocket);
|
TcpClose(m_AcceptSocket);
|
||||||
m_AcceptSocket = SOCKET_ERROR;
|
m_AcceptSocket = SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
if (FD_ISSET(m_AcceptSocket, &fdSet))
|
if (SOCKET_ERROR != m_AcceptSocket && INVALID_SOCKET != m_AcceptSocket && FD_ISSET(m_AcceptSocket, &fdSet))
|
||||||
{
|
{
|
||||||
len = ::recv(m_AcceptSocket , (char *)Data , MaxLen , 0);
|
len = ::recv(m_AcceptSocket , (char *)Data , MaxLen , 0);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
@ -1796,6 +1796,7 @@ int CFesSimServerThread::AccDataResp(unsigned char *Data,int FrameNo)
|
|||||||
SFesAcc *pAcc;
|
SFesAcc *pAcc;
|
||||||
int writex,count,structLen,maxCount,RtuNo;
|
int writex,count,structLen,maxCount,RtuNo;
|
||||||
int i,StartIndex,EndIndex;
|
int i,StartIndex,EndIndex;
|
||||||
|
unsigned char* pTemp;
|
||||||
|
|
||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1886,14 +1887,23 @@ int CFesSimServerThread::AccDataResp(unsigned char *Data,int FrameNo)
|
|||||||
Data[writex++] = (pAcc->PointNo>>8)&0xff;
|
Data[writex++] = (pAcc->PointNo>>8)&0xff;
|
||||||
Data[writex++] = (pAcc->PointNo>>16)&0xff;
|
Data[writex++] = (pAcc->PointNo>>16)&0xff;
|
||||||
Data[writex++] = (pAcc->PointNo>>24)&0xff;
|
Data[writex++] = (pAcc->PointNo>>24)&0xff;
|
||||||
Data[writex++]=pAcc->Value&0xff;
|
// Data[writex++]=pAcc->Value&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>8)&0xff;
|
// Data[writex++]=(pAcc->Value>>8)&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>16)&0xff;
|
// Data[writex++]=(pAcc->Value>>16)&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>24)&0xff;
|
// Data[writex++]=(pAcc->Value>>24)&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>32)&0xff;
|
// Data[writex++]=(pAcc->Value>>32)&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>40)&0xff;
|
// Data[writex++]=(pAcc->Value>>40)&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>48)&0xff;
|
// Data[writex++]=(pAcc->Value>>48)&0xff;
|
||||||
Data[writex++]=(pAcc->Value>>56)&0xff;
|
// Data[writex++]=(pAcc->Value>>56)&0xff;
|
||||||
|
pTemp = (unsigned char*)&pAcc->Value;
|
||||||
|
Data[writex++]=*pTemp;
|
||||||
|
Data[writex++]=*(pTemp+1);
|
||||||
|
Data[writex++]=*(pTemp+2);
|
||||||
|
Data[writex++]=*(pTemp+3);
|
||||||
|
Data[writex++]=*(pTemp+4);
|
||||||
|
Data[writex++]=*(pTemp+5);
|
||||||
|
Data[writex++]=*(pTemp+6);
|
||||||
|
Data[writex++]=*(pTemp+7);
|
||||||
Data[writex++]=pAcc->Status&0xff;
|
Data[writex++]=pAcc->Status&0xff;
|
||||||
Data[writex++]=(pAcc->Status>>8)&0xff;
|
Data[writex++]=(pAcc->Status>>8)&0xff;
|
||||||
Data[writex++]=(pAcc->Status>>16)&0xff;
|
Data[writex++]=(pAcc->Status>>16)&0xff;
|
||||||
@ -2869,7 +2879,7 @@ void CFesSimServerThread::SimAiSetValue()
|
|||||||
{
|
{
|
||||||
AiValue.PointNo=m_SimAi.PointNo;
|
AiValue.PointNo=m_SimAi.PointNo;
|
||||||
AiValue.Status=CN_FesValueUpdate;
|
AiValue.Status=CN_FesValueUpdate;
|
||||||
AiValue.Value=rand()%10000;
|
AiValue.Value = static_cast<float>(rand()%10000);
|
||||||
AiValue.time = getUTCTimeMsec();
|
AiValue.time = getUTCTimeMsec();
|
||||||
ChgAiValue.Status = AiValue.Status;
|
ChgAiValue.Status = AiValue.Status;
|
||||||
//ChgAiValue.Value = AiValue.Value;
|
//ChgAiValue.Value = AiValue.Value;
|
||||||
@ -2908,7 +2918,7 @@ void CFesSimServerThread::SimAiSetValue()
|
|||||||
if((pAi=pRtu->GetAiByPointNo(i))!=NULL)
|
if((pAi=pRtu->GetAiByPointNo(i))!=NULL)
|
||||||
{
|
{
|
||||||
AiValue.PointNo = i;
|
AiValue.PointNo = i;
|
||||||
AiValue.Value=rand()%10000;
|
AiValue.Value = static_cast<float>(rand()%10000);
|
||||||
//ChgAiValue.Value = AiValue.Value;
|
//ChgAiValue.Value = AiValue.Value;
|
||||||
memcpy(ChgAiValue.TableName,pAi->TableName,CN_FesMaxTableNameSize);
|
memcpy(ChgAiValue.TableName,pAi->TableName,CN_FesMaxTableNameSize);
|
||||||
memcpy(ChgAiValue.ColumnName,pAi->ColumnName,CN_FesMaxColumnNameSize);
|
memcpy(ChgAiValue.ColumnName,pAi->ColumnName,CN_FesMaxColumnNameSize);
|
||||||
@ -2946,7 +2956,7 @@ void CFesSimServerThread::SimAiSetValue()
|
|||||||
if((pAi=pRtu->GetAiByPointNo(j))!=NULL)
|
if((pAi=pRtu->GetAiByPointNo(j))!=NULL)
|
||||||
{
|
{
|
||||||
AiValue.PointNo = j;
|
AiValue.PointNo = j;
|
||||||
AiValue.Value=rand()%10000;
|
AiValue.Value= static_cast<float>(rand()%10000);
|
||||||
//ChgAiValue.Value = AiValue.Value;
|
//ChgAiValue.Value = AiValue.Value;
|
||||||
memcpy(ChgAiValue.TableName,pAi->TableName,CN_FesMaxTableNameSize);
|
memcpy(ChgAiValue.TableName,pAi->TableName,CN_FesMaxTableNameSize);
|
||||||
memcpy(ChgAiValue.ColumnName,pAi->ColumnName,CN_FesMaxColumnNameSize);
|
memcpy(ChgAiValue.ColumnName,pAi->ColumnName,CN_FesMaxColumnNameSize);
|
||||||
@ -3540,30 +3550,55 @@ int CFesSimServerThread::SimAccStartResp(unsigned char *Data,int /*FrameNo*/)
|
|||||||
m_SimAcc.Period |= (short)m_RecvBuf[readx++]<<8;
|
m_SimAcc.Period |= (short)m_RecvBuf[readx++]<<8;
|
||||||
m_SimAccLastmSec = getMonotonicMsec();
|
m_SimAccLastmSec = getMonotonicMsec();
|
||||||
|
|
||||||
m_SimAcc.SetValue = (uint64)m_RecvBuf[readx++];
|
// m_SimAcc.SetValue = (uint64)m_RecvBuf[readx++];
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<8;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<8;
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<16;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<16;
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<24;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<24;
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<32;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<32;
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<40;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<40;
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<48;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<48;
|
||||||
m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<56;
|
// m_SimAcc.SetValue |= (uint64)m_RecvBuf[readx++]<<56;
|
||||||
|
unsigned char *pTemp= (unsigned char*)&m_SimAcc.SetValue;
|
||||||
|
|
||||||
|
*pTemp = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+1) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+2) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+3) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+4) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+5) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+6) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+7) = m_RecvBuf[readx++];
|
||||||
m_SimAcc.Status = (uint32)m_RecvBuf[readx++];
|
m_SimAcc.Status = (uint32)m_RecvBuf[readx++];
|
||||||
m_SimAcc.Status |= (uint32)m_RecvBuf[readx++]<<8;
|
m_SimAcc.Status |= (uint32)m_RecvBuf[readx++]<<8;
|
||||||
m_SimAcc.Status |= (uint32)m_RecvBuf[readx++]<<16;
|
m_SimAcc.Status |= (uint32)m_RecvBuf[readx++]<<16;
|
||||||
m_SimAcc.Status |= (uint32)m_RecvBuf[readx++]<<24;
|
m_SimAcc.Status |= (uint32)m_RecvBuf[readx++]<<24;
|
||||||
m_SimAcc.MinValue = (int)m_RecvBuf[readx++];
|
// m_SimAcc.MinValue = (int)m_RecvBuf[readx++];
|
||||||
m_SimAcc.MinValue |= (int)m_RecvBuf[readx++]<<8;
|
// m_SimAcc.MinValue |= (int)m_RecvBuf[readx++]<<8;
|
||||||
m_SimAcc.MinValue |= (int)m_RecvBuf[readx++]<<16;
|
// m_SimAcc.MinValue |= (int)m_RecvBuf[readx++]<<16;
|
||||||
m_SimAcc.MinValue |= (int)m_RecvBuf[readx++]<<24;
|
// m_SimAcc.MinValue |= (int)m_RecvBuf[readx++]<<24;
|
||||||
m_SimAcc.MaxValue = (int)m_RecvBuf[readx++];
|
// m_SimAcc.MaxValue = (int)m_RecvBuf[readx++];
|
||||||
m_SimAcc.MaxValue |= (int)m_RecvBuf[readx++]<<8;
|
// m_SimAcc.MaxValue |= (int)m_RecvBuf[readx++]<<8;
|
||||||
m_SimAcc.MaxValue |= (int)m_RecvBuf[readx++]<<16;
|
// m_SimAcc.MaxValue |= (int)m_RecvBuf[readx++]<<16;
|
||||||
m_SimAcc.MaxValue |= (int)m_RecvBuf[readx++]<<24;
|
// m_SimAcc.MaxValue |= (int)m_RecvBuf[readx++]<<24;
|
||||||
m_SimAcc.StepValue = (int)m_RecvBuf[readx++];
|
// m_SimAcc.StepValue = (int)m_RecvBuf[readx++];
|
||||||
m_SimAcc.StepValue |= (int)m_RecvBuf[readx++]<<8;
|
// m_SimAcc.StepValue |= (int)m_RecvBuf[readx++]<<8;
|
||||||
m_SimAcc.StepValue |= (int)m_RecvBuf[readx++]<<16;
|
// m_SimAcc.StepValue |= (int)m_RecvBuf[readx++]<<16;
|
||||||
m_SimAcc.StepValue |= (int)m_RecvBuf[readx++]<<24;
|
// m_SimAcc.StepValue |= (int)m_RecvBuf[readx++]<<24;
|
||||||
|
pTemp = (unsigned char*)&m_SimAcc.MinValue;
|
||||||
|
*pTemp = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+1) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+2) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+3) = m_RecvBuf[readx++];
|
||||||
|
pTemp = (unsigned char*)&m_SimAcc.MaxValue;
|
||||||
|
*pTemp = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+1) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+2) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+3) = m_RecvBuf[readx++];
|
||||||
|
pTemp = (unsigned char*)&m_SimAcc.StepValue;
|
||||||
|
*pTemp = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+1) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+2) = m_RecvBuf[readx++];
|
||||||
|
*(pTemp+3) = m_RecvBuf[readx++];
|
||||||
|
|
||||||
|
|
||||||
m_SimAcc.RtuNo = (int)m_RecvBuf[readx++];
|
m_SimAcc.RtuNo = (int)m_RecvBuf[readx++];
|
||||||
@ -3579,7 +3614,8 @@ int CFesSimServerThread::SimAccStartResp(unsigned char *Data,int /*FrameNo*/)
|
|||||||
m_SimAccStart = 1;
|
m_SimAccStart = 1;
|
||||||
m_SimAccChangeCountReset = m_SimAcc.Period*1000/50; //50ms polling;
|
m_SimAccChangeCountReset = m_SimAcc.Period*1000/50; //50ms polling;
|
||||||
m_SimAccChangeCount = 0;
|
m_SimAccChangeCount = 0;
|
||||||
m_SimAccValue = m_SimAcc.MinValue;
|
//m_SimAccValue = m_SimAcc.MinValue;
|
||||||
|
m_SimAccValue = (double)m_SimAcc.MinValue;
|
||||||
m_SimAccValueSigned = 1;
|
m_SimAccValueSigned = 1;
|
||||||
|
|
||||||
Data[6] = CN_SFesSimAccStartResp; //命令码
|
Data[6] = CN_SFesSimAccStartResp; //命令码
|
||||||
@ -6828,6 +6864,7 @@ int CFesSimServerThread::FwAccDataResp(unsigned char *Data, int FrameNo)
|
|||||||
SFesFwAcc *pFwAcc;
|
SFesFwAcc *pFwAcc;
|
||||||
int writex, count, structLen, maxCount, RtuNo;
|
int writex, count, structLen, maxCount, RtuNo;
|
||||||
int i, StartIndex, EndIndex;
|
int i, StartIndex, EndIndex;
|
||||||
|
unsigned char* pTemp;
|
||||||
|
|
||||||
if (m_ptrCFesBase == NULL)
|
if (m_ptrCFesBase == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -6916,14 +6953,23 @@ int CFesSimServerThread::FwAccDataResp(unsigned char *Data, int FrameNo)
|
|||||||
Data[writex++] = (pFwAcc->RemoteNo >> 8) & 0xff;
|
Data[writex++] = (pFwAcc->RemoteNo >> 8) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->RemoteNo >> 16) & 0xff;
|
Data[writex++] = (pFwAcc->RemoteNo >> 16) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->RemoteNo >> 24) & 0xff;
|
Data[writex++] = (pFwAcc->RemoteNo >> 24) & 0xff;
|
||||||
Data[writex++] = pFwAcc->Value & 0xff;
|
// Data[writex++] = pFwAcc->Value & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 8) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 8) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 16) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 16) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 24) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 24) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 32) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 32) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 40) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 40) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 48) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 48) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Value >> 56) & 0xff;
|
// Data[writex++] = (pFwAcc->Value >> 56) & 0xff;
|
||||||
|
pTemp = (unsigned char*)&pFwAcc->Value;
|
||||||
|
Data[writex++] = *pTemp;
|
||||||
|
Data[writex++] = *(pTemp + 1);
|
||||||
|
Data[writex++] = *(pTemp + 2);
|
||||||
|
Data[writex++] = *(pTemp + 3);
|
||||||
|
Data[writex++] = *(pTemp + 4);
|
||||||
|
Data[writex++] = *(pTemp + 5);
|
||||||
|
Data[writex++] = *(pTemp + 6);
|
||||||
|
Data[writex++] = *(pTemp + 7);
|
||||||
Data[writex++] = pFwAcc->Status & 0xff;
|
Data[writex++] = pFwAcc->Status & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Status >> 8) & 0xff;
|
Data[writex++] = (pFwAcc->Status >> 8) & 0xff;
|
||||||
Data[writex++] = (pFwAcc->Status >> 16) & 0xff;
|
Data[writex++] = (pFwAcc->Status >> 16) & 0xff;
|
||||||
@ -7589,6 +7635,7 @@ int CFesSimServerThread::SpecifiedAccDataResp(unsigned char *Data, int FrameNo)
|
|||||||
SFesAcc *pAcc;
|
SFesAcc *pAcc;
|
||||||
int writex, count, structLen, maxCount, RtuNo;
|
int writex, count, structLen, maxCount, RtuNo;
|
||||||
int i;
|
int i;
|
||||||
|
unsigned char* pTemp;
|
||||||
|
|
||||||
if (m_ptrCFesBase == NULL)
|
if (m_ptrCFesBase == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -7673,14 +7720,23 @@ int CFesSimServerThread::SpecifiedAccDataResp(unsigned char *Data, int FrameNo)
|
|||||||
Data[writex++] = (pAcc->PointNo >> 8) & 0xff;
|
Data[writex++] = (pAcc->PointNo >> 8) & 0xff;
|
||||||
Data[writex++] = (pAcc->PointNo >> 16) & 0xff;
|
Data[writex++] = (pAcc->PointNo >> 16) & 0xff;
|
||||||
Data[writex++] = (pAcc->PointNo >> 24) & 0xff;
|
Data[writex++] = (pAcc->PointNo >> 24) & 0xff;
|
||||||
Data[writex++] = pAcc->Value & 0xff;
|
// Data[writex++] = pAcc->Value & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 8) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 8) & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 16) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 16) & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 24) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 24) & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 32) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 32) & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 40) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 40) & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 48) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 48) & 0xff;
|
||||||
Data[writex++] = (pAcc->Value >> 56) & 0xff;
|
// Data[writex++] = (pAcc->Value >> 56) & 0xff;
|
||||||
|
pTemp = (unsigned char*)&pAcc->Value;
|
||||||
|
Data[writex++] = *pTemp;
|
||||||
|
Data[writex++] = *(pTemp + 1);
|
||||||
|
Data[writex++] = *(pTemp + 2);
|
||||||
|
Data[writex++] = *(pTemp + 3);
|
||||||
|
Data[writex++] = *(pTemp + 4);
|
||||||
|
Data[writex++] = *(pTemp + 5);
|
||||||
|
Data[writex++] = *(pTemp + 6);
|
||||||
|
Data[writex++] = *(pTemp + 7);
|
||||||
Data[writex++] = pAcc->Status & 0xff;
|
Data[writex++] = pAcc->Status & 0xff;
|
||||||
Data[writex++] = (pAcc->Status >> 8) & 0xff;
|
Data[writex++] = (pAcc->Status >> 8) & 0xff;
|
||||||
Data[writex++] = (pAcc->Status >> 16) & 0xff;
|
Data[writex++] = (pAcc->Status >> 16) & 0xff;
|
||||||
|
|||||||
@ -101,7 +101,8 @@ private:
|
|||||||
SFesSimAccStartReq m_SimAcc;
|
SFesSimAccStartReq m_SimAcc;
|
||||||
int m_SimAccChangeCount;
|
int m_SimAccChangeCount;
|
||||||
int m_SimAccChangeCountReset;
|
int m_SimAccChangeCountReset;
|
||||||
int64 m_SimAccValue;
|
//int64 m_SimAccValue;
|
||||||
|
double m_SimAccValue;
|
||||||
int m_SimAccValueSigned; //增加的方向 (1)+ else(-)
|
int m_SimAccValueSigned; //增加的方向 (1)+ else(-)
|
||||||
int64 m_SimAccLastmSec; //2022-01-10
|
int64 m_SimAccLastmSec; //2022-01-10
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ void CFesTxControlCmdThread::execute()
|
|||||||
if(m_ptrTxCommunicator==NULL)
|
if(m_ptrTxCommunicator==NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//发送控制消息
|
//发送控制反馈消息
|
||||||
int retNum,msgType;
|
int retNum,msgType;
|
||||||
for (size_t i = 0; i < m_ptrCFesBase->m_vectCFesRtuPtr.size(); i++)
|
for (size_t i = 0; i < m_ptrCFesBase->m_vectCFesRtuPtr.size(); i++)
|
||||||
{
|
{
|
||||||
@ -203,7 +203,7 @@ void CFesTxControlCmdThread::execute()
|
|||||||
CmdReplyPkg.set_nstatus(TxDefCmd.retStatus);
|
CmdReplyPkg.set_nstatus(TxDefCmd.retStatus);
|
||||||
CmdReplyPkg.set_ndevid(TxDefCmd.DevId);
|
CmdReplyPkg.set_ndevid(TxDefCmd.DevId);
|
||||||
CmdReplyPkg.set_ndatalen(TxDefCmd.CmdNum);
|
CmdReplyPkg.set_ndatalen(TxDefCmd.CmdNum);
|
||||||
int count = TxDefCmd.VecCmd.size();
|
int count = static_cast<int>(TxDefCmd.VecCmd.size());
|
||||||
for(int k=0;k<count;k++)
|
for(int k=0;k<count;k++)
|
||||||
{
|
{
|
||||||
SFesCustCmdQueue *cmdQueue;
|
SFesCustCmdQueue *cmdQueue;
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
2021-05-25 thxiao 增加 SFesSoeStrEvent 事件 的发送
|
2021-05-25 thxiao 增加 SFesSoeStrEvent 事件 的发送
|
||||||
2021-06-04 thxiao ChanEventResp()改为从base结构m_ChanEventBuf发出。
|
2021-06-04 thxiao ChanEventResp()改为从base结构m_ChanEventBuf发出。
|
||||||
2021-06-07 thxiao 时间的判断由getUTCTimeMsec()改为getMonotonicMsec()
|
2021-06-07 thxiao 时间的判断由getUTCTimeMsec()改为getMonotonicMsec()
|
||||||
2023-11-25 thxiao MiChangeResp()消息由SFesChangeDiPkg变为SFesChangeMiPkg,原来的也不会有问题。
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include "FesTxDataChangeThread.h"
|
#include "FesTxDataChangeThread.h"
|
||||||
@ -464,7 +463,7 @@ int CFesTxDataChangeThread::DiChangeResp()
|
|||||||
if (i >= m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
if (i >= m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iDiChgRtu = 0;
|
m_ptrCFesBase->m_LastRtuIndx.iDiChgRtu = 0;
|
||||||
else
|
else
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iDiChgRtu = i;
|
m_ptrCFesBase->m_LastRtuIndx.iDiChgRtu = static_cast<int>(i);
|
||||||
|
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
@ -560,7 +559,7 @@ int CFesTxDataChangeThread::AiChangeResp()
|
|||||||
if(i>=m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
if(i>=m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iAiChgRtu=0;
|
m_ptrCFesBase->m_LastRtuIndx.iAiChgRtu=0;
|
||||||
else
|
else
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iAiChgRtu=i;
|
m_ptrCFesBase->m_LastRtuIndx.iAiChgRtu=static_cast<int>(i);
|
||||||
|
|
||||||
//LOGINFO("AiChangeResp end %lld",mSec);
|
//LOGINFO("AiChangeResp end %lld",mSec);
|
||||||
|
|
||||||
@ -614,7 +613,7 @@ int CFesTxDataChangeThread::AccChangeResp()
|
|||||||
pAccWithTm->set_strappcolumnname(pChgAcc->ColumnName);
|
pAccWithTm->set_strappcolumnname(pChgAcc->ColumnName);
|
||||||
pAccWithTm->set_strapptagname(pChgAcc->TagName);
|
pAccWithTm->set_strapptagname(pChgAcc->TagName);
|
||||||
pAccWithTm->set_ustatus(pChgAcc->Status);
|
pAccWithTm->set_ustatus(pChgAcc->Status);
|
||||||
pAccWithTm->set_nvalue(pChgAcc->Value);
|
pAccWithTm->set_dvalue(pChgAcc->Value);
|
||||||
pAccWithTm->set_ultime(pChgAcc->time);
|
pAccWithTm->set_ultime(pChgAcc->time);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -653,7 +652,7 @@ int CFesTxDataChangeThread::AccChangeResp()
|
|||||||
if(i>=m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
if(i>=m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iAccChgRtu=0;
|
m_ptrCFesBase->m_LastRtuIndx.iAccChgRtu=0;
|
||||||
else
|
else
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iAccChgRtu=i;
|
m_ptrCFesBase->m_LastRtuIndx.iAccChgRtu=static_cast<int>(i);
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -670,8 +669,8 @@ int CFesTxDataChangeThread::MiChangeResp()
|
|||||||
int j,startIndex;
|
int j,startIndex;
|
||||||
CFesRtuPtr ptrCFesRtu;
|
CFesRtuPtr ptrCFesRtu;
|
||||||
int num,retNum,count;
|
int num,retNum,count;
|
||||||
SFesChangeMiPkg ChgMiPkg;
|
SFesChangeDiPkg ChgMiPkg;
|
||||||
SFesMiDataWithTm *pMiWithTm;
|
SFesDiDataWithTm *pMiWithTm;
|
||||||
SFesChgMi *pChgMi;
|
SFesChgMi *pChgMi;
|
||||||
|
|
||||||
if(m_ptrCFesBase==NULL)
|
if(m_ptrCFesBase==NULL)
|
||||||
@ -701,7 +700,7 @@ int CFesTxDataChangeThread::MiChangeResp()
|
|||||||
pChgMi = m_pChgMiData+j;
|
pChgMi = m_pChgMiData+j;
|
||||||
if(strlen(pChgMi->TagName)<1)//TagName 内容<1,表明后台配置无效,不需送数据
|
if(strlen(pChgMi->TagName)<1)//TagName 内容<1,表明后台配置无效,不需送数据
|
||||||
continue;
|
continue;
|
||||||
pMiWithTm = ChgMiPkg.add_stmidata();
|
pMiWithTm = ChgMiPkg.add_stdidata();
|
||||||
pMiWithTm->set_strapptablename(pChgMi->TableName);
|
pMiWithTm->set_strapptablename(pChgMi->TableName);
|
||||||
pMiWithTm->set_strappcolumnname(pChgMi->ColumnName);
|
pMiWithTm->set_strappcolumnname(pChgMi->ColumnName);
|
||||||
pMiWithTm->set_strapptagname(pChgMi->TagName);
|
pMiWithTm->set_strapptagname(pChgMi->TagName);
|
||||||
@ -747,7 +746,7 @@ int CFesTxDataChangeThread::MiChangeResp()
|
|||||||
if(i>=m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
if(i>=m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iMiChgRtu=0;
|
m_ptrCFesBase->m_LastRtuIndx.iMiChgRtu=0;
|
||||||
else
|
else
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iMiChgRtu=i;
|
m_ptrCFesBase->m_LastRtuIndx.iMiChgRtu=static_cast<int>(i);
|
||||||
|
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
@ -852,7 +851,7 @@ int CFesTxDataChangeThread::SoeEventResp()
|
|||||||
if (i >= m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
if (i >= m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iSoeEventRtu=0;
|
m_ptrCFesBase->m_LastRtuIndx.iSoeEventRtu=0;
|
||||||
else
|
else
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iSoeEventRtu=i;
|
m_ptrCFesBase->m_LastRtuIndx.iSoeEventRtu=static_cast<int>(i);
|
||||||
|
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
@ -1132,7 +1131,7 @@ int CFesTxDataChangeThread::SoeStrEventResp()
|
|||||||
if (i >= m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
if (i >= m_ptrCFesBase->m_vectCFesRtuPtr.size())
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iSoeStrEventRtu = 0;
|
m_ptrCFesBase->m_LastRtuIndx.iSoeStrEventRtu = 0;
|
||||||
else
|
else
|
||||||
m_ptrCFesBase->m_LastRtuIndx.iSoeStrEventRtu = i;
|
m_ptrCFesBase->m_LastRtuIndx.iSoeStrEventRtu = static_cast<int>(i);
|
||||||
|
|
||||||
return iotSuccess;
|
return iotSuccess;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ std::set<std::string> FesWaveRecord::getDevGroupTagList(CFesRtuPtr rtuPtr,int fe
|
|||||||
retNum = rtuPtr->GetDiPointNoByDevId(fesDevId, VetPointNo);
|
retNum = rtuPtr->GetDiPointNoByDevId(fesDevId, VetPointNo);
|
||||||
std::set<string> devGroupList;
|
std::set<string> devGroupList;
|
||||||
SFesDi* pFesDi;
|
SFesDi* pFesDi;
|
||||||
int diCount = VetPointNo.size();
|
int diCount = static_cast<int>(VetPointNo.size());
|
||||||
string pointTagName;
|
string pointTagName;
|
||||||
string devGroupTag;
|
string devGroupTag;
|
||||||
for (int i = 0; i < diCount; i++)
|
for (int i = 0; i < diCount; i++)
|
||||||
@ -165,8 +165,7 @@ bool FesWaveCfgFile::openFile(std::string& file)
|
|||||||
m_startTime = 0;
|
m_startTime = 0;
|
||||||
m_endTime = 0;
|
m_endTime = 0;
|
||||||
|
|
||||||
CFileUtil fu;
|
std::string dataPath = CFileUtil::getCurModuleDir();
|
||||||
std::string dataPath = fu.getCurModuleDir();
|
|
||||||
//file path
|
//file path
|
||||||
filesystem::path fpath = dataPath;
|
filesystem::path fpath = dataPath;
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,6 @@ SOURCES += main.cpp \
|
|||||||
FesChan.cpp \
|
FesChan.cpp \
|
||||||
FesRedundantManage.cpp \
|
FesRedundantManage.cpp \
|
||||||
FesRtu.cpp \
|
FesRtu.cpp \
|
||||||
FesSimServerThread.cpp \
|
|
||||||
FesWaveFormThread.cpp \
|
FesWaveFormThread.cpp \
|
||||||
FesDataPublish.cpp \
|
FesDataPublish.cpp \
|
||||||
FesForwardConfig.cpp \
|
FesForwardConfig.cpp \
|
||||||
@ -28,11 +27,8 @@ SOURCES += main.cpp \
|
|||||||
FesFwRxControlCmdThread.cpp \
|
FesFwRxControlCmdThread.cpp \
|
||||||
FesFwTxControlCmdThread.cpp \
|
FesFwTxControlCmdThread.cpp \
|
||||||
FesWaveRecord.cpp \
|
FesWaveRecord.cpp \
|
||||||
AnaWorkThread.cpp \
|
DebugThread.cpp \
|
||||||
DigWorkThread.cpp \
|
DebugMbCommunicator.cpp
|
||||||
AccWorkThread.cpp \
|
|
||||||
MixWorkThread.cpp \
|
|
||||||
PacketQueue.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
FesApp.h \
|
FesApp.h \
|
||||||
@ -51,7 +47,6 @@ HEADERS += \
|
|||||||
../include/FesRdbStruct.h \
|
../include/FesRdbStruct.h \
|
||||||
FesChanManageThread.h \
|
FesChanManageThread.h \
|
||||||
FesRedundantManage.h \
|
FesRedundantManage.h \
|
||||||
FesSimServerThread.h \
|
|
||||||
FesWaveFormThread.h \
|
FesWaveFormThread.h \
|
||||||
FesDataPublish.h \
|
FesDataPublish.h \
|
||||||
FesForwardConfig.h \
|
FesForwardConfig.h \
|
||||||
@ -63,16 +58,15 @@ HEADERS += \
|
|||||||
../../idl_files/FesDataMessage.pb.h \
|
../../idl_files/FesDataMessage.pb.h \
|
||||||
../../idl_files/FesFwMessage.pb.h \
|
../../idl_files/FesFwMessage.pb.h \
|
||||||
FesWaveRecord.h \
|
FesWaveRecord.h \
|
||||||
AnaWorkThread.h \
|
DebugThread.h \
|
||||||
DigWorkThread.h \
|
DebugMbCommunicator.h \
|
||||||
AccWorkThread.h \
|
DebugSimParam.h
|
||||||
MixWorkThread.h \
|
|
||||||
PacketQueue.h
|
|
||||||
|
|
||||||
INCLUDEPATH += ../include/
|
INCLUDEPATH += ../include/
|
||||||
|
INCLUDEPATH += ../fes_idl_files/
|
||||||
|
|
||||||
LIBS += -lboost_system -lboost_thread -lboost_chrono -lboost_program_options -lboost_date_time -lboost_filesystem -lboost_locale -lboost_regex
|
LIBS += -lboost_system -lboost_thread -lboost_chrono -lboost_program_options -lboost_date_time -lboost_filesystem -lboost_locale -lboost_regex
|
||||||
LIBS += -lpub_utility_api -lpub_logger_api -lnet_msg_bus_api -lpub_sysinfo_api -llog4cplus -lsys_dog_auth_api
|
LIBS += -lpub_utility_api -lpub_logger_api -lnet_msg_bus_api -lpub_sysinfo_api -llog4cplus
|
||||||
LIBS += -lrdb_api
|
LIBS += -lrdb_api
|
||||||
LIBS += -lprotobuf
|
LIBS += -lprotobuf
|
||||||
LIBS += -lsys_node_mng_api
|
LIBS += -lsys_node_mng_api
|
||||||
@ -80,10 +74,12 @@ LIBS += -lsys_proc_mng_api
|
|||||||
LIBS += -lalarm_server_api
|
LIBS += -lalarm_server_api
|
||||||
LIBS += -ldp_chg_data_api
|
LIBS += -ldp_chg_data_api
|
||||||
LIBS += -lsys_file_sync_api
|
LIBS += -lsys_file_sync_api
|
||||||
|
LIBS += -lzmq -lczmq
|
||||||
|
|
||||||
DEFINES += PROTOCOLBASE_API_EXPORTS
|
DEFINES += PROTOCOLBASE_API_EXPORTS
|
||||||
|
|
||||||
include($$PWD/../../idl_files/idl_files.pri)
|
include($$PWD/../../idl_files/idl_files.pri)
|
||||||
|
include($$PWD/../fes_idl_files/fes_idl_files.pri)
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
COMMON_PRI=$$PWD/../../common.pri
|
COMMON_PRI=$$PWD/../../common.pri
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user