ValveFixedDesign.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
# 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
import sys
from prism.props import Inc_liquid
from math import *
from prism.fortran import orifice

class ValveFixedDesign( MassItem ):
    
    def __str__(self):
        return self.refName
    
    def __init__(self, name="liquid valve", liqObj=None,  matlName="Stainless Steel, Teflon", 
        wdot=0.1, refWaterWdot=0.214, refWaterDP=30.0, refName="MOOG Spacebus valve",  Number=1,
        mass_lbm=0.9, cxw=1.0):
            
        
        MassItem.__init__(self, name, type="inert", mass_lbm=mass_lbm)
        
        self.liqObj = liqObj
        #if (liqObj is not Inc_liquid.Inc_liquid):
        #    print "ERROR...",name,"must have Inc_liquid object input for liqObj"
        #    sys.exit(1)
        
        self.Number = Number
        self.matlName = matlName
        
        self.wdot = wdot
        #self.deltaP = deltaP
        self.refWaterWdot = refWaterWdot
        self.refWaterDP = refWaterDP
        self.refName = refName
        self.cxw = cxw
        self.mass_lbmInp = mass_lbm
        
        self.reCalc()
        
    def reCalc(self, autoCalc=1):
        self.autoCalc = autoCalc

        self.Q = self.wdot / self.liqObj.D  # cuft/s
        
        self.Kw = sqrt( self.refWaterWdot**2 / self.refWaterDP)
        
        self.deltaP = self.wdot**2 * 62.4/ self.liqObj.D/ self.Kw**2
        
        self.mass_lbm = self.mass_lbmInp * self.cxw * self.Number
        
        # estimate CdA
        self.velFluid = sqrt( 24.0 * 32.174 * self.deltaP / self.liqObj.rho ) # in/sec
        self.CdA = self.wdot/(self.liqObj.rho * self.velFluid) # sqin
        
    
    def minGaugeStr(self, t):
        if t<= self.tming:
            return 'Min Gauge'
        else:
            return ''
        
    def buildSummary(self):
        
        name = self.name
        if self.Number>1:
            name += ' (%i)'%self.Number
        
        summ = Summary(  summName='Liquid Valve',
        componentName=name, mass_lbm=self.mass_lbm, type=self.type)
        
        summ.addAssumption( 'fluid : ' + self.liqObj.symbol )
        summ.addAssumption( 'Structural Material : ' + self.matlName )
        summ.addAssumption( 'valve: '+self.refName )
        
        if self.Number>1:
            summ.addAssumption( 'Mass is for %i valves total'%self.Number )
        
        # add inputs
        summ.addInput('wdot', self.wdot, 'lbm/sec', '%g')
        summ.addInput('cxw', self.cxw, '', '%g')
        
        summ.addInput('refWaterWdot', self.refWaterWdot, 'lbm/sec', '%g')
        summ.addInput('refWaterDP', self.refWaterDP, 'psid', '%g')
        
        summ.addInput('# Valves', self.Number, '', '%i')
        
        # add outputs

        summ.addOutput( 'deltaP', self.deltaP, 'psid', '%.2f' )
        summ.addOutput( 'Kw', self.Kw, 'in-lb^.5/sec', '%g' )
        summ.addOutput( 'velFluid', self.velFluid/12.0, 'ft/sec', '%g' )
        summ.addOutput( 'CdA', self.CdA, 'sqin', '%g' )
        
        
        summ.addOutput( 'fluid rho', self.liqObj.rho, 'lbm/cuin', '%g' )
        summ.addOutput( 'fluid D', self.liqObj.D, 'lbm/cuft', '%g' )
        summ.addOutput( 'fluid visc', self.liqObj.Visc, '1.0E5 * lb/ft-sec', '%g' )
        if self.Number>1:
            summ.addOutput( 'wt/Valve', self.mass_lbm/self.Number, 'lbm', '%.3f' )

        return summ


if __name__ == "__main__":  #self test

    
    Fl = Inc_liquid.Inc_liquid( symbol="N2H4",T=530.0,P=243.0, mass_lbm=10.0)
    h = ValveFixedDesign(name="liquid valve", liqObj=Fl,  matlName="Stainless Steel, Teflon", 
        wdot=0.1, refWaterWdot=0.214, refWaterDP=30.0, refName="MOOG Spacebus valve, Model 53-203",  Number=1,
        mass_lbm=0.9, cxw=1.0)
    print h.getMassStr()
    print
    print h.getSummary()
    
    
    print
    h = ValveFixedDesign(name="latch valve", liqObj=Fl,  matlName="CRES, Vespel", 
        wdot=6.0, refWaterWdot=8.5, refWaterDP=2.0, refName="MOOG PMA Latch valve Model 51-212",  Number=1,
        mass_lbm=0.3, cxw=1.0)
    print h.getMassStr()
    print
    print h.getSummary()
    
    
    print
    h = ValveFixedDesign(name="torque motor valve", liqObj=Fl,  matlName="Stainless Steel, Teflon", 
        wdot=0.02, refWaterWdot=0.08, refWaterDP=3.0, refName="MOOG Artemis Latch valve Model 52-220",  Number=1,
        mass_lbm=1.54, cxw=1.0)
    print h.getMassStr()
    print
    print h.getSummary()
    
    
    print
    h = ValveFixedDesign(name="torque motor valve", liqObj=Fl,  matlName="Stainless Steel, Teflon", 
        wdot=.2, refWaterWdot=0.3, refWaterDP=9.0, refName="MOOG Latch valve Model 52-266",  Number=1,
        mass_lbm=1.54, cxw=1.0)
    print h.getMassStr()
    print
    print h.getSummary()