瀏覽代碼

Added some rafiee data structures

najafi
mahmood19227 1 年之前
父節點
當前提交
8d59cc0a67
共有 35 個文件被更改,包括 1549 次插入1531 次删除
  1. +18
    -18
      CSharp/Problems/CBopProblemsVariables.f90
  2. +2
    -2
      CSharp/Problems/CChokeProblemsVariables.f90
  3. +10
    -10
      CSharp/Problems/CGaugesProblemsVariables.f90
  4. +2
    -2
      CSharp/Problems/COtherProblemsVariables.f90
  5. +22
    -1
      Data Structures.txt
  6. +73
    -73
      Equipments/BopStack/ANNULAR.f90
  7. +6
    -6
      Equipments/BopStack/AnnularMain.f90
  8. +113
    -113
      Equipments/BopStack/BOP.f90
  9. +135
    -135
      Equipments/BopStack/BOPstartup.f90
  10. +9
    -9
      Equipments/BopStack/BlindRamsMain.f90
  11. +53
    -53
      Equipments/BopStack/CHOKE_LINE.f90
  12. +5
    -5
      Equipments/BopStack/ChokeLineMain.f90
  13. +56
    -56
      Equipments/BopStack/KILL_LINE.f90
  14. +3
    -3
      Equipments/BopStack/KillLineMain.f90
  15. +444
    -449
      Equipments/BopStack/LOSS_INPUTS.f90
  16. +68
    -68
      Equipments/BopStack/PIPE_RAM1.f90
  17. +66
    -66
      Equipments/BopStack/PIPE_RAM2.f90
  18. +3
    -3
      Equipments/BopStack/PipeRams1Main.f90
  19. +3
    -3
      Equipments/BopStack/PipeRams2Main.f90
  20. +62
    -62
      Equipments/BopStack/SHEAR_RAM.f90
  21. +121
    -98
      Equipments/BopStack/VARIABLES.f90
  22. +122
    -122
      Equipments/ChokeControl/AirPump_Choke_Subs.f90
  23. +30
    -30
      Equipments/ChokeControl/CHOKE.f90
  24. +41
    -62
      Equipments/ChokeControl/CHOKE_VARIABLES.f90
  25. +1
    -1
      Equipments/ChokeControl/ChokeControlMain.f90
  26. +42
    -42
      Equipments/ChokeControl/ChokeStartup.f90
  27. +1
    -1
      Equipments/Drawworks/Drawworks_INPUTS.f90
  28. +9
    -9
      Equipments/MudSystem/MudSystem.f90
  29. +2
    -2
      Equipments/MudSystem/MudSystemStartup.f90
  30. +5
    -5
      FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90
  31. +1
    -1
      FluidFlow/Flow_Startup.f90
  32. +1
    -1
      FluidFlow/Horizontal_and_String_Pressure_Distribution.f90
  33. +6
    -6
      FluidFlow/Well_Pressure_Data_Transfer.f90
  34. +4
    -4
      TorqueDrag/TD_DrillingSubs/TD_BOPDiamCalculation.f90
  35. +10
    -10
      TorqueDrag/TD_Forces/TD_HookLoadCalculation.f90

+ 18
- 18
CSharp/Problems/CBopProblemsVariables.f90 查看文件

@@ -141,8 +141,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! ! if(associated(AnnularFailPtr)) call AnnularFailPtr(status)
if(status == Clear_StatusType) AnnularFailureMalf = 0
if(status == Executed_StatusType) AnnularFailureMalf = 1
if(status == Clear_StatusType) Annular%AnnularFailureMalf = 0
if(status == Executed_StatusType) Annular%AnnularFailureMalf = 1
endsubroutine
subroutine ChangeAnnularLeak(status)
@@ -150,8 +150,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! ! if(associated(AnnularLeakPtr)) call AnnularLeakPtr(status)
if(status == Clear_StatusType) AnnularLeakMalf = 0
if(status == Executed_StatusType) AnnularLeakMalf = 1
if(status == Clear_StatusType) Annular%AnnularLeakMalf = 0
if(status == Executed_StatusType) Annular%AnnularLeakMalf = 1
endsubroutine
@@ -169,8 +169,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! ! if(associated(UpperRamFailPtr)) call UpperRamFailPtr(status)
if(status == Clear_StatusType) UpperRamsFailureMalf = 0
if(status == Executed_StatusType) UpperRamsFailureMalf = 1
if(status == Clear_StatusType) PipeRam1%UpperRamsFailureMalf = 0
if(status == Executed_StatusType) PipeRam1%UpperRamsFailureMalf = 1
endsubroutine
subroutine ChangeUpperRamLeak(status)
@@ -178,8 +178,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! ! if(associated(UpperRamLeakPtr)) call UpperRamLeakPtr(status)
if(status == Clear_StatusType) UpperRamsLeakMalf = 0
if(status == Executed_StatusType) UpperRamsLeakMalf = 1
if(status == Clear_StatusType) PipeRam1%UpperRamsLeakMalf = 0
if(status == Executed_StatusType) PipeRam1%UpperRamsLeakMalf = 1
endsubroutine
@@ -196,8 +196,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(MiddleRamFailPtr)) call MiddleRamFailPtr(status)
if(status == Clear_StatusType) MiddleRamsFailureMalf = 0
if(status == Executed_StatusType) MiddleRamsFailureMalf = 1
if(status == Clear_StatusType) ShearRam%MiddleRamsFailureMalf = 0
if(status == Executed_StatusType) ShearRam%MiddleRamsFailureMalf = 1
endsubroutine
subroutine ChangeMiddleRamLeak(status)
@@ -205,8 +205,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! ! if(associated(MiddleRamLeakPtr)) call MiddleRamLeakPtr(status)
if(status == Clear_StatusType) MiddleRamsLeakMalf = 0
if(status == Executed_StatusType) MiddleRamsLeakMalf = 1
if(status == Clear_StatusType) ShearRam%MiddleRamsLeakMalf = 0
if(status == Executed_StatusType) ShearRam%MiddleRamsLeakMalf = 1
endsubroutine
@@ -224,8 +224,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! ! if(associated(LowerRamFailPtr)) call LowerRamFailPtr(status)
if(status == Clear_StatusType) LowerRamsFailureMalf = 0
if(status == Executed_StatusType) LowerRamsFailureMalf = 1
if(status == Clear_StatusType) PipeRam2%LowerRamsFailureMalf = 0
if(status == Executed_StatusType) PipeRam2%LowerRamsFailureMalf = 1
endsubroutine
subroutine ChangeLowerRamLeak(status)
@@ -233,8 +233,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(LowerRamLeakPtr)) call LowerRamLeakPtr(status)
if(status == Clear_StatusType) LowerRamsLeakMalf = 0
if(status == Executed_StatusType) LowerRamsLeakMalf = 1
if(status == Clear_StatusType) PipeRam2%LowerRamsLeakMalf = 0
if(status == Executed_StatusType) PipeRam2%LowerRamsLeakMalf = 1
endsubroutine
subroutine ChangeAccumulatorPumpFail(status)
@@ -242,8 +242,8 @@ module CBopProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(AccumulatorPumpFailPtr)) call AccumulatorPumpFailPtr(status)
if(status == Clear_StatusType) AccPupmsFailMalf = 0
if(status == Executed_StatusType) AccPupmsFailMalf = 1
if(status == Clear_StatusType) BopStackAcc%AccPupmsFailMalf = 0
if(status == Executed_StatusType) BopStackAcc%AccPupmsFailMalf = 1
endsubroutine
subroutine ChangeAccumulatorPumpLeak(status)


+ 2
- 2
CSharp/Problems/CChokeProblemsVariables.f90 查看文件

@@ -243,8 +243,8 @@ module CChokeProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(ChokePanelAirFailPtr)) call ChokePanelAirFailPtr(status)
if(status == Clear_StatusType) ChokeAirFail = 0
if(status == Executed_StatusType) ChokeAirFail = 1
if(status == Clear_StatusType) AirDrivenPump%ChokeAirFail = 0
if(status == Executed_StatusType) AirDrivenPump%ChokeAirFail = 1
endsubroutine


+ 10
- 10
CSharp/Problems/CGaugesProblemsVariables.f90 查看文件

@@ -305,8 +305,8 @@ module CGaugesProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(AccumulatorPressurePtr)) call AccumulatorPressurePtr(status)
if(status == Clear_StatusType) AccumulatorPressureGaugeMalf = 0
if(status == Executed_StatusType) AccumulatorPressureGaugeMalf = 1
if(status == Clear_StatusType) BopStackAcc%AccumulatorPressureGaugeMalf = 0
if(status == Executed_StatusType) BopStackAcc%AccumulatorPressureGaugeMalf = 1
endsubroutine
subroutine ChangeManifoldPressure(status)
@@ -314,8 +314,8 @@ module CGaugesProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(ManifoldPressurePtr)) call ManifoldPressurePtr(status)
if(status == Clear_StatusType) ManifoldPressureGaugeMalf = 0
if(status == Executed_StatusType) ManifoldPressureGaugeMalf = 1
if(status == Clear_StatusType) BopStackAcc%ManifoldPressureGaugeMalf = 0
if(status == Executed_StatusType) BopStackAcc%ManifoldPressureGaugeMalf = 1
endsubroutine
subroutine ChangeAnnularPressure(status)
@@ -323,8 +323,8 @@ module CGaugesProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(AnnularPressurePtr)) call AnnularPressurePtr(status)
if(status == Clear_StatusType) AnnularPressureGaugeMalf = 0
if(status == Executed_StatusType) AnnularPressureGaugeMalf = 1
if(status == Clear_StatusType) Annular%AnnularPressureGaugeMalf = 0
if(status == Executed_StatusType) Annular%AnnularPressureGaugeMalf = 1
endsubroutine
subroutine ChangeRigAirPressure(status)
@@ -332,8 +332,8 @@ module CGaugesProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(RigAirPressurePtr)) call RigAirPressurePtr(status)
if(status == Clear_StatusType) AirSupplyPressureGaugeMalf = 0
if(status == Executed_StatusType) AirSupplyPressureGaugeMalf = 1
if(status == Clear_StatusType) BopStackAcc%AirSupplyPressureGaugeMalf = 0
if(status == Executed_StatusType) BopStackAcc%AirSupplyPressureGaugeMalf = 1
endsubroutine
subroutine ChangeStandPipe1(status)
@@ -368,8 +368,8 @@ module CGaugesProblemsVariables
implicit none
integer, intent (in) :: status
! if(associated(ChokePositionPtr)) call ChokePositionPtr(status)
if(status == Clear_StatusType) GaugeChokePositionMailf = 0
if(status == Executed_StatusType) GaugeChokePositionMailf = 1
if(status == Clear_StatusType) Choke%GaugeChokePositionMailf = 0
if(status == Executed_StatusType) Choke%GaugeChokePositionMailf = 1
endsubroutine
subroutine ChangeCasingPressure2(status)


+ 2
- 2
CSharp/Problems/COtherProblemsVariables.f90 查看文件

@@ -126,8 +126,8 @@ module COtherProblemsVariables
implicit none
integer, intent (in) :: status
!if(associated(RigAirPtr)) call RigAirPtr(status)
if(status == Clear_StatusType) RigAirMalf = 0
if(status == Executed_StatusType) RigAirMalf = 1
if(status == Clear_StatusType) BopStackAcc%RigAirMalf = 0
if(status == Executed_StatusType) BopStackAcc%RigAirMalf = 1
endsubroutine
subroutine ChangeGen1(status)


+ 22
- 1
Data Structures.txt 查看文件

@@ -69,4 +69,25 @@ CSharp:
OtherProblems
PumpProblems
RotaryProblems
Equipments:
BopStack:
BopStackInput
BopStackAcc
RamLine
AnnularComputational
Annular
PipeRam1
ShearRam
PipeRam2
ChokeLine
KillLine
Pumps
RAM (previously exists)
RAMS
ChokeControl:
Choke
AirDrivenPump
AirPumpLine
CHOOKE (previously exists)
MudSystem:.........

+ 73
- 73
Equipments/BopStack/ANNULAR.f90 查看文件

@@ -1,4 +1,4 @@
SUBROUTINE ANNULAR
SUBROUTINE ANNULAR_SUB1
USE VARIABLES
USE CBopControlPanelVariables
USE PressureDisplayVARIABLES
@@ -15,9 +15,9 @@ SUBROUTINE ANNULAR
RAM(1)%SuccessionCounter = RAM(1)%SuccessionCounter + 1
if (BopControlPanel%AnnularValve == 1.0 .and. AnnularFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%AnnularValve == 1.0 .and. Annular%AnnularFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (AnnularCloseLedMine == LedOn) then
if (BopStackInput%AnnularCloseLedMine == LedOn) then
RETURN
end if
@@ -32,13 +32,13 @@ SUBROUTINE ANNULAR

if ( RAM(1)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(1)%First_CloseTimecheck= 1
BopControlPanel%AnnularOpenLED = LedOff
AnnularOpenLedMine = LedOff
BopStackInput%AnnularOpenLedMine = LedOff
BopControlPanel%AnnularCloseLED = LedOn !LedBlinking
RAM(1)%FourwayValve = 1
@@ -48,45 +48,45 @@ SUBROUTINE ANNULAR
endif
if (RAM(1)%FourwayValve == 1 .and. p_acc>acc_MinPressure .and. Pannular_reg>AnnularMovingPressure) then ! 1: Open , 0: Close
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_closed=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.
Qiter=7
Pumps%Qiter=7
RAM(1)%Qzero=70
RAM(1)%Q=RAM(1)%Qzero
RAM(1)%flow=70
tolAnnular=0.0018
if (finished_Annular==1) then
AnnularLeverOld=-1.0
Annular%tolAnnular=0.0018
if (Annular%finished_Annular==1) then
Annular%AnnularLeverOld=-1.0
else
AnnularLeverOld=BopControlPanel%AnnularValve
Annular%AnnularLeverOld=BopControlPanel%AnnularValve
endif
finished_Annular=0
AnnularIsClosing = .true.
AnnularIsOpening = .false.
Annular%finished_Annular=0
Annular%AnnularIsClosing = .true.
Annular%AnnularIsOpening = .false.

RAM(2)%bop_type = 3
!AbopAnnular=963.1 !(in^2)
AbopAnnular=(BopStackSpecification%AnnularPreventerClose*231.)/((IDAnnularBase-ODDrillpipe_inAnnularBase)/2.) ! 231 in^3 = 1 gal
NeededVolumeAnnular=AbopAnnular*(IDAnnularBase-max(ODDrillpipe_inAnnular,ODDrillpipe_inAnnularBase))/(2.*231) !=17.98 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnularBase=5
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. AnnularFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 ) then
if (BopControlPanel%AnnularValve == -1.0 .and. Annular%AnnularFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 ) then
if (AnnularOpenLedMine == LedOn) then
if (BopStackInput%AnnularOpenLedMine == LedOn) then
RETURN
end if
@@ -105,13 +105,13 @@ SUBROUTINE ANNULAR

if ( RAM(1)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(1)%First_OpenTimecheck= 1
BopControlPanel%AnnularCloseLED = LedOff !new
AnnularCloseLedMine = LedOff !new
BopStackInput%AnnularCloseLedMine = LedOff !new
BopControlPanel%AnnularOpenLED = LedOn !LedBlinking
RAM(1)%FourwayValve = 1
@@ -124,36 +124,36 @@ SUBROUTINE ANNULAR

if (RAM(1)%FourwayValve == 1 .and. Pannular_reg>AnnularMovingPressure .and. p_acc>acc_MinPressure &
.and. (Annular_closed==0 .or. (Annular_closed==1 .and.PressureGauges(2) <=100.0) .or. (Annular_closed==1 .and.PressureGauges(2)>100.0 .and. Pannular_reg>=AnnularSealingPressure))) then ! 1: Open , 0: Close
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.PressureGauges(2) <=100.0) .or. (Annular%Annular_closed==1 .and.PressureGauges(2)>100.0 .and. Annular%Pannular_reg>=AnnularComputational%AnnularSealingPressure))) then ! 1: Open , 0: Close
!write(*,*) 'open 2'
RAM(1)%FourwayValve = 0

Annular_closed=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.
Qiter=7
Pumps%Qiter=7
RAM(1)%Qzero=70
RAM(1)%Q=RAM(1)%Qzero
RAM(1)%flow=70
tolAnnular=0.0018
Annular%tolAnnular=0.0018

if (finished_Annular==1) then
AnnularLeverOld=1.0
if (Annular%finished_Annular==1) then
Annular%AnnularLeverOld=1.0
else
AnnularLeverOld=BopControlPanel%AnnularValve
Annular%AnnularLeverOld=BopControlPanel%AnnularValve
endif
finished_Annular=0
AnnularIsOpening = .true.
AnnularIsClosing = .false.
Annular%finished_Annular=0
Annular%AnnularIsOpening = .true.
Annular%AnnularIsClosing = .false.

!if (AnnularOpenLed == LedOn) then
@@ -164,22 +164,22 @@ SUBROUTINE ANNULAR

RAM(1)%bop_type = 3
!AbopAnnular=758.48 !(in^2)
AbopAnnular=(BopStackSpecification%AnnularPreventerOpen*231)/((IDAnnularBase-max(ODDrillpipe_inAnnular,ODDrillpipe_inAnnularBase))/2.)
NeededVolumeAnnular=AbopAnnular*(IDAnnularBase-ODDrillpipe_inAnnular)/(2.*231) !=14.16 galon for IDAnnularBase=13 5/8 , ODDrillpipe_inAnnular=5
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 (AnnularIsOpening .or. AnnularIsClosing .or. RAM(1)%Bottles_Charged_MalfActive) then
CALL ANNULAR_SUB
if (Annular%AnnularIsOpening .or. Annular%AnnularIsClosing .or. RAM(1)%Bottles_Charged_MalfActive) then
CALL ANNULAR_SUB2
end if
END SUBROUTINE ANNULAR
END SUBROUTINE ANNULAR_SUB1
@@ -194,7 +194,7 @@ end if
SUBROUTINE ANNULAR_SUB
SUBROUTINE ANNULAR_SUB2
USE VARIABLES
USE PressureDisplayVARIABLES
USE CBopControlPanelVariables
@@ -205,8 +205,8 @@ SUBROUTINE ANNULAR_SUB
implicit none
FirstSet= 0
RamsFirstSet= 0
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
! loop5: do while (finished_Annular==0)
@@ -218,7 +218,7 @@ SUBROUTINE ANNULAR_SUB

