|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264 |
- SUBROUTINE DEALLOCATE_ARRAYS()
- USE VARIABLES
- implicit none
- !===========================================================================
- ! RAMLINE MINOR LOSSES INPUT
- !===========================================================================
- DEALLOCATE (BopStackInput%MINORS1,RamLine%MINORDIAMETER_RAMLINE,RamLine%AREAMINOR_RAMLINE &
- ,RamLine%LF_RAMLINE,RamLine%CV_RAMLINE,RamLine%NOTE_RAMLINE,RAMS%minlosspa,RAMS%minloss)
- !===========================================================================
- ! RAMLINE PIPNING LOSSES INPUT
- !===========================================================================
- DEALLOCATE (BopStackInput%PIPINGS_RAMLINE,RamLine%DIAM_RAMLINE_INCH, &
- RamLine%AREA_RAMLINE,RamLine%LENGT_RAMLINE,RamLine%ROUGHNESS_RAMLINE,RamLine%RELROUGH_RAMLINE &
- ,RAMS%Re_ramline,RAMS%fric,RAMS%fricloss)
- !===========================================================================
- ! ANNULAR MINOR LOSSES INPUT
- !===========================================================================
- DEALLOCATE (BopStackInput%MINORS_ANNULAR,AnnularComputational%MINORDIAMETER_ANNULARLINE,AnnularComputational%AREAMINOR_ANNULARLINE &
- ,AnnularComputational%LF_ANNULARLINE,AnnularComputational%CV_ANNULARLINE,AnnularComputational%NOTE_ANNULARLINE,AnnularComputational%minlosspa_ANNULAR,AnnularComputational%minloss_ANNULAR)
- !===========================================================================
- ! ANNULAR PIPNING LOSSES INPUT
- !===========================================================================
- DEALLOCATE (BopStackInput%PIPINGS_ANNULAR,AnnularComputational%DIAM_ANNULARLINE_INCH,AnnularComputational%AREA_ANNULARLINE, &
- AnnularComputational%LENGT_ANNULARLINE,AnnularComputational%ROUGHNESS_ANNULARLINE,AnnularComputational%RELROUGH_ANNULARLINE &
- ,AnnularComputational%Re_ANNULARline,AnnularComputational%fricANNULAR,AnnularComputational%friclossANNULAR)
- !===========================================================================
- ! AIR PUMP LOSSES INPUT
- !===========================================================================
- DEALLOCATE (BopStackInput%PIPINGS_AIRPUMP,RamLine%DIAM_AIR_INCH, &
- RamLine%Re_air,RamLine%AREA_AIR,RamLine%LENGT_AIR,RamLine%ROUGHNESS_AIRPLINE,RamLine%REL_ROUGHAIR, &
- RamLine%fric_air,RamLine%fricloss_air)
- !================================================================
- DEALLOCATE (BopStackInput%MINORS_AIRPUMP,RamLine%MINORDIAM_AIR_INCH, &
- RamLine%MINORAREA_AIR,RamLine%LF_AIR,RamLine%CV_AIR,RamLine%NOTE_AIR &
- ,RamLine%minlosspa_air,RamLine%minloss_air)
-
- !===========================================================================
- ! DELAY ARRAYS
- !===========================================================================
- call AnnularComputational%Pannular_regDelay%Empty()
-
-
-
- END
-
-
-
-
-
-
-
-
-
-
-
- SUBROUTINE LOSS_INPUTS()
- USE VARIABLES
- implicit none
- INTEGER I
-
- !===========================================================================
- ! RAMLINE MINOR LOSSES INPUT
- !===========================================================================
- RamLine%NO_MINORSRAMLINE=34
-
- ALLOCATE (BopStackInput%MINORS1(RamLine%NO_MINORSRAMLINE,4))
-
- ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION
- BopStackInput%MINORS1(1,1:4)= (/2., 2., 0., 0./) !Acc.tee
- BopStackInput%MINORS1(2,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee
- BopStackInput%MINORS1(3,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee
- BopStackInput%MINORS1(4,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee
- BopStackInput%MINORS1(5,1:4)= (/2., 0.9, 0., 0./) !tee
- BopStackInput%MINORS1(6,1:4)= (/2., 2., 0., 0./) !tee
- BopStackInput%MINORS1(7,1:4)= (/2., 0., 105., 0./) !valve
- BopStackInput%MINORS1(8,1:4)= (/2., 0.9, 0., 0./) !tee
- BopStackInput%MINORS1(9,1:4)= (/2., 0., 105., 0./) !valve
- BopStackInput%MINORS1(10,1:4)= (/2., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS1(11,1:4)= (/2., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS1(12,1:4)= (/2., 0.8, 0., 0./) !unionA
- BopStackInput%MINORS1(13,1:4)= (/2., 0.8, 0., 0./) !unionA
- BopStackInput%MINORS1(14,1:4)= (/2., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS1(15,1:4)= (/2., 0., 425., 0./) !valve
- BopStackInput%MINORS1(16,1:4)= (/2., 2., 0., 0./) !tee
- BopStackInput%MINORS1(17,1:4)= (/0.75, 0., 1.5, 0./) !REGULATOR
- BopStackInput%MINORS1(18,1:4)= (/1., 2., 0., 0./) !tee
- BopStackInput%MINORS1(19,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS1(20,1:4)= (/1., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS1(21,1:4)= (/1., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS1(22,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS1(23,1:4)= (/1., 0., 105., 0./) !valve
- BopStackInput%MINORS1(24,1:4)= (/1., 0.9, 0., 0./) !tee
- BopStackInput%MINORS1(25,1:4)= (/1., 0., 0., 0.5/) !FT
- BopStackInput%MINORS1(26,1:4)= (/1., 0., 0., 3.4/) !filter
- BopStackInput%MINORS1(27,1:4)= (/1., 0., 105., 0./) !valve
- BopStackInput%MINORS1(28,1:4)= (/1., 0.9, 0., 0./) !tee
- BopStackInput%MINORS1(29,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS1(30,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS1(31,1:4)= (/1., 0., 9.2, 0./) !valve
- BopStackInput%MINORS1(32,1:4)= (/1., 0.8, 0., 0./) !unionA
- BopStackInput%MINORS1(33,1:4)= (/1., 0.8, 0., 0./) !unionA
- BopStackInput%MINORS1(34,1:4)= (/0.75, 0.35, 0., 0./) !contraction
-
-
- ALLOCATE (RamLine%MINORDIAMETER_RAMLINE(RamLine%NO_MINORSRAMLINE),RamLine%AREAMINOR_RAMLINE(RamLine%NO_MINORSRAMLINE),RamLine%LF_RAMLINE(RamLine%NO_MINORSRAMLINE),RamLine%CV_RAMLINE(RamLine%NO_MINORSRAMLINE) &
- ,RamLine%NOTE_RAMLINE(RamLine%NO_MINORSRAMLINE),RAMS%minlosspa(6,RamLine%NO_MINORSRAMLINE),RAMS%minloss(6,RamLine%NO_MINORSRAMLINE))
-
-
-
- DO I=1,RamLine%NO_MINORSRAMLINE
- RamLine%MINORDIAMETER_RAMLINE(I)=BopStackInput%MINORS1(I,1)
- RamLine%LF_RAMLINE(I)=BopStackInput%MINORS1(I,2)
- RamLine%CV_RAMLINE(I)=BopStackInput%MINORS1(I,3)
- RamLine%NOTE_RAMLINE(I)=BopStackInput%MINORS1(I,4)
-
-
- RamLine%AREAMINOR_RAMLINE(I)=PI*(RamLine%MINORDIAMETER_RAMLINE(I)*0.0254)**2/4. !D(in), AREA(m)
- ENDDO
-
-
- !===========================================================================
- ! RAMLINE PIPNING LOSSES INPUT
- !===========================================================================
- RamLine%NO_PIPINGSRAMLINE=15
-
- ALLOCATE (BopStackInput%PIPINGS_RAMLINE(RamLine%NO_PIPINGSRAMLINE,3))
-
- ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION
- BopStackInput%PIPINGS_RAMLINE(1,1:3)= (/2., 1035., 0.03/) !Avg.acc.distance
- BopStackInput%PIPINGS_RAMLINE(2,1:3)= (/2., 730., 0.03/) !Acc.end.horizontal
- BopStackInput%PIPINGS_RAMLINE(3,1:3)= (/2., 2000., 0.03/) !Acc.end.vertical
- BopStackInput%PIPINGS_RAMLINE(4,1:3)= (/2., 6000., 0.05/) !Hyd.hose
- BopStackInput%PIPINGS_RAMLINE(5,1:3)= (/2., 2370., 0.03/) !Corner.vertical1
- BopStackInput%PIPINGS_RAMLINE(6,1:3)= (/2., 210., 0.03/) !Add.from.bend
- BopStackInput%PIPINGS_RAMLINE(7,1:3)= (/1., 780., 0.03/) !Corner.horizontal1
- BopStackInput%PIPINGS_RAMLINE(8,1:3)= (/1., 780., 0.03/) !Corner.horizontal2
- BopStackInput%PIPINGS_RAMLINE(9,1:3)= (/1., 750., 0.03/) !Extra.length.back
- BopStackInput%PIPINGS_RAMLINE(10,1:3)= (/1., 800., 0.03/) !Corner.horizontal3
- BopStackInput%PIPINGS_RAMLINE(11,1:3)= (/1., 1650., 0.03/) !Corner.vertical2
- BopStackInput%PIPINGS_RAMLINE(12,1:3)= (/1., 340., 0.03/) !12.Valves.horizontal
- BopStackInput%PIPINGS_RAMLINE(13,1:3)= (/1., 1650., 0.03/) !Valves.vertical
- BopStackInput%PIPINGS_RAMLINE(14,1:3)= (/1., 31000., 10./) !Hyd.hose
- BopStackInput%PIPINGS_RAMLINE(15,1:3)= (/1., 526., 0.03/) !Add.from.bend
-
-
-
- ALLOCATE (RamLine%DIAM_RAMLINE_INCH(RamLine%NO_PIPINGSRAMLINE), &
- RamLine%AREA_RAMLINE(RamLine%NO_PIPINGSRAMLINE),RamLine%LENGT_RAMLINE(RamLine%NO_PIPINGSRAMLINE),RamLine%ROUGHNESS_RAMLINE(RamLine%NO_PIPINGSRAMLINE),RamLine%RELROUGH_RAMLINE(RamLine%NO_PIPINGSRAMLINE) &
- ,RAMS%Re_ramline(6,RamLine%NO_PIPINGSRAMLINE),RAMS%fric(6,RamLine%NO_PIPINGSRAMLINE),RAMS%fricloss(6,RamLine%NO_PIPINGSRAMLINE))
-
- DO I=1,RamLine%NO_PIPINGSRAMLINE
- RamLine%DIAM_RAMLINE_INCH(I)=BopStackInput%PIPINGS_RAMLINE(I,1)
- RamLine%LENGT_RAMLINE(I)=BopStackInput%PIPINGS_RAMLINE(I,2)
- RamLine%ROUGHNESS_RAMLINE(I)=BopStackInput%PIPINGS_RAMLINE(I,3)
-
-
-
- RamLine%AREA_RAMLINE(I)=PI*(RamLine%DIAM_RAMLINE_INCH(I)*0.0254)**2/4 !D(in), AREA(m)
- RamLine%RELROUGH_RAMLINE(I)=RamLine%ROUGHNESS_RAMLINE(I)/(RamLine%DIAM_RAMLINE_INCH(I)*25.4) !e/D
- !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m)
- RamLine%LENGT_RAMLINE(I)=RamLine%LENGT_RAMLINE(I)*.001 ! (m)
- ENDDO
-
-
-
- !===========================================================================
- ! ANNULAR PREVENTER MINOR LOSSES INPUT
- !===========================================================================
- AnnularComputational%NO_MinorsAnnularLine=29
-
- ALLOCATE (BopStackInput%MINORS_ANNULAR(AnnularComputational%NO_MinorsAnnularLine,4))
-
- ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION
- BopStackInput%MINORS_ANNULAR(1,1:4)= (/2., 2., 0., 0./) !Acc.tee
- BopStackInput%MINORS_ANNULAR(2,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee
- BopStackInput%MINORS_ANNULAR(3,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee
- BopStackInput%MINORS_ANNULAR(4,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee
- BopStackInput%MINORS_ANNULAR(5,1:4)= (/2., 0.9, 0., 0./) !tee
- BopStackInput%MINORS_ANNULAR(6,1:4)= (/2., 2., 0., 0./) !tee
- BopStackInput%MINORS_ANNULAR(7,1:4)= (/2., 0., 105., 0./) !valve
- BopStackInput%MINORS_ANNULAR(8,1:4)= (/2., 0.9, 0., 0./) !tee
- BopStackInput%MINORS_ANNULAR(9,1:4)= (/2., 0., 105., 0./) !valve
- BopStackInput%MINORS_ANNULAR(10,1:4)= (/2., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(11,1:4)= (/2., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(12,1:4)= (/2., 0.8, 0., 0./) !unionA
- BopStackInput%MINORS_ANNULAR(13,1:4)= (/2., 0.8, 0., 0./) !unionA
- BopStackInput%MINORS_ANNULAR(14,1:4)= (/2., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(15,1:4)= (/2., 0., 425., 0./) !valve
- BopStackInput%MINORS_ANNULAR(16,1:4)= (/2., 2., 0., 0./) !tee
- BopStackInput%MINORS_ANNULAR(17,1:4)= (/0.75, 0., 1.5, 0./) !REGULATOR
- BopStackInput%MINORS_ANNULAR(18,1:4)= (/1., 2., 0., 0./) !tee
- BopStackInput%MINORS_ANNULAR(19,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(20,1:4)= (/1., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(21,1:4)= (/1., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(22,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(23,1:4)= (/1., 0., 3.2, 0./) !valve
- BopStackInput%MINORS_ANNULAR(24,1:4)= (/1., 2., 0., 0./) !tee
- BopStackInput%MINORS_ANNULAR(25,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(26,1:4)= (/1., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(27,1:4)= (/1., 0.42, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(28,1:4)= (/1., 1.5, 0., 0./) !elbow
- BopStackInput%MINORS_ANNULAR(29,1:4)= (/1., 0., 3.2, 0./) !valve
-
-
-
- ALLOCATE (AnnularComputational%MINORDIAMETER_ANNULARLINE(AnnularComputational%NO_MinorsAnnularLine),AnnularComputational%AREAMINOR_ANNULARLINE(AnnularComputational%NO_MinorsAnnularLine),AnnularComputational%LF_ANNULARLINE(AnnularComputational%NO_MinorsAnnularLine) &
- ,AnnularComputational%CV_ANNULARLINE(AnnularComputational%NO_MinorsAnnularLine),AnnularComputational%NOTE_ANNULARLINE(AnnularComputational%NO_MinorsAnnularLine),AnnularComputational%minlosspa_ANNULAR(AnnularComputational%NO_MinorsAnnularLine),AnnularComputational%minloss_ANNULAR(AnnularComputational%NO_MinorsAnnularLine))
-
-
-
- DO I=1,AnnularComputational%NO_MinorsAnnularLine
- AnnularComputational%MINORDIAMETER_ANNULARLINE(I)=BopStackInput%MINORS_ANNULAR(I,1)
- AnnularComputational%LF_ANNULARLINE(I)=BopStackInput%MINORS_ANNULAR(I,2)
- AnnularComputational%CV_ANNULARLINE(I)=BopStackInput%MINORS_ANNULAR(I,3)
- AnnularComputational%NOTE_ANNULARLINE(I)=BopStackInput%MINORS_ANNULAR(I,4)
-
- AnnularComputational%AREAMINOR_ANNULARLINE(I)=PI*(AnnularComputational%MINORDIAMETER_ANNULARLINE(I)*0.0254)**2/4. !D(in), AREA(m)
- ENDDO
-
-
- !===========================================================================
- ! ANNULAR PREVENTER PIPNING LOSSES INPUT
- !===========================================================================
- AnnularComputational%NO_PipingsAnnularLine=10
-
- ALLOCATE (BopStackInput%PIPINGS_ANNULAR(AnnularComputational%NO_PipingsAnnularLine,3))
-
- ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION
- BopStackInput%PIPINGS_ANNULAR(1,1:3)= (/2., 1035., 0.03/) !Avg.acc.distance
- BopStackInput%PIPINGS_ANNULAR(2,1:3)= (/2., 730., 0.03/) !Acc.endhorizontal
- BopStackInput%PIPINGS_ANNULAR(3,1:3)= (/2., 2000., 0.03/) !Acc.endvertical
- BopStackInput%PIPINGS_ANNULAR(4,1:3)= (/2., 6000., 0.03/) !Hyd.hose
- BopStackInput%PIPINGS_ANNULAR(5,1:3)= (/2., 2370., 0.03/) !Corner.vertical1
- BopStackInput%PIPINGS_ANNULAR(6,1:3)= (/2., 210., 0.03/) !Add.frombend
- BopStackInput%PIPINGS_ANNULAR(7,1:3)= (/2., 1000., 0.03/) !manifold
- BopStackInput%PIPINGS_ANNULAR(8,1:3)= (/1., 46000., 0.03/) !pipe
- BopStackInput%PIPINGS_ANNULAR(9,1:3)= (/2., 1000., 0.03/) !manifold
- BopStackInput%PIPINGS_ANNULAR(10,1:3)= (/1., 46000., 0.03/) !pipe
-
-
-
-
- ALLOCATE (AnnularComputational%DIAM_ANNULARLINE_INCH(AnnularComputational%NO_PipingsAnnularLine),AnnularComputational%AREA_ANNULARLINE(AnnularComputational%NO_PipingsAnnularLine),AnnularComputational%LENGT_ANNULARLINE(AnnularComputational%NO_PipingsAnnularLine) &
- ,AnnularComputational%ROUGHNESS_ANNULARLINE(AnnularComputational%NO_PipingsAnnularLine),AnnularComputational%RELROUGH_ANNULARLINE(AnnularComputational%NO_PipingsAnnularLine) &
- ,AnnularComputational%Re_ANNULARline(AnnularComputational%NO_PipingsAnnularLine),AnnularComputational%fricANNULAR(AnnularComputational%NO_PipingsAnnularLine),AnnularComputational%friclossANNULAR(AnnularComputational%NO_PipingsAnnularLine))
-
-
- DO I=1,AnnularComputational%NO_PipingsAnnularLine
- AnnularComputational%DIAM_ANNULARLINE_INCH(I)=BopStackInput%PIPINGS_ANNULAR(I,1)
- AnnularComputational%LENGT_ANNULARLINE(I)=BopStackInput%PIPINGS_ANNULAR(I,2)
- AnnularComputational%ROUGHNESS_ANNULARLINE(I)=BopStackInput%PIPINGS_ANNULAR(I,3)
-
-
- AnnularComputational%AREA_ANNULARLINE(I)=PI*(AnnularComputational%DIAM_ANNULARLINE_INCH(I)*0.0254)**2/4. !D(in), AREA(m)
- AnnularComputational%RELROUGH_ANNULARLINE(I)=AnnularComputational%ROUGHNESS_ANNULARLINE(I)/(AnnularComputational%DIAM_ANNULARLINE_INCH(I)*25.4)
- !DIAM_ANNULARLINE_MM(I)=DIAM_ANNULARLINE_MM(I)*.001 ! (m)
- AnnularComputational%LENGT_ANNULARLINE(I)=AnnularComputational%LENGT_ANNULARLINE(I)*.001 ! (m)
- ENDDO
-
-
- !===========================================================================
- ! AIR PUMP LOSSES INPUT
- !===========================================================================
- RamLine%NO_PIPINGS_AIRPLINE=1
-
- ALLOCATE (BopStackInput%PIPINGS_AIRPUMP(RamLine%NO_PIPINGS_AIRPLINE,3))
-
- ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION
- BopStackInput%PIPINGS_AIRPUMP(1,1:3)= (/2., 10000., 0.03/) !Avg.acc.distance
-
-
-
-
- ALLOCATE (RamLine%DIAM_AIR_INCH(RamLine%NO_PIPINGS_AIRPLINE),RamLine%Re_air(RamLine%NO_PIPINGS_AIRPLINE),RamLine%AREA_AIR(RamLine%NO_PIPINGS_AIRPLINE), &
- RamLine%LENGT_AIR(RamLine%NO_PIPINGS_AIRPLINE),RamLine%ROUGHNESS_AIRPLINE(RamLine%NO_PIPINGS_AIRPLINE),RamLine%REL_ROUGHAIR(RamLine%NO_PIPINGS_AIRPLINE), &
- RamLine%fric_air(RamLine%NO_PIPINGS_AIRPLINE),RamLine%fricloss_air(RamLine%NO_PIPINGS_AIRPLINE))
-
-
-
- DO I=1,RamLine%NO_PIPINGS_AIRPLINE
- RamLine%DIAM_AIR_INCH(I)=BopStackInput%PIPINGS_AIRPUMP(I,1)
- RamLine%LENGT_AIR(I)=BopStackInput%PIPINGS_AIRPUMP(I,2)
- RamLine%ROUGHNESS_AIRPLINE(I)=BopStackInput%PIPINGS_AIRPUMP(I,3)
-
-
- RamLine%AREA_AIR(I)=PI*(RamLine%DIAM_AIR_INCH(I)*0.0254)**2/4 !D(in), AREA(m)
- RamLine%REL_ROUGHAIR(I)=RamLine%ROUGHNESS_AIRPLINE(I)/(RamLine%DIAM_AIR_INCH(I)*25.4)
- !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m)
- RamLine%LENGT_AIR(I)=RamLine%LENGT_AIR(I)*.001 ! (m)
- ENDDO
-
-
-
- !================================================================
- RamLine%NO_MINORS_AIRPLINE=6
-
- ALLOCATE (BopStackInput%MINORS_AIRPUMP(RamLine%NO_MINORS_AIRPLINE,4))
-
- ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION
- BopStackInput%MINORS_AIRPUMP(1,1:4)= (/2., 10., 0., 0./) !Acc.tee
- BopStackInput%MINORS_AIRPUMP(2,1:4)= (/2., 11., 0., 0./) !elbow
- BopStackInput%MINORS_AIRPUMP(3,1:4)= (/1., 0., 0., 3.4/) !filter
- BopStackInput%MINORS_AIRPUMP(4,1:4)= (/2., 0., 105., 0./) !valve
- BopStackInput%MINORS_AIRPUMP(5,1:4)= (/1., 0., 9.2, 0./) !valve
- BopStackInput%MINORS_AIRPUMP(6,1:4)= (/2., 6.4, 0., 0./) !unionA
-
-
-
- ALLOCATE (RamLine%MINORDIAM_AIR_INCH(RamLine%NO_MINORS_AIRPLINE),RamLine%MINORAREA_AIR(RamLine%NO_MINORS_AIRPLINE), &
- RamLine%LF_AIR(RamLine%NO_MINORS_AIRPLINE),RamLine%CV_AIR(RamLine%NO_MINORS_AIRPLINE),RamLine%NOTE_AIR(RamLine%NO_MINORS_AIRPLINE) &
- ,RamLine%minlosspa_air(RamLine%NO_MINORS_AIRPLINE),RamLine%minloss_air(RamLine%NO_MINORS_AIRPLINE))
-
-
-
- DO I=1,RamLine%NO_MINORS_AIRPLINE
- RamLine%MINORDIAM_AIR_INCH(I)=BopStackInput%MINORS_AIRPUMP(I,1)
- RamLine%LF_AIR(I)=BopStackInput%MINORS_AIRPUMP(I,2)
- RamLine%CV_AIR(I)=BopStackInput%MINORS_AIRPUMP(I,3)
- RamLine%NOTE_AIR(I)=BopStackInput%MINORS_AIRPUMP(I,4)
-
-
- RamLine%MINORAREA_AIR(I)=PI*(RamLine%MINORDIAM_AIR_INCH(I)*0.0254)**2/4. !D(in), AREA(m)
- ENDDO
-
-
-
- END
-
- SUBROUTINE pumps_charge_bottle()
- USE VARIABLES
- USE CAccumulatorVariables
- USE CBopStackVariables
- USE CBopControlPanelVariables
- USE CEquipmentsConstants
- ! use CSimulationVariables
- implicit none
-
- !Pannular_regset=min(AnnularRegulatorSetControl,1700.) ! for changing its set conditions instantaneously
- !write(*,*) 'pumps_charge_bottle'
-
- if(BopControlPanel%ByePassValve == -1.0) then
- BopStackAcc%ByPassOld= -1.0
- elseif(BopControlPanel%ByePassValve == 1.0) then
- BopStackAcc%ByPassOld= 1.0
- endif
-
-
- !=====================================================================
- ! ACCUMULATOR
- !=====for a 10 gal bottle,precharge=1000psig curve BOSCH-isotherm=====
- !for charging bottles by the pump
- !((((((((IN OUTER LOOP))))))
- ! ba1=1003; ba2=.03375; ba3=4.014; ba4=.2458;
- if (RamLine%AIRP_SWITCH==0) Pumps%DELTAV_AIR=0
- RamLine%FVR=RamLine%FVR+Pumps%DELTAV_AIR+Pumps%DELTAV_ELECP
-
- RamLine%pacc_before=RamLine%P_ACC
- RamLine%P_ACC=RamLine%B1*exp(RamLine%B2*RamLine%FVR/BopStackAcc%NOBOTTLES)+RamLine%B3*exp(RamLine%B4*RamLine%FVR/BopStackAcc%NOBOTTLES) ! adiabatic(psig)<<<< 8=no. of bottles
-
- !=====================================================================
-
-
- if(BopStackAcc%ByPassOld == 1.0) then
-
- if (BopStackAcc%pram_reg<BopStackAcc%PRAMS_REGSET) then
- !pram_reg=pram_reg+(p_acc-pacc_before)
- BopStackAcc%PressureDifference= (RamLine%P_ACC-RamLine%pacc_before)
- else
- !pram_reg=PRAMS_REGSET
- BopStackAcc%PressureDifference= BopStackAcc%PRAMS_REGSET - BopStackAcc%pram_reg
- endif
-
-
- !old=pram_reg
- !difference= new-old
- if (ABS(BopStackAcc%PressureDifference) > BaseDifferenceP) then
- BopStackAcc%pram_reg= BopStackAcc%pram_reg + (BopStackAcc%PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20.
- else
-
- if (BopStackAcc%pram_reg<BopStackAcc%PRAMS_REGSET) then
- BopStackAcc%pram_reg=BopStackAcc%pram_reg+(RamLine%P_ACC-RamLine%pacc_before)
- else
- BopStackAcc%pram_reg=BopStackAcc%PRAMS_REGSET
- endif
-
- endif
-
-
-
-
-
- else !if(ByPassOld == -1.0) then
-
-
- !old=pram_reg
- !new=p_acc- MAXVAL(RAM%loss_before)
- !difference= new-old
- BopStackAcc%PressureDifference= RamLine%P_ACC- MAXVAL(RAM%loss_before) - BopStackAcc%pram_reg
- if (ABS(BopStackAcc%PressureDifference) > BaseDifferenceP) then
- BopStackAcc%pram_reg= BopStackAcc%pram_reg + (BopStackAcc%PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20.
- else
- BopStackAcc%pram_reg= RamLine%P_ACC- MAXVAL(RAM%loss_before)
- endif
-
- endif
-
-
- !Pannular_reg= min(p_acc,Pannular_regset)
-
-
- end
-
-
- SUBROUTINE airpump_code()
- USE VARIABLES
- use CSounds
- implicit none
- INTEGER I
-
-
-
- Pumps%QAIR=Pumps%Qiter+.1 !(gpm) maximum flow for the start
- RamLine%diffp_air=-10
- RamLine%losses_air=10
-
- !===================================================================
- ! AIR OPERATED PUMP
- !=================for air consumption at 8 bar======================
- do while (RamLine%diffp_air<0)
- Pumps%QAIR=Pumps%QAIR-.1
- ! Qup=QAIR_PUMP;
- ! bba1 =31.8; bba2 =-725.7 ; bba3 =4154;
- Pumps%P_AIRP=RamLine%BBA1*Pumps%QAIR**2+RamLine%BBA2*Pumps%QAIR+RamLine%BBA3 !(psig)
- RamLine%kinetic_air=sg*wdens*(Pumps%QAIR*6.30902e-5/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)
-
-
- RamLine%diffp_air=Pumps%P_AIRP+RamLine%kinetic_air-RamLine%P_ACC
-
- end do !returns Qup
-
-
- do while (abs((RamLine%diffp_air-RamLine%losses_air)/RamLine%diffp_air)>Pumps%TOL_AIR) !finding correct QAIR_pump for 1 timecounter_ram
-
- if (RamLine%diffp_air-RamLine%losses_air>0) then
- Pumps%QAIR=Pumps%QAIR+.01
- else
- Pumps%QAIR=Pumps%QAIR-.01
- endif
-
- !===================================================================
- ! AIR OPERATED PUMP
- ! Maximator - Model: GX (35)
- !=================for air consumption at 8 bar======================
-
- Pumps%P_AIRP=RamLine%BBA1*Pumps%QAIR**2+RamLine%BBA2*Pumps%QAIR+RamLine%BBA3 !(psig)
- RamLine%kinetic_air=sg*wdens*(Pumps%QAIR*6.30902e-005/((1/4.)*pi*(2*0.254e-1)**2))**2/(2*6895) !(psi)
-
- RamLine%diffp_air=Pumps%P_AIRP+RamLine%kinetic_air-RamLine%P_ACC
-
-
- !===========================LOSSES====================================
- do i=1,RamLine%NO_PIPINGS_AIRPLINE
- RamLine%Re_air(i)=Pumps%QAIR*6.30902e-005*RamLine%DIAM_AIR_INCH(I)*0.0254/(RamLine%AREA_AIR(i)*nu)
- enddo
-
- do i=1,RamLine%NO_PIPINGS_AIRPLINE
- if (RamLine%Re_air(i)<Re_cr) then
- RamLine%fric_air(i)=64/RamLine%Re_air(i)
- else
- RamLine%fric_air(i)=1/(-1.8*log10((RamLine%REL_ROUGHAIR(i)/3.7)**1.11+6.9/RamLine%Re_air(i)))**2
- endif
-
- RamLine%fricloss_air(i)=((RamLine%fric_air(i)*(wdens*sg*RamLine%LENGT_AIR(i)*(Pumps%QAIR*6.30902e-005/RamLine%AREA_AIR(i))**2))/(2*RamLine%DIAM_AIR_INCH(I)*0.0254))/6895
-
- enddo
-
-
-
-
- RamLine%pipe_loss1air=sum(RamLine%fricloss_air) !loss before regulator(psi)
-
- do i=1,RamLine%NO_MINORS_AIRPLINE
- if (RamLine%LF_AIR(i)/=0) then
- RamLine%minlosspa_air(i)=RamLine%LF_AIR(i)*wdens*sg*(Pumps%QAIR*6.30902e-005/RamLine%MINORAREA_AIR(i))**2/2 !(Pa)
- RamLine%minloss_air(i)=RamLine%minlosspa_air(i)/6895 !(psi)
- elseif (RamLine%CV_AIR(i)/=0) then
- RamLine%minlosspa_air(i)=1000*sg*((11.7*Pumps%QAIR*6.30902e-005*3600)/(RamLine%CV_AIR(i)))**2 !(pa)
- RamLine%minloss_air(i)=RamLine%minlosspa_air(i)/6895 !(psi)
- else
- RamLine%minlosspa_air(i)=RamLine%NOTE_AIR(i)*1e5 !(pa)
- RamLine%minloss_air(i)=RamLine%minlosspa_air(i)/6895 !(psi)
- endif
- enddo
-
-
- RamLine%minor_loss1air=sum(RamLine%minloss_air) !loss before regulator(psi)
-
- RamLine%static_loss1air=0
-
- RamLine%losses_air=RamLine%pipe_loss1air+RamLine%minor_loss1air+RamLine%static_loss1air !(psi)
- !=========================================================================
-
-
-
- end do !returns correct QAIR_PUMP for 1 counter
-
- RamLine%counter_airp=RamLine%counter_airp+1
- Pumps%Qiter=Pumps%QAIR
-
- BopStackAcc%Cumulative_AirVolume= BopStackAcc%Cumulative_AirVolume + ((Pumps%QAIR * RamLine%DeltaT_BOP / 60.0 ) / (6.71*0.004329004) ) ! =strokes
- !write(*,*) 'Cumulative_AirVolume=' , Cumulative_AirVolume
-
- if ( BopStackAcc%Cumulative_AirVolume > 1.0 ) then
- BopStackAcc%SoundKoomeyAirPump= 120.0
- BopStackAcc%Cumulative_AirVolume= BopStackAcc%Cumulative_AirVolume - 1.0
- else
- BopStackAcc%SoundKoomeyAirPump= 0.0
- endif
-
-
- !SoundKoomeyAirPump= int ( (QAIR_PUMP/ (6.71*0.004329004)) ) ! 6.71: Volume per stroke (in^3) , 0.004329004: in^3 to gal
- ! 2.0 : two air pumps 60:seconds
- !write(*,*) 'sedaaaa=' ,(QAIR_PUMP/ (6.71*0.004329004)) *DeltaT_BOP/(60.0*2.0)
- call SetSoundKoomeyAirPump(BopStackAcc%SoundKoomeyAirPump)
-
-
- Pumps%DELTAV_AIR=Pumps%QAIR*RamLine%DeltaT_BOP/60. !(galon) delta_t=1sec , Q(gpm)
-
- !write(*,*) 'QAIR_PUMP=' , QAIR_PUMP
-
-
- !((((((((IN OUTER LOOP))))))
- !fvr_air=fvr_air+deltav_air !=fvr_after (galon) for next timecounter_ram
-
-
- !========================================================
-
- !WRITE(50,50) QAIR_PUMP,p_airp, &
- !p_acc,diffp_air,losses_air,deltav_air
- 50 FORMAT(6(f15.5))
-
-
- end
-
-
- SUBROUTINE bop_code(ramtype,H_RAMBOP,RNUMBER)
-
- USE VARIABLES
- USE CAccumulatorVariables
- USE CBopControlPanelVariables
- USE CEquipmentsConstants
- ! use CSimulationVariables
- USE TD_GeneralData
- use CUnityOutputs
- implicit none
- integer ramtype, I
- real H_RAMBOP
- INTEGER RNUMBER
-
- !Pannular_regset=min(AnnularRegulatorSetControl,1700.) ! for changing its set conditions instantaneously
-
- !====================================================
- ! BOP back pressure IN PRESENCE OF DP
- !====================================================
- if (RAM(RNUMBER)%bop_type==2) then
- RAM(RNUMBER)%checkp= RAM(RNUMBER)%p_bop
- if ( RAM(RNUMBER)%vdis_tot<ShearRam%VA) then
- RAM(RNUMBER)%p_bop=ShearRam%PA
- elseif (ShearRam%VA<= RAM(RNUMBER)%vdis_tot .and. RAM(RNUMBER)%vdis_tot<=ShearRam%VB) then
- RAM(RNUMBER)%p_bop=ShearRam%PA+ShearRam%PB*(( RAM(RNUMBER)%vdis_tot-ShearRam%VA)/(ShearRam%VB-ShearRam%VA))
- else
- RAM(RNUMBER)%p_bop=ShearRam%PA
- endif
-
- if ( RAM(RNUMBER)%checkp/=ShearRam%PA .and. RAM(RNUMBER)%p_bop==ShearRam%PA) then
- RAM(RNUMBER)%Q=RAM(RNUMBER)%Qzero
- else
- RAM(RNUMBER)%Q=RAM(RNUMBER)%flow
- endif
-
- endif
-
- !====================================================
- ! BOP back pressure without DP
- !====================================================
- if (RAM(RNUMBER)%bop_type==3) then
- RAM(RNUMBER)%p_bop=ShearRam%PA
- ! Q=flow
- endif
-
-
-
- RAM(RNUMBER)%clock=0
- !======================Losses============================
- RAM(RNUMBER)%loss_after=0 !initial value
- RAM(RNUMBER)%diffp_ram=1000 !initial value
- RAM(RNUMBER)%loss_before=0
-
- !Q=0.0055; %initial flow rate (m^3/s)
-
- RAM(RNUMBER)%Q=RAM(RNUMBER)%flow
-
-
- do while (abs( RAM(RNUMBER)%diffp_ram- RAM(RNUMBER)%loss_after)/ RAM(RNUMBER)%diffp_ram>RAM(RNUMBER)%tol)
- if (RAM(RNUMBER)%Bottles_Charged_MalfActive==.true.) exit
- ! while abs( RAM(RNUMBER)%diffp_ram- RAM(RNUMBER)%loss_after)>10
- RAM(RNUMBER)%clock= RAM(RNUMBER)%clock+1
-
- if ( RAM(RNUMBER)%clock>20) then
- ! tclock=clock
- RAM(RNUMBER)%tol= RAM(RNUMBER)%TOLZERO+(floor( RAM(RNUMBER)%clock/10)-1)*.001
- endif
- ! if (clock==1) continue
-
- if ( RAM(RNUMBER)%clock/=1 .and. RAM(RNUMBER)%loss_after> RAM(RNUMBER)%diffp_ram) then
- RAM(RNUMBER)%Q=RAM(RNUMBER)%Q-.1
- elseif ( RAM(RNUMBER)%clock/=1 .and. RAM(RNUMBER)%loss_after<= RAM(RNUMBER)%diffp_ram) then
- RAM(RNUMBER)%Q=RAM(RNUMBER)%Q+.01
-
- endif
-
- !====================Before Regulator=========================
- !pipe_loss1=3.2; % should be replaced by formula
- do i=1,RamLine%NO_PIPINGSRAMLINE
- RAMS%Re_ramline(RNUMBER,i)=RAM(RNUMBER)%Q*6.30902e-5*RamLine%DIAM_RAMLINE_INCH(i)*0.0254/(RamLine%AREA_RAMLINE(i)*nu)
-
- enddo
-
-
- do i=1,RamLine%NO_PIPINGSRAMLINE
- if ( RAMS%Re_ramline(RNUMBER,i)<Re_cr) then
- RAMS%fric(RNUMBER,i)=64/ RAMS%Re_ramline(RNUMBER,i)
- else
-
- RAMS%fric(RNUMBER,i)=1/(-1.8*log10((RamLine%RELROUGH_RAMLINE(i)/3.7)**1.11+6.9/ RAMS%Re_ramline(RNUMBER,i)))**2
- endif
-
- RAMS%fricloss(RNUMBER,i)=(( RAMS%fric(RNUMBER,i)*(wdens*sg*RamLine%LENGT_RAMLINE(i)*(RAM(RNUMBER)%Q*6.30902e-5/RamLine%AREA_RAMLINE(i))**2))/(2*RamLine%DIAM_RAMLINE_INCH(i)*0.0254))/6895
-
- enddo
- RAM(RNUMBER)%pipe_loss1=sum( RAMS%fricloss(RNUMBER,1:6)) !loss before regulator(psi)
-
- ! Q*6.30902e-5 for (gpm) to (m^3/sec)
- do i=1,RamLine%NO_MINORSRAMLINE
- if (RamLine%LF_RAMLINE(i)/=0) then
- RAMS%minlosspa(RNUMBER,i)=RamLine%LF_RAMLINE(i)*wdens*sg*(RAM(RNUMBER)%Q*6.30902e-5/RamLine%AREAMINOR_RAMLINE(i))**2/2 !(Pa)
- RAMS%minloss(RNUMBER,i)= RAMS%minlosspa(RNUMBER,i)/6895 !(psi)
- elseif (RamLine%CV_RAMLINE(i)/=0) then
- RAMS%minlosspa(RNUMBER,i)=1000*sg*((11.7*RAM(RNUMBER)%Q*6.30902e-5*3600)/(RamLine%CV_RAMLINE(i)))**2 !(pa)
- RAMS%minloss(RNUMBER,i)= RAMS%minlosspa(RNUMBER,i)/6895 !(psi)
- else
- RAMS%minlosspa(RNUMBER,i)=RamLine%NOTE_RAMLINE(i)*1e5 !(pa)
- RAMS%minloss(RNUMBER,i)= RAMS%minlosspa(RNUMBER,i)/6895 !(psi)
- endif
- enddo
-
- RAMS%minloss(RNUMBER,17)= 5.*RAM(RNUMBER)%Q ! <==== regulator loss (psig)
-
- RAM(RNUMBER)%minor_loss1=sum( RAMS%minloss(RNUMBER,1:16)) !loss before regulator(psi)
-
- RAM(RNUMBER)%static_loss1=0
-
- RAM(RNUMBER)%kinetic_loss1=sg*wdens*(RAM(RNUMBER)%Q*6.30902e-5/((1/4.)*pi*(.72*0.254e-1)**2))**2/(2*6895) !(psi)
- !.72 for regulator diameter)
-
- RAM(RNUMBER)%loss_before= RAM(RNUMBER)%pipe_loss1+ RAM(RNUMBER)%minor_loss1+ RAM(RNUMBER)%static_loss1+ RAM(RNUMBER)%kinetic_loss1 !(psi)
- !===================after Regulator======================
- ! all in (psi)
- RAM(RNUMBER)%pipe_loss2=sum( RAMS%fricloss(RNUMBER,7:RamLine%NO_PIPINGSRAMLINE)) !7=after regulator<<<<<<<
- RAM(RNUMBER)%minor_loss2=sum( RAMS%minloss(RNUMBER,17:RamLine%NO_MINORSRAMLINE)) !17=after regulator<<<<<<<
-
- RAM(RNUMBER)%deltah=H_RAMBOP-ShearRam%H_REGRAM
- ! RAM(RNUMBER)%static_loss2pa= RAM(RNUMBER)%deltah*sg*wdens*gravity; %(pa)
- RAM(RNUMBER)%static_loss2= RAM(RNUMBER)%deltah*sg*wdens*gravity/6895 !(psi)
- RAM(RNUMBER)%kinetic_loss2=0
-
- RAM(RNUMBER)%loss_after= RAM(RNUMBER)%pipe_loss2+ RAM(RNUMBER)%minor_loss2+ RAM(RNUMBER)%static_loss2 !(psi)
- !=======================================================
-
- if(BopControlPanel%ByePassValve == -1.0) then
- BopStackAcc%ByPassOld= -1.0
- elseif(BopControlPanel%ByePassValve == 1.0) then
- BopStackAcc%ByPassOld= 1.0
- endif
- ! write(*,*) 'ByPassOld=', ByPassOld
-
-
- !==========================p_regulator======================
- if (BopStackAcc%PRAMS_REGSET<RamLine%P_ACC- RAM(RNUMBER)%loss_before) then
-
- if(BopStackAcc%ByPassOld == 1.0) then
- !old=pram_reg
- !new=PRAMS_REGSET- sum(RAMS%minloss(2:6,17)) ! 2:6 = RNUMBER
- !difference= new-old
- BopStackAcc%PressureDifference= BopStackAcc%PRAMS_REGSET- sum(RAMS%minloss(2:6,17)) - BopStackAcc%pram_reg
- if (ABS(BopStackAcc%PressureDifference) > BaseDifferenceP) then
- BopStackAcc%pram_reg= BopStackAcc%pram_reg + (BopStackAcc%PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20.
- else
- BopStackAcc%pram_reg= BopStackAcc%PRAMS_REGSET- sum(RAMS%minloss(2:6,17)) ! 2:6 = RNUMBER
- endif
- !pram_reg=PRAMS_REGSET- sum(RAMS%minloss(2:6,17)) ! 2:6 = RNUMBER
- else !(ByPassOld == -1.0)
- !old=pram_reg
- !new=p_acc- RAM(RNUMBER)%loss_before
- !difference= new-old
- BopStackAcc%PressureDifference= RamLine%P_ACC- RAM(RNUMBER)%loss_before - BopStackAcc%pram_reg
- if (ABS(BopStackAcc%PressureDifference) > BaseDifferenceP) then
- BopStackAcc%pram_reg= BopStackAcc%pram_reg + (BopStackAcc%PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20.
- else
- BopStackAcc%pram_reg= RamLine%P_ACC- RAM(RNUMBER)%loss_before
- endif
-
- endif
- !pram_reg=p_acc- RAM(RNUMBER)%loss_before
-
- else
- BopStackAcc%pram_reg=RamLine%P_ACC- RAM(RNUMBER)%loss_before- sum(RAMS%minloss(2:6,17)) ! 2:6 = RNUMBER
- endif
- !===========================================================
-
-
- !====================Flow Rate calculation==================
- RAM(RNUMBER)%diffp_ram=BopStackAcc%pram_reg+RAMS%minloss(RNUMBER,17)- RAM(RNUMBER)%p_bop
- !write(*,*) 'Q calculation'
-
-
- end do ! returns correct Q for one timecounter_ram
- !write(*,*)'RAM(RNUMBER)%Q= ' , RAM(RNUMBER)%Q
-
- !write(*,*) 'UpperRamsLeakMalf , Bottles_Charged_MalfActive=' , UpperRamsLeakMalf , Bottles_Charged_MalfActive
- if (RAM(RNUMBER)%Bottles_Charged_MalfActive==.true.) then
- RAM(RNUMBER)%Q= 5.0 ! gpm
- !write(*,*) 'malffffffffff'
- endif
-
- RAM(RNUMBER)%flow=RAM(RNUMBER)%Q
-
-
-
- !====================p_accumulator for next iterate==================
- ! deltav=Q*1*1000; %delta_t=1sec (lit)
- ! fvr=fvr-deltav; %=fvr_after (lit)
- ! p_acc=0.001178*fvr^3+0.02019*fvr^2+16.1*fvr+2379; %(psia)
- ! vdis_bottles=fvr_tot-fvr; %from the start***needed for p_bop calculating (lit)
-
- !========for a 10 gal bottle,precharge=1000psig curve BOSCH======
- RAM(RNUMBER)%deltav_bottles=RAM(RNUMBER)%Q*RamLine%DeltaT_BOP/60. !(galon) delta_t=1sec , Q(gpm)
- RamLine%FVR=RamLine%FVR- RAM(RNUMBER)%deltav_bottles !=fvr_after (galon)
- ! b1=993.7; b2=0.164; b3=5.492; b4=0.9796;
- RAM(RNUMBER)%p_acccheck=RamLine%P_ACC
- RamLine%P_ACC=RamLine%B1*exp(RamLine%B2*RamLine%FVR/BopStackAcc%NOBOTTLES)+RamLine%B3*exp(RamLine%B4*RamLine%FVR/BopStackAcc%NOBOTTLES) !(psig)<<<< 8=no. of bottles
- !formula is derived for fvr (galon)
- !vdis_bottles=fvr_tot-fvr
- RAM(RNUMBER)%vdis_bottles= RAM(RNUMBER)%vdis_bottles+ RAM(RNUMBER)%deltav_bottles
-
- RamLine%NoActiveRmas=6.-real(Annular%Annular_closed+RamLine%ShearBop_closed+PipeRam1%closed+PipeRam2%closed+ChokeLine%closed+KillLine%closed)
-
- RAM(RNUMBER)%vdis_elecp= RAM(RNUMBER)%vdis_elecp+(Pumps%DELTAV_ELECP/RamLine%NoActiveRmas) !overal discharged
- RAM(RNUMBER)%fvr_air= RAM(RNUMBER)%fvr_air+(Pumps%DELTAV_AIR/RamLine%NoActiveRmas) !=fvr_after (galon) for next timecounter_ram
- !write(*,*) 'deltav_air , NoActiveRmas' , deltav_air , NoActiveRmas
-
- RAM(RNUMBER)%vdis_tot= RAM(RNUMBER)%vdis_bottles+ RAM(RNUMBER)%fvr_air+ RAM(RNUMBER)%vdis_elecp !overal
- ! write(*,*) RAM(RNUMBER)%vdis_tot, vdis_bottles, RAM(RNUMBER)%fvr_air, vdis_elecp !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- if (ramtype==1) then !for shear ram
- if (RamLine%ShearRamIsClosing) then
- ShearRam%IDshearBop=(2.*(ShearRam%NeededVolumeShearRams- RAM(RNUMBER)%vdis_tot)*231./ShearRam%AbopShearRam) +ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam
- !write(*,*) 'stop now' !, IDshearBop, NeededVolumeShearRams, RAM(RNUMBER)%vdis_tot, AbopShearRam
- endif
-
- if (RamLine%ShearRamIsOpening) then
- ShearRam%IDshearBop=ShearRam%IDshearBopBase-2.*(ShearRam%NeededVolumeShearRams- RAM(RNUMBER)%vdis_tot)*231./ShearRam%AbopShearRam
- endif
-
-
-
- if ( RAM(RNUMBER)%vdis_tot>ShearRam%NeededVolumeShearRams) then
-
- RamLine%ShearBop_closed=1
- !ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3)
-
- BopStackAcc%pram_reg=BopStackAcc%pram_reg+RAMS%minloss(RNUMBER,17)
- RamLine%P_ACC= RAM(RNUMBER)%p_acccheck
-
- if (RamLine%ShearRamIsClosing) then
- ShearRam%IDshearBop=0. + ShearRam%ShearIsNotAllowed*ShearRam%ODDrillpipe_inShearRam
- BopControlPanel%MiddleRamsCloseLED = LedOn
- BopStackInput%MiddleRamsCloseLEDMine = LedOn
- BopControlPanel%MiddleRamsOpenLED = LedOff
- BopStackInput%MiddleRamsOpenLEDMine = LedOff
- if (TD_BOP%BOPConnectionPossibility(3) == 1 .and. ShearRam%ShearIsNotAllowed==0) then
- CALL CloseMiddleRams
- RamLine%ShearBop_Situation_forTD= 1 ! closed - for TD code
- endif
- endif
-
- if (RamLine%ShearRamIsOpening) then
- ShearRam%IDshearBop=ShearRam%IDshearBopBase
- BopControlPanel%MiddleRamsOpenLED = LedOn
- BopStackInput%MiddleRamsOpenLEDMine = LedOn
- BopControlPanel%MiddleRamsCloseLED = LedOff
- BopStackInput%MiddleRamsCloseLEDMine = LedOff
- CALL OpenMiddleRams
- RamLine%ShearBop_Situation_forTD= 0 ! open - for TD code
- endif
-
- endif
-
- ShearRam%IDshearBopFinal= ShearRam%IDshearBop ! for output data
-
- endif
-
- if (ramtype==2) then !for pipe ram1
- if (PipeRam1%IsClosing) then
- PipeRam1%ID=(2.*(PipeRam1%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./PipeRam1%A)+max(PipeRam1%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase)
- endif
-
- if (PipeRam1%IsOpening) then
- PipeRam1%ID=PipeRam1%IDBase-2.*(PipeRam1%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./PipeRam1%A
- endif
-
- if ( RAM(RNUMBER)%vdis_tot>PipeRam1%NeededVolume) then
-
- PipeRam1%closed=1
- !PipeRam1_Situation_forTD= PipeRam1_closed * TD_BOPConnectionPossibility(2)
- BopStackAcc%pram_reg=BopStackAcc%pram_reg+RAMS%minloss(RNUMBER,17)
- RamLine%P_ACC= RAM(RNUMBER)%p_acccheck
-
- if (PipeRam1%IsClosing) then
- PipeRam1%ID=max(PipeRam1%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase)
- BopControlPanel%UpperRamsCloseLED = LedOn
- BopStackInput%UpperRamsCloseLEDMine = LedOn
- BopControlPanel%UpperRamsOpenLED = LedOff
- BopStackInput%UpperRamsOpenLEDMine = LedOff
- if (TD_BOP%BOPConnectionPossibility(2) == 1) then
- CALL CloseUpperRams ! for C code
- call Set_BlowoutFromAnnular(.true.)
-
-
- PipeRam1%Situation_forTD= 1 ! closed - for TD code
- endif
- endif
-
- if (PipeRam1%IsOpening) then
- PipeRam1%ID=PipeRam1%IDBase
- BopControlPanel%UpperRamsOpenLED = LedOn
- BopStackInput%UpperRamsOpenLEDMine = LedOn
- BopControlPanel%UpperRamsCloseLED = LedOff
- BopStackInput%UpperRamsCloseLEDMine = LedOff
- Call OpenUpperRams ! for C code
- PipeRam1%Situation_forTD= 0 ! open - for TD code
- endif
-
- endif
-
- ShearRam%IDPipeRam1Final= PipeRam1%ID ! for output data
-
- endif
-
-
- if (ramtype==3) then !for pipe ram2
- if (PipeRam2%IsClosing) then
- PipeRam2%ID=(2.*(PipeRam2%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./PipeRam1%A)+max(PipeRam2%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase)
- endif
-
- if (PipeRam2%IsOpening) then
- PipeRam2%ID=PipeRam1%IDBase-2.*(PipeRam2%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./PipeRam1%A
- endif
-
- if ( RAM(RNUMBER)%vdis_tot>PipeRam2%NeededVolume) then
-
- PipeRam2%closed=1
- !PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4)
- BopStackAcc%pram_reg=BopStackAcc%pram_reg+RAMS%minloss(RNUMBER,17)
- RamLine%P_ACC= RAM(RNUMBER)%p_acccheck
-
- if (PipeRam2%IsClosing) then
- PipeRam2%ID=max(PipeRam2%ODDrillpipe_in,PipeRam1%ODDrillpipe_inBase)
- BopControlPanel%LowerRamsCloseLED = LedOn
- BopStackInput%LowerRamsCloseLEDMine = LedOn
- BopControlPanel%LowerRamsOpenLED = LedOff
- BopStackInput%LowerRamsOpenLEDMine = LedOff
- if (TD_BOP%BOPConnectionPossibility(4) == 1) then
- CALL CloseLowerRams
- PipeRam2%Situation_forTD= 1 ! closed - for TD code
- endif
- endif
-
- if (PipeRam2%IsOpening) then
- PipeRam2%ID=PipeRam1%IDBase
- BopControlPanel%LowerRamsOpenLED = LedOn
- BopStackInput%LowerRamsOpenLEDMine = LedOn
- BopControlPanel%LowerRamsCloseLED = LedOff
- BopStackInput%LowerRamsCloseLEDMine = LedOff
- CALL OpenLowerRams
- PipeRam2%Situation_forTD= 0 ! open - for TD code
- endif
-
- endif
-
- ShearRam%IDPipeRam2Final= PipeRam2%ID ! for output data
-
- endif
-
-
- if (ramtype==4) then !for Choke Line
- if (ChokeLine%IsClosing) then
- ChokeLine%ID=(2.*(ChokeLine%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./ChokeLine%Abop)+max(ChokeLine%ODDrillpipe_in,ChokeLine%ODDrillpipe_inBase)
- endif
-
- if (ChokeLine%IsOpening) then
- ChokeLine%ID=ChokeLine%IDBase-2.*(ChokeLine%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./ChokeLine%Abop
- endif
-
- if ( RAM(RNUMBER)%vdis_tot>ChokeLine%NeededVolume) then
-
- ChokeLine%closed=1
- BopStackAcc%pram_reg=BopStackAcc%pram_reg+RAMS%minloss(RNUMBER,17)
- RamLine%P_ACC= RAM(RNUMBER)%p_acccheck
-
- if (ChokeLine%IsClosing) then
- ChokeLine%ID=max(ChokeLine%ODDrillpipe_in,ChokeLine%ODDrillpipe_inBase)
- BopControlPanel%ChokeLineCloseLED = LedOn
- BopStackInput%ChokeLineCloseLEDMine = LedOn
- BopControlPanel%ChokeLineOpenLED = LedOff
- BopStackInput%ChokeLineOpenLEDMine = LedOff
- CALL CloseChokeLine
- endif
-
- if (ChokeLine%IsOpening) then
- ChokeLine%ID=ChokeLine%IDBase
- BopControlPanel%ChokeLineOpenLED = LedOn
- BopStackInput%ChokeLineOpenLEDMine = LedOn
- BopControlPanel%ChokeLineCloseLED = LedOff
- BopStackInput%ChokeLineCloseLEDMine = LedOff
- CALL OpenChokeLine
- endif
-
- endif
-
- endif
-
-
-
- if (ramtype==5) then !for Kill Line
- if (KillLine%IsClosing) then
- KillLine%ID=(2.*(KillLine%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./KillLine%Abop)+max(KillLine%ODDrillpipe_in,KillLine%ODDrillpipe_inBase)
- endif
-
- if (KillLine%IsOpening) then
- KillLine%ID=KillLine%IDBase-2.*(KillLine%NeededVolume- RAM(RNUMBER)%vdis_tot)*231./KillLine%Abop
- endif
-
- if ( RAM(RNUMBER)%vdis_tot>KillLine%NeededVolume) then
-
- KillLine%closed=1
- BopStackAcc%pram_reg=BopStackAcc%pram_reg+RAMS%minloss(RNUMBER,17)
- RamLine%P_ACC= RAM(RNUMBER)%p_acccheck
-
- if (KillLine%IsClosing) then
- KillLine%ID=max(KillLine%ODDrillpipe_in,KillLine%ODDrillpipe_inBase)
- BopControlPanel%KillLineCloseLED = LedOn
- BopStackInput%KillLineCloseLedMine = LedOn
- BopControlPanel%KillLineOpenLED = LedOff
- BopStackInput%KillLineOpenLedMine = LedOff
- CALL CloseKillLine
- endif
-
- if (KillLine%IsOpening) then
- KillLine%ID=KillLine%IDBase
- BopControlPanel%KillLineOpenLED = LedOn
- BopStackInput%KillLineOpenLedMine = LedOn
- BopControlPanel%KillLineCloseLED = LedOff
- BopStackInput%KillLineCloseLedMine = LedOff
- CALL OpenKillLine
- endif
-
- endif
-
- endif
-
-
-
-
- !if (ramtype==4) then !for annular
- ! if (AnnularIsClosing) then
- ! IDAnnular=((NeededVolumeAnnular-vdis_tot)*231./AbopAnnular)+ODDrillpipe_inAnnular
- ! endif
- !
- ! if (AnnularIsOpening) then
- ! IDAnnular=IDAnnularBase-(NeededVolumeAnnular-vdis_tot)*231./AbopAnnular
- ! endif
- !
- ! if (vdis_tot>NeededVolumeAnnular) then
- !
- ! Annular_closed=1
- ! p_acc= RAM(RNUMBER)%p_acccheck
- !
- ! if (AnnularIsClosing) then
- ! IDAnnular=ODDrillpipe_inAnnular
- ! AnnularCloseLed = LedOn
- ! AnnularOpenLed = LedOff
- ! endif
- !
- ! if (AnnularIsOpening) then
- ! IDAnnular=IDAnnularBase
- ! AnnularOpenLed = LedOn
- ! AnnularCloseLed = LedOff
- ! endif
- !
- ! endif
- !
- !endif
-
-
- end
-
-
-
- SUBROUTINE bop_codeAnnular(RNUMBER)
-
- USE VARIABLES
- USE CBopControlPanelVariables
- USE CEquipmentsConstants
- USE TD_GeneralData
- implicit none
- INTEGER RNUMBER, I
-
-
- !Pannular_regset=min(AnnularRegulatorSetControl,1700.) ! for changing its set conditions instantaneously
-
- !====================================================
- ! BOP back pressure without DP
- !====================================================
- !if (bop_type==3) then
- !p_annular=510.725-(30.145*IDAnnular)
- AnnularComputational%p_annular=448-(19.7*Annular%IDAnnular)
- ! Q=flow
- ! endif
-
-
-
- RAM(RNUMBER)%clock=0
- !======================Losses============================
- RAM(RNUMBER)%loss_after=0 !initial value
- RAM(RNUMBER)%diffp_ram=1000 !initial value
- RAM(RNUMBER)%loss_before=0
-
- !Q=0.0055; %initial flow rate (m^3/s)
-
- RAM(RNUMBER)%Q=RAM(RNUMBER)%flow
-
- !write(*,*) 'Q1=' , Q
- !write(*,*) 'tol=' , tol
- do while (abs( RAM(RNUMBER)%diffp_ram- RAM(RNUMBER)%loss_after)/ RAM(RNUMBER)%diffp_ram>Annular%tolAnnular)
- if (RAM(RNUMBER)%Bottles_Charged_MalfActive==.true.) exit
- ! while abs( RAM(RNUMBER)%diffp_ram- RAM(RNUMBER)%loss_after)>10
- RAM(RNUMBER)%clock= RAM(RNUMBER)%clock+1
-
- if ( RAM(RNUMBER)%clock>20) then
- ! tclock=clock
- Annular%tolAnnular=Annular%tolzeroAnnular+(floor( RAM(RNUMBER)%clock/10)-1)*.001
- endif
- ! if (clock==1) continue
-
- if ( RAM(RNUMBER)%clock/=1 .and. RAM(RNUMBER)%loss_after> RAM(RNUMBER)%diffp_ram) then
- RAM(RNUMBER)%Q=RAM(RNUMBER)%Q-.1
- elseif ( RAM(RNUMBER)%clock/=1 .and. RAM(RNUMBER)%loss_after<= RAM(RNUMBER)%diffp_ram) then
- RAM(RNUMBER)%Q=RAM(RNUMBER)%Q+.01
-
- endif
-
- !====================Before Regulator=========================
- do i=1,AnnularComputational%NO_PipingsAnnularLine
- AnnularComputational%Re_ANNULARline(i)=RAM(RNUMBER)%Q*6.30902e-5*AnnularComputational%DIAM_ANNULARLINE_INCH(i)*0.0254/(AnnularComputational%AREA_ANNULARLINE(i)*nu)
-
- enddo
-
-
-
- do i=1,AnnularComputational%NO_PipingsAnnularLine
- if (AnnularComputational%Re_ANNULARline(i)<Re_cr) then
- AnnularComputational%fricANNULAR(i)=64/AnnularComputational%Re_ANNULARline(i)
- else
-
- AnnularComputational%fricANNULAR(i)=1/(-1.8*log10((AnnularComputational%RELROUGH_ANNULARLINE(i)/3.7)**1.11+6.9/AnnularComputational%Re_ANNULARline(i)))**2
- endif
-
- AnnularComputational%friclossANNULAR(i)=((AnnularComputational%fricANNULAR(i)*(wdens*sg*AnnularComputational%LENGT_ANNULARLINE(i)*(RAM(RNUMBER)%Q*6.30902e-5/AnnularComputational%AREA_ANNULARLINE(i))**2))/(2*AnnularComputational%DIAM_ANNULARLINE_INCH(i)*0.0254))/6895
-
- enddo
-
-
-
-
- RAM(RNUMBER)%pipe_loss1=sum(AnnularComputational%friclossANNULAR(1:6)) !loss before regulator(psi)
-
-
- do i=1,AnnularComputational%NO_MinorsAnnularLine
- if (AnnularComputational%LF_ANNULARLINE(i)/=0) then
- AnnularComputational%minlosspa_ANNULAR(i)=AnnularComputational%LF_ANNULARLINE(i)*wdens*sg*(RAM(RNUMBER)%Q*6.30902e-5/AnnularComputational%AREAMINOR_ANNULARLINE(i))**2/2 !(Pa)
- AnnularComputational%minloss_ANNULAR(i)=AnnularComputational%minlosspa_ANNULAR(i)/6895 !(psi)
- elseif (AnnularComputational%CV_ANNULARLINE(i)/=0) then
- AnnularComputational%minlosspa_ANNULAR(i)=1000*sg*((11.7*RAM(RNUMBER)%Q*6.30902e-5*3600)/(AnnularComputational%CV_ANNULARLINE(i)))**2 !(pa)
- AnnularComputational%minloss_ANNULAR(i)=AnnularComputational%minlosspa_ANNULAR(i)/6895 !(psi)
- else
- AnnularComputational%minlosspa_ANNULAR(i)=AnnularComputational%NOTE_ANNULARLINE(i)*1e5 !(pa)
- AnnularComputational%minloss_ANNULAR(i)=AnnularComputational%minlosspa_ANNULAR(i)/6895 !(psi)
- endif
- enddo
-
- AnnularComputational%minloss_ANNULAR(17)= 3.4*RAM(RNUMBER)%Q ! <==== regulator loss (psig)
-
- RAM(RNUMBER)%minor_loss1=sum(AnnularComputational%minloss_ANNULAR(1:16)) !loss before regulator(psi)
-
- RAM(RNUMBER)%static_loss1=0
-
- RAM(RNUMBER)%kinetic_loss1=sg*wdens*(RAM(RNUMBER)%Q*6.30902e-5/((1/4.)*pi*(.72*0.254e-1)**2))**2/(2*6895) !(psi)
- !.72 for regulator diameter)
-
- RAM(RNUMBER)%loss_before= RAM(RNUMBER)%pipe_loss1+ RAM(RNUMBER)%minor_loss1+ RAM(RNUMBER)%static_loss1+ RAM(RNUMBER)%kinetic_loss1 !(psi)
- !===================after Regulator======================
- ! all in (psi)
- RAM(RNUMBER)%pipe_loss2=sum(AnnularComputational%friclossANNULAR(7:AnnularComputational%NO_PipingsAnnularLine)) !7=after regulator<<<<<<<
- RAM(RNUMBER)%minor_loss2=sum(AnnularComputational%minloss_ANNULAR(17:AnnularComputational%NO_MinorsAnnularLine)) !17=after regulator<<<<<<<
-
- RAM(RNUMBER)%deltah=Annular%H_AnnularBop-ShearRam%H_REGRAM
- ! RAM(RNUMBER)%static_loss2pa= RAM(RNUMBER)%deltah*sg*wdens*gravity; %(pa)
- RAM(RNUMBER)%static_loss2= RAM(RNUMBER)%deltah*sg*wdens*gravity/6895 !(psi)
- RAM(RNUMBER)%kinetic_loss2=0
-
- RAM(RNUMBER)%loss_after= RAM(RNUMBER)%pipe_loss2+ RAM(RNUMBER)%minor_loss2+ RAM(RNUMBER)%static_loss2 !(psi)
- !=======================================================
-
-
-
- !==========================p_regulator======================
- if (Annular%Pannular_regset<RamLine%P_ACC- RAM(RNUMBER)%loss_before) then
-
- !!new= Pannular_regset-minloss_ANNULAR(17)
- !
- !CALL Pannular_regDelay%AddToFirst( Pannular_regset-minloss_ANNULAR(17) )
- !CALL Pannular_regDelay%Remove(Pannular_regDelay%Length())
- !Pannular_reg= Pannular_regDelay%Last()
-
- Annular%Pannular_reg= Annular%Pannular_regset-AnnularComputational%minloss_ANNULAR(17)
-
- ! RAM(RNUMBER)%loss_after= RAM(RNUMBER)%loss_after-minloss(17); %minloss(17)=regulator loss
- else
-
- !!new= p_acc- RAM(RNUMBER)%loss_before-minloss_ANNULAR(17)
- !
- !CALL Pannular_regDelay%AddToFirst( p_acc- RAM(RNUMBER)%loss_before-minloss_ANNULAR(17) )
- !CALL Pannular_regDelay%Remove(Pannular_regDelay%Length())
- !Pannular_reg= Pannular_regDelay%Last()
-
- Annular%Pannular_reg= RamLine%P_ACC- RAM(RNUMBER)%loss_before-AnnularComputational%minloss_ANNULAR(17)
-
- endif
- !===========================================================
-
-
- !====================Flow Rate calculation==================
- RAM(RNUMBER)%diffp_ram=Annular%Pannular_reg+AnnularComputational%minloss_ANNULAR(17)-AnnularComputational%p_annular
-
-
-
-
-
- end do ! returns correct Q for one timecounter_ram
-
- if (RAM(RNUMBER)%Bottles_Charged_MalfActive==.true.) then
- RAM(RNUMBER)%Q= 5.0 ! gpm
- !write(*,*) 'malffffffffff'
- endif
-
- RAM(RNUMBER)%flow=RAM(RNUMBER)%Q
- !write(*,*) 'minloss_ANNULAR(17)=' , minloss_ANNULAR(17)
- !write(*,*) '%loss_after=' ,RAM(RNUMBER)%loss_after
- !====================p_accumulator for next iterate==================
- ! deltav=Q*1*1000; %delta_t=1sec (lit)
- ! fvr=fvr-deltav; %=fvr_after (lit)
- ! p_acc=0.001178*fvr^3+0.02019*fvr^2+16.1*fvr+2379; %(psia)
- ! vdis_bottles=fvr_tot-fvr; %from the start***needed for p_BOP calculating (lit)
-
- !========for a 10 gal bottle,precharge=1000psig curve BOSCH======
- RAM(RNUMBER)%deltav_bottles=RAM(RNUMBER)%Q*RamLine%DeltaT_BOP/60. !(galon) delta_t=1sec , Q(gpm)
- RamLine%FVR=RamLine%FVR- RAM(RNUMBER)%deltav_bottles !=fvr_after (galon)
- ! b1=993.7; b2=0.164; b3=5.492; b4=0.9796;
- RAM(RNUMBER)%p_acccheck=RamLine%P_ACC
- RamLine%P_ACC=RamLine%B1*exp(RamLine%B2*RamLine%FVR/BopStackAcc%NOBOTTLES)+RamLine%B3*exp(RamLine%B4*RamLine%FVR/BopStackAcc%NOBOTTLES) !(psig)<<<< 8=no. of bottles
- !formula is derived for fvr (galon)
- !vdis_bottles=fvr_tot-fvr
- RAM(RNUMBER)%vdis_bottles= RAM(RNUMBER)%vdis_bottles+ RAM(RNUMBER)%deltav_bottles
-
- RamLine%NoActiveRmas=6.-real(Annular%Annular_closed+RamLine%ShearBop_closed+PipeRam1%closed+PipeRam2%closed+ChokeLine%closed+KillLine%closed)
- RAM(RNUMBER)%vdis_elecp= RAM(RNUMBER)%vdis_elecp+(Pumps%DELTAV_ELECP/RamLine%NoActiveRmas) !overal discharged
- RAM(RNUMBER)%fvr_air= RAM(RNUMBER)%fvr_air+(Pumps%DELTAV_AIR/RamLine%NoActiveRmas) !=fvr_after (galon) for next timecounter_ram
-
-
- RAM(RNUMBER)%vdis_tot= RAM(RNUMBER)%vdis_bottles+ RAM(RNUMBER)%fvr_air+ RAM(RNUMBER)%vdis_elecp !overal
- !write(*,*) 'RAM(RNUMBER)%vdis_tot=' , RAM(RNUMBER)%vdis_tot!, vdis_bottles,fvr_air, vdis_elecp !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-
- !write(*,*) 'a)IDAnnular=' , IDAnnular
- ! WRITE(*,*) 'a)NeededVolumeAnnular=' , NeededVolumeAnnular
- !
- ! write(*,*) 'AbopAnnular= ' , AbopAnnular
- ! write(*,*) 'max=' , max(ODDrillpipe_inAnnular,ODDrillpipe_inAnnularBase)
-
- !if (ramtype==4) then !for annular
- if (Annular%AnnularIsClosing) then
- Annular%IDAnnular=(2.*(Annular%NeededVolumeAnnular- RAM(RNUMBER)%vdis_tot)*231./Annular%AbopAnnular)+max(Annular%ODDrillpipe_inAnnular,Annular%ODDrillpipe_inAnnularBase)
- !write(*,*) 'b)IDAnnular=' , IDAnnular
- endif
-
- if (Annular%AnnularIsOpening) then
- Annular%IDAnnular=Annular%IDAnnularBase-2.*(Annular%NeededVolumeAnnular- RAM(RNUMBER)%vdis_tot)*231./Annular%AbopAnnular
- endif
-
- if ( RAM(RNUMBER)%vdis_tot>Annular%NeededVolumeAnnular) then
-
- Annular%Annular_closed=1
- !Annular_closed_withPossibility= Annular_closed * TD_BOPConnectionPossibility(1)
- !pram_reg=pram_reg+minloss_ANNULAR(17)
- Annular%Pannular_reg= Annular%Pannular_reg+AnnularComputational%minloss_ANNULAR(17)
-
- RamLine%P_ACC= RAM(RNUMBER)%p_acccheck
- if (Annular%AnnularIsClosing) then
-
- Annular%IDAnnular=max(Annular%ODDrillpipe_inAnnular,Annular%ODDrillpipe_inAnnularBase)
- BopControlPanel%AnnularCloseLED = LedOn
- BopStackInput%AnnularCloseLedMine = LedOn
-
- BopControlPanel%AnnularOpenLED = LedOff
- BopStackInput%AnnularOpenLedMine = LedOff
-
- if (TD_BOP%BOPConnectionPossibility(1) == 1) then
- CALL CloseAnnular
- Annular%Annular_Situation_forTD= 1 ! closed - for TD code
- endif
- endif
-
-
-
- if (Annular%AnnularIsOpening) then
-
- Annular%IDAnnular=Annular%IDAnnularBase
- BopControlPanel%AnnularOpenLED = LedOn
- BopStackInput%AnnularOpenLedMine = LedOn
-
- BopControlPanel%AnnularCloseLED = LedOff
- BopStackInput%AnnularCloseLedMine = LedOff
-
- CALL OpenAnnular
- Annular%Annular_Situation_forTD= 0 ! open - for TD code
- endif
-
- endif
-
- ShearRam%IDAnnularFinal= Annular%IDAnnular ! for output data
- !endif
-
-
- end
|