module choke USE CHOKEVARIABLES !USE CDataDisplayConsoleVariables, CasingPressureDataDisplay=>CasingPressure!, StandPipePressureDataDisplay=>StandPipePressure USE CChokeProblemsVariables !use CChokeControlPanelVariables, StandPipePressureChoke=>StandPipePressure use MudSystemVARIABLES USE CChokeManifoldVariables contains subroutine CHOKE_MainBody implicit none Integer I INTEGER CHNUMBER ! time2=time2+0.1 !=========================================================================== !StandPipePressureChoke= STGauge_Pressure ! from module mud system ! CasingPressure = CasingPressureDataDisplay !=========================================================================== ! ! HYDRAULIC CHOKE CONTROL ! !=========================================================================== IF(ChokeControlPanel%ChokeSelectorSwitch== 1) THEN ChokeControlPanel%Choke1LED=1 ChokeControlPanel%Choke2LED=0 CHNUMBER=1 ELSE ChokeControlPanel%Choke2LED=1 ChokeControlPanel%Choke1LED=0 CHNUMBER=2 ENDIF if (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. (CHOOKE(1)%FailMalf==0 .OR. CHOOKE(2)%FailMalf==0)) then CALL PIPE_RAMS_CHOKE(CHNUMBER) end if IF (ChokeControlPanel%Choke1LED==1) THEN ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ! display monitor ELSE ! Choke2LED==1 ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10 ! display monitor ENDIF ! =================== calculating Area ! AreaChoke=0.5 ! .91 >> 9 percent clearance CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2) CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2 !write(*,*) 'CHOOKE(1)%AreaChoke= ' , CHOOKE(1)%AreaChoke 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 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 !write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef IF (CHOOKE(1)%PlugMalf == 1) THEN Present_HydraulicChoke1Plug= Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf ! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay ! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent !write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent if ( (HydraulicChoke1PluggedPercent - HydraulicChoke1PluggedPercent_Old) /= 0) then DeltaPlug1Percent = (REAL(HydraulicChoke1PluggedPercent)/100.) - Present_HydraulicChoke1Plug Plug1TimeCounter = 0 !write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug endif Plug1TimeCounter= Plug1TimeCounter + 1 HydraulicChoke1PluggedPercent_Old= HydraulicChoke1PluggedPercent if (Plug1TimeCounter <= ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800 Present_HydraulicChoke1Plug = Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((DeltaPlug1Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 endif !write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug ENDIF IF (CHOOKE(2)%PlugMalf == 1) THEN Present_HydraulicChoke2Plug= Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf ! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay ! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent if ( (HydraulicChoke2PluggedPercent - HydraulicChoke2PluggedPercent_Old) /= 0 ) then DeltaPlug2Percent = (REAL(HydraulicChoke2PluggedPercent)/100.) - Present_HydraulicChoke2Plug Plug2TimeCounter = 0 endif Plug2TimeCounter= Plug2TimeCounter + 1 HydraulicChoke2PluggedPercent_Old= HydraulicChoke2PluggedPercent if (Plug2TimeCounter <= ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800 Present_HydraulicChoke2Plug = Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((DeltaPlug2Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 1800.0 endif ENDIF ! 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 !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(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 !write(*,*) 'CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke=' ,CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke CHOOKE(1)%AreaChokeFinal= CHOOKE(1)%AreaChoke 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 !write(*,*) 'CHOOKE(1)%PercentClose=' , CHOOKE(1)%PercentClose ! close percent 0 to 100 !write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display !write(*,*) 'CHOOKE(1)%AreaChokeFinal=' , CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance !write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.) !write(*,*) 'valve value=' , 100 - nint((CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance !write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close ! =================== calculating Area !AreaChoke= CHOOKE(1)%AreaChoke !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< badan moteghayer 1 ya 2 shavad ! write(*,*) 'AreaChoke:',AreaChoke !=========================================================================== ! MUD PUMP STROKES ! & TOTAL STROKE- CHOKE CONTROL PANEL !=========================================================================== !************************* IN MUD SYSTEM MODULE************************* end subroutine CHOKE_MainBody end module CHOKE