I am writing a LP formulation for generator dispatch.
The generator production is a two dimensional matrix, n*t ; n = number of generators , t= time step
Now generator production values depending on the previous time step values.
So theoretical equation is
P[g,t] - P[g,t-1] < R; R is a constant and also
P[g,t] - P[g,t-1] > -R
How should I write this using CVX
minimize sum((sum(pg)).*costco) + sum(grid)*5
(rampmin ) <= diff(pg) <= (rampmax ) %ramp rate limit, CVX does not recognize diff function of MATLAB
sum (pg,2) + grid == load; % Load demand constraint, sum over the rows , CVX fails to create this constraint
pgmin <= pg(:,g) <= pgmax; % Generator power constraint ; How should I define g?
Sorry, i forgot that diff is not supported for CVX variables or expressions - there was a previous thread about that in this forum. You can put the constraints in a for loop.
rampmin <= pg(:,t) - pg(:,t-1) <= rampmax
I don’t know what you want to do with g. if all elements of pg need to be in [pgmin,pgmax], then use (not in a for loop) , pgmin <= pg <= pgmax
I think you will not want or need to use nonnegative in the variable declaration of pg, because of the pgmin constraint.