| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 426 人关注过本帖
标题:新编的程序怎么有几个老提示C2601定义非法,找不出来啊
只看楼主 加入收藏
lixuge
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2012-11-13
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:4 
新编的程序怎么有几个老提示C2601定义非法,找不出来啊
#include<iostream>
#include<math.h>
#define pi 3.1415926535897939
using namespace std;
double psat(double Tsat)
{
    double psat;
    psat=exp(21.51297-2200.9809/(Tsat+246.61));
    return (psat);
}

double Tsat(double psat)
{
    double Tsat;
    Tsat=-2200.9809/(log(psat)-21.51297)-246.61;
    return (Tsat);
}

double v(double tsh,double Tsat)
{
    double v,vs;
    vs=exp(-12.4539+2669.0/(Tsat+273.15))*(1.01357+10.6736*pow(10,-4)*Tsat-9.2532*pow(10,-6)*pow(Tsat,2)-3.2192*pow(10,-7)*pow(Tsat,3.0));
    v=(1+4.7881*pow(10,-3)*tsh-3.965*pow(10,-6)*pow(tsh,2)+2.5817*pow(10,-5)*tsh*Tsat-1.8506*pow(10,-7)*pow(tsh,2.0)*Tsat
        +8.5739*pow(10,-7)*tsh*pow(Tsat,2.0)-5.401*pow(10,-9)*pow(tsh,2.0)*pow(Tsat,2.0))*vs;
   return(v);
}

double ug(double Tg)
{
    double ug;
    ug=pow(10,-7)*(-5.083+0.50162*(Tg+273.15)-1.18e-4*pow(Tg+273.15,2.0));
    return(ug);
}

double uf(double Tf)
{
    double uf;
    uf=pow(10,-3)*pow(10,-14.4406+1256.3/(Tf+273.15)+0.052393*(Tf+273.15)-6.9771*pow(10,-5)*pow((Tf+273.15),2.0));
    return(uf);
}

double utp(double uf,double ug,double x)
{
    double utp;
    utp=uf*ug/(x*uf+(1-x)*ug);
    return(utp);
}

double g(double t)
{
    double g,T,j;
    T=t+273.15;
    j=-pow(1-T/380.0,0.31372);
    g=0.49834*pow(0.24141,j)*1000;
    return(g);

}

double vs(double Tsat)
{
    double vs(Tsat);
    vs=exp(-12.4539+2669.0/(Tsat+273.15))*(1.01357+10.6736*pow(10,-4)*Tsat-9.2532*pow(10,-6)*pow(Tsat,2.0)-3.2192*pow(10,-7)*pow(Tsat,3.0));
    return(vs);
}

double hf(double T1)
{
    double hf;
    hf=200000+1335.29*T1+1.70650*pow(T1,2.0)+7.6741*pow(10,-3)*pow(T1,3.0);
    return(hf);
}
double T(double h)
{
    double t,h1,t1,t2;
    for(t1=60,t2=-60,t=(t1+t2)/2,h1=200000+1335.29*t+1.70650*pow(t,2.0)+7.6741*pow(10,-3)*pow(t,3.0);
    fabs(h-h1)>0.01;
    t=(t1+t2)/2,h1=200000+1335.29*t+1.70650*pow(t,2.0)+7.6741*pow(10,-3)*pow(t,3.0))
    {  if(h1>h)
          t1=t;
        else
    t2=t;}
    return(t);
}
double hv(double Tsat)
{
    double hv,hi1;
    hi1=249455+606.163*Tsat-1.05644*pow(Tsat,2.0)-18.2426*pow(10,-3)*pow(Tsat,3.0);
    hv=hi1+149048;
    return(hv);
}
double hs(double tsh,double Tsat)
{
    double hs,hi1,hi2;
    hi1=249455+606.163*Tsat-1.05644*pow(Tsat,2.0)-18.2426*pow(10,-3)*pow(Tsat,3.0);
    hi2=(1+3.48186*pow(10,-3)*tsh+16.886*pow(10,-7)*pow(tsh,2)+9.2642*pow(10,-6)*tsh*Tsat-7.698*pow(10,-8)*pow(tsh,2)*Tsat
        +17.07*pow(10,-8)*tsh*pow(Tsat,2)-12.13*pow(10,-10)*pow(tsh,2)*pow(Tsat,2))*hi1;
    hs=hi2+149048;
    return(hs);
}
double tsh(double h,double Tsat)
{
    double t,hsc,t1,t2;
    for(t1=0,t2=50,t=(t1+t2)/2,hsc=hs(t,Tsat);
    fabs(h-hsc)>0.01;t=(t1+t2)/2,hsc=hs(t,Tsat))
    {
        if(hsc>h)
        t2=t;
        else  
        t1=t;
    }
    return(t);
}


