我有使用ODE45的问题。我在下面给出了matlab代码。我无法启动解算器。可能是语法错误。如果你能找到问题,我会很高兴。
它是填充床反应器的建模和模拟。然而;在开始真实模拟之前我得到了错误:)
clear all % Clear workspace and variables %
close all % Close all figures %
clc % Clear command window for fresh start %
temp_array=[500;550;600;650;700;750;800;850];
pressure=1;
reactor_h=60;
reactor_d=10;
bed_dens=1500;
P_EtOH_0=0.5;
P_CO2_0=0.5;
space_t=24.89;
reactor_volume = pi * ((reactor_d/2)^2) * reactor_h; % Reactor volume in mm3 %
reactor_volume_m3 = reactor_volume * 10^(-9); % Reactor volume in m3 %
m_cat=reactor_volume_m3*bed_dens;
m_cat=0.002; %kg
F_EtOH_0=m_cat/space_t; %kmol/h
F_CO2_0=F_EtOH_0*P_CO2_0/P_EtOH_0; % kmol/h
for i=1:1
temp=temp_array(i);
[V,X]=ode45(@(V,X)RateFuncTempEffect(V,X,temp,F_EtOH_0,F_CO2_0,pressure,m_cat,reactor_volume_m3), [0 reactor_volume_m3], 0);
end
function fnc = RateFuncTempEffect(V,X,temp,F_EtOH_0,F_CO2_0,pressure,m_cat,reactor_volume_m3)
freq_factor = 6.78*10^5; % kmol/kg cat h (atm)^4.91 %
activ_energy = 97.87; % kJ/mol %
R_kJ = 8.3144598; % kJ/mol K %
F_EtOH = (1-X)*F_EtOH_0;
EtOH_reacted = F_EtOH_0 - F_EtOH;
F_CO2 = F_CO2_0 - EtOH_reacted;
F_CO = 3*EtOH_reacted;
F_H2 = 3*EtOH_reacted;
F_total = F_EtOH + F_CO2 + F_CO + F_H2;
frac_EtOH = F_EtOH/F_total;
frac_CO2 = F_CO2/F_total;
%frac_CO = F_CO/F_total;
%frac_H2 = F_H2/F_total;
P_EtOH = frac_EtOH * pressure;
P_CO2 = frac_CO2 * pressure;
k = freq_factor*exp(activ_energy/(R_kJ*temp)); % Rate constant %
rA = -k * (P_EtOH)^0.96 * (P_CO2)^3.95; % Rate expression %
cat_dens=m_cat/reactor_volume_m3;
fnc = (-rA/flow_EtOH0)/cat_dens;
end