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.
 
 
 
 
 
 

206 lines
11 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. ! if(print_log) print*, 'Evaluate_TongNotification=Kelly'
  48. !OPERATION-CODE=44
  49. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  50. !((Get_HookHeight() >= 65.0 .and. Get_HookHeight() <= 70.0) .or.&
  51. ! (Get_HookHeight() >= 96.0 .and. Get_HookHeight() <= 101.0)).and.&
  52. ((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.&
  53. (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.&
  54. GetRotaryRpm() == 0.0d0 .and.&
  55. Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  56. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  57. Get_Swing() == SWING_WELL_END .and.&
  58. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  59. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  60. Get_Slips() == SLIPS_SET_END) then
  61. call Set_TongNotification(.true.)
  62. return
  63. end if
  64. !OPERATION-CODE=45
  65. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  66. Get_HookHeight() >= 66 .and. Get_HookHeight() <= 69 .and.&
  67. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  68. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  69. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  70. Get_Swing() == SWING_MOUSE_HOLE_END) then
  71. call Set_TongNotification(.true.)
  72. return
  73. end if
  74. !OPERATION-CODE=46
  75. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  76. Get_JointConnectionPossible() .and.&
  77. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  78. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  79. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  80. Get_Swing() == SWING_MOUSE_HOLE_END) then
  81. call Set_TongNotification(.true.)
  82. return
  83. end if
  84. !OPERATION-CODE=47
  85. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  86. GetRotaryRpm() == 0.0d0 .and.&
  87. Get_JointConnectionPossible() .and.&
  88. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  89. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  90. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  91. Get_Swing() == SWING_WELL_END .and.&
  92. Get_Slips() == SLIPS_SET_END) then
  93. call Set_TongNotification(.true.)
  94. return
  95. end if
  96. !OPERATION-CODE=48
  97. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  98. GetRotaryRpm() == 0.0d0 .and.&
  99. Get_JointConnectionPossible() .and.&
  100. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  101. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  102. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  103. Get_Swing() == SWING_WELL_END .and.&
  104. Get_Slips() == SLIPS_SET_END) then
  105. call Set_TongNotification(.true.)
  106. return
  107. end if
  108. !OPERATION-CODE=50
  109. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  110. ((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.&
  111. (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.&
  112. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  113. GetRotaryRpm() == 0.0d0 .and.&
  114. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.&
  115. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  116. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  117. Get_Swing() == SWING_WELL_END .and.&
  118. Get_Slips() == SLIPS_SET_END) then
  119. call Set_TongNotification(.true.)
  120. return
  121. end if
  122. !OPERATION-CODE=51
  123. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  124. GetRotaryRpm() == 0.0d0 .and.&
  125. Get_JointConnectionPossible() .and.&
  126. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  127. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  128. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  129. Get_Swing() == SWING_WELL_END .and.&
  130. Get_Slips() == SLIPS_SET_END) then
  131. call Set_TongNotification(.true.)
  132. return
  133. end if
  134. !OPERATION-CODE=52
  135. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  136. GetRotaryRpm() == 0.0d0 .and.&
  137. Get_JointConnectionPossible() .and.&
  138. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  139. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  140. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  141. Get_Swing() == SWING_WELL_END .and.&
  142. Get_Slips() == SLIPS_SET_END) then
  143. call Set_TongNotification(.true.)
  144. return
  145. end if
  146. !if (Get_OperationCondition() == OPERATION_DRILL .and.&
  147. ! Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  148. ! Get_Swing() == SWING_WELL_END .and.&
  149. ! Get_Slips() == SLIPS_SET_END) then
  150. !
  151. ! call Set_TongNotification(.true.)
  152. ! return
  153. !end if
  154. !
  155. call Set_TongNotification(.false.)
  156. endif
  157. call Set_TongNotification(.true.)
  158. end subroutine
  159. ! subroutine Subscribe_TongNotification()
  160. ! implicit none
  161. ! call data%State%unitySignals%OnOperationConditionChange%Add(Evaluate_TongNotification)
  162. ! ! call softwareInputs%OnHookHeightChange%Add(Evaluate_TongNotification)
  163. ! call data%Equipments%UnityInputs%OnJointConnectionPossibleChange%Add(Evaluate_TongNotification)
  164. ! call data%Equipments%UnityInputs%OnSingleSetInMouseHoleChange%Add(Evaluate_TongNotification)
  165. ! call data%State%OperationScenario%OnElevatorConnectionChange%Add(Evaluate_TongNotification)
  166. ! call KellyConnectionEnum%OnKellyConnectionChange%Add(Evaluate_TongNotification)
  167. ! call data%State%unitySignals%OnSwingChange%Add(Evaluate_TongNotification)
  168. ! call data%State%unitySignals%OnSlipsChange%Add(Evaluate_TongNotification)
  169. ! end subroutine
  170. end module CTongNotification