clear all
TK=273.15;
t1=38+TK;
t2=t1;
t4=80+TK;
t8=38+TK;
t10=6+TK;
ks=0.7;
t5=t4-ks*(t4-t2);
tt8=t8-TK;
tt10=t10-TK;
mr=0.02125;%mass fraction of refrigerant
hc=latent_heat(tt8);%latent heat of condensation
he=latent_heat(tt10);%latent heat of vaporization
a0=0.988;%Licl
a1=0.304;
b0=-27.9;
b1=59.3;
cpv=1.86;
cpl=4.18;
x2=(t4-a0*t8-b0)/(a1*t8+b1);%mass fraction of strong solution
x1=(t1-a0*t10-b0)/(a1*t10+b1);%mass fraction of weak solution
t3a=(a1*x1+a0)*t8+(b1*x1+b0);
t6a=(a1*x2+a0)*t10+(b1*x2+b0);
t6=t5;
t45=(t4+t5)/2-TK;
cp45=licl_birerong(t45,x2);
fa=x2/(x2-x1);
ms=mr*fa;
t3=(ms-mr)*(t4-t5)/ms+t2;
tol=1;
while tol>0.01
t23=(t3+t2)/2-TK;
cp23=licl_birerong(t23,x1);
t31=(ms-mr)*(t4-t5)*cp45/ms/cp23+t2;
tol=abs(t31-t3);
t3=t31;
end
ag=((t4+t3a)/2/t8)^2/(a1*(x1+x2)/2+a0);
aa=((t6a+t1)/t10/2)^2/(a1*(x1+x2)/2+a0);
tv=t4;
t43=(t4+t3)/2-TK;
t51=(t5+t1)/2-TK;
t56=(t5+t6a)/2-TK;
cp1=licl_birerong(t51,x1);
cp2=licl_birerong(t43,x1);
cp3=licl_birerong(t56,x2);
Qg=ms*cp2*(t4-t3)+mr*(ag*hc+cpv*(tv-t4));
Qa=ms*cp1*(t5-t1)+mr*(aa*he+cpv*(t10-t1)-cp3*(t5-t6a));
Qc=mr*(hc+cpv*(tv-t8));
Qe=mr*(he-cpl*(t8-t10));
Qs=cp45*(ms-mr)*(t4-t5);
cop=Qe/Qg;
A=[Qg;Qa;Qc;Qe;Qs;cop]; 