In [1]:

```
# Given:-
v = 2450.00 # volume of gaseous products in cm^3
P = 7.00 # pressure of gaseous product in bar
T = 867.00 # temperature of gaseous product in degree celcius
T0 = 300.00 # in kelvin
P0 = 1.013 # in bar
# From table A-22
u = 880.35 # in kj/kg
u0 = 214.07 # in kj/kg
s0T = 3.11883 # in kj/kg.k
s0T0 = 1.70203 # in kj/kg.k
# Calculations
import math
e = (u-u0) + (P0*(8.314/28.97)*(((T+273)/P)-(T0/P0))) - T0*(s0T-s0T0-(8.314/28.97)*math.log(P/P0)) # kj/kg
# Results
print '-> The specific exergy of the gas is ',round(e,3),'kJ/kg.'
```

In [2]:

```
# Given:-
mR = 1.11 # mass of the refrigerant in kg
T1 = -28.00 # initial temperature of the saturated vapor in degree celcius
P2 = 1.4 # final pressure of the refrigerant in bar
T0 = 293.00 # in kelvin
P0 = 1.00 # in bar
# Part (a)
# From table A-10
u1 = 211.29 # in kj/kg
v1 = 0.2052 # in m^3/kg
s1 = 0.9411 # in kj/kg.k
# From table A-12
u0 = 246.67 # in kj/kg
v0 = 0.23349 # in m^3/kg
s0 = 1.0829 # in kj/kg.k
# From table A-12
u2 = 300.16 # in kj/kg
s2 = 1.2369 # in kj/kg.k
v2 = v1
# Calculations
E1 = mR*((u1-u0) + P0*(10**5)*(v1-v0)*(10**(-3))-T0*(s1-s0))
E2 = mR*((u2-u0) + P0*(10**5)*(v2-v0)*(10**(-3))-T0*(s2-s0))
# Results for Part A
print '-> Part(a) The initial exergy is ',round(E1,2),'kJ.'
print '-> The final exergy is ',round(E2,2),'kJ.'
print '-> The change in exergy of the refrigerant is ',round(E2-E1,2),'kJ.'
# Part (b)
# Calculations
deltaU = mR*(u2-u1)
# From energy balance
deltaPE = -deltaU
# With the assumption::The only significant changes of state are experienced by the refrigerant and the suspended mass. For the refrigerant,
# there is no change in kinetic or potential energy. For the suspended mass, there is no change in kinetic or internal energy. Elevation is
# the only intensive property of the suspended mass that changes
deltaE = deltaPE
# Results for part b
print '-> Part(b)The change in exergy of the suspended mass is ',round(deltaE,3),'kJ.'
# Part(c)
# Calculations
deltaEiso = (E2-E1) + deltaE
# Results
print '-> Part(c)The change in exergy of an isolated system of the vessel and pulley–mass assembly is ',round(deltaEiso,2),'kJ.'
```

In [3]:

```
# Given :-
T = 373.15 # initial temperature of saturated liquid in kelvin
T0 = 293.15 # in kelvin
P0 = 1.014 # in bar
# Part(a)
# From table A-2
ug = 2506.5 # in kj/kg
uf = 418.94 # in kj/kg
vg = 1.673 # in m^3/kg
vf = 1.0435*(10**(-3)) # in m^3/kg
sg = 7.3549 # in kj/kg.k
sf = 1.3069 # in kj/kg.k
# Calculations
# Energy transfer accompanying work
etaw = 0 # since p = p0
# Exergy transfer accompanying heat
Q = 2257 # in kj/kg,obtained from example 6.1
etah = (1-(T0/T))*Q
# Exergy destruction
ed = 0 # since the process is accomplished without any irreversibilities
deltae = ug-uf + P0*(10**5)*(vg-vf)/(10**3)-T0*(sg-sf)
# Results
print '-> Part(a)the change in exergy is',round(deltae,2),'kJ/kg.'
print '-> The exergy transfer accompanying work is',round(etaw,2),'kJ/kg.'
print '-> The exergy transfer accompanying heat is',round(etah,2),'kJ/kg.'
print '-> The exergy destruction is',round(ed,2),'kJ/kg.'
# Part(b)
Deltae = deltae # since the end states are same
Etah = 0 # since process is adiabatic
# Exergy transfer along work
W = -2087.56 # in kj/kg from example 6.2
Etaw = W- P0*(10**5)*(vg-vf)/(10**3)
# Exergy destruction
Ed = -(Deltae+Etaw)
# Results
print '-> Part(b)the change in exergy is ',round(Deltae,2),'kJ/kg.'
print '-> The exergy transfer accompanying work is',round(Etaw,2),'kJ/kg.'
print '-> The exergy transfer accompanying heat is',round(Etah,2),'kJ/kg.'
print '-> The exergy destruction is',round(Ed,2),'kJ/kg.'
```

