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.
 
 
 
 
 
 

330 lines
11 KiB

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