Skip to content

Commit ca85342

Browse files
Merge pull request #2917 from jClugstor/bifurcation_ext_codegen_fix
Bifurcationkit_ext observable fix
2 parents cf929ad + d4899bc commit ca85342

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

ext/MTKBifurcationKitExt.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ function BifurcationKit.BifurcationProblem(osys::ODESystem, args...; kwargs...)
144144
if !ModelingToolkit.iscomplete(osys)
145145
error("A completed `ODESystem` is required. Call `complete` or `structural_simplify` on the system before creating a `BifurcationProblem`")
146146
end
147-
nsys = NonlinearSystem([0 ~ eq.rhs for eq in equations(osys)],
147+
nsys = NonlinearSystem([0 ~ eq.rhs for eq in full_equations(osys)],
148148
unknowns(osys),
149149
parameters(osys);
150+
observed = observed(osys),
150151
name = nameof(osys))
151152
return BifurcationKit.BifurcationProblem(complete(nsys), args...; kwargs...)
152153
end

test/extensions/bifurcationkit.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,33 @@ let
133133
@test length(fold_points) == 2
134134
@test fold_points [-1.1851851706940317, -5.6734983580551894e-6] # test that they occur at the correct parameter values).
135135
end
136+
137+
let
138+
@mtkmodel FOL begin
139+
@parameters begin
140+
τ # parameters
141+
end
142+
@variables begin
143+
x(t) # dependent variables
144+
RHS(t)
145+
end
146+
@equations begin
147+
RHS ~ τ + x^2 - 0.1
148+
D(x) ~ RHS
149+
end
150+
end
151+
152+
@mtkbuild fol = FOL()
153+
154+
par = [fol.τ => 0.0]
155+
u0 = [fol.x => -1.0]
156+
#prob = ODEProblem(fol, u0, (0.0, 1.), par)
157+
158+
bif_par = fol.τ
159+
bp = BifurcationProblem(fol, u0, par, bif_par)
160+
opts_br = ContinuationPar(p_min = -1.0,
161+
p_max = 1.0)
162+
bf = bifurcationdiagram(bp, PALC(), 2, opts_br)
163+
164+
@test bf.γ.specialpoint[1].param0.1 atol=1e-4 rtol=1e-4
165+
end

0 commit comments

Comments
 (0)