Clear Filters
Clear Filters

How can i get the optimum point from this curve ?

3 views (last 30 days)
Vrev = 1.229;
A = 0.25;
n = 1;
s = 0.185;
t1 = 1.002;
t2 = 8.424;
t3 = 247.3;
r1 = 8.05e-5;
r2 = -2.5e-7;
T = [40, 60, 80].';
Iplot = linspace(0,350,100);
nc=1;
Z=2;
F=96485;
f1=[150 200 250].';
f2=[0.99 0.985 0.98].';
I = (((r1 + r2 * T) ./ A) .* Iplot.* A) ./ ((r1 + r2 .* T));
Vact = s * log10(((((t1 + (t2 ./ T)) + (t3 ./ T.^2)) ./ A) .* I) + 1);
Vohm = ((r1 + r2 * T) ./ A) .* I;
Y = Vrev + s * log10((((t1 + (t2 ./ T) + (t3 ./ T.^2)) ./ A) .* I) + 1) + ((r1 + r2 * T) ./ A) .* I;
EF=(((I./A).^2).*f2)./(f1+(I./A).^2);
ndotH=EF.*((nc.*I)/(Z*F));
Q=ndotH*3600*0.022414;
tiledlayout("flow")
nexttile
plot(Iplot,Y)
title('Current denisty vs Voltage cell')
legend('T=40','T=60','T=80');
xlabel("Current Density ,mA/cm^2");
ylabel("cell Voltage ,voltage");
grid on;
nexttile
plot(Iplot,Vohm)
legend('T=40','T=60','T=80');
title ('Current denisty vs Ohmic voltage')
xlabel("Current Density ,mA/cm^2");
ylabel("ohmic voltage ,(Vohmic)");
grid on;
nexttile
plot(Iplot,Vact)
title('Current denisty vs Actual Voltage')
legend('T=40','T=60','T=80');
xlabel("Current Density ,mA/cm^2");
ylabel("Activation voltage ,Vact");
grid on;
nexttile
plot(Iplot,EF)
title ('Current denisty vs Faraday efficiency')
legend('T=40','T=60','T=80');
xlabel("Current Density ,mA/cm^2");
ylabel("Faraday efficiency");
grid on;
nexttile
plot(Iplot,Q)
title ('current denisty vs H2 flowrate')
legend('T=40','T=60','T=80');
xlabel("Current Density ,mA/cm^2");
ylabel("flow rate ,m^3/sec");
grid on;
How can i get the optimum point from this curve and the otimum temp operated on it ?

Accepted Answer

Hassaan
Hassaan on 25 Jan 2024
I assumed you want to optimize for a balance between high hydrogen flow rate and high Faraday efficiency while maintaining a reasonable cell voltage.
% your parameters and equations as you have already done.
Vrev = 1.229;
A = 0.25;
s = 0.185;
t1 = 1.002;
t2 = 8.424;
t3 = 247.3;
r1 = 8.05e-5;
r2 = -2.5e-7;
T = [40, 60, 80].'; % Temperatures
Iplot = linspace(0, 350, 100); % Current Density
f1 = [150 200 250].';
f2 = [0.99 0.985 0.98].';
nc = 1;
Z = 2;
F = 96485;
% Calculate parameters for each temperature
optimalPoints = zeros(length(T), 3); % To store optimum points for each temperature
for i = 1:length(T)
I = (((r1 + r2 * T(i)) / A) * Iplot * A) / ((r1 + r2 * T(i)));
Vact = s * log10(((((t1 + (t2 / T(i))) + (t3 / T(i).^2)) / A) * I) + 1);
Vohm = ((r1 + r2 * T(i)) / A) * I;
Y = Vrev + Vact + Vohm;
EF = (((I/A).^2) * f2(i)) / (f1(i) + (I/A).^2);
ndotH = EF * ((nc * I) / (Z * F));
Q = ndotH * 3600 * 0.022414;
% Define optimization criteria (example: maximize Q and EF, minimize Y)
% You can adjust these criteria based on your specific needs
score = Q .* EF ./ Y; % Example scoring function
[maxScore, idx] = max(score); % Find index of maximum score
% Store the optimum point for each temperature
optimalPoints(i, :) = [Iplot(idx), Q(idx), T(i)];
end
% Display the optimal points
optimalPoints
optimalPoints = 3×3
350.0000 0.1449 40.0000 350.0000 0.1441 60.0000 350.0000 0.1434 80.0000
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  2 Comments
Muhamed
Muhamed on 25 Jan 2024
thanks bro but how can i identify this point on the curve ? i want to know how to identify this point on the curve

