Using the relation between [[Heat|heat]] and [[Entropy|entropy]] we can determine the [[Work|work]] for an [[Reversibility|irreversible]] [[Cycle|cycle]].
$s_e−s_i=\int_i^e\dfrac{\partial q}{T}+s_{gen}$
$ds=\dfrac{\partial q}{T}+\partial s_{gen}$
Solving for heat as follows:
$\partial q=Tds−T\partial s_{gen}$
$q=\int_i^eTds−\int_i^eT\partial s_{gen}$
Using the Gibbs equation for the first term:
$q=\int_i^edh−\int_i^e\nu dP−\int_i^eT\partial s_{gen}$
Finally, application of the [[First Law of Thermodynamics|first law]] will result in:
$q−w=h_e−h_i+\dfrac{1}{2}(v_e^2−v_i^2)+g(z_e−z_i)$
$h_e−h_i−\int_i^e\nu dP−\int_i^eT\partial s_{gen}−w=he−hi+\dfrac{1}{2}(v_e^2−v_i^2)+g(z_e−z_i)$
$w=\dfrac{1}{2}(v_i^2−v_e^2)+g(z_i−z_e)−\int_i^e\nu dP−\int_i^eT\partial s_{gen}$
Entropy generation, $\int_i^eT\partial s_{gen}$, is unique to irreversible processes. Therefore, the resultant work for an ideal, reversible process is:
$w=\dfrac{1}{2}(v_i^2−v_e^2)+g(z_i−z_e)−\int_i^e\nu dP$