SUBROUTINE DEALLOCATE_ARRAYS() USE VARIABLES implicit none !=========================================================================== ! RAMLINE MINOR LOSSES INPUT !=========================================================================== DEALLOCATE (MINORS1,MINORDIAMETER_RAMLINE,AREAMINOR_RAMLINE & ,LF_RAMLINE,CV_RAMLINE,NOTE_RAMLINE,RAMS%minlosspa,RAMS%minloss) !=========================================================================== ! RAMLINE PIPNING LOSSES INPUT !=========================================================================== DEALLOCATE (PIPINGS_RAMLINE,DIAM_RAMLINE_INCH, & AREA_RAMLINE,LENGT_RAMLINE,ROUGHNESS_RAMLINE,RELROUGH_RAMLINE & ,RAMS%Re_ramline,RAMS%fric,RAMS%fricloss) !=========================================================================== ! ANNULAR MINOR LOSSES INPUT !=========================================================================== DEALLOCATE (MINORS_ANNULAR,MINORDIAMETER_ANNULARLINE,AREAMINOR_ANNULARLINE & ,LF_ANNULARLINE,CV_ANNULARLINE,NOTE_ANNULARLINE,minlosspa_ANNULAR,minloss_ANNULAR) !=========================================================================== ! ANNULAR PIPNING LOSSES INPUT !=========================================================================== DEALLOCATE (PIPINGS_ANNULAR,DIAM_ANNULARLINE_INCH,AREA_ANNULARLINE, & LENGT_ANNULARLINE,ROUGHNESS_ANNULARLINE,RELROUGH_ANNULARLINE & ,Re_ANNULARline,fricANNULAR,friclossANNULAR) !=========================================================================== ! AIR PUMP LOSSES INPUT !=========================================================================== 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) !=========================================================================== ! DELAY ARRAYS !=========================================================================== call Pannular_regDelay%Empty() END SUBROUTINE LOSS_INPUTS() USE VARIABLES implicit none INTEGER I !=========================================================================== ! RAMLINE MINOR LOSSES INPUT !=========================================================================== NO_MINORSRAMLINE=34 ALLOCATE (MINORS1(NO_MINORSRAMLINE,4)) ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION MINORS1(1,1:4)= (/2., 2., 0., 0./) !Acc.tee MINORS1(2,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee MINORS1(3,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee MINORS1(4,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee MINORS1(5,1:4)= (/2., 0.9, 0., 0./) !tee MINORS1(6,1:4)= (/2., 2., 0., 0./) !tee MINORS1(7,1:4)= (/2., 0., 105., 0./) !valve MINORS1(8,1:4)= (/2., 0.9, 0., 0./) !tee MINORS1(9,1:4)= (/2., 0., 105., 0./) !valve MINORS1(10,1:4)= (/2., 0.42, 0., 0./) !elbow MINORS1(11,1:4)= (/2., 0.42, 0., 0./) !elbow MINORS1(12,1:4)= (/2., 0.8, 0., 0./) !unionA MINORS1(13,1:4)= (/2., 0.8, 0., 0./) !unionA MINORS1(14,1:4)= (/2., 1.5, 0., 0./) !elbow MINORS1(15,1:4)= (/2., 0., 425., 0./) !valve MINORS1(16,1:4)= (/2., 2., 0., 0./) !tee MINORS1(17,1:4)= (/0.75, 0., 1.5, 0./) !REGULATOR MINORS1(18,1:4)= (/1., 2., 0., 0./) !tee MINORS1(19,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS1(20,1:4)= (/1., 0.42, 0., 0./) !elbow MINORS1(21,1:4)= (/1., 0.42, 0., 0./) !elbow MINORS1(22,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS1(23,1:4)= (/1., 0., 105., 0./) !valve MINORS1(24,1:4)= (/1., 0.9, 0., 0./) !tee MINORS1(25,1:4)= (/1., 0., 0., 0.5/) !FT MINORS1(26,1:4)= (/1., 0., 0., 3.4/) !filter MINORS1(27,1:4)= (/1., 0., 105., 0./) !valve MINORS1(28,1:4)= (/1., 0.9, 0., 0./) !tee MINORS1(29,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS1(30,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS1(31,1:4)= (/1., 0., 9.2, 0./) !valve MINORS1(32,1:4)= (/1., 0.8, 0., 0./) !unionA MINORS1(33,1:4)= (/1., 0.8, 0., 0./) !unionA MINORS1(34,1:4)= (/0.75, 0.35, 0., 0./) !contraction ALLOCATE (MINORDIAMETER_RAMLINE(NO_MINORSRAMLINE),AREAMINOR_RAMLINE(NO_MINORSRAMLINE),LF_RAMLINE(NO_MINORSRAMLINE),CV_RAMLINE(NO_MINORSRAMLINE) & ,NOTE_RAMLINE(NO_MINORSRAMLINE),RAMS%minlosspa(6,NO_MINORSRAMLINE),RAMS%minloss(6,NO_MINORSRAMLINE)) DO I=1,NO_MINORSRAMLINE MINORDIAMETER_RAMLINE(I)=MINORS1(I,1) LF_RAMLINE(I)=MINORS1(I,2) CV_RAMLINE(I)=MINORS1(I,3) NOTE_RAMLINE(I)=MINORS1(I,4) AREAMINOR_RAMLINE(I)=PI*(MINORDIAMETER_RAMLINE(I)*0.0254)**2/4. !D(in), AREA(m) ENDDO !=========================================================================== ! RAMLINE PIPNING LOSSES INPUT !=========================================================================== NO_PIPINGSRAMLINE=15 ALLOCATE (PIPINGS_RAMLINE(NO_PIPINGSRAMLINE,3)) ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION PIPINGS_RAMLINE(1,1:3)= (/2., 1035., 0.03/) !Avg.acc.distance PIPINGS_RAMLINE(2,1:3)= (/2., 730., 0.03/) !Acc.end.horizontal PIPINGS_RAMLINE(3,1:3)= (/2., 2000., 0.03/) !Acc.end.vertical PIPINGS_RAMLINE(4,1:3)= (/2., 6000., 0.05/) !Hyd.hose PIPINGS_RAMLINE(5,1:3)= (/2., 2370., 0.03/) !Corner.vertical1 PIPINGS_RAMLINE(6,1:3)= (/2., 210., 0.03/) !Add.from.bend PIPINGS_RAMLINE(7,1:3)= (/1., 780., 0.03/) !Corner.horizontal1 PIPINGS_RAMLINE(8,1:3)= (/1., 780., 0.03/) !Corner.horizontal2 PIPINGS_RAMLINE(9,1:3)= (/1., 750., 0.03/) !Extra.length.back PIPINGS_RAMLINE(10,1:3)= (/1., 800., 0.03/) !Corner.horizontal3 PIPINGS_RAMLINE(11,1:3)= (/1., 1650., 0.03/) !Corner.vertical2 PIPINGS_RAMLINE(12,1:3)= (/1., 340., 0.03/) !12.Valves.horizontal PIPINGS_RAMLINE(13,1:3)= (/1., 1650., 0.03/) !Valves.vertical PIPINGS_RAMLINE(14,1:3)= (/1., 31000., 10./) !Hyd.hose PIPINGS_RAMLINE(15,1:3)= (/1., 526., 0.03/) !Add.from.bend ALLOCATE (DIAM_RAMLINE_INCH(NO_PIPINGSRAMLINE), & AREA_RAMLINE(NO_PIPINGSRAMLINE),LENGT_RAMLINE(NO_PIPINGSRAMLINE),ROUGHNESS_RAMLINE(NO_PIPINGSRAMLINE),RELROUGH_RAMLINE(NO_PIPINGSRAMLINE) & ,RAMS%Re_ramline(6,NO_PIPINGSRAMLINE),RAMS%fric(6,NO_PIPINGSRAMLINE),RAMS%fricloss(6,NO_PIPINGSRAMLINE)) DO I=1,NO_PIPINGSRAMLINE DIAM_RAMLINE_INCH(I)=PIPINGS_RAMLINE(I,1) LENGT_RAMLINE(I)=PIPINGS_RAMLINE(I,2) ROUGHNESS_RAMLINE(I)=PIPINGS_RAMLINE(I,3) AREA_RAMLINE(I)=PI*(DIAM_RAMLINE_INCH(I)*0.0254)**2/4 !D(in), AREA(m) RELROUGH_RAMLINE(I)=ROUGHNESS_RAMLINE(I)/(DIAM_RAMLINE_INCH(I)*25.4) !e/D !DIAM_RAMLINE_MM(I)=DIAM_RAMLINE_MM(I)*.001 ! (m) LENGT_RAMLINE(I)=LENGT_RAMLINE(I)*.001 ! (m) ENDDO !=========================================================================== ! ANNULAR PREVENTER MINOR LOSSES INPUT !=========================================================================== NO_MinorsAnnularLine=29 ALLOCATE (MINORS_ANNULAR(NO_MinorsAnnularLine,4)) ! ID(INCH) LF CV NOTE(BAR) DESCRIPTION MINORS_ANNULAR(1,1:4)= (/2., 2., 0., 0./) !Acc.tee MINORS_ANNULAR(2,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee MINORS_ANNULAR(3,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee MINORS_ANNULAR(4,1:4)= (/2., 0.9, 0., 0./) !Avg.acc.tee MINORS_ANNULAR(5,1:4)= (/2., 0.9, 0., 0./) !tee MINORS_ANNULAR(6,1:4)= (/2., 2., 0., 0./) !tee MINORS_ANNULAR(7,1:4)= (/2., 0., 105., 0./) !valve MINORS_ANNULAR(8,1:4)= (/2., 0.9, 0., 0./) !tee MINORS_ANNULAR(9,1:4)= (/2., 0., 105., 0./) !valve MINORS_ANNULAR(10,1:4)= (/2., 0.42, 0., 0./) !elbow MINORS_ANNULAR(11,1:4)= (/2., 0.42, 0., 0./) !elbow MINORS_ANNULAR(12,1:4)= (/2., 0.8, 0., 0./) !unionA MINORS_ANNULAR(13,1:4)= (/2., 0.8, 0., 0./) !unionA MINORS_ANNULAR(14,1:4)= (/2., 1.5, 0., 0./) !elbow MINORS_ANNULAR(15,1:4)= (/2., 0., 425., 0./) !valve MINORS_ANNULAR(16,1:4)= (/2., 2., 0., 0./) !tee MINORS_ANNULAR(17,1:4)= (/0.75, 0., 1.5, 0./) !REGULATOR MINORS_ANNULAR(18,1:4)= (/1., 2., 0., 0./) !tee MINORS_ANNULAR(19,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS_ANNULAR(20,1:4)= (/1., 0.42, 0., 0./) !elbow MINORS_ANNULAR(21,1:4)= (/1., 0.42, 0., 0./) !elbow MINORS_ANNULAR(22,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS_ANNULAR(23,1:4)= (/1., 0., 3.2, 0./) !valve MINORS_ANNULAR(24,1:4)= (/1., 2., 0., 0./) !tee MINORS_ANNULAR(25,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS_ANNULAR(26,1:4)= (/1., 0.42, 0., 0./) !elbow MINORS_ANNULAR(27,1:4)= (/1., 0.42, 0., 0./) !elbow MINORS_ANNULAR(28,1:4)= (/1., 1.5, 0., 0./) !elbow MINORS_ANNULAR(29,1:4)= (/1., 0., 3.2, 0./) !valve ALLOCATE (MINORDIAMETER_ANNULARLINE(NO_MinorsAnnularLine),AREAMINOR_ANNULARLINE(NO_MinorsAnnularLine),LF_ANNULARLINE(NO_MinorsAnnularLine) & ,CV_ANNULARLINE(NO_MinorsAnnularLine),NOTE_ANNULARLINE(NO_MinorsAnnularLine),minlosspa_ANNULAR(NO_MinorsAnnularLine),minloss_ANNULAR(NO_MinorsAnnularLine)) DO I=1,NO_MinorsAnnularLine MINORDIAMETER_ANNULARLINE(I)=MINORS_ANNULAR(I,1) LF_ANNULARLINE(I)=MINORS_ANNULAR(I,2) CV_ANNULARLINE(I)=MINORS_ANNULAR(I,3) NOTE_ANNULARLINE(I)=MINORS_ANNULAR(I,4) AREAMINOR_ANNULARLINE(I)=PI*(MINORDIAMETER_ANNULARLINE(I)*0.0254)**2/4. !D(in), AREA(m) ENDDO !=========================================================================== ! ANNULAR PREVENTER PIPNING LOSSES INPUT !=========================================================================== NO_PipingsAnnularLine=10 ALLOCATE (PIPINGS_ANNULAR(NO_PipingsAnnularLine,3)) ! ID(INCH) L(MM) ROUGHNESS(MM)=e DESCRIPTION PIPINGS_ANNULAR(1,1:3)= (/2., 1035., 0.03/) !Avg.acc.distance PIPINGS_ANNULAR(2,1:3)= (/2., 730., 0.03/) !Acc.endhorizontal PIPINGS_ANNULAR(3,1:3)= (/2., 2000., 0.03/) !Acc.endvertical PIPINGS_ANNULAR(4,1:3)= (/2., 6000., 0.03/) !Hyd.hose PIPINGS_ANNULAR(5,1:3)= (/2., 2370., 0.03/) !Corner.vertical1 PIPINGS_ANNULAR(6,1:3)= (/2., 210., 0.03/) !Add.frombend PIPINGS_ANNULAR(7,1:3)= (/2., 1000., 0.03/) !manifold PIPINGS_ANNULAR(8,1:3)= (/1., 46000., 0.03/) !pipe PIPINGS_ANNULAR(9,1:3)= (/2., 1000., 0.03/) !manifold PIPINGS_ANNULAR(10,1:3)= (/1., 46000., 0.03/) !pipe ALLOCATE (DIAM_ANNULARLINE_INCH(NO_PipingsAnnularLine),AREA_ANNULARLINE(NO_PipingsAnnularLine),LENGT_ANNULARLINE(NO_PipingsAnnularLine) & ,ROUGHNESS_ANNULARLINE(NO_PipingsAnnularLine),RELROUGH_ANNULARLINE(NO_PipingsAnnularLine) & ,Re_ANNULARline(NO_PipingsAnnularLine),fricANNULAR(NO_PipingsAnnularLine),friclossANNULAR(NO_PipingsAnnularLine)) DO I=1,NO_PipingsAnnularLine DIAM_ANNULARLINE_INCH(I)=PIPINGS_ANNULAR(I,1) LENGT_ANNULARLINE(I)=PIPINGS_ANNULAR(I,2) ROUGHNESS_ANNULARLINE(I)=PIPINGS_ANNULAR(I,3) AREA_ANNULARLINE(I)=PI*(DIAM_ANNULARLINE_INCH(I)*0.0254)**2/4. !D(in), AREA(m) RELROUGH_ANNULARLINE(I)=ROUGHNESS_ANNULARLINE(I)/(DIAM_ANNULARLINE_INCH(I)*25.4) !DIAM_ANNULARLINE_MM(I)=DIAM_ANNULARLINE_MM(I)*.001 ! (m) LENGT_ANNULARLINE(I)=LENGT_ANNULARLINE(I)*.001 ! (m) ENDDO !=========================================================================== ! 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)= (/2., 10000., 0.03/) !Avg.acc.distance 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 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 ByPassOld= -1.0 elseif(BopControlPanel%ByePassValve == 1.0) then 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 (airp_switch==0) deltav_air=0 fvr=fvr+deltav_air+deltav_elecp pacc_before=p_acc p_acc=b1*exp(b2*fvr/nobottles)+b3*exp(b4*fvr/nobottles) ! adiabatic(psig)<<<< 8=no. of bottles !===================================================================== if(ByPassOld == 1.0) then if (pram_reg BaseDifferenceP) then pram_reg= pram_reg + (PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20. else if (pram_reg BaseDifferenceP) then pram_reg= pram_reg + (PressureDifference/PressureDifferenceSteps) ! PressureDifferenceSteps = 20. else pram_reg= 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 QAIR_PUMP=Qiter+.1 !(gpm) maximum flow for the start diffp_air=-10 losses_air=10 !=================================================================== ! AIR OPERATED PUMP !=================for air consumption at 8 bar====================== do while (diffp_air<0) QAIR_PUMP=QAIR_PUMP-.1 ! Qup=QAIR_PUMP; ! bba1 =31.8; bba2 =-725.7 ; bba3 =4154; p_airp=bba1*QAIR_PUMP**2+bba2*QAIR_PUMP+bba3 !(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+kinetic_air-p_acc 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+.01 else QAIR_PUMP=QAIR_PUMP-.01 endif !=================================================================== ! AIR OPERATED PUMP ! Maximator - Model: GX (35) !=================for air consumption at 8 bar====================== p_airp=bba1*QAIR_PUMP**2+bba2*QAIR_PUMP+bba3 !(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+kinetic_air-p_acc !===========================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)NeededVolumeShearRams) then ShearBop_closed=1 !ShearBop_closed_withPossibility= ShearBop_closed * TD_BOPConnectionPossibility(3) pram_reg=pram_reg+RAMS%minloss(RNUMBER,17) p_acc= RAM(RNUMBER)%p_acccheck if (ShearRamIsClosing) then IDshearBop=0. + ShearIsNotAllowed*ODDrillpipe_inShearRam BopControlPanel%MiddleRamsCloseLED = LedOn MiddleRamsCloseLEDMine = LedOn BopControlPanel%MiddleRamsOpenLED = LedOff MiddleRamsOpenLEDMine = LedOff if (TD_BOPConnectionPossibility(3) == 1 .and. ShearIsNotAllowed==0) then CALL CloseMiddleRams ShearBop_Situation_forTD= 1 ! closed - for TD code endif endif if (ShearRamIsOpening) then IDshearBop=IDshearBopBase BopControlPanel%MiddleRamsOpenLED = LedOn MiddleRamsOpenLEDMine = LedOn BopControlPanel%MiddleRamsCloseLED = LedOff MiddleRamsCloseLEDMine = LedOff CALL OpenMiddleRams ShearBop_Situation_forTD= 0 ! open - for TD code endif endif IDshearBopFinal= IDshearBop ! for output data endif if (ramtype==2) then !for pipe ram1 if (PipeRam1IsClosing) then IDPipeRam1=(2.*(NeededVolumePipeRams1- RAM(RNUMBER)%vdis_tot)*231./AbopPipeRam)+max(ODDrillpipe_inPipeRam1,ODDrillpipe_inPipeRam1Base) endif if (PipeRam1IsOpening) then IDPipeRam1=IDPipeRamBase-2.*(NeededVolumePipeRams1- RAM(RNUMBER)%vdis_tot)*231./AbopPipeRam endif if ( RAM(RNUMBER)%vdis_tot>NeededVolumePipeRams1) then PipeRam1_closed=1 !PipeRam1_Situation_forTD= PipeRam1_closed * TD_BOPConnectionPossibility(2) pram_reg=pram_reg+RAMS%minloss(RNUMBER,17) p_acc= RAM(RNUMBER)%p_acccheck if (PipeRam1IsClosing) then IDPipeRam1=max(ODDrillpipe_inPipeRam1,ODDrillpipe_inPipeRam1Base) BopControlPanel%UpperRamsCloseLED = LedOn UpperRamsCloseLEDMine = LedOn BopControlPanel%UpperRamsOpenLED = LedOff UpperRamsOpenLEDMine = LedOff if (TD_BOPConnectionPossibility(2) == 1) then CALL CloseUpperRams ! for C code call Set_BlowoutFromAnnular(.true.) PipeRam1_Situation_forTD= 1 ! closed - for TD code endif endif if (PipeRam1IsOpening) then IDPipeRam1=IDPipeRamBase BopControlPanel%UpperRamsOpenLED = LedOn UpperRamsOpenLEDMine = LedOn BopControlPanel%UpperRamsCloseLED = LedOff UpperRamsCloseLEDMine = LedOff Call OpenUpperRams ! for C code PipeRam1_Situation_forTD= 0 ! open - for TD code endif endif IDPipeRam1Final= IDPipeRam1 ! for output data endif if (ramtype==3) then !for pipe ram2 if (PipeRam2IsClosing) then IDPipeRam2=(2.*(NeededVolumePipeRams2- RAM(RNUMBER)%vdis_tot)*231./AbopPipeRam)+max(ODDrillpipe_inPipeRam2,ODDrillpipe_inPipeRam1Base) endif if (PipeRam2IsOpening) then IDPipeRam2=IDPipeRamBase-2.*(NeededVolumePipeRams2- RAM(RNUMBER)%vdis_tot)*231./AbopPipeRam endif if ( RAM(RNUMBER)%vdis_tot>NeededVolumePipeRams2) then PipeRam2_closed=1 !PipeRam2_closed_withPossibility= PipeRam2_closed * TD_BOPConnectionPossibility(4) pram_reg=pram_reg+RAMS%minloss(RNUMBER,17) p_acc= RAM(RNUMBER)%p_acccheck if (PipeRam2IsClosing) then IDPipeRam2=max(ODDrillpipe_inPipeRam2,ODDrillpipe_inPipeRam1Base) BopControlPanel%LowerRamsCloseLED = LedOn LowerRamsCloseLEDMine = LedOn BopControlPanel%LowerRamsOpenLED = LedOff LowerRamsOpenLEDMine = LedOff if (TD_BOPConnectionPossibility(4) == 1) then CALL CloseLowerRams PipeRam2_Situation_forTD= 1 ! closed - for TD code endif endif if (PipeRam2IsOpening) then IDPipeRam2=IDPipeRamBase BopControlPanel%LowerRamsOpenLED = LedOn LowerRamsOpenLEDMine = LedOn BopControlPanel%LowerRamsCloseLED = LedOff LowerRamsCloseLEDMine = LedOff CALL OpenLowerRams PipeRam2_Situation_forTD= 0 ! open - for TD code endif endif IDPipeRam2Final= IDPipeRam2 ! for output data endif if (ramtype==4) then !for Choke Line if (ChokeLineIsClosing) then IDChokeLine=(2.*(NeededVolumeChokeLine- RAM(RNUMBER)%vdis_tot)*231./AbopChokeLine)+max(ODDrillpipe_inChokeLine,ODDrillpipe_inChokeLineBase) endif if (ChokeLineIsOpening) then IDChokeLine=IDChokeLineBase-2.*(NeededVolumeChokeLine- RAM(RNUMBER)%vdis_tot)*231./AbopChokeLine endif if ( RAM(RNUMBER)%vdis_tot>NeededVolumeChokeLine) then ChokeLine_closed=1 pram_reg=pram_reg+RAMS%minloss(RNUMBER,17) p_acc= RAM(RNUMBER)%p_acccheck if (ChokeLineIsClosing) then IDChokeLine=max(ODDrillpipe_inChokeLine,ODDrillpipe_inChokeLineBase) BopControlPanel%ChokeLineCloseLED = LedOn ChokeLineCloseLEDMine = LedOn BopControlPanel%ChokeLineOpenLED = LedOff ChokeLineOpenLEDMine = LedOff CALL CloseChokeLine endif if (ChokeLineIsOpening) then IDChokeLine=IDChokeLineBase BopControlPanel%ChokeLineOpenLED = LedOn ChokeLineOpenLEDMine = LedOn BopControlPanel%ChokeLineCloseLED = LedOff ChokeLineCloseLEDMine = LedOff CALL OpenChokeLine endif endif endif if (ramtype==5) then !for Kill Line if (KillLineIsClosing) then IDKillLine=(2.*(NeededVolumeKillLine- RAM(RNUMBER)%vdis_tot)*231./AbopKillLine)+max(ODDrillpipe_inKillLine,ODDrillpipe_inKillLineBase) endif if (KillLineIsOpening) then IDKillLine=IDKillLineBase-2.*(NeededVolumeKillLine- RAM(RNUMBER)%vdis_tot)*231./AbopKillLine endif if ( RAM(RNUMBER)%vdis_tot>NeededVolumeKillLine) then KillLine_closed=1 pram_reg=pram_reg+RAMS%minloss(RNUMBER,17) p_acc= RAM(RNUMBER)%p_acccheck if (KillLineIsClosing) then IDKillLine=max(ODDrillpipe_inKillLine,ODDrillpipe_inKillLineBase) BopControlPanel%KillLineCloseLED = LedOn KillLineCloseLedMine = LedOn BopControlPanel%KillLineOpenLED = LedOff KillLineOpenLedMine = LedOff CALL CloseKillLine endif if (KillLineIsOpening) then IDKillLine=IDKillLineBase BopControlPanel%KillLineOpenLED = LedOn KillLineOpenLedMine = LedOn BopControlPanel%KillLineCloseLED = LedOff 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) p_annular=448-(19.7*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>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 tolAnnular=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,NO_PipingsAnnularLine Re_ANNULARline(i)=RAM(RNUMBER)%Q*6.30902e-5*DIAM_ANNULARLINE_INCH(i)*0.0254/(AREA_ANNULARLINE(i)*nu) enddo do i=1,NO_PipingsAnnularLine if (Re_ANNULARline(i)