MATLAB Answers

This is my code for a PI controller that has an output concentration set to 0.25 that is controlled by Q. How would I change my dydt(3) so that it is a P-only controller?

1 view (last 30 days)
Mackenzy Allen
Mackenzy Allen on 9 Apr 2018
function CH460_HW_7_P
clear;
clc;
t0=0;
tf=750;
I0=[0.3 300 7E5];
soln = ode45(@f,[t0 tf],I0);
t=linspace(0,tf,300);
Ca=deval(soln,t,1);
plot(t,Ca,'-b','LineWidth',1);
xlabel('t');
ylabel('Ca');
grid on;
end
function dydt= f(t,y)
Vr=100; %[L]
F=10; %[g/s]
Ca0=1; %[gmol/L]
rho=1; %[cal/g]
Cp=1000; %[cal/gK]
Qs=7E5; %[cal/s]
dH=160000; %[cal/gmol]
T0=400; %[K]
ER=2E4; %[K]
Cv=Cp; %[cal/gK]
k0=1.97E24; %[1/s]
T=350; %[K]
Casp=0.25; %[gmol/L]
Kp=75500;
tau=0.5;
dydt(1)=(F/rho/Vr)*(Ca0-y(1))-(k0*y(1)*exp(-ER/y(2)));
dydt(2)=((F*Cp)/(Vr*rho*Cv))*(T0-y(2))-((dH*k0*y(1)*exp(-ER/y(2)))/(Cv*rho))+(y(3)/(Vr*rho*Cv));
dydt(3)=Kp*((F/rho/Vr)*(Ca0-y(1))-k0*y(1)*exp(-ER/y(2)))-((Kp/tau)*(Casp-y(1)));
dydt=dydt';
end
%

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!