Skip to content

Commit

Permalink
fix: make SII.observed support time-independent systems
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed May 31, 2024
1 parent e721fe7 commit 152e9c2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,20 @@ function SymbolicIndexingInterface.is_observed(sys::AbstractSystem, sym)
end

function SymbolicIndexingInterface.observed(sys::AbstractSystem, sym)
return let _fn = build_explicit_observed_function(sys, sym)
fn(u, p, t) = _fn(u, p, t)
fn(u, p::MTKParameters, t) = _fn(u, p..., t)
fn
if is_time_dependent(sys)
return let _fn = build_explicit_observed_function(sys, sym)
fn1(u, p, t) = _fn(u, p, t)
fn1(u, p::MTKParameters, t) = _fn(u, p..., t)
fn1
end
else
return let _fn = build_explicit_observed_function(sys, sym)
fn2(u, p) = _fn(u, p)
fn2(u, p::MTKParameters) = _fn(u, p...)
fn2(::Nothing, p) = _fn([], p)
fn2(::Nothing, p::MTKParameters) = _fn([], p...)
fn2
end
end
end

Expand Down

0 comments on commit 152e9c2

Please sign in to comment.