@@ -262,9 +262,11 @@ function IndexCache(sys::AbstractSystem)
262262 sym = eq. lhs
263263 vs = vars (eq. rhs)
264264 timeseries = TimeseriesSetType ()
265- for v in vs
266- if (idx = get (disc_idxs, v, nothing )) != = nothing
267- push! (timeseries, idx. clock_idx)
265+ if is_time_dependent (sys)
266+ for v in vs
267+ if (idx = get (disc_idxs, v, nothing )) != = nothing
268+ push! (timeseries, idx. clock_idx)
269+ end
268270 end
269271 end
270272 ttsym = default_toterm (sym)
@@ -284,11 +286,20 @@ function IndexCache(sys::AbstractSystem)
284286 sym = eq. lhs
285287 vs = vars (eq. rhs)
286288 timeseries = TimeseriesSetType ()
287- for v in vs
288- if (idx = get (disc_idxs, v, nothing )) != = nothing
289- push! (timeseries, idx. clock_idx)
290- elseif haskey (unk_idxs, v) || haskey (observed_syms_to_timeseries, v)
291- push! (timeseries, ContinuousTimeseries ())
289+ if is_time_dependent (sys)
290+ for v in vs
291+ if (idx = get (disc_idxs, v, nothing )) != = nothing
292+ push! (timeseries, idx. clock_idx)
293+ elseif haskey (unk_idxs, v)
294+ push! (timeseries, ContinuousTimeseries ())
295+ elseif haskey (observed_syms_to_timeseries, v)
296+ union! (timeseries, observed_syms_to_timeseries[v])
297+ elseif haskey (dependent_pars_to_timeseries, v)
298+ union! (timeseries, dependent_pars_to_timeseries[v])
299+ elseif iscall (v) && issym (operation (v)) &&
300+ is_variable (sys, operation (v)(get_iv (sys)))
301+ push! (timeseries, ContinuousTimeseries ())
302+ end
292303 end
293304 end
294305 ttsym = default_toterm (sym)
0 commit comments