Skip to content

Commit e6451d8

Browse files
fix: manually implement controls for AbstractBasis
1 parent c6359a2 commit e6451d8

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/DataDrivenDiffEq.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using SymbolicUtils: operation, arguments, iscall, issym
1919
using Symbolics
2020
using Symbolics: scalarize, variable, value
2121
@reexport using ModelingToolkit: unknowns, parameters, independent_variable, observed,
22-
controls, get_iv, get_observed
22+
get_iv, get_observed
2323

2424
using Random
2525
using QuadGK
@@ -98,7 +98,7 @@ include("./basis/utils.jl")
9898
include("./basis/type.jl")
9999
export Basis
100100
export jacobian, dynamics
101-
export implicit_variables, states
101+
export implicit_variables, states, controls
102102
export get_parameter_values, get_parameter_map
103103

104104
include("./utils/basis_generators.jl")

src/basis/type.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ function states(b::AbstractBasis)
263263
return getfield(b, :unknowns)
264264
end
265265

266+
function controls(b::AbstractBasis)
267+
ctrls = getfield(b, :ctrls)
268+
systems = getfield(b, :systems)
269+
isempty(systems) && return ctrls
270+
271+
ctrls = copy(ctrls)
272+
for sys in systems
273+
append!(ctrls, unknowns(sys, controls(sys)))
274+
end
275+
return ctrls
276+
end
277+
266278
# For internal use
267279
is_implicit(b::Basis{X, <:Any}) where {X} = X
268280
is_controlled(b::Basis{<:Any, X}) where {X} = X

0 commit comments

Comments
 (0)