How to write equality constraints for receivers that hourly consume a certain amount of energy

1. How to write equality constraints for receivers that hourly consume a certain amount of energy (let's say 0.9 kWh) once a day? Its hourly consumption can be 0 or 0.9. Its total daily consumption = 0.9. I set lb = 0 and up = 0.9. During the optimization process, this consumption is flexible, the receiver can be scheduled to consume at 11 or 12 o'clock for instance.
2. How to write equality constraints for receivers that can't be interrupted and consume at two consecutive hours certain amount of energy (let's say 2 and 0.7 kWh) once a day? Its total daily consumption = 2.7. I set lb = 0 and ub = 2. This receiver can also consume at any time intervals, the only restrictions are: it should consume at two consecutive time intervals and first 2 kWh and then 0.7 kWh.

2 comentarios

What does the vector of design variables look like? Is it hourly consumption rates for the entire day? What is the length of the variable (24-by-1)?
Simona
Simona el 12 de Ag. de 2015
Editada: Simona el 12 de Ag. de 2015
It is a 1x24 variable. Its hourly consumption = daily consumption, so it is on only for an hour. For other receivers (their hourly consumption forms variables), that consume entire day (such as refrigerator) I wrote Aeq(1,1:24) = [1,1,1,...x24], beq = 5, 5 means its daily consumption.

Iniciar sesión para comentar.

 Respuesta aceptada

You should be representing the design variables as a column vector, I will call it x. With that in mind we want the constraint:
Aeq*x = beq;
If we wish to write the sum of values in x is equal to 5, then we should have:
Aeq = ones(1,24);
beq = 5;
Now simply pass these into the appropriate solver.
For part 2 you will likely need to use some form of global optimization for this, unless your objective in linear as is expected by intlinprog.

7 comentarios

I am afraid I was not clear enough. Let me explain. I already set x as variables' vector. x has 168 rows since I have 7 receivers multiplied by 24 hours. Then for each receiver I set lb and ub. I have no A and b. I only have Aeq and beq to set. These 7 receivers are different as in reality: refrigerator is on 24 hours a day, but washing machine is not. For refrigerator, it was easy to set Aeq = ones(1,24), but for washing machine I don't know how to set Aeq, because it should be on only one hour and this hour is flexible from the optimization point of view. It doesn't matter when washing machine is on, the point is to be on once a day. By Aeq and beq I just set daily consumption for each receiver.
What is the function you are trying to minimize?
Simona
Simona el 12 de Ag. de 2015
Editada: Simona el 12 de Ag. de 2015
min(hourly consumption * price). Price has two levels (0.1 at night and double otherwise)
If this is the case and the washing machine only has to be on for 1 hour you have as many solutions as you have daytime hours (and no real need for an optimization problem). If you really want to perform an optimization on this, then since this is a linear problem it would not be an issue (but again there are so many possibilities for the solution). We can use intlinprog and just rethink about how we want to setup the problem:
Our design vector x will just be an indicator of whether or not the washing machine is on during each hour. We need the constraint that there is only 1 hour it is on. For intlinprog we are minimizing f'x, so assuming the first 12 hours are night and the next 12 are day, f is:
f = [repmat(0.1,12,1); repmat(0.2,12,1)];
intcon = 1:24;
Aeq = ones(1,24);
beq = 1;
lb = zeros(24,1);
ub = ones(24,1);
[xVal,fMin] = intlinprog(f,intcon,[],[],Aeq,beq,lb,ub)
If you really need to combine this with the other optimization problems you can, but since it is linear then you robjective, min(hourly consumption * price), is the same as the sum of the minimums of each device separately.
I forgot to mention that you can just multiple f by the usage for the washing machine in this problem as well.
I will try this approach, that means to add new constraints related to on(1)/off(0) state to the existing ones. Thank you!
When I used intcon for a couple of variables 145:168 Matlab ignored lb=zeros(168,1) and I don't know why. I am very curious. Then I put intcon for all variables and it worked well. Now, I want to change objective function and I don't know how to do this because the new function depends on the results. Objective function should be min(hourly consumption). Hourly consumption should be consumption of 1st receiver + consumption of 2nd receiver... at 1 o'clock and so on.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear Programming and Mixed-Integer Linear Programming en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Ag. de 2015

Comentada:

el 13 de Ag. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by