SUBROUTINE ANNULAR_SUB1 USE VARIABLES USE CBopControlPanelVariables use PressureDisplayVARIABLESModule USE CEquipmentsConstants USE CBopStackVariables implicit none !write(*,*) 'checkpoint 1' !===================================================================== ! ANNULAR PREVENTER- BOP CAMERON Type U 5000 ! START CONDITIONS FOR ANNULAR PREVENTER !===================================================================== RAM(1)%SuccessionCounter = RAM(1)%SuccessionCounter + 1 if (BopControlPanel%AnnularValve == 1.0 .and. Annular%AnnularFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then if (BopStackInput%AnnularCloseLedMine == LedOn) then RETURN end if if ( RAM(1)%SuccessionCounter /= RAM(1)%SuccessionCounterOld+1 ) then RAM(1)%SuccessionCounter = 0 ! also in starup RAM(1)%SuccessionCounterOld = 0 ! also in starup !return else RAM(1)%SuccessionCounterOld= RAM(1)%SuccessionCounter endif if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then !return RAM(1)%First_CloseTimecheck= 1 BopControlPanel%AnnularOpenLED = LedOff BopStackInput%AnnularOpenLedMine = LedOff BopControlPanel%AnnularCloseLED = LedOn !LedBlinking RAM(1)%FourwayValve = 1 endif endif if (RAM(1)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure .and. Annular%Pannular_reg>AnnularComputational%AnnularMovingPressure) then ! 1: Open , 0: Close RAM(1)%FourwayValve = 0 Annular%Annular_closed=0 !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) RAM(1)%vdis_tot=0 RAM(1)%vdis_bottles=0. RAM(1)%fvr_air=0. RAM(1)%vdis_elecp=0. Pumps%Qiter=7 RAM(1)%Qzero=70 RAM(1)%Q=RAM(1)%Qzero RAM(1)%flow=70 Annular%tolAnnular=0.0018 if (Annular%finished_Annular==1) then Annular%AnnularLeverOld=-1.0 else Annular%AnnularLeverOld=BopControlPanel%AnnularValve endif Annular%finished_Annular=0 Annular%AnnularIsClosing = .true. Annular%AnnularIsOpening = .false. RAM(2)%bop_type = 3 !AbopAnnular=963.1 !(in^2) Annular%AbopAnnular=(BopStackSpecification%AnnularPreventerClose*231.)/((Annular%IDAnnularBase-Annular%ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal Annular%NeededVolumeAnnular=Annular%AbopAnnular*(Annular%IDAnnularBase-max(Annular%ODDrillpipe_inAnnular,Annular%ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5 !WRITE(*,*) 'a)NeededVolumeAnnular=' , NeededVolumeAnnular !write(*,*) 'close 1' endif if (BopControlPanel%AnnularValve == -1.0 .and. Annular%AnnularFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 ) then if (BopStackInput%AnnularOpenLedMine == LedOn) then RETURN end if !CasingPressure : PressureGauges(2) *****temp conditionssssss !note: (AnnularSealingPressure) is only for opening while well is pressurised if ( RAM(1)%SuccessionCounter /= RAM(1)%SuccessionCounterOld+1 ) then RAM(1)%SuccessionCounter = 0 ! also in starup RAM(1)%SuccessionCounterOld = 0 ! also in starup !return else RAM(1)%SuccessionCounterOld= RAM(1)%SuccessionCounter endif if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then !return RAM(1)%First_OpenTimecheck= 1 BopControlPanel%AnnularCloseLED = LedOff !new BopStackInput%AnnularCloseLedMine = LedOff !new BopControlPanel%AnnularOpenLED = LedOn !LedBlinking RAM(1)%FourwayValve = 1 endif endif if (RAM(1)%FourwayValve == 1 .and. Annular%Pannular_reg>AnnularComputational%AnnularMovingPressure .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure & .and. (Annular%Annular_closed==0 .or. (Annular%Annular_closed==1 .and. PressureDisplayVARIABLES%PressureGauges(2) <=100.0) .or. (Annular%Annular_closed==1 .and. PressureDisplayVARIABLES%PressureGauges(2)>100.0 .and. Annular%Pannular_reg>=AnnularComputational%AnnularSealingPressure))) then ! 1: Open , 0: Close !write(*,*) 'open 2' RAM(1)%FourwayValve = 0 Annular%Annular_closed=0 !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) RAM(1)%vdis_tot=0 RAM(1)%vdis_bottles=0. RAM(1)%fvr_air=0. RAM(1)%vdis_elecp=0. Pumps%Qiter=7 RAM(1)%Qzero=70 RAM(1)%Q=RAM(1)%Qzero RAM(1)%flow=70 Annular%tolAnnular=0.0018 if (Annular%finished_Annular==1) then Annular%AnnularLeverOld=1.0 else Annular%AnnularLeverOld=BopControlPanel%AnnularValve endif Annular%finished_Annular=0 Annular%AnnularIsOpening = .true. Annular%AnnularIsClosing = .false. !if (AnnularOpenLed == LedOn) then ! RETURN !end if RAM(1)%bop_type = 3 !AbopAnnular=758.48 !(in^2) Annular%AbopAnnular=(BopStackSpecification%AnnularPreventerOpen*231)/((Annular%IDAnnularBase-max(Annular%ODDrillpipe_inAnnular,Annular%ODDrillpipe_inAnnularBase))/2.) Annular%NeededVolumeAnnular=Annular%AbopAnnular*(Annular%IDAnnularBase-Annular%ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5 !write(*,*) 'open 1' endif !===================================================================== if (Annular%AnnularIsOpening .or. Annular%AnnularIsClosing .or. RAM(1)%Bottles_Charged_MalfActive) then CALL ANNULAR_SUB2 end if END SUBROUTINE ANNULAR_SUB1 SUBROUTINE ANNULAR_SUB2 USE VARIABLES use PressureDisplayVARIABLESModule USE CBopControlPanelVariables USE CEquipmentsConstants USE CBopStackVariables ! use CSimulationVariables implicit none Annular%FirstSet= 0 AnnularComputational%RamsFirstSet= 0 ! loop5: do while (finished_Annular==0) !write(*,*) 'checkpoint 2' RAM(1)%SuccessionCounter = RAM(1)%SuccessionCounter + 1 ! CALL CPU_TIME(Annular_StartTime) if (BopControlPanel%AnnularValve == 1.0 .and. Annular%AnnularLeverOld == -1.0 .and. Annular%AnnularFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then if ( RAM(1)%First_CloseTimecheck == 0 ) then if ( RAM(1)%SuccessionCounter /= RAM(1)%SuccessionCounterOld+1 ) then RAM(1)%SuccessionCounter = 0 ! also in starup RAM(1)%SuccessionCounterOld = 0 ! also in starup !return else RAM(1)%SuccessionCounterOld= RAM(1)%SuccessionCounter endif if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then !return BopControlPanel%AnnularOpenLED = LedOff BopStackInput%AnnularOpenLedMine = LedOff BopControlPanel%AnnularCloseLED = LedOn !LedBlinking RAM(1)%FourwayValve = 1 endif endif !write(*,*) 'chekkk 1' endif if (RAM(1)%FourwayValve == 1 .and. Annular%Pannular_reg>AnnularComputational%AnnularMovingPressure .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then !write(*,*) 'close 4' RAM(1)%FourwayValve = 0 Annular%Annular_closed=0 !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) AnnularComputational%p_annular=AnnularComputational%pa_annular Annular%AnnularLeverOld = BopControlPanel%AnnularValve CALL OpenAnnular Annular%Annular_Situation_forTD= 0 ! open - for TD code RAM(1)%bop_type = 3 !AbopAnnular=963.1 !(in^2) Annular%AbopAnnular=(BopStackSpecification%AnnularPreventerClose*231)/((Annular%IDAnnularBase-Annular%ODDrillpipe_inAnnularBase)/2.) !write(*,*) 'NeededVolumeShearRams1=',NeededVolumeShearRams Annular%NeededVolumeAnnular=Annular%AbopAnnular*(Annular%IDAnnular-max(Annular%ODDrillpipe_inAnnular,Annular%ODDrillpipe_inAnnularBase))/(2*231.) ! write(*,*) 'NeededVolumeAnnular=',NeededVolumeAnnular RAM(1)%vdis_bottles=0. RAM(1)%fvr_air=0. RAM(1)%vdis_elecp=0. Annular%AnnularIsClosing = .true. Annular%AnnularIsOpening = .false. !write(*,*) 'close 2' endif if (BopControlPanel%AnnularValve == -1.0 .and. Annular%AnnularLeverOld == 1.0 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure .and. Annular%AnnularFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 ) then !CasingPressure : PressureGauges(2) *****temp conditionssssss !note: (AnnularSealingPressure) is only for opening while well is pressurised if ( RAM(1)%First_OpenTimecheck == 0 ) then if ( RAM(1)%SuccessionCounter /= RAM(1)%SuccessionCounterOld+1 ) then RAM(1)%SuccessionCounter = 0 ! also in starup RAM(1)%SuccessionCounterOld = 0 ! also in starup !return else RAM(1)%SuccessionCounterOld= RAM(1)%SuccessionCounter endif if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then !return BopControlPanel%AnnularCloseLED = LedOff BopStackInput%AnnularCloseLedMine= LedOff BopControlPanel%AnnularOpenLED = LedOn !LedBlinking RAM(1)%FourwayValve = 1 endif endif !write(*,*) 'chekkk 2' endif if (RAM(1)%FourwayValve == 1 .and. Annular%Pannular_reg>AnnularComputational%AnnularMovingPressure & .and. (Annular%Annular_closed==0 .or. (Annular%Annular_closed==1 .and. PressureDisplayVARIABLES%PressureGauges(2) <=100.0) .or. (Annular%Annular_closed==1 .and. PressureDisplayVARIABLES%PressureGauges(2)>100.0 .and. Annular%Pannular_reg>=AnnularComputational%AnnularSealingPressure))) then !write(*,*) 'open 4' RAM(1)%FourwayValve = 0 Annular%Annular_closed=0 !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1) AnnularComputational%p_annular=AnnularComputational%pa_annular Annular%AnnularLeverOld = BopControlPanel%AnnularValve CALL OpenAnnular Annular%Annular_Situation_forTD= 0 ! open - for TD code RAM(1)%bop_type = 3 !AbopAnnular=758.48 !(in^2) Annular%AbopAnnular=(BopStackSpecification%AnnularPreventerOpen*231)/((Annular%IDAnnularBase-Annular%ODDrillpipe_inAnnularBase)/2.) Annular%NeededVolumeAnnular=Annular%AbopAnnular*(Annular%IDAnnularBase-Annular%IDAnnular)/(2*231.) RAM(1)%vdis_bottles=0. RAM(1)%fvr_air=0. RAM(1)%vdis_elecp=0. Annular%AnnularIsOpening = .true. Annular%AnnularIsClosing = .false. !write(*,*) 'open 2' endif RAM(1)%First_CloseTimecheck = 0 RAM(1)%First_OpenTimecheck = 0 RAM(1)%time=RAM(1)%time+RamLine%DeltaT_BOP !overal time (s) !=================================================== ! BOP !=================================================== if (Annular%Annular_closed==0) then !bop closing !write(*,*) 'AnnularIsClosing,AnnularIsOpening' , AnnularIsClosing,AnnularIsOpening call bop_codeAnnular(1) !ramtype=4 1=RNUMBER endif !bop is closing !================================================================ if (Annular%Annular_closed==1) then RAM(1)%Q=0 !p_bop=pram_reg AnnularComputational%p_annular=AnnularComputational%pa_annular endif RAM(1)%timecounter_ram=RAM(1)%timecounter_ram+1 ! MiddleRamsStatus = IDshearBop ! UpperRamsStatus = IDPipeRam1 ! LowerRamsStatus = IDPipeRam2 ! AnnularStatus = IDAnnular ! AccumulatorPressureGauge = p_acc ! ManifoldPressureGauge= pram_reg ! AnnularPressureGauge=Pannular_reg ! ! ! ! WRITE(60,60) RAM(1)%time,RAM(1)%Q,RAM(1)%vdis_tot,p_acc, & ! pram_reg,Pannular_reg,RAM(1)%p_bop,IDshearBop, & ! IDPipeRam1,IDPipeRam2,IDAnnular !60 FORMAT(11(f18.5)) ! call sleepqq(100) !CALL CPU_TIME(Annular_EndTime) ! ! !PUMP(1)%INT_CPU_TIME=IDINT((Annular_EndTime-Annular_StartTime)*1000.) !PUMP(1)%Dt_ref=IDINT(DeltaT_BOP*1000.) ! !call sleepqq(PUMP(1)%Dt_ref-PUMP(1)%INT_CPU_TIME) if (Annular%Annular_closed==1) then ! if ((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. (UpperRamsValve==1. .and. UpperRamsFailureMalf==0) .or. (UpperRamsValve==-1.0 .and. UpperRamsFailureMalf==0) .or. ChokeLineValve==1. .or. ChokeLineValve==-1.0 .or. KillLineValve==1. .or. KillLineValve==-1.0) then Annular%finished_Annular=1 ! endif endif ! if (IsStopped == .true.) return ! end do loop5 !while finished_Annular==0 if ( Annular%finished_Annular==1 .and. RAM(1)%Bottles_Charged_MalfActive==.true.) then call bop_codeAnnular(1) !ramtype=4 1=RNUMBER ! call sleepqq(100) endif END SUBROUTINE ANNULAR_SUB2