diff --git a/Project.toml b/Project.toml index 9cd1753..57dd372 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/ode_system.jl b/src/ode_system.jl index 93e8f63..a19c0ed 100644 --- a/src/ode_system.jl +++ b/src/ode_system.jl @@ -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 diff --git a/test/test_ODESystem.jl b/test/test_ODESystem.jl index a828205..90a12d9 100644 --- a/test/test_ODESystem.jl +++ b/test/test_ODESystem.jl @@ -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)