In [1]:

```
#Variable declaration
connected_load = 450.0*10**3 #Connected load(kW)
maximum_demand = 250.0*10**3 #Maximum demand(kW)
units_generated = 615.0*10**6 #Units generated per annum(kWh)
#Calculation
#Case(i)
demand_factor = maximum_demand/connected_load #Demand factor
#Case(ii)
hours_year = 365.0*24 #Total hours in a year
average_demand = units_generated/hours_year #Average demand(kW)
load_factor = average_demand/maximum_demand #Load factor
#Result
print('Case(i) : Demand factor = %.3f ' %demand_factor)
print('Case(ii): Load factor = %.3f = %.1f percent' %(load_factor,load_factor*100))
```

In [1]:

```
#Variable declaration
maximum_demand = 480.0*10**3 #Maximum demand(kW)
LF = 0.4 #Annual load factor
#Calculation
hours_year = 365.0*24 #Total hours in a year
energy_gen = maximum_demand*LF*hours_year #Total energy generated annually(kWh)
#Result
print('Total energy generated annually = %.5e kWh' %energy_gen)
```

In [2]:

```
#Variable declaration
cap_baseload = 400.0*10**3 #Installed capacity of base load plant(kW)
cap_standby = 50.0*10**3 #Installed capacity of standby unit(kW)
output_baseload = 101.0*10**6 #Annual baseload station output(kWh)
output_standby = 87.35*10**6 #Annual standby station output(kWh)
peakload_standby = 120.0*10**3 #Peak load on standby station(kW)
hours_use = 3000.0 #Hours of standby station use/year(hrs)
#Calculation
#Case(i)
LF_1 = output_standby*100/(peakload_standby*hours_use) #Annual load factor(%)
hours_year = 365.0*24 #Total hours in a year
CF_1 = output_standby*100/(cap_standby*hours_year) #Annual capacity factor(%)
#Case(ii)
peakload_baseload = peakload_standby #Peak load on baseload station(kW)
LF_2 = output_baseload*100/(peakload_baseload*hours_use) #Annual load factor(%)
hours_year = 365.0*24 #Total hours in a year
CF_2 = output_baseload*100/(cap_baseload*hours_year) #Annual capacity factor(%)
#Result
print('Case(i) : Standby Station')
print(' Annual load factor = %.2f percent' %LF_1)
print(' Annual capacity factor = %.2f percent' %CF_1)
print('Case(ii): Base load Station')
print(' Annual load factor = %.2f percent' %LF_2)
print(' Annual capacity factor = %.2f percent' %CF_2)
print('\nNOTE: Incomplete solution in the textbook')
```

In [1]:

```
#Variable declaration
MD = 500.0 #Maximum demand(MW)
LF = 0.5 #Annual load factor
CF = 0.4 #Annual capacity factor
#Calculation
hours_year = 365.0*24 #Total hours in a year
energy_gen = MD*LF*hours_year #Energy generated/annum(MWh)
plant_cap = energy_gen/(CF*hours_year) #Plant capacity(MW)
reserve_cap = plant_cap-MD #Reserve capacity of plant(MW)
#Result
print('Reserve capacity of plant = %.f MW' %reserve_cap)
```

In [1]:

```
#Variable declaration
load_1 = 150.0 #Load supplied by station(MW)
load_2 = 120.0 #Load supplied by station(MW)
load_3 = 85.0 #Load supplied by station(MW)
load_4 = 60.0 #Load supplied by station(MW)
load_5 = 5.0 #Load supplied by station(MW)
MD = 220.0 #Maximum demand(MW)
LF = 0.48 #Annual load factor
#Calculation
#Case(a)
hours_year = 365.0*24 #Total hours in a year
units = LF*MD*hours_year #Number of units supplied annually
#Case(b)
sum_demand = load_1+load_2+load_3+load_4+load_5 #Sum of max demand of individual consumers(MW)
diversity_factor = sum_demand/MD #Diversity factor
#Case(c)
DF = MD/sum_demand #Demand factor
#Result
print('Case(a): Number of units supplied annually = %.2e units' %units)
print('Case(b): Diversity factor = %.3f ' %diversity_factor)
print('Case(c): Demand factor = %.3f = %.1f percent' %(DF,DF*100))
```

In [1]:

```
#Variable declaration
power_del_1 = 1000.0 #Power delivered by station(MW)
time_1 = 2.0 #Time for which power is delivered(hours)
power_del_2 = 500.0 #Power delivered by station(MW)
time_2 = 6.0 #Time for which power is delivered(hours)
days_maint = 60.0 #Maintenance days
max_gen_cap = 1000.0 #Max generating capacity(MW)
#Calculation
energy_sup_day = (power_del_1*time_1)+(power_del_2*time_2) #Energy supplied for each working day(MWh)
days_total = 365.0 #Total days in a year
days_op = days_total-days_maint #Operating days of station in a year
energy_sup_year = energy_sup_day*days_op #Energy supplied per year(MWh)
hours_day = 24.0 #Total hours in a day
working_hours = days_op*hours_day #Hour of working in a year
LF = energy_sup_year*100/(max_gen_cap*working_hours) #Annual load factor(%)
#Result
print('Annual load factor = %.1f percent' %LF)
```

In [1]:

```
#Variable declaration
load_industry = 750.0 #Industrial consumer load supplied by station(MW)
load_commercial = 350.0 #Commercial establishment load supplied by station(MW)
load_power = 10.0 #Domestic power load supplied by station(MW)
load_light = 50.0 #Domestic light load supplied by station(MW)
MD = 1000.0 #Maximum demand(MW)
kWh_gen = 50.0*10**5 #Number of kWh generated per year
#Calculation
#Case(i)
sum_demand = load_industry+load_commercial+load_power+load_light #Sum of max demand of individual consumers(MW)
diversity_factor = sum_demand/MD #Diversity factor
#Case(ii)
hours_year = 365.0*24 #Total hours in a year
average_demand = kWh_gen/hours_year #Average demand(MW)
LF = average_demand/MD #Load factor
#Result
print('Case(i) : Diversity factor = %.2f ' %diversity_factor)
print('Case(ii): Annual load factor = %.5f = %.f percent' %(LF,LF*100))
```

In [1]:

```
#Variable declaration
load_domestic = 15000.0 #Domestic load supplied by station(kW)
diversity_domestic = 1.25 #Diversity factor of domestic load
DF_domestic = 0.7 #Demand factor of domestic load
load_commercial = 25000.0 #Commercial load supplied by station(kW)
diversity_commercial = 1.2 #Diversity factor of commercial load
DF_commercial = 0.9 #Demand factor of commercial load
load_industry = 50000.0 #Industrial load supplied by station(kW)
diversity_industry = 1.3 #Diversity factor of industrial load
DF_industry = 0.98 #Demand factor of industrial load
diversity_factor = 1.5 #Overall system diversity factor
#Calculation
#Case(a)
sum_demand = load_domestic+load_commercial+load_industry #Sum of max demand of individual consumers(MW)
MD = sum_demand/diversity_factor #Maximum demand
#Case(b)
MD_domestic = load_domestic*diversity_domestic #Maximum domestic load demand(kW)
connected_domestic = MD_domestic/DF_domestic #Connected domestic load(kW)
MD_commercial = load_commercial*diversity_commercial #Maximum commercial load demand(kW)
connected_commercial = MD_commercial/DF_commercial #Connected commercial load(kW)
MD_industry = load_industry*diversity_industry #Maximum industrial load demand(kW)
connected_industry = MD_industry/DF_industry #Connected industrial load(kW)
#Result
print('Case(a): Maximum demand = %.f kW' %MD)
print('Case(b): Connected domestic load = %.1f kW' %connected_domestic)
print(' Connected commercial load = %.1f kW' %connected_commercial)
print(' Connected industrial load = %.1f kW' %connected_industry)
```

