Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Solve First Order Plus Delay Time(FOPDT) #5

Open
Agnes159 opened this issue Mar 23, 2020 · 4 comments
Open

Cannot Solve First Order Plus Delay Time(FOPDT) #5

Agnes159 opened this issue Mar 23, 2020 · 4 comments

Comments

@Agnes159
Copy link

Agnes159 commented Mar 23, 2020

Hi, I try to simulate FOPDT using ddeint. However, it doesn't work for me.
May I have your advice on this?

My system is as shown:

dxdt = (-x(t)+Kp*u(t-d))/taup

where Kp = 1.0 ; d = 180 ; taup = 181 
x(0) = 0.0 and u is a step change from 0 to 0.3

model = lambda x,t,d,Kp,taup : (-x(t)+Kp*u(t-d))/taup
g = lambda t : 0

tt=np.linspace(0,1440,1000)
yy=ddeint(model,g,tt,fargs=(180,1.0,181))

plt.plot(tt,yy)
@Zulko
Copy link
Owner

Zulko commented Mar 23, 2020

What's your error?

@Agnes159
Copy link
Author

TypeError: 'float' object is not callable
^
Above error is shown when I input value for 'u'
where u is a step change from 0 to 0.3

@Agnes159
Copy link
Author

Then, I try to input integer.
It shows:
TypeError: 'int' object is not callable

@Menginventor
Copy link

I implemented dde solver base on ddeint with scipy.integrate.solve_ivp which is newer version.
https://github.com/Menginventor/dde_ivp
It support rk23, rk45 adaptive step size. vectorized variable, dense output, and event detection
I would be more efficient and accurate the existing ddeint. Feel free to try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants