Skip to content

Commit a189698

Browse files
committed
set_param! fcn text
1 parent d970e93 commit a189698

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/src/howto/howto_6.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ There are two available shortcuts:
108108
# Shortcut 1
109109
set_param!(m::Model, param_name::Symbol, val::Any)
110110
```
111-
This method create an external parameter in the model called `param_name`, sets its value to `val`, looks at all the components in the model `m`, finds all the unbound parameters named `param_name`, and creates connections from all the unbound parameters that are named `param_name` to the newly created external parameter. If there is already a parameter called `param_name` in the external parameter list, it errors.
111+
This method creates an external parameter in the model called `param_name`, sets its value to `val`, looks at all the components in the model `m`, finds all the unbound parameters named `param_name`, and creates connections from all the unbound parameters that are named `param_name` to the newly created external parameter. If there is already a parameter called `param_name` in the external parameter list, it errors.
112112

113113
```
114114
# Shortcut 2
@@ -117,8 +117,8 @@ set_param!(m::Model, comp_name::Symbol, param_name::Symbol, val::Any)
117117
This method creates a new external parameter called `param_name` in the model `m` (if that already exists, it errors), sets its value to `val`, and then connects the parameter `param_name` in component `comp_name` to this newly created external parameter.
118118

119119
*The User Change:*
120-
Any old code that uses the `set_param!` method with only 4 arguments (shortcut #2 shown above) will still work for setting parameters if they are found in only one component. But if you have multiple components that have parameters with the same name, using the old 4-argument version of `set_param!` multiple times will cause an error. Instead, you need to determine what behavior you want across multiple components with parameters of the same name:
121-
- If you want these parameters with the same name that are found in multiple components to have the _same_ value, use the 3-argument method: `set_param!(m, :param_name, val)`. You only have to call this once and it will set the same value for all components with an unconnected parameter called `param_name`.
120+
Any old code that uses the `set_param!` method with only 4 arguments (shortcut #2 shown above) will still work for setting parameters **if they are found in only one component** ... but if you have multiple components that have parameters with the same name, using the old 4-argument version of `set_param!` multiple times will cause an error. Instead, you need to determine what behavior you want across multiple components with parameters of the same name:
121+
- If you want parameters with the same name that are found in multiple components to have the _same_ value, use the 3-argument method: `set_param!(m, :param_name, val)`. You only have to call this once and it will set the same value for all components with an unconnected parameter called `param_name`.
122122
- If you want different components that have parameters with the same name to have _different_ values, then you need to call the 5-argument version of `set_param!` individually for each parameter value, such as:
123123
```
124124
set_param!(m, :comp1, :foo, :foo1, 25) # creates an external parameter called :foo1 with value 25, and connects just comp1/foo to that value

0 commit comments

Comments
 (0)