Skip to content

Commit

Permalink
Version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasvarga committed Jan 22, 2024
1 parent 24fdfe8 commit c3db7d7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
fail-fast: false
matrix:
version:
# - '1.7'
# - '1.8'
- '1.8'
- '1.9'
- '1'
- 'nightly'
os:
Expand Down
16 changes: 9 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DescriptorSystems"
uuid = "a81e2ce2-54d1-11eb-2c75-db236b00f339"
authors = ["Andreas Varga <varga.andreas@gmail.com>"]
version = "1.3.9"
version = "1.4"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -11,14 +11,16 @@ Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[compat]
MatrixEquations = "2.0"
MatrixPencils = "1.7"
Polynomials = "3"
julia = "1.6"
LinearAlgebra = "1"
MatrixEquations = "2.4"
MatrixPencils = "1.8"
Polynomials = "2.0, 3, 4"
Random = "1"
Test = "1"
julia = "1.8"

[extras]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Random", "Test"]
test = ["Test"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Compatibility

Julia 1.6 and higher.
Julia 1.8 and higher.

## How to install

Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## Version 1.4

Version bump to comply with Julia 1.8 and higher.

## Version 1.3.9

Patch release with new functions `gprescale`, `gbalqual` and `pbalqual` related to balancing of descriptor system models and several enhanced functions, such as: `gminreal`, `gdec`, `gzero`, `gzeroinfo`, to automatically perform balancing in the case of poorly scaled system models.
Expand Down
18 changes: 8 additions & 10 deletions src/types/RationalTransferFunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ end
Base.propertynames(F::RationalTransferFunction) =
(:Ts, :var, :zeros, :poles, :gain, fieldnames(typeof(F))...)
poles(F::RationalTransferFunction) = F.poles
poles(F::Polynomial{T}) where T = zeros(T,0)
gpole(F::Polynomial{T}) where T = zeros(T,0)
gain(F::RationalTransferFunction) = F.gain
gain(F::Polynomial) = last(F.coeffs)
gpole(F::RationalTransferFunction) = [F.poles; Inf*ones(Int,max(0,degree(F.num)-degree(F.den)))]
Expand All @@ -101,20 +101,18 @@ function Base.convert(::Type{PQ}, pq::RationalTransferFunction) where {PQ <:Rati
end

# alternate constructors
function RationalTransferFunction(p′::P, q′::Q, Ts::Union{Real,Nothing}) where {T, X, P<:AbstractPolynomial{T,X},
S, Q<:AbstractPolynomial{S,X}}
function RationalTransferFunction(p′::P, q′::Q, Ts::Union{Real,Nothing}) where {T, X, P<:AbstractPolynomial{T,X}, S, Q<:AbstractPolynomial{S,X}}
p, q = promote(p′, q′)
RationalTransferFunction{eltype(p),X,typeof(p)}(p,q,Ts)
end
function RationalTransferFunction(p′::P, q′::S, Ts::Union{Real,Nothing}) where {S, T, X, P<:AbstractPolynomial{T,X}}
function RationalTransferFunction(p′::P, q′::Number, Ts::Union{Real,Nothing}) where {T, X, P<:AbstractPolynomial{T,X}}
p, q = promote(p′, q′)
RationalTransferFunction{eltype(p),X,typeof(p)}(p,q,Ts)
end
function RationalTransferFunction(p′::S, q′::P, Ts::Union{Real,Nothing}) where {S, T, X, P<:AbstractPolynomial{T,X}}
function RationalTransferFunction(p′::Number, q′::P, Ts::Union{Real,Nothing}) where {T, X, P<:AbstractPolynomial{T,X}}
p, q = promote(p′, q′)
RationalTransferFunction{eltype(q),X,typeof(q)}(p,q,Ts)
end

end

function Polynomials.rational_function(::Type{PQ}, p::P, q::Q) where {PQ <:RationalTransferFunction,
T, X, P<:AbstractPolynomial{T,X},
Expand Down Expand Up @@ -327,9 +325,9 @@ function rtf(::Type{T}, var::Union{AbstractString,Char,Symbol}; Ts::Union{Real,M
end
end
rtf(var::Union{AbstractString,Char,Symbol}; Ts::Union{Real,Missing} = missing) = rtf(Int, var; Ts = Ts)
function Base.:/(p::AbstractPolynomial,q::AbstractPolynomial)
RationalFunction(p,q)
end
# function Base.:/(p::AbstractPolynomial,q::AbstractPolynomial)
# RationalFunction(p,q)
# end

"""
r = rtf(z, p, k; Ts = rts, var = rvar)
Expand Down
4 changes: 2 additions & 2 deletions test/test_rtf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ s = Polynomial([0,1],:s)
@test propertynames(sys) == (:Ts, :var, :zeros, :poles, :gain, :num, :den)
@test poles(sys) [-d/c] && gpole(sys) [-d/c]
@test gzero(sys) [-b/a] && gain(sys) a/c #&& length(sys) == 1
@test poles(sys.num) Int[] && gain(sys.den) c
@test gpole(sys.num) Int[] && gain(sys.den) c
@test !isconstant(sys) && !isconstant(sys.num) && isconstant(a)
@test variable(sys) == variable(sys.num)
@test convert(RationalFunction,sys) == RationalFunction(sys.num,sys.den)
Expand Down Expand Up @@ -119,7 +119,7 @@ sys2 = rtf(Polynomial([b]), Ts = 0, var = :s)
a = 1; b = 2; c = 3; d = 4;
sys = rtf(Polynomial([b, a],:s), Polynomial([d, c],:s), Ts = 0)
z = Polynomial([0,1],:z)
sys1 = rtf((a*z+b)/(c*z+d),Ts=1)
sys1 = rtf((a*z+b)//(c*z+d),Ts=1)

@test rtf(sys,Ts=1,var=:z) == sys1

Expand Down

0 comments on commit c3db7d7

Please sign in to comment.