In [4]:

```
# Given:-
T0 = 293.00 # in kelvin
Qdot = -1.2 # in KW, from example 6.4a
Tb = 300.00 # temperature at the outer surface of the gearbox in kelvin from example 6.4a
sigmadot = 0.004 # rate of entropy production in KW/k from example 6.4a
# Calculations
R = -(1-T0/Tb)*Qdot # time rate of exergy transfer accompanying heat
Eddot = T0*sigmadot # rate of exergy destruction
# Results
print '-> Balance sheet'
print '* Rate of exergy in high speed shaft 60Kw'
print '-> Disposition of the exergy: Rate of exergy out low-speed shaft 58.8Kw'
print '-> Heat transfer is',round(R,3),'kw.'
print '-> Rate of exergy destruction is',round(Eddot,3),'kw.'
```

In [5]:

```
# Given:-
p1 = 3.0 # entry pressure in Mpa
p2 = 0.5 # exit pressure in Mpa
T1 = 320.0 # entry temperature in degree celcius
T0 = 25.0 # in degree celcius
p0 = 1.0 # in atm
# From table A-4
h1 = 3043.4 # in kj/kg
s1 = 6.6245 # in kj/kg.k
h2 = h1 # from reduction of the steady-state mass and energy rate balances
s2 = 7.4223 # Interpolating at a pressure of 0.5 MPa with h2 = h1, units in kj/kg.k
# From table A-2
h0 = 104.89 # in kj/kg
s0 = 0.3674 # in kj/kg.k
# Calculations
ef1 = h1-h0-(T0+273)*(s1-s0) # flow exergy at the inlet
ef2 = h2-h0-(T0+273)*(s2-s0) # flow exergy at the exit
# From the steady-state form of the exergy rate balance
Ed = ef1-ef2 # the exergy destruction per unit of mass flowing is
# Results
print '-> The specific flow exergy at the inlet is ',round(ef1,2),'kJ/kg.'
print '-> The specific flow exergy at the exit is',round(ef2,2),'kJ/kg.'
print '-> The exergy destruction per unit of mass flowing is',round(Ed,2),'kJ/kg.'
```

In [6]:

```
# Given:-
T1 = 610.0 # temperature of the air entering heat exchanger in kelvin
p1 = 10.0 # pressure of the air entering heat exchanger in bar
T2 = 860.0 # temperature of the air exiting the heat exchanger in kelvin
p2 = 9.70 # pressure of the air exiting the heat exchanger in bar
T3 = 1020.0 # temperature of entering hot combustion gas in kelvin
p3 = 1.10 # pressure of entering hot combustion gas in bar
p4 = 1.0 # pressure of exiting hot combustion gas in bar
mdot = 90.0 # mass flow rate in kg/s
T0 = 300.0 # in kelvin
p0 = 1.0 # in bar
# Part (a)
# From table A-22
h1 = 617.53 # in kj/kg
h2 = 888.27 # in kj/kg
h3 = 1068.89 # in kj/kg
# Calculations
"""From reduction of mass and energy rate balances for the control volume at
steady state """
h4 = h3+h1-h2
# Using interpolation in table A-22 gives
T4 = 778 # in kelvin
# Results
print '-> The exit temperature of the combustion gas is',T4,'kelvin.'
# Part(b)
# From table A-22
s2 = 2.79783 # in kj/kg.k
s1 = 2.42644 # in kj/kg.k
s4 = 2.68769 # in kj/kg.k
s3 = 2.99034 # in kj/kg.k
# Calculations for part b
import math
deltaR = (mdot*((h2-h1)-T0*(s2-s1-(8.314/28.97)*math.log(p2/p1))))/1000
deltRc = mdot*((h4-h3)-T0*(s4-s3-(8.314/28.97)*math.log(p4/p3)))/1000
# Results for part b
print '-> The net change in the flow exergy rate from inlet to exit of compressed gas is',round(deltaR,3),'MW.'
print '-> The net change in the flow exergy rate from inlet to exit of hot combustion gas is',round(deltRc,3),'MW.'
# Part(c)
#From an exergy rate balance
Eddot = -deltaR-deltRc
# Results
print '-> The rate exergy destroyed, is',round(Eddot,3),'MW.'
```

