Simulation Core
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

ANNULAR.f90 19 KiB

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