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.

CTdsElevatorModesEnum.f90 12 KiB

1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. module CTdsElevatorModesEnum
  2. use OperationScenariosModule
  3. use UnityModule
  4. implicit none
  5. contains
  6. subroutine Evaluate_TdsElevatorModes()
  7. use CCommon, only: SetStandRack
  8. implicit none
  9. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  10. if(print_log) print*, 'Evaluate_TdsElevatorModes=TopDrive'
  11. !TOPDRIVE-CODE=7
  12. if (Get_Elevator() == ELEVATOR_LATCH_STRING_END .and.&
  13. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  14. Get_TdsSwing() == TDS_SWING_OFF_END ) then
  15. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_STRING)
  16. call Set_Elevator(ELEVATOR_NEUTRAL)
  17. return
  18. end if
  19. !TOPDRIVE-CODE=8
  20. if (Get_HookHeight() <= (TL() + TJH() - data%State%OperationScenario%ECG) .and.&
  21. Get_ElevatorPickup() == .false. .and.&
  22. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING) then
  23. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_STRING)
  24. return
  25. end if
  26. !TOPDRIVE-CODE=9
  27. if (Get_ElevatorPickup() .and.&
  28. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING) then
  29. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_STRING)
  30. return
  31. end if
  32. !TOPDRIVE-CODE=10
  33. if (Get_Elevator() == ELEVATOR_UNLATCH_STRING_END .and.&
  34. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING) then
  35. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_NOTHING)
  36. call Set_Elevator(ELEVATOR_NEUTRAL)
  37. return
  38. end if
  39. !TOPDRIVE-CODE=11
  40. if (Get_Elevator() == ELEVATOR_UNLATCH_STRING_END .and.&
  41. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .and.&
  42. Get_TdsConnectionModes() == TDS_CONNECTION_STRING) then
  43. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_NOTHING)
  44. call Set_Elevator(ELEVATOR_NEUTRAL)
  45. return
  46. end if
  47. !TOPDRIVE-CODE=12
  48. if (Get_Elevator() == ELEVATOR_LATCH_STAND_END .and.&
  49. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING) then
  50. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_STAND)
  51. call Set_Elevator(ELEVATOR_NEUTRAL)
  52. call SetStandRack(Get_StandRack() - 1)
  53. return
  54. end if
  55. !TOPDRIVE-CODE=13
  56. if (Get_Elevator() == ELEVATOR_UNLATCH_STAND_END .and.&
  57. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) then
  58. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_NOTHING)
  59. call Set_Elevator(ELEVATOR_NEUTRAL)
  60. call SetStandRack(Get_StandRack() + 1)
  61. return
  62. end if
  63. !TOPDRIVE-CODE=14
  64. if (Get_Elevator() == ELEVATOR_LATCH_SINGLE_END .and.&
  65. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_NOTHING .and.&
  66. Get_TdsSwing() == TDS_SWING_TILT_END .and.&
  67. Get_FillMouseHoleLed()) then
  68. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_SINGLE)
  69. call Set_Elevator(ELEVATOR_NEUTRAL)
  70. call Set_UnlatchLed(.true.)
  71. call Set_FillMouseHoleLed(.false.)
  72. call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
  73. return
  74. end if
  75. !TOPDRIVE-CODE=15
  76. if (Get_Elevator() == ELEVATOR_UNLATCH_SINGLE_END .and.&
  77. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE .and.&
  78. Get_TdsSwing() == TDS_SWING_TILT_END .and.&
  79. Get_FillMouseHoleLed() == .false.) then
  80. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_NOTHING)
  81. call Set_Elevator(ELEVATOR_NEUTRAL)
  82. call Set_UnlatchLed(.false.)
  83. call Set_FillMouseHoleLed(.true.)
  84. call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
  85. return
  86. end if
  87. !TOPDRIVE-CODE=16
  88. if (Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%PL - data%State%OperationScenario%ECG) .and.&
  89. Get_Tong() == TONG_BREAKOUT_END .and.&
  90. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .and.&
  91. Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then
  92. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_SINGLE)
  93. call Set_Tong(TONG_NEUTRAL)
  94. call Set_StringUpdate(STRING_UPDATE_REMOVE_SINGLE)
  95. return
  96. end if
  97. !TOPDRIVE-CODE=17
  98. if (Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%PL - data%State%OperationScenario%ECG) .and.&
  99. Get_Tong() == TONG_BREAKOUT_END .and.&
  100. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING .and.&
  101. Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then
  102. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_SINGLE)
  103. call Set_Tong(TONG_NEUTRAL)
  104. call Set_StringUpdate(STRING_UPDATE_REMOVE_SINGLE)
  105. return
  106. end if
  107. !TOPDRIVE-CODE=18
  108. if (Get_ElevatorPickup() .and.&
  109. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE) then
  110. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_SINGLE)
  111. return
  112. end if
  113. !TOPDRIVE-CODE=19
  114. if (Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%PL - data%State%OperationScenario%ECG) .and.&
  115. Get_ElevatorPickup() == .false. .and.&
  116. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) then
  117. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_SINGLE)
  118. return
  119. end if
  120. !TOPDRIVE-CODE=20
  121. if (Get_Tong() == TONG_MAKEUP_END .and.&
  122. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) then
  123. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_STRING)
  124. call Set_Tong(TONG_NEUTRAL)
  125. call Set_StringUpdate(STRING_UPDATE_ADD_SINGLE)
  126. return
  127. end if
  128. !TOPDRIVE-CODE=21
  129. if (Get_Tong() == TONG_MAKEUP_END .and.&
  130. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE) then
  131. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_STRING)
  132. call Set_Tong(TONG_NEUTRAL)
  133. call Set_StringUpdate(STRING_UPDATE_ADD_SINGLE)
  134. return
  135. end if
  136. !TOPDRIVE-CODE=22
  137. if (Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG) .and.&
  138. Get_Tong() == TONG_BREAKOUT_END .and.&
  139. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .and.&
  140. Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then
  141. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_STAND)
  142. call Set_Tong(TONG_NEUTRAL)
  143. call Set_StringUpdate(STRING_UPDATE_REMOVE_STAND)
  144. return
  145. end if
  146. !TOPDRIVE-CODE=23
  147. if (Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG) .and.&
  148. Get_Tong() == TONG_BREAKOUT_END .and.&
  149. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING .and.&
  150. Get_TdsConnectionModes() == TDS_CONNECTION_NOTHING) then
  151. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_STAND)
  152. call Set_Tong(TONG_NEUTRAL)
  153. call Set_StringUpdate(STRING_UPDATE_REMOVE_STAND)
  154. return
  155. end if
  156. !TOPDRIVE-CODE=24
  157. if (Get_ElevatorPickup() .and.&
  158. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND) then
  159. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_STAND)
  160. return
  161. end if
  162. !TOPDRIVE-CODE=25
  163. if (Get_HookHeight() <= (TL() + NFC() + data%State%OperationScenario%SL - data%State%OperationScenario%ECG) .and.&
  164. Get_ElevatorPickup() == .false. .and.&
  165. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) then
  166. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_STAND)
  167. return
  168. end if
  169. !TOPDRIVE-CODE=26
  170. if (Get_Tong() == TONG_MAKEUP_END .and.&
  171. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) then
  172. call Set_TdsElevatorModes(TDS_ELEVATOR_CONNECTION_STRING)
  173. call Set_Tong(TONG_NEUTRAL)
  174. call Set_StringUpdate(STRING_UPDATE_ADD_STAND)
  175. return
  176. end if
  177. !TOPDRIVE-CODE=27
  178. if (Get_Tong() == TONG_MAKEUP_END .and.&
  179. Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND) then
  180. call Set_TdsElevatorModes(TDS_ELEVATOR_LATCH_STRING)
  181. call Set_Tong(TONG_NEUTRAL)
  182. call Set_StringUpdate(STRING_UPDATE_ADD_STAND)
  183. return
  184. end if
  185. endif
  186. ! if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  187. ! if(print_log) print*, 'Evaluate_TdsElevatorModes=Kelly'
  188. ! endif
  189. end subroutine
  190. subroutine Subscribe_TdsElevatorModes()
  191. use CDrillingConsoleVariables
  192. use SimulationVariables
  193. use SimulationVariables
  194. implicit none
  195. end subroutine
  196. end module CTdsElevatorModesEnum