| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942 |
- #include "pch.h"
- #include "ElectricEqpmt_Breaker.h"
- #include "ElectricEqpmt_PowerBolt.h"
- map<int, BreakerDelayTime> ElectricEqpmt_Breaker::mapBreakerDelayTime;
- map<string,string> ElectricEqpmt_Breaker::m_mapCheckedEqpmtStrID;
- bool ElectricEqpmt_Breaker::handle_delaytime(time_t& time, map<string, BaseElectricEqpmt*>& 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<string,BaseElectricEqpmt*>& 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<string,BaseElectricEqpmt*>& 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;i<m_ActUnions.size();i++)
- {
- //if (m_ActUnions[i].OperStatus==GetStatus())
- {
- if (m_ActUnions[i].EventID==protectValue.pretectid)
- {
- ELEEQPMTMAP::iterator iter = ElectricEqpmtMap.find(m_ActUnions[i].PreEqpmtID);
- if (iter==ElectricEqpmtMap.end())
- return -1;
- iter->second->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&&ActiveProtectIndex<SettingProtects.size())
- {
- if(RepeatShut==Auto_RepeatShut_Status_NONE)
- {
- if (SettingProtects[ActiveProtectIndex].kind==Protect_Kind_Main)
- {
- RepeatShut =Auto_RepeatShut_Status_START;
- DelayTimeInfo delay;
- delay.type=Auto_DelayTime_RepeatShut;
- delay.faultType = SettingProtects[ActiveProtectIndex].faulttype;
- delay.faultID = SettingProtects[ActiveProtectIndex].faultid;
- p_DelayTimeMap->insert(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<string,string>::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<SettingProtects.size();i++)
- {
- if (SettingProtects[i].faultid==errorid&&SettingProtects[i].pretectid==protectid&&SettingProtects[i].status==Protect_Status_ON)
- {
- ActiveProtectIndex=i;
-
- //xyx屏蔽begin
- //string strtext;
- //strtext.Format("%s %s 动作",GetEqpmentName(), SettingProtects[ActiveProtectIndex].protectDisplayContent );
- //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(); //设备类型
- int nActType = SettingProtects[i].pretectid; //“保护”类型报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType);
- //xyx修改end
- EqpmtAutoBreak(ElectricEqpmtMap, SettingProtects[i], bAutoRelation);
- return true;
- }
- }
- return false;
- }
- int ElectricEqpmt_Breaker::GetActiveProtectID()
- {
- if (ActiveProtectIndex<SettingProtects.size()&&ActiveProtectIndex>=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;i<ProtectVecs.size();i++)
- {
- if ( ProtectVecs[i].EventID == protectid )
- {
- ELEEQPMTMAP::iterator iter = eqpmtmap.find(ProtectVecs[i].ProtectStrID);
- if (iter==eqpmtmap.end())
- continue;
- iter->second->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<string,InputLineInfo>::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<string,InputLineInfo>::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<int, BreakerDelayTime>::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<int, BreakerDelayTime>::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<int, BreakerDelayTime>::iterator iter = mapBreakerDelayTime.find( GetBaseType() );
- if ( iter != mapBreakerDelayTime.end() )
- {
- nRet = iter->second.GetDelayTime( nIndex );
- }
- return nRet;
- }
- int ElectricEqpmt_Breaker::GetOneTime()
- {
- int nRet = 0;
- map<int, BreakerDelayTime>::iterator iter = mapBreakerDelayTime.find( GetBaseType() );
- if ( iter != mapBreakerDelayTime.end() )
- {
- nRet = iter->second.GetOneTime( );
- }
- return nRet;
- }
- int ElectricEqpmt_Breaker::GetCurIndexDelayTime()
- {
- int nRet = 0;
- map<int, BreakerDelayTime>::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<string,string>::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<string,InputLineInfo>::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<string,InputLineInfo>::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<string,string>::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<string,string>::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;
- }
|