In [1]:

```
#Variable declaration
MD = 10000.0 #Maximum demand(kW)
load_1 = 2000.0 #Load from 11 PM-6 AM(kW)
t_1 = 7.0 #Time from 11 PM-6 AM(hour)
load_2 = 3500.0 #Load from 6 AM-8 AM(kW)
t_2 = 2.0 #Time from 6 AM-8 AM(hour)
load_3 = 8000.0 #Load from 8 AM-12 Noon(kW)
t_3 = 4.0 #Time from 8 AM-12 Noon(hour)
load_4 = 3000.0 #Load from 12 Noon-1 PM(kW)
t_4 = 1.0 #Time from 12 Noon-1 PM(hour)
load_5 = 7500.0 #Load from 1 PM-5 PM(kW)
t_5 = 4.0 #Time from 1 PM-5 PM(hour)
load_6 = 8500.0 #Load from 5 PM-7 PM(kW)
t_6 = 2.0 #Time from 5 PM-7 PM(hour)
load_7 = 10000.0 #Load from 7 PM-9 PM(kW)
t_7 = 2.0 #Time from 7 PM-9 PM(hour)
load_8 = 4500.0 #Load from 9 PM-11 PM(kW)
t_8 = 2.0 #Time from 9 PM-11 PM(hour)
#Calculation
energy_gen = (load_1*t_1)+(load_2*t_2)+(load_3*t_3)+(load_4*t_4)+(load_5*t_5)+(load_6*t_6)+(load_7*t_7)+(load_8*t_8) #Energy generated during 24 hours(kWh)
LF = energy_gen/(MD*24.0) #Load factor
no_units = 3.0 #Number of generating set
cap_1 = 5000.0 #Capacity of first generating unit(kW)
cap_2 = 3000.0 #Capacity of second generating unit(kW)
cap_3 = 2000.0 #Capacity of third generating unit(kW)
cap_reserve = cap_1 #Reserve capacity(kW) i.e largest size of generating unit
cap_installed = cap_1+cap_2+cap_3+cap_reserve #Installed capacity(kW)
cap_factor = energy_gen/(cap_installed*24.0) #Plant capacity factor
cap_plant = cap_3*t_1+(cap_3+cap_2)*t_2+(cap_2+cap_1)*t_3+cap_2*t_4+(cap_2+cap_1)*t_5+(cap_3+cap_2+cap_1)*t_6+(cap_3+cap_2+cap_1)*t_7+cap_1*t_8 #Capacity of plant running actually(kWh)
use_factor = energy_gen/cap_plant #Plant use factor
#Result
print('Number of generator units = %.f' %no_units)
print('Size of generator units required are %.f kW, %.f kW and %.f kW' %(cap_1,cap_2,cap_3))
print('Reserve plant capacity = %.f kW' %cap_reserve)
print('Load factor = %.2f = %.f percent' %(LF,LF*100))
print('Plant capacity factor = %.4f = %.2f percent' %(cap_factor,cap_factor*100))
print('Plant use factor = %.3f = %.1f percent' %(use_factor,use_factor*100))
print('Operating Schedule:')
print('-------------------------------------------------')
print(' TIME : GENERATOR SET RUN')
print('-------------------------------------------------')
print(' 11 PM - 6 AM : 2000 kW')
print(' 6 AM - 8 AM : 2000 kW & 3000 kW')
print(' 8 AM - 12 Noon : 3000 kW & 5000 kW')
print(' 12 Noon- 1 PM : 3000 kW')
print(' 1 PM - 5 PM : 3000 kW & 5000 kW')
print(' 5 PM - 7 PM : 2000 kW, 3000 kW & 5000 kW')
print(' 7 PM - 9 PM : 2000 kW, 3000 kW & 5000 kW')
print(' 9 PM - 11 PM : 5000 kW')
```

In [1]:

```
#Variable declaration
cap_installed = 210.0*10**3 #Installed capacity of the station(kW)
capital_cost_kW = 1000.0 #Capital cost of station(Rs/kW)
fixed_cost_per = 0.13 #Fixed cost = 13% * cost of investment
variable_cost_per = 1.3 #Variable cost = 1.3*fixed cost
#Calculation
MD = cap_installed #Maximum demand(kW)
hours_year = 365.0*24 #Total hours in a year
capital_cost = capital_cost_kW*cap_installed #Capital cost of station(Rs)
#Case(i) At 100% load factor
fixed_cost_1 = capital_cost*fixed_cost_per #Fixed cost(Rs)
variable_cost_1 = variable_cost_per*fixed_cost_1 #Variable cost(Rs)
operating_cost_1 = fixed_cost_1+variable_cost_1 #Operating cost per annum(Rs)
LF_1 = 1.0 #Load factor
units_gen_1 = LF_1*MD*hours_year #Total units generated(kWh)
cost_gen_1 = operating_cost_1*100/units_gen_1 #Cost of genaration per kWh(Paise)
#Case(ii) At 50% load factor
fixed_cost_2 = capital_cost*fixed_cost_per #Fixed cost(Rs)
LF_2 = 0.5 #Load factor
units_gen_2 = LF_2*MD*hours_year #Total units generated(kWh)
variable_cost_2 = variable_cost_1*units_gen_2/units_gen_1 #Variable cost(Rs)
operating_cost_2 = fixed_cost_2+variable_cost_2 #Operating cost per annum(Rs)
cost_gen_2 = operating_cost_2*100/units_gen_2 #Cost of generation per kWh(Paise)
#Result
print('Cost of generation per kWh at 100 percent load factor = %.2f paise' %cost_gen_1)
print('Cost of generation per kWh at 50 percent load factor = %.1f paise' %cost_gen_2)
print('Comment: As load factor is reduced, cost of generation is increased')
print('\nNOTE: ERROR: In problem statement, Capital cost of station is Rs. 1000/kW, not Rs. 1000/MW')
print(' Calculation mistake in Total units generated in Case(i) in textbook')
```

In [1]:

```
#Variable declaration
MD = 100.0*10**3 #Maximum demand(kW)
capital_cost = 200.0*10**6 #Capital cost(Rs)
LF = 0.4 #Annual load factor
cost_fueloil = 15.0*10**6 #Annual cost of fuel and oil(Rs)
cost_tax = 10.0*10**6 #Cost of taxes, wages and salaries(Rs)
interest = 0.15 #Interest and depreciation
#Calculation
hours_year = 365.0*24 #Total hours in a year
units_gen = MD*LF*hours_year #Units generated per annum(kWh)
fixed_charge = interest*capital_cost #Annual fixed charges(Rs)
running_charge = cost_fueloil+cost_tax #Annual running charges(Rs)
annual_charge = fixed_charge+running_charge #Total annual charges(Rs)
cost_unit = annual_charge*100/units_gen #Cost per unit(Paise)
#Result
print('Cost per unit generated = %.f paise' %cost_unit)
```

In [1]:

```
#Variable declaration
cap_installed = 500.0 #Installed capacity of the station(MW)
CF = 0.45 #Capacity factor
LF = 0.6 #Annual laod factor
cost_fueloil = 10.0*10**7 #Annual cost of fuel,oil etc(Rs)
capital_cost = 10**9 #Capital cost(Rs)
interest = 0.15 #Interest and depreciation
#Calculation
#Case(i)
MD = cap_installed*CF/LF #Maximum demand(MW)
cap_reserve = cap_installed-MD #Reserve capacity(MW)
#Case(ii)
hours_year = 365.0*24 #Total hours in a year
units_gen = MD*10**3*LF*hours_year #Units generated per annum(kWh)
fixed_charge = interest*capital_cost #Annual fixed charges(Rs)
running_charge = cost_fueloil #Annual running charges(Rs)
annual_charge = fixed_charge+running_charge #Total annual charges(Rs)
cost_unit = annual_charge*100/units_gen #Cost per kWh generated(Paise)
#Result
print('Case(i) : Minimum reserve capacity of station = %.f MW' %cap_reserve)
print('Case(ii): Cost per kWh generated = %.f paise' %cost_unit)
```

In [1]:

```
#Variable declaration
MD = 75.0*10**3 #Maximum demand(kW)
gen_expense = 850000.0 #Annual generation expense(Rs)
fuel_expense = 2800000.0 #Annual fuel expense(Rs)
trans_expense = 345000.0 #Annual transmission expense(Rs)
dist_expense = 2750000.0 #Annual distribution expense(Rs)
repair_expense = 300000.0 #Annual repairs,etc expense(Rs)
unit_gen = 600.0*10**6 #Number of units generated per year(kWh)
gen = 0.9 #Fixed charges for generation
fuel = 0.15 #Fixed charges for fuel
trans = 0.85 #Fixed charges for transmission
dist = 0.95 #Fixed charges for distribution
repair = 0.5 #Fixed charges for repairs,etc
loss_dist = 0.2 #Losses in transmission and distribution
#Calculation
fixed_gen = gen_expense*gen #Fixed charge on generation(Rs)
running_gen = gen_expense*(1-gen) #Running charge on generation(Rs)
fixed_fuel = fuel_expense*fuel #Fixed charge on fuel(Rs)
running_fuel = fuel_expense*(1-fuel) #Running charge on fuel(Rs)
fixed_trans = trans_expense*trans #Fixed charge on transmission(Rs)
running_trans = trans_expense*(1-trans) #Running charge on transmission(Rs)
fixed_dist = dist_expense*dist #Fixed charge on distribution(Rs)
running_dist = dist_expense*(1-dist) #Running charge on distribution(Rs)
fixed_repair = repair_expense*repair #Fixed charge on repairs,etc(Rs)
running_repair = repair_expense*(1-repair) #Running charge on repairs,etc(Rs)
fixed_charge = fixed_gen+fixed_fuel+fixed_trans+fixed_dist+fixed_repair #Total fixed charges(Rs)
running_charge = running_gen+running_fuel+running_trans+running_dist+running_repair #Total running charges(Rs)
fixed_unit = fixed_charge/MD #Fixed charges per unit(Rs)
units_dist = unit_gen*(1-loss_dist) #Total number of units distributed(kWh)
running_unit = running_charge*100/units_dist #Running charges per unit(Paise)
#Result
print('Two part tariff is Rs %.3f per kW of maximum demand plus %.3f paise per kWh' %(fixed_unit,running_unit))
```

In [1]:

```
#Variable declaration
cap_installed = 100.0*10**3 #Installed capacity of the station(kW)
capital_cost_kW = 1000.0 #Capital cost(Rs/kW)
depreciation = 0.15 #Annual depreciation charge
royalty_kW = 2.0 #Royalty per kW per year(Rs)
royalty_kWh = 0.03 #Royalty per kWh per year(Rs)
MD = 70.0*10**3 #Maximum demand(kW)
LF = 0.6 #Annual load factor
cost_salary = 1000000.0 #Annual cost of salaries,maintenance charges etc(Rs)
cost_salary_per = 0.2 #Annual cost of salaries,maintenance charges etc charged as fixed charges
#Calculation
hours_year = 365.0*24 #Total hours in a year
unit_gen = MD*LF*hours_year #Units generated/annum(kWh)
capital_cost = cap_installed*capital_cost_kW #Capital cost of plant(Rs)
depreciation_charge = depreciation*capital_cost #Depreciation charges(Rs)
salary_charge = cost_salary_per*cost_salary #Cost on salaries, maintenance etc(Rs)
fixed_charge = depreciation_charge+salary_charge #Total annual fixed charges(Rs)
cost_kW_fixed = (fixed_charge/MD)+royalty_kW #Cost per kW(Rs)
salary_charge_running = (1-cost_salary_per)*cost_salary #Annual running charge on salaries, maintenance etc(Rs)
cost_kWh_running = (salary_charge_running/unit_gen)+royalty_kWh #Cost per kWh(Rs)
#Result
print('Generation cost in two part form is given by, Rs. (%.2f*kW + %.3f*kWh) ' %(cost_kW_fixed,cost_kWh_running))
```

In [1]:

```
#Variable declaration
cap_installed = 100.0*10**3 #Installed capacity of station(kW)
cost_gen = 30.0 #Generating cost per annum(Rs)
cost_fixed = 4000000.0 #Fixed cost per annum(Rs)
cost_fuel = 60.0 #Cost of fuel(Rs/tonne)
calorific = 5700.0 #Calorific value of fuel(kcal/kg)
rate_heat_1 = 2900.0 #Plant heat rate at 100% capacity factor(kcal/kWh)
CF_1 = 1.0 #Capacity factor
rate_heat_2 = 4050.0 #Plant heat rate at 50% capacity factor(kcal/kWh)
CF_2 = 0.5 #Capacity factor
#Calculation
cost_fixed_kW = cost_fixed/cap_installed #Fixed cost per kW(Rs)
cost_fixed_total = cost_gen+cost_fixed_kW #Fixed cost per kW capacity(Rs)
average_demand_1 = CF_1*cap_installed #Average demand at 100% capacity factor(kW)
average_demand_2 = CF_2*cap_installed #Average demand at 50% capacity factor(kW)
hours_year = 365.0*24 #Total hours in a year
unit_gen_1 = 1*hours_year #Energy generated per annum with average demand of 1 kW(kWh)
unit_gen_2 = 0.5*hours_year #Energy generated per annum with average demand of 0.5 kW(kWh)
cost_kWh_fixed_1 = cost_fixed_total*100/unit_gen_1 #Cost per kWh due to fixed charge with 100% CF(Paise)
cost_kWh_fixed_2 = cost_fixed_total*100/unit_gen_2 #Cost per kWh due to fixed charge with 50% CF(Paise)
kg_kWh_1 = rate_heat_1/calorific #Weight(kg)
kg_kWh_2 = rate_heat_2/calorific #Weight(kg)
cost_coal_1 = kg_kWh_1*cost_fuel*100/1000.0 #Cost due to coal at 100% CF(Paise/kWh)
cost_coal_2 = kg_kWh_2*cost_fuel*100/1000.0 #Cost due to coal at 50% CF(Paise/kWh)
cost_total_1 = cost_kWh_fixed_1+cost_coal_1 #Total cost per unit with 100% CF(Paise)
cost_total_2 = cost_kWh_fixed_2+cost_coal_2 #Total cost per unit with 50% CF(Paise)
#Result
print('Overall generating cost per unit at 100 percent capacity factor = %.3f paise' %cost_total_1)
print('Overall generating cost per unit at 50 percent capacity factor = %.3f paise' %cost_total_2)
print('\nNOTE: Slight change in obtained answer from that of textbook answer is due to more precision')
```

