from __future__ import division
print "solution for (a)"
nb=8; nf=2; nl=2 #given number of equipments is 8 bulbs 2 fans 2plugs
lb=100 ;lf=60 ;ll=100 #corresponding wattages
cl=nb*lb+nf*lf+nl*ll #total connected load
print "connected load = %dW\n"%(cl)
print "solution for (b)"
t1=5 ;t2=2 ;t3=2; t4=9; t5=6; # time periods in hours
# let = [bulb, fan, light]
w1=1*lf #12 to 5am period of duration 5h
w2=2*lf+1*ll #5am to 7am period of duration 2h
w3=0 #7am to 9am period of duration 2h
w4=2*lf #9am to 6pm period of duration 9h
w5=4*lb+2*lf #6pm to 12pm period of duration 6h
w=[w1 ,w2 ,w3, w4, w5]
print "\nthe maximum demand is %d W\n"%(max(w))
m=max(w)
print "solution for (c)"
df=m/cl
print "\ndemand factor =%0.3f\n"%(df)
print "solution for (d)"
#energy consumed is power multiply by corresponding time
energy=[w1*t1 ,w2*t2 ,w3*t3 ,w4*t4, w5*t5]
e=sum(energy)
print "\ntotal energy consumed during 24 hours = %d Wh = %0.2f kWh\n"%(e,e/1e3)
print "solution for (e)"
ec=cl*24
print "\nif all devices are used throughout the day the energy consumed = %d Wh = %.2fkWh"%(ec,ec/1000)
#for 24 hours of max. load
%matplotlib inline
from matplotlib.pyplot import plot, subplot, title, title, show, hist
print "(a)"
mca=1.1 ;cla=2.5; mcb=1; clb=3; #mca=maximum demand of consumera cla=connected load of a mcb=maximum load of consumer b clb=connected load of consumer b
print "maximum demand of consumer A = %0.1fkW \n \ndemand factor of consumer A = %0.2f \n \nmaximum demand of consumer B = %dkW\n \ndemand factor of consumer B = %0.3f"%(mca,mca/cla,mcb,mcb/clb)
print "(b)"
print "The variation in demand versus time curves are plotted and shown in Fig This is known as chronological load curve."
a=([100]*5,[1100]*1,[200]*2,[0]*9,[500]*7)
i=0
A=range(1,25)
for x in a:
for y in x:
A[i]=y
i+=1
b=([0]*(7),[300]*(1),[1000]*(2),[200]*(8),[600]*(5),[0]*(1)) #time line of different periods by a and b consumers
i=0
B=range(1,25)
for x in b:
for y in x:
B[i]=y
i+=1
from numpy import arange, nditer
t=arange(1,25,1) #for 24 hours ploting
ma=max(A) ;mb=max(B)
subplot(211) #matrix plotting
plot(t,A)
plot(t,B)
title("load curves of A and B: fig(1) \n")
show()
C=range(1,25)
i=0
for x,y in nditer([A,B]):
C[i]=x+y
i+=1
subplot(222)
plot(t,C)
title("chronological load of group : fig(2) \n")
show()
mg=max(C) #maximum demand of group
print "(c)"
print "maximum demand of the group is %dW"%(mg)
gd=(ma+mb)/mg
print "group diversity factor = %.3f"%(gd) #group diversity factor is sum of individual maximum consumaer load to the group max load
print "(d)"
sa=sum(A)
print "energy consumed by A during 24 hours is = %d Wh = %0.2f kWh"%(sa,sa/1e3)
sb=sum(B)
print "(e)"
print "maximum energy which A could consume in 24hours = %.2fkWh \nmaximum energy which B consume in 24 hours is =%.2fkWh"%(mca*24,mcb*24 )
print "(f)"
print "actual energy/maximum energy"
mca=mca*10**3; mcb=mcb*10**3
aemea=sa/(mca*24)
aemeb=sb/(mcb*24)
print "\nfor A = %0.4f \nfor b = %.4f"%(sa/(mca*24),aemeb)
cola=5 ;na=600; ns=20
cls=2 ;clfm=10 ;clsm=5; cll=20; i=80
dffl=0.7; dfsm=0.8; dfl=0.65; dfci=0.5
nsl=200 ;clsl=0.04 ;dfa=0.5; gdfa=3.0
pdfa=1.25; gdfc=2 ;pdfc=1.6; dfs=0.8 #given col||cl=connected load,n=number,df=demand factor,gdf=group diversity factor,pdf=peak diversity factor,a=appartement,c=commertials,s=shop,sl=streetlight,fm=flourmill,sm=saw mill,l=laundry,ci=cinema complex.
mdea=cola*dfa
print "maximum demand of each appartment =%.2fkWh \n"%(mdea)
mda=(na*mdea)/gdfa
print "maximum demand of 600 apatments =%.2fkW \n"%(mda)
datsp=mda/pdfa
print "demand of 600 apartments at time of the system peak =%dkW \n"%(datsp)
mdtcc=((cls*ns*dfs)+(clfm*dffl)+(clsm*dfsm)+(cll*dfl)+(i*dfci))/gdfc
print "maximum demand of total commertial complex=%dkW \n"%(mdtcc)
dcsp=mdtcc/pdfc
print "demand of the commertial load at the time of the peak = %dkW\n"%(dcsp)
dsltsp=nsl*clsl
print "demand of the street lighting at the time of the system peak =%dkW"%(dsltsp)
ispd=datsp+dcsp+dsltsp
print "\nincrease in system peak deamand =%dkW "%(ispd)
from __future__ import division
%matplotlib inline
from matplotlib.pyplot import plot, subplot, title, title, show, hist
print "the chronological load curve is plotted in fig 1 the durition of loads is as under :"
LC=([20]*(5),[40]*4,[80]*9,[100]*4,[20]*2)
i=0
lc=range(1,25)
for x in LC:
for y in x:
lc[i] = y
i+=1
lc.sort()
nn=len(lc)
e=sum(lc)
print lc
print "\nthe load duration curve is ploted in 2 the energy produced by plant in 24 hours = %d MWh \n"%(e)
lff=e/(24*max(lc))
print "load factor = %0.4f= %.2f %%"%(lff,lff*100)
t=range(1,25)
subplot(211)
plot(t,lc)
show()
title("chronological curve")
subplot(212)
plot(t,lc)
title("load duration curve")
show()
from __future__ import division
lf=0.5917; ml=100; ic=125 #lf=load factor,ic=installed capacity,ml=maximum load,cf=capacity factor,uf=utillization factor
cf=(ml*lf)/ic; uf=ml/ic
print "capacity factor =%0.3f"%(cf)
print "\nutilisation factor =%.2f"%(uf)
from numpy import nditer
%matplotlib inline
from matplotlib.pyplot import plot, subplot, title, xlabel, ylabel, show
t=[24, 24-7, 24-11, 4] # Periods for running load 20,40,80,100
l = [20,40,80,100] # different loads
E= range(0,len(l))
E[0] = t[0]*l[0] # MWh
i=1
for x in E[1:]:
E[i] = E[i-1]+(l[i]-l[i-1])*t[i]
i+=1
print "Energy at different load levels:\nLoad(MW)\t\tEnergy(MWh)\n"
for x, y in nditer([l, E]):
print ' ',x,'\t\t\t ',y
subplot(211)
plot(E,l,'bo')
plot(E,l)
title('Energy Load Curve')
xlabel('Energy MW Hrs')
ylabel('Load MW')
show()
######### Mass Curve #######
t = [5,4,9,4,2]
l = [20,40,80,100,20] # loads on different time of day
Es= range(0,len(l))
Es[0] = t[0]*l[0] # MWh
i=1
for x in Es[1:]:
Es[i] = Es[i-1]+(l[i])*t[i]
i+=1
print "Energy supplied uto different times of day:\nTime\t\tEnergy(MWh)\n"
times = ['5am', '9am', '6pm','10pm','12pm']
for x, y in nditer([times, Es]):
print x,'\t\t\t ',y
td= range(0,len(t))
td[0] = t[0] # MWh
i=1
for x in td[1:]:
td[i] = td[i-1]+t[i]
i+=1
subplot(212)
plot(td,Es,'bo')
plot(td,Es)
title('Mass Curve')
xlabel('Time')
ylabel('Load MW')
show()
md=40 ;cf=0.5; uf=0.8 #maximum demand in MW capacity factor utility factor
print "(a)"
lf=cf/uf #load factor is ratio of capacity factor to the utility factor
print "load factor = capacity factor/utilisation factor =%0.3f"%(lf)
print "(b)"
pc=md/uf #plant capacity is ratio of maximum demand to utility factor
print "plant capacity = maximum demand/utilisation factor =%dMW"%(pc)
print "(c)"
rc=pc-md #reserve capacity is plant capacity minus maximum demand
print "reserve capacity =%dMW"%(rc)
print "(d)"
print "annual energy production =%dMWh"%(md*lf*8760)
%matplotlib inline
from matplotlib.pyplot import plot, subplot, title, xlabel, ylabel, show
a=[0, 5, 9 ,18, 20, 22, 24] #time in matrix format
b=[50 ,50 ,100 ,100 ,150 ,80 ,50]#load in matrix format
z= range (1,7)
for x in range (1,6):
z[x]=((b[x]+b[x+1])/2)*(a[(x+1)])-a[x]
e = b[0]*a[1]+(b[2]+b[1])*(a[2]-a[1])/2+(b[3]*a[2])+(b[3]+b[4])+(b[4]+b[5])+(b[5]+b[6]) # MWh
print "energy required required by the system in 24 hrs = %d MWh"%(e)
#50x5MWh+((100+50)/2)x4MWh +(100x9)MWh+(100+150)MWh+(150+80)MWh+(80+50)MWh \n =
dlf=e/(max(b)*24)
print "\ndaily load factor = %f or %0.2f %%"%(dlf,dlf*100)
#########PLOT##############
plot(a,b)
title('Load Curve')
xlabel("TIME -->")
ylabel("MW -->")
show()
#xtitle("load curve"%("time"%("MW"
%matplotlib inline
from matplotlib.pyplot import plot, subplot, title, xlabel, ylabel, show
print "load duration curve in fig1"
print "the energy consumed upto different times is as "
a=[0, 5 ,9 ,18, 20, 22, 24] #time in matrix format
b=[50, 50 ,100 ,100 ,150 ,80 ,50] #load in matrix format
z = range(0,6)
for x in range (0,6):
z[x]=((b[x]+b[x+1])/2)*(a[x+1]-a[x])
et=0
q = range(0,7)
m = range(0,7)
ett = range(0,6)
for x in range(0,6):
et=et+z[x]
A=a[(x)]
ett[x]=et
q[x]=a[x+1]
print "\nfrom mid night upto %d,energy=%dMWh"%(A,et)
n = sorted(range(len(b)), key=lambda k: b[k], reverse=True)
m = sorted(b, reverse=True)
print "energy curve in fig 2"
t=[0, 3.88, 15.88 ,19.88, 23]
k = range(0,6)
for j in range(0,6):
k[j]=a[(j+1)]
M =range(0,5)
#rearranging for mass curve
for i in range(0,5):
M[i] = m[i]
Q = range(0,6)
for i in range(0,6):
Q[i] = q[i]
subplot(121)
plot(t,M)
title("load duration")
xlabel("hours")
ylabel("MW")
subplot(122)
plot(Q,ett)
title("energy curve")
xlabel("time")
ylabel("MWh")
show()
egd1=438*10**4 ;plp=0.2; pcf=0.15 #annual load duration annual load factor plant capacity factor
pml=egd1/(plp*8760)
pc=(pml*plp)/pcf
print "annual load factor =energy generated during 1 year/(max. load)x8760=%.1f \n maximum load =%dkW"%(plp,pml)
print "\ncapacity factor =(max.load/plant capacity)x(load factor)\n plant capacity =max.load/0.75 =%fMW \n reserve capacity =3.333-2.5=%fMW"%(pc,pc-pml)
p1=10; p2=6; p3=8; p4=7 #peak demands of 4 areas
df=1.5 ;lf=0.65 ;imdp=0.6 #diversity factor annual load factor ratio of maximum demand
p=p1+p2+p3+p4
md=p/df
ae=md*lf*8760
imd=imdp*md
ic=md+imd
print " sum of maximum=%dMW"%(p)
print "\n maximum demand = sum of max.demands/diversity factor =%d/%f = %fMW"%(p,df,md)
print "\n annual energy =%fMWh \n increase in maximum demand =%fMW \n installed capacity =%fMW"%(ae,imd,ic)
from __future__ import division
%matplotlib inline
from matplotlib.pyplot import plot, title, xlabel, ylabel, show
#Arranging data for Load Duration Curve
#week days 5-9pm load
L1=350 #MW
t1=4*5 #hours
#week days 8-12am & 1-5pm load
L2=250 #MW
t2=t1+8*5 #hours
#saturday & sunday 5-9pm load
L3=200 #MW
t3=t2+4*2 #hours
#All days 150MW load
L4=150 #MW
t4=t3+6*5+15*2 #hours
#All days 100MW load
L5=100 #MW
t5=t4+6*5+5*2 #hours
A=31600 #Total Load Curve Area
LF=A/L1/24/7*100 #%#Weekly load factor
print "Weekly Load factor = %0.2f %%"%LF
print "Load Duration Curve is shown in figure."
#Load Duration Curve
L=[L1 ,L2, L3, L4, L5] #MW
T=[t1 ,t2 ,t3 ,t4 ,t5] #hours
plot(T,L)
title('Load Duration Curve')
xlabel('Time(Hours)')
ylabel('Load(MW)')
show()
dlf=0.825 #daily load factor
lptmlp=0.87 #average daily peak load to monthly load peak
mlptalp=0.78 #average monthly peak load to annual load peak
print "annual load factor = %fx%fx%f = %0.2f"%(dlf,lptmlp,mlptalp,dlf*lptmlp*mlptalp)
print "(a)"
#given
transformer1_motorload=300
transformer1_demandfactorm=0.6
tarnsformer1_commercialload=100
transformer1_demandfactorc=0.5
transformer1_diversityfactor=2.3
transformer2_residentalload=500
transformer2_demandfactor=0.4
transformer2_diversitryfactor=2.5
transformer3_residentalload=400
transformer3_demandfactor=0.5
transformer3_diversityfactor=2.0
diversitybtwxmer=1.4
peakloadoftransformer1=((transformer1_motorload*transformer1_demandfactorm)+(tarnsformer1_commercialload*transformer1_demandfactorc))/transformer1_diversityfactor
peakloadonxmer=(transformer2_residentalload*transformer2_demandfactor)/transformer2_diversitryfactor
peakloadonxmer3=(transformer3_residentalload*transformer3_demandfactor)/(transformer3_diversityfactor)
print "peak load on transformer 1 =(300x0.6+100x0.5)/2.3 =%dkW \npeak load on transformer 2 =%dkW \n peak load on transformer 3 =%dkW"%(peakloadoftransformer1,peakloadonxmer,peakloadonxmer3)
print "(b)"
peakloadonfeeder=(peakloadoftransformer1+peakloadonxmer+peakloadonxmer3)/diversitybtwxmer
print "peak load on feeder =(100+80+100)/1.4 =%dkW"%(peakloadonfeeder)