@@ -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), observeds (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 .( observeds ( 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 = observeds ( 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 `observeds(sys)`.
14141415
14151416See also [`ModelingToolkit.get_unknowns`](@ref).
14161417"""
@@ -1673,6 +1674,14 @@ function controls(sys::AbstractSystem)
16731674 isempty (systems) ? ctrls : [ctrls; reduce (vcat, namespace_controls .(systems))]
16741675end
16751676
1677+ """
1678+ $(TYPEDSIGNATURES)
1679+
1680+ Get the observed equations of the system `sys` and its subsystems.
1681+ These can be expressed in terms of `unknowns(sys)`, and do not have to be explicitly solved for.
1682+
1683+ See also [`observeds`](@ref) and [`ModelingToolkit.get_observed()`](@ref).
1684+ """
16761685function observed (sys:: AbstractSystem )
16771686 obs = get_observed (sys)
16781687 systems = get_systems (sys)
@@ -1682,6 +1691,19 @@ function observed(sys::AbstractSystem)
16821691 init = Equation[])]
16831692end
16841693
1694+ """
1695+ $(TYPEDSIGNATURES)
1696+
1697+ Get the observed variables of the system `sys` and its subsystems.
1698+ These can be expressed in terms of `unknowns(sys)`, and do not have to be explicitly solved for.
1699+ It is equivalent to all left hand sides of `observed(sys)`.
1700+
1701+ See also [`observed`](@ref).
1702+ """
1703+ function observeds (sys:: AbstractSystem )
1704+ return map (eq -> eq. lhs, observed (sys))
1705+ end
1706+
16851707Base. @deprecate default_u0 (x) defaults (x) false
16861708Base. @deprecate default_p (x) defaults (x) false
16871709
0 commit comments