In [1]:

```
#Variable declaration
MD = 75.0*10**3 #Maximum demand(kW)
LF = 0.4 #Yearly load factor
cost_capital = 60.0 #Capital cost(Rs/annum/kW)
cost_kWh = 1.0 #Cost per kWh transmitted(Paise)
charge_trans = 2000000.0 #Annual capital charge for transmission(Rs)
charge_dist = 1500000.0 #Annual capital charge for distribution(Rs)
diversity_trans = 1.2 #Diversity factor for transmission
diversity_dist = 1.25 #Diversity factor for distribution
n_trans = 0.9 #Efficiency of transmission system
n_dist = 0.85 #Efficiency of distribution system
#Calculation
#Case(a)
capital_cost = cost_capital*MD #Annual capital cost(Rs)
fixed_charge_sub = capital_cost+charge_trans #Total fixed charges for supply to substation per annum(Rs)
sum_MD_sub = MD*diversity_trans #Sum of all maximum demand of substation(kW)
cost_kW_sub = fixed_charge_sub/sum_MD_sub #Yearly cost per kW demand at substation(Rs)
running_cost_unit_sub = 1/n_trans #Running cost per unit supplied at substation(Paise)
#Case(b)
sum_MD_con = sum_MD_sub*diversity_dist #Sum of all maximum demand of consumer(kW)
fixed_charge_con = capital_cost+charge_trans+charge_dist #Total fixed charges for supply to cosnumers(Rs)
cost_kW_con = fixed_charge_con/sum_MD_con #Yearly cost per kW demand on consumer premises(Rs)
running_cost_unit_con = running_cost_unit_sub/n_dist #Running cost per unit supplied to consumer(Paise)
#Result
print('Case(a): Yearly cost per kW demand at the substations = Rs. %.2f ' %cost_kW_sub)
print(' Cost per kWh supplied at the substations = %.2f paise' %running_cost_unit_sub)
print('Case(b): Yearly cost per kW demand at the consumer premises = Rs. %.2f ' %cost_kW_con)
print(' Cost per kWh supplied at the consumer premises = %.3f paise' %running_cost_unit_con)
```

In [1]:

```
from sympy import Symbol,solve
#Variable declaration
kVA_tariff_hv = 60.0 #HV supply per kVA per annum(Rs)
kWh_tariff_hv = 3.0/100 #HV supply per kWh annum(Rs)
kVA_tariff_lv = 65.0 #LV supply per kVA per annum(Rs)
kWh_tariff_lv = 3.3/100 #LV supply per kWh annum(Rs)
cost_equip_kVA = 50.0 #Cost of transformers and switchgear per kVA(Rs)
loss_full_load = 0.02 #Full load transformation loss
fixed_charge_per = 0.2 #Fixed charges per annum
no_week = 50.0 #Number of working weeks in a year
#Calculation
rating_equip = 1000/(1-loss_full_load) #Rating of transformer and switchgear(kVA)
cost_equip = cost_equip_kVA*rating_equip #Cost of transformers and switchgear(Rs)
fixed_charge = fixed_charge_per*cost_equip #Fixed charges per annum on HV plant(Rs)
X = Symbol('X') #Number of working hours per week
units_cosumed = (no_week*X)*1000.0 #Yearly units consumed by load
total_units = units_cosumed/(1-loss_full_load) #Total units to be paid on HV supply
#Case(a)
annual_cost_hv = (kVA_tariff_hv*rating_equip)+(kWh_tariff_hv*cost_equip*X)+fixed_charge #Annual cost(Rs)
#Case(b)
annual_cost_lv = (kVA_tariff_lv*1000.0)+(kWh_tariff_lv*units_cosumed) #Annual cost(Rs)
x = solve(annual_cost_hv-annual_cost_lv) #Finding unknown value i.e working hours
x_sol = x[0] #Working hours
#Result
print('Above %.1f working hours per week the H.V supply is cheaper ' %x_sol)
```

In [1]:

```
#Variable declaration
load_1 = 10.0*10**3 #Load per annum(kVA)
time_1 = 1800.0 #Time(hours)
load_2 = 6.0*10**3 #Load per annum(kVA)
time_2 = 600.0 #Time(hours)
load_3 = 0.25*10**3 #Load per annum(kVA)
time_3 = 400.0 #Time(hours)
rating_trans = 10.0*10**3 #Transformer rating(kVA)
pf = 0.8 #Lagging power factor
n_fl_A = 98.3/100.0 #Full load efficiency of transformer A
n_fl_B = 98.8/100.0 #Full load efficiency of transformer B
loss_A = 70.0 #Core loss at rated voltage of transformer A(kW)
loss_B = 40.0 #Core loss at rated voltage of transformer B(kW)
cost_A = 250000.0 #Cost of transformer A(Rs)
cost_B = 280000.0 #Cost of transformer B(Rs)
interest_per = 0.1 #Interest and depreciation charges
cost_energy_unit = 3.0 #Energy costs per unit(Paise)
#Calculation
#Transformer A
output_A = rating_trans*pf #kW output at full load(kW)
input_A = output_A/n_fl_A #Input at full load(kW)
cu_loss_fl_A = input_A-output_A-loss_A #Copper loss at full load(kW)
cu_loss_2_A = (load_2/load_1)**2*cu_loss_fl_A #Copper loss at 6 MVA output(kW)
cu_loss_3_A = (load_3/load_1)**2*cu_loss_fl_A #Copper loss at 0.25 MVA output(kW)
ene_iron_loss_A = loss_A*(time_1+time_2+time_3) #Energy consumed due to iron losses(kWh)
ene_cu_loss_A = time_1*cu_loss_fl_A+time_2*cu_loss_2_A+time_3*cu_loss_3_A #Energy consumed due to copper losses(kWh)
total_loss_A = ene_iron_loss_A+ene_cu_loss_A #Total loss per annum(kWh)
cost_energy_A = cost_energy_unit/100*total_loss_A #Energy cost per annum due to losses(Rs)
#Transformer B
output_B = rating_trans*pf #kW output at full load(kW)
input_B = output_B/n_fl_B #Input at full load(kW)
cu_loss_fl_B = input_B-output_B-loss_B #Copper loss at full load(kW)
cu_loss_2_B = (load_2/load_1)**2*cu_loss_fl_B #Copper loss at 6 MVA output(kW)
cu_loss_3_B = (load_3/load_1)**2*cu_loss_fl_B #Copper loss at 0.25 MVA output(kW)
ene_iron_loss_B = loss_B*(time_1+time_2+time_3) #Energy consumed due to iron losses(kWh)
ene_cu_loss_B = time_1*cu_loss_fl_B+time_2*cu_loss_2_B+time_3*cu_loss_3_B #Energy consumed due to copper losses(kWh)
total_loss_B = ene_iron_loss_B+ene_cu_loss_B #Total loss per annum(kWh)
cost_energy_B = cost_energy_unit/100*total_loss_B #Energy cost per annum due to losses(Rs)
diff_capital = cost_B-cost_A #Difference in capital costs(Rs)
annual_charge = interest_per*diff_capital #Annual charge due to this amount(Rs)
diff_cost_energy = cost_energy_A-cost_energy_B #Difference in energy cost per annum(Rs)
cheap = diff_cost_energy-annual_charge #Cheaper in cost(Rs)
#Result
print('Transformer B is cheaper by Rs. %.f per year' %cheap)
print('\nNOTE: ERROR: In problem statement, Full load efficiency for transformer B is 98.8 percent, not 98.3 percent as given')
print(' Changes in obtained answer from that of textbook answer is due to more precision')
```

