@@ -430,7 +430,7 @@ function has_observed_with_lhs(sys, sym)
430430 if has_index_cache (sys) && (ic = get_index_cache (sys)) != = nothing
431431 return haskey (ic. observed_syms_to_timeseries, sym)
432432 else
433- return any (isequal (sym), [eq . lhs for eq in observed (sys)] )
433+ return any (isequal (sym), observables (sys))
434434 end
435435end
436436
@@ -489,7 +489,7 @@ function _all_ts_idxs!(ts_idxs, ::ScalarSymbolic, sys, sym::Symbol)
489489 if has_index_cache (sys) && (ic = get_index_cache (sys)) != = nothing
490490 return _all_ts_idxs! (ts_idxs, sys, ic. symbol_to_variable[sym])
491491 elseif is_variable (sys, sym) || is_independent_variable (sys, sym) ||
492- any (isequal (sym), [ getname (eq . lhs) for eq in observed ( sys)] )
492+ any (isequal (sym), getname .( observables ( sys)) )
493493 push! (ts_idxs, ContinuousTimeseries ())
494494 elseif is_timeseries_parameter (sys, sym)
495495 push! (ts_idxs, timeseries_parameter_index (sys, s). timeseries_idx)
@@ -579,7 +579,7 @@ SymbolicIndexingInterface.constant_structure(::AbstractSystem) = true
579579
580580function SymbolicIndexingInterface. all_variable_symbols (sys:: AbstractSystem )
581581 syms = variable_symbols (sys)
582- obs = getproperty .( observed ( sys), :lhs )
582+ obs = observables ( sys)
583583 return isempty (obs) ? syms : vcat (syms, obs)
584584end
585585
@@ -1411,6 +1411,7 @@ _nonum(@nospecialize x) = x isa Num ? x.val : x
14111411$(TYPEDSIGNATURES)
14121412
14131413Get the unknown variables of the system `sys` and its subsystems.
1414+ These must be explicitly solved for, unlike `observables(sys)`.
14141415
14151416See also [`ModelingToolkit.get_unknowns`](@ref).
14161417"""
@@ -1677,6 +1678,14 @@ function controls(sys::AbstractSystem)
16771678 isempty (systems) ? ctrls : [ctrls; reduce (vcat, namespace_controls .(systems))]
16781679end
16791680
1681+ """
1682+ $(TYPEDSIGNATURES)
1683+
1684+ Get the observed equations of the system `sys` and its subsystems.
1685+ These can be expressed in terms of `unknowns(sys)`, and do not have to be explicitly solved for.
1686+
1687+ See also [`observables`](@ref) and [`ModelingToolkit.get_observed()`](@ref).
1688+ """
16801689function observed (sys:: AbstractSystem )
16811690 obs = get_observed (sys)
16821691 systems = get_systems (sys)
@@ -1686,6 +1695,19 @@ function observed(sys::AbstractSystem)
16861695 init = Equation[])]
16871696end
16881697
1698+ """
1699+ $(TYPEDSIGNATURES)
1700+
1701+ Get the observed variables of the system `sys` and its subsystems.
1702+ These can be expressed in terms of `unknowns(sys)`, and do not have to be explicitly solved for.
1703+ It is equivalent to all left hand sides of `observed(sys)`.
1704+
1705+ See also [`observed`](@ref).
1706+ """
1707+ function observables (sys:: AbstractSystem )
1708+ return map (eq -> eq. lhs, observed (sys))
1709+ end
1710+
16891711Base. @deprecate default_u0 (x) defaults (x) false
16901712Base. @deprecate default_p (x) defaults (x) false
16911713
0 commit comments