In [7]:

```
# Given:-
p1 = 30.0 # pressure of entering steam in bar
t1 = 400.0 # temperature of entering steam in degree celcius
v1 = 160.0 # velocity of entering steam in m/s
t2 = 100.0 # temperature of exiting saturated vapor in degree celcius
v2 = 100.0 # velocity of exiting saturated vapor in m/s
W = 540.0 # rate of work developed in kj per kg of steam
Tb = 350.0 # the temperature on the boundary where heat transfer occurs in kelvin
T0 = 25.0 # in degree celcius
p0 = 1.0 # in atm
# From table A-4
h1 = 3230.9 # in kj/kg
s1 = 6.9212 # in kj/kg.k
# From table A-2
h2 = 2676.1 # in kj/kg
s2 = 7.3549 # in kj/kg.k
# From example 6.6
Q = -22.6 # in kj/kg
# Calculations
DELTAef = (h1-h2)-(T0+273)*(s1-s2)+(v1**2-v2**2)/(2*1000)
# The net exergy carried in per unit mass of steam flowing in kj/kg
Eq = (1-(T0+273)/Tb)*(Q) # exergy transfer accompanying heat in kj/kg
Ed = ((1-(T0+273)/Tb)*(Q))-W+(DELTAef) # The exergy destruction determined by rearranging the steady-state form of the exergy
# rate balance
# Results
print '-> Balance sheet'
print '-> Net rate of exergy ',DELTAef,'kJ/kg,'
print '-> Disposition of the exergy:'
print '* Rate of exergy out'
print '-> Work',W,'kJ/kg.'
print '-> Heat transfer',-Eq,'.'
print '• Rate of exergy destruction',Ed,'kJ/kg.'
```

In [8]:

```
# Given:-
m1dot = 69.78 # in kg/s
p1 = 1.0 # in bar
T1 = 478.0 # in kelvin
T2 = 400.0 # in kelvin
p2 = 1.0 # in bar
p3 = 0.275 # in Mpa
T3 = 38.9 # in degree celcius
m3dot = 2.08 # in kg/s
T4 = 180.0 # in degree celcius
p4 = 0.275 # in Mpa
p5 = 0.07 # in bar
x5 = 0.93
Wcvdot = 876.8 # in kW
T0 = 298.0 # in kelvin
# Part(a)
# From table A-22
h1 = 480.35 # in kj/kg
h2 = 400.97 # in kj/kg
s1 = 2.173 # in kj/kg
s2 = 1.992 # in kj/kg
# From table A-2E
h3 = 162.82 # in kj/kg
s3 = 0.5598 # in kj/kg.k
# Using saturation data at 0.07 bars from Table A-3
h5 = 2403.27 # in kj/kg
s5 = 7.739 # in kj/kg.k
#The net rate exergy carried out by the water stream
# From table A-4
h4 = 2825.0 # in kj/kg
s4 = 7.2196 # in kj/kg.k
# Calculations
import math
netRE = m1dot*(h1-h2-T0*(s1-s2-(8.314/28.97)*math.log(p1/p2))) # the net rate exergy carried into the control volume
netREout = m3dot*(h5-h3-T0*(s5-s3))
# From an exergy rate balance applied to a control volume enclosing the steam generator
Eddot = netRE + m3dot*(h3-h4-T0*(s3-s4)) # the rate exergy is destroyed in the heat-recovery steam generator
# From an exergy rate balance applied to a control volume enclosing the turbine
EdDot = -Wcvdot + m3dot*(h4-h5-T0*(s4-s5)) # the rate exergy is destroyed in the tpurbine
# Results
print '-> balance sheet'
print '- Net rate of exergy in:',netRE,'kJ/kg.'
print '-> Disposition of the exergy:'
print '• Rate of exergy out'
print '-> power developed',1772.8-netREout-Eddot-EdDot,'kJ/kg.'
print '-> water stream ',netREout
print '• Rate of exergy destruction'
print '-> heat-recovery steam generator',Eddot,'kJ/kg'
print '-> turbine',EdDot
```

