Chapter1-Energy auditing

Ex1-pg8

In [5]:
import math
#calculate heat availble 

## Example 1.1
print('Example 1.1');
print(' Page No. 08');
## Solution 

## Given
m1= 40.*10**3;## fuel oil in gallons per year
ga= 4.545*10**-3;## m**3
m= m1*ga;## fuel oil in m**3 per year
Cv1= 175.*10**3;## Btu per gallons
Bt= .2321*10**6;## J per m**3
Cv= Cv1*Bt;## in J per year per m**3 
q=m*Cv;## in J per year
print'%s %.2e %s'%(' Heat available is ',q,' J per year')
Example 1.1
 Page No. 08
 Heat available is  7.38e+12  J per year

Ex2-pg9

In [2]:
## Example 1.2
print('Example 1.2');
print('Page No. 09');
## Solution 

## Given
Eo1= 1.775*10**9;## Annular energy consumption of oil in Btu
Btu= 1055.;## 1 Btu = 1055 Joules
Eo= Eo1*Btu;## Annular energy consumption of oil in Joules
Eg1= 5.*10**3;## Annular energy consumption of gas in Therms
Th= 1055.*10**5;##  1 Th = 1055*10**3 Joules
Eg= Eg1*Th;## Annular energy consumption of gas in Joules
Ee1= 995.*10**3;## Annular energy consumption of electricity in KWh
KWh= 3.6*10**6;## 1 KWh = 3.6*10**6 Joules
Ee= Ee1*KWh;## Annular energy consumption of electricity in Joules
Et= ( Eo + Eg + Ee);## Total energy consumption
P1= (Eo/Et)*100.; ## percentage of oil consumption
P2= (Eg/Et)*100.; ## percentage of gas consumption
P3= (Ee/Et)*100.; ## percentage of electricity consumption
print'%s %.1f %s'%('percentage of oil consumption is ',P1,'')
print'%s %.1f %s'%('percentage of gas consumption is ',P2,'')
print'%s %.1f %s'%('percentage of electricity consumption is ',P3,'') 
Example 1.2
Page No. 09
percentage of oil consumption is  31.3 
percentage of gas consumption is  8.8 
percentage of electricity consumption is  59.9 

Ex3-pg10

In [3]:
import math
## Example 1.3
print('Example 1.3\n\n');
print('Page No. 10\n\n');
## Solution 

## Given
Et = 100*10**3;## total energy production in tonnes per annum
Eo= 0.520*10**9;## oil consumption in Wh
Eg= 0.146*10**9;## gas consumption in Wh
Ee= 0.995*10**9;## electricity consumption in Wh
Io= Eo/Et;
Ig= Eg/Et;
Ie= Ee/Et;
Et1= Eo + Eg + Ee;## total energy consumption
It= Et1/Et;
print'%s %.1f %s'%('oil energy index is ',Io,' Wh per tonne ')
print'%s %.1f %s'%('gas energy index is ',Ig,' Wh per tonne ')
print'%s %.1f %s'%('electricity energy index is ',Ie,' Wh per tonne')
print'%s %.1f %s'%('total energy index is ',It,' Wh per tonne ')
Example 1.3


Page No. 10


oil energy index is  5200.0  Wh per tonne 
gas energy index is  1460.0  Wh per tonne 
electricity energy index is  9950.0  Wh per tonne
total energy index is  16610.0  Wh per tonne 

Ex4-pg10

In [4]:
## Example 1.4
print('Example 1.4');
print('Page No. 10');
## Solution 

## Given
mc= 1.5*10**3;## coke consumption in tonnes
mg= 18.*10**3;## gas consumption in therms
me= 1.*10**9;## electricity consumption in Wh
Cc1= 72.;## cost of coke in Pound per tonne
Cg1= 0.20;## cost of gas in Pound per therm
Ce1= 2.25*10**-5 ;## cost of electricity in Pound per Wh
Cc= mc*Cc1;##in Pound
Cg= mg*Cg1;##in Pound
Ce= me*Ce1;##in Pound
Ct= Cc+Cg+Ce;##in Pound
print'%s %.1f %s'%('cost of coke consumption is ',Cc,' Pound ')
print'%s %.1f %s'%('cost of gas consumption is',Cg, 'Pound ')
print'%s %.1f %s'%('cost of electricity consumption is',Ce,' Pound ')
print'%s %.1f %s'%('total cost is ',Ct,' Pound ')
Example 1.4
Page No. 10
cost of coke consumption is  108000.0  Pound 
cost of gas consumption is 3600.0 Pound 
cost of electricity consumption is 22500.0  Pound 
total cost is  134100.0  Pound 

Ex5-pg11

In [5]:
## Example 1.5
#page no 11

## Solution 

## Given
Cc= 108.0*10**3;## cost of coke in Pound
Cg= 3.6*10**3;## cost of gas in Pound
Ce= 22.5*10**3;## cost of electricity in Pound
Ct= Cc+Cg+Ce;## total cost of fuel in Pound
E= 15*10**3;## total production in tonnes per year
Ic= Cc/E;##Pound per tonne
Ig= Cg/E;##Pound per tonne
Ie= Ce/E;##Pound per tonne
It= Ct/E;##Pound per tonne
print'%s %.1f %s'%(' coke cost index is',Ic,'Pound per tonne ')
print'%s %.1f %s'%(' gas cost index is',Ig,'Pound per tonne')
print'%s %.1f %s'%(' electricity cost index is ',Ie,' Pound per tonne')
print'%s %.1f %s'%(' total cost index is',It,' Pound per tonne')
 coke cost index is 7.2 Pound per tonne 
 gas cost index is 0.2 Pound per tonne
 electricity cost index is  1.5  Pound per tonne
 total cost index is 8.9  Pound per tonne

Ex6-pg11

In [2]:
import math
%matplotlib inline
## Example 1.6
##page No. 11\n\n');
## Solution 
import matplotlib.pyplot as plt

## Given
G1= 11.72*10**3;## hourly consumption of gas in therms
th= 34.13;## in Watts
G= G1*th;## hourly consumption of gas in Watts
O1= 4.32*10**9;## hourly consumption of oil in Joules
J= .278*10**-3;## in Watts
O= O1*J;## hourly consumption of oil in Watts
E= 500.*10**3;## hourly consumption of electricity in Watts
## Pie Chart Representation : one input argument  x=[G O E]
labels = [r'gas', r'oil', r'electricity']
sizes = [G,O,E]
colors = ['yellowgreen', 'gold', 'lightskyblue']
patches, texts = plt.pie(sizes, colors=colors, startangle=90)
plt.legend(patches, labels, loc="best")
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
plt.tight_layout()
plt.show()

print('The Pie chart is plotted in the figure');
The Pie chart is plotted in the figure

Ex7-pg12

In [3]:
import math
## Example 1.7
print('Example 1.7\n\n');
print('Page No. 12\n\n');
## Solution 
import matplotlib.pyplot as plt
%matplotlib inline
## Given
O= 150.*10**3;## energy consumption in office heating in Watts
L= 120.*10**3;## energy consumption in lighting in Watts
B= 90.*10**3;## energy consumption in boiler house in Watts
P= 180.*10**3;## energy consumption in process in Watts
## Pie Chart Representation : one input argument  x=[O L B P]
labels = [r'office heating', r'lighting', r'boiler heating',r'process']
sizes = [O,L ,B , P]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
patches, texts = plt.pie(sizes, colors=colors, startangle=90)
plt.legend(patches, labels, loc="best")
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
plt.tight_layout()
plt.show()
print('The Pie chart is plotted in the figure');
Example 1.7


Page No. 12


The Pie chart is plotted in the figure

Ex8-pg16

In [22]:
import math
import numpy
## Example 1.8
print('Example 1.8\n\n');
print('Page No. 16\n\n');
## given

qunty= numpy.array([40, 10000, 400 ,90000])
unit_price= numpy.array([29 ,0.33, 0.18, 0.025])
cost= (unit_price * qunty)## in Pound
common_basis= ([310, 492 ,11.7 ,90])## in 10^6 Wh
per_unit_cost= (unit_price * qunty) / common_basis## Pound per 10^6 Wh
p= 150;## production in tonnes
EI= sum(common_basis)*10**6/150.
CI= sum(unit_price * qunty)/150.
print'%s %.2f %s'%('energy index is ',EI,' Wh per tonne \n')
print'%s %.2f %s'%('cost index  is ',CI,' Wh per tonne \n')
Example 1.8


Page No. 16


energy index is  6024666.67  Wh per tonne 

cost index  is  45.21  Wh per tonne 

Ex9-pg

In [4]:
import math
%matplotlib inline
## Example 1.9
import numpy 
import matplotlib.pyplot as plt
print('Example 1.9\n\n');
print('Page No. 17\n\n');
##given

