Skip to content
New issue

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

DEF in parameters #3401

Closed
aml5600 opened this issue Feb 21, 2025 · 0 comments · Fixed by #3403
Closed

DEF in parameters #3401

aml5600 opened this issue Feb 21, 2025 · 0 comments · Fixed by #3403
Labels
bug Something isn't working

Comments

@aml5600
Copy link
Contributor

aml5600 commented Feb 21, 2025

Describe the bug 🐞

Looks like a DEF slips by when completing a system with split = true, but flatten = false.

Expected behavior

No DEF in parameters

Minimal Reproducible Example 👇

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D

@mtkmodel SubSystem begin
    @parameters begin
        c = 1
    end
    @variables begin
        x(t)
    end
    @equations begin
        D(x) ~ c * x
    end
end

@mtkmodel System begin
    @components begin
        subsys = SubSystem()
    end
    @parameters begin
        k = 1
    end
    @variables begin
        y(t)
    end
    @equations begin
        D(y) ~ k * y + subsys.x
    end
end

@named sys = System()

sys1 = complete(sys; split = false, flatten = true)
sys2 = complete(sys; split = true, flatten = true)
sys3 = complete(sys; split = false, flatten = false)
sys4 = complete(sys; split = true, flatten = false)

parameters(sys1) # Vector{Any}[k, subsys₊c]
parameters(sys2) # Vector{Any}[k, subsys₊c]
parameters(sys3) # Vector{Any}[k, subsys₊c]
parameters(sys4) # Vector{Any}[k, DEF, subsys₊c]

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
ulia> Pkg.status()
Project ModelingToolkit v9.64.0
Status `~/workspace/ModelingToolkit.jl/Project.toml`
  [1520ce14] AbstractTrees v0.4.5
  [4fba245c] ArrayInterface v7.18.0
  [8e7c35d0] BlockArrays v1.4.0
  [861a8166] Combinatorics v1.0.2
  [38540f10] CommonSolve v0.2.4
  [34da2185] Compat v4.16.0
  [187b0558] ConstructionBase v1.5.8
  [864edb3b] DataStructures v0.18.20
  [2b5f629d] DiffEqBase v6.164.1
  [459566f4] DiffEqCallbacks v4.3.0
  [77a26b50] DiffEqNoiseProcess v5.24.1
  [b552c78f] DiffRules v1.15.1
  [31c24e10] Distributions v0.25.117
  [ffbed154] DocStringExtensions v0.9.3
  [5b8099bc] DomainSets v0.7.15
  [06fc5a27] DynamicQuantities v1.4.0
  [4e289a0a] EnumX v1.0.4
  [e2ba6199] ExprTools v0.1.10
⌅ [6b7a57c9] Expronicon v0.8.5
  [64ca27bc] FindFirstFunctions v1.4.1
  [f6369f11] ForwardDiff v0.10.38
  [069b7b12] FunctionWrappers v1.1.3
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [86223c79] Graphs v1.12.0
  [98e50ef6] JuliaFormatter v1.0.62
  [ccbc3e58] JumpProcesses v9.14.2
  [23fbe1c1] Latexify v0.16.6
  [d8e11817] MLStyle v0.4.17
  [77ba4419] NaNMath v1.1.2
  [8913a72c] NonlinearSolve v4.4.0
  [6fe1bfb0] OffsetArrays v1.15.0
  [bac558e1] OrderedCollections v1.8.0
  [aea7be01] PrecompileTools v1.2.1
  [731186ca] RecursiveArrayTools v3.29.0
  [189a3867] Reexport v1.2.2
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
  [9dfe8606] SCCNonlinearSolve v1.0.0
  [0bca4576] SciMLBase v2.74.1
  [53ae85a6] SciMLStructures v1.6.1
  [efcf1570] Setfield v1.1.1
  [727e6d20] SimpleNonlinearSolve v2.1.0
  [276daf66] SpecialFunctions v2.5.0
  [90137ffa] StaticArrays v1.9.12
  [2efcf032] SymbolicIndexingInterface v0.3.37
  [d1185830] SymbolicUtils v3.15.0
  [0c5d862f] Symbolics v6.29.1
  [5c2747f8] URIs v1.5.1
  [3a884ed6] UnPack v1.0.2
  [1986cc42] Unitful v1.22.0
  [8ba89e20] Distributed
  [b77e0a4c] InteractiveUtils
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [9e88b42a] Serialization
  [2f01184e] SparseArrays v1.10.0
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.10.8
Commit 4c16ff44be8 (2025-01-22 10:06 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 6 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant