Skip to content

Commit

Permalink
fixed promotion for delay systems
Browse files Browse the repository at this point in the history
  • Loading branch information
mfalt committed May 14, 2021
1 parent 7a7188b commit e3dccfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/delay_systems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function lsim(sys::DelayLtiSystem{T,S}, u, t::AbstractArray{<:Real};
(out, t) -> (out .= u(t))
end

_lsim(sys, u!, t, x0, alg; abstol=abstol, reltol=reltol, kwargs...)
_lsim(sys, u!, t, x0, alg; abstol, reltol, kwargs...)
end

# Generic parametrized dde used for simulating DelayLtiSystem
Expand Down Expand Up @@ -160,9 +160,6 @@ function _lsim(sys::DelayLtiSystem{T,S}, Base.@nospecialize(u!), t::AbstractArra

P = sys.P

t0 = first(t)
dt = t[2] - t[1]

# Get all matrices to save on allocations
A, B1, B2, C1, C2, D11, D12, D21, D22 = P.A, P.B1, P.B2, P.C1, P.C2, P.D11, P.D12, P.D21, P.D22
Tau = sys.Tau
Expand Down
4 changes: 2 additions & 2 deletions src/types/DelayLtiSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ DelayLtiSystem(sys::TransferFunction{TE,S}) where {TE,T,S<:SisoTf{T}} = DelayLti
Base.promote_rule(::Type{AbstractMatrix{T1}}, ::Type{DelayLtiSystem{T2,S}}) where {T1<:Number,T2<:Number,S} = DelayLtiSystem{promote_type(T1,T2),S}
Base.promote_rule(::Type{T1}, ::Type{DelayLtiSystem{T2,S}}) where {T1<:Number,T2<:Number,S} = DelayLtiSystem{promote_type(T1,T2),S}

Base.promote_rule(::Type{<:StateSpace{<:TimeEvolution,T1}}, ::Type{DelayLtiSystem{T2,S}}) where {T1,T2,S} = DelayLtiSystem{promote_type(T1,T2),S}
Base.promote_rule(::Type{<:TransferFunction}, ::Type{DelayLtiSystem{T,S}}) where {T,S} = DelayLtiSystem{T,S}
Base.promote_rule(::Type{<:StateSpace{Continuous,T1}}, ::Type{DelayLtiSystem{T2,S}}) where {T1,T2,S} = DelayLtiSystem{promote_type(T1,T2),S}
Base.promote_rule(::Type{<:TransferFunction{Continuous,S1}}, ::Type{DelayLtiSystem{T2,S2}}) where {T1,S1<:SisoTf{T1},T2,S2} = DelayLtiSystem{promote_type(T1,T2),S2}
#Base.promote_rule(::Type{<:UniformScaling}, ::Type{S}) where {S<:DelayLtiSystem} = DelayLtiSystem{T,S}

function Base.convert(::Type{DelayLtiSystem{T,S}}, sys::StateSpace) where {T,S}
Expand Down

0 comments on commit e3dccfe

Please sign in to comment.