#include "pch.h" #include "PowerEventDeal.h" #include "PublicEqpmtID.h" #include "YD_Public_OCC.h" #include #include extern void GetMainSubStationID( int& nFirstStationID, int& nSecondStationID ); PowerEventDeal::PowerEventDeal() { p_SendList=nullptr; BaseElectricEqpmt::SetTelesignalisationOwner(this); BaseElectricEqpmt::SetCallBackTelesignalisationFunc(DealTelesignalisation); BaseElectricEqpmt::SetCallBackDealElcTurnOffAreaFunc(DealElcTurnOffArea); BaseElectricEqpmt::SetCallBackDeal400VLoadTurnOffFunc(DealDeal400VLoadTurnOff); ElectricEqpmt_ElcTurnOffAreaMng::SetOwner(this); ElectricEqpmt_ElcTurnOffAreaMng::SetCallBackEqpmtElcStatus( GetEqpmtElcStatus ); ElectricEqpmt_ElcTurnOffAreaMng::SetCallBackTurnOffArea( TurnOffArea ); IsExamMOde = false; } void PowerEventDeal::SetInitInfo(CommandQueue * psendlist,int trian)//? { p_SendList =psendlist; m_trainID = trian; ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); while (iter!=pElectricEqpmtMap->end()) { iter->second->SetSendList(psendlist,m_trainID); iter->second->SetDelayMap(&m_DelayDelMap); iter++; } m_400VLoadMng.SetDelayMap(&m_DelayDelMap); } DELAYMAP* PowerEventDeal::GetDelayTimeMap() { return &m_DelayDelMap; } bool PowerEventDeal::NeedDelayTimeDeal()//? { if (m_DelayDelMap.size()>0) return true; return false; } bool PowerEventDeal::handle_delaytime()//?handle_delaytime()与NeedDelayTimeDeal()的区别 { std::time_t curtime = std::time(nullptr); std::tm* local_time = std::localtime(&curtime); DELAYMAP::iterator iter=m_DelayDelMap.begin(); for (;iter!=m_DelayDelMap.end();iter++) { ELEEQPMTMAP::iterator iter1 = pElectricEqpmtMap->find(iter->first); if (iter1!=pElectricEqpmtMap->end()) { if (!iter1->second->handle_delaytime(curtime,*pElectricEqpmtMap,iter->second)) { m_DelayDelMap.erase(iter); return false; } } } return true; } bool PowerEventDeal::CloseOffSwicth()//? { R_Mutex_LOCK(*pEqpmtMapCriticalSection); ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); for (;iter!=pElectricEqpmtMap->end();iter++) { //置开关在关闭时为无电状态,如果不进行此操作,牵引变电所的纵向隔离开关无法断电 if (iter->second->GetBaseType() ==OCC_EQPMTTYPE_35kVBREAKER || iter->second->GetBaseType() == OCC_EQPMTTYPE_27_5kVBREAKER || iter->second->GetBaseType() == OCC_EQPMTTYPE_27_5kVSwitch || iter->second->GetBaseType()==OCC_EQPMTTYPE_ThreePositong_ELCSWICTH || iter->second->GetBaseType() ==OCC_EQPMTTYPE_BREAKER_DC || iter->second->GetBaseType()==OCC_EQPMTTYPE_Power_ELCSWICTH || iter->second->GetBaseType()==OCC_EQPMTTYPE_Mannual_ELCSWICTH || iter->second->GetBaseType() ==OCC_EQPMTTYPE_400vACControlBreaker || iter->second->GetBaseType()==OCC_EQPMTTYPE_110kVBreaker || iter->second->GetBaseType()==OCC_EQPMTTYPE_110kVSwitch) //处理一个元件有三个以上的输入 { if (iter->second->GetStatus()==Electric_Eqpmt_Status_OFF) { iter->second->PowerLost(*pElectricEqpmtMap,iter->first,POWER_EQPMT_INIT); } } } return true; } bool PowerEventDeal::DealEvent(NORMALCMDC NCmd,int EventOper,string Eqpmtid,int parm,const string& str2)//? { if (EventOper == Power_Breaker_ProtectAllReset)//add by dengt 处理断路器保护总复归 { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); for (; iter != pElectricEqpmtMap->end(); iter++) { if (stoi(Eqpmtid) != iter->second->GetSourceStationID()) { continue; } if (iter->second->GetFaultLockStatus() != Electric_Eqpmt_Status_Lock) { continue; } UpdateEvaOperStatus updateEvaOperStatus; memset(&updateEvaOperStatus, 0, sizeof(UpdateEvaOperStatus)); updateEvaOperStatus.TrainID = m_trainID; updateEvaOperStatus.CourseID = GetCourseID(); updateEvaOperStatus.OperItemType = Item_Type_DD; updateEvaOperStatus.OperItemObject = MajorType_DD; updateEvaOperStatus.OperClientID = NCmd.paraInt7; updateEvaOperStatus.OperStuID = MajorType_DD; string EqpmemtID = iter->second->GetEqpmentID(); string EqpmentName = iter->second->GetEqpmentName(); string StationName = GetStationName(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara1, EqpmemtID.c_str(), sizeof(updateEvaOperStatus.AssociPara1)); strncpy(updateEvaOperStatus.AssociPara1Name, EqpmentName.c_str(), sizeof(updateEvaOperStatus.AssociPara1Name)); string StationID; StationID = std::to_string(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara2, StationID.c_str(), sizeof(updateEvaOperStatus.AssociPara2)); strncpy(updateEvaOperStatus.AssociPara2Name, StationName.c_str(), sizeof(updateEvaOperStatus.AssociPara2Name)); iter->second->ClearSingleProtect(*pElectricEqpmtMap, 0, str2); updateEvaOperStatus.OperStatus = true; updateEvaOperStatus.OperItemSubType1 = DD_Operate_Item_SwitchEqpmt; //开关设备操作 updateEvaOperStatus.OperItemSubType2 = Switch_Protect_Reset; //控制闭锁 SendMsgToTech(updateEvaOperStatus); } return true; } ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(Eqpmtid); if (iter!=pElectricEqpmtMap->end()) { UpdateEvaOperStatus updateEvaOperStatus; memset(&updateEvaOperStatus,0,sizeof(UpdateEvaOperStatus)); updateEvaOperStatus.TrainID=m_trainID; updateEvaOperStatus.CourseID=GetCourseID(); updateEvaOperStatus.OperItemType=Item_Type_DD; updateEvaOperStatus.OperItemObject=MajorType_DD; updateEvaOperStatus.OperClientID= NCmd.paraInt7; updateEvaOperStatus.OperStuID=MajorType_DD; string EqpmemtID=iter->second->GetEqpmentID(); string EqpmentName=iter->second->GetEqpmentName(); string StationName=GetStationName(iter->second->GetSourceStationID()); /* strcpy(updateEvaOperStatus.AssociPara1,EqpmemtID.GetBuffer()); EqpmemtID.ReleaseBuffer(); string OperDis=StationName+iter->second->GetBaseTypeName()+ EqpmentName; strcpy(updateEvaOperStatus.AssociPara2,OperDis.GetBuffer()); OperDis.ReleaseBuffer(); */ //mod by yangsong 20200615 strncpy(updateEvaOperStatus.AssociPara1,EqpmemtID.c_str(), sizeof(updateEvaOperStatus.AssociPara1)); strncpy(updateEvaOperStatus.AssociPara1Name,EqpmentName.c_str(), sizeof(updateEvaOperStatus.AssociPara1Name)); string StationID; StationID = std::to_string(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara2,StationID.c_str(), sizeof(updateEvaOperStatus.AssociPara2)); strncpy(updateEvaOperStatus.AssociPara2Name,StationName.c_str(), sizeof(updateEvaOperStatus.AssociPara2Name)); //mod end if (EventOper==POWER_ERORR_OCCAR) { //return iter->second->handle_fault(EventOper,*pElectricEqpmtMap,parm); if (parm==10000) { iter->second->CutCommunication(*pElectricEqpmtMap); iter->second->DealTelesignalisation(10000,iter->second->GetEqpmentID(),1); iter->second->UpdateEqpmtLightCardStatu(parm); return true; } if (parm==10002) { iter->second->CutEqpmtAlarm(*pElectricEqpmtMap,ElcAlarm_TripActType_HighMashgas); iter->second->DealTelesignalisation(10002,iter->second->GetEqpmentID(),1); iter->second->UpdateEqpmtLightCardStatu(parm); return true; } return iter->second->CheckErrorToProtect(EventOper,*pElectricEqpmtMap,parm); } else if (EventOper==POWER_ERORR_REVERT) { if (parm==10000) { iter->second->RevertCommunication(*pElectricEqpmtMap); iter->second->UpdateEqpmtLightCardStatu(-1); return true; } if (parm==10002) { iter->second->RevertEqpmtAlarm(*pElectricEqpmtMap,ElcAlarm_TripActType_HighMashgas_Recover); iter->second->UpdateEqpmtLightCardStatu(parm); return true; } return iter->second->handle_revert(EventOper,*pElectricEqpmtMap,parm); } else if (EventOper==Power_Breaker_ProtectReset)//added by zhangjh on 2017.5.17 处理断路器保护复归 { //for (int i=5000;i<5006;i++) //特殊处理故障编号 //if (!iter->second->getProhibitedReversion()) { iter->second->ClearSingleProtect(*pElectricEqpmtMap, 0,str2); updateEvaOperStatus.OperStatus=true; updateEvaOperStatus.OperItemSubType1=DD_Operate_Item_SwitchEqpmt; //开关设备操作 updateEvaOperStatus.OperItemSubType2=Switch_Protect_Reset; //控制闭锁 SendMsgToTech(updateEvaOperStatus); } return true; } else if (EventOper==ShieldStatus_Set) { iter->second->SetShield( *pElectricEqpmtMap ); updateEvaOperStatus.OperStatus=true; updateEvaOperStatus.OperItemSubType1=DD_Operate_Item_SwitchEqpmt; //开关设备操作 updateEvaOperStatus.OperItemSubType2=Switch_Contol_Lock; //控制闭锁 SendMsgToTech(updateEvaOperStatus); } else if (EventOper==ShieldStatus_Cancle) { iter->second->CancleShield( *pElectricEqpmtMap ); updateEvaOperStatus.OperStatus=true; updateEvaOperStatus.OperItemSubType1=DD_Operate_Item_SwitchEqpmt; //开关设备操作 updateEvaOperStatus.OperItemSubType2=Switch_Contol_UnLock; //闭锁解除 SendMsgToTech(updateEvaOperStatus); } else if (EventOper==RemoteLock_Set) { //iter->second->SetRemoteLock(*pElectricEqpmtMap,); } else if (EventOper==RemoteShut) { //modified by zhangjiahua on 2019.4.10 ElectricEqpmt_Breaker *pBreak=(ElectricEqpmt_Breaker*)iter->second; //if (iter->second->GetAutoBoltID()!="") if (pBreak->GetAutoBoltID()!="") { //ELEEQPMTMAP::iterator iter2 = pElectricEqpmtMap->find(iter->second->GetAutoBoltID()); ELEEQPMTMAP::iterator iter2 = pElectricEqpmtMap->find(pBreak->GetAutoBoltID()); if (iter2!=pElectricEqpmtMap->end()) { if (iter2->second->GetStatus()==Electric_Eqpmt_Status_ON) { iter2->second->UpdateEqpmtStatus(*pElectricEqpmtMap,Electric_Eqpmt_Status_OFF); } else if (iter2->second->GetStatus()==Electric_Eqpmt_Status_OFF) { iter2->second->UpdateEqpmtStatus(*pElectricEqpmtMap,Electric_Eqpmt_Status_ON); ElectricEqpmt_PowerBolt* pbolt= (ElectricEqpmt_PowerBolt*)iter2->second; if ( NULL != pbolt ) { pbolt->CheckSelfShut( *pElectricEqpmtMap,pbolt->GetRelationBreaker() ); } } } } } } return false; } void PowerEventDeal::EqpmtCtrl(NORMALCMDC NCmd,string Eqpmtid,int Status,string Stdid,int CtrlType,int nMark/* = 0*/) //对电力元件的相关状态进行控制执行操作 { //DealThirdTrackPowerLose(); UpdateEvaOperStatus updateEvaOperStatus; memset(&updateEvaOperStatus,0,sizeof(UpdateEvaOperStatus)); updateEvaOperStatus.TrainID=m_trainID; updateEvaOperStatus.CourseID=GetCourseID(); updateEvaOperStatus.OperItemType=Item_Type_DD; updateEvaOperStatus.OperItemObject=MajorType_DD; updateEvaOperStatus.OperClientID=NCmd.paraInt7; updateEvaOperStatus.OperStuID=MajorType_DD; ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(Eqpmtid); if (iter!=pElectricEqpmtMap->end()) { string EqpmemtID=iter->second->GetEqpmentID(); string EqpmentName=iter->second->GetEqpmentName(); string StationName=GetStationName(iter->second->GetSourceStationID()); //mod by yangsong 20200615 strncpy(updateEvaOperStatus.AssociPara1,EqpmemtID.c_str(), sizeof(updateEvaOperStatus.AssociPara1)); strncpy(updateEvaOperStatus.AssociPara1Name,EqpmentName.c_str(), sizeof(updateEvaOperStatus.AssociPara1Name)); string StationID; StationID = std::to_string(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara2,StationID.c_str(), sizeof(updateEvaOperStatus.AssociPara2)); strncpy(updateEvaOperStatus.AssociPara2Name,StationName.c_str(), sizeof(updateEvaOperStatus.AssociPara2Name)); //mod end if (iter->second->getProhibitedReversion()) { //CElectricEqpmt_SwicthEqpmt *pEqpmt = (CElectricEqpmt_SwicthEqpmt *)iter->second; //pEqpmt->UpdateFaultLockStatus(Electric_Eqpmt_Status_Lock); string EqpmtTypeName = iter->second->GetBaseTypeName(); //设备类型名称 string EqpmtName = iter->second->GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = iter->second->GetSourceStationID(); //设备所属车站ID int EqpmtType = iter->second->GetBaseType(); //设备类型 int nActType1 = ElcAlarm_TripActType_TouchnetTest_Fail; //“试送失败”报文类型 iter->second->UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); return; } else { if (iter->second->GetCurErrorNos() > 0) { string EqpmtTypeName = iter->second->GetBaseTypeName(); //设备类型名称 string EqpmtName = iter->second->GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = iter->second->GetSourceStationID(); //设备所属车站ID int EqpmtType = iter->second->GetBaseType(); //设备类型 int nActType1 = ElcAlarm_TripActType_TouchnetTest_Success; //“试送成功”报文类型 iter->second->UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); } } //在操作设备之前先进行控制校验 modied by zhangjh if(CtrlType == CTRLTYPE_MODE || IsExamMOde || iter->second->CheckEqpmtCtrlCase(Status,*pElectricEqpmtMap,0,iter->second->GetOperSubsysID(),m_trainID,iter->second->GetStationID(),iter->second->GetViewID(), CtrlType, nMark)==DH_CmdReplyStatus_Pass || CtrlType == CTRLTYPE_CARD) { //查找设备是否关联备自投,有则设置关联备自投为手动控制 ELEEQPMTMAP::iterator iterBolt = pElectricEqpmtMap->find(iter->second->GetAutoBoltID()); if (iterBolt != pElectricEqpmtMap->end()) { ElectricEqpmt_PowerBolt* pEqpmtBolt = (ElectricEqpmt_PowerBolt*)iterBolt->second; { pEqpmtBolt->SetCtrlMode(AutoBolt_CtrlMode_Manual_Manual); } } //新增 if (CtrlType == CTRLTYPE_MODE) CtrlType = CTRLTYPE_STATUS; // 设备控制,关联了真实设备后需要延时等待真实设备反馈 if (iter->second->checkReallyEqpmtFlag()) { iter->second->EqpmtCtrlExecution(Status, *pElectricEqpmtMap, Stdid, CtrlType, nMark); } else { iter->second->EqpmtCtrl(Status, *pElectricEqpmtMap, Stdid, CtrlType, nMark); } updateEvaOperStatus.OperStatus=true; EqpmtStatusToIBP(iter->first,Status); //控制结束恢复备自投控制 if (iterBolt != pElectricEqpmtMap->end()) { ElectricEqpmt_PowerBolt* pEqpmtBolt = (ElectricEqpmt_PowerBolt*)iterBolt->second; if (Status == Electric_Eqpmt_Status_ON) { pEqpmtBolt->SetCtrlMode(AutoBolt_CtrlMode_Auto_Auto); } } } else { updateEvaOperStatus.OperStatus=false; } updateEvaOperStatus.OperItemSubType1=DD_Operate_Item_SwitchEqpmt; //开关设备操作 if (Status) { updateEvaOperStatus.OperItemSubType2=Switch_On;//合闸 } else { updateEvaOperStatus.OperItemSubType2=Switch_Off;//分闸 } if (NCmd.cmdType > 0 && OperClient_RealSynch != nMark) { SendMsgToTech(updateEvaOperStatus); } } } void PowerEventDeal::EqpmtCtrlCheck(int ViewID,int SubSys,string Eqpmtid,int Status,int Stdid,int ctrlarea,int grade,int station,int CtrlType) // 检查设备的状态属性 { ELEEQPMTMAP::iterator iterAutoBolt; ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(Eqpmtid); if (iter!=pElectricEqpmtMap->end()) { if(IsExamMOde) iter->second->SendExamModeEqpmtCheckStatus(Stdid,SubSys,m_trainID,station,ViewID); else iter->second->CheckEqpmtCtrlCase(Status,*pElectricEqpmtMap,Stdid,SubSys,m_trainID,station,ViewID,CtrlType); m_EqpmtStationID = station; m_StrCheckEqpmt = Eqpmtid; //modified by zhangjiahua on 2019.4.10 if (iter->second->GetEqpmentType()==Electric_EqpmentType_Breaker) { ElectricEqpmt_Breaker *pbreak=(ElectricEqpmt_Breaker*)iter->second; ELEEQPMTMAP::iterator iterAutoBolt = pElectricEqpmtMap->find(pbreak->GetAutoBoltID()); if (iterAutoBolt != pElectricEqpmtMap->end()) { iterAutoBolt->second->SetOperViewID(ViewID); iterAutoBolt->second->SetOperStationID(station); iterAutoBolt->second->SetOperSubsysID(SubSys); } } //ELEEQPMTMAP::iterator iterAutoBolt = pElectricEqpmtMap->find(iter->second->GetAutoBoltID()); //if (iterAutoBolt != pElectricEqpmtMap->end()) //{ // iterAutoBolt->second->SetOperViewID(ViewID); // iterAutoBolt->second->SetOperStationID(station); // iterAutoBolt->second->SetOperSubsysID(SubSys); //} iter->second->SetOperViewID(ViewID); iter->second->SetOperStationID(station); iter->second->SetOperSubsysID(SubSys); } } PowerEventDeal::~PowerEventDeal() { m_DelayDelMap.clear(); } void PowerEventDeal::SetEqpmtMap(ELEEQPMTMAP* pepmtmap, std::recursive_mutex* psec, EQPMTTELEINFO* pEqpmtTeleInfo) //初始化电力设备列表 { pElectricEqpmtMap = pepmtmap; pEqpmtMapCriticalSection = psec; mptr_EqpmtTeleInfo = pEqpmtTeleInfo; } //mod by yangs //新增整形参数 nDesSysID:消息指定发送系统ID //将状态变化更新到客户端 void PowerEventDeal::SystemInit(int nDesSysID) { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); for( ; iter != pElectricEqpmtMap->end(); iter++ ) { if ( iter->second->GetInitStatus() != iter->second->GetStatus()) { iter->second->UpdateEqpmtStatus( *pElectricEqpmtMap,iter->second->GetStatus(),CTRLTYPE_STATUS,nDesSysID); } } TelesignalisationInit(); } bool PowerEventDeal::DealWithAutoBoltCtrlMothod(int trainid, string Eqpmtid,int ctrlmode) { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(Eqpmtid); if (iter!=pElectricEqpmtMap->end()) { if (iter->second->GetBaseType() == OCC_EQPMTTYPE_AUTOBOLT) { ElectricEqpmt_PowerBolt* pbolt = (ElectricEqpmt_PowerBolt*)iter->second; //pbolt->m_CtrlMode = ctrlmode; pbolt->SetCtrlMode(ctrlmode); pbolt->AutoBoltCheckEqpmtCtrlCase(trainid,*pElectricEqpmtMap,m_subsystemid,pbolt->GetStationID(),pbolt->GetViewID(),m_stdid); pbolt->UpdateModeStatusShow(*pElectricEqpmtMap,ctrlmode); if ( NULL != pbolt ) { pbolt->CheckSelfShut( *pElectricEqpmtMap,pbolt->GetRelationBreaker() ); } } } else { return false; } return true; } void PowerEventDeal::DealTelesignalisation(void* pOwner, int nProtectID, const string& strEqpmtStrID , int nMark ) { PowerEventDeal* pDeal = (PowerEventDeal*)pOwner; if ( NULL == pDeal ) { return; } pDeal->DealTelesignalisation( nProtectID, strEqpmtStrID, nMark ); } void PowerEventDeal::DealTelesignalisation( int nProtectID, const string& strEqpmtStrID, int nMark ) { m_TelesignalisationMng.DealTelesignalisationMsg( p_SendList, m_trainID, nProtectID, strEqpmtStrID, nMark ); } void PowerEventDeal::TelesignalisationInit() { m_TelesignalisationMng.TelesignalisationInit( p_SendList, m_trainID ); } bool PowerEventDeal::GetEqpmtElcStatus(void* pOwner, const string& strEqpmtStrID ) { bool bRet = false; PowerEventDeal* pThis = (PowerEventDeal*)pOwner; if ( NULL != pThis ) { bRet = pThis->GetEqpmtElcStatus(strEqpmtStrID); } return bRet; } bool PowerEventDeal::GetEqpmtElcStatus( const string& strEqpmtStrID ) { bool bRet = false; ELEEQPMTMAP::iterator iterEqpmt = pElectricEqpmtMap->find( strEqpmtStrID ); if ( iterEqpmt != pElectricEqpmtMap->end() ) { bRet = iterEqpmt->second->IsPower(); } return bRet; } void PowerEventDeal::TurnOffArea(void* pOwner, int nAreaID, int nStationID , int nMark ) { PowerEventDeal* pThis = (PowerEventDeal*)pOwner; if ( NULL != pThis ) { pThis->TurnOffArea( nAreaID, nStationID, nMark ); } } void PowerEventDeal::TurnOffArea( int nAreaID, int nStationID , int nMark ) { // 发送停电区域给环调服务器 OCCCOMMAND tmpSendHC; tmpSendHC.DesSysType=OCC_SYS_HD_SVR; tmpSendHC.TrainningID = m_trainID; tmpSendHC.ScrSysType=OCC_SYS_DD_SVR; NETELCTURNOFFAREA ElcTurnOffArea; ElcTurnOffArea.AreaID = nAreaID; ElcTurnOffArea.StationID = nStationID; ElcTurnOffArea.Mark = nMark; tmpSendHC.setPacketValue(&ElcTurnOffArea,OCCCOMMAND::eUpdateTurnOffArea); p_SendList->push(tmpSendHC); // 报警 ElcAreaAlarm( nStationID, nMark ); } void PowerEventDeal::DealElcTurnOffArea(void* pOwner, const string& strEqpmtStrID ) { PowerEventDeal* pThis = (PowerEventDeal*)pOwner; if ( NULL != pThis ) { pThis->m_ElcTurnOffAreaMng.EqpmtOffOccur(strEqpmtStrID); } } void PowerEventDeal::ElcAreaAlarm( int nStationID, bool bPower ) { if ( 0 == nStationID ) { } else { ELEEQPMTMAP::iterator iterEqpmt = pElectricEqpmtMap->begin( ); for ( ; iterEqpmt != pElectricEqpmtMap->end(); iterEqpmt++ ) { if ( OCC_EQPMTTYPE_400vACUncontrolBreaker == iterEqpmt->second->GetBaseType() && nStationID == iterEqpmt->second->GetSourceStationID() ) { iterEqpmt->second->ElcAreaAlarm(bPower); } } } } void PowerEventDeal::DealThirdTrackPowerLose() { ELEEQPMTMAP::iterator iterEqpmt1 = pElectricEqpmtMap->begin( ); ELEEQPMTMAP::iterator iterEqpmt2 = pElectricEqpmtMap->begin( ); ELEEQPMTMAP::iterator iterEqpmt3 = pElectricEqpmtMap->begin( ); bool bFlag1 = false; int nNum1 = -1; bool bFlag2 = false; int nNum2 = -1; int nFirstStation = -1; int nSecondStation = -1; GetMainSubStationID(nFirstStation, nSecondStation); if (iterEqpmt1 !=pElectricEqpmtMap->end() ) { for ( ; iterEqpmt1 != pElectricEqpmtMap->end(); iterEqpmt1++ ) { if ( iterEqpmt1->second->GetSourceStationID() == nFirstStation && iterEqpmt1->second->GetBaseType() == OCC_EQPMTTYPE_35kVMOTHERLINE && iterEqpmt1->second->GetStatus() == Electric_Eqpmt_Status_OFF) { nNum1++; if (nNum1 == 1) { bFlag1 = true; } } else if ( iterEqpmt1->second->GetSourceStationID() == nSecondStation && iterEqpmt1->second->GetBaseType() == OCC_EQPMTTYPE_35kVMOTHERLINE && iterEqpmt1->second->GetStatus() == Electric_Eqpmt_Status_OFF) { nNum2++; if (nNum2 == 1) { bFlag2 = true; } } } } //if (iterEqpmt1 !=pElectricEqpmtMap->end() ) //{ // for ( ; iterEqpmt1 != pElectricEqpmtMap->end(); iterEqpmt1++ ) // { // //if (iterEqpmt1->second->m_SourceStation == 24 && iterEqpmt1->second->m_type == OCC_EQPMTTYPE_MOTHERLINE && iterEqpmt1->second->GetStatus() == Electric_Eqpmt_Status_OFF) // if ( iterEqpmt1->second->m_SourceStation == nFirstStation // && iterEqpmt1->second->m_type == OCC_EQPMTTYPE_MOTHERLINE // && iterEqpmt1->second->GetStatus() == Electric_Eqpmt_Status_OFF) // { // nFirstStation = iterEqpmt1->second->m_SourceStation; // nNum1++; // if (nNum1 == 1) // { // bFlag1 = true; // } // } // } //} //if (iterEqpmt2 !=pElectricEqpmtMap->end() ) //{ // for ( ; iterEqpmt2 != pElectricEqpmtMap->end(); iterEqpmt2++ ) // { // //if (iterEqpmt2->second->m_SourceStation == 25 && iterEqpmt2->second->m_type == OCC_EQPMTTYPE_MOTHERLINE && iterEqpmt2->second->GetStatus() == Electric_Eqpmt_Status_OFF) // if ( iterEqpmt2->second->m_SourceStation == nSecondStation // && iterEqpmt2->second->m_type == OCC_EQPMTTYPE_MOTHERLINE // && iterEqpmt2->second->GetStatus() == Electric_Eqpmt_Status_OFF) // { // nNum2++; // if (nNum2 == 1) // { // bFlag2 = true; // } // } // } //} if (bFlag2 && bFlag1) { for ( ; iterEqpmt3 != pElectricEqpmtMap->end(); iterEqpmt3++ ) { if ((iterEqpmt3->second->GetBaseType() == OCC_EQPMTTYPE_TouchNet ||iterEqpmt3->second->GetBaseType() == OCC_EQPMTTYPE_DCPowerLine) && iterEqpmt3->second->GetStatus() == Electric_Eqpmt_Status_ON) { iterEqpmt3->second->PowerLost(*pElectricEqpmtMap,iterEqpmt3->first,POWER_EQPMT_OPERNO); } } } } void PowerEventDeal::PowerCutArea( int nAreaID ) { map::iterator iterArea = m_ElcTurnOffAreaMng.m_mapElcTurnOffArea.find(nAreaID); if ( iterArea == m_ElcTurnOffAreaMng.m_mapElcTurnOffArea.end() ) { return; } string strInputEqpmtStrID; for ( int i = 0; i < iterArea->second.m_vecElcTurnOffArea.size(); i++ ) { strInputEqpmtStrID = iterArea->second.m_vecElcTurnOffArea[i].m_strUnioEqpmtStrID; NORMALCMDC NCmd; EqpmtCtrl(NCmd,strInputEqpmtStrID, Electric_Eqpmt_Status_OFF, "系统", CTRLTYPE_STATUS); } } void PowerEventDeal::Deal400VLoad( int nStationID, int nThreeLoadUnitID, int nCutMark ) { m_400VLoadMng.Deal400VLoad(nStationID, nThreeLoadUnitID, nCutMark); } void PowerEventDeal::DealDeal400VLoadTurnOff(void* pOwner, const string& strEqpmtStrID, int nButtonID ) { PowerEventDeal* pThis = (PowerEventDeal*)pOwner; if ( NULL != pThis ) { pThis->m_400VLoadMng.CheckInputEqpmt(pThis->pElectricEqpmtMap, strEqpmtStrID, nButtonID ); } } void PowerEventDeal::DealRemoteLock(NORMALCMDC&NCmd) { UpdateEvaOperStatus updateEvaOperStatus; memset(&updateEvaOperStatus,0,sizeof(UpdateEvaOperStatus)); updateEvaOperStatus.TrainID=m_trainID; updateEvaOperStatus.CourseID=GetCourseID(); updateEvaOperStatus.OperItemType=Item_Type_DD; updateEvaOperStatus.OperItemObject=MajorType_DD; updateEvaOperStatus.OperClientID=NCmd.paraInt7; updateEvaOperStatus.OperStuID=MajorType_DD; ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(NCmd.StrPara1); if (iter!=pElectricEqpmtMap->end()) { string EqpmemtID=iter->second->GetEqpmentID(); string EqpmentName=iter->second->GetEqpmentName(); string StationName=GetStationName(iter->second->GetSourceStationID()); /* strcpy(updateEvaOperStatus.AssociPara1,EqpmemtID.GetBuffer()); EqpmemtID.ReleaseBuffer(); string OperDis=StationName+iter->second->GetBaseTypeName()+ EqpmentName; strcpy(updateEvaOperStatus.AssociPara2,OperDis.GetBuffer()); OperDis.ReleaseBuffer();*/ //mod by yangsong 20200615 strncpy(updateEvaOperStatus.AssociPara1,EqpmemtID.c_str(),sizeof(updateEvaOperStatus.AssociPara1)); strncpy(updateEvaOperStatus.AssociPara1Name,EqpmentName.c_str(), sizeof(updateEvaOperStatus.AssociPara1Name)); string StationID; StationID = std::to_string(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara2,StationID.c_str(), sizeof(updateEvaOperStatus.AssociPara2)); strncpy(updateEvaOperStatus.AssociPara2Name,StationName.c_str(), sizeof(updateEvaOperStatus.AssociPara2Name)); //mod end updateEvaOperStatus.OperItemSubType1=DD_Operate_Item_SwitchEqpmt; updateEvaOperStatus.OperStatus=true; updateEvaOperStatus.OperItemSubType2 = -1; if (NCmd.cmdType==RemoteLock_Set) { iter->second->SetRemoteLock(*pElectricEqpmtMap,NCmd.paraInt1,NCmd.paraInt2,NCmd.paraInt3); switch (NCmd.paraInt3) { case RemoteLockType_Off: { updateEvaOperStatus.OperItemSubType2=Switch_RemoteLock_Off;//遥信封锁分 } break; case RemoteLockType_On: { updateEvaOperStatus.OperItemSubType2=Switch_RemoteLock_On;//遥信封锁合 } break; case RemoteLockType_Local: { updateEvaOperStatus.OperItemSubType2=Switch_RemoteLock_Local;//遥信封锁就地 } break; case RemoteLockType_Test: { updateEvaOperStatus.OperItemSubType2=Switch_HanderLock_Test;//手车封锁试验 } break; case RemoteLockType_Work: { updateEvaOperStatus.OperItemSubType2=Switch_HanderLock_Work;//手车封锁工作 } break; default: break; } } else if (NCmd.cmdType==RemoteLock_Cancle) { iter->second->CancleRemoteLock(*pElectricEqpmtMap,NCmd.paraInt1,NCmd.paraInt2); if (NCmd.paraInt3>=0) { updateEvaOperStatus.OperItemSubType2 = Switch_RemoteLock_Unlock;//遥信解除 } } if (updateEvaOperStatus.OperItemSubType2>=0) { SendMsgToTech(updateEvaOperStatus); } } } string PowerEventDeal::GetStationName(int stationID) { string strStationName = ""; ELECSTATIONMAP::iterator iterStation =m_MI_powerstation.find(stationID); if ( iterStation != m_MI_powerstation.end() ) { strStationName = iterStation->second.strstationname; } return strStationName; } void PowerEventDeal::DealPermissionChange(NORMALCMDC&NCmd) { ELECSTATIONMAP::iterator iter= m_MI_powerstation.find(NCmd.paraInt1); if (iter!=m_MI_powerstation.end()) { iter->second.ctrlarea=NCmd.paraInt2; UpdateEvaOperStatus updateEvaOperStatus; memset(&updateEvaOperStatus,0,sizeof(UpdateEvaOperStatus)); updateEvaOperStatus.TrainID=m_trainID; updateEvaOperStatus.CourseID=GetCourseID(); updateEvaOperStatus.OperItemType=Item_Type_DD; updateEvaOperStatus.OperItemObject=MajorType_DD; updateEvaOperStatus.OperClientID=NCmd.paraInt7; updateEvaOperStatus.OperStuID=MajorType_DD; string StationID; StationID = std::to_string(iter->second.stationID); string StationName=iter->second.strstationname; strncpy(updateEvaOperStatus.AssociPara1,StationID.c_str(), sizeof(updateEvaOperStatus.AssociPara1)); strncpy(updateEvaOperStatus.AssociPara2,StationName.c_str(), sizeof(updateEvaOperStatus.AssociPara2)); updateEvaOperStatus.OperItemSubType1=DD_Operate_Item_PermissionChange; if (iter->second.ctrlarea==11) //中心控制 { updateEvaOperStatus.OperItemSubType2=Permission_OCC; } else if (iter->second.ctrlarea==12)//变电所控制 { updateEvaOperStatus.OperItemSubType2=Permission_Station; } updateEvaOperStatus.OperStatus = true; //SendMsgToTech(updateEvaOperStatus); } string AlarmText = ""; int nStation = NCmd.paraInt1; int nArea = 0; if (NCmd.paraInt2==11) { nArea = ELC_EQPMTCTRL_REMOTE; AlarmText = "遥控权限切换至主控"; } else if (NCmd.paraInt2==12) { nArea = ELC_EQPMTCTRL_LOCAL; AlarmText = "遥控权限切换至所控"; } ELEEQPMTMAP::iterator iterEqpmt = pElectricEqpmtMap->begin(); for (iterEqpmt;iterEqpmt != pElectricEqpmtMap->end();iterEqpmt++) { if ((NCmd.paraInt1 != -1) && (iterEqpmt->second->GetSourceStationID() != NCmd.paraInt1)) { continue; } iterEqpmt->second->SetControlArea(nArea); } if ( nStation != -1) { SendStationAlarmMsgToClient(nStation,AlarmText); } else { ELECSTATIONMAP::iterator iterStation =m_MI_powerstation.begin(); for ( ;iterStation != m_MI_powerstation.end(); iterStation++) { SendStationAlarmMsgToClient(iterStation->second.stationID,AlarmText); } } SendControlPermission(); } void PowerEventDeal::SendControlPermission() { //设置车站设备控制区域 ELECSTATIONMAP::iterator iter= m_MI_powerstation.begin(); for (;iter != m_MI_powerstation.end();iter++) { CONTROLPERMISSION controlperssion; controlperssion.nStationID=iter->second.stationID; controlperssion.nControlArea=iter->second.ctrlarea; OCCCOMMAND tmpSendHC; tmpSendHC.setPacketValue(&controlperssion,OCCCOMMAND::eUpdateSendControlPermission); tmpSendHC.DesSysType=OCC_SYS_DD_CLIENT; tmpSendHC.TrainningID = m_trainID; tmpSendHC.ScrSysType=OCC_SYS_DD_SVR; p_SendList->push(tmpSendHC); } } void PowerEventDeal::SendMsgToTech(UpdateEvaOperStatus data) { OCCCOMMAND NetOrder; NetOrder.setPacketValue(&data,OCCCOMMAND::eUpdateEvaOperStatus); NetOrder.TrainningID = m_trainID; NetOrder.ScrSysType = OCC_SYS_DD_SVR; NetOrder.DesSysType = OCC_SYS_SERVER_TH; p_SendList->push(NetOrder); } void PowerEventDeal::EqpmetInit() { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); for( ; iter != pElectricEqpmtMap->end(); iter++ ) { /*if ( iter->second->GetInitStatus() != iter->second->GetStatus()) { iter->second->UpdateEqpmtStatus( *pElectricEqpmtMap,iter->second->GetInitStatus(), CTRLTYPE_STATUS); }*/ int status=iter->second->GetInitStatus(); iter->second->SetEqmpInitStatus(status); //状态初始化 iter->second->SetFaultLockStatus(Electric_Eqpmt_Status_UnLock);//故障锁闭初始化 iter->second->SetControlLock(Electric_Eqpmt_Status_UnLock);//控制闭锁初始化 iter->second->SetCommunicationStatus(false);//设置通讯正常 iter->second->SetCardStatus(ELC_EQPMTCARDSTATUS_NORMAL);//设置挂牌正常 iter->second->SetRemoteLockStatus(Electric_Eqpmt_Status_RemoteUnLock);//设置遥信闭锁正常 iter->second->SetControlArea(ELC_EQPMTCTRL_REMOTE);//设置控制方式默认为远程控制 iter->second->ResetInputPower(); //iter->second->UpdateEqpmtStatus( *pElectricEqpmtMap,iter->second->GetStatus(), CTRLTYPE_STATUS); } InitEqpmtStatusToIBP(); } void PowerEventDeal::SetEqpmtTelemeteryValue(string Eqpmtid, int nType, float nValue, int IsReset) { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(Eqpmtid); if (iter!=pElectricEqpmtMap->end()) { if (IsReset != 1) { int nBaseType = iter->second->GetBaseType(); int nSubType = iter->second->GetSubType(); string strKey(""); strKey = std::to_string(nBaseType); EQPMTTELEINFO::iterator iter_tele = mptr_EqpmtTeleInfo->find(strKey); if (iter_tele == mptr_EqpmtTeleInfo->end()) { strKey = std::to_string(nBaseType) + "-" + std::to_string(nSubType); iter_tele = mptr_EqpmtTeleInfo->find(strKey); } if(iter_tele != mptr_EqpmtTeleInfo->end()) { EqpmtTelemeteryValueInfo* ptrTeleInfo = iter_tele->second; string EppmtTypeName = iter->second->GetBaseTypeName(); string EqpmtName = iter->second->GetEqpmentName(); int EqpmtSourceStatonID = iter->second->GetSourceStationID(); std::string AlarmText = ""; bool IsAlarm = false; int nActType; if( 1 == nType )//电压 { if (nValue < ptrTeleInfo->Excptional_nMinV || nValue > ptrTeleInfo->Excptional_nMaxV)//数值非法 { std::stringstream ss; ss << EppmtTypeName << " " << EqpmtName << " 电压置数 " << std::fixed << std::setprecision(2) << nValue << " 数值非法"; AlarmText = ss.str(); iter->second->SendMsgNotice(EqpmtSourceStatonID, 10, 2, 2, 0, AlarmText, Eqpmtid); return; } else if (nValue >= ptrTeleInfo->Namol_nMaxV /*&& nValue <= ptrTeleInfo->Excptional_nMaxV*/) { nActType = ElcAlarm_TripActType_HighV; //高压 IsAlarm = true; } else if (nValue <= ptrTeleInfo->Namol_nMinV/* && nValue >= ptrTeleInfo->Excptional_nMinV*/) { nActType = ElcAlarm_TripActType_LowV; //低压 IsAlarm = true; } } else { if (nValue < ptrTeleInfo->Excptional_nMinA || nValue > ptrTeleInfo->Excptional_nMaxA)//数值非法 { std::stringstream ss; ss << EppmtTypeName << " " << EqpmtName << " 电流置数 " << std::fixed << std::setprecision(2) << nValue << " 数值非法"; AlarmText = ss.str(); iter->second->SendMsgNotice(EqpmtSourceStatonID, 10, 2, 2, 0, AlarmText, Eqpmtid); return; } else if (nValue >= ptrTeleInfo->Namol_nMaxA && nValue <= ptrTeleInfo->Excptional_nMaxA) { nActType = ElcAlarm_TripActType_HighA; //大电流 IsAlarm = true; } } if(IsAlarm) iter->second->UpdateAlarmType(nBaseType, EppmtTypeName, EqpmtName, EqpmtSourceStatonID,nActType); } } iter->second->UpdateEqpmtTeleValue(Eqpmtid, nType, nValue, IsReset); } } //设置设备定值分区 void PowerEventDeal::DealWith_EqpmtFixedAreaCtrl(string Eqpmtid, int CtrlType, int FixedArea, int SysID) { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->find(Eqpmtid); if (iter != pElectricEqpmtMap->end()) { string EqpmtTypeName = iter->second->GetBaseTypeName(); //设备类型名称 string EqpmtName = iter->second->GetEqpmentName(); //设备名称 const int EqpmtSourceStatonID = iter->second->GetSourceStationID(); //设备所属车站ID string AlarmText; if (CtrlType == 1) { //AlarmText.Format("%s%s修改定值区号为 %d", EqpmtTypeName, EqpmtName, FixedArea); std::stringstream ss; ss << EqpmtTypeName << EqpmtName << " 修改定值区号为 " << std::dec << FixedArea; AlarmText = ss.str(); } else if (CtrlType == 2) { //AlarmText.Format("%s%s确认修改定值区号为 %d", EqpmtTypeName, EqpmtName, FixedArea); std::stringstream ss; ss << EqpmtTypeName << EqpmtName << " 确认修改定值区号为 " << std::dec << FixedArea; AlarmText = ss.str(); } else { //AlarmText.Format("%s%s撤销修改定值区号", EqpmtTypeName, EqpmtName); std::stringstream ss; ss << EqpmtTypeName << EqpmtName << " 撤销修改定值区号"; AlarmText = ss.str(); } iter->second->SendMsgNotice(EqpmtSourceStatonID, 10, 2, 2, 0, AlarmText, Eqpmtid); UpdateEvaOperStatus updateEvaOperStatus; memset(&updateEvaOperStatus, 0, sizeof(UpdateEvaOperStatus)); updateEvaOperStatus.TrainID = m_trainID; updateEvaOperStatus.CourseID = GetCourseID(); updateEvaOperStatus.OperItemType = Item_Type_DD; updateEvaOperStatus.OperItemObject = MajorType_DD; updateEvaOperStatus.OperClientID = SysID; updateEvaOperStatus.OperStuID = MajorType_DD; strncpy(updateEvaOperStatus.AssociPara1, Eqpmtid.c_str(),sizeof(updateEvaOperStatus.AssociPara1)); strncpy(updateEvaOperStatus.AssociPara1Name, EqpmtName.c_str(), sizeof(updateEvaOperStatus.AssociPara1Name)); string StationID; StationID = std::to_string(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara2, StationID.c_str(), sizeof(updateEvaOperStatus.AssociPara2)); string StationName = GetStationName(iter->second->GetSourceStationID()); strncpy(updateEvaOperStatus.AssociPara2Name, StationName.c_str(), sizeof(updateEvaOperStatus.AssociPara2Name)); updateEvaOperStatus.OperStatus = CtrlType; updateEvaOperStatus.OperItemSubType1 = DD_Operate_Item_SwitchEqpmt; //开关设备操作 updateEvaOperStatus.OperItemSubType2 = Switch_EqpmtFixedArea_Set;//定值区设置 SendMsgToTech(updateEvaOperStatus); } } //设置车站通信状态 void PowerEventDeal::DealWith_StationCommunicationStatus(int nStation, int IsReset) { int nStatus = 0; string AlarmText = "车站通信中断"; //报文内容 ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); for ( ;iter!=pElectricEqpmtMap->end(); iter++) { if ((nStation == -1 || iter->second->GetSourceStationID() == nStation) && (iter->second->GetBaseType() == OCC_EQPMTTYPE_AUTOBOLT || iter->second->GetBaseType() == OCC_EQPMTTYPE_35kVBREAKER || iter->second->GetBaseType() == OCC_EQPMTTYPE_110kVBreaker || iter->second->GetBaseType() == OCC_EQPMTTYPE_110kVSwitch || iter->second->GetBaseType() == OCC_EQPMTTYPE_400vACControlBreaker || iter->second->GetBaseType() == OCC_EQPMTTYPE_BREAKER_DC ) ) { if (IsReset) { nStatus = 0; AlarmText = "车站通信恢复"; //报文内容 iter->second->UpdateCommmunicationStatus(nStatus); iter->second->UpdateEqpmtStatus(*pElectricEqpmtMap,iter->second->GetStatus()); iter->second->UpdateEqpmtLightCardStatu(-1); } else { nStatus = 1; AlarmText = "车站通信中断"; //报文内容 iter->second->UpdateCommmunicationStatus(nStatus); iter->second->UpdateEqpmtStatus(*pElectricEqpmtMap,iter->second->GetStatus()); iter->second->DealTelesignalisation(10000,iter->second->GetEqpmentID(),1); iter->second->UpdateEqpmtLightCardStatu(10000); } } } if ( nStation != -1) { SendStationAlarmMsgToClient(nStation,AlarmText); } else { ELECSTATIONMAP::iterator iterStation =m_MI_powerstation.begin(); for ( ;iterStation != m_MI_powerstation.end(); iterStation++) { SendStationAlarmMsgToClient(iterStation->second.stationID,AlarmText); } } } //向客户端发送报警信息 void PowerEventDeal::SendStationAlarmMsgToClient(int nStation, string AlarmText) { if (p_SendList!=NULL) { DHMSGNOTICE DHNotice; DHNotice.StationID = nStation; DHNotice.Time = GetNumTime_Second_2(); DHNotice.RegionID = ISCS_SUBSYS_TYPE_ELC; DHNotice.Type = 9; DHNotice.Level =2; strncpy(DHNotice.LabelValue,AlarmText.c_str(), sizeof(DHNotice.LabelValue)); OCCCOMMAND NetOrder; NetOrder.DesSysType = OCC_SYS_DD_CLIENT; NetOrder.ScrSysType = OCC_SYS_DD_SVR; NetOrder.TrainningID = m_trainID; NetOrder.setPacketValue(&DHNotice,OCCCOMMAND::eUpdateDHMsgNotice); p_SendList->push(NetOrder); } } void PowerEventDeal::InitEqpmtStatusToIBP() { ELEEQPMTMAP::iterator iter = pElectricEqpmtMap->begin(); for( ; iter != pElectricEqpmtMap->end(); iter++ ) { //直流断路器 if (iter->second->GetBaseType() ==OCC_EQPMTTYPE_BREAKER_DC) { EqpmtStatusToIBP(iter->first,Electric_Eqpmt_Status_ON); } } } void PowerEventDeal::EqpmtStatusToIBP( const std::string& strEqpmtID, int nEqpmtStatus ) { string strKey = MakeCStr_IntKey_2(strEqpmtID, nEqpmtStatus); auto iter = m_MIEqpmtStatusToIBPLight.find(strKey); if ( iter == m_MIEqpmtStatusToIBPLight.end() ) { return; } if ( !iter->second.m_strLightingOffIBPkey.empty() ) { int nIBPSysID = iter->second.m_nIBPSysID; string strLightingOffIBPkey = iter->second.m_strLightingOffIBPkey; int nIBPStationID = iter->second.m_nIBPStationID; UpdateIBPLightStatus(nIBPSysID, strLightingOffIBPkey, 0, 0, nIBPStationID); } if ( !iter->second.m_strLightenIBPKey.empty() ) { int nIBPSysID = iter->second.m_nIBPSysID; string strLightingOffIBPkey = iter->second.m_strLightenIBPKey; int nIBPStationID = iter->second.m_nIBPStationID; UpdateIBPLightStatus(nIBPSysID, strLightingOffIBPkey, 0, 0, nIBPStationID); } } void PowerEventDeal::UpdateIBPLightStatus(int nIBPSysID, std::string& strKey, int nStatus,int nflashFlag,int nIBPIOID) { vector vecKey; string strFindKey = ";"; if ( !strKey.empty() ) { vecKey = str_split_2( strKey, strFindKey ); } if ( !vecKey.empty() ) { UpdateIBPLightStatus(nIBPSysID, vecKey, nStatus,nflashFlag,nIBPIOID); } } void PowerEventDeal::UpdateIBPLightStatus( int nIBPSysID, vector& vecKey, int nStatus,int nflashFlag,int nIBPIOID ) { for ( int i = 0; i < vecKey.size(); i++ ) { UpdateIBPLightStatus( nIBPSysID, stoi(vecKey[i]), nStatus ,nflashFlag,nIBPIOID); } } void PowerEventDeal::UpdateIBPLightStatus( int nIBPSysID, int nKey, int nStatus,int nflashFlag ,int nIBPIOID) { if(nKey <= 0) { return; } OCCCOMMAND tmpOccComand; tmpOccComand.DesSysType = OCC_SYS_SERVER_SETSYS; tmpOccComand.DesNetID = nIBPSysID; tmpOccComand.ScrSysType = OCC_SYS_XD_SVR; tmpOccComand.TrainningID = m_trainID; tmpOccComand.cmdType = OCCCOMMAND::CMD_CTRL_IBPEQPMT; IBPPACKET Net_IBP_SERVER; memset(&Net_IBP_SERVER,0,sizeof(Net_IBP_SERVER)); Net_IBP_SERVER.nIBPID = nKey; Net_IBP_SERVER.param1 = nStatus; Net_IBP_SERVER.param2 = nflashFlag; if (nIBPIOID>0) { Net_IBP_SERVER.nIBPStationID =nIBPIOID; } tmpOccComand.setPacketValue(&Net_IBP_SERVER,OCCCOMMAND::CMD_CTRL_IBPEQPMT); p_SendList->push(tmpOccComand); }