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/basics/Linearization.md
+7-10Lines changed: 7 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ y &= Cx + Du
15
15
\end{aligned}
16
16
```
17
17
18
-
The `linearize` function expects the user to specify the inputs ``u`` and the outputs ``y`` using the syntax shown in the example below. The system model is *not* supposed to be simplified before calling `linearize`:
18
+
The `linearize` function expects the user to specify the inputs ``u`` and the outputs ``y`` using the syntax shown in the example below.
@named sys = ODESystem(eqs, t) # Do not call @mtkbuild when linearizing
32
+
@mtkbuild sys = ODESystem(eqs, t) # Do not call @mtkbuild when linearizing
33
33
matrices, simplified_sys = linearize(sys, [r], [y]) # Linearize from r to y
34
34
matrices
35
35
```
@@ -45,10 +45,6 @@ using ModelingToolkit: inputs, outputs
45
45
46
46
The model above has 4 variables but only three equations, there is no equation specifying the value of `r` since `r` is an input. This means that only unbalanced models can be linearized, or in other words, models that are balanced and can be simulated _cannot_ be linearized. To learn more about this, see [How to linearize a ModelingToolkit model (YouTube)](https://www.youtube.com/watch?v=-XOux-2XDGI&t=395s). Also see [ModelingToolkitStandardLibrary: Linear analysis](https://docs.sciml.ai/ModelingToolkit/stable/tutorials/linear_analysis/) for utilities that make linearization of completed models easier.
47
47
48
-
!!! note "Un-simplified system"
49
-
50
-
Linearization expects `sys` to be un-simplified, i.e., `structural_simplify` or `@mtkbuild` should not be called on the system before linearizing.
51
-
52
48
## Operating point
53
49
54
50
The operating point to linearize around can be specified with the keyword argument `op` like this: `op = Dict(x => 1, r => 2)`. The operating point may include specification of unknown variables, input variables and parameters. For variables that are not specified in `op`, the default value specified in the model will be used if available, if no value is specified, an error is thrown.
Return a function that linearizes the system `sys`. The function [`linearize`](@ref) provides a higher-level and easier to use interface.
5
5
@@ -22,7 +22,6 @@ The `simplified_sys` has undergone [`structural_simplify`](@ref) and had any occ
22
22
- `sys`: An [`ODESystem`](@ref). This function will automatically apply simplification passes on `sys` and return the resulting `simplified_sys`.
23
23
- `inputs`: A vector of variables that indicate the inputs of the linearized input-output model.
24
24
- `outputs`: A vector of variables that indicate the outputs of the linearized input-output model.
25
-
- `simplify`: Apply simplification in tearing.
26
25
- `initialize`: If true, a check is performed to ensure that the operating point is consistent (satisfies algebraic equations). If the op is not consistent, initialization is performed.
27
26
- `initialization_solver_alg`: A NonlinearSolve algorithm to use for solving for a feasible set of state and algebraic variables that satisfies the specified operating point.
28
27
- `autodiff`: An `ADType` supported by DifferentiationInterface.jl to use for calculating the necessary jacobians. Defaults to using `AutoForwardDiff()`
@@ -31,7 +30,7 @@ The `simplified_sys` has undergone [`structural_simplify`](@ref) and had any occ
31
30
See also [`linearize`](@ref) which provides a higher-level interface.
Similar to [`linearize`](@ref), but returns symbolic matrices `A,B,C,D` rather than numeric. While `linearize` uses ForwardDiff to perform the linearization, this function uses `Symbolics.jacobian`.
467
470
@@ -479,12 +482,10 @@ y &= h(x, z, u)
479
482
where `x` are differential unknown variables, `z` algebraic variables, `u` inputs and `y` outputs.
0 commit comments