Sign in to comment.

More Answers (1)

Hassaan
Hassaan on 25 Jan 2024
% your parameters and equations as you have already done.
Vrev = 1.229;
A = 0.25;
s = 0.185;
t1 = 1.002;
t2 = 8.424;
t3 = 247.3;
r1 = 8.05e-5;
r2 = -2.5e-7;
T = [40, 60, 80].'; % Temperatures
Iplot = linspace(0, 350, 100); % Current Density
f1 = [150 200 250].';
f2 = [0.99 0.985 0.98].';
nc = 1;
Z = 2;
F = 96485;
% Calculate parameters for each temperature
optimalPoints = zeros(length(T), 3); % To store optimum points for each temperature
for i = 1:length(T)
I = (((r1 + r2 * T(i)) / A) * Iplot * A) / ((r1 + r2 * T(i)));
Vact = s * log10(((((t1 + (t2 / T(i))) + (t3 / T(i).^2)) / A) * I) + 1);
Vohm = ((r1 + r2 * T(i)) / A) * I;
Y = Vrev + Vact + Vohm;
EF = (((I/A).^2) * f2(i)) / (f1(i) + (I/A).^2);
ndotH = EF * ((nc * I) / (Z * F));
Q = ndotH * 3600 * 0.022414;
% Define optimization criteria (example: maximize Q and EF, minimize Y)
% You can adjust these criteria based on your specific needs
score = Q .* EF ./ Y; % Example scoring function
[maxScore, idx] = max(score); % Find index of maximum score
% Store the optimum point for each temperature
optimalPoints(i, :) = [Iplot(idx), Q(idx), T(i)];
end
% Display the optimal points
optimalPoints
optimalPoints = 3×3
350.0000 0.1449 40.0000 350.0000 0.1441 60.0000 350.0000 0.1434 80.0000
% Now plot the curves and highlight the optimal points
figure; % Create a new figure
% Plotting Current Density vs. Total Cell Voltage (Y)
subplot(2,2,1);
hold on;
for i = 1:length(T)
Y = Vrev + s * log10((((t1 + (t2 ./ T(i)) + (t3 ./ T(i).^2)) ./ A) .* Iplot) + 1) + ((r1 + r2 * T(i)) ./ A) .* Iplot;
plot(Iplot, Y);
% Marking the optimal point
plot(optimalPoints(i, 1), Vrev + s * log10((((t1 + (t2 / T(i)) + (t3 / T(i).^2)) / A) * optimalPoints(i, 1)) + 1) + ((r1 + r2 * T(i)) / A) * optimalPoints(i, 1), 'o');
end
hold off;
title('Current Density vs Total Cell Voltage');
xlabel('Current Density (mA/cm^2)');
ylabel('Total Cell Voltage (V)');
legend('T=40','T=60','T=80','Optimal Points');
grid on;
% Similarly, you can plot for other parameters like Vohm, Vact, EF, and Q
% Just remember to use the subplot and plot commands to create each plot and mark the optimal points
% Example for plotting Current Density vs Hydrogen Flow Rate (Q)
subplot(2,2,2);
hold on;
for i = 1:length(T)
EF = (((Iplot/A).^2) * f2(i)) / (f1(i) + (Iplot/A).^2);
ndotH = EF * ((nc * Iplot) / (Z * F));
Q = ndotH * 3600 * 0.022414;
plot(Iplot, Q);
% Marking the optimal point for Q
plot(optimalPoints(i, 1), optimalPoints(i, 2), 'o');
end
hold off;
title('Current Density vs Hydrogen Flow Rate');
xlabel('Current Density (mA/cm^2)');
ylabel('Hydrogen Flow Rate (m^3/sec)');
legend('T=40','T=60','T=80','Optimal Points');
grid on;
% Continue for other plots as needed...
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  1 Comment
Muhamed
Muhamed on 25 Jan 2024
thanks very much bro but can you help me to get the point in which the st line turns into curve on the curve

Sign in to comment.

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!