ELD Using Newton Method
ELD Using Newton Method
Method
Power System Optimization
March 15, 2025
Contents
1 Introduction 3
2 Problem Formulation 3
2.1 Objective Function . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Loss Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1
6 Theoretical Background 15
6.1 Newton Method for ELD . . . . . . . . . . . . . . . . . . . . . 15
6.2 Handling Generator Limits . . . . . . . . . . . . . . . . . . . . 16
8 Conclusion 17
2
1 Introduction
This document provides a comprehensive explanation of an Economic Load
Dispatch (ELD) solution using the Newton method. ELD is a fundamen-
tal optimization problem in power systems that aims to allocate generation
among multiple generators to meet the load demand while minimizing the
total operating cost. The implementation accounts for power losses in the
system and enforces generator constraints.
The solution is divided into three main components:
1. Main ELD code
2 Problem Formulation
2.1 Objective Function
The objective of ELD is to minimize the total generation cost:
N
X
min FT = Fi (PGi ) (1)
i=1
2.2 Constraints
The optimization is subject to the following constraints:
N
X
PGi = PD + PL (2)
i=1
2. Generator Limits:
PGmin
i
≤ PGi ≤ PGmax
i
(3)
3
where PGmin
i
and PGmax
i
are the minimum and maximum generation limits
of generator i.
4
4 Newton Method Function
The Newton method function uses iterative approach to solve the ELD prob-
lem by finding the optimal generator outputs and system incremental cost
(lambda).
1 function [ pg_final_calculated , l a m b d a _ f i n a l _ c a l c u l a t e d ] =
n e w t o n _ m e t h o d _ f u n c t i o n ( pd , lambda , N , a , b , pg_min , pg_max
, ploss_coeff , pg , ploss , pf )
2 % Initialize variables
3 error_tolerance = 0.0001;
4 max_iterations = 50;
5
6 % Start with current values
7 p g_ f i na l _ c al c u la t e d = pg ;
8 l a m b d a _ f i n a l _ c a l c u l a t e d = lambda ;
9
10 for iter = 1: max_iterations
11 % Calculate updated loss and penalty factors based on
current generation
12 ploss_current = zeros (1 , N ) ;
13 pf_current = zeros (1 , N ) ;
14 for j = 1: N
15 pf_current ( j ) = 1/(1 -(2* p g _ fi n a l_ c a lc u l at e d ( j ) *
ploss_coeff ( j ) ) ) ;
16 ploss_current ( j ) = ( p g _ fi n a l_ c a lc u l at e d ( j ) ^2) *
ploss_coeff ( j ) ;
17 end
18
5
35 jacobian_matrix (k , k ) = 2* a ( k ) ;
36
37 % Lambda column
38 jacobian_matrix (k , N +1) = -1/ pf_current ( k ) ;
39
40 % Power balance row - include the effect of
losses
41 dloss_dpg = 2* ploss_coeff ( k ) * p g _ fi n a l_ c a lc u l at e d (
k);
42 jacobian_matrix ( N +1 , k ) = dloss_dpg - 1;
43 end
44 jacobian_matrix ( N +1 , N +1) = 0;
45
6
74 end
75
76 % Calculate required generation
77 r e qu i r ed _ g en e r at i o n = pd + total_losses ;
78 cu rr en t_ ge ne ra ti on = sum ( p g _ fi n a l_ c a lc u l at e d ) ;
79
80 % Adjust generation if needed and possible
81 if abs ( r eq u i re d _ ge n e ra t i on - cur re nt _g en er at io n )
> error_tolerance
82 shortage = r e q ui r e d_ g e ne r a ti o n -
cu rr en t_ ge ne ra ti on ;
83
84 % Find generators that can be adjusted
85 adjustable_gens = [];
86 for j = 1: N
87 if shortage > 0 && p g_ f i na l _ ca l c ul a t ed ( j )
< pg_max ( j )
88 adjustable_gens = [ adjustable_gens j
];
89 elseif shortage < 0 &&
p g _f i n al _ c al c u la t e d ( j ) > pg_min ( j )
90 adjustable_gens = [ adjustable_gens j
];
91 end
92 end
93
94 % Distribute the shortage among adjustable
generators
95 if ~ isempty ( adjustable_gens )
96 adjustment = shortage / length (
adjustable_gens ) ;
97 for j = adjustable_gens
98 p g_ f i na l _ c al c u la t e d ( j ) =
p g _f i n al _ c al c u la t e d ( j ) + adjustment ;
99
100 % Re - check limits after adjustment
101 if p g_ f i na l _ ca l c ul a t ed ( j ) < pg_min ( j )
102 p g_ f i na l _ ca l c ul a t e d ( j ) = pg_min ( j
);
103 elseif pg _ f in a l _ ca l c ul a t ed ( j ) >
pg_max ( j )
104 p g_ f i na l _ ca l c ul a t e d ( j ) = pg_max ( j
);
105 end
106 end
107 end
108 end
109 end
110 end
7
111 end
Listing 2: newton method function.m - Newton Method Implementation
• N: Number of generators
It returns:
2. Iterative Process:
8
• Solve for correction vector
• Update lambda and generator outputs with constraints
J · ∆x = −g (6)
9
1 clear all
2 clc
3 ELD_Data % Load the data
4
5 % Extract generator parameters
6 N = size ( PG_data , 1) ;
7 a = PG_data (: , 1) ;
8 b = PG_data (: , 2) ;
9 c = PG_data (: , 3) ;
10 pg_min = PG_data (: , 4) ;
11 pg_max = PG_data (: , 5) ;
12 ploss_coeff = PG_data (: , 7) ;
13 pd = 975; % Load demand
14
15 % Initialize variables with a feasible starting point
16 pg = zeros (1 , N ) ;
17 total_min = sum ( pg_min ) ;
18 total_max = sum ( pg_max ) ;
19
20 if pd < total_min
21 error ( ’ Demand is less than minimum generation capacity ’) ;
22 elseif pd > total_max
23 error ( ’ Demand exceeds maximum generation capacity ’) ;
24 else
25 % Distribute load proportionally between min and max
limits
26 for i = 1: N
27 pg ( i ) = pg_min ( i ) + ( pg_max ( i ) - pg_min ( i ) ) * ( pd -
total_min ) / ( total_max - total_min ) ;
28 end
29 end
30
31 % Better initial lambda estimate based on average marginal
cost
32 lambda_init = 0;
33 for i = 1: N
34 lambda_init = lambda_init + 2* a ( i ) * pg ( i ) + b ( i ) ;
35 end
36 lambda = lambda_init / N ;
37
38 error_tolerance = 0.01; % Tolerance for convergence
39 max_iterations = 100; % Maximum iterations
40
41 % Initialize loss and penalty factors
42 ploss = zeros (1 , N ) ;
43 pf = zeros (1 , N ) ;
44
45 % Calculate initial ploss and pf
46 for i = 1: N
10
47 pf ( i ) = 1/(1 -(2* pg ( i ) * ploss_coeff ( i ) ) ) ;
48 ploss ( i ) = ( pg ( i ) ^2) * ploss_coeff ( i ) ;
49 end
50
51 total_ploss = sum ( ploss ) ;
52 fprintf ( ’ Initial : Gen : %.2 f MW , Demand : %.2 f MW , Loss : %.2 f
MW , Balance : %.2 f MW \ n ’ , sum ( pg ) , pd , total_ploss , sum ( pg )
- ( pd + total_ploss ) ) ;
53
54 % Main iteration loop
55 for iter = 1: max_iterations
56 % Call Newton method to update pg and lambda
57 [ pg_new , lambda_new ] = n e w t o n _ m e t h o d _ f u n c t i o n ( pd , lambda ,
N , a , b , pg_min , pg_max , ploss_coeff , pg , ploss , pf ) ;
58
59 % Calculate new loss and penalty factors
60 ploss_new = zeros (1 , N ) ;
61 pf_new = zeros (1 , N ) ;
62 for j = 1: N
63 pf_new ( j ) = 1/(1 -(2* pg_new ( j ) * ploss_coeff ( j ) ) ) ;
64 ploss_new ( j ) = ( pg_new ( j ) ^2) * ploss_coeff ( j ) ;
65 end
66
67 % Calculate changes for convergence check
68 total_ploss_new = sum ( ploss_new ) ;
69 power_balance = sum ( pg_new ) - ( pd + total_ploss_new ) ;
70
71 % Print iteration details
72 fprintf ( ’ Iter %2 d : Gen : %.2 f MW , Loss : %.2 f MW , Balance :
%.6 f MW , Lambda : %.6 f \ n ’ , iter , sum ( pg_new ) ,
total_ploss_new , power_balance , lambda_new ) ;
73
74 % Update values for next iteration
75 pg = pg_new ;
76 lambda = lambda_new ;
77 ploss = ploss_new ;
78 pf = pf_new ;
79
80 % Check convergence on power balance
81 if abs ( power_balance ) < error_tolerance
82 fprintf ( ’\ nConverged after % d iterations !\ n ’ , iter ) ;
83 break ;
84 end
85
86 % If we ’ re at the last iteration and still not converged ,
try one final adjustment
87 if iter == max_iterations
88 fprintf ( ’\ nReached maximum iterations . Performing
final adjustment ...\ n ’) ;
11
89
12
133
2. Initial Calculations:
13
• Call Newton method function to update generator outputs and
lambda
• Calculate new losses and penalty factors
• Check for convergence based on power balance
• Update all variables for next iteration
5. Results Reporting:
14
5.2.3 Variable Updates
Between iterations, all key variables are properly updated:
• Generator outputs (pg)
• System incremental cost (lambda)
• Power losses (ploss)
• Penalty factors (pf)
6 Theoretical Background
6.1 Newton Method for ELD
The Newton method for ELD is based on solving the Lagrangian function:
N N
!
X X
L= Fi (PGi ) − λ PGi − PD − PL (8)
i=1 i=1
15
6.2 Handling Generator Limits
When a generator output reaches its limit, that generator is fixed at the
limit, and the optimization continues with the remaining generators. This is
implemented by enforcing the limits after each update:
min
P G i
if PGi < PGmin
i
PG i = PG i min
if PGi ≤ PGi ≤ PGmax
i
(11)
max max
PG i if PGi > PGi
16
7.3 Optimal Generation Dispatch
The optimal dispatch follows the equal incremental cost principle, adjusted
by penalty factors:
1 ∂F1 1 ∂F2 1 ∂FN
= = ··· = =λ (12)
P F1 ∂PG1 P F2 ∂PG2 P FN ∂PGN
Generators with lower costs and lower loss impacts are dispatched more
heavily, subject to their operating limits.
8 Conclusion
The Economic Load Dispatch solution using the Newton method provides
an efficient approach to optimally allocate generation among multiple gener-
ators while accounting for transmission losses and enforcing generator con-
straints. The implementation presented here demonstrates a robust solution
that achieves:
17
These files should be placed in the same directory and executed by run-
ning the main ELD.m script in MATLAB.
18