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 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