In [1]:

```
aerpe=100*10**6
md=25*10**3
def ucc(dd,e):
u=600*dd+0.3*e #rs per kW
return u
sc=30*10**3
a_cci=9000#per kW
a_shr=4000
b_cci=10500
b_shr=3500
c_cci=12000
c_shr=3000
salc=3000
sal=2280
sh=10
tax=0.04
ins=0.5*10**-2
cir=0.07
hv=5000#l cal per kg
fuc=225#rs per ton
acsnm=150000#for each plan
pl=20
dr=cir/((cir+1)**pl-1)
tfcr=cir+dr+tax+ins
print "depreciation rate %f \ntotal fixed rate =%f"%(dr,tfcr)
a_ci=a_cci*sc ;b_ci=b_cci*sc ;c_ci=c_cci*sc
a_afca=a_ci*tfcr ;b_afca=b_ci*tfcr ;c_afca=c_ci*tfcr
a_afuc=a_shr*fuc*10**8/(hv*10**3)
b_afuc=b_shr*fuc*10**8/(hv*10**3)
c_afuc=c_shr*fuc*10**8/(hv*10**3)
ass=12*(salc+sh*sal)
tota=a_afca+ass+a_afuc+acsnm
totb=b_afca+ass+b_afuc+acsnm
totc=c_afca+ass+c_afuc+acsnm
print "\nannual fixed cost of a is Rs%d fuel cost of plan a is Rs%d and total cost of a is Rs%d"%(a_afca,a_afuc,tota)
print "\nannual fixed cost of b is Rs%d fuel cost of plan b is Rs%d and total cost of b is Rs%d"%(b_afca,b_afuc,totb)
print "\nannual fixed cost of c is Rs%d fuel cost of plan c is Rs%d and total cost of c is Rs%d"%(c_afca,c_afuc,totc)
ppt=ucc(md,aerpe)
print "\nannual cost of purchasing electricty from utility is Rs600x%d+0.3x%.1e is Rs%d"%(md,aerpe,ppt)
```

In [2]:

```
aer=100*10**6
md=25*10**3
def ucc(dd,e):
u=600*dd+0.3*e #rs per kW
return u
p=30*10**3
ap=9000#per kW
ahr=4000
bp=10500
bhr=3500
cp=12000
Chr=3000
salc=3000
sal=2280
sh=10
t=0.04
i=0.5*10**-2
r=0.07
hv=5000#l cal per kg
fuc=225#rs per ton
mc=150000#for each plan
n=20
dr=r/((r+1)**n-1)
pwf=r/(1-(r+1)**(-n))
print "persent of worth factor is %f"%(pwf)
afc=ahr*fuc*10**8/(hv*10**3)
bfc=bhr*fuc*10**8/(hv*10**3)
cfc=Chr*fuc*10**8/(hv*10**3)
ass=12*(salc+sh*sal)
aaoc=ass+mc+afc
baoc=ass+mc+bfc
caoc=ass+mc+cfc
ai=ap*p ;bi=bp*p ;ci=cp*p
atac=(t+i)*ap*p+aaoc
btac=(i+t)*bp*p+baoc
ctac=(i+t)*cp*p+caoc
uts=ucc(md,aer)
apw=atac/pwf ;bpw=btac/pwf ;cpw=ctac/pwf; utss=uts/pwf
ta=apw+ai ;tb=bpw+bi; tc=cpw+ci
print "\nannual cost excludinding interest and \ndepreciation of a \t\tRs%d \npersent worth factor \t\t %f \npresent worth annual cost of a is Rs%d \n investement of a is \tRs%d \n total persent worth of a is \t%d"%(atac,pwf,apw,ai,ta)
print "\n\n annual cost excludinding interest and \ndepreciation of b \t\tRs%d \npersent wort factor \t\t%f \npresent worth annual cost of b is Rs%d \n investement of b is \tRs%d \n total persent worth of b is \t%d"%(btac,pwf,bpw,bi,tb)
print "\n \nannual cost excludinding interest and \ndepreciation of c \t\tRs%d \npersent wort factor \t\t%f \npresent worth annual cost of c is Rs%d \n investement of c is \tRs%d \n total persent worth of c is \t%d"%(ctac,pwf,cpw,ci,tc)
print "\n \nannual cost excludinding interest and \ndepreciation of utility service \tRs%d \npersent wort factor \t\t\t%f \npresent worth annual cost of utility service is Rs%d \n investement of utility service is \t\t nill \n total persent worth of utility service is %d"%(uts,pwf,utss,utss)
print "\n\n\tsince the present worth of the utility service is the minimum,it is the obvious choice \nout of the other plans,plan A is the best since it has the lowest present worth"
```

In [3]:

