import math
#initialisation of variables
Fc1=1.1 #Fuel cost(1)=Rs 1.1/MBtu
Fc2=1 #Fuel cost(2)=1/MBtu
Fc3=1.2 #Fuel cost(3)=1.2/MBtu
P1max=600.0
P1=P1max
#Calculations
F1=600+7.1*P1+0.00141*(P1**2) #For P1= Pm1ax
Favg1=F1*Fc1/600.0 #Full load average production cost
P2max=450.0
P2=P2max
F2=350+7.8*P2+0.00195*(P2**2) #For P2= P2max
Favg2=F2*Fc2/450.0 #Full load average production cost
P3max=250.0
P3=P3max
F3=80+8*P3+0.0049*(P3**2) #For P3= P3max
Favg3=F3*Fc3/250.0 #Full load average production cost
#Results
print("Priority List is as follows")
print("Unit Rs/MWhr MinMW Max MW")
print(" 2 %.3f 100 %.0f " %(Favg2,P2max))
print(" 1 %.4f 60 %.0f " %(Favg1,P1max))
print(" 3 %.2f 50 %.0f " %(Favg3,P3max))
Fmax1=P1max+P2max+P3max
Fmax2=P2max+P1max
Fmax3=P2max
print("Unit Commitment Scheme is follows")
print("Combination Min.MW from Combination Max.MW from Combination")
print("2+1+3 310 %.0f " %Fmax1)
print("2+1 260 %.0f " %Fmax2)
print("2 100 %.0f " %Fmax3)
import math
#initialisation of variables
#Calculations
def F1(P1):
F1=7.1*P1+.00141*(P1^2)
print("F1(%.0f)=%.1f" %(P1,F1))
def F2(P2):
f2=7.8*P2+.00195*(P2^2)
print("f2(%.0f)=%.0f" %(P2,f2))
def F(P1,P2):
F1=7.1*P1+.00141*(P1**2)
F2=7.8*P2+.00195*(P2**2)
F=F1+F2
print("F1(%.0f)+f2(%.0f)=%.0f" %(P1,P2,F))
#Results
P1max=600
P2max=450
print("Unit Commitment using Load 500MW")
F1(500)
print("\n Since min. Power of second unit is 100MW , we find")
F(400,100)
F(380,120)
F(360,140)
print("\n Therefore for load 500 MW , the load commitment on unit 1 is 400 MW and that on 2 is 100 MW which gives min. cost")
print("Next we increase the load by 50 MW and loading unit 1 we get, \n")
F1(550)
print("Also if we distribute a part of load to unit 2 we get ,")
F(450,100)
F(400,150)
F(350,200)
print("\n Therefore for load 550 MW , the load commitment on unit 1 is 400 MW and that on 2 is 150 MW which gives min. cost")