Skip to content

replace_comp! functionality with default parameters #644

@corakingdon

Description

@corakingdon

example:

using Mimi

@defcomp A begin
    p1 = Parameter(default=3)
    p2 = Parameter()
end

@defcomp B begin
    p1 = Parameter(default=4)
    p2 = Parameter()
end

m = Model()
set_dimension!(m, :time, 10)
add_comp!(m, A)
set_param!(m, :A, :p1, 5)
set_param!(m, :A, :p2, 6)
replace_comp!(m, B, :A)
run(m)
m[:A, :p1]

The above code returns a value of 4 for p1, even though the parameter value had been set to 5 before the replacement, and other external values that are set such as for p2 are maintained. Is this the behavior we want? In my opinion, this is a bug, but I'm curious what others think.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions