|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- # 1 "/mnt/c/Projects/VSIM/SimulationCore2/Equipments/BopStack/CHOKE_LINE.f90"
-
-
- SUBROUTINE CHOKE_LINE
- use SimulationVariables
- USE CAccumulatorVariables
- USE CBopStackVariables
- use CBopControlPanel
- use SimulationVariables
- USE CEquipmentsConstants
-
- implicit none
-
-
- !=====================================================================
- ! CHOKE LINE 1- BOP CAMERON Type U 5000
- ! START CONDITIONS FOR CHOKE LINE 1
- !=====================================================================
-
- data%State%RAM(5)%SuccessionCounter = data%State%RAM(5)%SuccessionCounter + 1
-
-
- if (data%Equipments%BopControlPanel%ChokeLineValve == -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
-
- if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
- data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
- return
- else
- data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
- endif
-
-
- if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- return
- endif
-
- data%State%RAM(5)%First_CloseTimecheck= 1
-
-
-
-
- if (data%State%BopStackInput%ChokeLineOpenLEDMine == LedOn) then
- RETURN
- end if
- data%State%ChokeLine%closed=0
- data%State%RAM(5)%vdis_tot=0
- data%State%RAM(5)%vdis_bottles=0.
- data%State%RAM(5)%fvr_air=0.
- data%State%RAM(5)%vdis_elecp=0.
- data%State%Pumps%Qiter=7
- data%State%RAM(5)%Qzero=70
- data%State%RAM(5)%Q=data%State%RAM(5)%Qzero
- data%State%RAM(5)%flow=70
- data%State%RAM(5)%tol=0.0037
- if (data%State%ChokeLine%finished==1) then
- data%State%ChokeLine%LeverOld= 1.0
- else
- data%State%ChokeLine%LeverOld=data%Equipments%BopControlPanel%ChokeLineValve
- endif
- data%State%ChokeLine%finished=0
- data%State%ChokeLine%IsOpening = .true.
- data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOff
- data%State%BopStackInput%ChokeLineCloseLEDMine = LedOff
- data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOn !LedBlinking
- data%State%RAM(5)%bop_type = 3
- !AbopChokeLine=196.67
- data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeClose*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
- data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%IDBase-max(data%State%ChokeLine%ODDrillpipe_in,data%State%ChokeLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
- endif
-
- if (data%Equipments%BopControlPanel%ChokeLineValve == 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
-
-
- if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
- data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
- return
- else
- data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
- endif
-
-
- if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- return
- endif
-
- data%State%RAM(5)%First_OpenTimecheck= 1
-
-
-
- if (data%State%BopStackInput%ChokeLineCloseLEDMine == LedOn) then
- RETURN
- end if
- data%State%ChokeLine%closed=0
- data%State%RAM(5)%vdis_tot=0
- data%State%RAM(5)%vdis_bottles=0.
- data%State%RAM(5)%fvr_air=0.
- data%State%RAM(5)%vdis_elecp=0.
- data%State%Pumps%Qiter=7
- data%State%RAM(5)%Qzero=70
- data%State%RAM(5)%Q=data%State%RAM(5)%Qzero
- data%State%RAM(5)%flow=70
- data%State%RAM(5)%tol=0.0037
-
-
-
- if (data%State%ChokeLine%finished==1) then
- data%State%ChokeLine%LeverOld= -1.0
- else
- data%State%ChokeLine%LeverOld=data%Equipments%BopControlPanel%ChokeLineValve
- endif
- data%State%ChokeLine%finished=0
- data%State%ChokeLine%IsClosing = .true.
-
-
- !if (ChokeLineCloseLED == LedOn) then
- ! RETURN
- !end if
-
- data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOff !new
- data%State%BopStackInput%ChokeLineCloseLEDMine = LedOff !new
-
-
- data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOn !LedBlinking
- data%State%RAM(5)%bop_type = 3
- !AbopChokeLine=196.67
- data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeOpen*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
- data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%IDBase-max(data%State%ChokeLine%ODDrillpipe_in,data%State%ChokeLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
- endif
-
-
- !=====================================================================
-
- ! if (ChokeLineIsOpening .or. ChokeLineIsClosing) then
- ! CALL CHOKE_LINE_SUB
- ! end if
-
-
- END SUBROUTINE CHOKE_LINE
-
-
-
-
-
-
-
-
-
-
-
-
- SUBROUTINE CHOKE_LINE_SUB
-
- use SimulationVariables
- USE CAccumulatorVariables
- USE CBopStackVariables
- use CBopControlPanel
- use SimulationVariables
- USE CEquipmentsConstants
- ! use CSimulationVariables
- implicit none
-
-
- ! FirstSet= 0
- ! RamsFirstSet= 0
-
- ! loop5: do while (finished_ChokeLine==0)
-
-
- data%State%RAM(5)%SuccessionCounter = data%State%RAM(5)%SuccessionCounter + 1
-
-
- if (data%Equipments%BopControlPanel%ChokeLineValve == 1.0 .and. data%State%ChokeLine%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
-
- if ( data%State%RAM(5)%First_CloseTimecheck == 0 ) then
-
-
- if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
- data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
- return
- else
- data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
- endif
-
-
-
- if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- return
- endif
-
- endif
-
-
-
- data%State%ChokeLine%closed=0
- data%State%RAM(5)%p_bop=data%State%ShearRAM%PA
- data%State%ChokeLine%LeverOld = data%Equipments%BopControlPanel%ChokeLineValve
- data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOff
- data%State%BopStackInput%ChokeLineOpenLEDMine = LedOff
- data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOn !LedBlinking
- CALL OpenChokeLine
- data%State%RAM(5)%bop_type = 3
- !AbopChokeLine=196.67
- data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeClose*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
- data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%ID-max(data%State%ChokeLine%ODDrillpipe_in,data%State%ChokeLine%ODDrillpipe_inBase))/(2.*231)
-
- data%State%RAM(5)%vdis_bottles=0.
- data%State%RAM(5)%fvr_air=0.
- data%State%RAM(5)%vdis_elecp=0.
- data%State%ChokeLine%IsClosing = .true.
- data%State%ChokeLine%IsOpening = .false.
- endif
-
- if (data%Equipments%BopControlPanel%ChokeLineValve == -1.0 .and. data%State%ChokeLine%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
-
- if ( data%State%RAM(5)%First_OpenTimecheck == 0 ) then
-
- if ( data%State%RAM(5)%SuccessionCounter /= data%State%RAM(5)%SuccessionCounterOld+1 ) then
- data%State%RAM(5)%SuccessionCounter = 0 ! also in starup
- data%State%RAM(5)%SuccessionCounterOld = 0 ! also in starup
- return
- else
- data%State%RAM(5)%SuccessionCounterOld= data%State%RAM(5)%SuccessionCounter
- endif
-
- if ( data%State%RAM(5)%SuccessionCounter < int(2.5/data%State%RamLine%DeltaT_BOP) ) then
- return
- endif
-
- endif
-
-
-
- data%State%ChokeLine%closed=0
- data%State%RAM(5)%p_bop=data%State%ShearRAM%PA
- data%State%ChokeLine%LeverOld = data%Equipments%BopControlPanel%ChokeLineValve
- data%Equipments%BopControlPanel%ChokeLineCloseLED = LedOff
- data%State%BopStackInput%ChokeLineCloseLEDMine = LedOff
- data%Equipments%BopControlPanel%ChokeLineOpenLED = LedOn !LedBlinking
- CALL OpenChokeLine
- data%State%RAM(5)%bop_type = 3
- !AbopChokeLine=196.67
- data%State%ChokeLine%Abop=(data%Configuration%BopStack%ChokeOpen*231)/((data%State%ChokeLine%IDBase-data%State%ChokeLine%ODDrillpipe_inBase)/2.)
- data%State%ChokeLine%NeededVolume=data%State%ChokeLine%Abop*(data%State%ChokeLine%IDBase-data%State%ChokeLine%ID)/(2.*231)
- data%State%RAM(5)%vdis_bottles=0.
- data%State%RAM(5)%fvr_air=0.
- data%State%RAM(5)%vdis_elecp=0.
-
- data%State%ChokeLine%IsOpening = .true.
- data%State%ChokeLine%IsClosing = .false.
- endif
-
-
- data%State%RAM(5)%First_CloseTimecheck = 0
- data%State%RAM(5)%First_OpenTimecheck = 0
-
-
- data%State%RAM(5)%time=data%State%RAM(5)%time+data%State%RamLine%DeltaT_BOP !overal time (s)
-
-
-
- !===================================================
- ! BOP
- !===================================================
- if (data%State%ChokeLine%closed==0) then !bop closing
- call bop_code(4,data%State%ChokeLine%H_Bop,5) !ramtype=4 5=RNUMBER
- endif !bop is closing
- !================================================================
- if (data%State%ChokeLine%closed==1) then
- data%State%RAM(5)%Q=0
- !p_bop=pram_reg
- data%State%RAM(5)%p_bop=data%State%ShearRAM%PA
- data%State%RAMS%minloss(5,17)=0. !RNUMBER=5
- endif
-
- data%State%RAM(5)%timecounter_ram=data%State%RAM(5)%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(5)%time,data%State%RAM(5)%Q,data%State%RAM(5)%vdis_tot,p_acc, &
- ! pram_reg,Pannular_reg,data%State%RAM(5)%p_bop,IDshearBop, &
- ! IDPipeRam1,IDPipeRam2,IDAnnular
- !60 FORMAT(11(f18.5))
-
-
- ! call sleepqq(100)
- if (data%State%ChokeLine%closed==1) then
- ! 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. KillLineValve==1. .or. KillLineValve==-1.0) then
- data%State%ChokeLine%finished=1
- ! endif
- endif
-
- ! if (IsStopped == .true.) return
-
- ! end do loop5 !while finished_ChokeLine==0
-
- END SUBROUTINE CHOKE_LINE_SUB
|