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
Return a function that linearizes the system `sys`. The function [`linearize`](@ref) provides a higher-level and easier to use interface.
1255
1256
@@ -1273,12 +1274,14 @@ The `simplified_sys` has undergone [`structural_simplify`](@ref) and had any occ
1273
1274
- `inputs`: A vector of variables that indicate the inputs of the linearized input-output model.
1274
1275
- `outputs`: A vector of variables that indicate the outputs of the linearized input-output model.
1275
1276
- `simplify`: Apply simplification in tearing.
1277
+
- `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.
1276
1278
- `kwargs`: Are passed on to `find_solvables!`
1277
1279
1278
1280
See also [`linearize`](@ref) which provides a higher-level interface.
@@ -1397,7 +1408,7 @@ function linearize_symbolic(sys::AbstractSystem, inputs,
1397
1408
if!allow_input_derivatives
1398
1409
der_inds =findall(vec(any(!iszero, Bs, dims =1)))
1399
1410
@showtypeof(der_inds)
1400
-
error("Input derivatives appeared in expressions (-g_z\\g_u != 0), the following inputs appeared differentiated: $(ModelingToolkit.inputs(sys)[der_inds]). Call `linear_statespace` with keyword argument `allow_input_derivatives = true` to allow this and have the returned `B` matrix be of double width ($(2nu)), where the last $nu inputs are the derivatives of the first $nu inputs.")
1411
+
error("Input derivatives appeared in expressions (-g_z\\g_u != 0), the following inputs appeared differentiated: $(ModelingToolkit.inputs(sys)[der_inds]). Call `linearize_symbolic` with keyword argument `allow_input_derivatives = true` to allow this and have the returned `B` matrix be of double width ($(2nu)), where the last $nu inputs are the derivatives of the first $nu inputs.")
(; A, B, C, D), simplified_sys = linearize(sys, inputs, outputs; t=0.0, op = Dict(), allow_input_derivatives = false, kwargs...)
1446
-
(; A, B, C, D) = linearize(simplified_sys, lin_fun; t=0.0, op = Dict(), allow_input_derivatives = false)
1456
+
(; A, B, C, D), simplified_sys = linearize(sys, inputs, outputs; t=0.0, op = Dict(), allow_input_derivatives = false, zero_dummy_der=false, kwargs...)
1457
+
(; A, B, C, D) = linearize(simplified_sys, lin_fun; t=0.0, op = Dict(), allow_input_derivatives = false, zero_dummy_der=false)
1447
1458
1448
1459
Return a NamedTuple with the matrices of a linear statespace representation
1449
1460
on the form
@@ -1463,6 +1474,8 @@ the default values of `sys` are used.
1463
1474
1464
1475
If `allow_input_derivatives = false`, an error will be thrown if input derivatives (``u̇``) appear as inputs in the linearized equations. If input derivatives are allowed, the returned `B` matrix will be of double width, corresponding to the input `[u; u̇]`.
1465
1476
1477
+
`zero_dummy_der` can be set to automatically set the operating point to zero for all dummy derivatives.
1478
+
1466
1479
See also [`linearization_function`](@ref) which provides a lower-level interface, [`linearize_symbolic`](@ref) and [`ModelingToolkit.reorder_states`](@ref).
1467
1480
1468
1481
See extended help for an example.
@@ -1576,7 +1589,7 @@ function linearize(sys, lin_fun; t = 0.0, op = Dict(), allow_input_derivatives =
1576
1589
if!iszero(Bs)
1577
1590
if!allow_input_derivatives
1578
1591
der_inds =findall(vec(any(!=(0), Bs, dims =1)))
1579
-
error("Input derivatives appeared in expressions (-g_z\\g_u != 0), the following inputs appeared differentiated: $(inputs(sys)[der_inds]). Call `linear_statespace` with keyword argument `allow_input_derivatives = true` to allow this and have the returned `B` matrix be of double width ($(2nu)), where the last $nu inputs are the derivatives of the first $nu inputs.")
1592
+
error("Input derivatives appeared in expressions (-g_z\\g_u != 0), the following inputs appeared differentiated: $(inputs(sys)[der_inds]). Call `linearize` with keyword argument `allow_input_derivatives = true` to allow this and have the returned `B` matrix be of double width ($(2nu)), where the last $nu inputs are the derivatives of the first $nu inputs.")
0 commit comments