SlopeInfluence_ETref.py 文件源码

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

项目:wa 作者: wateraccounting 项目源码 文件源码
def TwoPeriodSunnyTimes(constant,delta,slope,slopedir,lat):
    # First derive A1 and A2 from the normal procedure    
    A1,A2 = SunHours(delta,slope,slopedir,lat)

    # Then calculate the other two functions.
    # Initialize function    

    a,b,c = Constants(delta,slope,slopedir,lat)
    riseSlope, setSlope = BoundsSlope(a,b,c)  

    B1 = np.maximum(riseSlope,setSlope)
    B2 = np.minimum(riseSlope,setSlope)

    Angle_B1 = AngleSlope(a,b,c,B1)
    Angle_B2 = AngleSlope(a,b,c,B2) 

    B1[abs(Angle_B1) > 0.001] = np.pi - B1[abs(Angle_B1) > 0.001]
    B2[abs(Angle_B2) > 0.001] = -np.pi - B2[abs(Angle_B2) > 0.001]    

    # Check if two periods really exist
    ID = np.ravel_multi_index(np.where(np.logical_and(B2 >= A1, B1 <= A2) == True),a.shape)
    Val = IntegrateSlope(constant,B2.flat[ID],B1.flat[ID],delta,slope.flat[ID],slopedir.flat[ID],lat.flat[ID])
    ID = ID[Val < 0]

    return A1,A2,B1,B2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号