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