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 *inputs* of an edge connecting two nodes are the *outputs* of the nodes at both their ends. The output of each node
140
-
is split into two parts:
141
-
1. the *`dst`* output which is used as the input of the vertex at the destination end
142
-
2. the `src` output which is used as the input of the vertex at the `src` end.
138
+
Each edge has two inputs: the node outputs of the source and destination end of the edge.
139
+
Similarily, they also have two outputs:
140
+
1. the `dst` output which is used as the input of the vertex at the destination end
141
+
2. the `src` output which is used as the input of the vertex at the source end.
143
142
144
-
Because a Vertex only receives flows from the edges connected to it, it does not know whether the flow it
145
-
received was produced by the source or the destination end of an edge. To solve this problem a sign convention has been
146
-
introduced. A positive flow represents a flow *into* the connected vertex, while a negative flow represents a flow *out*
147
-
of the connected vertex.
143
+
In general, the two edge outputs $y_{\mathrm{src}}$ and $y_{\mathrm{dst}}$ are **completely independent**. There is not implicit conservation law or something like that.
144
+
Examples for such unbalanced systems are power lines with losses, i.e. the power flowing into the line does not match the power flowing out of the line, because some energy is lost as heat. Another example would be a gas pipeline with some internal pressure: it es entirely possible to push in gas from both ends simultaneously, which would just result in increased pressure.
145
+
For the (important) special case where there is a strong correlation between source and destination output see the section on [Single Sided Edge Outputs](@ref) below.
148
146
149
-
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,
150
-
so $y_dst < 0$. Whereas flows out of $n_2$ and into $n_1$ are positive, so $y_src > 0$.
147
+
The vertex models connected to the edge do not know whether they are at the src or dst end of the edge.
148
+
Therefore, the sign convention for both outputs of an edge must be identical, typically, a positive flow represents a flow *into* the connected vertex.
151
149
```
152
-
y_dst < 0
153
-
n_1 (src) o───────→────────o n_2 (dst)
154
-
y_src > 0
155
-
n_1 (src) o───────←────────o n_2 (dst)
156
-
```
157
-
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,
158
-
so $y_dst < 0$. Whereas flows out of $n_1$ and into $n_2$ are positive, so $y_src > 0$.
150
+
y_src ┌───────────────────┐ y_dst
151
+
V_src o───←───┤ internal dynamics ├───→───o V_dst
152
+
└───────────────────┘
159
153
```
160
-
y_src > 0
161
-
$n_1$ (dst) o───────→────────o $n_2$ (src)
162
-
y_dst < 0
163
-
$n_1$ (dst) o───────→────────o $n_2$ (src)
164
-
```
165
-
166
-
For undirected graphs, `Graphs.jl` chooses the direction of an edge (so which node is the `src` and which the `dst`)
167
-
$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
168
-
`src=12` and destination `dst=16`.
169
154
155
+
### Single Sided Edge Outputs
156
+
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.
157
+
For example, in a system with a conservation law, the output at the source end is equal to the output at the destination end, i.e. $y_\mathrm{src} = -y_\mathrm{dst}$.
170
158
159
+
To accommodate such cases, we can use the concept of **single sided edge output functions**.
160
+
A single sided output function only defines a founction for one of the outputs:
171
161
172
-
### Single Sided Edge Outputs
173
-
To simplify the calculations, we split the output flows of edges into "single sided" edge output functions. That way we
174
-
can split the output flows of edges into "single sided" edge output functions which simplifies the calculations:
175
162
```julia
176
163
functiong_single(y, xᵥ, v_src, v_dst, pₑ, t)
177
164
# mutate y
@@ -180,10 +167,10 @@ end
180
167
```
181
168
182
169
There are multiple wrappers available to automatically convert them into double-sided edge output functions:
183
-
-`Directed(g_single)` builds a double-sided function *which only couples* to the destination side.
184
-
-`Symmetric(g_single)` builds a double-sided function in which both ends receive `y`.
185
-
-`AntiSymmetric(g_single)` builds a double-sided function where the destination receives `y` and the source receives `-y`.
186
-
-`Fiducial(g_single_src, g_singl_dst)` builds a double-sided edge output function based on two single sided functions.
170
+
-`Directed(g_single)` builds a double-sided function *which only couples* to the destination side (i.e. $y_{dst}=y$ and $y_{src} = 0$).
171
+
-`Symmetric(g_single)` builds a double-sided function in which both ends receive `y` (i.e. $y = y_{src} = y_{dst})$.
172
+
-`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}$).
173
+
-`Fiducial(g_single_src, g_single_dst)` builds a double-sided edge output function based on two single sided functions.
187
174
188
175
189
176
## Feed Forward Behavior
@@ -214,10 +201,12 @@ transformation can be performed automatically using [`ff_to_constraint`](@ref).
214
201
215
202
Concretely, NetworkDynamics distinguishes between 4 types of feed forward behaviours of `g` functions based on the
216
203
[`FeedForwardType`](@ref) trait.
217
-
The feed forward type is inferred automatically based on the provided function `g` (by calculating the signature of the
218
-
methods used over the number of arguments it is given.)
204
+
The feed forward type is inferred automatically based on the provided function `g` (this is done by inspecting the available
205
+
method signatures for `g`, i.e. network dynamics checks how many arguments you `g` function takes)
206
+
If the automatic inference of feed forward type fails, the user may specify it explicitly using the `ff` keyword
207
+
argument of the Edge/VertexModel constructor.
219
208
220
-
The code bloke below presents the different `g` signatures for the different feed forward types:
209
+
The code block below presents the different `g` signatures for the different feed forward types:
0 commit comments