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
Copy file name to clipboardExpand all lines: docs/src/metadata.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Special cases for symbol metadata are:
33
33
34
34
For those, there are special functions `has_*`, `get_*`, `set_*!`, `delete_*!` and `strip_*!`. The `strip_*!` functions remove all metadata of a specific type from all symbols in a component. See [Per Symbol Metadata API](@ref).
35
35
36
-
These are closely aligned with the [metadata use in ModelingToolkit](@extref ModelingToolkit symbolic_metadata). They are automatically copied from the `ODESystem` if you use MTK models to create NetworkDynamics models.
36
+
These are closely aligned with the [metadata use in ModelingToolkit](@extref ModelingToolkit symbolic_metadata). They are automatically copied from the `System` if you use MTK models to create NetworkDynamics models.
37
37
38
38
## Metadata Utils
39
39
Accessing metadata (especially defaults) of states and parameters is a very
@@ -149,7 +149,7 @@ We can see, that NetworkDynamics internally is able to reduce all of the "output
149
149
150
150
Now we can simulate the system. For that we generate the `u0` object. Since the metadata (such as default values) was automatically transferred, we can straight away construct the `ODEProblem`
151
151
and solve the system.
152
-
152
+
153
153
```@example mtk
154
154
u0 = NWState(nw) # generate state based on default values
When working with MTK systems in NetworkDynamics, you may encounter situations where
169
+
your desired output variables don't explicitly appear in the equations. This creates **fully
170
+
implicit outputs** - variables that are determined by the system's constraints but aren't
171
+
directly computed.
172
+
173
+
!!! tip "tl;dr"
174
+
Introduce "fake" dependencies to your input-forcing equations `0 ~ in + implicit_output(y)`.
175
+
Which is mathematically equivalent to `0 ~ in` but helps MTK to reason about dependencies.
176
+
177
+
Consider a system with a fully implicit output:
178
+
```
179
+
u┌───────┐y
180
+
─→┤ 0 ~ u ├→─
181
+
└───────┘
182
+
```
183
+
Here, $y$ does not appear in the equations at all. In general, that doesn't make too much sense.
184
+
During simplification, MTK will potentially get rid of the equation as it does not contribute to the system's state.
185
+
186
+
However, in NetworkDynamics, we're always dealing with **open loop models** on the equation level, which is not exactly what MTK was made for.
187
+
If you build a closed loop between a subsystem A which **has input forcing** and a subsystem
188
+
B which has **input feed forward**, the resulting system can be solved:
189
+
```
190
+
(system with input forcing)
191
+
ua┌─────────┐ya
192
+
┌──→┤ 0 ~ ua ├→──┐
193
+
│ └─────────┘ │
194
+
│ yb┌─────────┐ub │
195
+
└──←┤ yb ~ ub ├←──┘
196
+
└─────────┘
197
+
(system with input feed forward)
198
+
```
199
+
200
+
Since MTK does not know about the closed loop (which is only introduced on the NetworkDynamics level once we leave the equation based domain) we need to help MTK to figure out those dependencies.
201
+
We can do so by introducing "fake" dependencies using [`implicit_output`](@ref).
0 commit comments