double cpf(double Tf)
{
    double cpf;
    cpf=pow(10,3)*(-14.015+1.4306*(Tf+273.15)-0.006022*pow((Tf+273.15),2.0)+9.9834*pow(10,-6)*pow((Tf+273.15),3))/86.5;//为什么要除以86.5
    return(cpf);
}

double cpg(double Tg)
{
    double cpg;
    cpg=pow(10,3)*(8.429+0.34966*(Tg+273.15)-3.3281*pow(10,-4)*pow((Tg+273.15),2)+1.5603*pow(10,-7)*pow((Tg+273.15),3)-2.8939*pow(10,-11)*pow((Tg+273.15),4.0))/86.5;
    return(cpg);
}

double rg(double Tg)
{
    double rg;
    rg=-0.00668+4.8544*pow(10,-5)*(Tg+273.15)+1.2108*pow(10,-8)*pow((Tg+273.15),2.0);
    return(rg);
}

double rf(double Tf)
{
    double rf;
    rf=pow(10,(-1.7425+0.9769*pow(1-(Tf+273.15)/380,2.0/7.0)));
    return (rf);
}

double d(double Tg,double Tw)
{
    double d,a,b,c,tg,tw;
    tg=Tg+273.15;
    tw=Tw+273.15;
    a=166.31*pow(647.3-tw,0.38);
    b=1e5*exp(3816.44/(tw-46.13)-23.1964)-1;
    c=267.38*pow(647.3-tw,0.38)+1.88*(tg-tw);
    d=(a*1.0/b-1.01*(tg-tw))/c;
    return(d);
}
double cpma(double Tg,double Tw)
{
    double cpma,cpda,cpv,da;
        cpda=1.00687*pow(10,3)-8.722*pow(10,-2)*Tg+1.236*pow(10,-4)*pow(Tg,2);
        cpv=1.85314*pow(10,3)+0.6133*Tg+1.014*pow(10,-3)*pow(Tg,2);
        da=d(Tg,Tw);
        cpma=(cpda/(1+da))*(1+da*cpv/cpda);
        return(cpma);
}

