# CHAPTER 50 : Tariffs and Economic Considerations¶

## EXAMPLE 50.1 , PAGE NO :- 1946¶

In :
'''Find the total annual charge on an installation costing Rs. 500,000 to buy and install, the estimated life being 30 years
and negligible scrap value. Interest is 4% compounded annually.'''

import math as m

Q = 5e+5        #(installation cost)
r = 0.04        #(rate of interest)

q = Q*(r/(1+r))/(m.pow(1+r,30) - 1)

#Hence, total annual charge on installation is
charge = r*Q + q        # (As P=Q)

print "Total annual charge on installation = Rs.",round(charge)

Total annual charge on installation = Rs. 28572.0


## EXAMPLE 50.2 , PAGE NO :- 1946¶

In :
'''A power plant having initial cost of Rs. 2.5 lakhs has an estimated salvage value of Rs. 30,000 at the end of its
useful life of 20 years. What will be the annual deposit necessary if it is calculated by :
(i) straight-line depreciation method.
(ii) sinking-fund method with compound interest at 7%.'''

import math as m

P = 250000.0       #Rs     (Initial investment)
Q = P - 30000.0      #Rs     (Replacement cost)
r = 0.07           #       (Interest rate)
n = 20.0             #       (Number of years)

#(i)straight-line depriciation method

#Annual depriciation
q= Q/n

deposit1 = r*P + q

#(ii)sinking fund method

#Annual depriciation
q= Q*(r/(1+r))/(m.pow(1+r,n) - 1)

deposit2 = r*P + q

print "Annual Deposit for Straight-line depriciation method = Rs.",round(deposit1)
print "Annual Deposit for Sink fund method = Rs.",round(deposit2)

Annual Deposit for Straight-line depriciation method = Rs. 28500.0
Annual Deposit for Sink fund method = Rs. 22515.0


## EXAMPLE 50.3 , PAGE NO :- 1947¶

In :
'''A plant initially costing Rs. 5 lakhs has an estimated salvage value of Rs. 1 lakh at the end of its useful life of 20 years.
What will be its valuation half-way through its life (a) on the basis of straight-line depreciation and
(b) on the sinking-fund basis at 8% compounded annually?'''

import math as m

P = 500000.0       #Rs     (Initial investment)
Q = P - 100000.0      #Rs     (Replacement cost)
r = 0.08           #       (Interest rate)
n = 20.0             #       (Number of years)

#(i)straight-line depriciation method

#Annual depriciation in 10 years
q= Q/2

#Value after 10 years
value1 = P - q

#(ii)sinking fund method

#Annual depriciation
q= Q*(r/(1+r))/(m.pow(1+r,n) - 1)

#Value after 10 years i.e n/2 years
value2 = P -  q*((1+r)/r)*(m.pow(1+r,n/2) - 1)

print "Annual Deposit for Straight-line depriciation method = Rs.",round(value1)
print "Annual Deposit for Sink fund method = Rs.",round(value2)

Annual Deposit for Straight-line depriciation method = Rs. 300000.0
Annual Deposit for Sink fund method = Rs. 373375.0


## EXAMPLE 50.4 , PAGE NO :- 1955¶

In :
'''A consumer has the following connected load : 10 lamps of 60 W each and two heaters of 1000 W each. His maximum demand is 1500 W.
On the average, he uses 8 lamps for 5 hours a day and each heater for 3 hours a day. Find his total load, montly energy

con_load = 10*60.0 + 2*1000.0     #W

#Daily energy consumption is
enrgy = 8*60.0*5 + 2*1000.0*3     #Wh

#Monthly energy consumption is
menrgy = enrgy*30.0/1000.0          #kWh

lf = menrgy*1000/(1500.0*24*30)

print "Monthly energy consumption =",menrgy ,"kWh"

Total connected load = 2600.0 W
Monthly energy consumption = 252.0 kWh


## EXAMPLE 50.5 , PAGE NO :- 1955¶

In :
'''The load survey of a small town gives the following categories of expected loads.
Type               Load in kW             % D.F.                   Group D.F.
1.    Residential lighting           1000                 60                         3
2.    Commercial lighting            300                  75                        1.5
3.    Street lighting                50                   100                       1.0
4.    Domestic power                 300                  50                        1.5
5.    Industrial power               1800                 55                        1.2
What should be the kVA capacity of the S/S assuming a station p.f. of 0.8 lagging ?'''

#Using Demand factor = Max demand/Connected load
#(i) Residential lighting
maxd1 = 1000.0*(60.0/100.0)        #kW    (Max demand)
grpd1 = maxd1/3.0                  #kW    (Max demand of group)

#(ii) Commercial lighting
maxd2 = 300.0*(75.0/100.0)        #kW    (Max demand)
grpd2 = maxd2/1.5                  #kW    (Max demand of group)

#(iii) Street lighting
maxd3 = 50.0*(100.0/100.0)        #kW    (Max demand)
grpd3 = maxd3/1.0                  #kW    (Max demand of group)

#(iv)  Domestic Power
maxd4 = 300.0*(50.0/100.0)        #kW    (Max demand)
grpd4 = maxd4/1.5                  #kW    (Max demand of group)

#(v)   Industrial Power
maxd5 = 1800.0*(55.0/100.0)        #kW    (Max demand)
grpd5 = maxd5/1.2                  #kW    (Max demand of group)

#Total maximum demand is
tot = grpd1 + grpd2 + grpd3 + grpd4 + grpd5    #kW

#KVA capacity of substation is
capacity = tot/0.8                  #kW

print "Capacity of substation = ",round(capacity),"kW"

Capacity of substation =  1656.0 kW


## EXAMPLE 50.6 , PAGE NO :- 1956¶

In :
'''A consumer has the following load-schedule for a day :
From midnight (12 p.m.) to 6 a.m. = 200 W ;
From 6 a.m. to 12 noon = 3000 W
From 12 noon to 1 p.m. = 100 W ;
From 1 p.m. to 4 p.m. = 4000 W
From 4 p.m. to 9 p.m. = 2000 W ;
From 9 p.m. to mid-night (12 p.m.) = 1000 W

If the tariff is 50 paisa per kW of max. demand plus 35 paisa per kWh, find the daily bill the consumer has to pay.'''

maxp = 4000.0    #W   (Maximum power)

#Total consumption is
enrgy = 6*200.0 + 6*3000.0 + 1*100.0 + 3*4000.0 + 5*2000.0 + 3*1000.0         #W

#Average power
pwer = enrgy/24       #kW

#Daily load factor = Average Power/Max Power
lf = pwer/maxp

#Max Demand charge.
charge1 = (maxp/1000)*0.5     #Rs

#Consumption charge
charge2 = (enrgy/1000)*0.35   #Rs

#Total Bill
bill = charge1 + charge2      #Rs

print "Daily bill of consumer = Rs",round(bill,1)

Load factor = 0.46
Daily bill of consumer = Rs 17.5


## EXAMPLE 50.7 , PAGE NO :- 1956¶

In :
'''A generating station has a connected load of 43,000 kW and a maximum demand of 20,000 kW, the units generated being
61,500,000 for the year. Calculate the load factor and demand factor for this case.'''

maxp = 20000.0                  #W      (Maximum Demand)
conn = 43000.0                  #W      (Connected load)

#Demand factor = Max demand/Connected load
df = maxp/conn

#Average power
pwer = 61500000/(365*24)            #W

#Load factor = Avg Power/Max Power
lf = pwer/maxp

print "Demand factor =",round(df,2)
print "Average Power =",round(pwer,2),"W."

Demand factor = 0.47
Average Power = 7020.0 W.


## EXAMPLE 50.8 , PAGE NO :- 1956¶

In :
'''A 100 MW power station delivers 100 MW for 2 hours, 50 MW for 6 hours and is shut down for the rest of each day.
It is also shut down for maintenance for 45 days each year.Calculate its annual load factor.'''

#Given
days = 365 - 45      #    (Operating days)
maxp = 100.0         #MW  (Maximum demand)

#Energy consumption in  a year
enrgy = (100.0*2 + 50.0*6)*days    #MWh

#Load factor = Total Energy Consumption/(Max demand*24*no of days)
lf = enrgy/(maxp*24*days)


load factor = 0.21


## EXAMPLE 50.9 , PAGE NO :- 1956¶

In :
'''Differentiate between fixed and running charges in the operation of a power company.
Calculate the cost per kWh delivered from the generating station whose

(i) capital cost = Rs. 10^6      ,     (ii) annual cost of fuel = Rs. 10^5      , (iii) wages and taxes = Rs. 5*10^5
(iv) maximum demand laod = 10,000 kW     ,      (v) rate of interest and depreciation = 10%    ,  (vi) annual load factor = 50%.
Total number of hours in a year is 8,760.'''

#Given
maxp = 10000.0       #kW     (Maximum demand)

#Total energy consumption

#Total Annual Charge
charge = (1.0e+5 + 5.0e+5) + (10.0e+5)*(10.0/100)   #Rs

#Cost per unit
cost = charge/enrgy*100.0      #paise
print "Cost per unit =",round(cost,2),"paise"

Cost per unit = 1.6 paise


## EXAMPLE 50.10 , PAGE NO :- 1957¶

In :
'''A new colony of 200 houses is being established, with each house having an average connected load of 2 kW. The business
centre of the colony will have a total connected load of 200 kW. Find the peak demand of the city sub-station given the
following data.
Demand factor        Group D.F.     Peak D.F.

#Given
dem_res = 0.5           #   (demand factor Residential load)
gf_res  = 3.2           #   (Group demand factor Residential load)
pk_res  = 1.5           #   (Peak demand factor Residential load)

#Demand factor = Max demand/Connected load

maxp_res = dem_res*2.0      #kW   (Max demand of each house)

#Group D.F  = Sum of individual max demand/Actual max demand   is
maxtot_res = (200*maxp_res)/gf_res       #kW   (Actual max demand)

#Peak D.F =  Max demand of consumer/Max demand during Peak time is
maxpeak_res = maxtot_res/pk_res          #kW   (Max demand during Peak time)

#Demand factor = Max demand/Connected load

maxp_bus = dem_bus*200.0     #kW   (Max demand of Commercial Load)

#Group D.F  = Sum of individual max demand/Actual max demand   is
maxtot_bus = maxp_bus/gf_bus       #kW   (Actual max demand)

#Peak D.F =  Max demand of consumer/Max demand during Peak time is
maxpeak_bus = maxtot_bus/pk_bus          #kW   (Max demand during Peak time)

#Total Max demand during Peak time
peaktot = maxpeak_bus + maxpeak_res       #kW

print "Peak demand of the city sub-station =",round(peaktot,2),"kW."

Peak demand of the city sub-station = 113.1 kW.


## EXAMPLE 50.11 , PAGE NO :- 1957¶

In :
'''In Fig. 50.6 is shown the distribution network from main sub-station. There are four feeders connected to each load centre
sub-station. The connected loads of different feeders and their maximum demands are as follows :
Feeder No.             Connected load, kW                Maximum Demand, kW
1.                            150                              125
2.                            150                              125
3.                            500                              350
4.                            750                              600
If the actual demand on each load centre is 1000 kW, what is the diversity factor on the feeders?If load centres B, C and D are
similar to A and the diversity factor between different load centres is 1.1, calculate the maximum demand of the main sub-station.
What would be the kVA capacity of the transformer required at the main sub-station if the overall p.f. at the main sub-station
is 0.8 ?'''

#Maximum Demands
fed1 = 125.0              #kW   (feeder 1)
fed2 = 125.0             #kW   (feeder 2)
fed3 = 350.0              #kW   (feeder 3)
fed4 = 600.0              #kW   (feeder 4)

#Diversity factor of feeders is
df_fed = (fed1 + fed2 + fed3 + fed4)/1000.0         #(df = Individual Max demand/Simultaneous Max demand)

#Simultaneous Max demand of  load centres  = Total Individual Max demand/D.F of load centres    is

#KVA capacity of transformer is
capacity = maxp/0.8                     #kW

print "Maximum demand of Substation =",round(maxp,2),"kW"
print "kVA capacity of transformer =",round(capacity,2),"kVA"

Maximum demand of Substation = 3636.36 kW
kVA capacity of transformer = 4545.45 kVA


## EXAMPLE 50.12 , PAGE NO :- 1958¶

In :
'''If a generating station had a maximum load for the year of 18,000 kW and a load factor of 30.5% and the maximum loads on
the sub-stations were 7,500, 5,000, 3,400, 4,600 and 2,800 kW, calculate the units generated for the year and the
diversity factor.'''

#Given
lf = 0.305                                     #    (load factor)
maxp = 18000.0                                 #kW  (Maximum demand)
sum_max = 7500.0+5000+3400+4600+2800.0         #kW  (Sum of individual max demand)

avg_pwer = lf*maxp        #kW

#Energy generated per year
enrgy = avg_pwer*8760     #kWh

#Diversity factor = Sum of Individual Max demand/Simultaneous Max demand
df = sum_max/maxp

print 'Units generated per year = %1.3e kWh' %enrgy
print "Diversity Factor =",round(df,2)

Units generated per year = 4.809e+07 kWh
Diversity Factor = 1.29


## EXAMPLE 50.13 , PAGE NO :- 1958¶

In :
'''A power station is supplying four regions of load whose peak loads are 10MW,5 MW, 8 MW and 7 MW. the diversity factor of the
load at the station is 1.5 and the average annual load factor is 60%. Calculate the maximum demand on the station and the annual
energy supplied from the station. Suggest the installed capacity and the number of units taking all aspects into account.'''

#Given
df = 1.5                   #     (diversity factor)
lf = 0.6                   #     (load factor)
sum_max = 10.0+5+8+7.0     #MW   (Sum of individual max. load)

#Max demand  is                           (Using Diversity factor =  Sum of individual max. demand/Simultaneous Max. demand)
maxdem = sum_max/df       #MW

#Total Energy consumption in a year is

#Considering 50% more for future use
install = maxdem*1.5      #MW   (installed capacity)

print "Maximum demand =",round(maxdem,2),"MW."
print "Annual energy supllied = %1.2e kWh" %enrgy
print "Installed capacity = %f MW . With 2 -- 10 MW generators and 2 -- 5 MW generators." %install

Maximum demand = 20.0 MW.
Annual energy supllied = 1.05e+08 kWh
Installed capacity = 30.000000 MW . With 2 -- 10 MW generators and 2 -- 5 MW generators.


## EXAMPLE 50.14 , PAGE NO :- 1959¶

In :
'''The capital cost of 30 MW generating station is Rs. 15*10^6. The annual expenses incurred on account of fuel, taxes,
salaries and maintenance amount to Rs. 1.25*10^6. The station operates at an annual load factor of 35%. Determine the
generating cost per unit delivered, assuming rate of interest 5% and rate of depreciation 6%.'''

#Given
lf = 0.35             #          (load factor)
maxp = 30.0*1000      #kW        (max power)
mntnce = 1.25e+6      #Rs        (maintainance cost)
cost = 15.0e+6        #Rs        (capital cost)

#Units produced per year

dep = 0.11*cost          #(Depriciation + Interest cost)

#Total cost per year
tot_cost = dep + mntnce  #Rs

#Cost per unit
cost_unit = tot_cost/units*100     #Paise/kWh

print "Generating cost per unit is",round(cost_unit,2),"paise."

Generating cost per unit is 3.15 paise.


## EXAMPLE 50.15 , PAGE NO :- 1959¶

In :
'''A generating plant has a maximum capacity of 100 kW and costs Rs.300,000.The fixed charges are 12% consisting of 5% interest,
5% depreciation and 2% taxes etc. Find the fixed charges per kWh generated if load factor is (i) 100% and (ii) 25%.'''

#Annual fixed charges are
charge1 = 300.0e+3*(12.0/100)       #Rs

#Number of kWh generated per year with 100% load factor are
units1 = 100.0*8760*1                #kWh

#Number of kWh generated per year with 25% load factor are
units2 = 100.0*8760*0.25             #kWh

#Fixed charges per unit is

cost1 = charge1/units1*100      #paise        (100% load factor)
cost2 = charge1/units2*100      #paise        (25% load factor)

print "Fixed charge(100% load factor) = ",round(cost1,2),"paise."
print "Fixed charge(25% load factor) =  ",round(cost2,2),"paise."

Fixed charge(100% load factor) =  4.11 paise.
Fixed charge(25% load factor) =   16.44 paise.


## EXAMPLE 50.16 , PAGE NO :- 1959¶

In :
'''The annual working cost of a thermal station is represented by the formula Rs. (a + b kW + c kWh) where a, b and c are constants
for that particular station, kW is the total installed capacity and kWh is the energy produced per annum.

Determine the values of a, b and c for a 100 MW station having annual load factor of 55% and for which
(i) capital cost of buildings and equipment is Rs. 90 million
(ii) the annual cost of fuel, oil,taxation and wages and salaries of operating staff is Rs. 1,20,000
(iii) interest and depreciation on buildings and equipment are 10% p.a.
(iv) annual cost of orginasation, interest on cost of site etc. is Rs. 80,000.'''

#Given
lf = 0.55         #     (load factor)
cap = 100.0e+3    #kW   (capacity of station)

#As a represents the fixed-cost,b semi-fixed cost and c the running cost.

a = 80000.0       #Rs       (Given)

#Now, b*kW minimum demand = semi-fixed cost
b = 90.0e+6/cap

#Total units generated per annum = (max demand in kW)*(load factor)*8760
units = cap*lf*8760      #kWh

# Now,  c*(no. of units) = 120000.0 . Therefore,
c = 120000.0/units

print "a =",round(a,2)
print "b = ",round(b,2)
print "c = ",round(c,5)

a = 80000.0
b =  900.0
c =  0.00025


## EXAMPLE 50.17 , PAGE NO :- 1960¶

In :
'''In a steam generating station, the relation between the water evaporated W kg and coal consumed C kg and power in kW
generated per 8-hour shift is as follows :
W = 28,000 + 5.4 kWh; C = 6000 + 0.9 kWh
What would be the limiting value of the water evaporated per kg of coal consumed as the station output increases ?
Also, calculate the amount of coal required per hour to keep the station running at no-load.'''

#For an 8-hour shift,Wt of water evaporated per kg of coal consumed is
# W/C =  28000 + 5.4kWh/6000 + 0.9kWh

#Limiting value will approach
lim = 5.4/0.9
print "Limiting value of water evaporated =",lim,"kg."

#Since at no load there is no generation of power
#Coal consumption per 8 hour shift is 6000.0 kg
#Coal consumption per hour on no-load is
cons = 6000.0/8
print "Coal consumption per hour on no-load is =",round(cons,2),"kg."

Limiting value of water evaporated = 6.0 kg.
Coal consumption per hour on no-load is = 750.0 kg.


## EXAMPLE 50.18 , PAGE NO :- 1960¶

In :
'''Estimate the generating cost per kWh delivered from a generating station from the following data :
Plant capacity = 50 MW ; annual load factor = 40%; capital cost = Rs. 3.60 crores; annual cost
of wages, taxation etc. = Rs. 4 lakhs; cost of fuel, lubrication, maintenance etc. = 2.0 paise per kWh
generated, interest 5% per annum, depreciation 5% per annum of initial value.'''

#Given
maxp = 50.0e+3          #kW    (Plant capacity)
lf = 0.4                  #      (load factor)

#Average power over a year is = Max. power * load factor

avg_p = maxp*lf           #kW

#Units produced per year
units = avg_p*8760        #kWh

#Depriciation + Interest    (5 + 5 = 10% of capital cost)
charge1 = (10.0/100)*3.60e+7   #Rs

#Annual wage and taxation
charge2 = 4.0e+5          #Rs

#Total cost/year =
tot_charge= charge1 + charge2   #Rs

#Cost per unit
cost = tot_charge/units*100         #paise

#Cost per kWh(unit) delivered = base cost + maintenance cost
tot_cost = cost + 2.0               #paise

print "Cost per kWh(unit) delivered =",round(tot_cost,2),"paise."

Cost per kWh(unit) delivered = 4.28 paise.


## EXAMPLE 50.19 , PAGE NO :- 1960¶

In :
'''The following data relate to a 1000 kW thermal station :
Cost of Plant = Rs. 1,200 per kW                              Interest, insurance and taxes = 5% p.a.
Depreciation = 5% p.a.                                        Cost of primary distribution system = Rs. 4,00,000
Interest, insurance, taxes and depreciaton = 5% p.a.          Cost of coal including transportation = Rs. 40 per tonne
Operating cost = Rs. 4,00,000 p.a.                            Plant maintenance cost : fixed = Rs. 20,000 p.a.
variable = Rs. 30,000 p.a.                                    Installed plant capacity = 10,000  kW
Maximum demand = 9,000 kW                                     Annual load factor = 60%
Consumption of coal = 25,300 tonne
Find the cost of power generation per kilowatt per year, the cost per kilowatt-hour generated
and the total cost of generation per kilowatt-hour. Transmission/primary distribution is chargeable
to generation.'''

#Given
maxp = 9000.0              #kW     (Maximum demand)
lf = 0.6                    #       (load factor)
#Fixed cost
costp = 400000.0            #Rs     (cost of primary distribution)
costplant = 1200.0*10000.0   #Rs     (Total cost of plant)
mntnce = 20000.0            #Rs     (Maintenance cost)

#Variable cost
fuel = 25300.0*40.0          #Rs     (fuel cost)
var_mntnce = 30000.0         #Rs     (variable maintenance cost)
op_cost = 400000.0           #Rs     (operating cost)

#Total fixed cost is
fixed = costplant*(10.0/100) + mntnce + costp*(5.0/100)  #Rs

#Total variable cost is
var = op_cost + fuel + var_mntnce                        #Rs

#Total cost is
cost_tot = fixed + var                                   #Rs

#Average demand (kWh) = Load factor * Max demand *(no. of hours in a year)
avg_p = lf*maxp*8760           #kWh

#Cost per kWh generated = Total annual cost/units produced in a year
cost = cost_tot/avg_p*100.0    #paise

#Since installed capacity is 10000.0 kW , cost per kW is
cost_kw = cost_tot/10000.0     #Rs

print "Cost per kWh generated = ",round(cost,2),"Paise."
print "Cost per kW is =",round(cost_kw,2),"Rs."

Cost per kWh generated =  5.67 Paise.
Cost per kW is = 268.2 Rs.


## EXAMPLE 50.20 , PAGE NO :- 1961¶

In :
'''Consumer has an annual consumption of 176,400 kWh. The charge is Rs. 120 per kW of maximum demand plus 4 paisa
per kWh.
(i) Find the annual bill and the overall cost per kWh if the load factor is 36%.
(ii) What is the overall cost per kWh, if the consumption were reduced 25% with the same load factor ?
(iii) What is the overall cost per kWh, if the load factor is 27% with the same consumption as in (i) '''

#Given
an_con = 176400.0           #kWh           (Annual consumption)
lf = 0.36                   #              (load factor)

###(i)###
#Average demand  = annual consumption/No of hours in a year is
avg_dem = an_con/8760       #kW

#Maximum demand = Avg demand/Load factor
maxp = avg_dem/lf           #kW

#Total bill = charge due to maximum demand + 4 paise per kWh
bill = maxp*120.0 + 0.04*an_con     #Rs

#Cost/kWh = annual bill/annual consumption(in kWh)
cost = bill/an_con*100              #paise

print "Annual Bill = ",round(bill),"Rs."
print "Cost/kWh  (i) = ",round(cost,2),"paise ."

###(ii)###
an_con = 176400.0 * (0.75)          #kWh           (Annual consumption is 75% only)
lf = 0.36                           #              (load factor)

#Average demand  = annual consumption/No of hours in a year is
avg_dem = an_con/8760       #kW

#Maximum demand = Avg demand/Load factor
maxp = avg_dem/lf           #kW

#Total bill = charge due to maximum demand + 4 paise per kWh
bill = maxp*120.0 + 0.04*an_con     #Rs

#Cost/kWh = annual bill/annual consumption(in kWh)
cost = bill/an_con*100              #paise

print "Cost/kWh (ii) = ",round(cost,2),"paise ."

###(iii)###
an_con = 176400.0                   #kWh           (Annual consumption)
lf = 0.27                           #              (changed load factor)

#Average demand  = annual consumption/No of hours in a year is
avg_dem = an_con/8760       #kW

#Maximum demand = Avg demand/Load factor
maxp = avg_dem/lf           #kW

#Total bill = charge due to maximum demand + 4 paise per kWh
bill = maxp*120.0 + 0.04*an_con     #Rs

#Cost/kWh = annual bill/annual consumption(in kWh)
cost = bill/an_con*100              #paise

print "Cost/kWh (iii)= ",round(cost,2),"paise ."

Annual Bill =  13768.0 Rs.
Cost/kWh  (i) =  7.81 paise .
Cost/kWh (ii) =  7.81 paise .
Cost/kWh (iii)=  9.07 paise .


## EXAMPLE 50.21 , PAGE NO :- 1964¶

In :
'''A power station has a load cycle as under :

260 MW for 6 hr    ; 200 MW for 8 hr     ; 160 MW for 4 hr     ; 100 MW for 6 hr
If the power station is equipped with 4 sets of 75 MW each, calculate the load factor and the
capacity factor from the above data. Calculate the daily fuel requirement if the calorific value of the
oil used were 10,000 kcal/kg and the average heat rate of the station were 2,860 kcal/kWh.'''

#Given
maxp = 260.0        #MW                 (Maximum demand)
heat = 2860.0       #kcal/kWh           (Heat rate of station)
cal = 100000.0       #kcal/kg            (calorific value)

#Energy consumed per day
enrgy = maxp*6 + 200.0*8 + 160.0*4 + 100.0*6             #MW

#Daily load factor = Energy consumed/Max demand*24 is
lf = enrgy/(maxp*24)

#Installed capacity is
cap = (75.0)*4                 #MW

#Capacity factor = Energy consumed/Installed capacity*24 is
cf = enrgy/(cap*24)

#Heat produced in station in kcal
heat_p = heat*enrgy*1000.0     #kcal

#Daily fuel requirement is
fuel = (heat_p/cal)/1000.0       #tonne

print "capacity factor =",round(cf,2)
print "daily fuel requirement =",round(fuel,2),"tonne."

load factor = 0.71
capacity factor = 0.61
daily fuel requirement = 125.84 tonne.


## EXAMPLE 50.22 , PAGE NO :- 1964¶

In :
'''A generating station has two 50 MW units each running for 8,500 hours in a year and one 30 MW unit running for
1,250 hours in one year. The station output is 650 * 10^6 kWh per year. Calculate
(i) station load factor, (ii) the utilization factor.'''

#Given

#Output of power station(Energy used)
enrgy = 650.0e+6           #kWh

#Maximum demand
maxp = 2*50.0 + 30.0       #MW
maxp = maxp*1000.0         #kW

#Total energy produced in kWh is
enrgy_pro = 2*(50.0e+3)*(8500.0) + (30.0e+3)*1250.0     #kWh

#Annual load factor  = Energy consumed/Max demand*8760 is
lf = enrgy/(maxp*8760)

#Utilization factor = Energy consumed/Energy produced
uf = enrgy/enrgy_pro

print "utilization factor =",round(uf,2)

load factor =  0.57
utilization factor = 0.73


## EXAMPLE 50.23 , PAGE NO :- 1965¶

In :
'''The yearly duration curve of a certain plant may be considered as a straight line from 40,000 kW to 8,000 kW.
To meet this load, three turbo-generators, two rated at 20,000 kW each and one at 10,000 kW are installed.
Determine (a) the installed capacity, (b) plant factor,(c) maximum demand, (d) load factor and (e) utilization factor.'''

#(a) Installed capacity is
cap = 2*20.0 + 10.0          #MW

#(b)plant factor

#Average demand
avg_dem = (40000.0 + 8000.0)/2  #kW

#Plant factor = Average demand/Installed capacity
pf = avg_dem/(cap*1000.0)

#(c) Maximum demand
maxp = 40000.0               #kW   (Given)

#(d)load factor = Avg demand/Max demand
lf = avg_dem/maxp

#(e)Utilization factor = Max demand/Plant capacity
uf = maxp/(cap*1000.0)

print "Installed Capacity = ",round(cap),"MW"
print "Plant factor = ",round(pf,2)
print "Maximum demand = ",maxp,"kW"
print "Utilization factor = ",round(uf,2)

Installed Capacity =  50.0 MW
Plant factor =  0.48
Maximum demand =  40000.0 kW
Utilization factor =  0.8


## EXAMPLE 50.24 , PAGE NO :- 1965¶

In :
'''The load duration curve of a system is as shown in Fig. 50.10. The system is
supplied by three stations; a steam station, a run-of-river station and a reservoir hydro-electric
station. The ratios of number of units supplied by the three stations are as below :
Steam       :     Run of river       :      Reservoir
7           :           4            :          1
The run-of-river station is capable of generating power continuosuly and works as a peak load
station. Estimate the maximum demand on each station and also the load factor of each station.'''

from sympy import Symbol,Eq,solve

#Let 100% time be 1 year = 8760 hours

#Area under curve is energy produced in a year
enrgy = (0.5*(160-80)*8760.0 + 80*8760.0)*1000.0        #kWh

#For the given ratio ,units supplied by each station is
steam = enrgy*(7.0/12)               #kWh           (Steam station)
runriv = enrgy*(4.0/12)              #kWh           (Run of river station)
reservoir = enrgy*(1.0/12)           #kWh           (Reservoir)

#Maximum demand of run of river is
max_ror =  runriv/(8760.0*1000.0)            #MW      (From figure)

#For Maximum demand of Reservoir,
x = Symbol('x')            #(As shown in figure)

#No of hours reservoir will work is
y = x/80*(8760)

#Area under the reservoir curve(Energy produced) is
area = 0.5*(y)*(x)*1000.0            #kWh

eq = Eq(area,reservoir)
x = solve(eq)
max_res =  x                               #MW
#Maximum demand of steam station is
max_steam = 160.0 - max_ror - max_res         #MW

#Run of River operates continously
lf_ror = 1.0
lf_res = reservoir/(max_res*1000*8760)
lf_steam = steam/(max_steam*1000*8760)

print "Maximum demand of Run of River = ",round(max_ror,2),"MW."
print "Maximum demand of Reservoir    = ",round(max_res,2),"MW."
print "Maximum demand of Steam        = ",round(max_steam,2),"MW."

print "Load factor(Run of river) = ",round(lf_ror,2)

Maximum demand of Run of River =  40.0 MW.
Maximum demand of Reservoir    =  40.0 MW.
Maximum demand of Steam        =  80.0 MW.
Load factor(Run of river) =  1.0


## EXAMPLE 50.25 , PAGE NO :- 1966¶

In :
'''A load having a maximum value of 150 MW can be supplied by either a hydroelectric plant or a steam power plant.
The costs are as follows :
Capital cost of steam plant             = Rs. 700 per kW installed
Capital cost of hydro-electric plant    = Rs. 1,600 per kW installed
Operating cost of steam plant           = Rs. 0.03 per kWh
Operating cost of hydro-electric plant  = Rs. 0.006 per kWh
Interest on capital cost 8 per cent. Calculate the minimum load factor above which the hydroelectric plant will be
more economical.'''

from sympy import Symbol,solve,Eq

#Given
maxp = 150.0e+3         #kW

#Let x be the total number of units generated per annum
x = Symbol('x')

##     Steam plant     ##

#Capital cost is
cap_stm = 700.0*(maxp)      #Rs
#Interest charges
charge1 = cap_stm*(8.0/100)     #Rs

#Fixed charge/unit
fxd_stm = charge1/x             #Rs

#Total cost per kWh for steam plant is
cost_stm = fxd_stm + 0.03       #Rs

##     Hydro-electric plant     ##

#Capital cost is
cap_hyd = 1600.0*(maxp)      #Rs
#Interest charges
charge1 = cap_hyd*(8.0/100)     #Rs

#Fixed charge/unit
fxd_hyd = charge1/x             #Rs

#Total cost per kWh for steam plant is
cost_hyd = fxd_hyd + 0.006       #Rs

#Let us find out x when both cost will be equal
eq = Eq(cost_hyd,cost_stm)
x = solve(eq)
x1 = x

#If units generated are more than x1 then cost of hydro-electricity will be cheaper

#Load factor = Energy produced/Max demand*8760

lf = x1/(maxp*8760)


Load factor = 0.34


## EXAMPLE 50.26 , PAGE NO :- 1967¶

In :
'''A power system having maximum demand of 100 MW has a load 30% and is to be supplied by either of the following schemes :
(a) a steam station in conjunction with a hydro-electric station, the latter supplying 100 * 10^6
units per annum with a max. output of 40 MW,
(b) a steam station capable of supply the whole load,
(c) a hydro station capable of supplying the whole load,
Compare the overall cost per unit generated assuming the following data :
Steam                       Hydro
Capital cost / kW                               Rs. 1,250                   Rs. 2,500
Interest and depreciation on the capital cost     12%                         10%
Operating cost/kWh                              5 paise                     1.5 paise
Transmission cost/kWh                           Negligible                  0.2 paise
Show how overall cost would be affected in case (ii) and (iii) above if the system load factor
were improved to 90 per cent.'''

#Average power consumption is
avg_pwr = 100.0*0.3*1000.0                  #kW

#Units generated in a year = Power*time(no of hours in a year)
units = avg_pwr*(8760)                      #kWh

#----------------------------------------------------------------------------------------------#
#(a)Steam station in conjunction with Hydro station

hyd_units = 100.0e+6                 #kWh     (units supplied by hydro station)
stm_units = units - hyd_units        #kWh     (units supplied by steam station)
hyd_max = 40.0e+3                    #kW      (max. output of Hydro station)
stm_max = 100.0e+3 - hyd_max         #kW      (max. output of Steam station)

#(i)Steam station
cap_cost = stm_max*(1250)            #Rs      (capital cost)
fxd_charge = (12.0/100)*cap_cost     #Rs      (fixed charge: interest & depreciation)
op_charge = (5.0/100)*stm_units      #Rs      (operating charge)
stm_cost = fxd_charge + op_charge    #Rs      (total steam charges)

