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.
 
 
 
 
 
 

262 lines
12 KiB

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