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.
 
 
 
 
 
 

247 lines
8.8 KiB

  1. module OperationScenariosModule
  2. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  3. !! Paseted From ....Variables.f90
  4. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  5. ! use OperationScenariosModule !
  6. ! use OperationScenariosModule !!CElevator...
  7. ! use COperationScenariosVariables
  8. use SimulationVariables
  9. use PermissionsModule
  10. use SoftwareInputsVariables
  11. use CUnityInputs
  12. use CUnityOutputs, only: GetRotaryRpm
  13. use UnitySignalVariables
  14. use UnitySignalsModule
  15. use PermissionsModule
  16. ! use CTdsElevatorModesEnumVariables !
  17. use CHoistingVariables
  18. use SimulationVariables
  19. use CTopDrivePanelVariables
  20. use SimulationVariables
  21. use NotificationModule
  22. use UnitySignalsModule !for CTdsConnectionModesEnum!!!!
  23. ! use CTdsTorqueWrenchLedNotificationVariables !
  24. contains
  25. ! moved from kellyConnectionEnum
  26. subroutine Set_KellyConnection(v)
  27. use CManifolds, Only: KellyConnected, KellyDisconnected
  28. implicit none
  29. integer , intent(in) :: v
  30. #ifdef ExcludeExtraChanges
  31. if(data%State%OperationScenario%KellyConnection == v) return
  32. #endif
  33. data%State%OperationScenario%KellyConnection = v
  34. if(data%State%OperationScenario%KellyConnection /= KELLY_CONNECTION_STRING) then
  35. call KellyDisconnected()
  36. else
  37. call KellyConnected()
  38. endif
  39. #ifdef deb
  40. print*, 'data%State%OperationScenario%KellyConnection=', data%State%OperationScenario%KellyConnection
  41. #endif
  42. !**call data%State%OperationScenario%OnKellyConnectionChange%RunAll()
  43. end subroutine
  44. integer function Get_KellyConnection()
  45. implicit none
  46. Get_KellyConnection = data%State%OperationScenario%KellyConnection
  47. end function
  48. subroutine Evaluate_KellyConnection()
  49. implicit none
  50. if (data%State%Hoisting%DriveType == TopDrive_DriveType) then
  51. #ifdef OST
  52. print*, 'Evaluate_KellyConnection=TopDrive'
  53. #endif
  54. endif
  55. if (data%State%Hoisting%DriveType == Kelly_DriveType) then
  56. #ifdef OST
  57. print*, 'Evaluate_KellyConnection=Kelly'
  58. #endif
  59. !!OPERATION-CODE=4
  60. !if (Get_OperationCondition() == OPERATION_DRILL .and.&
  61. ! Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  62. ! Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  63. ! Get_TongNotification() .and.&
  64. ! Get_FillMouseHoleLed() == .false. .and.&
  65. ! Get_Tong() == TONG_BREAKOUT_END) then
  66. !
  67. ! call Set_FillMouseHoleLed(.true.)
  68. ! return
  69. !end if
  70. !OPERATION-CODE=1
  71. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  72. !Get_JointConnectionPossible() .and.&
  73. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  74. Get_Swing() == SWING_WELL_END .and.&
  75. !Get_TongNotification() .and.&
  76. Get_Tong() == TONG_MAKEUP_END) then
  77. !call Log_4('KELLY_CONNECTION_STRING')
  78. call Set_Tong(TONG_NEUTRAL)
  79. call Set_KellyConnection(KELLY_CONNECTION_STRING)
  80. return
  81. end if
  82. !OPERATION-CODE=2
  83. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  84. Get_StringPressure() == 0 .and.&
  85. Get_HookHeight() <= (data%State%OperationScenario%HKL + Get_NearFloorConnection()) .and.&
  86. Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  87. Get_Swing() == SWING_WELL_END .and.&
  88. !Get_TongNotification() .and.&
  89. Get_Tong() == TONG_BREAKOUT_END) then
  90. call Set_Tong(TONG_NEUTRAL)
  91. call Set_KellyConnection(KELLY_CONNECTION_NOTHING)
  92. call Set_SwingLed(.true.)
  93. return
  94. end if
  95. !OPERATION-CODE=3
  96. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  97. !Get_JointConnectionPossible() .and.&
  98. Get_KellyConnection() == KELLY_CONNECTION_NOTHING .and.&
  99. Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  100. !Get_TongNotification() .and.&
  101. Get_FillMouseHoleLed() .and.&
  102. Get_Tong() == TONG_MAKEUP_END) then
  103. call Set_Tong(TONG_NEUTRAL)
  104. call Set_KellyConnection(KELLY_CONNECTION_SINGLE)
  105. call Set_SwingLed(.false.)
  106. call Set_FillMouseHoleLed(.false.)
  107. call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
  108. return
  109. end if
  110. !OPERATION-CODE=4
  111. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  112. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  113. Get_Swing() == SWING_MOUSE_HOLE_END .and.&
  114. !Get_TongNotification() .and.&
  115. Get_FillMouseHoleLed() == .false. .and.&
  116. Get_Tong() == TONG_BREAKOUT_END) then
  117. call Set_Tong(TONG_NEUTRAL)
  118. call Set_KellyConnection(KELLY_CONNECTION_NOTHING)
  119. call Set_FillMouseHoleLed(.true.)
  120. call Set_MouseHole(MOUSE_HOLE_NEUTRAL)
  121. return
  122. end if
  123. !OPERATION-CODE=5
  124. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  125. !Get_JointConnectionPossible() .and.&
  126. Get_KellyConnection() == KELLY_CONNECTION_SINGLE .and.&
  127. Get_Swing() == SWING_WELL_END .and.&
  128. !Get_TongNotification() .and.&
  129. Get_Tong() == TONG_MAKEUP_END) then
  130. call Set_Tong(TONG_NEUTRAL)
  131. call Set_KellyConnection(KELLY_CONNECTION_STRING)
  132. call Set_StringUpdate(STRING_UPDATE_ADD_SINGLE)
  133. call Set_SwingLed(.false.)
  134. return
  135. end if
  136. !OPERATION-CODE=6
  137. if (Get_OperationCondition() == OPERATION_DRILL .and.&
  138. Get_StringPressure() == 0 .and.&
  139. Get_HookHeight() > 70.0 .and.&
  140. Get_KellyConnection() == KELLY_CONNECTION_STRING .and.&
  141. !Get_TongNotification() .and.&
  142. Get_Swing() == SWING_WELL_END .and.&
  143. Get_Tong() == TONG_BREAKOUT_END) then
  144. call Set_Tong(TONG_NEUTRAL)
  145. call Set_KellyConnection(KELLY_CONNECTION_SINGLE)
  146. call Set_StringUpdate(STRING_UPDATE_REMOVE_SINGLE)
  147. return
  148. end if
  149. endif
  150. end subroutine
  151. ! subroutine Subscribe_KellyConnection()
  152. ! use CDrillingConsoleVariables
  153. ! use ConfigurationVariables
  154. ! use ConfigurationVariables
  155. ! implicit none
  156. ! call OnBreakoutLeverPress%Add(ButtonPress_Breakout)
  157. ! call OnMakeupLeverPress%Add(ButtonPress_Makeup)
  158. ! end subroutine
  159. subroutine ButtonPress_Breakout()
  160. implicit none
  161. #ifdef deb
  162. print*, 'ButtonPress_Breakout on ======> CKellyConnectionEnum'
  163. #endif
  164. end subroutine
  165. subroutine ButtonPress_Makeup()
  166. implicit none
  167. #ifdef deb
  168. print*, 'ButtonPress_Makeup on ======> CKellyConnectionEnum'
  169. #endif
  170. end subroutine
  171. subroutine Set_StringUpdate(v)
  172. implicit none
  173. integer , intent(in) :: v
  174. #ifdef ExcludeExtraChanges
  175. if(data%State%OperationScenario%StringUpdate == v) return
  176. #endif
  177. data%State%OperationScenario%StringUpdate = v
  178. !**call data%State%OperationScenario%OnStringUpdateChange%RunAll(v)
  179. end subroutine
  180. integer function Get_StringUpdate()
  181. implicit none
  182. Get_StringUpdate = data%State%OperationScenario%StringUpdate
  183. end function
  184. real(8) function TJH()
  185. use TD_DrillStemComponents
  186. implicit none
  187. TJH = data%State%TD_String%TopJointHeight
  188. end function
  189. real function TL()
  190. implicit none
  191. TL = 26.97
  192. end function
  193. real function NFC()
  194. implicit none
  195. NFC = Get_NearFloorConnection()
  196. end function
  197. subroutine Set_ElevatorConnection(v)
  198. implicit none
  199. integer , intent(in) :: v
  200. #ifdef ExcludeExtraChanges
  201. if(data%State%OperationScenario%ElevatorConnection == v) return
  202. #endif
  203. data%State%OperationScenario%ElevatorConnection = v
  204. #ifdef deb
  205. print*, 'data%State%OperationScenario%ElevatorConnection=', data%State%OperationScenario%ElevatorConnection
  206. #endif
  207. !**call data%State%OperationScenario%OnElevatorConnectionChange%RunAll()
  208. end subroutine
  209. integer function Get_ElevatorConnection()
  210. implicit none
  211. Get_ElevatorConnection = data%State%OperationScenario%ElevatorConnection
  212. end function
  213. end module OperationScenariosModule