#(ii)Hydro station
cap_cost = hyd_max*(2500)            #Rs      (capital cost)
fxd_charge = (10.0/100)*cap_cost     #Rs      (fixed charges: interest & depreciation)
op_charge = (1.5/100)*hyd_units      #Rs      (operating charges)
tr_charge = (0.2/100)*hyd_units      #Rs      (transmission charges)
hyd_cost = fxd_charge + op_charge + tr_charge    #Rs      (total hydro charges)

#Total cost
tot_cost = stm_cost + hyd_cost       #Rs      (total cost)
#Overal cost per kWh
cost_kwh = tot_cost/units*100        #paisa
print "Overall cost/kWh for (a) = ",round(cost_kwh,2),"paise."

#------------------------------------------------------------------------------------------------#
#(b)Steam station alone
stm_max = 100.0e+3                   #kW      (max. output of Steam station)
stm_units = units                    #kWh     (units supplied by Steam station)

cap_cost = stm_max*(1250)            #Rs      (capital cost)
fxd_charge = (12.0/100)*cap_cost     #Rs      (fixed charge: interest & depreciation)
op_charge = (5.0/100)*stm_units      #Rs      (operating charge)
stm_cost = fxd_charge + op_charge    #Rs      (total steam charges)
stm_fxdkWh = fxd_charge/stm_units*100#paise   (fixed charge per unit)
#Overal cost per kWh
cost_kwh = stm_cost/stm_units*100        #paisa
print "Overall cost/kWh for (b) = ",round(cost_kwh,2),"paise."

#------------------------------------------------------------------------------------------------#
#(c)Hydro station alone
hyd_max = 100.0e+3                   #kW      (max. output of Hydro station)
hyd_units = units                    #kWh     (units supplied by Hydro station)

cap_cost = hyd_max*(2500)            #Rs      (capital cost)
fxd_charge = (10.0/100)*cap_cost     #Rs      (fixed charges: interest & depreciation)
op_charge = (1.5/100)*hyd_units      #Rs      (operating charges)
tr_charge = (0.2/100)*hyd_units      #Rs      (transmission charges)
hyd_cost = fxd_charge + op_charge + tr_charge    #Rs      (total hydro charges)
hyd_fxdkWh = fxd_charge/hyd_units*100#paise   (fixed charge per unit)
#Overall cost per kWh
cost_kwh = hyd_cost/hyd_units*100        #paisa
print "Overall cost/kWh for (c) = ",round(cost_kwh,2),"paise."

#-------------------------------------------------------------------------------------------------#
#(d)As load factor is made 3 times. No. of units generated are 3 times and therefore fixed price
#decrease to 1/3 times the previous price

#(i)Steam station
cost_kwh = stm_fxdkWh/3 + 5.0    #paise      (new total steam cost per kWh)
print "Overall cost/kWh for steam station with 90% load factor = ",round(cost_kwh,2),"paise."
#(ii)Hydro station
cost_kwh = hyd_fxdkWh/3  + 1.5 + 0.2   #paise      (new total hydro cost per kWh)
print "Overall cost/kWh for steam station with 90% load factor = ",round(cost_kwh,2),"paise."

Overall cost/kWh for (a) =  10.97 paise.
Overall cost/kWh for (b) =  10.71 paise.
Overall cost/kWh for (c) =  11.21 paise.
Overall cost/kWh for steam station with 90% load factor =  6.9 paise.
Overall cost/kWh for steam station with 90% load factor =  4.87 paise.


## EXAMPLE 50.27 , PAGE NO :- 1969¶

In :
'''The capital cost of a hydro-power station of 50,000 kW capacity is Rs. 1,200 per kW. The annual charge on investment
including depreciation etc. is 10%. A royality of Rs. 1 per kW per year and Rs. 0.01 per kWh generated is to be paid for
using the river water for generation of power. The maximum demand is 40,000 kW and the yearly load factor is 80%.
Salaries,maintenance charges and supplies etc. total Rs. 6,50,000. If 20% of this expense is also chargeable
as fixed charges, determine the generation cost in the form of A per kW plus B per kWh.'''

maxp = 40000.0         #kW       (Maximum demand)
#Capital cost of station = Cost/kW *(Capacity of plant in kW)
cap_cost = 1200.0*50000.0                #Rs

#Annual charge on investment includin depriciation
anl_charge = (10.0/100)*cap_cost         #Rs

#Total running charge
run_charge = (80.0/100)*650000.0         #Rs

#Fixed charges
fxd_charge = (20.0/100)*650000.0         #Rs

#Cost per Max demand kW due to fixed charge is
cost_md1 = (anl_charge + fxd_charge)/maxp               #Rs
#Cost per Max demand kW due to royalty is
cost_md2 = 1.0                           #Rs
#Total Cost per Max demand kW is
cost_md = cost_md1 + cost_md2            #Rs

#Total number of unit generated per annum = Max demand*load factor*(No of hours)
units = maxp*0.8*8760                    #kWh

#Cost per unit due to running charges
cost_unit = run_charge/units             #Rs
#Royalty cost
cost_roy = 0.01                          #Rs
#Total cost per unit is
cost_tot = cost_unit + cost_roy          #Rs

print "Generation cost is = Rs (",round(cost_md,2),"kW + ",round(cost_tot,4),")kWh."

Generation cost is = Rs ( 154.25 kW +  0.0119 )kWh.


## EXAMPLE 50.28 , PAGE NO :- 1969¶

In :
'''The capital costs of steam and water power stations are Rs. 1,200 and Rs. 2,100 per kW of the installed capacity.
The corresponding running costs are 5 paise and 3.2 paise per kWh respectively.The reserve capacity in the case of the
steam station is to be 25% and that for the water power station is to be 33.33% of the installed capacity.At what
load factor would the overall cost per kWh be the same in both cases ? Assume interest and depreciation charges
on the capital to be 9% for the thermal and 7.5% for the hydro-electric station. What would be the cost of generating
500 million kWh at this load factor ? '''

from sympy import Symbol,Eq,solve

#Let x be the maximum demand in kWh and y the load factor
x = Symbol('x')
y = Symbol('y')
#Total number of units produced
units = x*y*8760.0                #kWh

######         Steam station        ######

#Installed capacity
capacity = 1.25*x                #kW  (including reserve capacity)
#Capital cost
cap_cost = capacity*1200.0        #Rs
#Annual depreciation
anl_charge = (9.0/100)*cap_cost   #Rs
#Annual running cost
run_charge = (8760*x*y)*(5.0/100) #Rs
#Total annual cost
cost_stm = run_charge + anl_charge
#Total cost/unit
stmcost_unt = cost_stm/units

######         Hydro station       ######

#Installed capacity
capacity = 1.33*x                #kW  (including reserve capacity)
#Capital cost
cap_cost = capacity*2100.0        #Rs
#Annual depreciation
anl_charge = (7.5/100)*cap_cost   #Rs
#Annual running cost
run_charge = (8760*x*y)*(3.2/100) #Rs
#Total annual cost
cost_hyd = run_charge + anl_charge    #Rs
#Total cost/unit
hydcost_unt = cost_hyd/units         #Rs

#To solve we will assume a value of x
x = 10
eq = Eq(hydcost_unt,stmcost_unt)
y  = solve(eq)
y1 = y
for key in y1:
y1 = y1.get(key);
#Maximum demand is
x = 500.0e+6/(8760.0*y1)          #kW

#Calculating cost
capacity = 1.25*x
cap_cost = capacity*1200.0
anl_charge = (9.0/100)*cap_cost
run_charge = (8760*x*y1)*(5.0/100)
cost_stm = run_charge + anl_charge        #Rs
print "generating cost = Rs.",round(cost_stm,-1)

load factor = 0.472
generating cost = Rs. 41314200.0


## EXAMPLE 50.29 , PAGE NO :- 1970¶

In :
'''In a particular area, both steam and hydro-stations are equally possible. It has been estimated that capital cost and the running
costs of these two types will be as follows:
Capital cost/kW            Running cost/kWh             Interest
Hydro :      Rs. 2,200                   1 Paise                     5%
Steam :      Rs. 1,200                   5 Paise                     5%
If expected average load factor is only 10%, which is economical to operate : steam or hydro?
If the load factor is 50%, would there be any change in the choice ? If so, indicate with calculation.'''

from sympy import Symbol

#Let x be the capacity of power station in kW.
x = Symbol('x')
#------------------------------------------------------------------------#
#Case I :-   Load factor = 10%
lf1 = 0.1
#Total units generated per annum
units = x*lf1*(8760)                          #kWh

#(a) Hydro Station
#--------------------------------#
cap_cost = 2200.0*x                           #Rs        (Capital cost)
fxd_charge = (5.0/100)*cap_cost               #Rs        (Fixed cost)
run_charge = (1.0/100)*units                  #Rs        (Running cost  ->   given, 1 unit costs 1 paisa)
tot_charge = fxd_charge + run_charge          #Rs        (Total charge)
hyd_costkwh = tot_charge/units*100               #paise     (Cost per kWh)

#(b) Steam Station
#--------------------------------#
cap_cost = 1200.0*x                           #Rs        (Capital cost)
fxd_charge = (5.0/100)*cap_cost               #Rs        (Fixed cost)
run_charge = (5.0/100)*units                  #Rs        (Running cost  ->   given, 1 unit costs 5 paisa)
tot_charge = fxd_charge + run_charge          #Rs        (Total charge)
stm_costkwh = tot_charge/units*100               #paise     (Cost per kWh)

print "Hydro cost/kWh =",round(hyd_costkwh,2),"paise."
print "Steam cost/kWh =",round(stm_costkwh,2),"paise."

if (hyd_costkwh >= stm_costkwh) :
print "Steam is economical for lf =",round(lf1,2)
else:
print "Hydro is economical for lf =",round(lf1,2)

#-----------------------------------------------------------------------------------------------------------#

#Case II :-   Load factor = 50%
lf2 = 0.5
#Total units generated per annum
units = x*lf2*(8760)                          #kWh

#(a) Hydro Station
#--------------------------------#
cap_cost = 2200.0*x                           #Rs        (Capital cost)
fxd_charge = (5.0/100)*cap_cost               #Rs        (Fixed cost)
run_charge = (1.0/100)*units                  #Rs        (Running cost  ->   given, 1 unit costs 1 paisa)
tot_charge = fxd_charge + run_charge          #Rs        (Total charge)
hyd_costkwh = tot_charge/units*100               #paise     (Cost per kWh)

#(b) Steam Station
#--------------------------------#
cap_cost = 1200.0*x                           #Rs        (Capital cost)
fxd_charge = (5.0/100)*cap_cost               #Rs        (Fixed cost)
run_charge = (5.0/100)*units                  #Rs        (Running cost  ->   given, 1 unit costs 5 paisa)
tot_charge = fxd_charge + run_charge          #Rs        (Total charge)
stm_costkwh = tot_charge/units*100               #paise     (Cost per kWh)

print "Hydro cost/kWh =",round(hyd_costkwh,2),"paise."
print "Steam cost/kWh =",round(stm_costkwh,2),"paise."

if (hyd_costkwh >= stm_costkwh) :
print "Steam is economical for lf =",round(lf2,2)
else:
print "Hydro is economical for lf =",round(lf2,2)

Hydro cost/kWh = 13.56 paise.
Steam cost/kWh = 11.85 paise.
Steam is economical for lf = 0.1
Hydro cost/kWh = 3.51 paise.
Steam cost/kWh = 6.37 paise.
Hydro is economical for lf = 0.5


## EXAMPLE 50.30 , PAGE NO :- 1971¶

In :
'''The annual working cost of a thermal station can be represented by a formula Rs. (a + b kW + c kWh) where a, b and c
are constants for a particular station, kW is the total installed capactiy and kWh the energy produced per annum.
Explain the significance of the constants a, b and c and the factors on which their values depend.
Determine the values of a, b and c for a 60 MW station operating with annual load factor of 40% for which :
(i) capital cost of buildings and equipment is Rs. 5 * 10^5
(ii) the annual cost of fuel, oil, taxation and wages and salaries of operating staff is Rs.90,000
(iii) the interest and depreciation on buildings and equipment are 10% per annum
(iv) annual cost of organisation and interest on cost of site etc. is Rs. 50,000.'''

#Constant a is fixed cost i.e annual ineterest cost
a = 50000.0

#Constand b is semi-fixed cost such that
#b*(Max demand in kW) = annual interest on capital cost
b = 0.1*5.0e+5/(60.0e+3)

#Constant c is running cost such that
#c*(units in kWh) = annual fuel cost etc.

avg_pwr = 0.5*(60.0e+3)         #kW      (Average power)
units = avg_pwr*8760.0          #kWh     (No of units produced)
c = 90000.0/units
print "a =",a
print "b =",round(b,3)
print "c =",round(c,6)

a = 50000.0
b = 0.833
c = 0.000342


## EXAMPLE 50.31 , PAGE NO :- 1972¶

In :
'''Compute the cost of electrical energy and average cost for consuming 375 kWh under ' block rate tariff ' as under :
First 50 kWh at 60 paisa per kWh ; next 50 kWh at 50 paisa per kWh; next 50 kWh at 40 paisa per kWh; next 50 kWh at 30 paisa per kWh.
Excess over 200 kWh at 25 paisa per kWh.'''

#Energy charge for first 50 kWh is
cost1 = 0.6*50.0         #Rs
#Energy charge for next 50 kWh is
cost2 = 0.5*50.0         #Rs
#Energy charge for next 50 kWh is
cost3 = 0.4*50.0         #Rs
#Energy charge for next 50 kWh is
cost4 = 0.3*50.0         #Rs
#Energy charge for the rest (375-200) kWh is
cost5 = 0.25*(375.0 - 200.0)        #Rs
#Total cost is
tot_cost = cost1 + cost2 + cost3 + cost4 + cost5       #Rs

#Cost/kWh = Total cost/No of units
cost_unit = tot_cost/375.0 * 100         #paisa

print "Total cost =",round(tot_cost,2),"Rs"
print "Cost per unit(kWh) is = ",round(cost_unit,2),"paise"

Total cost = 133.75 Rs
Cost per unit(kWh) is =  35.67 paise


## EXAMPLE 50.32 , PAGE NO :- 1972¶

In :
'''The output of a generating station is 390 * 10^6 units per annum and installed capacity is 80,000 kW. If the annual fixed
charges are Rs. 18 per kW of isntalled plant and running charges are 5 paisa per kWh, what is the cost per unit at the generating
station ?'''

#Given
cap = 80000.0            #kW        (installed capacity)
units = 390.0e+6         #kWh       (no of units produced)

#Annual Fixed charge is
anl_charge = cap*18.0        #Rs

#Fixed charge per kW is
fxd_charge = anl_charge/units*100    #paise

#Running charges per kW is
run_charge = 5.0                     #paise

#Cost of generating  station  is
gen_cost = run_charge + fxd_charge   #paise

print "Cost of generating is = ",round(gen_cost,2),"paise."

Cost of generating is =  5.37 paise.


## EXAMPLE 50.33 , PAGE NO :- 1973¶

In :
'''A power station has an installed capacity of 20 MW. The capital cost of station
is Rs. 800 per kW. The fixed costs are 13% of the cost of investment. On full-load at 100% load factor,
the variable costs of the station per year are 1.5 times the fixed cost. Assume no reserve capacity and
variable cost to be proportional to the energy produced, find the cost of generation per kWh at load
factors of 100% and 20%. Comment on the results.'''

#Given
capacity = 20000.0       #kW    (installed capacity)
lf1 = 1.0                #      (load factor 1)
lf2 = 0.2                #      (load factor 2)

#Capital cost of station is
cap_cost = capacity*(800.0)           #Rs

fxd_cost = (13.0/100)*cap_cost        #Rs     (fixed cost)
var_cost = 1.5*fxd_cost               #Rs     (variable cost)

#Total operating cost is
tot_cost = fxd_cost + var_cost        #Rs

#Total no. of units generated  = (Max.demand*8760)*(load factor)
units = capacity*8760*lf1             #kWh
#Cost of unit per kWh generated is
cost_kwh = tot_cost/units*100         #paise

#error in the answer of book
print "Cost of generation per kWh(load factor 100%) = ",round(cost_kwh,2),"paise."

fxd_cost = (13.0/100)*cap_cost        #Rs     (fixed cost)
#Since variable cost is propotional to load
var_cost = 0.2*(1.5*fxd_cost)         #Rs     (variable cost)

#Total operating cost is
tot_cost = fxd_cost + var_cost        #Rs

#Total no. of units generated  = (Max.demand*8760)*(load factor)
units = capacity*8760*lf2            #kWh
#Cost of unit per kWh generated is
cost_kwh = tot_cost/units*100         #paise

print "Cost of generation per kWh(load factor 100%) = ",round(cost_kwh,2),"paise."

Cost of generation per kWh(load factor 100%) =  2.97 paise.
Cost of generation per kWh(load factor 100%) =  7.72 paise.


## EXAMPLE 50.34 , PAGE NO :- 1973¶

