From 1caf834137ba0a11c95d7cce2987c192ae6ddbfe Mon Sep 17 00:00:00 2001 From: DSVarga Date: Thu, 15 Dec 2022 14:31:56 +0100 Subject: [PATCH] Minor corrections, e.g. in simplify and show --- .github/workflows/CI.yml | 6 ++---- Project.toml | 2 +- ReleaseNotes.md | 4 ++++ docs/src/index.md | 1 + src/types/RationalTransferFunction.jl | 10 +++++++--- test/DSToolsDemo.jl | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6cfd7f8..64e00a0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,16 +11,14 @@ jobs: test: name: Tests, Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.version == '1.9' }} + continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false matrix: version: - # - '1.6' - '1.7' - '1' - # - '1.9' - # - 'nightly' + - 'nightly' os: - ubuntu-latest - windows-latest diff --git a/Project.toml b/Project.toml index db91324..0c9d741 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DescriptorSystems" uuid = "a81e2ce2-54d1-11eb-2c75-db236b00f339" authors = ["Andreas Varga "] -version = "1.3.5" +version = "1.3.6" [deps] MatrixPencils = "48965c70-4690-11ea-1f13-43a2532b2fa8" diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 815e53e..1b7f355 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -2,6 +2,10 @@ ## Version 1.3.5 +Patch release to correct simplify and show for ratios of constants. + +## Version 1.3.5 + Patch release enhancing step response computation. ## Version 1.3.4 diff --git a/docs/src/index.md b/docs/src/index.md index 58114f4..ecfdab5 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -102,6 +102,7 @@ The available functions in the `DescriptorSystems.jl` package cover both standar * **[`gh2norm`](@ref)** `H2` norm of a descriptor system. * **[`glinfnorm`](@ref)** `L∞` norm of a descriptor system. * **[`ghinfnorm`](@ref)** `H∞` norm of a descriptor system. +* **[`gnugap`](@ref)** ν-gap distance between two descriptor systems. * **[`freqresp`](@ref)** Frequency response of a descriptor system. * **[`timeresp`](@ref)** Time response of a descriptor system. * **[`stepresp`](@ref)** Step response of a descriptor system. diff --git a/src/types/RationalTransferFunction.jl b/src/types/RationalTransferFunction.jl index 8025cce..24afff6 100644 --- a/src/types/RationalTransferFunction.jl +++ b/src/types/RationalTransferFunction.jl @@ -190,8 +190,9 @@ Base.show(io::IO, sys::RationalTransferFunction) = show(io, MIME("text/plain"), function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, sys::RationalTransferFunction) summary(io, sys); println(io) - p, q = Polynomials.pqs(sys) - if order(sys) == 0 + n = order(sys) + p, q = n == 0 ? Polynomials.pqs(normalize(sys)) : Polynomials.pqs(sys) + if n == 0 printpoly(io, p) println(io, "\n\nStatic gain.") return @@ -600,13 +601,16 @@ numerator and denominator coefficients. function simplify(r::RationalTransferFunction; atol::Real = 0, rtol::Real=10*eps(float(real(_eltype(r))))) m = degree(r.num) (m == 0 || degree(r.den) == 0) && (return r) + var = Polynomials.indeterminate(r.num) pnum = r.num.coeffs pden = r.den.coeffs d, u, w, = MatrixPencils.polgcdvw(pnum, pden, atol = atol, rtol = rtol, maxnit = 3) + length(u) > m && (return r) # no cancelation, keep original r knum = pnum[end]/d[end]/u[end] kden = pden[end]/d[end]/w[end] - return rtf(Polynomial(u*knum,Polynomials.indeterminate(r.num)), Polynomial(w*kden,Polynomials.indeterminate(r.den)), Ts = r.Ts) + rs = rtf(Polynomial(u*knum,var), Polynomial(w*kden,var), Ts = r.Ts) + return length(u) == length(w) == 1 ? normalize(rs) : rs end """ Rval = evalfr(R,val) diff --git a/test/DSToolsDemo.jl b/test/DSToolsDemo.jl index 25c07a6..a5a3475 100644 --- a/test/DSToolsDemo.jl +++ b/test/DSToolsDemo.jl @@ -48,7 +48,7 @@ println("gzero(sysc) # computes all zeros (finite and infinite)") display(gzero(sysc)) pause() -println("Descriptor systems (A-λE,B,C,D) with singular pole pencil A-λE are not supported in DSTOOLS!") +println("Descriptor systems (A-λE,B,C,D) with singular pole pencil A-λE are not supported!") println("Non-regular A-λE can be detected in several ways.\n ") println("(1) non-regular A-λE can be detected when building a descriptor system ") println("A = zeros(1,1); E = zeros(1,1); B = ones(1,1); C = ones(1,1); D = zeros(1,1);")