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.
 
 
 
 
 
 

310 lines
13 KiB

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