Skip to content

Commit de5e295

Browse files
committed
fix #909
1 parent 7c86b31 commit de5e295

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/ControlSystemsBase/src/discrete.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ This method of translation is useful when analyzing hybrid continuous/discrete s
143143
The resulting system will be be a static system in feedback with pure delays. When `method = :causal`, the delays will be positive, resulting in a causal system that can be simulated in the time domain. When `method = :acausal`, the delays will be negative, resulting in an acausal system that **can not** be simulated in the time domain. The acausal translation results in a smaller system with half as many delay elements in the feedback path.
144144
"""
145145
function d2c_exact(sys::AbstractStateSpace{<:Discrete}, method=:causal)
146+
if sys.nx == 0
147+
return DelayLtiSystem(d2c(sys))
148+
end
146149
T = sys.Ts
147150
A,B,C,D = ssdata(sys)
148151
if method === :acausal

lib/ControlSystemsBase/test/test_discrete.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ pd = c2d_poly2poly(A, 0.1)
164164
# rd = step(sys, 0:10)
165165
# rc = step(sysc_causal, 0:10)
166166
# @test rd.y ≈ rc.y atol = 1e-8
167+
168+
sys = ss(1,1)
169+
sysc = d2c_exact(sys)
170+
sysc2 = DelayLtiSystem(ss(1))
171+
@test sysc.P.P sysc2.P.P
172+
@test sysc.P.ny sysc2.P.ny
173+
@test sysc.Tau sysc2.Tau
167174
end
168175

169176

0 commit comments

Comments
 (0)