Skip to content

Commit

Permalink
Merge pull request #289 from BambOoxX/main
Browse files Browse the repository at this point in the history
Fix `states` -> `unknowns`
  • Loading branch information
ChrisRackauckas authored Apr 21, 2024
2 parents fb8a224 + ccf23a2 commit 4aff0de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Blocks/analysis_points.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/Mechanical/multibody.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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(), )
Expand Down

0 comments on commit 4aff0de

Please sign in to comment.