@@ -163,18 +163,50 @@ function isvarkind(m, x)
163163 getmetadata (x, m, false )
164164end
165165
166+ """
167+ $(TYPEDSIGNATURES)
168+
169+ Set the `input` metadata of variable `x` to `v`.
170+ """
166171setinput (x, v:: Bool ) = setmetadata (x, VariableInput, v)
172+ """
173+ $(TYPEDSIGNATURES)
174+
175+ Set the `output` metadata of variable `x` to `v`.
176+ """
167177setoutput (x, v:: Bool ) = setmetadata (x, VariableOutput, v)
168178setio (x, i:: Bool , o:: Bool ) = setoutput (setinput (x, i), o)
169179
180+ """
181+ $(TYPEDSIGNATURES)
182+
183+ Check if variable `x` is marked as an input.
184+ """
170185isinput (x) = isvarkind (VariableInput, x)
186+ """
187+ $(TYPEDSIGNATURES)
188+
189+ Check if variable `x` is marked as an output.
190+ """
171191isoutput (x) = isvarkind (VariableOutput, x)
172192
173193# Before the solvability check, we already have handled IO variables, so
174194# irreducibility is independent from IO.
195+ """
196+ $(TYPEDSIGNATURES)
197+
198+ Check if `x` is marked as irreducible. This prevents it from being eliminated as an
199+ observed variable in `mtkcompile`.
200+ """
175201isirreducible (x) = isvarkind (VariableIrreducible, x)
176202setirreducible (x, v:: Bool ) = setmetadata (x, VariableIrreducible, v)
177203state_priority (x:: Union{Num, Symbolics.Arr} ) = state_priority (unwrap (x))
204+ """
205+ $(TYPEDSIGNATURES)
206+
207+ Return the `state_priority` metadata of variable `x`. This influences its priority to be
208+ chosen as a state in `mtkcompile`.
209+ """
178210state_priority (x) = convert (Float64, getmetadata (x, VariableStatePriority, 0.0 )):: Float64
179211
180212normalize_to_differential (x) = x
@@ -419,6 +451,11 @@ function getdescription(x)
419451 Symbolics. getmetadata (x, VariableDescription, " " )
420452end
421453
454+ """
455+ $(TYPEDSIGNATURES)
456+
457+ Check if variable `x` has a non-empty attached description.
458+ """
422459function hasdescription (x)
423460 getdescription (x) != " "
424461end
0 commit comments