varying efficiency in MILP approach
Awaiting user inputHello,
I'm using gurobi in an python enviroment and would like to Model a varying efficiency for a Battery charge/discharge without the Model losing it's MIPL characteristics.
Example Code:
eta_Batt = 0.9 # Battery Efficiency
E_Batt_StandBy = 0 # Constant Dischsarge in [W]
m = Model()
m.setParam("MIPGap", 0.1)
x_E_Batt_discharge = m.addVars(
Horizont,
name="x_E_Batt_discharge",
vtype=GRB.CONTINUOUS,
lb=0,
ub=E_Batt_discharge_max,
)
x_E_Batt_charge = m.addVars(
Horizont, name="x_E_Batt_charge", vtype=GRB.CONTINUOUS, lb=0, ub=E_Batt_charge_max
)
m.addConstrs(
x_SoC_Batt[t]
== x_SoC_Batt[t - 1]
+ (
x_E_Batt_charge[t] * eta_Batt
- x_E_Batt_discharge[t] / eta_Batt
- E_Batt_StandBy
)
* (100 * (delta_t / 60) / Cap_Batt)
for t in T1
)
m.addConstrs(
x_SoC_Batt[t]
== SoC_Batt_start
+ (
x_E_Batt_charge[t] * eta_Batt
- x_E_Batt_discharge[t] / eta_Batt
- E_Batt_StandBy
)
* (100 * (delta_t / 60) / Cap_Batt)
for t in range(1)
)
I'm searching for a way so that eta_Batt is not a constant but decreases with x_E_Batt_charge or x_E_Batt_discharge without having it directly dependent on these variables and therefore making the contrstaints quadratic.
Thank you in advance
Johanna
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Johanna,
Could you please write the quadratic mathematical expression defining the relationship between the variables \(\texttt{eta_Batt}\) and \(\texttt{x_E_Batt_charge}\)/\(\texttt{x_E_Batt_discharge}\)?
The Gurobi optimizer can handle non-convex quadratic constraints directly. Have you tried modelling the problem in the quadratic form to evaluate the Gurobi performance?
Best regards,
Maliheh
0
Post is closed for comments.
Comments
2 comments