<jupyter_start><jupyter_text>Please cite us if you use the software   Padulles-Hauer Dynamic Model  Version 1.3     Overview    Nernst Voltage            FC Voltage        Power of PEMFC    Efficiency of PEMFC    Linear Approximation    Overall Parameters    Full Run    Plot    Parameters    Reference     Overview The Padulles dynamic model can predict the transient response of cell voltage, temperature of the cell, hydrogen/oxygen out flow rates and cathode and anode channel temperatures/pressures under sudden change in load current. Hence, a dynamic fuel cell simulation is developed in this model, which incorporates the dynamics of flow and pressure in the anode and cathode channels and mass/ heat transfer transient features in the fuel cell body.This model is based on several assumptions:     The stack is fed with hydrogen and air   Cell temperature is stable at all times   The ratio of pressures between the interior and exterior of the electrode channels is large  The channels that transport gases along the electrodes have a fixed volume     Only source of voltage loss is ohmic polarization     Nernst equation can be applied too  Padulles-Hauer Dynamic Model is a dynamic electrochemical simulation model of a grid independent proton exchange membrane (PEM) fuel cell. This model includes a methanol reformer to generate hydrogen from methanol and the PEM stack. The model is used to predict the output voltage and power of a PEMFC. It has to be noted that the reformer model is a second order transfer function.        Fig1. Padulles-Hauer Dynamic Model Block Diagram       Nernst Voltage $$E_{Nernst}=N_0\times [E_0+\frac{RT}{2F}ln(\frac{P_{H_2}\times \sqrt{P_{O_2}}}{P_{H_2O}})]$$ $$P_{H_2}=\frac{\frac{1}{K_{H_2}}}{1+\tau_{H_2}^{(s)}}[(q_{H_2}^{(inlet)}-(2\times K_r \times i)]$$ $$\frac{q_{H_2}^{(inlet)}}{q_{methanol}}=\frac{CV}{\tau_{1}^{(s)}+(\tau_{2}^{(s)})^2+(\tau_{1}+\tau_{2})^{(s)}+1}$$ $$P_{O_2}=\frac{\frac{1}{K_{O_2}}}{1+\tau_{O_2}^{(s)}}[(q_{O_2}^{(inlet)}-(K_r \times i)]$$ $$P_{H_2O}=\frac{\frac{1}{K_{H_2O}}}{1+\tau_{H_2O}^{(s)}}[(q_{H_2O}^{(inlet)}-(2\times K_r \times i)]$$ $$K_r=\frac{N_0}{4F}$$ $$q_{O_2}^{(inlet)}=\frac{q_{H_2}^{(inlet)}}{r_{h-o}}$$ $$q_{H_2O}^{(inlet)}=q_{H_2}^{(inlet)}$$<jupyter_code>from opem.Dynamic.Padulles_Hauer import qH2_Calc,Kr_Calc,qO2_Calc,PH2_Calc,PO2_Calc,PH2O_Calc,Enernst_Calc
qH2=qH2_Calc(qMethanol=0.0002,CV=2,t1=2,t2=2)
qH2
Kr=Kr_Calc(N0=5)
Kr
qO2=qO2_Calc(qH2=qH2,rho=1.168)
qO2
PH2=PH2_Calc(KH2=0.0000422,tH2=3.37,Kr=Kr,I=1,qH2=qH2)
PH2
PO2=PO2_Calc(KO2=0.0000211,tO2=6.74,Kr=Kr,I=1,qO2=qO2)
PO2
PH2O=PH2O_Calc(KH2O=0.000007716,tH2O=18.418,Kr=Kr,I=1,qH2O=qH2)
PH2O
Enernst=Enernst_Calc(E0=0.6,N0=5,T=343, PH2=PH2, PO2=PO2,PH2O=PH2O)
Enernst<jupyter_output><empty_output><jupyter_text>FC Voltage $$V_{Fuelcell}=E_{Nernst}-Bln(Ci)-(R^{int}\times i)$$<jupyter_code>from opem.Dynamic.Padulles_Hauer import Vcell_Calc
FC_Voltage=Vcell_Calc(Enernst=Enernst, B=0.04777,C=0.0136,I=1,Rint=0.00303)
FC_Voltage<jupyter_output><empty_output><jupyter_text>Power of PEMFC $$P=V_{cell}\times i$$ $$P_{Thermal}=i\times(N \times E_{th}-V_{Stack})$$ $$E_{th}=\frac{-\Delta H}{nF}=1.23V$$<jupyter_code>from opem.Dynamic.Padulles_Hauer import Power_Calc,Power_Thermal_Calc
Power=Power_Calc(Vcell=FC_Voltage,i=2)
Power
Power_Thermal_Calc(VStack=FC_Voltage,N=5,i=2)<jupyter_output><empty_output><jupyter_text>Efficiency of PEMFC $$\eta=\frac{\mu_F\times V_{Fuelcell}}{N_0\times HHV}$$<jupyter_code>from opem.Dynamic.Padulles_Hauer import Efficiency_Calc
Efficiency_Calc(Vcell=FC_Voltage,N=5)<jupyter_output><empty_output><jupyter_text>Linear Approximation Sometimes quick calculations regarding fuel cell efficiency–power-size relationships need to be made. Linear approximation is a good method to find a rough estimate of the value of polarization function at a particular point. A linear polarization curve has the following form:$$V_{cell}=V_0-kI$$where V0 is the intercept (actual open circuit voltage is always higher) and k is the slope of the curve.* Notice : Simple linear regression used for this approximation             $$Parameter$$        $$Description$$        $$Unit$$                 $$V_0$$        Intercept of the curve obtained by linear approximation        $$V$$                $$k$$        Slope of the curve obtained by linear approximation        $$A^{-1}$$                $$P_{max}$$        Maximum power obtained by linear approximation        $$W$$                $$V_{FC}|P_{max}$$        Cell voltage at maximum power obtained by linear approximation        $$V$$                         * Notice : These parameters are only available in HTML report  Overall Parameters             $$Parameter$$        $$Description$$        $$Unit$$                 $$\eta|P_{Max}$$        Cell efficiency at maximum power        $$--$$                $$P_{Max}$$        Maximum power         $$W$$                $$P_{Elec} $$        Total electrical power         $$W$$                $$P_{Thermal} $$        Total thermal power           $$W$$                $$V_{FC}|P_{Max}$$        Cell voltage at maximum power         $$V$$                         * Notice : P(Thermal) & P(Elec) calculated by Simpson's Rule* Notice : These parameters are only available in HTML report  Full Run * Run from `i`=0.1 to `i`=100 with `step`=0.1<jupyter_code>Test_Vector = {
    "T": 343,
    "E0": 0.6,
    "N0": 5,
    "KO2": 0.0000211,
    "KH2": 0.0000422,
    "KH2O": 0.000007716,
    "tH2": 3.37,
    "tO2": 6.74,
    "t1": 2,
    "t2": 2,
    "tH2O": 18.418,
    "B": 0.04777,
    "C": 0.0136,
    "Rint": 0.00303,
    "rho": 1.168,
    "qMethanol": 0.0002,
    "CV": 2,
    "i-start": 0.1,
    "i-stop": 100,
    "i-step": 0.1,
    "Name": "Padulles_Hauer_Test"}<jupyter_output><empty_output><jupyter_text>* Notice : "Name", new in version 0.5<jupyter_code>from opem.Dynamic.Padulles_Hauer import Dynamic_Analysis
data=Dynamic_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=True)<jupyter_output>###########
Padulles-Hauer-Model Simulation
###########
Analyzing . . .
I : 0.1
E : 2.9234154992732004 V
FC Efficiency : 0.41518043908246366 
FC Power : 0.3238407424843217 W
FC Voltage : 3.2384074248432166 V
PH2 : 0.19717074233280188 atm
PH2O : 0.2426831613626925 atm
PO2 : 0.1906263686382979 atm
Power-Thermal : 0.2911592575156784 W
###########
I : 0.2
E : 2.9234139617015558 V
FC Efficiency : 0.4108963136482338 
FC Power : 0.6409982492912448 W
FC Voltage : 3.204991246456224 V
PH2 : 0.1971566919511875 atm
PH2O : 0.24266586776736396 atm
PO2 : 0.1906184358000996 atm
Power-Thermal : 0.5890017507087553 W
###########
I : 0.3
E : 2.9234124240659227 V
FC Efficiency : 0.4083740564879825 
FC Power : 0.955595292181879 W
FC Voltage : 3.1853176406062635 V
PH2 : 0.19714264156957312 atm
PH2O : 0.24264857417203542 atm
PO2 : 0.1906105029619013 atm
Power-Thermal : 0.889404707818121 W
###########
I : 0.4
E : 2.9234108863662946 V
FC Efficiency : 0.4065731449109761 
FC Power : 1.2685082121222457 W
FC Voltag[...]<jupyter_text>* Notice : "Status", "V0", "K" and "EFF" , new in version 0.8<jupyter_code>data_2=Dynamic_Analysis(InputMethod=Test_Vector,TestMode=True,PrintMode=True,ReportMode=False)<jupyter_output>###########
Padulles-Hauer-Model Simulation
###########
Analyzing . . .
Done!<jupyter_text>* Notice : "PrintMode" & "ReportMode" , new in version 0.5<jupyter_code>Dynamic_Analysis(InputMethod={},TestMode=True,PrintMode=False,ReportMode=True)<jupyter_output><empty_output><jupyter_text>* Notice: 1. `TestMode` : Active test mode and get/return data as `dict`, (Default : `False`)2. `ReportMode` : Generate reports(`.csv`,`.opem`,`.html`) and print result in console, (Default : `True`)3. `PrintMode` : Control printing in console, (Default : `True`)  Plot<jupyter_code>import sys
!{sys.executable} -m pip -q -q install matplotlib;
import matplotlib.pyplot as plt
def plot_func(x,y,x_label,y_label,color='green',legend=[],multi=False):
    plt.figure()
    plt.grid()
    if multi==True:
        for index,y_item in enumerate(y):
            plt.plot(x,y_item,color=color[index])
    else:
        plt.plot(x,y,color=color)
    plt.xlabel(x_label)
    plt.ylabel(y_label)
    if len(legend)!=0:
        plt.legend(legend)
    plt.show()

plot_func(data["I"],data["P"],"I(A)","Power(W)")
plot_func(data["I"],[data["V"],data["VE"]],"I(A)","V(V)",["red","blue"],legend=["Voltage-Stack","Linear-Apx"],multi=True)
plot_func(data["I"],data["Ph"],"I(A)","Power-Thermal(W)","blue")
plot_func(data["I"],data["EFF"],"I(A)","Efficiency","gray")
plot_func(data["I"],data["PO2"],"I(A)","PO2(atm)","orange")
plot_func(data["I"],data["PH2"],"I(A)","PH2(atm)","violet")
plot_func(data["I"],data["PH2O"],"I(A)","PH2O(atm)","pink")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15648592999313657, 'fraction_numerical': 0.08785175017158545, 'mean_word_length': 4.502202643171806, 'pattern_counts': {'":': 21, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '438284', 'license': 'MIT', 'n_tokens_mistral': 3714, 'n_tokens_neox': 3226, 'n_words': 725, 'path': 'Documents/Padulles_Hauer.ipynb', 'repo_name': 'Martenet/opem', 'size': '8742'}