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.
 
 
 
 
 
 

333 lines
12 KiB

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