1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 | # Applied Python PRISM
# (PRISM) PaRametrIc System Model
#
# Written by Charlie Taylor <cet@appliedpython.com>
# Oct,21 2005
from prism.MassItem import MassItem
from prism.isp.cea import CEA_Isp
from math import *
from prism.utils import Constants
from prism.Summary import Summary
class Engine_CEA_Scale( MassItem ):
def __init__(self, name="engine", mass_lbm=0.0, oxName='N2O4', fuelName='MMH',
cxw=1.25, Pc=150.0, Fvac=100.0, eps=50.0, mr=1.6, CR=2.5, LoverDt=4.0,
etaERE=0.97, etaNoz=0.99, useFastCEALookup=0):
MassItem.__init__(self, name, type="inert")
self.oxName = oxName
self.fuelName = fuelName
self.Fvac = Fvac
self.Pc = Pc
self.eps = eps
self.mr = mr
self.CR = CR
self.LoverDt = LoverDt
self.cxw = cxw
self.etaERE = etaERE
self.etaNoz = etaNoz
self.ispObj = CEA_Isp.CEA_Isp( oxName=oxName, fuelName=fuelName, useFastLookup=useFastCEALookup ) # create isp calculating object
self.reCalc()
def reCalc(self, autoCalc=1):
self.autoCalc = autoCalc
# set design variables
self.IspODE,self.CstarODE,self.Tc = \
self.ispObj.get_IvacCstrTc(Pc=self.Pc, MR=self.mr, eps=self.eps)
self.effIsp = self.etaERE * self.etaNoz
self.Isp = self.IspODE * self.effIsp
self.Cstar = self.CstarODE * self.etaERE
self.wdotTot = self.Fvac / self.Isp
self.wdotOx = self.wdotTot * self.mr / (1.0 + self.mr)
self.wdotFl = self.wdotTot - self.wdotOx
self.At = self.Cstar* self.wdotTot / self.Pc / Constants.gc
self.Dt = sqrt( self.At / pi ) * 2.0
self.Dcham = self.Dt * sqrt( self.CR )
self.Lcham = self.Dt * self.LoverDt
# fake in simple scaling relationships
self.mass_lbm = 6.95 * (self.At/3.0) * (0.5 + 0.5*self.Pc/100.0) \
+ 6.95 * (self.Dt/1.0) * (0.8 + 0.2*self.Pc/100.0) \
+ 0.8 * (self.At/3.0) * ((self.eps-1)/(20.0-1)) * (0.8 + 0.2*self.Pc/100.0)
self.mass_lbm *= self.cxw
self.FtoW = self.Fvac / self.mass_lbm
def buildSummary(self):
summ = Summary( summName='Scaled Bipropellant Engine',
componentName=self.name, mass_lbm=self.mass_lbm, type=self.type)
summ.addAssumption( 'Propellants : ' + self.oxName + ' / ' + self.fuelName )
summ.addAssumption( 'NASA CEA Code for ODE performance ')
#summ.addInput(self, label='generic param', value=0.0, units='', format='%g')
summ.addInput('Fvac', self.Fvac, 'lbf', '%g')
summ.addInput('Pc', self.Pc, 'psia', '%.1f')
summ.addInput('eps', self.eps, '', '%g')
summ.addInput('mr', self.mr, '', '%g')
summ.addInput('CR', self.CR, '', '%g')
summ.addInput('LoverDt', self.LoverDt, '', '%g')
summ.addInput('cxw', self.cxw, '', '%g')
summ.addInput('etaERE', self.etaERE, '', '%g')
summ.addInput('etaNoz', self.etaNoz, '', '%g')
# outputs
summ.addOutput('Isp', self.Isp, 'sec', '%g')
summ.addOutput('Cstar', self.Cstar, 'ft/sec', '%.1f')
summ.addOutput('effIsp', self.effIsp, '', '%g')
summ.addOutput('IspODE', self.IspODE, 'sec', '%g')
summ.addOutput('CstarODE', self.CstarODE, 'ft/sec', '%.1f')
summ.addOutput('Tc', self.Tc, 'degR', '%.1f')
summ.addOutput('wdotTot', self.wdotTot, 'lbm/sec', '%g')
summ.addOutput('wdotOx ', self.wdotOx , 'lbm/sec', '%g')
summ.addOutput('wdotFl', self.wdotFl, 'lbm/sec', '%g')
summ.addOutput('At', self.At, 'sqin', '%g')
summ.addOutput('Dt', self.Dt, 'in', '%.3f')
summ.addOutput('Dcham', self.Dcham, 'in', '%.3f')
summ.addOutput('Lcham', self.Lcham, 'in', '%.3f')
return summ
def old_getSummary(self):
return '''F/Wt Engine Summary: %s
mass = %12.3f lbm
type = %s (of Engine_CEA_Scale)
propellants: %s / %s
=== INPUT ===
Fvac = %.1f lbf
Pc = %.1f psia
eps = %.1f (-)
cxw = %.3f (-)
=== OUTPUT ===
Isp = %.1f (sec)
Cstar = %.1f (ft/sec)
Isp ODE = %.1f (sec)
eff ERE = %.4f (-)
eff Isp = %.4f (-)
Dthrt = %.3f in
Dcham = %.3f in
wdotOx = %.3f lbm/sec
wdotFl = %.3f lbm/sec
wdotTot = %.3f lbm/sec
MReng = %.3f (-)
Thrust/Wt = %.3f (-)
wtEngine = %.3f lbm
'''%(self.name,self.mass_lbm,self.type, self.oxName, self.fuelName,
self.Fvac,self.Pc,
self.eps,self.cxw,self.Isp,self.Cstar,self.IspODE,self.etaERE,self.effIsp,self.Dt,self.Dcham,
self.wdotOx,self.wdotFl,self.wdotTot,self.mr,self.FtoW,self.mass_lbm)
if __name__ == "__main__": #self test
h = Engine_CEA_Scale(name="Axial Engine")
print h.getMassStr()
print
print h.getSummary()
|