Skip to content

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

@TorkelE

Description

@TorkelE

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)"

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions