Skip to content

Accessing and plotting states (and observables) without namespacing pitfalls #1488

@rschiemann1

Description

@rschiemann1

See here.

With an MTK variable Tgas[1:n] defined for sys = ODESystem(...), intended variable access (e.g. for plotting) seems to be:
plot(sol, vars=(sys.Tgas[1]))

This however gives the following error:

# ArgumentError: sys₊Tgas[1](t) is either an observed nor a state variable.
# (should it read "_n_either... nor"?)

Namespacing of the variable:

sys.Tgas[1]
# sys₊Tgas[1](t)

Additional info:

Pkg.status()
#  [165a45c3] DASKR v2.8.0
#  [e993076c] DASSL v2.6.0
#  [0c46a032] DifferentialEquations v7.1.0
#  [28b8d3ca] GR v0.64.0
#  [33e6dc65] MKL v0.5.0
#  [961ee093] ModelingToolkit v8.5.1
#  [1dea7af3] OrdinaryDiffEq v6.7.0
#  [91a5bcdd] Plots v1.26.0
#  [d236fae5] PreallocationTools v0.2.4
#  [c3572dad] Sundials v4.9.2
#  [0c5d862f] Symbolics v4.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions