您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 交通运输 > 西安交通大学高工编程作业
一、请用PR方程计算制冷剂R32、R125和混合制冷剂R32/R125(50/50Wt%)的pvT性质。1.算法已知流体的P,T求V;赋初值(0)1.10.001z气相液相;利用牛顿迭代(1)(0)()()fzzzfz;终值判断(1)();kkzzzRTvP。2.源程序与运行结果2.1计算R32的源程序#includeiostream.h#includemath.hvoidmain(){doubleA,B,P,T,Tc,Tr,Pc,Rg,w,M,atc,a,b,k,v,z0,z1;w=0.277;Tc=351.255;Pc=5780000;M=0.052024;Rg=8.31451/M;cout用PR方程计算制冷剂R32endlendl;cout输入R32压力值(单位:Pa):endl;cinP;coutendl;cout输入R32温度值(单位:K):endl;cinT;coutendl;Tr=T/Tc;atc=0.45724*pow(Rg,2)*pow(Tc,2)/Pc;b=0.0778*Rg*Tc/Pc;k=0.37464+1.5422*w-0.26992*pow(w,2);a=pow(((1-pow(Tr,0.5))*k+1),2);a=atc*a;A=a*P/(Rg*Rg*T*T);B=b*P/(Rg*T);z0=1.1;label0:z1=z0-(pow(z0,3)-(1-B)*pow(z0,2)+(A-3*pow(B,2)-2*B)*z0-(A*B-pow(B,2)-pow(B,3)))/(3*pow(z0,2)-2*(1-B)*z0+(A-3*pow(B,2)+2*B));if(fabs(z1-z0)0.0001){z0=z1;gotolabel0;}v=z1*Rg*T/P;coutR32的比体积v为:vendl;}运行结果用PR方程计算制冷剂R32输入R32压力值(单位:Pa):5780000输入R32温度值(单位:K):351.255R32的比体积v为:0.003299112.2计算R125的源程序#includeiostream.h#includemath.hvoidmain(){doubleA,B,P,T,Tc,Tr,Pc,Rg,w,M,atc,at,a,b,k,v,z0,z1;w=0.299;Tc=339.45;Pc=3630600;M=0.12003;Rg=8.31451/M;cout用PR方程计算制冷剂R125endlendl;cout输入R125压力值(单位:Pa)endl;cinP;coutendl;cout输入R125温度值(单位:K)endl;cinT;coutendl;Tr=T/Tc;atc=0.45724*pow(Rg,2)*pow(Tc,2)/Pc;b=0.0778*Rg*Tc/Pc;k=0.37464+1.5422*w-0.26992*pow(w,2);a=pow(((1-pow(Tr,0.5))*k+1),2);at=atc*a;a=at;A=a*P/(Rg*Rg*T*T);B=b*P/(Rg*T);z0=1.1;label0:z1=z0-(pow(z0,3)-(1-B)*pow(z0,2)+(A-3*pow(B,2)-2*B)*z0-(A*B-pow(B,2)-pow(B,3)))/(3*pow(z0,2)-2*(1-B)*z0+(A-3*pow(B,2)+2*B));if(fabs(z1-z0)0.0001){z0=z1;gotolabel0;}v=z1*Rg*T/P;coutR125的比体积为:vendl;}计算结果用PR方程计算制冷剂R125输入R125压力值(单位:Pa)3630600输入R125温度值(单位:K)339.45R125的比体积为:0.002199962.3计算R32/R125的源程序#includeiostream.h#includemath.hvoidmain(){DoubleA,B,P,T,Tc1,Tc2,Tr1,Tr2,Pc1,Pc2,Rg,Rg1,Rg2,w1,w2,M1,M2,a,a1,a2,b,b1,b2,k1,k2,v,z0,z1,x1,x2;x1=0.69763;x2=0.30237;w1=0.277;Tc1=351.255;Pc1=5780000;M1=0.052024;Rg1=8.3145/M1;w2=0.299;Tc2=339.45;Pc2=3630600;M2=0.12003;Rg2=8.3145/M2;cout用PR方程计算制冷剂R410Aendlendl;cout输入R410A压力值(单位:Pa)endl;cinP;coutendl;cout输入R410A温度值(单位:K)endl;cinT;coutendl;Tr1=T/Tc1;b1=0.0778*Rg1*Tc1/Pc1;k1=0.37464+1.5422*w1-0.26992*pow(w1,2);a1=pow(((1-pow(Tr1,0.5))*k1+1),2);a1=a1*0.45724*pow(Rg1,2)*pow(Tc1,2)/Pc1;Tr2=T/Tc2;b2=0.0778*Rg2*Tc2/Pc2;k2=0.37464+1.5422*w2-0.26992*pow(w2,2);a2=pow(((1-pow(Tr2,0.5))*k2+1),2);a2=a2*0.45724*pow(Rg2,2)*pow(Tc2,2)/Pc2;a=pow(x1,2)*a1+x1*x2*(1-0.01)*pow(a1*a2,0.5)+x2*x1*(1-0.01)*pow(a2*a1,0.5)+pow(x2,2)*a2;b=x1*b1+x2*b2;Rg=8.3145/(M1/2+M2/2);A=a*P/(Rg*Rg*T*T);B=b*P/(Rg*T);z0=1.1;label0:z1=z0-(pow(z0,3)-(1-B)*pow(z0,2)+(A-3*pow(B,2)-2*B)*z0-(A*B-pow(B,2)-pow(B,3)))/(3*pow(z0,2)-2*(1-B)*z0+(A-3*pow(B,2)+2*B));if(fabs(z1-z0)0.0001){z0=z1;gotolabel0;}v=z1*Rg*T/P;coutR410A的比体积为:vendl;}计算结果用PR方程计算制冷剂R32/R125输入R32/R125压力值(单位:Pa)4000000输入R410A温度值(单位:K)380R125的比体积为:0.00123557二、请用PR方程计算工质R32、R125和混合工质R32/R125的导出热力性质焓和熵。2.1用PR方程计算R125的导出热力性质焓和熵。#includeiostream.h#includemath.hdoublezi(doubleP,doubleT){doubleA,B,Tc,Tr,Pc,Rg,w,M,atc,a,b,k,z0,z1;w=0.299;Tc=339.45;Pc=3630600;M=0.12003;Rg=8.31451/M;Tr=T/Tc;atc=0.45724*pow(Rg,2)*pow(Tc,2)/Pc;b=0.0778*Rg*Tc/Pc;k=0.37464+1.5422*w-0.26992*pow(w,2);a=pow(((1-pow(Tr,0.5))*k+1),2);a=atc*a;A=a*P/(Rg*Rg*T*T);B=b*P/(Rg*T);z0=1.1;label0:z1=z0-(pow(z0,3)-(1-B)*pow(z0,2)+(A-3*pow(B,2)-2*B)*z0-(A*B-pow(B,2)-pow(B,3)))/(3*pow(z0,2)-2*(1-B)*z0+(A-3*pow(B,2)+2*B));if(fabs(z1-z0)0.0001){z0=z1;gotolabel0;}returnz1;}doublevolume(doubleP,doubleT){doubleA,B,Tc,Tr,Pc,Rg,w,M,atc,a,b,k,v,z0,z1;w=0.299;Tc=339.45;Pc=3630600;M=0.12003;Rg=8.31451/M;Tr=T/Tc;atc=0.45724*pow(Rg,2)*pow(Tc,2)/Pc;b=0.0778*Rg*Tc/Pc;k=0.37464+1.5422*w-0.26992*pow(w,2);a=pow(((1-pow(Tr,0.5))*k+1),2);a=atc*a;A=a*P/(Rg*Rg*T*T);B=b*P/(Rg*T);z0=1.1;label0:z1=z0-(pow(z0,3)-(1-B)*pow(z0,2)+(A-3*pow(B,2)-2*B)*z0-(A*B-pow(B,2)-pow(B,3)))/(3*pow(z0,2)-2*(1-B)*z0+(A-3*pow(B,2)+2*B));if(fabs(z1-z0)0.0001){z0=z1;gotolabel0;}v=z1*Rg*T/P;returnv;}doublebeta(doubleT){doubleRg,Tc,k,Tr,M,w,Pc,b;w=0.299;Pc=3630600;Tc=339.45;M=0.12003;Rg=8.31451/M;Tr=T/Tc;k=0.37464+1.5422*w-0.26992*pow(w,2);b=-(1+k*(1-pow(Tr,0.5)))*(0.45724*pow(Rg,2)*Tc*k)/(Pc*pow(Tr,0.5));returnb;}voidmain(){doublezi(doubleP,doubleT);doublebeta(doubleT);doublevolume(doubleP,doubleT);doublear,sr,hr,P,T,Tc,Tr,Pc,Rg,w,M,atc,a,b,k,v,vi,bt,Z,P0,T0,h0,s0,h,s,c0,c1,c2,c3;cout工质R125endlendl;cout请输入工质R125压力值(单位:Pa)endl;cinP;coutendl;cout请输入工质R125温度值(单位:K)endl;cinT;coutendl;P0=671500;T0=273.15;h0=333289;s0=1488;c0=2.83868;c1=11.581633;c2=-1.704482;c3=-0.266732;Z=zi(P,T);v=volume(P,T);bt=beta(T);w=0.299;Tc=339.45;Pc=3630600;M=0.12003;Rg=8.31451/M;Tr=T/Tc;atc=0.45724*pow(Rg,2)*pow(Tc,2)/Pc;b=0.0778*Rg*Tc/Pc;k=0.37464+1.5422*w-0.26992*pow(w,2);a=pow(((1-pow(Tr,0.5))*k+1),2);a=atc*a;vi=Rg*T/P;ar=Rg*T*log((v-b)/v)-a*log((v-0.414*b)/(v+2.414*b))/(2*pow(2,0.5)*b)+Rg*T*log(v/vi);sr=-Rg*log((v-b)/v)+bt*log((v-0.414*b)/(v+2.414*b))/(2*pow(2,0.5)*b)-Rg*log(v/vi);hr=ar+T*sr+Rg*T*(1-Z);h=h0+(c0*(T-T0)+c1*(T*T-T0*T0)/(2*Tc)+c2*(T*T*T-T0*T0*T0)/(3*Tc*Tc)+c3*
本文标题:西安交通大学高工编程作业
链接地址:https://www.777doc.com/doc-6010747 .html