In [1]:

```
# Variables
Q = 16.; # in MJ
Q = Q * 10**3; # in kJ
T_H = 227.; # in °C
T_H = T_H + 273; # in K
T_L = 15.; # in °C
T_L = T_L + 273; # in K
# Calculations and Results
del_S = Q/T_H; # in kJ/K
A = Q - (T_L * del_S); # in kJ
print "The available part of heat in kJ is ",A
U_P_ofHeat = T_L * del_S; # unavailable part of heat in kJ
print "The unavailable part of heat in kJ is :",U_P_ofHeat
```

In [1]:

```
# Variables
Q = 12000.; # in kJ
T_H = 600.; # in K
T_L = 300.; # in K
# Calculations and Results
dS = Q / T_H; #in kJ/K
A = Q - (T_L * dS); #available work in kJ
print "Available work is in kJ",A
UA = T_L * dS; #unavailable work in kJ
print "Unavailable work is in kJ",UA
```

In [4]:

```
import math
# Variables
m = 800.; # in kg
C_p = 0.5; # in kJ/kg K
T2 = 500.; # in K
T1 = 1250.; # in K
T_o = 300.; # in K
# Calculations and Results
del_t = T1 - T2; # in K
Q = m * C_p * del_t; # in kJ
dS = abs(m * C_p * math.log(T2/T1)); # in kJ/K
availableEnergy = Q - (T_o * dS); #in kJ
print "Available energy in MJ is :",round(availableEnergy*10**-3)
unavailableEnergy = T_o * dS; # UA for unavailable energy in kJ
print "Unavailable energy in MJ is :",(round(unavailableEnergy*10**-3))
```

In [2]:

```
# Variables
h_i = 726.1;
h_o = 25.03;
T_o = 298; # in K
s_i = 1.582;
s_o = 0.087;
h2 = 669.;
s2 = 1.677;
# Calculations and Results
h3 = 52.17 + (0.9 * 567.7);
s3 = 0.1748 + (0.9 * 1.7448);
sai_i = (h_i - h_o) - (T_o * (s_i - s_o)); # in kcl/kg
print "The availablibity per kg of steam entering in kcl/kg is : %.2f"%sai_i
sai_e = (0.25 * ((h2 - h_o) - (T_o * (s2 - s_o)))) + (0.75 * ((h3 - h_o) - (T_o * (s3 - s_o)))) ; # in kcl/kg
print "The availablibity per kg of steam leaving in kcl/kg is : %.2f"%sai_e
w_rev = sai_i - sai_e; # in kcl/kg
print "reversible work per kg of steam in kcl/kg is : %.4f"%w_rev
# Note: There is calculation error in evaluating the value of availability per kg of
# steam leaving in kcl/kg . so the answer in the book is wrong and coding is right.
```

In [1]:

```
# Variables
T_o = 298; # in K
m2 = 25000;
s2 = 16775;
m3 = 75000;
s3 = 17448;
m1 = 1000000;
s1 = 1582;
Q = -16; # in MJ
# Calculations
Q = Q * 10**3; # in kJ
I = (T_o * ((m2 * s2) + (m3 * s3) - (m1 * s1))) - Q; # in cal/hr
I=I*10**-3; # in kcal/hr
# Results
print "The irreversiblity in kcal/hr",I
# Note: There is calculation error in evaluating the value of the irreversibility
# in kcal/hr. so the answer in the book is wrong and coding is right.
```

In [2]:

```
# Variables
h_i = 749.2;
h_o = 25.03;
T_o = 298; # in K
s_i = 1.6202;
s_o = 0.0877;
# Calculations and Results
phi_i = (h_i - h_o)- (T_o * (s_i - s_o)); # kcal/kg
print "The availablibity before adiabatic throttling in kcal/kg is : %.2f"%phi_i
h_e = 749.2;
s_e = 1.6936;
phi_e = (h_e - h_o) - (T_o * (s_e - s_o)); # in kcal/kg
print "The availablibity before adiabatic throttling in kcal/kg is : %.2f"%phi_e
Wrev = phi_i - phi_e; # in kcal/kg
print "Reversible work in kcal/kg is : %.2f"%Wrev
Wactual = 0;
i = Wrev-Wactual; # in kcal/kg
print "Irreversibility per kg of steam in kcal/kg is : %.2f"%i
```

In [3]:

```
import math
# Variables
# del_W = T * ds - del_Q
T = 600; # in K
p_i = 7; #kgf/cm**2
p_e = 1.5; #kgf/cm**2
T_o = 298; # in K
# Calculations and Results
R = 29.27/427;
del_W_lost = T * ( R *math.log(p_i/p_e)); # in kcal/kg
print "Lost work in kcal/kg is",round(del_W_lost,4)
i = T_o * (R * (math.log(p_i/p_e))); # in kcal/kg
print "Irreversebility per kg of air flow in kcal/kg is : %.3f"%i
```