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
If `descriptor = true`, the function `DescriptorSystems.dss2ss` is used. In this case,
157
157
- `balance`: indicates whether to balance the system using `DescriptorSystems.gprescale` before conversion to `StateSpace`. Balancing changes the state realization (through scaling).
158
158
- `simple_infeigs`: if set to false, further simplification may be performed in some cases.
159
159
160
-
If `descriptor = false`, the argument `big = true` performs computations in `BigFloat` precision, useful for poorly scaled systems.
160
+
The argument `big = true` performs computations in `BigFloat` precision, useful for poorly scaled systems. This may require the user to install and load `GenericLinearAlgebra` (if you get error `no method matching svd!(::Matrix{BigFloat})`).
161
161
"""
162
162
functioncausal_simplification(sys, u2duinds::Vector{Pair{Int, Int}}; balance=false, descriptor=true, simple_infeigs =true, big =false)
163
-
fm(x) =convert(Matrix{Float64}, x)
163
+
T = big ? BigFloat : Float64
164
+
b1 = big ? Base.big(1.0) :1.0
165
+
fm(x) =convert(Matrix{T}, x)
164
166
nx =size(sys.A, 1)
165
167
ny =size(sys.C, 1)
166
168
ndu =length(u2duinds)
167
169
nu =size(sys.B, 2) - ndu
168
170
u_with_du_inds =first.(u2duinds)
169
171
duinds =last.(u2duinds)
170
-
B = sys.B[:, 1:nu]
171
-
B̄ = sys.B[:, duinds]
172
-
D = sys.D[:, 1:nu]
173
-
D̄ = sys.D[:, duinds]
172
+
B =b1*sys.B[:, 1:nu]
173
+
B̄ =b1*sys.B[:, duinds]
174
+
D =b1*sys.D[:, 1:nu]
175
+
D̄ =b1*sys.D[:, duinds]
174
176
iszero(fm(D̄)) ||error("Nonzero feedthrough matrix from input derivative not supported")
175
177
if descriptor
176
178
Iu = u_with_du_inds .== (1:nu)'
@@ -191,22 +193,11 @@ function causal_simplification(sys, u2duinds::Vector{Pair{Int, Int}}; balance=fa
Copy file name to clipboardExpand all lines: test/test_ODESystem.jl
+20-6Lines changed: 20 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -335,18 +335,25 @@ op2[cart.f] = 0
335
335
@test G.ny ==length(lin_outputs)
336
336
337
337
## Test difficult `named_ss` simplification
338
-
using ControlSystemsMTK, ControlSystemsBase, RobustAndOptimalControl
338
+
using ControlSystemsMTK, ControlSystemsBase, RobustAndOptimalControl, Test, GenericLinearAlgebra
339
339
lsys = (A = [0.02.778983834717109e81.4122312296634873e60.0; 0.00.00.00.037848975765016724; 0.024.8375411480749620.126220062308977120.0; -0.0-4.620724819774693-0.023481719514324866-0.6841991610512456], B = [-5.042589978197361e80.0; -0.00.0; -45.068824982602656-0.0; 8.38451104936908554.98555939873381], C = [0.00.00.9549296585513720.0], D = [0.00.0])
340
340
341
341
# lsys = (A = [-0.0075449237853825925 1.6716817118020731e-6 0.0; 1864.7356343162514 -0.4131578457122937 0.0; 0.011864343330426718 -2.6287085638214332e-6 0.0], B = [0.0 0.0; 0.0 52566.418015009294; 0.0 0.3284546792274811], C = [1.4683007399899215e8 0.0 0.0], D = [-9.157636303058283e7 0.0])
342
342
343
343
G = ControlSystemsMTK.causal_simplification(lsys, [1=>2])
0 commit comments