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.
 
 
 
 
 
 

312 line
13 KiB

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