summaryrefslogtreecommitdiff
path: root/Working_Examples/83/CH7
diff options
context:
space:
mode:
Diffstat (limited to 'Working_Examples/83/CH7')
-rwxr-xr-xWorking_Examples/83/CH7/EX7.1/example_7_1.sce86
-rwxr-xr-xWorking_Examples/83/CH7/EX7.1/result_example_7_1.txt18
-rwxr-xr-xWorking_Examples/83/CH7/EX7.1/result_graph_example_7_1.jpgbin0 -> 148973 bytes
-rwxr-xr-xWorking_Examples/83/CH7/EX7.2/example_7_2.sce15
-rwxr-xr-xWorking_Examples/83/CH7/EX7.2/result_example_7_2.txt9
-rwxr-xr-xWorking_Examples/83/CH7/EX7.3/example_7_3.sce41
-rwxr-xr-xWorking_Examples/83/CH7/EX7.3/result_example_7_3.txt10
-rwxr-xr-xWorking_Examples/83/CH7/EX7.4/example_7_4.sce59
-rwxr-xr-xWorking_Examples/83/CH7/EX7.4/result_example_7_4.txt15
-rwxr-xr-xWorking_Examples/83/CH7/EX7.5/example_7_5.sce69
-rwxr-xr-xWorking_Examples/83/CH7/EX7.5/result_example_7_5.txt13
-rwxr-xr-xWorking_Examples/83/CH7/EX7.6/example_7_6.sce48
-rwxr-xr-xWorking_Examples/83/CH7/EX7.6/result_example_7_6.txt25
-rwxr-xr-xWorking_Examples/83/CH7/EX7.7/example_7_7.sce72
-rwxr-xr-xWorking_Examples/83/CH7/EX7.7/result_example_7_7.txt11
15 files changed, 491 insertions, 0 deletions
diff --git a/Working_Examples/83/CH7/EX7.1/example_7_1.sce b/Working_Examples/83/CH7/EX7.1/example_7_1.sce
new file mode 100755
index 0000000..4980957
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.1/example_7_1.sce
@@ -0,0 +1,86 @@
+//Chapter 7
+//Example 7.1
+//page 246
+//To find incremental cost and load sharing
+clear;clc;
+
+///Let us use the program given in the Appendix G in the textbook to write
+//a function that returns the value of lamda and Loading of each generator
+//when the total load on the plant is sent to the function
+
+function [lamdaprev,Pg]=optimum(Pd)
+ n=2; //number of generators
+ Alpha=[0.2 0.25];
+ Beta=[40 30];
+ lamda=35; //initial guess for lambda
+ lamdaprev=lamda;
+ eps=1; //tolerance
+ deltalamda=0.25; //increment in lamda
+ Pgmax=[125 125];
+ Pgmin=[20 20];
+ Pg=100*ones(n,1);
+ while abs(sum(Pg)-Pd)>eps
+ for i=1:n
+ Pg(i)=(lamda-Beta(i))/Alpha(i);
+ if Pg(i)>Pgmax(i) then
+ Pg(i)=Pgmax(i);
+ end
+ if Pg(i)<Pgmin(i) then
+ Pg(i)=Pgmin(i);
+ end
+ end
+ if (sum(Pg)-Pd)<0 then
+ lamdaprev=lamda;
+ lamda=lamda+deltalamda;
+ else
+ lamdaprev=lamda;
+ lamda=lamda-deltalamda;
+ end
+ end
+endfunction
+
+
+//to draw the table 7.1
+printf('Table 7.1 Output of each unit and plant output for various values of lamda\n')
+printf('--------------------------------------------------------------\n');
+printf('Plant Lamda, Unit 1 Unit 2 Plant Output \n');
+printf('Rs/MWh Pg1,MW Pg2,MW (Pg1+Pg2),MW \n');
+printf('--------------------------------------------------------------\n');
+
+Pd_matrix=[40 76 130 150 175 220 231.25 250];
+for i=1:8
+ [lamda,Pg]=optimum(Pd_matrix(i));
+ printf('%0.2f %0.2f %0.2f %0.2f\n',lamda,Pg(1),Pg(2),Pg(1)+Pg(2));
+end
+printf('--------------------------------------------------------------\n');
+
+//To draw the Graphs 7.3 and 7.4
+
+Pd_test=40:3.75:250;
+[Pd_ro,Pd_co]=size(Pd_test)
+for i=1:Pd_co
+ [lamda,Pg]=optimum(Pd_test(i));
+ lamda_test(i)=lamda;
+ Pg1_test(i)=Pg(1);
+ Pg2_test(i)=Pg(2);
+end
+Pg1_test=Pg1_test.'; //transposing without conjugating
+Pg2_test=Pg2_test.';
+lamda_test=lamda_test.';
+
+subplot(211)
+plot(Pd_test,lamda_test);
+title('Incremental Fuel cost versus plant output');
+xlabel('Plant output,MW');
+ylabel('Incremental fuel cost,Rs/MWh');
+set(gca(),"grid",[0,0])
+get("current_axes");
+
+subplot(212)
+plot(Pd_test,Pg1_test,Pd_test,Pg2_test);
+title('Output of each unit versus plant output');
+xlabel('Plant output,MW');
+ylabel('Unit output,MW');
+legend(["Unit 1";"Unit 2"],[2]);
+set(gca(),"grid",[0,0])
+get("current_axes"); \ No newline at end of file
diff --git a/Working_Examples/83/CH7/EX7.1/result_example_7_1.txt b/Working_Examples/83/CH7/EX7.1/result_example_7_1.txt
new file mode 100755
index 0000000..19fcad4
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.1/result_example_7_1.txt
@@ -0,0 +1,18 @@
+
+
+Table 7.1 Output of each unit and plant output for various values of lamda
+--------------------------------------------------------------
+Plant Lamda, Unit 1 Unit 2 Plant Output
+Rs/MWh Pg1,MW Pg2,MW (Pg1+Pg2),MW
+--------------------------------------------------------------
+35.00 20.00 20.00 40.00
+43.75 20.00 55.00 75.00
+50.00 50.00 80.00 130.00
+52.25 61.25 89.00 150.25
+55.00 75.00 100.00 175.00
+60.00 100.00 120.00 220.00
+61.25 106.25 125.00 231.25
+65.00 125.00 125.00 250.00
+--------------------------------------------------------------
+
+
diff --git a/Working_Examples/83/CH7/EX7.1/result_graph_example_7_1.jpg b/Working_Examples/83/CH7/EX7.1/result_graph_example_7_1.jpg
new file mode 100755
index 0000000..0d12777
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.1/result_graph_example_7_1.jpg
Binary files differ
diff --git a/Working_Examples/83/CH7/EX7.2/example_7_2.sce b/Working_Examples/83/CH7/EX7.2/example_7_2.sce
new file mode 100755
index 0000000..50258fe
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.2/example_7_2.sce
@@ -0,0 +1,15 @@
+//Chapter 7
+//Example 7.2
+//page 248
+//To find the saving in fuel cost by optimal scheduling
+clear;clc;
+
+//Example reveals that for optimal load sharing units 1&2 has to take up 50MW and 80MW respectively
+//If each unit supplies 65MW,increase in cost for units 1&2 are
+
+Increase1=integrate('0.2*Pg1+40','Pg1',50,65);
+Increase2=integrate('0.25*Pg2+30','Pg2',80,65);
+printf('\nIncrease in cost for unit 1 is = %0.1f Rs/hr',Increase1);
+printf('\n\nIncrease in cost for unit 2 is = %0.3f Rs/hr',Increase2);
+printf('\n\nNet saving caused by optimum scheduling is = %0.3f Rs/hr',Increase1+Increase2);
+printf('\n\nTotal yearly saving assuming continuous operation= Rs %d',(Increase1+Increase2)*24*365); \ No newline at end of file
diff --git a/Working_Examples/83/CH7/EX7.2/result_example_7_2.txt b/Working_Examples/83/CH7/EX7.2/result_example_7_2.txt
new file mode 100755
index 0000000..61d8801
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.2/result_example_7_2.txt
@@ -0,0 +1,9 @@
+
+
+Increase in cost for unit 1 is = 772.5 Rs/hr
+
+Increase in cost for unit 2 is = -721.875 Rs/hr
+
+Net saving caused by optimum scheduling is = 50.625 Rs/hr
+
+Total yearly saving assuming continuous operation= Rs 443474
diff --git a/Working_Examples/83/CH7/EX7.3/example_7_3.sce b/Working_Examples/83/CH7/EX7.3/example_7_3.sce
new file mode 100755
index 0000000..427f9af
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.3/example_7_3.sce
@@ -0,0 +1,41 @@
+//Chapter 7
+//Example 7.3
+//page 249
+//To find the economical operation
+clear;clc;
+
+//from the table we got as the output in the example_7_1
+//for optimum operation of load 220MW,unit 1&2 must be loaded 100MW and 120MW respwctively
+//and for a load of 76MW,unit 1&2 must be loaded 20MW and 56MW respwctively
+start_up=400;
+//case(i)
+printf('\nCase(i)');
+//total fuel cost for the load of 220MW during 6AM to 6PM
+Pg1=100;
+Pg2=120;
+C1=0.1*Pg1^2+40*Pg1+120;
+C2=0.125*Pg2^2+30*Pg2+100;
+total1=(C1+C2)*12;
+printf('\nTotal fuel cost for the load of 220MW during 6AM to 6PM = Rs. %d',total1);
+
+//total fuel cost for the load of 76MW during 6PM to 6AM
+Pg1=20;
+Pg2=56;
+C1=0.1*Pg1^2+40*Pg1+120;
+C2=0.125*Pg2^2+30*Pg2+100;
+total2=(C1+C2)*12;
+printf('\nTotal fuel cost for the load of 76MW during 6PM to 6AM if both the units run = Rs. %d',total2);
+
+total=total1+total2; //total fuel cost for 24hrs
+
+printf('\nTotal fuel cost for the load during 24hrs if both the units run = Rs. %d',total);
+
+//case(ii)
+printf('\n\nCase(ii)');
+//If during light load condition unit2 is On and Unit1 is Off then
+Pg2=76;
+C2=0.125*Pg2^2+30*Pg2+100;
+total2=C2*12;
+total_case2=total1+total2+start_up;
+
+printf('\nTotal fuel cost for the 24hrs laod if only unit 2 run during light loads is = Rs. %d',total_case2); \ No newline at end of file
diff --git a/Working_Examples/83/CH7/EX7.3/result_example_7_3.txt b/Working_Examples/83/CH7/EX7.3/result_example_7_3.txt
new file mode 100755
index 0000000..1032b7b
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.3/result_example_7_3.txt
@@ -0,0 +1,10 @@
+
+
+Case(i)
+Total fuel cost for the load of 220MW during 6AM to 6PM = Rs. 127440
+Total fuel cost for the load of 76MW during 6PM to 6AM if both the units run = Rs. 37584
+Total fuel cost for the load during 24hrs if both the units run = Rs. 165024
+
+Case(ii)
+Total fuel cost for the 24hrs laod if only unit 2 run during light loads is = Rs. 165064
+
diff --git a/Working_Examples/83/CH7/EX7.4/example_7_4.sce b/Working_Examples/83/CH7/EX7.4/example_7_4.sce
new file mode 100755
index 0000000..2fb2f76
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.4/example_7_4.sce
@@ -0,0 +1,59 @@
+//Chapter 7
+//Example 7.4
+//page 263
+//To find required generation for each plant and losses incurred
+clear;clc;
+
+///Let us use the program given in the Appendix G in the textbook which includes penalty factor also to write
+//a function that returns the value of lamda,Loading of each generator and losses
+//when the total load on the plant is sent to the function
+
+function [lamda,Pg,PL]=optimum2(Pd)
+n=2; //no of generators
+Alpha=[0.02 0.04];
+Beta=[16 20];
+lamda=20; //initial value of lamda
+lamdaprev=lamda;
+eps=1; //tolerance
+deltalamda=0.1;
+Pgmax=[200 200];
+Pgmin=[0 0];
+B=[0.001 0;0 0];
+Pg=zeros(n,1);
+noofiter=0;
+PL=0;
+Pg=zeros(n,1);
+while abs(sum(Pg)-Pd-PL)>eps
+ for i=1:n
+ sigma=B(i,:)*Pg-B(i,i)*Pg(i);
+ Pg(i)=(1-(Beta(i)/lamda)-(2*sigma))/(Alpha(i)/lamda+2*B(i,i));
+ PL=Pg.'*B*Pg;
+ if Pg(i)>Pgmax(i) then
+ Pg(i)=Pgmax(i);
+ end
+ if Pg(i)<Pgmin(i) then
+ Pg(i)=Pgmin(i);
+ end
+ end
+ PL=Pg.'*B*Pg;
+ if(sum(Pg)-Pd-PL)<0 then
+ lamdaprev=lamda;
+ lamda=lamda+deltalamda;
+ else
+ lamdaprev=lamda;
+ lamda=lamda-deltalamda;
+ end
+ noofiter=noofiter+1;
+ Pg;
+end
+endfunction
+
+//In this example let us take the answer .i.e load(Pd)=237.04MW and calculate
+//lamda so that we can use the algorithm used in the textbook
+Pd=237.04
+[lamda_test,Pg_test,PL_test]=optimum2(Pd);
+printf('\nLagrange''s multiplier (lamda) is\n Lamda =%0.1f',lamda_test);
+printf('\n\nRequired generation for optimum loading are \n Pg1=%0.2f MW \n Pg2=%d MW\n',Pg_test(1),Pg_test(2));
+printf('\nThe transmission power loss is\n PL=%0.2f MW',PL_test);
+printf('\n\nThe load is \n Pd=%0.2f MW',Pd);
+
diff --git a/Working_Examples/83/CH7/EX7.4/result_example_7_4.txt b/Working_Examples/83/CH7/EX7.4/result_example_7_4.txt
new file mode 100755
index 0000000..9038d91
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.4/result_example_7_4.txt
@@ -0,0 +1,15 @@
+
+
+Lagrange's multiplier (lamda) is
+ Lamda =24.9
+
+Required generation for optimum loading are
+ Pg1=128.57 MW
+ Pg2=125 MW
+
+The transmission power loss is
+ PL=16.53 MW
+
+The load is
+ Pd=237.04 MW
+
diff --git a/Working_Examples/83/CH7/EX7.5/example_7_5.sce b/Working_Examples/83/CH7/EX7.5/example_7_5.sce
new file mode 100755
index 0000000..aed5fe2
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.5/example_7_5.sce
@@ -0,0 +1,69 @@
+//Chapter 7
+//Example 7.5
+//page 264
+//To find savings when losses are coordinated
+clear;clc;
+
+function [lamdaprev,Pg]=optimum(Pd)
+ n=2; //number of generators
+ Alpha=[0.02 0.04];
+ Beta=[16 20];
+ lamda=20; //initial guess for lambda
+ lamdaprev=lamda;
+ eps=1; //tolerance
+ deltalamda=0.25; //increment in lamda
+ Pgmax=[200 200];
+ Pgmin=[0 0];
+ Pg=100*ones(n,1);
+ while abs(sum(Pg)-Pd)>eps
+ for i=1:n
+ Pg(i)=(lamda-Beta(i))/Alpha(i);
+ if Pg(i)>Pgmax(i) then
+ Pg(i)=Pgmax(i);
+ end
+ if Pg(i)<Pgmin(i) then
+ Pg(i)=Pgmin(i);
+ end
+ end
+ if (sum(Pg)-Pd)<0 then
+ lamdaprev=lamda;
+ lamda=lamda+deltalamda;
+ else
+ lamdaprev=lamda;
+ lamda=lamda-deltalamda;
+ end
+ end
+endfunction
+
+//the above function "optimum" doesn't coordinate losses
+
+//case(i) when the losses are included but not coordinated
+[lamda_case1,Pg_case1]=optimum(237.04);
+//since Pg2 does not supply transmission losses and the losses are supplied only by Pg1
+Pg2_1=Pg_case1(2);
+//to get Pg1 we will solve Pg1+Pg2=0.001*Pg1^2+237.04
+//the above equation can be wriiten as (0.001*Pg1^2) - Pg1 +(237.04-Pg2) =0
+p=poly([0.001 -1 (237.04+Pg2_1)],"Pg1");
+Pg1_1=roots(p);
+Pg1_1=Pg1_1(1);
+
+printf('\ncase(i) when the losses are included but not coordinated');
+printf('\nPg1=%0.2f MW Pg2=%0.2f MW',Pg1_1,Pg2_1);
+
+//case(ii) when the losses are also coordinated
+//we have the solution for case(ii) from example_7_4
+Pg1_2=128.57; Pg2_2=125; //case(ii)
+
+printf('\n\ncase(ii) when the losses are coordinated');
+printf('\nPg1=%0.2f MW Pg2=%0.2f MW',Pg1_2,Pg2_2);
+
+//saving at plant 1 is
+saving1=integrate('0.02*Pg1+16','Pg1',Pg1_2,Pg1_1);
+printf('\n\nSaving at plant 1 due to loss coordination is = Rs %0.2f/hr',saving1);
+
+//saving at plant 2 is
+saving2=integrate('0.04*Pg2+20','Pg2',Pg2_2,Pg2_1);
+printf('\n\nSaving at plant 2 due to loss coordination is = Rs %0.2f/hr',saving2);
+
+//net savings achieved
+printf('\n\nThe net saving achieved by coordinating losses while scheduling the recieved load of 237.04MW is Rs %0.2f/hr',saving1+saving2); \ No newline at end of file
diff --git a/Working_Examples/83/CH7/EX7.5/result_example_7_5.txt b/Working_Examples/83/CH7/EX7.5/result_example_7_5.txt
new file mode 100755
index 0000000..7cd9f3c
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.5/result_example_7_5.txt
@@ -0,0 +1,13 @@
+
+case(i) when the losses are included but not coordinated
+Pg1=274.54 MW Pg2=37.50 MW
+
+case(ii) when the losses are coordinated
+Pg1=128.57 MW Pg2=125.00 MW
+
+Saving at plant 1 due to loss coordination is = Rs 2923.94/hr
+
+Saving at plant 2 due to loss coordination is = Rs -2034.38/hr
+
+The net saving achieved by coordinating losses while scheduling the recieved load of 237.04MW is Rs 889.56/hr
+
diff --git a/Working_Examples/83/CH7/EX7.6/example_7_6.sce b/Working_Examples/83/CH7/EX7.6/example_7_6.sce
new file mode 100755
index 0000000..4948e09
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.6/example_7_6.sce
@@ -0,0 +1,48 @@
+//Chapter 7
+//Example 7.6
+//page 268
+//To calculate the loss formula coefficients of the system
+clear;clc;
+
+Ia=2-%i*0.5; Ic=1-%i*0.25;
+Ib=1.6-%i*0.4; Id=3.6-%i*0.9;
+Za=0.015+%i*0.06; Zc=0.01+%i*0.04;
+Zb=0.015+%i*0.06; Zd=0.01+%i*0.04;
+
+ID=Id+Ic ;//total load current
+
+//calculation of current distribution factors
+printf('\nCurrent distribution factors are :\n')
+Ma1=(ID/ID);
+Ma2=(0/ID);
+Mb1=(-Ic/ID);
+Mb2=(Id/ID);
+Mc1=(Ic/ID);
+Mc2=(Ic/ID);
+Md1=(Id/ID);
+Md2=(Id/ID);
+printf('Ma1=%d\tMb1=%0.4f\tMc1=%0.4f\tMd1=%0.4f\nMa2=%d\tMb2=%0.4f\tMc2=%0.4f\tMd2=%0.4f',Ma1,Mb1,Mc1,Md1,Ma2,Mb2,Mc2,Md2);
+
+//bus voltage calcultion
+[V1_mag,V1_ang]=polar(1.0+Ia*Za);
+[V2_mag,V2_ang]=polar(1+Ib*Zb);
+V1_ang=real(V1_ang)*180/%pi;
+V2_ang=real(V2_ang)*180/%pi;
+printf('\n\nBus voltages are given by \nV1=%0.3f @ %0.2fdeg PU\tV2=%0.3f @ %0.2fdeg PU',V1_mag,V1_ang,V2_mag,V2_ang);
+
+//current phase angles at the plants
+sigma1=atand(imag(Ia)/real(Ia));
+sigma2=atand(imag(Ib+Ic)/real(Ib+Ic));
+printf('\n\nCurrent phase angles at the plants\nSigma1=%ddeg\tSigma2=%ddeg',sigma1,sigma2);
+
+//plant power factors
+pf1=cosd(V1_ang-sigma1);
+pf2=cosd(V2_ang-sigma2);
+printf('\n\nThe plant power factors are\npf1=%0.4f\tpf2=%0.4f',pf1,pf2);
+
+//calculation of loss coefficients
+B11=(Ma1*Ma1*real(Za)+Mb1*Mb1*real(Zb)+Mc1*Mc1*real(Zc)+Md1*Md1*real(Zd))/(V1_mag*V1_mag*pf1*pf1);
+B22=(Ma2*Ma2*real(Za)+Mb2*Mb2*real(Zb)+Mc2*Mc2*real(Zc)+Md2*Md2*real(Zd))/(V2_mag*V2_mag*pf2*pf2);
+B12=(Ma1*Ma2*real(Za)+Mb1*Mb2*real(Zb)+Mc1*Mc2*real(Zc)+Md1*Md2*real(Zd))/(V1_mag*V2_mag*pf1*pf2);
+printf('\n\nThe Loss coefficients in PU are \nB11=%0.5f pu\nB22=%0.5f pu\nB12=%0.5f pu',B11,B22,B12);
+printf('\n\nThe Loss coefficients in reciprocal megawatts are \nB11=%0.8f MW^-1\nB22=%0.8f MW^-1\nB12=%0.8f MW^-1',B11/100,B22/100,B12/100);
diff --git a/Working_Examples/83/CH7/EX7.6/result_example_7_6.txt b/Working_Examples/83/CH7/EX7.6/result_example_7_6.txt
new file mode 100755
index 0000000..d4cd7f2
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.6/result_example_7_6.txt
@@ -0,0 +1,25 @@
+
+
+Current distribution factors are :
+Ma1=1 Mb1=-0.2174 Mc1=0.2174 Md1=0.7826
+Ma2=0 Mb2=0.7826 Mc2=0.2174 Md2=0.7826
+
+Bus voltages are given by
+V1=1.066 @ 6.06deg PU V2=1.052 @ 4.91deg PU
+
+Current phase angles at the plants
+Sigma1=-14deg Sigma2=-14deg
+
+The plant power factors are
+pf1=0.9391 pf2=0.9458
+
+The Loss coefficients in PU are
+B11=0.02226 pu
+B22=0.01595 pu
+B12=0.00406 pu
+
+The Loss coefficients in reciprocal megawatts are
+B11=0.00022259 MW^-1
+B22=0.00015947 MW^-1
+B12=0.00004062 MW^-1
+
diff --git a/Working_Examples/83/CH7/EX7.7/example_7_7.sce b/Working_Examples/83/CH7/EX7.7/example_7_7.sce
new file mode 100755
index 0000000..fa8e64f
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.7/example_7_7.sce
@@ -0,0 +1,72 @@
+//Chapter 7
+//Example 7.7
+//page 281
+//To find the optimal generation schedule for a typical day of the fundamental hydrothermal system
+clear;clc;
+
+h_b=20;//basic head of the water
+e=0.005; //head correction factor
+r=2; //non-effective water discharge
+Pd_1=7; Pd_2=10; Pd_3=5; //load at three intervals of time during a day
+alpha=0.5;//positive scalar
+X_0=100; //initial water storage in the reservoir
+X_3=60; //final water storage in the reservoir
+//let us assume the initial values of the control variables
+q_2=15;
+q_3=15;
+i=0; //iteration count
+grad_2=1;grad_3=1; //inital value for iterations
+
+while ((grad_2>0.1)|(grad_3>0.1))
+
+//water discharge in the first interval
+q_1=X_0-X_3-(q_2+q_3);
+
+//water level after the first intervals are
+X_1=X_0-q_1;
+X_2=X_1-q_2;
+
+//hydro generations in the subintervals
+Pgh_1=9.81*(10^-3)*20*(1+0.5*e*(X_1+X_0))*(q_1-r);
+Pgh_2=9.81*(10^-3)*20*(1+0.5*e*(X_2+X_1))*(q_2-r);
+Pgh_3=9.81*(10^-3)*20*(1+0.5*e*(X_3+X_2))*(q_3-r);
+
+//thermal generation in the three intervals
+Pgt_1=Pd_1-Pgh_1;
+Pgt_2=Pd_2-Pgh_2;
+Pgt_3=Pd_3-Pgh_3;
+
+//calculating lamda_1 for three subintervals
+lamda_1_1=Pgt_1+25;
+lamda_1_2=Pgt_2+25;
+lamda_1_3=Pgt_3+25;
+
+//since we are considering lossless case
+lamda_3_1=lamda_1_1;
+lamda_3_2=lamda_1_2;
+lamda_3_3=lamda_1_3;
+
+//for calculating lamda_2 for three intervals
+lamda_2_1=lamda_3_1*9.81*(10^-3)*20*(1+0.5*e*(2*X_0-2*q_1+r));
+lamda_2_2=lamda_2_1-lamda_3_1*(0.5*9.81*(10^-3)*20*e*(q_1-r))-lamda_3_2*(0.5*9.81*(10^-3)*20*e*(q_2-r));
+lamda_2_3=lamda_2_2-lamda_3_2*(0.5*9.81*(10^-3)*20*e*(q_2-r))-lamda_3_3*(0.5*9.81*(10^-3)*20*e*(q_3-r));
+
+//calculation of gradient vector
+grad_2=lamda_2_2-lamda_3_2*9.81*(10^-3)*20*(1+0.5*e*(2*X_1-2*q_2+r));
+grad_3=lamda_2_3-lamda_3_3*9.81*(10^-3)*20*(1+0.5*e*(2*X_2-2*q_3+r));
+
+q_2=q_2-alpha*grad_2; //updating value of q and reiterating
+q_3=q_3-alpha*grad_3;
+i=i+1;
+end
+
+//Hydel and thermal generation for the three sub interavals are given in tabular format
+printf('\nResults for Optimal Loading of Hydrothermal stations at the end of %d iterations',i);
+printf('\n---------------------------------------------------------------------------------------\n');
+printf('Interval\t\tLoad\t\tHydro\t\tThermal\t\tWater discharge\n');
+printf(' \t\tMW\t\tMW\t\tMW\t\tm^3/s\n');
+printf('---------------------------------------------------------------------------------------\n');
+printf(' 1 \t\t%d\t\t%0.4f\t\t%0.4f\t\t%0.2f\n',Pd_1,Pgh_1,Pgt_1,q_1);
+printf(' 2 \t\t%d\t\t%0.4f\t\t%0.4f\t\t%0.2f\n',Pd_2,Pgh_2,Pgt_2,q_2);
+printf(' 3 \t\t%d\t\t%0.4f\t\t%0.4f\t\t%0.2f\n',Pd_3,Pgh_3,Pgt_3,q_3);
+printf('---------------------------------------------------------------------------------------\n');
diff --git a/Working_Examples/83/CH7/EX7.7/result_example_7_7.txt b/Working_Examples/83/CH7/EX7.7/result_example_7_7.txt
new file mode 100755
index 0000000..7ba65bd
--- /dev/null
+++ b/Working_Examples/83/CH7/EX7.7/result_example_7_7.txt
@@ -0,0 +1,11 @@
+Results for Optimal Loading of Hydrothermal stations at the end of 46 iterations
+---------------------------------------------------------------------------------------
+Interval Load Hydro Thermal Water discharge
+ MW MW MW m^3/s
+---------------------------------------------------------------------------------------
+ 1 7 3.0068 3.9932 12.43
+ 2 10 5.0295 4.9705 20.53
+ 3 5 1.3133 3.6867 7.03
+---------------------------------------------------------------------------------------
+
+