help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] conditional constraint Matlab


From: aastha.kanwar
Subject: [Help-glpk] conditional constraint Matlab
Date: Tue, 29 Apr 2014 19:32:11 +0200

Hello help-glpk members
 
I am working on a model with batteries using Matlab. I would like to optimize how much power goes into or out of battery.
 
P(i) represents power for time step i. This is the variable to be optimized. If P is positive, it represents dicharging of battery, if P is negative then it is charging. Since charging and discharging conditions for battery are different, I need to use conditional constraints. I have read about using binary variables for conditional constraints but I cannot figure out how to apply it here.
 
I want to model contraints of following form:
if P(i) >0 (discharging)
limit1<= K(i,1)*P(1)+ K(i,2)*P(2)+ K(i,3)*P(3)...K(i,i)*P(i) <= limit2
K(i,1),K(i,2)... are constants
 
else if P(i)<=0 (charging)
limit1<= C(i,1)*P(1)+ C(i,2)*P(2)+ C(i,3)*P(3)...C(i,i)*P(i) <= limit2
C(i,1),C(i,2)... are constants different from K(i,1)..
 
Is it possible to represent such constraint for linear programming? Also, I am working with 72 time steps and three batteries. So it is 216 variables. Would that be too complicated?
__________________________________________________________________________
For more details, the above constraint is reformulation of following: 
The energy in battery at time i+1 depends on energy in battery at time i and power in/output in time step i.
 
E(i+1)=E(i)- P(i)/discharging_efficiency * time_step
or
E(i+1)=E(i)+ P(i)*charging_efficiency * time_step
 
 and    min_limit <= E(i)<= max_limit
 
So, the constant K(i,1) depends upon the signs of P(1),P(2)..P(i). i.e. if we were charging or discharging for each step.
 
I would appreciate any help I can get. Thank you so much. :)
 
Aastha
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]