Skip to content

Commit ee90a35

Browse files
committed
Minor fixes.
1 parent e5915d7 commit ee90a35

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/connections.jl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function feedback(sys1::StateSpace,sys2::StateSpace)
264264
sys2.B*sys1.C sys2.A+sys2.B*sys1.D*(-sys2.C)]
265265
B = [sys1.B; sys2.B*sys1.D]
266266
C = [sys1.C sys1.D*(-sys2.C)]
267-
267+
268268
ss(A, B, C, sys1.D, sys1.Ts)
269269
end
270270

@@ -292,12 +292,10 @@ See Zhou etc. for similar (somewhat less symmetric) formulas.
292292
error("Sampling time mismatch")
293293
end
294294

295-
#= must define allunique(c::Colon) = true for the following checks to work
296-
if !allunique(Y1); @warn "Connecting single output to multiple inputs Y1=$Y1"; end
297-
if !allunique(Y2); @warn "Connecting single output to multiple inputs Y2=$Y2"; end
298-
if !allunique(U1); @warn "Connecting multiple outputs to a single input U1=$U1"; end
299-
if !allunique(U2); @warn "Connecting a single output to multiple inputs U2=$U2"; end
300-
=#
295+
if !(isa(Y1, Colon) || allunique(Y1)); @warn "Connecting single output to multiple inputs Y1=$Y1"; end
296+
if !(isa(Y2, Colon) || allunique(Y2)); @warn "Connecting single output to multiple inputs Y2=$Y2"; end
297+
if !(isa(U1, Colon) || allunique(U1)); @warn "Connecting multiple outputs to a single input U1=$U1"; end
298+
if !(isa(U2, Colon) || allunique(U2)); @warn "Connecting a single output to multiple inputs U2=$U2"; end
301299

302300
if (U1 isa Colon ? size(sys1, 2) : length(U1)) != (Y2 isa Colon ? size(sys2, 1) : length(Y2))
303301
error("Lengths of U1 ($U1) and Y2 ($Y2) must be equal")
@@ -341,13 +339,13 @@ See Zhou etc. for similar (somewhat less symmetric) formulas.
341339
R1 = try
342340
inv*I - s2_D22*s1_D22) # slightly faster than α*inv(I - α*s2_D22*s1_D22)
343341
catch
344-
error("Illposed feedback interconnection, I - α*s2_D22*s1_D22 or I - α*s2_D22*s1_D22 not invertible")
342+
error("Ill-posed feedback interconnection, I - α*s2_D22*s1_D22 or I - α*s2_D22*s1_D22 not invertible")
345343
end
346344

347345
R2 = try
348346
inv(I - α*s1_D22*s2_D22)
349347
catch
350-
error("Illposed feedback interconnection, I - α*s2_D22*s1_D22 or I - α*s2_D22*s1_D22 not invertible")
348+
error("Ill-posed feedback interconnection, I - α*s2_D22*s1_D22 or I - α*s2_D22*s1_D22 not invertible")
351349
end
352350

353351
A = [sys1.A + s1_B2*R1*s2_D22*s1_C2 s1_B2*R1*s2_C2;

src/utilities.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ else
2525
roots(args...; kwargs...) = Polynomials.roots(args...; kwargs...)
2626
end
2727

28+
@static if VERSION < v"1.1"
29+
isnothing(::Any) = false
30+
isnothing(::Nothing) = true
31+
end
32+
2833
""" f = printpolyfun(var)
2934
`fun` Prints polynomial in descending order, with variable `var`
3035
"""

0 commit comments

Comments
 (0)