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
The sign convention for both outputs of an edge must be identical, so typically, a positive flow represents a flow
137
-
*into* the connected vertex. This is important, because the vertex only receives the flows, it does not know whether
138
-
the flow was produced by the source or the destination end of an edge.
139
-
```
140
-
y_src y_dst
141
-
V_src o───←─────────→───o V_dst
136
+
The *inputs* of an edge connecting two nodes are the *outputs* of the nodes at both their ends. The output of each node
137
+
is split into two parts:
138
+
1. the *`dst`* output which is used as the input of the vertex at the destination end
139
+
2. the `src` output which is used as the input of the vertex at the `src` end.
140
+
141
+
Because a Vertex only receives flows from the edges connected to it, it does not know whether the flow it
142
+
received was produced by the source or the destination end of an edge. To solve this problem a sign convention has been
143
+
introduced. A positive flow represents a flow *into* the connected vertex, while a negative flow represents a flow *out*
144
+
of the connected vertex.
142
145
146
+
When we consider $n_1$ as the source and $n_2$ as the destination, flows out of $n_1$ and into $n_2$ are negative,
147
+
so $y_dst < 0$. Whereas flows out of $n_2$ and into $n_1$ are positive, so $y_src > 0$.
143
148
```
149
+
y_dst < 0
150
+
n_1 (src) o───────→────────o n_2 (dst)
151
+
y_src > 0
152
+
n_1 (src) o───────←────────o n_2 (dst)
153
+
```
154
+
But when we consider $n_2$ as the source and $n_1$ as the destination, flows out of $n_2$ and into $n_1$ are negative,
155
+
so $y_dst < 0$. Whereas flows out of $n_1$ and into $n_2$ are positive, so $y_src > 0$.
156
+
```
157
+
y_src > 0
158
+
$n_1$ (dst) o───────→────────o $n_2$ (src)
159
+
y_dst < 0
160
+
$n_1$ (dst) o───────→────────o $n_2$ (src)
161
+
```
162
+
163
+
For undirected graphs, `Graphs.jl` chooses the direction of an edge (so which node is the `src` and which the `dst`)
164
+
$v_1->v_2$ such that $v_1 < v_2$, so the edge between vertices 16 and 12 will always be an edge with source
165
+
`src=12` and destination `dst=16`.
166
+
144
167
145
168
146
169
### Single Sided Edge Outputs
147
-
Often, edge outputs will possess some symmetry. This makes it more convenient to define
148
-
"single sided" edge output functions:
170
+
To simplify the calculations, we split the output flows of edges into "single sided" edge output functions. That way we
171
+
can split the output flows of edges into "single sided" edge output functions which simplifies the calculations:
149
172
```julia
150
173
functiong_single(y, xᵥ, v_src, v_dst, pₑ, t)
151
174
# mutate y
152
175
nothing
153
176
end
154
177
```
155
-
There are multiple wrappers available to automatically convert them into double-sided edge
156
-
output functions:
157
178
179
+
There are multiple wrappers available to automatically convert them into double-sided edge output functions:
158
180
-`Directed(g_single)` builds a double-sided function *which only couples* to the destination side.
159
181
-`Symmetric(g_single)` builds a double-sided function in which both ends receive `y`.
160
182
-`AntiSymmetric(g_single)` builds a double-sided function where the destination receives `y` and the source receives `-y`.
161
183
-`Fiducial(g_single_src, g_singl_dst)` builds a double-sided edge output function based on two single sided functions.
162
184
185
+
163
186
## Feed Forward Behavior
164
-
Component models can show have so-called feed forward behavior. Feed forward means, that there is a direct link from input to output.
187
+
!!! warning "Feed Forward Vertices"
188
+
As of 11/2024, vertices with feed forward behaviour (FF) are not supported at all. Use [`ff_to_constraint`](@ref) to
189
+
transform them into vertex models without FF.
165
190
166
-
The most generic version of the component models can contain direct feed forwards from the input to the output.
167
-
This means, the output function depends $g$ directly depends on the component inputs $i$ and not only on the component state $x$.
191
+
Component models can have a so-called Feed Forward behaviour, which provides a direct link between the input and the
192
+
output.
168
193
169
-
Whenever possible, you should define output functions without feed forwards, i.e.
194
+
The most generic version of the component models can contain direct FFs from the input to the output. This means that
195
+
the output function $g$ depends directly on the component inputs $i$ rather than just on the component state $x$.
196
+
197
+
Whenever possible, you should define output functions without FFs in the following way:
170
198
```julia
171
199
gᵥ_noff(yᵥ, xᵥ, pᵥ, t)
172
200
gₑ_noff([y_src,] y_dst, xᵥ, pₑ, t)
@@ -177,20 +205,17 @@ gᵥ(yᵥ, xᵥ, e_aggr, pᵥ, t)
177
205
gₑ([y_src], y_dst, xᵥ, v_src, v_dst, pₑ, t)
178
206
```
179
207
180
-
NetworkDynamics cannot couple two components with feed forward to each other.
181
-
But, it is always possible to transform feed forward behavior to an internal state `x` with mass matrix entry zero to
182
-
circumvent this problem. This transformation can be performed automatically by using [`ff_to_constraint`](@ref).
183
-
208
+
NetworkDynamics cannot couple two components with FFs to each other. But, it is always possible to transform
209
+
feed forward behaviour to an internal state `x` with mass matrix entry zero to circumvent this problem. This
210
+
transformation can be performed automatically using [`ff_to_constraint`](@ref).
184
211
185
-
!!! warning "Feed Forward Vertices"
186
-
As of 11/2024, vertices with feed forward are not supported at all. Use [`ff_to_constraint`](@ref) to transform them
187
-
into vertex model without FF.
188
-
189
-
Concretely, NetworkDynamics distinguishes between 4 types of feed forward behaviors of `g` functions based on the
212
+
Concretely, NetworkDynamics distinguishes between 4 types of feed forward behaviours of `g` functions based on the
190
213
[`FeedForwardType`](@ref) trait.
191
-
The feed forward type is inferred automatically based on the provided function `g`, more concretely it is determined by the signature of that method / the number of arguments it takes.
214
+
The feed forward type is inferred automatically based on the provided function `g` (by calculating the signature of the
215
+
methods used over the number of arguments it is given.)
216
+
217
+
The code bloke below presents the different `g` signatures for the different feed forward types:
192
218
193
-
The code blow shows the different `g` signatures for the different feed forward types
If the automatic inference of feed forward type fails, the user may specify it explicitly using the `ff` keyword argument of the Edge/VertexModel constructor.
248
+
If the automatic inference of feed forward type fails, the user may specify it explicitly using the `ff` keyword
0 commit comments