# Variables :
deltaQ = 1000.; #KJ
T = 1073.; #Kelvin
T0 = 20.+273; #Kelvin
# Calculations and Results
deltaS = deltaQ/T; #KJ/K
A = deltaQ-T0*deltaS; #KJ
print "Available energy in KJ : %.2f"%A
UA = T0*deltaS; #KJ
print "Unavailable energy in KJ : %.2f"%UA
import math
# Variables :
m = 2.; #Kg
T1 = 300.+273; #Kelvin
T2 = 150.+273; #Kelvin
T0 = 20.+273; #Kelvin
Cp = 0.45; #KJ/KgK
# Calculations and Results
deltaQ = m*Cp*(T1-T2); #KJ
deltaS = m*Cp*math.log(T1/T2); #KJ/K
A = deltaQ-T0*deltaS; #KJ
print "Reversible work or Available energy in KJ : %.2f"%A
UA = T0*deltaS; #KJ
print "Irreversibility in KJ : %.2f"%UA
#Irreversibilty is not calculated in the book and asked in the question.
import math
# Variables :
m = 5.; #Kg
p = 1.; #bar
T0 = 20.+273; #Kelvin
T1 = 23.+273; #Kelvin
T2 = 227.+273; #Kelvin
Cp = 1.005; #J/KgK
# Calculations
deltaS = Cp*math.log(T1/T2); #KJ/KgK
deltaQ = Cp*(T2-T1); #KJ
A = m*(deltaQ+T0*deltaS); #KJ
# Results
print "Increase in availability due to heating in KJ : %.2f"%A
# Variables :
Q1 = 400.; #KJ
T1 = 1227.+273; #Kelvin
T2 = 27.+273; #Kelvin
# Calculations and Results
A = Q1-T2*Q1/T1; #KJ
print "Availability of the system in KJ : ",A
UA = Q1-A; #KJ
print "Unavailable energy in KJ : ",UA
# Variables :
P = 1.; #KW or KJ/s
Q = 6.; #MJ/hr
Q = Q*1000./3600; #KJ/s
T1 = 26.+273; #Kelvin
T2 = 3.+273; #Kelvin
# Calculations
COP = T1/(T1-T2);
W = Q/COP; #KJ/s or KW
# Results
print "Work required to pump heat in KJ/s or KW : %.3f"%W
print ("As P>W, required condition can be maintained.")
# Variables :
T = 727.+273; #Kelvin
T0 = 17.+273; #Kelvin
deltaQ = 4000.; #KJ
# Calculations and Results
deltaS = deltaQ/T; #KJ/K
A = deltaQ-T0*deltaS; #KJ
print "Availability of heat energy in KJ : ",A
UA = T0*deltaS; #KJ
print "Unavailable heat energy in KJ : ",UA
# Variables :
deltaQ = 850.; #KJ
T = 180+273.; #Kelvin
T0 = 22+273.; #Kelvin
# Calculations
deltaS = deltaQ/T; #KJ/K
A = deltaQ-T0*deltaS; #KJ
# Results
print "Available energy in KJ : %.2f"%A
# Variables :
deltaQ = 850.; #KJ
T1 = 1400.+273.; #Kelvin
T2 = 250.+273.; #Kelvin
T0 = 20.+273.; #Kelvin
Q = -1000.; #KJ
# Calculations and Results
deltaS1 = Q/T1; #KJ/K(-ve as heat leaving)
deltaS2 = abs(Q)/T2; #KJ/K(+ve Q as steam receives heat)
deltaS = deltaS1+deltaS2; #KJ/K
print ("Part (i) As energy leaves the hot gases : ");
A = (T1-T0)*deltaS1; #KJ
UA = T0*deltaS1; #KJ
print "Available energy in KJ : %.2f"%A
print "Unavailable energy in KJ : %.2f"%UA
print ("Part (ii) As energy enters the system : ");
A = (T2-T0)*deltaS2; #KJ
UA = T0*deltaS2; #KJ
print "Available energy in KJ : %.2f"%A
print "Part (iii) Unavailable energy in KJ : %.2f"%UA
import scipy
from scipy.integrate import quad
# Variables :
deltaQ = 850.; #KJ
T1 = 523.; #Kelvin
T2 = 873.; #Kelvin
T0 = 288.; #Kelvin
dQ_by_dT = 100.; #KJ/K
# Calculations and Results
def f3(T):
return 100/T
deltaS = quad(f3,T1,T2)[0]
def f4(T):
return 100
deltaQ = quad(f4,T1,T2)[0]
print "Total heat abstracted in KJ : ",deltaQ
A = deltaQ-T0*deltaS; #KJ
print "Availability in KJ : %.1f"%A
Loss = deltaQ-A; #KJ
print "Loss of availability in KJ : %.1f"%Loss
import math
# Variables :
p0 = 1.; #bar
T0 = 17.+273; #Kelvin
T1 = 1817.+273; #Kelvin
Cp = 1.; #KJ/KgK
# Calculations
deltaQ = Cp*(T1-T0); #KJ/Kg
deltaS = Cp*math.log(T0/T1); #KJ/KgK
deltaS_fluid = -deltaS; #KJ/KgK(As deltaS_surrounding = 0)
A = deltaQ-T0*deltaS_fluid; #KJ
# Results
print "Availability of hot products in KJ : %.2f"%A
# Variables :
T1 = 1200.; #Kelvin
T2 = 400.; #Kelvin
T0 = 300.; #Kelvin
Qsource = -150.; #KJ/s
Qsystem = 150.; #KJ/s
# Calculations and Results
deltaS_source = Qsource/T1; #KJ/sK
deltaS_system = Qsystem/T2; #KJ/sK
deltaS_net = deltaS_source+deltaS_system; #KJ/sK
print "Net change in entropy in KJ/sK : ",deltaS_net
A1 = (T1-T0)*-deltaS_source; #KJ/s
print "Available energy of heat source in KJ/s : ",A1
A2 = (T2-T0)*deltaS_system; #KJ/s
print "Available energy of system in KJ/s : ",A2
E_decrease = A1-A2; #KJ/s
print "Decrease in available energy in KJ/s : ",E_decrease
import math
# Variables :
Tg1 = 1127.+273; #Kelvin
Tg2 = 527.+273; #Kelvin
T2 = 250.+273; #Kelvin
T0 = 27.+273; #Kelvin
Cpg = 1.; #KJ/KgK
mw = 5.; #Kg/s
hfg = 1716.2; #KJ/Kg
# Calculations and Results
#mg*Cpg*(Tg1-Tg2) = mw*hfg
mg = mw*hfg/Cpg/(Tg1-Tg2); #Kg/s
print "Mass flow rate of gases in Kg/s : %.1f"%mg
deltaSg = mg*Cpg*math.log(Tg2/Tg1); #KJ/sK
print "Entropy change of gases in KJ/sK : %.4f"%deltaSg
deltaSw = mw*hfg/T2; #KJ/sK
print "Entropy change of water in KJ/sK : %.4f"%deltaSw
deltaSnet = deltaSg+deltaSw; #KJ/sK
print "Net Entropy change in KJ/sK : %.4f"%deltaSnet
Q1 = mw*hfg; #KJ/s
Sa_sub_Sb = -deltaSg; #KJ/sK
A1 = Q1-T0*(Sa_sub_Sb); #KJ/s
print "Availability of hot gases in KJ/s : %.2f"%A1
A2 = Q1-T0*deltaSw; #KJ/s
print "Availability of water in KJ/s : %.2f"%A2
UA1 = T0*(Sa_sub_Sb); #KJ/s
print "Unavailable energy of hot gases in KJ/s : %.2f"%UA1
UA2 = T0*deltaSw; #KJ/s
print "Unavailable energy of water in KJ/s : %.2f"%UA2
E_increase = T0*deltaSnet; #KJ/s
print "Increase in unavailable energy in KJ/s : %.2f"%E_increase
import math
# Variables :
mg = 5.; #Kg
p1 = 3.; #bar
T1 = 500.; #Kelvin
Q = 500.; #KJ
Cv = 0.8; #KJ/Kg
T0 = 300.; #Kelvin
T = 1300.; #Kelvin
# Calculations
#Q = mg*Cv*(T2-T1)
T2 = Q/mg/Cv+T1; #Kelvin
A1 = Q-T0*Q/T; #KJ
deltaSg = mg*Cv*math.log(T2/T1); #KJ/K
Ag = Q-T0*deltaSg; #KJ
Loss = A1-Ag; #KJ
# Results
print "Loss of Availability due to heat transfer in KJ : %.1f"%Loss
import math
# Variables :
m = 3.; #Kg
p1 = 3.; #bar
T1 = 450.; #Kelvin
Q = 600.; #KJ
Cv = 0.81; #KJ/Kg
T0 = 300.; #Kelvin
T = 1500.; #Kelvin
# Calculations
deltaSsource = Q/T; #KJ/K
#Q = m*Cv*(T2-T1)
T2 = Q/m/Cv+T1; #Kelvin
A1 = Q-T0*deltaSsource; #KJ
deltaSg = m*Cv*math.log(T2/T1); #KJ/K
A2 = Q-T0*deltaSg; #KJ
Loss = A1-A2; #KJ
# Results
print "Loss in available energy due to heat transfer in KJ : %.1f"%Loss