diff --git a/LinearSystems2TestConversion3.mo b/LinearSystems2TestConversion3.mo index 4ec452df..154965df 100644 --- a/LinearSystems2TestConversion3.mo +++ b/LinearSystems2TestConversion3.mo @@ -314,6 +314,10 @@ package LinearSystems2TestConversion3 "Rectangular matrix with orthonormal columns such that Q*R=A[:,p]"; output Real R[size(A, 2),size(A, 2)] "Square upper triangular matrix"; output Integer p[size(A, 2)] "Column permutation vector"; + output Real To[size(S, 1),size(S, 2)] "Reordered Schur form"; + output Real Qo[size(S, 1),size(S, 2)] "Reordered Schur vectors"; + output Real wr[size(S, 2)] "Reordered eigenvalues, real part"; + output Real wi[size(S, 2)] "Reordered eigenvalues, imaginary part"; protected Real A[3,3] = [1, 0, 0; 6, 5, 0; 1, -2, 2] "Square matrix"; @@ -323,7 +327,8 @@ package LinearSystems2TestConversion3 Real QZ[size(A, 1),size(A, 2)]; Real alphaReal[size(A, 1)] "Real part of eigenvalue=alphaReal+i*alphaImag"; - Real alphaImag[size(A, 1)] "Imaginary part of eigenvalue=(alphaReal+i*alphaImag"; + Real alphaImag[size(A, 1)] "Imaginary part of eigenvalue=alphaReal+i*alphaImag"; + Real alpha=-1e10 "Maximum admissible value for real parts of the eigenvalues of A which will not be modified by the eigenvalue assignment algorithm"; Real Als[:,:] = [-1.0, 0.0, 0.0; 0.0, -2.0, 0.0; 0.0, 0.0, -3.0]; Real Bls[:,:] = [1.0; 1.0; 0.0]; @@ -351,6 +356,8 @@ package LinearSystems2TestConversion3 n := Modelica_LinearSystems2.Math.Matrices.norm(A); Z := Modelica_LinearSystems2.Math.Matrices.nullspace(A); (S, QZ, alphaReal, alphaImag) := Modelica_LinearSystems2.Math.Matrices.rsf2(A); + (S, QZ, alphaReal, alphaImag) := Modelica_LinearSystems2.Math.Matrices.Internal.reorderRSF2( + S, identity(size(S, 1)), alphaReal, alphaImag, alpha); rcond := Modelica_LinearSystems2.Math.Matrices.rcond(A); x := Modelica_LinearSystems2.Math.Matrices.solve(A, b1); X := Modelica_LinearSystems2.Math.Matrices.solve2(A, B); diff --git a/Modelica_LinearSystems2/Math/Matrices/Internal/package.order b/Modelica_LinearSystems2/Math/Matrices/Internal/package.order index 4a9e6608..006f666e 100644 --- a/Modelica_LinearSystems2/Math/Matrices/Internal/package.order +++ b/Modelica_LinearSystems2/Math/Matrices/Internal/package.order @@ -19,6 +19,5 @@ symMatMul symMatMul_C solveSymRight solveSymRight_C -reorderRSF2 solve2rSym solve2rSym_C diff --git a/Modelica_LinearSystems2/Math/Matrices/Internal/reorderRSF2.mo b/Modelica_LinearSystems2/Math/Matrices/Internal/reorderRSF2.mo deleted file mode 100644 index e6cd4f47..00000000 --- a/Modelica_LinearSystems2/Math/Matrices/Internal/reorderRSF2.mo +++ /dev/null @@ -1,38 +0,0 @@ -within Modelica_LinearSystems2.Math.Matrices.Internal; -function reorderRSF2 - "Reorders a real Schur factorization for poleAssignmentMI design" - extends Modelica.Icons.Function; - - input Real T[:,:] "upper quasi-triangular matrix in Schur canonical form"; - input Real Q[:,size(T, 2)] "matrix of Schur vectors"; - input Real alphaReal[size(T, 1)] - "Real part of eigenvalue=alphaReal+i*alphaImag"; - input Real alphaImag[size(T, 1)] - "Imaginary part of eigenvalue=(alphaReal+i*alphaImag"; - input Real alpha - "maximum admissible value for real parts(continuous) or for moduli (discrete) of the eigenvalues of A which will not be modified by the eigenvalue assignment algorithm"; - - output Real To[size(T, 1),size(T, 2)]; - output Real Qo[size(T, 1),size(T, 2)]; - output Real wr[size(T, 2)]; - output Real wi[size(T, 2)]; - -protected - Integer n=size(T, 2); - Boolean select[n]=fill(false, n); - Integer i; -algorithm - for i in 1:n loop - if alphaReal[i] < alpha then - select[i] := true; - end if; - end for; - - (To,Qo,wr,wi) := Modelica.Math.Matrices.LAPACK.dtrsen( - "E", - "V", - select, - T, - Q); - -end reorderRSF2; diff --git a/Modelica_LinearSystems2/Resources/Scripts/Conversion/ConvertLinearSystems2_from_2.4.0.mos b/Modelica_LinearSystems2/Resources/Scripts/Conversion/ConvertLinearSystems2_from_2.4.0.mos index 945385e6..b1a2976b 100644 --- a/Modelica_LinearSystems2/Resources/Scripts/Conversion/ConvertLinearSystems2_from_2.4.0.mos +++ b/Modelica_LinearSystems2/Resources/Scripts/Conversion/ConvertLinearSystems2_from_2.4.0.mos @@ -322,12 +322,14 @@ convertClass({"Modelica_LinearSystems2.Math.Matrices.Internal.dgeqp3_workdim", "Modelica_LinearSystems2.Math.Matrices.Internal.dgeqrf_workdim", "Modelica_LinearSystems2.Math.Matrices.Internal.dhseqr_workdim", "Modelica_LinearSystems2.Math.Matrices.Internal.QR", - "Modelica_LinearSystems2.Math.Matrices.Internal.QR2"}, + "Modelica_LinearSystems2.Math.Matrices.Internal.QR2", + "Modelica_LinearSystems2.Math.Matrices.Internal.reorderRSF2"}, {"ObsoleteLinearSystems2.Math.Matrices.Internal.dgeqp3_workdim", "ObsoleteLinearSystems2.Math.Matrices.Internal.dgeqrf_workdim", "ObsoleteLinearSystems2.Math.Matrices.Internal.dhseqr_workdim", "Modelica.Math.Matrices.QR", - "ObsoleteLinearSystems2.Math.Matrices.Internal.QR2"}); + "ObsoleteLinearSystems2.Math.Matrices.Internal.QR2", + "Modelica_LinearSystems2.Math.Matrices.Internal.reorderRSFc"}); // Polynomial //