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.
 
 
 
 
 
 

310 lines
13 KiB

  1. SUBROUTINE CHOKE_LINE
  2. use SimulationVariables
  3. USE CAccumulatorVariables
  4. USE CBopStackVariables
  5. use CBopControlPanel
  6. use SimulationVariables
  7. USE CEquipmentsConstants
  8. implicit none
  9. !=====================================================================
  10. ! CHOKE LINE 1- BOP CAMERON Type U 5000
  11. ! START CONDITIONS FOR CHOKE LINE 1
  12. !=====================================================================
  13. data%State%RAM(5)%SuccessionCounter = data%State%RAM(5)%SuccessionCounter + 1
  14. if (data%Equipments%BopControlPanel%ChokeLineValve == -1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
  15. if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
  16. data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
  17. data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
  18. return
  19. else
  20. data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
  21. endif
  22. if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  23. return
  24. endif
  25. data%State%RAM(5)%First_CloseTimecheck= 1
  26. if (data%State%BopStackInput%ChokeLineOpenLEDMine == LedOn) then
  27. RETURN
  28. end if
  29. data%State%ChokeLine%closed=0
  30. data%State%RAM(5)%vdis_tot=0
  31. data%State%RAM(5)%vdis_bottles=0.
  32. data%State%RAM(5)%fvr_air=0.
  33. data%State%RAM(5)%vdis_elecp=0.
  34. data%State%Pumps%Qiter=7
  35. data%State%RAM(5)%Qzero=70
  36. data%State%RAM(5)%Q=data%State%RAM(5)%Qzero
  37. data%State%RAM(5)%flow=70
  38. data%State%RAM(5)%tol=0.0037
  39. if (data%State%ChokeLine%finished==1) then
  40. data%State%ChokeLine%LeverOld= 1.0
  41. else
  42. data%State%ChokeLine%LeverOld=data%Equipments%BopControlPanel%ChokeLineValve
  43. endif
  44. data%State%ChokeLine%finished=0
  45. data%State%ChokeLine%IsOpening = .true.
  46. data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOff
  47. data%State%BopStackInput%ChokeLineCloseLEDMine = LedOff
  48. data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOn !LedBlinking
  49. data%State%RAM(5)%bop_type = 3
  50. !AbopChokeLine=196.67
  51. data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeClose*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
  52. data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%IDBase-max(data%State%ChokeLine%ODDrillpipe_in,data%State%ChokeLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
  53. endif
  54. if (data%Equipments%BopControlPanel%ChokeLineValve == 1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
  55. if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
  56. data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
  57. data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
  58. return
  59. else
  60. data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
  61. endif
  62. if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  63. return
  64. endif
  65. data%State%RAM(5)%First_OpenTimecheck= 1
  66. if (data%State%BopStackInput%ChokeLineCloseLEDMine == LedOn) then
  67. RETURN
  68. end if
  69. data%State%ChokeLine%closed=0
  70. data%State%RAM(5)%vdis_tot=0
  71. data%State%RAM(5)%vdis_bottles=0.
  72. data%State%RAM(5)%fvr_air=0.
  73. data%State%RAM(5)%vdis_elecp=0.
  74. data%State%Pumps%Qiter=7
  75. data%State%RAM(5)%Qzero=70
  76. data%State%RAM(5)%Q=data%State%RAM(5)%Qzero
  77. data%State%RAM(5)%flow=70
  78. data%State%RAM(5)%tol=0.0037
  79. if (data%State%ChokeLine%finished==1) then
  80. data%State%ChokeLine%LeverOld= -1.0
  81. else
  82. data%State%ChokeLine%LeverOld=data%Equipments%BopControlPanel%ChokeLineValve
  83. endif
  84. data%State%ChokeLine%finished=0
  85. data%State%ChokeLine%IsClosing = .true.
  86. !if (ChokeLineCloseLED == LedOn) then
  87. ! RETURN
  88. !end if
  89. data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOff !new
  90. data%State%BopStackInput%ChokeLineCloseLEDMine = LedOff !new
  91. data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOn !LedBlinking
  92. data%State%RAM(5)%bop_type = 3
  93. !AbopChokeLine=196.67
  94. data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeOpen*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
  95. data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%IDBase-max(data%State%ChokeLine%ODDrillpipe_in,data%State%ChokeLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
  96. endif
  97. !=====================================================================
  98. ! if (ChokeLineIsOpening .or. ChokeLineIsClosing) then
  99. ! CALL CHOKE_LINE_SUB
  100. ! end if
  101. END SUBROUTINE CHOKE_LINE
  102. SUBROUTINE CHOKE_LINE_SUB
  103. use SimulationVariables
  104. USE CAccumulatorVariables
  105. USE CBopStackVariables
  106. use CBopControlPanel
  107. use SimulationVariables
  108. USE CEquipmentsConstants
  109. ! use CSimulationVariables
  110. implicit none
  111. ! FirstSet= 0
  112. ! RamsFirstSet= 0
  113. ! loop5: do while (finished_ChokeLine==0)
  114. data%State%RAM(5)%SuccessionCounter = data%State%RAM(5)%SuccessionCounter + 1
  115. if (data%Equipments%BopControlPanel%ChokeLineValve == 1.0 .and. data%State%ChokeLine%LeverOld == -1.0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
  116. if ( data%State%RAM(5)%First_CloseTimecheck == 0 ) then
  117. if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
  118. data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
  119. data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
  120. return
  121. else
  122. data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
  123. endif
  124. if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  125. return
  126. endif
  127. endif
  128. data%State%ChokeLine%closed=0
  129. data%State%RAM(5)%p_bop=data%State%ShearRAM%PA
  130. data%State%ChokeLine%LeverOld = data%Equipments%BopControlPanel%ChokeLineValve
  131. data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOff
  132. data%State%BopStackInput%ChokeLineOpenLEDMine = LedOff
  133. data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOn !LedBlinking
  134. CALL OpenChokeLine
  135. data%State%RAM(5)%bop_type = 3
  136. !AbopChokeLine=196.67
  137. data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeClose*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
  138. data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%ID-max(data%State%ChokeLine%ODDrillpipe_in,data%State%ChokeLine%ODDrillpipe_inBase))/(2.*231)
  139. data%State%RAM(5)%vdis_bottles=0.
  140. data%State%RAM(5)%fvr_air=0.
  141. data%State%RAM(5)%vdis_elecp=0.
  142. data%State%ChokeLine%IsClosing = .true.
  143. data%State%ChokeLine%IsOpening = .false.
  144. endif
  145. if (data%Equipments%BopControlPanel%ChokeLineValve == -1.0 .and. data%State%ChokeLine%LeverOld == 1.0 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
  146. if ( data%State%RAM(5)%First_OpenTimecheck == 0 ) then
  147. if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
  148. data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
  149. data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
  150. return
  151. else
  152. data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
  153. endif
  154. if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  155. return
  156. endif
  157. endif
  158. data%State%ChokeLine%closed=0
  159. data%State%RAM(5)%p_bop=data%State%ShearRAM%PA
  160. data%State%ChokeLine%LeverOld = data%Equipments%BopControlPanel%ChokeLineValve
  161. data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOff
  162. data%State%BopStackInput%ChokeLineCloseLEDMine = LedOff
  163. data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOn !LedBlinking
  164. CALL OpenChokeLine
  165. data%State%RAM(5)%bop_type = 3
  166. !AbopChokeLine=196.67
  167. data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeOpen*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
  168. data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%IDBase-data%State%ChokeLine%ID)/(2.*231)
  169. data%State%RAM(5)%vdis_bottles=0.
  170. data%State%RAM(5)%fvr_air=0.
  171. data%State%RAM(5)%vdis_elecp=0.
  172. data%State%ChokeLine%IsOpening = .true.
  173. data%State%ChokeLine%IsClosing = .false.
  174. endif
  175. data%State%RAM(5)%First_CloseTimecheck = 0
  176. data%State%RAM(5)%First_OpenTimecheck = 0
  177. data%State%RAM(5)%time=data%State%RAM(5)%time+data%State%RamLine%DeltaT_BOP !overal time (s)
  178. !===================================================
  179. ! BOP
  180. !===================================================
  181. if (data%State%ChokeLine%closed==0) then !bop closing
  182. call bop_code(4,data%State%ChokeLine%H_Bop,5) !ramtype=4 5=RNUMBER
  183. endif !bop is closing
  184. !================================================================
  185. if (data%State%ChokeLine%closed==1) then
  186. data%State%RAM(5)%Q=0
  187. !p_bop=pram_reg
  188. data%State%RAM(5)%p_bop=data%State%ShearRAM%PA
  189. data%State%RAMS%minloss(5,17)=0. !RNUMBER=5
  190. endif
  191. data%State%RAM(5)%timecounter_ram=data%State%RAM(5)%timecounter_ram+1
  192. ! MiddleRamsStatus = IDshearBop
  193. ! UpperRamsStatus = IDPipeRam1
  194. ! LowerRamsStatus = IDPipeRam2
  195. ! AnnularStatus = IDAnnular
  196. ! AccumulatorPressureGauge = p_acc
  197. ! ManifoldPressureGauge= pram_reg
  198. ! AnnularPressureGauge=Pannular_reg
  199. !
  200. !
  201. !
  202. ! WRITE(60,60) data%State%RAM(5)%time,data%State%RAM(5)%Q,data%State%RAM(5)%vdis_tot,p_acc, &
  203. ! pram_reg,Pannular_reg,data%State%RAM(5)%p_bop,IDshearBop, &
  204. ! IDPipeRam1,IDPipeRam2,IDAnnular
  205. !60 FORMAT(11(f18.5))
  206. ! call sleepqq(100)
  207. if (data%State%ChokeLine%closed==1) then
  208. ! if ((UpperRamsValve==1. .and. UpperRamsFailureMalf==0) .or. (UpperRamsValve==-1.0 .and. UpperRamsFailureMalf==0) .or. (MiddleRamsValve==1. .and. MiddleRamsFailureMalf==0) .or. (MiddleRamsValve==-1.0 .and. MiddleRamsFailureMalf==0) .or. (LowerRamsValve==1. .and. LowerRamsFailureMalf==0) .or. (LowerRamsValve==-1.0 .and. LowerRamsFailureMalf==0) .or. (AnnularValve==1. .and. AnnularFailureMalf==0) .or. (AnnularValve==-1.0 .and. AnnularFailureMalf==0) .or. KillLineValve==1. .or. KillLineValve==-1.0) then
  209. data%State%ChokeLine%finished=1
  210. ! endif
  211. endif
  212. ! if (IsStopped == .true.) return
  213. ! end do loop5 !while finished_ChokeLine==0
  214. END SUBROUTINE CHOKE_LINE_SUB