Pump.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
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
145
146
147
148
149
150
151
152
153
# Applied Python PRISM
# (PRISM) PaRametrIc System Model
#
# Written by Charlie Taylor <cet@appliedpython.com> 
# Oct,21 2005

from math import *
from prism.MassItem import MassItem
from prism.utils import Constants
from prism.props import Materials
from prism.Summary import Summary
from prism.tpa.supt import des_pump
from prism.tpa.supt import fluNode


class Pump( MassItem ):
    
    def __init__(self, name="pump",  fluName="MMH", wdot=1.0,
        mass_lbm=0.0,  matlName="Ti", Pinlet=25.0, Tinlet=530.0,
        deltaP=250.0, rpm=20000.0, eff=0.62, cxw=1.0, pStages=1,
        vDisMx=2100.0, vIndMx=1165.0, spspMx=5000.0,
        SigShaft = 40000.0, DtipMn=0.75,
        suctMx=20000.0, spspMn=400.0):
        
        MassItem.__init__(self, name, type="inert")
        
        self.matlName = matlName
        self.rho, self.sy, self.e, self.tming = Materials.getMatlProps(matlName)
        
        NodeIn = fluNode.fluNode(fluName=fluName, \
                    nodeName=name + " Inlet", T=Tinlet, P=Pinlet)
        NodeOut = fluNode.fluNode(fluName=fluName, \
                    nodeName=name + " Outlet", T=Tinlet, P=Pinlet+deltaP)
                    

        p = des_pump.rpm_pump( NodeIn, NodeOut,rpm=rpm, pStges=float(pStages),cxw=cxw,\
                  pumpName=name, dP=deltaP, eff=eff, fluType='unknown',holdDP=1)
                  
        self.wdot = wdot
        self.Pinlet = Pinlet
        self.Tinlet = Tinlet
        self.deltaP = deltaP
        self.eff = eff
        self.cxw = cxw
        self.pStages = pStages
        
        self.rpm = rpm
        self.DtipMn = DtipMn
        self.vDisMx = vDisMx
        self.vIndMx = vIndMx
        self.spspMx = spspMx
        self.suctMx = suctMx
        self.spspMn = spspMn
                  
        self.pump = p
        self.pump.NodeIn = NodeIn
        self.pump.NodeOut = NodeOut
        
        self.reCalc()
        
    def reCalc(self):
        
        self.pump.rpm = self.rpm
        self.pump.rpmInit = self.rpm
        self.pump.rhoMat = self.rho
        self.pump.DtipMn = self.DtipMn
        self.pump.vDisMx = self.vDisMx
        self.pump.vIndMx = self.vIndMx
        self.pump.spspMx = self.spspMx
        self.pump.suctMx = self.suctMx
        self.pump.spspMn = self.spspMn
        self.pump.pStges = self.pStages
        self.pump.DpkgOvDtip = 0.0
        self.pump.XpkgOvDtip = 0.0
        self.pump.cxw = self.cxw
        
        self.pump.eff = self.eff
        
        
        #self.pump.wdotIn = self.wdot
        self.pump.setWdotIn(self.wdot)
        self.pump.setWdotOut(self.wdot)
        self.pump.fluIn.setTP(self.Tinlet, self.Pinlet)
        self.pump.setWdotIn( self.wdot )
        
        #self.pump.fluOut.setTP(self.Tinlet, self.Pinlet+self.deltaP)
        self.pump.dP = self.deltaP
        self.pump.b_StateInOK = 1
        self.pump.b_StateOutOK = 0
        self.pump.setPoutFixed(self.Pinlet+self.deltaP)
        self.pump.calcFluidState()
        #self.pump.setPoutViaPinlet(self.Pinlet)
        self.pump.propagateWdot()
        #self.pump.b_StateInOK = 1
        #self.pump.b_StateOutOK = 1
        self.pump.design()
        
        self.effCalc = self.pump.effCalc
        
        self.mass_lbm = self.pump.Wpump

    def buildSummary(self):
        
        summ = Summary(  summName='Centrifugal Pump',
            componentName=self.name, mass_lbm=self.mass_lbm, type=self.type)
        
        # assumptions
        summ.addAssumption( 'Material : ' + self.matlName )
        
        tup = self.pump.getSummary(asTuple=1,Ncol=1) 
        for t in tup:
            #print t
            if len(t) == 3:
                summ.addOutput(t[0],t[1],t[2],'%s' )
            elif len(t) > 3:
                summ.addAssumption( ' '.join(t[:3]) )
                summ.addAssumption( ' '.join(t[3:]) )
            else:
                s = ' '.join( t )
                if len(s)>1:
                    summ.addAssumption( s )
        # inputs
        summ.addInput('Pinlet', self.Pinlet, 'psia', '%.1f')
        summ.addInput('deltaP', self.deltaP, 'psig', '%.1f')
        
        summ.addInput('wdot',self.wdot,'lbm/sec','%g')
        summ.addInput('rpm',self.rpm,'rpm','%g')
        summ.addInput('DtipMn',self.DtipMn,'in','%g')
        summ.addInput('vDisMx',self.vDisMx,'ft/sec','%g')
        summ.addInput('vIndMx',self.vIndMx,'ft/sec','%g')
        summ.addInput('spspMx',self.spspMx,'','%g')
        summ.addInput('suctMx',self.suctMx,'','%g')
        summ.addInput('spspMn',self.spspMn,'','%g')
        summ.addInput('pStages',self.pStages,'','%g')
        summ.addInput('cxw',self.cxw        ,'','%g')
        summ.addInput('eff',self.eff,'','%g')

        
        # outputs
        summ.addOutput( 'rho', self.rho, 'lbm/cuin', '%g' )
        summ.addOutput( 'sy', self.sy, 'psi', '%g' )
        #summ.addOutput( 'e', self.e, 'psi', '%g' )
        #summ.addOutput( 'tming', self.tming, 'in', '%.3f' )
        

        return summ

if __name__ == "__main__":  #self test

    h = Pump(name="My Pump")
    print h.getMassStr()
    print
    print h.getSummary()