Skip to content

Commit 932da0c

Browse files
baggepinnenclaude
andcommitted
Add the timeevol property to FRD and accept keyword arguments in freqresp(::FRD)
ControlSystemsBase 1.22 calls `freqresp(sys, w; balance)` from `nyquist`. Since `freqresp(::FRD, w)` accepted no keyword arguments, the call was dispatched to the generic `freqresp(::LTISystem, w; balance)`, which failed in `timeevol(::FRD)` and, after that, in `numeric_type(::FRD)`. `FRD` now has the property `timeevol = Continuous()`, consistent with its supertype `LTISystem{Continuous}`, and `freqresp(::FRD, w; kwargs...)` ignores the keyword arguments. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent ab88a19 commit 932da0c

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/frd.jl‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ end
9191
Base.lastindex(f::FRD) = length(f)
9292
function Base.getproperty(f::FRD, s::Symbol)
9393
s === :Ts && return π / maximum(f.w)
94+
s === :timeevol && return Continuous()
9495
s === :nu && return ninputs(f)
9596
s === :ny && return noutputs(f)
9697
getfield(f, s)
9798
end
98-
Base.propertynames(f::FRD, private::Bool = false) = (fieldnames(typeof(f))..., :Ts)
99+
Base.propertynames(f::FRD, private::Bool = false) = (fieldnames(typeof(f))..., :Ts, :timeevol, :nu, :ny)
99100

100101
function Base.show(io::IO, frd::FRD)
101102
write(io, "Frequency (rad/s)\n")
@@ -120,7 +121,7 @@ function ControlSystemsBase.bode(f::FRD, w::AbstractVector = f.w; unwrap=true)
120121
reshape(abs.(f.r), f.ny, f.nu, :), angles, f.w
121122
end
122123

123-
function ControlSystemsBase.freqresp(f::FRD, w::AbstractVector{W} = f.w) where W <: Real
124+
function ControlSystemsBase.freqresp(f::FRD, w::AbstractVector{W} = f.w; kwargs...) where W <: Real # kwargs such as balance do not apply to frequency-response data
124125
w == f.w || error("Frequency vector must match the one stored in the FRD")
125126
reshape(f.r, f.ny, f.nu, :)
126127
end

‎test/test_frd.jl‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ frd = FRD(w, G); # Build a frequency-response data object
176176

177177
@test bode(frd) == bode(G, w)
178178
@test nyquist(frd) == nyquist(G, w)
179+
@test ControlSystemsBase.iscontinuous(frd)
180+
@test freqresp(frd, w; balance = false) == freqresp(frd)
179181

180182
@test size([frd frd]) == (ny, 2nu)
181183
@test size([frd; frd]) == (2ny, nu)

0 commit comments

Comments
 (0)