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.

OperationScenarios.i90 8.5 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. # 1 "/home/admin/SimulationCore2/CSharp/OperationScenarios/Common/OperationScenarios.f90"
  2. module OperationScenariosModule
  3. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. !! Paseted From ....Variables.f90
  5. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  6. ! use OperationScenariosModule !
  7. ! use OperationScenariosModule !!CElevator...
  8. ! use COperationScenariosVariables
  9. use SimulationVariables
  10. use PermissionsModule
  11. ! use SoftwareInputsVariables
  12. ! use CUnityInputs
  13. use UnityModule
  14. use UnitySignalVariables
  15. use UnitySignalsModule
  16. use PermissionsModule
  17. ! use CTdsElevatorModesEnumVariables !
  18. use CHoistingVariables
  19. use CTopDrivePanelVariables
  20. use NotificationModule
  21. use SoftwareInputsModule
  22. contains
  23. subroutine OperationScenariosToJson(parent)
  24. type(json_value),pointer :: parent
  25. type(json_core) :: json
  26. type(json_value),pointer :: p
  27. ! 1. create new node
  28. call json%create_object(p,'OperationScenarios')
  29. ! 2. add member of data type to new node
  30. call json%add(p,"ElevatorConnection",data%State%OperationScenario%ElevatorConnection)
  31. call json%add(p,"StringUpdate",data%State%OperationScenario%StringUpdate)
  32. call json%add(p,"KellyConnection",data%State%OperationScenario%KellyConnection)
  33. ! 3. add new node to parent
  34. call json%add(parent,p)
  35. end subroutine
  36. ! moved from kellyConnectionEnum
  37. subroutine Set_KellyConnection(v)
  38. use CManifolds, Only: KellyConnected, KellyDisconnected
  39. implicit none
  40. integer , intent(in) :: v
  41. #ifdef ExcludeExtraChanges
  42. if(data%State%OperationScenario%KellyConnection == v) return
  43. #endif
  44. data%State%OperationScenario%KellyConnection = v
  45. if(data%State%OperationScenario%KellyConnection /= KELLY_CONNECTION_STRING) then
  46. call KellyDisconnected()
  47. else
  48. call KellyConnected()
  49. endif
  50. #ifdef deb
  51. print*, 'data%State%OperationScenario%KellyConnection=', data%State%OperationScenario%KellyConnection
  52. #endif
  53. !**call data%State%OperationScenario%OnKellyConnectionChange%RunAll()
  54. end subroutine
  55. integer function Get_KellyConnection()
  56. implicit none
  57. Get_KellyConnection = data%State%OperationScenario%KellyConnection
  58. end function
  59. subroutine Evaluate_KellyConnection()
  60. implicit none
  61. if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
  62. #ifdef OST
  63. print*, 'Evaluate_KellyConnection=TopDrive'
  64. #endif
  65. endif
  66. if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
  67. #ifdef OST
  68. print*, 'Evaluate_KellyConnection=Kelly'
  69. #endif
  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. # 187
  162. end subroutine
  163. subroutine ButtonPress_Makeup()
  164. implicit none
  165. # 194
  166. end subroutine
  167. subroutine Set_StringUpdate(v)
  168. implicit none
  169. integer , intent(in) :: v
  170. #ifdef ExcludeExtraChanges
  171. if(data%State%OperationScenario%StringUpdate == v) return
  172. #endif
  173. data%State%OperationScenario%StringUpdate = v
  174. !**call data%State%OperationScenario%OnStringUpdateChange%RunAll(v)
  175. end subroutine
  176. integer function Get_StringUpdate()
  177. implicit none
  178. Get_StringUpdate = data%State%OperationScenario%StringUpdate
  179. end function
  180. real(8) function TJH()
  181. use TD_DrillStemComponents
  182. implicit none
  183. TJH = data%State%TD_String%TopJointHeight
  184. end function
  185. real function TL()
  186. implicit none
  187. TL = 26.97
  188. end function
  189. real function NFC()
  190. implicit none
  191. NFC = Get_NearFloorConnection()
  192. end function
  193. subroutine Set_ElevatorConnection(v)
  194. implicit none
  195. integer , intent(in) :: v
  196. #ifdef ExcludeExtraChanges
  197. if(data%State%OperationScenario%ElevatorConnection == v) return
  198. #endif
  199. data%State%OperationScenario%ElevatorConnection = v
  200. #ifdef deb
  201. print*, 'data%State%OperationScenario%ElevatorConnection=', data%State%OperationScenario%ElevatorConnection
  202. #endif
  203. !**call data%State%OperationScenario%OnElevatorConnectionChange%RunAll()
  204. end subroutine
  205. integer function Get_ElevatorConnection()
  206. implicit none
  207. Get_ElevatorConnection = data%State%OperationScenario%ElevatorConnection
  208. end function
  209. end module OperationScenariosModule