Borrar filtros
Borrar filtros

Model producing negative values where it shouldn't

2 visualizaciones (últimos 30 días)
Nathaniel Porter
Nathaniel Porter el 3 de Mzo. de 2022
Comentada: Star Strider el 4 de Mzo. de 2022
Under the section current density at electrodes im obtaining a much smaller value and a negative value when using the exp function in MATLAB. However when done by hand and calculated with a calculator using 'e' for the expotent i got the desired value and a positive one. Any way I can receive help here on why I am not getting the required value.
%Variables
gamma_anode = 0.5; %reactant concentration at anode
gamma_cathode = 1; %reactant concentration at cathode
a_anode = 0.54; %transfer coefficient at anode
a_cathode = 0.52; %transfer coeffiecent at cathode
i0_ref_a = 3.5e-3;%reference exchange current density at anode
Glucose_conc = 0.0008;%glucose concnetration
Glucose_ref = 0.0001;%reference glucose concentration
i0_ref_c = 1.9e5;%reference exchange current desnity at cathode
Oxygen_conc = 0.016;%oxygen concentration
Oxygen_ref = 1.95e5;%reference oxygen concentration
Er_a = 0; %reference potential at anode
Ea = -0.853; %potential at anode for glucose oxidation
Er_c = 1.229; %reference potential at cathode
Ec = 0.403; %potential at cathode for oxygen reduction
R = 8.314;%Gas constant
F = 96485;%Faraday constant
T = 300; %Temperature of cell
A = 5; %area of fuel cell
Rin = 2.6; %Internal resistance of the cell
n_anode = 2; %moles per reactant at the anode
n_cathode =4;%moles per reactant at the cathode
D_anode = 6.5e-6; %diffusion coefficient of glucose in KOH
D_cathode = 0.0056;%diffusion coefficient of oxygen in plain medium
d_l_a = 0.035; %diffsuion layer thickness anode
d_l_c= 0.03 ;%diffsuion layer thickness cathode
%--------------------------------------------------------------------------
%EXCHANGE CURRENT DENSITY
%Anode
i0_a = (i0_ref_a) * (Glucose_conc/Glucose_ref)^gamma_anode;%exchage current density at anode
display(i0_a)
%Cathode
i0_c = (i0_ref_c) * (Oxygen_conc/Oxygen_ref)^gamma_cathode;%exchange current density at cathode
display(i0_c)
%--------------------------------------------------------------------------
%CURRENT DENSITY AT ELECTRODES
%Anode
i_a = (-i0_a) * exp(a_anode*F*(Ea-Er_a)/(R*T));%current density at anode
display(i_a)
%Cathode
i_c = (-i0_c) * exp(a_cathode*F*(Ec-Er_c)/(R*T));%current density at cathode
display(i_c)
%--------------------------------------------------------------------------
%Activation Overpotential
%Anode
V_act_a = ((R*T)/(a_anode*F))*log(i_a/i0_a);%activation potential at anode
V_act_anode = abs(V_act_a);
display(V_act_anode)
%Cathode
V_act_c = ((R*T)/(a_cathode*F))*log(i_c/i0_c);%activation potential at cathode
V_act_cathode = abs(V_act_c);
display(V_act_cathode)
%Total activation overpotential
V_act = V_act_cathode + V_act_anode;
display(V_act)
%--------------------------------------------------------------------------
%Ohmic overpotential
j = i_a + i_c ; %current density of anode and cathode
i = j / A; %current density of fuel cell
R = Rin * A; %resisitance of fuel cell
V_ohm = i * R;%ohmic overpotential of cell
display(V_ohm)
%--------------------------------------------------------------------------
%Concentration overpotential
%limiting current at anode
i_L_a = (n_anode*F*D_anode*Glucose_conc)/d_l_a;
%limiting current at cathode
i_L_c = (n_cathode*F*D_cathode*Oxygen_conc)/d_l_c;
%concentration overpotential at anode
V_conc_anode = ((R*T)/(n_anode*F))*log(i_L_a/(i_L_a-i));
%concentration overpotential at cathode
V_conc_cathode = ((R*T)/(n_cathode*F))*log(i_L_c/(i_L_c-i));
%concentration overpotential
V_conc = V_conc_anode + V_conc_anode;
%--------------------------------------------------------------------------
%Cell potential
Et =1.3; %thermodynamic potential of fuel cell
%Fuel cell voltage
V_cell = Et - V_act - V_conc - V_ohm;
%--------------------------------------------------------------------------
%Power of fuel cell
P_cell = V_cell * i;
%--------------------------------------------------------------------------
%Plots

Respuesta aceptada

Star Strider
Star Strider el 3 de Mzo. de 2022
The exp calls are multiplied by ‘-i0_a’ or ‘-i0_c’ in the posted code.
%Anode
i_a = (-i0_a) * exp(a_anode*F*(Ea-Er_a)/(R*T));%current density at anode
display(i_a)
%Cathode
i_c = (-i0_c) * exp(a_cathode*F*(Ec-Er_c)/(R*T));%current density at cathode
display(i_c)
Is that also the situation with the calculator entries?
Those are the only exp calls I see.
  5 comentarios
Nathaniel Porter
Nathaniel Porter el 4 de Mzo. de 2022
Okay thankswill try it
Star Strider
Star Strider el 4 de Mzo. de 2022
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by