```
aer=100*10**6 #from example 5.1
md=25*10**3
def ucc(dd,e):
u=600*dd+0.3*e #rs per kW
return u
p=30*10**3
ap=9000#per kW
ahr=4000
bp=10500
bhr=3500
cp=12000
Chr=3000
salc=3000
sal=2280
sh=10
t=0.04
i=0.5*10**-2
r=0.07
hv=5000#l cal per kg
fuc=225#rs per ton
mc=150000#for each plan
n=20
dr=r/((r+1)**n-1)
pwf=r/(1-(r+1)**(-n))
uts=ucc(md,aer)
afc=ahr*fuc*10**8/(hv*10**3)
bfc=bhr*fuc*10**8/(hv*10**3)
cfc=Chr*fuc*10**8/(hv*10**3)
ass=12*(salc+sh*sal)
aaoc=ass+mc+afc
baoc=ass+mc+bfc
caoc=ass+mc+cfc
aw=(((dr+t+i)*ap*p+aaoc)/r)+ap*p
bw=(((dr+t+i)*bp*p+baoc)/r)+bp*p
cw=(((dr+t+i)*cp*p+caoc)/r)+cp*p
utt=uts/r+p
print "\n plan A is \t\tRs.%d \n plan B is \t\tRs.%d \n planC is \t\tRs.%d \nutility services is \tRs%d"%(aw,bw,cw,utt)
print "the utility service has the lowest capitalized cost and is the obvious choice. Out of the other plans,plan A is the best"
```

In [4]:

```
from numpy import arange
aer=100*10**6
md=25*10**3
utse=6600*10**4
p=30*10**3
ap=9000#per kW
ahr=4000
bp=10500
bhr=3500
cp=12000
Chr=3000
salc=3000
sal=2280
sh=10
t=0.04
i=0.5*10**-2
r=0.07
hv=5000#l cal per kg
fuc=225#rs per ton
mc=150000#for each plan
n=20
dr=r/((r+1)**n-1)
pwf=r/(1-(r+1)**(-n))
afc=ahr*fuc*10**8/(hv*10**3)
bfc=bhr*fuc*10**8/(hv*10**3)
cfc=Chr*fuc*10**8/(hv*10**3)
ass=12*(salc+sh*sal)
aaoc=ass+mc+afc
baoc=ass+mc+bfc
caoc=ass+mc+cfc
sol_a_totalannualcost=(t+i)*ap*p+aaoc
sol_b_totalannualcost=(i+t)*bp*p+baoc
sol_c_totalannualcost=(i+t)*cp*p+caoc
sol_a_pinvestement=ap*p
sol_b_pinvestement=bp*p
sol_c_pinvestement=cp*p
sol_a_annuity=utse-sol_a_totalannualcost
sol_b_annuity=utse-sol_b_totalannualcost
sol_c_annuity=utse-sol_c_totalannualcost
sol_a_ratioaandp=sol_a_annuity/sol_a_pinvestement
sol_b_ratioaandp=sol_b_annuity/sol_b_pinvestement
sol_c_ratioaandp=sol_c_annuity/sol_c_pinvestement
def alt(r):
R=abs(r/(1-wr))
return R
ra=round((sol_a_ratioaandp)*100)
rb=round((sol_b_ratioaandp)*100)
rc=round((sol_c_ratioaandp)*100)
for x in arange(-0.12,-0.07,0.001): #for itration
wr=(1+x)**n
re=alt(x)
re=(round(re*100))
if re==ra :
sol_a_return=(abs(x)*100)
#end
if re==rb :
sol_b_return=(abs(x)*100)
#end
if re==rc :
sol_c_return=(abs(x)*100)
#end
#end
print "for (a)"
print "total annual cost Rs.%d\ninvestement Rs.%d\nannuity Rs%d \nratio of a and b %f \nrate of return %.1fpercent"%(sol_a_totalannualcost,sol_a_pinvestement,sol_a_annuity,sol_a_ratioaandp,sol_a_return)
print "for (b)"
print "total annual cost Rs.%d\ninvestement Rs.%d\nannuity Rs%d \nratio of a and b %f \nrate of return %.1fpercent"%(sol_b_totalannualcost,sol_b_pinvestement,sol_b_annuity,sol_b_ratioaandp,sol_b_return)
print "for (c)"
print "total annual cost Rs.%d\ninvestement Rs.%d\nannuity Rs%d \nratio of a and b %f \nrate of return %.1fpercent"%(sol_c_totalannualcost,sol_c_pinvestement,sol_c_annuity,sol_c_ratioaandp,sol_c_return)
sb=sol_b_annuity-sol_a_annuity
sc=sol_c_annuity-sol_b_annuity
ib=sol_b_pinvestement-sol_a_pinvestement
ic=sol_b_pinvestement-sol_a_pinvestement
rcb=sb/ib; rcc=sc/ic
print "\nsaving in annual cost excluding interest and depreciation B over A \t %d C over A \t %d"%(sb,sc)
print "\nadditional investement P is \t\t\t\tB over A \t %d C over A \t %d"%(ib,ic)
print "\nrate of saving to investement \t\t\t\tAoverB \t\t %f BoverC \t%f"%(rcb,rcc)
print "\nrate of return on capital investement\n evidently plan A is the best \t\t\t\tA over B \tNegative B over C \tNegative"
```