! CALL CPU_TIME(Annular_StartTime)
if (BopControlPanel%AnnularValve == 1.0 .and. AnnularLeverOld == -1.0 .and. AnnularFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
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

@@ -233,11 +233,11 @@ SUBROUTINE ANNULAR_SUB

if ( RAM(1)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
BopControlPanel%AnnularOpenLED = LedOff
AnnularOpenLedMine = LedOff
BopStackInput%AnnularOpenLedMine = LedOff
BopControlPanel%AnnularCloseLED = LedOn !LedBlinking
RAM(1)%FourwayValve = 1
@@ -250,36 +250,36 @@ SUBROUTINE ANNULAR_SUB
endif
if (RAM(1)%FourwayValve == 1 .and. Pannular_reg>AnnularMovingPressure .and. p_acc>acc_MinPressure) then
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_closed=0
Annular%Annular_closed=0
!Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
p_annular=pa_annular
AnnularLeverOld = BopControlPanel%AnnularValve
AnnularComputational%p_annular=AnnularComputational%pa_annular
Annular%AnnularLeverOld = BopControlPanel%AnnularValve

CALL OpenAnnular
Annular_Situation_forTD= 0 ! open - for TD code
Annular%Annular_Situation_forTD= 0 ! open - for TD code
RAM(1)%bop_type = 3
!AbopAnnular=963.1 !(in^2)
AbopAnnular=(BopStackSpecification%AnnularPreventerClose*231)/((IDAnnularBase-ODDrillpipe_inAnnularBase)/2.)
Annular%AbopAnnular=(BopStackSpecification%AnnularPreventerClose*231)/((Annular%IDAnnularBase-Annular%ODDrillpipe_inAnnularBase)/2.)
!write(*,*) 'NeededVolumeShearRams1=',NeededVolumeShearRams
NeededVolumeAnnular=AbopAnnular*(IDAnnular-max(ODDrillpipe_inAnnular,ODDrillpipe_inAnnularBase))/(2*231.)
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.
AnnularIsClosing = .true.
AnnularIsOpening = .false.
Annular%AnnularIsClosing = .true.
Annular%AnnularIsOpening = .false.
!write(*,*) 'close 2'
endif
if (BopControlPanel%AnnularValve == -1.0 .and. AnnularLeverOld == 1.0 .and. p_acc>acc_MinPressure .and. AnnularFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 ) then
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
@@ -295,11 +295,11 @@ SUBROUTINE ANNULAR_SUB
RAM(1)%SuccessionCounterOld= RAM(1)%SuccessionCounter
endif
if ( RAM(1)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(1)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
BopControlPanel%AnnularCloseLED = LedOff
AnnularCloseLedMine= LedOff
BopStackInput%AnnularCloseLedMine= LedOff
BopControlPanel%AnnularOpenLED = LedOn !LedBlinking
RAM(1)%FourwayValve = 1
@@ -313,30 +313,30 @@ SUBROUTINE ANNULAR_SUB
if (RAM(1)%FourwayValve == 1 .and. Pannular_reg>AnnularMovingPressure &
.and. (Annular_closed==0 .or. (Annular_closed==1 .and.PressureGauges(2) <=100.0) .or. (Annular_closed==1 .and.PressureGauges(2)>100.0 .and. Pannular_reg>=AnnularSealingPressure))) then
if (RAM(1)%FourwayValve == 1 .and. Annular%Pannular_reg>AnnularComputational%AnnularMovingPressure &
.and. (Annular%Annular_closed==0 .or. (Annular%Annular_closed==1 .and.PressureGauges(2) <=100.0) .or. (Annular%Annular_closed==1 .and.PressureGauges(2)>100.0 .and. Annular%Pannular_reg>=AnnularComputational%AnnularSealingPressure))) then
!write(*,*) 'open 4'
RAM(1)%FourwayValve = 0
Annular_closed=0
Annular%Annular_closed=0
!Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
p_annular=pa_annular
AnnularLeverOld = BopControlPanel%AnnularValve
AnnularComputational%p_annular=AnnularComputational%pa_annular
Annular%AnnularLeverOld = BopControlPanel%AnnularValve

CALL OpenAnnular
Annular_Situation_forTD= 0 ! open - for TD code
Annular%Annular_Situation_forTD= 0 ! open - for TD code
RAM(1)%bop_type = 3
!AbopAnnular=758.48 !(in^2)
AbopAnnular=(BopStackSpecification%AnnularPreventerOpen*231)/((IDAnnularBase-ODDrillpipe_inAnnularBase)/2.)
NeededVolumeAnnular=AbopAnnular*(IDAnnularBase-IDAnnular)/(2*231.)
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.

AnnularIsOpening = .true.
AnnularIsClosing = .false.
Annular%AnnularIsOpening = .true.
Annular%AnnularIsClosing = .false.
!write(*,*) 'open 2'
@@ -347,7 +347,7 @@ SUBROUTINE ANNULAR_SUB
RAM(1)%First_CloseTimecheck = 0
RAM(1)%First_OpenTimecheck = 0
RAM(1)%time=RAM(1)%time+DeltaT_BOP !overal time (s)
RAM(1)%time=RAM(1)%time+RamLine%DeltaT_BOP !overal time (s)



@@ -356,15 +356,15 @@ SUBROUTINE ANNULAR_SUB
!===================================================
! BOP
!===================================================
if (Annular_closed==0) then !bop closing
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_closed==1) then
if (Annular%Annular_closed==1) then
RAM(1)%Q=0
!p_bop=pram_reg
p_annular=pa_annular
AnnularComputational%p_annular=AnnularComputational%pa_annular
endif

RAM(1)%timecounter_ram=RAM(1)%timecounter_ram+1
@@ -404,9 +404,9 @@ RAM(1)%timecounter_ram=RAM(1)%timecounter_ram+1
if (Annular_closed==1) then
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
finished_Annular=1
Annular%finished_Annular=1
! endif
endif
@@ -419,9 +419,9 @@ endif
if ( finished_Annular==1 .and. RAM(1)%Bottles_Charged_MalfActive==.true.) then
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_SUB
END SUBROUTINE ANNULAR_SUB2

+ 6
- 6
Equipments/BopStack/AnnularMain.f90 查看文件

@@ -20,15 +20,15 @@ module AnnularMain
subroutine Annular_Step
use VARIABLES
implicit none
if (finished_Annular/=0) then
call ANNULAR
if (AnnularIsOpening .or. AnnularIsClosing .or. RAM(1)%Bottles_Charged_MalfActive) then
if(finished_Annular==0) then
call ANNULAR_SUB !only body of loop2
if (Annular%finished_Annular/=0) then
call ANNULAR_SUB1
if (Annular%AnnularIsOpening .or. Annular%AnnularIsClosing .or. RAM(1)%Bottles_Charged_MalfActive) then
if(Annular%finished_Annular==0) then
call ANNULAR_SUB2 !only body of loop2
endif
endif
else
call ANNULAR_SUB
call ANNULAR_SUB2
endif
end subroutine Annular_Step


+ 113
- 113
Equipments/BopStack/BOP.f90 查看文件

@@ -10,17 +10,17 @@ module BOP
implicit none
BOP_timeCounter= BOP_timeCounter + 1
BopStackInput%BOP_timeCounter= BopStackInput%BOP_timeCounter + 1

write(*,*) 'BOP_timeCounter=' , BOP_timeCounter
write(*,*) 'BOP_timeCounter=' , BopStackInput%BOP_timeCounter
BopControlPanel%AirSupplyPressureGauge= (1 - AirSupplyPressureGaugeMalf)* (1 - RigAirMalf) *120. !psi
BopControlPanel%AirSupplyPressureGauge= (1 - BopStackAcc%AirSupplyPressureGaugeMalf)* (1 - BopStackAcc%RigAirMalf) *120. !psi
if (pram_reg < 2300.) then
ShearIsNotAllowed= 1
if (BopStackAcc%pram_reg < 2300.) then
ShearRam%ShearIsNotAllowed= 1
else
ShearIsNotAllowed= 0
ShearRam%ShearIsNotAllowed= 0
endif
!write(*,*) 'ShearIsNotAllowed=' , ShearIsNotAllowed
@@ -36,10 +36,10 @@ module BOP

!=== Instantaneous Pipe Diameters in Each Ram (Input from TD Module):==
ODDrillpipe_inAnnular= TD_AnnularPreventerDiam * 12.0 ! ft to inch
ODDrillpipe_inPipeRam1= TD_UpperRamDiam * 12.0
ODDrillpipe_inShearRam= TD_BlindRamDiam * 12.0
ODDrillpipe_inPipeRam2= TD_LowerRamDiam * 12.0
Annular%ODDrillpipe_inAnnular= TD_AnnularPreventerDiam * 12.0 ! ft to inch
PipeRam1%ODDrillpipe_in= TD_UpperRamDiam * 12.0
ShearRam%ODDrillpipe_inShearRam= TD_BlindRamDiam * 12.0
PipeRam2%ODDrillpipe_in= TD_LowerRamDiam * 12.0
@@ -48,12 +48,12 @@ module BOP
!IDPipeRam2Final
!IDAnnularFinal
OpenArea_shearBop= PI*(IDshearBopFinal**2-ODDrillpipe_inShearRam**2)/4.0d0 !D(in), AREA(in^2)
OpenArea_PipeRam1= PI*(IDPipeRam1Final**2-ODDrillpipe_inPipeRam1**2)/4.0d0 !D(in), AREA(in^2)
OpenArea_PipeRam2= PI*(IDPipeRam2Final**2-ODDrillpipe_inPipeRam2**2)/4.0d0 !D(in), AREA(in^2)
OpenArea_Annular= PI*(IDAnnularFinal**2-ODDrillpipe_inAnnular**2)/4.0d0 !D(in), AREA(in^2)
ShearRam%OpenArea_shearBop= PI*(ShearRam%IDshearBopFinal**2-ShearRam%ODDrillpipe_inShearRam**2)/4.0d0 !D(in), AREA(in^2)
ShearRam%OpenArea_PipeRam1= PI*(ShearRam%IDPipeRam1Final**2-PipeRam1%ODDrillpipe_in**2)/4.0d0 !D(in), AREA(in^2)
ShearRam%OpenArea_PipeRam2= PI*(ShearRam%IDPipeRam2Final**2-PipeRam2%ODDrillpipe_in**2)/4.0d0 !D(in), AREA(in^2)
ShearRam%OpenArea_Annular= PI*(ShearRam%IDAnnularFinal**2-Annular%ODDrillpipe_inAnnular**2)/4.0d0 !D(in), AREA(in^2)
MinimumOpenArea_InBOP= min(OpenArea_shearBop,OpenArea_PipeRam1,OpenArea_PipeRam2,OpenArea_Annular)
ShearRam%MinimumOpenArea_InBOP= min(ShearRam%OpenArea_shearBop,ShearRam%OpenArea_PipeRam1,ShearRam%OpenArea_PipeRam2,ShearRam%OpenArea_Annular)
!TD_BOPConnectionPossibility(j) = 0 or 1
@@ -64,89 +64,89 @@ module BOP

!=====================================================================
!============SEALING PRESSURES TO BE SET IN ANNULAR REGULATOR==========
WellBorePressure=5000.
if (ODDrillpipe_inAnnular>0.) then
if (ODDrillpipe_inAnnular>0. .and. ODDrillpipe_inAnnular<=1.99) then
acoef=-0.2673
bcoef=994.3
const=77
elseif (ODDrillpipe_inAnnular>1.99 .and. ODDrillpipe_inAnnular<=2.375) then
acoef=-0.2539
bcoef=994.3
const=73.15
elseif (ODDrillpipe_inAnnular>2.375 .and. ODDrillpipe_inAnnular<=2.875) then
acoef=-0.2005
bcoef=745.9
const=57.75
elseif (ODDrillpipe_inAnnular>2.875 .and. ODDrillpipe_inAnnular<=3.5) then
acoef=-0.1871
bcoef=696.1
const=53.9
elseif (ODDrillpipe_inAnnular>3.5 .and. ODDrillpipe_inAnnular<=5) then
acoef=-0.1733
bcoef=647
const=50
elseif (ODDrillpipe_inAnnular>5 .and. ODDrillpipe_inAnnular<=10) then
acoef=-0.1604
bcoef=596.7
const=46.2
AnnularComputational%WellBorePressure=5000.
if (Annular%ODDrillpipe_inAnnular>0.) then
if (Annular%ODDrillpipe_inAnnular>0. .and. Annular%ODDrillpipe_inAnnular<=1.99) then
AnnularComputational%acoef=-0.2673
AnnularComputational%Bcoef=994.3
AnnularComputational%const=77
elseif (Annular%ODDrillpipe_inAnnular>1.99 .and. Annular%ODDrillpipe_inAnnular<=2.375) then
AnnularComputational%acoef=-0.2539
AnnularComputational%Bcoef=994.3
AnnularComputational%const=73.15
elseif (Annular%ODDrillpipe_inAnnular>2.375 .and. Annular%ODDrillpipe_inAnnular<=2.875) then
AnnularComputational%acoef=-0.2005
AnnularComputational%Bcoef=745.9
AnnularComputational%const=57.75
elseif (Annular%ODDrillpipe_inAnnular>2.875 .and. Annular%ODDrillpipe_inAnnular<=3.5) then
AnnularComputational%acoef=-0.1871
AnnularComputational%Bcoef=696.1
AnnularComputational%const=53.9
elseif (Annular%ODDrillpipe_inAnnular>3.5 .and. Annular%ODDrillpipe_inAnnular<=5) then
AnnularComputational%acoef=-0.1733
AnnularComputational%Bcoef=647
AnnularComputational%const=50
elseif (Annular%ODDrillpipe_inAnnular>5 .and. Annular%ODDrillpipe_inAnnular<=10) then
AnnularComputational%acoef=-0.1604
AnnularComputational%Bcoef=596.7
AnnularComputational%const=46.2
endif
AnnularSealingPressure= max((acoef*WellBorePressure+bcoef), const) !(psi)
AnnularComputational%AnnularSealingPressure= max((AnnularComputational%acoef*AnnularComputational%WellBorePressure+AnnularComputational%Bcoef), AnnularComputational%const) !(psi)
else !CSO(COMPLETE SHUT OFF) ODDrillpipe_inAnnular=0
AnnularSealingPressure= 1150. !(psi)
AnnularComputational%AnnularSealingPressure= 1150. !(psi)
endif
!=====================================================================
! BYPASS POSITION
!=====================================================================
if(BopControlPanel%ByePassValve == -1.0 .and. BopControlPanel%AirMasterValve==1) then
ByPassOld= -1.0
BopStackAcc%ByPassOld= -1.0
!write(*,*) 'ByePassValve to -1' ,ByePassValve
elseif(BopControlPanel%ByePassValve == 1.0 .and. BopControlPanel%AirMasterValve==1) then
ByPassOld= 1.0
BopStackAcc%ByPassOld= 1.0
!write(*,*) 'ByePassValve to 1=' ,ByePassValve
endif
!write(*,*) 'ByePassValve,ByPassOld=' ,ByePassValve,ByPassOld
!=====================================================================
!WRITE(*,*) 'AnnularRegulatorSetControl====' , AnnularRegulatorSetControl
Pannular_regset=min(BopControlPanel%AnnularRegulatorSetControl,1700.) ! for changing its set conditions instantaneously
if (Annular_closed==1) then
if (FirstSet==1) then ! code start
Pannular_reg= Pannular_regset
Annular%Pannular_regset=min(BopControlPanel%AnnularRegulatorSetControl,1700.) ! for changing its set conditions instantaneously
if (Annular%Annular_closed==1) then
if (Annular%FirstSet==1) then ! code start
Annular%Pannular_reg= Annular%Pannular_regset
endif

if (FirstSet==0) then ! durig run, but annular is not closing or opening
Pannular_reg= min(p_acc,Pannular_regset)
if (Annular%FirstSet==0) then ! durig run, but annular is not closing or opening
Annular%Pannular_reg= min(RamLine%P_ACC,Annular%Pannular_regset)
endif
endif
!===================================================================
! Annular Preventer Pressure Rise On Tooljoint
!===================================================================
if ( Annular_Situation_forTD == 1 .and. TD_AnnularFillingFinal==0.0 ) then ! Annular_Situation_forTD= 1 ! closed - for TD code
AnnPressureRise= .true.
elseif ( Annular_Situation_forTD == 0 ) then
AnnPressureRise= .false.
if ( Annular%Annular_Situation_forTD == 1 .and. TD_AnnularFillingFinal==0.0 ) then ! Annular_Situation_forTD= 1 ! closed - for TD code
AnnularComputational%AnnPressureRise= .true.
elseif ( Annular%Annular_Situation_forTD == 0 ) then
AnnularComputational%AnnPressureRise= .false.
endif
if (AnnPressureRise == .true.) then
Pannular_reg= Pannular_reg + 200. * TD_AnnularFillingFinal ! 200 psi pressure rise when 100% of AnnPreventer is filled by tool joint
if (AnnularComputational%AnnPressureRise == .true.) then
Annular%Pannular_reg= Annular%Pannular_reg + 200. * TD_AnnularFillingFinal ! 200 psi pressure rise when 100% of AnnPreventer is filled by tool joint
!TD_AnnularFillingFinal ! (0.0 to 1.0) percentage filled by tool joint
endif
!===================================================================
if (FirstSet== 1) then
if (Annular%FirstSet== 1) then
!new= (1 - AnnularPressureGaugeMalf) * min(AnnularRegulatorSetControl,1700.)
CALL Pannular_regDelay%AddToFirst( (1 - AnnularPressureGaugeMalf) * min(BopControlPanel%AnnularRegulatorSetControl,1700.) )
CALL Pannular_regDelay%Remove(Pannular_regDelay%Length())
BopControlPanel%AnnularPressureGauge= Pannular_regDelay%Last()
CALL AnnularComputational%Pannular_regDelay%AddToFirst( (1 - Annular%AnnularPressureGaugeMalf) * min(BopControlPanel%AnnularRegulatorSetControl,1700.) )
CALL AnnularComputational%Pannular_regDelay%Remove(AnnularComputational%Pannular_regDelay%Length())
BopControlPanel%AnnularPressureGauge= AnnularComputational%Pannular_regDelay%Last()
!AnnularPressureGauge= (1 - AnnularPressureGaugeMalf) * min(AnnularRegulatorSetControl,1700.)
!write(*,*) 'set 1' , AnnularPressureGauge
else !FirstSet== 0
!new= (1 - AnnularPressureGaugeMalf) * Pannular_reg
CALL Pannular_regDelay%AddToFirst( (1 - AnnularPressureGaugeMalf) * Pannular_reg)
CALL Pannular_regDelay%Remove(Pannular_regDelay%Length())
BopControlPanel%AnnularPressureGauge= Pannular_regDelay%Last()
CALL AnnularComputational%Pannular_regDelay%AddToFirst( (1 - Annular%AnnularPressureGaugeMalf) * Annular%Pannular_reg)
CALL AnnularComputational%Pannular_regDelay%Remove(AnnularComputational%Pannular_regDelay%Length())
BopControlPanel%AnnularPressureGauge= AnnularComputational%Pannular_regDelay%Last()
!AnnularPressureGauge= (1 - AnnularPressureGaugeMalf) * Pannular_reg
!write(*,*) 'set 0' , AnnularPressureGauge
endif
@@ -154,122 +154,122 @@ module BOP
!===================================================
! AIR OPERATED PUMP CODE- START
!===================================================
if (p_acc<AIR_PUMPON .and. airp_switch==0) then
airp_switch=1
if (RamLine%P_ACC<Pumps%AIR_ON .and. RamLine%AIRP_SWITCH==0) then
RamLine%AIRP_SWITCH=1
endif
if (p_acc>AIR_PUMPOFF .and. airp_switch==1) then
airp_switch=0
call SetSoundKoomeyAirPump(airp_switch)
if (RamLine%P_ACC>Pumps%AIR_OFF .and. RamLine%AIRP_SWITCH==1) then
RamLine%AIRP_SWITCH=0
call SetSoundKoomeyAirPump(RamLine%AIRP_SWITCH)
endif
if (p_acc<ELECTRIC_PUMPON .and. elecp_switch==0) then
elecp_switch=1
if (RamLine%P_ACC<Pumps%ELECTRIC_ON .and. RamLine%ELECP_SWITCH==0) then
RamLine%ELECP_SWITCH=1
endif
if (p_acc>ELECTRIC_PUMPOFF .and. elecp_switch==1) then
elecp_switch=0
if (RamLine%P_ACC>Pumps%ELECTRIC_OFF .and. RamLine%ELECP_SWITCH==1) then
RamLine%ELECP_SWITCH=0
endif

!write(*,*) 'airp_switch,elecp_switch=' , airp_switch,elecp_switch
!================CHARGING BOTTLES=======================
if (airp_switch==1 .or. elecp_switch==1) then
if (Annular_closed==1 .and. ShearBop_closed==1 .and. PipeRam1_closed==1 .and. PipeRam2_closed==1 .and. ChokeLine_closed==1 .and. KillLine_closed==1) then
if (RamLine%AIRP_SWITCH==1 .or. RamLine%ELECP_SWITCH==1) then
if (Annular%Annular_closed==1 .and. RamLine%ShearBop_closed==1 .and. PipeRam1%closed==1 .and. PipeRam2%closed==1 .and. ChokeLine%closed==1 .and. KillLine%closed==1) then
call pumps_charge_bottle()
! increases volume and pressure in the bottles
if (p_acc>acc_ChargedPressure) then
p_acc=acc_ChargedPressure
if (AnnularLeakMalf== 0) then
if (RamLine%P_ACC>BopStackAcc%acc_ChargedPressure) then
RamLine%P_ACC=BopStackAcc%acc_ChargedPressure
if (Annular%AnnularLeakMalf== 0) then
!finished_Annular=1
RAM(1)%Bottles_Charged_MalfActive= .false.
else
finished_Annular=0
Annular%finished_Annular=0
RAM(1)%Bottles_Charged_MalfActive= .true.
!fvr=fvr-2.5
endif
if (UpperRamsLeakMalf== 0) then
if (PipeRam1%UpperRamsLeakMalf== 0) then
!finished_pipe1=1
RAM(2)%Bottles_Charged_MalfActive= .false.
else
finished_pipe1=0
PipeRam1%finished=0
RAM(2)%Bottles_Charged_MalfActive= .true.
!fvr=fvr-2.5
endif
if (LowerRamsLeakMalf== 0) then
if (PipeRam2%LowerRamsLeakMalf== 0) then
!finished_pipe2=1
RAM(3)%Bottles_Charged_MalfActive= .false.
else
finished_pipe2=0
PipeRam2%finished=0
RAM(3)%Bottles_Charged_MalfActive= .true.
!fvr=fvr-2.5
endif
if (MiddleRamsLeakMalf== 0) then
if (ShearRam%MiddleRamsLeakMalf== 0) then
!finished_shear=1
RAM(4)%Bottles_Charged_MalfActive= .false.
else
finished_shear=0
RamLine%FINISHED_shear=0
RAM(4)%Bottles_Charged_MalfActive= .true.
!fvr=fvr-2.5
endif
finished_KillLine=1
finished_ChokeLine=1
KillLine%finished=1
ChokeLine%finished=1
if (AnnularLeakMalf== 0 .and. UpperRamsLeakMalf== 0 .and. LowerRamsLeakMalf== 0 .and. MiddleRamsLeakMalf== 0) then
elecp_switch=0
airp_switch=0
if (Annular%AnnularLeakMalf== 0 .and. PipeRam1%UpperRamsLeakMalf== 0 .and. PipeRam2%LowerRamsLeakMalf== 0 .and. ShearRam%MiddleRamsLeakMalf== 0) then
RamLine%ELECP_SWITCH=0
RamLine%AIRP_SWITCH=0
endif
endif
endif
endif

!=======================================================
if (elecp_switch==1 .and. AccPupmsFailMalf==0) then !on position
deltav_elecp=QELECTRIC_PUMP*DeltaT_BOP/60. !QELECTRIC_PUMP(gpm), deltav_elecp(gal), DeltaT_BOP(0.1 sec)
SoundKoomeyElectricPump= .True.
if (RamLine%ELECP_SWITCH==1 .and. BopStackAcc%AccPupmsFailMalf==0) then !on position
Pumps%DELTAV_ELECP=Pumps%QELECTRIC*RamLine%DeltaT_BOP/60. !QELECTRIC_PUMP(gpm), deltav_elecp(gal), DeltaT_BOP(0.1 sec)
Pumps%SoundKoomeyElectric= .True.
else
deltav_elecp=0
SoundKoomeyElectricPump= .false.
Pumps%DELTAV_ELECP=0
Pumps%SoundKoomeyElectric= .false.
endif

!call SetSoundKoomeyElectricPump(SoundKoomeyElectricPump)
if (airp_switch==1 .and. AccPupmsFailMalf==0) then !on position
if (RamLine%AIRP_SWITCH==1 .and. BopStackAcc%AccPupmsFailMalf==0) then !on position
call airpump_code() !ramtype=2
end if ! if (airp_switch==1) then !on position


!===============AIR OPERATED PUMP CODE- END================
if (ShearBop_closed==1 .and. PipeRam1_closed==1 .and. PipeRam2_closed==1 .and. ChokeLine_closed==1 .and. KillLine_closed==1) then
if (RamLine%ShearBop_closed==1 .and. PipeRam1%closed==1 .and. PipeRam2%closed==1 .and. ChokeLine%closed==1 .and. KillLine%closed==1) then
!write(*,*) ' All Rams are closed'
if(ByPassOld== -1.0) then ! (OPEN POSITION)
if(BopStackAcc%ByPassOld== -1.0) then ! (OPEN POSITION)
!old=pram_reg
!new=p_acc- MAXVAL(RAM%loss_before)
!difference= new-old
PressureDifference= p_acc- MAXVAL(RAM%loss_before) - pram_reg
if (ABS(PressureDifference) > BaseDifferenceP) then !BaseDifferenceP= 300. psi
pram_reg= pram_reg + (PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20.
BopStackAcc%PressureDifference= RamLine%P_ACC- MAXVAL(RAM%loss_before) - BopStackAcc%pram_reg
if (ABS(BopStackAcc%PressureDifference) > BaseDifferenceP) then !BaseDifferenceP= 300. psi
BopStackAcc%pram_reg= BopStackAcc%pram_reg + (BopStackAcc%PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20.
else
pram_reg= p_acc- MAXVAL(RAM%loss_before) ! mishe khate paeen ye shart gozasht ke pacc=3000 shod, in adad dige kam nashe
BopStackAcc%pram_reg= RamLine%P_ACC- MAXVAL(RAM%loss_before) ! mishe khate paeen ye shart gozasht ke pacc=3000 shod, in adad dige kam nashe
endif
elseif (ByPassOld== 1.0) then ! (CLOSE POSITION)
elseif (BopStackAcc%ByPassOld== 1.0) then ! (CLOSE POSITION)
!pram_reg= prams_regset
!if (RamsFirstSet==1) then
!write(*,*) 'bypass CLOSE POSITION'
!old=pram_reg
!new=prams_regset
!difference= new-old
PressureDifference= prams_regset - pram_reg
BopStackAcc%PressureDifference= BopStackAcc%PRAMS_REGSET - BopStackAcc%pram_reg
!write(*,*) 'PressureDifference, prams_regset , pram_reg=' , PressureDifference, prams_regset , pram_reg
if (ABS(PressureDifference) > BaseDifferenceP) then !BaseDifferenceP= 200. ! psi in starup
pram_reg= pram_reg + (PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20. in startup
if (ABS(BopStackAcc%PressureDifference) > BaseDifferenceP) then !BaseDifferenceP= 200. ! psi in starup
BopStackAcc%pram_reg= BopStackAcc%pram_reg + (BopStackAcc%PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20. in startup
else
pram_reg= prams_regset
BopStackAcc%pram_reg= BopStackAcc%PRAMS_REGSET
endif
!write(*,*) 'pram_reg=' , pram_reg
@@ -279,12 +279,12 @@ module BOP
endif
BopControlPanel%MiddleRamsStatus = IDshearBop
BopControlPanel%UpperRamsStatus = IDPipeRam1
BopControlPanel%LowerRamsStatus = IDPipeRam2
BopControlPanel%AnnularStatus = IDAnnular
BopControlPanel%AccumulatorPressureGauge = (1 - AccumulatorPressureGaugeMalf) * p_acc
BopControlPanel%ManifoldPressureGauge= (1 - ManifoldPressureGaugeMalf) * pram_reg
BopControlPanel%MiddleRamsStatus = ShearRam%IDshearBop
BopControlPanel%UpperRamsStatus = PipeRam1%ID
BopControlPanel%LowerRamsStatus = PipeRam2%ID
BopControlPanel%AnnularStatus = Annular%IDAnnular
BopControlPanel%AccumulatorPressureGauge = (1 - BopStackAcc%AccumulatorPressureGaugeMalf) * RamLine%P_ACC
BopControlPanel%ManifoldPressureGauge= (1 - BopStackAcc%ManifoldPressureGaugeMalf) * BopStackAcc%pram_reg
!AnnularPressureGauge=Pannular_reg
!
! WRITE(60,60) RAM(2)%time,RAM(2)%Q,RAM(2)%vdis_tot,p_acc, &


+ 135
- 135
Equipments/BopStack/BOPstartup.f90 查看文件

@@ -22,7 +22,7 @@ integer i
!AirSupplyPressureGauge=0
!======================= SETTING VARIABLES

BOP_timeCounter= 0
BopStackInput%BOP_timeCounter= 0

!============== FOR MANIFOLD VALVES CODE=====================
CALL OpenAnnular
@@ -32,10 +32,10 @@ CALL CloseKillLine
CALL CloseChokeLine
CALL OpenLowerRams

Annular_Situation_forTD= 0 ! open - for TD code
ShearBop_Situation_forTD= 0 ! open - for TD code
PipeRam1_Situation_forTD= 0 ! open - for TD code
PipeRam2_Situation_forTD= 0 ! open - for TD code
Annular%Annular_Situation_forTD= 0 ! open - for TD code
RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
PipeRam1%Situation_forTD= 0 ! open - for TD code
PipeRam2%Situation_forTD= 0 ! open - for TD code
!======================================================================

CALL LOSS_INPUTS()
@@ -54,11 +54,11 @@ RAM%First_OpenTimecheck= 0



Cumulative_AirVolume= 0.0
BopStackAcc%Cumulative_AirVolume= 0.0


bottle_capacity=10 !(GALON)
nobottles=Accumulator%NumberOfBottels
BopStackAcc%BOTTLE_CAPACITY=10 !(GALON)
BopStackAcc%NOBOTTLES=Accumulator%NumberOfBottels



@@ -67,82 +67,82 @@ nobottles=Accumulator%NumberOfBottels


!fvr_tot=40 !(GALON) IN CHARGED POSITION
prams_regset=1500 !RamsReglatorSet !=1500 DEFAULT regulator set pressure (PSI)
acc_ChargedPressure=3000 !charged(PSI)
acc_MinPressure=Accumulator%AccumulatorMinimumOperatingPressure !1200 !discharged(PSI)
BopStackAcc%PRAMS_REGSET=1500 !RamsReglatorSet !=1500 DEFAULT regulator set pressure (PSI)
BopStackAcc%acc_ChargedPressure=3000 !charged(PSI)
BopStackAcc%acc_MinPressure=Accumulator%AccumulatorMinimumOperatingPressure !1200 !discharged(PSI)
!acc_precharge=1000


fvr_tot=(-2451*(acc_ChargedPressure**(-0.8202))+8.435)*nobottles ! IT IS WRRITEN FOR PRECHARGE 1000 PSI FROM ITS CURVE
BopStackAcc%FVR_TOT=(-2451*(BopStackAcc%acc_ChargedPressure**(-0.8202))+8.435)*BopStackAcc%NOBOTTLES ! IT IS WRRITEN FOR PRECHARGE 1000 PSI FROM ITS CURVE

!write(*,*) 'fvr_tot=',fvr_tot

!ELECTRIC_PUMPON=2800
ELECTRIC_PUMPON=Accumulator%StartPressure
Pumps%ELECTRIC_ON=Accumulator%StartPressure
!ELECTRIC_PUMPOFF=acc_ChargedPressure !=3000 psi
ELECTRIC_PUMPOFF=Accumulator%StopPressure
Pumps%ELECTRIC_OFF=Accumulator%StopPressure
!QELECTRIC_PUMP=12 !(gpm)
QELECTRIC_PUMP=Accumulator%ElectricPumpOutput
Pumps%QELECTRIC=Accumulator%ElectricPumpOutput



!AIR_PUMPON=2600
AIR_PUMPON=Accumulator%StartPressure2
Pumps%AIR_ON=Accumulator%StartPressure2
!AIR_PUMPOFF=2900
AIR_PUMPOFF=Accumulator%StopPressure2
Pumps%AIR_OFF=Accumulator%StopPressure2



RAM%tol=0.0037 !%=(2700-2600)/2700
RAM%tolzero=RAM%tol

tolAnnular=0.0018 !=(2900-2895)/2900
tolzeroAnnular=tolAnnular
Annular%tolAnnular=0.0018 !=(2900-2895)/2900
Annular%tolzeroAnnular=Annular%tolAnnular
!======================OTHER INPUTS(CONSTANTS)===========================
pa=300 !(PSI)
p_shear=1200 !(PSI)
ShearRam%PA=300 !(PSI)
ShearRam%P_SHEAR=1200 !(PSI)
!p_shear=2423.1 !(PSI)
pb=p_shear-pa
pa_annular=100 !(psi)
ShearRam%PB=ShearRam%P_SHEAR-ShearRam%PA
AnnularComputational%pa_annular=100 !(psi)



IDAnnularBase=13.625 !(inch)
IDAnnular=IDAnnularBase
ODDrillpipe_inAnnularBase=5. ! so 18 gal is for complete closing of annular
ODDrillpipe_inAnnular=5. ! initial
AnnularMovingPressure=360. !(psi)
IDAnnularFinal= IDAnnular
Annular%IDAnnularBase=13.625 !(inch)
Annular%IDAnnular=Annular%IDAnnularBase
Annular%ODDrillpipe_inAnnularBase=5. ! so 18 gal is for complete closing of annular
Annular%ODDrillpipe_inAnnular=5. ! initial
AnnularComputational%AnnularMovingPressure=360. !(psi)
ShearRam%IDAnnularFinal= Annular%IDAnnular


IDshearBopBase=13.625 !(inch)
IDshearBop=IDshearBopBase
ODDrillpipe_inShearRamBase=5 !initial
ODDrillpipe_inShearRam=5 !initial
IDshearBopFinal= IDshearBop
ShearRam%IDshearBopBase=13.625 !(inch)
ShearRam%IDshearBop=ShearRam%IDshearBopBase
ShearRam%ODDrillpipe_inShearRamBase=5 !initial
ShearRam%ODDrillpipe_inShearRam=5 !initial
ShearRam%IDshearBopFinal= ShearRam%IDshearBop

IDPipeRamBase=13.625 !(inch)
IDPipeRam1=IDPipeRamBase
ODDrillpipe_inPipeRam1Base=5 !initial
ODDrillpipe_inPipeRam1=5 !initial
IDPipeRam1Final= IDPipeRam1
PipeRam1%IDBase=13.625 !(inch)
PipeRam1%ID=PipeRam1%IDBase
PipeRam1%ODDrillpipe_inBase=5 !initial
PipeRam1%ODDrillpipe_in=5 !initial
ShearRam%IDPipeRam1Final= PipeRam1%ID


IDPipeRam2=IDPipeRamBase !(inch)
ODDrillpipe_inPipeRam2Base=5 !initial
ODDrillpipe_inPipeRam2=5 !initial
IDPipeRam2Final= IDPipeRam2
PipeRam2%ID=PipeRam1%IDBase !(inch)
PipeRam2%ODDrillpipe_inBase=5 !initial
PipeRam2%ODDrillpipe_in=5 !initial
ShearRam%IDPipeRam2Final= PipeRam2%ID

IDChokeLineBase=8.6 !(inch)
IDChokeLine=IDChokeLineBase
ODDrillpipe_inChokeLineBase=5
ODDrillpipe_inChokeLine=5
ChokeLine%IDBase=8.6 !(inch)
ChokeLine%ID=ChokeLine%IDBase
ChokeLine%ODDrillpipe_inBase=5
ChokeLine%ODDrillpipe_in=5

IDKillLineBase=8.6 !(inch)
IDKillLine=IDKillLineBase
ODDrillpipe_inKillLineBase=5
ODDrillpipe_inKillLine=5
KillLine%IDBase=8.6 !(inch)
KillLine%ID=KillLine%IDBase
KillLine%ODDrillpipe_inBase=5
KillLine%ODDrillpipe_in=5


!va=4 !(liter)
@@ -150,99 +150,99 @@ ODDrillpipe_inKillLine=5

!cv=2; !flow coefficinet of regulator

RAM_COURSE=320.2 !milimeter
H_REGRAM=0 !(m)<<<<<<<<<<<<<<<<<<<<<<<<
H_ShearRamBop=(BopStackSpecification%GroundLevel-BopStackSpecification%BlindRamHeight)*0.3048 ! foot to meter
H_PipeRam1Bop=(BopStackSpecification%GroundLevel-BopStackSpecification%UpperRamHeight)*0.3048 ! foot to meter
H_PipeRam2Bop=(BopStackSpecification%GroundLevel-BopStackSpecification%LowerRamHeight)*0.3048 ! foot to meter
H_AnnularBop=(BopStackSpecification%GroundLevel-BopStackSpecification%AnnularPreventerHeight)*0.3048 ! foot to meter
H_ChokeLineBop=(BopStackSpecification%GroundLevel-BopStackSpecification%KillHeight)*0.3048 ! foot to meter
H_KillLineBop=(BopStackSpecification%GroundLevel-BopStackSpecification%KillHeight)*0.3048 ! foot to meter
ShearRam%RAM_COURSE=320.2 !milimeter
ShearRam%H_REGRAM=0 !(m)<<<<<<<<<<<<<<<<<<<<<<<<
ShearRam%H_ShearRamBop=(BopStackSpecification%GroundLevel-BopStackSpecification%BlindRamHeight)*0.3048 ! foot to meter
PipeRam1%H=(BopStackSpecification%GroundLevel-BopStackSpecification%UpperRamHeight)*0.3048 ! foot to meter
PipeRam2%H_Bop=(BopStackSpecification%GroundLevel-BopStackSpecification%LowerRamHeight)*0.3048 ! foot to meter
Annular%H_AnnularBop=(BopStackSpecification%GroundLevel-BopStackSpecification%AnnularPreventerHeight)*0.3048 ! foot to meter
ChokeLine%H_Bop=(BopStackSpecification%GroundLevel-BopStackSpecification%KillHeight)*0.3048 ! foot to meter
KillLine%H_Bop=(BopStackSpecification%GroundLevel-BopStackSpecification%KillHeight)*0.3048 ! foot to meter


p_acc=acc_ChargedPressure
RamLine%P_ACC=BopStackAcc%acc_ChargedPressure
RAM%vdis_bottles=0 !initial discharged volume
fvr=fvr_tot
RamLine%FVR=BopStackAcc%FVR_TOT
RAMS%minloss=0.

!======================AIRPUMP INPUTS(CONSTANTS)===========================

RAM%FVR_AIR=0
P_AIRP=0
Pumps%P_AIRP=0

ba1=1003; ba2=.03375; ba3=4.014; ba4=.2458
bba1 =31.8; bba2 =-725.7 ; bba3 =4154
RamLine%BA1=1003; RamLine%BA2=.03375; RamLine%BA3=4.014; RamLine%BA4=.2458
RamLine%BBA1 =31.8; RamLine%BBA2 =-725.7 ; RamLine%BBA3 =4154

Qiter=7 !(gpm)
Pumps%Qiter=7 !(gpm)

! Q=0.0003585; true


DeltaT_BOP=0.1 !second
tol_air=.08
RamLine%DeltaT_BOP=0.1 !second
Pumps%TOL_AIR=.08

alpha_Qair=0
alpha_timeair=0
alpha_paccair=p_acc
alpha_pairp=p_acc
alpha_diffpair=0
alpha_lossesair=0
alpha_fvrair=0
Pumps%alpha_Qair=0
Pumps%alpha_timeair=0
Pumps%alpha_paccair=RamLine%P_ACC
Pumps%alpha_pairp=RamLine%P_ACC
Pumps%alpha_diffpair=0
Pumps%alpha_lossesair=0
Pumps%alpha_fvrair=0

counter_airp=1
RamLine%counter_airp=1

!======================BOP INPUTS(CONSTANTS)===========================

if (Accumulator%PrechargePressure == 1400.) then
b1=1396; b2=0.17; b3=3.873; b4=1.101
RamLine%B1=1396; RamLine%B2=0.17; RamLine%B3=3.873; RamLine%B4=1.101
elseif (Accumulator%PrechargePressure == 2000.) then
b1=1980; b2=0.1237; b3=15.69; b4=1.029
RamLine%B1=1980; RamLine%B2=0.1237; RamLine%B3=15.69; RamLine%B4=1.029
elseif (Accumulator%PrechargePressure == 600.) then
b1=591.9; b2=0.1968; b3=2.887; b4=0.9757
RamLine%B1=591.9; RamLine%B2=0.1968; RamLine%B3=2.887; RamLine%B4=0.9757
else !(PrechargePressure == 1000.) then ! this is for precharge=1000 psi
b1=993.7; b2=0.164; b3=5.492; b4=0.9796
RamLine%B1=993.7; RamLine%B2=0.164; RamLine%B3=5.492; RamLine%B4=0.9796
endif
ByPassOld= 1.0
BopStackAcc%ByPassOld= 1.0

RAM%p_bop=pa
p_annular=pa_annular
RAM%p_bop=ShearRam%PA
AnnularComputational%p_annular=AnnularComputational%pa_annular
!Q=0.0055; !initial flow rate (m^3/s)
RAM%flow=60 !(gpm) initial value
RAM%Qzero=70 !for DP code, increasing Q after shear
RAM%vdis_tot=0
airp_switch=0 !off position
elecp_switch=0 !off position
ShearBop_closed=1
PipeRam1_closed=1
PipeRam2_closed=1
ChokeLine_closed=1
KillLine_closed=1
Annular_closed=1
finished_Shear=0
finished_pipe1=0
finished_pipe2=0
finished_ChokeLine=0
finished_KillLine=0
finished_Annular=0
deltav_elecp=0
RamLine%AIRP_SWITCH=0 !off position
RamLine%ELECP_SWITCH=0 !off position
RamLine%ShearBop_closed=1
PipeRam1%closed=1
PipeRam2%closed=1
ChokeLine%closed=1
KillLine%closed=1
Annular%Annular_closed=1
RamLine%FINISHED_shear=0
PipeRam1%finished=0
PipeRam2%finished=0
ChokeLine%finished=0
KillLine%finished=0
Annular%finished_Annular=0
Pumps%DELTAV_ELECP=0
RAM%vdis_elecp=0
!==================================================================
RAM%timecounter_ram=0
RAM%Q=0
pram_reg=prams_regset !psi !RamsReglatorSet
Pannular_reg=min(BopControlPanel%AnnularRegulatorSetControl,1700.)
BopStackAcc%pram_reg=BopStackAcc%PRAMS_REGSET !psi !RamsReglatorSet
Annular%Pannular_reg=min(BopControlPanel%AnnularRegulatorSetControl,1700.)




BopControlPanel%MiddleRamsStatus= IDshearBop
BopControlPanel%UpperRamsStatus= IDPipeRam1
BopControlPanel%LowerRamsStatus= IDPipeRam2
BopControlPanel%AnnularStatus = IDAnnular
BopControlPanel%MiddleRamsStatus= ShearRam%IDshearBop
BopControlPanel%UpperRamsStatus= PipeRam1%ID
BopControlPanel%LowerRamsStatus= PipeRam2%ID
BopControlPanel%AnnularStatus = Annular%IDAnnular


BopControlPanel%AccumulatorPressureGauge = p_acc
BopControlPanel%AccumulatorPressureGauge = RamLine%P_ACC


RAM%time=0
@@ -260,62 +260,62 @@ RAM%time=0


BopControlPanel%MiddleRamsOpenLED = LedOn
MiddleRamsOpenLEDMine = LedOn
BopStackInput%MiddleRamsOpenLEDMine = LedOn
BopControlPanel%MiddleRamsCloseLED = LedOff
MiddleRamsCloseLEDMine = LedOff
ShearRamIsOpening = .false.
ShearRamIsClosing = .false.
BopStackInput%MiddleRamsCloseLEDMine = LedOff
RamLine%ShearRamIsOpening = .false.
RamLine%ShearRamIsClosing = .false.

BopControlPanel%UpperRamsOpenLED = LedOn
UpperRamsOpenLEDMine = LedOn
BopStackInput%UpperRamsOpenLEDMine = LedOn
BopControlPanel%UpperRamsCloseLED = LedOff
UpperRamsCloseLEDMine = LedOff
PipeRam1IsOpening = .false.
PipeRam1IsClosing = .false.
BopStackInput%UpperRamsCloseLEDMine = LedOff
PipeRam1%IsOpening = .false.
PipeRam1%IsClosing = .false.
BopControlPanel%LowerRamsOpenLED = LedOn
LowerRamsOpenLEDMine = LedOn
BopStackInput%LowerRamsOpenLEDMine = LedOn
BopControlPanel%LowerRamsCloseLED = LedOff
LowerRamsCloseLEDMine = LedOff
PipeRam2IsOpening = .false.
PipeRam2IsClosing = .false.
BopStackInput%LowerRamsCloseLEDMine = LedOff
PipeRam2%IsOpening = .false.
PipeRam2%IsClosing = .false.
BopControlPanel%ChokeLineOpenLED = LedOff
ChokeLineOpenLEDMine = LedOff
BopStackInput%ChokeLineOpenLEDMine = LedOff
BopControlPanel%ChokeLineCloseLED = LedOn
ChokeLineCloseLEDMine = LedOn
ChokeLineIsOpening = .false.
ChokeLineIsClosing = .false.
BopStackInput%ChokeLineCloseLEDMine = LedOn
ChokeLine%IsOpening = .false.
ChokeLine%IsClosing = .false.
BopControlPanel%KillLineOpenLED = LedOff
KillLineOpenLedMine = LedOff
BopStackInput%KillLineOpenLedMine = LedOff
BopControlPanel%KillLineCloseLED = LedOn
KillLineCloseLedMine = LedOn
KillLineIsOpening = .false.
KillLineIsClosing = .false.
BopStackInput%KillLineCloseLedMine = LedOn
KillLine%IsOpening = .false.
KillLine%IsClosing = .false.
BopControlPanel%AnnularOpenLED = LedOn
AnnularOpenLedMine = LedOn
BopStackInput%AnnularOpenLedMine = LedOn
BopControlPanel%AnnularCloseLED = LedOff
AnnularCloseLedMine = LedOff
BopStackInput%AnnularCloseLedMine = LedOff
AnnularIsOpening = .false.
AnnularIsClosing = .false.
Annular%AnnularIsOpening = .false.
Annular%AnnularIsClosing = .false.
FirstSet=1
RamsFirstSet=1
BopControlPanel%ManifoldPressureGauge=prams_regset !RamsReglatorSet
BopControlPanel%AnnularPressureGauge= (1 - AnnularPressureGaugeMalf) * min(BopControlPanel%AnnularRegulatorSetControl,1700.)
Annular%FirstSet=1
AnnularComputational%RamsFirstSet=1
BopControlPanel%ManifoldPressureGauge=BopStackAcc%PRAMS_REGSET !RamsReglatorSet
BopControlPanel%AnnularPressureGauge= (1 - Annular%AnnularPressureGaugeMalf) * min(BopControlPanel%AnnularRegulatorSetControl,1700.)
PannularTimeStepDelay = int(1./DeltaT_BOP) ! 1/0.1 : for 1 sec delay in AnnRegulator shot time
AnnularComputational%PannularTimeStepDelay = int(1./RamLine%DeltaT_BOP) ! 1/0.1 : for 1 sec delay in AnnRegulator shot time

DO i = 1 , PannularTimeStepDelay
CALL Pannular_regDelay%AddToFirst(BopControlPanel%AnnularPressureGauge)
DO i = 1 , AnnularComputational%PannularTimeStepDelay
CALL AnnularComputational%Pannular_regDelay%AddToFirst(BopControlPanel%AnnularPressureGauge)
END DO


+ 9
- 9
Equipments/BopStack/BlindRamsMain.f90 查看文件

@@ -20,22 +20,22 @@ module BlindRamsMain
subroutine BlindRams_Step
use VARIABLES
implicit none
if (FINISHED_shear/=0) then
if (RamLine%FINISHED_shear/=0) then
call SHEAR_RAMS
if (ShearRamIsOpening .or. ShearRamIsClosing .or. RAM(4)%Bottles_Charged_MalfActive) then
FirstSet= 0
RamsFirstSet= 0
if(FINISHED_shear==0) then
if (RamLine%ShearRamIsOpening .or. RamLine%ShearRamIsClosing .or. RAM(4)%Bottles_Charged_MalfActive) then
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
if(RamLine%FINISHED_shear==0) then
call SHEAR_RAMS_SUB !only body of loop2
if (FINISHED_shear/=0 .and. finished_shear==1 .and. RAM(4)%Bottles_Charged_MalfActive==.true.) then
call bop_code(1,H_ShearRamBop,4)
if (RamLine%FINISHED_shear/=0 .and. RamLine%FINISHED_shear==1 .and. RAM(4)%Bottles_Charged_MalfActive==.true.) then
call bop_code(1,ShearRam%H_ShearRamBop,4)
endif
endif
endif
else
call SHEAR_RAMS_SUB
if (FINISHED_shear/=0 .and. finished_shear==1 .and. RAM(4)%Bottles_Charged_MalfActive==.true.) then
call bop_code(1,H_ShearRamBop,4)
if (RamLine%FINISHED_shear/=0 .and. RamLine%FINISHED_shear==1 .and. RAM(4)%Bottles_Charged_MalfActive==.true.) then
call bop_code(1,ShearRam%H_ShearRamBop,4)
endif
endif



+ 53
- 53
Equipments/BopStack/CHOKE_LINE.f90 查看文件

@@ -18,7 +18,7 @@ SUBROUTINE CHOKE_LINE
RAM(5)%SuccessionCounter = RAM(5)%SuccessionCounter + 1
if (BopControlPanel%ChokeLineValve == -1.0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. p_acc>acc_MinPressure) then
if (BopControlPanel%ChokeLineValve == -1.0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
if ( RAM(5)%SuccessionCounter /= RAM(5)%SuccessionCounterOld+1 ) then
RAM(5)%SuccessionCounter = 0 ! also in starup
@@ -29,7 +29,7 @@ SUBROUTINE CHOKE_LINE
endif
if ( RAM(5)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(5)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -38,36 +38,36 @@ SUBROUTINE CHOKE_LINE
if (ChokeLineOpenLEDMine == LedOn) then
if (BopStackInput%ChokeLineOpenLEDMine == LedOn) then
RETURN
end if
ChokeLine_closed=0
ChokeLine%closed=0
RAM(5)%vdis_tot=0
RAM(5)%vdis_bottles=0.
RAM(5)%fvr_air=0.
RAM(5)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(5)%Qzero=70
RAM(5)%Q=RAM(5)%Qzero
RAM(5)%flow=70
RAM(5)%tol=0.0037
if (finished_ChokeLine==1) then
ChokeLineLeverOld= 1.0
if (ChokeLine%finished==1) then
ChokeLine%LeverOld= 1.0
else
ChokeLineLeverOld=BopControlPanel%ChokeLineValve
ChokeLine%LeverOld=BopControlPanel%ChokeLineValve
endif
finished_ChokeLine=0
ChokeLineIsOpening = .true.
ChokeLine%finished=0
ChokeLine%IsOpening = .true.
BopControlPanel%ChokeLineCloseLED = LedOff
ChokeLineCloseLEDMine = LedOff
BopStackInput%ChokeLineCloseLEDMine = LedOff
BopControlPanel%ChokeLineOpenLED = LedOn !LedBlinking
RAM(5)%bop_type = 3
!AbopChokeLine=196.67
AbopChokeLine=(BopStackSpecification%ChokeClose*231)/((IDChokeLineBase-ODDrillpipe_inChokeLineBase)/2.)
NeededVolumeChokeLine=AbopChokeLine*(IDChokeLineBase-max(ODDrillpipe_inChokeLine,ODDrillpipe_inChokeLineBase))/(2.*231) !1.5 galon for each BOP
ChokeLine%Abop=(BopStackSpecification%ChokeClose*231)/((ChokeLine%IDBase-ChokeLine%ODDrillpipe_inBase)/2.)
ChokeLine%NeededVolume=ChokeLine%Abop*(ChokeLine%IDBase-max(ChokeLine%ODDrillpipe_in,ChokeLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
endif
if (BopControlPanel%ChokeLineValve == 1.0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. p_acc>acc_MinPressure) then
if (BopControlPanel%ChokeLineValve == 1.0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
if ( RAM(5)%SuccessionCounter /= RAM(5)%SuccessionCounterOld+1 ) then
@@ -79,7 +79,7 @@ SUBROUTINE CHOKE_LINE
endif
if ( RAM(5)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(5)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -87,15 +87,15 @@ SUBROUTINE CHOKE_LINE
if (ChokeLineCloseLEDMine == LedOn) then
if (BopStackInput%ChokeLineCloseLEDMine == LedOn) then
RETURN
end if
ChokeLine_closed=0
ChokeLine%closed=0
RAM(5)%vdis_tot=0
RAM(5)%vdis_bottles=0.
RAM(5)%fvr_air=0.
RAM(5)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(5)%Qzero=70
RAM(5)%Q=RAM(5)%Qzero
RAM(5)%flow=70
@@ -103,13 +103,13 @@ SUBROUTINE CHOKE_LINE

if (finished_ChokeLine==1) then
ChokeLineLeverOld= -1.0
if (ChokeLine%finished==1) then
ChokeLine%LeverOld= -1.0
else
ChokeLineLeverOld=BopControlPanel%ChokeLineValve
ChokeLine%LeverOld=BopControlPanel%ChokeLineValve
endif
finished_ChokeLine=0
ChokeLineIsClosing = .true.
ChokeLine%finished=0
ChokeLine%IsClosing = .true.

!if (ChokeLineCloseLED == LedOn) then
@@ -117,14 +117,14 @@ SUBROUTINE CHOKE_LINE
!end if
BopControlPanel%ChokeLineCloseLED = LedOff !new
ChokeLineCloseLedMine = LedOff !new
BopStackInput%ChokeLineCloseLEDMine = LedOff !new
BopControlPanel%ChokeLineCloseLED = LedOn !LedBlinking
RAM(5)%bop_type = 3
!AbopChokeLine=196.67
AbopChokeLine=(BopStackSpecification%ChokeOpen*231)/((IDChokeLineBase-ODDrillpipe_inChokeLineBase)/2.)
NeededVolumeChokeLine=AbopChokeLine*(IDChokeLineBase-max(ODDrillpipe_inChokeLine,ODDrillpipe_inChokeLineBase))/(2.*231) !1.5 galon for each BOP
ChokeLine%Abop=(BopStackSpecification%ChokeOpen*231)/((ChokeLine%IDBase-ChokeLine%ODDrillpipe_inBase)/2.)
ChokeLine%NeededVolume=ChokeLine%Abop*(ChokeLine%IDBase-max(ChokeLine%ODDrillpipe_in,ChokeLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
endif

@@ -168,7 +168,7 @@ SUBROUTINE CHOKE_LINE_SUB
RAM(5)%SuccessionCounter = RAM(5)%SuccessionCounter + 1
if (BopControlPanel%ChokeLineValve == 1.0 .and. ChokeLineLeverOld == -1.0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. p_acc>acc_MinPressure) then
if (BopControlPanel%ChokeLineValve == 1.0 .and. ChokeLine%LeverOld == -1.0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
if ( RAM(5)%First_CloseTimecheck == 0 ) then
@@ -183,7 +183,7 @@ SUBROUTINE CHOKE_LINE_SUB

if ( RAM(5)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(5)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -191,26 +191,26 @@ SUBROUTINE CHOKE_LINE_SUB
ChokeLine_closed=0
RAM(5)%p_bop=pa
ChokeLineLeverOld = BopControlPanel%ChokeLineValve
ChokeLine%closed=0
RAM(5)%p_bop=ShearRam%PA
ChokeLine%LeverOld = BopControlPanel%ChokeLineValve
BopControlPanel%ChokeLineOpenLED = LedOff
ChokeLineOpenLEDMine = LedOff
BopStackInput%ChokeLineOpenLEDMine = LedOff
BopControlPanel%ChokeLineCloseLED = LedOn !LedBlinking
CALL OpenChokeLine
RAM(5)%bop_type = 3
!AbopChokeLine=196.67
AbopChokeLine=(BopStackSpecification%ChokeClose*231)/((IDChokeLineBase-ODDrillpipe_inChokeLineBase)/2.)
NeededVolumeChokeLine=AbopChokeLine*(IDChokeLine-max(ODDrillpipe_inChokeLine,ODDrillpipe_inChokeLineBase))/(2.*231)
ChokeLine%Abop=(BopStackSpecification%ChokeClose*231)/((ChokeLine%IDBase-ChokeLine%ODDrillpipe_inBase)/2.)
ChokeLine%NeededVolume=ChokeLine%Abop*(ChokeLine%ID-max(ChokeLine%ODDrillpipe_in,ChokeLine%ODDrillpipe_inBase))/(2.*231)
RAM(5)%vdis_bottles=0.
RAM(5)%fvr_air=0.
RAM(5)%vdis_elecp=0.
ChokeLineIsClosing = .true.
ChokeLineIsOpening = .false.
ChokeLine%IsClosing = .true.
ChokeLine%IsOpening = .false.
endif
if (BopControlPanel%ChokeLineValve == -1.0 .and. ChokeLineLeverOld == 1.0 .and. p_acc>acc_MinPressure .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%ChokeLineValve == -1.0 .and. ChokeLine%LeverOld == 1.0 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if ( RAM(5)%First_OpenTimecheck == 0 ) then

@@ -222,7 +222,7 @@ SUBROUTINE CHOKE_LINE_SUB
RAM(5)%SuccessionCounterOld= RAM(5)%SuccessionCounter
endif
if ( RAM(5)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(5)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -230,23 +230,23 @@ SUBROUTINE CHOKE_LINE_SUB
ChokeLine_closed=0
RAM(5)%p_bop=pa
ChokeLineLeverOld = BopControlPanel%ChokeLineValve
ChokeLine%closed=0
RAM(5)%p_bop=ShearRam%PA
ChokeLine%LeverOld = BopControlPanel%ChokeLineValve
BopControlPanel%ChokeLineCloseLED = LedOff
ChokeLineCloseLEDMine = LedOff
BopStackInput%ChokeLineCloseLEDMine = LedOff
BopControlPanel%ChokeLineOpenLED = LedOn !LedBlinking
CALL OpenChokeLine
RAM(5)%bop_type = 3
!AbopChokeLine=196.67
AbopChokeLine=(BopStackSpecification%ChokeOpen*231)/((IDChokeLineBase-ODDrillpipe_inChokeLineBase)/2.)
NeededVolumeChokeLine=AbopChokeLine*(IDChokeLineBase-IDChokeLine)/(2.*231)
ChokeLine%Abop=(BopStackSpecification%ChokeOpen*231)/((ChokeLine%IDBase-ChokeLine%ODDrillpipe_inBase)/2.)
ChokeLine%NeededVolume=ChokeLine%Abop*(ChokeLine%IDBase-ChokeLine%ID)/(2.*231)
RAM(5)%vdis_bottles=0.
RAM(5)%fvr_air=0.
RAM(5)%vdis_elecp=0.

ChokeLineIsOpening = .true.
ChokeLineIsClosing = .false.
ChokeLine%IsOpening = .true.
ChokeLine%IsClosing = .false.
endif


@@ -254,21 +254,21 @@ SUBROUTINE CHOKE_LINE_SUB
RAM(5)%First_OpenTimecheck = 0
RAM(5)%time=RAM(5)%time+DeltaT_BOP !overal time (s)
RAM(5)%time=RAM(5)%time+RamLine%DeltaT_BOP !overal time (s)


!===================================================
! BOP
!===================================================
if (ChokeLine_closed==0) then !bop closing
call bop_code(4,H_ChokeLineBop,5) !ramtype=4 5=RNUMBER
if (ChokeLine%closed==0) then !bop closing
call bop_code(4,ChokeLine%H_Bop,5) !ramtype=4 5=RNUMBER
endif !bop is closing
!================================================================
if (ChokeLine_closed==1) then
if (ChokeLine%closed==1) then
RAM(5)%Q=0
!p_bop=pram_reg
RAM(5)%p_bop=pa
RAM(5)%p_bop=ShearRam%PA
RAMS%minloss(5,17)=0. !RNUMBER=5
endif

@@ -295,9 +295,9 @@ RAM(5)%timecounter_ram=RAM(5)%timecounter_ram+1
! call sleepqq(100)
if (ChokeLine_closed==1) then
if (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
finished_ChokeLine=1
ChokeLine%finished=1
! endif
endif


+ 5
- 5
Equipments/BopStack/ChokeLineMain.f90 查看文件

@@ -20,12 +20,12 @@ module ChokeLineMain
subroutine ChokeLine_Step
use VARIABLES
implicit none
if (finished_ChokeLine/=0) then
if (ChokeLine%finished/=0) then
call CHOKE_LINE
if (ChokeLineIsOpening .or. ChokeLineIsClosing) then
FirstSet= 0
RamsFirstSet= 0
if(finished_ChokeLine==0) then
if (ChokeLine%IsOpening .or. ChokeLine%IsClosing) then
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
if(ChokeLine%finished==0) then
call CHOKE_LINE_SUB !only body of loop2
endif
endif


+ 56
- 56
Equipments/BopStack/KILL_LINE.f90 查看文件

@@ -19,7 +19,7 @@ SUBROUTINE KILL_LINE
RAM(6)%SuccessionCounter = RAM(6)%SuccessionCounter + 1
if (BopControlPanel%KillLineValve == -1.0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. p_acc>acc_MinPressure) then
if (BopControlPanel%KillLineValve == -1.0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
if ( RAM(6)%SuccessionCounter /= RAM(6)%SuccessionCounterOld+1 ) then
RAM(6)%SuccessionCounter = 0 ! also in starup
@@ -30,7 +30,7 @@ SUBROUTINE KILL_LINE
endif
if ( RAM(6)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(6)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -38,36 +38,36 @@ SUBROUTINE KILL_LINE
if (KillLineOpenLedMine == LedOn) then
if (BopStackInput%KillLineOpenLedMine == LedOn) then
RETURN
end if
KillLine_closed=0
KillLine%closed=0
RAM(6)%vdis_tot=0
RAM(6)%vdis_bottles=0.
RAM(6)%fvr_air=0.
RAM(6)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(6)%Qzero=70
RAM(6)%Q=RAM(6)%Qzero
RAM(6)%flow=70
RAM(6)%tol=0.0037
if (finished_KillLine==1) then
KillLineLeverOld= 1.0
if (KillLine%finished==1) then
KillLine%LeverOld= 1.0
else
KillLineLeverOld=BopControlPanel%KillLineValve
KillLine%LeverOld=BopControlPanel%KillLineValve
endif
finished_KillLine=0
KillLineIsOpening = .true.
KillLine%finished=0
KillLine%IsOpening = .true.
BopControlPanel%KillLineCloseLED = LedOff
KillLineCloseLedMine = LedOff
BopStackInput%KillLineCloseLedMine = LedOff
BopControlPanel%KillLineOpenLED = LedOn !LedBlinking
RAM(6)%bop_type = 3
!AbopKillLine=196.67
AbopKillLine=(BopStackSpecification%KillClose*231)/((IDKillLineBase-ODDrillpipe_inKillLineBase)/2.)
NeededVolumeKillLine=AbopKillLine*(IDKillLineBase-max(ODDrillpipe_inKillLine,ODDrillpipe_inKillLineBase))/(2.*231) !1.5 galon for each BOP
KillLine%Abop=(BopStackSpecification%KillClose*231)/((KillLine%IDBase-KillLine%ODDrillpipe_inBase)/2.)
KillLine%NeededVolume=KillLine%Abop*(KillLine%IDBase-max(KillLine%ODDrillpipe_in,KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
endif
if (BopControlPanel%KillLineValve == 1.0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. p_acc>acc_MinPressure) then
if (BopControlPanel%KillLineValve == 1.0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
if ( RAM(6)%SuccessionCounter /= RAM(6)%SuccessionCounterOld+1 ) then
@@ -79,7 +79,7 @@ SUBROUTINE KILL_LINE
endif
if ( RAM(6)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(6)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -87,15 +87,15 @@ SUBROUTINE KILL_LINE
if (KillLineCloseLedMine == LedOn) then
if (BopStackInput%KillLineCloseLedMine == LedOn) then
RETURN
end if
KillLine_closed=0
KillLine%closed=0
RAM(6)%vdis_tot=0
RAM(6)%vdis_bottles=0.
RAM(6)%fvr_air=0.
RAM(6)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(6)%Qzero=70
RAM(6)%Q=RAM(6)%Qzero
RAM(6)%flow=70
@@ -103,13 +103,13 @@ SUBROUTINE KILL_LINE

if (finished_KillLine==1) then
KillLineLeverOld= -1.0
if (KillLine%finished==1) then
KillLine%LeverOld= -1.0
else
KillLineLeverOld=BopControlPanel%KillLineValve
KillLine%LeverOld=BopControlPanel%KillLineValve
endif
finished_KillLine=0
KillLineIsClosing = .true.
KillLine%finished=0
KillLine%IsClosing = .true.

!if (KillLineCloseLed == LedOn) then
@@ -117,18 +117,18 @@ SUBROUTINE KILL_LINE
!end if
BopControlPanel%KillLineCloseLED = LedOff !new
KillLineCloseLedMine = LedOff !new
BopStackInput%KillLineCloseLedMine = LedOff !new
BopControlPanel%KillLineCloseLED = LedOn !LedBlinking
RAM(6)%bop_type = 3
!AbopKillLine=196.67
AbopKillLine=(BopStackSpecification%KillOpen*231)/((IDKillLineBase-ODDrillpipe_inKillLineBase)/2.)
NeededVolumeKillLine=AbopKillLine*(IDKillLineBase-max(ODDrillpipe_inKillLine,ODDrillpipe_inKillLineBase))/(2.*231) !1.5 galon for each BOP
KillLine%Abop=(BopStackSpecification%KillOpen*231)/((KillLine%IDBase-KillLine%ODDrillpipe_inBase)/2.)
KillLine%NeededVolume=KillLine%Abop*(KillLine%IDBase-max(KillLine%ODDrillpipe_in,KillLine%ODDrillpipe_inBase))/(2.*231) !1.5 galon for each BOP
endif
!==========================================================================
if (KillLineIsOpening .or. KillLineIsClosing) then
if (KillLine%IsOpening .or. KillLine%IsClosing) then
CALL KILL_LINE_SUB
end if
@@ -157,8 +157,8 @@ SUBROUTINE KILL_LINE_SUB
implicit none
FirstSet= 0
RamsFirstSet= 0
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
! loop6: do while (finished_KillLine==0)
@@ -167,7 +167,7 @@ SUBROUTINE KILL_LINE_SUB
if (BopControlPanel%KillLineValve == 1.0 .and. KillLineLeverOld == -1.0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. p_acc>acc_MinPressure) then
if (BopControlPanel%KillLineValve == 1.0 .and. KillLine%LeverOld == -1.0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
if ( RAM(6)%First_CloseTimecheck == 0 ) then
@@ -182,7 +182,7 @@ SUBROUTINE KILL_LINE_SUB

if ( RAM(6)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(6)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
@@ -190,26 +190,26 @@ SUBROUTINE KILL_LINE_SUB
KillLine_closed=0
RAM(6)%p_bop=pa
KillLineLeverOld = BopControlPanel%KillLineValve
KillLine%closed=0
RAM(6)%p_bop=ShearRam%PA
KillLine%LeverOld = BopControlPanel%KillLineValve
BopControlPanel%KillLineOpenLED = LedOff
KillLineOpenLedMine = LedOff
BopStackInput%KillLineOpenLedMine = LedOff
BopControlPanel%KillLineCloseLED = LedOn !LedBlinking
CALL OpenKillLine
RAM(6)%bop_type = 3
!AbopKillLine=196.67
AbopKillLine=(BopStackSpecification%KillClose*231)/((IDKillLineBase-ODDrillpipe_inKillLineBase)/2.)
NeededVolumeKillLine=AbopKillLine*(IDKillLine-max(ODDrillpipe_inKillLine,ODDrillpipe_inKillLineBase))/(2.*231)
KillLine%Abop=(BopStackSpecification%KillClose*231)/((KillLine%IDBase-KillLine%ODDrillpipe_inBase)/2.)
KillLine%NeededVolume=KillLine%Abop*(KillLine%ID-max(KillLine%ODDrillpipe_in,KillLine%ODDrillpipe_inBase))/(2.*231)
RAM(6)%vdis_bottles=0.
RAM(6)%fvr_air=0.
RAM(6)%vdis_elecp=0.
KillLineIsClosing = .true.
KillLineIsOpening = .false.
KillLine%IsClosing = .true.
KillLine%IsOpening = .false.
endif
if (BopControlPanel%KillLineValve == -1.0 .and. KillLineLeverOld == 1.0 .and. p_acc>acc_MinPressure .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%KillLineValve == -1.0 .and. KillLine%LeverOld == 1.0 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if ( RAM(6)%First_OpenTimecheck == 0 ) then
@@ -222,30 +222,30 @@ SUBROUTINE KILL_LINE_SUB
RAM(6)%SuccessionCounterOld= RAM(6)%SuccessionCounter
endif
if ( RAM(6)%SuccessionCounter < int(2.5/DeltaT_BOP) ) then
if ( RAM(6)%SuccessionCounter < int(2.5/RamLine%DeltaT_BOP) ) then
return
endif
endif
KillLine_closed=0
RAM(6)%p_bop=pa
KillLineLeverOld = BopControlPanel%KillLineValve
KillLine%closed=0
RAM(6)%p_bop=ShearRam%PA
KillLine%LeverOld = BopControlPanel%KillLineValve
BopControlPanel%KillLineCloseLED = LedOff
KillLineCloseLedMine = LedOff
BopStackInput%KillLineCloseLedMine = LedOff
BopControlPanel%KillLineOpenLED = LedOn !LedBlinking
CALL OpenKillLine
RAM(6)%bop_type = 3
!AbopKillLine=196.67
AbopKillLine=(BopStackSpecification%KillOpen*231)/((IDKillLineBase-ODDrillpipe_inKillLineBase)/2.)
NeededVolumeKillLine=AbopKillLine*(IDKillLineBase-IDKillLine)/(2.*231)
KillLine%Abop=(BopStackSpecification%KillOpen*231)/((KillLine%IDBase-KillLine%ODDrillpipe_inBase)/2.)
KillLine%NeededVolume=KillLine%Abop*(KillLine%IDBase-KillLine%ID)/(2.*231)
RAM(6)%vdis_bottles=0.
RAM(6)%fvr_air=0.
RAM(6)%vdis_elecp=0.

KillLineIsOpening = .true.
KillLineIsClosing = .false.
KillLine%IsOpening = .true.
KillLine%IsClosing = .false.
endif

@@ -253,21 +253,21 @@ SUBROUTINE KILL_LINE_SUB
RAM(6)%First_OpenTimecheck = 0
RAM(6)%time=RAM(6)%time+DeltaT_BOP !overal time (s)
RAM(6)%time=RAM(6)%time+RamLine%DeltaT_BOP !overal time (s)


!===================================================
! BOP
!===================================================
if (KillLine_closed==0) then !bop closing
call bop_code(5,H_KillLineBop,6) !ramtype=5 6=RNUMBER
if (KillLine%closed==0) then !bop closing
call bop_code(5,KillLine%H_Bop,6) !ramtype=5 6=RNUMBER
endif !bop is closing
!================================================================
if (KillLine_closed==1) then
if (KillLine%closed==1) then
RAM(6)%Q=0
!p_bop=pram_reg
RAM(6)%p_bop=pa
RAM(6)%p_bop=ShearRam%PA
RAMS%minloss(6,17)=0. !RNUMBER=6
endif

@@ -295,9 +295,9 @@ RAM(6)%timecounter_ram=RAM(6)%timecounter_ram+1
! call sleepqq(100)
if (KillLine_closed==1) then
if (KillLine%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. ChokeLineValve==1. .or. ChokeLineValve==-1.0) then
finished_KillLine=1
KillLine%finished=1
! endif
endif


+ 3
- 3
Equipments/BopStack/KillLineMain.f90 查看文件

@@ -20,10 +20,10 @@ module KillLineMain
subroutine KillLine_Step
use VARIABLES
implicit none
if (finished_KillLine/=0) then
if (KillLine%finished/=0) then
call KILL_LINE
if (KillLineIsOpening .or. KillLineIsClosing) then
if(finished_KillLine==0) then
if (KillLine%IsOpening .or. KillLine%IsClosing) then
if(KillLine%finished==0) then
call KILL_LINE_SUB !only body of loop2
endif
endif


+ 444
- 449
Equipments/BopStack/LOSS_INPUTS.f90
文件差異過大導致無法顯示
查看文件


+ 68
- 68
Equipments/BopStack/PIPE_RAM1.f90 查看文件

@@ -13,8 +13,8 @@ SUBROUTINE PIPE_RAMS1
! START CONDITIONS FOR PIPE RAMS 1
!=====================================================================
RAM(2)%SuccessionCounter = RAM(2)%SuccessionCounter + 1
if (BopControlPanel%UpperRamsValve == 1.0 .and. UpperRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (UpperRamsCloseLEDMine == LedOn) then
if (BopControlPanel%UpperRamsValve == 1.0 .and. PipeRam1%UpperRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopStackInput%UpperRamsCloseLEDMine == LedOn) then
RETURN
end if
if ( RAM(2)%SuccessionCounter /= RAM(2)%SuccessionCounterOld+1 ) then
@@ -28,13 +28,13 @@ SUBROUTINE PIPE_RAMS1

if ( RAM(2)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(2)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(2)%First_CloseTimecheck= 1
BopControlPanel%UpperRamsOpenLED = LedOff
UpperRamsOpenLEDMine = LedOff
BopStackInput%UpperRamsOpenLEDMine = LedOff
BopControlPanel%UpperRamsCloseLED = LedOn !LedBlinking
RAM(2)%FourwayValve = 1
@@ -43,42 +43,42 @@ SUBROUTINE PIPE_RAMS1
endif
if (RAM(2)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then ! 1: Open , 0: Close
if (RAM(2)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
!write(*,*) 'close 2'
RAM(2)%FourwayValve = 0


PipeRam1_closed=0
PipeRam1%closed=0
!PipeRam1_closed_withPossibility= PipeRam1_closed * TD_BOPConnectionPossibility(2)
RAM(2)%vdis_tot=0
RAM(2)%vdis_bottles=0.
RAM(2)%fvr_air=0.
RAM(2)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(2)%Qzero=70
RAM(2)%Q=RAM(2)%Qzero
RAM(2)%flow=70
RAM(2)%tol=0.0037
if (finished_pipe1==1) then
PipeRams1LeverOld=-1.0
if (PipeRam1%finished==1) then
PipeRam1%PipeRams1DotLeverOld=-1.0
else
PipeRams1LeverOld=BopControlPanel%UpperRamsValve
PipeRam1%PipeRams1DotLeverOld=BopControlPanel%UpperRamsValve
endif
finished_pipe1=0
PipeRam1IsClosing = .true.
PipeRam1IsOpening = .false.
PipeRam1%finished=0
PipeRam1%IsClosing = .true.
PipeRam1%IsOpening = .false.

RAM(2)%bop_type = 3
!AbopPipeRam=196.67
AbopPipeRam=(BopStackSpecification%UpperRamClose*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams1=AbopPipeRam*(IDPipeRamBase-max(ODDrillpipe_inPipeRam1,ODDrillpipe_inPipeRam1Base))/(2.*231) !3.67 galon for each BOP
PipeRam1%A=(BopStackSpecification%UpperRamClose*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam1%NeededVolume=PipeRam1%A*(PipeRam1%IDBase-max(PipeRam1%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase))/(2.*231) !3.67 galon for each BOP
endif
if (BopControlPanel%UpperRamsValve == -1.0 .and. UpperRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%UpperRamsValve == -1.0 .and. PipeRam1%UpperRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (UpperRamsOpenLEDMine == LedOn) then
if (BopStackInput%UpperRamsOpenLEDMine == LedOn) then
RETURN
end if

@@ -91,13 +91,13 @@ SUBROUTINE PIPE_RAMS1
endif
if ( RAM(2)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(2)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(2)%First_OpenTimecheck= 1
BopControlPanel%UpperRamsCloseLED = LedOff !new
UpperRamsCloseLedMine = LedOff !new
BopStackInput%UpperRamsCloseLEDMine = LedOff !new
BopControlPanel%UpperRamsOpenLED = LedOn !LedBlinking

RAM(2)%FourwayValve = 1
@@ -106,19 +106,19 @@ SUBROUTINE PIPE_RAMS1
endif
if (RAM(2)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then ! 1: Open , 0: Close
if (RAM(2)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
!write(*,*) 'open 2'
RAM(2)%FourwayValve = 0

PipeRam1_closed=0
PipeRam1%closed=0
!PipeRam1_closed_withPossibility= PipeRam1_closed * TD_BOPConnectionPossibility(2)
RAM(2)%vdis_tot=0
RAM(2)%vdis_bottles=0.
RAM(2)%fvr_air=0.
RAM(2)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(2)%Qzero=70
RAM(2)%Q=RAM(2)%Qzero
RAM(2)%flow=70
@@ -126,14 +126,14 @@ SUBROUTINE PIPE_RAMS1

if (finished_pipe1==1) then
PipeRams1LeverOld=1.0
if (PipeRam1%finished==1) then
PipeRam1%PipeRams1DotLeverOld=1.0
else
PipeRams1LeverOld=BopControlPanel%UpperRamsValve
PipeRam1%PipeRams1DotLeverOld=BopControlPanel%UpperRamsValve
endif
finished_pipe1=0
PipeRam1IsOpening = .true.
PipeRam1IsClosing = .false.
PipeRam1%finished=0
PipeRam1%IsOpening = .true.
PipeRam1%IsClosing = .false.

!if (UpperRamsOpenLED == LedOn) then
@@ -144,17 +144,17 @@ SUBROUTINE PIPE_RAMS1

RAM(2)%bop_type = 3
!AbopPipeRam=186.5
AbopPipeRam=(BopStackSpecification%UpperRamOpen*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams1=AbopPipeRam*(IDPipeRamBase-max(ODDrillpipe_inPipeRam1,ODDrillpipe_inPipeRam1Base))/(2.*231) !3.48 galon for each BOP
PipeRam1%A=(BopStackSpecification%UpperRamOpen*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam1%NeededVolume=PipeRam1%A*(PipeRam1%IDBase-max(PipeRam1%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase))/(2.*231) !3.48 galon for each BOP
endif
!=====================================================================
FirstSet= 0
RamsFirstSet= 0
if (PipeRam1IsOpening .or. PipeRam1IsClosing .or. RAM(2)%Bottles_Charged_MalfActive) then
FirstSet= 0
RamsFirstSet= 0
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
if (PipeRam1%IsOpening .or. PipeRam1%IsClosing .or. RAM(2)%Bottles_Charged_MalfActive) then
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
CALL PIPE_RAMS1_SUB
end if
@@ -190,7 +190,7 @@ SUBROUTINE PIPE_RAMS1_SUB
RAM(2)%SuccessionCounter = RAM(2)%SuccessionCounter + 1
if (BopControlPanel%UpperRamsValve == 1.0 .and. PipeRams1LeverOld == -1.0 .and. UpperRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%UpperRamsValve == 1.0 .and. PipeRam1%PipeRams1DotLeverOld == -1.0 .and. PipeRam1%UpperRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then

@@ -207,11 +207,11 @@ SUBROUTINE PIPE_RAMS1_SUB

if ( RAM(2)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(2)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
BopControlPanel%UpperRamsOpenLED = LedOff
UpperRamsOpenLEDMine = LedOff
BopStackInput%UpperRamsOpenLEDMine = LedOff
BopControlPanel%UpperRamsCloseLED = LedOn !LedBlinking
RAM(2)%FourwayValve = 1
@@ -222,35 +222,35 @@ SUBROUTINE PIPE_RAMS1_SUB
endif
if (RAM(2)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then
if (RAM(2)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
!write(*,*) 'close 4'
RAM(2)%FourwayValve = 0
PipeRam1_closed=0
PipeRam1%closed=0
!PipeRam1_closed_withPossibility= PipeRam1_closed * TD_BOPConnectionPossibility(2) ! for TD code
CALL OpenUpperRams ! for C code
PipeRam1_Situation_forTD= 0 ! open - for TD code
RAM(2)%p_bop=pa
PipeRams1LeverOld = BopControlPanel%UpperRamsValve
PipeRam1%Situation_forTD= 0 ! open - for TD code
RAM(2)%p_bop=ShearRam%PA
PipeRam1%PipeRams1DotLeverOld = BopControlPanel%UpperRamsValve

RAM(2)%bop_type = 3
!AbopPipeRam=196.67
AbopPipeRam=(BopStackSpecification%UpperRamClose*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
PipeRam1%A=(BopStackSpecification%UpperRamClose*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
!write(*,*) 'NeededVolumeShearRams1=',NeededVolumeShearRams
NeededVolumePipeRams1=AbopPipeRam*(IDPipeRam1-max(ODDrillpipe_inPipeRam1,ODDrillpipe_inPipeRam1Base))/(2.*231)
PipeRam1%NeededVolume=PipeRam1%A*(PipeRam1%ID-max(PipeRam1%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase))/(2.*231)
! write(*,*) 'NeededVolumeShearRams2=',NeededVolumeShearRams
RAM(2)%vdis_bottles=0.
RAM(2)%fvr_air=0.
RAM(2)%vdis_elecp=0.
PipeRam1IsClosing = .true.
PipeRam1IsOpening = .false.
PipeRam1%IsClosing = .true.
PipeRam1%IsOpening = .false.
endif
if (BopControlPanel%UpperRamsValve == -1.0 .and. PipeRams1LeverOld == 1.0 .and. UpperRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%UpperRamsValve == -1.0 .and. PipeRam1%PipeRams1DotLeverOld == 1.0 .and. PipeRam1%UpperRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if ( RAM(2)%First_OpenTimecheck == 0 ) then
@@ -263,11 +263,11 @@ SUBROUTINE PIPE_RAMS1_SUB
RAM(2)%SuccessionCounterOld= RAM(2)%SuccessionCounter
endif
if ( RAM(2)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(2)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
BopControlPanel%UpperRamsCloseLED = LedOff
UpperRamsCloseLEDMine = LedOff
BopStackInput%UpperRamsCloseLEDMine = LedOff
BopControlPanel%UpperRamsOpenLED = LedOn !LedBlinking
RAM(2)%FourwayValve = 1
@@ -279,30 +279,30 @@ SUBROUTINE PIPE_RAMS1_SUB
endif
if (RAM(2)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then
if (RAM(2)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
!write(*,*) 'open 4'
RAM(2)%FourwayValve = 0
PipeRam1_closed=0
PipeRam1%closed=0
!PipeRam1_closed_withPossibility= PipeRam1_closed * TD_BOPConnectionPossibility(2)
CALL OpenUpperRams
PipeRam1_Situation_forTD= 0 ! open - for TD code
RAM(2)%p_bop=pa
PipeRams1LeverOld = BopControlPanel%UpperRamsValve
PipeRam1%Situation_forTD= 0 ! open - for TD code
RAM(2)%p_bop=ShearRam%PA
PipeRam1%PipeRams1DotLeverOld = BopControlPanel%UpperRamsValve

RAM(2)%bop_type = 3
!AbopPipeRam=186.5
AbopPipeRam=(BopStackSpecification%UpperRamOpen*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams1=AbopPipeRam*(IDPipeRamBase-IDPipeRam1)/(2.*231)
PipeRam1%A=(BopStackSpecification%UpperRamOpen*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam1%NeededVolume=PipeRam1%A*(PipeRam1%IDBase-PipeRam1%ID)/(2.*231)
RAM(2)%vdis_bottles=0.
RAM(2)%fvr_air=0.
RAM(2)%vdis_elecp=0.

PipeRam1IsOpening = .true.
PipeRam1IsClosing = .false.
PipeRam1%IsOpening = .true.
PipeRam1%IsClosing = .false.
endif

@@ -310,21 +310,21 @@ SUBROUTINE PIPE_RAMS1_SUB
RAM(2)%First_OpenTimecheck = 0
RAM(2)%time=RAM(2)%time+DeltaT_BOP !overal time (s)
RAM(2)%time=RAM(2)%time+RamLine%DeltaT_BOP !overal time (s)


!===================================================
! BOP
!===================================================
if (PipeRam1_closed==0) then !bop closing
call bop_code(2,H_PipeRam1Bop,2) !ramtype=2 2=RNUMBER
if (PipeRam1%closed==0) then !bop closing
call bop_code(2,PipeRam1%H,2) !ramtype=2 2=RNUMBER
endif !bop is closing
!================================================================
if (PipeRam1_closed==1) then
if (PipeRam1%closed==1) then
RAM(2)%Q=0
!p_bop=pram_reg
RAM(2)%p_bop=pa
RAM(2)%p_bop=ShearRam%PA
RAMS%minloss(2,17)=0. !RNUMBER=2
endif

@@ -352,9 +352,9 @@ RAM(2)%timecounter_ram=RAM(2)%timecounter_ram+1
! call sleepqq(100)
if (PipeRam1_closed==1) then
if (PipeRam1%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. (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
finished_pipe1=1
PipeRam1%finished=1
! endif
endif
@@ -367,8 +367,8 @@ endif
if ( finished_pipe1==1 .and. RAM(2)%Bottles_Charged_MalfActive==.true.) then
call bop_code(2,H_PipeRam1Bop,2) !ramtype=2 2=RNUMBER
if ( PipeRam1%finished==1 .and. RAM(2)%Bottles_Charged_MalfActive==.true.) then
call bop_code(2,PipeRam1%H,2) !ramtype=2 2=RNUMBER
! call sleepqq(100)
endif


+ 66
- 66
Equipments/BopStack/PIPE_RAM2.f90 查看文件

@@ -18,11 +18,11 @@ SUBROUTINE PIPE_RAMS2
RAM(3)%SuccessionCounter = RAM(3)%SuccessionCounter + 1
if (BopControlPanel%LowerRamsValve == 1.0 .and. LowerRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%LowerRamsValve == 1.0 .and. PipeRam2%LowerRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
!write(*,*) 'close 1'
if (LowerRamsCloseLEDMine == LedOn) then
if (BopStackInput%LowerRamsCloseLEDMine == LedOn) then
RETURN
end if
@@ -36,13 +36,13 @@ SUBROUTINE PIPE_RAMS2
endif
if ( RAM(3)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(3)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(3)%First_CloseTimecheck= 1
BopControlPanel%LowerRamsOpenLED = LedOff
LowerRamsOpenLEDMine = LedOff
BopStackInput%LowerRamsOpenLEDMine = LedOff
BopControlPanel%LowerRamsCloseLED = LedOn !LedBlinking
RAM(3)%FourwayValve = 1
@@ -54,45 +54,45 @@ SUBROUTINE PIPE_RAMS2
if (RAM(3)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then ! 1: Open , 0: Close
if (RAM(3)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
!write(*,*) 'close 2'
RAM(3)%FourwayValve = 0
PipeRam2_closed=0
PipeRam2%closed=0
!PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
RAM(3)%vdis_tot=0
RAM(3)%vdis_bottles=0.
RAM(3)%fvr_air=0.
RAM(3)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(3)%Qzero=70
RAM(3)%Q=RAM(3)%Qzero
RAM(3)%flow=70
RAM(3)%tol=0.0037
if (finished_pipe2==1) then
PipeRams2LeverOld=-1.0
if (PipeRam2%finished==1) then
PipeRam2%LeverOld=-1.0
else
PipeRams2LeverOld=BopControlPanel%LowerRamsValve
PipeRam2%LeverOld=BopControlPanel%LowerRamsValve
endif
finished_pipe2=0
PipeRam2IsClosing = .true.
PipeRam2IsOpening = .false.
PipeRam2%finished=0
PipeRam2%IsClosing = .true.
PipeRam2%IsOpening = .false.

RAM(3)%bop_type = 3
!AbopPipeRam=196.67
AbopPipeRam=(BopStackSpecification%LowerRamClose*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams2=AbopPipeRam*(IDPipeRamBase-max(ODDrillpipe_inPipeRam2,ODDrillpipe_inPipeRam1Base))/(2.*231) !galon for each BOP
PipeRam1%A=(BopStackSpecification%LowerRamClose*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam2%NeededVolume=PipeRam1%A*(PipeRam1%IDBase-max(PipeRam2%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase))/(2.*231) !galon for each BOP
!write(*,*) 'close 1'
endif
if (BopControlPanel%LowerRamsValve == -1.0 .and. LowerRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%LowerRamsValve == -1.0 .and. PipeRam2%LowerRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
!write(*,*) 'open 1'
if (LowerRamsOpenLEDMine == LedOn) then
if (BopStackInput%LowerRamsOpenLEDMine == LedOn) then
RETURN
end if
@@ -106,13 +106,13 @@ SUBROUTINE PIPE_RAMS2
endif
if ( RAM(3)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(3)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(3)%First_OpenTimecheck= 1
BopControlPanel%LowerRamsCloseLED = LedOff !new
LowerRamsCloseLedMine = LedOff !new
BopStackInput%LowerRamsCloseLEDMine = LedOff !new
BopControlPanel%LowerRamsOpenLED = LedOn !LedBlinking
RAM(3)%FourwayValve = 1
@@ -123,31 +123,31 @@ SUBROUTINE PIPE_RAMS2
endif
if (RAM(3)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then ! 1: Open , 0: Close
if (RAM(3)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
!write(*,*) 'open 2'
RAM(3)%FourwayValve = 0
PipeRam2_closed=0
PipeRam2%closed=0
!PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
RAM(3)%vdis_tot=0
RAM(3)%vdis_bottles=0.
RAM(3)%fvr_air=0.
RAM(3)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(3)%Qzero=70
RAM(3)%Q=RAM(3)%Qzero
RAM(3)%flow=70
RAM(3)%tol=0.0037

if (finished_pipe2==1) then
PipeRams2LeverOld=1.0
if (PipeRam2%finished==1) then
PipeRam2%LeverOld=1.0
else
PipeRams2LeverOld=BopControlPanel%LowerRamsValve
PipeRam2%LeverOld=BopControlPanel%LowerRamsValve
endif
finished_pipe2=0
PipeRam2IsOpening = .true.
PipeRam2IsClosing = .false.
PipeRam2%finished=0
PipeRam2%IsOpening = .true.
PipeRam2%IsClosing = .false.

!if (LowerRamsOpenLED == LedOn) then
@@ -157,8 +157,8 @@ SUBROUTINE PIPE_RAMS2

RAM(3)%bop_type = 3
!AbopPipeRam=186.5
AbopPipeRam=(BopStackSpecification%LowerRamOpen*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams2=AbopPipeRam*(IDPipeRamBase-max(ODDrillpipe_inPipeRam2,ODDrillpipe_inPipeRam1Base))/(2.*231) !galon for each BOP
PipeRam1%A=(BopStackSpecification%LowerRamOpen*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam2%NeededVolume=PipeRam1%A*(PipeRam1%IDBase-max(PipeRam2%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase))/(2.*231) !galon for each BOP
!write(*,*) 'open 1'
endif
@@ -166,9 +166,9 @@ SUBROUTINE PIPE_RAMS2
!=====================================================================

if (PipeRam2IsOpening .or. PipeRam2IsClosing .or. RAM(3)%Bottles_Charged_MalfActive) then
FirstSet= 0
RamsFirstSet= 0
if (PipeRam2%IsOpening .or. PipeRam2%IsClosing .or. RAM(3)%Bottles_Charged_MalfActive) then
Annular%FirstSet= 0
AnnularComputational%RamsFirstSet= 0
CALL PIPE_RAMS2_SUB
end if

@@ -206,7 +206,7 @@ SUBROUTINE PIPE_RAMS2_SUB
RAM(3)%SuccessionCounter = RAM(3)%SuccessionCounter + 1
if (BopControlPanel%LowerRamsValve == 1.0 .and. PipeRams2LeverOld == -1.0 .and. LowerRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%LowerRamsValve == 1.0 .and. PipeRam2%LeverOld == -1.0 .and. PipeRam2%LowerRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
!write(*,*) 'close 3'
@@ -223,11 +223,11 @@ SUBROUTINE PIPE_RAMS2_SUB

if ( RAM(3)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(3)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
BopControlPanel%LowerRamsOpenLED = LedOff
LowerRamsOpenLEDMine = LedOff
BopStackInput%LowerRamsOpenLEDMine = LedOff
BopControlPanel%LowerRamsCloseLED = LedOn !LedBlinking
RAM(3)%FourwayValve = 1
@@ -241,34 +241,34 @@ SUBROUTINE PIPE_RAMS2_SUB
endif
if (RAM(3)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then
if (RAM(3)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
!write(*,*) 'close 4'
RAM(3)%FourwayValve = 0

PipeRam2_closed=0
PipeRam2%closed=0
!PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
RAM(3)%p_bop=pa
PipeRams2LeverOld = BopControlPanel%LowerRamsValve
RAM(3)%p_bop=ShearRam%PA
PipeRam2%LeverOld = BopControlPanel%LowerRamsValve

CALL OpenLowerRams
PipeRam2_Situation_forTD= 0 ! open - for TD code
PipeRam2%Situation_forTD= 0 ! open - for TD code
RAM(3)%bop_type = 3
!AbopPipeRam=196.67
AbopPipeRam=(BopStackSpecification%LowerRamClose*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams2=AbopPipeRam*(IDPipeRam2-max(ODDrillpipe_inPipeRam2,ODDrillpipe_inPipeRam1Base))/(2.*231)
PipeRam1%A=(BopStackSpecification%LowerRamClose*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam2%NeededVolume=PipeRam1%A*(PipeRam2%ID-max(PipeRam2%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase))/(2.*231)
RAM(3)%vdis_bottles=0.
RAM(3)%fvr_air=0.
RAM(3)%vdis_elecp=0.
PipeRam2IsClosing = .true.
PipeRam2IsOpening = .false.
PipeRam2%IsClosing = .true.
PipeRam2%IsOpening = .false.
!write(*,*) 'close 2'
endif
if (BopControlPanel%LowerRamsValve == -1.0 .and. PipeRams2LeverOld == 1.0 .and. LowerRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%LowerRamsValve == -1.0 .and. PipeRam2%LeverOld == 1.0 .and. PipeRam2%LowerRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
!write(*,*) 'open 3'
@@ -282,11 +282,11 @@ SUBROUTINE PIPE_RAMS2_SUB
RAM(3)%SuccessionCounterOld= RAM(3)%SuccessionCounter
endif
if ( RAM(3)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(3)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
BopControlPanel%LowerRamsCloseLED = LedOff
LowerRamsCloseLEDMine = LedOff
BopStackInput%LowerRamsCloseLEDMine = LedOff
BopControlPanel%LowerRamsOpenLED = LedOn !LedBlinking
RAM(3)%FourwayValve = 1
@@ -299,28 +299,28 @@ SUBROUTINE PIPE_RAMS2_SUB
endif
if (RAM(3)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then
if (RAM(3)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
!write(*,*) 'open 4'
RAM(3)%FourwayValve = 0
PipeRam2_closed=0
PipeRam2%closed=0
!PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
RAM(3)%p_bop=pa
PipeRams2LeverOld = BopControlPanel%LowerRamsValve
RAM(3)%p_bop=ShearRam%PA
PipeRam2%LeverOld = BopControlPanel%LowerRamsValve

CALL OpenLowerRams
PipeRam2_Situation_forTD= 0 ! open - for TD code
PipeRam2%Situation_forTD= 0 ! open - for TD code
RAM(3)%bop_type = 3
!AbopPipeRam=186.5
AbopPipeRam=(BopStackSpecification%LowerRamOpen*231)/((IDPipeRamBase-ODDrillpipe_inPipeRam1Base)/2.)
NeededVolumePipeRams2=AbopPipeRam*(IDPipeRamBase-IDPipeRam2)/(2.*231)
PipeRam1%A=(BopStackSpecification%LowerRamOpen*231)/((PipeRam1%IDBase-PipeRam1%ODDrillpipe_inBase)/2.)
PipeRam2%NeededVolume=PipeRam1%A*(PipeRam1%IDBase-PipeRam2%ID)/(2.*231)
RAM(3)%vdis_bottles=0.
RAM(3)%fvr_air=0.
RAM(3)%vdis_elecp=0.

PipeRam2IsOpening = .true.
PipeRam2IsClosing = .false.
PipeRam2%IsOpening = .true.
PipeRam2%IsClosing = .false.
!write(*,*) 'open 2'
endif
@@ -330,22 +330,22 @@ SUBROUTINE PIPE_RAMS2_SUB
RAM(3)%First_OpenTimecheck = 0
RAM(3)%time=RAM(3)%time+DeltaT_BOP !overal time (s)
RAM(3)%time=RAM(3)%time+RamLine%DeltaT_BOP !overal time (s)


!===================================================
! BOP
!===================================================
if (PipeRam2_closed==0) then !bop closing
if (PipeRam2%closed==0) then !bop closing
!write(*,*) 'BOP code is called'
call bop_code(3,H_PipeRam2Bop,3) !ramtype=3 3=RNUMBER
call bop_code(3,PipeRam2%H_Bop,3) !ramtype=3 3=RNUMBER
endif !bop is closing
!================================================================
if (PipeRam2_closed==1) then
if (PipeRam2%closed==1) then
RAM(3)%Q=0
!p_bop=pram_reg
RAM(3)%p_bop=pa
RAM(3)%p_bop=ShearRam%PA
RAMS%minloss(3,17)=0. !RNUMBER=3
endif

@@ -373,10 +373,10 @@ RAM(3)%timecounter_ram=RAM(3)%timecounter_ram+1
! call sleepqq(100)
if (PipeRam2_closed==1) then
if (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
finished_pipe2=1
PipeRam2%finished=1
! endif
endif
@@ -385,8 +385,8 @@ endif
! end do loop4 !while finished_pipe2==0
if ( finished_pipe2==1 .and. RAM(3)%Bottles_Charged_MalfActive==.true.) then
call bop_code(3,H_PipeRam2Bop,3) !ramtype=3 3=RNUMBER
if ( PipeRam2%finished==1 .and. RAM(3)%Bottles_Charged_MalfActive==.true.) then
call bop_code(3,PipeRam2%H_Bop,3) !ramtype=3 3=RNUMBER
! call sleepqq(100)
endif


+ 3
- 3
Equipments/BopStack/PipeRams1Main.f90 查看文件

@@ -20,10 +20,10 @@ module PipeRams1Main
subroutine PipeRams1_Step
use VARIABLES
implicit none
if (finished_pipe1/=0) then
if (PipeRam1%finished/=0) then
call PIPE_RAMS1
if (PipeRam1IsOpening .or. PipeRam1IsClosing .or. RAM(2)%Bottles_Charged_MalfActive) then
if(finished_pipe1==0) then
if (PipeRam1%IsOpening .or. PipeRam1%IsClosing .or. RAM(2)%Bottles_Charged_MalfActive) then
if(PipeRam1%finished==0) then
call PIPE_RAMS1_SUB !only body of loop2
endif
endif


+ 3
- 3
Equipments/BopStack/PipeRams2Main.f90 查看文件

@@ -21,10 +21,10 @@
subroutine PipeRams2_Step
use VARIABLES
implicit none
if (finished_pipe2/=0) then
if (PipeRam2%finished/=0) then
call PIPE_RAMS2
if (PipeRam2IsOpening .or. PipeRam2IsClosing .or. RAM(3)%Bottles_Charged_MalfActive) then
if(finished_pipe2==0) then
if (PipeRam2%IsOpening .or. PipeRam2%IsClosing .or. RAM(3)%Bottles_Charged_MalfActive) then
if(PipeRam2%finished==0) then
call PIPE_RAMS2_SUB !only body of loop2
endif
endif


+ 62
- 62
Equipments/BopStack/SHEAR_RAM.f90 查看文件

@@ -16,9 +16,9 @@ SUBROUTINE SHEAR_RAMS
RAM(4)%SuccessionCounter = RAM(4)%SuccessionCounter + 1
if (BopControlPanel%MiddleRamsValve == 1.0 .and. MiddleRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%MiddleRamsValve == 1.0 .and. ShearRam%MiddleRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (MiddleRamsCloseLEDMine == LedOn) then
if (BopStackInput%MiddleRamsCloseLEDMine == LedOn) then
RETURN
end if
@@ -32,13 +32,13 @@ SUBROUTINE SHEAR_RAMS
endif
if ( RAM(4)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(4)%First_CloseTimecheck= 1
BopControlPanel%MiddleRamsOpenLED = LedOff
MiddleRamsOpenLEDMine = LedOff
BopStackInput%MiddleRamsOpenLEDMine = LedOff
BopControlPanel%MiddleRamsCloseLED = LedOn !LedBlinking
RAM(4)%FourwayValve = 1
@@ -48,46 +48,46 @@ SUBROUTINE SHEAR_RAMS
endif
if (RAM(4)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then ! 1: Open , 0: Close
if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
!write(*,*) 'close 2'
RAM(4)%FourwayValve = 0

ShearBop_closed=0
RamLine%ShearBop_closed=0
!ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
RAM(4)%vdis_tot=0
RAM(4)%vdis_bottles=0.
RAM(4)%fvr_air=0.
RAM(4)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(4)%Qzero=70
RAM(4)%Q=RAM(4)%Qzero
RAM(4)%flow=70
RAM(4)%tol=0.0037
if (finished_shear==1) then
ShearRamsLeverOld=-1.0
if (RamLine%FINISHED_shear==1) then
RamLine%ShearRamsLeverOld=-1.0
else
ShearRamsLeverOld=BopControlPanel%MiddleRamsValve
RamLine%ShearRamsLeverOld=BopControlPanel%MiddleRamsValve
endif
finished_shear=0
ShearRamIsClosing = .true.
ShearRamIsOpening = .false.
RamLine%FINISHED_shear=0
RamLine%ShearRamIsClosing = .true.
RamLine%ShearRamIsOpening = .false.

RAM(4)%bop_type = 2
!NeededVolumeShearRams=5.8 !galon for each BOP
!AbopShearRam=196.67 !(in^2)
AbopShearRam=(BopStackSpecification%BlindRamClose*231)/(IDshearBopBase/2.)
ShearRam%AbopShearRam=(BopStackSpecification%BlindRamClose*231)/(ShearRam%IDshearBopBase/2.)
!NeededVolumeShearRams=BlindRamClose !galon for each BOP **changed
NeededVolumeShearRams=AbopShearRam*(IDshearBopBase-ShearIsNotAllowed*ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
va=AbopShearRam*(IDshearBopBase-ODDrillpipe_inShearRam)/(2.*231)
vb=NeededVolumeShearRams
ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
ShearRam%VA=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%ODDrillpipe_inShearRam)/(2.*231)
ShearRam%VB=ShearRam%NeededVolumeShearRams
endif
if (BopControlPanel%MiddleRamsValve == -1.0 .and. MiddleRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (BopControlPanel%MiddleRamsValve == -1.0 .and. ShearRam%MiddleRamsFailureMalf==0 .and. BopStackAcc%RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1) then
if (MiddleRamsOpenLEDMine == LedOn) then
if (BopStackInput%MiddleRamsOpenLEDMine == LedOn) then
RETURN
end if
@@ -100,13 +100,13 @@ SUBROUTINE SHEAR_RAMS
endif
if ( RAM(4)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
!return
RAM(4)%First_OpenTimecheck= 1
BopControlPanel%MiddleRamsCloseLED = LedOff !new
MiddleRamsCloseLedMine = LedOff !new
BopStackInput%MiddleRamsCloseLEDMine = LedOff !new
BopControlPanel%MiddleRamsOpenLED = LedOn !LedBlinking
endif
@@ -114,40 +114,40 @@ SUBROUTINE SHEAR_RAMS
endif
if (RAM(4)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then ! 1: Open , 0: Close
if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then ! 1: Open , 0: Close
!write(*,*) 'open 2'
RAM(4)%FourwayValve = 0

ShearBop_closed=0
RamLine%ShearBop_closed=0
!ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
RAM(4)%vdis_tot=0
RAM(4)%vdis_bottles=0.
RAM(4)%fvr_air=0.
RAM(4)%vdis_elecp=0.
Qiter=7
Pumps%Qiter=7
RAM(4)%Qzero=70
RAM(4)%Q=RAM(4)%Qzero
RAM(4)%flow=70
RAM(4)%tol=0.0037

if (finished_shear==1) then
ShearRamsLeverOld=1.0
if (RamLine%FINISHED_shear==1) then
RamLine%ShearRamsLeverOld=1.0
else
ShearRamsLeverOld=BopControlPanel%MiddleRamsValve
RamLine%ShearRamsLeverOld=BopControlPanel%MiddleRamsValve
endif
finished_shear=0
ShearRamIsOpening = .true.
ShearRamIsClosing = .false.
RamLine%FINISHED_shear=0
RamLine%ShearRamIsOpening = .true.
RamLine%ShearRamIsClosing = .false.

RAM(4)%bop_type = 3
!AbopShearRam=186.5 !(in^2)
AbopShearRam=(BopStackSpecification%BlindRamOpen*231)/(IDshearBopBase/2.)
ShearRam%AbopShearRam=(BopStackSpecification%BlindRamOpen*231)/(ShearRam%IDshearBopBase/2.)
!NeededVolumeShearRams=5.5 !galon for each BOP
!NeededVolumeShearRams=BlindRamOpen ! **changed
NeededVolumeShearRams=AbopShearRam*(IDshearBopBase-ShearIsNotAllowed*ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam)/(2.*231) !3.67 galon for each BOP ! **changed
!va=AbopShearRam*(IDshearBopBase-ODDrillpipe_inShearRam)/(2.*231)
!vb=NeededVolumeShearRams
endif
@@ -175,39 +175,39 @@ SUBROUTINE SHEAR_RAMS_SUB

! loop2: do while (finished_shear==0)
RAM(4)%SuccessionCounter = RAM(4)%SuccessionCounter + 1
if (BopControlPanel%MiddleRamsValve == 1.0 .and. ShearRamsLeverOld == -1.0 .and. MiddleRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RAM(4)%First_CloseTimecheck == 0) then
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
if ( RAM(4)%SuccessionCounter /= RAM(4)%SuccessionCounterOld+1 ) then
RAM(4)%SuccessionCounter = 0 ! also in starup
RAM(4)%SuccessionCounterOld = 0 ! also in starup
else
RAM(4)%SuccessionCounterOld= RAM(4)%SuccessionCounter
endif
if ( RAM(4)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
BopControlPanel%MiddleRamsOpenLED = LedOff
MiddleRamsOpenLEDMine = LedOff
BopStackInput%MiddleRamsOpenLEDMine = LedOff
BopControlPanel%MiddleRamsCloseLED = LedOn !LedBlinking
RAM(4)%FourwayValve = 1
endif
endif
if (RAM(4)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then
if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
RAM(4)%FourwayValve = 0
ShearBop_closed=0
RAM(4)%p_bop=pa
ShearRamsLeverOld = BopControlPanel%MiddleRamsValve
RamLine%ShearBop_closed=0
RAM(4)%p_bop=ShearRam%PA
RamLine%ShearRamsLeverOld = BopControlPanel%MiddleRamsValve
CALL OpenMiddleRams ! for C code
ShearBop_Situation_forTD= 0 ! open - for TD code
RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
RAM(4)%bop_type = 2
AbopShearRam=(BopStackSpecification%BlindRamClose*231)/(IDshearBopBase/2.)
NeededVolumeShearRams=AbopShearRam*(IDshearBop-ShearIsNotAllowed*ODDrillpipe_inShearRam)/(2.*231) ! **changed
ShearRam%AbopShearRam=(BopStackSpecification%BlindRamClose*231)/(ShearRam%IDshearBopBase/2.)
ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBop-ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam)/(2.*231) ! **changed
RAM(4)%vdis_bottles=0.
RAM(4)%fvr_air=0.
RAM(4)%vdis_elecp=0.
ShearRamIsClosing = .true.
ShearRamIsOpening = .false.
RamLine%ShearRamIsClosing = .true.
RamLine%ShearRamIsOpening = .false.
endif

if (BopControlPanel%MiddleRamsValve == -1.0 .and. ShearRamsLeverOld == 1.0 .and. MiddleRamsFailureMalf==0 .and. RigAirMalf==0 .and. BopControlPanel%AirMasterValve==1 .and. RAM(4)%First_OpenTimecheck == 0) then
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
if ( RAM(4)%SuccessionCounter /= RAM(4)%SuccessionCounterOld+1 ) then
RAM(4)%SuccessionCounter = 0 ! also in starup
RAM(4)%SuccessionCounterOld = 0 ! also in starup
@@ -216,52 +216,52 @@ SUBROUTINE SHEAR_RAMS_SUB
RAM(4)%SuccessionCounterOld= RAM(4)%SuccessionCounter
endif

if ( RAM(4)%SuccessionCounter >= int(2.5/DeltaT_BOP) ) then
if ( RAM(4)%SuccessionCounter >= int(2.5/RamLine%DeltaT_BOP) ) then
BopControlPanel%MiddleRamsCloseLED = LedOff
MiddleRamsCloseLEDMine = LedOff
BopStackInput%MiddleRamsCloseLEDMine = LedOff
BopControlPanel%MiddleRamsOpenLED = LedOn !LedBlinking
RAM(4)%FourwayValve = 1
endif
endif

if (RAM(4)%FourwayValve == 1 .and. p_acc>acc_MinPressure) then
if (RAM(4)%FourwayValve == 1 .and. RamLine%P_ACC>BopStackAcc%acc_MinPressure) then
RAM(4)%FourwayValve = 0
ShearBop_closed=0
RAM(4)%p_bop=pa
ShearRamsLeverOld = BopControlPanel%MiddleRamsValve
RamLine%ShearBop_closed=0
RAM(4)%p_bop=ShearRam%PA
RamLine%ShearRamsLeverOld = BopControlPanel%MiddleRamsValve
CALL OpenMiddleRams
ShearBop_Situation_forTD= 0 ! open - for TD code
RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
RAM(4)%bop_type = 3
NeededVolumeShearRams=AbopShearRam*(IDshearBopBase-IDshearBop)/(2.*231)
ShearRam%NeededVolumeShearRams=ShearRam%AbopShearRam*(ShearRam%IDshearBopBase-ShearRam%IDshearBop)/(2.*231)
RAM(4)%vdis_bottles=0.
RAM(4)%fvr_air=0.
RAM(4)%vdis_elecp=0.
ShearRamIsOpening = .true.
ShearRamIsClosing = .false.
RamLine%ShearRamIsOpening = .true.
RamLine%ShearRamIsClosing = .false.
endif

RAM(4)%First_CloseTimecheck = 0
RAM(4)%First_OpenTimecheck = 0
RAM(4)%time=RAM(4)%time+DeltaT_BOP !overal time (s)
RAM(4)%time=RAM(4)%time+RamLine%DeltaT_BOP !overal time (s)

!===================================================
! BOP
!===================================================
if (ShearBop_closed==0) then !bop closing
call bop_code(1,H_ShearRamBop,4) !ramtype=1 4=RNUMBER
if (RamLine%ShearBop_closed==0) then !bop closing
call bop_code(1,ShearRam%H_ShearRamBop,4) !ramtype=1 4=RNUMBER
endif !bop is closing
!================================================================
if (ShearBop_closed==1) then
if (RamLine%ShearBop_closed==1) then
RAM(4)%Q=0
RAM(4)%p_bop=pa
RAM(4)%p_bop=ShearRam%PA
RAMS%minloss(4,17)=0. !RNUMBER=4
endif

RAM(4)%timecounter_ram=RAM(4)%timecounter_ram+1
call sleepqq(100)

if (ShearBop_closed==1) then
finished_shear=1
if (RamLine%ShearBop_closed==1) then
RamLine%FINISHED_shear=1
endif
! if (IsStopped == .true.) return
! end do loop2 !while finished_shear==0


+ 121
- 98
Equipments/BopStack/VARIABLES.f90 查看文件

@@ -8,124 +8,146 @@ MODULE VARIABLES
!===========================================================================
! INPUT VARIABLES
!===========================================================================
REAL,ALLOCATABLE:: MINORS1(:,:),PIPINGS_RAMLINE(:,:),MINORS_ANNULAR(:,:),PIPINGS_ANNULAR(:,:),PIPINGS_AIRPUMP(:,:),MINORS_AIRPUMP(:,:)

integer AnnularOpenLedMine,AnnularCloseLedMine,UpperRamsCloseLEDMine,UpperRamsOpenLEDMine,LowerRamsOpenLEDMine,LowerRamsCloseLEDMine
integer MiddleRamsOpenLEDMine,MiddleRamsCloseLEDMine,KillLineOpenLedMine,KillLineCloseLedMine,ChokeLineOpenLEDMine,ChokeLineCloseLEDMine
integer BOP_timeCounter
type :: BopStackInputType
REAL,ALLOCATABLE:: MINORS1(:,:),PIPINGS_RAMLINE(:,:),MINORS_ANNULAR(:,:),PIPINGS_ANNULAR(:,:),PIPINGS_AIRPUMP(:,:),MINORS_AIRPUMP(:,:)
integer AnnularOpenLedMine,AnnularCloseLedMine,UpperRamsCloseLEDMine,UpperRamsOpenLEDMine,LowerRamsOpenLEDMine,LowerRamsCloseLEDMine
integer MiddleRamsOpenLEDMine,MiddleRamsCloseLEDMine,KillLineOpenLedMine,KillLineCloseLedMine,ChokeLineOpenLEDMine,ChokeLineCloseLEDMine
integer BOP_timeCounter
end type BopStackInputType
type(BopStackInputType)::BopStackInput
!===========================================================================
! ACC. VARIABLES
!===========================================================================
REAL,PARAMETER :: PI=3.141593 ,PressureDifferenceSteps = 20. ,BaseDifferenceP= 200. ! psi
REAL FVR_TOT,BOTTLE_CAPACITY,PRAMS_REGSET,acc_ChargedPressure,acc_MinPressure,ACC_PRECHARGE,ByPassOld
REAL pram_reg,test1,test2,test3,test4,test5,test6,test7,test8,test9,ax,bx
integer NOBOTTLES,AccPupmsFailMalf,AirSupplyPressureGaugeMalf,ManifoldPressureGaugeMalf,AccumulatorPressureGaugeMalf,RigAirMalf
real Cumulative_AirVolume, PressureDifference
integer SoundKoomeyAirPump
type::BopStackAccType
REAL FVR_TOT,BOTTLE_CAPACITY,PRAMS_REGSET,acc_ChargedPressure,acc_MinPressure,ACC_PRECHARGE,ByPassOld
REAL pram_reg,test1,test2,test3,test4,test5,test6,test7,test8,test9,ax,bx
integer NOBOTTLES,AccPupmsFailMalf,AirSupplyPressureGaugeMalf,ManifoldPressureGaugeMalf,AccumulatorPressureGaugeMalf,RigAirMalf
real Cumulative_AirVolume, PressureDifference
integer SoundKoomeyAirPump
end type BopStackAccType
type(BopStackAccType)::BopStackAcc
!===========================================================================

! RAM LINE COMPUTATIONAL VARIABLES
!===========================================================================
logical ShearRamIsClosing,ShearRamIsOpening
REAL ShearRamsLeverOld,NoActiveRmas
!REAL checkp,p_acccheck
REAL P_ACC,FVR,DeltaT_BOP
REAL diffp_air,losses_air,Qup,kinetic_air,pipe_loss1air,minor_loss1air,static_loss1air!,pipe_loss1_before,minor_loss1,static_loss1,kinetic_loss1,pipe_loss1
!REAL loss_before,pipe_loss2,minor_loss2,deltah,static_loss2,kinetic_loss2,loss_after
integer AIRP_SWITCH,ELECP_SWITCH,ShearBop_closed,FINISHED_shear,EOF,NO_MINORSRAMLINE,NO_PIPINGSRAMLINE,NO_PIPINGS_AIRPLINE,NO_MINORS_AIRPLINE
integer counter,iteration,ShearBop_Situation_forTD
real BA1,BA2,BA3,BA4,BBA1,BBA2,BBA3,BBA4
REAL B1,B2,B3,B4
REAL,ALLOCATABLE:: Re_air(:),DIAM_AIR_MM(:),DIAM_AIR_INCH(:),AREA_AIR(:),REL_ROUGHAIR(:),LENGT_AIR(:),LF_AIR(:),CV_AIR(:),NOTE_AIR(:)
REAL,ALLOCATABLE:: fric_air(:),fricloss_air(:),minlosspa_air(:),minloss_air(:)
REAL,ALLOCATABLE:: MINORDIAM_AIR_INCH(:),MINORAREA_AIR(:)
REAL,ALLOCATABLE:: DIAM_RAMLINE_INCH(:),DIAM_RAMLINE_MM(:),AREA_RAMLINE(:),ROUGHNESS_AIRPLINE(:),ROUGHNESS_RAMLINE(:),RELROUGH_RAMLINE(:),LENGT_RAMLINE(:),LF_RAMLINE(:),CV_RAMLINE(:),NOTE_RAMLINE(:),AREAMINOR_RAMLINE(:)
!REAL,ALLOCATABLE:: Re_ramline(:),fric(:),fricloss(:)
REAL,ALLOCATABLE:: MINORDIAMETER_RAMLINE(:)
INTEGER,ALLOCATABLE:: ITEM(:),ITEM_PIPING(:),ITEM_PIPINGAIR(:),ITEM_MINORAIR(:)
CHARACTER,ALLOCATABLE:: DECRIPTION(:),DECRIPTION2(:),DECRIPTION_RAM(:),DESCRIPTION_AIR1(:),DESCRIPTION_AIR2(:)
real:: counter_airp,pacc_before
integer Annular_active,ShearBop_active,PipeRam1_active,PipeRam2_active,ChokeLine_active,KillLine_active
!===========================================================================
type:: RamLineType
logical ShearRamIsClosing,ShearRamIsOpening
REAL ShearRamsLeverOld,NoActiveRmas
!REAL checkp,p_acccheck
REAL P_ACC,FVR,DeltaT_BOP
REAL diffp_air,losses_air,Qup,kinetic_air,pipe_loss1air,minor_loss1air,static_loss1air!,pipe_loss1_before,minor_loss1,static_loss1,kinetic_loss1,pipe_loss1
!REAL loss_before,pipe_loss2,minor_loss2,deltah,static_loss2,kinetic_loss2,loss_after
integer AIRP_SWITCH,ELECP_SWITCH,ShearBop_closed,FINISHED_shear,EOF,NO_MINORSRAMLINE,NO_PIPINGSRAMLINE,NO_PIPINGS_AIRPLINE,NO_MINORS_AIRPLINE
integer counter,iteration,ShearBop_Situation_forTD
real BA1,BA2,BA3,BA4,BBA1,BBA2,BBA3,BBA4
REAL B1,B2,B3,B4
REAL,ALLOCATABLE:: Re_air(:),DIAM_AIR_MM(:),DIAM_AIR_INCH(:),AREA_AIR(:),REL_ROUGHAIR(:),LENGT_AIR(:),LF_AIR(:),CV_AIR(:),NOTE_AIR(:)
REAL,ALLOCATABLE:: fric_air(:),fricloss_air(:),minlosspa_air(:),minloss_air(:)
REAL,ALLOCATABLE:: MINORDIAM_AIR_INCH(:),MINORAREA_AIR(:)
REAL,ALLOCATABLE:: DIAM_RAMLINE_INCH(:),DIAM_RAMLINE_MM(:),AREA_RAMLINE(:),ROUGHNESS_AIRPLINE(:),ROUGHNESS_RAMLINE(:),RELROUGH_RAMLINE(:),LENGT_RAMLINE(:),LF_RAMLINE(:),CV_RAMLINE(:),NOTE_RAMLINE(:),AREAMINOR_RAMLINE(:)
!REAL,ALLOCATABLE:: Re_ramline(:),fric(:),fricloss(:)
REAL,ALLOCATABLE:: MINORDIAMETER_RAMLINE(:)
INTEGER,ALLOCATABLE:: ITEM(:),ITEM_PIPING(:),ITEM_PIPINGAIR(:),ITEM_MINORAIR(:)
CHARACTER,ALLOCATABLE:: DECRIPTION(:),DECRIPTION2(:),DECRIPTION_RAM(:),DESCRIPTION_AIR1(:),DESCRIPTION_AIR2(:)
real:: counter_airp,pacc_before
integer Annular_active,ShearBop_active,PipeRam1_active,PipeRam2_active,ChokeLine_active,KillLine_active
end type RamLineType
type(RamLineType)::RamLine
!===========================================================================
! ANNULAR PREVENTER COMPUTATIONAL VARIABLES
!===========================================================================

integer PannularTimeStepDelay
type(DynamicDoubleArrayType) :: Pannular_regDelay
logical AnnPressureRise
integer NO_MinorsAnnularLine,NO_PipingsAnnularLine,RamsFirstSet
REAL pa_annular,p_annular
REAL,ALLOCATABLE:: MINORDIAMETER_ANNULARLINE(:),AREAMINOR_ANNULARLINE(:)
!REAL,ALLOCATABLE:: REAL_PregAnnular(:),real_IDAnnular(:),real_pAnnular(:)
REAL REAL_PregAnnular,real_IDAnnular,real_pAnnular
REAL,ALLOCATABLE:: LF_ANNULARLINE(:),CV_ANNULARLINE(:),NOTE_ANNULARLINE(:),minlosspa_ANNULAR(:),minloss_ANNULAR(:)
REAL,ALLOCATABLE:: DIAM_ANNULARLINE_INCH(:),DIAM_ANNULARLINE_MM(:),AREA_ANNULARLINE(:)
REAL,ALLOCATABLE:: LENGT_ANNULARLINE(:),ROUGHNESS_ANNULARLINE(:),RELROUGH_ANNULARLINE(:),Re_ANNULARline(:),fricANNULAR(:),friclossANNULAR(:)
INTEGER,ALLOCATABLE:: ITEMANNULAR(:),ITEM_PIPINGANNULAR(:)
CHARACTER,ALLOCATABLE:: DECRIPTIONANNULAR(:),DECRIPTION2ANNULAR(:),DECRIPTION_ANNULAR(:)
REAL WellBorePressure,acoef,Bcoef,const,AnnularSealingPressure,AnnularMovingPressure
type::AnnularComputationalType
integer PannularTimeStepDelay
type(DynamicDoubleArrayType) :: Pannular_regDelay
logical AnnPressureRise
integer NO_MinorsAnnularLine,NO_PipingsAnnularLine,RamsFirstSet
REAL pa_annular,p_annular
REAL,ALLOCATABLE:: MINORDIAMETER_ANNULARLINE(:),AREAMINOR_ANNULARLINE(:)
!REAL,ALLOCATABLE:: REAL_PregAnnular(:),real_IDAnnular(:),real_pAnnular(:)
REAL REAL_PregAnnular,real_IDAnnular,real_pAnnular
REAL,ALLOCATABLE:: LF_ANNULARLINE(:),CV_ANNULARLINE(:),NOTE_ANNULARLINE(:),minlosspa_ANNULAR(:),minloss_ANNULAR(:)
REAL,ALLOCATABLE:: DIAM_ANNULARLINE_INCH(:),DIAM_ANNULARLINE_MM(:),AREA_ANNULARLINE(:)
REAL,ALLOCATABLE:: LENGT_ANNULARLINE(:),ROUGHNESS_ANNULARLINE(:),RELROUGH_ANNULARLINE(:),Re_ANNULARline(:),fricANNULAR(:),friclossANNULAR(:)
INTEGER,ALLOCATABLE:: ITEMANNULAR(:),ITEM_PIPINGANNULAR(:)
CHARACTER,ALLOCATABLE:: DECRIPTIONANNULAR(:),DECRIPTION2ANNULAR(:),DECRIPTION_ANNULAR(:)
REAL WellBorePressure,acoef,Bcoef,const,AnnularSealingPressure,AnnularMovingPressure
end type AnnularComputationalType
type(AnnularComputationalType)::AnnularComputational
!===========================================================================
! ANNULAR PREVENTER VARIABLES
!===========================================================================
REAL (8) Pannular_reg
real Pannular_regset
logical AnnularIsClosing,AnnularIsOpening
REAL tolAnnular,tolzeroAnnular
integer Annular_closed,finished_Annular,FirstSet,AnnularFailureMalf,AnnularLeakMalf,AnnularPressureGaugeMalf,Annular_Situation_forTD
REAL AnnularLeverOld,H_AnnularBop,IDAnnular,AbopAnnular,ODDrillpipe_inAnnular,IDAnnularBase,ODDrillpipe_inAnnularBase
REAL NeededVolumeAnnular
type :: AnnularType
REAL (8) Pannular_reg
real Pannular_regset
logical AnnularIsClosing,AnnularIsOpening
REAL tolAnnular,tolzeroAnnular
integer Annular_closed,finished_Annular,FirstSet,AnnularFailureMalf,AnnularLeakMalf,AnnularPressureGaugeMalf,Annular_Situation_forTD
REAL AnnularLeverOld,H_AnnularBop,IDAnnular,AbopAnnular,ODDrillpipe_inAnnular,IDAnnularBase,ODDrillpipe_inAnnularBase
REAL NeededVolumeAnnular
end type AnnularType
type(AnnularType)::Annular
!===========================================================================
! PIPE RAMS 1 VARIABLES
!===========================================================================
logical PipeRam1IsClosing,PipeRam1IsOpening
REAL PipeRams1LeverOld,H_PipeRam1Bop
REAL NeededVolumePipeRams1,AbopPipeRam,IDPipeRamBase,IDPipeRam1,ODDrillpipe_inPipeRam1,ODDrillpipe_inPipeRam1Base
integer PipeRam1_closed,finished_pipe1,UpperRamsFailureMalf,UpperRamsLeakMalf,PipeRam1_Situation_forTD
REAL real_IDPipeRam1

type::PipeRams1Type
logical IsClosing,IsOpening
REAL PipeRams1DotLeverOld,H
REAL NeededVolume,A,IDBase,ID,ODDrillpipe_in,ODDrillpipe_inBase
integer closed,finished,UpperRamsFailureMalf,UpperRamsLeakMalf,Situation_forTD
REAL real_ID
end type PipeRams1Type
type(PipeRams1Type)::PipeRam1
!============================================================================
! SHEAR RAM BOP VARIABLES
!============================================================================
REAL PA,PB,P_SHEAR,VA,VB,RAM_COURSE,H_REGRAM,H_ShearRamBop
REAL,ALLOCATABLE:: ALPHA_QRAM(:),ALPHA_VDISRAM(:),ALPHA_PACC(:),ALPHA_PREGRAM(:),ALPHA_PBOP(:)
!REAL,ALLOCATABLE:: REAL_TIME(:),REAL_QRAM(:),REAL_VDISRAM(:),REAL_PACC(:),REAL_PREGRAM(:),REAL_PBOP(:),real_IDshearBop(:)
REAL REAL_TIME,REAL_QRAM,REAL_VDISRAM,REAL_PACC,REAL_PREGRAM,REAL_PBOP,real_IDshearBop
REAL IDshearBopBase,IDshearBop,ODDrillpipe_inShearRam,AbopShearRam,NeededVolumeShearRams,ODDrillpipe_inShearRamBase
Real IDshearBopFinal,IDPipeRam1Final,IDPipeRam2Final,IDAnnularFinal,OpenArea_shearBop,OpenArea_PipeRam1,OpenArea_PipeRam2,OpenArea_Annular
Real MinimumOpenArea_InBOP
integer MiddleRamsFailureMalf,MiddleRamsLeakMalf,ShearIsNotAllowed

type:: ShearRamType
REAL PA,PB,P_SHEAR,VA,VB,RAM_COURSE,H_REGRAM,H_ShearRamBop
REAL,ALLOCATABLE:: ALPHA_QRAM(:),ALPHA_VDISRAM(:),ALPHA_PACC(:),ALPHA_PREGRAM(:),ALPHA_PBOP(:)
!REAL,ALLOCATABLE:: REAL_TIME(:),REAL_QRAM(:),REAL_VDISRAM(:),REAL_PACC(:),REAL_PREGRAM(:),REAL_PBOP(:),real_IDshearBop(:)
REAL REAL_TIME,REAL_QRAM,REAL_VDISRAM,REAL_PACC,REAL_PREGRAM,REAL_PBOP,real_IDshearBop
REAL IDshearBopBase,IDshearBop,ODDrillpipe_inShearRam,AbopShearRam,NeededVolumeShearRams,ODDrillpipe_inShearRamBase
Real IDshearBopFinal,IDPipeRam1Final,IDPipeRam2Final,IDAnnularFinal,OpenArea_shearBop,OpenArea_PipeRam1,OpenArea_PipeRam2,OpenArea_Annular
Real MinimumOpenArea_InBOP
integer MiddleRamsFailureMalf,MiddleRamsLeakMalf,ShearIsNotAllowed
end type ShearRamType
type(ShearRamType)::ShearRam
!===========================================================================
! PIPE RAMS 2 VARIABLES
!===========================================================================
logical PipeRam2IsClosing,PipeRam2IsOpening
REAL PipeRams2LeverOld,H_PipeRam2Bop
REAL NeededVolumePipeRams2,IDPipeRam2,ODDrillpipe_inPipeRam2,ODDrillpipe_inPipeRam2Base
integer PipeRam2_closed,finished_pipe2,LowerRamsFailureMalf,LowerRamsLeakMalf,PipeRam2_Situation_forTD
!REAL,ALLOCATABLE:: real_IDPipeRam2(:)
REAL real_IDPipeRam2

type::PipeRam2Type
logical IsClosing,IsOpening
REAL LeverOld,H_Bop
REAL NeededVolume,ID,ODDrillpipe_in,ODDrillpipe_inBase
integer closed,finished,LowerRamsFailureMalf,LowerRamsLeakMalf,Situation_forTD
!REAL,ALLOCATABLE:: real_IDPipeRam2(:)
REAL real_ID
end type PipeRam2Type
type(PipeRam2Type)::PipeRam2
!===========================================================================
! CHOKE LINE VARIABLES
!===========================================================================
logical ChokeLineIsClosing,ChokeLineIsOpening
REAL ChokeLineLeverOld,H_ChokeLineBop
REAL NeededVolumeChokeLine,AbopChokeLine,IDChokeLine,ODDrillpipe_inChokeLine,IDChokeLineBase,ODDrillpipe_inChokeLineBase
integer ChokeLine_closed,finished_ChokeLine
!REAL,ALLOCATABLE:: real_IDPipeRam1(:)
REAL real_IDChokeLine

type::ChokeLineType
logical IsClosing,IsOpening
REAL LeverOld,H_Bop
REAL NeededVolume,Abop,ID,ODDrillpipe_in,IDBase,ODDrillpipe_inBase
integer closed,finished
!REAL,ALLOCATABLE:: real_IDPipeRam1(:)
REAL real_ID
end type ChokeLineType
type(ChokeLineType)::ChokeLine
!===========================================================================
! KILL LINE VARIABLES
!===========================================================================
logical KillLineIsClosing,KillLineIsOpening
REAL KillLineLeverOld,H_KillLineBop
REAL NeededVolumeKillLine,AbopKillLine,IDKillLine,ODDrillpipe_inKillLine,IDKillLineBase,ODDrillpipe_inKillLineBase
integer KillLine_closed,finished_KillLine
!REAL,ALLOCATABLE:: real_IDPipeRam1(:)
REAL real_IDKillLine

type::KillLineType
logical IsClosing,IsOpening
REAL LeverOld,H_Bop
REAL NeededVolume,Abop,ID,ODDrillpipe_in,IDBase,ODDrillpipe_inBase
integer closed,finished
!REAL,ALLOCATABLE:: real_IDPipeRam1(:)
REAL real_ID
end type KillLineType
type(KillLineType)::KillLine
!============================================================================
! OIL & ENVIRONMENT VARIABLES
!============================================================================
@@ -135,13 +157,14 @@ REAL:: SG=1.12,WDENS=1000,GRAVITY=9.81,RE_CR=2000,NU=9e-6
!============================================================================
! PUMP VARIABLES
!============================================================================
REAL P_AIRP,DELTAV_AIR,TOL_AIR,DELTAV_ELECP,Qiter
REAL ELECTRIC_PUMPON,ELECTRIC_PUMPOFF,AIR_PUMPON,AIR_PUMPOFF,QAIR_PUMP,QELECTRIC_PUMP
!REAL,ALLOCATABLE:: alpha_Qair(:),alpha_timeair(:),alpha_paccair(:),alpha_pairp(:),alpha_diffpair(:),alpha_lossesair(:),alpha_fvrair(:)
REAL alpha_Qair,alpha_timeair,alpha_paccair,alpha_pairp,alpha_diffpair,alpha_lossesair,alpha_fvrair
logical SoundKoomeyElectricPump


type::PumpsType
REAL P_AIRP,DELTAV_AIR,TOL_AIR,DELTAV_ELECP,Qiter
REAL ELECTRIC_ON,ELECTRIC_OFF,AIR_ON,AIR_OFF,QAIR,QELECTRIC
!REAL,ALLOCATABLE:: alpha_Qair(:),alpha_timeair(:),alpha_paccair(:),alpha_pairp(:),alpha_diffpair(:),alpha_lossesair(:),alpha_fvrair(:)
REAL alpha_Qair,alpha_timeair,alpha_paccair,alpha_pairp,alpha_diffpair,alpha_lossesair,alpha_fvrair
logical SoundKoomeyElectric
end type PumpsType
type(PumpsType)::Pumps

!=================================================================================



+ 122
- 122
Equipments/ChokeControl/AirPump_Choke_Subs.f90 查看文件

@@ -9,13 +9,13 @@ write(*,*) 'deallocateeeeeeeeeeeee'
!===========================================================================
!if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP)

DEALLOCATE (PIPINGS_AIRPUMP,DIAM_AIR_INCH, &
Re_air,AREA_AIR,LENGT_AIR,ROUGHNESS_AIRPLINE,REL_ROUGHAIR, &
fric_air,fricloss_air)
DEALLOCATE (AirPumpLine%PIPINGS_AIRPUMP,AirPumpLine%DIAM_AIR_INCH, &
AirPumpLine%Re_air,AirPumpLine%AREA_AIR,AirPumpLine%LENGT_AIR,AirPumpLine%ROUGHNESS_AIRPLINE,AirPumpLine%REL_ROUGHAIR, &
AirPumpLine%fric_air,AirPumpLine%fricloss_air)
!================================================================
DEALLOCATE (MINORS_AIRPUMP,MINORDIAM_AIR_INCH, &
MINORAREA_AIR,LF_AIR,CV_AIR,NOTE_AIR &
,minlosspa_air,minloss_air)
DEALLOCATE (AirPumpLine%MINORS_AIRPUMP,AirPumpLine%MINORDIAM_AIR_INCH, &
AirPumpLine%MINORAREA_AIR,AirPumpLine%LF_AIR,AirPumpLine%CV_AIR,AirPumpLine%NOTE_AIR &
,AirPumpLine%minlosspa_air,AirPumpLine%minloss_air)

END
@@ -33,63 +33,63 @@ implicit none
!===========================================================================
! AIR PUMP LOSSES INPUT
!===========================================================================
NO_PIPINGS_AIRPLINE=1
AirPumpLine%NO_PIPINGS_AIRPLINE=1

ALLOCATE (PIPINGS_AIRPUMP(NO_PIPINGS_AIRPLINE,3))
ALLOCATE (AirPumpLine%PIPINGS_AIRPUMP(AirPumpLine%NO_PIPINGS_AIRPLINE,3))
! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION
PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance
AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance
!60960= 200 ft

ALLOCATE (DIAM_AIR_INCH(NO_PIPINGS_AIRPLINE),Re_air(NO_PIPINGS_AIRPLINE),AREA_AIR(NO_PIPINGS_AIRPLINE), &
LENGT_AIR(NO_PIPINGS_AIRPLINE),ROUGHNESS_AIRPLINE(NO_PIPINGS_AIRPLINE),REL_ROUGHAIR(NO_PIPINGS_AIRPLINE), &
fric_air(NO_PIPINGS_AIRPLINE),fricloss_air(NO_PIPINGS_AIRPLINE))
ALLOCATE (AirPumpLine%DIAM_AIR_INCH(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%Re_air(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%AREA_AIR(AirPumpLine%NO_PIPINGS_AIRPLINE), &
AirPumpLine%LENGT_AIR(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%ROUGHNESS_AIRPLINE(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%REL_ROUGHAIR(AirPumpLine%NO_PIPINGS_AIRPLINE), &
AirPumpLine%fric_air(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%fricloss_air(AirPumpLine%NO_PIPINGS_AIRPLINE))



DO I=1,NO_PIPINGS_AIRPLINE
DIAM_AIR_INCH(I)=PIPINGS_AIRPUMP(I,1)
LENGT_AIR(I)=PIPINGS_AIRPUMP(I,2)
ROUGHNESS_AIRPLINE(I)=PIPINGS_AIRPUMP(I,3)
DO I=1,AirPumpLine%NO_PIPINGS_AIRPLINE
AirPumpLine%DIAM_AIR_INCH(I)=AirPumpLine%PIPINGS_AIRPUMP(I,1)
AirPumpLine%LENGT_AIR(I)=AirPumpLine%PIPINGS_AIRPUMP(I,2)
AirPumpLine%ROUGHNESS_AIRPLINE(I)=AirPumpLine%PIPINGS_AIRPUMP(I,3)
AREA_AIR(I)=PI*(DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m)
REL_ROUGHAIR(I)=ROUGHNESS_AIRPLINE(I)/(DIAM_AIR_INCH(I)*25.4)
AirPumpLine%AREA_AIR(I)=PI*(AirPumpLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m)
AirPumpLine%REL_ROUGHAIR(I)=AirPumpLine%ROUGHNESS_AIRPLINE(I)/(AirPumpLine%DIAM_AIR_INCH(I)*25.4)
!DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m)
LENGT_AIR(I)=LENGT_AIR(I)*.001 ! (m)
AirPumpLine%LENGT_AIR(I)=AirPumpLine%LENGT_AIR(I)*.001 ! (m)
ENDDO

!================================================================
NO_MINORS_AIRPLINE=6
AirPumpLine%NO_MINORS_AIRPLINE=6

ALLOCATE (MINORS_AIRPUMP(NO_MINORS_AIRPLINE,4))
ALLOCATE (AirPumpLine%MINORS_AIRPUMP(AirPumpLine%NO_MINORS_AIRPLINE,4))

! ID(INCH) LF CV NOTE(BAR) DESCRIPTION
MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee
MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow
MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter
MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve
MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve
MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA
AirPumpLine%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee
AirPumpLine%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow
AirPumpLine%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter
AirPumpLine%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve
AirPumpLine%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve
AirPumpLine%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA

ALLOCATE (MINORDIAM_AIR_INCH(NO_MINORS_AIRPLINE),MINORAREA_AIR(NO_MINORS_AIRPLINE), &
LF_AIR(NO_MINORS_AIRPLINE),CV_AIR(NO_MINORS_AIRPLINE),NOTE_AIR(NO_MINORS_AIRPLINE) &
,minlosspa_air(NO_MINORS_AIRPLINE),minloss_air(NO_MINORS_AIRPLINE))
ALLOCATE (AirPumpLine%MINORDIAM_AIR_INCH(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%MINORAREA_AIR(AirPumpLine%NO_MINORS_AIRPLINE), &
AirPumpLine%LF_AIR(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%CV_AIR(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%NOTE_AIR(AirPumpLine%NO_MINORS_AIRPLINE) &
,AirPumpLine%minlosspa_air(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%minloss_air(AirPumpLine%NO_MINORS_AIRPLINE))

DO I=1,NO_MINORS_AIRPLINE
MINORDIAM_AIR_INCH(I)=MINORS_AIRPUMP(I,1)
LF_AIR(I)=MINORS_AIRPUMP(I,2)
CV_AIR(I)=MINORS_AIRPUMP(I,3)
NOTE_AIR(I)=MINORS_AIRPUMP(I,4)
DO I=1,AirPumpLine%NO_MINORS_AIRPLINE
AirPumpLine%MINORDIAM_AIR_INCH(I)=AirPumpLine%MINORS_AIRPUMP(I,1)
AirPumpLine%LF_AIR(I)=AirPumpLine%MINORS_AIRPUMP(I,2)
AirPumpLine%CV_AIR(I)=AirPumpLine%MINORS_AIRPUMP(I,3)
AirPumpLine%NOTE_AIR(I)=AirPumpLine%MINORS_AIRPUMP(I,4)
MINORAREA_AIR(I)=PI*(MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m)
AirPumpLine%MINORAREA_AIR(I)=PI*(AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m)
ENDDO
@@ -107,7 +107,7 @@ SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER)
Integer I

loop3: do while (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. CHOOKE(CHNUMBER)%FailMalf==0 .AND. ChokeAirFail==0)
loop3: do while (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. CHOOKE(CHNUMBER)%FailMalf==0 .AND. AirDrivenPump%ChokeAirFail==0)
if (ChokeControlPanel%ChokeControlLever == 1.0) then
CHOOKE(CHNUMBER)%ChokeIsClosing = .true.
CHOOKE(CHNUMBER)%ChokeIsOpening = .false.
@@ -120,7 +120,7 @@ SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER)

time=time+DeltaT_Choke !overal time (s)
AirPumpLine%TIME=AirPumpLine%TIME+AirPumpLine%DeltaT_Choke !overal time (s)



@@ -155,33 +155,33 @@ implicit none
INTEGER CHNUMBER


QAIR_PUMP=Qiter+.1 !(gpm) maximum flow for the start
diffp_air=-10
losses_air=10
AirDrivenPump%QAIR_PUMP=AirPumpLine%QITER+.1 !(gpm) maximum flow for the start
AirPumpLine%diffp_air=-10
AirPumpLine%losses_air=10

!===================================================================
! AIR OPERATED PUMP
! MODEL 10-6000W030 RATIO 55:1
!=================for air consumption at 100 psig===================
do while (diffp_air<0)
QAIR_PUMP=QAIR_PUMP-.1
! Qup=QAIR_PUMP;
do while (AirPumpLine%diffp_air<0)
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.1
! Qup=AirDrivenPump%QAIR_PUMP;
!cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM
p_airp=cc1*(QAIR_PUMP**4) + cc2*(QAIR_PUMP**3) + cc3*(QAIR_PUMP**2) + cc4*QAIR_PUMP + cc5 !(psig)
AirPumpLine%P_AIRP=AirDrivenPump%cc1*(AirDrivenPump%QAIR_PUMP**4) + AirDrivenPump%cc2*(AirDrivenPump%QAIR_PUMP**3) + AirDrivenPump%cc3*(AirDrivenPump%QAIR_PUMP**2) + AirDrivenPump%cc4*AirDrivenPump%QAIR_PUMP + AirDrivenPump%cc5 !(psig)
! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)

diffp_air= p_airp - Pdownstrem
AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem

end do !returns Qup



do while (abs((diffp_air-losses_air)/diffp_air)>tol_air) !finding correct QAIR_pump for 1 timecounter_ram
do while (abs((AirPumpLine%diffp_air-AirPumpLine%losses_air)/AirPumpLine%diffp_air)>AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram

if (diffp_air-losses_air>0) then
QAIR_PUMP=QAIR_PUMP+.005
if (AirPumpLine%diffp_air-AirPumpLine%losses_air>0) then
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP+.005
else
QAIR_PUMP=QAIR_PUMP-.005
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.005
endif

!===================================================================
@@ -189,53 +189,53 @@ endif
! MODEL 10-6000W030 RATIO 55:1
!=================for air consumption at 100 psig===================

p_airp=cc1*(QAIR_PUMP**4) + cc2*(QAIR_PUMP**3) + cc3*(QAIR_PUMP**2) + cc4*QAIR_PUMP + cc5 !(psig)
AirPumpLine%P_AIRP=AirDrivenPump%cc1*(AirDrivenPump%QAIR_PUMP**4) + AirDrivenPump%cc2*(AirDrivenPump%QAIR_PUMP**3) + AirDrivenPump%cc3*(AirDrivenPump%QAIR_PUMP**2) + AirDrivenPump%cc4*AirDrivenPump%QAIR_PUMP + AirDrivenPump%cc5 !(psig)
!kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)

diffp_air= p_airp - Pdownstrem
AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem


!===========================LOSSES====================================
do i=1,NO_PIPINGS_AIRPLINE
Re_air(i)=QAIR_PUMP*6.30902e-005*DIAM_AIR_INCH(I)*0.0254/(area_air(i)*nu)
do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
AirPumpLine%Re_air(i)=AirDrivenPump%QAIR_PUMP*6.30902e-005*AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(AirPumpLine%AREA_AIR(i)*nu)
enddo


do i=1,NO_PIPINGS_AIRPLINE
if (Re_air(i)<Re_cr) then
fric_air(i)=64/Re_air(i)
do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
if (AirPumpLine%Re_air(i)<Re_cr) then
AirPumpLine%fric_air(i)=64/AirPumpLine%Re_air(i)
else
fric_air(i)=1/(-1.8*log10((rel_roughair(i)/3.7)**1.11+6.9/Re_air(i)))**2
AirPumpLine%fric_air(i)=1/(-1.8*log10((AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/AirPumpLine%Re_air(i)))**2
endif
fricloss_air(i)=((fric_air(i)*(wdens*sg*lengt_air(i)*(QAIR_PUMP*6.30902e-005/area_air(i))**2))/(2*DIAM_AIR_INCH(I)*0.0254))/6895
AirPumpLine%fricloss_air(i)=((AirPumpLine%fric_air(i)*(wdens*sg*AirPumpLine%LENGT_AIR(i)*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%AREA_AIR(i))**2))/(2*AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895

enddo




pipe_loss1air=sum(fricloss_air) !loss before regulator(psi)
AirPumpLine%pipe_loss1air=sum(AirPumpLine%fricloss_air) !loss before regulator(psi)

do i=1,NO_MINORS_AIRPLINE
if (LF_air(i)/=0) then
minlosspa_air(i)=LF_air(i)*wdens*sg*(QAIR_PUMP*6.30902e-005/MINORAREA_AIR(i))**2/2 !(Pa)
minloss_air(i)=minlosspa_air(i)/6895 !(psi)
elseif (CV_air(i)/=0) then
minlosspa_air(i)=1000*sg*((11.7*QAIR_PUMP*6.30902e-005*3600)/(CV_air(i)))**2 !(pa)
minloss_air(i)=minlosspa_air(i)/6895 !(psi)
do i=1,AirPumpLine%NO_MINORS_AIRPLINE
if (AirPumpLine%LF_AIR(i)/=0) then
AirPumpLine%minlosspa_air(i)=AirPumpLine%LF_AIR(i)*wdens*sg*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
elseif (AirPumpLine%CV_AIR(i)/=0) then
AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(AirPumpLine%CV_AIR(i)))**2 !(pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
else
minlosspa_air(i)=NOTE_air(i)*1e5 !(pa)
minloss_air(i)=minlosspa_air(i)/6895 !(psi)
AirPumpLine%minlosspa_air(i)=AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
endif
enddo

minor_loss1air=sum(minloss_air) !loss before regulator(psi)
AirPumpLine%minor_loss1air=sum(AirPumpLine%minloss_air) !loss before regulator(psi)

static_loss1air=0
AirPumpLine%static_loss1air=0

losses_air=pipe_loss1air+minor_loss1air+static_loss1air !(psi)
AirPumpLine%losses_air=AirPumpLine%pipe_loss1air+AirPumpLine%minor_loss1air+AirPumpLine%static_loss1air !(psi)
!=========================================================================


@@ -244,29 +244,29 @@ losses_air=pipe_loss1air+minor_loss1air+static_loss1air !(psi)



Qiter=QAIR_PUMP
QAIR_PUMP=QAIR_PUMP*(ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
AirPumpLine%QITER=AirDrivenPump%QAIR_PUMP
AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP*(ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
Cumulative_AirVolume_Choke= Cumulative_AirVolume_Choke + ((QAIR_PUMP * DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke + ((AirDrivenPump%QAIR_PUMP * AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes

if ( Cumulative_AirVolume_Choke > 1.0 ) then
SoundChokePump= 60
Cumulative_AirVolume_Choke= Cumulative_AirVolume_Choke - 1.0
if ( Choke%Cumulative_AirVolume_Choke > 1.0 ) then
Choke%SoundChokePump= 60
Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke - 1.0
else
SoundChokePump= 0.0
Choke%SoundChokePump= 0.0
endif
!SoundChokePump= int (QAIR_PUMP/ (1.5*0.004329004)*DeltaT_Choke/60.0) ! 1.5: Volume per stroke (in^3) , 0.004329004: in^3 to gal , 60:seconds

deltav_air=QAIR_PUMP*DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm)
AirPumpLine%DELTAV_AIR=AirDrivenPump%QAIR_PUMP*AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm)

if (CHOOKE(CHNUMBER)%ChokeIsClosing) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse + (deltav_air*3785.412/Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3
if (CHOOKE(CHNUMBER)%ChokeIsClosing) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse + (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) ! 3785.412 : GALON TO CM^3
if (CHOOKE(CHNUMBER)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse - (deltav_air*3785.412/Acylinder)!*(ChokeRateControlKnob/10.)
if (CHOOKE(CHNUMBER)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse - (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.)


@@ -276,39 +276,39 @@ if (CHOOKE(CHNUMBER)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUM
!((((((((IN OUTER LOOP))))))

!===============AIR PUMP OUTPUTS=========================
alpha_timeair=time ! overal time (s)
alpha_Pdownstrem=Pdownstrem
alpha_pairp=p_airp
alpha_Qair=QAIR_PUMP
AirPumpLine%alpha_timeair=AirPumpLine%TIME ! overal time (s)
AirPumpLine%alpha_Pdownstrem=AirPumpLine%Pdownstrem
AirPumpLine%alpha_pairp=AirPumpLine%P_AIRP
AirPumpLine%alpha_Qair=AirDrivenPump%QAIR_PUMP
!write(*,*) 'diffp_air=',diffp_air
!pause
alpha_diffpair=diffp_air
AirPumpLine%alpha_diffpair=AirPumpLine%diffp_air

alpha_lossesair=losses_air
AirPumpLine%alpha_lossesair=AirPumpLine%losses_air
!========================================================
!OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT')


if (CHOOKE(CHNUMBER)%ChokeIsClosing .AND. CHOOKE(CHNUMBER)%PassedCourse>CourseBase) then
CHOOKE(CHNUMBER)%PassedCourse=CourseBase
SoundChokePump= 0.0
if (CHOOKE(CHNUMBER)%ChokeIsClosing .AND. CHOOKE(CHNUMBER)%PassedCourse>AirPumpLine%CourseBase) then
CHOOKE(CHNUMBER)%PassedCourse=AirPumpLine%CourseBase
Choke%SoundChokePump= 0.0
endif
if (CHOOKE(CHNUMBER)%ChokeIsOpening .AND. CHOOKE(CHNUMBER)%PassedCourse<0.) then
CHOOKE(CHNUMBER)%PassedCourse=0.
SoundChokePump= 0.0
Choke%SoundChokePump= 0.0
endif
call SetSoundChokePump(SoundChokePump)
call SetSoundChokePump(Choke%SoundChokePump)

CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/CourseBase
CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/AirPumpLine%CourseBase
IF (ChokeControlPanel%Choke1LED==1) THEN
ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10
ELSE ! Choke2LED==1
ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10
ENDIF
!CALL SetHydraulicChock1(nint(MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)*100))
@@ -329,37 +329,37 @@ alpha_lossesair=losses_air

HydraulicChoke1WashoutCoef= HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
HydraulicChoke1WashoutCoef= MIN( 0.5 , HydraulicChoke1WashoutCoef+ CHOOKE(1)%WashoutMalf*(0.5/(60.0/DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time
Choke%HydraulicChoke1WashoutCoef= Choke%HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke1WashoutCoef+ CHOOKE(1)%WashoutMalf*(0.5/(60.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time
HydraulicChoke2WashoutCoef= HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
HydraulicChoke2WashoutCoef= MIN( 0.5 , HydraulicChoke2WashoutCoef+ CHOOKE(2)%WashoutMalf*(0.5/(60.0/DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time
Choke%HydraulicChoke2WashoutCoef= Choke%HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke2WashoutCoef+ CHOOKE(2)%WashoutMalf*(0.5/(60.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5=maximum washout coef , 60.0 sec= 1min duration time

!write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef
IF (CHOOKE(1)%PlugMalf == 1) THEN
Present_HydraulicChoke1Plug= Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf
Choke%Present_HydraulicChoke1Plug= Choke%Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf
! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent
!write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent
if ( (ChokeProblems%HydraulicChoke1PluggedPercent - HydraulicChoke1PluggedPercent_Old) /= 0) then
DeltaPlug1Percent = (REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - Present_HydraulicChoke1Plug
Plug1TimeCounter = 0
if ( (ChokeProblems%HydraulicChoke1PluggedPercent - Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then
Choke%DeltaPlug1Percent = (REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - Choke%Present_HydraulicChoke1Plug
Choke%Plug1TimeCounter = 0
!write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug
endif
Plug1TimeCounter= Plug1TimeCounter + 1
Choke%Plug1TimeCounter= Choke%Plug1TimeCounter + 1

HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
Choke%HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
if (Plug1TimeCounter <= ChokePlugTimeDelay) then !ChokePlugTimeDelay=600
if (Choke%Plug1TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600
Present_HydraulicChoke1Plug = Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((DeltaPlug1Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
Choke%Present_HydraulicChoke1Plug = Choke%Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((Choke%DeltaPlug1Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
endif
@@ -374,23 +374,23 @@ alpha_lossesair=losses_air
IF (CHOOKE(2)%PlugMalf == 1) THEN

Present_HydraulicChoke2Plug= Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf
Choke%Present_HydraulicChoke2Plug= Choke%Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf
! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent
if ( (ChokeProblems%HydraulicChoke2PluggedPercent - HydraulicChoke2PluggedPercent_Old) /= 0 ) then
DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Present_HydraulicChoke2Plug
Plug2TimeCounter = 0
if ( (ChokeProblems%HydraulicChoke2PluggedPercent - Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then
Choke%DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Choke%Present_HydraulicChoke2Plug
Choke%Plug2TimeCounter = 0
endif
Plug2TimeCounter= Plug2TimeCounter + 1
Choke%Plug2TimeCounter= Choke%Plug2TimeCounter + 1

HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
Choke%HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
if (Plug2TimeCounter <= ChokePlugTimeDelay) then !ChokePlugTimeDelay=600
if (Choke%Plug2TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600
Present_HydraulicChoke2Plug = Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((DeltaPlug2Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
Choke%Present_HydraulicChoke2Plug = Choke%Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((Choke%DeltaPlug2Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
endif
@@ -403,14 +403,14 @@ alpha_lossesair=losses_air
! fully open area is 123/64 in^2 = 0.01334635 ft^2
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*HydraulicChoke1WashoutCoef*ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*Choke%HydraulicChoke1WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke=' ,CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Choke%Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*HydraulicChoke2WashoutCoef*ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*Choke%HydraulicChoke2WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Choke%Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke=' ,CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke
@@ -418,8 +418,8 @@ alpha_lossesair=losses_air
CHOOKE(2)%AreaChokeFinal= CHOOKE(2)%AreaChoke
! 144: ft^2 to in^2
CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
!write(*,*) 'CHOOKE(1)%PercentClose=' , CHOOKE(1)%PercentClose ! close percent 0 to 100


+ 30
- 30
Equipments/ChokeControl/CHOKE.f90 查看文件

@@ -1,6 +1,6 @@
module choke
module ChokeModule
USE CHOKEVARIABLES
!USE CDataDisplayConsoleVariables, CasingPressureDataDisplay=>CasingPressure!, StandPipePressureDataDisplay=>StandPipePressure
USE CChokeProblemsVariables
@@ -42,9 +42,9 @@ module choke


IF (ChokeControlPanel%Choke1LED==1) THEN
ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ! display monitor
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ! display monitor
ELSE ! Choke2LED==1
ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10 ! display monitor
ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10 ! display monitor
ENDIF


@@ -62,37 +62,37 @@ module choke

HydraulicChoke1WashoutCoef= HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
HydraulicChoke1WashoutCoef= MIN( 0.5 , HydraulicChoke1WashoutCoef+ CHOOKE(1)%WashoutMalf*(0.5/(180.0/DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time
Choke%HydraulicChoke1WashoutCoef= Choke%HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
Choke%HydraulicChoke1WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke1WashoutCoef+ CHOOKE(1)%WashoutMalf*(0.5/(180.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time
HydraulicChoke2WashoutCoef= HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
HydraulicChoke2WashoutCoef= MIN( 0.5 , HydraulicChoke2WashoutCoef+ CHOOKE(2)%WashoutMalf*(0.5/(180.0/DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time
Choke%HydraulicChoke2WashoutCoef= Choke%HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
Choke%HydraulicChoke2WashoutCoef= MIN( 0.5 , Choke%HydraulicChoke2WashoutCoef+ CHOOKE(2)%WashoutMalf*(0.5/(180.0/AirPumpLine%DeltaT_Choke)) ) ! 0.5 = maximum washout coef , 180.0 sec = 3 min duration time

!write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef
IF (CHOOKE(1)%PlugMalf == 1) THEN
Present_HydraulicChoke1Plug= Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf
Choke%Present_HydraulicChoke1Plug= Choke%Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf
! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent
!write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent
if ( (ChokeProblems%HydraulicChoke1PluggedPercent - HydraulicChoke1PluggedPercent_Old) /= 0) then
DeltaPlug1Percent = (REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - Present_HydraulicChoke1Plug
Plug1TimeCounter = 0
if ( (ChokeProblems%HydraulicChoke1PluggedPercent - Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then
Choke%DeltaPlug1Percent = (REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - Choke%Present_HydraulicChoke1Plug
Choke%Plug1TimeCounter = 0
!write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug
endif
Plug1TimeCounter= Plug1TimeCounter + 1
Choke%Plug1TimeCounter= Choke%Plug1TimeCounter + 1

HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
Choke%HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
if (Plug1TimeCounter <= ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
if (Choke%Plug1TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
Present_HydraulicChoke1Plug = Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((DeltaPlug1Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
Choke%Present_HydraulicChoke1Plug = Choke%Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((Choke%DeltaPlug1Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
endif
@@ -107,23 +107,23 @@ module choke
IF (CHOOKE(2)%PlugMalf == 1) THEN

Present_HydraulicChoke2Plug= Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf
Choke%Present_HydraulicChoke2Plug= Choke%Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf
! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent
if ( (ChokeProblems%HydraulicChoke2PluggedPercent - HydraulicChoke2PluggedPercent_Old) /= 0 ) then
DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Present_HydraulicChoke2Plug
Plug2TimeCounter = 0
if ( (ChokeProblems%HydraulicChoke2PluggedPercent - Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then
Choke%DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Choke%Present_HydraulicChoke2Plug
Choke%Plug2TimeCounter = 0
endif
Plug2TimeCounter= Plug2TimeCounter + 1
Choke%Plug2TimeCounter= Choke%Plug2TimeCounter + 1

HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
Choke%HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
if (Plug2TimeCounter <= ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
if (Choke%Plug2TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800
Present_HydraulicChoke2Plug = Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((DeltaPlug2Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 1800.0
Choke%Present_HydraulicChoke2Plug = Choke%Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((Choke%DeltaPlug2Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 1800.0
endif
@@ -136,14 +136,14 @@ module choke
! fully open area is 123/64 in^2 = 0.01334635 ft^2
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*HydraulicChoke1WashoutCoef*ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*Choke%HydraulicChoke1WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke=' ,CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Choke%Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*HydraulicChoke2WashoutCoef*ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*Choke%HydraulicChoke2WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Choke%Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
!write(*,*) 'CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke=' ,CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke
@@ -151,8 +151,8 @@ module choke
CHOOKE(2)%AreaChokeFinal= CHOOKE(2)%AreaChoke
! 144: ft^2 to in^2
CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
!write(*,*) 'CHOOKE(1)%PercentClose=' , CHOOKE(1)%PercentClose ! close percent 0 to 100
@@ -180,4 +180,4 @@ module choke
!************************* IN MUD SYSTEM MODULE*************************
end subroutine CHOKE_MainBody

end module CHOKE
end module ChokeModule

+ 41
- 62
Equipments/ChokeControl/CHOKE_VARIABLES.f90 查看文件

@@ -12,28 +12,35 @@ IMPLICIT NONE
!===========================================================================
! CHOKE VARIABLES
!===========================================================================
REAL Ycritical,Cp,Cv,CL,kRatio,nPolytripic,x1,SGliquid,WaterDensity,LiquidDensity,VL,VG1
REAL epsilon_step,epsilon_abs,step_size,Ycritical_a,Ycritical_b,Ycritical_c
REAL G2,Cdrag,Pwh,MixDens2,Yratio_a,Yratio_b,Yratio_c,Yratio,Yratio_low,Yratio_high
REAL FlowRate,Patm,MassFlux,LiquidPPG,time2,AreaChoke
REAL eps_step,eps_abs,Yratiomat(100),Yrario_actual,Yrario
REAL :: DegreeOpen,GRAVITY1=9.81!,PercentClose
REAL ChokedMassFlux,ChokedFlowRate,PwhChoked
REAL TotalStrokes1,TotalStrokes2
!INTEGER WashoutMalf,PlugMalf,failMalf
INTEGER GaugeChokePositionMailf,SoundChokePump
Real Cumulative_AirVolume_Choke
Real HydraulicChoke1WashoutCoef,HydraulicChoke2WashoutCoef

Real Present_HydraulicChoke1Plug, Present_HydraulicChoke2Plug,DeltaPlug1Percent,DeltaPlug2Percent
Integer HydraulicChoke1PluggedPercent_Old,HydraulicChoke2PluggedPercent_Old,Plug1TimeCounter,Plug2TimeCounter,ChokePlugTimeDelay
Real ChokeAreaFullyOpen
type::ChokeType
REAL Ycritical,Cp,Cv,CL,kRatio,nPolytripic,x1,SGliquid,WaterDensity,LiquidDensity,VL,VG1
REAL epsilon_step,epsilon_abs,step_size,Ycritical_a,Ycritical_b,Ycritical_c
REAL G2,Cdrag,Pwh,MixDens2,Yratio_a,Yratio_b,Yratio_c,Yratio,Yratio_low,Yratio_high
REAL FlowRate,Patm,MassFlux,LiquidPPG,time2,AreaChoke
REAL eps_step,eps_abs,Yratiomat(100),Yrario_actual,Yrario
REAL :: DegreeOpen,GRAVITY1=9.81!,PercentClose
REAL ChokedMassFlux,ChokedFlowRate,PwhChoked
REAL TotalStrokes1,TotalStrokes2
!INTEGER WashoutMalf,PlugMalf,failMalf
INTEGER GaugeChokePositionMailf,SoundChokePump
Real Cumulative_AirVolume_Choke
Real HydraulicChoke1WashoutCoef,HydraulicChoke2WashoutCoef

Real Present_HydraulicChoke1Plug, Present_HydraulicChoke2Plug,DeltaPlug1Percent,DeltaPlug2Percent
Integer HydraulicChoke1PluggedPercent_Old,HydraulicChoke2PluggedPercent_Old,Plug1TimeCounter,Plug2TimeCounter,ChokePlugTimeDelay
Real ChokeAreaFullyOpen
end type ChokeType
type(ChokeType)::Choke
!===========================================================================
! AIR DRIVEN PUMP VARIABLES
!===========================================================================
REAL QAIR_PUMP,cc1,cc2,cc3,cc4,cc5
type::AirDrivenPumpType
REAL QAIR_PUMP,cc1,cc2,cc3,cc4,cc5
INTEGER ChokeAirFail
end type AirDrivenPumpType
type(AirDrivenPumpType)::AirDrivenPump

PARAMETER PI=3.141593
INTEGER ChokeAirFail
!============================================================================
! OIL & ENVIRONMENT VARIABLES
!============================================================================
@@ -46,57 +53,29 @@ REAL:: SG=1.12,WDENS=1000,GRAVITY=9.81,RE_CR=2000,NU=9e-6
! AIR PUMP LINE COMPUTATIONAL VARIABLES
!===========================================================================
!logical ChokeIsClosing,ChokeIsOpening
REAL ChokeControlLeverOld
REAL P_AIRP,QITER,DELTAV_AIR,TIME,DeltaT_Choke,TOL_AIR
REAL diffp_air,losses_air,pipe_loss1air,minor_loss1air,static_loss1air
integer NO_PIPINGS_AIRPLINE,NO_MINORS_AIRPLINE
REAL,ALLOCATABLE:: Re_air(:),DIAM_AIR_MM(:),DIAM_AIR_INCH(:),AREA_AIR(:),REL_ROUGHAIR(:),LENGT_AIR(:),LF_AIR(:),CV_AIR(:),NOTE_AIR(:)
REAL,ALLOCATABLE:: fric_air(:),fricloss_air(:),minlosspa_air(:),minloss_air(:),MINORS_AIRPUMP(:,:)
REAL,ALLOCATABLE:: MINORDIAM_AIR_INCH(:),MINORAREA_AIR(:)
REAL,ALLOCATABLE:: ROUGHNESS_AIRPLINE(:),PIPINGS_AIRPUMP(:,:)
REAL Acylinder,CourseBase!,PassedCourse
REAL alpha_Qair,alpha_timeair,alpha_pairp,alpha_diffpair,alpha_lossesair,alpha_Pdownstrem,Pdownstrem


type::AirPumpLineType
REAL ChokeControlLeverOld
REAL P_AIRP,QITER,DELTAV_AIR,TIME,DeltaT_Choke,TOL_AIR
REAL diffp_air,losses_air,pipe_loss1air,minor_loss1air,static_loss1air
integer NO_PIPINGS_AIRPLINE,NO_MINORS_AIRPLINE
REAL,ALLOCATABLE:: Re_air(:),DIAM_AIR_MM(:),DIAM_AIR_INCH(:),AREA_AIR(:),REL_ROUGHAIR(:),LENGT_AIR(:),LF_AIR(:),CV_AIR(:),NOTE_AIR(:)
REAL,ALLOCATABLE:: fric_air(:),fricloss_air(:),minlosspa_air(:),minloss_air(:),MINORS_AIRPUMP(:,:)
REAL,ALLOCATABLE:: MINORDIAM_AIR_INCH(:),MINORAREA_AIR(:)
REAL,ALLOCATABLE:: ROUGHNESS_AIRPLINE(:),PIPINGS_AIRPUMP(:,:)
REAL Acylinder,CourseBase!,PassedCourse
REAL alpha_Qair,alpha_timeair,alpha_pairp,alpha_diffpair,alpha_lossesair,alpha_Pdownstrem,Pdownstrem
end type AirPumpLineType
type(AirPumpLineType)::AirPumpLine

!=================================================================================

TYPE, PUBLIC :: CHOKE_TypeVars



INTEGER WashoutMalf,PlugMalf,failMalf
REAL PercentClose,PassedCourse,AreaChoke,AreaChokeFinal
logical ChokeIsClosing,ChokeIsOpening

INTEGER WashoutMalf,PlugMalf,failMalf
REAL PercentClose,PassedCourse,AreaChoke,AreaChokeFinal
logical ChokeIsClosing,ChokeIsOpening
END TYPE CHOKE_TypeVars

TYPE(CHOKE_TypeVars), DIMENSION(1:2) :: CHOOKE
!TYPE, PUBLIC :: BOP_TypeVars2D
!REAL, ALLOCATABLE:: minlosspa(:,:),minloss(:,:)
!REAL,ALLOCATABLE:: Re_ramline(:,:),fric(:,:),fricloss(:,:)
!
!
!END TYPE BOP_TypeVars2D
!
!TYPE(BOP_TypeVars2D) :: RAMS

! 1 : CHOKE1
! 2 : CHOKE2




END MODULE



+ 1
- 1
Equipments/ChokeControl/ChokeControlMain.f90 查看文件

@@ -18,7 +18,7 @@ module ChokeControlMain
! end subroutine ChokeControl_Init
subroutine ChokeControl_Step
use CHOKE
use ChokeModule
implicit none
CALL CHOKE_MainBody
end subroutine ChokeControl_Step


+ 42
- 42
Equipments/ChokeControl/ChokeStartup.f90 查看文件

@@ -28,34 +28,34 @@
kRatio=1.4
Cp=0.24
CL=0.8
Choke%kRatio=1.4
Choke%Cp=0.24
Choke%CL=0.8

x1=0.5
Choke%x1=0.5
LiquidPPG=9.
LiquidDensity=LiquidPPG*7.48 !lbm/ft**3
Choke%LiquidPPG=9.
Choke%LiquidDensity=Choke%LiquidPPG*7.48 !lbm/ft**3

VL=1.0/LiquidDensity !SpecificVolume of Liquid
Choke%VL=1.0/Choke%LiquidDensity !SpecificVolume of Liquid

Cv=Cp/kRatio
Choke%Cv=Choke%Cp/Choke%kRatio

nPolytripic=1+(x1*(Cp-Cv)/(x1*Cv+(1-x1)*CL))
Choke%nPolytripic=1+(Choke%x1*(Choke%Cp-Choke%Cv)/(Choke%x1*Choke%Cv+(1-Choke%x1)*Choke%CL))
VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream
Choke%VG1=1./0.748 !lbm/ft**3 Specific Volume of Air, Upstream

Cdrag=0.8
Pwh=1400. !psi
Choke%Cdrag=0.8
Choke%Pwh=1400. !psi


Patm=14.7
MixDens2=x1*VG1 !lbm/ft**3
Choke%Patm=14.7
Choke%MixDens2=Choke%x1*Choke%VG1 !lbm/ft**3



epsilon_abs= 1e-5
epsilon_step= 1e-5
Choke%epsilon_abs= 1e-5
Choke%epsilon_step= 1e-5


!ChokeDiameter= 32/64. !in
@@ -66,26 +66,26 @@ CHOOKE%PercentClose= 0.0
! CHOOKE(1)%AreaChoke=0.01334635
!ChokeAreaFullyOpen = 123.d0 / 64.d0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2

DeltaT_Choke=0.1
AirPumpLine%DeltaT_Choke=0.1
!TotalStrokes1=0.
!TotalStrokes2=0.

HydraulicChoke1WashoutCoef= 0.0
HydraulicChoke2WashoutCoef= 0.0
Choke%HydraulicChoke1WashoutCoef= 0.0
Choke%HydraulicChoke2WashoutCoef= 0.0



ChokePlugTimeDelay = int(180./DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay
Choke%ChokePlugTimeDelay = int(180./AirPumpLine%DeltaT_Choke) ! =1800 = 180/0.1 : for 3 min delay

Present_HydraulicChoke1Plug = REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.
HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
Plug1TimeCounter= 0
DeltaPlug1Percent = 0.0
Choke%Present_HydraulicChoke1Plug = REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.
Choke%HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
Choke%Plug1TimeCounter= 0
Choke%DeltaPlug1Percent = 0.0

Present_HydraulicChoke2Plug = REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.
HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
Plug2TimeCounter= 0
DeltaPlug2Percent = 0.0
Choke%Present_HydraulicChoke2Plug = REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.
Choke%HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
Choke%Plug2TimeCounter= 0
Choke%DeltaPlug2Percent = 0.0



@@ -93,35 +93,35 @@ DeltaPlug2Percent = 0.0

!======================AIRPUMP INPUTS(CONSTANTS)===========================
CourseBase= 24. !cm
AirPumpLine%CourseBase= 24. !cm
CHOOKE%PassedCourse= 0.
ChokeControlPanel%ChokePosition=0.

Acylinder= PI*(8.**2)/4. ! (CM^2), 8=DIAMETER, 24=course , 3785.412: cm^3 to galon
AirPumpLine%Acylinder= PI*(8.**2)/4. ! (CM^2), 8=DIAMETER, 24=course , 3785.412: cm^3 to galon


CHOOKE%ChokeIsOpening = .false.
CHOOKE%ChokeIsClosing = .false.
P_AIRP=0
AirPumpLine%P_AIRP=0

cc1 = 0.1354; cc2 = -2.066; cc3 = -21.09; cc4 = -51.36; cc5 = 5935 ! FOR OUTPUT IN GPM
AirDrivenPump%cc1 = 0.1354; AirDrivenPump%cc2 = -2.066; AirDrivenPump%cc3 = -21.09; AirDrivenPump%cc4 = -51.36; AirDrivenPump%cc5 = 5935 ! FOR OUTPUT IN GPM
! cc1 = 4.754e-07; cc2 = -0.0001676; cc3 = -0.03953; cc4 = -2.223; cc5 = 5935 FOR OUTPUT IN IN^3/MIN


Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Qiter=5. !(gpm)
AirPumpLine%Pdownstrem= 4950 !+0.01*Pchoke (psi) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
AirPumpLine%QITER=5. !(gpm)

! Q=0.0003585; true
time=0
tol_air=0.05
alpha_Qair=0
alpha_timeair=0
alpha_Pdownstrem=Pdownstrem
alpha_diffpair=0
alpha_lossesair=0
AirPumpLine%TIME=0
AirPumpLine%TOL_AIR=0.05
AirPumpLine%alpha_Qair=0
AirPumpLine%alpha_timeair=0
AirPumpLine%alpha_Pdownstrem=AirPumpLine%Pdownstrem
AirPumpLine%alpha_diffpair=0
AirPumpLine%alpha_lossesair=0





+ 1
- 1
Equipments/Drawworks/Drawworks_INPUTS.f90 查看文件

@@ -229,7 +229,7 @@ subroutine Drawworks_INPUTS
!===> Closed BOP Rams , No Motion
!if ( PipeRam1_Situation_forTD==1 .or. PipeRam2_Situation_forTD==1 .or. ShearBop_Situation_forTD==1 ) then
if ( ShearBop_Situation_forTD==1 .and. (any(DW_DrillModeCond==(/3,10,19,20,24/))) ) then
if ( RamLine%ShearBop_Situation_forTD==1 .and. (any(DW_DrillModeCond==(/3,10,19,20,24/))) ) then
Drawworks%ManualBreak = 100.d0
Drawworks%N_ref = 0.d0
end if


+ 9
- 9
Equipments/MudSystem/MudSystem.f90 查看文件

@@ -2203,35 +2203,35 @@ module MudSystem
if (ChokeControlPanel%ChokePanelStrokeResetSwitch == 1) then
IF (ChokeControlPanel%ChokePanelPumpSelectorSwitch == 1) THEN
!write(*,*) '1 reset'
TotalStrokes1 =0.
Choke%TotalStrokes1 =0.
elseif (ChokeControlPanel%ChokePanelPumpSelectorSwitch == 2) THEN
!write(*,*) '2 reset'
TotalStrokes2 =0.
Choke%TotalStrokes2 =0.
else
!write(*,*) 'both reset'
TotalStrokes1 =0.
TotalStrokes2 =0.
Choke%TotalStrokes1 =0.
Choke%TotalStrokes2 =0.
endif
endif
!write(*,*) 'b)))' , ChokePanelStrokeResetSwitch
TotalStrokes1= TotalStrokes1+((DataDisplayConsole%MP1SPMGauge)/60.)*DeltaT_Mudline
TotalStrokes2= TotalStrokes2+((DataDisplayConsole%MP2SPMGauge)/60.)*DeltaT_Mudline
Choke%TotalStrokes1= Choke%TotalStrokes1+((DataDisplayConsole%MP1SPMGauge)/60.)*DeltaT_Mudline
Choke%TotalStrokes2= Choke%TotalStrokes2+((DataDisplayConsole%MP2SPMGauge)/60.)*DeltaT_Mudline
IF (ChokeControlPanel%ChokePanelPumpSelectorSwitch == 1) THEN
ChokeControlPanel%ChokePanelSPMCounter = real(nint(DataDisplayConsole%MP1SPMGauge))
ChokeControlPanel%ChokePanelTotalStrokeCounter = real(nint(TotalStrokes1))
ChokeControlPanel%ChokePanelTotalStrokeCounter = real(nint(Choke%TotalStrokes1))
ELSEIF (ChokeControlPanel%ChokePanelPumpSelectorSwitch == 2) THEN
ChokeControlPanel%ChokePanelSPMCounter = real(nint(DataDisplayConsole%MP2SPMGauge))
ChokeControlPanel%ChokePanelTotalStrokeCounter = real(nint(TotalStrokes2))
ChokeControlPanel%ChokePanelTotalStrokeCounter = real(nint(Choke%TotalStrokes2))
ELSE
ChokeControlPanel%ChokePanelSPMCounter= real(nint(DataDisplayConsole%MP1SPMGauge+DataDisplayConsole%MP2SPMGauge))
ChokeControlPanel%ChokePanelTotalStrokeCounter = real(nint(TotalStrokes1+TotalStrokes2))
ChokeControlPanel%ChokePanelTotalStrokeCounter = real(nint(Choke%TotalStrokes1+Choke%TotalStrokes2))
ENDIF
! ChokePanelStrokeResetSwitch = 0


+ 2
- 2
Equipments/MudSystem/MudSystemStartup.f90 查看文件

@@ -251,8 +251,8 @@ ReturnFlowRate=0.
GraphTotalStrokes=0.
TotalStrokes1 =0.
TotalStrokes2 =0.
Choke%TotalStrokes1 =0.
Choke%TotalStrokes2 =0.


+ 5
- 5
FluidFlow/Annulus_and_Openhole_Pressure_Distribution.f90 查看文件

@@ -68,9 +68,9 @@ IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal we
!!!!!!!!!!!!!!!!!!!!!!!!! initial guess flowrates for opening BOP or choke line
IF (WellHeadWasOpen == .FALSE. .AND. NoGasPocket > 0 .AND. KickIteration == 1) THEN
IF (ChokeKroneckerDelta == 1) THEN ! flow on choke line
IF (TotalOpenChokeArea < 0.01 * ChokeAreaFullyOpen) THEN
IF (TotalOpenChokeArea < 0.01 * Choke%ChokeAreaFullyOpen) THEN
WRITE (*,*) 'density , TotalOpenChokeArea' , DownHole%Density, TotalOpenChokeArea
TotalOpenChokeArea = 0.01 * ChokeAreaFullyOpen
TotalOpenChokeArea = 0.01 * Choke%ChokeAreaFullyOpen
END IF
Kchoke = (ChokeDensity / ((2.0 * 89158.0) * (0.26 * 0.61 * TotalOpenChokeArea)**2)) * 4.0 ! *4.d0: seyyed gofte
GasPocketFlowInduced%Array(:) = MIN((0.6 / NoGasPocket * SQRT(PressureGauges(2) / Kchoke)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt))
@@ -91,7 +91,7 @@ IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal we
ELSE ! flow through bell nipple
k = NoHorizontalEl + NoStringEl + NoAnnulusEl
KBOP = FlowEl(AnnulusLastEl)%Density / ((2.0 * 89158.0) * (0.26 * 0.61 * MinimumOpenArea_InBOP)**2)
KBOP = FlowEl(AnnulusLastEl)%Density / ((2.0 * 89158.0) * (0.26 * 0.61 * ShearRam%MinimumOpenArea_InBOP)**2)
GasPocketFlowInduced%Array(:) = MIN((0.1 / NoGasPocket * SQRT(PressureGauges(6) / KBOP)) , (0.05 * GasPocketNewVol%Array(:) * ConvFt3toUSgal / 60 / dt))
WRITE (*,*) 'PressureGauges(6), KBOP', PressureGauges(6), KBOP
WRITE (*,*) 'Initial guess after opening BOP =', GasPocketFlowInduced%Array(1)
@@ -161,9 +161,9 @@ IF (WellHeadOpen .OR. NoGasPocket == 0) THEN !! (mud circulation is normal we
!!!!!!!!!!!!!!!!!!!!!!!!! when flow passes through choke manifold, solution process may be unstable
IF (ChokeKroneckerDelta == 1) THEN ! thus we should stabilize solution
IF (TotalOpenChokeArea > 0.5 * ChokeAreaFullyOpen) THEN
IF (TotalOpenChokeArea > 0.5 * Choke%ChokeAreaFullyOpen) THEN
KickCorrectionUnderRelaxation = 0.6
ELSE IF (TotalOpenChokeArea > 0.1 * ChokeAreaFullyOpen) THEN
ELSE IF (TotalOpenChokeArea > 0.1 * Choke%ChokeAreaFullyOpen) THEN
KickCorrectionUnderRelaxation = 0.5
ELSE ! TotalOpenChokeArea < 0.1 * ChokeAreaFullyOpen
KickCorrectionUnderRelaxation = 0.4


+ 1
- 1
FluidFlow/Flow_Startup.f90 查看文件

@@ -53,7 +53,7 @@ SUBROUTINE FlowStartup
KickWasExitingThroughChoke = .FALSE.
FloatValveOpen = .TRUE.
ChokeAreaFullyOpen = 123.0 / 64.0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2
Choke%ChokeAreaFullyOpen = 123.0 / 64.0 ! fully open area is 123/64 in^2 = 0.01334635 ft^2
ChokeBypassArea = PI / 4.0 * BopStackSpecification%ChokeLineId**2
BHPSafetyMargin = 150.0
AChBHPTol = 15.0


+ 1
- 1
FluidFlow/Horizontal_and_String_Pressure_Distribution.f90 查看文件

@@ -308,7 +308,7 @@ SUBROUTINE PressureHorizAndStringDistribution
!!!!!!!!!!!!!!!!!!!!! Pressure distribution in string and horizontal pump to string line
IF (ShearBop_Situation_forTD == 1) THEN
IF (RamLine%ShearBop_Situation_forTD == 1) THEN
FlowEl(1 : NoHorizontalEl)%EndPress = 0.0
FlowEl(1 : NoHorizontalEl)%StartPress = 0.0
FlowEl(1 : NoHorizontalEl)%FricPressLoss = 0.0


+ 6
- 6
FluidFlow/Well_Pressure_Data_Transfer.f90 查看文件

@@ -341,10 +341,10 @@ SUBROUTINE WellPressureDataTransfer
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
OpenArea32 = ((ChokeManifold%LeftManualChoke * (1.0 - ManChoke1Plug * REAL(ChokeProblems%ManualChoke1PluggedPercent)) / 100.0) + 0.5 * ManChoke1Washout) * ChokeAreaFullyOpen
OpenArea32 = ((ChokeManifold%LeftManualChoke * (1.0 - ManChoke1Plug * REAL(ChokeProblems%ManualChoke1PluggedPercent)) / 100.0) + 0.5 * ManChoke1Washout) * Choke%ChokeAreaFullyOpen
OpenArea33 = CHOOKE(1)%AreaChokeFinal * Convfttoinch**2 ! (1.d0 - CHOOKE(1)%PercentClose) * ChokeAreaFullyOpen
OpenArea34 = CHOOKE(2)%AreaChokeFinal * Convfttoinch**2 ! (1.d0 - CHOOKE(2)%PercentClose) * ChokeAreaFullyOpen
OpenArea35 = ((ChokeManifold%RightManualChoke * (1.0 - ManChoke2Plug * REAL(ChokeProblems%ManualChoke2PluggedPercent)) / 100.0) + 0.5 * ManChoke2Washout) * ChokeAreaFullyOpen
OpenArea35 = ((ChokeManifold%RightManualChoke * (1.0 - ManChoke2Plug * REAL(ChokeProblems%ManualChoke2PluggedPercent)) / 100.0) + 0.5 * ManChoke2Washout) * Choke%ChokeAreaFullyOpen
!write(*,*) 'OpenArea32=' , OpenArea32, active32, ManChoke1Plug, ManualChoke1PluggedPercent, ManChoke1Washout
!write(*,*) 'OpenArea33=' , OpenArea33, active33
!write(*,*) 'OpenArea34=' , OpenArea34, active34, !HydraulicChoke2PluggedPercent
@@ -352,13 +352,13 @@ SUBROUTINE WellPressureDataTransfer
InstantaneousTotalOpenChokeArea = OpenArea32 * active32 + OpenArea33 * active33 + OpenArea34 * active34 + OpenArea35 * active35 + ChokeBypassArea * active29
OldTotalOpenChokeArea = TotalOpenChokeArea
!WRITE (*,*) 'Instantaneous / Old TotalOpenChokeArea', InstantaneousTotalOpenChokeArea, OldTotalOpenChokeArea
IF (OldTotalOpenChokeArea <= 0.01 * ChokeAreaFullyOpen) OldTotalOpenChokeArea = 0.01 * ChokeAreaFullyOpen
IF (InstantaneousTotalOpenChokeArea <= 0.01 * ChokeAreaFullyOpen) THEN
IF (OldTotalOpenChokeArea <= 0.01 * Choke%ChokeAreaFullyOpen) OldTotalOpenChokeArea = 0.01 * Choke%ChokeAreaFullyOpen
IF (InstantaneousTotalOpenChokeArea <= 0.01 * Choke%ChokeAreaFullyOpen) THEN
WellToChokeManifoldOpen = .FALSE.
OldTotalOpenChokeArea = 0.01 * ChokeAreaFullyOpen
OldTotalOpenChokeArea = 0.01 * Choke%ChokeAreaFullyOpen
!WRITE (*,*) ' Choke Controler Here 2'
ELSE IF (InstantaneousTotalOpenChokeArea > 0.5 * ChokeAreaFullyOpen .OR. WelltoPitsOpen) THEN
ELSE IF (InstantaneousTotalOpenChokeArea > 0.5 * Choke%ChokeAreaFullyOpen .OR. WelltoPitsOpen) THEN
! mud flows through well to bell nipple, or choke is rather open
TotalOpenChokeArea = InstantaneousTotalOpenChokeArea
!WRITE (*,*) ' Choke Controler Here 1'


+ 4
- 4
TorqueDrag/TD_DrillingSubs/TD_BOPDiamCalculation.f90 查看文件

@@ -31,10 +31,10 @@ subroutine TD_BOPDiamCalculation
TD_BOPHeight(4) = BopStackSpecification%LowerRamHeight
TD_BOPRamDiam(1) = IDAnnularfinal
TD_BOPRamDiam(2) = IDPipeRam1final
TD_BOPRamDiam(3) = IDshearBopfinal
TD_BOPRamDiam(4) = IDPipeRam2final
TD_BOPRamDiam(1) = ShearRam%IDAnnularFinal
TD_BOPRamDiam(2) = ShearRam%IDPipeRam1Final
TD_BOPRamDiam(3) = ShearRam%IDshearBopFinal
TD_BOPRamDiam(4) = ShearRam%IDPipeRam2Final


+ 10
- 10
TorqueDrag/TD_Forces/TD_HookLoadCalculation.f90 查看文件

@@ -32,30 +32,30 @@ subroutine TD_HookLoadCalculation
!print* , 'TD_HookLoad1=' , TD_HookLoad
if ( Drawworks%motion==1 ) then
if ( PipeRam1_Situation_forTD==1 ) then !Upper Ram
if ( PipeRam1%Situation_forTD==1 ) then !Upper Ram
TD_HookLoad = TD_HookLoad+BopStackSpecification%RamStringDrag
end if
if ( PipeRam2_Situation_forTD==1 ) then !Lower Ram
if ( PipeRam2%Situation_forTD==1 ) then !Lower Ram
TD_HookLoad = TD_HookLoad+BopStackSpecification%RamStringDrag
end if
if ( ShearBop_Situation_forTD==1 ) then !Blind Ram
if ( RamLine%ShearBop_Situation_forTD==1 ) then !Blind Ram
TD_HookLoad = TD_HookLoad+BopStackSpecification%RamStringDrag !????????????????????
end if
if ( Annular_Situation_forTD==1 ) then !Annular Preventer
TD_HookLoad = TD_HookLoad+(p_annular*BopStackSpecification%AnnularStringDrag)
if ( Annular%Annular_Situation_forTD==1 ) then !Annular Preventer
TD_HookLoad = TD_HookLoad+(AnnularComputational%p_annular*BopStackSpecification%AnnularStringDrag)
end if
else if ( Drawworks%motion==-1 ) then
if ( PipeRam1_Situation_forTD==1 ) then !Upper Ram
if ( PipeRam1%Situation_forTD==1 ) then !Upper Ram
TD_HookLoad = TD_HookLoad-BopStackSpecification%RamStringDrag
end if
if ( PipeRam2_Situation_forTD==1 ) then !Lower Ram
if ( PipeRam2%Situation_forTD==1 ) then !Lower Ram
TD_HookLoad = TD_HookLoad-BopStackSpecification%RamStringDrag
end if
if ( ShearBop_Situation_forTD==1 ) then !Blind Ram
if ( RamLine%ShearBop_Situation_forTD==1 ) then !Blind Ram
TD_HookLoad = TD_HookLoad-BopStackSpecification%RamStringDrag !????????????????????
end if
if ( Annular_Situation_forTD==1 ) then !Annular Preventer
TD_HookLoad = TD_HookLoad-(p_annular*BopStackSpecification%AnnularStringDrag)
if ( Annular%Annular_Situation_forTD==1 ) then !Annular Preventer
TD_HookLoad = TD_HookLoad-(AnnularComputational%p_annular*BopStackSpecification%AnnularStringDrag)
end if
end if


Loading…
取消
儲存