Energy balance in battery thermodynamics I am trying to understand the derivation of a general energy balance in battery thermodynamics. The following relation is frequently found to determine the heat generation of a battery:

$\dot{Q} = \dot{Q}_\text{rev} + \dot{Q}_\text{irrev} = IT\,\frac{\mathrm dE_0}{\mathrm dT} + I(E-E_0)$

where $\dot{Q}$ is the heat generation, $I$ current, $T$ temperature and $E$ cell voltage. The index $0$ denotes the open circuit voltage. Furthermore, $\Delta S = zF\,\frac{\mathrm dE_0}{\mathrm dT}$, with $F$ as Faraday constant and $z$ as number of exchanged electrons. 

The derivation is as follows:

First law of thermodynamics: $\mathrm dU = \mathrm dQ - \mathrm dW \tag{1}$ with $\mathrm dW = p\,\mathrm dV + \mathrm dW_\mathrm{el}$

$\mathrm dH = \mathrm dU + p\,\mathrm dV + V\,\mathrm dp \tag{2}$

Substituting (2) in (1):

$\mathrm dH - p\,\mathrm dV -V\,\mathrm dp = \mathrm dQ - p\,\mathrm dV - \mathrm dW_\mathrm{el} \tag{3}$

with $\mathrm dp=0$ follows:

$\mathrm dH = \mathrm dQ -\mathrm dW_\mathrm{el}$, differentiation with respect to time:

$$\frac{\mathrm dH}{\mathrm dt} = \frac{\mathrm dQ}{\mathrm dt} - \frac{\mathrm dW_\mathrm{el}}{\mathrm dt} = \dot{Q} - EI$$

So far, everything is fine. But now:

$$H = G + TS \rightarrow \frac{\mathrm dH}{\mathrm dt} = \frac{\mathrm dG}{\mathrm dt} + T\,\frac{\mathrm dS}{\mathrm dt} + \frac{\mathrm dT}{\mathrm dt}S$$

Here my first problem in understanding arises: In general $\frac{\mathrm dG}{\mathrm dt}$ and $\frac{\mathrm dT}{\mathrm dt}S$ cancels each other, since, $S=-\frac{\mathrm dG}{\mathrm dT}$ and $\frac{\mathrm dG}{\mathrm dt}$ can be expanded with $\mathrm dT$: $\frac{\mathrm dT}{\mathrm dt}S = -\frac{\mathrm dT}{\mathrm dt}\frac{\mathrm dG}{\mathrm dT}$. This means, that the influence of the open circuit voltage in the given energy balance would vanish. 

I assume, that this is prevented by simply stating isothermal conditions: $\frac{\mathrm dT}{\mathrm dt}S = 0$. But this makes no sense to me, since the whole purpose of this calculation is the temperature increase with time during cycling a cell. Can somebody explain this to me?

Now if $\mathrm dT=0$ the derivation would proceed like this:

$$\frac{\mathrm dG}{\mathrm dt} + T\,\frac{\mathrm dS}{\mathrm dt} = \dot{Q} - EI$$

$$\frac{\mathrm d(-znFE_0)}{\mathrm dt} + T\,\frac{\mathrm d\left(znF\,\frac{\mathrm dE_0}{\mathrm dT}\right)}{\mathrm dt} = \dot{Q} - EI$$
where $znF=C$ is the charge and $\frac{\mathrm dC}{\mathrm dt} = I$

And here my second problem arises: to get to the equation at the very beginning of this post, it is necessary to set $E_0$ and $\frac{\mathrm dE_0}{\mathrm dT}$ constant, so that the chain rule does not apply. And I do not understand why this should be valid?

Can anybody help me with this?
The answer to this problem explains how to arrive at 

$$ dQ_p = - dw_{ele} +  dG + TdS $$

This expression is generally true for electrical work at constant T and p. From it the differential equation in the OP can be derived by taking the time derivative on both sides and making appropriate substitutions. 


  $\frac{\mathrm dG}{\mathrm dt}$ can be expanded with dT:  $\frac{\mathrm dT}{\mathrm dt}S = -\frac{\mathrm dT}{\mathrm dt}\frac{\mathrm dG}{\mathrm dT}$


But remember that you defined 

$G=H-TS$

and you should use that when computing $\frac{\mathrm dG}{\mathrm dt}$. But introducing that just results in a circular argument (a lot of terms cancelling to no use). 


  to get to the equation at the very beginning of this post, it is necessary to set $E_0$ and $dE_0/dT$ constant


That's ok. $E_0$ is the voltage when no current is running (that is, battery is not being depleted, as there is no reaction, and therefore composition is constant over time), and is thus constant with respect to time.


  But this makes no sense to me, since the whole purpose of this calculation is the temperature increase with time during cycling a cell. 


That's tricky and I do not have a complete answer. The equation derived is for a specific T. To solve for the time-dependence of the temperature evidently requires additional steps, presumably incorporating expressions for the heat capacity.