Grain_EndBurn.py

  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
# Applied Python PRISM
# (PRISM) PaRametrIc System Model
#
# Written by Charlie Taylor <cet@appliedpython.com> 
# Oct,21 2005

from prism.MassItem import MassItem
from prism.Summary import Summary
from math import *
from prism.utils import Constants
from prism.grains import SolidPropellant

class Grain_EndBurn( MassItem ):
    
    def __init__(self, name="grain(end burner)",  
        WpropBurned=200.0, propName='ARC448', 
        cxw=1.0, Pc=500.0, FvacMaxPerGG=300.0, IspVacDel=238.6):
        
        MassItem.__init__(self, name, type="propellant")
        
        self.WpropBurned = WpropBurned
        self.propName = propName
        self.FvacMaxPerGG = FvacMaxPerGG
        self.Pc = Pc
        self.IspVacDel = IspVacDel
        self.cxw = cxw
        self.massBreakdown = []
        
        self.rho,self.refBurnRate,self.refPress,self.BRexp = \
            SolidPropellant.getPropellantProps(propName)
        
        self.reCalc()
        
    def reCalc(self):
        # set design variables
        
        self.mass_lbm = self.WpropBurned * self.cxw
        self.Vgrain = self.mass_lbm / self.rho
        
        self.wdotMaxPerGG = self.FvacMaxPerGG / self.IspVacDel
        
        # refBurnRate can be changed by the user (i.e. away from value in SolidPropellant.py
        #   therefor do NOT call library to get BurnRate at Pc
        #   self.BurnRate = SolidPropellant.getBurnRate( name=self.propName, pressure=self.Pc)
        self.BurnRate = self.refBurnRate * (self.Pc/self.refPress)**self.BRexp 
        
        self.Aburn = self.wdotMaxPerGG/ self.rho / self.BurnRate
        
        self.Dgrain = sqrt( self.Aburn * 4.0 / pi )
        
        self.Web = self.mass_lbm / self.rho / self.Aburn
        
        self.tminBurn = self.Vgrain / self.Aburn / self.BurnRate
        
        
        
    def setMassBreakdown(self, nameValueList=None):
        self.massBreakdown = []
        self.WpropBurned = 0.0
        for n,v in nameValueList:
            self.massBreakdown.append( (n,v) )
            self.WpropBurned += v


        
    def buildSummary(self):
        
        summ = Summary(  summName='Solid Grain (End Burning)',
        componentName=self.name, mass_lbm=self.mass_lbm, type=self.type)
        
        summ.addAssumption( 'Propellant : ' + self.propName  )
        

        #summ.addInput(self, label='generic param', value=0.0, units='', format='%g')

        summ.addInput('WpropBurned', self.WpropBurned, 'lbm', '%.3f')
        summ.addInput('cxw', self.cxw, '', '%g')
        summ.addInput('FvacMaxPerGG', self.FvacMaxPerGG, 'lbf', '%g')
        summ.addInput('Pc', self.Pc, 'psia', '%.1f')
        summ.addInput('IspVacDel', self.IspVacDel, 'sec', '%g')
        
        summ.addInput('refBurnRate', self.refBurnRate, 'in/sec', '%.4f')
        summ.addInput('refPress', self.refPress, 'psia', '%.1f')
        summ.addInput('BRexp', self.BRexp, '', '%g')
        summ.addInput('rho', self.rho, 'lbm/cuin', '%.4f')
        
        
        if len( self.massBreakdown ) > 0:
            for n,v in self.massBreakdown:
                summ.addInput(n, v, 'lbm', '%.3f')

        # outputs
        
        summ.addOutput('wdotMaxPerGG', self.wdotMaxPerGG, 'lbm/sec', '%g')
        summ.addOutput('tminBurn', self.tminBurn, 'sec', '%.1f')
        
        summ.addOutput('BurnRate at Pc', self.BurnRate, 'in/sec', '%.4f')
        summ.addOutput('Aburn', self.Aburn, 'sqin', '%.3f')
        summ.addOutput('Dgrain', self.Dgrain, 'in', '%.3f')
        summ.addOutput('Web', self.Web, 'in', '%.3f')
        summ.addOutput('Vgrain', self.Vgrain, 'cuin', '%.3f')
        
        return summ

if __name__ == "__main__":  #self test

    h = Grain_EndBurn(name="Solid Grain", WpropBurned=946.2/4, propName='ARC448', 
        cxw=1.01, Pc=480.0, FvacMaxPerGG=403.725/2, IspVacDel=238.6)
        
    print h.getMassStr()
    print
    print h.getSummary()