Ramp rate limit constraint in cvx

I am trying to develop a code for the “Optimal Generator Dispatch” of the “Additional Exercises for Convex Optimization” book by Stephen Boyd and Lieven Vandenberghe.

I am unable to incorporate the ramp rate limit ? Please guide me how to apply this constraints.

Thank you
Abdul Hafeez

You could do it with for-loops, but it’s better to avoid these. The constraint can be written as \max_{t=2,\ldots,T}|p_{it}-p_{i,t-1}|\le R_i for i=1,\ldots,n. This suggests using CVX’s norms command:

norms(p(:, 2:T) - p(:, 1:(T-1)), Inf, 2) <= R

That is, we take the L_\infty-“norm” of each row of the matrix of differences.

1 Like

That’s a great answer. Of course, for the Inf norm case, the norms term is equivalent to max(abs(...),[],2).