@@ -11,6 +11,19 @@ function set_param!(ref::ComponentReference, name::Symbol, value)
11
11
set_param! (parent (ref), compdef, name, unique_name, value)
12
12
end
13
13
14
+ """
15
+ update_param!(ref::ComponentReference, name::Symbol, value)
16
+
17
+ Update a component parameter as `update_param!(reference, name, value)`.
18
+ This uses the unique name :compname_paramname in the model's external parameter list,
19
+ and updates the parameter only in the referenced component to that value.
20
+ """
21
+ function update_param! (ref:: ComponentReference , name:: Symbol , value)
22
+ compdef = find_comp (ref)
23
+ unique_name = Symbol (" $(compdef. name) _$name " )
24
+ update_param! (parent (ref), unique_name, value)
25
+ end
26
+
14
27
"""
15
28
Base.setindex!(ref::ComponentReference, value, name::Symbol)
16
29
@@ -19,7 +32,13 @@ This creates a unique name :compname_paramname in the model's external parameter
19
32
and sets the parameter only in the referenced component to that value.
20
33
"""
21
34
function Base. setindex! (ref:: ComponentReference , value, name:: Symbol )
22
- set_param! (ref, name, value)
35
+ compdef = find_comp (ref)
36
+ unique_name = Symbol (" $(compdef. name) _$name " )
37
+ if has_parameter (parent (ref), unique_name)
38
+ update_param! (ref, name, value)
39
+ else
40
+ set_param! (ref, name, value)
41
+ end
23
42
end
24
43
25
44
"""
0 commit comments