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.

BOPstartup.i90 13 KiB

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