Solved

IF-THEN Batterycharing

  • 24 June 2023
  • 2 replies
  • 81 views

Hello to everyone,

 

i have the following problem i can not solve. So on the one side I have consumers that need a certain amount of energy at a time. On the other side I have a generator plant that produce green electricity. The Problem is, that the demand can not alaways be satisfied by the generators. For this I use batteries. The are charged, if there is more then enough energy available.

The express this mathematically, I used a if then formulation: For the charging I use:

Demand(t) - Generator (t) >= 0 → Battery(t) = Battery(t-1)*(1-self-discharge-coeffizient)+((Demand(t)-Generator(t))*efficiency_Inverter*efficiency_Battery)

For the discharging

Demand(t) - Generator (t) <= 0 → Battery(t) = Battery(t-1)*(1 - self_discharge_coeffizient)+((Demand(t)-Generator(t))/efficiency_Inverter)

Demand(t), Generator(t) and Battery(t) are variables.

self_discharge_coeffizient, efficiency are parameters

 

I do not have any clue how to solve the problem in AIMMS. If anybody could help me, i would be very thankfull.

 

icon

Best answer by Marcel Hunting 26 June 2023, 12:14

View original

2 replies

Userlevel 5
Badge +4

Hi @LGoeckeler. You can formulate this using indicator constraints. Introduce a binary variable b(t) and use the following constraints:

Constraint C1a {
IndexDomain: t;
Property : IndicatorConstraint;
ActivatingCondition : b(t) = 1;
Definition : Demand(t) - Generator (t) >= 0;
}
Constraint C1b {
IndexDomain: t;
Property : IndicatorConstraint;
ActivatingCondition : b(t) = 1;
Definition : Battery(t) = Battery(t-1)*(1-self-discharge-coeffizient)+
((Demand(t)-Generator(t))*efficiency_Inverter*
efficiency_Battery);
}
Constraint C2a {
IndexDomain: t;
Property : IndicatorConstraint;
ActivatingCondition : b(t) = 0;
Definition : Demand(t) - Generator (t) <= 0;
}
Constraint C2b {
IndexDomain: t;
Property : IndicatorConstraint;
ActivatingCondition : b(t) = 0;
Definition : Battery(t) = Battery(t-1)*(1 - self_discharge_coeffizient)+
((Demand(t)-Generator(t))/efficiency_Inverter);
}

Indicator constraints are only supported by CPLEX, Gurobi and ODH-CPLEX.

Hi @Marcel Hunting, Many many thanks for your advice! It really helps me!

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator