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

from prism.Summary import Summary
from prism.MassItem import MassItem

from prism.utils import Constants
from prism.props import Materials
from prism.utils.mensuration import *
from prism.pov import POV_Items, POV_Basics

class ShellStructure( MassItem ):
    
    def __init__(self, name="shell",  mass_lbm=0.0,  
        matlShell="grEpox", matlFlange="Al", 
        OD=20.0, Length=25.0,
        thkShell=0.1, thkFlange=0.1, widthFlange=0.5, cxw=1.0):
        
        MassItem.__init__(self, name, type="inert")
        
        self.name = name
        self.mass_lbm = mass_lbm
        self.matlShell = matlShell
        self.matlFlange = matlFlange
        self.OD = OD
        self.Length = Length
        self.thkShell = thkShell
        self.thkFlange = thkFlange
        self.widthFlange = widthFlange
        
        self.cxw = cxw
        
        self.rhoSh, self.sySh, self.eSh, self.tmingSh = Materials.getMatlProps(matlShell)
        self.rhoFl, self.syFl, self.eFl, self.tmingFl = Materials.getMatlProps(matlFlange)
        
        self.reCalc()
        
    def calc_thk_for_buckling(self, ThrustTotal=1000.0, SF=1.5, tming=0.001):
        
        TaxBuck=0.83*sqrt(ThrustTotal/self.eSh)*SF
        self.thkShell = max(TaxBuck, self.tmingSh, tming)
        self.reCalc()
        
    def getPOV_Item(self):
        if hasattr( self, 'texture'):
            texture = self.texture
        else:
            
            texture = POV_Basics.Texture( colorName="White", transmit=0.9, reflection=0. )
            
        shell = POV_Items.HollowCylinder( OD=self.OD, thickness=self.thkShell, height=self.Length, texture = texture)
        f1 = POV_Items.HollowCylinder( OD=self.OD, thickness=self.widthFlange, height=self.thkFlange, texture = texture)
        f2 = POV_Items.HollowCylinder( OD=self.OD, thickness=self.widthFlange, height=self.thkFlange, texture = texture)
        f2.translate( [0.,self.Length-self.thkFlange,0.] )
        
        # start out with CSE_Tank, but override the CSE_Tank itemsL to be shell items.
        s =  POV_Items.CSE_Tank( radius=10.0, ellRatio=1.414, cylLen=5.0, texture=texture)
        s.itemsL = [shell, f1, f2]
        s.h = self.Length
        s.w = self.OD
        s.d = self.OD
        
        
        return s
        
    def reCalc(self):
        
        self.ID = self.OD - 2.0*self.thkShell
        self.shellVolume = cylVol( self.thkShell, self.ID, self.Length )
        self.shellMass = self.shellVolume * self.rhoSh
        
        self.flangeID = self.OD - 2.0*self.widthFlange
        self.flangeVolume =  cylVol( self.widthFlange, self.flangeID, self.thkFlange )
        self.flangeMass = self.flangeVolume * self.rhoFl
        
        # include mass for 2 flages
        self.mass_lbm = (self.shellMass + self.flangeMass*2.0) * self.cxw

    def buildSummary(self):
        
        summ = Summary(  summName='Shell Structure',
            componentName=self.name, mass_lbm=self.mass_lbm, type=self.type)
        
        # assumptions
        summ.addAssumption( 'Structural Material : ' + self.matlShell )
        summ.addAssumption( 'Flange Material : ' + self.matlFlange )
        summ.addAssumption( 'Total Mass includes two (2) flanges')
        
        # inputs
        summ.addInput('OD', self.OD, 'in', '%.3f')
        summ.addInput('Length', self.Length, 'in', '%.3f')
        summ.addInput('thkShell', self.thkShell, 'in', '%.3f')
        summ.addInput('thkFlange', self.thkFlange, 'in', '%.3f')
        summ.addInput('widthFlange', self.widthFlange, 'in', '%.3f')
        summ.addInput('cxw', self.cxw, '', '%.3f')
        
        # outputs
        summ.addOutput( 'rho Shell', self.rhoSh, 'lbm/cuin', '%g' )
        #summ.addOutput( 'sy Shell', self.sySh, 'psi', '%g' )
        #summ.addOutput( 'e Shell', self.eSh, 'psi', '%g' )
        #summ.addOutput( 'tming Shell', self.tmingSh, 'in', '%.3f' )
        #summ.addOutput( '', '', '', '%s' )
        
        summ.addOutput( 'rho Flange', self.rhoFl, 'lbm/cuin', '%g' )
        #summ.addOutput( 'sy Flange', self.syFl, 'psi', '%g' )
        #summ.addOutput( 'e Flange', self.eFl, 'psi', '%g' )
        #summ.addOutput( 'tming Flange', self.tmingFl, 'in', '%.3f' )
        summ.addOutput( '', '', '', '%s' )

        summ.addOutput('ID', self.ID, 'in', '%.3f')
        summ.addOutput('flangeID', self.flangeID, 'in', '%.3f')
        summ.addOutput('shellVolume', self.shellVolume, 'cuin', '%g')
        summ.addOutput('flangeVolume', self.flangeVolume, 'cuin', '%g')
        summ.addOutput('shellMass', self.shellMass, 'lbm', '%.3f')
        summ.addOutput('flangeMass', self.flangeMass, 'lbm', '%.3f')

        return summ

if __name__ == "__main__":  #self test

    h = ShellStructure(name="Stage External Shell",
        matlShell="grEpox", matlFlange="Al", 
        OD=33.0, Length=29.0,
        thkShell=0.08, thkFlange=0.1, widthFlange=0.5, cxw=1.0)
        
    print h.getMassStr()
    print
    print h.getSummary()

    print '='*70
    h.calc_thk_for_buckling(ThrustTotal=100000.0, SF=1.5, tming=0.07)
    print h.getMassStr()
    print
    print h.getSummary()