SUBROUTINE DEALLOCATE_ARRAYS_CHOKE() USE CHOKEVARIABLES implicit none write(*,*) 'deallocateeeeeeeeeeeee' !=========================================================================== ! AIR PUMP LOSSES INPUT !=========================================================================== !if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP) 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 (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 SUBROUTINE LOSS_INPUTS_CHOKE() USE CHOKEVARIABLES implicit none Integer I !=========================================================================== ! AIR PUMP LOSSES INPUT !=========================================================================== AirPumpLine%NO_PIPINGS_AIRPLINE=1 ALLOCATE (AirPumpLine%PIPINGS_AIRPUMP(AirPumpLine%NO_PIPINGS_AIRPLINE,3)) ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance !60960= 200 ft 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,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) 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) AirPumpLine%LENGT_AIR(I)=AirPumpLine%LENGT_AIR(I)*.001 ! (m) ENDDO !================================================================ AirPumpLine%NO_MINORS_AIRPLINE=6 ALLOCATE (AirPumpLine%MINORS_AIRPUMP(AirPumpLine%NO_MINORS_AIRPLINE,4)) ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION 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 (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,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) AirPumpLine%MINORAREA_AIR(I)=PI*(AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m) ENDDO END SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER) USE CHOKEVARIABLES Use CSimulationVariables implicit none INTEGER CHNUMBER Integer I 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. endif if (ChokeControlPanel%ChokeControlLever == -1.0) then CHOOKE(CHNUMBER)%ChokeIsOpening = .true. CHOOKE(CHNUMBER)%ChokeIsClosing = .false. endif AirPumpLine%TIME=AirPumpLine%TIME+AirPumpLine%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 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 (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 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) AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem end do !returns Qup do while (abs((AirPumpLine%diffp_air-AirPumpLine%losses_air)/AirPumpLine%diffp_air)>AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram if (AirPumpLine%diffp_air-AirPumpLine%losses_air>0) then AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP+.005 else AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.005 endif !=================================================================== ! AIR OPERATED PUMP ! MODEL 10-6000W030 RATIO 55:1 !=================for air consumption at 100 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) AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem !===========================LOSSES==================================== 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,AirPumpLine%NO_PIPINGS_AIRPLINE if (AirPumpLine%Re_air(i) 1.0 ) then Choke%SoundChokePump= 60 Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke - 1.0 else 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 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 + (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 - (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.) !DeltaT_Choke= 1sec or 2sec !((((((((IN OUTER LOOP)))))) !===============AIR PUMP OUTPUTS========================= 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 AirPumpLine%alpha_diffpair=AirPumpLine%diffp_air AirPumpLine%alpha_lossesair=AirPumpLine%losses_air !======================================================== !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT') 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. Choke%SoundChokePump= 0.0 endif call SetSoundChokePump(Choke%SoundChokePump) CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/AirPumpLine%CourseBase IF (ChokeControlPanel%Choke1LED==1) THEN ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10 ELSE ! Choke2LED==1 ChokeControlPanel%ChokePosition= (1 - Choke%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 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 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 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=600 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=600 Choke%Present_HydraulicChoke2Plug = Choke%Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((Choke%DeltaPlug2Percent / real(Choke%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*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 !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