Skip to content

Commit ea9b6bd

Browse files
feat: enable structural_simplify(::SDESystem)
1 parent a2acbe5 commit ea9b6bd

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/systems/systems.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ function __structural_simplify(sys::JumpSystem, args...; kwargs...)
7272
return sys
7373
end
7474

75+
function __structural_simplify(sys::SDESystem, args...; kwargs...)
76+
return __structural_simplify(ODESystem(sys), args...; kwargs...)
77+
end
78+
7579
function __structural_simplify(sys::AbstractSystem, io = nothing; simplify = false,
7680
kwargs...)
7781
sys = expand_connections(sys)

test/sdesystem.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,3 +858,13 @@ end
858858
end
859859
end
860860
end
861+
862+
@testset "`structural_simplify(::SDESystem)`" begin
863+
@variables x(t) y(t)
864+
@mtkbuild sys = SDESystem(
865+
[D(x) ~ x, y ~ 2x], [x, 0], t, [x, y], []; is_scalar_noise = true)
866+
@test sys isa SDESystem
867+
@test length(equations(sys)) == 1
868+
@test length(ModelingToolkit.get_noiseeqs(sys)) == 1
869+
@test length(observed(sys)) == 1
870+
end

0 commit comments

Comments
 (0)