| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991 |
- #include "pch.h"
- #include "ElectricEqpmt_PowerBolt.h"
- #include "ElectricEqpmt_Breaker.h"
- #include "YD_Public_OCC.h"
- ElectricEqpmt_PowerBolt::ElectricEqpmt_PowerBolt(void)
- {
- m_NextBolt = "";
- m_RelationBreak = "";
- m_LeftInputBreak.clear();
- m_RightInputBreak.clear();
- m_strAA_ModeStatus = "";
- m_strAM_ModeStatus = "";
- m_strMM_ModeStatus = "";
-
- m_nCtrlMode = AutoBolt_CtrlMode_Auto_Auto;
- m_strLeftInputLine = "";
- m_strRightInputLine = "";
- m_strLeftMotherLine = "";
- m_strRightMotherLine = "";
- }
- ElectricEqpmt_PowerBolt::~ElectricEqpmt_PowerBolt(void)
- {
- }
- void ElectricEqpmt_PowerBolt::CalculateValue(double inputv,double inputI,ELEEQPMTMAP* PEqpmtMap)
- {
- }
- bool ElectricEqpmt_PowerBolt::handle_delaytime(int64_t& time,ELEEQPMTMAP& eqpmtmap,DelayTimeInfo& delayparm)
- {
- //CTimeSpan Timespan=CTimeSpan(0,0,0,Auto_AutoBoltDelay_DurTime);
- //CTimeSpan Timespan=CTimeSpan(0,0,0,delayparm.delaydur);
- if (delayparm.occartime + delayparm.delaydur > time)
- return true;
- if (GetCtrlMode()==AutoBolt_CtrlMode_Manual_Manual)
- {
- return true;
- }
- else if (GetCtrlMode()==AutoBolt_CtrlMode_Manual_Auto)
- {
- if (delayparm.type==Auto_DelayTime_AutoBolt&&delayparm.destatus==Electric_Eqpmt_Status_ON)
- AutoBlotShut(eqpmtmap); //自动合闸
- }
- else if (GetCtrlMode()==AutoBolt_CtrlMode_Auto_Auto)
- {
- if (delayparm.type==Auto_DelayTime_AutoBolt&&delayparm.destatus==Electric_Eqpmt_Status_ON)
- AutoBlotShut(eqpmtmap); //自动合闸
- //AutoBlotOff(eqpmtmap);
- if (delayparm.type==Auto_DelayTime_AutoBolt&&delayparm.destatus==Electric_Eqpmt_Status_OFF)
- AutoBlotOff(eqpmtmap); //自动分闸
- if (delayparm.type==Auto_DelayTime_AutoBolt&&delayparm.destatus==Electric_Eqpmt_Status_ON&&delayparm.srcstatus == Electric_Eqpmt_Status_ON)
- AutoBlotOff(eqpmtmap); //自动分闸
- }
- else if(GetCtrlMode()==AutoBolt_CtrlMode_Auto_Manual)
- {
- if (delayparm.type==Auto_DelayTime_AutoBolt&&delayparm.destatus==Electric_Eqpmt_Status_ON)
- AutoBlotShut(eqpmtmap); //自动合闸
- //AutoBlotOff(eqpmtmap);
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::AutoBlotOff(ELEEQPMTMAP& eqpmtmap)
- {
- if ( !CheckBoltRelationLRBreak_Off( eqpmtmap ) )//若左右进线断路器均合闸,则备自投启动自复逻辑,母联断路器分闸 add by xyx-2017.07.28
- {
- return false;
- }
- ElectricEqpmt_Breaker* pbreaker=NULL;
- ELEEQPMTMAP::iterator iterbreaker = eqpmtmap.find(m_RelationBreak);
- if (iterbreaker!=eqpmtmap.end())
- {
- if (iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kVBREAKER || iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_BREAKER_DC || iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400vACControlBreaker)
- {
- pbreaker = (ElectricEqpmt_Breaker*)iterbreaker->second;
- // 自投自复时,先判断是否有故障发生并需要母联开关跳闸,若有,则优先故障跳闸,不会合母联
- if ( pbreaker->IsFault() )
- {
- return false;
- }
- //if (pbreaker->GetBoltInOff(eqpmtmap)!=NULL) //备自投未处于分闸状态
- {
- if (CheckEqpmtCtrlCase(Electric_Eqpmt_Status_OFF,eqpmtmap,0,0,0,0,0, CTRLTYPE_STATUS)==DH_CmdReplyStatus_Pass) //检查该设备控制的相关元件
- {
- if (pbreaker->GetStatus()==Electric_Eqpmt_Status_OFF)
- {
- return false;
- }
- pbreaker->TurnOff(eqpmtmap,Auto_DelayTime_AutoBolt);
-
- //xyx屏蔽begin
- //string strtext;
- //strtext.Format("母联断路器 %s 分闸",pbreaker->GetEqpmentName());
- //SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SYS,strtext);
- //xyx屏蔽end
- //xyx修改begin
- string EqpmtTypeName = pbreaker->GetBaseTypeName(); //设备类型名称
- string EqpmtName = pbreaker->GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = pbreaker->GetSourceStationID(); //设备所属车站ID
- int EqpmtType = pbreaker-> GetBaseType(); //设备类型
- int nActType = ElcAlarm_TripActType_Open; //“分闸”报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType);
- //xyx修改end
- return true;
- }
- }
- }
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::AutoBlotShut(ELEEQPMTMAP& eqpmtmap)
- {
- if ( !CheckBoltRelationLRBreak_On( eqpmtmap ) )//若左右进线断路器任一处于分闸状态,则母联断路器合闸 add by xyx-2017.07.28
- {
- return false;
- }
- ElectricEqpmt_Breaker* pbreaker=NULL;
- ELEEQPMTMAP::iterator iterbreaker = eqpmtmap.find(m_RelationBreak);
- if (iterbreaker!=eqpmtmap.end())
- {
- if (iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kVBREAKER || iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_BREAKER_DC|| iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400vACControlBreaker)
- {
- pbreaker = (ElectricEqpmt_Breaker*)iterbreaker->second;
- // 自投自复时,先判断是否有故障发生并需要母联开关跳闸,若有,则优先故障跳闸,不会合母联
- if ( pbreaker->IsFault() )
- {
- return false;
- }
- //if (pbreaker->GetBoltInShut(eqpmtmap)!=NULL)
- {
- if (CheckEqpmtCtrlCase(Electric_Eqpmt_Status_ON,eqpmtmap,0,0,0,0,0, CTRLTYPE_STATUS)==DH_CmdReplyStatus_Pass)
- {
- pbreaker->TurnOn(eqpmtmap);
-
- //xyx屏蔽begin
- //string strtext;
- //strtext.Format("母联断路器 %s 合闸",pbreaker->GetEqpmentName());
- //SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SYS,strtext);
- //xyx屏蔽end
- //xyx修改begin
- string EqpmtTypeName = pbreaker->GetBaseTypeName(); //设备类型名称
- string EqpmtName = pbreaker->GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = pbreaker->GetSourceStationID(); //设备所属车站ID
- int EqpmtType = pbreaker-> GetBaseType(); //设备类型
- int nActType = ElcAlarm_TripActType_Close; //母联断路器“合闸”报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType);
- //xyx修改end
- return true;
- }
- }
- }
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::CheckSelfOff(ELEEQPMTMAP& eqpmtmap,string sbreaker) //检查自断
- {
- if (GetStatus()==Electric_Eqpmt_Status_OFF||sbreaker!=m_RelationBreak)
- {
- return false;
- }
- DelayTimeInfo delay;
-
- //modify by dengt
- if (GetBaseType() == OCC_EQPMTTYPE_35kVBREAKER)
- {
- delay.delaydur = Auto_AutoBoltDelay_DurTime_35kv;
- }
- else
- delay.delaydur = Auto_AutoBoltDelay_DurTime;
- delay.occartime = GetNumTime_Second_2();
- delay.srcstatus = GetStatus();
- delay.destatus = Electric_Eqpmt_Status_OFF;
-
- if (GetCtrlMode()==AutoBolt_CtrlMode_Manual_Manual)
- {
- delay.type=AutoBolt_CtrlMode_Manual_Manual;
- }
- else if (AutoBolt_CtrlMode_Manual_Auto)
- {
- delay.type=AutoBolt_CtrlMode_Manual_Auto;
- }
- else if (AutoBolt_CtrlMode_Auto_Auto)
- {
- delay.type=Auto_DelayTime_AutoBolt;
- }
- else if(AutoBolt_CtrlMode_Auto_Manual)
- {
- delay.type=AutoBolt_CtrlMode_Auto_Manual;
- }
- p_DelayTimeMap->insert(make_pair(GetEqpmentID(),delay));
- return true;
- }
- bool ElectricEqpmt_PowerBolt::CheckSelfShut(ELEEQPMTMAP& eqpmtmap,string sbreaker) //检查自动合闸
- {
- if (GetStatus()==Electric_Eqpmt_Status_OFF/*||m_CtrlMode==AutoBolt_CtrlMode_Manual*/||sbreaker!=m_RelationBreak)
- {
- return false;
- }
- //手动操作时不分闸
- if ( GetCtrlMark() )
- {
- return false;
- }
- //获取关联母联断路器
- ElectricEqpmt_Breaker* pbreaker = NULL;
- ELEEQPMTMAP::iterator iterbreaker = eqpmtmap.find(m_RelationBreak);
- if (iterbreaker == eqpmtmap.end())
- {
- return false;
- }
- ElectricEqpmt_Breaker* plbreaker1=NULL; //added by zhangjh on 2017.3.21
- ElectricEqpmt_Breaker* plbreaker2=NULL;
- for (int i=0;i<m_LeftInputBreak.size();i++)
- {
- ELEEQPMTMAP::iterator iterlbreaker = eqpmtmap.find(m_LeftInputBreak[i]);
- if (iterlbreaker!=eqpmtmap.end())
- {
- if (iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kVBREAKER
- || iterlbreaker->second->GetBaseType()== OCC_EQPMTTYPE_BREAKER_DC
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400vACControlBreaker
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kvACPowerLine
- || iterlbreaker->second->GetBaseType()== OCC_EQPMTTYPE_400vACPowerLine
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_110kvPowerLine
- || iterlbreaker->second->GetBaseType() == OCC_EQPMTTYPE_10kvPowerLine //花溪10kv馈线 add by dengt
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kVLineInOutlet
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400VLineInOutlet)
- {
- if (i==0)
- {
- plbreaker1 = (ElectricEqpmt_Breaker*)iterlbreaker->second;
- }
- if (i==1)
- {
- plbreaker2 = (ElectricEqpmt_Breaker*)iterlbreaker->second;
- }
- }
- }
- }
-
- ElectricEqpmt_Breaker* prbreaker1=NULL; //added by zhangjh on 2017.3.21
- ElectricEqpmt_Breaker* prbreaker2=NULL;
- for (int i=0;i<m_RightInputBreak.size();i++)
- {
- ELEEQPMTMAP::iterator iterlbreaker = eqpmtmap.find(m_RightInputBreak[i]);
- if (iterlbreaker!=eqpmtmap.end())
- {
- if (iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kVBREAKER
- || iterlbreaker->second->GetBaseType()== OCC_EQPMTTYPE_BREAKER_DC
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400vACControlBreaker
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kvACPowerLine
- || iterlbreaker->second->GetBaseType()== OCC_EQPMTTYPE_400vACPowerLine
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_110kvPowerLine
- || iterlbreaker->second->GetBaseType() == OCC_EQPMTTYPE_10kvPowerLine //花溪10kv馈线 add by dengt
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_35kVLineInOutlet
- || iterlbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400VLineInOutlet)
- {
- if (i==0)
- {
- prbreaker1 = (ElectricEqpmt_Breaker*)iterlbreaker->second;
- }
- if (i==1)
- {
- prbreaker2 = (ElectricEqpmt_Breaker*)iterlbreaker->second;
- }
- }
- }
- }
-
- //左右进线开关都存在再进行逻辑判断
- if (prbreaker1!=NULL&&plbreaker1!=NULL&&prbreaker2!=NULL&&plbreaker2!=NULL)
- {
- //左右进线都是失电时逻辑,母联断路器分闸
- if (prbreaker1->GetStatus()==Electric_Eqpmt_Status_OFF && plbreaker1->GetStatus()==Electric_Eqpmt_Status_OFF
- &&prbreaker2->GetStatus()==Electric_Eqpmt_Status_OFF && plbreaker2->GetStatus()==Electric_Eqpmt_Status_OFF)//added by yangsong
- {
- //400V备自投逻辑,分闸立即执行
- if (iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400vACControlBreaker)
- {
- if (GetCtrlMode()==AutoBolt_CtrlMode_Auto_Auto
- || GetCtrlMode() == AutoBolt_CtrlMode_Manual_Auto)
- {
- AutoBlotOff(eqpmtmap);//如果是400V备自投控制模式是自复,就立即分闸
- }
- }
- else
- {
- DelayTimeInfo delay;
- delay.type = Auto_DelayTime_AutoBolt;
- //modify by dengt
- if (iterbreaker->second->GetBaseType() == OCC_EQPMTTYPE_35kVBREAKER)
- {
- delay.delaydur = Auto_AutoBoltDelay_DurTime_35kv;
- }
- else{
- delay.delaydur = Auto_AutoBoltDelay_DurTime;
- }
- delay.occartime = GetNumTime_Second_2();
- delay.srcstatus = GetStatus();
- delay.destatus = Electric_Eqpmt_Status_OFF;
- p_DelayTimeMap->insert(make_pair(GetEqpmentID(),delay));
- }
- return true;
- }
- //左侧进线或者右侧进线失电时逻辑,母联断路器合闸
- else if ((prbreaker1->GetStatus()==Electric_Eqpmt_Status_OFF && prbreaker2->GetStatus()==Electric_Eqpmt_Status_OFF)
- || (plbreaker1->GetStatus()==Electric_Eqpmt_Status_OFF && plbreaker2->GetStatus()==Electric_Eqpmt_Status_OFF))//added by zhangjh on 2017.3.21
- {
- DelayTimeInfo delay;
- delay.type=Auto_DelayTime_AutoBolt;
- //modify by dengt
- //35kV备自投延时比400V延时短
- if (iterbreaker->second->GetBaseType() == OCC_EQPMTTYPE_35kVBREAKER)
- {
- delay.delaydur = Auto_AutoBoltDelay_DurTime_35kv;
- }
- else {
- delay.delaydur = Auto_AutoBoltDelay_DurTime;
- }
- delay.occartime = GetNumTime_Second_2();
- delay.srcstatus = GetStatus();
- delay.destatus = Electric_Eqpmt_Status_ON;
- p_DelayTimeMap->insert(make_pair(GetEqpmentID(),delay));
- return true;
- }
- //左右进线都是得电时逻辑,母联断路器分闸
- else if (prbreaker1->GetStatus()==Electric_Eqpmt_Status_ON&&plbreaker1->GetStatus()==Electric_Eqpmt_Status_ON
- &&prbreaker2->GetStatus()==Electric_Eqpmt_Status_ON&&plbreaker2->GetStatus()==Electric_Eqpmt_Status_ON)
- {
- //400V备自投控制模式是自复,就立即分闸
- if (iterbreaker->second->GetBaseType()==OCC_EQPMTTYPE_400vACControlBreaker)
- {
- if (GetCtrlMode()==AutoBolt_CtrlMode_Auto_Auto
- || GetCtrlMode() == AutoBolt_CtrlMode_Manual_Auto)
- {
- AutoBlotOff(eqpmtmap);
- }
- }
- else
- {
- DelayTimeInfo delay;
- delay.type=Auto_DelayTime_AutoBolt;
- //modify by dengt
- if (iterbreaker->second->GetBaseType() == OCC_EQPMTTYPE_35kVBREAKER)
- {
- delay.delaydur = Auto_AutoBoltDelay_DurTime_35kv;
- }
- else
- delay.delaydur = Auto_AutoBoltDelay_DurTime;
- //delay.delaydur=Auto_AutoBoltDelay_DurTime;
- delay.occartime = GetNumTime_Second_2();
- delay.srcstatus = GetStatus();
- delay.destatus = Electric_Eqpmt_Status_OFF;
- p_DelayTimeMap->insert(make_pair(GetEqpmentID(),delay));
- }
- return true;
- }
- }
- return false;
- }
- int ElectricEqpmt_PowerBolt::AutoBoltCheckEqpmtCtrlCase(int trainid,ELEEQPMTMAP& ElectricEqpmtMap,int subsysid,int stationid,int viewid,int stdid)
- {
- DHSVRREPLY CheckReplyMsg;
- memset(&CheckReplyMsg,0,sizeof(DHSVRREPLY)) ;
- string retstr;
- int retstatus = AutoBolt_CtrlMode_Auto_Auto;
-
- ELEEQPMTMAP::iterator iter = ElectricEqpmtMap.find(GetEqpmentID()); //查找联动设备(前一个设备的状态)
- if (iter!=ElectricEqpmtMap.end())
- {
-
- // retstr.Format("%s %s 控制模式为:",iter->second->GetTypeName(),iter->second->GetName());
- retstr = "控制模式为:";
- if (GetCtrlMode()==AutoBolt_CtrlMode_Manual_Manual)
- {
- retstr+="手投手复";
- retstatus = AutoBolt_CtrlMode_Manual_Manual;
- UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- //add by yangs 添加备自投模式切换报警
- string EqpmtTypeName = GetBaseTypeName(); //设备类型名称
- string EqpmtName = GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID
- int EqpmtType = GetBaseType(); //设备类型
- int nActType1 = ElcAlarm_TripActType_CtrlModeManualManual; //“手投手复”报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1);
- }
- else if (GetCtrlMode()==AutoBolt_CtrlMode_Manual_Auto)
- {
- retstr+="手投自复";
- retstatus = AutoBolt_CtrlMode_Manual_Auto;
- //add by yangs 添加备自投模式切换报警
- string EqpmtTypeName = GetBaseTypeName(); //设备类型名称
- string EqpmtName = GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID
- int EqpmtType = GetBaseType(); //设备类型
- int nActType1 = ElcAlarm_TripActType_CtrlModeManualAuto; //“手投自复”报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1);
- }
- else if (GetCtrlMode()==AutoBolt_CtrlMode_Auto_Auto)
- {
- retstr+="自投自复";
- retstatus = AutoBolt_CtrlMode_Auto_Auto;
- UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- //add by yangs 添加备自投模式切换报警
- string EqpmtTypeName = GetBaseTypeName(); //设备类型名称
- string EqpmtName = GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID
- int EqpmtType = GetBaseType(); //设备类型
- int nActType1 = ElcAlarm_TripActType_CtrlModeAutoAuto; //“自投自复”报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1);
- }
- else if(GetCtrlMode()==AutoBolt_CtrlMode_Auto_Manual)
- {
- retstr+="自投手复";
- retstatus = AutoBolt_CtrlMode_Auto_Manual;
- UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- //add by yangs 添加备自投模式切换报警
- string EqpmtTypeName = GetBaseTypeName(); //设备类型名称
- string EqpmtName = GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID
- int EqpmtType = GetBaseType(); //设备类型
- int nActType1 = ElcAlarm_TripActType_CtrlModeAutoManual; //“自投手复”报文类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1);
- }
- if (trainid>0)
- {
- POWERAUTOBOLTCTRLMODE autoBoltMode;
- memset(&autoBoltMode, 0, sizeof(POWERAUTOBOLTCTRLMODE));
- string eqpmentid = GetEqpmentID();;
- strncpy(autoBoltMode.Eqpmtid, eqpmentid.c_str(),sizeof(autoBoltMode.Eqpmtid));
- autoBoltMode.AutoBoltCtrlMode = GetCtrlMode();
- autoBoltMode.nStationID = stationid;
- autoBoltMode.nViewID = viewid;
- OCCCOMMAND NetOrder;
- memset(&NetOrder, 0, sizeof(OCCCOMMAND));
- NetOrder.DesSysType = OCC_SYS_DD_CLIENT;
- NetOrder.ScrSysType = OCC_SYS_DD_SVR;
- NetOrder.TrainningID = trainid;
- NetOrder.setPacketValue(&autoBoltMode,OCCCOMMAND::eUpdateAutoBolt_CtrlMode);
- p_SendList->push(NetOrder);
- }
- }
- if (trainid>0)
- {
- strncpy(CheckReplyMsg.ReplyText,retstr.c_str(), sizeof(CheckReplyMsg.ReplyText));
- CheckReplyMsg.CmdID = OCCCOMMAND::eUpdateAutoBolt_CtrlMode;
-
- string strID=GetEqpmentID();
- strncpy(CheckReplyMsg.EqpmtStrID,strID.c_str(), sizeof(CheckReplyMsg.EqpmtStrID));
- CheckReplyMsg.StdID = stdid;
- CheckReplyMsg.EqpmtStatus =retstatus; //100表示通过,101拒绝
- 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 = trainid;
- NetOrder.setPacketValue(&CheckReplyMsg,OCCCOMMAND::eUpdateSvrReply);
- p_SendList->push(NetOrder);
- }
- return retstatus;
- }
- bool ElectricEqpmt_PowerBolt::CheckBoltRelationLRBreak_On( ELEEQPMTMAP& eqpmtmap )//add by xyx-2017.07.28
- {
- if ( Electric_Eqpmt_Status_OFF == GetStatus() )
- {
- return false;
- }
- bool bLeft = true;
- ELEEQPMTMAP::iterator iterEqpmt;
- // 左进线合闸条件
- for ( int i = 0; i < m_LeftInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_LeftInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bLeft = false;
- break;
- }
- }
- // 右进线合闸条件
- bool bRight = true;
- for ( int i = 0; i < m_RightInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_RightInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bRight = false;
- break;
- }
- }
- if ( bLeft || bRight )
- {
- return true;
- }
- if( !bLeft && !bRight )
- {
- return false;
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::CheckBoltRelationLRBreak_Off( ELEEQPMTMAP& eqpmtmap )
- {
- //// 先检查左进线断路器是否合闸
- //ELEEQPMTMAP::iterator iterEqpmt;
- //for ( int i = 0; i < m_LeftInputBreak.size(); i++ )
- //{
- // iterEqpmt = eqpmtmap.find( m_LeftInputBreak[i]);
- // if ( iterEqpmt == eqpmtmap.end() )
- // {
- // continue;
- // }
- // if ( IsBreakType(iterEqpmt->second->GetType()) )
- // {
- // if ( Electric_Eqpmt_Status_OFF == iterEqpmt->second->GetStatus() )
- // {
- // return false;
- // }
- // }
- //}
- // // 先检查右进线断路器是否合闸
- //for ( int i = 0; i < m_RightInputBreak.size(); i++ )
- //{
- // iterEqpmt = eqpmtmap.find( m_RightInputBreak[i]);
- // if ( iterEqpmt == eqpmtmap.end() )
- // {
- // continue;
- // }
- // if ( IsBreakType(iterEqpmt->second->GetType()) )
- // {
- // if ( Electric_Eqpmt_Status_OFF == iterEqpmt->second->GetStatus() )
- // {
- // return false;
- // }
- // }
- //}
- //return true;
- /*if ( Electric_Eqpmt_Status_OFF == GetStatus() )
- {
- return false;
- }*/
- bool bLeft = false;
- ELEEQPMTMAP::iterator iterEqpmt;
- // 左进线断路器是否合位
- for ( int i = 0; i < m_LeftInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_LeftInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if ( IsBreakType(iterEqpmt->second->GetBaseType()) )
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bLeft = true;
- break;
- }
- }
- }
- // 右进线断路器是否合位
- bool bRight = false;
- for ( int i = 0; i < m_RightInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_RightInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if ( IsBreakType(iterEqpmt->second->GetBaseType()) )
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bRight = true;
- break;
- }
- }
- }
- if ((bLeft && bRight) || (!bLeft && !bRight))
- {
- return true;
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::CheckBoltRelationLRBreak_OnByHand(ELEEQPMTMAP& eqpmtmap)
- {
- // 左进线断路器状态判断
- bool bLeft = true;
- ELEEQPMTMAP::iterator iterEqpmt;
- for ( int i = 0; i < m_LeftInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_LeftInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if (IsBreakType(iterEqpmt->second->GetBaseType()))
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bLeft = false;
- break;
- }
- }
-
- }
- // 右进线断路器状态判断
- bool bRight = true;
- for ( int i = 0; i < m_RightInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_RightInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if (IsBreakType(iterEqpmt->second->GetBaseType()))
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bRight = false;
- break;
- }
- }
- }
- if ( bLeft && bRight ) //左右进线断路器均分闸时,母联断路器不可合闸
- {
- return false;
- }
- else if( !bLeft && !bRight ) //左右进线断路器均合闸时,母联断路器不可合闸
- {
- return false;
- }
- else if ( bLeft || bRight ) //左右进线断路器有一分一合时,母联断路器可合闸
- {
- return true;
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::IsBreakType( int nType )
- {
- bool bRet = false;
- //int nStationType = GetStationType(m_SourceStation);
- //switch(nStationType)
- //{
- //case StationType_CenterControlStation:
- //case StationType_JYSubStation:
- //case StationType_QYSubStation:
- // {
- // if ( OCC_EQPMTTYPE_BREAKER == nType || OCC_EQPMTTYPE_400vACControlBreaker == nType )
- // {
- // bRet = true;
- // }
- // }
- // break;
- //case StationType_MainSubStation:
- // {
- // if ( OCC_EQPMTTYPE_BREAKER == nType || OCC_EQPMTTYPE_400vACControlBreaker == nType || OCC_EQPMTTYPE_35kvACFeedLine == nType || OCC_EQPMTTYPE_400vACFeedLine == nType )
- // {
- // bRet = true;
- // }
- // }
- // break;
- //default:
- // break;
- //}
- if ( OCC_EQPMTTYPE_35kVBREAKER == nType || OCC_EQPMTTYPE_400vACControlBreaker == nType )
- {
- bRet = true;
- }
- return bRet;
- }
- void ElectricEqpmt_PowerBolt::EqpmtCtrl( int status,ELEEQPMTMAP& ElectricEqpmtMap,string Stdid,int CtrlType, int nMark/* = 0*/ )
- {
- if (CtrlType==CTRLTYPE_LOCKSTATUS)
- {
- UpdateLockStatus(status);
- }
- else if (CtrlType ==CTRLTYPE_STATUS)
- {
- if (GetControlLock()==Electric_Eqpmt_Status_UnLock)
- {
- //xyx屏蔽begin
- //if (status==Eqpmt_Operation_OFF&&GetStatus()==Electric_Eqpmt_Status_ON)
- //{
- // TurnOff(ElectricEqpmtMap,POWER_EQPMT_OPERNO);
- // string text;
- // text.Format(" 母联 %s 自投投入/退出 退出",GetEqpmentName() );
- // SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SOE,text);
- //}
- //else if (status==Eqpmt_Operation_ON)
- //{
- // if (GetStatus()==Electric_Eqpmt_Status_OFF)
- // {
- // TurnOn(ElectricEqpmtMap);
- // string text;
- // text.Format(" 母联 %s 自投投入/退出 投入",GetEqpmentName() );
- // SendMsgNotice(GetSourceStationID(),GetRegion(),2,DH_MSGCATEGORY_SOE,text);
- // }
- //}
- //else
- // UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus());
- //xyx屏蔽end
- //xyx修改begin
- string EqpmtTypeName = GetBaseTypeName(); //设备类型名称
- string EqpmtName = GetEqpmentName(); //设备名称
- int EqpmtSourceStatonID = GetSourceStationID(); //设备所属车站ID
- int EqpmtType = GetBaseType(); //设备类型
- if (status==Eqpmt_Operation_OFF&&GetStatus()==Electric_Eqpmt_Status_ON)
- {
- TurnOff(ElectricEqpmtMap,POWER_EQPMT_OPERNO);
- int nActType1 = ElcAlarm_TripActType_Open; //“退出”类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType1);
- UpdateOperResultToTechEva(GetEqpmentID(),GetStatus()); //更新“退出”操作执行结果
- }
- else if (status==Eqpmt_Operation_ON)
- {
- if (GetStatus()==Electric_Eqpmt_Status_OFF)
- {
- TurnOn(ElectricEqpmtMap);
- //备自投操作后检查是否需要启动自投
- CheckSelfShut( ElectricEqpmtMap,GetRelationBreaker() );
- int nActType2 = ElcAlarm_TripActType_Close; //“投入”类型
- UpdateAlarmType(EqpmtType,EqpmtTypeName,EqpmtName,EqpmtSourceStatonID,nActType2);
- UpdateOperResultToTechEva(GetEqpmentID(),GetStatus()); //更新“投入”执行结果
- }
- }
- else
- UpdateEqpmtStatus(ElectricEqpmtMap,GetStatus());
- //xyx修改end
- }
- }
- else if (CtrlType ==CTRLTYPE_CARD)
- {
- //CardStatus = status;
- SetCardStatus(status);
- UpdateEqpmtStatus(ElectricEqpmtMap,GetCardStatus(),CTRLTYPE_CARD);
- }
- }
- int ElectricEqpmt_PowerBolt::GetEqpmtCtrlCaseStatus_CircuitBreaker_OnByHand( int status, ELEEQPMTMAP& ElectricEqpmtMap)
- {
- //int nRet = DH_CmdReplyStatus_Pass;
- //if ( !GetStatus() )
- //{
- // //母联联备自投退出位:不能操作
- // nRet = DH_CmdReplyStatus_Deny;
- //}
- //else
- //{
- // if ( Electric_Eqpmt_Status_ON == status )
- // {
- // // 三合两闭合闸检测
- // if ( !CheckBoltRelationLRBreak_OnByHand(ElectricEqpmtMap) )
- // {
- // nRet = DH_CmdReplyStatus_Deny;
- // }
- // }
- //}
- //return nRet;
- //母联断路器手动操作,三合两闭逻辑校验
- int nRet = DH_CmdReplyStatus_Pass;
- if ( !CheckBoltRelationLRBreak_OnByHand(ElectricEqpmtMap) )
- {
- nRet = DH_CmdReplyStatus_Deny;
- }
- return nRet;
- }
- int ElectricEqpmt_PowerBolt::GetEqpmtCtrlCaseStatus_LInputBreaker_OnByHand( int status,ELEEQPMTMAP& ElectricEqpmtMap )
- {
- //左进线断路器手动操作,三合两闭逻辑校验
- int nRet = DH_CmdReplyStatus_Pass;
- ELEEQPMTMAP::iterator iterEqpmt;
- for ( int i = 0; i < m_LeftInputBreak.size(); i++ )
- {
- iterEqpmt = ElectricEqpmtMap.find( m_LeftInputBreak[i]);
- if ( iterEqpmt != ElectricEqpmtMap.end()&&IsBreakType(iterEqpmt->second->GetBaseType()))
- {
- if ( !CheckBoltRelation_L_Break_OnByHand(ElectricEqpmtMap) )
- {
- nRet = DH_CmdReplyStatus_Deny;
- break;
- }
- }
- }
- return nRet;
- }
- int ElectricEqpmt_PowerBolt::GetEqpmtCtrlCaseStatus_RInputBreaker_OnByHand( int status,ELEEQPMTMAP& ElectricEqpmtMap )
- {
- //右进线断路器手动操作,三合两闭逻辑校验
- int nRet = DH_CmdReplyStatus_Pass;
- ELEEQPMTMAP::iterator iterEqpmt;
- for ( int i = 0; i < m_RightInputBreak.size(); i++ )
- {
- iterEqpmt = ElectricEqpmtMap.find( m_RightInputBreak[i]);
- if ( iterEqpmt != ElectricEqpmtMap.end()&&IsBreakType(iterEqpmt->second->GetBaseType()))
- {
- if ( !CheckBoltRelation_R_Break_OnByHand(ElectricEqpmtMap) )
- {
- nRet = DH_CmdReplyStatus_Deny;
- break;
- }
- }
- }
- return nRet;
- }
- bool ElectricEqpmt_PowerBolt::CheckBoltRelation_L_Break_OnByHand( ELEEQPMTMAP& eqpmtmap )
- {
- //判断母联断路器状态
- bool bBustieBreaker = true;
- ELEEQPMTMAP::iterator iterEqpmt;
- iterEqpmt = eqpmtmap.find( m_RelationBreak);
- if (iterEqpmt!=eqpmtmap.end())
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bBustieBreaker = false;
- }
- }
- //判断右进线断路器状态
- bool bRightBreaker = true;
- for ( int i = 0; i < m_RightInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_RightInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if (IsBreakType(iterEqpmt->second->GetBaseType()))
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bRightBreaker = false;
- break;
- }
- }
- }
- if( !bBustieBreaker && !bRightBreaker ) //母联断路器与右进线断路器均合闸时,左进线断路器不可合闸
- {
- return false;
- }
- else //其余情况,左进线断路器可合闸
- {
- return true;
- }
- return false;
- }
- bool ElectricEqpmt_PowerBolt::CheckBoltRelation_R_Break_OnByHand( ELEEQPMTMAP& eqpmtmap )
- {
- //判断母联断路器状态
- bool bBustieBreaker = true;
- ELEEQPMTMAP::iterator iterEqpmt;
- iterEqpmt = eqpmtmap.find( m_RelationBreak);
- if (iterEqpmt!=eqpmtmap.end())
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bBustieBreaker = false;
- }
- }
- //判断左进线断路器状态
- bool bLeftBreaker = true;
- for ( int i = 0; i < m_LeftInputBreak.size(); i++ )
- {
- iterEqpmt = eqpmtmap.find( m_LeftInputBreak[i]);
- if ( iterEqpmt == eqpmtmap.end() )
- {
- continue;
- }
- if (IsBreakType(iterEqpmt->second->GetBaseType()))
- {
- if ( Electric_Eqpmt_Status_ON == iterEqpmt->second->GetStatus() )
- {
- bLeftBreaker = false;
- break;
- }
- }
- }
- if( !bBustieBreaker && !bLeftBreaker ) //母联断路器与左进线断路器均合闸时,右进线断路器不可合闸
- {
- return false;
- }
- else //其余情况,右进线断路器可合闸
- {
- return true;
- }
- return false;
- }
- void ElectricEqpmt_PowerBolt::SetModeStatusShowEqpmt(string strEqpmt, int modeType)
- {
- if (AutoBolt_CtrlMode_Auto_Auto == modeType)
- {
- m_strAA_ModeStatus = strEqpmt;
- }
- else if (AutoBolt_CtrlMode_Auto_Manual == modeType)
- {
- m_strAM_ModeStatus = strEqpmt;
- }
- else if (AutoBolt_CtrlMode_Manual_Manual == modeType)
- {
- m_strMM_ModeStatus = strEqpmt;
- }
- else
- {
- m_strAA_ModeStatus = strEqpmt;
- }
- }
- void ElectricEqpmt_PowerBolt::UpdateModeStatusShow(ELEEQPMTMAP& ElectricEqpmtMap, int modeType)
- {
- ELEEQPMTMAP::iterator iterAAEqpmt = ElectricEqpmtMap.find(m_strAA_ModeStatus); //查找状态显示设备
- ELEEQPMTMAP::iterator iterAMEqpmt = ElectricEqpmtMap.find(m_strAM_ModeStatus); //查找状态显示设备
- ELEEQPMTMAP::iterator iterMMEqpmt = ElectricEqpmtMap.find(m_strMM_ModeStatus); //查找状态显示设备
- if (iterAAEqpmt!=ElectricEqpmtMap.end() && iterAMEqpmt!=ElectricEqpmtMap.end() && iterMMEqpmt!=ElectricEqpmtMap.end())
- {
- if (AutoBolt_CtrlMode_Auto_Auto == modeType)
- {
- iterAAEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- iterAMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- iterMMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- }
- else if (AutoBolt_CtrlMode_Auto_Manual == modeType)
- {
- iterAAEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- iterAMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- iterMMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- }
- else if (AutoBolt_CtrlMode_Manual_Manual == modeType)
- {
- iterAAEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- iterAMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- iterMMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- }
- else
- {
- iterAAEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_ON);
- iterAMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- iterMMEqpmt->second->UpdateEqpmtStatus(ElectricEqpmtMap,Electric_Eqpmt_Status_OFF);
- }
- }
- }
|