| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913 |
- #include "pch.h"
- #include "ElectricEqpmt_BreakRailPotential.h"
- #include "ElectricEqpmt_PowerBolt.h"
- map<int, BreakerDelayTime> ElectricEqpmt_BreakRailPotential::mapBreakerDelayTime;
- map<string,string> ElectricEqpmt_BreakRailPotential::m_mapCheckedEqpmtStrID;
- bool ElectricEqpmt_BreakRailPotential::handle_delaytime(int64_t& time,ELEEQPMTMAP& ElectricEqpmtMap,DelayTimeInfo& delayparm)
- {
- //xyx修改begin
- string EqpmtTypeName = GetBaseTypeName(); //设备类型名称
- string EqpmtName = GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID
- int EqpmtType = GetBaseType(); //设备类型
- //xyx修改end
-
- if (delayparm.type==Auto_DelayTime_InitCtrl) //主动联控类型处理方法
- {
- //CTimeSpan Timespan=CTimeSpan(0,0,0,delayparm.delaydur);
- if (delayparm.occartime + delayparm.delaydur > time)
- return true;
- ELEEQPMTMAP::iterator iter;
- // 如果目联备自投退出则主动联控不生效
- if ( !m_strMotherAutoBolt.empty() )
- {
- iter = ElectricEqpmtMap.find( m_strMotherAutoBolt );
- if ( iter != ElectricEqpmtMap.end() )
- {
- if ( !iter->second->GetStatus() )
- {
- return false;
- }
- }
- }
- iter = ElectricEqpmtMap.find(delayparm.srcid);
- if (iter!=ElectricEqpmtMap.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(ElectricEqpmtMap);
- int nActType1 = ElcAlarm_TripActType_SelfClose; //“自复合闸”
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1);
- }
- if (delayparm.destatus==Electric_Eqpmt_Status_OFF&&GetStatus()!=Electric_Eqpmt_Status_OFF) //目标状态为分闸,设备显示状态不为分闸则对其送电
- {
- TurnOff(ElectricEqpmtMap,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: //重合闸开始
- {
- //xyx修改begin
- int nActType3 = ElcAlarm_TripActType_RepeatShut_Start; //“重合闸开始”
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType3);
- //xyx修改end
- 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(ElectricEqpmtMap);
- //xyx屏蔽begin
- //string text;
- //text.Format(" %s %s 自动重合闸 位置 合闸",GetEqpmentName(),GetBaseTypeName());
- //SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SOE,text,GetEqpmentID());
- //xyx屏蔽end
- //xyx修改begin
- int nActType4 = ElcAlarm_TripActType_Close; //“合闸”报文
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType4);
- //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(ElectricEqpmtMap, delayparm.faultID);
-
- //xyx屏蔽begin
- //string text;
- //text.Format(" %s %s 位置 分闸",GetEqpmentName(),GetBaseTypeName());
- //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SOE,text);
- //xyx屏蔽end
- //xyx修改begin
- int nActType5 = ElcAlarm_TripActType_Open; //“分闸”报文
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType5);
- //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 重合闸不成功",GetEqpmentName(), GetBaseTypeName() );
- //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SYS,strtext);
- //xyx屏蔽end
- //xyx修改begin
- int nActType6 = ElcAlarm_TripActType_RepeatShut_Fail; //“重合闸失败”报文
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType6);
- //xyx修改end
- RepeatShut = Auto_RepeatShut_Status_Lock;
- }
- }
- else if(delayparm.faultType == Fault_Type_OneTime)
- {
- //xyx屏蔽begin
- //string strtext;
- //strtext.Format(" %s %s 重合闸成功",GetEqpmentName(), GetBaseTypeName() );
- //SendMsgNotice(GetSourceStationID(),GetRegion(),1,DH_MSGCATEGORY_SYS,strtext);
- //xyx屏蔽end
- //xyx修改begin
- int nActType7 = ElcAlarm_TripActType_RepeatShut_Success; //“重合闸成功”报文
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType7);
- //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);
- UpdateEqpmtStatus(ElectricEqpmtMap,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_BreakRailPotential::ElectricEqpmt_BreakRailPotential()
- {
- RepeatShut=Auto_RepeatShut_Status_NONE;
- //m_strAutoBoltID="";
- ActiveProtectIndex=-1;
- ResetRepeatShutIndex();
- }
- bool ElectricEqpmt_BreakRailPotential::AddProtectRelation(ProtectValue& protect)
- {
- SettingProtects.push_back(protect);
- return true;
- }
- void ElectricEqpmt_BreakRailPotential::SetRepeatShut(int shutstatus)
- {
- RepeatShut = shutstatus;
- }
- void ElectricEqpmt_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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==m_status)
- {
- 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);
- }
- }
- }
- return 0;
- }
- int ElectricEqpmt_BreakRailPotential::EqpmtAutoBreak(ELEEQPMTMAP& ElectricEqpmtMap,const ProtectValue& protectValue, bool bAutoRelation /*= true*/ )
- {
- // 故障跳闸变更控制方式为系统控制
- ResetCtrlMark();
- //if (m_status==Electric_Eqpmt_Status_ON)
- {
- if ( protectValue.breakerRejection || !bAutoRelation )
- {
- //if (m_status==Electric_Eqpmt_Status_ON)
- //{
- // TurnOff(ElectricEqpmtMap, protectValue.faultid );
- //}
- if(GetStatus()==Electric_Eqpmt_Status_OFF)
- {
- TurnOn(ElectricEqpmtMap);
- }
- }
- 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);
- }
- if ( protectValue.breakerRejection || !bAutoRelation )
- {
- UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- }
- else
- {
- // 失灵拒动时更新失败锁闭状态
- UpdateEqpmtStatus(ElectricEqpmtMap, GetStatus());
- }
- }
- }
- }
- if ( bAutoRelation )
- {
- // 只联跳一层关系
- CheckAutoUnionStatus(protectValue.faultid, ElectricEqpmtMap, protectValue, false);
- }
- // 遥信功能设置
- DealTelesignalisation( protectValue.pretectid, GetEqpmentID(), 1);
- return 0;
- }
- void ElectricEqpmt_BreakRailPotential::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);
- }
- }
- }
- void ElectricEqpmt_BreakRailPotential::SetBreakHandID(string id)
- {
- BreakHandleID = id;
- }
- string ElectricEqpmt_BreakRailPotential::GetBreakHandleID()
- {
- return BreakHandleID;
- }
- bool ElectricEqpmt_BreakRailPotential::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_BreakRailPotential::GetActiveProtectID()
- {
- if (ActiveProtectIndex<SettingProtects.size()&&ActiveProtectIndex>=0)
- {
- return SettingProtects[ActiveProtectIndex].pretectid;
- }
- return -1;
- }
- bool ElectricEqpmt_BreakRailPotential::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;
- }
- bool ElectricEqpmt_BreakRailPotential::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);
- }
- }
- /*ElectricEqpmt_PowerBolt* pbolt=GetBoltInShut(eqpmtmap);
- if (pbolt!=NULL)
- {
- pbolt->CheckSelfShut(eqpmtmap,m_strid);
- }*/
- return true;
- }
- bool ElectricEqpmt_BreakRailPotential::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)
- {
- 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();
- /*ElectricEqpmt_PowerBolt* pbolt=GetBoltInOff(eqpmtmap);
- if (pbolt!=NULL)
- {
- pbolt->CheckSelfShut(eqpmtmap,m_strid);
- }*/
- return true;
- }
- ElectricEqpmt_PowerBolt* ElectricEqpmt_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::SetRemoteLock(ELEEQPMTMAP& ElectricEqpmtMap,int status,int ctrlArea,int lockType)
- {
- SetControlArea(ctrlArea);
- UpdateRemoteLockStatus(Electric_Eqpmt_Status_RemoteLock);
- 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_BreakRailPotential::CancleRemoteLock(ELEEQPMTMAP& ElectricEqpmtMap,int status,int ctrlArea)
- {
- SetControlArea(ctrlArea);
- UpdateRemoteLockStatus(Electric_Eqpmt_Status_RemoteUnLock);
- UpdateEqpmtStatus(ElectricEqpmtMap,status);
- }
- bool ElectricEqpmt_BreakRailPotential::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);
- UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- }
-
- //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(); //设备类型
- int nActType = protectValue.pretectid; //“联跳报文”动作类型
- 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 (nActType==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_BreakRailPotential::IsFault()
- {
- bool bRet = false;
- if ( Electric_Eqpmt_Status_Lock == GetControlLock() )
- {
- bRet = true;
- }
- return bRet;
- }
- void ElectricEqpmt_BreakRailPotential::UnLockTrippingEqpmt( ELEEQPMTMAP& ElectricEqpmtMap )
- {
- if ( Electric_Eqpmt_Status_Lock == GetFaultLockStatus() )
- {
- //UpdateLockStatus(Electric_Eqpmt_Status_UnLock);
- UpdateFaultLockStatus(Electric_Eqpmt_Status_UnLock);
- UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus());
- }
- }
- void ElectricEqpmt_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::GetOneTime()
- {
- int nRet = 0;
- map<int, BreakerDelayTime>::iterator iter = mapBreakerDelayTime.find( GetBaseType() );
- if ( iter != mapBreakerDelayTime.end() )
- {
- nRet = iter->second.GetOneTime( );
- }
- return nRet;
- }
- int ElectricEqpmt_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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_BreakRailPotential::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;
- }
- int ElectricEqpmt_BreakRailPotential::CheckEqpmtCtrlCase(int status, ELEEQPMTMAP& ElectricEqpmtMap, int stdid, int subsysid, int trianid, int stationid, int viewid, int CtrlType, int nMark)
- {
- // 真实设备反馈状态变化,不进行校验直接更新
- if (OperClient_RealSys == nMark || OperClient_RealSynch == nMark)
- {
- return DH_CmdReplyStatus_Pass;
- }
- // 母联断路器处理逻辑
- int nRetStatus = DH_CmdReplyStatus_Pass;
- ELEEQPMTMAP::iterator iterBolt = ElectricEqpmtMap.find(GetAutoBoltID());
- if (iterBolt != ElectricEqpmtMap.end() )
- {
- ElectricEqpmt_PowerBolt* pEqpmtBolt = (ElectricEqpmt_PowerBolt*)iterBolt->second;
- if ( pEqpmtBolt != NULL )
- {
- nRetStatus = pEqpmtBolt->GetEqpmtCtrlCaseStatus_CircuitBreaker_OnByHand(status,ElectricEqpmtMap);
- if ( nRetStatus == DH_CmdReplyStatus_Deny )
- {
- if (trianid>0)
- {
- std::stringstream ss;
- ss << GetEqpmentName() << "操作禁止";
- string retstr = ss.str();
- DHSVRREPLY CheckReplyMsg;
- memset(&CheckReplyMsg,0,sizeof(DHSVRREPLY)) ;
- strncpy(CheckReplyMsg.ReplyText, retstr.c_str(), sizeof(CheckReplyMsg.ReplyText));
- CheckReplyMsg.CmdID = OCCCOMMAND::eUpdateOperCheck;
- strncpy(CheckReplyMsg.EqpmtStrID, GetEqpmentID().c_str(), sizeof(CheckReplyMsg.ReplyText));
- CheckReplyMsg.CtrlLock=GetControlLock();
-
- CheckReplyMsg.StdID = stdid;
- CheckReplyMsg.EqpmtStatus =nRetStatus;
- CheckReplyMsg.StationID=stationid;
- CheckReplyMsg.ViewID = viewid;
- CheckReplyMsg.SubSysID = subsysid;
- OCCCOMMAND NetOrder;
- NetOrder.DesSysType = OCC_SYS_DD_CLIENT;
- NetOrder.ScrSysType = OCC_SYS_DD_SVR;
- NetOrder.TrainningID = trianid;
- NetOrder.setPacketValue(&CheckReplyMsg,OCCCOMMAND::eUpdateSvrReply);
- p_SendList->push(NetOrder);
- return nRetStatus;
- }
- }
- }
- }
- return CElectricEqpmt_SwicthEqpmt::CheckEqpmtCtrlCase(status, ElectricEqpmtMap, stdid, subsysid, trianid, stationid, viewid, CtrlType, nMark);
- }
|