Enegy Storage Arbitrage - minimal cycles - pyomo
ユーザーの入力を待っています。Dear all, following is my problem:
I am implementing a energy storage arbitrage optimization for the running of a battery. I am specifically interested in the charge and discharge profile that maximizes profit. I have first coded in optimization using a single variable list with negative and positive power figures which works.
I am working with pyomo.
However for further implementations in which I am interested in, I need to have the positive and negative power vectors be separated to eventually use in another objective function.
Specifically the problem is that the first draft of this code that separates the negative and and positive power figures returned optimal charge and discharge solutions containing only one event in each.
You will find below the pasted code that returns what is stated above, as well as a graph of the state of charge of the battery which is an energy balance and represents "model.e".
# Variables
model.discharge = pe.Var(model.IDX, bounds = (0, Pmax))
model.charge = pe.Var(model.IDX, bounds = (0, Pmax))
model.e = pe.Var(model.IDX, bounds = (0, Emax))
model.charge.pprint()
# Objective
model.obj = pe.Objective(expr = sum(values[i-1] * model.discharge[i] -(values[i-1] * model.charge[i]) for i in model.IDX), sense=pe.maximize)
# Constraints
model.cap1 = pe.Constraint(expr = sum(model.discharge[i] for i in model.IDX) <= Pmax)
model.cap2 = pe.Constraint(expr = sum(model.charge[i] for i in model.IDX) <= Pmax)
def ebalance_rule(model, i):
if i == 1:
return model.e[i] == 0
else:
return model.e[i] == model.e[i-1] + model.charge[i] - model.discharge[i]
model.ebalance = pe.Constraint(model.IDX, rule = ebalance_rule)
# Solving the model
opt = pe.SolverFactory('gurobi')
results = opt.solve(model)

I presume that the problem has to do with the objective definition however after pondering new solution seems to come my way.
I would greatly appreciate your help, have a good day!
-
Hi Viktor,
To fully understand your issue with the formulation:
- In each time step you have 2 non-negative variables, one for charging and one for discharging.
- You currently obtain solutions that either only discharge or only charge in one time step, is that correct?
- There are potentially many feasible solutions to obtain the same balances, e.g., if the balance increases by 5 in the next time step, you could charge 5, or charge 10 and discharge 5, etc. Which of those solutions are preferable?
- Currently, your objective function maximizes discharges and minimizes charges, is this what you want? Does the values list used in the objective only contain non-negative coefficients?
Best regards,
Mario0
サインインしてコメントを残してください。
コメント
1件のコメント