资源描述:
《c语言中调用焓熵表(.txt格式)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、/*WaterandSteamParameters*/#include"conio.h"#include"stdio.h"#include"math.h"#include"string.h"#include#include#include#includestructptf1{doublev;doubleh;doubles;}ptf2;/*h[kJ/kg],s[kJ/(kg.K)]*/structptg1{doublev;doubleh;doubles;}ptg2;/*h[kJ/kg]*/structpt
2、1{doublex;doublev;doubleh;doubles;}pt2;/*s[kJ/(kg.K)]*/structps1{doublex;doublet;doublev;doubleh;}ps2;/*h[kJ/kg]*/structph1{doublex;doublev;doubles;doublet;}ph2;structpe1{doublex;doublet;}pe2;doublepsk(doublet)/*Saturatedpressure[at]fromtemperature*/ {double psk1; double f[10]={0.0,-7.6912
3、34564,-26.08023696,-168.1706546,64.23285504,-118.9646225,4.16711732,20.9750676,1.0e9,6.0}; doublezt=(t+273.15)/647.3; doubleztt=1.0-zt,pk=0.0; inti=0; for(i=5;i>=0;i--){pk=pk*ztt+f[i];} pk=pk/zt/(1+f[6]*ztt+f[7]*pow(ztt,2.0)); pk=pk-ztt/(f[8]*pow(ztt,2)+f[9]); psk1=exp(pk)*221.2
4、; return(psk1);/*[at]*/ }doubletsk(doublep)/*Saturatedtemperaturefrompressurep[at]*/ {doubleta,pb,tsk1; ta=100.0*pow(p,0.25);loop11:pb=psk(ta); if(fabs((p-pb)/p)>1.0e-7) {ta=ta+25*(p-pb)/pow(pb,0.75); gotoloop11;} else{tsk1=ta;} return(tsk1); }
5、voidptf(doublep,doublet,structptf1*p1)/*Coolwaterfrompressureandtemperature*/ {doublezp,zt,zh,zs,y,z,yp,zv; inti,i1; doublea[23]={6.824687741e3,-5.422063673e2,-2.096666205e4,3.941286787e4,-6.733277739e4, 9.902381028e4,-1.093911774e5,8.590841667e4,-4.511168742e4,1.418
6、138926e4,-2.017271113e3, 7.982692717,-2.616571843e-2,1.52241179e-3,2.284279054e-2,2.421647003e2,1.269716088e-10, 2.074838328e-7,2.17402035e-8,1.105710498e-9,1.293441934e1,1.308119072e-5,6.047626338e-14}; doublee[12]={8.438375405e-1,5.362162162e-4,1.720000,7.342278489e-2,4.
7、975858870e-2,6.53715430e-1,1.15e-6,1.5108e-5,1.4188e-1,7.0027531650,2.995284926e-4,2.04e-1}; zp=p/221.20; zt=(273.15+t)/647.3; y=1-e[0]*pow(zt,2)-e[1]/pow(zt,6); z=y+sqrt(fabs(e[2]*pow(fabs(y),2)-2*e[3]*zt+2*e[4]*zp));