module ChokeModule 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 !=========================================================================== !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 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ! display monitor ELSE ! Choke2LED==1 ChokeControlPanel%ChokePosition= (1 - Choke%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 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 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 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 - 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 Choke%Plug1TimeCounter= Choke%Plug1TimeCounter + 1 Choke%HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent if (Choke%Plug1TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800 Choke%Present_HydraulicChoke1Plug = Choke%Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((Choke%DeltaPlug1Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0 endif !write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug ENDIF IF (CHOOKE(2)%PlugMalf == 1) THEN Choke%Present_HydraulicChoke2Plug= Choke%Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf ! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay ! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent if ( (ChokeProblems%HydraulicChoke2PluggedPercent - Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then Choke%DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Choke%Present_HydraulicChoke2Plug Choke%Plug2TimeCounter = 0 endif Choke%Plug2TimeCounter= Choke%Plug2TimeCounter + 1 Choke%HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent if (Choke%Plug2TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=1800 Choke%Present_HydraulicChoke2Plug = Choke%Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((Choke%DeltaPlug2Percent / real(Choke%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*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* Choke%Present_HydraulicChoke1Plug *CHOOKE(1)%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 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/(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 !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 ChokeModule