lu.setinputs(P, vals, cols, inpline) # Construct table lists for displaying, funky typing required for pmcgi code st = ['liquid', 'vapor'] #1 is liq, 2 is vap T = [float(T1), float(T1)] p = [float(p1), float(p1)] v = [float(vf), float(vg)] e = [float(ef), float(eg)] h = [float(hf), float(hg)] s = [float(sf), float(sg)] # build label and unit lists labels = ['Phase', 'T', 'p', 'v', 'u', 'h', 's'] units = [ '', uT, up, uV + '/' + uM, uE + '/' + uM, uE + '/' + uM, uE + '/' + uM + uT ] P.insert('<h3>Saturation Properties</h3><center>' + pmcgi.html_column_table( labels, units, (st, T, p, v, e, h, s), thousands=',') + '</center>', (resline, 0), wait=True) # Insert the cgi call to build the image P.insert( '<img class="figure" src="/cgi-bin/live/satdata_plot.py?id={:s}&T1={:f}&up={:s}&uT={:s}&uE={:s}&uM={:s}&uV={:s}">' .format(species, float(T1), up, uT, uE, uM, uV), (chartline, 0)) #Perform the write operation P.insert_exec() P.write()
Tc, pc, dc = F.critical(density=True) if (p1 > pc and T1 > Tc): x = ['supercritical'] elif (d1 < dc): x = ['vapor'] else: x = ['liquid'] # build label and unit lists labels = ['T', 'p', 'v', 'u', 'h', 's', 'x'] units = [ uT, up, uV + '/' + uM, uE + '/' + uM, uE + '/' + uM, uE + '/' + uM + uT, '-' ] P.insert('<h3>State Properties</h3><center>' + pmcgi.html_column_table( labels, units, (T, p, v, e, h, s, x), thousands=',') + '</center>', (resline, 0), wait=True) # Insert the cgi call to build the image # """<canvas id="myCanvas" style="cursor:crosshair;background: url('/cgi-bin/live/pointdata_plot.py?id={:s}&p1={:f}&s1={:f}&up={:s}&uT={:s}&uE={:s}&uM={:s}&uV={:s}')" width="640" height="480"></canvas>""".format( # species, float(p1), float(s1), up, uT, uE, uM, uV) P.insert( """/cgi-bin/live/pointdata_plot.py?id={:s}&p1={:f}&s1={:f}&up={:s}&uT={:s}&uE={:s}&uM={:s}&uV={:s}""" .format(species, float(p1), float(s1), up, uT, uE, uM, uV), (chartline, 63)) #insert the chartcoordinates def getChartCoords():
lu.perror(P, 'Python error: ' + str(e), errline) # Put the input values back into the input boxes vals = [str(Tval), str(hval)] cols = [76, 82] lu.setinputs(P, vals, cols, inpline) # # # # # # # # # # # # # # Display Output Values # # # # # # # # # # # # # # # Construct table lists for displaying, funky typing required for pmcgi code T = [float(T1)] h = [float(h1)] cv = [float(cv1)] cp = [float(cp1)] gamma = [float(gamma1)] # build label and unit lists labels = ['T', 'h', 'cv', 'cp', 'gamma'] units = [uT, uE + '/' + uM, uE + '/' + uM + uT, uE + '/' + uM + uT, '-'] P.insert('<h3>State Properties</h3><center>' + pmcgi.html_column_table( labels, units, (T, h, cv, cp, gamma), thousands=',') + '</center>', (resline, 0), wait=True) #Perform the write operation P.insert_exec() P.write()
# Construct table lists for displaying # This inspires some future code to automatically collapse the arrays # to make the float() conversions unnecessary st = [1,2,3,4] T = [float(T1), float(T2), float(T3), float(T4)] p = [float(p1), float(p2), float(p3), float(p4)] v = [float(v1), float(v2), float(v3), float(v4)] h = [float(h1), float(h2), float(h3), float(h4)] s = [float(s1), float(s2), float(s3), float(s4)] x = ['0', 'liquid', 'vapor', float(x4)] # build label and unit lists labels = ['','T', 'p', 'v', 'h', 's', 'x'] units = ['', uT, up, uV+'/'+uM, uE+'/'+uM, uE+'/'+uM+uT,''] P.insert('<h3>Cycle States</h3><center>' + pmcgi.html_column_table(labels, units, (st,T,p,v,h,s,x), thousands=',')\ + '</center>', (resline,0), wait=True) Qhi = Qhi[0] Qlo = Qlo[0] Wp = Wp[0] Wt = Wt[0] Wnet = Wnet[0] eff = eff[0] LifeFuelCost = LifeFuelCost[0] LifeCosts = LifeCosts[0] LifeSavings = LifeSavings[0] P.insert("""<h3>Performance per unit Mass</h3> <center><table>
(line+1,0)) P.write() exit(0) # Build the plot P.insert('<div class="figure"><img src="rankine_plot.py' + pmcgi.buildget() + '"></div>', (line+1,0), wait=True) # build label and unit lists labels = ['','T', 'p', 'ρ', 'x', 'h', 's'] units = ['', uT, up, uM+'/'+uV, '-', uE+'/'+uM, uE+'/'+uM+uT] st = [1,2,3,4] P.insert('<h3>Cycle States</h3><center>' + pmcgi.html_column_table(labels, units, (st,RC.T,RC.p,RC.d, RC.x, RC.h,RC.s), thousands=',')\ + '</center>', (line+2,0), wait=True) P.insert("""<h3>Performance</h3> <center><table> <tr><th>Parameter</th><th>Symb.</th><th>Value</th><th>Units</th></tr> <tr><td>Pump Work</td><td>W<sub>1-2</sub></td><td>{5:f}</td><td>{2:s}/{3:s}</td></tr> <tr><td>Boiler Heat</td><td>Q<sub>2-3</sub></td><td>{6:f}</td><td>{2:s}/{3:s}</td></tr> <tr><td>Work Out</td><td>W<sub>3-4</sub></td><td>{7:f}</td><td>{2:s}/{3:s}</td></tr> <tr><td>Condenser Heat</td><td>Q<sub>4-1</sub></td><td>{8:f}</td><td>{2:s}/{3:s}</td></tr> <tr><td>Efficiency</td><td>η</sub></td><td>{9:.2f}</td><td>%</td></tr> </table></center>""".format( up, uT, uE, uM, uV, float(RC.w[0]), float(RC.q[1]), float(RC.w[2]), float(RC.q[3]), 100*float(RC.meta['eta'])), (line+3,0), wait=True)