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.
 
 
 
 
 
 

325 lines
13 KiB

  1. SUBROUTINE BOP_StartUp()
  2. use SimulationVariables
  3. USE CAccumulatorVariables
  4. USE CBopStackVariables
  5. use CBopControlPanel
  6. use SimulationVariables
  7. USE CEquipmentsConstants
  8. implicit none
  9. integer i
  10. !UpperRamsFailureMalf=0
  11. !AnnularFailureMalf=0
  12. !LowerRamsFailureMalf=0
  13. !MiddleRamsFailureMalf=0
  14. !UpperRamsLeakMalf=0
  15. !LowerRamsLeakMalf=0
  16. !MiddleRamsLeakMalf=0
  17. !AnnularLeakMalf=0
  18. !AccPupmsFailMalf=0
  19. !AirSupplyPressureGauge=0
  20. !======================= SETTING VARIABLES
  21. data%State%BopStackInput%BOP_timeCounter= 0
  22. !============== FOR MANIFOLD VALVES CODE=====================
  23. CALL OpenAnnular
  24. CALL OpenUpperRams
  25. CALL OpenMiddleRams
  26. CALL CloseKillLine
  27. CALL CloseChokeLine
  28. CALL OpenLowerRams
  29. data%State%Annular%Annular_Situation_forTD= 0 ! open - for TD code
  30. data%State%RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
  31. data%State%PipeRam1%Situation_forTD= 0 ! open - for TD code
  32. data%State%PipeRam2%Situation_forTD= 0 ! open - for TD code
  33. !======================================================================
  34. CALL LOSS_INPUTS()
  35. !
  36. !OPEN(50,FILE='AIRPUMP_OUTPUTS.DAT')
  37. !OPEN(60,FILE='RAMS_OUTPUTS.DAT')
  38. !======================================================================
  39. ! GET INPUTS
  40. !======================================================================
  41. data%State%RAM%SuccessionCounter = 0
  42. data%State%RAM%SuccessionCounterOld = 0
  43. data%State%RAM%First_CloseTimecheck= 0
  44. data%State%RAM%First_OpenTimecheck= 0
  45. data%State%BopStackAcc%Cumulative_AirVolume= 0.0
  46. data%State%BopStackAcc%BOTTLE_CAPACITY=10 !(GALON)
  47. data%State%BopStackAcc%NOBOTTLES=data%Configuration%Accumulator%NumberOfBottels
  48. !fvr_tot=40 !(GALON) IN CHARGED POSITION
  49. data%State%BopStackAcc%PRAMS_REGSET=1500 !RamsReglatorSet !=1500 DEFAULT regulator set pressure (PSI)
  50. data%State%BopStackAcc%acc_ChargedPressure=3000 !charged(PSI)
  51. data%State%BopStackAcc%acc_MinPressure=data%Configuration%Accumulator%AccumulatorMinimumOperatingPressure !1200 !discharged(PSI)
  52. !acc_precharge=1000
  53. data%State%BopStackAcc%FVR_TOT=(-2451*(data%State%BopStackAcc%acc_ChargedPressure**(-0.8202))+8.435)*data%State%BopStackAcc%NOBOTTLES ! IT IS WRRITEN FOR PRECHARGE 1000 PSI FROM ITS CURVE
  54. !write(*,*) 'fvr_tot=',fvr_tot
  55. !ELECTRIC_PUMPON=2800
  56. data%State%Pumps%ELECTRIC_ON=data%Configuration%Accumulator%StartPressure
  57. !ELECTRIC_PUMPOFF=acc_ChargedPressure !=3000 psi
  58. data%State%Pumps%ELECTRIC_OFF=data%Configuration%Accumulator%StopPressure
  59. !QELECTRIC_PUMP=12 !(gpm)
  60. data%State%Pumps%QELECTRIC=data%Configuration%Accumulator%ElectricPumpOutput
  61. !AIR_PUMPON=2600
  62. data%State%Pumps%AIR_ON=data%Configuration%Accumulator%StartPressure2
  63. !AIR_PUMPOFF=2900
  64. data%State%Pumps%AIR_OFF=data%Configuration%Accumulator%StopPressure2
  65. data%State%RAM%tol=0.0037 !%=(2700-2600)/2700
  66. data%State%RAM%tolzero=data%State%RAM%tol
  67. data%State%Annular%tolAnnular=0.0018 !=(2900-2895)/2900
  68. data%State%Annular%tolzeroAnnular=data%State%Annular%tolAnnular
  69. !======================OTHER INPUTS(CONSTANTS)===========================
  70. data%State%ShearRAM%PA=300 !(PSI)
  71. data%State%ShearRAM%P_SHEAR=1200 !(PSI)
  72. !p_shear=2423.1 !(PSI)
  73. data%State%ShearRAM%PB=data%State%ShearRAM%P_SHEAR-data%State%ShearRAM%PA
  74. data%State%AnnularComputational%pa_annular=100 !(psi)
  75. data%State%Annular%IDAnnularBase=13.625 !(inch)
  76. data%State%Annular%IDAnnular=data%State%Annular%IDAnnularBase
  77. data%State%Annular%ODDrillpipe_inAnnularBase=5. ! so 18 gal is for complete closing of annular
  78. data%State%Annular%ODDrillpipe_inAnnular=5. ! initial
  79. data%State%AnnularComputational%AnnularMovingPressure=360. !(psi)
  80. data%State%ShearRAM%IDAnnularFinal= data%State%Annular%IDAnnular
  81. data%State%ShearRAM%IDshearBopBase=13.625 !(inch)
  82. data%State%ShearRAM%IDshearBop=data%State%ShearRAM%IDshearBopBase
  83. data%State%ShearRAM%ODDrillpipe_inShearRamBase=5 !initial
  84. data%State%ShearRAM%ODDrillpipe_inShearRam=5 !initial
  85. data%State%ShearRAM%IDshearBopFinal= data%State%ShearRAM%IDshearBop
  86. data%State%PipeRam1%IDBase=13.625 !(inch)
  87. data%State%PipeRam1%ID=data%State%PipeRam1%IDBase
  88. data%State%PipeRam1%ODDrillpipe_inBase=5 !initial
  89. data%State%PipeRam1%ODDrillpipe_in=5 !initial
  90. data%State%ShearRAM%IDPipeRam1Final= data%State%PipeRam1%ID
  91. data%State%PipeRam2%ID=data%State%PipeRam1%IDBase !(inch)
  92. data%State%PipeRam2%ODDrillpipe_inBase=5 !initial
  93. data%State%PipeRam2%ODDrillpipe_in=5 !initial
  94. data%State%ShearRAM%IDPipeRam2Final= data%State%PipeRam2%ID
  95. data%State%ChokeLine%IDBase=8.6 !(inch)
  96. data%State%ChokeLine%ID=data%State%ChokeLine%IDBase
  97. data%State%ChokeLine%ODDrillpipe_inBase=5
  98. data%State%ChokeLine%ODDrillpipe_in=5
  99. data%State%KillLine%IDBase=8.6 !(inch)
  100. data%State%KillLine%ID=data%State%KillLine%IDBase
  101. data%State%KillLine%ODDrillpipe_inBase=5
  102. data%State%KillLine%ODDrillpipe_in=5
  103. !va=4 !(liter)
  104. !vb=8 !(liter)
  105. !cv=2; !flow coefficinet of regulator
  106. data%State%ShearRAM%RAM_COURSE=320.2 !milimeter
  107. data%State%ShearRAM%H_REGRAM=0 !(m)<<<<<<<<<<<<<<<<<<<<<<<<
  108. data%State%ShearRAM%H_ShearRamBop=(data%Configuration%BopStack%GroundLevel-data%Configuration%BopStack%BlindRamHeight)*0.3048 ! foot to meter
  109. data%State%PipeRam1%H=(data%Configuration%BopStack%GroundLevel-data%Configuration%BopStack%UpperRamHeight)*0.3048 ! foot to meter
  110. data%State%PipeRam2%H_Bop=(data%Configuration%BopStack%GroundLevel-data%Configuration%BopStack%LowerRamHeight)*0.3048 ! foot to meter
  111. data%State%Annular%H_AnnularBop=(data%Configuration%BopStack%GroundLevel-data%Configuration%BopStack%AnnularPreventerHeight)*0.3048 ! foot to meter
  112. data%State%ChokeLine%H_Bop=(data%Configuration%BopStack%GroundLevel-data%Configuration%BopStack%KillHeight)*0.3048 ! foot to meter
  113. data%State%KillLine%H_Bop=(data%Configuration%BopStack%GroundLevel-data%Configuration%BopStack%KillHeight)*0.3048 ! foot to meter
  114. data%State%RamLine%P_ACC=data%State%BopStackAcc%acc_ChargedPressure
  115. data%State%RAM%vdis_bottles=0 !initial discharged volume
  116. data%State%RamLine%FVR=data%State%BopStackAcc%FVR_TOT
  117. data%State%RAMS%minloss=0.
  118. !======================AIRPUMP INPUTS(CONSTANTS)===========================
  119. data%State%RAM%FVR_AIR=0
  120. data%State%Pumps%P_AIRP=0
  121. data%State%RamLine%BA1=1003; data%State%RamLine%BA2=.03375; data%State%RamLine%BA3=4.014; data%State%RamLine%BA4=.2458
  122. data%State%RamLine%BBA1 =31.8; data%State%RamLine%BBA2 =-725.7 ; data%State%RamLine%BBA3 =4154
  123. data%State%Pumps%Qiter=7 !(gpm)
  124. ! Q=0.0003585; true
  125. data%State%RamLine%DeltaT_BOP=0.1 !second
  126. data%State%Pumps%TOL_AIR=.08
  127. data%State%Pumps%alpha_Qair=0
  128. data%State%Pumps%alpha_timeair=0
  129. data%State%Pumps%alpha_paccair=data%State%RamLine%P_ACC
  130. data%State%Pumps%alpha_pairp=data%State%RamLine%P_ACC
  131. data%State%Pumps%alpha_diffpair=0
  132. data%State%Pumps%alpha_lossesair=0
  133. data%State%Pumps%alpha_fvrair=0
  134. data%State%RamLine%counter_airp=1
  135. !======================BOP INPUTS(CONSTANTS)===========================
  136. if (data%Configuration%Accumulator%PrechargePressure == 1400.) then
  137. data%State%RamLine%B1=1396; data%State%RamLine%B2=0.17; data%State%RamLine%B3=3.873; data%State%RamLine%B4=1.101
  138. elseif (data%Configuration%Accumulator%PrechargePressure == 2000.) then
  139. data%State%RamLine%B1=1980; data%State%RamLine%B2=0.1237; data%State%RamLine%B3=15.69; data%State%RamLine%B4=1.029
  140. elseif (data%Configuration%Accumulator%PrechargePressure == 600.) then
  141. data%State%RamLine%B1=591.9; data%State%RamLine%B2=0.1968; data%State%RamLine%B3=2.887; data%State%RamLine%B4=0.9757
  142. else !(PrechargePressure == 1000.) then ! this is for precharge=1000 psi
  143. data%State%RamLine%B1=993.7; data%State%RamLine%B2=0.164; data%State%RamLine%B3=5.492; data%State%RamLine%B4=0.9796
  144. endif
  145. data%State%BopStackAcc%ByPassOld= 1.0
  146. data%State%RAM%p_bop=data%State%ShearRAM%PA
  147. data%State%AnnularComputational%p_annular=data%State%AnnularComputational%pa_annular
  148. !Q=0.0055; !initial flow rate (m^3/s)
  149. data%State%RAM%flow=60 !(gpm) initial value
  150. data%State%RAM%Qzero=70 !for DP code, increasing Q after shear
  151. data%State%RAM%vdis_tot=0
  152. data%State%RamLine%AIRP_SWITCH=0 !off position
  153. data%State%RamLine%ELECP_SWITCH=0 !off position
  154. data%State%RamLine%ShearBop_closed=1
  155. data%State%PipeRam1%closed=1
  156. data%State%PipeRam2%closed=1
  157. data%State%ChokeLine%closed=1
  158. data%State%KillLine%closed=1
  159. data%State%Annular%Annular_closed=1
  160. data%State%RamLine%FINISHED_shear=0
  161. data%State%PipeRam1%finished=0
  162. data%State%PipeRam2%finished=0
  163. data%State%ChokeLine%finished=0
  164. data%State%KillLine%finished=0
  165. data%State%Annular%finished_Annular=0
  166. data%State%Pumps%DELTAV_ELECP=0
  167. data%State%RAM%vdis_elecp=0
  168. !==================================================================
  169. data%State%RAM%timecounter_ram=0
  170. data%State%RAM%Q=0
  171. data%State%BopStackAcc%pram_reg=data%State%BopStackAcc%PRAMS_REGSET !psi !RamsReglatorSet
  172. data%State%Annular%Pannular_reg=min(data%Equipments%BopControlPanel%AnnularRegulatorSetControl,1700.)
  173. data%Equipments%BopControlPanel%MiddleRamsStatus= data%State%ShearRAM%IDshearBop
  174. data%Equipments%BopControlPanel%UpperRamsStatus= data%State%PipeRam1%ID
  175. data%Equipments%BopControlPanel%LowerRamsStatus= data%State%PipeRam2%ID
  176. data%Equipments%BopControlPanel%AnnularStatus = data%State%Annular%IDAnnular
  177. data%Equipments%BopControlPanel%AccumulatorPressureGauge = data%State%RamLine%P_ACC
  178. data%State%RAM%time=0
  179. ! WRITE(60,10) ' Overal Time','Q Ram Line','Vdis Ram Line','P Accumulator','Preg Ram Line','Preg Annular',' P BOP','ID Shear Ram', &
  180. ! 'ID Pipe Ram1','ID Pipe Ram2','ID Annular'
  181. !10 FORMAT(11(A18))
  182. !
  183. !
  184. !
  185. ! WRITE(60,60) data%State%RAM(2)%time,data%State%RAM(2)%Q,data%State%RAM(2)%vdis_tot,p_acc, &
  186. ! pram_reg,Pannular_reg,data%State%RAM(2)%p_bop,IDshearBop, &
  187. ! IDPipeRam1,IDPipeRam2,IDAnnular
  188. !60 FORMAT(11(f18.5))
  189. data%Equipments%BopControlPanel%MiddleRamsOpenLED = LedOn
  190. data%State%BopStackInput%MiddleRamsOpenLEDMine = LedOn
  191. data%Equipments%BopControlPanel%MiddleRamsCloseLED = LedOff
  192. data%State%BopStackInput%MiddleRamsCloseLEDMine = LedOff
  193. data%State%RamLine%ShearRamIsOpening = .false.
  194. data%State%RamLine%ShearRamIsClosing = .false.
  195. data%Equipments%BopControlPanel%UpperRamsOpenLED = LedOn
  196. data%State%BopStackInput%UpperRamsOpenLEDMine = LedOn
  197. data%Equipments%BopControlPanel%UpperRamsCloseLED = LedOff
  198. data%State%BopStackInput%UpperRamsCloseLEDMine = LedOff
  199. data%State%PipeRam1%IsOpening = .false.
  200. data%State%PipeRam1%IsClosing = .false.
  201. data%Equipments%BopControlPanel%LowerRamsOpenLED = LedOn
  202. data%State%BopStackInput%LowerRamsOpenLEDMine = LedOn
  203. data%Equipments%BopControlPanel%LowerRamsCloseLED = LedOff
  204. data%State%BopStackInput%LowerRamsCloseLEDMine = LedOff
  205. data%State%PipeRam2%IsOpening = .false.
  206. data%State%PipeRam2%IsClosing = .false.
  207. data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOff
  208. data%State%BopStackInput%ChokeLineOpenLEDMine = LedOff
  209. data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOn
  210. data%State%BopStackInput%ChokeLineCloseLEDMine = LedOn
  211. data%State%ChokeLine%IsOpening = .false.
  212. data%State%ChokeLine%IsClosing = .false.
  213. data%Equipments%BopControlPanel%KillLineOpenLED = LedOff
  214. data%State%BopStackInput%KillLineOpenLedMine = LedOff
  215. data%Equipments%BopControlPanel%KillLineCloseLED = LedOn
  216. data%State%BopStackInput%KillLineCloseLedMine = LedOn
  217. data%State%KillLine%IsOpening = .false.
  218. data%State%KillLine%IsClosing = .false.
  219. data%Equipments%BopControlPanel%AnnularOpenLED = LedOn
  220. data%State%BopStackInput%AnnularOpenLedMine = LedOn
  221. data%Equipments%BopControlPanel%AnnularCloseLED = LedOff
  222. data%State%BopStackInput%AnnularCloseLedMine = LedOff
  223. data%State%Annular%AnnularIsOpening = .false.
  224. data%State%Annular%AnnularIsClosing = .false.
  225. data%State%Annular%FirstSet=1
  226. data%State%AnnularComputational%RamsFirstSet=1
  227. data%Equipments%BopControlPanel%ManifoldPressureGauge=data%State%BopStackAcc%PRAMS_REGSET !RamsReglatorSet
  228. data%Equipments%BopControlPanel%AnnularPressureGauge= (1 - data%State%Annular%AnnularPressureGaugeMalf) * min(data%Equipments%BopControlPanel%AnnularRegulatorSetControl,1700.)
  229. data%State%AnnularComputational%PannularTimeStepDelay = int(1./data%State%RamLine%DeltaT_BOP) ! 1/0.1 : for 1 sec delay in AnnRegulator shot time
  230. DO i = 1 , data%State%AnnularComputational%PannularTimeStepDelay
  231. CALL data%State%AnnularComputational%Pannular_regDelay%AddToFirst(data%Equipments%BopControlPanel%AnnularPressureGauge)
  232. END DO
  233. end