@@ -31,6 +31,15 @@ states(::Any) = []
3131"""
3232$(TYPEDSIGNATURES)
3333
34+ Get an iterable over the unknown states for the given system. Default to an empty vector.
35+ """
36+ function unknown_states end
37+
38+ unknown_states (:: Any ) = []
39+
40+ """
41+ $(TYPEDSIGNATURES)
42+
3443Find the index of the given sym in the given system. Default to the index of the first
3544symbol in the iterable returned by `states` which matches the given `sym`. Return
3645`nothing` if the given `sym` does not match.
@@ -81,3 +90,73 @@ to checking if the value returned by `param_sym_to_index` is not `nothing`.
8190function is_param_sym end
8291
8392is_param_sym (store, sym) = ! isnothing (param_sym_to_index (store, sym))
93+
94+ """
95+ $(TYPEDSIGNATURES)
96+
97+ Get an iterable over the observed variable expressions for the given system.
98+ Default to an empty vector.
99+ """
100+ function observed end
101+
102+ observed (:: Any ) = []
103+
104+ """
105+ $(TYPEDSIGNATURES)
106+
107+ Check if the given sym is an observed variable in the given system. Default
108+ to checking if the value returned by `observed_sym_to_index` is not `nothing`.
109+ """
110+ function is_observed_sym end
111+
112+ is_observed_sym (store, sym) = ! isnothing (observed_sym_to_index (store, sym))
113+
114+ """
115+ $(TYPEDSIGNATURES)
116+
117+ Find the index of the given sym in the given system. Default to the index of the first
118+ symbol in the iterable returned by `states` which matches the given `sym`. Return
119+ `nothing` if the given `sym` does not match.
120+ """
121+ function observed_sym_to_index end
122+
123+ function observed_sym_to_index (store, sym)
124+ findfirst (o -> isequal (sym, o. lhs), observed (store))
125+ end
126+
127+ """
128+ $(TYPEDSIGNATURES)
129+
130+ Return a list of the dependent state variables of an observed variable. Default to returning
131+ an empty list.
132+ """
133+ function get_state_dependencies end
134+
135+ get_state_dependencies (store, sym) = []
136+
137+ """
138+ $(TYPEDSIGNATURES)
139+
140+ Return a list of the dependent observed variables of an observed variable. Default to returning
141+ an empty list.
142+ """
143+ function get_observed_dependencies end
144+
145+ get_observed_dependencies (store, sym) = []
146+
147+ """
148+ $(TYPEDSIGNATURES)
149+
150+ Return a list of the dependent state variables of all observed equations of the system.
151+ Default to returning an empty list.
152+ """
153+ function get_deps_of_observed end
154+
155+ function get_deps_of_observed (store)
156+ obs = observed (store)
157+ deps = mapreduce (vcat, obs, init = []) do eq
158+ get_state_dependencies (store, eq. lhs)
159+ end |> unique
160+
161+ return deps
162+ end
0 commit comments