@@ -59,6 +59,23 @@ mutable struct TearingState <: StateSelection.TransformationState{System}
5959 are not used in the rest of the system.
6060 """
6161 additional_observed:: Vector{Equation}
62+ """
63+ Corresponding to `fullvars`, marks variables which may not be structurally present in
64+ any equation according to `structure.graph` but should not be considered as unused.
65+ This is typically used by variables on the RHS of equations in `additional_observed`,
66+ and is useful for ensuring the consistency check is valid. For example, a simplification
67+ pass prior to `StateSelection.check_consistency` may process the equations
68+ ```julia
69+ a ~ b
70+ b ~ c
71+ c ~ a
72+ ```
73+ Into `additional_observed = [a ~ b, c ~ b]`, and thus end up in a state where
74+ there are no equations and `fullvars = [b]`. The consistency check would consider `b` as
75+ unused and the system as fully determined, but in reality `b` should be considered
76+ as used and the system singular.
77+ """
78+ always_present:: BitVector
6279 statemachines:: Vector{System}
6380 """
6481 Source information for each equation in the `TearingState`. `Vector{Symbol}` for each
@@ -325,7 +342,8 @@ function TearingState(sys::System, source_info::Union{Nothing, MTKBase.EquationS
325342 structure = SystemStructure (complete (var_to_diff), complete (eq_to_diff),
326343 complete (graph), nothing , var_types, state_priorities, false )
327344 return TearingState (sys, fullvars, structure, Equation[], param_derivative_map,
328- no_deriv_params, original_eqs, Equation[], typeof (sys)[], sources)
345+ no_deriv_params, original_eqs, Equation[], falses (length (fullvars)),
346+ typeof (sys)[], sources)
329347end
330348
331349function build_state_priorities (sys:: System , fullvars:: Vector{SymbolicT} , var_to_diff:: StateSelection.DiffGraph )
0 commit comments