Skip to content

Instantly share code, notes, and snippets.

@n7275
Last active March 10, 2021 05:28
Show Gist options
  • Save n7275/e96e85617a50cdb77163807be6c758f5 to your computer and use it in GitHub Desktop.
Save n7275/e96e85617a50cdb77163807be6c758f5 to your computer and use it in GitHub Desktop.
Model of Apollo Fuel Cell Performance as a function of Current and Temperature
clear;
clc;
close all;
V = zeros(100);
P = zeros(100);
ST = zeros(100);
H = zeros(100);
Hnet = zeros(100);
H2RATIO = 0.1119;
O2RATIO = 0.8881;
MMASSH2 = 2.01588;
FaradaysConstant = 96485.3321233100184;
T = linspace(422,533,100);
I = linspace(0,110,100);
H2FLOW = (I * MMASSH2 / (2*FaradaysConstant)) * 31;
O2FLOW = H2FLOW/H2RATIO * O2RATIO;
##H2SPECIFICC = 9.668;
##O22SPECIFICC = 1.669;
H2SPECIFICC = 14.50;
O2SPECIFICC = 0.956;
H2TEMP = 15.8;
O2TEMP = 129;
H2COOLPOW = zeros(100);
O2COOLPOW = zeros(100);
COOLPOW = zeros(100);
for ii = 1:100
for jj = 1:100
Ii = I(jj);
Ti = T(ii);
H2FLOWi = H2FLOW(jj);
O2FLOWi = O2FLOW(jj);
A = 0.023951368224792 * Ti + 23.9241562583015;
B = 0.003480859912024 * Ti - 2.19986938582928;
C = -0.0001779207513 * Ti + 0.104916556604259;
D = 5.0656524872309E-06 * Ti - 0.002885372247954;
E = -6.42229870072935E-08 * Ti + 3.58599071612147E-05;
F = 3.02098031429142E-10 * Ti - 1.66275376548748E-07;
V(ii,jj) = A + B*Ii + C*Ii^2 + D*Ii^3 + E*Ii^4 + F*Ii^5;
if V(ii,jj) < 0
V(ii,jj) = 0.0;
endif
P(ii,jj) = V(ii,jj)*Ii;
ST(ii,jj) = -0.0000045559012144530875*P(ii,jj)^2+0.03002257783131527*P(ii,jj)+465.52543389089476;
H(ii,jj) = P(ii,jj) / (0.9043642805859956 +...
-0.00040191337758397755 * P(ii,jj) +...
0.0000003368939782880486 * P(ii,jj)^2 +...
-1.5580350625528442E-10 * P(ii,jj)^3 +...
3.2902028095999155E-14 * P(ii,jj)^4 +...
-2.581100488488906E-18 * P(ii,jj)^5)-P(ii,jj);
H2COOLPOW(ii,jj) = H2FLOWi*H2SPECIFICC*(H2TEMP-Ti);
O2COOLPOW(ii,jj) = O2FLOWi*O2SPECIFICC*(O2TEMP-Ti);
COOLPOW(ii,jj) = H2COOLPOW(ii,jj)+O2COOLPOW(ii,jj);
endfor
endfor
[II,TT] = meshgrid(I,T);
[C,h] = contourf(II,TT,V,linspace(0,35,36));
grid on;
title('Model of Apollo Fuel Cell Performance')
xlabel('Current [Amperes]')
ylabel('Temperature [K]')
clabel(C,h);
colormap(jet)
cbar = colorbar;
figure(2)
[C1,h1] = contourf(II,TT,P,linspace(0,3000,16));
grid on;
title('Model of Apollo Fuel Cell Heat Output')
xlabel('Current [Amperes]')
ylabel('Temperature [K]')
clabel(C1,h1);
colormap(jet)
cbar = colorbar;
figure(3)
[C2,h2] = contourf(II,TT,H+flip(COOLPOW'),linspace(-1000,2000,31));
grid on;
title('Model of Apollo Fuel Cell Net Heat Output')
xlabel('Current [Amperes]')
ylabel('Temperature [K]')
clabel(C2,h2);
colormap(jet)
cbar = colorbar;
figure(4)
[C3,h3] = contourf(II,V,ST);
grid on;
title('Model of Apollo Fuel Cell Steady State Temperature')
xlabel('Current [Amperes]')
ylabel('Terminal Potential [V]')
clabel(C3,h3);
colormap(jet)
cbar = colorbar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment