|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- # 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/BopStack/PIPE_RAM2.f90"
-
-
- SUBROUTINE PIPE_RAMS2
- use SimulationVariables
- USE CBopStackVariables
- use CBopControlPanel
- use SimulationVariables
- USE CEquipmentsConstants
- ! ! use CSimulationVariables
- implicit none
-
-
- !write(*,*) 'checkpoint 1'
-
- !=====================================================================
- ! PIPE RAMS 2- BOP CAMERON Type U 5000
- ! START CONDITIONS FOR PIPE RAMS 2
- !=====================================================================
- data%State%RAM(3)%SuccessionCounter = data%State%RAM(3)%SuccessionCounter + 1
-
-
- if (data%Equipments%BopControlPanel%LowerRamsValve == 1.0 .and. data%State%PipeRam2%LowerRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
- !write(*,*) 'close 1'
-
-
- if (data%State%BopStackInput%LowerRamsCloseLEDMine == LedOn) then
- RETURN
- end if
-
-
- if ( data%State%RAM(3)%SuccessionCounter /= data%State%RAM(3)%SuccessionCounterOld+1 ) then
- data%State%RAM(3)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(3)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(3)%SuccessionCounterOld= data%State%RAM(3)%SuccessionCounter
- endif
-
-
- if ( data%State%RAM(3)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- !return
-
- data%State%RAM(3)%First_CloseTimecheck= 1
-
- data%Equipments%BopControlPanel%LowerRamsOpenLED = LedOff
- data%State%BopStackInput%LowerRamsOpenLEDMine = LedOff
- data%Equipments%BopControlPanel%LowerRamsCloseLED = LedOn !LedBlinking
-
- data%State%RAM(3)%FourwayValve = 1
-
- endif
-
-
- endif
-
-
-
- if (data%State%RAM(3)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
- !write(*,*) 'close 2'
-
-
-
- data%State%RAM(3)%FourwayValve = 0
-
- data%State%PipeRam2%closed=0
- !PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
- data%State%RAM(3)%vdis_tot=0
- data%State%RAM(3)%vdis_bottles=0.
- data%State%RAM(3)%fvr_air=0.
- data%State%RAM(3)%vdis_elecp=0.
- data%State%Pumps%Qiter=7
- data%State%RAM(3)%Qzero=70
- data%State%RAM(3)%Q=data%State%RAM(3)%Qzero
- data%State%RAM(3)%flow=70
- data%State%RAM(3)%tol=0.0037
- if (data%State%PipeRam2%finished==1) then
- data%State%PipeRam2%LeverOld=-1.0
- else
- data%State%PipeRam2%LeverOld=data%Equipments%BopControlPanel%LowerRamsValve
- endif
- data%State%PipeRam2%finished=0
- data%State%PipeRam2%IsClosing = .true.
- data%State%PipeRam2%IsOpening = .false.
-
-
- data%State%RAM(3)%bop_type = 3
- !AbopPipeRam=196.67
- data%State%PipeRam1%A=(data%Configuration%BopStack%LowerRamClose*231)/((data%State%PipeRam1%IDBase-data%State%PipeRam1%ODDrillpipe_inBase)/2.)
- data%State%PipeRam2%NeededVolume=data%State%PipeRam1%A*(data%State%PipeRam1%IDBase-max(data%State%PipeRam2%ODDrillpipe_in,data%State%PipeRam1%ODDrillpipe_inBase))/(2.*231) !galon for each BOP
- !write(*,*) 'close 1'
- endif
-
- if (data%Equipments%BopControlPanel%LowerRamsValve == -1.0 .and. data%State%PipeRam2%LowerRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
- !write(*,*) 'open 1'
-
- if (data%State%BopStackInput%LowerRamsOpenLEDMine == LedOn) then
- RETURN
- end if
-
-
- if ( data%State%RAM(3)%SuccessionCounter /= data%State%RAM(3)%SuccessionCounterOld+1 ) then
- data%State%RAM(3)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(3)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(3)%SuccessionCounterOld= data%State%RAM(3)%SuccessionCounter
- endif
-
-
- if ( data%State%RAM(3)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- !return
-
- data%State%RAM(3)%First_OpenTimecheck= 1
-
- data%Equipments%BopControlPanel%LowerRamsCloseLED = LedOff !new
- data%State%BopStackInput%LowerRamsCloseLEDMine = LedOff !new
- data%Equipments%BopControlPanel%LowerRamsOpenLED = LedOn !LedBlinking
-
- data%State%RAM(3)%FourwayValve = 1
-
- endif
-
-
- endif
-
-
- if (data%State%RAM(3)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
- !write(*,*) 'open 2'
-
- data%State%RAM(3)%FourwayValve = 0
-
- data%State%PipeRam2%closed=0
- !PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
- data%State%RAM(3)%vdis_tot=0
- data%State%RAM(3)%vdis_bottles=0.
- data%State%RAM(3)%fvr_air=0.
- data%State%RAM(3)%vdis_elecp=0.
- data%State%Pumps%Qiter=7
- data%State%RAM(3)%Qzero=70
- data%State%RAM(3)%Q=data%State%RAM(3)%Qzero
- data%State%RAM(3)%flow=70
- data%State%RAM(3)%tol=0.0037
-
- if (data%State%PipeRam2%finished==1) then
- data%State%PipeRam2%LeverOld=1.0
- else
- data%State%PipeRam2%LeverOld=data%Equipments%BopControlPanel%LowerRamsValve
- endif
- data%State%PipeRam2%finished=0
- data%State%PipeRam2%IsOpening = .true.
- data%State%PipeRam2%IsClosing = .false.
-
-
- !if (LowerRamsOpenLED == LedOn) then
- ! RETURN
- !end if
-
-
- data%State%RAM(3)%bop_type = 3
- !AbopPipeRam=186.5
- data%State%PipeRam1%A=(data%Configuration%BopStack%LowerRamOpen*231)/((data%State%PipeRam1%IDBase-data%State%PipeRam1%ODDrillpipe_inBase)/2.)
- data%State%PipeRam2%NeededVolume=data%State%PipeRam1%A*(data%State%PipeRam1%IDBase-max(data%State%PipeRam2%ODDrillpipe_in,data%State%PipeRam1%ODDrillpipe_inBase))/(2.*231) !galon for each BOP
- !write(*,*) 'open 1'
-
- endif
-
-
- !=====================================================================
-
- if (data%State%PipeRam2%IsOpening .or. data%State%PipeRam2%IsClosing .or. data%State%RAM(3)%Bottles_Charged_MalfActive) then
- data%State%Annular%FirstSet= 0
- data%State%AnnularComputational%RamsFirstSet= 0
- CALL PIPE_RAMS2_SUB
- end if
-
- END SUBROUTINE PIPE_RAMS2
-
-
-
-
-
-
-
-
-
-
-
-
- SUBROUTINE PIPE_RAMS2_SUB
-
- use SimulationVariables
- USE CBopStackVariables
- use CBopControlPanel
- use SimulationVariables
- USE CEquipmentsConstants
- ! use CSimulationVariables
- implicit none
-
-
- ! FirstSet= 0
- ! RamsFirstSet= 0
-
- ! loop4: do while (finished_pipe2==0)
-
- !write(*,*) 'checkpoint 2'
-
-
- data%State%RAM(3)%SuccessionCounter = data%State%RAM(3)%SuccessionCounter + 1
-
-
- if (data%Equipments%BopControlPanel%LowerRamsValve == 1.0 .and. data%State%PipeRam2%LeverOld == -1.0 .and. data%State%PipeRam2%LowerRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
-
- !write(*,*) 'close 3'
-
- if ( data%State%RAM(3)%First_CloseTimecheck == 0 ) then
-
-
- if ( data%State%RAM(3)%SuccessionCounter /= data%State%RAM(3)%SuccessionCounterOld+1 ) then
- data%State%RAM(3)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(3)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(3)%SuccessionCounterOld= data%State%RAM(3)%SuccessionCounter
- endif
-
-
-
- if ( data%State%RAM(3)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- !return
-
- data%Equipments%BopControlPanel%LowerRamsOpenLED = LedOff
- data%State%BopStackInput%LowerRamsOpenLEDMine = LedOff
- data%Equipments%BopControlPanel%LowerRamsCloseLED = LedOn !LedBlinking
-
- data%State%RAM(3)%FourwayValve = 1
-
- endif
-
- endif
-
-
-
-
- endif
-
- if (data%State%RAM(3)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
- !write(*,*) 'close 4'
-
- data%State%RAM(3)%FourwayValve = 0
-
-
- data%State%PipeRam2%closed=0
- !PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
- data%State%RAM(3)%p_bop=data%State%ShearRAM%PA
- data%State%PipeRam2%LeverOld = data%Equipments%BopControlPanel%LowerRamsValve
-
- CALL OpenLowerRams
- data%State%PipeRam2%Situation_forTD= 0 ! open - for TD code
- data%State%RAM(3)%bop_type = 3
- !AbopPipeRam=196.67
- data%State%PipeRam1%A=(data%Configuration%BopStack%LowerRamClose*231)/((data%State%PipeRam1%IDBase-data%State%PipeRam1%ODDrillpipe_inBase)/2.)
- data%State%PipeRam2%NeededVolume=data%State%PipeRam1%A*(data%State%PipeRam2%ID-max(data%State%PipeRam2%ODDrillpipe_in,data%State%PipeRam1%ODDrillpipe_inBase))/(2.*231)
-
- data%State%RAM(3)%vdis_bottles=0.
- data%State%RAM(3)%fvr_air=0.
- data%State%RAM(3)%vdis_elecp=0.
- data%State%PipeRam2%IsClosing = .true.
- data%State%PipeRam2%IsOpening = .false.
- !write(*,*) 'close 2'
-
- endif
-
- if (data%Equipments%BopControlPanel%LowerRamsValve == -1.0 .and. data%State%PipeRam2%LeverOld == 1.0 .and. data%State%PipeRam2%LowerRamsFailureMalf==0 .and. data%State%BopStackAcc%RigAirMalf==0 .and. data%Equipments%BopControlPanel%AirMasterValve==1) then
- !write(*,*) 'open 3'
-
-
- if ( data%State%RAM(3)%First_OpenTimecheck == 0 ) then
-
- if ( data%State%RAM(3)%SuccessionCounter /= data%State%RAM(3)%SuccessionCounterOld+1 ) then
- data%State%RAM(3)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(3)%SuccessionCounterOld = 0 ! also in starup
- !return
- else
- data%State%RAM(3)%SuccessionCounterOld= data%State%RAM(3)%SuccessionCounter
- endif
-
- if ( data%State%RAM(3)%SuccessionCounter >= int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- !return
-
- data%Equipments%BopControlPanel%LowerRamsCloseLED = LedOff
- data%State%BopStackInput%LowerRamsCloseLEDMine = LedOff
- data%Equipments%BopControlPanel%LowerRamsOpenLED = LedOn !LedBlinking
-
- data%State%RAM(3)%FourwayValve = 1
-
- endif
-
- endif
-
-
- endif
-
-
- if (data%State%RAM(3)%FourwayValve == 1 .and. data%State%RamLine%P_ACC>data%State%BopStackAcc%acc_MinPressure) then
- !write(*,*) 'open 4'
-
- data%State%RAM(3)%FourwayValve = 0
-
- data%State%PipeRam2%closed=0
- !PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
- data%State%RAM(3)%p_bop=data%State%ShearRAM%PA
- data%State%PipeRam2%LeverOld = data%Equipments%BopControlPanel%LowerRamsValve
-
- CALL OpenLowerRams
- data%State%PipeRam2%Situation_forTD= 0 ! open - for TD code
- data%State%RAM(3)%bop_type = 3
- !AbopPipeRam=186.5
- data%State%PipeRam1%A=(data%Configuration%BopStack%LowerRamOpen*231)/((data%State%PipeRam1%IDBase-data%State%PipeRam1%ODDrillpipe_inBase)/2.)
- data%State%PipeRam2%NeededVolume=data%State%PipeRam1%A*(data%State%PipeRam1%IDBase-data%State%PipeRam2%ID)/(2.*231)
- data%State%RAM(3)%vdis_bottles=0.
- data%State%RAM(3)%fvr_air=0.
- data%State%RAM(3)%vdis_elecp=0.
-
- data%State%PipeRam2%IsOpening = .true.
- data%State%PipeRam2%IsClosing = .false.
- !write(*,*) 'open 2'
-
- endif
-
-
- data%State%RAM(3)%First_CloseTimecheck = 0
- data%State%RAM(3)%First_OpenTimecheck = 0
-
-
- data%State%RAM(3)%time=data%State%RAM(3)%time+data%State%RamLine%DeltaT_BOP !overal time (s)
-
-
-
- !===================================================
- ! BOP
- !===================================================
- if (data%State%PipeRam2%closed==0) then !bop closing
- !write(*,*) 'BOP code is called'
- call bop_code(3,data%State%PipeRam2%H_Bop,3) !ramtype=3 3=RNUMBER
- endif !bop is closing
- !================================================================
- if (data%State%PipeRam2%closed==1) then
- data%State%RAM(3)%Q=0
- !p_bop=pram_reg
- data%State%RAM(3)%p_bop=data%State%ShearRAM%PA
- data%State%RAMS%minloss(3,17)=0. !RNUMBER=3
- endif
-
- data%State%RAM(3)%timecounter_ram=data%State%RAM(3)%timecounter_ram+1
-
-
-
-
-
- ! MiddleRamsStatus = IDshearBop
- ! UpperRamsStatus = IDPipeRam1
- ! LowerRamsStatus = IDPipeRam2
- ! AnnularStatus = IDAnnular
- ! AccumulatorPressureGauge = p_acc
- ! ManifoldPressureGauge= pram_reg
- ! AnnularPressureGauge=Pannular_reg
- !
- !
- !
- ! WRITE(60,60) data%State%RAM(3)%time,data%State%RAM(3)%Q,data%State%RAM(3)%vdis_tot,p_acc, &
- ! pram_reg,Pannular_reg,data%State%RAM(3)%p_bop,IDshearBop, &
- ! IDPipeRam1,IDPipeRam2,IDAnnular
- !60 FORMAT(11(f18.5))
-
-
- ! call sleepqq(100)
-
- if (data%State%PipeRam2%closed==1) then
-
- ! if ((MiddleRamsValve==1. .and. MiddleRamsFailureMalf==0) .or. (MiddleRamsValve==-1.0 .and. MiddleRamsFailureMalf==0) .or. (UpperRamsValve==1. .and. UpperRamsFailureMalf==0) .or. (UpperRamsValve==-1.0 .and. UpperRamsFailureMalf==0) .or. (AnnularValve==1. .and. AnnularFailureMalf==0) .or. (AnnularValve==-1.0 .and. AnnularFailureMalf==0) .or. ChokeLineValve==1. .or. ChokeLineValve==-1.0 .or. KillLineValve==1. .or. KillLineValve==-1.0) then
- data%State%PipeRam2%finished=1
- ! endif
- endif
-
- ! if (IsStopped == .true.) return
-
-
- ! end do loop4 !while finished_pipe2==0
-
- if ( data%State%PipeRam2%finished==1 .and. data%State%RAM(3)%Bottles_Charged_MalfActive==.true.) then
- call bop_code(3,data%State%PipeRam2%H_Bop,3) !ramtype=3 3=RNUMBER
- ! call sleepqq(100)
- endif
-
-
-
-
- END SUBROUTINE PIPE_RAMS2_SUB
|