% Potentially useful functions for HW Set #6
% you can copy the contents of this file to your main function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function CMrate = Cell_Multiplication(Ncells,Nutrients,P,params)
% computes the Cell Multiplication rate (cells/s) in the CSTR
% inputs:
% Ncells number of cells in the CSTR
% Nutrients concentration of Nutrients in the CSTR (moles/liter)
% P concentration of Product in CSTR, [=] moles/liter
% params values of [k1,k2,k3,c1,c2,d] as listed in problem statement.
k1 = params(1); c1=params(4); d=params(6);
CMrate = k1.*Ncells.*Nutrients./((1+c1.*Nutrients).*(1+d.*P));
return;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function NCrate = Nutrient_Consumption(Ncells,Nutrients,P,params)
% computes the nutrient consumption rate in the CSTR (moles/s)
% inputs:
% Ncells number of cells in the CSTR
% Nutrients concentration of Nutrients in the CSTR (moles/liter)
% P concentration of Product in CSTR, [=] moles/liter
% params values of [k1,k2,k3,c1,c2,d] as listed in problem statement.
k2 = params(2); c2 = params(5);
NCrate = k2*Ncells*(Nutrients - 1e-6) + c2*Cell_Multiplication(Ncells,Nutrients,P,params);
return;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Prate = P_production(Ncells,Nutrients,P,params)
% computes the product production rate in the CSTR (moles/s)
% inputs:
% Ncells number of cells in the CSTR
% Nutrients concentration of Nutrients in the CSTR (moles/liter)
% P concentration of Product in CSTR, [=] moles/liter
% params values of [k1,k2,k3,c1,c2,d] as listed in problem statement.
k3 = params(3); d=params(6); c1=params(4);
Prate = k3.*Ncells.*exp(-d.*P).*((Nutrients-0.01).^2)./(1+c1.*Nutrients);
return;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function params = param_set
% sets params as in the problem statement
% [k1 k2 k3 c1 c2 d]
params = [5e-3 1e-9 1e-8 0.1 1e-7 0.01];
return;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%