Skip to content

Commit

Permalink
refactor: use version of Stdlib which disables old AnalysisPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Jan 3, 2025
1 parent 229dd3d commit 7f42ef0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Latexify = "0.11, 0.12, 0.13, 0.14, 0.15, 0.16"
Libdl = "1"
LinearAlgebra = "1"
MLStyle = "0.4.17"
ModelingToolkitStandardLibrary = "2.19"
NaNMath = "0.3, 1"
NonlinearSolve = "4.3"
OffsetArrays = "1"
Expand Down
15 changes: 2 additions & 13 deletions test/analysis_points.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using ModelingToolkit, ModelingToolkitStandardLibrary.Blocks
using OrdinaryDiffEq, LinearAlgebra
using Test
using ModelingToolkit: t_nounits as t, D_nounits as D, AnalysisPoint, get_sensitivity,
get_comp_sensitivity, get_looptransfer, open_loop, AbstractSystem
using ModelingToolkit: t_nounits as t, D_nounits as D, AnalysisPoint, AbstractSystem
using Symbolics: NAMESPACE_SEPARATOR

@testset "AnalysisPoint is lowered to `connect`" begin
Expand Down Expand Up @@ -164,17 +163,7 @@ end
(inputap, [nameof(outputap)]),
(nameof(inputap), [nameof(outputap)])
]
if input isa Symbol
# broken because MTKStdlib defines the method for
# `input::Union{Symbol, Vector{Symbol}}` which we can't directly call
@test_broken linearize(sys, input, output)
linfun, ssys = @invoke linearization_function(sys::AbstractSystem,
input::Union{Symbol, Vector{Symbol}, AnalysisPoint, Vector{AnalysisPoint}},
output::Any)
matrices = linearize(ssys, linfun)
else
matrices, _ = linearize(sys, input, output)
end
matrices, _ = linearize(sys, input, output)
# Result should be the same as feedpack(P, 1), i.e., the closed-loop transfer function from plant input to plant output
@test matrices.A[] == -2
@test matrices.B[] * matrices.C[] == 1 # both positive
Expand Down
3 changes: 3 additions & 0 deletions test/downstream/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"

[compat]
ModelingToolkitStandardLibrary = "2.19"
3 changes: 1 addition & 2 deletions test/downstream/analysis_points.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using ModelingToolkit, OrdinaryDiffEq, LinearAlgebra, ControlSystemsBase
using ModelingToolkitStandardLibrary.Mechanical.Rotational
using ModelingToolkitStandardLibrary.Blocks
using ModelingToolkit: connect, AnalysisPoint, t_nounits as t, D_nounits as D,
get_sensitivity, get_comp_sensitivity, get_looptransfer, open_loop
using ModelingToolkit: connect, t_nounits as t, D_nounits as D
import ControlSystemsBase as CS

@testset "Complicated model" begin
Expand Down

0 comments on commit 7f42ef0

Please sign in to comment.