#include "pch.h" #include "ElectricEqpmt_Breaker.h" #include "ElectricEqpmt_PowerBolt.h" map ElectricEqpmt_Breaker::mapBreakerDelayTime; map ElectricEqpmt_Breaker::m_mapCheckedEqpmtStrID; bool ElectricEqpmt_Breaker::handle_delaytime(time_t& time, map& eqpmtmap, const DelayTimeInfo& delayparm) { // 添加设备控制延时判断 bool bRet = CElectricEqpmt_SwicthEqpmt::handle_delaytime(time, eqpmtmap, delayparm); if (!bRet) { return false; //处理的是控制延时 } //xyx新增begin string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 //xyx新增end if (delayparm.type==Auto_DelayTime_InitCtrl) //主动联控类型处理方法 { // 时间间隔判断 if (time - delayparm.occartime <= delayparm.delaydur) return true; ELEEQPMTMAP::iterator iter; // 如果目联备自投退出则主动联控不生效 if ( !m_strMotherAutoBolt.empty() && (GetSubType() == Electric_Breaker_Circuit || GetSubType() == Electric_Breaker_Input)) { iter = eqpmtmap.find( m_strMotherAutoBolt ); if ( iter != eqpmtmap.end() ) { if ( !iter->second->GetStatus()) { return false; } } } iter = eqpmtmap.find(delayparm.srcid); if (iter!= eqpmtmap.end()) { if (iter->second->GetStatus()!=delayparm.srcstatus) { return false; } } ResetCtrlMark(); //xyx修改begin if (delayparm.destatus==Electric_Eqpmt_Status_ON&&GetStatus()!=Electric_Eqpmt_Status_ON)//目标状态为合闸,设备显示状态不为合闸则对其送电 { TurnOn(eqpmtmap); int nActType1 = ElcAlarm_TripActType_SelfClose; //“自复”合闸报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); } if (delayparm.destatus==Electric_Eqpmt_Status_OFF&&GetStatus()!=Electric_Eqpmt_Status_OFF) //目标状态为分闸,设备显示状态不为分闸则对其送电 { TurnOff(eqpmtmap,Auto_DelayTime_InitCtrl); int nActType2 = ElcAlarm_TripActType_SelfOpen; //“自切”分闸报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType2); } //xyx修改end return false; } if (delayparm.type==Auto_DelayTime_RepeatShut) //重合闸类型处理方法 { switch (RepeatShut) { case Auto_RepeatShut_Status_START: //重合闸开始 { //string strtext; //strtext.Format("%s%s重合闸开始",GetTypeName(),GetName()); //SendMsgNotice(m_SourceStation,m_Region,3,DH_MSGCATEGORY_SYS,strtext,GetStrID()); RepeatShutST = time; LastShutST = time; RepeatShut =Auto_RepeatShut_Status_WAIT; ResetRepeatShutIndex(); } break; case Auto_RepeatShut_Status_WAIT: { //CTimeSpan Timespan=CTimeSpan(0,0,0,Auto_RepeatShut_Dur_Time); //备自投动作时间>线路电源侧后备保护动作时间+线路重合闸时间 // CTimeSpan Timespan=CTimeSpan(0,0,0, GetCurIndexDelayTime() ); if (LastShutST+ GetCurIndexDelayTime() < time) { if (GetStatus()==Electric_Eqpmt_Status_OFF) { TurnOn(eqpmtmap); //xyx屏蔽begin // string text; // text.Format(" %s %s 自动重合闸 位置 合闸",GetBaseTypeName(),GetEqpmentName()); // SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SOE,text,GetEqpmentID()); //xyx屏蔽end //xyx修改begin int nActType1 = ElcAlarm_TripActType_Close; //“合闸”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); //xyx修改end } RepeatShut =Auto_RepeatShut_Status_SHUT; LastShutST = time; MoveNextRepeatShutIndex(); } } break; case Auto_RepeatShut_Status_SHUT: { RepeatShut = Auto_RepeatShut_Status_JUDGE; } break; case Auto_RepeatShut_Status_JUDGE: { //CTimeSpan Timespan=CTimeSpan(0,0,0, GetCurIndexDelayTime() ); if (LastShutST + GetCurIndexDelayTime() < time) { if (delayparm.faultType == Fault_Type_Fever) { TurnOff(eqpmtmap, delayparm.faultID); //xyx屏蔽begin //string text; //text.Format(" %s %s 位置 分闸",GetBaseTypeName(),GetEqpmentName()); //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SOE,text); //xyx屏蔽end //xyx修改begin int nActType2 = ElcAlarm_TripActType_Open; ////重合闸“分闸”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType2); //xyx修改end MoveNextRepeatShutIndex(); RepeatShut=Auto_RepeatShut_Status_BREAK; //CTimeSpan Timespan=CTimeSpan(0,0,0,Auto_RepeatShut_All_Time); //CTimeSpan Timespan=CTimeSpan(0,0,0,GetAllRepeatShutTime()); if (time >RepeatShutST + GetAllRepeatShutTime()) { //xyx屏蔽begin //string strtext; //strtext.Format(" %s %s 重合闸不成功",GetBaseTypeName(), GetEqpmentName() ); //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SYS,strtext); //xyx屏蔽end //xyx修改begin int nActType3 = ElcAlarm_TripActType_RepeatShut_Fail; //“重合闸不成功”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType3); //xyx修改end RepeatShut = Auto_RepeatShut_Status_Lock; } } else if(delayparm.faultType == Fault_Type_OneTime) { //xyx屏蔽begin //string strtext; //strtext.Format(" %s %s 重合闸成功",GetBaseTypeName(), GetEqpmentName() ); //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SYS,strtext); //xyx屏蔽end //xyx修改begin int nActType4 = ElcAlarm_TripActType_RepeatShut_Success; //“重合闸成功”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType4); //xyx修改end RepeatShut = Auto_RepeatShut_Status_SUCCESS; } } } break; case Auto_RepeatShut_Status_BREAK: { LastShutST = time; RepeatShut =Auto_RepeatShut_Status_WAIT; } break; case Auto_RepeatShut_Status_Lock: { RepeatShut =Auto_RepeatShut_Status_NONE; //UpdateLockStatus(Electric_Eqpmt_Status_Lock); UpdateFaultLockStatus(Electric_Eqpmt_Status_Lock); UpdateEqpmtLightCardStatu(delayparm.faultID); UpdateEqpmtStatus(eqpmtmap,Electric_Eqpmt_Status_OFF); ResetRepeatShutIndex(); return false; } break; case Auto_RepeatShut_Status_SUCCESS: { RepeatShut =Auto_RepeatShut_Status_NONE; ResetRepeatShutIndex(); return false; } break; } } return true; } ElectricEqpmt_Breaker::ElectricEqpmt_Breaker() { RepeatShut=Auto_RepeatShut_Status_NONE; ActiveProtectIndex=-1; ResetRepeatShutIndex(); SetEqpmentType(Electric_EqpmentType_Breaker); } bool ElectricEqpmt_Breaker::AddProtectRelation(ProtectValue& protect) { SettingProtects.push_back(protect); return true; } void ElectricEqpmt_Breaker::SetRepeatShut(int shutstatus) { RepeatShut = shutstatus; } void ElectricEqpmt_Breaker::SetCommunicationStatus(map& ElectricEqpmtMap) { UpdateCommmunicationStatus(1); UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus()); //xyx屏蔽begin //string text; //text.Format(" %s %s 通讯中断",GetBaseTypeName(),GetEqpmentName()); //SendMsgNotice(GetSourceStationID(),GetRegion(),3,DH_MSGCATEGORY_SOE,text); //xyx屏蔽end //xyx修改begin string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 int nActType = ElcAlarm_TripActType_Comloss; //“通讯中断”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType); //xyx修改end } void ElectricEqpmt_Breaker::CancleCommunicationStatus(map& ElectricEqpmtMap) { UpdateCommmunicationStatus(0); UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus()); //xyx屏蔽begin //string text; //text.Format(" %s %s 通讯恢复",GetBaseTypeName(),GetEqpmentName()); //SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SOE,text); //xyx屏蔽end //xyx修改begin string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 int nActType = ElcAlarm_TripActType_ComRecovery; //“通讯恢复”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType); //xyx修改end } int ElectricEqpmt_Breaker::CheckAutoUnionStatus(int errorid,ELEEQPMTMAP& ElectricEqpmtMap, const ProtectValue& protectValue, bool bAutoRelation/* = true */) { for (int i=0;isecond->CheckTripping(ElectricEqpmtMap,protectValue); //add by yangs 20230702 iter->second->OccarSearchError(protectValue.faultid); } } } return 0; } int ElectricEqpmt_Breaker::EqpmtAutoBreak(ELEEQPMTMAP& ElectricEqpmtMap,const ProtectValue& protectValue, bool bAutoRelation /*= true*/ ) { // 故障跳闸变更控制方式为系统控制 ResetCtrlMark(); //add by yangs 20230702 OccarSearchError(protectValue.faultid); //if (m_status==Electric_Eqpmt_Status_ON) { if ( protectValue.breakerRejection || !bAutoRelation ) { if (GetStatus()==Electric_Eqpmt_Status_ON) { TurnOff(ElectricEqpmtMap, protectValue.faultid ); //add by yangs 20230111 string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 int nActType1 = ElcAlarm_TripActType_Open; //“分闸”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); } } if (ActiveProtectIndex>=0&&ActiveProtectIndexinsert(make_pair(GetEqpmentID(),delay)); } else { //UpdateLockStatus(Electric_Eqpmt_Status_Lock); UpdateFaultLockStatus(Electric_Eqpmt_Status_Lock); UpdateEqpmtLightCardStatu(protectValue.pretectid); } if ( protectValue.breakerRejection || !bAutoRelation ) { UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF); } else { // 失灵拒动时更新失败锁闭状态 UpdateEqpmtStatus(ElectricEqpmtMap, GetStatus()); } } } // 设置是否可以复归 //add by yangs 20230701 if( protectValue.nPermanentFault == 1){ setProhibitedReversion(); } } if ( bAutoRelation ) { // 只联跳一层关系 CheckAutoUnionStatus(protectValue.faultid, ElectricEqpmtMap, protectValue, false); } // 遥信功能设置 DealTelesignalisation( protectValue.pretectid, GetEqpmentID(), 1); return 0; } void ElectricEqpmt_Breaker::CalculateValue(double inputv,double inputI,ELEEQPMTMAP* PEqpmtMap) { InputVoltage=inputv; InputElectricity=inputI; if (GetStatus()==Electric_Eqpmt_Status_ON) { OutputVoltage=InputVoltage; OutputElectricity=InputElectricity; } else { OutputVoltage=0; OutputElectricity=0; } std::map::iterator iter=OutputEqpmtIDMap.begin(); for (;iter!=OutputEqpmtIDMap.end();iter++) { ELEEQPMTMAP::iterator Eqpmtiter; Eqpmtiter=PEqpmtMap->find(iter->first); if (Eqpmtiter!=PEqpmtMap->end()) { Eqpmtiter->second->CalculateValue(OutputVoltage,OutputElectricity,PEqpmtMap); } } } bool ElectricEqpmt_Breaker::CheckProtect(ELEEQPMTMAP& ElectricEqpmtMap,int errorid,int protectid,bool bAutoRelation/* = true*/ ) { for (size_t i=0;i=0) { return SettingProtects[ActiveProtectIndex].pretectid; } return -1; } bool ElectricEqpmt_Breaker::handle_checkprotect(int eventOper,ELEEQPMTMAP& eqpmtmap,int errorid,int protectid) { if (GetStatus()==Electric_Eqpmt_Status_Error||GetControlLock()==Electric_Eqpmt_Status_Lock) { if (GetStatus()==Electric_Eqpmt_Status_ON) { for (size_t i=0;isecond->handle_checkprotect(eventOper,eqpmtmap,errorid,protectid); } } //xyx屏蔽begin //string strtext; //strtext.Format("%s%s拒动",GetBaseTypeName(),GetEqpmentName()); //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SYS,strtext); //xyx屏蔽end //xyx修改begin string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 int nActType = protectid; //“失灵拒动”报文类型 UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType); //xyx修改end } } else if (eventOper==POWER_ERORR_OCCAR) { CheckProtect(eqpmtmap,errorid,protectid); } return true; } ElectricEqpmt_PowerBolt* ElectricEqpmt_Breaker::GetBoltInShut(ELEEQPMTMAP& eqpmtmap) { int count =0; std::map::iterator iter = InputEqpmtIDMap.begin(); for (;iter!=InputEqpmtIDMap.end();iter++) { if (iter->second.InputPower) { count++; } } ElectricEqpmt_PowerBolt* pbolt=NULL; ELEEQPMTMAP::iterator iterbolt = eqpmtmap.find(GetAutoBoltID()); if (iterbolt!=eqpmtmap.end()) { if (GetStatus()==Electric_Eqpmt_Status_OFF && count==1&&InputEqpmtIDMap.size()==2) { if (iterbolt->second->GetBaseType()==OCC_EQPMTTYPE_AUTOBOLT) { pbolt=(ElectricEqpmt_PowerBolt*)iterbolt->second; } } } return pbolt; } ElectricEqpmt_PowerBolt* ElectricEqpmt_Breaker::GetBoltInOff(ELEEQPMTMAP& eqpmtmap) { int count =0; std::map::iterator iter = InputEqpmtIDMap.begin(); for (;iter!=InputEqpmtIDMap.end();iter++) { if (iter->second.InputPower) { count++; } } ElectricEqpmt_PowerBolt* pbolt=NULL; ELEEQPMTMAP::iterator iterbolt = eqpmtmap.find(GetAutoBoltID()); if (iterbolt!=eqpmtmap.end()) { if (GetStatus()==Electric_Eqpmt_Status_ON && count==2&&InputEqpmtIDMap.size()==2) { if (iterbolt->second->GetBaseType()==OCC_EQPMTTYPE_AUTOBOLT) { pbolt=(ElectricEqpmt_PowerBolt*)iterbolt->second; } } } return pbolt; } void ElectricEqpmt_Breaker::SetRemoteLock(ELEEQPMTMAP& ElectricEqpmtMap,int status,int ctrlArea,int lockType) { SetControlArea(ctrlArea); UpdateRemoteLockStatus(Electric_Eqpmt_Status_RemoteLock); if (RemoteLockType_Off==lockType) { UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF); } else if (RemoteLockType_On==lockType) { UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON); } else if (RemoteLockType_Test==lockType) { string str=GetBreakHandleID(); ELEEQPMTMAP::iterator iter=ElectricEqpmtMap.find(str); if (iter!=ElectricEqpmtMap.end()) { iter->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF); } } else if (RemoteLockType_Work==lockType) { string str=GetBreakHandleID(); ELEEQPMTMAP::iterator iter=ElectricEqpmtMap.find(str); if (iter!=ElectricEqpmtMap.end()) { iter->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON); } } else if (RemoteLockType_Local==lockType) { UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus()); } /*if(status<=1) { UpdateEqpmtStatus(ElectricEqpmtMap,status); } else { if (status==OCC_BREAKERHAND_STATUS_TEST) { string str=GetBreakHandleID(); ELEEQPMTMAP::iterator iter=ElectricEqpmtMap.find(str); if (iter!=ElectricEqpmtMap.end()) { iter->second->UpdateEqpmtStatus(ElectricEqpmtMap,0); } } if (status==OCC_BREAKERHAND_STATUS_WORK) { string str=GetBreakHandleID(); ELEEQPMTMAP::iterator iter=ElectricEqpmtMap.find(str); if (iter!=ElectricEqpmtMap.end()) { iter->second->UpdateEqpmtStatus(ElectricEqpmtMap,1); } } }*/ } void ElectricEqpmt_Breaker::CancleRemoteLock(ELEEQPMTMAP& ElectricEqpmtMap,int status,int ctrlArea) { SetControlArea(ctrlArea); UpdateRemoteLockStatus(Electric_Eqpmt_Status_RemoteUnLock); UpdateEqpmtStatus(ElectricEqpmtMap,status); } bool ElectricEqpmt_Breaker::CheckTripping( ELEEQPMTMAP& ElectricEqpmtMap, const ProtectValue& protectValue ) { if ( Electric_Eqpmt_Status_ON == GetStatus()) { // 联跳是直接跳闸,不受保护等其他因素影响 TurnOff(ElectricEqpmtMap, protectValue.faultid ); } // 判断联跳设备是否需要重合闸 if ( protectValue.kind==Protect_Kind_Main && protectValue.trippingRepeatShut ) { RepeatShut =Auto_RepeatShut_Status_START; DelayTimeInfo delay; delay.type=Auto_DelayTime_RepeatShut; delay.faultType = protectValue.faulttype; delay.faultID = protectValue.faultid; p_DelayTimeMap->insert(make_pair(GetEqpmentID(),delay)); } else { //UpdateLockStatus(Electric_Eqpmt_Status_Lock); UpdateFaultLockStatus(Electric_Eqpmt_Status_Lock); UpdateEqpmtLightCardStatu(protectValue.pretectid); UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF); } // 设置是否可以复归 //add by yangs 20230701 if( protectValue.nPermanentFault == 1){ setProhibitedReversion(); } // 联跳报文 //xyx屏蔽begin //string strtext; //strtext.Format("%s %s 动作",GetEqpmentName(),protectValue.trippingDisplayContent); //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SYS,strtext,GetEqpmentID()); //xyx屏蔽end //xyx修改begin string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 ELCEQPMTALARMINFOMAP::iterator iterAlarmEqpmtType = m_EqpmtAlarmInfoMap->find(EqpmtType); if (iterAlarmEqpmtType!=m_EqpmtAlarmInfoMap->end()) { ELCEQPMTALARMACTTYPEMAP mapAlarmActType = iterAlarmEqpmtType->second; ELCEQPMTALARMACTTYPEMAP::iterator iterAlarmActType=mapAlarmActType.begin(); for (;iterAlarmActType!=mapAlarmActType.end();iterAlarmActType++) { if (protectValue.pretectid==iterAlarmActType->first) //保护联跳报文更新 { iterAlarmActType->second.m_strAlrmText = iterAlarmActType->second.m_strTripText; //将联跳报文赋给显示的报文 UpdateAlarmInfo(EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,iterAlarmActType->second); } } } //xyx修改end // 联跳遥信 DealTelesignalisation( protectValue.pretectid, GetEqpmentID(), 1); return false; } bool ElectricEqpmt_Breaker::IsFault() { bool bRet = false; if ( Electric_Eqpmt_Status_Lock == GetControlLock() ) { bRet = true; } return bRet; } void ElectricEqpmt_Breaker::UnLockTrippingEqpmt( ELEEQPMTMAP& ElectricEqpmtMap ) { if ( Electric_Eqpmt_Status_Lock == GetFaultLockStatus() ) { //UpdateLockStatus(Electric_Eqpmt_Status_UnLock); UpdateFaultLockStatus(Electric_Eqpmt_Status_UnLock); UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus()); UpdateEqpmtLightCardStatu(-1); } } void ElectricEqpmt_Breaker::AddRepeatShut( int nEqpmtType, int nIndex, int nDelayTime, int nOneTime ) { map::iterator iter = mapBreakerDelayTime.find( nEqpmtType ); if ( iter == mapBreakerDelayTime.end() ) { BreakerDelayTime breakerDelayTime; breakerDelayTime.AddIndexDelayTime( nIndex, nDelayTime ); breakerDelayTime.EqpmtType = nEqpmtType; breakerDelayTime.OneTime = nOneTime; mapBreakerDelayTime.insert( make_pair(nEqpmtType, breakerDelayTime) ); } else { iter->second.AddIndexDelayTime(nIndex, nDelayTime); } } int ElectricEqpmt_Breaker::GetAllRepeatShutTime() { int nRet = 0; map::iterator iter = mapBreakerDelayTime.find( GetBaseType() ); if ( iter != mapBreakerDelayTime.end() ) { nRet = iter->second.GetAllTime()+2; } return nRet; } int ElectricEqpmt_Breaker::GetDelayTime( int nIndex ) { int nRet = 0; map::iterator iter = mapBreakerDelayTime.find( GetBaseType() ); if ( iter != mapBreakerDelayTime.end() ) { nRet = iter->second.GetDelayTime( nIndex ); } return nRet; } int ElectricEqpmt_Breaker::GetOneTime() { int nRet = 0; map::iterator iter = mapBreakerDelayTime.find( GetBaseType() ); if ( iter != mapBreakerDelayTime.end() ) { nRet = iter->second.GetOneTime( ); } return nRet; } int ElectricEqpmt_Breaker::GetCurIndexDelayTime() { int nRet = 0; map::iterator iter = mapBreakerDelayTime.find( GetBaseType() ); if ( iter != mapBreakerDelayTime.end() ) { nRet = iter->second.GetDelayTime( RepeatShutIndex ); } return nRet; } void ElectricEqpmt_Breaker::EqpmtCtrl( int status,ELEEQPMTMAP& ElectricEqpmtMap,string Stdid,int CtrlType, int nMark /*= 0*/ ) { CElectricEqpmt_SwicthEqpmt::EqpmtCtrl(status,ElectricEqpmtMap,Stdid,CtrlType,nMark); if ( Eqpmt_Operation_OFF == status && nMark ) { if ( !m_mapCheckedEqpmtStrID.empty() ) { m_mapCheckedEqpmtStrID.clear(); } CheckOutLineElectricEqpmt(ElectricEqpmtMap,nMark); } } void ElectricEqpmt_Breaker::CheckOutLineElectricEqpmt( ELEEQPMTMAP& ElectricEqpmtMap, int nMark /*= 0*/ ) { // 防止无限递归:一个设备只检验一次 map::iterator iter = m_mapCheckedEqpmtStrID.find(GetEqpmentID()); if ( iter != m_mapCheckedEqpmtStrID.end() ) { //string strTip; //strTip.Format("重复的循环,数据异常,重复设备编号为%s\n", GetEqpmentID() ); m_mapCheckedEqpmtStrID.clear(); return; } else { m_mapCheckedEqpmtStrID.insert( make_pair(GetEqpmentID(), GetEqpmentID()) ); } // 先进行35KV出线设备检测 ELEEQPMTMAP::iterator iterOutLineEqpmt; for( int i = 0; i < m_vecOutLineElectricEqpmt.size(); i++ ) { if ( EQPMTTYPE_35KV == m_vecOutLineElectricEqpmt[i].m_nType ) { // 35KV断路器:根据顺序进行出线设备跳闸和备自投合闸信息检测 PowerCutOutLineElectricEqpmt_35KV( ElectricEqpmtMap, m_vecOutLineElectricEqpmt[i].m_strEqpmtID ); } if ( nMark ) { if ( EQPMTTYPE_400V == m_vecOutLineElectricEqpmt[i].m_nType ) { PowerCutOutLineElectricEqpmt_400V(ElectricEqpmtMap, m_vecOutLineElectricEqpmt[i].m_strEqpmtID ); } } } } void ElectricEqpmt_Breaker::PowerCutOutLineElectricEqpmt_35KV( ELEEQPMTMAP& ElectricEqpmtMap, const string& strOutLineElectricEqpmtStrID ) { // 如果是输出是本站则检测后续 ELEEQPMTMAP::iterator iterOutLine = ElectricEqpmtMap.find(strOutLineElectricEqpmtStrID); if ( iterOutLine == ElectricEqpmtMap.end() ) { return; } if ( GetSourceStationID() == iterOutLine->second->GetSourceStationID() ) { iterOutLine->second->CheckOutLineElectricEqpmt(ElectricEqpmtMap); return; } // 1. 已经处于分位则结束 if ( Eqpmt_Operation_OFF == iterOutLine->second->GetStatus() ) { return; } // 2. 合闸状态则断开:断开后检测本站35KV目联是否能够自投 iterOutLine->second->EqpmtCtrl( Eqpmt_Operation_OFF, ElectricEqpmtMap, "系统", CTRLTYPE_STATUS); // 3.断开后检测本站35KV目联是否能够自投,如果能则退出,否则继续检查下一个站 if ( iterOutLine->second->BoltPowerIn_35KV(ElectricEqpmtMap, strOutLineElectricEqpmtStrID) ) { } else { // 4. 本站备自投不满足投入条件,则该站400进线开关跳闸 iterOutLine->second->PowerCutCurElectricEqpmt_400V(ElectricEqpmtMap); // 5.继续检测下级站 iterOutLine->second->CheckOutLineElectricEqpmt(ElectricEqpmtMap); } } void ElectricEqpmt_Breaker::PowerCutOutLineElectricEqpmt_400V( ELEEQPMTMAP& ElectricEqpmtMap, const string& strOutLineElectricEqpmtStrID ) { // 如果当前设备处于闭合状态,则自动断开 ELEEQPMTMAP::iterator iterEqpmt = ElectricEqpmtMap.find(strOutLineElectricEqpmtStrID); if ( iterEqpmt != ElectricEqpmtMap.end() ) { if ( Eqpmt_Operation_ON == iterEqpmt->second->GetStatus() ) { iterEqpmt->second->EqpmtCtrl( Eqpmt_Operation_OFF, ElectricEqpmtMap, "系统", CTRLTYPE_STATUS); } } } void ElectricEqpmt_Breaker::PowerCutCurElectricEqpmt_400V( ELEEQPMTMAP& ElectricEqpmtMap ) { ELEEQPMTMAP::iterator iterOutLineEqpmt; for( int i = 0; i < m_vecOutLineElectricEqpmt.size(); i++ ) { if ( EQPMTTYPE_400V == m_vecOutLineElectricEqpmt[i].m_nType ) { PowerCutOutLineElectricEqpmt_400V(ElectricEqpmtMap, m_vecOutLineElectricEqpmt[i].m_strEqpmtID ); } } } bool ElectricEqpmt_Breaker::BoltPowerIn_35KV( ELEEQPMTMAP& ElectricEqpmtMap, const string& strOutLineElectricEqpmtStrID ) { ELEEQPMTMAP::iterator iterbolt = ElectricEqpmtMap.find(m_strMotherAutoBolt); if ( iterbolt == ElectricEqpmtMap.end() ) { return false; } bool bRet = false; ElectricEqpmt_PowerBolt* pbolt= (ElectricEqpmt_PowerBolt*)iterbolt->second; if ( NULL != pbolt ) { bRet = pbolt->CheckBoltRelationLRBreak_On(ElectricEqpmtMap); } return bRet; } bool ElectricEqpmt_Breaker::PowerCut(ELEEQPMTMAP& eqpmtmap,string sourceid,int offcase) { int count =0; string id; std::map::iterator iter = InputEqpmtIDMap.begin(); for (;iter!=InputEqpmtIDMap.end();iter++) { if (sourceid==iter->first) { iter->second.InputPower = false; } if (iter->second.InputPower) { count++; id = iter->first; } } if (GetStatus()==Electric_Eqpmt_Status_ON) { if (count==1) { ELEEQPMTMAP::iterator iter3 = eqpmtmap.find(id); if (iter3!=eqpmtmap.end()) { iter3->second->PowerCut(eqpmtmap,GetEqpmentID(),offcase); } } if (count<1) { PowerLost(eqpmtmap,GetEqpmentID(),offcase); } } return true; } bool ElectricEqpmt_Breaker::PowerIn(ELEEQPMTMAP& eqpmtmap,string sourceid) { std::map::iterator iter = InputEqpmtIDMap.begin(); for (;iter!=InputEqpmtIDMap.end();iter++) { if (sourceid==iter->first) { iter->second.InputPower = true; } } if (GetStatus()==Electric_Eqpmt_Status_ON) { SetPower(true); UpdateEqpmtStatus(eqpmtmap, Electric_Eqpmt_Status_ON, CTRLTYPE_ElcCut); //向客户端更新开关设备带电状态add by yangs string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 if (EqpmtType == OCC_EQPMTTYPE_35kVBREAKER) { int nActType1 = ElcAlarm_TripActType_TransLineOnPower; UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); UpdateEqpmtPower(GetEqpmentID(),ElcAlarm_TripActType_TransLineOnPower); } std::map::iterator iter2 = OutputEqpmtIDMap.begin(); for (;iter2!=OutputEqpmtIDMap.end();iter2++) { if (iter2->first!=sourceid) { ELEEQPMTMAP::iterator iter3 = eqpmtmap.find(iter2->first); if (iter3!=eqpmtmap.end()) { iter3->second->PowerIn(eqpmtmap,GetEqpmentID()); } } } } DealElcTurnOffArea(); return true; } bool ElectricEqpmt_Breaker::PowerLost(ELEEQPMTMAP& eqpmtmap,string sourceid,int offcase) { SetPower(false); UpdateEqpmtStatus(eqpmtmap, Electric_Eqpmt_Status_OFF, CTRLTYPE_ElcCut); //向客户端更新开关设备带电状态add by yangs if (POWER_EQPMT_INIT != offcase) { string EqpmtTypeName = GetBaseTypeName(); //设备类型名称 string EqpmtName = GetEqpmentName(); //设备名称 int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID int EqpmtType = GetBaseType(); //设备类型 if (EqpmtType == OCC_EQPMTTYPE_35kVBREAKER) { int nActType1 = ElcAlarm_TripActType_TransLineLosePower; UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1); UpdateEqpmtPower(GetEqpmentID(),ElcAlarm_TripActType_TransLineLosePower); } } std::map::iterator iter = OutputEqpmtIDMap.begin(); //OutputEqpmtIDMap为 sourceid的输出设备 for (;iter!=OutputEqpmtIDMap.end();iter++) { ELEEQPMTMAP::iterator iter1 = eqpmtmap.find(iter->first); if (iter1==eqpmtmap.end()) continue; if (POWER_EQPMT_INIT == offcase) offcase = POWER_EQPMT_OPERNO; iter1->second->PowerCut(eqpmtmap,GetEqpmentID(),offcase); } DealElcTurnOffArea(); return true; }