ElectricEqpmt_Station400VLoad.cpp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #include "pch.h"
  2. #include "ElectricEqpmt_Station400VLoad.h"
  3. #include "YD_Public_OCC.h"
  4. Station400VLoadItem::Station400VLoadItem() : m_nButtonID(-1), m_strEqpmtID(""),m_strInputStrID("")
  5. {
  6. }
  7. Station400VLoadItem::~Station400VLoadItem()
  8. {
  9. }
  10. // ElectricEqpmt_Station400VLoadUnit 定义开始
  11. ElectricEqpmt_Station400VLoadUnit::ElectricEqpmt_Station400VLoadUnit(): m_nButtonID(-1), m_nCutMark(1),m_strRelationBolt("")
  12. {
  13. }
  14. ElectricEqpmt_Station400VLoadUnit::~ElectricEqpmt_Station400VLoadUnit()
  15. {
  16. }
  17. void ElectricEqpmt_Station400VLoadUnit::UpdateCutStatus( int nCutMark )
  18. {
  19. m_nCutMark = nCutMark;
  20. }
  21. void ElectricEqpmt_Station400VLoadUnit::Add400VLoadData( const string& strEqpmtID, const string& strInputStrID, int nButtonID )
  22. {
  23. Station400VLoadItem station400VLoadItem;
  24. station400VLoadItem.m_nButtonID = nButtonID;
  25. station400VLoadItem.m_strEqpmtID = strEqpmtID;
  26. station400VLoadItem.m_strInputStrID = strInputStrID;
  27. m_mapStation400VLoadItem.insert( make_pair(strInputStrID, station400VLoadItem) );
  28. }
  29. void ElectricEqpmt_Station400VLoadUnit::CheckInputEqpmt(ELEEQPMTMAP* ElectricEqpmtMap, const string& strInputStrID )
  30. {
  31. // 先判断备自投是否投入
  32. ELEEQPMTMAP::iterator iterBolt = ElectricEqpmtMap->find( m_strRelationBolt );
  33. if ( iterBolt == ElectricEqpmtMap->end() )
  34. {
  35. return;
  36. }
  37. if ( ! iterBolt->second->GetStatus() )
  38. {
  39. return;
  40. }
  41. // 车站400V三级负荷逻辑
  42. map<string,Station400VLoadItem>::iterator iterInput = m_mapStation400VLoadItem.find( strInputStrID );
  43. if ( iterInput == m_mapStation400VLoadItem.end() )
  44. {
  45. return;
  46. }
  47. ELEEQPMTMAP::iterator iterInputEqpmt = ElectricEqpmtMap->find(strInputStrID);
  48. if ( iterInputEqpmt == ElectricEqpmtMap->end() )
  49. {
  50. return;
  51. }
  52. int nStatus = iterInputEqpmt->second->GetStatus();
  53. if ( Electric_Eqpmt_Status_OFF == nStatus )
  54. {
  55. CheckInputEqpmt_Off(ElectricEqpmtMap,strInputStrID);
  56. }
  57. else if ( Electric_Eqpmt_Status_ON == nStatus )
  58. {
  59. CheckInputEqpmt_On(ElectricEqpmtMap,strInputStrID);
  60. }
  61. }
  62. void ElectricEqpmt_Station400VLoadUnit::CheckInputEqpmt_Off(ELEEQPMTMAP* ElectricEqpmtMap, const string& strInputStrID )
  63. {
  64. if ( m_nCutMark )
  65. {
  66. // 投入: 断开三级负荷开关
  67. CutAllSwitch(ElectricEqpmtMap,strInputStrID);
  68. }
  69. else
  70. {
  71. // 退出
  72. }
  73. }
  74. void ElectricEqpmt_Station400VLoadUnit::CheckInputEqpmt_On(ELEEQPMTMAP* ElectricEqpmtMap, const string& strInputStrID )
  75. {
  76. if ( m_nCutMark )
  77. {
  78. // 投入
  79. OnAllSwitch(ElectricEqpmtMap,strInputStrID);
  80. }
  81. else
  82. {
  83. // 退出
  84. }
  85. }
  86. void ElectricEqpmt_Station400VLoadUnit::CutAllSwitch( ELEEQPMTMAP* ElectricEqpmtMap, const string& strInputStrID )
  87. {
  88. map<string,Station400VLoadItem>::iterator iter = m_mapStation400VLoadItem.begin();
  89. for ( ; iter != m_mapStation400VLoadItem.end(); iter++ )
  90. {
  91. CutAllSwitchEqpmt(ElectricEqpmtMap, iter->second.m_strEqpmtID, strInputStrID);
  92. }
  93. }
  94. void ElectricEqpmt_Station400VLoadUnit::CutAllSwitchEqpmt( ELEEQPMTMAP* ElectricEqpmtMap, const string& strEqpmtID, const string& strInputStrID )
  95. {
  96. ELEEQPMTMAP::iterator iterEqpmt = ElectricEqpmtMap->find(strEqpmtID);
  97. if ( iterEqpmt == ElectricEqpmtMap->end() )
  98. {
  99. return;
  100. }
  101. if ( iterEqpmt->second->GetStatus() )
  102. {
  103. //mod by yangs
  104. //iterEqpmt->second->EqpmtCtrl( Electric_Eqpmt_Status_OFF, *ElectricEqpmtMap,"系统", CTRLTYPE_STATUS );
  105. DelayTimeInfo delay;
  106. delay.type=Auto_DelayTime_InitCtrl;
  107. delay.delaydur=5;
  108. delay.occartime = GetNumTime_Second_2();
  109. delay.srcid = strInputStrID;
  110. delay.srcstatus = Electric_Eqpmt_Status_OFF;
  111. delay.desid =strEqpmtID;
  112. delay.destatus = Electric_Eqpmt_Status_OFF;
  113. p_DelayTimeMap->insert(make_pair(strEqpmtID,delay));
  114. }
  115. }
  116. void ElectricEqpmt_Station400VLoadUnit::OnAllSwitch( ELEEQPMTMAP* ElectricEqpmtMap, const string& strInputStrID )
  117. {
  118. map<string,Station400VLoadItem>::iterator iter = m_mapStation400VLoadItem.begin();
  119. for ( ; iter != m_mapStation400VLoadItem.end(); iter++ )
  120. {
  121. OnAllSwitchEqpmt(ElectricEqpmtMap, iter->second.m_strEqpmtID, strInputStrID);
  122. }
  123. }
  124. void ElectricEqpmt_Station400VLoadUnit::OnAllSwitchEqpmt( ELEEQPMTMAP* ElectricEqpmtMap, const string& strEqpmtID, const string& strInputStrID )
  125. {
  126. ELEEQPMTMAP::iterator iterEqpmt = ElectricEqpmtMap->find(strEqpmtID);
  127. if ( iterEqpmt == ElectricEqpmtMap->end() )
  128. {
  129. return;
  130. }
  131. if ( !iterEqpmt->second->GetStatus() )
  132. {
  133. //mod by yangs
  134. //iterEqpmt->second->EqpmtCtrl( Electric_Eqpmt_Status_ON, *ElectricEqpmtMap,"系统", CTRLTYPE_STATUS );
  135. DelayTimeInfo delay;
  136. delay.type=Auto_DelayTime_InitCtrl;
  137. delay.delaydur=5;
  138. delay.occartime = GetNumTime_Second_2();
  139. delay.srcid = strInputStrID;
  140. delay.srcstatus = Electric_Eqpmt_Status_ON;
  141. delay.desid =strEqpmtID;
  142. delay.destatus = Electric_Eqpmt_Status_ON;
  143. p_DelayTimeMap->insert(make_pair(strEqpmtID,delay));
  144. }
  145. }
  146. // ElectricEqpmt_Station400VLoadUnit定义结束
  147. // ElectricEqpmt_Station400VLoad定义开始
  148. ElectricEqpmt_Station400VLoad::ElectricEqpmt_Station400VLoad() : m_nStationID(0)
  149. {
  150. }
  151. ElectricEqpmt_Station400VLoad::~ElectricEqpmt_Station400VLoad()
  152. {
  153. }
  154. void ElectricEqpmt_Station400VLoad::Update400VLoadCut( int nThreeLoadUnitID, int nCutMark )
  155. {
  156. map<int, ElectricEqpmt_Station400VLoadUnit>::iterator iter = m_mapStation400VLoadUnit.find(nThreeLoadUnitID);
  157. if ( iter != m_mapStation400VLoadUnit.end() )
  158. {
  159. iter->second.UpdateCutStatus(nCutMark);
  160. }
  161. }
  162. void ElectricEqpmt_Station400VLoad::Add400VLoadData( const string& strEqpmtID, const string& strInputStrID, int nButtonID, const string& strRelationBoltID )
  163. {
  164. map<int, ElectricEqpmt_Station400VLoadUnit>::iterator iter = m_mapStation400VLoadUnit.find( nButtonID );
  165. if ( iter == m_mapStation400VLoadUnit.end() )
  166. {
  167. ElectricEqpmt_Station400VLoadUnit station400VLoadUnit;
  168. station400VLoadUnit.m_nButtonID = nButtonID;
  169. station400VLoadUnit.m_strRelationBolt = strRelationBoltID;
  170. station400VLoadUnit.Add400VLoadData(strEqpmtID, strInputStrID, nButtonID );
  171. m_mapStation400VLoadUnit.insert( make_pair( nButtonID, station400VLoadUnit) );
  172. }
  173. else
  174. {
  175. iter->second.Add400VLoadData( strEqpmtID, strInputStrID, nButtonID );
  176. }
  177. }
  178. void ElectricEqpmt_Station400VLoad::CheckInputEqpmt(ELEEQPMTMAP* ElectricEqpmtMap, const string& strInputStrID, int nButtonID )
  179. {
  180. map<int, ElectricEqpmt_Station400VLoadUnit>::iterator iterLoadUnit = m_mapStation400VLoadUnit.find( nButtonID );
  181. if ( iterLoadUnit != m_mapStation400VLoadUnit.end() )
  182. {
  183. iterLoadUnit->second.CheckInputEqpmt(ElectricEqpmtMap, strInputStrID );
  184. }
  185. }
  186. void ElectricEqpmt_Station400VLoad::SetDelayMap(DELAYMAP* delaymap)
  187. {
  188. map<int, ElectricEqpmt_Station400VLoadUnit>::iterator iterLoadUnit = m_mapStation400VLoadUnit.begin();
  189. if ( iterLoadUnit != m_mapStation400VLoadUnit.end() )
  190. {
  191. iterLoadUnit->second.SetDelayMap(delaymap);
  192. }
  193. }