Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Engineering Department
Several tools
GAMS+Solver
CONDOR
Joptimizer
NLOPT
.
Nlopt
+
What is Optimization?
Optimization is the mathematical discipline which
is concerned with finding the maxima and minima
of functions, possibly subject to constraints.
What do we optimize?
A real function of n variables
f ( x1 , x2 , , xn )
with or without constraints
Unconstrained optimization
min f ( x, y) x 2 y
2
min f ( x, y ) x 2 2 y 2
x0
or
min f ( x, y ) x 2 2 y 2
2 x 5, y 1
or
min f ( x, y ) x 2 2 y 2
x y 2
Dr.-Ing. Abdalkarim Awad
Nloptr Package
We are going to use a package called nloptr to
solve non-linear optimization problems.
Example1
Max=120 Mvar
GA
GB
LB=300
LA=300
Example1
Bus A
Bus B
300.0 MW
199.6 MW
AGC ON
300.0 MW
400.4 MW
AGC ON
10
PGA+PGB=600
11
12
Code
13
Code
14
Example2
Add constraints to generator 2
0<PGB<250
What is the total costs now?
15
Example3
Max=50 Mvar
Z=0.1j
A
GA
GB
LA=300 MW
LB=300 MW
16
Pi ( Bik ( i k ))
k 1
P1=(B12)(1-2)
P1=(B12)1-B12(2)
P2=B21(2- 1)
P2=-B21(1)+(B21)(2)
Z=0.1j y=-10jB=-10
PA 3 10 10 1
PB 3 10 10 2
Dr.-Ing. Abdalkarim Awad
17
PA 3 10 10 1
PB 3 10 10 2
PB-3=-(10)2
P12=B12*(1-2)
-PB+3-(10)(2)=0
|P12|=|-10(1-2)|<0.5
-0.5<10 2<0.5
-0.05<2<0.05
18
Example
P1
P2
BUS2
BUS3
1MW
Dr.-Ing. Abdalkarim Awad
500 MW
19
20
Optimization Problem
Minimize (C1(P1)+C2(P2))
Subject to:
100 MW P1 600 MW
50 MW P2 400 MW
P1+P2=500-100=400
21
Example4
Write R script to find P1 and P2 that minimizes the
operation costs
22
Solution
7.92 + 2*0.001562 x (P1)=
7.97 + 2*0.004820 x (P2) =
P1+P2=500-100=400
P1=306.0169
P2=93.98
Minimum Cost = 4000.55
23
P1=306MW
P1
94MW
SB=100 MVA
P12=71
BUS1
BUS2
y12=-10j
P13=235MW
P2
P13<200=2 pu
y13=-10j
P23=165
y23=-10j
BUS3
1MW= 1 pu
Dr.-Ing. Abdalkarim Awad
500= 5 pu
24
Example4
Write R script to find P1 and P2 that minimizes the
operation costs and takes into considerations line
limitations
25
Pi ( Bik ( i k ))
k 1
P1=(B12)(1-2)+B13(1-3
P1=(B12+B13)1-B12(2)-B13(3)
P2=-B21(1)+(B21+B23)(2)-B23(3)
P3=-B31(1)-B32(2)+(B31+B32)(3)
B12
B13
P1 B12 B13
P 2 B 21
B 21 B 23
B 23
P3 B31
B32
B 21 B32
1
2
3
Compare to Y matrix!
Dr.-Ing. Abdalkarim Awad
26
10
P1 20 10
P 2 10 20 10
1 5 10
10 20
singular
1
2
3
SB=100 MVA
P1
BUS1
P2
y12=-10j
P13<200=2 pu
y13=-10j
BUS2
y23=-10j
BUS3
500= 5 pu
1MW= 1 pu
27
0 1
P1 20 10
Solve
with
respect
P 2 10 20 10 2
to bus #1. i.e 1=0
4 0
10 20 3 (Slack bus)
P 2
4
20 10 2
10 20 3
28
Optimization Problem
Minimize (C1(P1)+C2(P2)) (in pu)
Subject to:
1 pu P1 6 pu
0.5 pu P2 4 pu
P1+P2=4
P 2
4
20 10 2
10 20 3
-0.2<3<0.20
Dr.-Ing. Abdalkarim Awad
29
Solution (using R)
1 0
2 0
3 0.2
P1=200 MW
P2=200 MW
P13=-B13(1-3)=-10*(0-0.2)=2 pu=200 MW
Costs=4072.28>4000.55 Euro
Dr.-Ing. Abdalkarim Awad
30
Optimization Problem
Minimize (C1(P1)+C2(P2)) (in pu)
Subject to:
1 pu P1 6 pu
0.5 pu P2 4 pu
P 2
4
20 10 2
10 20 3
31
P1
P2
BUS2
BUS1
-10j
P13<1.7
-10j
-10j
BUS3
1
32
Solution (using R)
P1=110
P2=290
2=-0.06
3=0.17
33