In [1]:

```
#Variable declaration
fixed_cost = 4.0*10**4 #Fixed cost of plant(Rs)
salvage_value = 4.0*10**3 #Salvage value(Rs)
n = 20.0 #Useful life(years)
n_2 = n/2 #Halfway of useful life(years)
r = 0.06 #Sinking fund depreciation compounded annually
#Calculation
#Case(a)
total_dep_A = fixed_cost-salvage_value #Total depreciation in 20 years(Rs)
dep_10_A = total_dep_A/2 #Depreciation in 10 years(Rs)
value_10_A = fixed_cost-dep_10_A #Value at the end of 10 years(Rs)
#Case(b)
P_B = fixed_cost #Capital outlay(Rs)
q_B = (salvage_value/fixed_cost)**(1/n) #q = (1-p)
value_10_B = P_B*(q_B)**n_2 #Value at the end of 10 years(Rs)
#Case(c)
P_C = fixed_cost #Capital cost of plant(Rs)
P__C = salvage_value #Scrap value(Rs)
Q_C = P_C-P__C #Cost of replacement(Rs)
q_C = Q_C/(((1+r)**n-1)/r) #Yearly charge(Rs)
amount_dep = q_C*((1+r)**n_2-1)/r #Amount deposited at end of 10 years(Rs)
value_10_C = P_C-amount_dep #Value at the end of 10 years(Rs)
#Result
print('Case(a): Value at the end of 10 years based on Straight line depreciation method = Rs %.1e ' %value_10_A)
print('Case(b): Value at the end of 10 years based on Reducing balance depreciation method = Rs %.2e ' %value_10_B)
print('Case(c): Value at the end of 10 years based on Sinking fund depreciation method = Rs %.2e ' %value_10_C)
```

In [1]:

```
#Variable declaration
h = 30.0 #Mean head(m)
area_catch = 250.0 #Catchment area(Square km)
average_rain = 1.25 #Average rainfall per annum(m)
utilized_rain = 0.7 #Rainfall utilized
LF = 0.8 #Expected load factor
n_turbine = 0.9 #Mechanical efficiency of turbine
n_gen = 0.95 #Efficiency of generator
#Calculation
water_avail = utilized_rain*area_catch*10**6*average_rain #Water available(m^3)
sec_year = 365.0*24*60*60 #Total seconds in a year
Q = water_avail/sec_year #Quantity available per second(m^3) i.e Discharge(m^3/sec)
w = 1000.0 #Density of water(kg/m^3)
n = n_turbine*n_gen #Overall efficiency
P = 0.736/75*Q*w*h*n #Average output of generator units(kW)
rating_gen = P/LF #Rating of generator(kW)
rating_gen_each = rating_gen/2.0 #Rating of each generator(kW)
rating_turbine = rating_gen/2*(1/(0.736*n_gen)) #Rating of each turbine(metric hp)
#Result
print('Choice of units are:')
print(' 2 generators each having maximum rating of %.f kW ' %rating_gen_each)
print(' 2 propeller turbines each having maximum rating of %.f metric hp ' %rating_turbine)
print('\nNOTE: Changes in obtained answer from that of textbook answer is due to more precision')
```

In [1]:

```
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,show,grid
#Variable declaration
t0 = 0.0 #Time 12 morning
l0 = 4.0 #Load at 12 morning(kW*1000)
t1 = 1.0 #Time 1 a.m
l1 = 3.5 #Load at 1 a.m(kW*1000)
t2 = 2.0 #Time 2 a.m
l2 = 3.0 #Load at 2 a.m(kW*1000)
t3 = 3.0 #Time 3 a.m
l3 = 3.0 #Load at 3 a.m(kW*1000)
t4 = 4.0 #Time 4 a.m
l4 = 3.5 #Load at 4 a.m(kW*1000)
t5 = 5.0 #Time 5 a.m
l5 = 3.0 #Load at 5 a.m(kW*1000)
t6 = 6.0 #Time 6 a.m
l6 = 6.0 #Load at 6 a.m(kW*1000)
t7 = 7.0 #Time 7 a.m
l7 = 12.5 #Load at 7 a.m(kW*1000)
t8 = 8.0 #Time 8 a.m
l8 = 14.5 #Load at 8 a.m(kW*1000)
t9 = 9.0 #Time 9 a.m
l9 = 13.5 #Load at 9 a.m(kW*1000)
t10 = 10.0 #Time 10 a.m
l10 = 13.0 #Load at 10 a.m(kW*1000)
t11 = 11.0 #Time 11 a.m
l11 = 13.5 #Load at 11 a.m(kW*1000)
t113 = 11.50 #Time 11.30 a.m
l113 = 12.0 #Load at 11.30 am(kW*1000)
t12 = 12.0 #Time 12 noon
l12 = 11.0 #Load at 12 noon(kW*1000)
t123 = 12.50 #Time 12.30 noon
l123 = 5.0 #Load at 12.30 noon(kW*1000)
t13 = 13.0 #Time 1 p.m
l13 = 12.5 #Load at 1 p.m(kW*1000)
t133 = 13.50 #Time 1.30 p.m
l133 = 13.5 #Load at 1.30 p.m(kW*1000)
t14 = 14.0 #Time 2 p.m
l14 = 14.0 #Load at 2 p.m(kW*1000)
t15 = 15.0 #Time 3 p.m
l15 = 14.0 #Load at 3 p.m(kW*1000)
t16 = 16.0 #Time 4 p.m
l16 = 15.0 #Load at 4 p.m(kW*1000)
t163 = 16.50 #Time 4.30 p.m
l163 = 18.0 #Load at 4.30 p.m(kW*1000)
t17 = 17.0 #Time 5 p.m
l17 = 20.0 #Load at 5 p.m(kW*1000)
t173 = 17.50 #Time 5.30 p.m
l173 = 17.0 #Load at 5.30 p.m(kW*1000)
t18 = 18.0 #Time 6 p.m
l18 = 12.5 #Load at 6 p.m(kW*1000)
t19 = 19.0 #Time 7 p.m
l19 = 10.0 #Load at 7 p.m(kW*1000)
t20 = 20.0 #Time 8 p.m
l20 = 7.5 #Load at 8 p.m(kW*1000)
t21 = 21.0 #Time 9 p.m
l21 = 5.0 #Load at 9 p.m(kW*1000)
t22 = 22.0 #Time 10 p.m
l22 = 5.0 #Load at 10 p.m(kW*1000)
t23 = 23.0 #Time 11 p.m
l23 = 4.0 #Load at 11 p.m(kW*1000)
t24 = 24.0 #Time 12 morning
l24 = 4.0 #Load at 12 morning(kW*1000)
#Calculation
#Chronological load curve
plot(
[t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t113,t12,t123,t13,t133,t14,t15,t16,t163,t17,t173,t18,t19,t20,t21,t22,t23,t24],
[l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l113,l12,l123,l13,l133,l14,l15,l16,l163,l17,l173,l18,l19,l20,l21,l22,l23,l24],
marker='o',color='b')
text(18,l8,'Chronological load curve',color='b')
#Load duration curve
plot(
[0,0.5,1,1.5,2.5,4.5,6,7,9,9.5,10,11,12,13,15.5,18.5,20.5,23.5,24],
[20,18,17,15,14.5,14,13.5,13,12.5,12,11,10,7.5,6,5,4,3.5,3,3],marker='o',linestyle='--',color='g'
)
text(1.5,16,'Load duration curve',color='g')
axis([0,24,0,20])
title('Plot of Chronological load curve and Load duration curve')
xlabel('Time & No. of hours')
ylabel('Load in 10^3 kW')
grid()
show()
#Result
print('\nNOTE: The time is plotted in 24 hours format')
```

