In [5]:

```
#Variable declaration:
M = 200 #max demand(kW)
LF = 0.4 #load factor
c1 = 100 #tarif(Rs/kW)
c2 = 10 #tariff(pais/kWh)
#Calculation:
E = M*LF*8760 #units consumed/year
T = c1*M+E*c2/100 #annual charges(Rs)
OC = T/E #overall cost(Rs/kWh)
#Results:
print "Overall cost per kWh is ",round(OC*100,2),"paise"
```

In [6]:

```
from __future__ import division
#Variable declaration:
V = 220 #voltage(V)
I = 20 #current(A)
E = 8760 #kWh
c1 = 20 #tariff part1(paise/unit for 500hrs)
c2 = 10 #tariff part2 for additional unit(paise/unit)
#Calculation:
#assuming power factor to be unity.
M = V*I/1000 #max demand(kW)
#part (i):
E1 = M*500 #kWh
C1 = c1*E1/100 #Rs
E2 = E-E1 #kWh
C2 = 10*E2/100 #kWh
T = C1+C2 #total annual bill(Rs)
T2 = T/E #equivalent flat rate(Rs/kWh)
#Results:
print "(i) Annual bill is Rs",T
print "(ii)Eqv flat rate is ",round(T2*100,1),"paise"
```

In [7]:

```
from sympy import *
#Variable declaration:
#for tariff (a):
c1 = 100 #tariff part1(Rs)
c11 = 15 #tariff part2(paise/kWh)
#for tariff (b):
c2 = 30 #paise/kWh
#Calculation:
#Let x be the number of units at which charges
#due to both tariffs become equal.
x = symbols('x')
x1 = solve(c1+c11*x/100 - c2*x/100 , x)[0]
#Results:
print "Tariff(a) is economical if consumption is more than",round(float(x1),2),"units."
```

In [8]:

```
from __future__ import division
from sympy import *
#Variable declaration:
#for 1t tariff:
c11 = 30 #Rs/annum
c12 = 3 #paise/unit
#for 2nd tariff:
c21 = 6 #paise/unit for 1st 400 units
c22 = 5 #paise/unit for extra units
#Calculation:
#Let x (> 400) be the number of units taken per annum
#for which the annual charges due to both tariffs become equal.
x=symbols('x')
T1 = c11+c12*x/100 #charges due to 1st tariff(Rs)
T2 = c21*400/100+c22*(x-400)/100 #charges due to 2nd tariff(Rs)
x1 = solve(T1-T2,x)[0]
#Results:
print "Required no. of units are ",round(x1),"kWh"
```

In [9]:

```
#Variable declaration:
M = 50 #max load on the station(MW)
AD = 75 #aggregate demand by consumers(MW)
E = 18*10**7 #units/annum
#for annual fixed charges:
c11 = 28*10**5 #for generation(Rs)
c12 = 32*10**5 #for transmission & distribution(Rs)
c13 = 90*10**5 #for fuel(Rs)
#for running charges:
c21 = 0.9*90*10**5 #fuel cost(Rs)
r = 85 #% of power transmitted
#Calculation:
T1 = c11+c12+c13*0.1 #10% of fuel used for fixed charges(Rs)
C1 = T1/(AD*10**3) #Rs/kW
E1 = r*E/100 #units delivered to consumers
C2 = c21/E1 #cost per kWh
#Results:
print "Tariff is",C1 ,"Rs/kW of maximum demand plus",round(C2*100,1),"paise per kWh."
```

In [10]:

```
from __future__ import division
#Variable declaration:
M = 75*10**3 #Max emand(kW)
LF = 0.4 #load factor
c1 = 60 #1st part of generating cost(Rs/kW)
c2 = 4 #2nd part of generating cost(paise/kW)
CT = 2000000 #annual capital charges for transmission system(Rs)
CD = 1500000 #annual capital charges for distribution system(Rs)
dt = 1.2 #diversity factor of tr. system
dd = 1.25 #diversity factor of tr. system
nt = 0.9 #efficiency of tr system
nd = 0.85 ##efficiency of distribution system
#Calculation:
#(i) Cost at substation:
#(a)Annual fixed charges:
Tafc1 = c1*M+CT #total annual fixed cost(Rs)
S1 = M*dt #sum of all the max demands(kW)
AC1 = Tafc1/S1 #Annual cost per kW of max. demand(Rs)
#(b) Running Charges:
Cs1 = c2/nt #Cost/kWh at substation(paise)
#(ii) Cost at consumer’s premises:
Tafc2 = Tafc1+CD #Total annual fixed charges at consumer’s premises(Rs)
S2 = S1*dd #sum of of maximum demands of all consumers(kW)
AC2 = Tafc2/S2 #Annual cost per kW of maximum demand(Rs)
#As the distribution efficiency is 85%, therefore, for each kWh delivered from
#substation, only 0·85 kWh reaches the consumer’s premises
Cs2 = Cs1/nd #Cost/kWh at consumer premises(paise)
#Result:
print "(i)At sub-station, the cost is Rs",round(AC1,2),"per annum per kW maximum demand "
print " plus",round(Cs1,2),"paise per kWh"
print "\n(ii)At consumer’s premises, the cost is",round(AC2,2),"per annum per kW maximum demand"
print " plus",round(Cs2,2),"paise per kWh."
```

In [11]:

```
from __future__ import division
from sympy import *
#Variable declaration:
# Fixed charges Running charges #Station
# (per kW) (paise/kWh)
Cf1 = 300; Cr1 = 25 #Diesel
Cf2 = 1200; Cr2 = 6.25 #Steam
#Calculation:
#Suppose energy supplied in one year is 100 units i.e., 100 kWh.
#Diesel Station:
L = symbols('L') #load factor
E = 100 #kWh(say)
P = E/8760 #avg power, kW
M = P/L #max deamnd(kW)
C1 = Cf1*M+E*Cr1/100 #Fixed and running charges for 100 kWh
#Steam station
C2 = Cf2*M+E*Cr2/100 #Fixed and running charges for 100 kWh
L1 = solve(C1-C2,L)[0]
#Result:
print "The load fctor is ",round(L1*100,2),"%"
```

In [12]:

```
#Variable declaration:
M = 100 #max demand(kW)
LF = 0.6 #load factor
pf = 0.8 #power factor
c1 = 75 #1st part tariff(Rs/kVA)
c2 = 15 #2nd part tariff(paise/kWh)
#Calculation:
E = M*LF*8760 #units consumed/year
M1 = M/pf #max demand in kVA
AB = M1*c1+E*c2/100 #annual bill(Rs)
#Result:
print "Annual bill is Rs",AB
```

In [13]:

```
#Variable declaration:
M = 240 #max load(kW)
pf = 0.8 #power factor
E = 50000 #annual units consumption(kW)
c1 = 50 #1st part tariff(Rs/KVA)
c2 = 10 #2nd part tariff(paise/unit)
#Calculation:
M1 = M/pf #KVA
AB = M1*c1+E*c2/100 #annual bill(Rs)
FR = AB/E #Rs
#now
pf1 = 1
M2 = M
AB1 = M2*c1+E*c2/100 #Rs
S = AB-AB1 #annual saving(Rs)
#Result:
print "Flat rate of energy consumption is ",FR*100,"paise"
print "Annual saving is Rs",S
```

In [1]:

```
from __future__ import division
import math
#Variable declaration:
M = 50 #max demand(kW)
E = 36000 #energy consume(kWh)
R = 23400 #reactive power(KVAR)
c1 = 80 #1st part tariff(Rs/kW)
c2 = 8 #2nd part tariff(paise/unit)
c3 = 0.5 #3rd part tariff(p/kWh)for each 1% of pf below 86%
#Calculation:
L = E/(24*30) #avg load(kW)
RP = R/(24*30) #avg reactive power(kVAR)
theta = math.atan(RP/L) #power factor angle
pf = math.cos(theta)
PFS = E*c3*(0.86-pf) #power factor surcharge(Rs)
MB = c1*L+c2*E/100+PFS #monthly bill(Rs)
#Result:
print "The monthly bill is Rs",round(MB,1)
```

In [15]:

```
#Variable declaration:
c1 = 150 #1st part tariff(Rs/KVA)
c2 = 8 #2nd part tariff(paise/unit)
LF = 0.3 #load factor
#Calculation:
#suppose max demand is 1kVA
#(i)When p.f. is unity:
pf = 1
OC1 = c1*100/(8760*LF)+c2 #operating cost(Rs)
#(ii) When p.f. is 0·7
pf1 = 0.7
OC2 = c1*100/(8760*LF*pf1)+c2 #operating cost(Rs)
#Result:
print "At unity p. f., overall cost is Rs",round(OC1,2)
print "At 0.7 p. f., overall cost is Rs",round(OC2,2)
```