double Re(double G,double d,double u)
{
    double Re;
    Re=G*d/u;
    return (Re);
}
double ha(double Tg,double Tw)
{
    double ha,da,w;
    w=pow(10,5)*exp(3816.44/(Tw+273.15-46.13)-23.1964)-1;
    da=d(Tg,Tw);
    ha=(1.01*Tg+0.001*(da*1000)*(2501+1.85*Tg))*1000;
    return(ha);
}
double t_w(double h)
{
    double t,t1,t2,ha,da;
    for(t1=-15,t2=70,t=(t1+t2)/2,da=d(t,t),
        ha=(1.01*t+0.001*(da*1000)*(2501+1.85*t))*1000;
        fabs(ha-h)>1;
        t=(t1+t2)/2,da=d(t,t),ha=(1.01*t+0.001*(da*1000)*(2501+1.85*t))*1000)
   
    {
            if (ha>h)
            t2=t;
            else
            t1=t;
    }
    return(t);

double ra(double Tg,double Tw)
{
    double ra,uda,uv,rda,rv,w,d;
    w=pow(10,5)*exp(3816.44/(Tw+273.15-46.13)-23.1964)-1;
    d=(166.31*pow((647.3-Tw-273.15),0.38)*1.0/w-1.01*(Tg-Tw))*1.0/(267.38*pow((647.3-Tw-273.15),0.38)+1.88*(Tg-Tw));
    uda=(17.4945+4.779e-2*Tg-3.526e-5*pow(Tg,2))*pow(10,-6);
    uv=(8.1804+4.011e-2*Tg-1.7858e-5*pow(Tg,2))*pow(10,-6);
    rda=(2.4587+7.5855e-3*Tg-1.69e-6*pow(Tg,2))*pow(10,-2);
    rv=(1.6+6.179e-3*Tg+2.7535e-5*pow(Tg,2))*pow(10,-2);
    ra=(rda*4.56724/pow((1+0.881*pow((uda/uv),0.5)),2))*(1/(1+1.60746*d)+(rv/rda)/(1+(uv/uda)*(1/d)));
    return(ra);
}
double ua(double Tg,double Tw)
{
    double ua,uda,uv,d,w;
    uda=(17.4945+4.779e-2*Tg-3.526e-5*pow(Tg,2))*pow(10,-6);
    uv=(8.1804+4.011e-2*Tg-1.7858e-5*pow(Tg,2))*pow(10,-6);
    w=pow(10,5)*exp(3816.44/(Tw+273.15-46.13)-23.1964)-1;
    d=(166.31*pow((647.3-Tw-273.15),0.38)*1.0/w-1.01*(Tg-Tw))*1.0/(267.38*pow((647.3-Tw-273.15),0.38)+1.88*(Tg-Tw));
    ua=uda*(1+1.268*(uv/uda)*d)/(1+1.268*d);
    return(ua);
}

double a(double Tg,double Tw,double Ga,double Lp,double Fp,double Ll,double Tp,double Fl,double Lj,double Ff,double Th)         
{
    double a,Rea,u,cp,pr,r;
        u=ua(Tg,Tw);
        Rea=Re(Ga,Lp,u);
        cp=cpma(Tg,Tw);
        r=ra(Tg,Tw);
        pr=cp*u/r;
        a=pow(Rea,-0.49)*pow(Lj/90,0.27)*pow(Fp/Lp,-0.14)*pow(Fl/Lp,-0.29)*pow(Th/Lp,-0.23)*pow(Ll/Lp,0.68)*pow(Tp/Lp,-0.28)*pow(Ff/Lp,-0.05)*Ga*cp*pow(pr,-2/3);
        return(a);
}
//由含湿量和湿球温度反算干球温度
double Tg(double d1,double tw)
{
    double t1,t2,t,da;
    for (t1=-15,t2=70,t=(t1+t2)/2,da=d(t,tw);
    fabs(da-d1)>0.0001;
    t=(t1+t2)/2,da=d(t,tw))
    {
        if(da>d1)
            t1=t;
        else
            t2=t;
    }
    return(t);
}
double ga(double tg,double tw)

{
    double a,ga,da,ps;
    ps=exp(6.42+0.072*tg-2.71e-3*pow(tg,2)+7.23e-7*pow(tg,3));
    da=d(tg,tw);
    a=101325/(0.622/da+1)/ps;
    ga=101325*(1-0.378*a*ps/101325)/(287.06*(tg+273.15));
    return(ga);
}


double x(double htp,double t)
{
    double x;
    x=(htp-hf(t))/(hv(t)-hf(t));
    return(x);
}

 double asc(double Gr,double t,double de)
{
    double asc,re,pr,nu,r,cp,u;
    u=ug(t);
    cp=cpg(t);
    r=rg(t);
    re=Gr*de/u;
    pr=cp*u/r;
    nu=0.023*pow(re,0.8)*pow(pr,0.4);
    asc=nu*r/de;
    return(asc);
}
 double atp(double x,double Gr,double t,double de)
 {
     double atp,cp,r,u,pr,g1,vs1,nu;
     cp=cpf(t);
     u=uf(t);
     r=x*rg(t)+(1-x)*rf(t);
     pr=cp*u/r;
     g1=g(t);
     vs1=vs(t);
     nu=0.0265*pow(Gr,0.8)*pow(((1-x+x*pow(g1*vs1,0.5))/u),0.8)*pow(pr,0.3333)*pow(de,0.8);
     atp=nu*r/de;
     return(atp);
 }

void Lsc(double tin,double xin,double mr,double ta,double tw,double v,double tsc,double hjs,double gjv,double jv,double ch,double de,double ck,
           double e,double Lp,double Fp,double Ll,double Tp,double Fl,double Lj,double Ff,double Th,double L,double Aa,
           double *t2_sc,double *Lsc,double *Qr)
{

    double hout,h1,h2;
    double t_sh,tout,t,t1,t2,trm,t_r;
    double ta1,tw1,ta2,tw2,d_1,Q_r,ha1,ha2,twm,tam;
    double asc_w,aos;
    double n,i;
    double L_sc;
    double Gr,ma,g_a,As,Ga;
    double Ai,Ao;
    As=pi*pow(de/2-e,2)+8.21*pow(10,-6);
    Gr=mr/As;
    g_a=ga(ta,tw);
    ma=g_a*v/3600;
    Aa=L*(gjv+de)-0.00611*L;
    Ga=ma/Aa;
    Ai=pi*(de-2*e)*L+0.046*L;
    Ao=pi*de*L+0.048*L;//换热外表面积
    hout=hjs;//过热区出口焓值
    t_sh=tsh(hout,tsc);//假设压降的过热度
    tout=tsc+t_sh;
    *t2_sc=tout;
    n=50;//过热区微元数
    t=(tout-tsc)/n;
    t2=tout;
    ta1=ta;//空气进口温度
    tw1=tw;//空气进口湿球温度
    *Lsc=0;
    *Qr=0;//热量初值
    for(i=1;i<=n;i++)
    {
        t_sh2=t2-tsc;
        t1=t2-t;
        t_sh1=t1-tsc;
        h2=hs(t_sh2,tsc);
        h1=hs(t_sh1,tsc);
        Q_r=mr*(h2-h1);
        Qa=Q_r;//微元空气得热量
        trm=(t1+t2)/2;//微元制冷剂平均温度
        asc_w=asc(Gr,trm,de-2*e);
        aos=a(tam,twm,Ga,Lp,Fp,Ll,Tp,Fl,Lj,Ff,Th);
        d_1=d(ta1,tw1);
        ha1=ha(ta1,tw1);
        ha2=ha1-Qa/ma;
        tw2=t_w(ha2);
        ta2=Tg(d_1,tw2);
        tam=(ta1+ta1)/2;
        twm=(tw1+tw2)/2;
        L_sc=(1/asc_w+Ai/(Ao*aos))*mr*(h2-h1)/(fabs(trm-tam)*pi*(de-2*e+0.046));
        *Lsc=*Lsc+L_sc;
        *Qr=*Qr+Q_r;
        t2=t1;//迭代
        h2=h1;
        }
}
//蒸发器两相区
void Ltp(double tin,double xin,double mr,double ta,double tw,double v,double tsc,double hjs,double pin,double hin,double gjv,double jv,double ch,double de,double ck,
           double e,double Lp,double Fp,double Ll,double Tp,double Fl,double Lj,double Ff,double Th,double L,double Aa,
           double *xout,double *Ltp,double *Qr)
{
    double htp1,htp2,htp;
    double trm;
    double x1,x2,xm;
    double ta1,tw1,ta2,tw2,tam,twm,d_1,Q_r,ha1,ha2;
    double atp_w,aos;
    double L_tp;
    double n,i;
    double Gr,ma,g_a,As,Ga;
    double Ai,Ao;
    As=pi*pow(de/2-e,2)+8.21*pow(10,-6);
    Gr=mr/As;
    g_a=ga(ta,tw);
    ma=g_a*v/3600;
    Aa=L*(gjv+de)-0.0061*L;
    Ga=ma/Aa;
    Ai=pi*(de-2*e)*L+0.046*L;
    Ao=pi*de*L+0.0481*L;
    ta1=ta;
    tw1=tw;
    htp2=hjs;
    n=100;//微元数
    htp=(htp2-hin)/n;
    *Ltp=0;
    *Qr=0;
    for(i=1;i<=n;i++)
    {
        htp1=htp2-htp;
        Q_r=mr*(htp2-htp1);
        trm=tsc;
        x1=x(htp1,tsc);
        x2=x(htp2,tsc);
        xm=(x1+x2)/2;
        d_1=d(ta,tw);
        ha1=h(ta1,tw1);
        Qa=Q_r;//空气吸热量
        ha2=ha1-Qa/ma;

        tw2=t_w(ha2);
        ta2=Tg(d_1,tw2);
        tam=(ta1+ta2)/2;
        twm=(tw1+tw2)/2;
        aos=a(tam,twm,Ga,Lp, Fp,Ll,Tp,Fl,Lj,Ff,Th);
        atp_w=atp(xm,Gr,Tc,de-2*e);
        L_tp=(1/atp_w+Ai/(Ao*aos))*mr*htp/(fabs(tam-trm)*pi*(de-2*e+0.046));
        *Ltp=*Ltp+L_tp;//总长
        *Qr=*Qr+Q_r;
        htp2=htp1;
        x2=x1;
   
    }
    *xout=x2;
}
void evaporator(double gjv,double jv,double ch,double de,double ck,double e,
                double Lp,double Fp,double Ll,double Tp,double Fl,double Lj,double Ff,double Th,double L,double Aa,double tin,double xin,double mr,double ta,double tw,
                double v,double*t2_sc,double*L_tp_con,double*L_sc_con,double*Qr_tp_con,double*Qr_sc_con,
                double*Qz,double*h_js,double *h_sc,double*xout,double*Lz,double *Te)
{
    double tsc,pin,hin,hxx,Tsh,hsx,hsc,hjs;
    double L_tp,L_sc;//、两相、过热区的长度
    double Qr_tp,Qr_sc,xout_tp;
    tsc=tin;
    hsc=hv(tsc);
    pin=psat(tin);
    hin=xin*hv(tin)+(1.0-xin)*hf(tin);
    hxx=hin;
    Tsh=ta-tin;
    hsx=hs(Tsh,tin);
    for(hjs=(hxx+hsx)/2.0;;hjs=(hxx+hsx)/2.0)
    {
        if(hjs>hsc)
            Lsc(tin,xin,mr, ta,tw, v,tsc,hjs,gjv,jv,ch,de,ck,e,Lp,Fp,Ll,Tp,Fl,Lj, Ff,Th,L,Aa,&t2_sc,&L_sc,&Qr_sc);
            *L_sc_con=L_sc;
            *Qr_sc_con=Qr_sc;
            Ltp( tin, xin,mr,ta,tw,v,tsc,hsc,pin,hin,gjv,jv,ch,de,ck,e,Lp, Fp, Ll, Tp, Fl, Lj,Ff,Th, L, Aa,&xout_tp,&L_tp,&Qr_tp);
            *L_tp_con=L_tp;
            *Qr_tp_con=Qr_tp;
            *Lz=L_sc+L_tp;//扁管总长
            *Qz=*Qr_tp_con+*Qr_sc_con;//总热量
        }
        else
        {
            L_sc=0;
            Qr_sc=0;
            Ltp( tin, xin,mr,ta,tw,v,tsc,hsc,pin,hin,gjv,jv,ch,de,ck,e,Lp, Fp, Ll, Tp, Fl, Lj,Ff,Th, L, Aa,&xout_tp,&L_tp,&Qr_tp);
            *L_tp_con=L_tp;
            *Qr_tp_con=Qr_tp;
            *Lz=L_sc+L_tp;//扁管总长
            *Qz=*Qr_tp_con+*Qr_sc_con;//总热量
        }
        if (*Lz-L>0.1)//调节长度
            hsx=hjs;
        else if (*Lz-L<-0.1)
            hxx=hjs;
        else
            break;
    }
      *h_js=hjs;
      *h_sc=hsc;
      *Lsc=L_sc;
      *t2_sc=t2sc;
      *Ltp=L_tp;
      *xout=xout_tp;
      *Te=tsc;
}
void main()
{
    double gjv,jv,ch,de,ck,e,Lp, Fp,Ll,Tp,Fl,Lj,Ff,Th,L,Aa;//蒸发器结构参数
    double tin,xin,mr;//制冷剂输入参数
    double ta,tw,v;//空气输入参数
    double h_js,h_sc,Te;
    double Qr_sh,Qr_sc,Qr_tp,Qz;
    double Lz,L_tp,L_sc;
    double t2_sc,xout;
    gjv=10e-3;//管间距(m)
    jv=2.5e-3;//翅片间距(m)
    ch=0.1e-3;//翅片厚度(m)
    de=3.0e-3;//管外径(m)
    ck=0.016;//翅片宽度(m)
    e=0.4e-3;//管壁厚度(m)
    mr=0.00077;//制冷剂流量(kg/s)
    v=76.17;//风机风量(m3/h)
    ta=7;//空气进口干球温度
    tw=6;//空气进口湿球温度
    L=2.48;//蒸发器长度(m)
    Aa=0.0062;//迎风面积
    Lp=1e-3;//百叶窗间距
    Fp=2.2e-3;//管间距
    Ll=5e-3;//翅片长度
    Tp=10e-3;//扁管间距
    Fl=8e-3;//翅片长度
    Lj=24;//开窗角度
    Ff=0.1e-3;//翅片厚度
    Th=1.5e-3;//扁管高度
    tin=0;//制冷剂进口温度
    xin=0.18;//制冷剂进口干度
 evaporator(gjv,jv,ch,de,ck,e,Lp,Fp,Ll,Tp,Fl,Lj,Ff,Th,L,Aa,tin,xin,mr,ta,tw,v,&t2_sc,&L_tp_con,&L_sc_con,&Qr_tp_con,&Qr_sc_con,
                &Qz,&h_js,&h_sc,&xout,&Lz,&Te);
     if (hjs>hsc)
    {
        cout<<"蒸发器过热"<<endl;
        cout<<"过热区制冷剂出口温度tout="<<t2_sc<<"℃"<<endl;
        cout<<"过热区换热量Qr_sc="<<Qr_sc<<"w"<<endl;
        cout<<"过热区长度L_sc="<<L_sc<<"m"<<endl;
        cout<<"R134a蒸发温度Te="<<Te<<"℃"<<endl;
        cout<<"两相区长度L_tp="<<L_tp<<"m"<<endl;
        cout<<"两相区换热量Qr_tp="<<Qr_tp<<"w"<<endl;
        cout<<"总换热量Qz="<<Qz<<"w"<<endl;
        cout<<"总长Lz="<<Lz<<"m"<<endl;
    }

    else if(hjs<hsc)
    {
        cout<<"R134a蒸发温度Te="<<Te<<"℃"<<endl;
        cout<<"两相区长度L_tp="<<L_tp<<"m"<<endl;
        cout<<"两相区换热量Qr_tp="<<Qr_tp<<"w"<<endl;
        cout<<"总换热量Qz="<<Qz<<"w"<<endl;
        cout<<"总长Lz="<<Lz<<"m"<<endl;
        
        
    }   
}
搜索更多相关主题的帖子: double include return 
2012-12-19 15:50
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:20 
老大,请问 是自己编的吗

DO IT YOURSELF !
2012-12-19 15:53
lixuge
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2012-11-13
收藏
得分:0 
是啊,怎么了啊?
2012-12-19 15:59
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:0 
以下是引用lixuge在2012-12-19 15:59:47的发言:

是啊,怎么了啊?
这么老长的代码 如果是自己写的话  应该排错没问题呀

DO IT YOURSELF !
2012-12-19 16:04
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:0 
这么多模块 一个一个的调试吧

DO IT YOURSELF !
2012-12-19 16:04
快速回复:新编的程序怎么有几个老提示C2601定义非法,找不出来啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027038 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved