Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CElevatorConnectionEnum.f90 25 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. module CElevatorConnectionEnum
  2. use OperationScenariosModule
  3. use CLog3
  4. use CLog4
  5. implicit none
  6. contains
  7. subroutine Evaluate_ElevatorConnection()
  8. use CHoistingVariables
  9. use SimulationVariables
  10. use CCommon, only: SetStandRack
  11. implicit none
  12. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  13. #ifdef OST
  14. print*, 'Evaluate_ElevatorConnection=TopDrive'
  15. #endif
  16. endif
  17. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  18. #ifdef OST
  19. print*, 'ElevatorConnection=Kelly'
  20. #endif
  21. !!OPERATION-CODE=83
  22. !if (Get_OperationCondition() == OPERATION_TRIP .and.&
  23. ! Get_ElevatorConnection() == ELEVATOR_LATCH_STRING .and.&
  24. ! Get_ElevatorPickup() .and.&
  25. ! Get_Slips() == SLIPS_SET_END) then
  26. ! !call Log_4('OPERATION-CODE=83')
  27. ! call Set_ElevatorConnection(ELEVATOR_CONNECTION_STRING)
  28. ! return
  29. !end if
  30. !OPERATION-CODE=78
  31. if (Get_ElevatorPickup() == .false. .and.&
  32. Get_Tong() == TONG_BREAKOUT_END .and.&
  33. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%PL) .and.&
  34. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then
  35. call Set_ElevatorConnection(ELEVATOR_LATCH_SINGLE)
  36. return
  37. end if
  38. !OPERATION-CODE=79
  39. if (Get_ElevatorPickup() == .false. .and.&
  40. Get_Tong() == TONG_BREAKOUT_END .and.&
  41. Get_HookHeight() >= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%SL - data%State%OperationScenario%LG) .and.&
  42. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then
  43. call Set_ElevatorConnection(ELEVATOR_LATCH_STAND)
  44. return
  45. end if
  46. !OPERATION-CODE=83
  47. if (Get_ElevatorPickup().and.&
  48. Get_ElevatorConnection() == ELEVATOR_LATCH_SINGLE) then
  49. call Set_ElevatorConnection(ELEVATOR_CONNECTION_SINGLE)
  50. return
  51. end if
  52. !OPERATION-CODE=84
  53. if (Get_ElevatorPickup().and.&
  54. Get_ElevatorConnection() == ELEVATOR_LATCH_STAND) then
  55. call Set_ElevatorConnection(ELEVATOR_CONNECTION_STAND)
  56. return
  57. end if
  58. !OPERATION-CODE=7
  59. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  60. !GetRotaryRpm() == 0.0d0 .and.&
  61. !Get_StandRack() > 0 .and.&
  62. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  63. !Get_Swing() == SWING_WELL_END .and.&
  64. !Get_Slips() == SLIPS_SET_END .and.&
  65. !Get_LatchLed() .and.
  66. Get_Elevator() == ELEVATOR_LATCH_STAND_END) then
  67. !call Log_4('OPERATION-CODE=7')
  68. call Set_ElevatorConnection(ELEVATOR_CONNECTION_STAND)
  69. !call Set_UnlatchLed(.true.)
  70. !call Set_LatchLed(.false.)
  71. call SetStandRack(Get_StandRack() - 1)
  72. call Set_Elevator(ELEVATOR_NEUTRAL)
  73. return
  74. end if
  75. !OPERATION-CODE=8
  76. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  77. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG) .and.&
  78. !GetRotaryRpm() == 0.0d0 .and.&
  79. !Get_StandRack() < 80 .and.&
  80. !Get_ElevatorConnectionPossible() .and.&
  81. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  82. !Get_Swing() == SWING_WELL_END .and.&
  83. !Get_Slips() == SLIPS_SET_END .and.&
  84. !Get_UnlatchLed() .and.&
  85. Get_Elevator() == ELEVATOR_UNLATCH_STAND_END) then
  86. call Set_ElevatorConnection(ELEVATOR_CONNECTION_NOTHING)
  87. !call Set_UnlatchLed(.false.)
  88. !call Set_LatchLed(.true.)
  89. call SetStandRack(Get_StandRack() + 1)
  90. call Set_Elevator(ELEVATOR_NEUTRAL)
  91. !call Set_Elevator(ELEVATOR_UNLATCH_STAND_BEGIN)
  92. call Log_3('OPERATION-CODE=8')
  93. return
  94. end if
  95. !OPERATION-CODE=9
  96. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  97. !Get_HookHeight() >= 18.0 .and. Get_HookHeight() <= 22.0 .and.&
  98. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  99. !Get_Swing() == SWING_WELL_END .and.&
  100. !Get_Slips() == SLIPS_SET_END .and.&
  101. !Get_LatchLed() .and.&
  102. !Get_ElevatorPickup() .and.&
  103. Get_Elevator() == ELEVATOR_LATCH_STRING_END) then
  104. !call Log_4('OPERATION-CODE=9')
  105. call Set_ElevatorConnection(ELEVATOR_LATCH_STRING)
  106. call Set_Elevator(ELEVATOR_NEUTRAL)
  107. !call Set_UnlatchLed(.true.)
  108. !call Set_LatchLed(.false.)
  109. !call Set_UnlatchLed(.false.)
  110. !call Set_Elevator(ELEVATOR_LATCH_STRING_BEGIN)
  111. return
  112. end if
  113. !OPERATION-CODE=60
  114. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  115. !Get_HookHeight() <= (HL + Get_NearFloorConnection() - ECG) .and.&
  116. Get_ElevatorPickup() == .false. .and.&
  117. Get_Slips() == SLIPS_SET_END .and.&
  118. !Get_Tong() /= TONG_MAKEUP_END .and.&
  119. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING) then
  120. call Set_ElevatorConnection(ELEVATOR_LATCH_STRING)
  121. !call Set_Elevator(ELEVATOR_NEUTRAL)
  122. return
  123. end if
  124. !OPERATION-CODE=49
  125. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  126. Get_ElevatorPickup() .and.&
  127. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) then
  128. call Set_ElevatorConnection(ELEVATOR_CONNECTION_STRING)
  129. return
  130. end if
  131. !OPERATION-CODE=10
  132. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  133. !GetRotaryRpm() == 0.0d0 .and.&
  134. (Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.&
  135. !Get_Swing() == SWING_WELL_END .and.&
  136. !Get_Slips() == SLIPS_SET_END .and.&
  137. !Get_UnlatchLed() .and.&
  138. Get_Elevator() == ELEVATOR_UNLATCH_STRING_END) then
  139. !call Log_4('OPERATION-CODE=10')
  140. call Set_ElevatorConnection(ELEVATOR_CONNECTION_NOTHING)
  141. call Set_Elevator(ELEVATOR_NEUTRAL)
  142. !call Set_UnlatchLed(.false.)
  143. !call Set_LatchLed(.true.)
  144. !call Set_Elevator(ELEVATOR_UNLATCH_STRING_BEGIN)
  145. return
  146. end if
  147. !OPERATION-CODE=11
  148. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  149. !Get_ElevatorConnectionPossible() .and.&
  150. Get_ElevatorPickup().and.&
  151. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  152. !Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  153. !Get_LatchLed() .and.&
  154. !Get_FillMouseHoleLed() .and.&
  155. Get_Elevator() == ELEVATOR_LATCH_SINGLE_END) then
  156. call Set_ElevatorConnection(ELEVATOR_CONNECTION_SINGLE)
  157. !call Set_UnlatchLed(.true.)
  158. call Set_FillMouseHoleLed(.false.)
  159. call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
  160. call Set_Elevator(ELEVATOR_NEUTRAL)
  161. !call Set_Elevator(ELEVATOR_LATCH_SINGLE_BEGIN)
  162. return
  163. end if
  164. !OPERATION-CODE=12
  165. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  166. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  167. !Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  168. !Get_UnlatchLed() .and.&
  169. !Get_FillMouseHoleLed() == .false. .and.&
  170. Get_Elevator() == ELEVATOR_UNLATCH_SINGLE_END) then
  171. !call Log_4('OPERATION-CODE=12')
  172. call Set_ElevatorConnection(ELEVATOR_CONNECTION_NOTHING)
  173. !call Set_UnlatchLed(.false.)
  174. !call Set_LatchLed(.true.)
  175. call Set_FillMouseHoleLed(.true.)
  176. call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
  177. call Set_Elevator(ELEVATOR_NEUTRAL)
  178. !call Set_Elevator(ELEVATOR_UNLATCH_SINGLE_BEGIN)
  179. return
  180. end if
  181. !OPERATION-CODE=13
  182. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  183. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%PL) .and.&
  184. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.&
  185. !Get_Swing() == SWING_WELL_END .and.&
  186. !Get_TongNotification() .and.&
  187. Get_ElevatorPickup().and.&
  188. Get_Tong() == TONG_BREAKOUT_END) then
  189. !call Log_4('OPERATION-CODE=13')
  190. call Set_ElevatorConnection(ELEVATOR_CONNECTION_SINGLE)
  191. call Set_StringUpdate(STRING_UPDATE_REMOVE_SINGLE)
  192. !call Set_StringUpdate(STRING_UPDATE_ADD_SINGLE)
  193. call Set_Tong(TONG_NEUTRAL)
  194. return
  195. end if
  196. !OPERATION-CODE=14
  197. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  198. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%PL) .and.&
  199. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  200. !Get_Swing() == SWING_WELL_END .and.&
  201. !Get_TongNotification() .and.&
  202. Get_ElevatorPickup().and.&
  203. Get_Tong() == TONG_MAKEUP_END) then
  204. !call Log_4('OPERATION-CODE=14')
  205. call Set_Tong(TONG_NEUTRAL)
  206. call Set_ElevatorConnection(ELEVATOR_CONNECTION_STRING)
  207. call Set_StringUpdate(STRING_UPDATE_ADD_SINGLE)
  208. return
  209. end if
  210. !OPERATION-CODE=15
  211. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  212. Get_HookHeight() >= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%SL - data%State%OperationScenario%LG) .and.&
  213. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG) .and.&
  214. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.&
  215. !Get_Swing() == SWING_WELL_END .and.&
  216. !Get_TongNotification() .and.&
  217. Get_ElevatorPickup().and.&
  218. Get_Tong() == TONG_BREAKOUT_END) then
  219. call Set_Tong(TONG_NEUTRAL)
  220. call Set_ElevatorConnection(ELEVATOR_CONNECTION_STAND)
  221. call Set_StringUpdate(STRING_UPDATE_REMOVE_STAND)
  222. return
  223. end if
  224. !OPERATION-CODE=16
  225. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  226. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG) .and.&
  227. !Get_JointConnectionPossible() .and.&
  228. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  229. !Get_Swing() == SWING_WELL_END .and.&
  230. !Get_TongNotification() .and.&
  231. Get_ElevatorPickup().and.&
  232. Get_Tong() == TONG_MAKEUP_END) then
  233. !call Log_4('OPERATION-CODE=16')
  234. call Set_Tong(TONG_NEUTRAL)
  235. call Set_ElevatorConnection(ELEVATOR_CONNECTION_STRING)
  236. call Set_StringUpdate(STRING_UPDATE_ADD_STAND)
  237. return
  238. end if
  239. !OPERATION-CODE=75
  240. if (Get_ElevatorPickup() == .false. .and.&
  241. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE) then
  242. call Set_ElevatorConnection(ELEVATOR_LATCH_SINGLE)
  243. return
  244. end if
  245. !OPERATION-CODE=76
  246. if (Get_ElevatorPickup() == .false. .and.&
  247. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND) then
  248. call Set_ElevatorConnection(ELEVATOR_LATCH_STAND)
  249. return
  250. end if
  251. endif
  252. end subroutine
  253. ! subroutine Subscribe_ElevatorConnection()
  254. ! use CDrillingConsoleVariables
  255. ! use ConfigurationVariables
  256. ! use ConfigurationVariables
  257. ! implicit none
  258. ! call OnLatchPipePress%Add(ButtonPress_Latch_ElevatorConnection)
  259. ! call OnUnlatchPipePress%Add(ButtonPress_Unlatch_ElevatorConnection)
  260. ! call OnBreakoutLeverPress%Add(ButtonPress_Breakout_ElevatorConnection)
  261. ! call OnMakeupLeverPress%Add(ButtonPress_Makeup_ElevatorConnection)
  262. ! end subroutine
  263. subroutine ButtonPress_Latch_ElevatorConnection()
  264. use CCommon, only: SetStandRack
  265. implicit none
  266. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  267. #ifdef OST
  268. print*, 'ButtonPress_Latch_ElevatorConnection=TopDrive'
  269. #endif
  270. !TOPDRIVE-CODE=73
  271. if ((Get_HookHeight() >= (TL() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + NFC()) .and. Get_HookHeight() <= (TL() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + NFC() + data%State%OperationScenario%TG)) .and.&
  272. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  273. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  274. Get_LatchLed()) then
  275. call Set_Elevator(ELEVATOR_LATCH_STAND_BEGIN)
  276. call Set_LatchLed(.false.)
  277. return
  278. end if
  279. !TOPDRIVE-CODE=74
  280. if (Get_HookHeight() <= (TL() + NFC() - data%State%OperationScenario%ECG) .and.&
  281. GetRotaryRpm() == 0.0d0 .and.&
  282. Get_ElevatorConnectionPossible() .and.&
  283. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  284. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  285. Get_LatchLed()) then
  286. call Set_Elevator(ELEVATOR_LATCH_STRING_BEGIN)
  287. call Set_LatchLed(.false.)
  288. return
  289. end if
  290. !TOPDRIVE-CODE=75
  291. if (Get_ElevatorConnectionPossible() .and.&
  292. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  293. Get_TdsSwing() == TDS_SWING_TILT_END .and.&
  294. Get_LatchLed() .and.&
  295. Get_FillMouseHoleLed()) then
  296. call Set_Elevator(ELEVATOR_LATCH_SINGLE_BEGIN)
  297. call Set_LatchLed(.false.)
  298. return
  299. end if
  300. endif
  301. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  302. #ifdef OST
  303. print*, 'ButtonPress_Latch_ElevatorConnection=Kelly'
  304. #endif
  305. !OPERATION-CODE=86
  306. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  307. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() - data%State%OperationScenario%ECG) .and.&
  308. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  309. Get_LatchLed() .and.&
  310. GetRotaryRpm() == 0.0d0 .and.&
  311. Get_Swing() == SWING_WELL_END .and.&
  312. Get_ElevatorConnectionPossible() .and.&
  313. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection())) then
  314. !call Log_4("OPERATION-CODE=ELEVATOR_LATCH_STRING_BEGIN")
  315. call Set_Elevator(ELEVATOR_LATCH_STRING_BEGIN)
  316. call Set_LatchLed(.false.)
  317. return
  318. endif
  319. !OPERATION-CODE=85
  320. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  321. Get_HookHeight() >= (data%State%OperationScenario%HL + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + Get_NearFloorConnection()) .and. Get_HookHeight() <= (data%State%OperationScenario%HL + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + Get_NearFloorConnection() + data%State%OperationScenario%LG) .and.&
  322. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  323. Get_LatchLed() .and.&
  324. Get_Swing() == SWING_WELL_END) then
  325. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL + RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG)
  326. call Set_Elevator(ELEVATOR_LATCH_STAND_BEGIN)
  327. call Set_LatchLed(.false.)
  328. return
  329. endif
  330. !OPERATION-CODE=87
  331. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  332. Get_ElevatorConnection() == ELEVATOR_CONNECTION_NOTHING .and.&
  333. Get_LatchLed() .and.&
  334. Get_FillMouseHoleLed() .and.&
  335. Get_ElevatorConnectionPossible() .and.&
  336. Get_Swing() == SWING_MOUSE_HOLE_END) then
  337. call Set_Elevator(ELEVATOR_LATCH_SINGLE_BEGIN)
  338. call Set_LatchLed(.false.)
  339. return
  340. endif
  341. endif
  342. end subroutine
  343. subroutine ButtonPress_Unlatch_ElevatorConnection()
  344. use CCommon, only: SetStandRack
  345. implicit none
  346. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  347. #ifdef OST
  348. print*, 'ButtonPress_Unlatch_ElevatorConnection=TopDrive'
  349. #endif
  350. !TOPDRIVE-CODE=76
  351. if ((Get_HookHeight() >= (TL() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + NFC()) .and. Get_HookHeight() <= (TL() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + NFC() + data%State%OperationScenario%TG)) .and.&
  352. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND .and.&
  353. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  354. Get_UnlatchLed()) then
  355. call Set_Elevator(ELEVATOR_UNLATCH_STAND_BEGIN)
  356. call Set_UnlatchLed(.false.)
  357. return
  358. end if
  359. !TOPDRIVE-CODE=77
  360. if (Get_HookHeight() <= (TL() + NFC() - data%State%OperationScenario%ECG) .and.&
  361. GetRotaryRpm() == 0.0d0 .and.&
  362. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  363. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING) .and.&
  364. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  365. Get_UnlatchLed()) then
  366. call Set_Elevator(ELEVATOR_UNLATCH_STRING_BEGIN)
  367. call Set_UnlatchLed(.false.)
  368. return
  369. end if
  370. !TOPDRIVE-CODE=78
  371. if ((Get_HookHeight() > TL() .and. Get_HookHeight() < (TL() + NFC() + data%State%OperationScenario%SG)) .and.&
  372. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE .and.&
  373. Get_TdsSwing() == TDS_SWING_TILT_END .and.&
  374. Get_UnlatchLed() .and.&
  375. Get_FillMouseHoleLed() == .false.) then
  376. call Set_Elevator(ELEVATOR_UNLATCH_SINGLE_BEGIN)
  377. call Set_UnlatchLed(.false.)
  378. return
  379. end if
  380. endif
  381. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  382. #ifdef OST
  383. print*, 'ButtonPress_Unlatch_ElevatorConnection=Kelly'
  384. #endif
  385. !OPERATION-CODE=89
  386. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  387. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() - data%State%OperationScenario%ECG) .and.&
  388. (Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .or. Get_ElevatorConnection() == ELEVATOR_LATCH_STRING) .and.&
  389. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection()) .and.&
  390. Get_UnlatchLed() .and.&
  391. GetRotaryRpm() == 0.0d0 .and.&
  392. Get_Swing() == SWING_WELL_END .and.&
  393. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0) then
  394. !Get_HookHeight() >= (HL + Get_NearFloorConnection() - 4.0) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() - 2.0)) then
  395. call Set_Elevator(ELEVATOR_UNLATCH_STRING_BEGIN)
  396. call Set_UnlatchLed(.false.)
  397. return
  398. endif
  399. !OPERATION-CODE=88
  400. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  401. Get_HookHeight() >= (data%State%OperationScenario%HL + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + Get_NearFloorConnection()) .and. Get_HookHeight() <= (data%State%OperationScenario%HL + data%State%OperationScenario%SL - data%State%OperationScenario%ECG + Get_NearFloorConnection() + data%State%OperationScenario%LG) .and.&
  402. !Get_HookHeight() >= (HL + Get_NearFloorConnection() + SL + RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + SL + LG)
  403. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  404. Get_UnlatchLed() .and.&
  405. Get_Swing() == SWING_WELL_END) then
  406. call Set_Elevator(ELEVATOR_UNLATCH_STAND_BEGIN)
  407. call Set_UnlatchLed(.false.)
  408. return
  409. endif
  410. !OPERATION-CODE=90
  411. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  412. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  413. Get_UnlatchLed() .and.&
  414. Get_HookHeight() >= data%State%OperationScenario%HL .and. Get_HookHeight() <= (data%State%OperationScenario%HL + Get_NearFloorConnection() + data%State%OperationScenario%SG) .and.&
  415. !Get_JointConnectionPossible() .and.&
  416. Get_Swing() == SWING_MOUSE_HOLE_END) then
  417. call Set_Elevator(ELEVATOR_UNLATCH_SINGLE_BEGIN)
  418. call Set_UnlatchLed(.false.)
  419. return
  420. endif
  421. endif
  422. end subroutine
  423. subroutine ButtonPress_Breakout_ElevatorConnection()
  424. implicit none
  425. end subroutine
  426. subroutine ButtonPress_Makeup_ElevatorConnection()
  427. implicit none
  428. end subroutine
  429. end module CElevatorConnectionEnum