In [16]:

```
from __future__ import division
#variable declaration
L = 200 #avg load(kW)
pf = 0.8 #power factor
M = 250 #max demand(kW)
l = 4 #losses(%)
r = 12 #interest & depreciation(%)
C = 50 #high voltage equipment cost(Rs)
t = 8 #working hours
n = 300 #no. of working working
#for system(i)high voltage supply:
c11 = 5 #1st part tariff(paise/unit)
c12 = 4.50 #2nd part tariff(per month per kVA)
#for system(ii)low voltage supply:
c21 = 5.5 #1st part tariff(paise/unit)
c22 = 5 #2nd part tariff(Rs per month per kVA)
#Calculation:
#(i) High voltage supply:
M1 = M/pf #Max. demand in kVA
#As the losses in h.v. equipment are 4%, therefore,
#capacity of h.v. equipment:
Cap = round(M1/(1-l/100),1) #capacity of h.v. equipment(kVA)
C1 = C*Cap #Capital investment on h.v. equipment(Rs)
E1 = L*t*n/(1-l/100) #units consumed(kWh)
T1 = C1*r/100+Cap*c12*12+c11*E1/100 #Total annual cost(Rs)
#(i) low voltage supply:
M2 = M/pf #Max. demand in kVA
E2 = L*t*n #units consumed(kWh)
T2 = M2*c22*12+E2*c21/100 #kWh
T = T2 - T1
#Results:
print "Difference in the annual costs of two systems is Rs",T
```

In [17]:

```
from __future__ import division
#Variable declaration:
#(i) Purchasing diesel set:
M1 = 1000 #kW
C1 = 400 #Rs/kW
r1 = 10 #annual interest depreciation(%)
c11 = 75 #Rs/kW
c12 = 5 #paise/unit
#(ii) Purchasing from grid supply:
r1 = 10 #annual interest depreciation(%)
c21 =120 #Rs/kW
c22 = 3 #paise/unit
#after 2 years:
M2 = 2500 #kW
E = 5.5*10**6 #units reached
#Calculation:
#(i) Purchasing diesel set:
CC = M1*C1 #Rs
#The present capacity of the station is 2000 kW and the expected
#maximum demand after two years is 2500 kW.
P = 2500-2000 #extra power to be generated(kW)
T1 = CC*r1/100+P*c11+E*c12/100 #total annual cost(Rs)
#(ii) Purchasing from grid supply:
T2 = P*c21+E*c22/100 #total annual cost(Rs)
#Result:
print "Alternative (ii) is cheaper by Rs",T1-T2,"per annum"
```

In [2]:

```
from __future__ import division
from pylab import *
from sympy import *
import math
#Variable declaration:
#H.V supply:
c11 = 70 #1st part tariff(Rs/kVA)
c12 = 3 #2nd part tariff(paise/kWh)
#L.V supply:
c21 = 65 #1st part tariff(Rs/kVA)
c22 = 4 #2nd part tariff(paise/kWh)
c = 50 #cost of transformer & switchgear for HV side(Rs/kVA)
r1= 2 #transformer losses(%)
r2 = 15 #annual fixed charges(%) of transformer & switchgear
n = 6 #no of working hours
#Calculation:
(x,y) = symbols('x y') #say x = Factory load in kW
#y = No. of working days above which H.V.
#supply is cheaper
#for HV side:
r = x*round(1/(1-r1/100),4) #rating of transformer & switchgear(kVA)
E1 = x*y*round(n*1/(1-r1/100),2) #units consumed per annnum
T11 = x*math.floor(1/(1-r1/100)*c11*100)/100+x*round(1/(1-r1/100)*r2*c/100,2) #total fixed charges(Rs)
T12 = E1*c12/100 #total running charges(Rs)
T1 = T11+T12 #total annual charges(Rs)
#for LV side:
E2 = x*y*n #units consumed per annnum
T21 = c21*x #total fixed charges(Rs)
T22 = c22*E2/100 #total running charges(Rs)
T2 = T21+T22 #total annual charges(Rs)
y11 = solve(T1-T2,y)[0]
#Result:
print "If the factory is run for more than",math.floor(y11),'days' #the ans. is different from that in book
print "then H. V. supply will be cheaper." #due to calculation using improper rounding.
```