| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #include "pch.h"
- #include "ElectricEqpmt_Line.h"
- bool ElectricEqpmt_Line::PowerIn(ELEEQPMTMAP& eqpmtmap,string sourceid)
- {
- SetPower(true);
- std::map<string,InputLineInfo>::iterator iter = InputEqpmtIDMap.begin();//查找sourceid的输出设备的输入设备列表
- for (;iter!=InputEqpmtIDMap.end();iter++)
- {
- if (sourceid==iter->first)
- {
- if (iter->second.InputPower)
- {
- return false;
- }
- iter->second.InputPower = true; //并将输入设备列表中与sourceid相同的元件使其受电
- UpdateEqpmtStatus(eqpmtmap,Electric_Eqpmt_Status_ON); //更新sourceid输入设备的显示状态
- }
- }
- //上面这部分代码用于置sourceid设备受电状态,并更新sourceid输入设备的显示状态
- std::map<string,string>::iterator iter2 = OutputEqpmtIDMap.begin();//string
- 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());//m_strid为UpdateEqpmtStatus所更改的设备元件,将m_strid设备使其受电 //给sourceid的输出设备送电 //iter3->second为m_strid的输入设备
- }
- }
- }
- //用于设置UpdateEqpmtStatus所更改设备的受电状态
- Deal400VLoad();
- DealElcTurnOffArea();
- return true;
- }
- void ElectricEqpmt_Line::CalculateValue(double inputv,double inputI,ELEEQPMTMAP* PEqpmtMap)
- {
- InputVoltage=inputv;
- InputElectricity=inputI;
- if (GetStatus()==Electric_Eqpmt_Status_ON)
- {
- OutputVoltage=InputVoltage;
- OutputElectricity=InputVoltage;
- }
- else
- {
- OutputVoltage=0;
- OutputElectricity=0;
- }
- for(int i = 0; i <m_EarthSwitchID.size();i++)
- {
- ELEEQPMTMAP::iterator Eqpmtiter;
- Eqpmtiter=PEqpmtMap->find(m_EarthSwitchID[i]);
- if (Eqpmtiter!=PEqpmtMap->end())
- {
- if (Eqpmtiter->second->GetStatus()==Electric_Eqpmt_Status_Error)
- {
- 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);
- }
- }
- }
|