Simulation Core
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

431 satır
18 KiB

  1. # 1 "/home/admin/SimulationCore2/Equipments/BopStack/ANNULAR.f90"
  2. SUBROUTINE ANNULAR_SUB1
  3. use SimulationVariables
  4. use CBopControlPanel
  5. use SimulationVariables
  6. use PressureDisplayVARIABLESModule
  7. USE CEquipmentsConstants
  8. USE CBopStackVariables
  9. implicit none
  10. !write(*,*) 'checkpoint 1'
  11. !=====================================================================
  12. ! ANNULAR PREVENTER- BOP CAMERON Type U 5000
  13. ! START CONDITIONS FOR ANNULAR PREVENTER
  14. !=====================================================================
  15. data%State%RAM(1)%SuccessionCounter = data%State%RAM(1)%SuccessionCounter + 1
  16. if (data%Equipments%BopControlPanel%AnnularValve == 1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
  17. if (data%State%BopStackInput%AnnularCloseLedMine == LedOn) then
  18. RETURN
  19. end if
  20. if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then
  21. data%State%RAM(1)%SuccessionCounter = 0 ! also in starup
  22. data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup
  23. !return
  24. else
  25. data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter
  26. endif
  27. if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  28. !return
  29. data%State%RAM(1)%First_CloseTimecheck= 1
  30. data%Equipments%BopControlPanel%AnnularOpenLED = LedOff
  31. data%State%BopStackInput%AnnularOpenLedMine = LedOff
  32. data%Equipments%BopControlPanel%AnnularCloseLED = LedOn !LedBlinking
  33. data%State%RAM(1)%FourwayValve = 1
  34. endif
  35. endif
  36. if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure) then ! 1: Open , 0: Close
  37. data%State%RAM(1)%FourwayValve = 0
  38. data%State%Annular%Annular_closed=0
  39. !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
  40. data%State%RAM(1)%vdis_tot=0
  41. data%State%RAM(1)%vdis_bottles=0.
  42. data%State%RAM(1)%fvr_air=0.
  43. data%State%RAM(1)%vdis_elecp=0.
  44. data%State%Pumps%Qiter=7
  45. data%State%RAM(1)%Qzero=70
  46. data%State%RAM(1)%Q=data%State%RAM(1)%Qzero
  47. data%State%RAM(1)%flow=70
  48. data%State%Annular%tolAnnular=0.0018
  49. if (data%State%Annular%finished_Annular==1) then
  50. data%State%Annular%AnnularLeverOld=-1.0
  51. else
  52. data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve
  53. endif
  54. data%State%Annular%finished_Annular=0
  55. data%State%Annular%AnnularIsClosing = .true.
  56. data%State%Annular%AnnularIsOpening = .false.
  57. data%State%RAM(2)%bop_type = 3
  58. !AbopAnnular=963.1 !(in^2)
  59. data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerClose*231.)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal
  60. data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5
  61. !WRITE(*,*) 'a)NeededVolumeAnnular=' , NeededVolumeAnnular
  62. !write(*,*) 'close 1'
  63. endif
  64. if (data%Equipments%BopControlPanel%AnnularValve == -1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 ) then
  65. if (data%State%BopStackInput%AnnularOpenLedMine == LedOn) then
  66. RETURN
  67. end if
  68. !CasingPressure : PressureGauges(2) *****temp conditionssssss
  69. !note: (AnnularSealingPressure) is only for opening while well is pressurised
  70. if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then
  71. data%State%RAM(1)%SuccessionCounter = 0 ! also in starup
  72. data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup
  73. !return
  74. else
  75. data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter
  76. endif
  77. if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  78. !return
  79. data%State%RAM(1)%First_OpenTimecheck= 1
  80. data%Equipments%BopControlPanel%AnnularCloseLED = LedOff !new
  81. data%State%BopStackInput%AnnularCloseLedMine = LedOff !new
  82. data%Equipments%BopControlPanel%AnnularOpenLED = LedOn !LedBlinking
  83. data%State%RAM(1)%FourwayValve = 1
  84. endif
  85. endif
  86. if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure &
  87. .and. (data%State%Annular%Annular_closed==0 .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2) <=100.0) .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2)>100.0 .and. data%State%Annular%Pannular_reg>=data%State%AnnularComputational%AnnularSealingPressure))) then ! 1: Open , 0: Close
  88. !write(*,*) 'open 2'
  89. data%State%RAM(1)%FourwayValve = 0
  90. data%State%Annular%Annular_closed=0
  91. !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
  92. data%State%RAM(1)%vdis_tot=0
  93. data%State%RAM(1)%vdis_bottles=0.
  94. data%State%RAM(1)%fvr_air=0.
  95. data%State%RAM(1)%vdis_elecp=0.
  96. data%State%Pumps%Qiter=7
  97. data%State%RAM(1)%Qzero=70
  98. data%State%RAM(1)%Q=data%State%RAM(1)%Qzero
  99. data%State%RAM(1)%flow=70
  100. data%State%Annular%tolAnnular=0.0018
  101. if (data%State%Annular%finished_Annular==1) then
  102. data%State%Annular%AnnularLeverOld=1.0
  103. else
  104. data%State%Annular%AnnularLeverOld=data%Equipments%BopControlPanel%AnnularValve
  105. endif
  106. data%State%Annular%finished_Annular=0
  107. data%State%Annular%AnnularIsOpening = .true.
  108. data%State%Annular%AnnularIsClosing = .false.
  109. !if (AnnularOpenLed == LedOn) then
  110. ! RETURN
  111. !end if
  112. data%State%RAM(1)%bop_type = 3
  113. !AbopAnnular=758.48 !(in^2)
  114. data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerOpen*231)/((data%State%Annular%IDAnnularBase-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/2.)
  115. data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5
  116. !write(*,*) 'open 1'
  117. endif
  118. !=====================================================================
  119. if (data%State%Annular%AnnularIsOpening .or. data%State%Annular%AnnularIsClosing .or. data%State%RAM(1)%Bottles_Charged_MalfActive) then
  120. CALL ANNULAR_SUB2
  121. end if
  122. END SUBROUTINE ANNULAR_SUB1
  123. SUBROUTINE ANNULAR_SUB2
  124. use SimulationVariables
  125. use PressureDisplayVARIABLESModule
  126. use CBopControlPanel
  127. use SimulationVariables
  128. USE CEquipmentsConstants
  129. USE CBopStackVariables
  130. ! use CSimulationVariables
  131. implicit none
  132. data%State%Annular%FirstSet= 0
  133. data%State%AnnularComputational%RamsFirstSet= 0
  134. ! loop5: do while (finished_Annular==0)
  135. !write(*,*) 'checkpoint 2'
  136. data%State%RAM(1)%SuccessionCounter = data%State%RAM(1)%SuccessionCounter + 1
  137. ! CALL CPU_TIME(Annular_StartTime)
  138. if (data%Equipments%BopControlPanel%AnnularValve == 1.0 .and. data%State%Annular%AnnularLeverOld == -1.0 .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
  139. if ( data%State%RAM(1)%First_CloseTimecheck == 0 ) then
  140. if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then
  141. data%State%RAM(1)%SuccessionCounter = 0 ! also in starup
  142. data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup
  143. !return
  144. else
  145. data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter
  146. endif
  147. if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  148. !return
  149. data%Equipments%BopControlPanel%AnnularOpenLED = LedOff
  150. data%State%BopStackInput%AnnularOpenLedMine = LedOff
  151. data%Equipments%BopControlPanel%AnnularCloseLED = LedOn !LedBlinking
  152. data%State%RAM(1)%FourwayValve = 1
  153. endif
  154. endif
  155. !write(*,*) 'chekkk 1'
  156. endif
  157. if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
  158. !write(*,*) 'close 4'
  159. data%State%RAM(1)%FourwayValve = 0
  160. data%State%Annular%Annular_closed=0
  161. !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
  162. data%State%AnnularComputational%p_annular=data%State%AnnularComputational%pa_annular
  163. data%State%Annular%AnnularLeverOld = data%Equipments%BopControlPanel%AnnularValve
  164. CALL OpenAnnular
  165. data%State%Annular%Annular_Situation_forTD= 0 ! open - for TD code
  166. data%State%RAM(1)%bop_type = 3
  167. !AbopAnnular=963.1 !(in^2)
  168. data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerClose*231)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.)
  169. !write(*,*) 'NeededVolumeShearRams1=',NeededVolumeShearRams
  170. data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnular-max(data%State%Annular%ODDrillpipe_inAnnular,data%State%Annular%ODDrillpipe_inAnnularBase))/(2*231.)
  171. ! write(*,*) 'NeededVolumeAnnular=',NeededVolumeAnnular
  172. data%State%RAM(1)%vdis_bottles=0.
  173. data%State%RAM(1)%fvr_air=0.
  174. data%State%RAM(1)%vdis_elecp=0.
  175. data%State%Annular%AnnularIsClosing = .true.
  176. data%State%Annular%AnnularIsOpening = .false.
  177. !write(*,*) 'close 2'
  178. endif
  179. if (data%Equipments%BopControlPanel%AnnularValve == -1.0 .and. data%State%Annular%AnnularLeverOld == 1.0 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure .and. data%State%Annular%AnnularFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 ) then
  180. !CasingPressure : PressureGauges(2) *****temp conditionssssss
  181. !note: (AnnularSealingPressure) is only for opening while well is pressurised
  182. if ( data%State%RAM(1)%First_OpenTimecheck == 0 ) then
  183. if ( data%State%RAM(1)%SuccessionCounter /= data%State%RAM(1)%SuccessionCounterOld+1 ) then
  184. data%State%RAM(1)%SuccessionCounter = 0 ! also in starup
  185. data%State%RAM(1)%SuccessionCounterOld = 0 ! also in starup
  186. !return
  187. else
  188. data%State%RAM(1)%SuccessionCounterOld= data%State%RAM(1)%SuccessionCounter
  189. endif
  190. if ( data%State%RAM(1)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
  191. !return
  192. data%Equipments%BopControlPanel%AnnularCloseLED = LedOff
  193. data%State%BopStackInput%AnnularCloseLedMine= LedOff
  194. data%Equipments%BopControlPanel%AnnularOpenLED = LedOn !LedBlinking
  195. data%State%RAM(1)%FourwayValve = 1
  196. endif
  197. endif
  198. !write(*,*) 'chekkk 2'
  199. endif
  200. if (data%State%RAM(1)%FourwayValve == 1 .and. data%State%Annular%Pannular_reg>data%State%AnnularComputational%AnnularMovingPressure &
  201. .and. (data%State%Annular%Annular_closed==0 .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2) <=100.0) .or. (data%State%Annular%Annular_closed==1 .and. data%State%PressureDisplay%PressureGauges(2)>100.0 .and. data%State%Annular%Pannular_reg>=data%State%AnnularComputational%AnnularSealingPressure))) then
  202. !write(*,*) 'open 4'
  203. data%State%RAM(1)%FourwayValve = 0
  204. data%State%Annular%Annular_closed=0
  205. !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
  206. data%State%AnnularComputational%p_annular=data%State%AnnularComputational%pa_annular
  207. data%State%Annular%AnnularLeverOld = data%Equipments%BopControlPanel%AnnularValve
  208. CALL OpenAnnular
  209. data%State%Annular%Annular_Situation_forTD= 0 ! open - for TD code
  210. data%State%RAM(1)%bop_type = 3
  211. !AbopAnnular=758.48 !(in^2)
  212. data%State%Annular%AbopAnnular=(data%Configuration%BopStack%AnnularPreventerOpen*231)/((data%State%Annular%IDAnnularBase-data%State%Annular%ODDrillpipe_inAnnularBase)/2.)
  213. data%State%Annular%NeededVolumeAnnular=data%State%Annular%AbopAnnular*(data%State%Annular%IDAnnularBase-data%State%Annular%IDAnnular)/(2*231.)
  214. data%State%RAM(1)%vdis_bottles=0.
  215. data%State%RAM(1)%fvr_air=0.
  216. data%State%RAM(1)%vdis_elecp=0.
  217. data%State%Annular%AnnularIsOpening = .true.
  218. data%State%Annular%AnnularIsClosing = .false.
  219. !write(*,*) 'open 2'
  220. endif
  221. data%State%RAM(1)%First_CloseTimecheck = 0
  222. data%State%RAM(1)%First_OpenTimecheck = 0
  223. data%State%RAM(1)%time=data%State%RAM(1)%time+data%State%RamLine%DeltaT_BOP !overal time (s)
  224. !===================================================
  225. ! BOP
  226. !===================================================
  227. if (data%State%Annular%Annular_closed==0) then !bop closing
  228. !write(*,*) 'AnnularIsClosing,AnnularIsOpening' , AnnularIsClosing,AnnularIsOpening
  229. call bop_codeAnnular(1) !ramtype=4 1=RNUMBER
  230. endif !bop is closing
  231. !================================================================
  232. if (data%State%Annular%Annular_closed==1) then
  233. data%State%RAM(1)%Q=0
  234. !p_bop=pram_reg
  235. data%State%AnnularComputational%p_annular=data%State%AnnularComputational%pa_annular
  236. endif
  237. data%State%RAM(1)%timecounter_ram=data%State%RAM(1)%timecounter_ram+1
  238. ! MiddleRamsStatus = IDshearBop
  239. ! UpperRamsStatus = IDPipeRam1
  240. ! LowerRamsStatus = IDPipeRam2
  241. ! AnnularStatus = IDAnnular
  242. ! AccumulatorPressureGauge = p_acc
  243. ! ManifoldPressureGauge= pram_reg
  244. ! AnnularPressureGauge=Pannular_reg
  245. !
  246. !
  247. !
  248. ! WRITE(60,60) data%State%RAM(1)%time,data%State%RAM(1)%Q,data%State%RAM(1)%vdis_tot,p_acc, &
  249. ! pram_reg,Pannular_reg,data%State%RAM(1)%p_bop,IDshearBop, &
  250. ! IDPipeRam1,IDPipeRam2,IDAnnular
  251. !60 FORMAT(11(f18.5))
  252. ! call sleepqq(100)
  253. !CALL CPU_TIME(Annular_EndTime)
  254. !
  255. !
  256. !data%State%Pump(1)%INT_CPU_TIME=IDINT((Annular_EndTime-Annular_StartTime)*1000.)
  257. !data%State%Pump(1)%Dt_ref=IDINT(DeltaT_BOP*1000.)
  258. !
  259. !call sleepqq(data%State%Pump(1)%Dt_ref-data%State%Pump(1)%INT_CPU_TIME)
  260. if (data%State%Annular%Annular_closed==1) then
  261. ! if ((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. (UpperRamsValve==1. .and. UpperRamsFailureMalf==0) .or. (UpperRamsValve==-1.0 .and. UpperRamsFailureMalf==0) .or. ChokeLineValve==1. .or. ChokeLineValve==-1.0 .or. KillLineValve==1. .or. KillLineValve==-1.0) then
  262. data%State%Annular%finished_Annular=1
  263. ! endif
  264. endif
  265. ! if (IsStopped == .true.) return
  266. ! end do loop5 !while finished_Annular==0
  267. if ( data%State%Annular%finished_Annular==1 .and. data%State%RAM(1)%Bottles_Charged_MalfActive==.true.) then
  268. call bop_codeAnnular(1) !ramtype=4 1=RNUMBER
  269. ! call sleepqq(100)
  270. endif
  271. END SUBROUTINE ANNULAR_SUB2