Hello, this question comes as a kind of follow up to my previous post a couple days ago.
I have a functioning model, which returns an optimal solution, however this solution ignores some of the constraints.
I have modeled a microgrid, part of this is a battery which can discharge to serve a local load.
The battery is defined through these constraints:
return model.batteryLevel[t] == model.batteryLevel[t-1]+model.batteryCharge[t-1]-model.batteryDischarge[t-1]
if t in model.t > 0:
model.battery_test_rule2 = Constraint(model.t, rule = battery_test_rule2)
model.battery_test_rule2 = None
return model.batteryLevel ==1000
model.battery_start_rule = Constraint(model.t, rule = battery_start_rule)
return model.batteryDischarge[t] <= model.batteryLevel[t-1]
if t in model.t >0:
model.battery_discharge_rule2 = Constraint(model.t, rule = battery_discharge_rule2)
model.battery_discharge_rule2 = None
The charging and discharging is also subject to some other constraints, but they seem to work fine. The problem is that the batteryLevel is 1000 for time, and 0 for all other timesteps, this does not seem to affect the discharge, which will continue to work even with an "empty" battery, even if this is in clear violation of the constraints defined above.
Does anyone know what might be the cause of this?
Thanks in advance
Please sign in to leave a comment.