example_2.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
import sys
import os
from prism import *

vOxTank = 150000.0
vFlTank = 100000.0
vPropTanks = vOxTank + vFlTank
ptank = 300.0
PHeTnk=2000.0

Oxtank = Tank(name="Oxidizer Tank", makeCompositeTank=0, matlName="Ti",
    kacqui=4, tliner=0.030, vfree=vOxTank, ptank=ptank)
Fltank = Tank(name="Fuel Tank", makeCompositeTank=0,
    kacqui=4, tliner=0.030, vfree=vFlTank, ptank=ptank)

he = PressurantHe(name="Helium Pressurant", 
    VpropTnk=vPropTanks,PHeTnk=PHeTnk,PpropNom=159.36,
    PfinHeOvPnom=1.0,
    tAction=433.94,TminR=510.0,TmaxR=550.0)

Hetank = Tank(name="Helium Tank",  makeCompositeTank=0,
   matlName="Ti", ptank=PHeTnk,
    tliner=0.030, vfree=he.volHeTotal)

def myControlRoutine(S):
    PHe    = S("PHe")
    he.PHeTnk =  PHe
    he.reCalc()
    Hetank.vfree = he.volHeTotal
    Hetank.ptank = PHe
    S.reCalcItems()
    
    S["HeSysMass"] = he.mass_lbm + Hetank.mass_lbm
    S["HeMass"] = he.mass_lbm
    S["HeTankMass"] = Hetank.mass_lbm
    
    S["HePVoverW"] = Hetank.PburstVoverW
    S["HeVolume"] = he.volHeTotal / 1728.0
    
Hetank.texture = Texture( colorName="Gray50" )
Oxtank.texture = Texture( colorName="Aquamarine" )
Fltank.texture = Texture( colorName="Pink" )


S = SysModel(author="I.B. Simpleton", name="simple system", type="trial baloon", 
    controlRoutine=myControlRoutine, renderControlRoutine=None)
S.addMassItem( Oxtank )
S.addMassItem( Fltank )
S.addMassItem( he )
S.addMassItem( Hetank )


# design vars have: 
#     name, value, minVal, maxVal, step,  units,  description
S.addDesignVariable( name="PHe", InitialVal=3250.0, minVal=500.0, maxVal=8000.0, step=200.0)

# result variables have: 
#    name,      units,  description
S.addResultVars( ["HeSysMass", "lbm", "Helium System Mass"] )
S.addResultVars( ["HeMass", "lbm", "Helium Gas Mass"] )
S.addResultVars( ["HeTankMass", "lbm", "Helium Tank Mass"] )
S.addResultVars( ["HePVoverW", "", "Helium Tank PV/W"] )
S.addResultVars( ["HeVolume", "cuft", "Helium Tank Volume"] )

print S.getShortSummary()

make2DPlot(S, sysParam="HePVoverW", desVar="PHe")

make2DPlot(S, sysParam="HeVolume", desVar="PHe")

make2DPlot(S, sysParam=["HeMass","HeTankMass","HeSysMass"], desVar="PHe")

makeMassItemSensitivityPlot(S, makeHTML=1,desVar="PHe", showDelta=0,
    excludePropellant=0, dpi=70)
    
S.saveFullSummary()

S.close()