In [9]:

```
# Given:-
T0 = 273.00 # in kelvin
pricerate = 0.08 # exergy value at $0.08 per kw.h
# From example 6.8
sigmadotComp = 17.5e-4 # in kw/k
sigmadotValve = 9.94e-4 # in kw/k
sigmadotcond = 7.95e-4 # in kw/k
# Calculations
# The rates of exergy destruction
EddotComp = T0*sigmadotComp # in kw
EddotValve = T0*sigmadotValve # in kw
Eddotcond = T0*sigmadotcond # in kw
mCP = 3.11 # From the solution to Example 6.14, the magnitude of the compressor power in kW
# Results
print '-> Daily cost in dollars of exergy destruction due to compressor irreversibilities = ',round(EddotComp*pricerate*24,3)
print '-> Daily cost in dollars of exergy destruction due to irreversibilities in the throttling valve = ',round(EddotValve*pricerate*24,3)
print '-> Daily cost in dollars of exergy destruction due to irreversibilities in the condenser = ',round(Eddotcond*pricerate*24,3)
print '-> Daily cost in dollars of electricity to operate compressor = ',round(mCP*pricerate*24,3)
```

In [10]:

```
# Given:-
EfFdot = 100.00 # exergy rate of fuel entering the boiler in MW
cF = 1.44 # unit cost of fuel in cents per kw.h
Zbdot = 1080.00 # the cost of owning and operating boiler in dollars per hour
Ef1dot = 35.00 # exergy rate of exiting steam from the boiler in MW
p1 = 50.00 # pressure of exiting steam from the boiler in bar
T1 = 466.00 # temperature of exiting steam from the boiler in degree celcius
Ztdot = 92.00 # the cost of owning and operating turbine in dollars per hour
p2 = 5.00 # pressure of exiting steam from the turbine in bars
T2 = 205.00 # temperature of exiting steam from the turbine in degree celcius
m2dot = 26.15 # mass flow rate of exiting steam from the turbine in kg/s
T0 = 298.00 # in kelvin
# Part(a)
# From table A-4,
h1 = 3353.54 # in kj/kg
h2 = 2865.96 # in kj/kg
s1 = 6.8773 # in kj/kg.k
s2 = 7.0806 # in kj/kg.k
# Calculations
# From assumption,For each control volume,Qcvdot = 0 and kinetic and potential energy effects are negligible,the mass and energy rate
# balances for a control volume enclosing the turbine reduce at steady state to give
Wedot = m2dot *(h1-h2)/1000 # power in MW
Ef2dot = Ef1dot+m2dot*(h2-h1-T0*(s2-s1))/1000 # the rate exergy exits with the steam in MW
# Results
print '-> For the turbine,the power is',round(Wedot,2),'MW.'
print '-> For the turbine,the rate exergy exits with the steam is',round(Ef2dot,2),' MW.'
# Part(b)
# Calculations
c1 = cF*(EfFdot/Ef1dot) + ((Zbdot/Ef1dot)/10**3)*100 # unit cost of exiting steam from boiler in cents/Kw.h
c2 = c1 # Assigning the same unit cost to the steam entering and exiting the turbine
ce = c1*((Ef1dot-Ef2dot)/Wedot) + ((Ztdot/Wedot)/10**3)*100 # unit cost of power in cents/kw.h
# Results
print '-> The unit costs of the steam exiting the boiler of exergy is:',round(c1,2),' cents per kw.h.'
print '-> The unit costs of the steam exiting the turbine of exergy is:',round(c2,2),' cents per kw.h.'
print '-> Unit cost of power is:',ce,'cents per kw.h.'
# Part(c)
C2dot = (c2*Ef2dot*10**3)/100 # cost rate for low-pressure steam in dollars per hour
Cedot = (ce*Wedot*10**3)/100 # cost rate for power in dollars per hour
# Results
print '-> The cost rate of the steam exiting the turbine is:',round(C2dot,2),' dollars per hour.'
print '-> The cost rate of the power is: ',round(Cedot,2),' dollars per hour.'
```