We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
structural_simplify
hasproperty
Describe the bug 🐞 I'm really sorry for spamming your issue tracker, but I'll provide MWEs at least...
A simplified system has weird behaviour for hasproperty and getproperty: namely it might lie about properties being present or not present!
getproperty
Expected behavior
hasproperty true => getproperty does not error hasproperty false => getproperty errors
Minimal Reproducible Example 👇
using ModelingToolkit using ModelingToolkit: t_nounits as t, D_nounits as Dt @mtkmodel Inner begin @parameters begin p end end @mtkmodel Outer begin @components begin inner = Inner() end @variables begin x(t) end @equations begin x ~ inner.p end end @named outer = Outer() simp = structural_simplify(outer) hasproperty(outer, :inner) # true outer.inner # works hasproperty(outer, :inner₊p) # false outer.inner₊p # errors as expected hasproperty(simp, :inner) # false simp.inner # still works hasproperty(simp, :inner₊p) # true inner.inner₊p # errors despite hasproperty true
Error & Stacktrace ⚠️
julia> outer.inner₊p # errors despite hasproperty ERROR: ArgumentError: System outer: variable inner₊p does not exist Stacktrace: [1] getvar(sys::ODESystem, name::Symbol; namespace::Bool) @ ModelingToolkit ~/.julia/packages/ModelingToolkit/yfT8s/src/systems/abstractsystem.jl:1066 [2] getproperty(sys::ODESystem, name::Symbol; namespace::Bool) @ ModelingToolkit ~/.julia/packages/ModelingToolkit/yfT8s/src/systems/abstractsystem.jl:1009 [3] getproperty(sys::ODESystem, name::Symbol) @ ModelingToolkit ~/.julia/packages/ModelingToolkit/yfT8s/src/systems/abstractsystem.jl:1005 [4] top-level scope @ none:1
Environment (please complete the following information):
using Pkg; Pkg.status()
Status `/tmp/jl_QTt44V/Project.toml` [961ee093] ModelingToolkit v9.36.0
versioninfo()
julia> versioninfo() Julia Version 1.11.0-rc3 Commit 616e45539db (2024-08-26 15:46 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 16 × AMD Ryzen 9 8945HS w/ Radeon 780M Graphics WORD_SIZE: 64 LLVM: libLLVM-16.0.6 (ORCJIT, znver3) Threads: 16 default, 0 interactive, 8 GC (on 16 virtual cores) Environment: JULIA_NUM_THREADS = auto
The text was updated successfully, but these errors were encountered:
Hmm seems like a bug with the naming / hierarchical handling.
Sorry, something went wrong.
AayushSabharwal
Successfully merging a pull request may close this issue.
Describe the bug 🐞
I'm really sorry for spamming your issue tracker, but I'll provide MWEs at least...
A simplified system has weird behaviour for
hasproperty
andgetproperty
: namely it might lie about properties being present or not present!Expected behavior
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
versioninfo()
The text was updated successfully, but these errors were encountered: