@@ -53,7 +53,7 @@ struct Basis{IMPL, CTRLS} <: AbstractBasis
5353 """ The equations of the basis"""
5454 eqs:: Vector{Equation}
5555 """ Dependent (state) variables"""
56- states :: Vector
56+ unknowns :: Vector
5757 """ Control variables"""
5858 ctrls:: Vector
5959 """ Parameters"""
168168# # Printing
169169
170170@inline function Base. print (io:: IO , x:: AbstractBasis )
171- state = states (x)
171+ state = unknowns (x)
172172 ps = parameters (x)
173173 Base. printstyled (io, " Model $(nameof (x)) with $(length (x)) equations\n " ; bold = true )
174174 print (io, " States :" )
207207@inline function Base. print (io:: IO , x:: AbstractBasis , fullview:: Bool )
208208 ! fullview && return print (io, x)
209209
210- state = states (x)
210+ state = unknowns (x)
211211 ps = parameters (x)
212212 Base. printstyled (io, " Model $(nameof (x)) with $(length (x)) equations\n " ; bold = true )
213213 print (io, " States :" )
@@ -259,6 +259,10 @@ function implicit_variables(b::AbstractBasis)
259259 return getfield (b, :implicit )
260260end
261261
262+ function states (b:: AbstractBasis )
263+ return getfield (b, :unknowns )
264+ end
265+
262266# For internal use
263267is_implicit (b:: Basis{X, <:Any} ) where {X} = X
264268is_controlled (b:: Basis{<:Any, X} ) where {X} = X
@@ -380,7 +384,7 @@ Base.iterate(x::B, id) where {B <: AbstractBasis} = iterate(equations(x), id)
380384# # Internal update
381385function __update! (b:: AbstractBasis , eval_expression = false )
382386 ff = DataDrivenFunction ([bi. rhs for bi in collect (equations (b))],
383- implicit_variables (b), states (b), parameters (b), [get_iv (b)],
387+ implicit_variables (b), unknowns (b), parameters (b), [get_iv (b)],
384388 controls (b), eval_expression)
385389 @set! b. f = ff
386390 return
@@ -403,13 +407,14 @@ If control variables are defined, the function can also be called by `f(u,p,t,co
403407
404408If the Jacobian with respect to other variables is needed, it can be passed via a second argument.
405409"""
406- jacobian (x:: Basis , eval_expression:: Bool = false ) = jacobian (x, states (x), eval_expression)
410+ jacobian (x:: Basis , eval_expression:: Bool = false ) = jacobian (
411+ x, unknowns (x), eval_expression)
407412
408413function jacobian (x:: Basis , s, eval_expression:: Bool = false )
409414 j = Symbolics. jacobian ([xi. rhs for xi in equations (x)], s)
410415
411416 return DataDrivenFunction (j,
412- implicit_variables (x), states (x), parameters (x), [get_iv (x)],
417+ implicit_variables (x), unknowns (x), parameters (x), [get_iv (x)],
413418 controls (x), eval_expression)
414419end
415420
481486
482487function Base. merge! (x:: Basis , y:: Basis ; eval_expression = false )
483488 push! (x, equations (y))
484- @set! x. states = unique (vcat (states (x), states (y)))
489+ @set! x. unknowns = unique (vcat (unknowns (x), unknowns (y)))
485490 @set! x. ps = unique (vcat (parameters (x), parameters (y)))
486491 @set! x. ctrls = unique (vcat (controls (x), controls (y)))
487492 @set! x. observed = unique (vcat (get_observed (x), get_observed (y)))
0 commit comments