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

In DDEs constant_lags break PresetTimeCallback #205

Open
laserschwelle opened this issue Feb 9, 2021 · 0 comments
Open

In DDEs constant_lags break PresetTimeCallback #205

laserschwelle opened this issue Feb 9, 2021 · 0 comments

Comments

@laserschwelle
Copy link

I wanted to modulate a DDE system at equidistant points in time. But if the constant_lags=[τ] parameter is set some combinations of delay times and distance between modulations don't work. Not every point in tstops triggers the affect.

Here is a minimal example:

using DifferentialEquations

f(u,h,p,t) = 0
h(p, t) = 0.0

p = 0.3       # delay time
step = 0.04   # intervall for callbacks
num = 1000    # number of callbacks

end_time = step*num
tstops = step:step:end_time  # callback preset times

counter = 0
function affect!(integrator)
    integrator.u = rand()
    global counter += 1
end
cb = PresetTimeCallback(tstops,affect!)

st_length = length(tstops)
println("step_times length: $st_length")

prob_const_lag = DDEProblem(f,h,(0,end_time),p,constant_lags=[p])
solve(prob_const_lag,callback=cb);
println("#callbacks: $counter")

counter = 0
prob_without = DDEProblem(f,h,(0,end_time),p)
solve(prob_without,callback=cb);
println("#callbacks: $counter")

Note: For step = 0.123 the code runs as expected.

@ChrisRackauckas ChrisRackauckas transferred this issue from SciML/DifferentialEquations.jl Feb 12, 2021
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

1 participant