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

System metadata disapearing when calling complete on model with subsystems #3275

Closed
TorkelE opened this issue Dec 17, 2024 · 0 comments · Fixed by #3276
Closed

System metadata disapearing when calling complete on model with subsystems #3275

TorkelE opened this issue Dec 17, 2024 · 0 comments · Fixed by #3276
Assignees
Labels
bug Something isn't working

Comments

@TorkelE
Copy link
Member

TorkelE commented Dec 17, 2024

Simple example, in one case complete removes the metadata (however, only when the system have subsystems).

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

@parameters p d
@variables V(t)
eqs = [D(V) ~ p - d*V]

@named sys_internal = ODESystem(eqs, t; metadata = "Metadata! (internal)")
@named sys_hierarchical = ODESystem(eqs, t; metadata = "Metadata! (hierarchical)", systems = [sys_internal])
sys_complete = complete(sys_hierarchical)

ModelingToolkit.get_metadata(sys_internal) # "Metadata! (internal)"
ModelingToolkit.get_metadata(sys_hierarchical) # "Metadata! (hierarchical)"
ModelingToolkit.get_metadata(sys_hierarchical.sys_internal) # "Metadata! (internal)"
ModelingToolkit.get_metadata(sys_complete) # nothing

@named sys_nonhierarchical = ODESystem(eqs, t; metadata = "Metadata! (nonhierarchical)")
sys_nonhierarchical_complete = complete(sys_nonhierarchical)

ModelingToolkit.get_metadata(sys_nonhierarchical) # "Metadata! (nonhierarchical)"
ModelingToolkit.get_metadata(sys_nonhierarchical_complete) # "Metadata! (nonhierarchical)"
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.

2 participants