In [1]:

```
#Variable declaration
MD = 20.0*10**3 #Maximum demand(kW)
LF = 0.6 #Load factor
CF = 0.48 #Plant capacity factor
UF = 0.8 #Plant use factor
#Calculation
#Case(a)
avg_demand = LF*MD #Average demand(kW)
ene_daily = avg_demand*24.0 #Daily energy produced(kWh)
#Case(b)
cap_installed = avg_demand/CF #Installed capacity(kW)
cap_reserve = cap_installed-MD #Reserve capacity(kW)
#Case(c)
max_ene_C = cap_installed*24.0 #Maximum energy that could be produced daily(kWh)
#Case(d)
max_ene_D = ene_daily/UF #Maximum energy that could be produced daily as per schedule(kWh)
#Result
print('Case(a): Daily energy produced = %.f kWh' %ene_daily)
print('Case(b): Reserve capacity of plant = %.f kW' %cap_reserve)
print('Case(c): Maximum energy that could be produced daily when plant runs at all time = %.f kWh' %max_ene_C)
print('Case(d): Maximum energy that could be produced daily when plant runs fully loaded = %.f kWh' %max_ene_D)
```

In [1]:

```
#Variable declaration
cap_3sets = 600.0 #Capacity of 3 generators(kW)
no_3 = 3.0 #Number of sets of 600 kW
cap_4thset = 400.0 #Capacity of 4th generator set(kW)
no_4 = 1.0 #Number of sets of 400 kW
MD = 1600.0 #Maximum demand(kW)
LF = 0.45 #Load factor
cost_capital_kW = 1000.0 #Capital cost per kW installed capacity(Rs)
cost_annual_per = 0.15 #Annual cost = 15% of capital cost
cost_operation = 60000.0 #Annual operation cost(Rs)
cost_maintenance = 30000.0 #Annual maintenance cost(Rs)
fixed_maintenance = 1.0/3 #Fixed cost
variable_maintenance = 2.0/3 #Variable cost
cost_fuel_kg = 40.0/100 #Cost of fuel oil(Rs/kg)
cost_oil_kg = 1.25 #Cost of lubricating oil(Rs/kg)
calorific = 10000.0 #Calorific value of fuel(kcal/kg)
oil_consum = 1.0/400 #Consumption of lubricating oil. 1kg for every 400kWh generated
fuel_consum = 1.0/2 #Consumption of fuel. 1kg for every 2kWh generated
n_gen = 0.92 #Generator efficiency
heat_lost = 1.0/3 #Heat lost in the fuel to cooling water
theta = 11.0 #Difference of temperature between inlet and outlet(Â°C)
#Calculation
#Case(a)
rating_3set_A = cap_3sets/n_gen #Rating of first 3 sets(kW)
rating_4th_A = cap_4thset/n_gen #Rating of 4th set(kW)
#Case(b)
avg_demand_B = LF*MD #Average demand(kW)
hours_year = 365.0*24 #Total hours in a year
energy_B = avg_demand_B*hours_year #Annual energy produced(kWh)
#Case(c)
total_invest = (no_3*cap_3sets+cap_4thset*no_4)*cost_capital_kW #Total investment(Rs)
annual_cost = cost_annual_per*total_invest #Annual cost(Rs)
maintenance_cost = fixed_maintenance*cost_maintenance #Maintenance cost(Rs)
fixed_cost_total = annual_cost+maintenance_cost #Total fixed cost per annum(Rs)
fuel_consumption = energy_B*fuel_consum #Fuel consumption(Kg)
cost_fuel = fuel_consumption*cost_fuel_kg #Cost of fuel(Rs)
oil_consumption = energy_B*oil_consum #Lubrication oil consumption(Kg)
cost_oil = oil_consumption*cost_oil_kg #Cost of Lubrication oil(Rs)
var_maintenance_cost = variable_maintenance*cost_maintenance #Variable part of maintenance cost(Rs)
variable_cost_total = cost_fuel+cost_oil+var_maintenance_cost+cost_operation #Total variable cost per annum(Rs)
cost_total_D = fixed_cost_total+variable_cost_total #Total cost per annum(Rs)
cost_kWh_gen = cost_total_D/energy_B*100 #Cost per kWh generated(Paise)
#Case(c)
n_overall = energy_B*860/(fuel_consumption*calorific)*100 #Overall efficiency(%)
#Case(d)
weight_water_hr = heat_lost*fuel_consumption/(hours_year*theta)*calorific #Weight of cooling water required(kg/hr)
weight_water_min = weight_water_hr/60.0 #Weight of cooling water required(kg/min)
capacity_pump = weight_water_min*MD/avg_demand_B #Capacity of cooling water pump(kg/min)
#Result
print('Case(a): Rating of first 3 sets of diesel engine = %.f kW' %rating_3set_A)
print(' Rating of 4th set of diesel engine = %.f kW' %rating_4th_A)
print('Case(b): Annual energy produced = %.1e kWh' %energy_B)
print('Case(c): Total fixed cost = Rs %.f ' %fixed_cost_total)
print(' Total variable cost = Rs %.f ' %variable_cost_total)
print(' Cost per kWh generated = %.f paise' %cost_kWh_gen)
print('Case(d): Overall efficiency of the diesel plant = %.1f percent' %n_overall)
print('Case(e): Quantity of cooling water required per round = %.1e kg/hr = %.f kg/min' %(weight_water_hr,weight_water_min))
print(' Capacity of cooling-water pumps under maximum load = %.f kg/min' %capacity_pump)
print('\nNOTE: Changes in obtained answer from that of textbook answer is due to more precision')
```

In [1]:

```
#Variable declaration
cap_installed = 30.0*10**3 #Rating of each generators(kW)
no = 4.0 #Number of installed generators
MD = 100.0*10**3 #Maximum demand(kW)
LF = 0.8 #Load factor
cost_capital_kW = 800.0 #Capital cost per kW installed capacity(Rs)
depreciation_per = 0.125 #Depreciation,etc = 12.5% of capital cost
cost_operation = 1.2*10**6 #Annual operation cost(Rs)
cost_maintenance = 600000.0 #Annual maintenance cost(Rs)
fixed_maintenance = 1.0/3 #Fixed cost
variable_maintenance = 2.0/3 #Variable cost
cost_miscellaneous = 100000.0 #Miscellaneous cost(Rs)
cost_fuel_kg = 32.0/1000 #Cost of fuel oil(Rs/kg)
calorific = 6400.0 #Calorific value of fuel(kcal/kg)
n_gen = 0.96 #Generator efficiency
n_thermal = 0.28 #Thermal efficiency of turbine
n_boiler = 0.75 #Boiler efficiency
n_overall = 0.2 #Overall thermal efficiency
#Calculation
#Case(a)
rating_turbine = cap_installed/(n_gen*0.736) #Rating of each steam turbine(metric hp)
#Case(b)
avg_demand_B = LF*MD #Average demand(kW)
hours_year = 365.0*24 #Total hours in a year
energy_B = avg_demand_B*hours_year #Annual energy produced(kWh)
#Case(c)
steam_consumption_C = (0.8+3.5*LF)/LF #Average steam consumption(kg/kWh)
#Case(d)
LF_D = 1.0 #Assumption that Load factor for boiler
steam_consumption_D = (0.8+3.5*LF_D)/LF_D #Steam consumption(kg/kWh)
energy_D = cap_installed*1.0 #Energy output per hour per set(kWh)
evaporation_cap = steam_consumption_D*energy_D #Evaporation capacity of boiler(kg/hr)
#Case(e)
total_invest = no*cap_installed*cost_capital_kW #Total investment(Rs)
capital_cost = depreciation_per*total_invest #Capital cost(Rs)
maintenance_cost = fixed_maintenance*cost_maintenance #Maintenance cost(Rs)
fixed_cost_total = capital_cost+maintenance_cost #Total fixed cost per annum(Rs)
var_maintenance_cost = variable_maintenance*cost_maintenance #Variable part of maintenance cost(Rs)
input_E = energy_B/n_overall #Input into system per annum(kWh)
weight_fuel = input_E*860/calorific #Weight of fuel(kg)
cost_fuel = weight_fuel*cost_fuel_kg #Cost of fuel(Rs)
variable_cost_total = cost_operation+var_maintenance_cost+cost_miscellaneous+cost_fuel #Total variable cost per annum(Rs)
cost_total_E = fixed_cost_total+variable_cost_total #Total cost per annum(Rs)
cost_kWh_gen = cost_total_E/energy_B*100 #Cost per kWh generated(Paise)
#Result
print('Case(a): Rating of each steam turbine = %.f metric hp' %rating_turbine)
print('Case(b): Energy produced per annum = %.3e kWh' %energy_B)
print('Case(c): Average steam consumption per kWh = %.1f kg/kWh' %steam_consumption_C)
print('Case(d): Evaporation capacity of boiler = %.f kg/hr' %evaporation_cap)
print('Case(e): Total fixed cost = Rs %.2e ' %fixed_cost_total)
print(' Total variable cost = Rs %.2e ' %variable_cost_total)
print(' Cost per kWh generated = %.2f paise' %cost_kWh_gen)
print('\nNOTE: Changes in obtained answer from that of textbook answer is due to more precision')
```

In [1]:

```
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,show
#Variable declaration
w1 = 1.0 #Week 1
Q1 = 200.0 #Discharge during week 1(m^2/sec)
w2 = 2.0 #Week 2
Q2 = 300.0 #Discharge during week 2(m^2/sec)
w3 = 3.0 #Week 3
Q3 = 1100.0 #Discharge during week 3(m^2/sec)
w4 = 4.0 #Week 4
Q4 = 700.0 #Discharge during week 4(m^2/sec)
w5 = 5.0 #Week 5
Q5 = 900.0 #Discharge during week 5(m^2/sec)
w6 = 6.0 #Week 6
Q6 = 800.0 #Discharge during week 6(m^2/sec)
w7 = 7.0 #Week 7
Q7 = 600.0 #Discharge during week 7(m^2/sec)
w8 = 8.0 #Week 8
Q8 = 1000.0 #Discharge during week 8(m^2/sec)
w9 = 9.0 #Week 9
Q9 = 500.0 #Discharge during week 9(m^2/sec)
w10 = 10.0 #Week 10
Q10 = 400.0 #Discharge during week 10(m^2/sec)
w11 = 11.0 #Week 11
Q11 = 500.0 #Discharge during week 11(m^2/sec)
w12 = 12.0 #Week 12
Q12 = 700.0 #Discharge during week 12(m^2/sec)
w13 = 13.0 #Week 13
Q13 = 100.0 #Discharge during week 13(m^2/sec)
no_week = 13.0 #Total weeks of discharge
#Calculation
Q_average = (Q1+Q2+Q3+Q4+Q5+Q6+Q7+Q8+Q9+Q10+Q11+Q12+Q13)/no_week #Average weekly discharge(m^3/sec)
#Hydrograph
plot(
[0,w1,w1,w2,w2,w3,w3,w4,w4,w5,w5,w6,w6,w7,w7,w8,w8,w9,w9,w10,w10,w11,w11,w12,w12,w13,w13,w13],
[200,Q1,Q2,Q2,Q3,Q3,Q4,Q4,Q5,Q5,Q6,Q6,Q7,Q7,Q8,Q8,Q9,Q9,Q10,Q10,Q11,Q11,Q12,Q12,Q13,Q13,Q13,0],
color='b',linewidth = 2
) #Plotting hydrograph
text(8.2,Q6,'Hydrograph',color='b')
Q = Q_average
plot(
[0,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12,w13,14],
[Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q],
color='g',linestyle='--'
) #Plotting average weekly discharge
text(13,Q-40,'Q_av',color='g')
text(12.02,120,'Q_min',color='r')
text(2.02,1120,'Q_max',color='r')
axis([0,14,0,1200])
title('Plot of Hydrograph')
xlabel('Time(week)')
ylabel('Q(m^3/sec)')
show()
#Result
print('Average discharge available for the whole period = %.f m^3/sec' %Q_average)
```

In [1]:

```
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,grid,show
#Variable declaration
Q1 = 1100.0 #Discharge in descending order(m^3/sec)
Q2 = 1000.0 #Discharge(m^3/sec)
Q3 = 900.0 #Discharge(m^3/sec)
Q4 = 800.0 #Discharge(m^3/sec)
Q5 = 700.0 #Discharge(m^3/sec)
Q6 = 600.0 #Discharge(m^3/sec)
Q7 = 500.0 #Discharge(m^3/sec)
Q8 = 400.0 #Discharge(m^3/sec)
Q9 = 300.0 #Discharge(m^3/sec)
Q10 = 200.0 #Discharge(m^3/sec)
Q11 = 100.0 #Discharge(m^3/sec)
no_week = 13.0 #Total weeks of discharge
h = 200.0 #Head of installation(m)
n_overall = 0.88 #Overall efficiency of turbine and generator
w = 1000.0 #Density of water(kg/m^3)
#Calculation
n1 = 1.0 #Number of weeks for 1100 discharge(m^3/sec)
n2 = 2.0 #Number of weeks for 1000 and above discharge(m^3/sec)
n3 = 3.0 #Number of weeks for 900 and above discharge(m^3/sec)
n4 = 4.0 #Number of weeks for 800 and above discharge(m^3/sec)
n5 = 6.0 #Number of weeks for 700 and above discharge(m^3/sec)
n6 = 7.0 #Number of weeks for 600 and above discharge(m^3/sec)
n7 = 9.0 #Number of weeks for 500 and above discharge(m^3/sec)
n8 = 10.0 #Number of weeks for 400 and above discharge(m^3/sec)
n9 = 11.0 #Number of weeks for 300 and above discharge(m^3/sec)
n10 = 12.0 #Number of weeks for 200 and above discharge(m^3/sec)
n11 = 13.0 #Number of weeks for 100 and above discharge(m^3/sec)
P1 = n1/no_week*100 #Percentage of total period for n1
P2 = n2/no_week*100 #Percentage of total period for n2
P3 = n3/no_week*100 #Percentage of total period for n3
P4 = n4/no_week*100 #Percentage of total period for n4
P5 = n5/no_week*100 #Percentage of total period for n5
P6 = n6/no_week*100 #Percentage of total period for n6
P7 = n7/no_week*100 #Percentage of total period for n7
P8 = n8/no_week*100 #Percentage of total period for n8
P9 = n9/no_week*100 #Percentage of total period for n9
P10 = n10/no_week*100 #Percentage of total period for n10
P11 = n11/no_week*100 #Percentage of total period for n11
plot(
[0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11],
[Q1,Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11],
marker='o',color='b'
) #Plotting flow duration curve
text(30,900,'Flow duration curve',color='b')
axis([0,100,0,1200])
title('Plot of Flow-duration curve')
xlabel('Percentage of time')
ylabel('Q(m^3/sec)')
grid()
show()
Q_1 = 1.0 #Discharge(m^3/sec)
P_1 = 0.736/75*w*Q_1*h*n_overall #Power developed for Q_1(kW)
Q_av = 600.0 #Average discharge(m^3/sec). Obtained from Example 1.7.25
P_av = P_1*Q_av/1000.0 #Average power developed(MW)
Q_max = Q1 #Maximum discharge(m^3/sec)
P_max = P_1*Q_max/1000.0 #Maximum power developed(MW)
Q_10 = 1070.0 #Discharge for 10% of time(m^3/sec). Value is obtained from graph
P_10 = P_1*Q_10/1000.0 #Installed capacity(MW)
#Result
print('Maximum power developed = %.f MW' %P_max)
print('Average power developed = %.f MW' %P_av)
print('Capacity of proposed station = %.f MW' %P_10)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to more precision here & approximation in textbook solution')
```

