old_sgra_simple_rocket.py 文件源码

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

项目:SOAR 作者: araujolma 项目源码 文件源码
def oderest(sizes,x,u,pi,t,constants,boundary,restrictions):
    print("\nIn oderest.")


    # get sizes
    N = sizes['N']
    n = sizes['n']
    m = sizes['m']
    p = sizes['p']

    print("Calc phi...")
    # calculate phi and psi
    phi = calcPhi(sizes,x,u,pi,constants,restrictions)

    # aux: phi - dx/dt
    aux = phi - ddt(sizes,x)

    # get gradients
    print("Calc grads...")
    Grads = calcGrads(sizes,x,u,pi,constants,restrictions)
    phix = Grads['phix']

    lam = 0*x        
    B = numpy.zeros((N,m))
    C = numpy.zeros(p)

    print("Integrating ODE for A...")
    # integrate equation for A:
    A = odeint(calcADotOdeRest,numpy.zeros(n),t,args= (t,phix,aux))

    #optPlot = dict()    
    #optPlot['mode'] = 'var'
    #plotSol(sizes,t,A,B,C,constants,restrictions,optPlot)

    print("Calculating step...")
    alfa = calcStepOdeRest(sizes,t,x,u,pi,A,B,C,constants,boundary,restrictions)
    nx = x + alfa * A

    print("Leaving oderest with alfa =",alfa)
    return nx,u,pi,lam,mu

# ##################
# MAIN SEGMENT:
# ##################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号