# Chapter 6: THE SECOND LAW OF THERMODYNAMICS

## Example 6.01, page: 133

In [1]:
from __future__ import division
import math

# Initialization  of  Variable
W = 410 #kJ
Qin = 1000 #kJ
Th = 500 #K
Tc = 300 #K

#calculations:
#cycle thermal efficiency
n = W/Qin
#maximum thermal efficiency
nmax = 1 - Tc/Th

#Results
print  "cycle thermal efficiency is", n*100,"% and maximum thermal efficiency is",nmax*100,"%"
if (n >nmax):
print "Since the thermal efficiency of the actual cycle exceeds the maximum theoretical value, the claim cannot be valid"
else:
print "Since the thermal efficiency of the actual cycle is less than the maximum theoretical value, the claim is valid"

cycle thermal efficiency is 41.0 % and maximum thermal efficiency is 40.0 %
Since the thermal efficiency of the actual cycle exceeds the maximum theoretical value, the claim cannot be valid


## Example 6.02, page: 134

In [2]:
from __future__ import division
import math

# Initialization  of  Variable
Qcdot = 8000 #kJ/h
Tc = -5 #degC
Th = 22 #degC
Wdotcycle = 3200 #kJ/h

#calculations:
#coefficient of performance of the refrigerator
beta = Qcdot/Wdotcycle
#coefficient of performance of a reversible refrigeration cycle
betamax = (Tc+273)/(Th-Tc)

#Results
print  "coefficient of performance of the refrigerator is", beta
print  "coefficient of performance of a reversible refrigeration cycle", round(betamax,1)

coefficient of performance of the refrigerator is 2.5
coefficient of performance of a reversible refrigeration cycle 9.9


## Example 6.03, page: 135

In [3]:
from __future__ import division
import math

# Initialization  of  Variable
Qh = 6E5 #Btu/day
Th = 70 #degF
Tc = 32 #degF
cost = 8 #cents/kW

#calculations:
#temps in Rankine
Thr = ((Th - 32)*5/9 +273)*1.8
Tcr = ((Tc - 32)*5/9 +273)*1.8
#Work
Wcycle = (1 - Tcr/Thr)*Qh
#costperday
cpd = (Wcycle/3413)*cost/100 #$/day #Results print "minimum theoretical work input is", round(Wcycle,1),"Btu/day" print "minimum theoretical cost per day is", round(cpd,2),"$/day"

minimum theoretical work input is 43067.6 Btu/day
minimum theoretical cost per day is 1.01 \$/day