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/initialization.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,27 @@
1
1
# Initialization
2
2
Initialization of the system describes the process of finding valid initial conditions, mostly a fixpoint of the system.
3
-
We distinguish between two types of initialization: full system initialziation and component initialization.
3
+
We distinguish between two types of initialization: full system initialization and component initialization.
4
4
5
5
## Full-System Initialization
6
-
Full system initialization describs the process of finding a fixpoint/steady state of th entire system.
6
+
Full system initialization describes the process of finding a fixpoint/steady state of the entire system.
7
7
8
-
To do so, you can use [`find_fixpoint`](@ref), which creates a `SteadyStateProblem` of the whole network and tries do solve it.
8
+
To do so, you can use [`find_fixpoint`](@ref), which creates a `SteadyStateProblem` of the whole network and tries to solve it.
9
9
10
10
## Component-wise Initialization
11
11
In contrast to full-system initialization the goal of component-wise initialization is to find a valid initial condition for a single component first, given a network coupling.
12
12
13
-
This can be usefull in cases, where there are nontrivial internal dynamics and states within a single vertex or edge.
14
-
The idea of component-wise initialisation is to find internal states which match a given "network coupling" (fixed inputs and outputs).
13
+
This can be useful in cases, where there are nontrivial internal dynamics and states within a single vertex or edge.
14
+
The idea of component-wise initialization is to find internal states which match a given "network coupling" (fixed inputs and outputs).
15
15
16
-
Lets consider the following example of a Swing-equation generator model.
16
+
The following initialization workflow (as used in the [Tutorial on Initialization](@ref init-tutorial)) is quite common for complex dynamics:
17
+
18
+
1. Define simple, quasistatic models with the same input-output structure as the dynamic models.
19
+
2. Find a solution of the static model using [`find_fixpoint`](@ref).
20
+
3. Define elaborate, dynamical models. Define dynamical network on same graph topology.
21
+
4. Use [`set_interface_defaults!`](@ref) to "copy" the inputs and outputs of all components from the static solution to the dynamical network.
22
+
5. Use [`initialize_component!`](@ref) to fix "free" states and parameters within the dynamical models to find a steady state while satisfying the constraints on inputs/output.
23
+
24
+
Let's consider the following example of a Swing-equation generator model.
17
25
```@example compinit
18
26
using NetworkDynamics, ModelingToolkit
19
27
using ModelingToolkit: t_nounits as t, D_nounits as Dt
@@ -47,7 +55,7 @@ sys = Swing(name=:swing)
47
55
vf = VertexModel(sys, [:i_r, :i_i], [:u_r, :u_i])
48
56
```
49
57
You can see in the provided [metadata](@ref), that we've set `default` values for the node outputs `u_r`, `u_i`, the node inputs `i_r`, `i_i` and most parameters.
50
-
For some states and parameters, we've onlye provided a `guess` rather than a default.
58
+
For some states and parameters, we've only provided a `guess` rather than a default.
51
59
Variables which only have `guess`es are considered "tunable" for the initialization algorithm.
52
60
53
61
In order to initialize the remaining variables we use [`initialize_component!`](@ref), which is a mutating function which tries to solve the nonlinear initialization problem and store the found values for the "free" variables as `init` metadata.
@@ -60,10 +68,10 @@ nothing #hide
60
68
vf #hide
61
69
```
62
70
63
-
Which lead to a successfull initialization of states `:θ` and `:ω` as well as parameter `:Pm`.
71
+
Which led to a successful initialization of states `:θ` and `:ω` as well as parameter `:Pm`.
64
72
To retrieve the residual you can use [`init_residual`](@ref).
65
73
66
-
As a quick test we can ensure that the angle indeed matches the voltag angel:
74
+
As a quick test we can ensure that the angle indeed matches the voltage angle:
0 commit comments