线性优化中的PV生产过剩



我目前正在尝试优化电池存储。对于光伏发电量过剩的情况,我试图提出一个生产过剩的约束条件。

我第一次尝试这个版本,但不起作用:

def pv_overproduction(model, t):
if model.demand[t] <= model.pv[t]:
return model.excess_pv[t] == model.pv[t] - model.demand[t]
else:
model.excess_pv[t] == 0
model.pv_overproduction = Constraint(model.t, rule = pv_overproduction)

据我所知,这个不起作用,因为我不能在if语句中使用变量。但是我没有办法解决这个问题。

这是为了减少光伏电力输入的负载覆盖功能:

def load_coverage(model, t):
return (model.pv[t] - model.excess_pv[t]) + model.elec_grid[t] + model.discharge[t] == model.demand[t]
model.load_coverage = Constraint(model.t, rule = load_coverage)

这是我的第二次尝试,可惜也没有成功。

def pv_overproduction(model, t):
return model.excess_pv[t] == model.pv[t] - model.demand[t]
model.pv_overproduction = Constraint(model.t, rule = pv_overproduction)

我的第二次尝试没有成功,因为模型excess_pv[t]大部分时间都是负的,这通常是有道理的。但我也不需要负值,因为这显然意味着没有生产过剩。。。

如能为解决上述问题提供任何帮助,我们将不胜感激。

我认为您的第一次尝试非常接近。如果正确使用不等式约束,if语句是不必要的。。。

捕获超额的约束条件:

excess >= supply - demand

仅在非负时捕获过量:

excess >= 0   (or alternatively set the domain to non-negative reals, which is equivalent)

假设你的问题是最小化,在你的目标中放入一个小的(或大的(惩罚

obj = ... + penalty * excess

插入几个测试值以确保您相信!:(

最新更新