In :
'''The annual output of a generating sub-station is 525.6 * 10^6 kWh and the average load factor is 60%. If annual fixed charges are
Rs. 20 per kW installed plant and the annual running charges are 1 paisa per kWh, what would be the cost per kWh at the bus bars ?'''

#Given
enrgy = 525.6e+6         #kWh      (Energy produced)
lf = 0.6                 #         (Load factor)

#Average power supplied per annum = Energy produced/(No of hours in a year)
avg_pwr = enrgy/8760               #kW
#Maximum demand = average power/load factor is
maxp = avg_pwr/lf       #kW

#Annual fixed charges
charge = 20.0*maxp          #Rs

#Fixed charge/kWh
fxd_charge = charge/enrgy*100  #paise

#Running charge/kWh
run_charge = 1.0              #paise

#Annual running charge/kWh is
cost = fxd_charge + run_charge  #paise
print "Annual running charge/kWh is = ",round(cost,2),"paise."

Annual running charge/kWh is =  1.38 paise.


## EXAMPLE 50.35 , PAGE NO :- 1974¶

In :
'''A certain factory working 24 hours a day is charged at Rs. 10 per kVA of max.demand plus 5 paisa per kV ARh. The meters record
for a month of 30 days; 135,200 kWh, 180,020 kV ARh and maximum demand 310 kW. Calculate
(i) M.D. charges,        (ii) monthly bill,         (iii) load factor,        (iv) average power factor.'''

import math as m

#Given
act_nrgy = 135200.0                      #kWh       (Active energy consumed in a month)
re_nrgy = 180020.0                       #kVARh     (Reactive energy consumed in a month)
maxp = 310.0                             #kW        (Maximum demand)

#Average power
avgact_pwr = act_nrgy/(24*30)               #kW     (Active)
avgre_pwr = re_nrgy/(24*30)                 #kVAR   (Reactive)
#Now, tan(theta) = kVAR/kW
theta = m.atan(avgre_pwr/avgact_pwr)

#Maximum demand in kVA is
md_kva = maxp/(m.cos(theta))

#(i)Maximum demand charge is
md_charge = md_kva*10.0             #Rs

#(ii)Monthly bill
#Reactive energy charges
re_charge = (5.0/100)*re_nrgy       #Rs
mon_bill = re_charge + md_charge    #Rs   (Monthly bill)

#(iii)Load factor = Avg Demand/Max demand is
lf = avgact_pwr/maxp

#(iv)Average power factor
pf = m.cos(theta)

print "M.D charges = Rs.",round(md_charge)
print "Monthly Bill = Rs.",round(mon_bill)
print "Power factor = ",round(pf,2)

M.D charges = Rs. 5162.0
Monthly Bill = Rs. 14163.0
Power factor =  0.6


## EXAMPLE 50.36 , PAGE NO :- 1974¶

In :
'''The cost data of a power supply company is as follows :
Station maximum demand = 50 MW ;      station load factor = 60% ;    Reserve capacity = 20% ; capital cost = Rs. 2,000 per kW;
interest and depreciation = 12% ;     salaries (annual) = Rs. 5 × 105;   fuel cost (annual) = Rs. 5 × 106 ;
maintenance and repairs (annual) Rs. 2 × 105 ;      losses indistribution = 8% ;    load diversity factor = 1.7.
Calculate the average cost per unit and the two-part tariff, assuming 80 per cent of salaries and repair and maintenace cost
to be fixed.'''

#Station capacity
stn_cap = (1 + 20.0/100)*50                        #MW
#Average power
avg_pwr = stn_cap * 0.6*1000                       #kW
#Capital investment
cap_inv =   stn_cap*1000 * 2000                    #Rs
#Interest + depreciation cost
charge1=  0.12*cap_inv                             #Rs
#Total cost both fixed and running
cost_tot= charge1 + 5.0e+5 + 5e+6 + 2e+5           #Rs
#No. of units generated annually
units = 8760*avg_pwr
#overall cost/unit
cost_uni = cost_tot/units*100                      #Paise.
print "overall cost/unit = ",round(cost_uni,2),"Paise."
#----------------------------------------------------------------------------------------------#
#Fixed charges
#Annual interest and depreciation
charge1 = charge1
#80% of salaries
charge2 = 0.8 * 5e+5                                #Rs
#80% of repair and maintenance cost
charge3 = 0.8 * 2e+5                                #Rs
#Total fixed charges                                #Rs
charge_tot = charge1 + charge2 + charge3            #Rs
#Aggregate maximum demand of all consumers = Max. demand on generating station * diversity factor
max_dem = 60*1000*1.7                               #kW
#annual cost/kW of maximum demand
cost =  charge_tot/max_dem                          #Rs

#-----------------------------------------------------------------------------------------------#
#Running Charges
#Cost of fuel
charge1 = 50e+5
#20% of salaries
charge2 = 0.2 * 5e+5                                #Rs
#20% of repair and maintenance cost
charge3 = 0.2 * 2e+5                                #Rs
#Total running charges
charge_run =  charge1 + charge2 + charge3           #Rs
#Cost per unit delivered (considering 8% losses)
cost_uni = charge_run/(0.92*units)*100              #Paise
print "Two-part tariff = Rs",round(cost,2),"per kW + ",round(cost_uni,2),"paise per kWh."

overall cost/unit =  6.37 Paise.
Two-part tariff = Rs 146.67 per kW +  1.77 paise per kWh.


## EXAMPLE 50.37 , PAGE NO :- 1975¶

In :
'''A certain electric supply undertaking having a maximum demand of 110 MW generates 400 * 10^6 kWh per year.The supply
undertaking supplies power to consumers having an aggregate demand of 170 MW. The annual expenses including capital charges are :
Fuel                                     = Rs. 5 * 10^6
Fixed expenses connected with generation = Rs. 7 * 10^6
Transmission and distribution expenses   = Rs. 8 * 10^6
Determine a two-part tariff for the consumers on the basis of actual cost.
Assume 90% of the fuel cost as variable charges and transmission and distrbution losses as 15% of energy generated.'''

#Given
maxp  = 170.0e+3           #kW        (Maximum demand)
units = 400.0e+6           #kWh       (Number of units generated)
fxd_charge = 7.0e+6        #Rs        (Fixed charges)
tr_charge = 8.0e+6         #Rs        (Transmission and distribution charges)
fuel_charge = (10.0/100)*5.0e+6                    #Rs
#Total cost
tot_charge = fxd_charge + tr_charge + fuel_charge  #Rs
#Cost per kW of Max. demand
cost_kw = tot_charge/maxp                       #Rs

#Running charges = 90% of fuel cost
run_charge = (90.0/100)*5.0e+6                  #Rs
#Units consumed after losses
units_con = (1 - 15.0/100)*units                #kWh
#Cost per kWh of energy
cost_kwh = run_charge/units_con*100             #Paise

print "Two-part tariff = Rs.",round(cost_kw,2),"kW + Paise.",round(cost_kwh,2),"kWh"

Two-part tariff = Rs. 91.18 kW + Paise. 1.32 kWh


## EXAMPLE 50.38 , PAGE NO :- 1975¶

In :
'''Customer is offered power at Rs. 80 per annum per kVA of maximum demand plus 8 paisa per unit metered.
He proposes to install a motor to carry his estimated maximum demand of 300 b.h.p. (223.8 kW). The motor available has a power
factor of 0.85 at full-load. How many units will he require at 20% load factor and what willl be his annual bill ? '''

#Given
mot_eff = 90.0/100                #           (motor efficiency)
maxp = 223.8/mot_eff              #kW         (full-load power intake)
lf = 0.2                          #           (load factor)

#Avg demand = Max demand * Load factor
avg_dem = maxp*lf                 #kW
#Annual consumption is
units = avg_dem*8760               #kWh
#Cost of units consumed per annum
cost1 = units*(8.0/100)            #Rs

#Maximum kVA of demand is
max_kva = maxp/0.85               #kVA
#Cost per kVA of Maximum demand is
cost2 = max_kva*(80.0)             #Rs

#Total annual bill is
tot_cost = cost1 + cost2
print "Total annual bill is = Rs.",round(tot_cost)

Total annual bill is = Rs. 58257.0


## EXAMPLE 50.39 , PAGE NO :- 1975¶

In :
'''How two-part tariff is modified for penalising low p.f. consumers ?
An industry consumes 4 million kWh/year with a maximum demand of 1000 kW at 0.8 p.f. What is its load factor ?
(a) Calculate the annual energy charges if tariff in force is as under :
Max. demand charge = Rs. 5 per kVA per month. Energy charges = Rs. 0.35 per kWh
(b) Also calculate reduction in this bill if the maximum demand is reduced to 900 kW at 0.9 p.f. lagging.'''

#Given
units = 4.0e+6            #kWh          (No. of units generated)
maxp = 1000.0             #kW           (Maximum demand)
avg_dem = units/8760      #kW           (Average demand)

#Load factor = Avg demand/Max demand
lf = avg_dem/maxp
#Max kVA demand is
max_kVA = maxp/0.8           #kVA
#--------------------------------------------#
#(a)
#Charge per kVA is
charge = 5.0*12              #Rs
#Annual charge per kVA is
cost1 = charge*max_kVA       #Rs
#Annual charge per unit is
cost2 = 0.35*units           #Rs
#Total energy bill is
tot_bill  = cost1 + cost2    #Rs
print "Annual energy bill = Rs.",tot_bill
#--------------------------------------------#
#(b)
maxp = 900.0                 #kW        (New Maximum demand)
avg_dem = maxp*lf           #kW
#No of units generated in a year are
units = avg_dem*8760        #kWh

#Max kVA demand is
max_kVA = maxp/0.9           #kVA
#Annual charge per kVA is
cost1 = charge*max_kVA       #Rs
#Annual charge per unit is
cost2 = 0.35*units           #Rs
#Total energy bill is
tot_bill2  = cost1 + cost2    #Rs
#Total savings
savings = tot_bill - tot_bill2  #Rs
print "Annual savings = Rs.",savings

Annual energy bill = Rs. 1475000.0
Annual savings = Rs. 155000.0


## EXAMPLE 50.40 , PAGE NO :- 1976¶

In :
'''A supply is offered on the basis of fixed charges of Rs. 30 per annum plus 3 paise per unit or alternatively,
at the rate of 6 paisa per unit for the first 400 units per annum and 5 paise per unit for all the additional units.
Find the number of units taken per annum for which the cost under these two tariffs becomes the same.'''

from sympy import Symbol,Eq,solve
#Let x kWh be the annual consumption of the consumer
x = Symbol('x')

#Cost under tariff 1
cost1 = 30.0 + (3.0/100)*x                      #Rs
#Cost under tariff 2
cost2 = (6.0/100)*400.0 + (5.0/100)*(x-400.0)   #Rs

#Since charge in both cases are equal
eq = Eq(cost1,cost2)
x = solve(eq)
x1 = x
print "Number of units taken per annum = ",round(x1,2),"kWh."

Number of units taken per annum =  1300.0 kWh.


## EXAMPLE 50.41 , PAGE NO :- 1976¶

In :
'''If power is charged for at the rate of Rs. 75 per kVA of maximum demand and 4 paisa per unit, what is the cost per unit at
25% yearly load factor (a) for unity power factor demand and (b) for 0.7 power factor demand.'''

#Given
lf = 0.25                #      (load factor)
charge = 75.0            #Rs    (Cost per kVA of max. demand)

#(a) At unity power factor
#Max. demand charge per unit
cost1 = charge/(8760*0.25)*100        #paise
#Cost per unit
tot_cost = cost1 + 4.0                #paise
print "Cost per unit at unity p.f = ",round(tot_cost,2),"paise"

#(b) At 0.7 power factor
#Max. demand charge per unit
cost2 = charge/(8760*0.25*0.7)*100        #paise
#Cost per unit
tot_cost = cost2 + 4.0                #paise
print "Cost per unit at 0.7 p.f = ",round(tot_cost,2),"paise"

Cost per unit at unity p.f =  7.42 paise
Cost per unit at 0.7 p.f =  8.89 paise


## EXAMPLE 50.42 , PAGE NO :- 1976¶

In :
'''Explain different methods of tariff. A tariff in force is Rs. 50 per kVA of max. demand per year plus 10 p per kWh.
A consumer has a max. demand of 10 kW with a load factor of 60% and p.f. 0.8 lag.
(i)  Calculate saving in his annual bill if he improves p.f. to 0.9 lag.
(ii) Show the effect of improving load factor to 80% with the same max. demand and p.f. 0.8 lag
on the total cost per kWh.'''

#Given
maxp = 10.0         #kW      (Maximum demand)

#(i)
max_kva = maxp/0.8  #kVA     (Maximum demand in kVA)
#Maximum demand charges
charge1 = max_kva*(50.0)          #Rs

max_kva2 = maxp/0.9 #kVA     (Maximum demand in kVA at 0.9 pf)
#Maximum demand charges
charge2 = max_kva2*(50.0)          #Rs

#Since energy consumed is same,savings is due to reduction in M.D charges
savings = charge1 - charge2        #Rs
print "Total savings in annual bill = Rs. ",round(savings,2)
#------------------------------------------------------------------------------------------------------#
#(ii)
#Avg demand = Max. demand * load factor
avg_dem = maxp*lf                  #kW
#No. of units consumed
units = avg_dem*8760               #kWh
#M.D charge per unit consumed
md_unit = charge1/units*100.0      #Paise
#Total charges
tot_cost1 = 10.0 + md_unit          #paise

print "Total cost per unit at 0.6 load factor = ",round(tot_cost1,2),"paise."

#Avg demand = Max. demand * load factor
avg_dem = maxp*lf                  #kW
#No. of units consumed
units = avg_dem*8760               #kWh
#M.D charge per unit consumed
md_unit = charge1/units*100.0      #Paise
#Total charges
tot_cost2 = 10.0 + md_unit          #paise

print "Total cost per unit at 0.8 load factor = ",round(tot_cost2,2),"paise."

if (tot_cost1 > tot_cost2):
print "Cost per unit is reduced with increase in lf."
else:
print "Cost per unit is increase with increase in lf."

Total savings in annual bill = Rs.  69.44
Total cost per unit at 0.6 load factor =  11.19 paise.
Total cost per unit at 0.8 load factor =  10.89 paise.
Cost per unit is reduced with increase in lf.


## EXAMPLE 50.43 , PAGE NO :- 1977¶

In :
'''A consumer has a maximum demand (M.D.) of 20 kW at 0.8 p.f. lagging and an annual load factor of 60%. There are two
alternative tariffs (i) Rs. 200 per kVA of M.D. plus 3p per kWh consumed and (ii) Rs. 50 per kVA of M.D. plus 7p per kWh
consumed. Determine which of the tariffs will be economical for him.'''

#Given
maxp = 20.0        #kW             (Maximum demand)
lf = 0.6           #               (load factor)

#Maximum demand in kVA
max_kva = maxp/0.8      #kVA
#Average power = Max. demand * load factor
avg_pwr = maxp*lf       #kW
#Energy consumed in a year
units = avg_pwr*8760        #kWh
#(a)
charge1 = 200.0*max_kva     #Rs      (Max. demand charge)
charge2 = (3.0/100)*units   #Rs      (Units consumption charge)
#Total charges
tot_costa = charge1 + charge2    #Rs
print "Annual charges in (a) = Rs.",round(tot_costa)

#(b)
charge1 = 50*max_kva     #Rs      (Max. demand charge)
charge2 = (7.0/100)*units   #Rs      (Units consumption charge)
#Total charges
tot_costb = charge1 + charge2    #Rs
print "Annual charges in (b) = Rs.",round(tot_costb)

if (tot_costa > tot_costb):
print "(b) is economical."
else:
print "(a) is economical."

Annual charges in (a) = Rs. 8154.0
Annual charges in (b) = Rs. 8608.0
(a) is economical.


## EXAMPLE 50.44 , PAGE NO :- 1977¶

In :
'''Determine the load factor at which the cost of supplying a unit of electricity from a Diesel station and from a steam
station is the same if the respective annual fixed and running charges are as follows.
Station                    Fixed charges                        Running charges
Diesel                     Rs. 300 per kW                       25 paise/kWh
Steam                      Rs. 1200 per kW                      6.25 paise/kWh .'''

from sympy import Symbol,Eq,solve
#(i)Diesel Station
#Suppose that the energy supplied in one year is one unit(1 kWh)
#Annual average power is
avg_pwr = 1.0/8760      #kW

#Annual load factor(L) = Annual average power/Annual max. demand
L = Symbol('L')
maxp = avg_pwr/L      #kW
fxd_charge = 300.0*(maxp)*100         #Paise
run_charge = 25.0                     #Paise
#Total charge
tot_charge1 = fxd_charge + run_charge  #Paise
#(ii)Steam Station
fxd_charge = 1200.0*(maxp)*100         #Paise
run_charge = 6.25                      #Paise
#Total charge
tot_charge2 = fxd_charge + run_charge  #Paise

eq = Eq(tot_charge1,tot_charge2)
L = solve(eq)
L1 = L

Load Factor =  0.55


## EXAMPLE 50.45 , PAGE NO :- 1978¶

In :
'''A factory has a maximum load of 300 kW at 0.72 p.f. with an annual consumption of 40,000 units, the tariff is
Rs. 4.50 per kVA of maximum demand plus 2 paisa/unit. Find out the average price per unit. What will be the annual
saving if the power factor be improved to units ? '''

#Given
maxp = 300.0            #kW            (Maximum demand)
pf = 0.72               #              (Power factor)
units = 40000.0         #kWh           (No of units consumed)
#Maximum demand in kVA
max_kva = maxp/pf       #kVA

#Max. KVA demand charge
charge1 = 4.5*max_kva   #Rs
#M.D charge per unit
md_unit = charge1/units*100   #paise

#Total charge per unit
tot_charge = md_unit + 2.0    #paise
print "Total charge per unit = ",round(tot_charge,2),"paise."

#Maximum demand in kVA at unity power factor
max_kva = maxp       #kVA

#Max. KVA demand charge
charge2 = 4.5*max_kva   #Rs

#Total savings is
saving = charge1 - charge2  #Rs
print "Total Savings = Rs.",saving

Total charge per unit =  6.69 paise.
Total Savings = Rs. 525.0


## EXAMPLE 50.46 , PAGE NO :- 1978¶

In :
'''There is a choice of two lamps, one costs Rs. 1.2 and takes 100 W and the other costs Rs. 5.0 and takes 30 W ;
each gives the same candle power and has the same useful life of 1000 hours. Which will prove more economical with
electrical energy at Rs. 60 per annum per kW of maximum demand plus 3 paise per unit ? At what load factor would

from sympy import Symbol,Eq,solve

#(i)First Lamp
#Initial cost per hour
charge11 = 120.0/1000                   #Paise
#Maximum demand/hr
maxp = 0.1                             #kW
#Maximum demand charge/hr
charge21 = (60.0*maxp/8760)*100          #Paise
#Energy charge/hr
charge31 = 3*maxp                        #Paise

#Total cost/hr
tot_cost1 = charge11 + charge21 + charge31 #Paise

print "Total cost/hr for lamp 1 = ",round(tot_cost1,2),"paise."
#-----------------------------------------------------------------------------#

#(ii)Second Lamp
#Initial cost per hour
charge12 = 500.0/1000                   #Paise
#Maximum demand/hr
maxp = 0.03                             #kW
#Maximum demand charge/hr
charge22 = (60.0*maxp/8760)*100          #Paise
#Energy charge/hr
charge32 = 3*maxp                        #Paise

#Total cost/hr
tot_cost2 = charge12 + charge22 + charge32 #Paise
print "Total cost/hr for lamp 2 = ",round(tot_cost2,2),"paise."

if (tot_cost1 > tot_cost2):
else:

#As Maximum demand charge will only vary with load factor and it varies inversely
#with maximum demand charge

x = Symbol('x')
tot_cost1 = charge11 + charge21/x + charge31 #Paise
tot_cost2 = charge12 + charge22/x + charge32 #Paise

eq = Eq(tot_cost1,tot_cost2)
x = solve(eq)
x1 = x

Total cost/hr for lamp 1 =  0.49 paise.
Total cost/hr for lamp 2 =  0.61 paise.


## EXAMPLE 50.47 , PAGE NO :- 1979¶

In :
'''The following data refers to a public undertaking which supplies electric energy to its consumers at a fixed tariff of 11.37
paise per unit.Total installed capacity = 344 MVA ; Total capital investment = Rs. 22.4 crores;
Annual recurring expenses = Rs. 9.4 crores ; Interest charge = 6% ; depreciation charge = 5%
Estimate the annual load factor at which the system should operate so that there is neither profit nor loss to the undertaking.
Assume distribution losses at 7.84% and the average system p.f. at 0.86.'''

from sympy import Symbol,solve,Eq
#Given
capacity = 344.0e+3            #kVA          (installed capacity)
cap_cost = 22.4e+7             #Rs           (capital cost)
pf = 0.86                      #             (power factor)

#Load factor (L) = No of kWh (units)supplied/Max. no of kWh(units) that can be supplied
L = Symbol('L')
units = (capacity*pf)*8760*L    #kWh         (No. of units supplied)
#Considering distribution losses,actual units supplied are
units = (1-7.84/100)*units      #kWh
#Total amount for consumption of units
cost1 = units*(11.37/100)     #Rs

#Fixed charges
charge1 = (11.0/100)*cap_cost      #Rs (interest and depreciation cost)
charge2 = 9.4e+7                   #Rs
cost2 = charge1 + charge2          #Rs
#As both charges should be equal for no profit no gain
eq = Eq(cost1,cost2)
L = solve(eq)
L1 = L
print "Annual Load factor = ",round(L1,3)

Annual Load factor =  0.437


## EXAMPLE 50.48 , PAGE NO :- 1979¶

In :
'''An area has a M.D. of 250 MW and a load factor of 45%. Calculate the overall cost per unit generated by
(i) steam power station with 30 per cent reserve generating capacity and
(ii) nuclear station with no reserve capacity.
Steam station :         Capital cost per kW = Rs. 1000 ; interest and depreciation on capital costs =15% ;
operating cost per unit = 5 paise.

Nucelar station :       Capital cost per kW = Rs. 2000 ; interest and depreciation on capital cost =12% ;
operating cost per unit = 2 paise.
For which load factor will the overall cost in the two cases become equal ?'''

from sympy import Symbol,solve,Eq

#(i)Steam station
#Installed capacity of steam station with 30% reserve capacity
capacity1 = (250.0e+3)*(1 + 30.0/100)                #kW
#Average power  = Max. demand * load factor
avg_pwr = capacity1*0.45                              #kW
#No. of units produced in a year
units = avg_pwr*8760                                #kWh
#Capital investment
cap_cost = 1000.0*capacity1                          #Rs
#Annual interest and depreciation
charge1 = (0.15)*cap_cost                           #Rs
#Fixed charge/unit
cost_unit = charge1/units*100                       #Paise
#Overall cost per unit
tot_cost = cost_unit + 5.0                          #Paise
print "Cost per unit for Steam station = ",round(tot_cost,2),"Paise."
#-------------------------------------------------------------------------------------------------------------#

#(ii)Nuclear station
#Installed capacity of steam station with 30% reserve capacity
capacity2 = (250.0e+3)                               #kW
#Average power  = Max. demand * load factor
avg_pwr = capacity2*0.45                              #kW
#No. of units produced in a year
units = avg_pwr*8760                                #kWh
#Capital investment
cap_cost = 2000.0*capacity2                          #Rs
#Annual interest and depreciation
charge2 = (0.12)*cap_cost                           #Rs
#Fixed charge/unit
cost_unit = charge2/units*100                       #Paise
#Overall cost per unit
tot_cost = cost_unit + 2                          #Paise
print "Cost per unit for Nuclear station = ",round(tot_cost,2),"Paise."
#---------------------------------------------------------------------------------------------------------------#

#Let L be the load factor
L = Symbol('L')

#Cost per unit of steam station is
stm_cost = charge1/(capacity1*8760*L)*100  + 5     #Paise

#Cost per unit of nuclear station is
nuc_cost = charge2/(capacity2*8760*L)*100  + 2     #Paise

#As overall cost should be equal
eq = Eq(stm_cost,nuc_cost)
L  = solve(eq)
L1 = L

Cost per unit for Steam station =  8.81 Paise.
Cost per unit for Nuclear station =  8.09 Paise.


## EXAMPLE 50.49 , PAGE NO :- 1980¶

In :
'''The maximum demand of a customer is 25 amperes at 220 volt and his total energy consumption is 9750 kWh. If the
energy is charged at the rate of 20 paise per kWh for 500 hours' use of the maximum demand plus 5 paise power unit
for all additional units, estimate his annual bill and the equivalent flat rate.'''

#Given
maxp = 25.0*220.0/1000           #kW    (Max. demand)
units = maxp*500.0               #kWh   (No. of units consumed)
charge1 = units*(20.0/100)       #Rs    (Max. demand charge)

#Units to be charged at lower rate
units2 = 9750.0 - units          #kWh
charge2 = units2*(5.0/100)       #Rs    (Charge)

#Annual Bill is
bill = charge1 + charge2         #Rs

#Equivalent flat rate
rate = bill/9750.0*100           #Paise
print "Annual Bill = Rs.",bill
print "Equivalent flat rate = ",round(rate,2),"Paise."

Annual Bill = Rs. 900.0
Equivalent flat rate =  9.23 Paise.


## EXAMPLE 50.50 , PAGE NO :- 1980¶

In :
'''A workshop having a number of induction motors has a maximum demand of 750 kW with a power factor of 0.75 and a
load factor of 35%. If the tariff is Rs. 75 per annum per kVA of maximum demand plus 3 paise per unit, estimate what
expenditure would it pay to incur to raise the power factor of 0.9.'''

#Given
maxp = 750.0           #kW      (Maximum demand)
max_kva = maxp/0.75    #kVA     (Maximum demand in kVA)

#Max. demand charge
charge1 = max_kva*75  #Rs

#If pf = 0.9
max_kva2 = maxp/0.9    #kVA     (Maximum demand in kVA)

#Max. demand charge
charge2 = max_kva2*75  #Rs

#Difference of amounts in one year
cost = charge1 - charge2     #Rs

#Assuming interest of 10% . The capital cost that can be put to increase power factor is
# cost = (10.0/100)*cap_cost

cap_cost = (100.0/10)*cost   #Rs
print "Amount that can be borrowed  = Rs.",cap_cost

Amount that can be borrowed  = Rs. 125000.0


## EXAMPLE 50.51 , PAGE NO :- 1981¶

In :
'''The owner of a new factory is comparing a private oil-engine generating station with public supply. Calculate the average
price per unit his supply would cost him in each case, using the following data :

