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.
 
 
 
 
 
 

274 lines
11 KiB

  1. SUBROUTINE SHEAR_RAMS
  2. USE VARIABLES
  3. USE CBopStackVariables
  4. USE CBopControlPanelVariables
  5. USE CEquipmentsConstants
  6. ! use CSimulationVariables
  7. implicit none
  8. !=====================================================================
  9. ! SHEAR RAMS- BOP CAMERON Type U 5000
  10. ! START CONDITIONS FOR SHEAR RAMS
  11. !=====================================================================
  12. RAM(4)%SuccessionCounter = RAM(4)%SuccessionCounter + 1
  13. if (BopControlPanel%MiddleRamsValve == 1.0 .and. ShearRam%MiddleRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
  14. if (BopStackInput%MiddleRamsCloseLEDMine == LedOn) then
  15. RETURN
  16. end if
  17. if ( RAM(4)%SuccessionCounter /= RAM(4)%SuccessionCounterOld+1 ) then
  18. RAM(4)%SuccessionCounter = 0 ! also in starup
  19. RAM(4)%SuccessionCounterOld = 0 ! also in starup
  20. !return
  21. else
  22. RAM(4)%SuccessionCounterOld= RAM(4)%SuccessionCounter
  23. endif
  24. if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
  25. !return
  26. RAM(4)%First_CloseTimecheck= 1
  27. BopControlPanel%MiddleRamsOpenLED = LedOff
  28. BopStackInput%MiddleRamsOpenLEDMine = LedOff
  29. BopControlPanel%MiddleRamsCloseLED = LedOn !LedBlinking
  30. RAM(4)%FourwayValve = 1
  31. endif
  32. endif
  33. if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
  34. !write(*,*) 'close 2'
  35. RAM(4)%FourwayValve = 0
  36. RamLine%ShearBop_closed=0
  37. !ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
  38. RAM(4)%vdis_tot=0
  39. RAM(4)%vdis_bottles=0.
  40. RAM(4)%fvr_air=0.
  41. RAM(4)%vdis_elecp=0.
  42. Pumps%Qiter=7
  43. RAM(4)%Qzero=70
  44. RAM(4)%Q=RAM(4)%Qzero
  45. RAM(4)%flow=70
  46. RAM(4)%tol=0.0037
  47. if (RamLine%FINISHED_shear==1) then
  48. RamLine%ShearRamsLeverOld=-1.0
  49. else
  50. RamLine%ShearRamsLeverOld=BopControlPanel%MiddleRamsValve
  51. endif
  52. RamLine%FINISHED_shear=0
  53. RamLine%ShearRamIsClosing = .true.
  54. RamLine%ShearRamIsOpening = .false.
  55. RAM(4)%bop_type = 2
  56. !NeededVolumeShearRams=5.8 !galon for each BOP
  57. !AbopShearRam=196.67 !(in^2)
  58. ShearRam%AbopShearRam=(BopStackSpecification%BlindRamClose*231)/(ShearRam%IDshearBopBase/2.)
  59. !NeededVolumeShearRams=BlindRamClose !galon for each BOP **changed
  60. ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
  61. ShearRam%VA=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%ODDrillpipe_inShearRam)/(2.*231)
  62. ShearRam%VB=ShearRam%NeededVolumeShearRams
  63. endif
  64. if (BopControlPanel%MiddleRamsValve == -1.0 .and. ShearRam%MiddleRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
  65. if (BopStackInput%MiddleRamsOpenLEDMine == LedOn) then
  66. RETURN
  67. end if
  68. if ( RAM(4)%SuccessionCounter /= RAM(4)%SuccessionCounterOld+1 ) then
  69. RAM(4)%SuccessionCounter = 0 ! also in starup
  70. RAM(4)%SuccessionCounterOld = 0 ! also in starup
  71. !return
  72. else
  73. RAM(4)%SuccessionCounterOld= RAM(4)%SuccessionCounter
  74. endif
  75. if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
  76. !return
  77. RAM(4)%First_OpenTimecheck= 1
  78. BopControlPanel%MiddleRamsCloseLED = LedOff !new
  79. BopStackInput%MiddleRamsCloseLEDMine = LedOff !new
  80. BopControlPanel%MiddleRamsOpenLED = LedOn !LedBlinking
  81. endif
  82. endif
  83. if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
  84. !write(*,*) 'open 2'
  85. RAM(4)%FourwayValve = 0
  86. RamLine%ShearBop_closed=0
  87. !ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
  88. RAM(4)%vdis_tot=0
  89. RAM(4)%vdis_bottles=0.
  90. RAM(4)%fvr_air=0.
  91. RAM(4)%vdis_elecp=0.
  92. Pumps%Qiter=7
  93. RAM(4)%Qzero=70
  94. RAM(4)%Q=RAM(4)%Qzero
  95. RAM(4)%flow=70
  96. RAM(4)%tol=0.0037
  97. if (RamLine%FINISHED_shear==1) then
  98. RamLine%ShearRamsLeverOld=1.0
  99. else
  100. RamLine%ShearRamsLeverOld=BopControlPanel%MiddleRamsValve
  101. endif
  102. RamLine%FINISHED_shear=0
  103. RamLine%ShearRamIsOpening = .true.
  104. RamLine%ShearRamIsClosing = .false.
  105. RAM(4)%bop_type = 3
  106. !AbopShearRam=186.5 !(in^2)
  107. ShearRam%AbopShearRam=(BopStackSpecification%BlindRamOpen*231)/(ShearRam%IDshearBopBase/2.)
  108. !NeededVolumeShearRams=5.5 !galon for each BOP
  109. !NeededVolumeShearRams=BlindRamOpen ! **changed
  110. ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
  111. !va=AbopShearRam*(IDshearBopBase-ODDrillpipe_inShearRam)/(2.*231)
  112. !vb=NeededVolumeShearRams
  113. endif
  114. !=====================================================================
  115. ! if (ShearRamIsOpening .or. ShearRamIsClosing .or. RAM(4)%Bottles_Charged_MalfActive) then
  116. ! CALL SHEAR_RAMS_SUB
  117. ! end if
  118. END SUBROUTINE SHEAR_RAMS
  119. SUBROUTINE SHEAR_RAMS_SUB
  120. USE VARIABLES
  121. USE CBopStackVariables
  122. USE CBopControlPanelVariables
  123. USE CEquipmentsConstants
  124. ! use CSimulationVariables
  125. implicit none
  126. ! FirstSet= 0
  127. ! RamsFirstSet= 0
  128. ! loop2: do while (finished_shear==0)
  129. RAM(4)%SuccessionCounter = RAM(4)%SuccessionCounter + 1
  130. if (BopControlPanel%MiddleRamsValve == 1.0 .and. RamLine%ShearRamsLeverOld == -1.0 .and. ShearRam%MiddleRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RAM(4)%First_CloseTimecheck == 0) then
  131. if ( RAM(4)%SuccessionCounter /= RAM(4)%SuccessionCounterOld+1 ) then
  132. RAM(4)%SuccessionCounter = 0 ! also in starup
  133. RAM(4)%SuccessionCounterOld = 0 ! also in starup
  134. else
  135. RAM(4)%SuccessionCounterOld= RAM(4)%SuccessionCounter
  136. endif
  137. if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
  138. BopControlPanel%MiddleRamsOpenLED = LedOff
  139. BopStackInput%MiddleRamsOpenLEDMine = LedOff
  140. BopControlPanel%MiddleRamsCloseLED = LedOn !LedBlinking
  141. RAM(4)%FourwayValve = 1
  142. endif
  143. endif
  144. if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
  145. RAM(4)%FourwayValve = 0
  146. RamLine%ShearBop_closed=0
  147. RAM(4)%p_bop=ShearRam%PA
  148. RamLine%ShearRamsLeverOld = BopControlPanel%MiddleRamsValve
  149. CALL OpenMiddleRams ! for C code
  150. RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
  151. RAM(4)%bop_type = 2
  152. ShearRam%AbopShearRam=(BopStackSpecification%BlindRamClose*231)/(ShearRam%IDshearBopBase/2.)
  153. ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBop-ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam)/(2.*231) ! **changed
  154. RAM(4)%vdis_bottles=0.
  155. RAM(4)%fvr_air=0.
  156. RAM(4)%vdis_elecp=0.
  157. RamLine%ShearRamIsClosing = .true.
  158. RamLine%ShearRamIsOpening = .false.
  159. endif
  160. if (BopControlPanel%MiddleRamsValve == -1.0 .and. RamLine%ShearRamsLeverOld == 1.0 .and. ShearRam%MiddleRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RAM(4)%First_OpenTimecheck == 0) then
  161. if ( RAM(4)%SuccessionCounter /= RAM(4)%SuccessionCounterOld+1 ) then
  162. RAM(4)%SuccessionCounter = 0 ! also in starup
  163. RAM(4)%SuccessionCounterOld = 0 ! also in starup
  164. !return
  165. else
  166. RAM(4)%SuccessionCounterOld= RAM(4)%SuccessionCounter
  167. endif
  168. if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
  169. BopControlPanel%MiddleRamsCloseLED = LedOff
  170. BopStackInput%MiddleRamsCloseLEDMine = LedOff
  171. BopControlPanel%MiddleRamsOpenLED = LedOn !LedBlinking
  172. RAM(4)%FourwayValve = 1
  173. endif
  174. endif
  175. if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
  176. RAM(4)%FourwayValve = 0
  177. RamLine%ShearBop_closed=0
  178. RAM(4)%p_bop=ShearRam%PA
  179. RamLine%ShearRamsLeverOld = BopControlPanel%MiddleRamsValve
  180. CALL OpenMiddleRams
  181. RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
  182. RAM(4)%bop_type = 3
  183. ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%IDshearBop)/(2.*231)
  184. RAM(4)%vdis_bottles=0.
  185. RAM(4)%fvr_air=0.
  186. RAM(4)%vdis_elecp=0.
  187. RamLine%ShearRamIsOpening = .true.
  188. RamLine%ShearRamIsClosing = .false.
  189. endif
  190. RAM(4)%First_CloseTimecheck = 0
  191. RAM(4)%First_OpenTimecheck = 0
  192. RAM(4)%time=RAM(4)%time+RamLine%DeltaT_BOP !overal time (s)
  193. !===================================================
  194. ! BOP
  195. !===================================================
  196. if (RamLine%ShearBop_closed==0) then !bop closing
  197. call bop_code(1,ShearRam%H_ShearRamBop,4) !ramtype=1 4=RNUMBER
  198. endif !bop is closing
  199. !================================================================
  200. if (RamLine%ShearBop_closed==1) then
  201. RAM(4)%Q=0
  202. RAM(4)%p_bop=ShearRam%PA
  203. RAMS%minloss(4,17)=0. !RNUMBER=4
  204. endif
  205. RAM(4)%timecounter_ram=RAM(4)%timecounter_ram+1
  206. call sleepqq(100)
  207. if (RamLine%ShearBop_closed==1) then
  208. RamLine%FINISHED_shear=1
  209. endif
  210. ! if (IsStopped == .true.) return
  211. ! end do loop2 !while finished_shear==0
  212. ! if ( finished_shear==1 .and. RAM(4)%Bottles_Charged_MalfActive==.true.) then
  213. ! call bop_code(1,H_ShearRamBop,4) !ramtype=1 4=RNUMBER
  214. ! call sleepqq(100)
  215. ! endif
  216. END SUBROUTINE SHEAR_RAMS_SUB