You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Partial systems can be extended in a higher system as `@extend PartialSystem(; kwargs)`.
152
-
- Keyword arguments pf partial system in the `@extend` definition are added as the keyword arguments of the base system.
153
-
- Note that in above example, `p1` is promoted as an argument of `ModelC`. Users can set the value of `p1`. However, as `p2` isn't listed in the model definition, its initial guess can't be specified while creating an instance of `ModelC`.
152
+
Partial systems can be extended in a higher system in two ways:
154
153
155
-
```julia
156
-
julia>@mtkbuild model_c2 =ModelC(; p1 =2.0)
154
+
-`@extend PartialSystem(var1 = value1)`
155
+
156
+
+ This is the recommended way of extending a base system.
157
+
+ The default values for the arguments of the base system can be declared in the `@extend` statement.
158
+
+ Note that all keyword arguments of the base system are added as the keyword arguments of the main system.
+ In this method: explicitly list the variables that should be unpacked, provide a name for the partial system and declare the base system.
163
+
+ Note that only the arguments listed out in the declaration of the base system (here: `var1`) are added as the keyword arguments of the higher system.
159
164
160
165
#### `@components` begin block
161
166
@@ -301,7 +306,7 @@ end
301
306
302
307
For more examples of usage, checkout [ModelingToolkitStandardLibrary.jl](https://github.com/SciML/ModelingToolkitStandardLibrary.jl/)
303
308
304
-
## More on `Model.structure`
309
+
## [More on `Model.structure`](@id model_structure)
305
310
306
311
`structure` stores metadata that describes composition of a model. It includes:
307
312
@@ -324,17 +329,57 @@ For example, the structure of `ModelC` is:
0 commit comments