Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AirPump_Choke_Subs.f90 19 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. SUBROUTINE DEALLOCATE_ARRAYS_CHOKE()
  2. USE CHOKEVARIABLES
  3. implicit none
  4. write(*,*) 'deallocateeeeeeeeeeeee'
  5. !===========================================================================
  6. ! AIR PUMP LOSSES INPUT
  7. !===========================================================================
  8. !if(allocated(PIPINGS_AIRPUMP)) deallocate(PIPINGS_AIRPUMP)
  9. DEALLOCATE (AirPumpLine%PIPINGS_AIRPUMP,AirPumpLine%DIAM_AIR_INCH, &
  10. AirPumpLine%Re_air,AirPumpLine%AREA_AIR,AirPumpLine%LENGT_AIR,AirPumpLine%ROUGHNESS_AIRPLINE,AirPumpLine%REL_ROUGHAIR, &
  11. AirPumpLine%fric_air,AirPumpLine%fricloss_air)
  12. !================================================================
  13. DEALLOCATE (AirPumpLine%MINORS_AIRPUMP,AirPumpLine%MINORDIAM_AIR_INCH, &
  14. AirPumpLine%MINORAREA_AIR,AirPumpLine%LF_AIR,AirPumpLine%CV_AIR,AirPumpLine%NOTE_AIR &
  15. ,AirPumpLine%minlosspa_air,AirPumpLine%minloss_air)
  16. END
  17. SUBROUTINE LOSS_INPUTS_CHOKE()
  18. USE CHOKEVARIABLES
  19. implicit none
  20. Integer I
  21. !===========================================================================
  22. ! AIR PUMP LOSSES INPUT
  23. !===========================================================================
  24. AirPumpLine%NO_PIPINGS_AIRPLINE=1
  25. ALLOCATE (AirPumpLine%PIPINGS_AIRPUMP(AirPumpLine%NO_PIPINGS_AIRPLINE,3))
  26. ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION
  27. AirPumpLine%PIPINGS_AIRPUMP(1,1:3)= (/0.5, 60960., 0.03/) !Avg.acc.distance
  28. !60960= 200 ft
  29. ALLOCATE (AirPumpLine%DIAM_AIR_INCH(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%Re_air(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%AREA_AIR(AirPumpLine%NO_PIPINGS_AIRPLINE), &
  30. AirPumpLine%LENGT_AIR(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%ROUGHNESS_AIRPLINE(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%REL_ROUGHAIR(AirPumpLine%NO_PIPINGS_AIRPLINE), &
  31. AirPumpLine%fric_air(AirPumpLine%NO_PIPINGS_AIRPLINE),AirPumpLine%fricloss_air(AirPumpLine%NO_PIPINGS_AIRPLINE))
  32. DO I=1,AirPumpLine%NO_PIPINGS_AIRPLINE
  33. AirPumpLine%DIAM_AIR_INCH(I)=AirPumpLine%PIPINGS_AIRPUMP(I,1)
  34. AirPumpLine%LENGT_AIR(I)=AirPumpLine%PIPINGS_AIRPUMP(I,2)
  35. AirPumpLine%ROUGHNESS_AIRPLINE(I)=AirPumpLine%PIPINGS_AIRPUMP(I,3)
  36. AirPumpLine%AREA_AIR(I)=PI*(AirPumpLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m)
  37. AirPumpLine%REL_ROUGHAIR(I)=AirPumpLine%ROUGHNESS_AIRPLINE(I)/(AirPumpLine%DIAM_AIR_INCH(I)*25.4)
  38. !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m)
  39. AirPumpLine%LENGT_AIR(I)=AirPumpLine%LENGT_AIR(I)*.001 ! (m)
  40. ENDDO
  41. !================================================================
  42. AirPumpLine%NO_MINORS_AIRPLINE=6
  43. ALLOCATE (AirPumpLine%MINORS_AIRPUMP(AirPumpLine%NO_MINORS_AIRPLINE,4))
  44. ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION
  45. AirPumpLine%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee
  46. AirPumpLine%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow
  47. AirPumpLine%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter
  48. AirPumpLine%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve
  49. AirPumpLine%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve
  50. AirPumpLine%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA
  51. ALLOCATE (AirPumpLine%MINORDIAM_AIR_INCH(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%MINORAREA_AIR(AirPumpLine%NO_MINORS_AIRPLINE), &
  52. AirPumpLine%LF_AIR(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%CV_AIR(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%NOTE_AIR(AirPumpLine%NO_MINORS_AIRPLINE) &
  53. ,AirPumpLine%minlosspa_air(AirPumpLine%NO_MINORS_AIRPLINE),AirPumpLine%minloss_air(AirPumpLine%NO_MINORS_AIRPLINE))
  54. DO I=1,AirPumpLine%NO_MINORS_AIRPLINE
  55. AirPumpLine%MINORDIAM_AIR_INCH(I)=AirPumpLine%MINORS_AIRPUMP(I,1)
  56. AirPumpLine%LF_AIR(I)=AirPumpLine%MINORS_AIRPUMP(I,2)
  57. AirPumpLine%CV_AIR(I)=AirPumpLine%MINORS_AIRPUMP(I,3)
  58. AirPumpLine%NOTE_AIR(I)=AirPumpLine%MINORS_AIRPUMP(I,4)
  59. AirPumpLine%MINORAREA_AIR(I)=PI*(AirPumpLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m)
  60. ENDDO
  61. END
  62. ! SUBROUTINE PIPE_RAMS_CHOKE(CHNUMBER)
  63. ! USE CHOKEVARIABLES
  64. ! Use CSimulationVariables
  65. ! implicit none
  66. ! INTEGER CHNUMBER
  67. ! Integer I
  68. ! loop3: do while (ABS(ChokeControlPanel%ChokeControlLever)==1.0 .AND. ChokeControlPanel%ChokePanelRigAirSwitch == 1 .AND. CHOOKE(CHNUMBER)%FailMalf==0 .AND. AirDrivenPump%ChokeAirFail==0)
  69. ! if (ChokeControlPanel%ChokeControlLever == 1.0) then
  70. ! CHOOKE(CHNUMBER)%ChokeIsClosing = .true.
  71. ! CHOOKE(CHNUMBER)%ChokeIsOpening = .false.
  72. ! endif
  73. ! if (ChokeControlPanel%ChokeControlLever == -1.0) then
  74. ! CHOOKE(CHNUMBER)%ChokeIsOpening = .true.
  75. ! CHOOKE(CHNUMBER)%ChokeIsClosing = .false.
  76. ! endif
  77. ! AirPumpLine%TIME=AirPumpLine%TIME+AirPumpLine%DeltaT_Choke !overal time (s)
  78. ! call airpump_code_CHOKE(CHNUMBER)
  79. ! call sleepqq(100)
  80. ! if (IsStopped == .true.) return
  81. ! end do loop3 !while finished_Choke==0
  82. ! end
  83. SUBROUTINE airpump_code_CHOKE(CHNUMBER)
  84. USE CHOKEVARIABLES
  85. USE CChokeManifoldVariables
  86. use CSounds
  87. USE CChokeProblemsVariables
  88. implicit none
  89. Integer I
  90. INTEGER CHNUMBER
  91. AirDrivenPump%QAIR_PUMP=AirPumpLine%QITER+.1 !(gpm) maximum flow for the start
  92. AirPumpLine%diffp_air=-10
  93. AirPumpLine%losses_air=10
  94. !===================================================================
  95. ! AIR OPERATED PUMP
  96. ! MODEL 10-6000W030 RATIO 55:1
  97. !=================for air consumption at 100 psig===================
  98. do while (AirPumpLine%diffp_air<0)
  99. AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.1
  100. ! Qup=AirDrivenPump%QAIR_PUMP;
  101. !cc1 = 1354; cc2 = -2066; cc3 = -2109; cc4 = -513.6; cc5 = 5935 FOR OUTPUT IN GPM
  102. 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)
  103. ! kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)
  104. AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem
  105. end do !returns Qup
  106. do while (abs((AirPumpLine%diffp_air-AirPumpLine%losses_air)/AirPumpLine%diffp_air)>AirPumpLine%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram
  107. if (AirPumpLine%diffp_air-AirPumpLine%losses_air>0) then
  108. AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP+.005
  109. else
  110. AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP-.005
  111. endif
  112. !===================================================================
  113. ! AIR OPERATED PUMP
  114. ! MODEL 10-6000W030 RATIO 55:1
  115. !=================for air consumption at 100 psig===================
  116. 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)
  117. !kinetic_air=sg*wdens*(QAIR_PUMP*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)
  118. AirPumpLine%diffp_air= AirPumpLine%P_AIRP - AirPumpLine%Pdownstrem
  119. !===========================LOSSES====================================
  120. do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
  121. AirPumpLine%Re_air(i)=AirDrivenPump%QAIR_PUMP*6.30902e-005*AirPumpLine%DIAM_AIR_INCH(I)*0.0254/(AirPumpLine%AREA_AIR(i)*nu)
  122. enddo
  123. do i=1,AirPumpLine%NO_PIPINGS_AIRPLINE
  124. if (AirPumpLine%Re_air(i)<Re_cr) then
  125. AirPumpLine%fric_air(i)=64/AirPumpLine%Re_air(i)
  126. else
  127. AirPumpLine%fric_air(i)=1/(-1.8*log10((AirPumpLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/AirPumpLine%Re_air(i)))**2
  128. endif
  129. AirPumpLine%fricloss_air(i)=((AirPumpLine%fric_air(i)*(wdens*sg*AirPumpLine%LENGT_AIR(i)*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%AREA_AIR(i))**2))/(2*AirPumpLine%DIAM_AIR_INCH(I)*0.0254))/6895
  130. enddo
  131. AirPumpLine%pipe_loss1air=sum(AirPumpLine%fricloss_air) !loss before regulator(psi)
  132. do i=1,AirPumpLine%NO_MINORS_AIRPLINE
  133. if (AirPumpLine%LF_AIR(i)/=0) then
  134. AirPumpLine%minlosspa_air(i)=AirPumpLine%LF_AIR(i)*wdens*sg*(AirDrivenPump%QAIR_PUMP*6.30902e-005/AirPumpLine%MINORAREA_AIR(i))**2/2 !(Pa)
  135. AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
  136. elseif (AirPumpLine%CV_AIR(i)/=0) then
  137. AirPumpLine%minlosspa_air(i)=1000*sg*((11.7*AirDrivenPump%QAIR_PUMP*6.30902e-005*3600)/(AirPumpLine%CV_AIR(i)))**2 !(pa)
  138. AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
  139. else
  140. AirPumpLine%minlosspa_air(i)=AirPumpLine%NOTE_AIR(i)*1e5 !(pa)
  141. AirPumpLine%minloss_air(i)=AirPumpLine%minlosspa_air(i)/6895 !(psi)
  142. endif
  143. enddo
  144. AirPumpLine%minor_loss1air=sum(AirPumpLine%minloss_air) !loss before regulator(psi)
  145. AirPumpLine%static_loss1air=0
  146. AirPumpLine%losses_air=AirPumpLine%pipe_loss1air+AirPumpLine%minor_loss1air+AirPumpLine%static_loss1air !(psi)
  147. !=========================================================================
  148. end do !returns correct QAIR_PUMP for 1 counter
  149. AirPumpLine%QITER=AirDrivenPump%QAIR_PUMP
  150. AirDrivenPump%QAIR_PUMP=AirDrivenPump%QAIR_PUMP*(ChokeControlPanel%ChokeRateControlKnob/10.) ! final Q (gpm)
  151. Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke + ((AirDrivenPump%QAIR_PUMP * AirPumpLine%DeltaT_Choke / 60.0 ) / (1.5*0.004329004) ) ! =strokes
  152. if ( Choke%Cumulative_AirVolume_Choke > 1.0 ) then
  153. Choke%SoundChokePump= 60
  154. Choke%Cumulative_AirVolume_Choke= Choke%Cumulative_AirVolume_Choke - 1.0
  155. else
  156. Choke%SoundChokePump= 0.0
  157. endif
  158. AirPumpLine%DELTAV_AIR=AirDrivenPump%QAIR_PUMP*AirPumpLine%DeltaT_Choke/60 !(galon) delta_t=1sec , Q(gpm)
  159. 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
  160. if (CHOOKE(CHNUMBER)%ChokeIsOpening) CHOOKE(CHNUMBER)%PassedCourse=CHOOKE(CHNUMBER)%PassedCourse - (AirPumpLine%DELTAV_AIR*3785.412/AirPumpLine%Acylinder)!*(ChokeRateControlKnob/10.)
  161. !DeltaT_Choke= 1sec or 2sec
  162. !((((((((IN OUTER LOOP))))))
  163. !===============AIR PUMP OUTPUTS=========================
  164. AirPumpLine%alpha_timeair=AirPumpLine%TIME ! overal time (s)
  165. AirPumpLine%alpha_Pdownstrem=AirPumpLine%Pdownstrem
  166. AirPumpLine%alpha_pairp=AirPumpLine%P_AIRP
  167. AirPumpLine%alpha_Qair=AirDrivenPump%QAIR_PUMP
  168. !write(*,*) 'diffp_air=',diffp_air
  169. !pause
  170. AirPumpLine%alpha_diffpair=AirPumpLine%diffp_air
  171. AirPumpLine%alpha_lossesair=AirPumpLine%losses_air
  172. !========================================================
  173. !OPEN(150,FILE='CHOKE_AIRPUMP_OUTPUTS.DAT')
  174. if (CHOOKE(CHNUMBER)%ChokeIsClosing .AND. CHOOKE(CHNUMBER)%PassedCourse>AirPumpLine%CourseBase) then
  175. CHOOKE(CHNUMBER)%PassedCourse=AirPumpLine%CourseBase
  176. Choke%SoundChokePump= 0.0
  177. endif
  178. if (CHOOKE(CHNUMBER)%ChokeIsOpening .AND. CHOOKE(CHNUMBER)%PassedCourse<0.) then
  179. CHOOKE(CHNUMBER)%PassedCourse=0.
  180. Choke%SoundChokePump= 0.0
  181. endif
  182. call SetSoundChokePump(Choke%SoundChokePump)
  183. CHOOKE(CHNUMBER)%PercentClose= CHOOKE(CHNUMBER)%PassedCourse/AirPumpLine%CourseBase
  184. IF (ChokeControlPanel%Choke1LED==1) THEN
  185. ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(1)%PercentClose*10
  186. ELSE ! Choke2LED==1
  187. ChokeControlPanel%ChokePosition= (1 - Choke%GaugeChokePositionMailf) * CHOOKE(2)%PercentClose*10
  188. ENDIF
  189. !CALL SetHydraulicChock1(nint(MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)*100))
  190. ! CALL SetHydraulicChock2(nint(MIN(CHOOKE(2)%PercentClose / 0.91 , 1.0)*100))
  191. ! .91 >> 9 percent clearance
  192. ! =================== calculating Area
  193. ! AreaChoke=0.5
  194. ! .91 >> 9 percent clearance
  195. CHOOKE(1)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(1)%PercentClose / 0.91 , 1.0)) !ft^2 0.01334635 is ChokeAreaFullyOpen (ft^2)
  196. CHOOKE(2)%AreaChoke=0.01334635-(0.01334635* MIN(CHOOKE(2)%PercentClose/ 0.91 , 1.0)) !ft^2
  197. Choke%HydraulicChoke1WashoutCoef= Choke%HydraulicChoke1WashoutCoef * CHOOKE(1)%WashoutMalf
  198. 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
  199. Choke%HydraulicChoke2WashoutCoef= Choke%HydraulicChoke2WashoutCoef * CHOOKE(2)%WashoutMalf
  200. 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
  201. !write(*,*) 'HydraulicChoke1WashoutCoef=' , HydraulicChoke1WashoutCoef
  202. IF (CHOOKE(1)%PlugMalf == 1) THEN
  203. Choke%Present_HydraulicChoke1Plug= Choke%Present_HydraulicChoke1Plug * CHOOKE(1)%PlugMalf
  204. ! integer: HydraulicChoke1PluggedPercent,HydraulicChoke1PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
  205. ! real: Present_HydraulicChoke1Plug,DeltaPlug1Percent
  206. !write(*,*) 'HydraulicChoke1PluggedPercent=' , HydraulicChoke1PluggedPercent
  207. if ( (ChokeProblems%HydraulicChoke1PluggedPercent - Choke%HydraulicChoke1PluggedPercent_Old) /= 0) then
  208. Choke%DeltaPlug1Percent = (REAL(ChokeProblems%HydraulicChoke1PluggedPercent)/100.) - Choke%Present_HydraulicChoke1Plug
  209. Choke%Plug1TimeCounter = 0
  210. !write(*,*) 'DeltaPlug1Percent, Present_HydraulicChoke1Plug = ' ,DeltaPlug1Percent , Present_HydraulicChoke1Plug
  211. endif
  212. Choke%Plug1TimeCounter= Choke%Plug1TimeCounter + 1
  213. Choke%HydraulicChoke1PluggedPercent_Old= ChokeProblems%HydraulicChoke1PluggedPercent
  214. if (Choke%Plug1TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600
  215. Choke%Present_HydraulicChoke1Plug = Choke%Present_HydraulicChoke1Plug + CHOOKE(1)%PlugMalf* ((Choke%DeltaPlug1Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
  216. endif
  217. !write(*,*) 'Present_HydraulicChoke1Plug=' , Present_HydraulicChoke1Plug
  218. ENDIF
  219. IF (CHOOKE(2)%PlugMalf == 1) THEN
  220. Choke%Present_HydraulicChoke2Plug= Choke%Present_HydraulicChoke2Plug * CHOOKE(2)%PlugMalf
  221. ! integer: HydraulicChoke2PluggedPercent,HydraulicChoke2PluggedPercent_Old,PlugTimeCounter,ChokePlugTimeDelay
  222. ! real: Present_HydraulicChoke2Plug,DeltaPlug2Percent
  223. if ( (ChokeProblems%HydraulicChoke2PluggedPercent - Choke%HydraulicChoke2PluggedPercent_Old) /= 0 ) then
  224. Choke%DeltaPlug2Percent = (REAL(ChokeProblems%HydraulicChoke2PluggedPercent)/100.) - Choke%Present_HydraulicChoke2Plug
  225. Choke%Plug2TimeCounter = 0
  226. endif
  227. Choke%Plug2TimeCounter= Choke%Plug2TimeCounter + 1
  228. Choke%HydraulicChoke2PluggedPercent_Old= ChokeProblems%HydraulicChoke2PluggedPercent
  229. if (Choke%Plug2TimeCounter <= Choke%ChokePlugTimeDelay) then !ChokePlugTimeDelay=600
  230. Choke%Present_HydraulicChoke2Plug = Choke%Present_HydraulicChoke2Plug + CHOOKE(2)%PlugMalf *((Choke%DeltaPlug2Percent / real(Choke%ChokePlugTimeDelay))) ! real(ChokePlugTimeDelay)= 600.0
  231. endif
  232. ENDIF
  233. ! fully open area is 123/64 in^2 = 0.01334635 ft^2
  234. CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke+(CHOOKE(1)%WashoutMalf*Choke%HydraulicChoke1WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
  235. !write(*,*) 'CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke=' ,CHOOKE(1)%WashoutMalf , CHOOKE(1)%AreaChoke
  236. CHOOKE(1)%AreaChoke=CHOOKE(1)%AreaChoke-(CHOOKE(1)%PlugMalf* Choke%Present_HydraulicChoke1Plug *CHOOKE(1)%AreaChoke) ! Initialised in Choke Startup
  237. CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke+(CHOOKE(2)%WashoutMalf*Choke%HydraulicChoke2WashoutCoef*Choke%ChokeAreaFullyOpen/144.0) ! Initialised in Choke Startup
  238. CHOOKE(2)%AreaChoke=CHOOKE(2)%AreaChoke-(CHOOKE(2)%PlugMalf* Choke%Present_HydraulicChoke2Plug *CHOOKE(2)%AreaChoke) ! Initialised in Choke Startup
  239. !write(*,*) 'CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke=' ,CHOOKE(2)%WashoutMalf , CHOOKE(2)%AreaChoke
  240. CHOOKE(1)%AreaChokeFinal= CHOOKE(1)%AreaChoke
  241. CHOOKE(2)%AreaChokeFinal= CHOOKE(2)%AreaChoke
  242. ! 144: ft^2 to in^2
  243. CALL SetHydraulicChock1(100 - nint((CHOOKE(1)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
  244. CALL SetHydraulicChock2(100 - nint((CHOOKE(2)%AreaChokeFinal/(Choke%ChokeAreaFullyOpen/144.))*100)) ! for manifold valve
  245. !write(*,*) 'CHOOKE(1)%PercentClose=' , CHOOKE(1)%PercentClose ! close percent 0 to 100
  246. !write(*,*) 'ChokePosition=' , ChokePosition ! close position 0 to 10 for display
  247. !write(*,*) 'CHOOKE(1)%AreaChokeFinal=' , CHOOKE(1)%AreaChokeFinal ! Open Area (in^2) with clearance
  248. !write(*,*) '(ChokeAreaFullyOpen/144.)=' , (ChokeAreaFullyOpen/144.)
  249. !write(*,*) 'valve value=' , 100 - nint((CHOOKE(1)%AreaChokeFinal/(ChokeAreaFullyOpen/144.))*100) ! percent close 0 to 100 with clearance
  250. !write(*,*) 'Valve(33)%Status=' , Valve(33)%Status ! T : open , F: close
  251. ! =================== calculating Area
  252. !write(*,*) 'CHOOKE(1)%AreaChoke= ' , CHOOKE(1)%AreaChoke
  253. !WRITE(150,50) alpha_timeair,alpha_Qair,alpha_pairp, &
  254. !alpha_Pdownstrem,alpha_diffpair,alpha_lossesair,CHOOKE(CHNUMBER)%PassedCourse
  255. !50 FORMAT(7(f15.5))
  256. !========================================================================================
  257. !========================================================================================
  258. ! write(*,*) PassedCourse
  259. end