Pumped_Storage.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:HydropowerProject 作者: msdogan 项目源码 文件源码
def obj_func_disc_nofit(xx, e_g, e_p, g, rho, Q_g, Q_p, head_g, head_p, optimizing = True):
    H_T = int(price_duration.Frequency.max()) # total duration (100%)
    prc_g, prc_p, freq_g, freq_p = [],[],[],[]       
    for i,x in enumerate(price_duration.Frequency):
        if x < xx: # Power Generation price and duration
            prc_g.append(price_duration.Price[i]), freq_g.append(x)
        if H_T - xx < x < H_T: # Pumping price and duration
            prc_p.append(price_duration.Price[i]), freq_p.append(x)  
    prc_g = np.array(prc_g) # generation price
    prc_p = np.array(prc_p) # pumping price
    freq_g = np.array(freq_g) # generation duration
    freq_p = np.array(freq_p) # pumping duration
    # Use numerical integration to integrate (Trapezoidal rule)
    Power_Revenue = np.trapz(prc_g, freq_g, dx=0.1, axis = -1)*e_g*rho*g*Q_g*head_g/(10**6)
    Pumping_Cost = np.trapz(prc_p, freq_p, dx=0.1, axis = -1)/e_p*rho*g*Q_p*head_p/(10**6)   
    z = Power_Revenue - Pumping_Cost # profit
    return z if optimizing else -z

# fit a curve
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号