Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #909 #910

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/ControlSystemsBase/src/discrete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ This method of translation is useful when analyzing hybrid continuous/discrete s
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.
"""
function d2c_exact(sys::AbstractStateSpace{<:Discrete}, method=:causal)
if sys.nx == 0
return DelayLtiSystem(d2c(sys))
end
T = sys.Ts
A,B,C,D = ssdata(sys)
if method === :acausal
Expand Down
7 changes: 7 additions & 0 deletions lib/ControlSystemsBase/test/test_discrete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ pd = c2d_poly2poly(A, 0.1)
# rd = step(sys, 0:10)
# rc = step(sysc_causal, 0:10)
# @test rd.y ≈ rc.y atol = 1e-8

sys = ss(1,1)
sysc = d2c_exact(sys)
sysc2 = DelayLtiSystem(ss(1))
@test sysc.P.P ≈ sysc2.P.P
@test sysc.P.ny ≈ sysc2.P.ny
@test sysc.Tau ≈ sysc2.Tau
end


Expand Down
Loading