diff --git a/src/Blocks/analysis_points.jl b/src/Blocks/analysis_points.jl index 99cf216a8..c5ee4b3a3 100644 --- a/src/Blocks/analysis_points.jl +++ b/src/Blocks/analysis_points.jl @@ -23,7 +23,7 @@ function ap_var(sys) # collect to turn symbolic arrays into arrays of symbols return length(sys.u) == 1 ? sys.u : collect(sys.u) end - x = states(sys) + x = unknowns(sys) length(x) == 1 && return x[1] error("Could not determine the analysis-point variable in system $(nameof(sys)). To use an analysis point, apply it to a connection between two causal blocks containing connectors of type `RealInput/RealOutput` from ModelingToolkitStandardLibrary.Blocks.") end diff --git a/test/Mechanical/multibody.jl b/test/Mechanical/multibody.jl index fde5c0cb7..75d5ae777 100644 --- a/test/Mechanical/multibody.jl +++ b/test/Mechanical/multibody.jl @@ -22,11 +22,11 @@ eqs = [connect(link1.TX1, cart.flange) #, force.flange) @named model = ODESystem(eqs, t, [], []; systems = [link1, link2, cart, fixed]) sys = structural_simplify(model) -@test length(states(sys)) == 6 +@test length(unknowns(sys)) == 6 # The below code does work... #= -unset_vars = setdiff(states(sys), keys(ModelingToolkit.defaults(sys))) +unset_vars = setdiff(unknowns(sys), keys(ModelingToolkit.defaults(sys))) prob = ODEProblem(sys, unset_vars .=> 0.0, (0.0, 20), []; jac = true) sol = solve(prob, Rodas5P()) @@ -44,7 +44,7 @@ f function plot_link(sol, sys, tmax) tm = Observable(0.0) - idx = Dict(reverse.(enumerate(states(sys)))) + idx = Dict(reverse.(enumerate(unknowns(sys)))) fig = Figure() a = Axis(fig[1,1], aspect=DataAspect(), )