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
11 KiB

  1. # 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Notifications/CTongNotification.f90"
  2. module CTongNotification
  3. use OperationScenariosModule
  4. implicit none
  5. contains
  6. subroutine Evaluate_TongNotification()
  7. implicit none
  8. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  9. # 16
  10. !TOPDRIVE-CODE=50
  11. 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.&
  12. (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.&
  13. GetRotaryRpm() == 0.0d0 .and.&
  14. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  15. ((Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  16. Get_Tong() /= TONG_MAKEUP_BEGIN) .or.&
  17. Get_Tong() == TONG_NEUTRAL ) .and.&
  18. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STRING .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STRING) .and.&
  19. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  20. Get_Slips() == SLIPS_SET_END) then
  21. call Set_TongNotification(.true.)
  22. return
  23. end if
  24. !TOPDRIVE-CODE=51
  25. if (GetRotaryRpm() == 0.0d0 .and.&
  26. Get_JointConnectionPossible() .and.&
  27. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  28. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  29. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_SINGLE .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_SINGLE) .and.&
  30. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  31. Get_Slips() == SLIPS_SET_END) then
  32. call Set_TongNotification(.true.)
  33. return
  34. end if
  35. !TOPDRIVE-CODE=52
  36. if (GetRotaryRpm() == 0.0d0 .and.&
  37. Get_JointConnectionPossible() .and.&
  38. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  39. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  40. (Get_TdsElevatorModes() == TDS_ELEVATOR_LATCH_STAND .or. Get_TdsElevatorModes() == TDS_ELEVATOR_CONNECTION_STAND) .and.&
  41. Get_TdsSwing() == TDS_SWING_OFF_END .and.&
  42. Get_Slips() == SLIPS_SET_END) then
  43. call Set_TongNotification(.true.)
  44. return
  45. end if
  46. endif
  47. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  48. # 92
  49. !OPERATION-CODE=44
  50. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  51. !((Get_HookHeight() >= 65.0 .and. Get_HookHeight() <= 70.0) .or.&
  52. ! (Get_HookHeight() >= 96.0 .and. Get_HookHeight() <= 101.0)).and.&
  53. ((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.&
  54. (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.&
  55. GetRotaryRpm() == 0.0d0 .and.&
  56. Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  57. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  58. Get_Swing() == SWING_WELL_END .and.&
  59. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  60. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  61. Get_Slips() == SLIPS_SET_END) then
  62. call Set_TongNotification(.true.)
  63. return
  64. end if
  65. !OPERATION-CODE=45
  66. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  67. Get_HookHeight() >= 66 .and. Get_HookHeight() <= 69 .and.&
  68. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  69. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  70. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  71. Get_Swing() == SWING_MOUSE_HOLE_END) then
  72. call Set_TongNotification(.true.)
  73. return
  74. end if
  75. !OPERATION-CODE=46
  76. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  77. Get_JointConnectionPossible() .and.&
  78. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  79. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  80. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  81. Get_Swing() == SWING_MOUSE_HOLE_END) then
  82. call Set_TongNotification(.true.)
  83. return
  84. end if
  85. !OPERATION-CODE=47
  86. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  87. GetRotaryRpm() == 0.0d0 .and.&
  88. Get_JointConnectionPossible() .and.&
  89. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  90. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  91. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  92. Get_Swing() == SWING_WELL_END .and.&
  93. Get_Slips() == SLIPS_SET_END) then
  94. call Set_TongNotification(.true.)
  95. return
  96. end if
  97. !OPERATION-CODE=48
  98. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  99. GetRotaryRpm() == 0.0d0 .and.&
  100. Get_JointConnectionPossible() .and.&
  101. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  102. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  103. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  104. Get_Swing() == SWING_WELL_END .and.&
  105. Get_Slips() == SLIPS_SET_END) then
  106. call Set_TongNotification(.true.)
  107. return
  108. end if
  109. !OPERATION-CODE=50
  110. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  111. ((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.&
  112. (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.&
  113. Get_NearFloorConnection() >= 3.0 .and. Get_NearFloorConnection() <= 6.0 .and.&
  114. GetRotaryRpm() == 0.0d0 .and.&
  115. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STRING .and.&
  116. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  117. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  118. Get_Swing() == SWING_WELL_END .and.&
  119. Get_Slips() == SLIPS_SET_END) then
  120. call Set_TongNotification(.true.)
  121. return
  122. end if
  123. !OPERATION-CODE=51
  124. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  125. GetRotaryRpm() == 0.0d0 .and.&
  126. Get_JointConnectionPossible() .and.&
  127. Get_ElevatorConnection() == ELEVATOR_CONNECTION_SINGLE .and.&
  128. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  129. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  130. Get_Swing() == SWING_WELL_END .and.&
  131. Get_Slips() == SLIPS_SET_END) then
  132. call Set_TongNotification(.true.)
  133. return
  134. end if
  135. !OPERATION-CODE=52
  136. if (Get_OperationCondition() == OPERATION_TRIP .and.&
  137. GetRotaryRpm() == 0.0d0 .and.&
  138. Get_JointConnectionPossible() .and.&
  139. Get_ElevatorConnection() == ELEVATOR_CONNECTION_STAND .and.&
  140. (Get_Tong() /= TONG_BREAKOUT_BEGIN .and.&
  141. Get_Tong() /= TONG_MAKEUP_BEGIN) .and.&
  142. Get_Swing() == SWING_WELL_END .and.&
  143. Get_Slips() == SLIPS_SET_END) then
  144. call Set_TongNotification(.true.)
  145. return
  146. end if
  147. !if (Get_OperationCondition() == OPERATION_DRILL .and.&
  148. ! Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  149. ! Get_Swing() == SWING_WELL_END .and.&
  150. ! Get_Slips() == SLIPS_SET_END) then
  151. !
  152. ! call Set_TongNotification(.true.)
  153. ! return
  154. !end if
  155. !
  156. call Set_TongNotification(.false.)
  157. endif
  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