-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
SciML/JumpProcesses.jl
#461Labels
bugSomething isn't workingSomething isn't working
Description
using ModelingToolkit, OrdinaryDiffEqTsit5, JumpProcesses, Plots
t = ModelingToolkit.t_nounits
@variables A(t) B(t) C(t)
@parameters k
vrj = VariableRateJump(k * (sin(t) + 1), [A ~ A + 1, C ~ C + 2])
js = complete(JumpSystem([vrj], t, [A, C], [k]; name = :js, observed = [B ~ C * A]))
oprob = ODEProblem(js, [A => 0, C => 0], (0.0, 10.0), [k => 1.0])
jprob = JumpProblem(js, oprob)
sol = solve(jprob, Tsit5())
plot(sol)
gives
julia> plot(sol)
ERROR: ArgumentError: Collection must contain exactly 1 element
Stacktrace:
[1] _only
@ ./iterators.jl:1561 [inlined]
[2] only(s::Set{Any})
@ Base ./set.jl:178
[3] macro expansion
@ ~/.julia/packages/SciMLBase/u1M8h/src/solutions/solution_interface.jl:242 [inlined]
[4] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, sol::SciMLBase.AbstractTimeseriesSolution)
@ SciMLBase ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:300
[5] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/user_recipe.jl:38
[6] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
@ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:72
[7] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
@ Plots ~/.julia/packages/Plots/kLeqV/src/plot.jl:223
[8] plot(args::Any; kw...)
@ Plots ~/.julia/packages/Plots/kLeqV/src/plot.jl:102
[9] plot(args::Any)
@ Plots ~/.julia/packages/Plots/kLeqV/src/plot.jl:93
[10] top-level scope
@ REPL[19]:1
Environment:
(jl_D37Hzc) pkg> st
Status `/private/var/folders/8s/kss4zcyx10v_l22h64zdzs6m0000gn/T/jl_D37Hzc/Project.toml`
[ccbc3e58] JumpProcesses v9.14.0
[961ee093] ModelingToolkit v9.49.0
[b1df2697] OrdinaryDiffEqTsit5 v1.1.0
[0bca4576] SciMLBase v2.58.1
For a JumpProblem over a DiscreteProblem things still seem to work:
@variables A(t) B(t)
@parameters k
crj = ConstantRateJump(k*A, [A ~ A - 1, B ~ B + 1])
js = complete(JumpSystem([crj], t, [A, B], [k]; name = :js))
dprob = DiscreteProblem(js, [A => 10, B => 0], (0.0, 10.0), [k => 1.0])
jprob = JumpProblem(js, dprob)
sol = solve(jprob)
plot(sol)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working