gpt4 book ai didi

ODEintWarning: Excess work done on this call (perhaps wrong Dfun type)(ODEintWarning:此调用上完成的工作过多(可能是错误的DFUN类型))

转载 作者:bug小助手 更新时间:2023-10-25 13:12:54 25 4
gpt4 key购买 nike



I was working on simulating suspension systems in quarter car vehicle using second order differential equations, and I was using Bees Algorithm to as PID controller.

我的工作是用二阶微分方程组模拟1/4轿车的悬架系统,并使用Bees算法作为PID控制器。


def optimal_stiff(kt):
acc_t=-(kt\*(0-1)-ks\*(0-xt\[0\])-b\*(xs\[1\]-xt\[1\]))/Mt
return -abs(acc_t)

def cartire_optim(current_state,t):

xs[0],xt[0],xs[1],xt[1]=current_state # initialize the variables
if t<1: # initialize the road profile
xr=0
else:
xr=1
search_bound=([ks],[2*ks])
optimal= BeesAlgorithm(optimal_stiff,search_bound[0],search_bound[1])
optimal.performFullOptimisation(max_iteration=20)
stiff= optimal.best_solution

acc_s=-(ks*(xs[0]-xt[0])+b*(xs[1]-xt[1]))/Ms # acceleration of the Sprung mass
acc_t=-(stiff.values[0]*(xt[0]-xr)-ks*(xs[0]-xt[0])-b*(xs[1]-xt[1]))/Mt # acceleration of the Unsprung mass
return np.array([xs[1],xt[1],acc_s,acc_t])

solution_optim= odeint(cartire_optim,state,time_point)

When I define the variables needed and run the code, it works till a time step around 1.75 sec and spit out zeros.
The Graph of the xs

当我定义所需的变量并运行代码时,它一直运行到大约1.75秒的时间步长,并吐出零。X的图


This line should stabilize at 1 not zero.

这条线应该稳定在1而不是0。


更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com