|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
-
- 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(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. CHOOKE(CHNUMBER)%FailMalf==0 .AND. 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
-
-
-
- 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)<Re_cr) then
- fric_air(i)=64/Re_air(i)
- else
- fric_air(i)=1/(-1.8*log10((rel_roughair(i)/3.7)**1.11+6.9/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
-
- enddo
-
-
-
-
- pipe_loss1air=sum(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)
- else
- minlosspa_air(i)=NOTE_air(i)*1e5 !(pa)
- minloss_air(i)=minlosspa_air(i)/6895 !(psi)
- endif
- enddo
-
-
- minor_loss1air=sum(minloss_air) !loss before regulator(psi)
-
- static_loss1air=0
-
- losses_air=pipe_loss1air+minor_loss1air+static_loss1air !(psi)
- !=========================================================================
-
-
- end do !returns correct QAIR_PUMP for 1 counter
-
-
-
-
- Qiter=QAIR_PUMP
- QAIR_PUMP=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
-
-
- if ( Cumulative_AirVolume_Choke > 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 (ChokeControlPanel%Choke1LED==1) THEN
- ChokeControlPanel%ChokePosition= (1 - GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10
- ELSE ! Choke2LED==1
- ChokeControlPanel%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
|