Max. demand, 600 kW; load factor, 30% ; supply tariff, Rs. 70 per kW of maximum demand plus 3 paise per unit;
capital cost of plant required for public supply, Rs. 105; capital cost of plant required for private generating station,
Rs. 4 * 10^5 ; cost of fuel, Rs. 80 per tonne ; consumption of fuel oil; 0.3 kg per unit generated. Other work costs for
private plant are as follows : lubricating oil,stores and water = 0.35 paise per unit generated ; wages 1.1 paise ;
repairs and maintenance 0.3 paise per unit.'''

#Given
maxp = 600.0            #kW    (Maximum demand)
lf = 0.3                #      (load factor)

avg_pwr =  maxp * lf    #kW    (Average demand = Max demand * load factor)
units = avg_pwr*8760    #kWh   (Energy consumption)

#(i)Public supply
fxd_charge = 70.0*maxp  #Rs    (Fixed annual charges)
cap_charge = (10.0/100)*1.0e+5 #Rs  (Capital annual charges)

tot_charge = fxd_charge + cap_charge #Rs         (Total annual charges)
fxdcost_unit = tot_charge/units*100    #Paise      (Fixed cost per unit)
totcost_unit = fxdcost_unit + 3.0       #Paise      (Total cost per unit)
print "Public supply charges per unit = ",round(totcost_unit,2),"Paise."
#--------------------------------------------------------------------------------------------------#
#(ii)Private supply
cap_charge = (10.0/100)*4.0e+5 #Rs  (Capital annual charges)
fxdcost_unit = cap_charge/units*100    #Paise      (Fixed cost per unit)
oilcost_unit = (80.0/1000)*(0.3)*100   #Paise      (Oil cost per unit)
runcost_unit = 0.35 + 0.3 + 1.1        #Paise      (Running cost per unit)
totcost_unit = runcost_unit + oilcost_unit + fxdcost_unit  #Paise      (Total cost per unit)
print "Private supply charges per unit = ",round(totcost_unit,2),"Paise."
#--------------------------------------------------------------------------------------------------#

Public supply charges per unit =  6.3 Paise.
Private supply charges per unit =  6.69 Paise.


## EXAMPLE 50.52 , PAGE NO :- 1981¶

In :
'''Calculate the minimum two-part tariff to be charged to the consumers of a supply undertaking from the following data :
Generating cost per kWh; 3.6 paise ; Generating cost per kW of maximum demand, Rs. 50 Total energy generated per year ;
4,380 * 10^4 kWh Load factor at the generating station, 50%             Annual charges for distribution Rs. 125,000
Diversity factor for the distribution network, 1.25                     Total loss between station and consumer, 10%.'''

#Given
units = 4380.0e+4                         #kWh      (No of units consumed in a year)
lf = 0.5                                  #         (Load factor)
df = 1.25                                 #         (Diversity factor)
avg_pwr = units/8760                      #kW       (Average generating power)
maxp = avg_pwr/lf                         #kW       (Max. load on generator   , lf = Avg Power/Max Power)

#Annual fixed charges are
charges = maxp*50                         #Rs
#Total fixed charges are
tot_charges = charges + 125000            #Rs
#Consumer's Max demand is
max_dem = maxp*df                         #kW

#Cost per kW of Max demand is
cost_kw = tot_charges/max_dem             #Rs
#Monthly cost per kW of maximum demand is
cost_kw = cost_kw/12                      #Rs

#Since there are 10% losses ,energy reached to consumers per kWh is
units =   1*(1-0.1)                  #kWh
#Charges per kWh generated is
charge1 = 3.6/units                  #Paise
print "Therefore minimum charges are Rs",round(cost_kw,2),"per kW and",round(charge1,2),"paise per kWh consumed."

Therefore minimum charges are Rs 4.17 per kW and 4.0 paise per kWh consumed.


## EXAMPLE 50.53 , PAGE NO :- 1982¶

In :
'''Two systems of tariffs are available for a factory working 8 hours a day for 300 working days in a year.
(a) High-voltage supply at 5 paise per unit plus Rs. 4.50 per month per kVA of maximum demand.
(b) Low-voltage supply at Rs. 5 per month per kVA of maximum demand plus 5.5 paise per unit.
The factory has an average load of 200 kW at 0.8 power factor and a maximum demand of
250 kW at the same p.f.
The high-voltage equipment costs Rs. 50 per kVA and losses can be taken as 4 per cent. Interest and depreciation charges
are 12 per cent. Calculate the difference in the annual cost between the two systems.'''

#Given
maxp = 250.0                    #kW           (Maximum demand)
avg_dem = 200.0                 #kW           (Average demand)
pf = 0.8                        #             (power factor)
max_kva = maxp/pf               #kVA          (Maximum demand in kVA)
max_kva = (100.0/96)*max_kva    #kVA          (considering losses)
#(a)
#Annual interest on capital investment
charge1 = max_kva*50.0*0.12                  #Rs

#Annual charge due to kVA max. demand is
charge2 = max_kva*12*4.5                     #Rs

#Annual charge due to kWh consumption
charge3 = avg_dem*(100.0/96)*(5.0/100)*8*300 #Rs

#Total charges
tot_chargesa = charge1 + charge2 + charge3    #Rs
#------------------------------------------------------------------#
#(b)
#Annual charge due to kVA max. demand is
charge1 = maxp/pf*12*5                    #Rs

#Annual charge due to kWh consumption
charge2 = avg_dem*(5.5/100)*8*300         #Rs

#Total charges
tot_chargesb = charge1 + charge2           #Rs

#Hence high-voltage is cheaper by
cost = tot_chargesb - tot_chargesa         #Rs

print "High-voltage is cheaper by = ",round(cost,2),"Rs."

High-voltage is cheaper by =  618.75 Rs.


## EXAMPLE 50.54 , PAGE NO :- 1982¶

In :
'''Estimate what the consumption must be in order to justify the following maximum demand tariff in preference to the flat
rate if the maximum demand is 6 kW.On Maximum Demand Tariff. A  max. demand rate of 37 paise per unit for the first 200 hr. at the
maximum demand rate plus 3 paisa for all units in excess.Flat-rate tariff, 20 paise per unit.'''

from sympy import Symbol,solve,Eq
#Let x = number of units to be consumed (within a specific period)
x = Symbol('x')

#Units consumed at max. demand rate
units = 6 * 200.0            #kWh
#Units in excess of the max. demand units
excess = (x - 1200)          #kWh
#Cost of max. demand units is
cost = units*37              #Paise
#Cost of excess units
cost_excss = 3.0*(excess)    #Paise
#Total cost on tariff
tot_cost1 = cost + cost_excss #Paise

#Flat rate tariff
tot_cost2 = 20*x              #Paise

eq = Eq(tot_cost1,tot_cost2)
x  = solve(eq)
x1 = x
print "Number of units consumed = ",round(x1,2),"units."

Number of units consumed =  2400.0 units.


## EXAMPLE 50.55 , PAGE NO :- 1986¶

In :
'''If the cost of an overhead line is Rs. 2000 A (where A is the cross-sectional area in cm^2) and if the interest and depreciation
charges on the line are 8%, estimate the most economical current density to use for a transmission requiring full-load current for
60% of the year.The cost of generating electric energy is 5 paise/kWh. The resistance of a conductor one kilometre long and
1 cm^2 cross-section is 0.18 ohm.'''

from sympy import Symbol,solve,Eq

#Given
A = 1.0                           #cm^2
R = 0.18                          #ohm
#Let the current through the overhead line be I
I = Symbol('I')
#Power loss in line is
loss = 2*(I*I)*R/1000             #kW

#No. of units consumed
units = loss*(0.6)*(365*24)       #kWh

#Annual charges
charge = units*0.05               #Rs

#Interest and depreciation charges
charge2 = (8.0/100)*2000         #Rs

#Equating two charges
eq = Eq(charge,charge2)
I = solve(eq)
I1 = I                        #A
#Current density
J = I1/A                         #A/cm^2
print "Current density = ",round(J,2),"A/cm^2"

Current density =  41.12 A/cm^2


## EXAMPLE 50.56 , PAGE NO :- 1986¶

In :
'''A 500-V, 2-core feeder cable 4 km long supplies a maximum current of 200 A and the demand is such that the copper
loss per annum is such as would be produced by the full-load current flowiing for six months. The resistance of the
conductor 1 km long and 1 sq cm. cross-sectional area is 0.17 ohm. The cost of cable including installation is
Rs. (120 A + 24) per metre where A is the area of cross-section in sq. cm and interest and depreciation charges are
10%. The cost of energy is 4 paise per kWh. Find the most economical cross-section.'''

from sympy import Symbol,solve,Eq

#Let us consider 1 km length of feeder cable
#Also, let A be the area of cross-section
A = Symbol('A')

#Cable cost/metre
cab_cost = 120.0*A + 24                          #Rs
#Cost of 1km long cable
cost1 = 120.0*A*(1000)                           #Rs
#Interest and depreciation per annum
charge1 = (10.0/100)*cost1                       #Rs

#Resistance of 1km long cable is
res = 0.17/A                                     #ohm
#Cu loss in cable = 2*I^2*R
I = 200.0                                        #A
loss = 2*(I*I)*res/1000                          #kW
#Energy loss over 6 months
units = loss*(8760.0/2)                          #kWh
#Cost of this energy loss is
charge2 = 0.04*units                             #Rs
#For most economical cross-section charge1= charge2
eq = Eq(charge1,charge2)
A = solve(eq)
A1 = A                                        #cm^2
print "Most economical cross-section is = ",round(A1,3),"cm^2."

Most economical cross-section is =  0.446 cm^2.


## EXAMPLE 50.57 , PAGE NO :- 1987¶

In :
'''A 2-core, 11-kV cable is to supply 1 MW at 0.8 p.f. lag for 3000 hours in a year. Capital cost of the cable is
Rs. (20 + 400a) per metre where a is the cross-sectional area of core in cm^2. Interest and depreciation total 10% and cost
per unit of energy is 15 paise. If the length of the cable is 1 km, calculate the most economical cross-section of the
conductor. The specific resistance of copper is 1.75 * 10^–6 ohm-cm.'''

from sympy import Symbol,solve,Eq
import math as m

#Let A be the cross-sectional area of core
A = Symbol('A')
#Cost of 1 km length of cable
cost1 = (400.0*A)*1000                #Rs
#Resistance of 1km cable length is  R = rho*l/A
res = 1.75e-6*(1000*100)/A                   #ohm

#Now,
V = 11.0e+3           #V    (applied voltage)
P = 1.0e+6             #W    (power consumed)
pf = 0.8               #     (power factor)

#P = V*I*pf.Therefore, full-load current is
I = P/(V*pf)           #A

#Power loss in cable
loss = 2*(I*I)*res     #W

#Annual cost of energy loss
charge1 = loss*(3000)*(15.0/100)*(1/1000.0)       #Rs
#Interest and depreciation per annum
charge2 = (10.0/100)*cost1                        #Rs

#The most economical cross-section will be when charge1 = charge2
eq = Eq(charge1,charge2)
A = solve(eq)
A1 = A                     #cm^2
d = m.sqrt(4*A1/3.14)          #cm            (diameter)
print "The most economical cross-sectional area is = ",round(A1,2),"cm^2."
print "The most economical diameter is = ",round(d,2),"cm."

The most economical cross-sectional area is =  0.23 cm^2.
The most economical diameter is =  0.54 cm.


## EXAMPLE 50.58 , PAGE NO :- 1988¶

In :
'''The cost of a two-core feeder cable including insulation is Rs. (130 A + 24) per metre and the interest and depreciation
charges 10% per annum. The cable is two km in length and the cost of energy is 4 paisa per unit. The maximum current in the
feeder is 250 amperes and the demand is such that the copper loss is equal to that which would be produced by the full current
flowing for six months. If the resistance of a conductor of 1 sq. cm cross-sectional area and one km in length be 0.18 ohm,
find the most economical section of the same.'''

from sympy import Symbol,solve,Eq

#Let us consider 1 km length of feeder cable
#Also, let A be the area of cross-section
A = Symbol('A')

#Cable cost/metre
cab_cost = 130.0*A + 24                          #Rs
#Cost of 1km long cable
cost1 = 130.0*A*(1000)                           #Rs
#Interest and depreciation per annum
charge1 = (10.0/100)*cost1                       #Rs

#Resistance of 1km long cable is
res = 0.18/A                                     #ohm
#Cu loss in cable = 2*I^2*R
I = 250.0                                        #A
loss = 2*(I*I)*res/1000                          #kW
#Energy loss over 6 months
units = loss*(8760.0/2)                          #kWh
#Cost of this energy loss is
charge2 = 0.04*units                             #Rs
#For most economical cross-section charge1= charge2
eq = Eq(charge1,charge2)
A = solve(eq)
A1 = A                                        #cm^2
print "Most economical cross-section is = ",round(A1,2),"cm^2."

Most economical cross-section is =  0.55 cm^2.


## EXAMPLE 50.59 , PAGE NO :- 1988¶

In :
'''An 11-kV, 3-core cable is to supply a works with 500-kW at 0.9 p.f. lagging for 2,000 hours p.a. Capital cost of the cable per
core when laid is Rs. (10,000 + 32,00 A) per km where A is the cross-sectional area of the core in sq. cm. The resistance per km
of conductor of 1 cm^2 crosssection is 0.16 ohm.If the energy losses cost 5 paise per unit and the interest and sinking fund is
recovered by a charge of 8% p.a., calculate the most economical current density and state the conductor diameter.'''

from sympy import Symbol,solve,Eq
import math as m

#Let A be the cross-sectional area of conductor
A = Symbol('A')
#The annual charge on cost of conductor per km is
charge1 = 0.08*32000.0*A                          #Rs
#Current per conductor is I = P/V*pf
I = (500000/1.73)/(11000.0)*(0.9)
#Resistance of conductor is
R = 0.16/A                #ohm

#Losses in 3-core cable
loss = 3*(I*I)*R/1000.0             #kW

#Annual cost of this loss
charge2 = loss*(5.0/100)*2000       #Rs

#For the most economical cross-section  (charge1 = charge2)
eq = Eq(charge1,charge2)
A = solve(eq)
A1 = A                            #cm^2
#Current density is
J = I/A1                             #A/cm^2
#Conductor diameter is   Using pi*d^2/4 = A
d = m.sqrt(A1*4/3.14)                #cm
print "Most economical cross-sectional area is = ",round(A1,2),"cm^2."
print "Most economical current density is = ",round(J,2),"A/cm^2."
print "Most economical diameter is = ",round(d,2),"cm."

Most economical cross-sectional area is =  0.1 cm^2.
Most economical current density is =  230.94 A/cm^2.
Most economical diameter is =  0.36 cm.


## EXAMPLE 50.60 , PAGE NO :- 1989¶

In :
'''Discuss limitations of the application of Kelvin’s law.An industrial load is supplied by a 3-phase cable from a sub-station
at a distance of 6 km. The voltage at the load is 11 kV. The daily load cycle for six days in a week for the entire year
is as given below :
(i) 700 kW at 0.8 p.f. for 7 hours                                                   (ii) 400 kW at 0.9 p.f. for 3 hours,
(iii) 88 kW at unity p.f. for 14 hours.
Compute the most economical cross-section of conductors for a cable whose cost is Rs. (5000 A +1500) per km (including the
cost of laying etc.). The tariff for the energy consumed at the load is Rs. 150 per annum per kVA of M.D. plus 5 paise per unit.
Assume the rate of interest and depreciation as 15%. The resistance per km of the conductor is (0.173/A) ohm.'''

from sympy import Symbol,solve,Eq

#Let us assume cross-section of conductor to be 'A'
A = Symbol('A')
#Capital cost of the cable is
cost1 = 6*5000.0*A                         #Rs
#Annual cost of interest and depreciation
charge1 = (15.0/100)*cost1                 #Rs

#Resistance of conductor is
R = 6*(0.173/A)                            #ohm

#Line currents due to different loads      Using I = P/V*pf

I1 = (700000.0/1.73)/(11.0e+3*0.8)        #A
I2 = (400000.0/1.73)/(11.0e+3*0.9)       #A
I3 = (88000.0/1.73)/(11.0e+3*1)           #A

#Corresponding energy loss per week        Using loss = 3*I*I*R
loss1 = 3*(I1*I1)*R*(6*7)/1000                  #kWh
loss2 = 3*(I2*I2)*R*(6*3)/1000                  #kWh
loss3 = 3*(I3*I3)*R*(6*14)/1000                 #kWh

#Total weekly loss is
tot_loss = loss1 + loss2 + loss3               #kW
#Annual cost from loss
cost2 = tot_loss*(52)*(5.0/100)                #Rs        (Assumed 52 weeks per year)

#Max. Voltage drop in each conductor       Using V = I*R
V = I1*R                    #V        (As I1 is Max.)
#Max kVA demand charge
cost3 = 3*V*I1*(150.0)/1000                    #Rs

#Total annual charge due to cable loss is
charge2 = cost2 + cost3                         #Rs

#For most economical size of cable charge1 = charge2
eq = Eq(charge1,charge2)
A = solve(eq)
A1 = A
print "Most economical cross-sectional area is = ",round(A1,2),"cm^2."

Most economical cross-sectional area is =  0.63 cm^2.


## EXAMPLE 50.61 , PAGE NO :- 1994¶

In :
'''A 3-phase, 50-Hz, 3,000-V motor develops 600 h.p. (447.6 kW), the power factor being 0.75 lagging and the efficiency
0.93. A bank of capacitors is connected in delta across the supply terminals and power factor raised to 0.95 lagging.
Each of the capacitance units is built of five similar 600-V capacitors. Determine capacitance of each capacitor.'''

from sympy import Symbol,solve,Eq
import math as m
#Given
V = 3000.0         #V      (supplied voltage)
pout = 447600.0    #W      (output power)
eff = 0.93         #       (efficiency)

pin = pout/eff     #W      (input power)

#As cosQ = power factor Q = cos-1(pf)
phi1 = m.acos(0.75)           #      (angle 1)
phi2 = m.acos(0.95)           #      (angle 2)

#Now, taking tanQ of angles
tan1 = m.tan(phi1)
tan2 = m.tan(phi2)

#Leading VAR supplied by capacitor bank is
pvar = pin*(tan1 - tan2)      # VAR
#Leading VAR supplied by each capacitor bank is
pvar = pvar/3                 # VAR        ----------------------(i)

#Phase current of capacitor is I = V/Xc   where Xc = 1/w*C    C-> Capacitance
C = Symbol('C')
w = 2*3.14*50.0               #Hz
Icp = V*w*C                   #A
#Reactive power is V*Icp
pvar2 = V*Icp                 #VAR         -----------------------(ii)
#Equating (i) & (ii)
eq = Eq(pvar,pvar2)
C = solve(eq)
C1 = C*1000000.0           #uF      (capacitance)

#As it is made of 5 capacitance in series
cap_each = 5*C1                 #uF
print "Capacitance of each capacitor is =",round(cap_each,2),"uF."

Capacitance of each capacitor is = 157.03 uF.


## EXAMPLE 50.62 , PAGE NO :- 1994¶

In :
'''A synchronous motor having a power consumption of 50 kW is connected in parallel with a load of 200 kW having a
lagging power factor of 0.8. If the combined load has a p.f. of 0.9, what is the value of leading reactive kVA
supplied by the motor and at what p.f. is it working?'''

import math as m

#Given
phi2 = m.acos(0.8)            #(power factor angle of load)
phit = m.acos(0.9)            #(combined power factor angle)

#Now, taking tanQ of angles
tan2 = m.tan(phi2)
tant = m.tan(phit)

#Combined power
power = 200.0 + 50.0             #kW
#Total kVAR is
kvar = power*tant                #kVAR

#KVAR supplied by motor is
mot_kvar = kvar - load_kvar      #kVAR

#Now, 50*tan(phi1) = mot_kvar
tan1 = mot_kvar/50.0
phi1 = m.atan(tan1)

#Power factor = cos(phi)
print "Power factor = ",round(pf,2)

Power factor =  0.87


## EXAMPLE 50.63 , PAGE NO :- 1994¶

In :
'''A generating station supplies power to the following, lighting load 100-kW ;an induction motor 400 h.p. (298.4 kW),
power factor 0.8, efficiency, 0.92 ; a rotary converter giving 100 A at 500 V at an efficiency of 0.94.
What must be the power factor of the rotary converter in order that the power factor of the supply station may be unity.'''

import math as m

#Motor Power input = Motor output/Efficiency
pin = 298.4/0.92               #kW
phi1 = m.acos(0.8)             #(motor power factor angle)
tan1 = m.tan(phi1)

#Lagging motor kVAR is
mot_kvar = pin*tan1            #kVAR
#Leading kVAR to be supplied by rotary converter is same that of motor.
rot_kvar = mot_kvar
#Input power of rotary converter is
pin_rot = (500.0*100.0)/(0.94*1000)      #kW

#For rotary converter,      tanQ = kVAR/kW
tan2 = rot_kvar/pin_rot
phi2 = m.atan(tan2)

#Power factor = cosQ

print "Power factor is =",round(pf,2)

Power factor is = 0.21


## EXAMPLE 50.64 , PAGE NO :- 1995¶

In :
'''A factory has an average annual demand of 50 kW and an annual load factor of 0.5. The power factor is 0.75 lagging.
The tariff is Rs. 100 per kVA maximum demand per annum plus five paise per kWh. If loss-free capacitors costing Rs. 600
per kVAR are to be utilized, find the value of the power factor at which maximum saving will result. The interest and
depreciation together amount to ten per cent. Also, determine the saving affected by improving the power factor to this value.'''

import math as m
#Given
A = 100.0            #Rs           (charge of maximum demand per kVA)
C = (10.0/100)*600   #Rs           (interest and depreciation charge)
#The most economical power factor angle is given by sinQ = C/A
phi = m.asin(C/A)         #angle
#Power factor = cosQ
pf = m.cos(phi)

#Max demand = Avg demand/load factor
maxp = 50.0/0.5          #kW           (Maximum demand)

#(i)At initial pf = 0.75 the Max load in kVA is
max_kva1 = maxp/0.75        #kVA
#Max. demand charge is
charge1 = max_kva1*A        #Rs
#(ii)At economical 'pf' the Max load in kVA is
max_kva2 = maxp/pf          #kVA
#Max. demand charge is
charge2 = max_kva2*A        #Rs

#Annual Savings
savings = charge1 - charge2   #Rs
print "Power factor at maximum savings = ",round(pf,2)
print "Annual savings = Rs.",round(savings,2)

Power factor at maximum savings =  0.8
Annual savings = Rs. 833.33


## EXAMPLE 50.65 , PAGE NO :- 1995¶

In :
'''For increasing the kW capacity of a plant working at 0.7 lag p.f. the necessary increase of power can be obtained by raising
the p.f. to 0.85 or by installing additional plant. What is the maximum cost per kVA of p.f. correction apparatus to make its use
more economical than additional plant at Rs. 500 kVA ?'''

from sympy import Symbol
import math as m

#Let kVA1 be the initial capacity of plant and kVA2 be its increased capacity
kVA1 = Symbol('kVA1')
#kVA1 * cosQ1 = kVA2 * cosQ2
kVA2 = kVA1*(0.85/0.7)
#Capital cost of additional plant is

#Now, cosQ1 and cosQ2 are known and we have to find sinQ1 and sinQ2
phi1 = m.acos(0.7)
phi2 = m.acos(0.85)

sin1 = m.sin(phi1)
sin2 = m.sin(phi2)

#kVAR supplied by pf corrections
kvar_supp  = kVA2*sin1 - kVA1*sin2      #kVAR
#Let Cost of pf corrections be x
#Now ,cost_add = cost of pf corrections . Therefore

print "Therefore, Maximum cost per kVA of pf corrections is = Rs.",round(x,2)

Therefore, Maximum cost per kVA of pf corrections is = Rs. 314.76


## EXAMPLE 50.66 , PAGE NO :- 1996¶

In :
'''A consumer taking a steady load of 160 kW at a p.f. of 0.8 lag is charged at Rs. 80 per annum per kVA of
maximum demand plus 5 paise per kWh consumed. Calculate the value to which he should improve the p.f. in order to
affect the maximum saving if the leading kVA cost Rs.100 per kVA and interest and depreciation be at 12% per annum.
Calculate also the saving.'''

import math as m

#Let the cost per kVAR is Rs. B and rate of interest and depreciation is P,then
#C = BP/100
A = 80.0           #Rs            (cost per kVA of max. demand)
C = 100*12/100     #Rs
#sinQ = C/A
phi = m.asin(C/A)    #        angle
pf = m.cos(phi)      #        power factor

maxp = 160.0         #kW          (max. demand)
#Max. demand in kVA for pf = 0.8
max_kva1 = maxp/0.8   #kVA
#Max.demand charge is
charge1 = max_kva1*80.0                   #Rs

#----------------------------------------------------------------------------------#
#Max. demand in kVA for most economical pf
max_kva2 = maxp/pf    #kVA
#Max.demand charge is
charge2 = max_kva2*80.0                   #Rs
#Annual savings is
savings = charge1 - charge2               #Rs
print "Annual savings = Rs.",round(savings)

Annual savings = Rs. 3054.0


## EXAMPLE 50.67 , PAGE NO :- 1996¶

In :
'''A consumer takes a steady load of 1500 kW at a p.f. of 0.71 lagging and pays Rs. 50 per annum per kVA of maximum
demand. Phase advancing plant costs Rs. 80 per kVA. Determine the capacity of the phase advancing plant required for
minimum overall annual expenditure.Interest and depreciation total 10%. What will be the value of the new power factor
of the supply?'''

import math as m

#Let the cost per kVAR is Rs. B and rate of interest and depreciation is P,then
#C = BP/100
A = 50.0           #Rs            (cost per kVA of max. demand)
C = 80*10/100     #Rs
#sinQ = C/A
phi = m.asin(C/A)    #        angle
pf = m.cos(phi)      #        power factor

#As power factor = cosQ
phi1 = m.acos(0.71)          #angle
tan1 = m.tan(phi1)           #tanQ
phi2 = m.acos(pf)            #angle
tan2 = m.tan(phi2)           #tanQ

#kVA supplied by plant is
kva_supp = 1500.0*(tan1 - tan2)
print "power factor = ",round(pf,3)
print "kVA supplied by plant is = ",round(kva_supp),"kVA"

power factor =  0.987
kVA supplied by plant is =  1245.0 kVA


## EXAMPLE 50.68 , PAGE NO :- 1996¶

In :
'''A factory takes a load of 200 kW at 0.85 p.f. (lagging) for 2,500 hours per annum and buys energy on tariff of Rs. 150
per kVA plus 6 paise per kWh consumed. If the power factor is improved to 0.9 lagging by means of capacitors costing
Rs. 525 per kVA and having a power loss of 100 W per kVA, calculate the annual saving affected by their use.
Allow 8% per annum for interest and depreciation on the capacitors.'''

from sympy import Symbol,solve,Eq
import math as m

#Given
maxp = 200.0          #kW           (factory load)
pf = 0.85             #             (power factor = cosQ)
phi = m.acos(pf)      #angle
tan1 = m.tan(phi)     #             (tanQ)
max_kvar = maxp*tan1  #kVAR

#Let x be capacitor's kVAR. Therefore, total kVAR is
x = Symbol('x')
tot_kvar = max_kvar - x
#Because loss per kVA is 100W i.e 1/10kW per kVA
cap_loss = x/10.0     #kW

#Total  kW is
tot_kw = maxp + cap_loss   #kW
#Overall pf is cosQ = 0.9
phi2 = m.acos(0.9)
tan2 = m.tan(phi2)
eq = Eq(tan2,tot_kvar/tot_kw)
x = solve(eq)
x1 = x             #kVAR

#(i)cost per annum before improvement
#Max demand in kVA
max_kva = maxp/pf            #kVA
#Units consumed per annum
units = maxp*2500.0          #kWh

#Total annual cost
cost1 = max_kva*150.0 + units*(6.0/100)     #Rs

#(ii)cost per annum after improvement
max_kva = maxp/0.9      #kVA
#Units consumed per annum
units = maxp*2500.0          #kWh

#Charges due to losses in capacitor
charge1 = x1*100*2500*6/(1000*100)         #Rs

#Annual interest and depreciation cost
charge2 = x1*525*(8.0/100)                 #Rs

#Total annual cost
cost2 = max_kva*150.0 + units*(6.0/100) + charge1 + charge2   #Rs

#Total annual savings are
savings = cost1 - cost2                    #Rs

print "Total annual savings = Rs.",round(savings,2)

Total annual savings = Rs. 488.29


## EXAMPLE 50.69 , PAGE NO :- 1997¶

In :
'''A 30 h.p. (22.38 kW) induction motor is supplied with energy on a two-part tariff of Rs. 60 per kVA of maximum demand
per annum plus 5 paise per unit. Motor (A) has an efficiency of 89% and a power factor of 0.83.
Motor (B) with an efficiency of 90% and a p.f. of 0.91 costs Rs. 160 more. With motor (A) the p.f. would be raised to
0.91 (lagging) by installing capacitors at a cost Rs. 50 per kVA.If the service required from the motor is equivalent
to 2,280 hr. per annum at full load, compare the annual charges in the two cases. Assume interest and depreciation charges
to be 12.5% per annum for the motor and 8% per annum for the capacitors.'''

import math as m

#(i)For Motor A
pin = 22.38/0.89               #kW        (Motor Input in kW)
pin_kva = pin/0.83                #kVA       (Motor Input in kVA)
#If power factor is changed to 0.91 then
pin_kva2 = pin/0.91               #kVA       (Motor Input in kVA)
#Annual cost of energy supplied to motor is
charge1  = pin_kva2*60.0 + pin*2280.0*(5.0/100)    #Rs

#Now, as we know pf = cosQ
phi1 = m.acos(0.83)                #angle
phi2 = m.acos(0.91)                #angle
tan1 = m.tan(phi1)                 #tanQ
tan2 = m.tan(phi2)                 #tanQ

#kVAR necessary for this improvement is
tot_kvar = pin*(tan1 - tan2)       #kVAR
#Annual charges on capacitors
charge2 = 50.0*tot_kvar*(8.0/100)  #Rs

#Total charges per annum is
tot_chargeA = charge1 + charge2     #Rs

#-----------------------------------------------------------------------------#
#(ii)For Motor B
pin = 22.38/0.9               #kW        (Motor Input in kW)
#If power factor is changed to 0.91 then
pin_kva2 = pin/0.91               #kVA       (Motor Input in kVA)
#Annual cost of energy supplied to motor is
charge1  = pin_kva2*60.0 + pin*2280.0*(5.0/100)    #Rs

#Annual charges on capacitors
charge2 = (12.5/100)*160           #Rs

#Total charges per annum is
tot_chargeB = charge1 + charge2     #Rs

#Hence B is cheaper than A by
cheap = tot_chargeA - tot_chargeB    #Rs

print "B is cheaper than A by = Rs. ",round(cheap,2)

B is cheaper than A by = Rs.  52.04


## EXAMPLE 50.70 , PAGE NO :- 1997¶

In :
'''The motor of a 22.5 kW condensate pump has been burnt beyond economical repairs. Two alternatives have been
proposed to replace it by
Motor A. Cost = Rs. 6000 ; η at full-load=90% ; at half-load = 86%.
Motor B. Cost = Rs. 4000 ; η at full-load=85% ; at half-load= 82%.
The life of each motor is 20 years and its salvage value is 10% of the initial cost. The rate of
interest is 5% annually. The motor operates at full-load for 25% of the time and at half-load for the
remaining period. The annual maintenance cost of motor A is Rs. 420 and that of motor B is Rs. 240.
The energy rate is 10 paise per kWh.Which motor will you recommend ?'''

pout = 22.5                  #kW     (output power)
#(i)For Motor A
eff_fl = 0.9                 # (efficiency at full-load)
eff_hl = 0.86                 # (efficiency at half-load)
#Annual interest on capital cost
charge1 = 6000.0*(5.0/100)                         #Rs
#Annual depreciation charges = (original cost - salvage value)/20 years
charge2 = (6000.0 - 6000.0*(10.0/100))/20          #Rs
#Annual maintenance cost
charge3 = 420.0                                    #Rs
#Energy input per annum
units = pout*0.25*8760/eff_fl + (pout/2)*0.75*8760/eff_hl   #kWh
#Annual energy cost is
charge4 = units*(10.0/100)                         #Rs
#Total annual cost is
tot_costA = charge1 + charge2 + charge3 + charge4   #Rs

#---------------------------------------------------------------------------------------#

#(ii)For Motor B
eff_fl = 0.85                  # (efficiency at full-load)
eff_hl = 0.82                 # (efficiency at half-load)
#Annual interest on capital cost
charge1 = 4000.0*(5.0/100)                         #Rs
#Annual depreciation charges = (original cost - salvage value)/20 years
charge2 = (4000.0 - 4000.0*(10.0/100))/20          #Rs
#Annual maintenance cost
charge3 = 240.0                                    #Rs
#Energy input per annum
units = pout*0.25*8760/eff_fl + (pout/2)*0.75*8760/eff_hl   #kWh
#Annual energy cost is
charge4 = units*(10.0/100)                         #Rs
#Total annual cost is
tot_costB = charge1 + charge2 + charge3 + charge4   #Rs

print "Total annual cost for Motor A is = Rs.",round(tot_costA,2)
print "Total annual cost for Motor B is = Rs.",round(tot_costB,2)

if(tot_costA>tot_costB):
print "Motor B would be recommended."
else:
print "Motor A would be recommended."

Total annual cost for Motor A is = Rs. 15059.48
Total annual cost for Motor B is = Rs. 15430.78
Motor A would be recommended.


## EXAMPLE 50.71 , PAGE NO :- 1998¶

In :
'''An industrial load takes 106 kWh a year, the power factor being 0.707 lagging.The maximum demand is 500 kVA.
The tariff is Rs. 75 per annum per kVA maximum demand plus 3 paise per unit. Calculate the yearly cost of supply
and find the annual saving in cost by installing phase advancing plant costing Rs. 45 per kVA which raises the plant
power factor from 0.707 to 0.9 lagging. Allow 10% per annum on the cost of the phase advancing plant to cover all

import math as m

#Given
units = 1.0e+6          #kWh        (No. of units consumed in a year)
max_dem = 500.0         #kVA        (Max. demand charge per annum)
#Max. demand charge per annum
charge1 = max_dem*75    #Rs
#Annual energy charges
charge2 = units*(3.0/100) #Rs
#Total cost of supply
tot_charge1 = charge1 + charge2       #Rs

#Now when pf is changed from 0.707 to 0.9 then Max. kVA demand is
max_dem =  max_dem*(0.707/0.9)       #kVA

#Max. demand charge per annum
charge1 = max_dem*75    #Rs
#Annual energy charges
charge2 = units*(3.0/100) #Rs
#Total cost of supply
tot_charge2 = charge1 + charge2       #Rs

#Now, as we know pf = cosQ
phi1 = m.acos(0.707)
phi2 = m.acos(0.9)
tan1 = m.tan(phi1)
tan2 = m.tan(phi2)

#kVAR to be supplied is  (kW demand)*(tan1 - tan2)
tot_kvar = max_dem*0.707*(tan1 - tan2)              #kVAR

#Annual cost of interest and depreciation
charge3 =tot_kvar*45*(10.0/100)            #Rs
tot_charge2 = tot_charge2 + charge3    #Rs

#Annual Savings
savings = tot_charge1 - tot_charge2   #Rs

print "Annual Savings = Rs. ",round(savings,2)

Annual Savings = Rs.  7396.89


## EXAMPLE 50.72 , PAGE NO :- 1999¶

In :
'''It is necessary to choose a transformer to supply a load which varies over 24
hour period in the manner given below :
500 kVA for 4 hours, 1000 kVA for 6 hours, 1500 kVA for 12 hours and 2000 kVA for the rest of the period.
Two transformers each rated at 1500 kVA have been quoted. Transformer I has iron loss of
2.7 kW and full-load copper loss of 8.1 kW while transformer II has an iron loss and full-load copper
loss of 5.4 kW each.
(i) Calculate the annual cost of supplying losses for each transformer if electrical energy costs
10 paise per kWh.
(ii) Determine which transformer should be chosen if the capital cost of the transformer I is
Rs. 1000 more than that of the transformer II and annual charges of interest and depreciation
are 10%.
(iii) What difference in capital cost will reverse the decision made in (ii) above ? '''

#(i.a)Transformer No. 1

iron_loss = 2.7*24         #kWh             (Iron loss/day)

cu_loss = 8.1*(((500.0/1500)**2.0)*4 + ((1000.0/1500)**2.0)*6 + ((1500.0/1500)**2.0)*12 + ((2000.0/1500)**2.0)*2)
#kWh(Copper loss/day)

#Annual energy loss
annual_loss = 365.0*(iron_loss + cu_loss)        #kWh

#Annual cost of both cases
charge1 = annual_loss*(10.0/100)                 #Rs
#-----------------------------------------------------------------------#
#(i.b)Transformer No. 2

iron_loss = 5.4*24         #kWh             (Iron loss/day)
cu_loss = 5.4*(((500.0/1500)**2.0)*4 + ((1000.0/1500)**2.0)*6 + ((1500.0/1500)**2.0)*12 + ((2000.0/1500)**2.0)*2)
#kWh(Copper loss/day)

#Annual energy loss
annual_loss = 365.0*(iron_loss + cu_loss)        #kWh

#Annual cost of both cases
charge2 = annual_loss*(10.0/100)                 #Rs

print "Annual charge of Transformer 1 is = Rs.",round(charge1,2)
print "Annual charge of Transformer 2 is = Rs.",round(charge2,2)

#------------------------------------------------------------------------------------------------------------------------------#
#(ii)Sice cost of transformer1 is Rs. 1000 more with 10% interest
#Total annual cost for Transformer 1 is
charge1a = charge1 + (10.0/100)*1000               #Rs

if(charge1a>charge2):
print "Transformer 2 is chosen."
else:
print "Transformer 1 is chosen."
#------------------------------------------------------------------------------------------------------------------------------#
#(iii)Total savings in Transformer 1 is
savings = charge2 - charge1                       #Rs
#Let x be the capital cost of transformer 1 . Then x*0.1 > savings
x = savings/0.1                                   #Rs
print "To reverse the situation , Capital cost of transformer is > Rs. ",round(x,2)

Annual charge of Transformer 1 is = Rs. 7884.0
Annual charge of Transformer 2 is = Rs. 8409.6
Transformer 1 is chosen.
To reverse the situation , Capital cost of transformer is > Rs.  5256.0


## EXAMPLE 50.73 , PAGE NO :- 1999¶

In :
'''Three-phase 50-Hz power is supplied to a mill, the voltage being stepped down to 460-V before use.The monthly power rate
is 7.50 per kVA. It is found that the average power factor is 0.745 while the monthly demand is 611 kVA.To improve power
factor, 210 kVA capacitors are installed in which there is negligible power loss. The installed cost of the equipment is
Rs. 11,600 and fixed charges are estimated at 15% per year. What is the yearly saving introduced by the capacitors.'''

import math as m

#Monthly demand
max_kva = 611.0             #kVA           (maximum demand)
pf = 0.745                  #              (power factor)
#Now, as we know
phi = m.acos(pf)            #angle
sin1 = m.sin(phi)

#Max demand in kW
max_kw = max_kva*pf         #kW
#Max demand in kVAR
max_kvar = max_kva*sin1        #kVAR  (lagging)
kvar2 = 210.0                  #kVAR

#kVAR after pf improvement
tot_kvar = max_kvar - kvar2        #kVAR

#kVA after power factor improvement is
new_kva = m.sqrt( max_kw**2 + tot_kvar**2 )        #kVA

#Reduction in kVA
red_kva = max_kva - new_kva                #kVA
#Monthly Savings in kVA charge
saving = red_kva*7.5                       #Rs
#Yearly Savings in kVA charge
saving = 12*saving                         #Rs

#Fixed charge per annum due to Capital cost on capacitors
fxd_charge = 0.15*11600                      #Rs

#Net savings
net_saving = saving - fxd_charge             #Rs

print "Net savings per annum = Rs. ",round(net_saving)

Net savings per annum = Rs.  8590.0


## EXAMPLE 50.74 , PAGE NO :- 2000¶

In :
'''A supply undertaking is offering the following two tariffs to prospective customers :
Tariff A : Lighting : 20 paise per unit; domestic power: 5 paise per unit, meter rent: 30 paise per meter per month.
Tariff B : 12 per cent on the rateable value of the customer's premises plus 3 paise per unit for all purposes.
If the annual rateable value of the customer's premises is Rs. 2,500 and his normal consumption for lighting per month
is 40 units, determine what amount of domestic power consumption will make both the tariffs equally advantageous.'''

from sympy import Symbol,solve,Eq

#Let x = minimum  number of power units consumed per month
x = Symbol('x')
#(i) Tariff A
#Total cost per month = meter rent + lighting charges + power charges
charge1 = 2*30.0 + 40.0*20.0 + 5*x            #Paise
#(ii) Tariff B
#Total cost per month = 12% of 2500 + energy charges for al purposes
charge2 = 0.12*2500.0*(100.0/12) + 3*(40.0 + x)          #Paise

#Equating tariff A and B
eq = Eq(charge1,charge2)
x  = solve(eq)
x1 = x
print "Minimum number of power units consumed per month = ",round(x1,2),"units."

Minimum number of power units consumed per month =  880.0 units.


