def test_check_FFC_Isp_values(self): """test check FFC Isp values""" geomObj = Geometry(Rthrt=1, CR=2.5, eps=62.5, pcentBell=75, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const( 'ERE', 0.98) # don't know injector details so set effERE=0.98 # It's an ablative chamber, so some FFC (fuel film cooling) is required... guess about 10% C = CoreStream(geomObj=geomObj, effObj=effObj, pcentFFC=10.0, Pamb=0.001, oxName='N2O4', fuelName='A50', MRcore=1.6, Pc=100) C.reset_attr('Pc', 100) self.assertAlmostEqual(C('IspDel'), 325.64723, places=2) self.assertAlmostEqual(C('IspODE'), 338.9201, places=2) self.assertAlmostEqual(C('IspODF'), 320.4940, places=2)
def __init__(self, name='RocketIsp Thruster', coreObj=CoreStream(), injObj=None, noz_regen_eps=1.0, pulse_sec=float('inf'), pulse_quality=0.8, isRegenCham=False, calc_CdThroat=True): """ Calculate delivered thrust chamber Isp by simplified JANNAF method. """ self.name = name self.coreObj = coreObj self.geomObj = coreObj.geomObj self.injObj = injObj #self.iprop = coreObj.oxName + '/' + coreObj.fuelName self.pulse_sec = pulse_sec self.pulse_quality = pulse_quality self.noz_regen_eps = noz_regen_eps self.isRegenCham = isRegenCham self.calc_CdThroat = calc_CdThroat self.calc_all_eff()
def test_check_Isp_values(self): """test check Isp values""" C = CoreStream(geomObj=Geometry(eps=35), effObj=Efficiencies(ERE=0.98, Noz=0.97), oxName='LOX', fuelName='CH4', MRcore=3.6, Pc=500, Pamb=14.7) self.assertAlmostEqual(C('IspAmb'), 251.9288, places=2) self.assertAlmostEqual(C('IspDel'), 345.2795, places=2) self.assertAlmostEqual(C('IspODE'), 363.2227, places=2) self.assertAlmostEqual(C('IspODF'), 334.1623, places=2) C.reset_CdThroat(C.CdThroat) C.reset_attr('Pamb', C.Pexit + 0.06, re_evaluate=True) C.reset_attr('Pamb', C.Pexit, re_evaluate=True) C.reset_attr('Pamb', 15, re_evaluate=True)
def test_overall_Isp_efficiency(self): """test overall Isp efficiency""" G = Geometry(Rthrt=5.978, CR=2.5, eps=62.5, pcentBell=75, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) C = CoreStream(geomObj=G, effObj=Efficiencies(ERE=0.98, Noz=0.96515), pcentFFC=10.0, oxName='N2O4', fuelName='A50', MRcore=1.6, Pc=100, Pamb=0.0) I = Injector( C, Tox=None, Tfuel=None, elemEm=0.8, fdPinjOx=0.25, fdPinjFuel=0.25, dpOxInp=None, dpFuelInp=None, setNelementsBy= 'acoustics', # can be "acoustics", "elem_density", "input" elemDensInp=5, NelementsInp=100, OxOrfPerEl=1.0, FuelOrfPerEl=1.0, lolFuelElem=True, setAcousticFreqBy='mode', # can be "mode" or "freq" desAcousMode='2T', desFreqInp=5000, CdOxOrf=0.75, CdFuelOrf=0.75, dropCorrOx=0.33, dropCorrFuel=0.33, DorfMin=0.008, LfanOvDorfOx=20.0, LfanOvDorfFuel=20.0) self.assertAlmostEqual(I('MolWtOx'), 92.011, places=1)
def __init__(self, name='PI Thruster', geomObj=Geometry(), ERE=0.98, oxName='N2O4', fuelName='MMH', MRcore=1.9, Pc=500, isRegenCham=0, noz_regen_eps=1.0, calc_CdThroat=True): # create a perfect injector CoreStream coreObj = CoreStream( geomObj=geomObj, effObj=Efficiencies(ERE=ERE), oxName=oxName, fuelName=fuelName, MRcore=MRcore, Pc=Pc) self.R = RocketThruster( name=name, coreObj=coreObj, injObj=None, isRegenCham=isRegenCham, noz_regen_eps=noz_regen_eps, calc_CdThroat=calc_CdThroat)
RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=16) effObj = Efficiencies() #effObj.set_const('ERE', 0.98) core = CoreStream(geomObj, effObj, oxName='N2O4', fuelName='MMH', MRcore=1.85, Pc=150, CdThroat=0.995, pcentFFC=14.0, ko=0.035) inj = Injector( core, Tox=None, Tfuel=None, elemEm=0.9, fdPinjOx=0.25, fdPinjFuel=0.25, elemDensInp=None, NelementsInp=None, setNelementsBy='acoustics', # can be "acoustics", "density", "input"
from rocketisp.rocket_isp import RocketThruster from rocketisp.geometry import Geometry from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies from rocketisp.examples.compare_vals import compare_header, compare geomObj = Geometry(Rthrt=3, CR=2.5, eps=55, pcentBell=80, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.97 ) core = CoreStream( geomObj=geomObj, effObj=effObj, oxName='N2O4', fuelName='MMH', MRcore=1.65, Pc=125, pcentFFC=4.5 ) R = RocketThruster(name='Shuttle OMS',coreObj=core, injObj=None) R.scale_Rt_to_Thrust( 6000 , Pamb=0.0 ) R.set_MRthruster( MRthruster=1.65 ) R.scale_Rt_to_Thrust( 6000 , Pamb=0.0 ) compare_header() compare('Fvacuum',6000, core('FvacTotal')) compare('Isp Vacuum', 313.2, core('IspDel')) compare('Engine Length', 77, geomObj('Ltotal')) compare('Nozzle ID', 43.09, geomObj('Rexit')*2) #R.summ_print()
from rocketisp.rocket_isp import RocketThruster from rocketisp.geometry import Geometry from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies from rocketisp.examples.compare_vals import compare_header, compare geomObj = Geometry(Rthrt=Rthrt, CR=(5.131/2.4724)**2, eps=eps, pcentBell=70, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=2.4842/2, LchmMin=2.0, LchamberInp=15.0) effObj = Efficiencies() effObj.set_const('ERE', 0.9892 ) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=MRcore, Pc=Pc, CdThroat=CdThroat) R = RocketThruster(name='RL10',coreObj=core, injObj=None, calc_CdThroat=False, noz_regen_eps=eps) R.scale_Rt_to_Thrust( Fvac, Pamb=0.0 , use_scipy=False ) compare_header() compare('Fvacuum',Fvac, core('FvacTotal')) compare('Isp Vacuum', Isp, core('IspDel')) compare('Cstar ODE', cstarODE, core('cstarODE')) print() compare('Fuel Flow Rate', wdotFuel, core('wdotFlCore')) compare('Ox Flow Rate', wdotOx, core('wdotOxCore'))
CR=2.5, eps=40, pcentBell=90, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() core = CoreStream(geomObj=geomObj, effObj=effObj, oxName='LOX', fuelName='CH4', MRcore=3.6, Pc=4786) R = RocketThruster(name='SpaceX Raptor', coreObj=core, injObj=None) R.scale_Rt_to_Thrust(500000, Pamb=0.0) compare_header() compare('Fvacuum', 500000, core('FvacTotal')) compare('Isp Vacuum', 380, core('IspDel')) core.reset_attr('Pamb', 14.7, re_evaluate=True) compare('Isp SeaLevel', 330, core('IspAmb')) core.reset_attr('Pamb', 0, re_evaluate=True)
from rocketisp.geometry import Geometry from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies # create basic Geometry. # Use "place-holder" of 1 inch for throat radius... correct later with "scale_Rt_to_Thrust" geomObj = Geometry(Rthrt=1, CR=2.5, eps=62.5, pcentBell=72.3, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.98) # don't know injector details so set effERE=0.98 # It's an ablative chamber, so some FFC (fuel film cooling) is required... guess about 15% core = CoreStream( geomObj=geomObj, effObj=effObj, pcentFFC=15.0, oxName='N2O4', fuelName='A50', MRcore=1.6, Pc=100 ) R = RocketThruster(name='Apollo SPS',coreObj=core) # scale geometry to give 20,500 lbf of thrust for current conditions R.scale_Rt_to_Thrust( 20500 , Pamb=0.0 ) # figure out best mixture ratio to run the engine. R.set_mr_to_max_ispdel() # re-scale geometry to give 20,500 lbf of thrust after MR change R.scale_Rt_to_Thrust( 20500 , Pamb=0.0 ) fsave = 'Apollo_SPS.html' fOut = open(fsave , 'w') fOut.write( R.get_html_file_str() )
Rt = (At / pi)**0.5 #print( 'Calculated MR =', wdOx / wdFuel ) dpOxInp=160 dpFuelInp=100 geomObj = Geometry(Rthrt=Rt, CR=CR, eps=eps, pcentBell=pcentBell, RupThroat=0.5, RdwnThroat=1.0, RchmConv=0.5, cham_conv_deg=30, LchmOvrDt=3, LchmMin=2.0, LchamberInp=Lcham) effObj = Efficiencies() effObj.set_const('ERE', 0.975 ) core = CoreStream( geomObj, effObj, oxName=oxName, fuelName=fuelName, MRcore=MR, Pc=Pc, Pamb=14.7, CdThroat=1.0, adjCstarODE=0.992801, adjIspIdeal=1.01876) C = RocketThruster(name='Huzel A-2',coreObj=core, injObj=None, calc_CdThroat=False) #C.scale_Rt_to_Thrust( Fvac, Pamb=0 , use_scipy=False ) compare_header() compare('Fvacuum',Fvac, core('FvacTotal')) compare('CfVacDesign', CfVacDesign, core('CfVacDel')) print() compare('Efficiency Cstar/ERE', effCstar, effObj('ERE')) compare('Cstar ODE', cstarODE, core('cstarODE'))
from rocketisp.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.rocket_isp import RocketThruster C = CoreStream( geomObj=Geometry(eps=35), effObj=Efficiencies(ERE=0.99), oxName='LOX', fuelName='LH2', MRcore=6, Pc=500, Pamb=0) R = RocketThruster(name='Example 6K Thruster', coreObj=C) R.scale_Rt_to_Thrust( 6000 , Pamb=0.0 ) R.summ_print()
""" model the XLR-134 """ from rocketisp.rocket_isp import RocketThruster from rocketisp.geometry import Geometry from rocketisp.stream_tubes import CoreStream from rocketisp.efficiencies import Efficiencies geomObj = Geometry(Rthrt=1, CR=3.0, eps=767.9, pcentBell=80, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', (490.45-8.6)/490.45) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=6.0, Pc=510 ) R = RocketThruster(name='xlr134',coreObj=core, injObj=None) R.scale_Rt_to_Thrust( 500 , Pamb=0.0 , use_scipy=False ) R.summ_print()
RdwnThroat=1.0, RchmConv=0.5, cham_conv_deg=30, LchmOvrDt=3, LchmMin=2.0, LchamberInp=Lcham) effObj = Efficiencies() effObj.set_const('ERE', 0.975) effObj.set_const('Noz', 0.933177) # Huzel based on frozen Isp core = CoreStream(geomObj, effObj, oxName=oxName, fuelName=fuelName, MRcore=MR, Pc=Pc, Pamb=14.7, CdThroat=1.0, adjCstarODE=0.978196, adjIspIdeal=1.0084418978404621) C = RocketThruster(name='Huzel A-1', coreObj=core, calc_CdThroat=False) #C.scale_Rt_to_Thrust( FseaLevel, Pamb=15 , use_scipy=False ) compare_header() compare('FseaLevel', FseaLevel, core('Fambient')) compare('CfVacDesign', CfVacDesign, core('CfVacDel')) compare('CfAmbDel', CfAmbDel, core('CfAmbDel'))
pcentBell=80, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() # It's an ablative chamber, so some FFC (fuel film cooling) is required... guess about 10% C = CoreStream(geomObj=geomObj, effObj=effObj, pcentFFC=0.0, Pamb=0.0, oxName='N2O4', fuelName='MMH', MRcore=1.9, Pc=500) I = Injector( C, Tox=None, Tfuel=None, elemEm=0.8, fdPinjOx=0.25, fdPinjFuel=0.25, elemDensInp=None, NelementsInp=None, setNelementsBy='acoustics', # can be "acoustics", "density", "input" setAcousticFreqBy='mode', # can be "mode" or "freq"
from rocketisp.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream C = CoreStream(geomObj=Geometry(eps=35), effObj=Efficiencies(ERE=0.98, Noz=0.97), oxName='LOX', fuelName='CH4', MRcore=3.6, Pc=500, Pamb=14.7) for name in ['IspODE', 'IspDel', 'IspODF']: print('%8s =' % name, '%.1f' % C(name)) print('%8s =' % 'IspAmb', '%.1f' % C('IspAmb'), C('noz_mode')) C.summ_print()
def calc_ODE_ODK_FROZ_isp(oxName='N2O4', fuelName='MMH', Pc=1000.0, eps=10.0, pcentBell=80.0, Fvac=1000.0, NumRuns=20, do_show=True): # ============ use RocketCEA to find MR range =================== mc = MR_Temperature_Limits(oxName=oxName, fuelName=fuelName, PcNominal=Pc, epsNominal=eps) mr_peak = MR_Peak_At_EpsPc( mc, pc=Pc, eps=eps, ispType='CEAODE', # ispType can be CEAODE, CEAFROZEN NterpSize=100) print('Peak IspODE=%g sec at MR =' % mr_peak.ispPeak, mr_peak.mrPeak) print() print('MR at 97% Isp (on low side) =', mr_peak.calc_mrLow_minus_NPcentIsp()) print('MR at 97% Isp (on high side) =', mr_peak.calc_mrHigh_minus_NPcentIsp()) mr_lo = round( mr_peak.mrLeftOfPeak - (mr_peak.mrRightOfPeak - mr_peak.mrLeftOfPeak) / 10.0, 2) mr_hi = round(mr_peak.mrRightOfPeak, 2) delMR = (mr_hi - mr_lo) / (NumRuns - 1) # =============================== geomObj = Geometry(Rthrt=5.868 / 2, CR=2.5, eps=eps, pcentBell=pcentBell, RupThroat=1.5, RdwnThroat=1.0, RchmConv=1.0, cham_conv_deg=30, LchmOvrDt=3.10, LchmMin=2.0, LchamberInp=16) core = CoreStream(geomObj, oxName=oxName, fuelName=fuelName, MRcore=1.6, Pc=Pc) R = RocketThruster(name='sample', coreObj=core, injObj=None) ispodeL = [] ispodkL = [] ispodfL = [] mrL = [] MR = mr_lo for _ in range(NumRuns): mrL.append(MR) core.reset_attr('MRcore', MR, re_evaluate=True) R.scale_Rt_to_Thrust(Fvac, Pamb=0.0, use_scipy=False) ispodeL.append(R.coreObj.IspODE) ispodkL.append(R.coreObj.IspODK) ispodfL.append(R.coreObj.IspODF) MR += delMR # ======= find peaks ====== mr_ode_terp = InterpProp(mrL, ispodeL) mr_ode_Peak, isp_ode_peak = gold_search_max(mr_ode_terp, mrL[0], mrL[-1], tol=1.0e-5) mr_odk_terp = InterpProp(mrL, ispodkL) mr_odk_Peak, isp_odk_peak = gold_search_max(mr_odk_terp, mrL[0], mrL[-1], tol=1.0e-5) mr_odf_terp = InterpProp(mrL, ispodfL) mr_odf_Peak, isp_odf_peak = gold_search_max(mr_odf_terp, mrL[0], mrL[-1], tol=1.0e-5) fig, ax = plt.subplots(figsize=(8, 6)) plt.plot(mrL, ispodeL, label='IspODE', color=COLORL[0]) plt.plot(mrL, ispodkL, label='IspODK', color=COLORL[1]) plt.plot(mrL, ispodfL, label='IspODF', color=COLORL[2]) # show ========= optimum MR difference ======== def span_mrpeak(isL): minpt = min(isL) maxpt = max(isL) span = maxpt - minpt return [maxpt - 0.8 * span, maxpt] plt.plot([mr_ode_Peak, mr_ode_Peak], span_mrpeak(ispodeL), '--', label='MRode=%.2f' % mr_ode_Peak, linewidth=2, color=COLORL[0]) plt.plot([mr_odk_Peak, mr_odk_Peak], span_mrpeak(ispodkL), '--', label='MRodk=%.2f' % mr_odk_Peak, linewidth=2, color=COLORL[1]) plt.plot([mr_odf_Peak, mr_odf_Peak], span_mrpeak(ispodfL), '--', label='MRodf=%.2f' % mr_odf_Peak, linewidth=2, color=COLORL[2]) isp_odk_peak = abs(isp_odk_peak) plt.text(mr_odk_Peak, isp_odk_peak, '%i' % int(isp_odk_peak), ha='left', va='bottom', transform=ax.transData, color=COLORL[1]) plt.legend() plt.ylabel('Isp (sec)') plt.xlabel('Mixture Ratio') plt.title( "%s/%s RocketIsp ODE ODK ODF\nFvac=%.0f lbf, Pc=%.0f psia, AR=%.0f:1, %%Bell=%.0f%%"%\ (oxName, fuelName, Fvac, Pc, eps, pcentBell)) png_name = 'odekf_%s_%s_Fvac%g_Pc%g_eps%g.png' % (oxName, fuelName, Fvac, Pc, eps) plt.savefig(png_name, dpi=120) if do_show: plt.show()
print('MR at 97% Isp (on low side) =', mr_peak.calc_mrLow_minus_NPcentIsp()) print('MR at 97% Isp (on high side) =', mr_peak.calc_mrHigh_minus_NPcentIsp()) mr_lo = round( mr_peak.mrLeftOfPeak - (mr_peak.mrRightOfPeak - mr_peak.mrLeftOfPeak) / 10.0, 2) mr_hi = round(mr_peak.mrRightOfPeak, 2) print('mr_lo =', mr_lo) print('mr_hi =', mr_hi) # =========== create RocketIsp structures # create CoreStream with area ratio=375:1, Pc=137, FFC=30% and effERE=0.99 C = CoreStream(geomObj=Geometry(eps=eps), effObj=Efficiencies(ERE=1.0, Div=1.0, BL=1.0, TP=1.0), pcentFFC=0, oxName=oxName, fuelName=fuelName, MRcore=mr_lo, Pc=Pc, Pamb=0) # instantiate RocketThruster R = RocketThruster(name='Sample Thruster', coreObj=C) R.scale_Rt_to_Thrust(ThrustLbf=Fvac, Pamb=0.0) #R.summ_print() # ========================================================= # generate data ispodeL = [] # list of IspODE (one-dimensional equilibrium) ispodkL = [] # list of IspODK (one-dimensional kinetic) ispodfL = [] # list of IspODF (frozen) mrcoreL = [] # list of MRcore (core stream tube mixture ratio) for MRcore in np.linspace(mr_lo, mr_hi, num=60):
""" Create an HTML summary page and launch webbrowser to show summary. """ import webbrowser import os from rocketisp.geometry import Geometry from rocketisp.efficiencies import Efficiencies from rocketisp.stream_tubes import CoreStream from rocketisp.rocket_isp import RocketThruster # create CoreStream with area ratio=375:1, Pc=137, FFC=30% and effERE=0.99 C = CoreStream(geomObj=Geometry(eps=375), effObj=Efficiencies(ERE=0.99), pcentFFC=30, oxName='N2O4', fuelName='N2H4', MRcore=1.26, Pc=137, Pamb=0) # instantiate RocketThruster R = RocketThruster(name='100 lbf Aerojet HiPAT R-4D', coreObj=C) R.scale_Rt_to_Thrust(100, Pamb=0.0) #R.summ_print() fsave = 'hipat_at_opt_mr.html' fOut = open(fsave, 'w') fOut.write(R.get_html_file_str()) fOut.close()
IspSL = 366 # sec cstarODE = xxx / 12.0 # ft/sec eps = 77.5 CR = 3.0 Lnoz = 121 # in geomObj = Geometry(Rthrt=Rthrt, CR=CR, eps=eps, pcentBell=80, LnozInp=Lnoz, RupThroat=1.0, RdwnThroat=0.392, RchmConv=1.73921, cham_conv_deg=25.42, LchmOvrDt=2.4842/2, LchmMin=2.0, LchamberInp=None) effObj = Efficiencies() effObj.set_const('ERE', 0.99 ) core = CoreStream( geomObj, effObj, oxName='LOX', fuelName='LH2', MRcore=MRcore, Pc=Pc) R = RocketThruster(name='SSME, RS-25',coreObj=core, injObj=None, pulse_sec=float('inf'), pulse_quality=0.8) R.scale_Rt_to_Thrust( Fvac , Pamb=0.0 , use_scipy=False ) compare_header() compare('Fvacuum',Fvac, core('FvacTotal')) compare('Isp Vacuum', Isp, core('IspDel')) core.reset_attr( 'Pamb', 14.7, re_evaluate=True) compare('Isp SeaLevel', IspSL, core('IspAmb')) compare('FseaLevel', FseaLevel, core('Fambient')) core.reset_attr( 'Pamb', 0, re_evaluate=True)