Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/systems/systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ function __structural_simplify(sys::AbstractSystem, io = nothing; simplify = fal
noise_eqs = StructuralTransformations.tearing_substitute_expr(ode_sys, noise_eqs)
return SDESystem(full_equations(ode_sys), noise_eqs,
get_iv(ode_sys), unknowns(ode_sys), parameters(ode_sys);
name = nameof(ode_sys), is_scalar_noise)
name = nameof(ode_sys), is_scalar_noise, observed = observed(ode_sys))
end
end
10 changes: 10 additions & 0 deletions test/sdesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -799,3 +799,13 @@ end
prob = SDEProblem(sys, [], (0.0, 1.0), [])
@test_nowarn solve(prob, RKMil())
end

@testset "Observed variables retained after `structural_simplify`" begin
@variables x(t) y(t) z(t)
@brownian a
@mtkbuild sys = System([D(x) ~ x + a, D(y) ~ y + a, z ~ x + y], t)
@test sys isa SDESystem
@test length(observed(sys)) == 1
prob = SDEProblem(sys, [x => 1.0, y => 1.0], (0.0, 1.0))
@test prob[z] ≈ 2.0
end
Loading