In [1]:

```
%matplotlib inline
from matplotlib.pyplot import plot,title,xlabel,ylabel,text,axis,show
#Variable declaration
Q1 = 700.0 #Discharge for week1(m^3/sec)
Q2 = 700.0 #Discharge for week2(m^3/sec)
Q3 = 700.0 #Discharge for week3(m^3/sec)
Q4 = 600.0 #Discharge for week4(m^3/sec)
Q5 = 400.0 #Discharge for week5(m^3/sec)
Q6 = 300.0 #Discharge for week6(m^3/sec)
Q7 = 400.0 #Discharge for week7(m^3/sec)
Q8 = 600.0 #Discharge for week8(m^3/sec)
Q9 = 1500.0 #Discharge for week9(m^3/sec)
Q10 = 900.0 #Discharge for week10(m^3/sec)
Q11 = 600.0 #Discharge for week11(m^3/sec)
Q12 = 300.0 #Discharge for week12(m^3/sec)
Q13 = 100.0 #Discharge for week13(m^3/sec)
#Calculation
Q_dsm = 60.0*60*24 #Discharge in day-sec-metres(m^3)
V1 = 7.0*Q1 #Weekly volume for week1(day-sec-metre)
V2 = 7.0*Q2 #Weekly volume for week2(day-sec-metre)
V3 = 7.0*Q3 #Weekly volume for week3(day-sec-metre)
V4 = 7.0*Q4 #Weekly volume for week4(day-sec-metre)
V5 = 7.0*Q5 #Weekly volume for week5(day-sec-metre)
V6 = 7.0*Q6 #Weekly volume for week6(day-sec-metre)
V7 = 7.0*Q7 #Weekly volume for week7(day-sec-metre)
V8 = 7.0*Q8 #Weekly volume for week8(day-sec-metre)
V9 = 7.0*Q9 #Weekly volume for week9(day-sec-metre)
V10 = 7.0*Q10 #Weekly volume for week10(day-sec-metre)
V11 = 7.0*Q11 #Weekly volume for week11(day-sec-metre)
V12 = 7.0*Q12 #Weekly volume for week12(day-sec-metre)
V13 = 7.0*Q13 #Weekly volume for week13(day-sec-metre)
C1 = V1 #Cumulative flow for week1(day-sec-metre)
C2 = V2+C1 #Cumulative flow for week2(day-sec-metre)
C3 = V3+C2 #Cumulative flow for week3(day-sec-metre)
C4 = V4+C3 #Cumulative flow for week4(day-sec-metre)
C5 = V5+C4 #Cumulative flow for week5(day-sec-metre)
C6 = V6+C5 #Cumulative flow for week6(day-sec-metre)
C7 = V7+C6 #Cumulative flow for week7(day-sec-metre)
C8 = V8+C7 #Cumulative flow for week8(day-sec-metre)
C9 = V9+C8 #Cumulative flow for week9(day-sec-metre)
C10 = V10+C9 #Cumulative flow for week10(day-sec-metre)
C11 = V11+C10 #Cumulative flow for week11(day-sec-metre)
C12 = V12+C11 #Cumulative flow for week12(day-sec-metre)
C13 = V13+C12 #Cumulative flow for week13(day-sec-metre)
plot(
[0,1,2,3,4,5,6,7,8,9,10,11,12,13],
[0,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13],
color='b'
) #Plotting mass curve
text(7.2,25000,'Mass curve',color='b')
plot(
[0,1,2,3,4,5,6,7,8,9,10,11,12,13],
[0,4725,4725*2.1,4725*3.1,4725*4,4725*5,4725*6,4725*7,4725*8,4725*9,4725*10.1,4725*11,4725*12,4725*13],
color='g'
) #Plotting tangent
text(10,45000,'A',color='b')
text(3,12000,'B',color='b')
axis([0,13,0,66000])
title('Plot of Mass-curve for the period')
xlabel('Time(weeks)')
ylabel('Flow(Day-sec-metre)')
show()
cap_reservoir = 7500.0 #Reservoir capacity obtained from graph(day-sec-metre)
reg_flow = 2.0*10**4/(4.0*7) #Regulated flow(m^3/sec)
#Result
print('Case(i) : Size of necessary reservoir = %.f day-sec-metres' %cap_reservoir)
print('Case(ii): Rate at which the flow is available with the reservoir = %.f m^3/sec' %reg_flow)
```

In [1]:

```
#Variable declaration
P = 50000.0 #Maximum demand(kW)
time = 8760.0 #Time(hours)
#Calculation
H = 2500.0 #Time(hours). Obtained directly from textbook
Ob = P
Oa = time
db = H*Ob/Oa #Power(kW)
S_B = 1/2.0*db*H #Units generated by station B(kWh)
S = 1/2.0*Ob*Oa #Total units generated(kWh)
S_A = S-S_B #Units generated by station A(kWh)
x = P-db #Capacity of station A(kW)
C = (100000+60*x+0.01*S_A)+(60000+35*db+0.02*S_B) #Total cost(Rs)
cost_unit = C*100/S #Overall generating cost per unit(Paise)
#Result
print('Station B is used to supply peak load')
print(' Installed capacity of station B = %.f kW' %db)
print(' Hours per year of station B operation to give minimum total cost per unit generated = %.f hours' %H)
print('Total cost per unit generated = %.2f paise' %cost_unit)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to approximation in textbook solution')
```

In [1]:

```
from sympy import Symbol,nsolve
#Variable declaration
max_load = 30000.0 #Maximum load(kW)
min_load = 10000.0 #Minimum load(kW)
peak_load = 72000.0 #Peak load per day(kWh)
n = 0.6 #Efficiency of steam electric conversion
#Calculation
x = Symbol('x')
y = Symbol('y')
area_BFGA = (1.0/2*x*y)-peak_load #Area of storage tank
ED = (max_load-min_load-x)
FE = 24-y
area_FED = 1.0/2*ED*FE
equ = nsolve([(area_BFGA-0.6*area_FED),24*x-(max_load-min_load)*y],[x,y],[1,1])
X = equ[0] #Hydro-plant capacity(kW)
cap_steam = max_load-X #Capacity of steam plant(kW)
#Result
print('Capacity of hydro plant = %.f kW' %X)
print('Capacity of steam plant = %.f kW' %cap_steam)
print('\nNOTE: Changes in the obtained answer from that of textbook is due to more precision here')
```