Skip to content

Commit aa3f0ba

Browse files
fixup! feat: add SII.observed support for AbstractSystem
1 parent 7c3817e commit aa3f0ba

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/systems/abstractsystem.jl

+14-4
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,20 @@ function SymbolicIndexingInterface.is_observed(sys::AbstractSystem, sym)
556556
end
557557

558558
function SymbolicIndexingInterface.observed(sys::AbstractSystem, sym)
559-
return let _fn = build_explicit_observed_function(sys, sym)
560-
fn(u, p, t) = _fn(u, p, t)
561-
fn(u, p::MTKParameters, t) = _fn(u, p..., t)
562-
fn
559+
if is_time_dependent(sys)
560+
return let _fn = build_explicit_observed_function(sys, sym)
561+
fn1(u, p, t) = _fn(u, p, t)
562+
fn1(u, p::MTKParameters, t) = _fn(u, p..., t)
563+
fn1
564+
end
565+
else
566+
return let _fn = build_explicit_observed_function(sys, sym)
567+
fn2(u, p) = _fn(u, p)
568+
fn2(u, p::MTKParameters) = _fn(u, p...)
569+
fn2(::Nothing, p) = _fn([], p)
570+
fn2(::Nothing, p::MTKParameters) = _fn([], p...)
571+
fn2
572+
end
563573
end
564574
end
565575

0 commit comments

Comments
 (0)