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
error("g_z not invertible, this indicates that the DAE is of index > 1.")
278
+
gzgx =-(gz \ g_x)
279
+
A = [f_x f_z
280
+
gzgx*f_x gzgx*f_z]
281
+
B = [f_u
282
+
gzgx * f_u] # The cited paper has zeros in the bottom block, see derivation in https://github.com/SciML/ModelingToolkit.jl/pull/1691 for the correct formula
283
+
284
+
C = [h_x h_z]
285
+
Bs =-(gz \ g_u) # This equation differ from the cited paper, the paper is likely wrong since their equaiton leads to a dimension mismatch.
286
+
if!iszero(Bs)
287
+
if!allow_input_derivatives
288
+
der_inds =findall(vec(any(!=(0), Bs, dims =1)))
289
+
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.")
error("g_z not invertible, this indicates that the DAE is of index > 1.")
498
-
gzgx =-(gz \ g_x)
499
-
A = [f_x f_z
500
-
gzgx*f_x gzgx*f_z]
501
-
B = [f_u
502
-
gzgx * f_u] # The cited paper has zeros in the bottom block, see derivation in https://github.com/SciML/ModelingToolkit.jl/pull/1691 for the correct formula
503
-
504
-
C = [h_x h_z]
505
-
Bs =-(gz \ g_u) # This equation differ from the cited paper, the paper is likely wrong since their equaiton leads to a dimension mismatch.
506
-
if!iszero(Bs)
507
-
if!allow_input_derivatives
508
-
der_inds =findall(vec(any(!=(0), Bs, dims =1)))
509
-
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.")
510
-
end
511
-
B = [B [zeros(nx, nu); Bs]]
512
-
D = [D zeros(ny, nu)]
513
-
end
534
+
p =anydict(p)
535
+
for (k, v) in p
536
+
setu(prob, k)(prob, v)
514
537
end
515
-
516
-
(; A, B, C, D)
538
+
returnsolve(prob; allow_input_derivatives)
517
539
end
518
540
519
541
functionlinearize(sys, inputs, outputs; op =Dict(), t =0.0,
0 commit comments