Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#229 - Parse black-box system with variable dimension #271

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,11 @@ function extract_dyn_equation_parameters(equation, state, input, noise, dim, AT)
# the dimension argument needs to be a iterable
isnothing(dim) &&
throw(ArgumentError("for a blackbox system, the dimension has to be defined"))
dim_vec = [dim...]
if dim isa Symbol
dim_vec = [dim]
else
dim_vec = [dim...]
end
push!(rhs_params, extract_blackbox_parameter(rhs, dim_vec)...)

# if rhs is a single term => affine system (e.g. A*x, Ax, 2x, x or 0)
Expand Down
4 changes: 4 additions & 0 deletions test/@system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ end
# allow for arbitrary input with definition for rhs of the form f_(x_, u_)
sys = @system(x' = f1(x, u123), x ∈ X, u123 ∈ U, dims = (2, 3))
@test sys == ConstrainedBlackBoxControlContinuousSystem(f1, 2, 3, X, U)
# parametric dimension
n = 3
sys = @system(x' = f1(x), dim:n)
@test sys == BlackBoxContinuousSystem(f1, 3)
end

# ==================
Expand Down
Loading