Ramp Rate constraint in Economic Dispatch using Linprog function

I have a problem in implementing ramp rate constraint using linprog function. I have 5 generators with marginal costs, ramp rate limits, min and max generation capacities as linear functions. In short my economic dispatch problem is as follows:
f = [1000 500 0 0 300]; %%Objective function
lb = [0 0 0 0 0]; %%Lower boundary
ub = [5000 9000 3500 1500 8000]; %%Upper boundary
Aeq = [1 1 1 1 1]; %%Equality Constraint
beq = L; %%Total load
Now, the ramp rate constraint: let PG1 be power generated by generator 1(say)
|PG1(k) - PG1(k-1)| <= Ramp rate limit(200);
where k is the optimization period. so how can i implement this using linprog function...?
PG = linprog(f,A,b,Aeq,beq,lb,ub);

2 Comments

What are the unknown variables x(i) and what is the dependence of PG on these variables?
PG = linprog(f,A,b,Aeq,beq,lb,ub);
Instead of x, i used PG. The output values are Power generated by each generator (PG). So x(i) = PG(i).

Sign in to comment.

 Accepted Answer

f = [1000 500 0 0 300]; %%Objective function
A = [];
b = [];
Aeq = [1 1 1 1 1]; %%Equality Constraint
beq = L; %%Total load
lb = [0 0 0 0 0]; %%Lower boundary
ub = [5000 9000 3500 1500 8000]; %%Upper boundary
PG = linprog(f,A,b,Aeq,beq,lb,ub);
A = [eye(5);-eye(5)];
for i=1:288
b = [200+PG(1) ; 83.33+PG(2) ; 100+PG(3) ; 150+PG(4) ; 66.67+PG(5) ; 200-PG(1) ; 83.33-PG(2) ; 100-PG(3) ; 150-PG(4) ; 66.67-PG(5)];
PG = linprog(f,A,b,Aeq,beq,lb,ub);
end
Best wishes
Torsten.

4 Comments

Thanks Torsten, I tried your code. A matrix and b vector as inequality constraints for implementing ramp rate constraint. I verified the output and it works perfectly and satisfies the ramp rate limits for every optimization period. Thank you for your answer, it helped me solve my problem.
Torsten's solution does satisfy the ramp limits, but if the goal is to optimize the total generator output across all 288 periods subject to those limits, i.e.,
min. sum_k dot(f,PG_k)
then this solution is not optimal.
Torsten's solution satisfies ramp limits and my goal is to optimize the total generation across all 288 periods.How can i obtain optimal solution to my problem.Please help me.Thanks in advance.
What advice is there to add beyond the solution that I proposed in my answer from November?

Sign in to comment.

More Answers (1)

n=numel(f);
D=diff(eye(n));
A=[D;-D];
b=200*ones(n,1);
PG = linprog(f,A,b,Aeq,beq,lb,ub);

4 Comments

I have different ramp rate constraints for each generator.
|PG1(k) - PG1(k-1)| <= 200 %%Ramp Rate for Generator 1
|PG2(k) - PG2(k-1)| <= 83.33 %%Ramp Rate for Generator 2
|PG3(k) - PG3(k-1)| <= 100 %%Ramp Rate for Generator 3
|PG4(k) - PG4(k-1)| <= 150 %%Ramp Rate for Generator 4
|PG5(k) - PG5(k-1)| <= 66.67 %%Ramp Rate for Generator 5
and k is the optimization period, k is from 1 to 288 periods. So the linprog function for economic dispatch should run in a loop for 288 times
PG = linprog(f,A,b,Aeq,beq,lb,ub);
The ramp rate constraint is the difference of the PG values obtained in current optimization period and previous optimization period. Which translates to that, each generator's output obtained from linprog function is constrained to either ramp up or ramp down within the ramp rate limits. So how can i include this ramp rate constraint as inequality constraint in linprog function...?
You will not be able to divide the optimization into independent periods. You will have to solve for all 5x288 unknown PG simultaneously:
D=speye(288);
A=kron([D,-D],eye(5));
b=kron(ones(288*2,1), [200;83.33;100;150;66.7]);
Aeq=kron(speye(288),ones(1,5));
beq=L*ones(288,1);
LB=repmat(lb(:),1,288);
UB=repmat(ub(:),1,288);
F=repmat(f(:),1,288);
PGall = linprog(F,A,b,Aeq,beq,LB,UB)
Hi,
I'm trying to use this code, but the following error is displayed:
The number of rows in A must be the same as the number of elements of b.
f = [1000 500 0 0 300]; % Objective function
lb = [0 0 0 0 0]; % lower bound
ub = [5000 9000 3500 1500 8000]; % upper bound
L = 20000; % load
D=speye(288);
A=kron([D,-D],eye(5));
b=kron(ones(288*2,1), [200;83.33;100;150;66.7]);
Aeq=kron(speye(288),ones(1,5));
beq=L*ones(288,1);
LB=repmat(lb(:),1,288);
UB=repmat(ub(:),1,288);
F=repmat(f(:),1,288);
PGall = linprog(F,A,b,Aeq,beq,LB,UB)
Do you have any ideas, why?
Best regards,
Aleksandra
It's because the A and b matrix generated by the code have different numbers of rows. But never mind. Looking back at it now, the problem was probably stated incorrectly. Since there are no changes in any of the problem data from period to period, satisfying the rate constraint is trivial. Just solve the optimization problem for the first period and use that for all later periods.

Sign in to comment.

Asked:

on 17 Nov 2017

Edited:

on 21 Feb 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!