/[ascend]/branches/fprops-incomp/models/johnpye/fprops/pipe_sequence_plot.py
ViewVC logotype

Diff of /branches/fprops-incomp/models/johnpye/fprops/pipe_sequence_plot.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3468 by jpye, Sat Feb 8 23:45:18 2020 UTC revision 3469 by jpye, Thu Feb 13 01:45:55 2020 UTC
# Line 2  Line 2 
2  import extpy, sys  import extpy, sys
3  from solverreporter import *  from solverreporter import *
4  from __builtin__ import *  from __builtin__ import *
   
5  import sys, os, os.path  import sys, os, os.path
6  if 'ASCENDLIBRARY' in os.environ:  if 'ASCENDLIBRARY' in os.environ:
7      p1 = os.path.join(os.environ['ASCENDLIBRARY'],'johnpye/fprops/python')      p1 = os.path.join(os.environ['ASCENDLIBRARY'],'johnpye/fprops/python')
# Line 73  def pipe_sequence_plot(self): Line 72  def pipe_sequence_plot(self):
72      pl.ion()      pl.ion()
73      pl.show()      pl.show()
74    
75    def table_to_text(t):
76        #import tabulate
77        return "\n".join(["\t".join([str(c) for c in r]) for r in t]) + "\n"
78    def float_C(n):
79        return float(n)-273.15
80    
81    def disharray_temperature_list(self):
82        n_DI = self.n_DI.getIntValue()
83        n_PH = self.n_PH.getIntValue()
84        t = []
85        t.append(["Location","T / [°C]","p / [bar]"])
86        import ascpy
87        for i in range(n_DI):
88            t.append(["DI[%d].inlet"%i, float_C(self.DI[i].inlet.T), float(self.DI[i].inlet.p)/1e5])
89            t.append(["DI[%d].outlet"%i, float_C(self.DI[i].outlet.T), float(self.DI[i].outlet.p)/1e5])
90            t.append(["TH[%d].outlet"%i, float_C(self.TH[i].outlet.T), float(self.DI[i].outlet.p)/1e5])
91        t.append(["inlet", float_C(self.inlet.T), float(self.inlet.p)/1e5])
92        t.append(["outlet", float_C(self.outlet.T), float(self.outlet.p)/1e5])
93        s = table_to_text(t) + "\n"
94        
95        t = []
96        t.append(["Pipe","T_in / [°C]","T_out / [°C]","L / [m]", "D_i / [m]","t_pipe / [m]","Vel_out / [m/s]"])
97        for i in range(n_PH):
98            d = {'PC[%d]'%i : self.PC[i], 'PH[%d]'%i : self.PH[i]}
99            for k,n in d.iteritems():
100                t.append([k] + [float(j) for j in [n.T_in_C, n.T_out_C, n.L, n.D, n.t_pipe, n.Vel_out]])
101        s += table_to_text(t) + "\n"
102        extpy.getbrowser().show_info(s,"csparray temperatures")
103    
104  extpy.registermethod(pipe_sequence_plot)  extpy.registermethod(pipe_sequence_plot)
105    extpy.registermethod(disharray_temperature_list)
106    
107    

Legend:
Removed from v.3468  
changed lines
  Added in v.3469

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22