Result = main
function Result = main
Wads=0.045;
Tads=80;
Wdes=0.035;
Tdes=27;
Teva=7;
Tcond=27;
Mweva=0.65;
Initial=[Wads Tads Wdes Tdes Mweva Teva Tcond 0 0 0 0];
tspan=[1:1:800];
opts = odeset('RelTol',1e-6,'AbsTol',1e-6);
[t,Soln]=ode45(@(t,Soln)ODEdw(t,Soln),tspan,Initial,opts);
colNames = {'Time','Wads','Tads','Wdes','Tdes','Mweva', 'Teva','Tcond',...
'Tcwaout', 'Thwdout', 'Tchwout', 'Tcwcout'};
Result = array2table([tspan',Soln],'VariableNames',colNames);
function [dYdt] =ODEdw(~,Soln)
Ea=4.2*10^4;
R=8.314;
Dso=2.54*10^-4;
Qs=2.8*10^6;
Thwdin=85;
Tcwain=27;
Tcwcin=27;
Tchwin=14;
mcwa=8/60;
mcwc=20/60;
mchw=1.6/60;
mhwd=7/60;
Cps=924;
Ms=9;
Rp=5.6*10^-4;
ps=700;
Por=0.3;
Cpw=4200;
Cpv=1900;
M=18.02;
Lv=2500*10^3;
Acond=5.76;
Mhexcond=19.87;
Ucond=486.87;
UAcond=Acond*Ucond;
Mwcond=1.0;
Mhex=65;
Cphex=386;
Aad=2.11;
Uads=189.60;
Udes=203.99;
UAads=Aad*Uads;
UAdes=Aad*Udes;
Vt=0.5;
Aeva=0.34;
Mhexeva=16.1;
Ueva=302.58;
UAeva=Aeva*Ueva;
Wads=Soln(1);
Tads=Soln(2);
Wdes=Soln(3);
Tdes=Soln(4);
Mweva=Soln(5);
Teva=Soln(6);
Tcond=Soln(7);
Kads=((15*Dso)/(Rp).^2)*exp(-Ea/(R*(Tads+273.16)));
Pwa=133.32*exp(18.3-(3820/((Teva+273.16)-46.1)));
Psga=133.32*exp(18.3-(3820/((Tads+273.16)-46.1)));
Weqa=0.346*(Pwa/Psga)^0.625;
Aads=(Kads*(Weqa-Wads));
TLads=(Ms*(Cpw+Cpw*Wads)+Mhex*Cphex);
Tcwaout=Tads+(Tcwain-Tads)*exp((-UAads)/(mcwa*Cpw));
Kdes=((15*Dso)/(Rp).^2)*exp(-Ea/(R*(Tdes+273.16)));
Pwd=133.32*exp(18.3-(3820/((Tcond+273.16)-46.1)));
Psgd=133.32*exp(18.3-(3820/((Tdes+273.16)-46.1)));
Weqd=0.346*(Pwd/Psgd)^0.625;
Ades=(Kdes*(Weqd-Wdes));
TLdes=(Ms*(Cps+Cpw*Wdes)+Mhex*Cphex);
Thwdout=Tdes+(Thwdin-Tdes)*exp((-UAdes)/(mhwd*Cpw));
TLeva=(Mweva*Cpw+Mhexeva*Cphex);
Tchwout=Teva+(Tchwin-Teva)*exp((-UAeva)/(mchw*Cpw));
TLcond=(Mwcond*Cpw+Mhexcond*Cphex);
Tcwcout=Tcond+(Tcwcin-Tcond)*exp((-UAcond)/(mcwc*Cpw));
dYdt=[Kads*(Weqa-Wads);((Qs*Ms*Aads)+(Ms*Cpv*Aads*(Teva-Tads))+mcwa*Cpw*(Tcwain-Tcwaout))/TLads;
Kdes*(Weqd-Wdes); ((Qs*Ms*Ades)+(mcwa*Cpw*(Thwdin-Thwdout)))/TLdes;
-Ms*((Kads*(Weqa-Wads))+(Kdes*(Weqd-Wdes)));((-Lv*Ms*Aads)+Ades*Ms*Cpw*(Tcond-Teva)+mchw*Cpw*(Tchwin-Tchwout))/TLeva;
(Ades*Ms*Cpv*(Tdes-Tcond)+(Lv*Ms*Ades)+mcwc*Cpw*(Tcwcin-Tcwcout))/TLcond; Tcwaout; Thwdout; Tchwout; Tcwcout];
end
end
Best Answer