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.
 
 
 
 
 
 

287 lines
10 KiB

  1. module CTongNotification
  2. use COperationScenariosVariables
  3. implicit none
  4. contains
  5. subroutine Evaluate_TongNotification()
  6. implicit none
  7. if (DriveType == TopDrive_DriveType) then
  8. #ifdef OST
  9. print*, 'Evaluate_TongNotification=TopDrive'
  10. #endif
  11. !TOPDRIVE-CODE=50
  12. if (((Get_HookHeight() >= (TL() + PL - ECG + NFC() - RE) .and. Get_HookHeight() <= (TL() + NFC() + PL - ECG + TG)) .or.&
  13. (Get_HookHeight() >= (TL() + SL - ECG + NFC() - RE) .and. Get_HookHeight() <= (TL() + NFC() + SL - ECG + TG))).and.&
  14. GetRotaryRpm() == 0.0d0 .and.&
  15. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  16. ((Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  17. Get_Tong() /= TONG_MAKEUP_BEGIN) .or.&
  18. Get_Tong() == TONG_NEUTRAL ) .and.&
  19. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING) .and.&
  20. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  21. Get_Slips() == SLIPS_SET_END) then
  22. call Set_TongNotification(.true.)
  23. return
  24. end if
  25. !TOPDRIVE-CODE=51
  26. if (GetRotaryRpm() == 0.0d0 .and.&
  27. Get_JointConnectionPossible() .and.&
  28. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  29. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  30. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) .and.&
  31. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  32. Get_Slips() == SLIPS_SET_END) then
  33. call Set_TongNotification(.true.)
  34. return
  35. end if
  36. !TOPDRIVE-CODE=52
  37. if (GetRotaryRpm() == 0.0d0 .and.&
  38. Get_JointConnectionPossible() .and.&
  39. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  40. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  41. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) .and.&
  42. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  43. Get_Slips() == SLIPS_SET_END) then
  44. call Set_TongNotification(.true.)
  45. return
  46. end if
  47. endif
  48. if (DriveType == Kelly_DriveType) then
  49. #ifdef OST
  50. print*, 'Evaluate_TongNotification=Kelly'
  51. #endif
  52. !OPERATION-CODE=44
  53. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  54. !((Get_HookHeight() >= 65.0 .and. Get_HookHeight() <= 70.0) .or.&
  55. ! (Get_HookHeight() >= 96.0 .and. Get_HookHeight() <= 101.0)).and.&
  56. ((Get_HookHeight() >= (HKL + Get_NearFloorConnection() - RE) .and. Get_HookHeight() <= (HKL + Get_NearFloorConnection() + TG)) .or.&
  57. (Get_HookHeight() >= (HKL + Get_NearFloorConnection() + PL -RE) .and. Get_HookHeight() <= (HKL + Get_NearFloorConnection() + TG + PL))).and.&
  58. GetRotaryRpm() == 0.0d0 .and.&
  59. Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  60. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  61. Get_Swing() == SWING_WELL_END .and.&
  62. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  63. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  64. Get_Slips() == SLIPS_SET_END) then
  65. call Set_TongNotification(.true.)
  66. return
  67. end if
  68. !OPERATION-CODE=45
  69. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  70. Get_HookHeight() >= 66 .and. Get_HookHeight() <= 69 .and.&
  71. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  72. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  73. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  74. Get_Swing() == SWING_MOUSE_HOLE_END) then
  75. call Set_TongNotification(.true.)
  76. return
  77. end if
  78. !OPERATION-CODE=46
  79. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  80. Get_JointConnectionPossible() .and.&
  81. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  82. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  83. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  84. Get_Swing() == SWING_MOUSE_HOLE_END) then
  85. call Set_TongNotification(.true.)
  86. return
  87. end if
  88. !OPERATION-CODE=47
  89. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  90. GetRotaryRpm() == 0.0d0 .and.&
  91. Get_JointConnectionPossible() .and.&
  92. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  93. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  94. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  95. Get_Swing() == SWING_WELL_END .and.&
  96. Get_Slips() == SLIPS_SET_END) then
  97. call Set_TongNotification(.true.)
  98. return
  99. end if
  100. !OPERATION-CODE=48
  101. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  102. GetRotaryRpm() == 0.0d0 .and.&
  103. Get_JointConnectionPossible() .and.&
  104. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  105. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  106. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  107. Get_Swing() == SWING_WELL_END .and.&
  108. Get_Slips() == SLIPS_SET_END) then
  109. call Set_TongNotification(.true.)
  110. return
  111. end if
  112. !OPERATION-CODE=50
  113. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  114. ((Get_HookHeight() >= (HL + PL - ECG + Get_NearFloorConnection() - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + PL - ECG + TG)) .or.&
  115. (Get_HookHeight() >= (HL + SL - ECG + Get_NearFloorConnection() - RE) .and. Get_HookHeight() <= (HL + Get_NearFloorConnection() + TG - ECG + SL))).and.&
  116. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  117. GetRotaryRpm() == 0.0d0 .and.&
  118. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.&
  119. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  120. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  121. Get_Swing() == SWING_WELL_END .and.&
  122. Get_Slips() == SLIPS_SET_END) then
  123. call Set_TongNotification(.true.)
  124. return
  125. end if
  126. !OPERATION-CODE=51
  127. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  128. GetRotaryRpm() == 0.0d0 .and.&
  129. Get_JointConnectionPossible() .and.&
  130. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  131. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  132. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  133. Get_Swing() == SWING_WELL_END .and.&
  134. Get_Slips() == SLIPS_SET_END) then
  135. call Set_TongNotification(.true.)
  136. return
  137. end if
  138. !OPERATION-CODE=52
  139. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  140. GetRotaryRpm() == 0.0d0 .and.&
  141. Get_JointConnectionPossible() .and.&
  142. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  143. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  144. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  145. Get_Swing() == SWING_WELL_END .and.&
  146. Get_Slips() == SLIPS_SET_END) then
  147. call Set_TongNotification(.true.)
  148. return
  149. end if
  150. !if (Get_OperationCondition() == OPERATION_DRILL .and.&
  151. ! Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  152. ! Get_Swing() == SWING_WELL_END .and.&
  153. ! Get_Slips() == SLIPS_SET_END) then
  154. !
  155. ! call Set_TongNotification(.true.)
  156. ! return
  157. !end if
  158. !
  159. call Set_TongNotification(.false.)
  160. endif
  161. end subroutine
  162. subroutine Subscribe_TongNotification()
  163. implicit none
  164. call OnOperationConditionChange%Add(Evaluate_TongNotification)
  165. call OnHookHeightChange%Add(Evaluate_TongNotification)
  166. call OnJointConnectionPossibleChange%Add(Evaluate_TongNotification)
  167. call OnSingleSetInMouseHoleChange%Add(Evaluate_TongNotification)
  168. call OnElevatorConnectionChange%Add(Evaluate_TongNotification)
  169. call OnKellyConnectionChange%Add(Evaluate_TongNotification)
  170. call OnSwingChange%Add(Evaluate_TongNotification)
  171. call OnSlipsChange%Add(Evaluate_TongNotification)
  172. end subroutine
  173. end module CTongNotification