Skip to content
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ControlSystemsMTK"
uuid = "687d7614-c7e5-45fc-bfc3-9ee385575c88"
authors = ["Fredrik Bagge Carlson"]
version = "2.8.0"
version = "2.8.1"

[deps]
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
Expand Down
5 changes: 4 additions & 1 deletion src/ode_system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ function RobustAndOptimalControl.named_ss(
)
ssys = sys
matrices, xpt = ModelingToolkit.linearize(sys, linfun; kwargs...)
inputs = linfun.inputs
# ModelingToolkit 11.36 removed the `inputs` field from LinearizationFunction;
# the input variables are recovered from the simplified system instead, which
# is what the operating-point extraction below already relies on.
inputs = ModelingToolkit.inputs(ssys)
nu = length(inputs)
unames = symstr.(inputs)
if nu > 0 && size(matrices.B, 2) == 2nu
Expand Down
6 changes: 6 additions & 0 deletions test/test_ODESystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ P02_named = named_ss(P, [input.u], [output.u]; op)
P02 = ss(P02_named)
@test P02 == P0 # verify that we get back what we started with

# named_ss from a precompiled LinearizationFunction (hot path)
lin_fun, sslin = ModelingToolkit.linearization_function(P, [input.u], [output.u]; op)
P02_linfun = named_ss(sslin, lin_fun, [output.u]; op)
@test P02_linfun.u == [Symbol("input₊u(t)")]
@test ss(P02_linfun) == P0

# same for controller
x = unknowns(C)
@nonamespace C02 = named_ss(C, [C.input], [C.output]; op)
Expand Down
Loading