Skip to content

Commit fcddc1d

Browse files
authored
Merge branch 'master' into scalar_u
2 parents d3b517a + 17c5867 commit fcddc1d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/analysis.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ Given a transfer function describing the Plant `P` and a transferfunction descri
464464
`T = PC/(1+PC)` Complementary sensitivity function
465465
466466
Only supports SISO systems"""
467-
function gangoffour(P::TransferFunction,C::TransferFunction)
467+
function gangoffour(P::LTISystem,C::LTISystem)
468468
if P.nu + P.ny + C.nu + C.ny > 4
469469
error("gangoffour only supports SISO systems")
470470
end

src/freqresp.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,19 @@ function _preprocess_for_freqresp(sys::StateSpace)
3939
end
4040

4141

42+
function _evalfr_return_type(sys::StateSpace{<:TimeEvolution,T0}, s::Number) where {T0}
43+
temp_product = one(T0)*one(typeof(s))
44+
typeof(temp_product/temp_product)
45+
end
46+
4247
"""
4348
`evalfr(sys, x)` Evaluate the transfer function of the LTI system sys
4449
at the complex number s=x (continuous-time) or z=x (discrete-time).
4550
4651
For many values of `x`, use `freqresp` instead.
4752
"""
4853
function evalfr(sys::StateSpace{<:TimeEvolution,T0}, s::Number) where {T0}
49-
T = promote_type(T0, typeof(one(T0)*one(typeof(s))/(one(T0)*one(typeof(s)))))
54+
T = _evalfr_return_type(sys, s)
5055
try
5156
R = s*I - sys.A
5257
sys.D + sys.C*((R\sys.B)::Matrix{T}) # Weird type stability issue

test/test_pid_design.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
P = tf(1,[1,1])^4
55
gangoffourplot(P,tf(1))
6+
gangoffourplot(ss(P),ss(1))
67
ωp = 0.8
78
kp,ki,C = loopshapingPI(P,ωp,phasemargin=60, doplot=true)
89
@test kp 0.82274734724854

0 commit comments

Comments
 (0)