Skip to content

Commit 4aff0de

Browse files
Merge pull request #289 from BambOoxX/main
Fix `states` -> `unknowns`
2 parents fb8a224 + ccf23a2 commit 4aff0de

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Blocks/analysis_points.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function ap_var(sys)
2323
# collect to turn symbolic arrays into arrays of symbols
2424
return length(sys.u) == 1 ? sys.u : collect(sys.u)
2525
end
26-
x = states(sys)
26+
x = unknowns(sys)
2727
length(x) == 1 && return x[1]
2828
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.")
2929
end

test/Mechanical/multibody.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ eqs = [connect(link1.TX1, cart.flange) #, force.flange)
2222
@named model = ODESystem(eqs, t, [], []; systems = [link1, link2, cart, fixed])
2323

2424
sys = structural_simplify(model)
25-
@test length(states(sys)) == 6
25+
@test length(unknowns(sys)) == 6
2626

2727
# The below code does work...
2828
#=
29-
unset_vars = setdiff(states(sys), keys(ModelingToolkit.defaults(sys)))
29+
unset_vars = setdiff(unknowns(sys), keys(ModelingToolkit.defaults(sys)))
3030
prob = ODEProblem(sys, unset_vars .=> 0.0, (0.0, 20), []; jac = true)
3131
sol = solve(prob, Rodas5P())
3232
@@ -44,7 +44,7 @@ f
4444
4545
function plot_link(sol, sys, tmax)
4646
tm = Observable(0.0)
47-
idx = Dict(reverse.(enumerate(states(sys))))
47+
idx = Dict(reverse.(enumerate(unknowns(sys))))
4848
4949
fig = Figure()
5050
a = Axis(fig[1,1], aspect=DataAspect(), )

0 commit comments

Comments
 (0)