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
1. the `dst` output (which is used as the input of the vertex at the destination end)
145
144
2. the `src` output (which is used as the input of the vertex at the source end)
146
145
147
-
In general, the two edge outputs $y_{\mathrm{src}}$ and $y_{\mathrm{dst}}$ are **completely independent** because there
146
+
In general, the two edge outputs $y_{\mathrm{src}}$ and $y_{\mathrm{dst}}$ are **completely independent** because there
148
147
is no implicit conservation law dictating that their values should be identical.
149
-
An example for such an unbalanced systems is power lines in an energy grid with losses, where the power flowing into a line
150
-
does not match the power flowing out of it, because some of the energy transported is lost in the form of heat.
151
-
Another example would be a gas pipeline with some internal pressure: it is entirely possible to push in gas from both
152
-
ends simultaneously. It would simply result in increased pressure within the pipe. For the (important) special cases
148
+
An example for such an unbalanced systems is power lines in an energy grid with losses, where the power flowing into a line
149
+
does not match the power flowing out of it, because some of the energy transported is lost in the form of heat.
150
+
Another example would be a gas pipeline with some internal pressure: it is entirely possible to push in gas from both
151
+
ends simultaneously. It would simply result in increased pressure within the pipe. For the (important) special cases
153
152
where there is a strong correlation between source and destination output see the section on [Single Sided Edge Outputs](@ref) below.
154
153
155
154
The vertex models connected to the edge do not know whether they are at the 'src' or the 'dst' end of the edge.
156
-
Therefore, the sign convention for both outputs of an edge must be identical. Typically, a positive flow represents
155
+
Therefore, the sign convention for both outputs of an edge must be identical. Typically, a positive flow represents
157
156
a flow *into* the connected vertex, whereas a negative flow represents a flow *out of* the connected vertex.
158
157
```
159
-
y_src ┌───────────────────┐ y_dst
158
+
y_src ┌───────────────────┐ y_dst
160
159
V_src o───←───┤ internal dynamics ├───→───o V_dst
161
160
└───────────────────┘
162
161
```
163
162
164
163
### Single Sided Edge Outputs
165
-
Systems exist, where the edge output functions $g_\mathrm{src}$ and $g_\mathrm{dst}$ are not independent, but rather one
166
-
is a function of the other. For example, in a system with a flow conservation law, the flow magnitude at the
167
-
source end is equal to the flow magnitude at the destination end (what flows in, must come out). Since the sign
168
-
convention on both ends must be identical (e.g. positive flow is a flow towards the vertex) we get antisymmetric
169
-
behavior: $y_\mathrm{src} = -y_\mathrm{dst}$.
164
+
Often, the edge output functions $g_\mathrm{src}$ and $g_\mathrm{dst}$ are not independent, but rather one of them is a function of the other.
165
+
For example, in an edge model with flow conservation without internal storage, the flow magnitude at the source end is equal to the flow magnitude at the destination end (what flows in, must come out).
166
+
Since the sign convention on both ends must be identical (e.g. positive flow is a flow towards the vertex) we get anti symmetric behavior: $y_\mathrm{src} = -y_\mathrm{dst}$.
170
167
171
168
To accommodate such cases, we can use the concept of **single sided edge output functions**.
172
169
A single sided output function only defines a function for one of the outputs:
@@ -181,41 +178,41 @@ end
181
178
There are multiple wrappers available to automatically convert them into double-sided edge output functions:
182
179
-`Directed(g_single)` builds a double-sided function *which only couples* to the destination side (i.e. $y_{dst}=y$ and $y_{src} = 0$).
183
180
-`Symmetric(g_single)` builds a double-sided function in which both ends receive `y` (i.e. $y = y_{src} = y_{dst})$.
184
-
-`AntiSymmetric(g_single)` builds a double-sided function where the destination receives `y` and the source receives `-y` (i.e. $y=y_{dst}=-y{src}$).
181
+
-`AntiSymmetric(g_single)` builds a double-sided function where the destination receives `y` and the source receives `-y` (i.e. $y=y_{dst}=-y_{src}$).
185
182
-`Fiducial(g_single_src, g_single_dst)` builds a double-sided edge output function based on two single sided functions.
186
183
187
184
188
185
## Feed Forward Behavior
189
186
!!! warning "Feed Forward Vertices"
190
-
As of 11/2024, vertices with feed forward behaviour (FF) are not supported at all. Use [`ff_to_constraint`](@ref) to
187
+
As of 11/2024, vertices with feed forward behaviour (FF) are not supported at all. Use [`ff_to_constraint`](@ref) to
191
188
transform them into vertex models without FF.
192
189
193
-
Component models can have a so-called Feed Forward behaviour, which provides a direct link between the input and the
190
+
Component models can have a so-called Feed Forward behaviour, which provides a direct link between the input and the
194
191
output.
195
192
196
-
The most generic version of the component models can contain direct FFs from the input to the output. This means that
193
+
The most generic version of the component models can contain direct FFs from the input to the output. This means that
197
194
the output function $g$ depends directly on the component inputs $i$ rather than just on the component state $x$.
198
195
199
196
Whenever possible, you should define output functions without FFs in the following way:
200
197
```julia
201
198
gᵥ_noff(yᵥ, xᵥ, pᵥ, t)
202
-
gₑ_noff([y_src,] y_dst, xᵥ, pₑ, t)
199
+
gₑ_noff([y_src,] y_dst, xₑ, pₑ, t)
203
200
```
204
201
instead of the more general
205
202
```julia
206
203
gᵥ(yᵥ, xᵥ, e_aggr, pᵥ, t)
207
-
gₑ([y_src], y_dst, xᵥ, v_src, v_dst, pₑ, t)
204
+
gₑ([y_src,] y_dst, xₑ, v_src, v_dst, pₑ, t)
208
205
```
209
206
210
-
NetworkDynamics cannot couple two components with FFs to each other. But, it is always possible to transform
211
-
feed forward behaviour to an internal state `x` with mass matrix entry zero to circumvent this problem. This
207
+
NetworkDynamics cannot couple two components with FFs to each other. But, it is always possible to transform
208
+
feed forward behaviour to an internal state `x` with mass matrix entry zero to circumvent this problem. This
212
209
transformation can be performed automatically using [`ff_to_constraint`](@ref).
213
210
214
-
Concretely, NetworkDynamics distinguishes between 4 types of feed forward behaviours of `g` functions based on the
211
+
Concretely, NetworkDynamics distinguishes between 4 types of feed forward behaviours of `g` functions based on the
215
212
[`FeedForwardType`](@ref) trait.
216
213
The feed forward type is inferred automatically based on the provided function `g` (this is done by inspecting the available
217
-
method signatures for `g`, i.e. network dynamics checks how many arguments you`g` function takes)
218
-
If the automatic inference of feed forward type fails, the user may specify it explicitly using the `ff` keyword
214
+
method signatures for `g`, i.e. network dynamics checks how many arguments your`g` function takes)
215
+
If the automatic inference of feed forward type fails, the user may specify it explicitly using the `ff` keyword
219
216
argument of the Edge/VertexModel constructor.
220
217
221
218
The code block below presents the different `g` signatures for the different feed forward types:
0 commit comments