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.
 
 
 
 
 
 

252 lines
20 KiB

  1. module CChokeProblems
  2. use SimulationVariables
  3. implicit none
  4. public
  5. contains
  6. subroutine ChokeProblemsToJson(parent)
  7. type(json_value),pointer :: parent
  8. type(json_core) :: json
  9. type(json_value),pointer :: p
  10. ! 1. create new node
  11. call json%create_object(p,'ChokeProblems')
  12. ! 2. add member of data type to new node
  13. call ProblemToJson(p,"HydraulicChoke1Plugged",data%problems%ChokeProblems%HydraulicChoke1Plugged)
  14. call ProblemToJson(p,"HydraulicChoke1Fail",data%problems%ChokeProblems%HydraulicChoke1Fail)
  15. call ProblemToJson(p,"HydraulicChoke1Washout",data%problems%ChokeProblems%HydraulicChoke1Washout)
  16. call ProblemToJson(p,"HydraulicChoke2Plugged",data%problems%ChokeProblems%HydraulicChoke2Plugged)
  17. call ProblemToJson(p,"HydraulicChoke2Fail",data%problems%ChokeProblems%HydraulicChoke2Fail)
  18. call ProblemToJson(p,"HydraulicChoke2Washout",data%problems%ChokeProblems%HydraulicChoke2Washout)
  19. call ProblemToJson(p,"ManualChoke1Plugged",data%problems%ChokeProblems%ManualChoke1Plugged)
  20. call ProblemToJson(p,"ManualChoke1Fail",data%problems%ChokeProblems%ManualChoke1Fail)
  21. call ProblemToJson(p,"ManualChoke1Washout",data%problems%ChokeProblems%ManualChoke1Washout)
  22. call ProblemToJson(p,"ManualChoke2Plugged",data%problems%ChokeProblems%ManualChoke2Plugged)
  23. call ProblemToJson(p,"ManualChoke2Fail",data%problems%ChokeProblems%ManualChoke2Fail)
  24. call ProblemToJson(p,"ManualChoke2Washout",data%problems%ChokeProblems%ManualChoke2Washout)
  25. call ProblemToJson(p,"ChokePanelAirFail",data%problems%ChokeProblems%ChokePanelAirFail)
  26. ! 3. add new node to parent
  27. call json%add(parent,p)
  28. end subroutine
  29. subroutine ProcessChokeProblemsDueTime(time)
  30. implicit none
  31. integer :: time
  32. if(data%problems%ChokeProblems%HydraulicChoke1Plugged%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%HydraulicChoke1Plugged, ChangeHydraulicChoke1Plugged, time)
  33. if(data%problems%ChokeProblems%HydraulicChoke1Fail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%HydraulicChoke1Fail, ChangeHydraulicChoke1Fail, time)
  34. if(data%problems%ChokeProblems%HydraulicChoke1Washout%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%HydraulicChoke1Washout, ChangeHydraulicChoke1Washout, time)
  35. if(data%problems%ChokeProblems%HydraulicChoke2Plugged%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%HydraulicChoke2Plugged, ChangeHydraulicChoke2Plugged, time)
  36. if(data%problems%ChokeProblems%HydraulicChoke2Fail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%HydraulicChoke2Fail, ChangeHydraulicChoke2Fail, time)
  37. if(data%problems%ChokeProblems%HydraulicChoke2Washout%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%HydraulicChoke2Washout, ChangeHydraulicChoke2Washout, time)
  38. if(data%problems%ChokeProblems%ManualChoke1Plugged%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ManualChoke1Plugged, ChangeManualChoke1Plugged, time)
  39. if(data%problems%ChokeProblems%ManualChoke1Fail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ManualChoke1Fail, ChangeManualChoke1Fail, time)
  40. if(data%problems%ChokeProblems%ManualChoke1Washout%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ManualChoke1Washout, ChangeManualChoke1Washout, time)
  41. if(data%problems%ChokeProblems%ManualChoke2Plugged%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ManualChoke2Plugged, ChangeManualChoke2Plugged, time)
  42. if(data%problems%ChokeProblems%ManualChoke2Fail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ManualChoke2Fail, ChangeManualChoke2Fail, time)
  43. if(data%problems%ChokeProblems%ManualChoke2Washout%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ManualChoke2Washout, ChangeManualChoke2Washout, time)
  44. if(data%problems%ChokeProblems%ChokePanelAirFail%ProblemType == Time_ProblemType) call ProcessDueTime(data%problems%ChokeProblems%ChokePanelAirFail, ChangeChokePanelAirFail, time)
  45. end subroutine
  46. subroutine ProcessChokeProblemsDuePumpStrokes(strokes)
  47. implicit none
  48. integer :: strokes
  49. if(data%problems%ChokeProblems%HydraulicChoke1Plugged%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%HydraulicChoke1Plugged, ChangeHydraulicChoke1Plugged, strokes)
  50. if(data%problems%ChokeProblems%HydraulicChoke1Fail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%HydraulicChoke1Fail, ChangeHydraulicChoke1Fail, strokes)
  51. if(data%problems%ChokeProblems%HydraulicChoke1Washout%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%HydraulicChoke1Washout, ChangeHydraulicChoke1Washout, strokes)
  52. if(data%problems%ChokeProblems%HydraulicChoke2Plugged%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%HydraulicChoke2Plugged, ChangeHydraulicChoke2Plugged, strokes)
  53. if(data%problems%ChokeProblems%HydraulicChoke2Fail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%HydraulicChoke2Fail, ChangeHydraulicChoke2Fail, strokes)
  54. if(data%problems%ChokeProblems%HydraulicChoke2Washout%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%HydraulicChoke2Washout, ChangeHydraulicChoke2Washout, strokes)
  55. if(data%problems%ChokeProblems%ManualChoke1Plugged%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ManualChoke1Plugged, ChangeManualChoke1Plugged, strokes)
  56. if(data%problems%ChokeProblems%ManualChoke1Fail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ManualChoke1Fail, ChangeManualChoke1Fail, strokes)
  57. if(data%problems%ChokeProblems%ManualChoke1Washout%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ManualChoke1Washout, ChangeManualChoke1Washout, strokes)
  58. if(data%problems%ChokeProblems%ManualChoke2Plugged%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ManualChoke2Plugged, ChangeManualChoke2Plugged, strokes)
  59. if(data%problems%ChokeProblems%ManualChoke2Fail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ManualChoke2Fail, ChangeManualChoke2Fail, strokes)
  60. if(data%problems%ChokeProblems%ManualChoke2Washout%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ManualChoke2Washout, ChangeManualChoke2Washout, strokes)
  61. if(data%problems%ChokeProblems%ChokePanelAirFail%ProblemType == PumpStrokes_ProblemType) call ProcessDuePumpStrokes(data%problems%ChokeProblems%ChokePanelAirFail, ChangeChokePanelAirFail, strokes)
  62. end subroutine
  63. subroutine ProcessChokeProblemsDueVolumePumped(volume)
  64. implicit none
  65. real(8) :: volume
  66. if(data%problems%ChokeProblems%HydraulicChoke1Plugged%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%HydraulicChoke1Plugged, ChangeHydraulicChoke1Plugged, volume)
  67. if(data%problems%ChokeProblems%HydraulicChoke1Fail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%HydraulicChoke1Fail, ChangeHydraulicChoke1Fail, volume)
  68. if(data%problems%ChokeProblems%HydraulicChoke1Washout%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%HydraulicChoke1Washout, ChangeHydraulicChoke1Washout, volume)
  69. if(data%problems%ChokeProblems%HydraulicChoke2Plugged%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%HydraulicChoke2Plugged, ChangeHydraulicChoke2Plugged, volume)
  70. if(data%problems%ChokeProblems%HydraulicChoke2Fail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%HydraulicChoke2Fail, ChangeHydraulicChoke2Fail, volume)
  71. if(data%problems%ChokeProblems%HydraulicChoke2Washout%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%HydraulicChoke2Washout, ChangeHydraulicChoke2Washout, volume)
  72. if(data%problems%ChokeProblems%ManualChoke1Plugged%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ManualChoke1Plugged, ChangeManualChoke1Plugged, volume)
  73. if(data%problems%ChokeProblems%ManualChoke1Fail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ManualChoke1Fail, ChangeManualChoke1Fail, volume)
  74. if(data%problems%ChokeProblems%ManualChoke1Washout%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ManualChoke1Washout, ChangeManualChoke1Washout, volume)
  75. if(data%problems%ChokeProblems%ManualChoke2Plugged%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ManualChoke2Plugged, ChangeManualChoke2Plugged, volume)
  76. if(data%problems%ChokeProblems%ManualChoke2Fail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ManualChoke2Fail, ChangeManualChoke2Fail, volume)
  77. if(data%problems%ChokeProblems%ManualChoke2Washout%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ManualChoke2Washout, ChangeManualChoke2Washout, volume)
  78. if(data%problems%ChokeProblems%ChokePanelAirFail%ProblemType == VolumePumped_ProblemType) call ProcessDueVolumePumped(data%problems%ChokeProblems%ChokePanelAirFail, ChangeChokePanelAirFail, volume)
  79. end subroutine
  80. subroutine ProcessChokeProblemsDueDistanceDrilled(distance)
  81. implicit none
  82. real(8) :: distance
  83. if(data%problems%ChokeProblems%HydraulicChoke1Plugged%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%HydraulicChoke1Plugged, ChangeHydraulicChoke1Plugged, distance)
  84. if(data%problems%ChokeProblems%HydraulicChoke1Fail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%HydraulicChoke1Fail, ChangeHydraulicChoke1Fail, distance)
  85. if(data%problems%ChokeProblems%HydraulicChoke1Washout%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%HydraulicChoke1Washout, ChangeHydraulicChoke1Washout, distance)
  86. if(data%problems%ChokeProblems%HydraulicChoke2Plugged%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%HydraulicChoke2Plugged, ChangeHydraulicChoke2Plugged, distance)
  87. if(data%problems%ChokeProblems%HydraulicChoke2Fail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%HydraulicChoke2Fail, ChangeHydraulicChoke2Fail, distance)
  88. if(data%problems%ChokeProblems%HydraulicChoke2Washout%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%HydraulicChoke2Washout, ChangeHydraulicChoke2Washout, distance)
  89. if(data%problems%ChokeProblems%ManualChoke1Plugged%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ManualChoke1Plugged, ChangeManualChoke1Plugged, distance)
  90. if(data%problems%ChokeProblems%ManualChoke1Fail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ManualChoke1Fail, ChangeManualChoke1Fail, distance)
  91. if(data%problems%ChokeProblems%ManualChoke1Washout%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ManualChoke1Washout, ChangeManualChoke1Washout, distance)
  92. if(data%problems%ChokeProblems%ManualChoke2Plugged%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ManualChoke2Plugged, ChangeManualChoke2Plugged, distance)
  93. if(data%problems%ChokeProblems%ManualChoke2Fail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ManualChoke2Fail, ChangeManualChoke2Fail, distance)
  94. if(data%problems%ChokeProblems%ManualChoke2Washout%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ManualChoke2Washout, ChangeManualChoke2Washout, distance)
  95. if(data%problems%ChokeProblems%ChokePanelAirFail%ProblemType == DistanceDrilled_ProblemType) call ProcessDueDistanceDrilled(data%problems%ChokeProblems%ChokePanelAirFail, ChangeChokePanelAirFail, distance)
  96. end subroutine
  97. subroutine ChangeHydraulicChoke1Plugged(status)
  98. USE CHOKEVARIABLES
  99. use SimulationVariables !@
  100. implicit none
  101. integer, intent (in) :: status
  102. ! if(associated(HydraulicChoke1PluggedPtr)) call HydraulicChoke1PluggedPtr(status)
  103. if(status == Clear_StatusType) data%State%CHOOKE(1)%PlugMalf = 0
  104. if(status == Executed_StatusType) data%State%CHOOKE(1)%PlugMalf = 1
  105. endsubroutine
  106. subroutine ChangeHydraulicChoke1Fail(status)
  107. USE CHOKEVARIABLES
  108. use SimulationVariables !@
  109. implicit none
  110. integer, intent (in) :: status
  111. ! if(associated(HydraulicChoke1FailPtr)) call HydraulicChoke1FailPtr(status)
  112. if(status == Clear_StatusType) data%State%CHOOKE(1)%FailMalf = 0
  113. if(status == Executed_StatusType) data%State%CHOOKE(1)%FailMalf = 1
  114. endsubroutine
  115. subroutine ChangeHydraulicChoke1Washout(status)
  116. USE CHOKEVARIABLES
  117. use SimulationVariables !@
  118. use CChokeManifoldVariables
  119. use SimulationVariables
  120. implicit none
  121. integer, intent (in) :: status
  122. ! if(associated(HydraulicChoke1WashoutPtr)) call HydraulicChoke1WashoutPtr(status)
  123. if(status == Clear_StatusType) data%State%CHOOKE(1)%WashoutMalf = 0
  124. if(status == Executed_StatusType) data%State%CHOOKE(1)%WashoutMalf = 1
  125. if(status == Clear_StatusType) data%EquipmentControl%ChokeManifold%HyChock1OnProblem = .false.
  126. if(status == Executed_StatusType) data%EquipmentControl%ChokeManifold%HyChock1OnProblem = .true.
  127. endsubroutine
  128. subroutine ChangeHydraulicChoke2Plugged(status)
  129. USE CHOKEVARIABLES
  130. use SimulationVariables !@
  131. implicit none
  132. integer, intent (in) :: status
  133. ! if(associated(HydraulicChoke2PluggedPtr)) call HydraulicChoke2PluggedPtr(status)
  134. if(status == Clear_StatusType) data%State%CHOOKE(2)%PlugMalf = 0
  135. if(status == Executed_StatusType) data%State%CHOOKE(2)%PlugMalf = 1
  136. endsubroutine
  137. subroutine ChangeHydraulicChoke2Fail(status)
  138. USE CHOKEVARIABLES
  139. use SimulationVariables !@
  140. implicit none
  141. integer, intent (in) :: status
  142. ! if(associated(HydraulicChoke2FailPtr)) call HydraulicChoke2FailPtr(status)
  143. if(status == Clear_StatusType) data%State%CHOOKE(2)%FailMalf = 0
  144. if(status == Executed_StatusType) data%State%CHOOKE(2)%FailMalf = 1
  145. endsubroutine
  146. subroutine ChangeHydraulicChoke2Washout(status)
  147. USE CHOKEVARIABLES
  148. use SimulationVariables !@
  149. use CChokeManifoldVariables
  150. use SimulationVariables
  151. implicit none
  152. integer, intent (in) :: status
  153. ! if(associated(HydraulicChoke2WashoutPtr)) call HydraulicChoke2WashoutPtr(status)
  154. if(status == Clear_StatusType) data%State%CHOOKE(2)%WashoutMalf = 0
  155. if(status == Executed_StatusType) data%State%CHOOKE(2)%WashoutMalf = 1
  156. if(status == Clear_StatusType) data%EquipmentControl%ChokeManifold%HyChock2OnProblem = .false.
  157. if(status == Executed_StatusType) data%EquipmentControl%ChokeManifold%HyChock2OnProblem = .true.
  158. endsubroutine
  159. subroutine ChangeManualChoke1Plugged(status)
  160. USE FricPressDropVarsModule
  161. implicit none
  162. integer, intent (in) :: status
  163. ! if(associated(ManualChoke1PluggedPtr)) call ManualChoke1PluggedPtr(status)
  164. if(status == Clear_StatusType) data%State%FricPressDrop%ManChoke1Plug = 0
  165. if(status == Executed_StatusType) data%State%FricPressDrop%ManChoke1Plug = 1
  166. endsubroutine
  167. subroutine ChangeManualChoke1Fail(status)
  168. implicit none
  169. integer, intent (in) :: status
  170. ! if(associated(ManualChoke1FailPtr)) call ManualChoke1FailPtr(status)
  171. !if(status == Clear_StatusType) print*,'On_ManualChoke1Fail_Clear'
  172. !if(status == Executed_StatusType) print*,'On_ManualChoke1Fail_Execute'
  173. endsubroutine
  174. subroutine ChangeManualChoke1Washout(status)
  175. USE FricPressDropVarsModule
  176. use CChokeManifoldVariables
  177. use SimulationVariables
  178. implicit none
  179. integer, intent (in) :: status
  180. ! if(associated(ManualChoke1WashoutPtr)) call ManualChoke1WashoutPtr(status)
  181. if(status == Clear_StatusType) data%State%FricPressDrop%ManChoke1Washout = 0
  182. if(status == Executed_StatusType) data%State%FricPressDrop%ManChoke1Washout = 1
  183. if(status == Clear_StatusType) data%EquipmentControl%ChokeManifold%LeftManChokeOnProblem = .false.
  184. if(status == Executed_StatusType) data%EquipmentControl%ChokeManifold%LeftManChokeOnProblem = .true.
  185. endsubroutine
  186. subroutine ChangeManualChoke2Plugged(status)
  187. USE FricPressDropVarsModule
  188. implicit none
  189. integer, intent (in) :: status
  190. ! if(associated(ManualChoke2PluggedPtr)) call ManualChoke2PluggedPtr(status)
  191. if(status == Clear_StatusType) data%State%FricPressDrop%ManChoke2Plug = 0
  192. if(status == Executed_StatusType) data%State%FricPressDrop%ManChoke2Plug = 1
  193. endsubroutine
  194. subroutine ChangeManualChoke2Fail(status)
  195. implicit none
  196. integer, intent (in) :: status
  197. ! if(associated(ManualChoke2FailPtr)) call ManualChoke2FailPtr(status)
  198. !if(status == Clear_StatusType) print*,'On_ManualChoke2Fail_Clear'
  199. !if(status == Executed_StatusType) print*,'On_ManualChoke2Fail_Execute'
  200. endsubroutine
  201. subroutine ChangeManualChoke2Washout(status)
  202. USE FricPressDropVarsModule
  203. use CChokeManifoldVariables
  204. use SimulationVariables
  205. implicit none
  206. integer, intent (in) :: status
  207. ! if(associated(ManualChoke2WashoutPtr)) call ManualChoke2WashoutPtr(status)
  208. if(status == Clear_StatusType) data%State%FricPressDrop%ManChoke2Washout = 0
  209. if(status == Executed_StatusType) data%State%FricPressDrop%ManChoke2Washout = 1
  210. if(status == Clear_StatusType) data%EquipmentControl%ChokeManifold%RightManChokeOnProblem = .false.
  211. if(status == Executed_StatusType) data%EquipmentControl%ChokeManifold%RightManChokeOnProblem = .true.
  212. endsubroutine
  213. subroutine ChangeChokePanelAirFail(status)
  214. USE CHOKEVARIABLES
  215. use SimulationVariables !@
  216. implicit none
  217. integer, intent (in) :: status
  218. ! if(associated(ChokePanelAirFailPtr)) call ChokePanelAirFailPtr(status)
  219. if(status == Clear_StatusType) data%State%AirDrivenPump%ChokeAirFail = 0
  220. if(status == Executed_StatusType) data%State%AirDrivenPump%ChokeAirFail = 1
  221. endsubroutine
  222. end module CChokeProblems