p= numpy.array([50, 55, 65, 50, 95, 90, 85, 80, 60, 90, 70, 110, 60, 105]);## weakly production in tonnes
s= numpy.array([0.4, 0.35, 0.45, .31, 0.51,0.55, 0.45, 0.5, 0.4, 0.51, 0.4, 0.6, 0.45, 0.55]);## weakly steam consumption in 10^6 kg
plt.plot(p,s,'r*');

plt.show()
Example 1.9


Page No. 17


Ex10-pg19

In [24]:
import math
## Example 1.10
print('Example 1.10\n\n');
print('Page No. 19\n\n');
## given
import numpy
##Monthly Energy Usage
qunty = numpy.array([15*10**3, 4*10**3 ,90*10**3])
cost = numpy.array([4950 ,720 , 2250])## in Pound
common_basis1  = numpy.array([738 ,117 ,90])## in 10**6 Wh
common_basis= numpy.array([2655 ,421 ,324])## converted into 10**9 Joules
unit_cost = cost/common_basis1## in Pound per 10**6 Wh
p= 80;## production in tonnes
EI = ((sum(common_basis))/p)*10**9;
CI = sum(cost)/80.;
print'%s %.2e %s'%('Monthly energy index is ',EI,' J per tonne \n')
print'%s %.2f %s'%('Monthly cost index is ',CI,' Pound per tonne \n\n')##Deviation in answer is due to calculation error for sum of cost in the book

## Boiler House Energy Audit
qunty_b = ([15000 ,10000])
Com_basis_b_1 = ([2655 ,36])## in 10**9 J
Com_basis_b = ([738, 10])## in 10**6 Wh
Cost_b = ([4950, 250])## in Pound
b_output = 571.*10**6;## in Wh
EI_b = (b_output/(sum(Com_basis_b)*10**6));
CI_b = (sum(Cost_b)/b_output)*10**3;## Pound converted into p
print'%s %.2f %s'%('Energy index  for boiler is ',EI_b,' \n')
print'%s %.2e %s'%('Cost index for boiler is ',CI_b,' p per Wh\n \n')

##Power House Energy Audit
P_gen = 200.*10**6;## Power generated in Wh
Com_basis_p_1 = ([14.4 ,2055 ,-1000])## in 10**9 J
Com_basis_p = ([4.0, 571, -278])## in 10**6 Wh
Cost_p = ([100 ,5196 ,-2530])## in Pound
CI_p = (sum(Cost_p)/P_gen)*10**3;## Pound converted into p
print'%s %.2e %s'%('Cost index for power house is ',CI_p,' p per Wh\n\n')##Deviation in answer is due to wrong calculation in the book

##Space Heating Energy Audit
deg_days = 260.;## Number of degree-days
Com_basis_s_1 = ([36 ,100 ,105])## in 10**9 J
Com_basis_s = ([10.0 ,27.8 ,29.2])## in 10**6 Wh
Cost_s = ([250 ,253 ,179])## in Pound
EI_s = ((sum(Com_basis_s)*10**6)/deg_days)
CI_s = (sum(Cost_s)/deg_days)
print'%s %.2e %s'%('Energy index  for space heating is ',EI_s,' Wh per degree-day\n')
print'%s %.2f %s'%('Cost index for space heating is ',CI_s,' Pound per degree-day\n\n')

##Process Energy Audit
T_pdt_output = 100.;## in tonne
Com_basis_pr_1 = ([216 ,720 ,810 ,316])## in 10**9 J
Com_basis_pr = ([60, 200 ,225 ,88])## in 10**6 Wh
Cost_pr = ([1500 ,2766 ,2047 ,540])## in Pound
EI_pr = ((sum(Com_basis_pr)*10**6)/T_pdt_output);
CI_pr = (sum(Cost_pr)/T_pdt_output);
print'%s %.2e %s'%('Energy index  for Process Energy Audit is ',EI_pr,' Wh per tonne \n')
print'%s %.2f %s'%('Cost index for Process Energy Audit is ',CI_pr,' Pound per tonne \n')
#igoner the warnings
Example 1.10


Page No. 19


Monthly energy index is  -9.50e+08  J per tonne 

Monthly cost index is  99.00  Pound per tonne 


Energy index  for boiler is  0.76  

Cost index for boiler is  9.11e-03  p per Wh
 

Cost index for power house is  1.38e-02  p per Wh


Energy index  for space heating is  2.58e+05  Wh per degree-day

Cost index for space heating is  2.62  Pound per degree-day


Energy index  for Process Energy Audit is  5.73e+06  Wh per tonne 

Cost index for Process Energy Audit is  68.53  Pound per tonne 

-c:14: RuntimeWarning: overflow encountered in long_scalars