0

我正在尝试模拟一个能源系统,其中有两个时刻可以出售电力。第二个时刻用于对电力供应进行一些调整,可以是额外的电力或更少的电力。

我使用 CVXR 通过以下方式对此进行了建模:

wbal <- Variable(t) #wind power sold in the balancing market (up-regulation)
el <- Variable(t) #power used to perform electrolysis
inst <- Variable(t) #hydrogen that goes to the storage
fc <- Variable(t) #power generated using the fuel cell for the day-ahead market
fcbal <- Variable(t) #power generated using the fuel cell for the balancing market (up-regulation)
sth <- Variable(t) #hydrogen sold to industry from the storage
h <- Variable(t) #hydrogen sold immediately after electrolysis
st <- Variable(t+1) #the storage level
wdown <- Variable(t) #negative amount of wind power sold in the balancing market (down-regulation)
fcdown <- Variable(t) #negative amount of fuel cell power sold in the balancing market (down-regulation)

#objective
objective <- Maximize(sum((wgen+fc)*p[1:(t)]+(wbal+fcbal)*pbal_up+(wdown+fcdown)*pbal_down+(h+sth)*h2p))

#contraints
constraints <- list(st[1]==0, wgen>=0, wbal>=0, wdown <= 0, el>=0, fc>=0, fcdown <=0, fcbal>=0,
h>=0, st>=0, inst>=0, sth>=0,
wgen + wbal + wdown+ el <= wind[1:(t)],
0 <= wbal + fcbal, wbal + fcbal <= max_up,
wdown + fcdown >= max_down, wdown + fcdown <= max_up,
abs(wdown) <= wgen, abs(fcdown) <= fc, #problematic constraint
h + sth <= heat[1:(t)],
el*eel==inst+h,
inst <= sendin,
el<= elmax, fc+fcbal+fcdown<= fcmax,
(fc+fcbal+fcdown)/efc+sth<= st[1:t],
(fc+fcbal+fcdown)/efc+sth<= sendout,
st[1:t+1] <= maxst,
diff(st)==inst-(fc+fcbal+fcdown)/efc-sth #diff is the increase from the last hour
) 

我面临的问题是,在第一时间出售了额外的电力,因为预计以后无论如何它都可以作为负电源出售。这是有道理的,因为这两个时刻都是同时优化的,我正在努力寻找一种方法来确保不会发生这种情况。也许两阶段模型可能有效或逻辑约束,但我不确定如何或是否可以在 CVXR 中完成。

如果有人对这些可能性或替代解决方案有更多了解,我们将不胜感激!我希望问题很清楚,否则请告诉我。

4

0 回答 0