ElectricEqpmt_Line.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "pch.h"
  2. #include "ElectricEqpmt_Line.h"
  3. bool ElectricEqpmt_Line::PowerIn(ELEEQPMTMAP& eqpmtmap,string sourceid)
  4. {
  5. SetPower(true);
  6. std::map<string,InputLineInfo>::iterator iter = InputEqpmtIDMap.begin();//查找sourceid的输出设备的输入设备列表
  7. for (;iter!=InputEqpmtIDMap.end();iter++)
  8. {
  9. if (sourceid==iter->first)
  10. {
  11. if (iter->second.InputPower)
  12. {
  13. return false;
  14. }
  15. iter->second.InputPower = true; //并将输入设备列表中与sourceid相同的元件使其受电
  16. UpdateEqpmtStatus(eqpmtmap,Electric_Eqpmt_Status_ON); //更新sourceid输入设备的显示状态
  17. }
  18. }
  19. //上面这部分代码用于置sourceid设备受电状态,并更新sourceid输入设备的显示状态
  20. std::map<string,string>::iterator iter2 = OutputEqpmtIDMap.begin();//string
  21. for (;iter2!=OutputEqpmtIDMap.end();iter2++)
  22. {
  23. if (iter2->first!=sourceid)
  24. {
  25. ELEEQPMTMAP::iterator iter3 = eqpmtmap.find(iter2->first);
  26. if (iter3!=eqpmtmap.end())
  27. {
  28. iter3->second->PowerIn(eqpmtmap,GetEqpmentID());//m_strid为UpdateEqpmtStatus所更改的设备元件,将m_strid设备使其受电 //给sourceid的输出设备送电 //iter3->second为m_strid的输入设备
  29. }
  30. }
  31. }
  32. //用于设置UpdateEqpmtStatus所更改设备的受电状态
  33. Deal400VLoad();
  34. DealElcTurnOffArea();
  35. return true;
  36. }
  37. void ElectricEqpmt_Line::CalculateValue(double inputv,double inputI,ELEEQPMTMAP* PEqpmtMap)
  38. {
  39. InputVoltage=inputv;
  40. InputElectricity=inputI;
  41. if (GetStatus()==Electric_Eqpmt_Status_ON)
  42. {
  43. OutputVoltage=InputVoltage;
  44. OutputElectricity=InputVoltage;
  45. }
  46. else
  47. {
  48. OutputVoltage=0;
  49. OutputElectricity=0;
  50. }
  51. for(int i = 0; i <m_EarthSwitchID.size();i++)
  52. {
  53. ELEEQPMTMAP::iterator Eqpmtiter;
  54. Eqpmtiter=PEqpmtMap->find(m_EarthSwitchID[i]);
  55. if (Eqpmtiter!=PEqpmtMap->end())
  56. {
  57. if (Eqpmtiter->second->GetStatus()==Electric_Eqpmt_Status_Error)
  58. {
  59. OutputVoltage=0;
  60. OutputElectricity=0;
  61. }
  62. }
  63. }
  64. std::map<string,string>::iterator iter=OutputEqpmtIDMap.begin();
  65. for (;iter!=OutputEqpmtIDMap.end();iter++)
  66. {
  67. ELEEQPMTMAP::iterator Eqpmtiter;
  68. Eqpmtiter=PEqpmtMap->find(iter->first);
  69. if (Eqpmtiter!=PEqpmtMap->end())
  70. {
  71. Eqpmtiter->second->CalculateValue(OutputVoltage,OutputElectricity,PEqpmtMap);
  72. }
  73. }
  74. }