Dear Professor,
I have an issue regarding the correct way to model constraints. I have a variable and I have to model its bounds. These bounds have to be valid for each timestep.
For instance:
AvL_capacity=sdpvar(1,Horizon) where Horizon is the number of timesteps
AvL_capacity >= 0
AvL_capacity<= EES_capacity
If I write the constraint as above YALMIP sees the inequalities as "element wise inequality 24x1".
If I model the bounds using a for loop:
AvL_capacity_bounds = [];
for k=1:Horizon;
AvL_capacity_bounds = [AvL_capacity_bounds,(AvL_capacity(k)>=0),(AvL_capacity(k)<=EES_capacity)];
end
YALMIP sees the inequalities as "element wise inequality 1x1".
(The same goes for bounds of the variable Pees_store).
The same doubt goes for the following balance constraint:
Phub_balance = [];
for k=1:Horizon;
Phub_balance = [Phub_balance,Pgrid_phub(k) + Ppv_phub(k) + Pees_phub(k) - Pphub_ees(k) + Pchp_phub(k) == Pphub_eload(k)]; %balance equation
end
With a for loop YALMIP sees the constraint as "equality constraint 1x1".
WIthout for loop YALMIP sees the constraint as "equality constraint 1x24":
Phub_balance = [(Pgrid_phub + Ppv_phub + Pees_phub - Pphub_ees + Pchp_phub == Pphub_eload)]; %balance equation
WHAT IS THE CORRECT WAY TO MODEL THESE INEQUALITY AND EQUALITY CONSTRAINTS IN ORDER, FOR EXAMPLE, TO HAVE THE POSITIVITY OF AvL_capacity AND THE VALIDITY OF THE BALANCE EQUATION IN EACH TIMESTEP OF THE OPTIMIZATION?
(Using the two ways I showed you i get different results:
file "prova_tuttoel.m" --->constraints without for loops
file "prova_tuttoel_mettotuttiforsudiseq.m"---->constraints with for loops)
Thank you very much!! Any help is really appreciated!