SUBROUTINE DEALLOCATE_ARRAYS_CHOKE() USE CHOKEVARIABLES implicit none write(*,*) 'deallocateeeeeeeeeeeee' !=========================================================================== ! AIR PUMP LOSSES INPUT !=========================================================================== !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 (MINORS_AIRPUMP,MINORDIAM_AIR_INCH, & MINORAREA_AIR,LF_AIR,CV_AIR,NOTE_AIR & ,minlosspa_air,minloss_air) END SUBROUTINE LOSS_INPUTS_CHOKE() USE CHOKEVARIABLES implicit none Integer I !=========================================================================== ! AIR PUMP LOSSES INPUT !=========================================================================== NO_PIPINGS_AIRPLINE=1 ALLOCATE (PIPINGS_AIRPUMP(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 !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)) 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) 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) !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m) LENGT_AIR(I)=LENGT_AIR(I)*.001 ! (m) ENDDO !================================================================ NO_MINORS_AIRPLINE=6 ALLOCATE (MINORS_AIRPUMP(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 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)) 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) MINORAREA_AIR(I)=PI*(MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m) ENDDO END SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER) USE CHOKEVARIABLES implicit none INTEGER CHNUMBER Integer I loop3: do while (ABS(ChokeControlLever)==1.0 .AND. ChokePanelRigAirSwitch == 1 .AND. CHOOKE(CHNUMBER)%FailMalf==0 .AND. ChokeAirFail==0) if (ChokeControlLever == 1.0) then CHOOKE(CHNUMBER)%ChokeIsClosing = .true. CHOOKE(CHNUMBER)%ChokeIsOpening = .false. endif if (ChokeControlLever == -1.0) then CHOOKE(CHNUMBER)%ChokeIsOpening = .true. CHOOKE(CHNUMBER)%ChokeIsClosing = .false. endif time=time+DeltaT_Choke !overal time (s) !==================================================== ! ******************************** call airpump_code_CHOKE(CHNUMBER) ! ************************* !==================================================== call sleepqq(100) if (IsStopped == .true.) return end do loop3 !while finished_Choke==0 end SUBROUTINE airpump_code_CHOKE(CHNUMBER) USE CHOKEVARIABLES USE CChokeManifoldVariables use CSounds USE CChokeProblemsVariables implicit none Integer I INTEGER CHNUMBER QAIR_PUMP=Qiter+.1 !(gpm) maximum flow for the start diffp_air=-10 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; !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) ! 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 end do !returns Qup do while (abs((diffp_air-losses_air)/diffp_air)>tol_air) !finding correct QAIR_pump for 1 timecounter_ram if (diffp_air-losses_air>0) then QAIR_PUMP=QAIR_PUMP+.005 else QAIR_PUMP=QAIR_PUMP-.005 endif !=================================================================== ! AIR OPERATED PUMP ! 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) !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 !===========================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) enddo do i=1,NO_PIPINGS_AIRPLINE if (Re_air(i) 1.0 ) then SoundChokePump= 60 Cumulative_AirVolume_Choke= Cumulative_AirVolume_Choke - 1.0 else 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) 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)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse - (deltav_air*3785.412/Acylinder)!*(ChokeRateControlKnob/10.) !DeltaT_Choke= 1sec or 2sec !((((((((IN OUTER LOOP)))))) !===============AIR PUMP OUTPUTS========================= alpha_timeair=time ! overal time (s) alpha_Pdownstrem=Pdownstrem alpha_pairp=p_airp alpha_Qair=QAIR_PUMP !write(*,*) 'diffp_air=',diffp_air !pause alpha_diffpair=diffp_air alpha_lossesair=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 endif if (CHOOKE(CHNUMBER)%ChokeIsOpening .AND. CHOOKE(CHNUMBER)%PassedCourse<0.) then CHOOKE(CHNUMBER)%PassedCourse=0. SoundChokePump= 0.0 endif call SetSoundChokePump(SoundChokePump) CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/CourseBase IF (Choke1LED==1) THEN ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ELSE ! Choke2LED==1 ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10 ENDIF !CALL SetHydraulicChock1(nint(MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)*100)) ! CALL SetHydraulicChock2(nint(MIN(CHOOKE(2)%PercentClose / 0.91 , 1.0)*100)) ! .91 >> 9 percent clearance ! =================== 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/(60.0/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 !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=600 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=600 Present_HydraulicChoke2Plug = Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((DeltaPlug2Percent / real(ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.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 !write(*,*) 'CHOOKE(1)%AreaChoke= ' , CHOOKE(1)%AreaChoke ! WRITE(150,50) alpha_timeair,alpha_Qair,alpha_pairp, & ! alpha_Pdownstrem,alpha_diffpair,alpha_lossesair,CHOOKE(CHNUMBER)%PassedCourse !50 FORMAT(7(f15.5)) !======================================================================================== !======================================================================================== ! write(*,*) PassedCourse end