## EXAMPLE 50.75 , PAGE NO :- 2000¶

In :
'''Transformers and low-tension motors of a certain size can be purchased at Rs. 12 per kVA of full output and Rs. 24 per kW
output respectively.If their respective efficiencies are 98% and 90%, what price per kW output could be paid for high-tension
motors of the same size but of average efficiency only 89%? Assume an annual load factor of 30%, the cost of energy per unit as
7 paise and interest and depreciation at the rate of 8% for low-tension motors.'''

from sympy import Symbol,solve,Eq

#Let S => The price of h.t motors per output kW in rupees
S = Symbol('S')

#-------Low-tension Motors with Transformers-----#
#Interest and depreciation charges of motors
charge1 = 24.0*0.08/0.9                        #Rs
#Interest and depreciation charges of transformers
charge2 = 12.0*0.9/0.99*0.08                   #Rs
#Running charges
charge3 = (8760*0.3)*7/(0.98*0.9*100)          #Rs

#Total cost of low tension motors with transformers
tot_chargeA = charge1 + charge2 + charge3       #Rs -----------(i)

#------High-tension Motors with Transformers----#

#Standing Charges/output kW
charge1 =  S*(0.12)/0.89                        #Rs
#Running charges
charge2 = (8760*0.3)*7/(0.89*100)               #Rs

#Total cost of high tension motors with transformers
tot_chargeB = charge1 + charge2                  #Rs -----------(ii)

#Equating (i) and (ii)
eq = Eq(tot_chargeA,tot_chargeB)
S = solve(eq)
S1 = S
print "The price of h.t motors per output kW = Rs.",round(S1,2)

The price of h.t motors per output kW = Rs. 36.2


## EXAMPLE 50.76 , PAGE NO :- 2001¶

In :
'''An industrial load can be supplied on the following alternative tariffs (a) highvoltage supply at Rs. 45 per kVA per annum
plus 1.5 paise per kWh or (b) low-voltage supply at Rs. 50 per annum plus 1.8 paise per kWh. Transformers and switchgear etc.
for the H.V. supply cost Rs. 35 per kVA, the full-load transformer losses being 2%. The fixed charges on the capital cost of
the high-voltage plant are 25% and the installation works at full-load. If there are 50 working weeks in a year, find the number
of working hours per week above which the H.V. supply is cheaper.'''

from sympy import Symbol,solve,Eq

#Let x be the number or working hours per week above which H.V. supply is cheaper than the L.V. supply.
x  =  Symbol('x')

#Cost of switchgear & trasformer
#annual fixed charge
charge1 = cost*0.25     #Rs

#Annual energy consumption
units = 100.0*x*50.0    #kWh

#(a) H.V. Supply
#Total annual cost = 45 * kVA + energy charges + charge on H.V. plant
charge_hv = 45*(rload) + units/0.98*(1.5/100) + charge1                 #Rs

#(b) L.V. Supply
#Total annual cost = Rs. 50 × kVA + energy charges
charge_lv = 50*load + units*(1.8/100)                                   #Rs

#If two annual costs are equal then
eq = Eq(charge_hv,charge_lv)
x = solve(eq)
x1 = x
print "number of hours per week above which the H.V. supply is cheaper = ",round(x1)

number of hours per week above which the H.V. supply is cheaper =  36.0


## EXAMPLE 50.77 , PAGE NO :- 2002¶

In :
'''For a particular drive in a factory requiring 10 h.p. (7.46 kW) motors, following tenders have been received. Which one
will you select ?
cost                                    efficiency
Motor X                            Rs. 1,150                                     86%
Motor Y                            Rs. 1,000                                     85%
Electrical tariff is Rs. 50 per kW + 5 paise per kWh. Assume interest and depreciation as 10% .'''

#(i) Motor X
pin = 7.46/0.86                 #kW        (Full load power input)
units = pin*8760.0              #kWh       (Units consumed/year)
#kW charges
charge1 = 50.0*pin              #Rs
#kWh charges
charge2 = (5.0/100)*units        #Rs
#Fixed charges
charge3 = (10.0/100)*1150.0     #Rs

#Total annual charges
tot_chargeX = charge1 + charge2 + charge3     #Rs

#-------------------------------------------------------------------------------#
#(ii) Motor Y
pin = 7.46/0.85                 #kW        (Full load power input)
units = pin*8760.0              #kWh       (Units consumed/year)
#kW charges
charge1 = 50.0*pin              #Rs
#kWh charges
charge2 = (5.0/100)*units         #Rs
#Fixed charges
charge3 = (10.0/100)*1000.0     #Rs

#Total annual charges
tot_chargeY = charge1 + charge2 + charge3     #Rs

#-------------------------------------------------------------------------------#
if (tot_chargeX > tot_chargeY):
savings = tot_chargeX - tot_chargeY       #Rs
print "Motor Y is cheaper by = Rs.",round(savings,2)
else:
savings = tot_chargeY - tot_chargeX      #Rs
print "Motor X is cheaper by = Rs.",round(savings,2)

Motor X is cheaper by = Rs. 34.8


## EXAMPLE 50.78 , PAGE NO :- 2002¶

In :
'''A 200-h p. (149.2 kW) motor is required to operate at full-load for 1500 hr, at half-load for 3000 hr per year and to
be shut down for the remainder of the time. Two motors are available.

Motor A : efficiency at full load = 90% ;          at half-load = 88%
Motor B : efficiency at full load = 90% ;          at half-load = 89%
The unit of energy is 5 paise/kWh and interest and depreciation may be taken as 12 per cent per year. If motor A cost
Rs. 9,000 ; what is the maximum price which could economically be paid for motor B ?'''

from sympy import Symbol,solve,Eq
#(i)Motor A
pin_fl = 149.2/0.9          #kW  (full-load power input)
pin_hl = (149.2/2)/0.88     #kW  (half-load power input)
pin_hl = round(pin_hl,1)
pin_fl = round(pin_fl,1)
#Total energy consumed in a year
units = 1500.0*pin_fl + 3000.0*pin_hl    #kWh
#Cost of energy is
charge1 = (5.0/100)*units   #Rs
#Interest and depreciation on motors
charge2 = 0.12*9000         #Rs
tot_chargeA = charge1 + charge2    #Rs ----------(i)
#------------------------------------------------------------------#

#(ii)Motor B
pin_fl = 149.2/0.9          #kW  (full-load power input)
pin_hl = (149.2/2)/0.89     #kW  (half-load power input)
pin_hl = round(pin_hl,1)
pin_fl = round(pin_fl,1)
#Total energy consumed in a year
units = 1500.0*pin_fl + 3000.0*pin_hl    #kWh
#Cost of energy is
charge1 = (5.0/100)*units   #Rs
#Let the cost of motor be x
x = Symbol('x')
#Interest and depreciation on motors
charge2 = 0.12*x         #Rs
tot_chargeB = charge1 + charge2    #Rs-------------(ii)

#Equating (i)&(ii)
eq = Eq(tot_chargeA,tot_chargeB)
x = solve(eq)
x1 = x
print "Cost of Motor B is = Rs.",round(x1,2)

Cost of Motor B is = Rs. 10250.0


## EXAMPLE 50.79 , PAGE NO :- 2003¶

In :
'''Two tenders A and B for a 1000-kVA, 0.8 power factor transformer are : A,full-load efficiency = 98.5% and iron
loss = 6 kW at rated voltage ; B, 98.8% and iron loss 4 kW but costs Rs. 1,500 more than A. The load cycle is 2000
hours per annum at full-load, 600 hours at halfload and 400 hours at 25 kVA. Annual charges for interest and
depreciation are 12.5% of capital cost and energy costs 3 paise per kWh. Which tender is better and what would be
the annual saving.'''

#Tender A
fl_out = 1000 * 0.8                          #kW
eff = (98.5/100)                             # (efficiency)
pin = fl_out/eff                            # (input power)
#Total losses
tot_loss = pin - fl_out                      #kW
#F.L. Cu losses
fl_culoss = tot_loss - 6.0                  #kW
#Total losses per year for a running period of 3000 hr. are—
#Iron loss
ir_loss = 3000 * 6.0                           #kWh
#F.L. Cu losses for 2000 hours
fl_units = 2000 * fl_culoss                  #kWh
#Cu loss at half-load for 600 hours
hl_units = 600*(fl_culoss/4)                #kWh

#Cu loss at 25 kVA load for 400 hours
units_kva = ((25.0/1000)**2)*fl_culoss*400.0   #kWh

#Total energy loss per year
enrgy_loss = ir_loss + fl_units + hl_units + units_kva #kWh
#Total Cost
costA = enrgy_loss*(3.0/100)                  #Rs.

#---------------------------------------------------------------------------#

#Tender  B
fl_out = 1000 * 0.8                          #kW
eff = (98.8/100)                             # (efficiency)
pin = fl_out/eff                             # (input power)
#Total losses
tot_loss = pin - fl_out                      #kW
#F.L. Cu losses
fl_culoss = tot_loss - 4.0                   #kW
#Total losses per year for a running period of 3000 hr. are—
#Iron loss
ir_loss = 3000 * 4                           #kWh
#F.L. Cu losses for 2000 hours
fl_units = 2000 * fl_culoss                  #kWh
#Cu loss at half-load for 600 hours
hl_units = 600*(fl_culoss/4)                #kWh

#Cu loss at 25 kVA load for 400 hours
units_kva = ((25.0/1000)**2)*fl_culoss*400.0   #kWh

#Total energy loss per year
enrgy_loss = ir_loss + fl_units + hl_units + units_kva #kWh
#Total Cost
costB = enrgy_loss*(3.0/100) + 1500.0*(12.5/100)       #Rs.

print "Total cost of Tender A is = Rs.",round(costA,2)
print "Total cost of Tender B is = Rs.",round(costB,2)

if (costA > costB):
diff = costA - costB
print "Tender B is cheaper by = Rs.",round(diff,2)
else:
diff = costB - costA
print "Tender A is cheaper by = Rs.",round(diff,2)

Total cost of Tender A is = Rs. 938.83
Total cost of Tender B is = Rs. 916.26
Tender B is cheaper by = Rs. 22.57


## EXAMPLE 50.80 , PAGE NO :- 2003¶

In :
'''Transformer A has iron loss of 150 kWh and load loss of 140 kWh daily while the corresponding losses of transformer B are 75 kWh
and 235 kWh. If annual charges are 12.5% of the capital costs and energy costs 5 paise per kWh, what should be the difference in the
cost of the two transformers so as to make them equally economical ?'''

#Transformer A
#Annual loss
annual_lossA = 365.0*(150 + 140)          #kWh       (Yearly loss)
#Transformer B
annual_lossB = 365.0*(75 + 235)           #kWh       (Yearly loss)

#Difference in yearly loss
tot_loss = annual_lossB - annual_lossA     #kWh

#Value of this loss
value = tot_loss*(5.0/100)                 #Rs

#As transformer B is costlier .
#Let the difference in capital cost of transformers be x
x = value/0.125                         #Rs

print "Transformer B should cost Rs.",round(x,2),"less than A."

Transformer B should cost Rs. 2920.0 less than A.


## EXAMPLE 50.81 , PAGE NO :- 2004¶

In :
'''Quotations received from three sources for transformers are :
A                 Rs. 41,000                16 kW                            50 kW
B                 Rs. 45,000                14 kW                            45 kW
C                 Rs. 38,000                19 kW                            60 kW
If the transformers are kept energized for the whole of day (24 hours), but will be on load for 12 hours per day, the remaining
period on no-load, the electricity cost being 5 paise per kWh and fixed charges Rs. 125 per kW of loss per annum and if
depreciation is 10% of the initial cost, which of the transformers would be most economical to purchase ?'''

#Transformer A
fl_loss = 50.0        #kW         (Full load losses)
nl_loss = 16.0        #kW         (No load losses)

fl_culoss = fl_loss - nl_loss    #kW   (Full load copper loss)

#Cu loss for 12 hours .Therefore units consumed
cu_units = fl_culoss*12          #kWh
#Iron loss for 24 hours.Therefore units consumed
ir_units = nl_loss*24            #kWh
#Total loss per day
day_loss = cu_units + ir_units   #kWh
#Annual loss is
anl_loss = day_loss*365.0        #kWh
#Cost of this loss is
loss_charge = anl_loss*(5.0/100)        #Rs
#Annual fixed charges
fxd_charge = 125.0*fl_loss       #Rs
#Annual depreciation
dep_charge = 0.1*41000.0         #Rs

#Total annual charges
tot_chargeA = loss_charge + fxd_charge + dep_charge        #Rs
print "Total annual charges for Transformer A is = Rs. ",round(tot_chargeA,2)
#--------------------------------------------------------------------------------------------#

#Transformer B
fl_loss = 45.0        #kW         (Full load losses)
nl_loss = 14.0        #kW         (No load losses)

fl_culoss = fl_loss - nl_loss    #kW   (Full load copper loss)

#Cu loss for 12 hours .Therefore units consumed
cu_units = fl_culoss*12          #kWh
#Iron loss for 24 hours.Therefore units consumed
ir_units = nl_loss*24            #kWh
#Total loss per day
day_loss = cu_units + ir_units   #kWh
#Annual loss is
anl_loss = day_loss*365.0        #kWh
#Cost of this loss is
loss_charge = anl_loss*(5.0/100)        #Rs
#Annual fixed charges
fxd_charge = 125.0*fl_loss       #Rs
#Annual depreciation
dep_charge = 0.1*45000.0         #Rs

#Total annual charges
tot_chargeB = loss_charge + fxd_charge + dep_charge        #Rs
print "Total annual charges for Transformer B is = Rs. ",round(tot_chargeB,2)
#--------------------------------------------------------------------------------------------#

#Transformer C
fl_loss = 60.0        #kW         (Full load losses)
nl_loss = 19.0        #kW         (No load losses)

fl_culoss = fl_loss - nl_loss    #kW   (Full load copper loss)

#Cu loss for 12 hours .Therefore units consumed
cu_units = fl_culoss*12          #kWh
#Iron loss for 24 hours.Therefore units consumed
ir_units = nl_loss*24            #kWh
#Total loss per day
day_loss = cu_units + ir_units   #kWh
#Annual loss is
anl_loss = day_loss*365.0        #kWh
#Cost of this loss is
loss_charge = anl_loss*(5.0/100)        #Rs
#Annual fixed charges
fxd_charge = 125.0*fl_loss       #Rs
#Annual depreciation
dep_charge = 0.1*38000.0         #Rs

#Total annual charges
tot_chargeC = loss_charge + fxd_charge + dep_charge        #Rs
print "Total annual charges for Transformer C is = Rs. ",round(tot_chargeC,2)
#--------------------------------------------------------------------------------------------#
if(tot_chargeA < tot_chargeB):
if(tot_chargeA < tot_chargeC):
print "Transformer A is cheaper."
else:
print "Transformer C is cheaper."
else:
if(tot_chargeB < tot_chargeC):
print "Transformer B is cheaper."
else:
print "Transformer C is cheaper."

Total annual charges for Transformer A is = Rs.  24804.0
Total annual charges for Transformer B is = Rs.  23046.0
Total annual charges for Transformer C is = Rs.  28601.0
Transformer B is cheaper.


## EXAMPLE 50.82 , PAGE NO :- 2005¶

In :
'''A 37.3 kW induction motor has power factor 0.9 and efficiency 0.9 at fullload,power factor 0.6 and efficiency 0.7 at half-load.
At no-load, the current is 25% of the full-load current and power factor 0.1. Capacitors are supplied to make the line power factor
0.8 at half-load.With these capacitors in circuit, find the line power factor at (i) full-load and (ii) no-load.'''

import math as m
from sympy import Symbol

p1 = 37.3/0.9           #kW
#Lagging kVAR drawn by the motor at full-load,
kvar1 = p1*(m.tan(m.acos(0.9)))      #kVAR

p2 = (37.3/2)/0.7       #kW
#Lagging kVAR drawn by motor at half-load,
kvar2 = p2*(m.tan(m.acos(0.6)))      #kVAR

#Let the line voltage be Vl
Vl = Symbol('Vl')
I1 = 37.3e+3/(1.73*0.9*0.9*Vl)       #A

I0 = 0.25*I1

#Motor Input at no-load P0 = 1.73*Vl*I0*cosQ
P0 = 1.73*Vl*I0*0.1/1000                  #W

#Lagging kVAR drawn by motor at no-load
kvar0 = P0*m.tan(m.acos(0.1))            #kW

#Lagging kVAR drawn from mains at half-load
kvar1 = p2*m.tan(m.acos(0.8))        #kW

#kVAR supplied by capacitors, kVARC = kVAR2 − kVAR2C
cap_kvar = kvar2 - kvar1
#kVAR drawn from the main at full-load with capacitors
fl_kvar = kvar1 - cap_kvar                     #kVAR

#(i) Line power factor at full-load is
pf_fl =   m.cos(m.atan(fl_kvar/p1))

print"Line power factor at full-load = ",round(pf_fl,2)
#----------------------------------------------------------------------------#

#(ii) kVAR drawn from mains at no-load with capacitors
nl_kvar = kvar0 - cap_kvar                     #kVAR

Line power factor at full-load =  0.99