ElectricEqpmt_Line_TouchNet.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #include "pch.h"
  2. #include "ElectricEqpmt_Line_TouchNet.h"
  3. void CElectricEqpmt_Line_TouchNet::CalculateValue(double inputv,double inputI,ELEEQPMTMAP* PEqpmtMap)
  4. {
  5. }
  6. bool CElectricEqpmt_Line_TouchNet::PowerLost(ELEEQPMTMAP& eqpmtmap,string sourceid,int offcase)
  7. {
  8. SetPower(false);
  9. UpdateEqpmtStatus(eqpmtmap,Electric_Eqpmt_Status_OFF);//¸üÐÂsourceidÉ豸µÄÏÔʾ״̬
  10. if (p_SendList!=nullptr)
  11. {
  12. ELCACCIDENT aci;
  13. string strID=GetEqpmentID();
  14. strncpy(aci.EqpmtStrID, strID.c_str(), sizeof(aci.EqpmtStrID));
  15. aci.EventType=Power_TouchNet_Power_Lost;
  16. aci.parm = offcase;
  17. OCCCOMMAND NetOrder;
  18. NetOrder.DesSysType = OCC_SYS_DD_SVR;
  19. NetOrder.ScrSysType = OCC_SYS_DD_SVR;
  20. NetOrder.TrainningID = m_Trianid;
  21. NetOrder.setPacketValue(&aci,OCCCOMMAND::eUpdateAccident);
  22. p_SendList->push(NetOrder);
  23. }
  24. std::map<string,string>::iterator iter = OutputEqpmtIDMap.begin();
  25. for (;iter!=OutputEqpmtIDMap.end();iter++)
  26. {
  27. ELEEQPMTMAP::iterator iter1 = eqpmtmap.find(iter->first);
  28. if (iter1==eqpmtmap.end())
  29. continue;
  30. iter1->second->PowerCut(eqpmtmap,GetEqpmentID(),offcase);
  31. }
  32. return true;
  33. }
  34. bool CElectricEqpmt_Line_TouchNet::PowerIn(ELEEQPMTMAP& eqpmtmap,string sourceid)
  35. {
  36. SetPower(true);
  37. std::map<string,InputLineInfo>::iterator iter = InputEqpmtIDMap.begin();
  38. for (;iter!=InputEqpmtIDMap.end();iter++)
  39. {
  40. if (sourceid==iter->first)
  41. {
  42. if (iter->second.InputPower)
  43. {
  44. return false;
  45. }
  46. iter->second.InputPower = true;
  47. UpdateEqpmtStatus(eqpmtmap,Electric_Eqpmt_Status_ON);
  48. if (p_SendList!=NULL)
  49. {
  50. ELCACCIDENT aci;
  51. //aci.Eqpmtid = m_strid;
  52. string strID=GetEqpmentID();
  53. strncpy(aci.EqpmtStrID,strID.c_str(), sizeof(aci.EqpmtStrID));
  54. aci.EventType=Power_TouchNet_Power_Come;
  55. OCCCOMMAND NetOrder;
  56. NetOrder.DesSysType = OCC_SYS_DD_SVR;
  57. NetOrder.ScrSysType = OCC_SYS_DD_SVR;
  58. NetOrder.TrainningID = m_Trianid;
  59. NetOrder.setPacketValue(&aci,OCCCOMMAND::eUpdateAccident);
  60. p_SendList->push(NetOrder);
  61. }
  62. }
  63. }
  64. std::map<string,string>::iterator iter2 = OutputEqpmtIDMap.begin();
  65. for (;iter2!=OutputEqpmtIDMap.end();iter2++)
  66. {
  67. if (iter2->first!=sourceid)
  68. {
  69. ELEEQPMTMAP::iterator iter3 = eqpmtmap.find(iter2->first);
  70. if (iter3!=eqpmtmap.end())
  71. {
  72. iter3->second->PowerIn(eqpmtmap,GetEqpmentID());
  73. }
  74. }
  75. }
  76. return true;
  77. }