|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- # 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/BopStack/SHEAR_RAM.f90"
-
- SUBROUTINE SHEAR_RAMS
- use SimulationVariables
- USE CBopStackVariables
- use CBopControlPanel
- use SimulationVariables
- USE CEquipmentsConstants
- ! use CSimulationVariables
- implicit none
-
-
-
- !=====================================================================
- ! SHEAR RAMS- BOP CAMERON Type U 5000
- ! START CONDITIONS FOR SHEAR RAMS
- !=====================================================================
-
- data%State%RAM(4)%SuccessionCounter = data%State%RAM(4)%SuccessionCounter + 1
-
- if (data%Equipments%BopControlPanel%MiddleRamsValve == 1.0 .and. data%State%ShearRAM%MiddleRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
-
- if (data%State%BopStackInput%MiddleRamsCloseLEDMine == LedOn) then
- RETURN
- end if
-
-
- if ( data%State%RAM(4)%SuccessionCounter /= data%State%RAM(4)%SuccessionCounterOld+1 ) then
- data%State%RAM(4)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(4)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(4)%SuccessionCounterOld= data%State%RAM(4)%SuccessionCounter
- endif
-
-
- if ( data%State%RAM(4)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- !return
-
- data%State%RAM(4)%First_CloseTimecheck= 1
-
- data%Equipments%BopControlPanel%MiddleRamsOpenLED = LedOff
- data%State%BopStackInput%MiddleRamsOpenLEDMine = LedOff
- data%Equipments%BopControlPanel%MiddleRamsCloseLED = LedOn !LedBlinking
-
- data%State%RAM(4)%FourwayValve = 1
-
- endif
-
- endif
-
-
- if (data%State%RAM(4)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
- !write(*,*) 'close 2'
- data%State%RAM(4)%FourwayValve = 0
-
-
- data%State%RamLine%ShearBop_closed=0
- !ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
- data%State%RAM(4)%vdis_tot=0
- data%State%RAM(4)%vdis_bottles=0.
- data%State%RAM(4)%fvr_air=0.
- data%State%RAM(4)%vdis_elecp=0.
- data%State%Pumps%Qiter=7
- data%State%RAM(4)%Qzero=70
- data%State%RAM(4)%Q=data%State%RAM(4)%Qzero
- data%State%RAM(4)%flow=70
- data%State%RAM(4)%tol=0.0037
-
-
- if (data%State%RamLine%FINISHED_shear==1) then
- data%State%RamLine%ShearRamsLeverOld=-1.0
- else
- data%State%RamLine%ShearRamsLeverOld=data%Equipments%BopControlPanel%MiddleRamsValve
- endif
- data%State%RamLine%FINISHED_shear=0
- data%State%RamLine%ShearRamIsClosing = .true.
- data%State%RamLine%ShearRamIsOpening = .false.
-
- data%State%RAM(4)%bop_type = 2
- !NeededVolumeShearRams=5.8 !galon for each BOP
- !AbopShearRam=196.67 !(in^2)
- data%State%ShearRAM%AbopShearRam=(data%Configuration%BopStack%BlindRamClose*231)/(data%State%ShearRAM%IDshearBopBase/2.)
- !NeededVolumeShearRams=BlindRamClose !galon for each BOP **changed
- data%State%ShearRAM%NeededVolumeShearRams=data%State%ShearRAM%AbopShearRam*(data%State%ShearRAM%IDshearBopBase-data%State%ShearRAM%ShearIsNotAllowed*data%State%ShearRAM%ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
- data%State%ShearRAM%VA=data%State%ShearRAM%AbopShearRam*(data%State%ShearRAM%IDshearBopBase-data%State%ShearRAM%ODDrillpipe_inShearRam)/(2.*231)
- data%State%ShearRAM%VB=data%State%ShearRAM%NeededVolumeShearRams
- endif
-
- if (data%Equipments%BopControlPanel%MiddleRamsValve == -1.0 .and. data%State%ShearRAM%MiddleRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
-
- if (data%State%BopStackInput%MiddleRamsOpenLEDMine == LedOn) then
- RETURN
- end if
-
- if ( data%State%RAM(4)%SuccessionCounter /= data%State%RAM(4)%SuccessionCounterOld+1 ) then
- data%State%RAM(4)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(4)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(4)%SuccessionCounterOld= data%State%RAM(4)%SuccessionCounter
- endif
-
-
- if ( data%State%RAM(4)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- !return
-
- data%State%RAM(4)%First_OpenTimecheck= 1
-
- data%Equipments%BopControlPanel%MiddleRamsCloseLED = LedOff !new
- data%State%BopStackInput%MiddleRamsCloseLEDMine = LedOff !new
- data%Equipments%BopControlPanel%MiddleRamsOpenLED = LedOn !LedBlinking
-
- endif
-
- endif
-
-
- if (data%State%RAM(4)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
- !write(*,*) 'open 2'
-
- data%State%RAM(4)%FourwayValve = 0
-
-
-
- data%State%RamLine%ShearBop_closed=0
- !ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
- data%State%RAM(4)%vdis_tot=0
- data%State%RAM(4)%vdis_bottles=0.
- data%State%RAM(4)%fvr_air=0.
- data%State%RAM(4)%vdis_elecp=0.
- data%State%Pumps%Qiter=7
- data%State%RAM(4)%Qzero=70
- data%State%RAM(4)%Q=data%State%RAM(4)%Qzero
- data%State%RAM(4)%flow=70
- data%State%RAM(4)%tol=0.0037
-
- if (data%State%RamLine%FINISHED_shear==1) then
- data%State%RamLine%ShearRamsLeverOld=1.0
- else
- data%State%RamLine%ShearRamsLeverOld=data%Equipments%BopControlPanel%MiddleRamsValve
- endif
- data%State%RamLine%FINISHED_shear=0
- data%State%RamLine%ShearRamIsOpening = .true.
- data%State%RamLine%ShearRamIsClosing = .false.
-
- data%State%RAM(4)%bop_type = 3
- !AbopShearRam=186.5 !(in^2)
- data%State%ShearRAM%AbopShearRam=(data%Configuration%BopStack%BlindRamOpen*231)/(data%State%ShearRAM%IDshearBopBase/2.)
- !NeededVolumeShearRams=5.5 !galon for each BOP
- !NeededVolumeShearRams=BlindRamOpen ! **changed
- data%State%ShearRAM%NeededVolumeShearRams=data%State%ShearRAM%AbopShearRam*(data%State%ShearRAM%IDshearBopBase-data%State%ShearRAM%ShearIsNotAllowed*data%State%ShearRAM%ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
- !va=AbopShearRam*(IDshearBopBase-ODDrillpipe_inShearRam)/(2.*231)
- !vb=NeededVolumeShearRams
- endif
- !=====================================================================
- ! if (ShearRamIsOpening .or. ShearRamIsClosing .or. data%State%RAM(4)%Bottles_Charged_MalfActive) then
- ! CALL SHEAR_RAMS_SUB
- ! end if
-
- END SUBROUTINE SHEAR_RAMS
-
-
-
-
-
- SUBROUTINE SHEAR_RAMS_SUB
- use SimulationVariables
- USE CBopStackVariables
- use CBopControlPanel
- use SimulationVariables
- USE CEquipmentsConstants
- ! use CSimulationVariables
- implicit none
-
- ! FirstSet= 0
- ! RamsFirstSet= 0
-
- ! loop2: do while (finished_shear==0)
- data%State%RAM(4)%SuccessionCounter = data%State%RAM(4)%SuccessionCounter + 1
- if (data%Equipments%BopControlPanel%MiddleRamsValve == 1.0 .and. data%State%RamLine%ShearRamsLeverOld == -1.0 .and. data%State%ShearRAM%MiddleRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RAM(4)%First_CloseTimecheck == 0) then
- if ( data%State%RAM(4)%SuccessionCounter /= data%State%RAM(4)%SuccessionCounterOld+1 ) then
- data%State%RAM(4)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(4)%SuccessionCounterOld = 0 ! also in starup
- else
- data%State%RAM(4)%SuccessionCounterOld= data%State%RAM(4)%SuccessionCounter
- endif
- if ( data%State%RAM(4)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- data%Equipments%BopControlPanel%MiddleRamsOpenLED = LedOff
- data%State%BopStackInput%MiddleRamsOpenLEDMine = LedOff
- data%Equipments%BopControlPanel%MiddleRamsCloseLED = LedOn !LedBlinking
- data%State%RAM(4)%FourwayValve = 1
- endif
- endif
-
- if (data%State%RAM(4)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
- data%State%RAM(4)%FourwayValve = 0
- data%State%RamLine%ShearBop_closed=0
- data%State%RAM(4)%p_bop=data%State%ShearRAM%PA
- data%State%RamLine%ShearRamsLeverOld = data%Equipments%BopControlPanel%MiddleRamsValve
- CALL OpenMiddleRams ! for C code
- data%State%RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
- data%State%RAM(4)%bop_type = 2
- data%State%ShearRAM%AbopShearRam=(data%Configuration%BopStack%BlindRamClose*231)/(data%State%ShearRAM%IDshearBopBase/2.)
- data%State%ShearRAM%NeededVolumeShearRams=data%State%ShearRAM%AbopShearRam*(data%State%ShearRAM%IDshearBop-data%State%ShearRAM%ShearIsNotAllowed*data%State%ShearRAM%ODDrillpipe_inShearRam)/(2.*231) ! **changed
- data%State%RAM(4)%vdis_bottles=0.
- data%State%RAM(4)%fvr_air=0.
- data%State%RAM(4)%vdis_elecp=0.
- data%State%RamLine%ShearRamIsClosing = .true.
- data%State%RamLine%ShearRamIsOpening = .false.
- endif
-
- if (data%Equipments%BopControlPanel%MiddleRamsValve == -1.0 .and. data%State%RamLine%ShearRamsLeverOld == 1.0 .and. data%State%ShearRAM%MiddleRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1 .and. data%State%RAM(4)%First_OpenTimecheck == 0) then
- if ( data%State%RAM(4)%SuccessionCounter /= data%State%RAM(4)%SuccessionCounterOld+1 ) then
- data%State%RAM(4)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(4)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(4)%SuccessionCounterOld= data%State%RAM(4)%SuccessionCounter
- endif
-
- if ( data%State%RAM(4)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- data%Equipments%BopControlPanel%MiddleRamsCloseLED = LedOff
- data%State%BopStackInput%MiddleRamsCloseLEDMine = LedOff
- data%Equipments%BopControlPanel%MiddleRamsOpenLED = LedOn !LedBlinking
- data%State%RAM(4)%FourwayValve = 1
- endif
- endif
-
- if (data%State%RAM(4)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
- data%State%RAM(4)%FourwayValve = 0
- data%State%RamLine%ShearBop_closed=0
- data%State%RAM(4)%p_bop=data%State%ShearRAM%PA
- data%State%RamLine%ShearRamsLeverOld = data%Equipments%BopControlPanel%MiddleRamsValve
- CALL OpenMiddleRams
- data%State%RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
- data%State%RAM(4)%bop_type = 3
- data%State%ShearRAM%NeededVolumeShearRams=data%State%ShearRAM%AbopShearRam*(data%State%ShearRAM%IDshearBopBase-data%State%ShearRAM%IDshearBop)/(2.*231)
- data%State%RAM(4)%vdis_bottles=0.
- data%State%RAM(4)%fvr_air=0.
- data%State%RAM(4)%vdis_elecp=0.
- data%State%RamLine%ShearRamIsOpening = .true.
- data%State%RamLine%ShearRamIsClosing = .false.
- endif
-
- data%State%RAM(4)%First_CloseTimecheck = 0
- data%State%RAM(4)%First_OpenTimecheck = 0
- data%State%RAM(4)%time=data%State%RAM(4)%time+data%State%RamLine%DeltaT_BOP !overal time (s)
-
- !===================================================
- ! BOP
- !===================================================
- if (data%State%RamLine%ShearBop_closed==0) then !bop closing
- call bop_code(1,data%State%ShearRAM%H_ShearRamBop,4) !ramtype=1 4=RNUMBER
- endif !bop is closing
- !================================================================
- if (data%State%RamLine%ShearBop_closed==1) then
- data%State%RAM(4)%Q=0
- data%State%RAM(4)%p_bop=data%State%ShearRAM%PA
- data%State%RAMS%minloss(4,17)=0. !RNUMBER=4
- endif
-
- data%State%RAM(4)%timecounter_ram=data%State%RAM(4)%timecounter_ram+1
- ! commented by mahmood
- ! call sleepqq(100)
-
- if (data%State%RamLine%ShearBop_closed==1) then
- data%State%RamLine%FINISHED_shear=1
- endif
- ! if (IsStopped == .true.) return
- ! end do loop2 !while finished_shear==0
-
- ! if ( finished_shear==1 .and. data%State%RAM(4)%Bottles_Charged_MalfActive==.true.) then
- ! call bop_code(1,H_ShearRamBop,4) !ramtype=1 4=RNUMBER
- ! call sleepqq(100)
- ! endif
-
- END SUBROUTINE SHEAR_RAMS_SUB
|