From: <par...@us...> - 2011-07-27 15:51:56
|
Revision: 8417 http://octave.svn.sourceforge.net/octave/?rev=8417&view=rev Author: paramaniac Date: 2011-07-27 15:51:50 +0000 (Wed, 27 Jul 2011) Log Message: ----------- control: prepare release of control-2.1.52 Modified Paths: -------------- trunk/octave-forge/main/control/DESCRIPTION trunk/octave-forge/main/control/devel/RELEASE_PACKAGE trunk/octave-forge/main/control/doc/NEWS Modified: trunk/octave-forge/main/control/DESCRIPTION =================================================================== --- trunk/octave-forge/main/control/DESCRIPTION 2011-07-27 13:12:27 UTC (rev 8416) +++ trunk/octave-forge/main/control/DESCRIPTION 2011-07-27 15:51:50 UTC (rev 8417) @@ -1,6 +1,6 @@ Name: Control -Version: 2.1.51 -Date: 2011-07-21 +Version: 2.1.52 +Date: 2011-07-27 Author: Lukas Reichlin <luk...@gm...> Maintainer: Lukas Reichlin <luk...@gm...> Title: Control Systems Modified: trunk/octave-forge/main/control/devel/RELEASE_PACKAGE =================================================================== --- trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-07-27 13:12:27 UTC (rev 8416) +++ trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-07-27 15:51:50 UTC (rev 8417) @@ -18,12 +18,12 @@ rm -R ~/octave/__TEMP__/control/devel cd ~/octave/__TEMP__ grep -i version control/DESCRIPTION -tar czf control-2.1.51.tar.gz control/ -md5 control-2.1.51.tar.gz -md5 control-2.1.51.tar.gz > md5_control_pkg.txt -uuencode control-2.1.51.tar.gz < control-2.1.51.tar.gz > control-2.1.51.tar.gz.uue +tar czf control-2.1.52.tar.gz control/ +md5 control-2.1.52.tar.gz +md5 control-2.1.52.tar.gz > md5_control_pkg.txt +uuencode control-2.1.52.tar.gz < control-2.1.52.tar.gz > control-2.1.52.tar.gz.uue octave -q --eval \ -"pkg install control-2.1.51.tar.gz" +"pkg install control-2.1.52.tar.gz" octave -q --eval \ "pkg load generate_html; generate_package_html ('control', 'control-html', 'octave-forge')" tar czf control-html.tar.gz control-html @@ -38,7 +38,7 @@ ===================================================================================== rm -R ~/octave/__TEMP__ -rm -R ~/octave/control-2.1.51 +rm -R ~/octave/control-2.1.52 ===================================================================================== Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-07-27 13:12:27 UTC (rev 8416) +++ trunk/octave-forge/main/control/doc/NEWS 2011-07-27 15:51:50 UTC (rev 8417) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the control package =============================================================================== -control-2.x.yy Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +control-2.1.52 Release Date: 2011-07-27 Release Manager: Lukas Reichlin =============================================================================== ** hsvd.m This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-04 19:18:47
|
Revision: 8431 http://octave.svn.sourceforge.net/octave/?rev=8431&view=rev Author: paramaniac Date: 2011-08-04 19:18:41 +0000 (Thu, 04 Aug 2011) Log Message: ----------- control: various changes Modified Paths: -------------- trunk/octave-forge/main/control/devel/MDSSystem.m trunk/octave-forge/main/control/devel/PROJECTS trunk/octave-forge/main/control/devel/ncfsyn/ncfsyn.m trunk/octave-forge/main/control/inst/@frd/display.m Modified: trunk/octave-forge/main/control/devel/MDSSystem.m =================================================================== --- trunk/octave-forge/main/control/devel/MDSSystem.m 2011-08-03 06:58:20 UTC (rev 8430) +++ trunk/octave-forge/main/control/devel/MDSSystem.m 2011-08-04 19:18:41 UTC (rev 8431) @@ -142,6 +142,7 @@ % Compute the suboptimal positive feedback controller K = ncfsyn (G, W1, W2, factor); % positive feedback controller +[K, N, gamma, info] = ncfsyn (G, W1, W2, factor) K = -K; % negative feedback controller L = G * K; % open loop Modified: trunk/octave-forge/main/control/devel/PROJECTS =================================================================== --- trunk/octave-forge/main/control/devel/PROJECTS 2011-08-03 06:58:20 UTC (rev 8430) +++ trunk/octave-forge/main/control/devel/PROJECTS 2011-08-04 19:18:41 UTC (rev 8431) @@ -37,6 +37,16 @@ * Check whether RASP-DESCRIPT Fortran routines are free software and include them for dss system conversions and other stuff if possible. + * Add input and output groups to LTI models. + -- sys.ingroup.controls = [1, 3] (stored as a struct) + -- sys(:, "controls") (instead of sys(:, [1, 3])) + -- Handle __sys_group__ case when indices of the second lti need to be increased + by the size of the first lti. + -- Handle __sys_prune__ case when indices need to be deleted from all struct fields + and channels numbers after the deleted ones need to be decreased. + -- Handle conflicting names for __sys_group__. + -- Beware of indices not in ascending order. + ----------------------- Frequency Response Data: ----------------------- Modified: trunk/octave-forge/main/control/devel/ncfsyn/ncfsyn.m =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/ncfsyn.m 2011-08-03 06:58:20 UTC (rev 8430) +++ trunk/octave-forge/main/control/devel/ncfsyn/ncfsyn.m 2011-08-04 19:18:41 UTC (rev 8431) @@ -16,7 +16,7 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}] =} ncfsyn (@var{G}, @var{W1}, @var{W2}, @var{factor}) +## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}, @var{info}] =} ncfsyn (@var{G}, @var{W1}, @var{W2}, @var{factor}) ## Normalized Coprime Factor (NCF) H-infinity synthesis. ## Compute positive feedback controller using the McFarlane/Glover Loop Shaping Design Procedure. ## Uses SLICOT SB10ID, SB10KD and SB10ZD by courtesy of @@ -46,9 +46,19 @@ ## @item K ## State-space model of the H-infinity loop-shaping controller. ## @item N -## State-space model of the lower LFT of @var{P} and @var{K}. +## State-space model of closed loop. ## @item gamma ## L-infinity norm of @var{N}. +## @item info +## Structure containing additional information. +## @item info.emax +## Nugap robustness. @code{emax = inv (gamma)}. +## @item info.Gs +## Shaped plant. @code{Gs = W2 * G * W1}. +## @item info.Ks +## Controller for shaped plant. @code{Ks = ncfsyn (Gs)}. +## @item info.rcond +## Estimates of the reciprocal condition numbers of the Riccati equations. ## @end table ## @end deftypefn @@ -56,8 +66,7 @@ ## Created: July 2011 ## Version: 0.1 -% function [K, N, gamma, info] = ncfsyn (G, W1 = [], W2 = [], factor = 1.0) -function K = ncfsyn (G, W1 = [], W2 = [], factor = 1.0) +function [K, varargout] = ncfsyn (G, W1 = [], W2 = [], factor = 1.0) if (nargin == 0 || nargin > 4) print_usage (); @@ -93,9 +102,25 @@ Ks = ss (ak, bk, ck, dk, tsam); K = W1 * Ks * W2; - - %struct ("Gs", Gs, "Ks", Ks, "rcond", rcond); + if (nargout > 1) + N = append (eye (p), K, G); + M = [zeros(p,p), zeros(p,m), eye(p); + eye(p), zeros(p,m), zeros(p,p); + zeros(m,p), eye(m), zeros(m,p)]; + in_idx = [1:p, 2*p+(1:m)]; + out_idx = 1:p+m; + N = mconnect (N, M, in_idx, out_idx); + varargout{1} = N; + if (nargout > 2) + gamma = norm (N, inf); + varargout{2} = gamma; + if (nargout > 3) + varargout{3} = struct ("emax", inv (gamma), "Gs", Gs, "Ks", Ks, "rcond", rcond); + endif + endif + endif + endfunction Modified: trunk/octave-forge/main/control/inst/@frd/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@frd/display.m 2011-08-03 06:58:20 UTC (rev 8430) +++ trunk/octave-forge/main/control/inst/@frd/display.m 2011-08-04 19:18:41 UTC (rev 8431) @@ -118,22 +118,22 @@ endfunction -function col = __vec2str__ (vec, post) +function str = __vec2str__ (vec, post) vec = vec(:); tmp = isfinite (vec); tmp = abs (vec(tmp & vec != 0)); vec = num2cell (vec); if (isempty (tmp) || min (tmp) < 1e-3 || max (tmp) > 1e4) - col = cellfun (@(x) sprintf ("%.3e", x), vec, "uniformoutput", false); + str = cellfun (@(x) sprintf ("%.3e", x), vec, "uniformoutput", false); elseif (all (floor (tmp) == tmp)) - col = cellfun (@(x) sprintf ("%d", x), vec, "uniformoutput", false); + str = cellfun (@(x) sprintf ("%d", x), vec, "uniformoutput", false); else - col = cellfun (@(x) sprintf ("%.4f", x), vec, "uniformoutput", false); + str = cellfun (@(x) sprintf ("%.4f", x), vec, "uniformoutput", false); endif - col = strjust (char (col), "right"); + str = strjust (char (str), "right"); if (nargin > 1) - col = [col, repmat(post, length (vec), 1)]; + str = [str, repmat(post, length (vec), 1)]; endif endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-05 12:34:21
|
Revision: 8435 http://octave.svn.sourceforge.net/octave/?rev=8435&view=rev Author: paramaniac Date: 2011-08-05 12:34:08 +0000 (Fri, 05 Aug 2011) Log Message: ----------- control: clean up ncfsyn Modified Paths: -------------- trunk/octave-forge/main/control/INDEX trunk/octave-forge/main/control/devel/makefile_all.m trunk/octave-forge/main/control/devel/makefile_ncfsyn.m trunk/octave-forge/main/control/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/control/inst/MDSSystem.m Removed Paths: ------------- trunk/octave-forge/main/control/devel/MDSSystem.m trunk/octave-forge/main/control/devel/ncfsyn/ Modified: trunk/octave-forge/main/control/INDEX =================================================================== --- trunk/octave-forge/main/control/INDEX 2011-08-05 12:14:15 UTC (rev 8434) +++ trunk/octave-forge/main/control/INDEX 2011-08-05 12:34:08 UTC (rev 8435) @@ -80,6 +80,7 @@ h2syn hinfsyn mixsyn + ncfsyn Matrix Equation Solvers care dare Deleted: trunk/octave-forge/main/control/devel/MDSSystem.m =================================================================== --- trunk/octave-forge/main/control/devel/MDSSystem.m 2011-08-05 12:14:15 UTC (rev 8434) +++ trunk/octave-forge/main/control/devel/MDSSystem.m 2011-08-05 12:34:08 UTC (rev 8435) @@ -1,156 +0,0 @@ -% =============================================================================== -% Robust Control of a Mass-Damper-Spring System Lukas Reichlin August 2011 -% =============================================================================== -% Reference: Gu, D.W., Petkov, P.Hr. and Konstantinov, M.M. -% Robust Control Design with Matlab, Springer 2005 -% =============================================================================== - -% Tabula Rasa -clear all, close all, clc - -% =============================================================================== -% System Model -% =============================================================================== -% +---------------+ -% | d_m 0 0 | -% +-----| 0 d_c 0 |<----+ -% u_m | | 0 0 d_k | | y_m -% u_c | +---------------+ | y_c -% u_k | | y_k -% | +---------------+ | -% +---->| |-----+ -% | G_nom | -% u ----->| |-----> y -% +---------------+ - -% Nominal Values -m_nom = 3; % mass -c_nom = 1; % damping coefficient -k_nom = 2; % spring stiffness - -% Perturbations -p_m = 0.4; % 40% uncertainty in the mass -p_c = 0.2; % 20% uncertainty in the damping coefficient -p_k = 0.3; % 30% uncertainty in the spring stiffness - -% State-Space Representation -A = [ 0, 1 - -k_nom/m_nom, -c_nom/m_nom ]; - -B1 = [ 0, 0, 0 - -p_m, -p_c/m_nom, -p_k/m_nom ]; - -B2 = [ 0 - 1/m_nom ]; - -C1 = [ -k_nom/m_nom, -c_nom/m_nom - 0, c_nom - k_nom, 0 ]; - -C2 = [ 1, 0 ]; - -D11 = [ -p_m, -p_c/m_nom, -p_k/m_nom - 0, 0, 0 - 0, 0, 0 ]; - -D12 = [ 1/m_nom - 0 - 0 ]; - -D21 = [ 0, 0, 0 ]; - -D22 = [ 0 ]; - -inname = {'u_m', 'u_c', 'u_k', 'u'}; % input names -outname = {'y_m', 'y_c', 'y_k', 'y'}; % output names - -G_nom = ss (A, [B1, B2], [C1; C2], [D11, D12; D21, D22], ... - 'inputname', inname, 'outputname', outname); - -G = G_nom(4, 4); % extract output y and input u - - -% =============================================================================== -% Frequency Analysis of Uncertain System -% =============================================================================== - -% Uncertainties: -1 <= delta_m, delta_c, delta_k <= 1 -[delta_m, delta_c, delta_k] = ndgrid ([-1, 0, 1], [-1, 0, 1], [-1, 0, 1]); - -% Bode Plots of Perturbed Plants -w = logspace (-1, 1, 100); % frequency vector -figure (1) - -for k = 1 : numel (delta_m) - Delta = diag ([delta_m(k), delta_c(k), delta_k(k)]); - G_per = lft (Delta, G_nom); - bode (G_per, w) - subplot (2, 1, 1) - hold on - subplot (2, 1, 2) - hold on -endfor - - -% =============================================================================== -% Mixed Sensitivity H-infinity Controller Design (S over KS Method) -% =============================================================================== -% +-------+ -% +--------------------->| W_p |----------> e_p -% | +-------+ -% | +-------+ -% | +---->| W_u |----------> e_u -% | | +-------+ -% | | +---------+ -% | | ->| |-> -% r + e | +-------+ u | | G_nom | -% ----->(+)---+-->| K |----+--->| |----+----> y -% ^ - +-------+ +---------+ | -% | | -% +-----------------------------------------+ - -% Weighting Functions -s = tf ('s'); % transfer function variable -W_p = 0.95 * (s^2 + 1.8*s + 10) / (s^2 + 8.0*s + 0.01); % performance weighting -W_u = 10^-2; % control weighting - -% Synthesis -K = mixsyn (G, W_p, W_u); % mixed-sensitivity H-infinity synthesis - -% Interconnections -L = G * K; % open loop -T = feedback (L); % closed loop - -% Plotting -figure (2) -sigma (T) % singular values - -figure (3) -step (T) % step response - - -% =============================================================================== -% H-infinity Loop-Shaping Design -% =============================================================================== - -% Settings -W1 = 8 * (2*s + 1) / (0.9*s); % precompensator -W2 = 1; % postcompensator -factor = 1.1; % suboptimal controller - -% Synthesis -K = ncfsyn (G, W1, W2, factor); % positive feedback controller - -% Interconnections -K = -K; % negative feedback controller -L = G * K; % open loop -T = feedback (L); % closed loop - -% Plotting -figure (4) -sigma (T) % singular values - -figure (5) -step (T) % step response - -% =============================================================================== Modified: trunk/octave-forge/main/control/devel/makefile_all.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_all.m 2011-08-05 12:14:15 UTC (rev 8434) +++ trunk/octave-forge/main/control/devel/makefile_all.m 2011-08-05 12:34:08 UTC (rev 8435) @@ -19,6 +19,7 @@ makefile_lqr makefile_lyap makefile_minreal +makefile_ncfsyn makefile_norm makefile_place makefile_scale Modified: trunk/octave-forge/main/control/devel/makefile_ncfsyn.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_ncfsyn.m 2011-08-05 12:14:15 UTC (rev 8434) +++ trunk/octave-forge/main/control/devel/makefile_ncfsyn.m 2011-08-05 12:34:08 UTC (rev 8435) @@ -1,3 +1,19 @@ +## ============================================================================== +## Developer Makefile for OCT-files +## ============================================================================== +## USAGE: * fetch control from Octave-Forge by svn +## * add control/inst, control/src and control/devel to your Octave path +## * run makefile_* +## NOTES: * The option "-Wl,-framework" "-Wl,vecLib" is needed for MacPorts' +## octave-devel @3.3.52_1+gcc44 on MacOS X 10.6.4. However, this option +## breaks other platforms. See MacPorts Ticket #26640. +## ============================================================================== + +homedir = pwd (); +develdir = fileparts (which ("makefile_ncfsyn")); +srcdir = [develdir, "/../src"]; +cd (srcdir); + ## H-infinity loop shaping - continuous-time mkoctfile "-Wl,-framework" "-Wl,vecLib" \ slsb10id.cc \ @@ -19,4 +35,6 @@ slsb10zd.cc \ SB10ZD.f MA02AD.f SB02OD.f select.f MB01RX.f \ MB02VD.f SB02OY.f SB02OW.f SB02OV.f SB02OU.f \ - SB02MR.f MA02GD.f SB02MV.f \ No newline at end of file + SB02MR.f MA02GD.f SB02MV.f + +cd (homedir); Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-08-05 12:14:15 UTC (rev 8434) +++ trunk/octave-forge/main/control/doc/NEWS 2011-08-05 12:34:08 UTC (rev 8435) @@ -1,17 +1,29 @@ Summary of important user-visible changes for releases of the control package =============================================================================== +control-2.x.yy Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +=============================================================================== + +** ncfsyn + -- Added support for McFarlane/Glover loop shaping design procedure. ncfsyn + stands for Normalized Coprime Factor Synthesis. + +** MDSSystem + -- Added example script which demonstrates the usage of the robust control + commands "mixsyn" and "ncfsyn". + +=============================================================================== control-2.1.52 Release Date: 2011-07-27 Release Manager: Lukas Reichlin =============================================================================== -** hsvd.m +** hsvd -- Use scaling unless state-space model property "scaled" is set to true. -** @lti/norm.m +** @lti/norm -- Use scaling for computation of L-infinity norm unless state-space model property "scaled" is set to true. -** @lti/minreal.m +** @lti/minreal -- Use scaling for state-space and descriptor state-space models unless property "scaled" is set to true. -- More accurate results are to be expected for descriptor state-space @@ -19,11 +31,11 @@ reduction occurs. This is achieved by saving the system matrices before each phase and restoring them if no order reduction took place. -** @lti/zero.m +** @lti/zero -- Use scaling for state-space and descriptor state-space models unless property "scaled" is set to true. -** @lti/frdata.m +** @lti/frdata -- The frequency response is now returned correctly as an array and not as a vector, unless the "vector" option is set and the system is single-input single-output. @@ -34,7 +46,7 @@ control-2.1.51 Release Date: 2011-07-21 Release Manager: Lukas Reichlin =============================================================================== -** frd.m +** frd -- Support for Frequency Response Data (frd) measurement "models". @@ -42,14 +54,14 @@ control-2.1.50 Release Date: 2011-07-06 Release Manager: Lukas Reichlin =============================================================================== -** ss.m +** ss -- Support for property "scaled". By default, it is set to "false". -** @lti/prescale.m +** @lti/prescale -- Scaling for state-space models (SLICOT TB01ID) and descriptor models (SLICOT TG01AD). -** @lti/freqresp.m +** @lti/freqresp -- Scale state-space models using @lti/prescale.m if property "scaled" is set to "false". Frequency response commands now perform automatic scaling unless model property "scaled" is set to "true". @@ -59,7 +71,7 @@ control-2.0.2 Release Date: 2011-03-18 Release Manager: Lukas Reichlin =============================================================================== -** lsim.m +** lsim -- Fixed a logical error that refused valid initial state vectors. It was due to a thinko introduced with the changes in control-2.0.1. (Thanks to Rob Frohne) @@ -69,11 +81,11 @@ control-2.0.1 Release Date: 2011-03-06 Release Manager: Lukas Reichlin =============================================================================== -** lsim.m +** lsim -- Support time vectors not starting at zero. (Thanks to Rob Frohne) -- Improved help text. -** @lti/zero.m +** @lti/zero -- The gain of descriptor state-space models is now computed correctly. (fingers crossed) Copied: trunk/octave-forge/main/control/inst/MDSSystem.m (from rev 8434, trunk/octave-forge/main/control/devel/MDSSystem.m) =================================================================== --- trunk/octave-forge/main/control/inst/MDSSystem.m (rev 0) +++ trunk/octave-forge/main/control/inst/MDSSystem.m 2011-08-05 12:34:08 UTC (rev 8435) @@ -0,0 +1,156 @@ +% =============================================================================== +% Robust Control of a Mass-Damper-Spring System Lukas Reichlin August 2011 +% =============================================================================== +% Reference: Gu, D.W., Petkov, P.Hr. and Konstantinov, M.M. +% Robust Control Design with Matlab, Springer 2005 +% =============================================================================== + +% Tabula Rasa +clear all, close all, clc + +% =============================================================================== +% System Model +% =============================================================================== +% +---------------+ +% | d_m 0 0 | +% +-----| 0 d_c 0 |<----+ +% u_m | | 0 0 d_k | | y_m +% u_c | +---------------+ | y_c +% u_k | | y_k +% | +---------------+ | +% +---->| |-----+ +% | G_nom | +% u ----->| |-----> y +% +---------------+ + +% Nominal Values +m_nom = 3; % mass +c_nom = 1; % damping coefficient +k_nom = 2; % spring stiffness + +% Perturbations +p_m = 0.4; % 40% uncertainty in the mass +p_c = 0.2; % 20% uncertainty in the damping coefficient +p_k = 0.3; % 30% uncertainty in the spring stiffness + +% State-Space Representation +A = [ 0, 1 + -k_nom/m_nom, -c_nom/m_nom ]; + +B1 = [ 0, 0, 0 + -p_m, -p_c/m_nom, -p_k/m_nom ]; + +B2 = [ 0 + 1/m_nom ]; + +C1 = [ -k_nom/m_nom, -c_nom/m_nom + 0, c_nom + k_nom, 0 ]; + +C2 = [ 1, 0 ]; + +D11 = [ -p_m, -p_c/m_nom, -p_k/m_nom + 0, 0, 0 + 0, 0, 0 ]; + +D12 = [ 1/m_nom + 0 + 0 ]; + +D21 = [ 0, 0, 0 ]; + +D22 = [ 0 ]; + +inname = {'u_m', 'u_c', 'u_k', 'u'}; % input names +outname = {'y_m', 'y_c', 'y_k', 'y'}; % output names + +G_nom = ss (A, [B1, B2], [C1; C2], [D11, D12; D21, D22], ... + 'inputname', inname, 'outputname', outname); + +G = G_nom(4, 4); % extract output y and input u + + +% =============================================================================== +% Frequency Analysis of Uncertain System +% =============================================================================== + +% Uncertainties: -1 <= delta_m, delta_c, delta_k <= 1 +[delta_m, delta_c, delta_k] = ndgrid ([-1, 0, 1], [-1, 0, 1], [-1, 0, 1]); + +% Bode Plots of Perturbed Plants +w = logspace (-1, 1, 100); % frequency vector +figure (1) + +for k = 1 : numel (delta_m) + Delta = diag ([delta_m(k), delta_c(k), delta_k(k)]); + G_per = lft (Delta, G_nom); + bode (G_per, w) + subplot (2, 1, 1) + hold on + subplot (2, 1, 2) + hold on +endfor + + +% =============================================================================== +% Mixed Sensitivity H-infinity Controller Design (S over KS Method) +% =============================================================================== +% +-------+ +% +--------------------->| W_p |----------> e_p +% | +-------+ +% | +-------+ +% | +---->| W_u |----------> e_u +% | | +-------+ +% | | +---------+ +% | | ->| |-> +% r + e | +-------+ u | | G_nom | +% ----->(+)---+-->| K |----+--->| |----+----> y +% ^ - +-------+ +---------+ | +% | | +% +-----------------------------------------+ + +% Weighting Functions +s = tf ('s'); % transfer function variable +W_p = 0.95 * (s^2 + 1.8*s + 10) / (s^2 + 8.0*s + 0.01); % performance weighting +W_u = 10^-2; % control weighting + +% Synthesis +K = mixsyn (G, W_p, W_u); % mixed-sensitivity H-infinity synthesis + +% Interconnections +L = G * K; % open loop +T = feedback (L); % closed loop + +% Plotting +figure (2) +sigma (T) % singular values + +figure (3) +step (T) % step response + + +% =============================================================================== +% H-infinity Loop-Shaping Design +% =============================================================================== + +% Settings +W1 = 8 * (2*s + 1) / (0.9*s); % precompensator +W2 = 1; % postcompensator +factor = 1.1; % suboptimal controller + +% Synthesis +K = ncfsyn (G, W1, W2, factor); % positive feedback controller + +% Interconnections +K = -K; % negative feedback controller +L = G * K; % open loop +T = feedback (L); % closed loop + +% Plotting +figure (4) +sigma (T) % singular values + +figure (5) +step (T) % step response + +% =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-05 12:14:26
|
Revision: 8434 http://octave.svn.sourceforge.net/octave/?rev=8434&view=rev Author: paramaniac Date: 2011-08-05 12:14:15 +0000 (Fri, 05 Aug 2011) Log Message: ----------- control: move ncfsyn into place Modified Paths: -------------- trunk/octave-forge/main/control/inst/test_control.m trunk/octave-forge/main/control/src/Makefile Added Paths: ----------- trunk/octave-forge/main/control/devel/makefile_ncfsyn.m trunk/octave-forge/main/control/inst/ncfsyn.m trunk/octave-forge/main/control/src/SB10ID.f trunk/octave-forge/main/control/src/SB10JD.f trunk/octave-forge/main/control/src/SB10KD.f trunk/octave-forge/main/control/src/SB10ZD.f trunk/octave-forge/main/control/src/slsb10id.cc trunk/octave-forge/main/control/src/slsb10kd.cc trunk/octave-forge/main/control/src/slsb10zd.cc Removed Paths: ------------- trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.dat trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.f trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.res trunk/octave-forge/main/control/devel/ncfsyn/SB10JD.f trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.dat trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.f trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.res trunk/octave-forge/main/control/devel/ncfsyn/SB10ZD.dat trunk/octave-forge/main/control/devel/ncfsyn/SB10ZD.f trunk/octave-forge/main/control/devel/ncfsyn/SB10ZD.res trunk/octave-forge/main/control/devel/ncfsyn/common.cc trunk/octave-forge/main/control/devel/ncfsyn/makefile_ncfsyn.m trunk/octave-forge/main/control/devel/ncfsyn/ncfsyn.m trunk/octave-forge/main/control/devel/ncfsyn/slsb10id.cc trunk/octave-forge/main/control/devel/ncfsyn/slsb10kd.cc trunk/octave-forge/main/control/devel/ncfsyn/slsb10zd.cc Copied: trunk/octave-forge/main/control/devel/makefile_ncfsyn.m (from rev 8433, trunk/octave-forge/main/control/devel/ncfsyn/makefile_ncfsyn.m) =================================================================== --- trunk/octave-forge/main/control/devel/makefile_ncfsyn.m (rev 0) +++ trunk/octave-forge/main/control/devel/makefile_ncfsyn.m 2011-08-05 12:14:15 UTC (rev 8434) @@ -0,0 +1,22 @@ +## H-infinity loop shaping - continuous-time +mkoctfile "-Wl,-framework" "-Wl,vecLib" \ + slsb10id.cc \ + SB10ID.f SB02RD.f select.f SB10JD.f MB02VD.f \ + MA02GD.f SB02MS.f MA02ED.f SB02RU.f SB02SD.f \ + MB01RU.f SB02QD.f SB02MV.f SB02MW.f SB02MR.f \ + MA02AD.f MB02PD.f MB01SD.f MB01UD.f SB03SY.f \ + MB01RX.f SB03MX.f SB03SX.f MB01RY.f SB03QY.f \ + SB03QX.f SB03MY.f SB04PX.f SB03MV.f SB03MW.f + +## H-infinity loop shaping - discrete-time - strictly proper case +mkoctfile "-Wl,-framework" "-Wl,vecLib" \ + slsb10kd.cc \ + SB10KD.f SB02OD.f select.f SB02OY.f SB02OW.f \ + SB02OV.f SB02MV.f SB02OU.f SB02MR.f + +## H-infinity loop shaping - discrete-time - proper case +mkoctfile "-Wl,-framework" "-Wl,vecLib" \ + slsb10zd.cc \ + SB10ZD.f MA02AD.f SB02OD.f select.f MB01RX.f \ + MB02VD.f SB02OY.f SB02OW.f SB02OV.f SB02OU.f \ + SB02MR.f MA02GD.f SB02MV.f \ No newline at end of file Deleted: trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.dat =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.dat 2011-08-05 11:57:01 UTC (rev 8433) +++ trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.dat 2011-08-05 12:14:15 UTC (rev 8434) @@ -1,21 +0,0 @@ - SB10ID EXAMPLE PROGRAM DATA - 6 2 3 - -1.0 0.0 4.0 5.0 -3.0 -2.0 - -2.0 4.0 -7.0 -2.0 0.0 3.0 - -6.0 9.0 -5.0 0.0 2.0 -1.0 - -8.0 4.0 7.0 -1.0 -3.0 0.0 - 2.0 5.0 8.0 -9.0 1.0 -4.0 - 3.0 -5.0 8.0 0.0 2.0 -6.0 - -3.0 -4.0 - 2.0 0.0 - -5.0 -7.0 - 4.0 -6.0 - -3.0 9.0 - 1.0 -2.0 - 1.0 -1.0 2.0 -4.0 0.0 -3.0 - -3.0 0.0 5.0 -1.0 1.0 1.0 - -7.0 5.0 0.0 -8.0 2.0 -2.0 - 1.0 -2.0 - 0.0 4.0 - 5.0 -3.0 - 1.0 Deleted: trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.f =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.f 2011-08-05 11:57:01 UTC (rev 8433) +++ trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.f 2011-08-05 12:14:15 UTC (rev 8434) @@ -1,584 +0,0 @@ - SUBROUTINE SB10ID( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, - $ FACTOR, NK, AK, LDAK, BK, LDBK, CK, LDCK, - $ DK, LDDK, RCOND, IWORK, DWORK, LDWORK, BWORK, - $ INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the matrices of the positive feedback controller -C -C | Ak | Bk | -C K = |----|----| -C | Ck | Dk | -C -C for the shaped plant -C -C | A | B | -C G = |---|---| -C | C | D | -C -C in the McFarlane/Glover Loop Shaping Design Procedure. -C -C ARGUMENTS -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the plant. N >= 0. -C -C M (input) INTEGER -C The column size of the matrix B. M >= 0. -C -C NP (input) INTEGER -C The row size of the matrix C. NP >= 0. -C -C A (input) DOUBLE PRECISION array, dimension (LDA,N) -C The leading N-by-N part of this array must contain the -C system state matrix A of the shaped plant. -C -C LDA INTEGER -C The leading dimension of the array A. LDA >= max(1,N). -C -C B (input) DOUBLE PRECISION array, dimension (LDB,M) -C The leading N-by-M part of this array must contain the -C system input matrix B of the shaped plant. -C -C LDB INTEGER -C The leading dimension of the array B. LDB >= max(1,N). -C -C C (input) DOUBLE PRECISION array, dimension (LDC,N) -C The leading NP-by-N part of this array must contain the -C system output matrix C of the shaped plant. -C -C LDC INTEGER -C The leading dimension of the array C. LDC >= max(1,NP). -C -C D (input) DOUBLE PRECISION array, dimension (LDD,M) -C The leading NP-by-M part of this array must contain the -C system matrix D of the shaped plant. -C -C LDD INTEGER -C The leading dimension of the array D. LDD >= max(1,NP). -C -C FACTOR (input) DOUBLE PRECISION -C = 1 implies that an optimal controller is required; -C > 1 implies that a suboptimal controller is required, -C achieving a performance FACTOR less than optimal. -C FACTOR >= 1. -C -C NK (output) INTEGER -C The order of the positive feedback controller. NK <= N. -C -C AK (output) DOUBLE PRECISION array, dimension (LDAK,N) -C The leading NK-by-NK part of this array contains the -C controller state matrix Ak. -C -C LDAK INTEGER -C The leading dimension of the array AK. LDAK >= max(1,N). -C -C BK (output) DOUBLE PRECISION array, dimension (LDBK,NP) -C The leading NK-by-NP part of this array contains the -C controller input matrix Bk. -C -C LDBK INTEGER -C The leading dimension of the array BK. LDBK >= max(1,N). -C -C CK (output) DOUBLE PRECISION array, dimension (LDCK,N) -C The leading M-by-NK part of this array contains the -C controller output matrix Ck. -C -C LDCK INTEGER -C The leading dimension of the array CK. LDCK >= max(1,M). -C -C DK (output) DOUBLE PRECISION array, dimension (LDDK,NP) -C The leading M-by-NP part of this array contains the -C controller matrix Dk. -C -C LDDK INTEGER -C The leading dimension of the array DK. LDDK >= max(1,M). -C -C RCOND (output) DOUBLE PRECISION array, dimension (2) -C RCOND(1) contains an estimate of the reciprocal condition -C number of the X-Riccati equation; -C RCOND(2) contains an estimate of the reciprocal condition -C number of the Z-Riccati equation. -C -C Workspace -C -C IWORK INTEGER array, dimension max(2*N,N*N,M,NP) -C -C DWORK DOUBLE PRECISION array, dimension (LDWORK) -C On exit, if INFO = 0, DWORK(1) contains the optimal value -C of LDWORK. -C -C LDWORK INTEGER -C The dimension of the array DWORK. -C LDWORK >= 4*N*N + M*M + NP*NP + 2*M*N + N*NP + 4*N + -C max( 6*N*N + 5 + max(1,4*N*N+8*N), N*NP + 2*N ). -C For good performance, LDWORK must generally be larger. -C An upper bound of LDWORK in the above formula is -C LDWORK >= 10*N*N + M*M + NP*NP + 2*M*N + 2*N*NP + 4*N + -C 5 + max(1,4*N*N+8*N). -C -C BWORK LOGICAL array, dimension (2*N) -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C = 1: the X-Riccati equation is not solved successfully; -C = 2: the Z-Riccati equation is not solved successfully; -C = 3: the iteration to compute eigenvalues or singular -C values failed to converge; -C = 4: the matrix Ip - D*Dk is singular; -C = 5: the matrix Im - Dk*D is singular; -C = 6: the closed-loop system is unstable. -C -C METHOD -C -C The routine implements the formulas given in [1]. -C -C REFERENCES -C -C [1] McFarlane, D. and Glover, K. -C A loop shaping design procedure using H_infinity synthesis. -C IEEE Trans. Automat. Control, vol. AC-37, no. 6, pp. 759-769, -C 1992. -C -C NUMERICAL ASPECTS -C -C The accuracy of the results depends on the conditioning of the -C two Riccati equations solved in the controller design (see the -C output parameter RCOND). -C -C CONTRIBUTORS -C -C P.Hr. Petkov, D.W. Gu and M.M. Konstantinov, October 2000. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Oct. 2000, -C Feb. 2001. -C -C KEYWORDS -C -C H_infinity control, Loop-shaping design, Robust control. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) -C .. -C .. Scalar Arguments .. - INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDD, - $ LDDK, LDWORK, M, N, NK, NP - DOUBLE PRECISION FACTOR -C .. -C .. Array Arguments .. - INTEGER IWORK( * ) - LOGICAL BWORK( * ) - DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), - $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), - $ D( LDD, * ), DK( LDDK, * ), DWORK( * ), - $ RCOND( 2 ) -C .. -C .. Local Scalars .. - CHARACTER*1 HINV - INTEGER I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, - $ I11, I12, I13, INFO2, IWRK, J, LWA, LWAMAX, - $ MINWRK, N2, NS, SDIM - DOUBLE PRECISION SEP, FERR, GAMMA -C .. -C .. External Functions .. - LOGICAL SELECT - EXTERNAL SELECT -C .. -C .. External Subroutines .. - EXTERNAL DGEES, DGEMM, DLACPY, DLASET, DPOTRF, DPOTRS, - $ DSYRK, DTRSM, MB02VD, SB02RD, SB10JD, XERBLA -C .. -C .. Intrinsic Functions .. - INTRINSIC DBLE, INT, MAX, SQRT -C .. -C .. Executable Statements .. -C -C Decode and Test input parameters. -C - INFO = 0 - IF( N.LT.0 ) THEN - INFO = -1 - ELSE IF( M.LT.0 ) THEN - INFO = -2 - ELSE IF( NP.LT.0 ) THEN - INFO = -3 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -5 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -7 - ELSE IF( LDC.LT.MAX( 1, NP ) ) THEN - INFO = -9 - ELSE IF( LDD.LT.MAX( 1, NP ) ) THEN - INFO = -11 - ELSE IF( FACTOR.LT.ONE ) THEN - INFO = -12 - ELSE IF( LDAK.LT.MAX( 1, N ) ) THEN - INFO = -15 - ELSE IF( LDBK.LT.MAX( 1, N ) ) THEN - INFO = -17 - ELSE IF( LDCK.LT.MAX( 1, M ) ) THEN - INFO = -19 - ELSE IF( LDDK.LT.MAX( 1, M ) ) THEN - INFO = -21 - END IF -C -C Compute workspace. -C - MINWRK = 4*N*N + M*M + NP*NP + 2*M*N + N*NP + 4*N + - $ MAX( 6*N*N + 5 + MAX( 1, 4*N*N + 8*N ), N*NP + 2*N ) - IF( LDWORK.LT.MINWRK ) THEN - INFO = -25 - END IF - IF( INFO.NE.0 ) THEN - CALL XERBLA( 'SB10ID', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF( N.EQ.0 .OR. M.EQ.0 .OR. NP.EQ.0 ) THEN - RCOND( 1 ) = ONE - RCOND( 2 ) = ONE - DWORK( 1 ) = ONE - RETURN - END IF -C -C Workspace usage. -C - I1 = N*N - I2 = I1 + N*N - I3 = I2 + M*N - I4 = I3 + M*N - I5 = I4 + M*M - I6 = I5 + NP*NP - I7 = I6 + NP*N - I8 = I7 + N*N - I9 = I8 + N*N - I10 = I9 + N*N - I11 = I10 + N*N - I12 = I11 + 2*N - I13 = I12 + 2*N -C - IWRK = I13 + 4*N*N -C -C Compute D'*C . -C - CALL DGEMM( 'T', 'N', M, N, NP, ONE, D, LDD, C, LDC, ZERO, - $ DWORK( I2+1 ), M ) -C -C Compute S = Im + D'*D . -C - CALL DLASET( 'U', M, M, ZERO, ONE, DWORK( I4+1 ), M ) - CALL DSYRK( 'U', 'T', M, NP, ONE, D, LDD, ONE, DWORK( I4+1 ), M ) -C -C Factorize S, S = T'*T, with T upper triangular. -C - CALL DPOTRF( 'U', M, DWORK( I4+1 ), M, INFO2 ) -C -C -1 -C Compute S D'*C . -C - CALL DPOTRS( 'U', M, N, DWORK( I4+1 ), M, DWORK( I2+1 ), M, - $ INFO2 ) -C -C -1 -C Compute B*T . -C - CALL DLACPY( 'F', N, M, B, LDB, DWORK( I3+1 ), N ) - CALL DTRSM( 'R', 'U', 'N', 'N', N, M, ONE, DWORK( I4+1 ), M, - $ DWORK( I3+1 ), N ) -C -C Compute R = Ip + D*D' . -C - CALL DLASET( 'U', NP, NP, ZERO, ONE, DWORK( I5+1 ), NP ) - CALL DSYRK( 'U', 'N', NP, M, ONE, D, LDD, ONE, DWORK( I5+1 ), NP ) -C -C Factorize R, R = U'*U, with U upper triangular. -C - CALL DPOTRF( 'U', NP, DWORK( I5+1 ), NP, INFO2 ) -C -C -T -C Compute U C . -C - CALL DLACPY( 'F', NP, N, C, LDC, DWORK( I6+1 ), NP ) - CALL DTRSM( 'L', 'U', 'T', 'N', NP, N, ONE, DWORK( I5+1 ), NP, - $ DWORK( I6+1 ), NP ) -C -C -1 -C Compute Ar = A - B*S D'*C . -C - CALL DLACPY( 'F', N, N, A, LDA, DWORK( I7+1 ), N ) - CALL DGEMM( 'N', 'N', N, N, M, -ONE, B, LDB, DWORK( I2+1 ), M, - $ ONE, DWORK( I7+1 ), N ) -C -C -1 -C Compute the upper triangle of Cr = C'*R *C . -C - CALL DSYRK( 'U', 'T', N, NP, ONE, DWORK( I6+1 ), NP, ZERO, - $ DWORK( I8+1 ), N ) -C -C -1 -C Compute the upper triangle of Dr = B*S B' . -C - CALL DSYRK( 'U', 'N', N, M, ONE, DWORK( I3+1 ), N, ZERO, - $ DWORK( I9+1 ), N ) -C -C Solution of the Riccati equation Ar'*X + X*Ar + Cr - X*Dr*X = 0 . -C Workspace: need 10*N*N + M*M + NP*NP + 2*M*N + N*NP + 4*N + -C 5 + max(1,4*N*N+8*N). -C prefer larger. -C AK is used as workspace. -C - N2 = 2*N - CALL SB02RD( 'A', 'C', HINV, 'N', 'U', 'G', 'S', 'N', 'O', N, - $ DWORK( I7+1 ), N, DWORK( I10+1 ), N, AK, LDAK, - $ DWORK( I9+1 ), N, DWORK( I8+1 ), N, DWORK, N, SEP, - $ RCOND( 1 ), FERR, DWORK( I11+1 ), DWORK( I12+1 ), - $ DWORK( I13+1 ), N2, IWORK, DWORK( IWRK+1 ), - $ LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 1 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( MINWRK, LWA ) -C -C Solution of the Riccati equation Ar*Z + Z*Ar' + Dr - Z*Cr*Z = 0 . -C - CALL SB02RD( 'A', 'C', HINV, 'T', 'U', 'G', 'S', 'N', 'O', N, - $ DWORK( I7+1 ), N, DWORK( I10+1 ), N, AK, LDAK, - $ DWORK( I8+1 ), N, DWORK( I9+1 ), N, DWORK( I1+1 ), - $ N, SEP, RCOND( 2 ), FERR, DWORK( I11+1 ), - $ DWORK( I12+1 ), DWORK( I13+1 ), N2, IWORK, - $ DWORK( IWRK+1 ), LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 2 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -C -1 -1 -C Compute F1 = -( S D'*C + S B'*X ) . -C - CALL DTRSM( 'R', 'U', 'T', 'N', N, M, ONE, DWORK( I4+1 ), M, - $ DWORK( I3+1 ), N ) - CALL DGEMM( 'T', 'N', M, N, N, -ONE, DWORK( I3+1 ), N, DWORK, N, - $ -ONE, DWORK( I2+1 ), M ) -C -C Compute gamma . -C - CALL DGEMM( 'N', 'N', N, N, N, ONE, DWORK, N, DWORK( I1+1 ), N, - $ ZERO, DWORK( I7+1 ), N ) - CALL DGEES( 'N', 'N', SELECT, N, DWORK( I7+1 ), N, SDIM, - $ DWORK( I11+1 ), DWORK( I12+1 ), DWORK( IWRK+1 ), N, - $ DWORK( IWRK+1 ), LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 3 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) - GAMMA = ZERO - DO 10 I = 1, N - GAMMA = MAX( GAMMA, DWORK( I11+I ) ) - 10 CONTINUE - GAMMA = FACTOR*SQRT( ONE + GAMMA ) -C -C Workspace usage. -C Workspace: need 4*N*N + M*N + N*NP. -C - I4 = I3 + N*N - I5 = I4 + N*N -C -C Compute Ac = A + B*F1 . -C - CALL DLACPY( 'F', N, N, A, LDA, DWORK( I4+1 ), N ) - CALL DGEMM( 'N', 'N', N, N, M, ONE, B, LDB, DWORK( I2+1 ), M, - $ ONE, DWORK( I4+1 ), N ) -C -C Compute W1' = (1-gamma^2)*In + Z*X . -C - CALL DLASET( 'F', N, N, ZERO, ONE-GAMMA*GAMMA, DWORK( I3+1 ), N ) - CALL DGEMM( 'N', 'N', N, N, N, ONE, DWORK( I1+1 ), N, DWORK, N, - $ ONE, DWORK( I3+1 ), N ) -C -C Compute Bcp = gamma^2*Z*C' . -C - CALL DGEMM( 'N', 'T', N, NP, N, GAMMA*GAMMA, DWORK( I1+1 ), N, C, - $ LDC, ZERO, BK, LDBK ) -C -C Compute C + D*F1 . -C - CALL DLACPY( 'F', NP, N, C, LDC, DWORK( I5+1 ), NP ) - CALL DGEMM( 'N', 'N', NP, N, M, ONE, D, LDD, DWORK( I2+1 ), M, - $ ONE, DWORK( I5+1 ), NP ) -C -C Compute Acp = W1'*Ac + gamma^2*Z*C'*(C+D*F1) . -C - CALL DGEMM( 'N', 'N', N, N, N, ONE, DWORK( I3+1 ), N, - $ DWORK( I4+1 ), N, ZERO, AK, LDAK ) - CALL DGEMM( 'N', 'N', N, N, NP, ONE, BK, LDBK, - $ DWORK( I5+1 ), NP, ONE, AK, LDAK ) -C -C Compute Ccp = B'*X . -C - CALL DGEMM( 'T', 'N', M, N, N, ONE, B, LDB, DWORK, N, ZERO, - $ CK, LDCK ) -C -C Set Dcp = -D' . -C - DO 30 I = 1, M - DO 20 J = 1, NP - DK( I, J ) = -D( J, I ) - 20 CONTINUE - 30 CONTINUE -C - IWRK = I4 -C -C Reduce the generalized state-space description to a regular one. -C Workspace: need 3*N*N + M*N. -C Additional workspace: need 2*N*N + 2*N + N*MAX(5,N+M+NP). -C prefer larger. -C - CALL SB10JD( N, NP, M, AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, - $ DWORK( I3+1 ), N, NK, DWORK( IWRK+1 ), LDWORK-IWRK, - $ INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 3 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -C Workspace usage. -C Workspace: need 4*N*N + M*M + NP*NP + 2*M*N + 2*N*NP. -C (NK <= N.) -C - I2 = NP*NP - I3 = I2 + NK*NP - I4 = I3 + M*M - I5 = I4 + N*M - I6 = I5 + NP*NK - I7 = I6 + M*N -C - IWRK = I7 + ( N + NK )*( N + NK ) -C -C Compute Ip - D*Dk . -C - CALL DLASET( 'Full', NP, NP, ZERO, ONE, DWORK, NP ) - CALL DGEMM( 'N', 'N', NP, NP, M, -ONE, D, LDD, DK, LDDK, ONE, - $ DWORK, NP ) -C -C -1 -C Compute Bk*(Ip-D*Dk) . -C - CALL DLACPY( 'F', NK, NP, BK, LDBK, DWORK( I2+1 ), NK ) - CALL MB02VD( 'N', NK, NP, DWORK, NP, IWORK, DWORK( I2+1 ), NK, - $ INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 4 - RETURN - END IF -C -C Compute Im - Dk*D . -C - CALL DLASET( 'Full', M, M, ZERO, ONE, DWORK( I3+1 ), M ) - CALL DGEMM( 'N', 'N', M, M, NP, -ONE, DK, LDDK, D, LDD, ONE, - $ DWORK( I3+1 ), M ) -C -C -1 -C Compute B*(Im-Dk*D) . -C - CALL DLACPY( 'F', N, M, B, LDB, DWORK( I4+1 ), N ) - CALL MB02VD( 'N', N, M, DWORK( I3+1 ), M, IWORK, DWORK( I4+1 ), N, - $ INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 5 - RETURN - END IF -C -C Compute D*Ck . -C - CALL DGEMM( 'N', 'N', NP, NK, M, ONE, D, LDD, CK, LDCK, ZERO, - $ DWORK( I5+1 ), NP ) -C -C Compute Dk*C . -C - CALL DGEMM( 'N', 'N', M, N, NP, ONE, DK, LDDK, C, LDC, ZERO, - $ DWORK( I6+1 ), M ) -C -C Compute the closed-loop state matrix. -C - CALL DLACPY( 'F', N, N, A, LDA, DWORK( I7+1 ), N+NK ) - CALL DGEMM( 'N', 'N', N, N, M, ONE, DWORK( I4+1 ), N, - $ DWORK( I6+1 ), M, ONE, DWORK( I7+1 ), N+NK ) - CALL DGEMM( 'N', 'N', NK, N, NP, ONE, DWORK( I2+1 ), NK, C, LDC, - $ ZERO, DWORK( I7+N+1 ), N+NK ) - CALL DGEMM( 'N', 'N', N, NK, M, ONE, DWORK( I4+1 ), N, CK, LDCK, - $ ZERO, DWORK( I7+(N+NK)*N+1 ), N+NK ) - CALL DLACPY( 'F', NK, NK, AK, LDAK, DWORK( I7+(N+NK)*N+N+1 ), - $ N+NK ) - CALL DGEMM( 'N', 'N', NK, NK, NP, ONE, DWORK( I2+1 ), NK, - $ DWORK( I5+1 ), NP, ONE, DWORK( I7+(N+NK)*N+N+1 ), - $ N+NK ) -C -C Compute the closed-loop poles. -C Additional workspace: need 3*(N+NK); prefer larger. -C The fact that M > 0, NP > 0, and NK <= N is used here. -C - CALL DGEES( 'N', 'N', SELECT, N+NK, DWORK( I7+1 ), N+NK, SDIM, - $ DWORK, DWORK( N+NK+1 ), DWORK( IWRK+1 ), N, - $ DWORK( IWRK+1 ), LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 3 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -C Check the stability of the closed-loop system. -C - NS = 0 - DO 40 I = 1, N+NK - IF( DWORK( I ).GE.ZERO ) NS = NS + 1 - 40 CONTINUE - IF( NS.GT.0 ) THEN - INFO = 6 - RETURN - END IF -C - DWORK( 1 ) = DBLE( LWAMAX ) - RETURN -C *** Last line of SB10ID *** - END Deleted: trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.res =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.res 2011-08-05 11:57:01 UTC (rev 8433) +++ trunk/octave-forge/main/control/devel/ncfsyn/SB10ID.res 2011-08-05 12:14:15 UTC (rev 8434) @@ -1,32 +0,0 @@ - SB10ID EXAMPLE PROGRAM RESULTS - - - The controller state matrix AK is - - -39.0671 9.9293 22.2322 -27.4113 43.8655 - -6.6117 3.0006 11.0878 -11.4130 15.4269 - 33.6805 -6.6934 -23.9953 14.1438 -33.4358 - -32.3191 9.7316 25.4033 -24.0473 42.0517 - -44.1655 18.7767 34.8873 -42.4369 50.8437 - - The controller input matrix BK is - - -10.2905 -16.5382 -10.9782 - -4.3598 -8.7525 -5.1447 - 6.5962 1.8975 6.2316 - -9.8770 -14.7041 -11.8778 - -9.6726 -22.7309 -18.2692 - - The controller output matrix CK is - - -0.6647 -0.0599 -1.0376 0.5619 1.7297 - -8.4202 3.9573 7.3094 -7.6283 10.6768 - - The controller matrix DK is - - 0.8466 0.4979 -0.6993 - -1.2226 -4.8689 -4.5056 - - The estimated condition numbers are - - 0.13861D-01 0.90541D-02 Deleted: trunk/octave-forge/main/control/devel/ncfsyn/SB10JD.f =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/SB10JD.f 2011-08-05 11:57:01 UTC (rev 8433) +++ trunk/octave-forge/main/control/devel/ncfsyn/SB10JD.f 2011-08-05 12:14:15 UTC (rev 8434) @@ -1,355 +0,0 @@ - SUBROUTINE SB10JD( N, M, NP, A, LDA, B, LDB, C, LDC, D, LDD, E, - $ LDE, NSYS, DWORK, LDWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To convert the descriptor state-space system -C -C E*dx/dt = A*x + B*u -C y = C*x + D*u -C -C into regular state-space form -C -C dx/dt = Ad*x + Bd*u -C y = Cd*x + Dd*u . -C -C ARGUMENTS -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the descriptor system. N >= 0. -C -C M (input) INTEGER -C The column size of the matrix B. M >= 0. -C -C NP (input) INTEGER -C The row size of the matrix C. NP >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the state matrix A of the descriptor system. -C On exit, the leading NSYS-by-NSYS part of this array -C contains the state matrix Ad of the converted system. -C -C LDA INTEGER -C The leading dimension of the array A. LDA >= max(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (LDB,M) -C On entry, the leading N-by-M part of this array must -C contain the input matrix B of the descriptor system. -C On exit, the leading NSYS-by-M part of this array -C contains the input matrix Bd of the converted system. -C -C LDB INTEGER -C The leading dimension of the array B. LDB >= max(1,N). -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading NP-by-N part of this array must -C contain the output matrix C of the descriptor system. -C On exit, the leading NP-by-NSYS part of this array -C contains the output matrix Cd of the converted system. -C -C LDC INTEGER -C The leading dimension of the array C. LDC >= max(1,NP). -C -C D (input/output) DOUBLE PRECISION array, dimension (LDD,M) -C On entry, the leading NP-by-M part of this array must -C contain the matrix D of the descriptor system. -C On exit, the leading NP-by-M part of this array contains -C the matrix Dd of the converted system. -C -C LDD INTEGER -C The leading dimension of the array D. LDD >= max(1,NP). -C -C E (input/output) DOUBLE PRECISION array, dimension (LDE,N) -C On entry, the leading N-by-N part of this array must -C contain the matrix E of the descriptor system. -C On exit, this array contains no useful information. -C -C LDE INTEGER -C The leading dimension of the array E. LDE >= max(1,N). -C -C NSYS (output) INTEGER -C The order of the converted state-space system. -C -C Workspace -C -C DWORK DOUBLE PRECISION array, dimension (LDWORK) -C On exit, if INFO = 0, DWORK(1) contains the optimal value -C of LDWORK. -C -C LDWORK INTEGER -C The dimension of the array DWORK. -C LDWORK >= max( 1, 2*N*N + 2*N + N*MAX( 5, N + M + NP ) ). -C For good performance, LDWORK must generally be larger. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C = 1: the iteration for computing singular value -C decomposition did not converge. -C -C METHOD -C -C The routine performs the transformations described in [1]. -C -C REFERENCES -C -C [1] Chiang, R.Y. and Safonov, M.G. -C Robust Control Toolbox User's Guide. -C The MathWorks Inc., Natick, Mass., 1992. -C -C CONTRIBUTORS -C -C P.Hr. Petkov, D.W. Gu and M.M. Konstantinov, October 1999. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Oct. 2000, -C Feb. 2001. -C -C KEYWORDS -C -C Descriptor systems, state-space models. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) -C .. -C .. Scalar Arguments .. - INTEGER INFO, LDA, LDB, LDC, LDD, LDE, LDWORK, M, N, - $ NP, NSYS -C .. -C .. Array Arguments .. - DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), - $ D( LDD, * ), DWORK( * ), E( LDE, * ) -C .. -C .. Local Scalars .. - INTEGER I, IA12, IA21, IB2, IC2, INFO2, IS, ISA, IU, - $ IV, IWRK, J, K, LWA, LWAMAX, MINWRK, NS1 - DOUBLE PRECISION EPS, SCALE, TOL -C .. -C .. External Functions .. - DOUBLE PRECISION DLAMCH - EXTERNAL DLAMCH -C .. -C .. External Subroutines .. - EXTERNAL DGEMM, DGESVD, DLACPY, DLASET, DSCAL, XERBLA -C .. -C .. Intrinsic Functions .. - INTRINSIC DBLE, INT, MAX, SQRT -C .. -C .. Executable Statements .. -C -C Decode and Test input parameters. -C - INFO = 0 - IF( N.LT.0 ) THEN - INFO = -1 - ELSE IF( M.LT.0 ) THEN - INFO = -2 - ELSE IF( NP.LT.0 ) THEN - INFO = -3 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -5 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -7 - ELSE IF( LDC.LT.MAX( 1, NP ) ) THEN - INFO = -9 - ELSE IF( LDD.LT.MAX( 1, NP ) ) THEN - INFO = -11 - ELSE IF( LDE.LT.MAX( 1, N ) ) THEN - INFO = -13 - END IF -C -C Compute workspace. -C - MINWRK = MAX( 1, 2*N*( N + 1 ) + N*MAX( 5, N + M + NP ) ) - IF( LDWORK.LT.MINWRK ) THEN - INFO = -16 - END IF - IF( INFO.NE.0 ) THEN - CALL XERBLA( 'SB10JD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF( N.EQ.0 ) THEN - NSYS = 0 - DWORK( 1 ) = ONE - RETURN - END IF -C -C Set tol. -C - EPS = DLAMCH( 'Epsilon' ) - TOL = SQRT( EPS ) -C -C Workspace usage. -C - IS = 0 - IU = IS + N - IV = IU + N*N -C - IWRK = IV + N*N -C -C Compute the SVD of E. -C Additional workspace: need 5*N; prefer larger. -C - CALL DGESVD( 'S', 'S', N, N, E, LDE, DWORK( IS+1 ), DWORK( IU+1 ), - $ N, DWORK( IV+1 ), N, DWORK( IWRK+1 ), LDWORK-IWRK, - $ INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 1 - RETURN - END IF - LWAMAX = MAX( MINWRK, INT( DWORK( IWRK+1 ) + IWRK ) ) -C -C Determine the rank of E. -C - NS1 = 0 - DO 10 I = 1, N - IF( DWORK( IS+I ).GT.TOL ) NS1 = NS1 + 1 - 10 CONTINUE - IF( NS1.GT.0 ) THEN -C -C Transform A. -C Additional workspace: need N*max(N,M,NP). -C - CALL DGEMM( 'T', 'N', N, N, N, ONE, DWORK( IU+1 ), N, A, LDA, - $ ZERO, DWORK( IWRK+1 ), N ) - CALL DGEMM( 'N', 'T', N, N, N, ONE, DWORK( IWRK+1 ), N, - $ DWORK( IV+1 ), N, ZERO, A, LDA ) -C -C Transform B. -C - CALL DLACPY( 'Full', N, M, B, LDB, DWORK( IWRK+1 ), N ) - CALL DGEMM( 'T', 'N', N, M, N, ONE, DWORK( IU+1 ), N, - $ DWORK( IWRK+1 ), N, ZERO, B, LDB ) -C -C Transform C. -C - CALL DLACPY( 'Full', NP, N, C, LDC, DWORK( IWRK+1 ), NP ) - CALL DGEMM( 'N', 'T', NP, N, N, ONE, DWORK( IWRK+1 ), NP, - $ DWORK( IV+1 ), N, ZERO, C, LDC ) -C - K = N - NS1 - IF( K.GT.0 ) THEN - ISA = IU + K*K - IV = ISA + K - IWRK = IV + K*MAX( K, NS1 ) -C -C Compute the SVD of A22. -C Additional workspace: need 5*K; prefer larger. -C - CALL DGESVD( 'S', 'S', K, K, A( NS1+1, NS1+1 ), LDA, - $ DWORK( ISA+1 ), DWORK( IU+1 ), K, - $ DWORK( IV+1 ), K, DWORK( IWRK+1 ), LDWORK-IWRK, - $ INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 1 - RETURN - END IF - IA12 = IWRK - IB2 = IA12 + NS1*K - IC2 = IB2 + K*M -C - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX, IC2 + K*NP ) -C -C Compute the transformed A12. -C - CALL DGEMM( 'N', 'T', NS1, K, K, ONE, A( 1, NS1+1 ), LDA, - $ DWORK( IV+1 ), K, ZERO, DWORK( IA12+1 ), NS1 ) -C -C Compute CC2. -C - CALL DGEMM( 'N', 'T', NP, K, K, ONE, C( 1, NS1+1 ), LDC, - $ DWORK( IV+1 ), K, ZERO, DWORK( IC2+1 ), NP ) -C -C Compute the transformed A21. -C - IA21 = IV - CALL DGEMM( 'T', 'N', K, NS1, K, ONE, DWORK( IU+1 ), K, - $ A( NS1+1, 1 ), LDA, ZERO, DWORK( IA21+1 ), K ) -C -C Compute BB2. -C - CALL DGEMM( 'T', 'N', K, M, K, ONE, DWORK( IU+1 ), K, - $ B( NS1+1, 1 ), LDB, ZERO, DWORK( IB2+1 ), K ) -C -C Compute A12*pinv(A22) and CC2*pinv(A22). -C - DO 20 J = 1, K - SCALE = ZERO - IF( DWORK( ISA+J ).GT.TOL ) SCALE = ONE/DWORK( ISA+J ) - CALL DSCAL( NS1, SCALE, DWORK( IA12+(J-1)*NS1+1 ), 1 ) - CALL DSCAL( NP, SCALE, DWORK( IC2+(J-1)*NP+1 ), 1 ) - 20 CONTINUE -C -C Compute Ad. -C - CALL DGEMM( 'N', 'N', NS1, NS1, K, -ONE, DWORK( IA12+1 ), - $ NS1, DWORK( IA21+1 ), K, ONE, A, LDA ) -C -C Compute Bd. -C - CALL DGEMM( 'N', 'N', NS1, M, K, -ONE, DWORK( IA12+1 ), NS1, - $ DWORK( IB2+1 ), K, ONE, B, LDB ) -C -C Compute Cd. -C - CALL DGEMM( 'N', 'N', NP, NS1, K, -ONE, DWORK( IC2+1 ), NP, - $ DWORK( IA21+1 ), K, ONE, C, LDC ) -C -C Compute Dd. -C - CALL DGEMM( 'N', 'N', NP, M, K, -ONE, DWORK( IC2+1 ), NP, - $ DWORK( IB2+1 ), K, ONE, D, LDD ) - END IF - DO 30 I = 1, NS1 - SCALE = ONE/SQRT( DWORK( IS+I ) ) - CALL DSCAL( NS1, SCALE, A( I, 1 ), LDA ) - CALL DSCAL( M, SCALE, B( I, 1 ), LDB ) - 30 CONTINUE - DO 40 J = 1, NS1 - SCALE = ONE/SQRT( DWORK( IS+J ) ) - CALL DSCAL( NS1, SCALE, A( 1, J ), 1 ) - CALL DSCAL( NP, SCALE, C( 1, J ), 1 ) - 40 CONTINUE - NSYS = NS1 - ELSE - CALL DLASET( 'F', N, N, ZERO, -ONE/EPS, A, LDA ) - CALL DLASET( 'F', N, M, ZERO, ZERO, B, LDB ) - CALL DLASET( 'F', NP, N, ZERO, ZERO, C, LDC ) - NSYS = N - END IF - DWORK( 1 ) = DBLE( LWAMAX ) - RETURN -C *** Last line of SB10JD *** - END Deleted: trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.dat =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.dat 2011-08-05 11:57:01 UTC (rev 8433) +++ trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.dat 2011-08-05 12:14:15 UTC (rev 8434) @@ -1,17 +0,0 @@ - SB10KD EXAMPLE PROGRAM DATA - 6 2 2 - 0.2 0.0 0.3 0.0 -0.3 -0.1 - -0.3 0.2 -0.4 -0.3 0.0 0.0 - -0.1 0.1 -0.1 0.0 0.0 -0.3 - 0.1 0.0 0.0 -0.1 -0.1 0.0 - 0.0 0.3 0.6 0.2 0.1 -0.4 - 0.2 -0.4 0.0 0.0 0.2 -0.2 - -1.0 -2.0 - 1.0 3.0 - -3.0 -4.0 - 1.0 -2.0 - 0.0 1.0 - 1.0 5.0 - 1.0 -1.0 2.0 -2.0 0.0 -3.0 - -3.0 0.0 1.0 -1.0 1.0 -1.0 - 1.1 Deleted: trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.f =================================================================== --- trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.f 2011-08-05 11:57:01 UTC (rev 8433) +++ trunk/octave-forge/main/control/devel/ncfsyn/SB10KD.f 2011-08-05 12:14:15 UTC (rev 8434) @@ -1,650 +0,0 @@ - SUBROUTINE SB10KD( N, M, NP, A, LDA, B, LDB, C, LDC, FACTOR, - $ AK, LDAK, BK, LDBK, CK, LDCK, DK, LDDK, RCOND, - $ IWORK, DWORK, LDWORK, BWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the matrices of the positive feedback controller -C -C | Ak | Bk | -C K = |----|----| -C | Ck | Dk | -C -C for the shaped plant -C -C | A | B | -C G = |---|---| -C | C | 0 | -C -C in the Discrete-Time Loop Shaping Design Procedure. -C -C ARGUMENTS -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the plant. N >= 0. -C -C M (input) INTEGER -C The column size of the matrix B. M >= 0. -C -C NP (input) INTEGER -C The row size of the matrix C. NP >= 0. -C -C A (input) DOUBLE PRECISION array, dimension (LDA,N) -C The leading N-by-N part of this array must contain the -C system state matrix A of the shaped plant. -C -C LDA INTEGER -C The leading dimension of the array A. LDA >= max(1,N). -C -C B (input) DOUBLE PRECISION array, dimension (LDB,M) -C The leading N-by-M part of this array must contain the -C system input matrix B of the shaped plant. -C -C LDB INTEGER -C The leading dimension of the array B. LDB >= max(1,N). -C -C C (input) DOUBLE PRECISION array, dimension (LDC,N) -C The leading NP-by-N part of this array must contain the -C system output matrix C of the shaped plant. -C -C LDC INTEGER -C The leading dimension of the array C. LDC >= max(1,NP). -C -C FACTOR (input) DOUBLE PRECISION -C = 1 implies that an optimal controller is required; -C > 1 implies that a suboptimal controller is required -C achieving a performance FACTOR less than optimal. -C FACTOR >= 1. -C -C AK (output) DOUBLE PRECISION array, dimension (LDAK,N) -C The leading N-by-N part of this array contains the -C controller state matrix Ak. -C -C LDAK INTEGER -C The leading dimension of the array AK. LDAK >= max(1,N). -C -C BK (output) DOUBLE PRECISION array, dimension (LDBK,NP) -C The leading N-by-NP part of this array contains the -C controller input matrix Bk. -C -C LDBK INTEGER -C The leading dimension of the array BK. LDBK >= max(1,N). -C -C CK (output) DOUBLE PRECISION array, dimension (LDCK,N) -C The leading M-by-N part of this array contains the -C controller output matrix Ck. -C -C LDCK INTEGER -C The leading dimension of the array CK. LDCK >= max(1,M). -C -C DK (output) DOUBLE PRECISION array, dimension (LDDK,NP) -C The leading M-by-NP part of this array contains the -C controller matrix Dk. -C -C LDDK INTEGER -C The leading dimension of the array DK. LDDK >= max(1,M). -C -C RCOND (output) DOUBLE PRECISION array, dimension (4) -C RCOND(1) contains an estimate of the reciprocal condition -C number of the linear system of equations from -C which the solution of the P-Riccati equation is -C obtained; -C RCOND(2) contains an estimate of the reciprocal condition -C number of the linear system of equations from -C which the solution of the Q-Riccati equation is -C obtained; -C RCOND(3) contains an estimate of the reciprocal condition -C number of the linear system of equations from -C which the solution of the X-Riccati equation is -C obtained; -C RCOND(4) contains an estimate of the reciprocal condition -C number of the matrix Rx + Bx'*X*Bx (see the -C comments in the code). -C -C Workspace -C -C IWORK INTEGER array, dimension 2*max(N,NP+M) -C -C DWORK DOUBLE PRECISION array, dimension (LDWORK) -C On exit, if INFO = 0, DWORK(1) contains the optimal value -C of LDWORK. -C -C LDWORK INTEGER -C The dimension of the array DWORK. -C LDWORK >= 15*N*N + 6*N + -C max( 14*N+23, 16*N, 2*N+NP+M, 3*(NP+M) ) + -C max( N*N, 11*N*NP + 2*M*M + 8*NP*NP + 8*M*N + -C 4*M*NP + NP ). -C For good performance, LDWORK must generally be larger. -C -C BWORK LOGICAL array, dimension (2*N) -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C = 1: the P-Riccati equation is not solved successfully; -C = 2: the Q-Riccati equation is not solved successfully; -C = 3: the X-Riccati equation is not solved successfully; -C = 4: the iteration to compute eigenvalues failed to -C converge; -C = 5: the matrix Rx + Bx'*X*Bx is singular; -C = 6: the closed-loop system is unstable. -C -C METHOD -C -C The routine implements the method presented in [1]. -C -C REFERENCES -C -C [1] McFarlane, D. and Glover, K. -C A loop shaping design procedure using H_infinity synthesis. -C IEEE Trans. Automat. Control, vol. AC-37, no. 6, pp. 759-769, -C 1992. -C -C NUMERICAL ASPECTS -C -C The accuracy of the results depends on the conditioning of the -C two Riccati equations solved in the controller design. For -C better conditioning it is advised to take FACTOR > 1. -C -C CONTRIBUTORS -C -C P.Hr. Petkov, D.W. Gu and M.M. Konstantinov, October 2000. -C -C REVISIONS -C -C V. Sima, Katholieke University Leuven, January 2001, -C February 2001. -C -C KEYWORDS -C -C H_infinity control, Loop-shaping design, Robust control. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) -C .. -C .. Scalar Arguments .. - INTEGER INFO, LDA, LDAK, LDB, LDBK, LDC, LDCK, LDDK, - $ LDWORK, M, N, NP - DOUBLE PRECISION FACTOR -C .. -C .. Array Arguments .. - INTEGER IWORK( * ) - LOGICAL BWORK( * ) - DOUBLE PRECISION A( LDA, * ), AK( LDAK, * ), B( LDB, * ), - $ BK( LDBK, * ), C( LDC, * ), CK( LDCK, * ), - $ DK( LDDK, * ), DWORK( * ), RCOND( 4 ) -C .. -C .. Local Scalars .. - INTEGER I, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, - $ I11, I12, I13, I14, I15, I16, I17, I18, I19, - $ I20, I21, I22, I23, I24, I25, I26, INFO2, - $ IWRK, J, LWA, LWAMAX, MINWRK, N2, NS, SDIM - DOUBLE PRECISION GAMMA, RNORM -C .. -C .. External Functions .. - LOGICAL SELECT - DOUBLE PRECISION DLANSY, DLAPY2 - EXTERNAL DLANSY, DLAPY2, SELECT -C .. -C .. External Subroutines .. - EXTERNAL DGEMM, DGEES, DLACPY, DLASET, DPOTRF, DPOTRS, - $ DSYCON, DSYEV, DSYRK, DSYTRF, DSYTRS, SB02OD, - $ XERBLA -C .. -C .. Intrinsic Functions .. - INTRINSIC DBLE, INT, MAX, SQRT -C .. -C .. Executable Statements .. -C -C Decode and Test input parameters. -C - INFO = 0 - IF( N.LT.0 ) THEN - INFO = -1 - ELSE IF( M.LT.0 ) THEN - INFO = -2 - ELSE IF( NP.LT.0 ) THEN - INFO = -3 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -5 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -7 - ELSE IF( LDC.LT.MAX( 1, NP ) ) THEN - INFO = -9 - ELSE IF( FACTOR.LT.ONE ) THEN - INFO = -10 - ELSE IF( LDAK.LT.MAX( 1, N ) ) THEN - INFO = -12 - ELSE IF( LDBK.LT.MAX( 1, N ) ) THEN - INFO = -14 - ELSE IF( LDCK.LT.MAX( 1, M ) ) THEN - INFO = -16 - ELSE IF( LDDK.LT.MAX( 1, M ) ) THEN - INFO = -18 - END IF -C -C Compute workspace. -C - MINWRK = 15*N*N + 6*N + MAX( 14*N+23, 16*N, 2*N+NP+M, 3*(NP+M) ) + - $ MAX( N*N, 11*N*NP + 2*M*M + 8*NP*NP + 8*M*N + - $ 4*M*NP + NP ) - IF( LDWORK.LT.MINWRK ) THEN - INFO = -22 - END IF - IF( INFO.NE.0 ) THEN - CALL XERBLA( 'SB10KD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF( N.EQ.0 .OR. M.EQ.0 .OR. NP.EQ.0 ) THEN - RCOND( 1 ) = ONE - RCOND( 2 ) = ONE - RCOND( 3 ) = ONE - RCOND( 4 ) = ONE - DWORK( 1 ) = ONE - RETURN - END IF -C -C Workspace usage. -C - N2 = 2*N - I1 = N*N - I2 = I1 + N*N - I3 = I2 + N*N - I4 = I3 + N*N - I5 = I4 + N2 - I6 = I5 + N2 - I7 = I6 + N2 - I8 = I7 + N2*N2 - I9 = I8 + N2*N2 -C - IWRK = I9 + N2*N2 - LWAMAX = 0 -C -C Compute Cr = C'*C . -C - CALL DSYRK( 'U', 'T', N, NP, ONE, C, LDC, ZERO, DWORK( I2+1 ), N ) -C -C Compute Dr = B*B' . -C - CALL DSYRK( 'U', 'N', N, M, ONE, B, LDB, ZERO, DWORK( I3+1 ), N ) -C -1 -C Solution of the Riccati equation A'*P*(In + Dr*P) *A - P + Cr = 0. -C - CALL SB02OD( 'D', 'G', 'N', 'U', 'Z', 'S', N, M, NP, A, LDA, - $ DWORK( I3+1 ), N, DWORK( I2+1 ), N, DWORK, M, DWORK, - $ N, RCOND( 1 ), DWORK, N, DWORK( I4+1 ), - $ DWORK( I5+1 ), DWORK( I6+1 ), DWORK( I7+1 ), N2, - $ DWORK( I8+1 ), N2, DWORK( I9+1 ), N2, -ONE, IWORK, - $ DWORK( IWRK+1 ), LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 1 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -C Transpose A in AK (used as workspace). -C - DO 40 J = 1, N - DO 30 I = 1, N - AK( I,J ) = A( J,I ) - 30 CONTINUE - 40 CONTINUE -C -1 -C Solution of the Riccati equation A*Q*(In + Cr*Q) *A' - Q + Dr = 0. -C - CALL SB02OD( 'D', 'G', 'N', 'U', 'Z', 'S', N, M, NP, AK, LDAK, - $ DWORK( I2+1 ), N, DWORK( I3+1 ), N, DWORK, M, DWORK, - $ N, RCOND( 2 ), DWORK( I1+1 ), N, DWORK( I4+1 ), - $ DWORK( I5+1 ), DWORK( I6+1 ), DWORK( I7+1 ), N2, - $ DWORK( I8+1 ), N2, DWORK( I9+1 ), N2, -ONE, IWORK, - $ DWORK( IWRK+1 ), LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 2 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -C Compute gamma. -C - CALL DGEMM( 'N', 'N', N, N, N, ONE, DWORK( I1+1 ), N, DWORK, N, - $ ZERO, AK, LDAK ) - CALL DGEES( 'N', 'N', SELECT, N, AK, LDAK, SDIM, DWORK( I6+1 ), - $ DWORK( I7+1 ), DWORK( IWRK+1 ), N, DWORK( IWRK+1 ), - $ LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 4 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) - GAMMA = ZERO - DO 50 I = 1, N - GAMMA = MAX( GAMMA, DWORK( I6+I ) ) - 50 CONTINUE - GAMMA = FACTOR*SQRT( ONE + GAMMA ) -C -C Workspace usage. -C - I3 = I2 + N*NP - I4 = I3 + NP*NP - I5 = I4 + NP*NP - I6 = I5 + NP*NP - I7 = I6 + NP - I8 = I7 + NP*NP - I9 = I8 + NP*NP - I10 = I9 + NP*NP - I11 = I10 + N*NP - I12 = I11 + N*NP - I13 = I12 + ( NP+M )*( NP+M ) - I14 = I13 + N*( NP+M ) - I15 = I14 + N*( NP+M ) - I16 = I15 + N*N - I17 = I16 + N2 - I18 = I17 + N2 - I19 = I18 + N2 - I20 = I19 + ( N2+NP+M )*( N2+NP+M ) - I21 = I20 + ( N2+NP+M )*N2 -C - IWRK = I21 + N2*N2 -C -C Compute Q*C' . -C - CALL DGEMM( 'N', 'T', N, NP, N, ONE, DWORK( I1+1 ), N, C, LDC, - $ ZERO, DWORK( I2+1 ), N ) -C -C Compute Ip + C*Q*C' . -C - CALL DLASET( 'Full', NP, NP, ZERO, ONE, DWORK( I3+1 ), NP ) - CALL DGEMM( 'N', 'N', NP, NP, N, ONE, C, LDC, DWORK( I2+1 ), N, - $ ONE, DWORK( I3+1 ), NP ) -C -C Compute the eigenvalues and eigenvectors of Ip + C'*Q*C -C - CALL DLACPY( 'U', NP, NP, DWORK( I3+1 ), NP, DWORK( I5+1 ), NP ) - CALL DSYEV( 'V', 'U', NP, DWORK( I5+1 ), NP, DWORK( I6+1 ), - $ DWORK( IWRK+1 ), LDWORK-IWRK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 4 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -1 -C Compute ( Ip + C'*Q*C ) . -C - DO 70 J = 1, NP - DO 60 I = 1, NP - DWORK( I9+I+(J-1)*NP ) = DWORK( I5+J+(I-1)*NP ) / - $ DWORK( I6+I ) - 60 CONTINUE - 70 CONTINUE - CALL DGEMM( 'N', 'N', NP, NP, NP, ONE, DWORK( I5+1 ), NP, - $ DWORK( I9+1 ), NP, ZERO, DWORK( I4+1 ), NP ) -C -C Compute Z2 . -C - DO 90 J = 1, NP - DO 80 I = 1, NP - DWORK( I9+I+(J-1)*NP ) = DWORK( I5+J+(I-1)*NP ) / - $ SQRT( DWORK( I6+I ) ) - 80 CONTINUE - 90 CONTINUE - CALL DGEMM( 'N', 'N', NP, NP, NP, ONE, DWORK( I5+1 ), NP, - $ DWORK( I9+1 ), NP, ZERO, DWORK( I7+1 ), NP ) -C -1 -C Compute Z2 . -C - DO 110 J = 1, NP - DO 100 I = 1, NP - DWORK( I9+I+(J-1)*NP ) = DWORK( I5+J+(I-1)*NP )* - $ SQRT( DWORK( I6+I ) ) - 100 CONTINUE - 110 CONTINUE - CALL DGEMM( 'N', 'N', NP, NP, NP, ONE, DWORK( I5+1 ), NP, - $ DWORK( I9+1 ), NP, ZERO, DWORK( I8+1 ), NP ) -C -C Compute A*Q*C' . -C - CALL DGEMM( 'N', 'N', N, NP, N, ONE, A, LDA, DWORK( I2+1 ), N, - $ ZERO, DWORK( I10+1 ), N ) -C -1 -C Compute H = -A*Q*C'*( Ip + C*Q*C' ) . -C - CALL DGEMM( 'N', 'N', N, NP, NP, -ONE, DWORK( I10+1 ), N, - $ DWORK( I4+1 ), NP, ZERO, DWORK( I11+1 ), N ) -C -C Compute Rx . -C - CALL DLASET( 'F', NP+M, NP+M, ZERO, ONE, DWORK( I12+1 ), NP+M ) - DO 130 J = 1, NP - DO 120 I = 1, NP - DWORK( I12+I+(J-1)*(NP+M) ) = DWORK( I3+I+(J-1)*NP ) - 120 CONTINUE - DWORK( I12+J+(J-1)*(NP+M) ) = DWORK( I3+J+(J-1)*NP ) - - $ GAMMA*GAMMA - 130 CONTINUE -C -C Compute Bx . -C - CALL DGEMM( 'N', 'N', N, NP, NP, -ONE, DWORK( I11+1 ), N, - $ DWORK( I8+1 ), NP, ZERO, DWORK( I13+1 ), N ) - DO 150 J = 1, M - DO 140 I = 1, N - DWORK( I13+N*NP+I+(J-1)*N ) = B( I, J ) - 140 CONTINUE - 150 CONTINUE -C -C Compute Sx . -C - CALL DGEMM( 'T', 'N', N, NP, NP, ONE, C, LDC, DWORK( I8+1 ), NP, - $ ZERO, DWORK( I14+1 ), N ) - CALL DLASET( 'F', N, M, ZERO, ZERO, DWORK( I14+N*NP+1 ), N ) -C -C Solve the Riccati equation -C -1 -C X = A'*X*A + Cx - (Sx + A'*X*Bx)*(Rx + Bx'*X*B ) *(Sx'+Bx'*X*A). -C - CALL SB02OD( 'D', 'B', 'C', 'U', 'N', 'S', N, NP+M, NP, A, LDA, - $ DWORK( I13+1 ), N, C, LDC, DWORK( I12+1 ), NP+M, - $ DWORK( I14+1 ), N, RCOND( 3 ), DWORK( I15+1 ), N, - $ DWORK( I16+1 ), DWORK( I17+1 ), DWORK( I18+1 ), - $ DWORK( I19+1 ), N2+NP+M, DWORK( I20+1 ), N2+NP+M, - $ DWORK( I21+1 ), N2, -ONE, IWORK, DWORK( IWRK+1 ), - $ LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 3 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C - I22 = I16 - I23 = I22 + ( NP+M )*N - I24 = I23 + ( NP+M )*( NP+M ) - I25 = I24 + ( NP+M )*N - I26 = I25 + M*N -C - IWRK = I25 -C -C Compute Bx'*X . -C - CALL DGEMM( 'T', 'N', NP+M, N, N, ONE, DWORK( I13+1 ), N, - $ DWORK( I15+1 ), N, ZERO, DWORK( I22+1 ), NP+M ) -C -C Compute Rx + Bx'*X*Bx . -C - CALL DLACPY( 'F', NP+M, NP+M, DWORK( I12+1 ), NP+M, - $ DWORK( I23+1 ), NP+M ) - CALL DGEMM( 'N', 'N', NP+M, NP+M, N, ONE, DWORK( I22+1 ), NP+M, - $ DWORK( I13+1 ), N, ONE, DWORK( I23+1 ), NP+M ) -C -C Compute -( Sx' + Bx'*X*A ) . -C - DO 170 J = 1, N - DO 160 I = 1, NP+M - DWORK( I24+I+(J-1)*(NP+M) ) = DWORK( I14+J+(I-1)*N ) - 160 CONTINUE - 170 CONTINUE - CALL DGEMM( 'N', 'N', NP+M, N, N, -ONE, DWORK( I22+1 ), NP+M, - $ A, LDA, -ONE, DWORK( I24+1 ), NP+M ) -C -C Factorize Rx + Bx'*X*Bx . -C - RNORM = DLANSY( '1', 'U', NP+M, DWORK( I23+1 ), NP+M, - $ DWORK( IWRK+1 ) ) - CALL DSYTRF( 'U', NP+M, DWORK( I23+1 ), NP+M, IWORK, - $ DWORK( IWRK+1 ), LDWORK-IWRK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 5 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) - CALL DSYCON( 'U', NP+M, DWORK( I23+1 ), NP+M, IWORK, RNORM, - $ RCOND( 4 ), DWORK( IWRK+1 ), IWORK( NP+M+1), INFO2 ) -C -1 -C Compute F = -( Rx + Bx'*X*Bx ) ( Sx' + Bx'*X*A ) . -C - CALL DSYTRS( 'U', NP+M, N, DWORK( I23+1 ), NP+M, IWORK, - $ DWORK( I24+1 ), NP+M, INFO2 ) -C -C Compute B'*X . -C - CALL DGEMM( 'T', 'N', M, N, N, ONE, B, LDB, DWORK( I15+1 ), N, - $ ZERO, DWORK( I25+1 ), M ) -C -C Compute Im + B'*X*B . -C - CALL DLASET( 'F', M, M, ZERO, ONE, DWORK( I23+1 ), M ) - CALL DGEMM( 'N', 'N', M, M, N, ONE, DWORK( I25+1 ), M, B, LDB, - $ ONE, DWORK( I23+1 ), M ) -C -C Factorize Im + B'*X*B . -C - CALL DPOTRF( 'U', M, DWORK( I23+1 ), M, INFO2 ) -C -1 -C Compute ( Im + B'*X*B ) B'*X . -C - CALL DPOTRS( 'U', M, N, DWORK( I23+1 ), M, DWORK( I25+1 ), M, - $ INFO2 ) -C -1 -C Compute Dk = ( Im + B'*X*B ) B'*X*H . -C - CALL DGEMM( 'N', 'N', M, NP, N, ONE, DWORK( I25+1 ), M, - $ DWORK( I11+1 ), N, ZERO, DK, LDDK ) -C -C Compute Bk = -H + B*Dk . -C - CALL DLACPY( 'F', N, NP, DWORK( I11+1 ), N, BK, LDBK ) - CALL DGEMM( 'N', 'N', N, NP, M, ONE, B, LDB, DK, LDDK, -ONE, - $ BK, LDBK ) -C -1 -C Compute Dk*Z2 . -C - CALL DGEMM( 'N', 'N', M, NP, NP, ONE, DK, LDDK, DWORK( I8+1 ), - $ NP, ZERO, DWORK( I26+1 ), M ) -C -C Compute F1 + Z2*C . -C - CALL DLACPY( 'F', NP, N, DWORK( I24+1 ), NP+M, DWORK( I12+1 ), - $ NP ) - CALL DGEMM( 'N', 'N', NP, N, NP, ONE, DWORK( I7+1 ), NP, C, LDC, - $ ONE, DWORK( I12+1 ), NP ) -C -1 -C Compute Ck = F2 - Dk*Z2 *( F1 + Z2*C ) . -C - CALL DLACPY( 'F', M, N, DWORK( I24+NP+1 ), NP+M, CK, LDCK ) - CALL DGEMM( 'N', 'N', M, N, NP, -ONE, DWORK( I26+1 ), M, - $ DWORK( I12+1 ), NP, ONE, CK, LDCK ) -C -C Compute Ak = A + H*C + B*Ck . -C - CALL DLACPY( 'F', N, N, A, LDA, AK, LDAK ) - CALL DGEMM( 'N', 'N', N, N, NP, ONE, DWORK( I11+1 ), N, C, LDC, - $ ONE, AK, LDAK ) - CALL DGEMM( 'N', 'N', N, N, M, ONE, B, LDB, CK, LDCK, ONE, AK, - $ LDAK ) -C -C Workspace usage. -C - I1 = M*N - I2 = I1 + N2*N2 - I3 = I2 + N2 -C - IWRK = I3 + N2 -C -C Compute Dk*C . -C - CALL DGEMM( 'N', 'N', M, N, NP, ONE, DK, LDDK, C, LDC, ZERO, - $ DWORK, M ) -C -C Compute the closed-loop state matrix. -C - CALL DLACPY( 'F', N, N, A, LDA, DWORK( I1+1 ), N2 ) - CALL DGEMM( 'N', 'N', N, N, M, -ONE, B, LDB, DWORK, M, ONE, - $ DWORK( I1+1 ), N2 ) - CALL DGEMM( 'N', 'N', N, N, NP, -ONE, BK, LDBK, C, LDC, ZERO, - $ DWORK( I1+N+1 ), N2 ) - CALL DGEMM( 'N', 'N', N, N, M, ONE, B, LDB, CK, LDCK, ZERO, - $ DWORK( I1+N2*N+1 ), N2 ) - CALL DLACPY( 'F', N, N, AK, LDAK, DWORK( I1+N2*N+N+1 ), N2 ) -C -C Compute the closed-loop poles. -C - CALL DGEES( 'N', 'N', SELECT, N2, DWORK( I1+1 ), N2, SDIM, - $ DWORK( I2+1 ), DWORK( I3+1 ), DWORK( IWRK+1 ), N, - $ DWORK( IWRK+1 ), LDWORK-IWRK, BWORK, INFO2 ) - IF( INFO2.NE.0 ) THEN - INFO = 4 - RETURN - END IF - LWA = INT( DWORK( IWRK+1 ) ) + IWRK - LWAMAX = MAX( LWA, LWAMAX ) -C -C Check the stability of the closed-loop system. -C - NS = 0 - DO 180 I = 1, N2 - IF( DLAPY2( DWORK( I2+I ), DWORK( I3+I ) ).GT.ONE ) NS = NS + 1 - 180 CONTINUE - IF( NS.GT.0 ) THEN - INFO = 6 - RETURN - END IF -C - DWORK( 1 ) = DBLE( LWAMAX ) - ... [truncated message content] |
From: <par...@us...> - 2011-08-06 19:07:50
|
Revision: 8444 http://octave.svn.sourceforge.net/octave/?rev=8444&view=rev Author: paramaniac Date: 2011-08-06 19:07:44 +0000 (Sat, 06 Aug 2011) Log Message: ----------- control: improve texinfo strings (2) Modified Paths: -------------- trunk/octave-forge/main/control/devel/pzmap2.m trunk/octave-forge/main/control/inst/@lti/pole.m trunk/octave-forge/main/control/inst/@lti/zero.m trunk/octave-forge/main/control/inst/pzmap.m Modified: trunk/octave-forge/main/control/devel/pzmap2.m =================================================================== --- trunk/octave-forge/main/control/devel/pzmap2.m 2011-08-06 18:56:03 UTC (rev 8443) +++ trunk/octave-forge/main/control/devel/pzmap2.m 2011-08-06 19:07:44 UTC (rev 8444) @@ -19,6 +19,22 @@ ## @deftypefn {Function File} pzmap (@var{sys}) ## @deftypefnx {Function File} {[@var{p}, @var{z}] =} pzmap (@var{sys}) ## Plot the poles and zeros of an LTI system in the complex plane. +## If no output arguments are given, the result is plotted on the screen. +## Otherwise, the poles and zeros are computed and returned. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. +## @end table +## +## @strong{Outputs} +## @table @var +## @item p +## Poles of @var{sys}. +## @item z +## Transmission zeros of @var{sys}. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> @@ -67,4 +83,4 @@ zer_r = zer{1}; endif -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@lti/pole.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/pole.m 2011-08-06 18:56:03 UTC (rev 8443) +++ trunk/octave-forge/main/control/inst/@lti/pole.m 2011-08-06 19:07:44 UTC (rev 8444) @@ -18,6 +18,18 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{p} =} pole (@var{sys}) ## Compute poles of LTI system. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. +## @end table +## +## @strong{Outputs} +## @table @var +## @item p +## Poles of @var{sys}. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> @@ -32,4 +44,4 @@ pol = __pole__ (sys); -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@lti/zero.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/zero.m 2011-08-06 18:56:03 UTC (rev 8443) +++ trunk/octave-forge/main/control/inst/@lti/zero.m 2011-08-06 19:07:44 UTC (rev 8444) @@ -19,6 +19,20 @@ ## @deftypefn {Function File} {@var{z} =} zero (@var{sys}) ## @deftypefnx {Function File} {[@var{z}, @var{k}] =} zero (@var{sys}) ## Compute transmission zeros and gain of LTI model. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. +## @end table +## +## @strong{Outputs} +## @table @var +## @item z +## Transmission zeros of @var{sys}. +## @item k +## Gain of @var{sys}. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> @@ -33,4 +47,4 @@ [zer, gain] = __zero__ (sys, nargout); -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/pzmap.m =================================================================== --- trunk/octave-forge/main/control/inst/pzmap.m 2011-08-06 18:56:03 UTC (rev 8443) +++ trunk/octave-forge/main/control/inst/pzmap.m 2011-08-06 19:07:44 UTC (rev 8444) @@ -19,6 +19,22 @@ ## @deftypefn {Function File} pzmap (@var{sys}) ## @deftypefnx {Function File} {[@var{p}, @var{z}] =} pzmap (@var{sys}) ## Plot the poles and zeros of an LTI system in the complex plane. +## If no output arguments are given, the result is plotted on the screen. +## Otherwise, the poles and zeros are computed and returned. +## +## @strong{Inputs} +## @table @var +## @item sys +## LTI model. +## @end table +## +## @strong{Outputs} +## @table @var +## @item p +## Poles of @var{sys}. +## @item z +## Transmission zeros of @var{sys}. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> @@ -56,4 +72,4 @@ zer_r = zer; endif -endfunction \ No newline at end of file +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-07 04:58:11
|
Revision: 8446 http://octave.svn.sourceforge.net/octave/?rev=8446&view=rev Author: paramaniac Date: 2011-08-07 04:58:05 +0000 (Sun, 07 Aug 2011) Log Message: ----------- control: touch up example Modified Paths: -------------- trunk/octave-forge/main/control/devel/pdfdoc/functions.texi trunk/octave-forge/main/control/inst/MDSSystem.m Modified: trunk/octave-forge/main/control/devel/pdfdoc/functions.texi =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-08-06 19:15:53 UTC (rev 8445) +++ trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-08-07 04:58:05 UTC (rev 8446) @@ -126,6 +126,8 @@ @strong{Inputs} @table @var + @item sys + LTI model to be converted to state-space. @item a State transition matrix (n-by-n). @item b @@ -172,7 +174,8 @@ @strong{Inputs} @table @var @item sys - LTI model. If second argument @var{w} is omitted, the interesting + LTI model to be converted to frequency response data. + If second argument @var{w} is omitted, the interesting frequency range is calculated by the zeros and poles of @var{sys}. @item H Frequency response array (p-by-m-by-lw). In the SISO case, @@ -207,6 +210,8 @@ @strong{Inputs} @table @var + @item sys + LTI model to be converted to state-space. @item a State transition matrix (n-by-n). @item b @@ -280,6 +285,8 @@ @strong{Inputs} @table @var + @item sys + LTI model to be converted to transfer function. @item num Numerator or cell of numerators. Each numerator must be a row vector containing the exponents of the polynomial in descending order. @@ -704,7 +711,36 @@ @deftypefn {Function File} {@var{co} =} ctrb (@var{sys}) @deftypefnx {Function File} {@var{co} =} ctrb (@var{a}, @var{b}) + Return controllability matrix. + + @strong{Inputs} + @table @var + @item sys + LTI model. + @item a + State transition matrix (n-by-n). + @item b + Input matrix (n-by-m). + @end table + + @strong{Outputs} + @table @var + @item co Controllability matrix. + @end table + + @strong{Equation} + @iftex + @tex + $$ C_o = [ B AB A^2B ldots A^{n-1}B ] $$ + @end tex + @end iftex + @ifinfo + @example + 2 n-1 + Co = [ B AB A B ... A B ] + @end example + @end ifinfo @end deftypefn @subsection @@lti/dcgain @@ -752,6 +788,20 @@ @deftypefn {Function File} {@var{bool} =} isct (@var{sys}) Determine whether LTI model is a continuous-time system. + + @strong{Inputs} + @table @var + @item sys + LTI system. + @end table + + @strong{Outputs} + @table @var + @item bool = 0 + @var{sys} is a discrete-time system. + @item bool = 1 + @var{sys} is a continuous-time system or a static gain. + @end table @end deftypefn @subsection isctrb @@ -839,6 +889,20 @@ @deftypefn {Function File} {@var{bool} =} isdt (@var{sys}) Determine whether LTI model is a discrete-time system. + + @strong{Inputs} + @table @var + @item sys + LTI system. + @end table + + @strong{Outputs} + @table @var + @item bool = 0 + @var{sys} is a continuous-time system. + @item bool = 1 + @var{sys} is a discrete-time system or a static gain. + @end table @end deftypefn @subsection @@lti/isminimumphase @@ -963,31 +1027,134 @@ @deftypefn {Function File} {@var{ob} =} obsv (@var{sys}) @deftypefnx {Function File} {@var{ob} =} obsv (@var{a}, @var{c}) + Return observability matrix. + + @strong{Inputs} + @table @var + @item sys + LTI model. + @item a + State transition matrix (n-by-n). + @item c + Measurement matrix (p-by-n). + @end table + + @strong{Outputs} + @table @var + @item ob Observability matrix. + @end table + + @strong{Equation} + @iftex + @tex + $$ O_b = left[ matrix{ C cr + CA cr + CA^2 cr + dots cr + CA^{n-1} } +ight ] $$ + @end tex + @end iftex + @ifinfo + @example + @group + | C | + | CA | + Ob = | CA^2 | + | ... | + | CA^(n-1) | + @end group + @end example + @end ifinfo @end deftypefn @subsection @@lti/pole @deftypefn {Function File} {@var{p} =} pole (@var{sys}) Compute poles of LTI system. + + @strong{Inputs} + @table @var + @item sys + LTI model. + @end table + + @strong{Outputs} + @table @var + @item p + Poles of @var{sys}. + @end table @end deftypefn @subsection pzmap @deftypefn {Function File} pzmap (@var{sys}) @deftypefnx {Function File} {[@var{p}, @var{z}] =} pzmap (@var{sys}) Plot the poles and zeros of an LTI system in the complex plane. + If no output arguments are given, the result is plotted on the screen. + Otherwise, the poles and zeros are computed and returned. + + @strong{Inputs} + @table @var + @item sys + LTI model. + @end table + + @strong{Outputs} + @table @var + @item p + Poles of @var{sys}. + @item z + Transmission zeros of @var{sys}. + @end table @end deftypefn @subsection @@lti/size - @deftypefn {Function File} {@var{nvec} =} size (@var{ltisys}) - @deftypefnx {Function File} {@var{n} =} size (@var{ltisys}, @var{idx}) - @deftypefnx {Function File} {[@var{ny}, @var{nu}] =} size (@var{ltisys}) + @deftypefn {Function File} {@var{nvec} =} size (@var{sys}) + @deftypefnx {Function File} {@var{n} =} size (@var{sys}, @var{dim}) + @deftypefnx {Function File} {[@var{p}, @var{m}] =} size (@var{sys}) LTI model size, i.e. number of outputs and inputs. + + @strong{Inputs} + @table @var + @item sys + LTI system. + @item dim + If given a second argument, @command{size} will return the size of the + corresponding dimension. + @end table + + @strong{Outputs} + @table @var + @item nvec + Row vector. The first element is the number of outputs (rows) and the second + element the number of inputs (columns). + @item n + Scalar value. The size of the dimension @var{dim}. + @item p + Number of outputs. + @item m + Number of inputs. + @end table @end deftypefn @subsection @@lti/zero @deftypefn {Function File} {@var{z} =} zero (@var{sys}) @deftypefnx {Function File} {[@var{z}, @var{k}] =} zero (@var{sys}) Compute transmission zeros and gain of LTI model. + + @strong{Inputs} + @table @var + @item sys + LTI model. + @end table + + @strong{Outputs} + @table @var + @item z + Transmission zeros of @var{sys}. + @item k + Gain of @var{sys}. + @end table @end deftypefn @section Model Simplification @subsection @@lti/minreal Modified: trunk/octave-forge/main/control/inst/MDSSystem.m =================================================================== --- trunk/octave-forge/main/control/inst/MDSSystem.m 2011-08-06 19:15:53 UTC (rev 8445) +++ trunk/octave-forge/main/control/inst/MDSSystem.m 2011-08-07 04:58:05 UTC (rev 8446) @@ -126,7 +126,7 @@ sigma (T) % singular values figure (3) -step (T) % step response +step (T, 10) % step response for 10 seconds % =============================================================================== @@ -151,6 +151,6 @@ sigma (T) % singular values figure (5) -step (T) % step response +step (T, 10) % step response for 10 seconds % =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-08 14:35:00
|
Revision: 8448 http://octave.svn.sourceforge.net/octave/?rev=8448&view=rev Author: paramaniac Date: 2011-08-08 14:34:54 +0000 (Mon, 08 Aug 2011) Log Message: ----------- control: prepare release of control-2.1.53 Modified Paths: -------------- trunk/octave-forge/main/control/DESCRIPTION trunk/octave-forge/main/control/devel/RELEASE_PACKAGE trunk/octave-forge/main/control/doc/NEWS Modified: trunk/octave-forge/main/control/DESCRIPTION =================================================================== --- trunk/octave-forge/main/control/DESCRIPTION 2011-08-07 07:03:54 UTC (rev 8447) +++ trunk/octave-forge/main/control/DESCRIPTION 2011-08-08 14:34:54 UTC (rev 8448) @@ -1,6 +1,6 @@ Name: Control -Version: 2.1.52 -Date: 2011-07-27 +Version: 2.1.53 +Date: 2011-08-08 Author: Lukas Reichlin <luk...@gm...> Maintainer: Lukas Reichlin <luk...@gm...> Title: Control Systems Modified: trunk/octave-forge/main/control/devel/RELEASE_PACKAGE =================================================================== --- trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-08-07 07:03:54 UTC (rev 8447) +++ trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-08-08 14:34:54 UTC (rev 8448) @@ -18,12 +18,12 @@ rm -R ~/octave/__TEMP__/control/devel cd ~/octave/__TEMP__ grep -i version control/DESCRIPTION -tar czf control-2.1.52.tar.gz control/ -md5 control-2.1.52.tar.gz -md5 control-2.1.52.tar.gz > md5_control_pkg.txt -uuencode control-2.1.52.tar.gz < control-2.1.52.tar.gz > control-2.1.52.tar.gz.uue +tar czf control-2.1.53.tar.gz control/ +md5 control-2.1.53.tar.gz +md5 control-2.1.53.tar.gz > md5_control_pkg.txt +uuencode control-2.1.53.tar.gz < control-2.1.53.tar.gz > control-2.1.53.tar.gz.uue octave -q --eval \ -"pkg install control-2.1.52.tar.gz" +"pkg install control-2.1.53.tar.gz" octave -q --eval \ "pkg load generate_html; generate_package_html ('control', 'control-html', 'octave-forge')" tar czf control-html.tar.gz control-html @@ -38,7 +38,7 @@ ===================================================================================== rm -R ~/octave/__TEMP__ -rm -R ~/octave/control-2.1.52 +rm -R ~/octave/control-2.1.53 ===================================================================================== Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-08-07 07:03:54 UTC (rev 8447) +++ trunk/octave-forge/main/control/doc/NEWS 2011-08-08 14:34:54 UTC (rev 8448) @@ -1,17 +1,21 @@ Summary of important user-visible changes for releases of the control package =============================================================================== -control-2.x.yy Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +control-2.1.53 Release Date: 2011-08-08 Release Manager: Lukas Reichlin =============================================================================== ** ncfsyn - -- Added support for McFarlane/Glover loop shaping design procedure. ncfsyn - stands for Normalized Coprime Factor Synthesis. + -- Added support for McFarlane/Glover loop shaping design procedure. + "ncfsyn" stands for Normalized Coprime Factor Synthesis. ** MDSSystem -- Added example script which demonstrates the usage of the robust control commands "mixsyn" and "ncfsyn". +** Texinfo help strings of several functions have been extended, although + documentation still leaves a lot to be desired. + + =============================================================================== control-2.1.52 Release Date: 2011-07-27 Release Manager: Lukas Reichlin =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-14 06:26:05
|
Revision: 8457 http://octave.svn.sourceforge.net/octave/?rev=8457&view=rev Author: paramaniac Date: 2011-08-14 06:25:58 +0000 (Sun, 14 Aug 2011) Log Message: ----------- control: partially fix generation of pdf manual Modified Paths: -------------- trunk/octave-forge/main/control/devel/pdfdoc/control.tex trunk/octave-forge/main/control/devel/pdfdoc/functions.texi trunk/octave-forge/main/control/devel/pdfdoc/usage.txt trunk/octave-forge/main/control/inst/place.m Modified: trunk/octave-forge/main/control/devel/pdfdoc/control.tex =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-08-10 13:20:17 UTC (rev 8456) +++ trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-08-14 06:25:58 UTC (rev 8457) @@ -3,7 +3,7 @@ @setfilename control.info @settitle Octave Control Systems Package @afourpaper -@set VERSION 2.1.52 +@set VERSION 2.1.53 @c @afourwide @c %**end of header Modified: trunk/octave-forge/main/control/devel/pdfdoc/functions.texi =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-08-10 13:20:17 UTC (rev 8456) +++ trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-08-14 06:25:58 UTC (rev 8457) @@ -522,6 +522,33 @@ @deftypefnx {Function File} {@var{sys} =} feedback (@var{sys1}, @var{sys2}, @var{feedin}, @var{feedout}, @var{"+"}) Feedback connection of two LTI models. + @strong{Inputs} + @table @var + @item sys1 + LTI model of forward transmission. @code{[p1, m1] = size (sys1)}. + @item sys2 + LTI model of backward transmission. + If not specified, an identity matrix of appropriate size is taken. + @item feedin + Vector containing indices of inputs to @var{sys1} which are involved in the feedback loop. + The number of @var{feedin} indices and outputs of @var{sys2} must be equal. + If not specified, @code{1:m1} is taken. + @item feedout + Vector containing indices of outputs from @var{sys1} which are to be connected to @var{sys2}. + The number of @var{feedout} indices and inputs of @var{sys2} must be equal. + If not specified, @code{1:p1} is taken. + @item "+" + Positive feedback sign. If not specified, @var{"-"} for a negative feedback interconnection + is assumed. @var{+1} and @var{-1} are possible as well, but only from the third argument + onward due to ambiguity. + @end table + + @strong{Outputs} + @table @var + @item sys + Resulting LTI model. + @end table + @strong{Block Diagram} @example @group @@ -1742,7 +1769,11 @@ Place is also suitable to design estimator gains: @group L = place (A.', C.', p).' - L = place (sys.', p).' @subsection rlocus + L = place (sys.', p).' # useful for discrete-time systems + @end group + @end example + @end deftypefn +@subsection rlocus @deftypefn {Function File} rlocus (@var{sys}) @deftypefnx {Function File} {[@var{rldata}, @var{k}] =} rlocus (@var{sys}[, @var{increment}, @var{min_k}, @var{max_k}]) @@ -2275,7 +2306,7 @@ @item factor @code{factor = 1} implies that an optimal controller is required. @code{factor > 1} implies that a suboptimal controller is required, - achieving a performance taht is @var{factor} times less than optimal. + achieving a performance that is @var{factor} times less than optimal. Default value is 1. @end table Modified: trunk/octave-forge/main/control/devel/pdfdoc/usage.txt =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/usage.txt 2011-08-10 13:20:17 UTC (rev 8456) +++ trunk/octave-forge/main/control/devel/pdfdoc/usage.txt 2011-08-14 06:25:58 UTC (rev 8457) @@ -1,3 +1,11 @@ +* Check that "pkg list" lists the packages generate_html and control. +* Run function_doc within Octave. This script collects the Texinfo strings from all + functions listed in the package's INDEX file and writes them to the file functions.texi. + Don't edit the file functions.texi since your changes will be lost by the next run. +* Adapt version number in control.tex +* Run control.tex + + tex control.tex q ??? Modified: trunk/octave-forge/main/control/inst/place.m =================================================================== --- trunk/octave-forge/main/control/inst/place.m 2011-08-10 13:20:17 UTC (rev 8456) +++ trunk/octave-forge/main/control/inst/place.m 2011-08-14 06:25:58 UTC (rev 8457) @@ -64,7 +64,7 @@ ## Place is also suitable to design estimator gains: ## @group ## L = place (A.', C.', p).' -## L = place (sys.', p).' % useful for discrete-time systems +## L = place (sys.', p).' # useful for discrete-time systems ## @end group ## @end example ## @end deftypefn This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-15 17:06:34
|
Revision: 8460 http://octave.svn.sourceforge.net/octave/?rev=8460&view=rev Author: paramaniac Date: 2011-08-15 17:06:28 +0000 (Mon, 15 Aug 2011) Log Message: ----------- control: work on ss2tf conversion Modified Paths: -------------- trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc trunk/octave-forge/main/control/inst/@lti/size.m trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m Modified: trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc 2011-08-15 16:44:45 UTC (rev 8459) +++ trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc 2011-08-15 17:06:28 UTC (rev 8460) @@ -146,6 +146,9 @@ retval(1) = gd; retval(2) = ignm; retval(3) = igdm; + retval(4) = octave_value (md); + retval(5) = octave_value (p); + retval(6) = octave_value (m); } return retval; Modified: trunk/octave-forge/main/control/inst/@lti/size.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/size.m 2011-08-15 16:44:45 UTC (rev 8459) +++ trunk/octave-forge/main/control/inst/@lti/size.m 2011-08-15 17:06:28 UTC (rev 8460) @@ -71,7 +71,7 @@ else stru = "s"; endif - disp (sprintf ("LTI model with %d output%s and %d input%s.", ny, stry, nu, stru)); + disp (sprintf ("LTI model with %d output%s and %d input%s.", p, stry, m, stru)); case 1 n = [p, m]; case 2 Modified: trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m 2011-08-15 16:44:45 UTC (rev 8459) +++ trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m 2011-08-15 17:06:28 UTC (rev 8460) @@ -20,28 +20,32 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1.1 +## Version: 0.2 function [retsys, retlti] = __sys2tf__ (sys) - if (! issiso (sys)) - error ("ss: ss2tf: MIMO case not implemented yet"); - endif + [a, b, c, d] = ssdata (sys); # system could be a descriptor model - if (isempty (sys.a)) # static gain - num = sys.d; - den = 1; - else # default case - [zer, gain] = zero (sys); - pol = pole (sys); - - num = gain * real (poly (zer)); - den = real (poly (pol)); - endif + [num, den, ign, igd, md, p, m] = sltb04bd (a, b, c, d); + num = reshape (num, md, p, m); + den = reshape (den, md, p, m); + + num = mat2cell (num, md, ones(1,p), ones(1,m)); + den = mat2cell (den, md, ones(1,p), ones(1,m)); + + num = squeeze (num); + den = squeeze (den); + + ign = mat2cell (ign, ones(1,p), ones(1,m)); + igd = mat2cell (igd, ones(1,p), ones(1,m)); + + num = cellfun (@(x, y) x(1:y+1), num, ign, "uniformoutput", false); + den = cellfun (@(x, y) x(1:y+1), den, igd, "uniformoutput", false); + retsys = tf (num, den, get (sys, "tsam")); # tsam needed to set appropriate tfvar retlti = sys.lti; # preserve lti properties ## FIXME: sys = tf (ss (5)) -endfunction \ No newline at end of file +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-15 21:24:52
|
Revision: 8463 http://octave.svn.sourceforge.net/octave/?rev=8463&view=rev Author: paramaniac Date: 2011-08-15 21:24:46 +0000 (Mon, 15 Aug 2011) Log Message: ----------- control: minor changes Modified Paths: -------------- trunk/octave-forge/main/control/devel/PROJECTS trunk/octave-forge/main/control/devel/pdfdoc/control.tex trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@tf/display.m Modified: trunk/octave-forge/main/control/devel/PROJECTS =================================================================== --- trunk/octave-forge/main/control/devel/PROJECTS 2011-08-15 18:23:39 UTC (rev 8462) +++ trunk/octave-forge/main/control/devel/PROJECTS 2011-08-15 21:24:46 UTC (rev 8463) @@ -59,8 +59,6 @@ * Balancing: TB01TD ? - * Use SLICOT TB04BD for @ss/__sys2tf__.m - ------------------------ Transfer Function Models: ------------------------ @@ -93,4 +91,4 @@ Octave-like language. </pre> -</html> \ No newline at end of file +</html> Modified: trunk/octave-forge/main/control/devel/pdfdoc/control.tex =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-08-15 18:23:39 UTC (rev 8462) +++ trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-08-15 21:24:46 UTC (rev 8463) @@ -3,7 +3,7 @@ @setfilename control.info @settitle Octave Control Systems Package @afourpaper -@set VERSION 2.1.53 +@set VERSION 2.1.54 @c @afourwide @c %**end of header Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-08-15 18:23:39 UTC (rev 8462) +++ trunk/octave-forge/main/control/doc/NEWS 2011-08-15 21:24:46 UTC (rev 8463) @@ -6,8 +6,8 @@ ** tf -- State-space to transfer function conversion uses now SLICOT TB04BD. - -- Conversion of MIMO models supported. - -- Usage: tf_sys = tf (ss_sys) + Conversion of MIMO models is now supported. Usage: tf_sys = tf (ss_sys) + -- Display an empty line between title and numerator for better readability. =============================================================================== Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2011-08-15 18:23:39 UTC (rev 8462) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2011-08-15 21:24:46 UTC (rev 8463) @@ -34,6 +34,7 @@ for nu = 1 : m disp (["Transfer function \"", sysname, "\" from input \"", inname{nu}, "\" to output ..."]); + disp (""); for ny = 1 : p __disp_frac__ (sys.num{ny, nu}, sys.den{ny, nu}, sys.tfvar, outname{ny}); endfor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-16 09:47:41
|
Revision: 8464 http://octave.svn.sourceforge.net/octave/?rev=8464&view=rev Author: paramaniac Date: 2011-08-16 09:47:35 +0000 (Tue, 16 Aug 2011) Log Message: ----------- control: display whether tf is static, continuous- or discrete-time Modified Paths: -------------- trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@tf/display.m Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-08-15 21:24:46 UTC (rev 8463) +++ trunk/octave-forge/main/control/doc/NEWS 2011-08-16 09:47:35 UTC (rev 8464) @@ -8,6 +8,7 @@ -- State-space to transfer function conversion uses now SLICOT TB04BD. Conversion of MIMO models is now supported. Usage: tf_sys = tf (ss_sys) -- Display an empty line between title and numerator for better readability. + -- Display whether model is static, continuous- or discrete-time. =============================================================================== Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2011-08-15 21:24:46 UTC (rev 8463) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2011-08-16 09:47:35 UTC (rev 8464) @@ -1,4 +1,4 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin +## Copyright (C) 2009, 2010, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,12 +20,12 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.2 +## Version: 0.3 function display (sys) sysname = inputname (1); - [inname, outname] = __lti_data__ (sys.lti); + [inname, outname, tsam] = __lti_data__ (sys.lti); [inname, m] = __labels__ (inname, "u"); [outname, p] = __labels__ (outname, "y"); @@ -40,8 +40,16 @@ endfor endfor - display (sys.lti); + display (sys.lti); # display sampling time + if (tsam == -2) + disp ("Static gain."); + elseif (tsam == 0) + disp ("Continuous-time model."); + else + disp ("Discrete-time model."); + endif + endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-08-15 18:06:52
|
Revision: 8461 http://octave.svn.sourceforge.net/octave/?rev=8461&view=rev Author: paramaniac Date: 2011-08-15 18:06:43 +0000 (Mon, 15 Aug 2011) Log Message: ----------- control: move ss2tf conversion into place Modified Paths: -------------- trunk/octave-forge/main/control/devel/makefile_all.m trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@ss/__sys2tf__.m trunk/octave-forge/main/control/inst/ltimodels.m trunk/octave-forge/main/control/src/Makefile Added Paths: ----------- trunk/octave-forge/main/control/devel/makefile_ss2tf.m trunk/octave-forge/main/control/src/MC01PD.f trunk/octave-forge/main/control/src/MC01PY.f trunk/octave-forge/main/control/src/TB01ZD.f trunk/octave-forge/main/control/src/TB04BD.f trunk/octave-forge/main/control/src/sltb04bd.cc Removed Paths: ------------- trunk/octave-forge/main/control/devel/ss2tf/MC01PD.f trunk/octave-forge/main/control/devel/ss2tf/MC01PY.f trunk/octave-forge/main/control/devel/ss2tf/TB01ZD.f trunk/octave-forge/main/control/devel/ss2tf/TB04BD.dat trunk/octave-forge/main/control/devel/ss2tf/TB04BD.f trunk/octave-forge/main/control/devel/ss2tf/TB04BD.html trunk/octave-forge/main/control/devel/ss2tf/TB04BD.res trunk/octave-forge/main/control/devel/ss2tf/common.cc trunk/octave-forge/main/control/devel/ss2tf/makefile_ss2tf.m trunk/octave-forge/main/control/devel/ss2tf/sltb04bd.cc Modified: trunk/octave-forge/main/control/devel/makefile_all.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_all.m 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/makefile_all.m 2011-08-15 18:06:43 UTC (rev 8461) @@ -23,7 +23,8 @@ makefile_norm makefile_place makefile_scale +makefile_ss2tf makefile_staircase makefile_zero -cd (homedir); \ No newline at end of file +cd (homedir); Copied: trunk/octave-forge/main/control/devel/makefile_ss2tf.m (from rev 8460, trunk/octave-forge/main/control/devel/ss2tf/makefile_ss2tf.m) =================================================================== --- trunk/octave-forge/main/control/devel/makefile_ss2tf.m (rev 0) +++ trunk/octave-forge/main/control/devel/makefile_ss2tf.m 2011-08-15 18:06:43 UTC (rev 8461) @@ -0,0 +1,19 @@ +## ============================================================================== +## Developer Makefile for OCT-files +## ============================================================================== +## USAGE: * fetch control from Octave-Forge by svn +## * add control/inst, control/src and control/devel to your Octave path +## * run makefile_* +## ============================================================================== + +homedir = pwd (); +develdir = fileparts (which ("makefile_ss2tf")); +srcdir = [develdir, "/../src"]; +cd (srcdir); + +mkoctfile sltb04bd.cc \ + TB04BD.f MC01PY.f TB01ID.f TB01ZD.f MC01PD.f \ + TB04BX.f MA02AD.f MB02RD.f MB01PD.f MB02SD.f \ + MB01QD.f + +cd (homedir); Deleted: trunk/octave-forge/main/control/devel/ss2tf/MC01PD.f =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/MC01PD.f 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/ss2tf/MC01PD.f 2011-08-15 18:06:43 UTC (rev 8461) @@ -1,159 +0,0 @@ - SUBROUTINE MC01PD( K, REZ, IMZ, P, DWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the coefficients of a real polynomial P(x) from its -C zeros. -C -C ARGUMENTS -C -C Input/Output Parameters -C -C K (input) INTEGER -C The number of zeros (and hence the degree) of P(x). -C K >= 0. -C -C REZ (input) DOUBLE PRECISION array, dimension (K) -C IMZ (input) DOUBLE PRECISION array, dimension (K) -C The real and imaginary parts of the i-th zero of P(x) -C must be stored in REZ(i) and IMZ(i), respectively, where -C i = 1, 2, ..., K. The zeros may be supplied in any order, -C except that complex conjugate zeros must appear -C consecutively. -C -C P (output) DOUBLE PRECISION array, dimension (K+1) -C This array contains the coefficients of P(x) in increasing -C powers of x. If K = 0, then P(1) is set to one. -C -C Workspace -C -C DWORK DOUBLE PRECISION array, dimension (K+1) -C If K = 0, this array is not referenced. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C > 0: if INFO = i, (REZ(i),IMZ(i)) is a complex zero but -C (REZ(i-1),IMZ(i-1)) is not its conjugate. -C -C METHOD -C -C The routine computes the coefficients of the real K-th degree -C polynomial P(x) as -C -C P(x) = (x - r(1)) * (x - r(2)) * ... * (x - r(K)) -C -C where r(i) = (REZ(i),IMZ(i)). -C -C Note that REZ(i) = REZ(j) and IMZ(i) = -IMZ(j) if r(i) and r(j) -C form a complex conjugate pair (where i <> j), and that IMZ(i) = 0 -C if r(i) is real. -C -C NUMERICAL ASPECTS -C -C None. -C -C CONTRIBUTOR -C -C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, Mar. 1997. -C Supersedes Release 2.0 routine MC01DD by A.J. Geurts. -C -C REVISIONS -C -C V. Sima, May 2002. -C -C KEYWORDS -C -C Elementary polynomial operations, polynomial operations. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) -C .. Scalar Arguments .. - INTEGER INFO, K -C .. Array Arguments .. - DOUBLE PRECISION DWORK(*), IMZ(*), P(*), REZ(*) -C .. Local Scalars .. - INTEGER I - DOUBLE PRECISION U, V -C .. External Subroutines .. - EXTERNAL DAXPY, DCOPY, XERBLA -C .. Executable Statements .. -C -C Test the input scalar arguments. -C - IF( K.LT.0 ) THEN - INFO = -1 -C -C Error return. -C - CALL XERBLA( 'MC01PD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - INFO = 0 - P(1) = ONE - IF ( K.EQ.0 ) - $ RETURN -C - I = 1 -C WHILE ( I <= K ) DO - 20 IF ( I.LE.K ) THEN - U = REZ(I) - V = IMZ(I) - DWORK(1) = ZERO -C - IF ( V.EQ.ZERO ) THEN - CALL DCOPY( I, P, 1, DWORK(2), 1 ) - CALL DAXPY( I, -U, P, 1, DWORK, 1 ) - I = I + 1 -C - ELSE - IF ( I.EQ.K ) THEN - INFO = K - RETURN - ELSE IF ( ( U.NE.REZ(I+1) ) .OR. ( V.NE.-IMZ(I+1) ) ) THEN - INFO = I + 1 - RETURN - END IF -C - DWORK(2) = ZERO - CALL DCOPY( I, P, 1, DWORK(3), 1 ) - CALL DAXPY( I, -(U + U), P, 1, DWORK(2), 1 ) - CALL DAXPY( I, U**2+V**2, P, 1, DWORK, 1 ) - I = I + 2 - END IF -C - CALL DCOPY( I, DWORK, 1, P, 1 ) - GO TO 20 - END IF -C END WHILE 20 -C - RETURN -C *** Last line of MC01PD *** - END Deleted: trunk/octave-forge/main/control/devel/ss2tf/MC01PY.f =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/MC01PY.f 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/ss2tf/MC01PY.f 2011-08-15 18:06:43 UTC (rev 8461) @@ -1,157 +0,0 @@ - SUBROUTINE MC01PY( K, REZ, IMZ, P, DWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the coefficients of a real polynomial P(x) from its -C zeros. The coefficients are stored in decreasing order of the -C powers of x. -C -C ARGUMENTS -C -C Input/Output Parameters -C -C K (input) INTEGER -C The number of zeros (and hence the degree) of P(x). -C K >= 0. -C -C REZ (input) DOUBLE PRECISION array, dimension (K) -C IMZ (input) DOUBLE PRECISION array, dimension (K) -C The real and imaginary parts of the i-th zero of P(x) -C must be stored in REZ(i) and IMZ(i), respectively, where -C i = 1, 2, ..., K. The zeros may be supplied in any order, -C except that complex conjugate zeros must appear -C consecutively. -C -C P (output) DOUBLE PRECISION array, dimension (K+1) -C This array contains the coefficients of P(x) in decreasing -C powers of x. -C -C Workspace -C -C DWORK DOUBLE PRECISION array, dimension (K) -C If K = 0, this array is not referenced. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C > 0: if INFO = i, (REZ(i),IMZ(i)) is a complex zero but -C (REZ(i-1),IMZ(i-1)) is not its conjugate. -C -C METHOD -C -C The routine computes the coefficients of the real K-th degree -C polynomial P(x) as -C -C P(x) = (x - r(1)) * (x - r(2)) * ... * (x - r(K)) -C -C where r(i) = (REZ(i),IMZ(i)). -C -C Note that REZ(i) = REZ(j) and IMZ(i) = -IMZ(j) if r(i) and r(j) -C form a complex conjugate pair (where i <> j), and that IMZ(i) = 0 -C if r(i) is real. -C -C NUMERICAL ASPECTS -C -C None. -C -C CONTRIBUTOR -C -C V. Sima, Research Institute for Informatics, Bucharest, May 2002. -C -C REVISIONS -C -C - -C -C KEYWORDS -C -C Elementary polynomial operations, polynomial operations. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) -C .. Scalar Arguments .. - INTEGER INFO, K -C .. Array Arguments .. - DOUBLE PRECISION DWORK(*), IMZ(*), P(*), REZ(*) -C .. Local Scalars .. - INTEGER I - DOUBLE PRECISION U, V -C .. External Subroutines .. - EXTERNAL DAXPY, DCOPY, XERBLA -C .. Executable Statements .. -C -C Test the input scalar arguments. -C - IF( K.LT.0 ) THEN - INFO = -1 -C -C Error return. -C - CALL XERBLA( 'MC01PY', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - INFO = 0 - P(1) = ONE - IF ( K.EQ.0 ) - $ RETURN -C - I = 1 -C WHILE ( I <= K ) DO - 20 IF ( I.LE.K ) THEN - U = REZ(I) - V = IMZ(I) - DWORK(I) = ZERO -C - IF ( V.EQ.ZERO ) THEN - CALL DAXPY( I, -U, P, 1, DWORK, 1 ) -C - ELSE - IF ( I.EQ.K ) THEN - INFO = K - RETURN - ELSE IF ( ( U.NE.REZ(I+1) ) .OR. ( V.NE.-IMZ(I+1) ) ) THEN - INFO = I + 1 - RETURN - END IF -C - DWORK(I+1) = ZERO - CALL DAXPY( I, -(U + U), P, 1, DWORK, 1 ) - CALL DAXPY( I, U**2+V**2, P, 1, DWORK(2), 1 ) - I = I + 1 - END IF -C - CALL DCOPY( I, DWORK, 1, P(2), 1 ) - I = I + 1 - GO TO 20 - END IF -C END WHILE 20 -C - RETURN -C *** Last line of MC01PY *** - END Deleted: trunk/octave-forge/main/control/devel/ss2tf/TB01ZD.f =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/TB01ZD.f 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/ss2tf/TB01ZD.f 2011-08-15 18:06:43 UTC (rev 8461) @@ -1,440 +0,0 @@ - SUBROUTINE TB01ZD( JOBZ, N, P, A, LDA, B, C, LDC, NCONT, Z, LDZ, - $ TAU, TOL, DWORK, LDWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To find a controllable realization for the linear time-invariant -C single-input system -C -C dX/dt = A * X + B * U, -C Y = C * X, -C -C where A is an N-by-N matrix, B is an N element vector, C is an -C P-by-N matrix, and A and B are reduced by this routine to -C orthogonal canonical form using (and optionally accumulating) -C orthogonal similarity transformations, which are also applied -C to C. -C -C ARGUMENTS -C -C Mode Parameters -C -C JOBZ CHARACTER*1 -C Indicates whether the user wishes to accumulate in a -C matrix Z the orthogonal similarity transformations for -C reducing the system, as follows: -C = 'N': Do not form Z and do not store the orthogonal -C transformations; -C = 'F': Do not form Z, but store the orthogonal -C transformations in the factored form; -C = 'I': Z is initialized to the unit matrix and the -C orthogonal transformation matrix Z is returned. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the original state-space representation, -C i.e. the order of the matrix A. N >= 0. -C -C P (input) INTEGER -C The number of system outputs, or of rows of C. P >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the original state dynamics matrix A. -C On exit, the leading NCONT-by-NCONT upper Hessenberg -C part of this array contains the canonical form of the -C state dynamics matrix, given by Z' * A * Z, of a -C controllable realization for the original system. The -C elements below the first subdiagonal are set to zero. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (N) -C On entry, the original input/state vector B. -C On exit, the leading NCONT elements of this array contain -C canonical form of the input/state vector, given by Z' * B, -C with all elements but B(1) set to zero. -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading P-by-N part of this array must -C contain the output/state matrix C. -C On exit, the leading P-by-N part of this array contains -C the transformed output/state matrix, given by C * Z, and -C the leading P-by-NCONT part contains the output/state -C matrix of the controllable realization. -C -C LDC INTEGER -C The leading dimension of array C. LDC >= MAX(1,P). -C -C NCONT (output) INTEGER -C The order of the controllable state-space representation. -C -C Z (output) DOUBLE PRECISION array, dimension (LDZ,N) -C If JOBZ = 'I', then the leading N-by-N part of this array -C contains the matrix of accumulated orthogonal similarity -C transformations which reduces the given system to -C orthogonal canonical form. -C If JOBZ = 'F', the elements below the diagonal, with the -C array TAU, represent the orthogonal transformation matrix -C as a product of elementary reflectors. The transformation -C matrix can then be obtained by calling the LAPACK Library -C routine DORGQR. -C If JOBZ = 'N', the array Z is not referenced and can be -C supplied as a dummy array (i.e. set parameter LDZ = 1 and -C declare this array to be Z(1,1) in the calling program). -C -C LDZ INTEGER -C The leading dimension of array Z. If JOBZ = 'I' or -C JOBZ = 'F', LDZ >= MAX(1,N); if JOBZ = 'N', LDZ >= 1. -C -C TAU (output) DOUBLE PRECISION array, dimension (N) -C The elements of TAU contain the scalar factors of the -C elementary reflectors used in the reduction of B and A. -C -C Tolerances -C -C TOL DOUBLE PRECISION -C The tolerance to be used in determining the -C controllability of (A,B). If the user sets TOL > 0, then -C the given value of TOL is used as an absolute tolerance; -C elements with absolute value less than TOL are considered -C neglijible. If the user sets TOL <= 0, then an implicitly -C computed, default tolerance, defined by -C TOLDEF = N*EPS*MAX( NORM(A), NORM(B) ) is used instead, -C where EPS is the machine precision (see LAPACK Library -C routine DLAMCH). -C -C Workspace -C -C DWORK DOUBLE PRECISION array, dimension (LDWORK) -C On exit, if INFO = 0, DWORK(1) returns the optimal value -C of LDWORK. -C -C LDWORK INTEGER -C The length of the array DWORK. LDWORK >= MAX(1,N,P). -C For optimum performance LDWORK should be larger. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C The Householder matrix which reduces all but the first element -C of vector B to zero is found and this orthogonal similarity -C transformation is applied to the matrix A. The resulting A is then -C reduced to upper Hessenberg form by a sequence of Householder -C transformations. Finally, the order of the controllable state- -C space representation (NCONT) is determined by finding the position -C of the first sub-diagonal element of A which is below an -C appropriate zero threshold, either TOL or TOLDEF (see parameter -C TOL); if NORM(B) is smaller than this threshold, NCONT is set to -C zero, and no computations for reducing the system to orthogonal -C canonical form are performed. -C All orthogonal transformations determined in this process are also -C applied to the matrix C, from the right. -C -C REFERENCES -C -C [1] Konstantinov, M.M., Petkov, P.Hr. and Christov, N.D. -C Orthogonal Invariants and Canonical Forms for Linear -C Controllable Systems. -C Proc. 8th IFAC World Congress, Kyoto, 1, pp. 49-54, 1981. -C -C [2] Hammarling, S.J. -C Notes on the use of orthogonal similarity transformations in -C control. -C NPL Report DITC 8/82, August 1982. -C -C [3] Paige, C.C -C Properties of numerical algorithms related to computing -C controllability. -C IEEE Trans. Auto. Contr., AC-26, pp. 130-138, 1981. -C -C NUMERICAL ASPECTS -C 3 -C The algorithm requires 0(N ) operations and is backward stable. -C -C CONTRIBUTOR -C -C V. Sima, Katholieke Univ. Leuven, Belgium, Feb. 1998. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Oct. 2001, -C Sept. 2003. -C -C KEYWORDS -C -C Controllability, minimal realization, orthogonal canonical form, -C orthogonal transformation. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) -C .. Scalar Arguments .. - CHARACTER JOBZ - INTEGER INFO, LDA, LDC, LDWORK, LDZ, N, NCONT, P - DOUBLE PRECISION TOL -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), B(*), C(LDC,*), DWORK(*), TAU(*), - $ Z(LDZ,*) -C .. Local Scalars .. - LOGICAL LJOBF, LJOBI, LJOBZ - INTEGER ITAU, J - DOUBLE PRECISION ANORM, B1, BNORM, FANORM, FBNORM, H, THRESH, - $ TOLDEF, WRKOPT -C .. Local Arrays .. - DOUBLE PRECISION NBLK(1) -C .. External Functions .. - LOGICAL LSAME - DOUBLE PRECISION DLAMCH, DLANGE - EXTERNAL DLAMCH, DLANGE, LSAME -C .. External Subroutines .. - EXTERNAL DGEHRD, DLACPY, DLARF, DLARFG, DLASET, DORGQR, - $ DORMHR, MB01PD, XERBLA -C .. Intrinsic Functions .. - INTRINSIC ABS, DBLE, MAX -C .. Executable Statements .. -C - INFO = 0 - LJOBF = LSAME( JOBZ, 'F' ) - LJOBI = LSAME( JOBZ, 'I' ) - LJOBZ = LJOBF.OR.LJOBI -C -C Test the input scalar arguments. -C - IF( .NOT.LJOBZ .AND. .NOT.LSAME( JOBZ, 'N' ) ) THEN - INFO = -1 - ELSE IF( N.LT.0 ) THEN - INFO = -2 - ELSE IF( P.LT.0 ) THEN - INFO = -3 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -5 - ELSE IF( LDC.LT.MAX( 1, P ) ) THEN - INFO = -8 - ELSE IF( LDZ.LT.1 .OR. ( LJOBZ .AND. LDZ.LT.N ) ) THEN - INFO = -11 - ELSE IF( LDWORK.LT.MAX( 1, N, P ) ) THEN - INFO = -15 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'TB01ZD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - NCONT = 0 - DWORK(1) = ONE - IF ( N.EQ.0 ) - $ RETURN -C -C (Note: Comments in the code beginning "Workspace:" describe the -C minimal amount of real workspace needed at that point in the -C code, as well as the preferred amount for good performance. -C NB refers to the optimal block size for the immediately -C following subroutine, as returned by ILAENV.) -C - WRKOPT = ONE -C -C Calculate the absolute norms of A and B (used for scaling). -C - ANORM = DLANGE( 'Max', N, N, A, LDA, DWORK ) - BNORM = DLANGE( 'Max', N, 1, B, N, DWORK ) -C -C Return if matrix B is zero. -C - IF( BNORM.EQ.ZERO ) THEN - IF( LJOBF ) THEN - CALL DLASET( 'Full', N, N, ZERO, ZERO, Z, LDZ ) - CALL DLASET( 'Full', N, 1, ZERO, ZERO, TAU, N ) - ELSE IF( LJOBI ) THEN - CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDZ ) - END IF - RETURN - END IF -C -C Scale (if needed) the matrices A and B. -C - CALL MB01PD( 'S', 'G', N, N, 0, 0, ANORM, 0, NBLK, A, LDA, INFO ) - CALL MB01PD( 'S', 'G', N, 1, 0, 0, BNORM, 0, NBLK, B, N, INFO ) -C -C Calculate the Frobenius norm of A and the 1-norm of B (used for -C controlability test). -C - FANORM = DLANGE( 'Frobenius', N, N, A, LDA, DWORK ) - FBNORM = DLANGE( '1-norm', N, 1, B, N, DWORK ) -C - TOLDEF = TOL - IF ( TOLDEF.LE.ZERO ) THEN -C -C Use the default tolerance in controllability determination. -C - THRESH = DBLE(N)*DLAMCH( 'EPSILON' ) - TOLDEF = THRESH*MAX( FANORM, FBNORM ) - END IF -C - ITAU = 1 - IF ( FBNORM.GT.TOLDEF ) THEN -C -C B is not negligible compared with A. -C - IF ( N.GT.1 ) THEN -C -C Transform B by a Householder matrix Z1: store vector -C describing this temporarily in B and in the local scalar H. -C - CALL DLARFG( N, B(1), B(2), 1, H ) -C - B1 = B(1) - B(1) = ONE -C -C Form Z1 * A * Z1. -C Workspace: need N. -C - CALL DLARF( 'Right', N, N, B, 1, H, A, LDA, DWORK ) - CALL DLARF( 'Left', N, N, B, 1, H, A, LDA, DWORK ) -C -C Form C * Z1. -C Workspace: need P. -C - CALL DLARF( 'Right', P, N, B, 1, H, C, LDC, DWORK ) -C - B(1) = B1 - TAU(1) = H - ITAU = ITAU + 1 - ELSE - B1 = B(1) - TAU(1) = ZERO - END IF -C -C Reduce modified A to upper Hessenberg form by an orthogonal -C similarity transformation with matrix Z2. -C Workspace: need N; prefer N*NB. -C - CALL DGEHRD( N, 1, N, A, LDA, TAU(ITAU), DWORK, LDWORK, INFO ) - WRKOPT = DWORK(1) -C -C Form C * Z2. -C Workspace: need P; prefer P*NB. -C - CALL DORMHR( 'Right', 'No transpose', P, N, 1, N, A, LDA, - $ TAU(ITAU), C, LDC, DWORK, LDWORK, INFO ) - WRKOPT = MAX( WRKOPT, DWORK(1) ) -C - IF ( LJOBZ ) THEN -C -C Save the orthogonal transformations used, so that they could -C be accumulated by calling DORGQR routine. -C - IF ( N.GT.1 ) - $ CALL DLACPY( 'Full', N-1, 1, B(2), N-1, Z(2,1), LDZ ) - IF ( N.GT.2 ) - $ CALL DLACPY( 'Lower', N-2, N-2, A(3,1), LDA, Z(3,2), - $ LDZ ) - IF ( LJOBI ) THEN -C -C Form the orthogonal transformation matrix Z = Z1 * Z2. -C Workspace: need N; prefer N*NB. -C - CALL DORGQR( N, N, N, Z, LDZ, TAU, DWORK, LDWORK, INFO ) - WRKOPT = MAX( WRKOPT, DWORK(1) ) - END IF - END IF -C -C Annihilate the lower part of A and B. -C - IF ( N.GT.2 ) - $ CALL DLASET( 'Lower', N-2, N-2, ZERO, ZERO, A(3,1), LDA ) - IF ( N.GT.1 ) - $ CALL DLASET( 'Full', N-1, 1, ZERO, ZERO, B(2), N-1 ) -C -C Find NCONT by checking sizes of the sub-diagonal elements of -C transformed A. -C - IF ( TOL.LE.ZERO ) - $ TOLDEF = THRESH*MAX( FANORM, ABS( B1 ) ) -C - J = 1 -C -C WHILE ( J < N and ABS( A(J+1,J) ) > TOLDEF ) DO -C - 10 CONTINUE - IF ( J.LT.N ) THEN - IF ( ABS( A(J+1,J) ).GT.TOLDEF ) THEN - J = J + 1 - GO TO 10 - END IF - END IF -C -C END WHILE 10 -C -C First negligible sub-diagonal element found, if any: set NCONT. -C - NCONT = J - IF ( J.LT.N ) - $ A(J+1,J) = ZERO -C -C Undo scaling of A and B. -C - CALL MB01PD( 'U', 'H', NCONT, NCONT, 0, 0, ANORM, 0, NBLK, A, - $ LDA, INFO ) - CALL MB01PD( 'U', 'G', 1, 1, 0, 0, BNORM, 0, NBLK, B, N, INFO ) - IF ( NCONT.LT.N ) - $ CALL MB01PD( 'U', 'G', N, N-NCONT, 0, 0, ANORM, 0, NBLK, - $ A(1,NCONT+1), LDA, INFO ) - ELSE -C -C B is negligible compared with A. No computations for reducing -C the system to orthogonal canonical form have been performed, -C except scaling (which is undoed). -C - CALL MB01PD( 'U', 'G', N, N, 0, 0, ANORM, 0, NBLK, A, LDA, - $ INFO ) - CALL MB01PD( 'U', 'G', N, 1, 0, 0, BNORM, 0, NBLK, B, N, INFO ) - IF( LJOBF ) THEN - CALL DLASET( 'Full', N, N, ZERO, ZERO, Z, LDZ ) - CALL DLASET( 'Full', N, 1, ZERO, ZERO, TAU, N ) - ELSE IF( LJOBI ) THEN - CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDZ ) - END IF - END IF -C -C Set optimal workspace dimension. -C - DWORK(1) = WRKOPT -C - RETURN -C *** Last line of TB01ZD *** - END Deleted: trunk/octave-forge/main/control/devel/ss2tf/TB04BD.dat =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/TB04BD.dat 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/ss2tf/TB04BD.dat 2011-08-15 18:06:43 UTC (rev 8461) @@ -1,11 +0,0 @@ - TB04BD EXAMPLE PROGRAM DATA - 3 2 2 0.0 D I N - -1.0 0.0 0.0 - 0.0 -2.0 0.0 - 0.0 0.0 -3.0 - 0.0 1.0 -1.0 - 1.0 1.0 0.0 - 0.0 1.0 1.0 - 1.0 1.0 1.0 - 1.0 0.0 - 0.0 1.0 Deleted: trunk/octave-forge/main/control/devel/ss2tf/TB04BD.f =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/TB04BD.f 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/ss2tf/TB04BD.f 2011-08-15 18:06:43 UTC (rev 8461) @@ -1,600 +0,0 @@ - SUBROUTINE TB04BD( JOBD, ORDER, EQUIL, N, M, P, MD, A, LDA, B, - $ LDB, C, LDC, D, LDD, IGN, LDIGN, IGD, LDIGD, - $ GN, GD, TOL, IWORK, DWORK, LDWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2009 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute the transfer function matrix G of a state-space -C representation (A,B,C,D) of a linear time-invariant multivariable -C system, using the pole-zeros method. Each element of the transfer -C function matrix is returned in a cancelled, minimal form, with -C numerator and denominator polynomials stored either in increasing -C or decreasing order of the powers of the indeterminate. -C -C ARGUMENTS -C -C Mode Parameters -C -C JOBD CHARACTER*1 -C Specifies whether or not a non-zero matrix D appears in -C the given state-space model: -C = 'D': D is present; -C = 'Z': D is assumed to be a zero matrix. -C -C ORDER CHARACTER*1 -C Specifies the order in which the polynomial coefficients -C are stored, as follows: -C = 'I': Increasing order of powers of the indeterminate; -C = 'D': Decreasing order of powers of the indeterminate. -C -C EQUIL CHARACTER*1 -C Specifies whether the user wishes to preliminarily -C equilibrate the triplet (A,B,C) as follows: -C = 'S': perform equilibration (scaling); -C = 'N': do not perform equilibration. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the system (A,B,C,D). N >= 0. -C -C M (input) INTEGER -C The number of the system inputs. M >= 0. -C -C P (input) INTEGER -C The number of the system outputs. P >= 0. -C -C MD (input) INTEGER -C The maximum degree of the polynomials in G, plus 1. An -C upper bound for MD is N+1. MD >= 1. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the original state dynamics matrix A. -C On exit, if EQUIL = 'S', the leading N-by-N part of this -C array contains the balanced matrix inv(S)*A*S, as returned -C by SLICOT Library routine TB01ID. -C If EQUIL = 'N', this array is unchanged on exit. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (LDB,M) -C On entry, the leading N-by-M part of this array must -C contain the input matrix B. -C On exit, the contents of B are destroyed: all elements but -C those in the first row are set to zero. -C -C LDB INTEGER -C The leading dimension of array B. LDB >= MAX(1,N). -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading P-by-N part of this array must -C contain the output matrix C. -C On exit, if EQUIL = 'S', the leading P-by-N part of this -C array contains the balanced matrix C*S, as returned by -C SLICOT Library routine TB01ID. -C If EQUIL = 'N', this array is unchanged on exit. -C -C LDC INTEGER -C The leading dimension of array C. LDC >= MAX(1,P). -C -C D (input) DOUBLE PRECISION array, dimension (LDD,M) -C If JOBD = 'D', the leading P-by-M part of this array must -C contain the matrix D. -C If JOBD = 'Z', the array D is not referenced. -C -C LDD INTEGER -C The leading dimension of array D. -C LDD >= MAX(1,P), if JOBD = 'D'; -C LDD >= 1, if JOBD = 'Z'. -C -C IGN (output) INTEGER array, dimension (LDIGN,M) -C The leading P-by-M part of this array contains the degrees -C of the numerator polynomials in the transfer function -C matrix G. Specifically, the (i,j) element of IGN contains -C the degree of the numerator polynomial of the transfer -C function G(i,j) from the j-th input to the i-th output. -C -C LDIGN INTEGER -C The leading dimension of array IGN. LDIGN >= max(1,P). -C -C IGD (output) INTEGER array, dimension (LDIGD,M) -C The leading P-by-M part of this array contains the degrees -C of the denominator polynomials in the transfer function -C matrix G. Specifically, the (i,j) element of IGD contains -C the degree of the denominator polynomial of the transfer -C function G(i,j). -C -C LDIGD INTEGER -C The leading dimension of array IGD. LDIGD >= max(1,P). -C -C GN (output) DOUBLE PRECISION array, dimension (P*M*MD) -C This array contains the coefficients of the numerator -C polynomials, Num(i,j), of the transfer function matrix G. -C The polynomials are stored in a column-wise order, i.e., -C Num(1,1), Num(2,1), ..., Num(P,1), Num(1,2), Num(2,2), -C ..., Num(P,2), ..., Num(1,M), Num(2,M), ..., Num(P,M); -C MD memory locations are reserved for each polynomial, -C hence, the (i,j) polynomial is stored starting from the -C location ((j-1)*P+i-1)*MD+1. The coefficients appear in -C increasing or decreasing order of the powers of the -C indeterminate, according to ORDER. -C -C GD (output) DOUBLE PRECISION array, dimension (P*M*MD) -C This array contains the coefficients of the denominator -C polynomials, Den(i,j), of the transfer function matrix G. -C The polynomials are stored in the same way as the -C numerator polynomials. -C -C Tolerances -C -C TOL DOUBLE PRECISION -C The tolerance to be used in determining the -C controllability of a single-input system (A,b) or (A',c'), -C where b and c' are columns in B and C' (C transposed). If -C the user sets TOL > 0, then the given value of TOL is used -C as an absolute tolerance; elements with absolute value -C less than TOL are considered neglijible. If the user sets -C TOL <= 0, then an implicitly computed, default tolerance, -C defined by TOLDEF = N*EPS*MAX( NORM(A), NORM(bc) ) is used -C instead, where EPS is the machine precision (see LAPACK -C Library routine DLAMCH), and bc denotes the currently used -C column in B or C' (see METHOD). -C -C Workspace -C -C IWORK INTEGER array, dimension (N) -C -C DWORK DOUBLE PRECISION array, dimension (LDWORK) -C On exit, if INFO = 0, DWORK(1) returns the optimal value -C of LDWORK. -C -C LDWORK INTEGER -C The length of the array DWORK. -C LDWORK >= MAX(1, N*(N+P) + -C MAX( N + MAX( N,P ), N*(2*N+5))) -C If N >= P, N >= 1, the formula above can be written as -C LDWORK >= N*(3*N + P + 5). -C For optimum performance LDWORK should be larger. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value; -C = 1: the QR algorithm failed to converge when trying to -C compute the zeros of a transfer function; -C = 2: the QR algorithm failed to converge when trying to -C compute the poles of a transfer function. -C The errors INFO = 1 or 2 are unlikely to appear. -C -C METHOD -C -C The routine implements the pole-zero method proposed in [1]. -C This method is based on an algorithm for computing the transfer -C function of a single-input single-output (SISO) system. -C Let (A,b,c,d) be a SISO system. Its transfer function is computed -C as follows: -C -C 1) Find a controllable realization (Ac,bc,cc) of (A,b,c). -C 2) Find an observable realization (Ao,bo,co) of (Ac,bc,cc). -C 3) Compute the r eigenvalues of Ao (the poles of (Ao,bo,co)). -C 4) Compute the zeros of (Ao,bo,co,d). -C 5) Compute the gain of (Ao,bo,co,d). -C -C This algorithm can be implemented using only orthogonal -C transformations [1]. However, for better efficiency, the -C implementation in TB04BD uses one elementary transformation -C in Step 4 and r elementary transformations in Step 5 (to reduce -C an upper Hessenberg matrix to upper triangular form). These -C special elementary transformations are numerically stable -C in practice. -C -C In the multi-input multi-output (MIMO) case, the algorithm -C computes each element (i,j) of the transfer function matrix G, -C for i = 1 : P, and for j = 1 : M. For efficiency reasons, Step 1 -C is performed once for each value of j (each column of B). The -C matrices Ac and Ao result in Hessenberg form. -C -C REFERENCES -C -C [1] Varga, A. and Sima, V. -C Numerically Stable Algorithm for Transfer Function Matrix -C Evaluation. -C Int. J. Control, vol. 33, nr. 6, pp. 1123-1133, 1981. -C -C NUMERICAL ASPECTS -C -C The algorithm is numerically stable in practice and requires about -C 20*N**3 floating point operations at most, but usually much less. -C -C FURTHER COMMENTS -C -C For maximum efficiency of index calculations, GN and GD are -C implemented as one-dimensional arrays. -C -C CONTRIBUTORS -C -C V. Sima, Research Institute for Informatics, Bucharest, May 2002. -C Partly based on the BIMASC Library routine TSMT1 by A. Varga. -C -C REVISIONS -C -C - -C -C KEYWORDS -C -C Eigenvalue, state-space representation, transfer function, zeros. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE, C100 - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, C100 = 100.0D0 ) -C .. Scalar Arguments .. - CHARACTER EQUIL, JOBD, ORDER - DOUBLE PRECISION TOL - INTEGER INFO, LDA, LDB, LDC, LDD, LDIGD, LDIGN, LDWORK, - $ M, MD, N, P -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), - $ DWORK(*), GD(*), GN(*) - INTEGER IGD(LDIGD,*), IGN(LDIGN,*), IWORK(*) -C .. Local Scalars .. - DOUBLE PRECISION ANORM, DIJ, EPSN, MAXRED, TOLDEF, X - INTEGER I, IA, IAC, IAS, IB, IC, ICC, IERR, IIP, IM, - $ IP, IPM1, IRP, ITAU, ITAU1, IZ, J, JJ, JWORK, - $ JWORK1, K, L, NCONT, WRKOPT - LOGICAL ASCEND, DIJNZ, FNDEIG, WITHD -C .. Local Arrays .. - DOUBLE PRECISION Z(1) -C .. External Functions .. - LOGICAL LSAME - DOUBLE PRECISION DLAMCH, DLANGE - EXTERNAL DLAMCH, DLANGE, LSAME -C .. External Subroutines .. - EXTERNAL DAXPY, DCOPY, DHSEQR, DLACPY, MA02AD, MC01PD, - $ MC01PY, TB01ID, TB01ZD, TB04BX, XERBLA -C .. Intrinsic Functions .. - INTRINSIC ABS, DBLE, INT, MAX, MIN -C .. -C .. Executable Statements .. -C -C Test the input scalar parameters. -C - INFO = 0 - WITHD = LSAME( JOBD, 'D' ) - ASCEND = LSAME( ORDER, 'I' ) - IF( .NOT.WITHD .AND. .NOT.LSAME( JOBD, 'Z' ) ) THEN - INFO = -1 - ELSE IF( .NOT.ASCEND .AND. .NOT.LSAME( ORDER, 'D' ) ) THEN - INFO = -2 - ELSE IF( .NOT. ( LSAME( EQUIL, 'S' ) .OR. - $ LSAME( EQUIL, 'N' ) ) ) THEN - INFO = -3 - ELSE IF( N.LT.0 ) THEN - INFO = -4 - ELSE IF( M.LT.0 ) THEN - INFO = -5 - ELSE IF( P.LT.0 ) THEN - INFO = -6 - ELSE IF( MD.LT.1 ) THEN - INFO = -7 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -9 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -11 - ELSE IF( LDC.LT.MAX( 1, P ) ) THEN - INFO = -13 - ELSE IF( LDD.LT.1 .OR. ( WITHD .AND. LDD.LT.P ) ) THEN - INFO = -15 - ELSE IF( LDIGN.LT.MAX( 1, P ) ) THEN - INFO = -17 - ELSE IF( LDIGD.LT.MAX( 1, P ) ) THEN - INFO = -19 - ELSE IF( LDWORK.LT.MAX( 1, N*( N + P ) + - $ MAX( N + MAX( N, P ), N*( 2*N + 5 ) ) ) - $ ) THEN - INFO = -25 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'TB04BD', -INFO ) - RETURN - END IF -C -C Initialize GN and GD to zero. -C - Z(1) = ZERO - CALL DCOPY( P*M*MD, Z, 0, GN, 1 ) - CALL DCOPY( P*M*MD, Z, 0, GD, 1 ) -C -C Quick return if possible. -C - IF( MIN( N, P, M ).EQ.0 ) THEN - IF( MIN( P, M ).GT.0 ) THEN - K = 1 -C - DO 20 J = 1, M -C - DO 10 I = 1, P - IGN(I,J) = 0 - IGD(I,J) = 0 - IF ( WITHD ) - $ GN(K) = D(I,J) - GD(K) = ONE - K = K + MD - 10 CONTINUE -C - 20 CONTINUE -C - END IF - DWORK(1) = ONE - RETURN - END IF -C -C Prepare the computation of the default tolerance. -C - TOLDEF = TOL - IF( TOLDEF.LE.ZERO ) THEN - EPSN = DBLE( N )*DLAMCH( 'Epsilon' ) - ANORM = DLANGE( 'Frobenius', N, N, A, LDA, DWORK ) - END IF -C -C Initializations. -C - IA = 1 - IC = IA + N*N - ITAU = IC + P*N - JWORK = ITAU + N - IAC = ITAU -C - K = 1 - DIJ = ZERO -C -C (Note: Comments in the code beginning "Workspace:" describe the -C minimal amount of real workspace needed at that point in the -C code, as well as the preferred amount for good performance.) -C - IF( LSAME( EQUIL, 'S' ) ) THEN -C -C Scale simultaneously the matrices A, B and C: -C A <- inv(S)*A*S, B <- inv(S)*B and C <- C*S, where S is a -C diagonal scaling matrix. -C Workspace: need N. -C - MAXRED = C100 - CALL TB01ID( 'All', N, M, P, MAXRED, A, LDA, B, LDB, C, LDC, - $ DWORK, IERR ) - END IF -C -C Compute the transfer function matrix of the system (A,B,C,D). -C - DO 80 J = 1, M -C -C Save A and C. -C Workspace: need W1 = N*(N+P). -C - CALL DLACPY( 'Full', N, N, A, LDA, DWORK(IA), N ) - CALL DLACPY( 'Full', P, N, C, LDC, DWORK(IC), P ) -C -C Remove the uncontrollable part of the system (A,B(J),C). -C Workspace: need W1+N+MAX(N,P); -C prefer larger. -C - CALL TB01ZD( 'No Z', N, P, DWORK(IA), N, B(1,J), DWORK(IC), P, - $ NCONT, Z, 1, DWORK(ITAU), TOL, DWORK(JWORK), - $ LDWORK-JWORK+1, IERR ) - IF ( J.EQ.1 ) - $ WRKOPT = INT( DWORK(JWORK) ) + JWORK - 1 -C - IB = IAC + NCONT*NCONT - ICC = IB + NCONT - ITAU1 = ICC + NCONT - IRP = ITAU1 - IIP = IRP + NCONT - IAS = IIP + NCONT - JWORK1 = IAS + NCONT*NCONT -C - DO 70 I = 1, P - IF ( WITHD ) - $ DIJ = D(I,J) - IF ( NCONT.GT.0 ) THEN -C -C Form the matrices of the state-space representation of -C the dual system for the controllable part. -C Workspace: need W2 = W1+N*(N+2). -C - CALL MA02AD( 'Full', NCONT, NCONT, DWORK(IA), N, - $ DWORK(IAC), NCONT ) - CALL DCOPY( NCONT, B(1,J), 1, DWORK(IB), 1 ) - CALL DCOPY( NCONT, DWORK(IC+I-1), P, DWORK(ICC), 1 ) -C -C Remove the unobservable part of the system (A,B(J),C(I)). -C Workspace: need W2+2*N; -C prefer larger. -C - CALL TB01ZD( 'No Z', NCONT, 1, DWORK(IAC), NCONT, - $ DWORK(ICC), DWORK(IB), 1, IP, Z, 1, - $ DWORK(ITAU1), TOL, DWORK(IIP), LDWORK-IIP+1, - $ IERR ) - IF ( I.EQ.1 ) - $ WRKOPT = MAX( WRKOPT, INT( DWORK(IIP) ) + IIP - 1 ) -C - IF ( IP.GT.0 ) THEN -C -C Save the state matrix of the minimal part. -C Workspace: need W3 = W2+N*(N+2). -C - CALL DLACPY( 'Full', IP, IP, DWORK(IAC), NCONT, - $ DWORK(IAS), IP ) -C -C Compute the poles of the transfer function. -C Workspace: need W3+N; -C prefer larger. -C - CALL DHSEQR( 'Eigenvalues', 'No vectors', IP, 1, IP, - $ DWORK(IAC), NCONT, DWORK(IRP), - $ DWORK(IIP), Z, 1, DWORK(JWORK1), - $ LDWORK-JWORK1+1, IERR ) - IF ( IERR.NE.0 ) THEN - INFO = 2 - RETURN - END IF - WRKOPT = MAX( WRKOPT, - $ INT( DWORK(JWORK1) ) + JWORK1 - 1 ) -C -C Compute the zeros of the transfer function. -C - IPM1 = IP - 1 - DIJNZ = WITHD .AND. DIJ.NE.ZERO - FNDEIG = DIJNZ .OR. IPM1.GT.0 - IF ( .NOT.FNDEIG ) THEN - IZ = 0 - ELSE IF ( DIJNZ ) THEN -C -C Add the contribution due to D(i,j). -C Note that the matrix whose eigenvalues have to -C be computed remains in an upper Hessenberg form. -C - IZ = IP - CALL DLACPY( 'Full', IZ, IZ, DWORK(IAS), IP, - $ DWORK(IAC), NCONT ) - CALL DAXPY( IZ, -DWORK(ICC)/DIJ, DWORK(IB), 1, - $ DWORK(IAC), NCONT ) - ELSE - IF( TOL.LE.ZERO ) - $ TOLDEF = EPSN*MAX( ANORM, - $ DLANGE( 'Frobenius', IP, 1, - $ DWORK(IB), 1, DWORK ) - $ ) -C - DO 30 IM = 1, IPM1 - IF ( ABS( DWORK(IB+IM-1) ).GT.TOLDEF ) GO TO 40 - 30 CONTINUE -C - IZ = 0 - GO TO 50 -C - 40 CONTINUE -C -C Restore (part of) the saved state matrix. -C - IZ = IP - IM - CALL DLACPY( 'Full', IZ, IZ, DWORK(IAS+IM*(IP+1)), - $ IP, DWORK(IAC), NCONT ) -C -C Apply the output injection. -C - CALL DAXPY( IZ, -DWORK(IAS+IM*(IP+1)-IP)/ - $ DWORK(IB+IM-1), DWORK(IB+IM), 1, - $ DWORK(IAC), NCONT ) - END IF -C - IF ( FNDEIG ) THEN -C -C Find the zeros. -C Workspace: need W3+N; -C prefer larger. -C - CALL DHSEQR( 'Eigenvalues', 'No vectors', IZ, 1, - $ IZ, DWORK(IAC), NCONT, GN(K), GD(K), - $ Z, 1, DWORK(JWORK1), LDWORK-JWORK1+1, - $ IERR ) - IF ( IERR.NE.0 ) THEN - INFO = 1 - RETURN - END IF - END IF -C -C Compute the gain. -C - 50 CONTINUE - IF ( DIJNZ ) THEN - X = DIJ - ELSE - CALL TB04BX( IP, IZ, DWORK(IAS), IP, DWORK(ICC), - $ DWORK(IB), DIJ, DWORK(IRP), - $ DWORK(IIP), GN(K), GD(K), X, IWORK ) - END IF -C -C Form the numerator coefficients in increasing or -C decreasing powers of the indeterminate. -C IAS is used here as pointer to the workspace. -C - IF ( ASCEND ) THEN - CALL MC01PD( IZ, GN(K), GD(K), DWORK(IB), - $ DWORK(IAS), IERR ) - ELSE - CALL MC01PY( IZ, GN(K), GD(K), DWORK(IB), - $ DWORK(IAS), IERR ) - END IF - JJ = K -C - DO 60 L = IB, IB + IZ - GN(JJ) = DWORK(L)*X - JJ = JJ + 1 - 60 CONTINUE -C -C Form the denominator coefficients. -C - IF ( ASCEND ) THEN - CALL MC01PD( IP, DWORK(IRP), DWORK(IIP), GD(K), - $ DWORK(IAS), IERR ) - ELSE - CALL MC01PY( IP, DWORK(IRP), DWORK(IIP), GD(K), - $ DWORK(IAS), IERR ) - END IF - IGN(I,J) = IZ - IGD(I,J) = IP - ELSE -C -C Null element. -C - IGN(I,J) = 0 - IGD(I,J) = 0 - GN(K) = DIJ - GD(K) = ONE - END IF -C - ELSE -C -C Null element. -C - IGN(I,J) = 0 - IGD(I,J) = 0 - GN(K) = DIJ - GD(K) = ONE - END IF -C - K = K + MD - 70 CONTINUE -C - 80 CONTINUE -C - RETURN -C *** Last line of TB04BD *** - END Deleted: trunk/octave-forge/main/control/devel/ss2tf/TB04BD.html =================================================================== --- trunk/octave-forge/main/control/devel/ss2tf/TB04BD.html 2011-08-15 17:06:28 UTC (rev 8460) +++ trunk/octave-forge/main/control/devel/ss2tf/TB04BD.html 2011-08-15 18:06:43 UTC (rev 8461) @@ -1,418 +0,0 @@ -<HTML> -<HEAD><TITLE>TB04BD - SLICOT Library Routine Documentation</TITLE> -</HEAD> -<BODY> - -<H2><A Name="TB04BD">TB04BD</A></H2> -<H3> -Transfer matrix of a given state-space representation (A,B,C,D), using the pole-zeros method -</H3> -<A HREF ="#Specification"><B>[Specification]</B></A> -<A HREF ="#Arguments"><B>[Arguments]</B></A> -<A HREF ="#Method"><B>[Method]</B></A> -<A HREF ="#References"><B>[References]</B></A> -<A HREF ="#Comments"><B>[Comments]</B></A> -<A HREF ="#Example"><B>[Example]</B></A> - -<P> -<B><FONT SIZE="+1">Purpose</FONT></B> -<PRE> - To compute the transfer function matrix G of a state-space - representation (A,B,C,D) of a linear time-invariant multivariable - system, using the pole-zeros method. Each element of the transfer - function matrix is returned in a cancelled, minimal form, with - numerator and denominator polynomials stored either in increasing - or decreasing order of the powers of the indeterminate. - -</PRE> -<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A> -<PRE> - SUBROUTINE TB04BD( JOBD, ORDER, EQUIL, N, M, P, MD, A, LDA, B, - $ LDB, C, LDC, D, LDD, IGN, LDIGN, IGD, LDIGD, - $ GN, GD, TOL, IWORK, DWORK, LDWORK, INFO ) -C .. Scalar Arguments .. - CHARACTER EQUIL, JOBD, ORDER - DOUBLE PRECISION TOL - INTEGER INFO, LDA, LDB, LDC, LDD, LDIGD, LDIGN, LDWORK, - $ M, MD, N, P -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), - $ DWORK(*), GD(*), GN(*) - INTEGER IGD(LDIGD,*), IGN(LDIGN,*), IWORK(*) - -</PRE> -<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A> -<P> - -<B>Mode Parameters</B> -<PRE> - JOBD CHARACTER*1 - Specifies whether or not a non-zero matrix D appears in - the given state-space model: - = 'D': D is present; - = 'Z': D is assumed to be a zero matrix. - - ORDER CHARACTER*1 - Specifies the order in which the polynomial coefficients - are stored, as follows: - = 'I': Increasing order of powers of the indeterminate; - = 'D': Decreasing order of powers of the indeterminate. - - EQUIL CHARACTER*1 - Specifies whether the user wishes to preliminarily - equilibrate the triplet (A,B,C) as follows: - = 'S': perform equilibration (scaling); - = 'N': do not perform equilibration. - -</PRE> -<B>Input/Output Parameters</B> -<PRE> - N (input) INTEGER - The order of the system (A,B,C,D). N >= 0. - - M (input) INTEGER - The number of the system inputs. M >= 0. - - P (input) INTEGER - The number of the system outputs. P >= 0. - - MD (input) INTEGER - The maximum degree of the polynomials in G, plus 1. An - upper bound for MD is N+1. MD >= 1. - - A (input/output) DOUBLE PRECISION array, dimension (LDA,N) - On entry, the leading N-by-N part of this array must - contain the original state dynamics matrix A. - On exit, if EQUIL = 'S', the leading N-by-N part of this - array contains the balanced matrix inv(S)*A*S, as returned - by SLICOT Library routine TB01ID. - If EQUIL = 'N', this array is unchanged on exit. - - LDA INTEGER - The leading dimension of array A. LDA >= MAX(1,N). - - B (input/output) DOUBLE PRECISION array, dimension (LDB,M) - On entry, the leading N-by-M part of this array must - contain the input matrix B. - On exit, the contents of B are destroyed: all elements but - those in the first row are set to zero. - - LDB INTEGER - The leading dimension of array B. LDB >= MAX(1,N). - - C (input/output) DOUBLE PRECISION array, dimension (LDC,N) - On entry, the leading P-by-N part of this array must - contain the output matrix C. - On exit, if EQUIL = 'S', the leading P-by-N part of this - array contains the balanced matrix C*S, as returned by - SLICOT Library routine TB01ID. - If EQUIL = 'N', this array is unchanged on exit. - - LDC INTEGER - The leading dimension of array C. LDC >= MAX(1,P). - - D (input) DOUBLE PRECISION array, dimension (LDD,M) - If JOBD = 'D', the leading P-by-M part of this array must - contain the matrix D. - If JOBD = 'Z', the array D is not referenced. - - LDD INTEGER - The leading dimension of array D. - LDD >= MAX(1,P), if JOBD = 'D'; - LDD >= 1, if JOBD = 'Z'. - - IGN (output) INTEGER array, dimension (LDIGN,M) - The leading P-by-M part of this array contains the degrees - of the numerator polynomials in the transfer function - matrix G. Specifically, the (i,j) element of IGN contains - the degree of the numerator polynomial of the transfer - function G(i,j) from the j-th input to the i-th output. - - LDIGN INTEGER - The leading dimension of array IGN. LDIGN >= max(1,P). - - IGD (output) INTEGER array, dimension (LDIGD,M) - The leading P-by-M part of this array contains the degrees - of the denominator polynomials in the transfer function - matrix G. Specifically, the (i,j) element of IGD contains - the degree of the denominator polynomial of the transfer - function G(i,j). - - LDIGD INTEGER - The leading dimension of array IGD. LDIGD >= max(1,P). - - GN (output) DOUBLE PRECISION array, dimension (P*M*MD) - This array contains the coefficients of the numerator - polynomials, Num(i,j), of the transfer function matrix G. - The polynomials are stored in a column-wise order, i.e., - Num(1,1), Num(2,1), ..., Num(P,1), Num(1,2), Num(2,2), - ..., Num(P,2), ..., Num(1,M), Num(2,M), ..., Num(P,M); - MD memory locations are reserved for each polynomial, - hence, the (i,j) polynomial is stored starting from the - location ((j-1)*P+i-1)*MD+1. The coefficients appear in - increasing or decreasing order of the powers of the - indeterminate, according to ORDER. - - GD (output) DOUBLE PRECISION array, dimension (P*M*MD) - This array contains the coefficients of the denominator - polynomials, Den(i,j), of the transfer function matrix G. - The polynomials are stored in the same way as the - numerator polynomials. - -</PRE> -<B>Tolerances</B> -<PRE> - TOL DOUBLE PRECISION - The tolerance to be used in determining the - controllability of a single-input system (A,b) or (A',c'), - where b and c' are columns in B and C' (C transposed). If - the user sets TOL > 0, then the given value of TOL is used - as an absolute tolerance; elements with absolute value - less than TOL are considered neglijible. If the user sets - TOL <= 0, then an implicitly computed, default tolerance, - defined by TOLDEF = N*EPS*MAX( NORM(A), NORM(bc) ) is used - ... [truncated message content] |
From: <par...@us...> - 2011-08-22 16:09:06
|
Revision: 8473 http://octave.svn.sourceforge.net/octave/?rev=8473&view=rev Author: paramaniac Date: 2011-08-22 16:08:57 +0000 (Mon, 22 Aug 2011) Log Message: ----------- control: prepare release of control-2.1.54 Modified Paths: -------------- trunk/octave-forge/main/control/DESCRIPTION trunk/octave-forge/main/control/devel/RELEASE_PACKAGE trunk/octave-forge/main/control/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/control/doc/control.pdf Modified: trunk/octave-forge/main/control/DESCRIPTION =================================================================== --- trunk/octave-forge/main/control/DESCRIPTION 2011-08-19 16:20:21 UTC (rev 8472) +++ trunk/octave-forge/main/control/DESCRIPTION 2011-08-22 16:08:57 UTC (rev 8473) @@ -1,6 +1,6 @@ Name: Control -Version: 2.1.53 -Date: 2011-08-08 +Version: 2.1.54 +Date: 2011-08-22 Author: Lukas Reichlin <luk...@gm...> Maintainer: Lukas Reichlin <luk...@gm...> Title: Control Systems Modified: trunk/octave-forge/main/control/devel/RELEASE_PACKAGE =================================================================== --- trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-08-19 16:20:21 UTC (rev 8472) +++ trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-08-22 16:08:57 UTC (rev 8473) @@ -18,12 +18,12 @@ rm -R ~/octave/__TEMP__/control/devel cd ~/octave/__TEMP__ grep -i version control/DESCRIPTION -tar czf control-2.1.53.tar.gz control/ -md5 control-2.1.53.tar.gz -md5 control-2.1.53.tar.gz > md5_control_pkg.txt -uuencode control-2.1.53.tar.gz < control-2.1.53.tar.gz > control-2.1.53.tar.gz.uue +tar czf control-2.1.54.tar.gz control/ +md5 control-2.1.54.tar.gz +md5 control-2.1.54.tar.gz > md5_control_pkg.txt +uuencode control-2.1.54.tar.gz < control-2.1.54.tar.gz > control-2.1.54.tar.gz.uue octave -q --eval \ -"pkg install control-2.1.53.tar.gz" +"pkg install control-2.1.54.tar.gz" octave -q --eval \ "pkg load generate_html; generate_package_html ('control', 'control-html', 'octave-forge')" tar czf control-html.tar.gz control-html @@ -38,7 +38,7 @@ ===================================================================================== rm -R ~/octave/__TEMP__ -rm -R ~/octave/control-2.1.53 +rm -R ~/octave/control-2.1.54 ===================================================================================== Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-08-19 16:20:21 UTC (rev 8472) +++ trunk/octave-forge/main/control/doc/NEWS 2011-08-22 16:08:57 UTC (rev 8473) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the control package =============================================================================== -control-2.x.yy Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +control-2.1.54 Release Date: 2011-08-22 Release Manager: Lukas Reichlin =============================================================================== ** tf @@ -10,7 +10,11 @@ -- Display an empty line between title and numerator for better readability. -- Display whether model is static, continuous- or discrete-time. +** A PDF manual is included for the first time. It is located inside the "doc" + folder. It has been generated automatically from the Texinfo help strings + and is not yet completely sorted out. + =============================================================================== control-2.1.53 Release Date: 2011-08-08 Release Manager: Lukas Reichlin =============================================================================== Added: trunk/octave-forge/main/control/doc/control.pdf =================================================================== --- trunk/octave-forge/main/control/doc/control.pdf (rev 0) +++ trunk/octave-forge/main/control/doc/control.pdf 2011-08-22 16:08:57 UTC (rev 8473) @@ -0,0 +1,3313 @@ +%PDF-1.3 +%\xC7쏢 +5 0 obj +<</Length 6 0 R/Filter /FlateDecode>> +stream +x\x9C\x95S\xC9n1\xEDY_\xA1\xA3tZ\x94(\x89\xBA:MS]\xE2d\x8A\x82\xD7q\x8B\xC6-\xBC\xA4@\xFF\xBE\xE4Ll\xE7\x90\x8A\xC1\x8C\xF2qyO\x9C\x8D +\x806\xE8\xF3t.\xD6frU\xEDjg\x82\xBD\x90we6\x80}:k;\xED\xC46(\x99\xB3\xED\xEF͘\x8C\xB6F[B\x82j\xFB\xB5\xB9u\x80\xA8\xA6\xD0\xDC/ߡ\xD8 +\xAB\xFB\xE9c\x81\xA2\xDB{\x84D\xA9\xBA\xAD\xE00p\x8D\xF9\x88\xA3\xEA|\x97jē\xD4,5Fr\xF8\xA27\x9F\xBC4\x9A\xCC\xFC\xA5g\xCE{37K9\x95aڎ\xB0\xAD\xD9\xE6\xD6\x88\x95\xFFtf&\xB3v\xBF}\\x9AɍE3y\xAB\x9F\xE9\xE5\x99\xB3\xD7\xF6\x959\x9F\xD9\xF9?uA\xF5@ +\x9F\x93b\x82B63ҨΙ\xEFH\xF8\xE6Q\x90ְ\x89" B@E\xBA<\xC4T\x84\xC4и\xB8k\xDF\xF7G(\xB9\x9D\xF2\x92\x81\xE9Y\xC6ғ[\xFB.\xAA_\xC0;\xCDgw\xE9S\xCB\xDFI\xC1\x85Ofv?|N\xA0\xC1\xBD\x92w)9\xB9I0\xB9\xFBS%\x9Db\xABղ4"w\xE1\x81\x8Fb\x85\x90#\xBA\xCF\xD6\xC4\xEC> )\x88\x8At:X\xFBcΝvo\\xB3\xFB\xED\xD3\xC0!\xE9\xE4#N/I\xF7 +I֢D\x95\xAF\x8BU\xB7\x8E\xE4zX\x84\xFB*½\xD7\xE1rl\xA5\xB9G5a!\xA5S\xA1\x94\xAAM\xC4d\xE0A\x85rtoĔ\xCE,R\xC1\xB8X,\xBD\xAF\x9A\x89P\xC9G\xA8\xBB\xEF\xEA\xC3Ъj\x85\x90ks\xDF\xC66Q8FGr\x94<\x84_\xDC3\xF9O\xE8\xB0g\x8C "\xE3\xEC\xD9\xDC\xFC\xAE\xCB\xC1Bendstream +endobj +6 0 obj +492 +endobj +15 0 obj +<</Length 16 0 R/Filter /FlateDecode>> +stream +x\x9C\xADWKo\xDBF\xBE\xFD<r\x8B\x90\xE5\xBE\xC8\xDDk\x8B\xB6@\x91C\xE8\x96\xF6\xA0X\x8Aď\xC6v\\xF4\xDFw\xBE\x99}Q\xB2k'-Fw\xDE\xF3}3\x9BO\xDD4\xEAn\xC2_\xFA<\xBB\xDA|\xF7f\xE9\xCE\xEF6S\xF73=\xE7\x9BO\xCD]\xFA8\xBB\xEA\xBEߒ\x90ƛ1NQw\xDB\xF7\xD1\xD6\xDDb:\xED\xE7\xD1\xCD\xDD\xF6j\xF3\xB6\xFFA +\xAE\xBFQ\xBE\xFFS\x99y\x8C\xD1\xF8\xFEo5\xE8\xFEV +\xBE\xFF\xA0LNg\xCA,㤭\xE9\xEF\x95\xFDc\xFB\xCBƻ\xD1\xD8((\xEB\xE32\x93\xAD=\xD9:S\x87\xE4yi=\xB6ւ\xBF\x93u\x9DD\xD7A\xBA\xD1\xEB)P\x963\xE4{JO\xA4gP\xB6\xBC\xD3\xE9y\xA5\xEC8M\xBA\xAD\xD3V\xC3\xDCT\xE14\xCDK\xBF#\x91;\xB1\xC9\xF5?)C\x9F!\xCC\xFDH/M \xA1\xA5\xA3(>z\xABM\xE8\xCAq\xDAgʢ:R\xF2d\xF0\x92^\xE1\xF55\xFD@\xE0\xC3\xEC\xC7\xC5S=\x8FF\xA2\xFDU\xD9I*#\\xC0+r\xC2zw\x8D\xFF\xC1/ԛ,YJwҾ\xC4\xC8?Qq\xD6ޱ\x98\xB4\x95g\xBB{\xC4\xED\xF9\xE7 +}\x9D(u\xED\xC4\xE4?*k\x90\xD4L\xC2\xE4\xC0s\x82b\x88\xD2\xD8'\x8D)\xE0\xEB\x9C=\xA36\xC1EE!\xA5\xFB\xF8$\xFAw\x90\xE5\xC2\x89\xE2\xA5ZR%\xC8eM\x99eᰈ\xC2\xE2C\x9F\xA3J\xE0R |
From: <par...@us...> - 2011-09-03 18:50:42
|
Revision: 8488 http://octave.svn.sourceforge.net/octave/?rev=8488&view=rev Author: paramaniac Date: 2011-09-03 18:50:35 +0000 (Sat, 03 Sep 2011) Log Message: ----------- control: add bilinear transformation (c2d case) Modified Paths: -------------- trunk/octave-forge/main/control/devel/makefile_all.m trunk/octave-forge/main/control/inst/@ss/__c2d__.m trunk/octave-forge/main/control/inst/@tf/__c2d__.m trunk/octave-forge/main/control/inst/ltimodels.m trunk/octave-forge/main/control/src/Makefile Added Paths: ----------- trunk/octave-forge/main/control/devel/makefile_tustin.m trunk/octave-forge/main/control/src/AB04MD.f trunk/octave-forge/main/control/src/slab04md.cc Modified: trunk/octave-forge/main/control/devel/makefile_all.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_all.m 2011-09-03 16:37:43 UTC (rev 8487) +++ trunk/octave-forge/main/control/devel/makefile_all.m 2011-09-03 18:50:35 UTC (rev 8488) @@ -25,7 +25,7 @@ makefile_scale makefile_ss2tf makefile_staircase +makefile_tustin makefile_zero -system ("rm *.o"); cd (homedir); Added: trunk/octave-forge/main/control/devel/makefile_tustin.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_tustin.m (rev 0) +++ trunk/octave-forge/main/control/devel/makefile_tustin.m 2011-09-03 18:50:35 UTC (rev 8488) @@ -0,0 +1,19 @@ +## ============================================================================== +## Developer Makefile for OCT-files +## ============================================================================== +## USAGE: * fetch control from Octave-Forge by svn +## * add control/inst, control/src and control/devel to your Octave path +## * run makefile_* +## ============================================================================== + +homedir = pwd (); +develdir = fileparts (which ("makefile_tustin")); +srcdir = [develdir, "/../src"]; +cd (srcdir); + +## bilinear transformation +mkoctfile slab04md.cc \ + AB04MD.f + +system ("rm *.o"); +cd (homedir); Modified: trunk/octave-forge/main/control/inst/@ss/__c2d__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-03 16:37:43 UTC (rev 8487) +++ trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-03 18:50:35 UTC (rev 8488) @@ -44,6 +44,19 @@ sys.a = tmp (1:n, 1:n); # F sys.b = tmp (1:n, n+(1:m)); # G + case {"tustin", "bilin"} + if (! isempty (sys.e)) + if (rcond (sys.e) < eps) + error ("ss: c2d: tustin method requires proper system"); + else + sys.a = sys.e \ sys.a; + sys.b = sys.e \ sys.b; + sys.e = []; # require ordinary state-space model + endif + endif + + [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, 2/tsam, false); + otherwise error ("ss: c2d: %s is an invalid method", method); Modified: trunk/octave-forge/main/control/inst/@tf/__c2d__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__c2d__.m 2011-09-03 16:37:43 UTC (rev 8487) +++ trunk/octave-forge/main/control/inst/@tf/__c2d__.m 2011-09-03 18:50:35 UTC (rev 8488) @@ -26,13 +26,13 @@ [p, m] = size (sys); - switch (method) - case {"zoh", "std"} + ##switch (method) + ## case {"zoh", "std"} error ("tf: c2d: not implemented yet"); - otherwise - error ("tf: c2d: %s is an invalid method", method); + ## otherwise + ## error ("tf: c2d: %s is an invalid method", method); - endswitch + ##endswitch endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/ltimodels.m =================================================================== --- trunk/octave-forge/main/control/inst/ltimodels.m 2011-09-03 16:37:43 UTC (rev 8487) +++ trunk/octave-forge/main/control/inst/ltimodels.m 2011-09-03 18:50:35 UTC (rev 8488) @@ -1229,3 +1229,71 @@ %! %!assert (NUM, NUMe, 1e-4); %!assert (DEN, DENe, 1e-4); + + +## bilinear transformation +%!shared Mo, Me +%! A = [ 1.0 0.5 +%! 0.5 1.0 ].'; +%! +%! B = [ 0.0 -1.0 +%! 1.0 0.0 ].'; +%! +%! C = [ -1.0 0.0 +%! 0.0 1.0 ].'; +%! +%! D = [ 1.0 0.0 +%! 0.0 -1.0 ].'; +%! +%! [Ao, Bo, Co, Do] = slab04md (A, B, C, D, 1.0, 1.0, false); +%! +%! Ae = [ -1.0000 -4.0000 +%! -4.0000 -1.0000 ]; +%! +%! Be = [ 2.8284 0.0000 +%! 0.0000 -2.8284 ]; +%! +%! Ce = [ 0.0000 2.8284 +%! -2.8284 0.0000 ]; +%! +%! De = [ -1.0000 0.0000 +%! 0.0000 -3.0000 ]; +%! +%! Mo = [Ao, Bo; Co, Do]; +%! Me = [Ae, Be; Ce, De]; +%! +%!assert (Mo, Me, 1e-4); + + +## bilinear transformation +%!shared Mo, Me +%! A = [ 1.0 0.5 +%! 0.5 1.0 ].'; +%! +%! B = [ 0.0 -1.0 +%! 1.0 0.0 ].'; +%! +%! C = [ -1.0 0.0 +%! 0.0 1.0 ].'; +%! +%! D = [ 1.0 0.0 +%! 0.0 -1.0 ].'; +%! +%! [Ao, Bo, Co, Do] = ssdata (c2d (ss (A, B, C, D), 2, "tustin")); +%! +%! Ae = [ -1.0000 -4.0000 +%! -4.0000 -1.0000 ]; +%! +%! Be = [ 2.8284 0.0000 +%! 0.0000 -2.8284 ]; +%! +%! Ce = [ 0.0000 2.8284 +%! -2.8284 0.0000 ]; +%! +%! De = [ -1.0000 0.0000 +%! 0.0000 -3.0000 ]; +%! +%! Mo = [Ao, Bo; Co, Do]; +%! Me = [Ae, Be; Ce, De]; +%! +%!assert (Mo, Me, 1e-4); Added: trunk/octave-forge/main/control/src/AB04MD.f =================================================================== --- trunk/octave-forge/main/control/src/AB04MD.f (rev 0) +++ trunk/octave-forge/main/control/src/AB04MD.f 2011-09-03 18:50:35 UTC (rev 8488) @@ -0,0 +1,345 @@ + SUBROUTINE AB04MD( TYPE, N, M, P, ALPHA, BETA, A, LDA, B, LDB, C, + $ LDC, D, LDD, IWORK, DWORK, LDWORK, INFO ) +C +C SLICOT RELEASE 5.0. +C +C Copyright (c) 2002-2010 NICONET e.V. +C +C This program is free software: you can redistribute it and/or +C modify it under the terms of the GNU General Public License as +C published by the Free Software Foundation, either version 2 of +C the License, or (at your option) any later version. +C +C This program is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +C GNU General Public License for more details. +C +C You should have received a copy of the GNU General Public License +C along with this program. If not, see +C <http://www.gnu.org/licenses/>. +C +C PURPOSE +C +C To perform a transformation on the parameters (A,B,C,D) of a +C system, which is equivalent to a bilinear transformation of the +C corresponding transfer function matrix. +C +C ARGUMENTS +C +C Mode Parameters +C +C TYPE CHARACTER*1 +C Indicates the type of the original system and the +C transformation to be performed as follows: +C = 'D': discrete-time -> continuous-time; +C = 'C': continuous-time -> discrete-time. +C +C Input/Output Parameters +C +C N (input) INTEGER +C The order of the state matrix A. N >= 0. +C +C M (input) INTEGER +C The number of system inputs. M >= 0. +C +C P (input) INTEGER +C The number of system outputs. P >= 0. +C +C ALPHA, (input) DOUBLE PRECISION +C BETA Parameters specifying the bilinear transformation. +C Recommended values for stable systems: ALPHA = 1, +C BETA = 1. ALPHA <> 0, BETA <> 0. +C +C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) +C On entry, the leading N-by-N part of this array must +C contain the state matrix A of the original system. +C On exit, the leading N-by-N part of this array contains +C _ +C the state matrix A of the transformed system. +C +C LDA INTEGER +C The leading dimension of array A. LDA >= MAX(1,N). +C +C B (input/output) DOUBLE PRECISION array, dimension (LDB,M) +C On entry, the leading N-by-M part of this array must +C contain the input matrix B of the original system. +C On exit, the leading N-by-M part of this array contains +C _ +C the input matrix B of the transformed system. +C +C LDB INTEGER +C The leading dimension of array B. LDB >= MAX(1,N). +C +C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) +C On entry, the leading P-by-N part of this array must +C contain the output matrix C of the original system. +C On exit, the leading P-by-N part of this array contains +C _ +C the output matrix C of the transformed system. +C +C LDC INTEGER +C The leading dimension of array C. LDC >= MAX(1,P). +C +C D (input/output) DOUBLE PRECISION array, dimension (LDD,M) +C On entry, the leading P-by-M part of this array must +C contain the input/output matrix D for the original system. +C On exit, the leading P-by-M part of this array contains +C _ +C the input/output matrix D of the transformed system. +C +C LDD INTEGER +C The leading dimension of array D. LDD >= MAX(1,P). +C +C Workspace +C +C IWORK INTEGER array, dimension (N) +C +C DWORK DOUBLE PRECISION array, dimension (LDWORK) +C On exit, if INFO = 0, DWORK(1) returns the optimal value +C of LDWORK. +C +C LDWORK INTEGER +C The length of the array DWORK. LDWORK >= MAX(1,N). +C For optimum performance LDWORK >= MAX(1,N*NB), where NB +C is the optimal blocksize. +C +C Error Indicator +C +C INFO INTEGER +C = 0: successful exit; +C < 0: if INFO = -i, the i-th argument had an illegal +C value; +C = 1: if the matrix (ALPHA*I + A) is exactly singular; +C = 2: if the matrix (BETA*I - A) is exactly singular. +C +C METHOD +C +C The parameters of the discrete-time system are transformed into +C the parameters of the continuous-time system (TYPE = 'D'), or +C vice-versa (TYPE = 'C') by the transformation: +C +C 1. Discrete -> continuous +C _ -1 +C A = beta*(alpha*I + A) * (A - alpha*I) +C _ -1 +C B = sqrt(2*alpha*beta) * (alpha*I + A) * B +C _ -1 +C C = sqrt(2*alpha*beta) * C * (alpha*I + A) +C _ -1 +C D = D - C * (alpha*I + A) * B +C +C which is equivalent to the bilinear transformation +C +C z - alpha +C z -> s = beta --------- . +C z + alpha +C +C of one transfer matrix onto the other. +C +C 2. Continuous -> discrete +C _ -1 +C A = alpha*(beta*I - A) * (beta*I + A) +C _ -1 +C B = sqrt(2*alpha*beta) * (beta*I - A) * B +C _ -1 +C C = sqrt(2*alpha*beta) * C * (beta*I - A) +C _ -1 +C D = D + C * (beta*I - A) * B +C +C which is equivalent to the bilinear transformation +C +C beta + s +C s -> z = alpha -------- . +C beta - s +C +C of one transfer matrix onto the other. +C +C REFERENCES +C +C [1] Al-Saggaf, U.M. and Franklin, G.F. +C Model reduction via balanced realizations: a extension and +C frequency weighting techniques. +C IEEE Trans. Autom. Contr., AC-33, pp. 687-692, 1988. +C +C NUMERICAL ASPECTS +C 3 +C The time taken is approximately proportional to N . +C The accuracy depends mainly on the condition number of the matrix +C to be inverted. +C +C CONTRIBUTORS +C +C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, and +C A. Varga, German Aerospace Research Establishment, +C Oberpfaffenhofen, Germany, Nov. 1996. +C Supersedes Release 2.0 routine AB04AD by W. van der Linden, and +C A.J. Geurts, Technische Hogeschool Eindhoven, Holland. +C +C REVISIONS +C +C - +C +C KEYWORDS +C +C Bilinear transformation, continuous-time system, discrete-time +C system, state-space model. +C +C ****************************************************************** +C +C .. Parameters .. + DOUBLE PRECISION ZERO, ONE, TWO + PARAMETER ( ZERO=0.0D0, ONE=1.0D0, TWO=2.0D0 ) +C .. Scalar Arguments .. + CHARACTER TYPE + INTEGER INFO, LDA, LDB, LDC, LDD, LDWORK, M, N, P + DOUBLE PRECISION ALPHA, BETA +C .. Array Arguments .. + INTEGER IWORK(*) + DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*), DWORK(*) +C .. Local Scalars .. + LOGICAL LTYPE + INTEGER I, IP + DOUBLE PRECISION AB2, PALPHA, PBETA, SQRAB2 +C .. External Functions .. + LOGICAL LSAME + EXTERNAL LSAME +C .. External Subroutines .. + EXTERNAL DGEMM, DGETRF, DGETRS, DGETRI, DLASCL, DSCAL, + $ DSWAP, XERBLA +C .. Intrinsic Functions .. + INTRINSIC ABS, MAX, SIGN, SQRT +C .. Executable Statements .. +C + INFO = 0 + LTYPE = LSAME( TYPE, 'D' ) +C +C Test the input scalar arguments. +C + IF( .NOT.LTYPE .AND. .NOT.LSAME( TYPE, 'C' ) ) THEN + INFO = -1 + ELSE IF( N.LT.0 ) THEN + INFO = -2 + ELSE IF( M.LT.0 ) THEN + INFO = -3 + ELSE IF( P.LT.0 ) THEN + INFO = -4 + ELSE IF( ALPHA.EQ.ZERO ) THEN + INFO = -5 + ELSE IF( BETA.EQ.ZERO ) THEN + INFO = -6 + ELSE IF( LDA.LT.MAX( 1, N ) ) THEN + INFO = -8 + ELSE IF( LDB.LT.MAX( 1, N ) ) THEN + INFO = -10 + ELSE IF( LDC.LT.MAX( 1, P ) ) THEN + INFO = -12 + ELSE IF( LDD.LT.MAX( 1, P ) ) THEN + INFO = -14 + ELSE IF( LDWORK.LT.MAX( 1, N ) ) THEN + INFO = -17 + END IF +C + IF ( INFO.NE.0 ) THEN +C +C Error return. +C + CALL XERBLA( 'AB04MD', -INFO ) + RETURN + END IF +C +C Quick return if possible. +C + IF ( MAX( N, M, P ).EQ.0 ) + $ RETURN +C +C (Note: Comments in the code beginning "Workspace:" describe the +C minimal amount of real workspace needed at that point in the +C code, as well as the preferred amount for good performance. +C NB refers to the optimal block size for the immediately +C following subroutine, as returned by ILAENV.) +C + IF (LTYPE) THEN +C +C Discrete-time to continuous-time with (ALPHA, BETA). +C + PALPHA = ALPHA + PBETA = BETA + ELSE +C +C Continuous-time to discrete-time with (ALPHA, BETA) is +C equivalent with discrete-time to continuous-time with +C (-BETA, -ALPHA), if B and C change the sign. +C + PALPHA = -BETA + PBETA = -ALPHA + END IF +C + AB2 = PALPHA*PBETA*TWO + SQRAB2 = SIGN( SQRT( ABS( AB2 ) ), PALPHA ) +C -1 +C Compute (alpha*I + A) . +C + DO 10 I = 1, N + A(I,I) = A(I,I) + PALPHA + 10 CONTINUE +C + CALL DGETRF( N, N, A, LDA, IWORK, INFO ) +C + IF (INFO.NE.0) THEN +C +C Error return. +C + IF (LTYPE) THEN + INFO = 1 + ELSE + INFO = 2 + END IF + RETURN + END IF +C -1 +C Compute (alpha*I+A) *B. +C + CALL DGETRS( 'No transpose', N, M, A, LDA, IWORK, B, LDB, INFO ) +C -1 +C Compute D - C*(alpha*I+A) *B. +C + CALL DGEMM( 'No transpose', 'No transpose', P, M, N, -ONE, C, + $ LDC, B, LDB, ONE, D, LDD ) +C +C Scale B by sqrt(2*alpha*beta). +C + CALL DLASCL( 'General', 0, 0, ONE, SQRAB2, N, M, B, LDB, INFO ) +C -1 +C Compute sqrt(2*alpha*beta)*C*(alpha*I + A) . +C + CALL DTRSM( 'Right', 'Upper', 'No transpose', 'Non-unit', P, N, + $ SQRAB2, A, LDA, C, LDC ) +C + CALL DTRSM( 'Right', 'Lower', 'No transpose', 'Unit', P, N, ONE, + $ A, LDA, C, LDC ) +C +C Apply column interchanges to the solution matrix. +C + DO 20 I = N-1, 1, -1 + IP = IWORK(I) + IF ( IP.NE.I ) + $ CALL DSWAP( P, C(1,I), 1, C(1,IP), 1 ) + 20 CONTINUE +C -1 +C Compute beta*(alpha*I + A) *(A - alpha*I) as +C -1 +C beta*I - 2*alpha*beta*(alpha*I + A) . +C +C Workspace: need N; prefer N*NB. +C + CALL DGETRI( N, A, LDA, IWORK, DWORK, LDWORK, INFO ) +C + DO 30 I = 1, N + CALL DSCAL(N, -AB2, A(1,I), 1) + A(I,I) = A(I,I) + PBETA + 30 CONTINUE +C + RETURN +C *** Last line of AB04MD *** + END Property changes on: trunk/octave-forge/main/control/src/AB04MD.f ___________________________________________________________________ Added: svn:executable + * Modified: trunk/octave-forge/main/control/src/Makefile =================================================================== --- trunk/octave-forge/main/control/src/Makefile 2011-09-03 16:37:43 UTC (rev 8487) +++ trunk/octave-forge/main/control/src/Makefile 2011-09-03 18:50:35 UTC (rev 8488) @@ -4,6 +4,7 @@ sltb01pd.oct slsb03od.oct slsg03bd.oct slag08bd.oct sltg01jd.oct \ sltg01hd.oct sltg01id.oct slsg02ad.oct sltg04bx.oct sltb01id.oct \ sltg01ad.oct slsb10id.oct slsb10kd.oct slsb10zd.oct sltb04bd.oct \ + slab04md.oct \ is_real_scalar.oct is_real_vector.oct is_real_matrix.oct \ is_real_square_matrix.oct @@ -212,6 +213,11 @@ TB04BX.f MA02AD.f MB02RD.f MB01PD.f MB02SD.f \ MB01QD.f +# bilinear transformation +slab04md.oct: slab04md.cc + mkoctfile slab04md.cc \ + AB04MD.f + # helpers is_real_scalar.oct: is_real_scalar.cc mkoctfile is_real_scalar.cc Added: trunk/octave-forge/main/control/src/slab04md.cc =================================================================== --- trunk/octave-forge/main/control/src/slab04md.cc (rev 0) +++ trunk/octave-forge/main/control/src/slab04md.cc 2011-09-03 18:50:35 UTC (rev 8488) @@ -0,0 +1,128 @@ +/* + +Copyright (C) 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +LTI Syncope is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Discrete-time <--> continuous-time systems conversion +by a bilinear transformation. +Uses SLICOT AB04MD by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: September 2011 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.cc" + +extern "C" +{ + int F77_FUNC (ab04md, AB04MD) + (char& TYPE, + int& N, int& M, int& P, + double& ALPHA, double& BETA, + double* A, int& LDA, + double* B, int& LDB, + double* C, int& LDC, + double* D, int& LDD, + int* IWORK, + double* DWORK, int& LDWORK, + int& INFO); +} + +DEFUN_DLD (slab04md, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB04MD Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 7) + { + print_usage (); + } + else + { + // arguments in + char type; + + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + Matrix c = args(2).matrix_value (); + Matrix d = args(3).matrix_value (); + + double alpha = args(4).double_value (); + double beta = args(5).double_value (); + int discrete = args(6).int_value (); + + if (discrete == 0) + type = 'C'; + else + type = 'D'; + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + int p = c.rows (); // p: number of outputs + + int lda = max (1, n); + int ldb = max (1, n); + int ldc = max (1, p); + int ldd = max (1, p); + + // workspace + int ldwork = max (1, n); + + OCTAVE_LOCAL_BUFFER (int, iwork, n); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicator + int info; + + + // SLICOT routine AB04MD + F77_XFCN (ab04md, AB04MD, + (type, + n, m, p, + alpha, beta, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + iwork, + dwork, ldwork, + info)); + + if (f77_exception_encountered) + error ("slab04md: exception in SLICOT subroutine AB04MD"); + + if (info != 0) + error ("slab04md: AB04MD returned info = %d", info); + + // return values + retval(0) = a; + retval(1) = b; + retval(2) = c; + retval(3) = d; + } + + return retval; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-03 21:01:24
|
Revision: 8490 http://octave.svn.sourceforge.net/octave/?rev=8490&view=rev Author: paramaniac Date: 2011-09-03 21:01:18 +0000 (Sat, 03 Sep 2011) Log Message: ----------- control: touch up conversion routines Modified Paths: -------------- trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@lti/c2d.m trunk/octave-forge/main/control/inst/@lti/d2c.m trunk/octave-forge/main/control/inst/@ss/__d2c__.m Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-03 19:42:05 UTC (rev 8489) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-03 21:01:18 UTC (rev 8490) @@ -1,6 +1,18 @@ Summary of important user-visible changes for releases of the control package =============================================================================== +control-2.1.55 Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +=============================================================================== + +** @lti/c2d + -- Support for "tustin" method added. + -- Improved Texinfo string. + +** @lti/d2c + -- INDEX + + +=============================================================================== control-2.1.54 Release Date: 2011-08-22 Release Manager: Lukas Reichlin =============================================================================== Modified: trunk/octave-forge/main/control/inst/@lti/c2d.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/c2d.m 2011-09-03 19:42:05 UTC (rev 8489) +++ trunk/octave-forge/main/control/inst/@lti/c2d.m 2011-09-03 21:01:18 UTC (rev 8490) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -18,12 +18,35 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}) ## @deftypefnx {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}, @var{method}) -## Convert the continuous lti model into its discrete time equivalent. +## Convert the continuous lti model into its discrete-time equivalent. +## +## @strong{Inputs} +## @table @var +## @item sys +## Continuous-time LTI model. +## @item tsam +## Sampling time in seconds. +## @item method +## Optional conversion method. If not specified, default method @var{"zoh"} +## is taken. +## @table @code +## @item "zoh" +## Zero-order hold or matrix exponential. +## @item "tustin", "bilin" +## Bilinear transformation or Tustin approximation. +## @end table +## @end table +## +## @strong{Outputs} +## @table @var +## @item sys +## Discrete-time LTI model. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function sys = c2d (sys, tsam, method = "std") @@ -35,6 +58,10 @@ error ("c2d: first argument is not an lti model"); endif + if (isdt (sys)) + error ("c2d: system is already discrete-time"); + endif + if (! issample (tsam)) error ("c2d: second argument is not a valid sample time"); endif Modified: trunk/octave-forge/main/control/inst/@lti/d2c.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/d2c.m 2011-09-03 19:42:05 UTC (rev 8489) +++ trunk/octave-forge/main/control/inst/@lti/d2c.m 2011-09-03 21:01:18 UTC (rev 8490) @@ -19,6 +19,27 @@ ## @deftypefn {Function File} {@var{sys} =} d2c (@var{sys}) ## @deftypefnx {Function File} {@var{sys} =} d2c (@var{sys}, @var{method}) ## Convert the discrete lti model into its continuous-time equivalent. +## +## @strong{Inputs} +## @table @var +## @item sys +## Discrete-time LTI model. +## @item method +## Optional conversion method. If not specified, default method @var{"zoh"} +## is taken. +## @table @code +## @item "zoh" +## Zero-order hold or matrix logarithm. +## @item "tustin", "bilin" +## Bilinear transformation or Tustin approximation. +## @end table +## @end table +## +## @strong{Outputs} +## @table @var +## @item sys +## Continuous-time LTI model. +## @end table ## @end deftypefn ## Author: Lukas Reichlin <luk...@gm...> @@ -35,6 +56,10 @@ error ("d2c: first argument is not an lti model"); endif + if (isct (sys)) + error ("d2c: system is already continuous-time"); + endif + if (! ischar (method)) error ("c2d: second argument is not a string"); endif Modified: trunk/octave-forge/main/control/inst/@ss/__d2c__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-03 19:42:05 UTC (rev 8489) +++ trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-03 21:01:18 UTC (rev 8490) @@ -36,6 +36,7 @@ endif endif + error ("ss: d2c: zoh method not implemented yet"); [n, m] = size (sys.b); # n: states, m: inputs ## TODO: use SLICOT MB05OD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-04 12:38:50
|
Revision: 8492 http://octave.svn.sourceforge.net/octave/?rev=8492&view=rev Author: paramaniac Date: 2011-09-04 12:38:43 +0000 (Sun, 04 Sep 2011) Log Message: ----------- control: use Slicot SB10JD for descriptor to regular state-space conversion Modified Paths: -------------- trunk/octave-forge/main/control/devel/makefile_all.m trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@lti/ssdata.m trunk/octave-forge/main/control/inst/@ss/__c2d__.m trunk/octave-forge/main/control/inst/@ss/__d2c__.m trunk/octave-forge/main/control/src/Makefile Added Paths: ----------- trunk/octave-forge/main/control/devel/makefile_conversions.m trunk/octave-forge/main/control/inst/__dss2ss__.m trunk/octave-forge/main/control/src/slsb10jd.cc Removed Paths: ------------- trunk/octave-forge/main/control/devel/makefile_ss2tf.m Modified: trunk/octave-forge/main/control/devel/makefile_all.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_all.m 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/devel/makefile_all.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -12,6 +12,7 @@ cd (srcdir); makefile_chol +makefile_conversions makefile_h2syn makefile_hankel makefile_helpers @@ -23,7 +24,6 @@ makefile_norm makefile_place makefile_scale -makefile_ss2tf makefile_staircase makefile_tustin makefile_zero Copied: trunk/octave-forge/main/control/devel/makefile_conversions.m (from rev 8491, trunk/octave-forge/main/control/devel/makefile_ss2tf.m) =================================================================== --- trunk/octave-forge/main/control/devel/makefile_conversions.m (rev 0) +++ trunk/octave-forge/main/control/devel/makefile_conversions.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -0,0 +1,25 @@ +## ============================================================================== +## Developer Makefile for OCT-files +## ============================================================================== +## USAGE: * fetch control from Octave-Forge by svn +## * add control/inst, control/src and control/devel to your Octave path +## * run makefile_* +## ============================================================================== + +homedir = pwd (); +develdir = fileparts (which ("makefile_conversions")); +srcdir = [develdir, "/../src"]; +cd (srcdir); + +## state-space to transfer function +mkoctfile sltb04bd.cc \ + TB04BD.f MC01PY.f TB01ID.f TB01ZD.f MC01PD.f \ + TB04BX.f MA02AD.f MB02RD.f MB01PD.f MB02SD.f \ + MB01QD.f + +## descriptor to regular state-space +mkoctfile slsb10jd.cc \ + SB10JD.f + +system ("rm *.o"); +cd (homedir); Deleted: trunk/octave-forge/main/control/devel/makefile_ss2tf.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_ss2tf.m 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/devel/makefile_ss2tf.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -1,20 +0,0 @@ -## ============================================================================== -## Developer Makefile for OCT-files -## ============================================================================== -## USAGE: * fetch control from Octave-Forge by svn -## * add control/inst, control/src and control/devel to your Octave path -## * run makefile_* -## ============================================================================== - -homedir = pwd (); -develdir = fileparts (which ("makefile_ss2tf")); -srcdir = [develdir, "/../src"]; -cd (srcdir); - -mkoctfile sltb04bd.cc \ - TB04BD.f MC01PY.f TB01ID.f TB01ZD.f MC01PD.f \ - TB04BX.f MA02AD.f MB02RD.f MB01PD.f MB02SD.f \ - MB01QD.f - -system ("rm *.o"); -cd (homedir); Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-04 12:38:43 UTC (rev 8492) @@ -10,6 +10,9 @@ ** @lti/d2c -- INDEX + +** Conversion from descriptor to regular state-space is now performed by SLICOT + routine SB10JD. =============================================================================== Modified: trunk/octave-forge/main/control/inst/@lti/ssdata.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/ssdata.m 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/inst/@lti/ssdata.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -45,7 +45,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.3 +## Version: 0.4 function [a, b, c, d, tsam, scaled] = ssdata (sys) @@ -55,15 +55,8 @@ [a, b, c, d, e, ~, scaled] = __sys_data__ (sys); - if (! isempty (e)) - if (rcond (e) < eps) # check for singularity - error ("ss: ssdata: descriptor matrice ""e"" singular"); - endif + [a, b, c, d, e] = __dss2ss__ (a, b, c, d, e); - a = e \ a; - b = e \ b; - endif - tsam = sys.tsam; endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__c2d__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -26,40 +26,20 @@ switch (method) case {"zoh", "std"} - if (! isempty (sys.e)) - if (rcond (sys.e) < eps) - error ("ss: c2d: zero-order hold method requires proper system"); - else - sys.a = sys.e \ sys.a; - sys.b = sys.e \ sys.b; - sys.e = []; # require ordinary state-space model - endif - endif - + [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); [n, m] = size (sys.b); # n: states, m: inputs - ## TODO: use SLICOT MB05OD tmp = expm ([sys.a*tsam, sys.b*tsam; zeros(m, n+m)]); - sys.a = tmp (1:n, 1:n); # F sys.b = tmp (1:n, n+(1:m)); # G case {"tustin", "bilin"} - if (! isempty (sys.e)) - if (rcond (sys.e) < eps) - error ("ss: c2d: tustin method requires proper system"); - else - sys.a = sys.e \ sys.a; - sys.b = sys.e \ sys.b; - sys.e = []; # require ordinary state-space model - endif - endif - + [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, 2/tsam, false); + ## TODO: descriptor case otherwise error ("ss: c2d: %s is an invalid or missing method", method); - endswitch endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__d2c__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -26,37 +26,14 @@ switch (method) case {"zoh", "std"} - if (! isempty (sys.e)) - if (rcond (sys.e) < eps) - error ("ss: d2c: zero-order hold method requires proper system"); - else - sys.a = sys.e \ sys.a; - sys.b = sys.e \ sys.b; - sys.e = []; # require ordinary state-space model - endif - endif + [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); error ("ss: d2c: zoh method not implemented yet"); - [n, m] = size (sys.b); # n: states, m: inputs - ## TODO: use SLICOT MB05OD - tmp = expm ([sys.a*tsam, sys.b*tsam; zeros(m, n+m)]); - - sys.a = tmp (1:n, 1:n); # F - sys.b = tmp (1:n, n+(1:m)); # G - case {"tustin", "bilin"} - if (! isempty (sys.e)) - if (rcond (sys.e) < eps) - error ("ss: d2c: tustin method requires proper system"); - else - sys.a = sys.e \ sys.a; - sys.b = sys.e \ sys.b; - sys.e = []; # require ordinary state-space model - endif - endif - + [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, 2/tsam, true); + ## TODO: descriptor case otherwise error ("ss: d2c: %s is an invalid or missing method", method); Added: trunk/octave-forge/main/control/inst/__dss2ss__.m =================================================================== --- trunk/octave-forge/main/control/inst/__dss2ss__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__dss2ss__.m 2011-09-04 12:38:43 UTC (rev 8492) @@ -0,0 +1,36 @@ +## Copyright (C) 2011 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Convert descriptor state-space system into regular state-space form. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: September 2011 +## Version: 0.1 + +function [a, b, c, d, e] = __dss2ss__ (a, b, c, d, e) + + if (isempty (e)) + return; + elseif (rcond (e) < eps) # check for singularity + error ("ss: dss2ss: descriptor matrice ""e"" singular"); + else + [a, b, c, d] = slsb10jd (a, b, c, d, e); + e = []; + endif + +endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/src/Makefile =================================================================== --- trunk/octave-forge/main/control/src/Makefile 2011-09-03 21:04:15 UTC (rev 8491) +++ trunk/octave-forge/main/control/src/Makefile 2011-09-04 12:38:43 UTC (rev 8492) @@ -4,7 +4,7 @@ sltb01pd.oct slsb03od.oct slsg03bd.oct slag08bd.oct sltg01jd.oct \ sltg01hd.oct sltg01id.oct slsg02ad.oct sltg04bx.oct sltb01id.oct \ sltg01ad.oct slsb10id.oct slsb10kd.oct slsb10zd.oct sltb04bd.oct \ - slab04md.oct \ + slab04md.oct slsb10jd.oct \ is_real_scalar.oct is_real_vector.oct is_real_matrix.oct \ is_real_square_matrix.oct @@ -218,6 +218,11 @@ mkoctfile slab04md.cc \ AB04MD.f +# descriptor to regular state-space conversion +slsb10jd.oct: slsb10jd.cc + mkoctfile slsb10jd.cc \ + SB10JD.f + # helpers is_real_scalar.oct: is_real_scalar.cc mkoctfile is_real_scalar.cc Added: trunk/octave-forge/main/control/src/slsb10jd.cc =================================================================== --- trunk/octave-forge/main/control/src/slsb10jd.cc (rev 0) +++ trunk/octave-forge/main/control/src/slsb10jd.cc 2011-09-04 12:38:43 UTC (rev 8492) @@ -0,0 +1,122 @@ +/* + +Copyright (C) 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +LTI Syncope is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Convert descriptor state-space system into regular state-space form. +Uses SLICOT SB10JD by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: September 2011 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.cc" + +extern "C" +{ + int F77_FUNC (sb10jd, SB10JD) + (int& N, int& M, int& NP, + double* A, int& LDA, + double* B, int& LDB, + double* C, int& LDC, + double* D, int& LDD, + double* E, int& LDE, + int& NSYS, + double* DWORK, int& LDWORK, + int& INFO); +} + +DEFUN_DLD (slsb10jd, args, nargout, + "-*- texinfo -*-\n\ +Slicot SB10JD Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 5) + { + print_usage (); + } + else + { + // arguments in + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + Matrix c = args(2).matrix_value (); + Matrix d = args(3).matrix_value (); + Matrix e = args(4).matrix_value (); + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + int np = c.rows (); // np: number of outputs + + int lda = max (1, n); + int ldb = max (1, n); + int ldc = max (1, np); + int ldd = max (1, np); + int lde = max (1, n); + + // arguments out + int nsys; + + // workspace + int ldwork = max (1, 2*n*n + 2*n + n*max (5, n + m + np)); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicator + int info; + + + // SLICOT routine SB10JD + F77_XFCN (sb10jd, SB10JD, + (n, m, np, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + e.fortran_vec (), lde, + nsys, + dwork, ldwork, + info)); + + if (f77_exception_encountered) + error ("slsb10jd: exception in SLICOT subroutine SB10JD"); + + if (info != 0) + error ("slsb10jd: SB10JD returned info = %d", info); + + // resize + a.resize (nsys, nsys); + b.resize (nsys, m); + c.resize (np, nsys); + + // return values + retval(0) = a; + retval(1) = b; + retval(2) = c; + retval(3) = d; + } + + return retval; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-05 17:58:42
|
Revision: 8500 http://octave.svn.sourceforge.net/octave/?rev=8500&view=rev Author: paramaniac Date: 2011-09-05 17:58:35 +0000 (Mon, 05 Sep 2011) Log Message: ----------- control: update index and news files Modified Paths: -------------- trunk/octave-forge/main/control/INDEX trunk/octave-forge/main/control/doc/NEWS Modified: trunk/octave-forge/main/control/INDEX =================================================================== --- trunk/octave-forge/main/control/INDEX 2011-09-05 17:45:13 UTC (rev 8499) +++ trunk/octave-forge/main/control/INDEX 2011-09-05 17:58:35 UTC (rev 8500) @@ -19,6 +19,7 @@ @lti/tfdata Model Conversions @lti/c2d + @lti/d2c @lti/prescale @lti/xperm Model Interconnections Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-05 17:45:13 UTC (rev 8499) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-05 17:58:35 UTC (rev 8500) @@ -9,10 +9,13 @@ -- Improved Texinfo string. ** @lti/d2c - -- INDEX + -- Discrete to continuous-time conversion added. However, support is + limited to state-space models and the zero-order hold and tustin methods. ** Conversion from descriptor to regular state-space is now performed by SLICOT - routine SB10JD. + routine SB10JD. Better numerical results are to be expected over the + previous naive inversion formula. This conversion is used internally for + ssdata and some other functions. =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-05 19:14:09
|
Revision: 8502 http://octave.svn.sourceforge.net/octave/?rev=8502&view=rev Author: paramaniac Date: 2011-09-05 19:14:03 +0000 (Mon, 05 Sep 2011) Log Message: ----------- control: add pre-warping option to c2d and d2c Modified Paths: -------------- trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@lti/c2d.m trunk/octave-forge/main/control/inst/@lti/d2c.m trunk/octave-forge/main/control/inst/@ss/__c2d__.m trunk/octave-forge/main/control/inst/@ss/__d2c__.m Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-05 18:02:37 UTC (rev 8501) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-05 19:14:03 UTC (rev 8502) @@ -5,12 +5,13 @@ =============================================================================== ** @lti/c2d - -- Support for "tustin" method added. + -- Support for "tustin" and "prewarp" method added. -- Improved Texinfo string. ** @lti/d2c -- Discrete to continuous-time conversion added. However, support is - limited to state-space models and the zero-order hold and tustin methods. + limited to state-space models and the zero-order hold, tustin and pre- + warping methods. ** Conversion from descriptor to regular state-space is now performed by SLICOT routine SB10JD. Better numerical results are to be expected over the Modified: trunk/octave-forge/main/control/inst/@lti/c2d.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/c2d.m 2011-09-05 18:02:37 UTC (rev 8501) +++ trunk/octave-forge/main/control/inst/@lti/c2d.m 2011-09-05 19:14:03 UTC (rev 8502) @@ -18,6 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}) ## @deftypefnx {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}, @var{method}) +## @deftypefnx {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}, @var{"prewarp"}, @var{w0}) ## Convert the continuous lti model into its discrete-time equivalent. ## ## @strong{Inputs} @@ -29,11 +30,13 @@ ## @item method ## Optional conversion method. If not specified, default method @var{"zoh"} ## is taken. -## @table @code +## @table @var ## @item "zoh" ## Zero-order hold or matrix exponential. ## @item "tustin", "bilin" ## Bilinear transformation or Tustin approximation. +## @item "prewarp" +## Bilinear transformation with pre-warping at frequency @var{w0}. ## @end table ## @end table ## @@ -48,9 +51,9 @@ ## Created: October 2009 ## Version: 0.2 -function sys = c2d (sys, tsam, method = "std") +function sys = c2d (sys, tsam, method = "std", w0 = 0) - if (nargin < 2 || nargin > 3) + if (nargin < 2 || nargin > 4) print_usage (); endif @@ -70,7 +73,7 @@ error ("c2d: third argument is not a string"); endif - sys = __c2d__ (sys, tsam, method); + sys = __c2d__ (sys, tsam, lower (method), w0); sys.tsam = tsam; -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@lti/d2c.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/d2c.m 2011-09-05 18:02:37 UTC (rev 8501) +++ trunk/octave-forge/main/control/inst/@lti/d2c.m 2011-09-05 19:14:03 UTC (rev 8502) @@ -18,6 +18,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{sys} =} d2c (@var{sys}) ## @deftypefnx {Function File} {@var{sys} =} d2c (@var{sys}, @var{method}) +## @deftypefnx {Function File} {@var{sys} =} d2c (@var{sys}, @var{"prewarp"}, @var{w0}) ## Convert the discrete lti model into its continuous-time equivalent. ## ## @strong{Inputs} @@ -27,11 +28,13 @@ ## @item method ## Optional conversion method. If not specified, default method @var{"zoh"} ## is taken. -## @table @code +## @table @var ## @item "zoh" ## Zero-order hold or matrix logarithm. ## @item "tustin", "bilin" ## Bilinear transformation or Tustin approximation. +## @item "prewarp" +## Bilinear transformation with pre-warping at frequency @var{w0}. ## @end table ## @end table ## @@ -46,9 +49,9 @@ ## Created: September 2011 ## Version: 0.1 -function sys = d2c (sys, method = "std") +function sys = d2c (sys, method = "std", w0 = 0) - if (nargin == 0 || nargin > 2) + if (nargin == 0 || nargin > 3) print_usage (); endif @@ -64,7 +67,7 @@ error ("d2c: second argument is not a string"); endif - sys = __d2c__ (sys, sys.tsam, method); + sys = __d2c__ (sys, sys.tsam, lower (method), w0); sys.tsam = 0; endfunction Modified: trunk/octave-forge/main/control/inst/@ss/__c2d__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-05 18:02:37 UTC (rev 8501) +++ trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-05 19:14:03 UTC (rev 8502) @@ -22,10 +22,10 @@ ## Created: October 2009 ## Version: 0.2 -function sys = __c2d__ (sys, tsam, method = "zoh") +function sys = __c2d__ (sys, tsam, method = "zoh", w0 = 0) - switch (method) - case {"zoh", "std"} + switch (method(1)) + case {"z", "s"} # {"zoh", "std"} [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); [n, m] = size (sys.b); # n: states, m: inputs ## TODO: use SLICOT MB05OD @@ -33,13 +33,16 @@ sys.a = tmp (1:n, 1:n); # F sys.b = tmp (1:n, n+(1:m)); # G - case {"tustin", "bilin"} + case {"t", "b", "p"} # {"tustin", "bilin", "prewarp"} + if (method(1) == "p") # prewarping + beta = w0 / tan (w0*tsam/2); + else + beta = 2/tsam; + endif [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); - [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, 2/tsam, false); + [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, beta, false); ## TODO: descriptor case - ## TODO: case "prewarp" - otherwise error ("ss: c2d: %s is an invalid or missing method", method); endswitch Modified: trunk/octave-forge/main/control/inst/@ss/__d2c__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-05 18:02:37 UTC (rev 8501) +++ trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-05 19:14:03 UTC (rev 8502) @@ -22,10 +22,10 @@ ## Created: September 2011 ## Version: 0.1 -function sys = __d2c__ (sys, tsam, method = "zoh") +function sys = __d2c__ (sys, tsam, method = "zoh", w0 = 0) - switch (method) - case {"zoh", "std"} + switch (method(1)) + case {"z", "s"} # {"zoh", "std"} [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); [n, m] = size (sys.b); # n: states, m: inputs tmp = logm ([sys.a, sys.b; zeros(m,n), eye(m)]) / tsam; @@ -35,13 +35,16 @@ sys.a = real (tmp(1:n, 1:n)); sys.b = real (tmp(1:n, n+1:n+m)); - case {"tustin", "bilin"} + case {"t", "b", "p"} # {"tustin", "bilin", "prewarp"} + if (method(1) == "p") # prewarping + beta = w0 / tan (w0*tsam/2); + else + beta = 2/tsam; + endif [sys.a, sys.b, sys.c, sys.d, sys.e] = __dss2ss__ (sys.a, sys.b, sys.c, sys.d, sys.e); - [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, 2/tsam, true); + [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, beta, true); ## TODO: descriptor case - ## TODO: case "prewarp" - otherwise error ("ss: d2c: %s is an invalid or missing method", method); endswitch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-06 11:36:17
|
Revision: 8506 http://octave.svn.sourceforge.net/octave/?rev=8506&view=rev Author: paramaniac Date: 2011-09-06 11:36:10 +0000 (Tue, 06 Sep 2011) Log Message: ----------- control: enable c2d and d2c for tf via ss functions Modified Paths: -------------- trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@lti/c2d.m trunk/octave-forge/main/control/inst/@lti/d2c.m trunk/octave-forge/main/control/inst/@tf/__c2d__.m trunk/octave-forge/main/control/inst/@tf/__d2c__.m Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-06 06:03:10 UTC (rev 8505) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-06 11:36:10 UTC (rev 8506) @@ -10,8 +10,7 @@ ** @lti/d2c -- Discrete to continuous-time conversion added. However, support is - limited to state-space models and the zero-order hold, tustin and pre- - warping methods. + limited to the zero-order hold, tustin and pre-warping methods. ** Conversion from descriptor to regular state-space is now performed by SLICOT routine SB10JD. Better numerical results are to be expected over the Modified: trunk/octave-forge/main/control/inst/@lti/c2d.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/c2d.m 2011-09-06 06:03:10 UTC (rev 8505) +++ trunk/octave-forge/main/control/inst/@lti/c2d.m 2011-09-06 11:36:10 UTC (rev 8506) @@ -24,7 +24,7 @@ ## @strong{Inputs} ## @table @var ## @item sys -## Continuous-time LTI model. Only state-space models have been implemented so far. +## Continuous-time LTI model. ## @item tsam ## Sampling time in seconds. ## @item method Modified: trunk/octave-forge/main/control/inst/@lti/d2c.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/d2c.m 2011-09-06 06:03:10 UTC (rev 8505) +++ trunk/octave-forge/main/control/inst/@lti/d2c.m 2011-09-06 11:36:10 UTC (rev 8506) @@ -24,7 +24,7 @@ ## @strong{Inputs} ## @table @var ## @item sys -## Discrete-time LTI model. Only state-space models have been implemented so far. +## Discrete-time LTI model. ## @item method ## Optional conversion method. If not specified, default method @var{"zoh"} ## is taken. Modified: trunk/octave-forge/main/control/inst/@tf/__c2d__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__c2d__.m 2011-09-06 06:03:10 UTC (rev 8505) +++ trunk/octave-forge/main/control/inst/@tf/__c2d__.m 2011-09-06 11:36:10 UTC (rev 8506) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,19 +20,23 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 -function sys = __c2d__ (sys, tsam, method = "zoh") +function sys = __c2d__ (sys, tsam, method = "zoh", w0 = 0) [p, m] = size (sys); - ##switch (method) - ## case {"zoh", "std"} - error ("tf: c2d: not implemented yet"); + for i = 1 : p + for j = 1 : m + idx = substruct ("()", {i, j}); + tmp = subsref (sys, idx); + tmp = c2d (ss (tmp), tsam, method, w0); + [num, den] = tfdata (tmp, "tfpoly"); + sys.num(i, j) = num; + sys.den(i, j) = den; + endfor + endfor - ## otherwise - ## error ("tf: c2d: %s is an invalid method", method); + sys.tfvar = "z"; - ##endswitch - -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@tf/__d2c__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__d2c__.m 2011-09-06 06:03:10 UTC (rev 8505) +++ trunk/octave-forge/main/control/inst/@tf/__d2c__.m 2011-09-06 11:36:10 UTC (rev 8506) @@ -22,8 +22,21 @@ ## Created: September 2011 ## Version: 0.1 -function sys = __d2c__ (sys, tsam, method = "zoh") +function sys = __d2c__ (sys, tsam, method = "zoh", w0 = 0) - error ("tf: d2c: not implemented yet"); + [p, m] = size (sys); -endfunction \ No newline at end of file + for i = 1 : p + for j = 1 : m + idx = substruct ("()", {i, j}); + tmp = subsref (sys, idx); + tmp = d2c (ss (tmp), method, w0); + [num, den] = tfdata (tmp, "tfpoly"); + sys.num(i, j) = num; + sys.den(i, j) = den; + endfor + endfor + + sys.tfvar = "s"; + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-07 17:45:19
|
Revision: 8508 http://octave.svn.sourceforge.net/octave/?rev=8508&view=rev Author: paramaniac Date: 2011-09-07 17:45:09 +0000 (Wed, 07 Sep 2011) Log Message: ----------- control: prepare release of control-2.1.55 Modified Paths: -------------- trunk/octave-forge/main/control/DESCRIPTION trunk/octave-forge/main/control/devel/PROJECTS trunk/octave-forge/main/control/devel/RELEASE_PACKAGE trunk/octave-forge/main/control/devel/pdfdoc/control.tex trunk/octave-forge/main/control/devel/pdfdoc/functions.texi trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/doc/control.pdf Modified: trunk/octave-forge/main/control/DESCRIPTION =================================================================== --- trunk/octave-forge/main/control/DESCRIPTION 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/DESCRIPTION 2011-09-07 17:45:09 UTC (rev 8508) @@ -1,6 +1,6 @@ Name: Control -Version: 2.1.54 -Date: 2011-08-22 +Version: 2.1.55 +Date: 2011-09-07 Author: Lukas Reichlin <luk...@gm...> Maintainer: Lukas Reichlin <luk...@gm...> Title: Control Systems Modified: trunk/octave-forge/main/control/devel/PROJECTS =================================================================== --- trunk/octave-forge/main/control/devel/PROJECTS 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/devel/PROJECTS 2011-09-07 17:45:09 UTC (rev 8508) @@ -67,10 +67,6 @@ * Use SLICOT (TD04AD?) for tf2ss conversion (@tf/__sys2ss__.m) - * Implement c2d conversion (@tf/__c2d__.m) - - * Implement d2c conversion (@tf/__d2c__.m) - ------ Always: ------ Modified: trunk/octave-forge/main/control/devel/RELEASE_PACKAGE =================================================================== --- trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/devel/RELEASE_PACKAGE 2011-09-07 17:45:09 UTC (rev 8508) @@ -5,6 +5,7 @@ * update version number in the commands below * adapt version number and release date in DESCRIPTION * update doc/NEWS + * update doc/control.pdf * copy-paste entire block at once to the terminal * follow instructions on <http://octave.sourceforge.net/developers.html> @@ -18,12 +19,12 @@ rm -R ~/octave/__TEMP__/control/devel cd ~/octave/__TEMP__ grep -i version control/DESCRIPTION -tar czf control-2.1.54.tar.gz control/ -md5 control-2.1.54.tar.gz -md5 control-2.1.54.tar.gz > md5_control_pkg.txt -uuencode control-2.1.54.tar.gz < control-2.1.54.tar.gz > control-2.1.54.tar.gz.uue +tar czf control-2.1.55.tar.gz control/ +md5 control-2.1.55.tar.gz +md5 control-2.1.55.tar.gz > md5_control_pkg.txt +uuencode control-2.1.55.tar.gz < control-2.1.55.tar.gz > control-2.1.55.tar.gz.uue octave -q --eval \ -"pkg install control-2.1.54.tar.gz" +"pkg install control-2.1.55.tar.gz" octave -q --eval \ "pkg load generate_html; generate_package_html ('control', 'control-html', 'octave-forge')" tar czf control-html.tar.gz control-html @@ -38,7 +39,7 @@ ===================================================================================== rm -R ~/octave/__TEMP__ -rm -R ~/octave/control-2.1.54 +rm -R ~/octave/control-2.1.55 ===================================================================================== Modified: trunk/octave-forge/main/control/devel/pdfdoc/control.tex =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-09-07 17:45:09 UTC (rev 8508) @@ -3,7 +3,7 @@ @setfilename control.info @settitle Octave Control Systems Package @afourpaper -@set VERSION 2.1.54 +@set VERSION 2.1.55 @c @afourwide @c %**end of header Modified: trunk/octave-forge/main/control/devel/pdfdoc/functions.texi =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-09-07 17:45:09 UTC (rev 8508) @@ -449,8 +449,64 @@ @deftypefn {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}) @deftypefnx {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}, @var{method}) - Convert the continuous lti model into its discrete time equivalent. + @deftypefnx {Function File} {@var{sys} =} c2d (@var{sys}, @var{tsam}, @var{"prewarp"}, @var{w0}) + Convert the continuous lti model into its discrete-time equivalent. + + @strong{Inputs} + @table @var + @item sys + Continuous-time LTI model. + @item tsam + Sampling time in seconds. + @item method + Optional conversion method. If not specified, default method @var{"zoh"} + is taken. + @table @var + @item "zoh" + Zero-order hold or matrix exponential. + @item "tustin", "bilin" + Bilinear transformation or Tustin approximation. + @item "prewarp" + Bilinear transformation with pre-warping at frequency @var{w0}. + @end table + @end table + + @strong{Outputs} + @table @var + @item sys + Discrete-time LTI model. + @end table @end deftypefn +@subsection @@lti/d2c + + @deftypefn {Function File} {@var{sys} =} d2c (@var{sys}) + @deftypefnx {Function File} {@var{sys} =} d2c (@var{sys}, @var{method}) + @deftypefnx {Function File} {@var{sys} =} d2c (@var{sys}, @var{"prewarp"}, @var{w0}) + Convert the discrete lti model into its continuous-time equivalent. + + @strong{Inputs} + @table @var + @item sys + Discrete-time LTI model. + @item method + Optional conversion method. If not specified, default method @var{"zoh"} + is taken. + @table @var + @item "zoh" + Zero-order hold or matrix logarithm. + @item "tustin", "bilin" + Bilinear transformation or Tustin approximation. + @item "prewarp" + Bilinear transformation with pre-warping at frequency @var{w0}. + @end table + @end table + + @strong{Outputs} + @table @var + @item sys + Continuous-time LTI model. + @end table + @end deftypefn @subsection @@lti/prescale @deftypefn {Function File} {[@var{scaledsys}, @var{info}] =} prescale (@var{sys}) Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-07 17:45:09 UTC (rev 8508) @@ -1,7 +1,7 @@ Summary of important user-visible changes for releases of the control package =============================================================================== -control-2.1.55 Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +control-2.1.55 Release Date: 2011-09-07 Release Manager: Lukas Reichlin =============================================================================== ** @lti/c2d Modified: trunk/octave-forge/main/control/doc/control.pdf =================================================================== --- trunk/octave-forge/main/control/doc/control.pdf 2011-09-06 11:39:16 UTC (rev 8507) +++ trunk/octave-forge/main/control/doc/control.pdf 2011-09-07 17:45:09 UTC (rev 8508) @@ -3,14 +3,13 @@ 5 0 obj <</Length 6 0 R/Filter /FlateDecode>> stream -x\x9C\x95S\xC9n1\xEDY_\xA1\xA3tZ\x94(\x89\xBA:MS]\xE2d\x8A\x82\xD7q\x8B\xC6-\xBC\xA4@\xFF\xBE\xE4Ll\xE7\x90\x8A\xC1\x8C\xF2qyO\x9C\x8D -\x806\xE8\xF3t.\xD6frU\xEDjg\x82\xBD\x90we6\x80}:k;\xED\xC46(\x99\xB3\xED\xEF͘\x8C\xB6F[B\x82j\xFB\xB5\xB9u\x80\xA8\xA6\xD0\xDC/ߡ\xD8 -\xAB\xFB\xE9c\x81\xA2\xDB{\x84D\xA9\xBA\xAD\xE00p\x8D\xF9\x88\xA3\xEA|\x97jē\xD4,5Fr\xF8\xA27\x9F\xBC4\x9A\xCC\xFC\xA5g\xCE{37K9\x95aڎ\xB0\xAD\xD9\xE6\xD6\x88\x95\xFFtf&\xB3v\xBF}\\x9AɍE3y\xAB\x9F\xE9\xE5\x99\xB3\xD7\xF6\x959\x9F\xD9\xF9?uA\xF5@ -\x9F\x93b\x82B63ҨΙ\xEFH\xF8\xE6Q\x90ְ\x89" B@E\xBA<\xC4T\x84\xC4и\xB8k\xDF\xF7G(\xB9\x9D\xF2\x92\x81\xE9Y\xC6ғ[\xFB.\xAA_\xC0;\xCDgw\xE9S\xCB\xDFI\xC1\x85Ofv?|N\xA0\xC1\xBD\x92w)9\xB9I0\xB9\xFBS%\x9Db\xABղ4"w\xE1\x81\x8Fb\x85\x90#\xBA\xCF\xD6\xC4\xEC> )\x88\x8At:X\xFBcΝvo\\xB3\xFB\xED\xD3\xC0!\xE9\xE4#N/I\xF7 -I֢D\x95\xAF\x8BU\xB7\x8E\xE4zX\x84\xFB*½\xD7\xE1rl\xA5\xB9G5a!\xA5S\xA1\x94\xAAM\xC4d\xE0A\x85rtoĔ\xCE,R\xC1\xB8X,\xBD\xAF\x9A\x89P\xC9G\xA8\xBB\xEF\xEA\xC3Ъj\x85\x90ks\xDF\xC66Q8FGr\x94<\x84_\xDC3\xF9O\xE8\xB0g\x8C "\xE3\xEC\xD9\xDC\xFC\xAE\xCB\xC1Bendstream +x\x9C\x95SKo1\xE6\x9C_\x91cro\x9C8\x89s\xDDR\xCA"\xDDvġZ\xB6\xA2\xDAG\x91\xF8\xF7\xD83\xFB\xE8\xA1\xD0h&\x96\xFD\xF9\xF1}\xF1ll |
From: <par...@us...> - 2011-09-18 16:40:24
|
Revision: 8556 http://octave.svn.sourceforge.net/octave/?rev=8556&view=rev Author: paramaniac Date: 2011-09-18 16:40:17 +0000 (Sun, 18 Sep 2011) Log Message: ----------- control: work on tf2ss conversion Modified Paths: -------------- trunk/octave-forge/main/control/doc/NEWS trunk/octave-forge/main/control/inst/@tf/__pole__.m trunk/octave-forge/main/control/inst/@tf/__sys2ss__.m trunk/octave-forge/main/control/inst/@tf/__zero__.m Modified: trunk/octave-forge/main/control/doc/NEWS =================================================================== --- trunk/octave-forge/main/control/doc/NEWS 2011-09-18 16:25:50 UTC (rev 8555) +++ trunk/octave-forge/main/control/doc/NEWS 2011-09-18 16:40:17 UTC (rev 8556) @@ -1,6 +1,21 @@ Summary of important user-visible changes for releases of the control package =============================================================================== +control-2.2.0 Release Date: 2011-xx-yy Release Manager: Lukas Reichlin +=============================================================================== + +** ss + -- Transfer function to state-space conversion uses now SLICOT TD04AD. + Conversion of MIMO models is now supported. Usage: ss_sys = ss (tf_sys) + +** @lti/pole, @lti/zero + -- Computation of poles and zeros of MIMO transfer functions is now possible + via conversion to state-space. Please note that the state-space + realization of SLICOT TD04AD is a minimal one. Therefore certain poles + and zeros might be missing. + + +=============================================================================== control-2.1.55 Release Date: 2011-09-07 Release Manager: Lukas Reichlin =============================================================================== Modified: trunk/octave-forge/main/control/inst/@tf/__pole__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__pole__.m 2011-09-18 16:25:50 UTC (rev 8555) +++ trunk/octave-forge/main/control/inst/@tf/__pole__.m 2011-09-18 16:40:17 UTC (rev 8556) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,14 +20,15 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function pol = __pole__ (sys) if (issiso (sys)) pol = roots (sys.den{1}); else - error ("tf: pole: mimo case not implemented yet"); + warning ("tf: pole: converting to minimal state-space for poles of mimo tf"); + pol = pole (ss (sys)); endif endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tf/__sys2ss__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__sys2ss__.m 2011-09-18 16:25:50 UTC (rev 8555) +++ trunk/octave-forge/main/control/inst/@tf/__sys2ss__.m 2011-09-18 16:40:17 UTC (rev 8556) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,27 +20,64 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function [retsys, retlti] = __sys2ss__ (sys) - if (! issiso (sys)) - error ("tf: tf2ss: MIMO case not implemented yet"); - endif - + [p, m] = size (sys); [num, den] = tfdata (sys); + + numc = cell (p, m); + denc = cell (p, 1); + + ## multiply all denominators in a row and + ## update each numerator accordingly + for i = 1 : p + denc(i) = __conv__ (den{i,:}); + for j = 1 : m + idx = setdiff (1:m, j); + numc(i,j) = __conv__ (num{i,j}, den{i,idx}); + endfor + endfor - num = num{1, 1}; - den = den{1, 1}; - + len_numc = cellfun (@length, numc); + len_denc = cellfun (@length, denc); + ## tfpoly ensures that there are no leading zeros - if (length (num) > length (den)) + tmp = len_numc > repmat (len_denc, 1, m); + if (any (tmp(:))) error ("tf: tf2ss: system must be proper"); endif - [a, b, c, d] = __tf2ss__ (num, den); + max_len_denc = max (len_denc(:)); + ucoeff = zeros (p, m, max_len_denc); + dcoeff = zeros (p, max_len_denc); + index = len_denc-1; + for i = 1 : p + len = len_denc(i); + dcoeff(i, 1:len) = denc{i}; + for j = 1 : m + ucoeff(i, j, len-len_numc(i,j)+1 : len) = numc{i,j}; + endfor + endfor + + [a, b, c, d] = sltd04ad (ucoeff, dcoeff, index, sqrt (eps)); + retsys = ss (a, b, c, d); retlti = sys.lti; # preserve lti properties -endfunction \ No newline at end of file +endfunction + + +function vec = __conv__ (vec, varargin) + + if (nargin == 1) + return; + else + for k = 1 : nargin-1 + vec = conv (vec, varargin{k}); + endfor + endif + +endfunction Modified: trunk/octave-forge/main/control/inst/@tf/__zero__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__zero__.m 2011-09-18 16:25:50 UTC (rev 8555) +++ trunk/octave-forge/main/control/inst/@tf/__zero__.m 2011-09-18 16:40:17 UTC (rev 8556) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009, 2011 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,18 +20,18 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function [zer, gain] = __zero__ (sys) if (issiso (sys)) num = get (sys.num{1}); den = get (sys.den{1}); - zer = roots (num); gain = num(1) / den(1); else - error ("tf: zero: mimo case not implemented yet"); + warning ("tf: zero: converting to minimal state-space for zeros of mimo tf"); + [zer, gain] = zero (ss (sys)); endif endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-18 19:42:58
|
Revision: 8560 http://octave.svn.sourceforge.net/octave/?rev=8560&view=rev Author: paramaniac Date: 2011-09-18 19:42:52 +0000 (Sun, 18 Sep 2011) Log Message: ----------- control: add a test for new tf2ss conversion Modified Paths: -------------- trunk/octave-forge/main/control/inst/@tf/__pole__.m trunk/octave-forge/main/control/inst/@tf/__zero__.m trunk/octave-forge/main/control/inst/ltimodels.m Added Paths: ----------- trunk/octave-forge/main/control/devel/__tf2ss__.m Removed Paths: ------------- trunk/octave-forge/main/control/inst/__tf2ss__.m Copied: trunk/octave-forge/main/control/devel/__tf2ss__.m (from rev 8557, trunk/octave-forge/main/control/inst/__tf2ss__.m) =================================================================== --- trunk/octave-forge/main/control/devel/__tf2ss__.m (rev 0) +++ trunk/octave-forge/main/control/devel/__tf2ss__.m 2011-09-18 19:42:52 UTC (rev 8560) @@ -0,0 +1,134 @@ +## Copyright (C) 1996, 1998, 2000, 2002, 2004, 2005, 2007 +## Auburn University. All rights reserved. +## +## +## This program is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}] =} tf2ss (@var{num}, @var{den}) +## Conversion from transfer function to state-space. +## The state space system: +## @iftex +## @tex +## $$ \dot x = Ax + Bu $$ +## $$ y = Cx + Du $$ +## @end tex +## @end iftex +## @ifinfo +## @example +## . +## x = Ax + Bu +## y = Cx + Du +## @end example +## @end ifinfo +## is obtained from a transfer function: +## @iftex +## @tex +## $$ G(s) = { { \rm num }(s) \over { \rm den }(s) } $$ +## @end tex +## @end iftex +## @ifinfo +## @example +## num(s) +## G(s)=------- +## den(s) +## @end example +## @end ifinfo +## +## The vector @var{den} must contain only one row, whereas the vector +## @var{num} may contain as many rows as there are outputs @var{y} of +## the system. The state space system matrices obtained from this function +## will be in controllable canonical form as described in @cite{Modern Control +## Theory}, (Brogan, 1991). +## @end deftypefn + +## Author: R. Bruce Tenison <bte...@en...> +## Created: June 22, 1994 +## mod A S Hodel July, Aug 1995 + +function [a, b, c, d] = __tf2ss__ (num, den) + + if (nargin != 2) + print_usage (); + elseif (isempty (num)) + error ("tf2ss: empty numerator"); + elseif (isempty (den)) + error ("tf2ss: empy denominator"); + elseif (! is_real_vector (num)) + error ("num(%dx%d) must be a vector", rows (num), columns (num)); + elseif (! is_real_vector (den)) + error ("den(%dx%d) must be a vector", rows (den), columns (den)); + endif + + ## strip leading zeros from num, den + nz = find (num != 0); + if (isempty (nz)) + num = 0; + else + num = num(nz(1):length(num)); + endif + nz = find (den != 0); + if (isempty (nz)) + error ("denominator is 0."); + else + den = den(nz(1):length(den)); + endif + + ## force num, den to be row vectors + num = reshape (num, 1, []); + den = reshape (den, 1, []); + nn = length (num); + nd = length (den); + if (nn > nd) + error ("deg(num)=%d > deg(den)= %d", nn, nd); + endif + + ## Check sizes + if (nd == 1) + a = b = c = []; + d = num(:,1) / den(1); + else + ## Pad num so that length(num) = length(den) + if (nd-nn > 0) + num = [zeros(1,nd-nn), num]; + endif + + ## Normalize the numerator and denominator vector w.r.t. the leading + ## coefficient + d1 = den(1); + num = num / d1; + den = den(2:nd)/d1; + sw = nd-1:-1:1; + + ## Form the A matrix + if (nd > 2) + a = [zeros(nd-2,1), eye(nd-2,nd-2); -den(sw)]; + else + a = -den(sw); + endif + + ## Form the B matrix + b = zeros (nd-1, 1); + b(nd-1,1) = 1; + + ## Form the C matrix + c = num(:,2:nd)-num(:,1)*den; + c = c(:,sw); + + ## Form the D matrix + d = num(:,1); + endif + +endfunction Modified: trunk/octave-forge/main/control/inst/@tf/__pole__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__pole__.m 2011-09-18 19:24:53 UTC (rev 8559) +++ trunk/octave-forge/main/control/inst/@tf/__pole__.m 2011-09-18 19:42:52 UTC (rev 8560) @@ -27,8 +27,8 @@ if (issiso (sys)) pol = roots (sys.den{1}); else - warning ("tf: pole: converting to minimal state-space for poles of mimo tf"); + warning ("tf: pole: converting to minimal state-space for pole computation of mimo tf"); pol = pole (ss (sys)); endif -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@tf/__zero__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__zero__.m 2011-09-18 19:24:53 UTC (rev 8559) +++ trunk/octave-forge/main/control/inst/@tf/__zero__.m 2011-09-18 19:42:52 UTC (rev 8560) @@ -30,8 +30,8 @@ zer = roots (num); gain = num(1) / den(1); else - warning ("tf: zero: converting to minimal state-space for zeros of mimo tf"); + warning ("tf: zero: converting to minimal state-space for zero computation of mimo tf"); [zer, gain] = zero (ss (sys)); endif -endfunction \ No newline at end of file +endfunction Deleted: trunk/octave-forge/main/control/inst/__tf2ss__.m =================================================================== --- trunk/octave-forge/main/control/inst/__tf2ss__.m 2011-09-18 19:24:53 UTC (rev 8559) +++ trunk/octave-forge/main/control/inst/__tf2ss__.m 2011-09-18 19:42:52 UTC (rev 8560) @@ -1,134 +0,0 @@ -## Copyright (C) 1996, 1998, 2000, 2002, 2004, 2005, 2007 -## Auburn University. All rights reserved. -## -## -## This program is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {[@var{a}, @var{b}, @var{c}, @var{d}] =} tf2ss (@var{num}, @var{den}) -## Conversion from transfer function to state-space. -## The state space system: -## @iftex -## @tex -## $$ \dot x = Ax + Bu $$ -## $$ y = Cx + Du $$ -## @end tex -## @end iftex -## @ifinfo -## @example -## . -## x = Ax + Bu -## y = Cx + Du -## @end example -## @end ifinfo -## is obtained from a transfer function: -## @iftex -## @tex -## $$ G(s) = { { \rm num }(s) \over { \rm den }(s) } $$ -## @end tex -## @end iftex -## @ifinfo -## @example -## num(s) -## G(s)=------- -## den(s) -## @end example -## @end ifinfo -## -## The vector @var{den} must contain only one row, whereas the vector -## @var{num} may contain as many rows as there are outputs @var{y} of -## the system. The state space system matrices obtained from this function -## will be in controllable canonical form as described in @cite{Modern Control -## Theory}, (Brogan, 1991). -## @end deftypefn - -## Author: R. Bruce Tenison <bte...@en...> -## Created: June 22, 1994 -## mod A S Hodel July, Aug 1995 - -function [a, b, c, d] = __tf2ss__ (num, den) - - if (nargin != 2) - print_usage (); - elseif (isempty (num)) - error ("tf2ss: empty numerator"); - elseif (isempty (den)) - error ("tf2ss: empy denominator"); - elseif (! is_real_vector (num)) - error ("num(%dx%d) must be a vector", rows (num), columns (num)); - elseif (! is_real_vector (den)) - error ("den(%dx%d) must be a vector", rows (den), columns (den)); - endif - - ## strip leading zeros from num, den - nz = find (num != 0); - if (isempty (nz)) - num = 0; - else - num = num(nz(1):length(num)); - endif - nz = find (den != 0); - if (isempty (nz)) - error ("denominator is 0."); - else - den = den(nz(1):length(den)); - endif - - ## force num, den to be row vectors - num = reshape (num, 1, []); - den = reshape (den, 1, []); - nn = length (num); - nd = length (den); - if (nn > nd) - error ("deg(num)=%d > deg(den)= %d", nn, nd); - endif - - ## Check sizes - if (nd == 1) - a = b = c = []; - d = num(:,1) / den(1); - else - ## Pad num so that length(num) = length(den) - if (nd-nn > 0) - num = [zeros(1,nd-nn), num]; - endif - - ## Normalize the numerator and denominator vector w.r.t. the leading - ## coefficient - d1 = den(1); - num = num / d1; - den = den(2:nd)/d1; - sw = nd-1:-1:1; - - ## Form the A matrix - if (nd > 2) - a = [zeros(nd-2,1), eye(nd-2,nd-2); -den(sw)]; - else - a = -den(sw); - endif - - ## Form the B matrix - b = zeros (nd-1, 1); - b(nd-1,1) = 1; - - ## Form the C matrix - c = num(:,2:nd)-num(:,1)*den; - c = c(:,sw); - - ## Form the D matrix - d = num(:,1); - endif - -endfunction Modified: trunk/octave-forge/main/control/inst/ltimodels.m =================================================================== --- trunk/octave-forge/main/control/inst/ltimodels.m 2011-09-18 19:24:53 UTC (rev 8559) +++ trunk/octave-forge/main/control/inst/ltimodels.m 2011-09-18 19:42:52 UTC (rev 8560) @@ -1369,3 +1369,44 @@ %! %!assert (Mo, Me, 1e-4); + +## transfer function to state-space conversion +## test from SLICOT TD04AD +%!shared Mo, Me +%! INDEX = [ 3 3 ]; +%! +%! DCOEFF = [ 1.0 6.0 11.0 6.0 +%! 1.0 6.0 11.0 6.0 ]; +%! +%! UCOEFF = zeros (2, 2, 4); +%! +%! u11 = [ 1.0 6.0 12.0 7.0 ]; +%! u12 = [ 0.0 1.0 4.0 3.0 ]; +%! u21 = [ 0.0 0.0 1.0 1.0 ]; +%! u22 = [ 1.0 8.0 20.0 15.0 ]; +%! +%! UCOEFF(1,1,:) = u11; +%! UCOEFF(1,2,:) = u12; +%! UCOEFF(2,1,:) = u21; +%! UCOEFF(2,2,:) = u22; +%! +%! [Ao, Bo, Co, Do] = sltd04ad (UCOEFF, DCOEFF, INDEX, 0); +%! +%! Ae = [ 0.5000 -0.8028 0.9387 +%! 4.4047 -2.3380 2.5076 +%! -5.5541 1.6872 -4.1620 ]; +%! +%! Be = [ -0.2000 -1.2500 +%! 0.0000 -0.6097 +%! 0.0000 2.2217 ]; +%! +%! Ce = [ 0.0000 -0.8679 0.2119 +%! 0.0000 0.0000 0.9002 ]; +%! +%! De = [ 1.0000 0.0000 +%! 0.0000 1.0000 ]; +%! +%! Mo = [Ao, Bo; Co, Do]; +%! Me = [Ae, Be; Ce, De]; +%! +%!assert (Mo, Me, 1e-4); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-19 11:40:57
|
Revision: 8565 http://octave.svn.sourceforge.net/octave/?rev=8565&view=rev Author: paramaniac Date: 2011-09-19 11:40:51 +0000 (Mon, 19 Sep 2011) Log Message: ----------- control: fix the pdf manual Modified Paths: -------------- trunk/octave-forge/main/control/devel/pdfdoc/control.tex trunk/octave-forge/main/control/devel/pdfdoc/functions.texi trunk/octave-forge/main/control/devel/tf2ss/tf2ss.m trunk/octave-forge/main/control/inst/@lti/mldivide.m trunk/octave-forge/main/control/inst/test_control.m Modified: trunk/octave-forge/main/control/devel/pdfdoc/control.tex =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-09-19 10:36:15 UTC (rev 8564) +++ trunk/octave-forge/main/control/devel/pdfdoc/control.tex 2011-09-19 11:40:51 UTC (rev 8565) @@ -35,3 +35,4 @@ @include functions.texi @end +@bye Modified: trunk/octave-forge/main/control/devel/pdfdoc/functions.texi =================================================================== --- trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-09-19 10:36:15 UTC (rev 8564) +++ trunk/octave-forge/main/control/devel/pdfdoc/functions.texi 2011-09-19 11:40:51 UTC (rev 8565) @@ -2639,7 +2639,7 @@ @subsection @@lti/mldivide Matrix left division of LTI objects. If necessary, object conversion - is done by sys_group in mtimes. Used by Octave for "lti1 lti2". + is done by sys_group in mtimes. Used by Octave for "lti1 \ lti2". @subsection @@lti/mpower Matrix power of LTI objects. The exponent must be an integer. @@ -2689,6 +2689,6 @@ @end deftypefn @subsection test_control - @deftypefn {Script File} test_control + @deftypefn {Script File} {} test_control Execute all available tests at once. @end deftypefn Modified: trunk/octave-forge/main/control/devel/tf2ss/tf2ss.m =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/tf2ss.m 2011-09-19 10:36:15 UTC (rev 8564) +++ trunk/octave-forge/main/control/devel/tf2ss/tf2ss.m 2011-09-19 11:40:51 UTC (rev 8565) @@ -54,7 +54,7 @@ ucoeff(i, j, len-len_numc(i,j)+1 : len) = numc{i,j}; endfor endfor - +index, prod (index), eps*prod (index) [a, b, c, d] = sltd04ad (ucoeff, dcoeff, index, tol); retsys = ss (a, b, c, d); Modified: trunk/octave-forge/main/control/inst/@lti/mldivide.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/mldivide.m 2011-09-19 10:36:15 UTC (rev 8564) +++ trunk/octave-forge/main/control/inst/@lti/mldivide.m 2011-09-19 11:40:51 UTC (rev 8565) @@ -17,7 +17,7 @@ ## -*- texinfo -*- ## Matrix left division of LTI objects. If necessary, object conversion -## is done by sys_group in mtimes. Used by Octave for "lti1 \ lti2". +## is done by sys_group in mtimes. Used by Octave for "lti1 \\ lti2". ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 Modified: trunk/octave-forge/main/control/inst/test_control.m =================================================================== --- trunk/octave-forge/main/control/inst/test_control.m 2011-09-19 10:36:15 UTC (rev 8564) +++ trunk/octave-forge/main/control/inst/test_control.m 2011-09-19 11:40:51 UTC (rev 8565) @@ -16,7 +16,7 @@ ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Script File} test_control +## @deftypefn {Script File} {} test_control ## Execute all available tests at once. ## @end deftypefn @@ -55,4 +55,4 @@ test initial test ctrb test obsv -test issample \ No newline at end of file +test issample This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2011-09-18 19:18:03
|
Revision: 8557 http://octave.svn.sourceforge.net/octave/?rev=8557&view=rev Author: paramaniac Date: 2011-09-18 19:17:54 +0000 (Sun, 18 Sep 2011) Log Message: ----------- control: move tf2ss conversion into place Modified Paths: -------------- trunk/octave-forge/main/control/devel/makefile_conversions.m trunk/octave-forge/main/control/devel/tf2ss/makefile_tf2ss.m trunk/octave-forge/main/control/src/Makefile Added Paths: ----------- trunk/octave-forge/main/control/src/TD03AY.f trunk/octave-forge/main/control/src/TD04AD.f trunk/octave-forge/main/control/src/sltd04ad.cc Removed Paths: ------------- trunk/octave-forge/main/control/devel/tf2ss/AB07MD.f trunk/octave-forge/main/control/devel/tf2ss/MB01PD.f trunk/octave-forge/main/control/devel/tf2ss/MB01QD.f trunk/octave-forge/main/control/devel/tf2ss/MB03OY.f trunk/octave-forge/main/control/devel/tf2ss/TB01ID.f trunk/octave-forge/main/control/devel/tf2ss/TB01PD.f trunk/octave-forge/main/control/devel/tf2ss/TB01UD.f trunk/octave-forge/main/control/devel/tf2ss/TB01XD.f trunk/octave-forge/main/control/devel/tf2ss/TD03AY.f trunk/octave-forge/main/control/devel/tf2ss/TD04AD.f trunk/octave-forge/main/control/devel/tf2ss/common.cc trunk/octave-forge/main/control/devel/tf2ss/sltd04ad.cc Modified: trunk/octave-forge/main/control/devel/makefile_conversions.m =================================================================== --- trunk/octave-forge/main/control/devel/makefile_conversions.m 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/makefile_conversions.m 2011-09-18 19:17:54 UTC (rev 8557) @@ -21,5 +21,10 @@ mkoctfile slsb10jd.cc \ SB10JD.f +## transfer function to state-space +mkoctfile sltd04ad.cc \ + TD04AD.f TD03AY.f TB01PD.f TB01XD.f AB07MD.f \ + TB01UD.f TB01ID.f MB01PD.f MB03OY.f MB01QD.f + system ("rm *.o"); cd (homedir); Deleted: trunk/octave-forge/main/control/devel/tf2ss/AB07MD.f =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/AB07MD.f 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/tf2ss/AB07MD.f 2011-09-18 19:17:54 UTC (rev 8557) @@ -1,224 +0,0 @@ - SUBROUTINE AB07MD( JOBD, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD, - $ INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To find the dual of a given state-space representation. -C -C ARGUMENTS -C -C Mode Parameters -C -C JOBD CHARACTER*1 -C Specifies whether or not a non-zero matrix D appears in -C the given state space model: -C = 'D': D is present; -C = 'Z': D is assumed a zero matrix. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the state-space representation. N >= 0. -C -C M (input) INTEGER -C The number of system inputs. M >= 0. -C -C P (input) INTEGER -C The number of system outputs. P >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the original state dynamics matrix A. -C On exit, the leading N-by-N part of this array contains -C the dual state dynamics matrix A'. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension -C (LDB,MAX(M,P)) -C On entry, the leading N-by-M part of this array must -C contain the original input/state matrix B. -C On exit, the leading N-by-P part of this array contains -C the dual input/state matrix C'. -C -C LDB INTEGER -C The leading dimension of array B. LDB >= MAX(1,N). -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, the leading P-by-N part of this array must -C contain the original state/output matrix C. -C On exit, the leading M-by-N part of this array contains -C the dual state/output matrix B'. -C -C LDC INTEGER -C The leading dimension of array C. -C LDC >= MAX(1,M,P) if N > 0. -C LDC >= 1 if N = 0. -C -C D (input/output) DOUBLE PRECISION array, dimension -C (LDD,MAX(M,P)) -C On entry, if JOBD = 'D', the leading P-by-M part of this -C array must contain the original direct transmission -C matrix D. -C On exit, if JOBD = 'D', the leading M-by-P part of this -C array contains the dual direct transmission matrix D'. -C The array D is not referenced if JOBD = 'Z'. -C -C LDD INTEGER -C The leading dimension of array D. -C LDD >= MAX(1,M,P) if JOBD = 'D'. -C LDD >= 1 if JOBD = 'Z'. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C If the given state-space representation is the M-input/P-output -C (A,B,C,D), its dual is simply the P-input/M-output (A',C',B',D'). -C -C REFERENCES -C -C None -C -C NUMERICAL ASPECTS -C -C None -C -C CONTRIBUTOR -C -C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, Dec. 1996. -C Supersedes Release 2.0 routine AB07AD by T.W.C.Williams, Kingston -C Polytechnic, United Kingdom, March 1982. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Feb. 2004. -C -C KEYWORDS -C -C Dual system, state-space model, state-space representation. -C -C ****************************************************************** -C -C .. Scalar Arguments .. - CHARACTER JOBD - INTEGER INFO, LDA, LDB, LDC, LDD, M, N, P -C .. Array Arguments .. - DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*) -C .. Local Scalars .. - LOGICAL LJOBD - INTEGER J, MINMP, MPLIM -C .. External functions .. - LOGICAL LSAME - EXTERNAL LSAME -C .. External subroutines .. - EXTERNAL DCOPY, DSWAP, XERBLA -C .. Intrinsic Functions .. - INTRINSIC MAX, MIN -C .. Executable Statements .. -C - INFO = 0 - LJOBD = LSAME( JOBD, 'D' ) - MPLIM = MAX( M, P ) - MINMP = MIN( M, P ) -C -C Test the input scalar arguments. -C - IF( .NOT.LJOBD .AND. .NOT.LSAME( JOBD, 'Z' ) ) THEN - INFO = -1 - ELSE IF( N.LT.0 ) THEN - INFO = -2 - ELSE IF( M.LT.0 ) THEN - INFO = -3 - ELSE IF( P.LT.0 ) THEN - INFO = -4 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -6 - ELSE IF( LDB.LT.MAX( 1, N ) ) THEN - INFO = -8 - ELSE IF( ( N.GT.0 .AND. LDC.LT.MAX( 1, MPLIM ) ) .OR. - $ ( N.EQ.0 .AND. LDC.LT.1 ) ) THEN - INFO = -10 - ELSE IF( ( LJOBD .AND. LDD.LT.MAX( 1, MPLIM ) ) .OR. - $ ( .NOT.LJOBD .AND. LDD.LT.1 ) ) THEN - INFO = -12 - END IF -C - IF ( INFO.NE.0 ) THEN -C -C Error return. -C - CALL XERBLA( 'AB07MD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF ( MAX( N, MINMP ).EQ.0 ) - $ RETURN -C - IF ( N.GT.0 ) THEN -C -C Transpose A, if non-scalar. -C - DO 10 J = 1, N - 1 - CALL DSWAP( N-J, A(J+1,J), 1, A(J,J+1), LDA ) - 10 CONTINUE -C -C Replace B by C' and C by B'. -C - DO 20 J = 1, MPLIM - IF ( J.LE.MINMP ) THEN - CALL DSWAP( N, B(1,J), 1, C(J,1), LDC ) - ELSE IF ( J.GT.P ) THEN - CALL DCOPY( N, B(1,J), 1, C(J,1), LDC ) - ELSE - CALL DCOPY( N, C(J,1), LDC, B(1,J), 1 ) - END IF - 20 CONTINUE -C - END IF -C - IF ( LJOBD .AND. MINMP.GT.0 ) THEN -C -C Transpose D, if non-scalar. -C - DO 30 J = 1, MPLIM - IF ( J.LT.MINMP ) THEN - CALL DSWAP( MINMP-J, D(J+1,J), 1, D(J,J+1), LDD ) - ELSE IF ( J.GT.P ) THEN - CALL DCOPY( P, D(1,J), 1, D(J,1), LDD ) - ELSE IF ( J.GT.M ) THEN - CALL DCOPY( M, D(J,1), LDD, D(1,J), 1 ) - END IF - 30 CONTINUE -C - END IF -C - RETURN -C *** Last line of AB07MD *** - END Deleted: trunk/octave-forge/main/control/devel/tf2ss/MB01PD.f =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/MB01PD.f 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/tf2ss/MB01PD.f 2011-09-18 19:17:54 UTC (rev 8557) @@ -1,271 +0,0 @@ - SUBROUTINE MB01PD( SCUN, TYPE, M, N, KL, KU, ANRM, NBL, NROWS, A, - $ LDA, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To scale a matrix or undo scaling. Scaling is performed, if -C necessary, so that the matrix norm will be in a safe range of -C representable numbers. -C -C ARGUMENTS -C -C Mode Parameters -C -C SCUN CHARACTER*1 -C SCUN indicates the operation to be performed. -C = 'S': scale the matrix. -C = 'U': undo scaling of the matrix. -C -C TYPE CHARACTER*1 -C TYPE indicates the storage type of the input matrix. -C = 'G': A is a full matrix. -C = 'L': A is a (block) lower triangular matrix. -C = 'U': A is an (block) upper triangular matrix. -C = 'H': A is an (block) upper Hessenberg matrix. -C = 'B': A is a symmetric band matrix with lower bandwidth -C KL and upper bandwidth KU and with the only the -C lower half stored. -C = 'Q': A is a symmetric band matrix with lower bandwidth -C KL and upper bandwidth KU and with the only the -C upper half stored. -C = 'Z': A is a band matrix with lower bandwidth KL and -C upper bandwidth KU. -C -C Input/Output Parameters -C -C M (input) INTEGER -C The number of rows of the matrix A. M >= 0. -C -C N (input) INTEGER -C The number of columns of the matrix A. N >= 0. -C -C KL (input) INTEGER -C The lower bandwidth of A. Referenced only if TYPE = 'B', -C 'Q' or 'Z'. -C -C KU (input) INTEGER -C The upper bandwidth of A. Referenced only if TYPE = 'B', -C 'Q' or 'Z'. -C -C ANRM (input) DOUBLE PRECISION -C The norm of the initial matrix A. ANRM >= 0. -C When ANRM = 0 then an immediate return is effected. -C ANRM should be preserved between the call of the routine -C with SCUN = 'S' and the corresponding one with SCUN = 'U'. -C -C NBL (input) INTEGER -C The number of diagonal blocks of the matrix A, if it has a -C block structure. To specify that matrix A has no block -C structure, set NBL = 0. NBL >= 0. -C -C NROWS (input) INTEGER array, dimension max(1,NBL) -C NROWS(i) contains the number of rows and columns of the -C i-th diagonal block of matrix A. The sum of the values -C NROWS(i), for i = 1: NBL, should be equal to min(M,N). -C The elements of the array NROWS are not referenced if -C NBL = 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading M by N part of this array must -C contain the matrix to be scaled/unscaled. -C On exit, the leading M by N part of A will contain -C the modified matrix. -C The storage mode of A is specified by TYPE. -C -C LDA (input) INTEGER -C The leading dimension of the array A. LDA >= max(1,M). -C -C Error Indicator -C -C INFO (output) INTEGER -C = 0: successful exit -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C Denote by ANRM the norm of the matrix, and by SMLNUM and BIGNUM, -C two positive numbers near the smallest and largest safely -C representable numbers, respectively. The matrix is scaled, if -C needed, such that the norm of the result is in the range -C [SMLNUM, BIGNUM]. The scaling factor is represented as a ratio -C of two numbers, one of them being ANRM, and the other one either -C SMLNUM or BIGNUM, depending on ANRM being less than SMLNUM or -C larger than BIGNUM, respectively. For undoing the scaling, the -C norm is again compared with SMLNUM or BIGNUM, and the reciprocal -C of the previous scaling factor is used. -C -C CONTRIBUTOR -C -C V. Sima, Katholieke Univ. Leuven, Belgium, Nov. 1996. -C -C REVISIONS -C -C Oct. 2001, V. Sima, Research Institute for Informatics, Bucharest. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) -C .. Scalar Arguments .. - CHARACTER SCUN, TYPE - INTEGER INFO, KL, KU, LDA, M, MN, N, NBL - DOUBLE PRECISION ANRM -C .. Array Arguments .. - INTEGER NROWS ( * ) - DOUBLE PRECISION A( LDA, * ) -C .. Local Scalars .. - LOGICAL FIRST, LSCALE - INTEGER I, ISUM, ITYPE - DOUBLE PRECISION BIGNUM, SMLNUM -C .. External Functions .. - LOGICAL LSAME - DOUBLE PRECISION DLAMCH - EXTERNAL DLAMCH, LSAME -C .. -C .. External Subroutines .. - EXTERNAL DLABAD, MB01QD, XERBLA -C .. Intrinsic Functions .. - INTRINSIC MAX, MIN -C .. Save statement .. - SAVE BIGNUM, FIRST, SMLNUM -C .. Data statements .. - DATA FIRST/.TRUE./ -C .. -C .. Executable Statements .. -C -C Test the input scalar arguments. -C - INFO = 0 - LSCALE = LSAME( SCUN, 'S' ) - IF( LSAME( TYPE, 'G' ) ) THEN - ITYPE = 0 - ELSE IF( LSAME( TYPE, 'L' ) ) THEN - ITYPE = 1 - ELSE IF( LSAME( TYPE, 'U' ) ) THEN - ITYPE = 2 - ELSE IF( LSAME( TYPE, 'H' ) ) THEN - ITYPE = 3 - ELSE IF( LSAME( TYPE, 'B' ) ) THEN - ITYPE = 4 - ELSE IF( LSAME( TYPE, 'Q' ) ) THEN - ITYPE = 5 - ELSE IF( LSAME( TYPE, 'Z' ) ) THEN - ITYPE = 6 - ELSE - ITYPE = -1 - END IF -C - MN = MIN( M, N ) -C - ISUM = 0 - IF( NBL.GT.0 ) THEN - DO 10 I = 1, NBL - ISUM = ISUM + NROWS(I) - 10 CONTINUE - END IF -C - IF( .NOT.LSCALE .AND. .NOT.LSAME( SCUN, 'U' ) ) THEN - INFO = -1 - ELSE IF( ITYPE.EQ.-1 ) THEN - INFO = -2 - ELSE IF( M.LT.0 ) THEN - INFO = -3 - ELSE IF( N.LT.0 .OR. - $ ( ( ITYPE.EQ.4 .OR. ITYPE.EQ.5 ) .AND. N.NE.M ) ) THEN - INFO = -4 - ELSE IF( ANRM.LT.ZERO ) THEN - INFO = -7 - ELSE IF( NBL.LT.0 ) THEN - INFO = -8 - ELSE IF( NBL.GT.0 .AND. ISUM.NE.MN ) THEN - INFO = -9 - ELSE IF( ITYPE.LE.3 .AND. LDA.LT.MAX( 1, M ) ) THEN - INFO = -11 - ELSE IF( ITYPE.GE.4 ) THEN - IF( KL.LT.0 .OR. KL.GT.MAX( M-1, 0 ) ) THEN - INFO = -5 - ELSE IF( KU.LT.0 .OR. KU.GT.MAX( N-1, 0 ) .OR. - $ ( ( ITYPE.EQ.4 .OR. ITYPE.EQ.5 ) .AND. KL.NE.KU ) ) - $ THEN - INFO = -6 - ELSE IF( ( ITYPE.EQ.4 .AND. LDA.LT.KL+1 ) .OR. - $ ( ITYPE.EQ.5 .AND. LDA.LT.KU+1 ) .OR. - $ ( ITYPE.EQ.6 .AND. LDA.LT.2*KL+KU+1 ) ) THEN - INFO = -11 - END IF - END IF -C - IF( INFO.NE.0 ) THEN - CALL XERBLA( 'MB01PD', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - IF( MN.EQ.0 .OR. ANRM.EQ.ZERO ) - $ RETURN -C - IF ( FIRST ) THEN -C -C Get machine parameters. -C - SMLNUM = DLAMCH( 'S' ) / DLAMCH( 'P' ) - BIGNUM = ONE / SMLNUM - CALL DLABAD( SMLNUM, BIGNUM ) - FIRST = .FALSE. - END IF -C - IF ( LSCALE ) THEN -C -C Scale A, if its norm is outside range [SMLNUM,BIGNUM]. -C - IF( ANRM.LT.SMLNUM ) THEN -C -C Scale matrix norm up to SMLNUM. -C - CALL MB01QD( TYPE, M, N, KL, KU, ANRM, SMLNUM, NBL, NROWS, - $ A, LDA, INFO ) - ELSE IF( ANRM.GT.BIGNUM ) THEN -C -C Scale matrix norm down to BIGNUM. -C - CALL MB01QD( TYPE, M, N, KL, KU, ANRM, BIGNUM, NBL, NROWS, - $ A, LDA, INFO ) - END IF -C - ELSE -C -C Undo scaling. -C - IF( ANRM.LT.SMLNUM ) THEN - CALL MB01QD( TYPE, M, N, KL, KU, SMLNUM, ANRM, NBL, NROWS, - $ A, LDA, INFO ) - ELSE IF( ANRM.GT.BIGNUM ) THEN - CALL MB01QD( TYPE, M, N, KL, KU, BIGNUM, ANRM, NBL, NROWS, - $ A, LDA, INFO ) - END IF - END IF -C - RETURN -C *** Last line of MB01PD *** - END Deleted: trunk/octave-forge/main/control/devel/tf2ss/MB01QD.f =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/MB01QD.f 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/tf2ss/MB01QD.f 2011-09-18 19:17:54 UTC (rev 8557) @@ -1,334 +0,0 @@ - SUBROUTINE MB01QD( TYPE, M, N, KL, KU, CFROM, CTO, NBL, NROWS, A, - $ LDA, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To multiply the M by N real matrix A by the real scalar CTO/CFROM. -C This is done without over/underflow as long as the final result -C CTO*A(I,J)/CFROM does not over/underflow. TYPE specifies that -C A may be full, (block) upper triangular, (block) lower triangular, -C (block) upper Hessenberg, or banded. -C -C ARGUMENTS -C -C Mode Parameters -C -C TYPE CHARACTER*1 -C TYPE indices the storage type of the input matrix. -C = 'G': A is a full matrix. -C = 'L': A is a (block) lower triangular matrix. -C = 'U': A is a (block) upper triangular matrix. -C = 'H': A is a (block) upper Hessenberg matrix. -C = 'B': A is a symmetric band matrix with lower bandwidth -C KL and upper bandwidth KU and with the only the -C lower half stored. -C = 'Q': A is a symmetric band matrix with lower bandwidth -C KL and upper bandwidth KU and with the only the -C upper half stored. -C = 'Z': A is a band matrix with lower bandwidth KL and -C upper bandwidth KU. -C -C Input/Output Parameters -C -C M (input) INTEGER -C The number of rows of the matrix A. M >= 0. -C -C N (input) INTEGER -C The number of columns of the matrix A. N >= 0. -C -C KL (input) INTEGER -C The lower bandwidth of A. Referenced only if TYPE = 'B', -C 'Q' or 'Z'. -C -C KU (input) INTEGER -C The upper bandwidth of A. Referenced only if TYPE = 'B', -C 'Q' or 'Z'. -C -C CFROM (input) DOUBLE PRECISION -C CTO (input) DOUBLE PRECISION -C The matrix A is multiplied by CTO/CFROM. A(I,J) is -C computed without over/underflow if the final result -C CTO*A(I,J)/CFROM can be represented without over/ -C underflow. CFROM must be nonzero. -C -C NBL (input) INTEGER -C The number of diagonal blocks of the matrix A, if it has a -C block structure. To specify that matrix A has no block -C structure, set NBL = 0. NBL >= 0. -C -C NROWS (input) INTEGER array, dimension max(1,NBL) -C NROWS(i) contains the number of rows and columns of the -C i-th diagonal block of matrix A. The sum of the values -C NROWS(i), for i = 1: NBL, should be equal to min(M,N). -C The array NROWS is not referenced if NBL = 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C The matrix to be multiplied by CTO/CFROM. See TYPE for -C the storage type. -C -C LDA (input) INTEGER -C The leading dimension of the array A. LDA >= max(1,M). -C -C Error Indicator -C -C INFO INTEGER -C Not used in this implementation. -C -C METHOD -C -C Matrix A is multiplied by the real scalar CTO/CFROM, taking into -C account the specified storage mode of the matrix. -C MB01QD is a version of the LAPACK routine DLASCL, modified for -C dealing with block triangular, or block Hessenberg matrices. -C For efficiency, no tests of the input scalar parameters are -C performed. -C -C CONTRIBUTOR -C -C V. Sima, Katholieke Univ. Leuven, Belgium, Nov. 1996. -C -C ****************************************************************** -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) -C .. -C .. Scalar Arguments .. - CHARACTER TYPE - INTEGER INFO, KL, KU, LDA, M, N, NBL - DOUBLE PRECISION CFROM, CTO -C .. -C .. Array Arguments .. - INTEGER NROWS ( * ) - DOUBLE PRECISION A( LDA, * ) -C .. -C .. Local Scalars .. - LOGICAL DONE, NOBLC - INTEGER I, IFIN, ITYPE, J, JFIN, JINI, K, K1, K2, K3, - $ K4 - DOUBLE PRECISION BIGNUM, CFROM1, CFROMC, CTO1, CTOC, MUL, SMLNUM -C .. -C .. External Functions .. - LOGICAL LSAME - DOUBLE PRECISION DLAMCH - EXTERNAL LSAME, DLAMCH -C .. -C .. Intrinsic Functions .. - INTRINSIC ABS, MAX, MIN -C .. -C .. Executable Statements .. -C - IF( LSAME( TYPE, 'G' ) ) THEN - ITYPE = 0 - ELSE IF( LSAME( TYPE, 'L' ) ) THEN - ITYPE = 1 - ELSE IF( LSAME( TYPE, 'U' ) ) THEN - ITYPE = 2 - ELSE IF( LSAME( TYPE, 'H' ) ) THEN - ITYPE = 3 - ELSE IF( LSAME( TYPE, 'B' ) ) THEN - ITYPE = 4 - ELSE IF( LSAME( TYPE, 'Q' ) ) THEN - ITYPE = 5 - ELSE - ITYPE = 6 - END IF -C -C Quick return if possible. -C - IF( MIN( M, N ).EQ.0 ) - $ RETURN -C -C Get machine parameters. -C - SMLNUM = DLAMCH( 'S' ) - BIGNUM = ONE / SMLNUM -C - CFROMC = CFROM - CTOC = CTO -C - 10 CONTINUE - CFROM1 = CFROMC*SMLNUM - CTO1 = CTOC / BIGNUM - IF( ABS( CFROM1 ).GT.ABS( CTOC ) .AND. CTOC.NE.ZERO ) THEN - MUL = SMLNUM - DONE = .FALSE. - CFROMC = CFROM1 - ELSE IF( ABS( CTO1 ).GT.ABS( CFROMC ) ) THEN - MUL = BIGNUM - DONE = .FALSE. - CTOC = CTO1 - ELSE - MUL = CTOC / CFROMC - DONE = .TRUE. - END IF -C - NOBLC = NBL.EQ.0 -C - IF( ITYPE.EQ.0 ) THEN -C -C Full matrix -C - DO 30 J = 1, N - DO 20 I = 1, M - A( I, J ) = A( I, J )*MUL - 20 CONTINUE - 30 CONTINUE -C - ELSE IF( ITYPE.EQ.1 ) THEN -C - IF ( NOBLC ) THEN -C -C Lower triangular matrix -C - DO 50 J = 1, N - DO 40 I = J, M - A( I, J ) = A( I, J )*MUL - 40 CONTINUE - 50 CONTINUE -C - ELSE -C -C Block lower triangular matrix -C - JFIN = 0 - DO 80 K = 1, NBL - JINI = JFIN + 1 - JFIN = JFIN + NROWS( K ) - DO 70 J = JINI, JFIN - DO 60 I = JINI, M - A( I, J ) = A( I, J )*MUL - 60 CONTINUE - 70 CONTINUE - 80 CONTINUE - END IF -C - ELSE IF( ITYPE.EQ.2 ) THEN -C - IF ( NOBLC ) THEN -C -C Upper triangular matrix -C - DO 100 J = 1, N - DO 90 I = 1, MIN( J, M ) - A( I, J ) = A( I, J )*MUL - 90 CONTINUE - 100 CONTINUE -C - ELSE -C -C Block upper triangular matrix -C - JFIN = 0 - DO 130 K = 1, NBL - JINI = JFIN + 1 - JFIN = JFIN + NROWS( K ) - IF ( K.EQ.NBL ) JFIN = N - DO 120 J = JINI, JFIN - DO 110 I = 1, MIN( JFIN, M ) - A( I, J ) = A( I, J )*MUL - 110 CONTINUE - 120 CONTINUE - 130 CONTINUE - END IF -C - ELSE IF( ITYPE.EQ.3 ) THEN -C - IF ( NOBLC ) THEN -C -C Upper Hessenberg matrix -C - DO 150 J = 1, N - DO 140 I = 1, MIN( J+1, M ) - A( I, J ) = A( I, J )*MUL - 140 CONTINUE - 150 CONTINUE -C - ELSE -C -C Block upper Hessenberg matrix -C - JFIN = 0 - DO 180 K = 1, NBL - JINI = JFIN + 1 - JFIN = JFIN + NROWS( K ) -C - IF ( K.EQ.NBL ) THEN - JFIN = N - IFIN = N - ELSE - IFIN = JFIN + NROWS( K+1 ) - END IF -C - DO 170 J = JINI, JFIN - DO 160 I = 1, MIN( IFIN, M ) - A( I, J ) = A( I, J )*MUL - 160 CONTINUE - 170 CONTINUE - 180 CONTINUE - END IF -C - ELSE IF( ITYPE.EQ.4 ) THEN -C -C Lower half of a symmetric band matrix -C - K3 = KL + 1 - K4 = N + 1 - DO 200 J = 1, N - DO 190 I = 1, MIN( K3, K4-J ) - A( I, J ) = A( I, J )*MUL - 190 CONTINUE - 200 CONTINUE -C - ELSE IF( ITYPE.EQ.5 ) THEN -C -C Upper half of a symmetric band matrix -C - K1 = KU + 2 - K3 = KU + 1 - DO 220 J = 1, N - DO 210 I = MAX( K1-J, 1 ), K3 - A( I, J ) = A( I, J )*MUL - 210 CONTINUE - 220 CONTINUE -C - ELSE IF( ITYPE.EQ.6 ) THEN -C -C Band matrix -C - K1 = KL + KU + 2 - K2 = KL + 1 - K3 = 2*KL + KU + 1 - K4 = KL + KU + 1 + M - DO 240 J = 1, N - DO 230 I = MAX( K1-J, K2 ), MIN( K3, K4-J ) - A( I, J ) = A( I, J )*MUL - 230 CONTINUE - 240 CONTINUE -C - END IF -C - IF( .NOT.DONE ) - $ GO TO 10 -C - RETURN -C *** Last line of MB01QD *** - END Deleted: trunk/octave-forge/main/control/devel/tf2ss/MB03OY.f =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/MB03OY.f 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/tf2ss/MB03OY.f 2011-09-18 19:17:54 UTC (rev 8557) @@ -1,388 +0,0 @@ - SUBROUTINE MB03OY( M, N, A, LDA, RCOND, SVLMAX, RANK, SVAL, JPVT, - $ TAU, DWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To compute a rank-revealing QR factorization of a real general -C M-by-N matrix A, which may be rank-deficient, and estimate its -C effective rank using incremental condition estimation. -C -C The routine uses a truncated QR factorization with column pivoting -C [ R11 R12 ] -C A * P = Q * R, where R = [ ], -C [ 0 R22 ] -C with R11 defined as the largest leading upper triangular submatrix -C whose estimated condition number is less than 1/RCOND. The order -C of R11, RANK, is the effective rank of A. Condition estimation is -C performed during the QR factorization process. Matrix R22 is full -C (but of small norm), or empty. -C -C MB03OY does not perform any scaling of the matrix A. -C -C ARGUMENTS -C -C Input/Output Parameters -C -C M (input) INTEGER -C The number of rows of the matrix A. M >= 0. -C -C N (input) INTEGER -C The number of columns of the matrix A. N >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension -C ( LDA, N ) -C On entry, the leading M-by-N part of this array must -C contain the given matrix A. -C On exit, the leading RANK-by-RANK upper triangular part -C of A contains the triangular factor R11, and the elements -C below the diagonal in the first RANK columns, with the -C array TAU, represent the orthogonal matrix Q as a product -C of RANK elementary reflectors. -C The remaining N-RANK columns contain the result of the -C QR factorization process used. -C -C LDA INTEGER -C The leading dimension of the array A. LDA >= max(1,M). -C -C RCOND (input) DOUBLE PRECISION -C RCOND is used to determine the effective rank of A, which -C is defined as the order of the largest leading triangular -C submatrix R11 in the QR factorization with pivoting of A, -C whose estimated condition number is less than 1/RCOND. -C 0 <= RCOND <= 1. -C NOTE that when SVLMAX > 0, the estimated rank could be -C less than that defined above (see SVLMAX). -C -C SVLMAX (input) DOUBLE PRECISION -C If A is a submatrix of another matrix B, and the rank -C decision should be related to that matrix, then SVLMAX -C should be an estimate of the largest singular value of B -C (for instance, the Frobenius norm of B). If this is not -C the case, the input value SVLMAX = 0 should work. -C SVLMAX >= 0. -C -C RANK (output) INTEGER -C The effective (estimated) rank of A, i.e., the order of -C the submatrix R11. -C -C SVAL (output) DOUBLE PRECISION array, dimension ( 3 ) -C The estimates of some of the singular values of the -C triangular factor R: -C SVAL(1): largest singular value of R(1:RANK,1:RANK); -C SVAL(2): smallest singular value of R(1:RANK,1:RANK); -C SVAL(3): smallest singular value of R(1:RANK+1,1:RANK+1), -C if RANK < MIN( M, N ), or of R(1:RANK,1:RANK), -C otherwise. -C If the triangular factorization is a rank-revealing one -C (which will be the case if the leading columns were well- -C conditioned), then SVAL(1) will also be an estimate for -C the largest singular value of A, and SVAL(2) and SVAL(3) -C will be estimates for the RANK-th and (RANK+1)-st singular -C values of A, respectively. -C By examining these values, one can confirm that the rank -C is well defined with respect to the chosen value of RCOND. -C The ratio SVAL(1)/SVAL(2) is an estimate of the condition -C number of R(1:RANK,1:RANK). -C -C JPVT (output) INTEGER array, dimension ( N ) -C If JPVT(i) = k, then the i-th column of A*P was the k-th -C column of A. -C -C TAU (output) DOUBLE PRECISION array, dimension ( MIN( M, N ) ) -C The leading RANK elements of TAU contain the scalar -C factors of the elementary reflectors. -C -C Workspace -C -C DWORK DOUBLE PRECISION array, dimension ( 3*N-1 ) -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit; -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C The routine computes a truncated QR factorization with column -C pivoting of A, A * P = Q * R, with R defined above, and, -C during this process, finds the largest leading submatrix whose -C estimated condition number is less than 1/RCOND, taking the -C possible positive value of SVLMAX into account. This is performed -C using the LAPACK incremental condition estimation scheme and a -C slightly modified rank decision test. The factorization process -C stops when RANK has been determined. -C -C The matrix Q is represented as a product of elementary reflectors -C -C Q = H(1) H(2) . . . H(k), where k = rank <= min(m,n). -C -C Each H(i) has the form -C -C H = I - tau * v * v' -C -C where tau is a real scalar, and v is a real vector with -C v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in -C A(i+1:m,i), and tau in TAU(i). -C -C The matrix P is represented in jpvt as follows: If -C jpvt(j) = i -C then the jth column of P is the ith canonical unit vector. -C -C REFERENCES -C -C [1] Bischof, C.H. and P. Tang. -C Generalizing Incremental Condition Estimation. -C LAPACK Working Notes 32, Mathematics and Computer Science -C Division, Argonne National Laboratory, UT, CS-91-132, -C May 1991. -C -C [2] Bischof, C.H. and P. Tang. -C Robust Incremental Condition Estimation. -C LAPACK Working Notes 33, Mathematics and Computer Science -C Division, Argonne National Laboratory, UT, CS-91-133, -C May 1991. -C -C NUMERICAL ASPECTS -C -C The algorithm is backward stable. -C -C CONTRIBUTOR -C -C V. Sima, Katholieke Univ. Leuven, Belgium, Feb. 1998. -C -C REVISIONS -C -C V. Sima, Research Institute for Informatics, Bucharest, Jan. 2009. -C V. Sima, Jan. 2010, following Bujanovic and Drmac's suggestion. -C -C KEYWORDS -C -C Eigenvalue problem, matrix operations, orthogonal transformation, -C singular values. -C -C ****************************************************************** -C -C .. Parameters .. - INTEGER IMAX, IMIN - PARAMETER ( IMAX = 1, IMIN = 2 ) - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 ) -C .. Scalar Arguments .. - INTEGER INFO, LDA, M, N, RANK - DOUBLE PRECISION RCOND, SVLMAX -C .. Array Arguments .. - INTEGER JPVT( * ) - DOUBLE PRECISION A( LDA, * ), DWORK( * ), SVAL( 3 ), TAU( * ) -C .. -C .. Local Scalars .. - INTEGER I, ISMAX, ISMIN, ITEMP, J, MN, PVT - DOUBLE PRECISION AII, C1, C2, S1, S2, SMAX, SMAXPR, SMIN, - $ SMINPR, TEMP, TEMP2, TOLZ -C .. -C .. External Functions .. - INTEGER IDAMAX - DOUBLE PRECISION DLAMCH, DNRM2 - EXTERNAL DLAMCH, DNRM2, IDAMAX -C .. External Subroutines .. - EXTERNAL DLAIC1, DLARF, DLARFG, DSCAL, DSWAP, XERBLA -C .. Intrinsic Functions .. - INTRINSIC ABS, MAX, MIN, SQRT -C .. -C .. Executable Statements .. -C -C Test the input scalar arguments. -C - INFO = 0 - IF( M.LT.0 ) THEN - INFO = -1 - ELSE IF( N.LT.0 ) THEN - INFO = -2 - ELSE IF( LDA.LT.MAX( 1, M ) ) THEN - INFO = -4 - ELSE IF( RCOND.LT.ZERO .OR. RCOND.GT.ONE ) THEN - INFO = -5 - ELSE IF( SVLMAX.LT.ZERO ) THEN - INFO = -6 - END IF -C - IF( INFO.NE.0 ) THEN - CALL XERBLA( 'MB03OY', -INFO ) - RETURN - END IF -C -C Quick return if possible. -C - MN = MIN( M, N ) - IF( MN.EQ.0 ) THEN - RANK = 0 - SVAL( 1 ) = ZERO - SVAL( 2 ) = ZERO - SVAL( 3 ) = ZERO - RETURN - END IF -C - TOLZ = SQRT( DLAMCH( 'Epsilon' ) ) - ISMIN = 1 - ISMAX = ISMIN + N -C -C Initialize partial column norms and pivoting vector. The first n -C elements of DWORK store the exact column norms. The already used -C leading part is then overwritten by the condition estimator. -C - DO 10 I = 1, N - DWORK( I ) = DNRM2( M, A( 1, I ), 1 ) - DWORK( N+I ) = DWORK( I ) - JPVT( I ) = I - 10 CONTINUE -C -C Compute factorization and determine RANK using incremental -C condition estimation. -C - RANK = 0 -C - 20 CONTINUE - IF( RANK.LT.MN ) THEN - I = RANK + 1 -C -C Determine ith pivot column and swap if necessary. -C - PVT = ( I-1 ) + IDAMAX( N-I+1, DWORK( I ), 1 ) -C - IF( PVT.NE.I ) THEN - CALL DSWAP( M, A( 1, PVT ), 1, A( 1, I ), 1 ) - ITEMP = JPVT( PVT ) - JPVT( PVT ) = JPVT( I ) - JPVT( I ) = ITEMP - DWORK( PVT ) = DWORK( I ) - DWORK( N+PVT ) = DWORK( N+I ) - END IF -C -C Save A(I,I) and generate elementary reflector H(i). -C - IF( I.LT.M ) THEN - AII = A( I, I ) - CALL DLARFG( M-I+1, A( I, I ), A( I+1, I ), 1, TAU( I ) ) - ELSE - TAU( M ) = ZERO - END IF -C - IF( RANK.EQ.0 ) THEN -C -C Initialize; exit if matrix is zero (RANK = 0). -C - SMAX = ABS( A( 1, 1 ) ) - IF ( SMAX.EQ.ZERO ) THEN - SVAL( 1 ) = ZERO - SVAL( 2 ) = ZERO - SVAL( 3 ) = ZERO - RETURN - END IF - SMIN = SMAX - SMAXPR = SMAX - SMINPR = SMIN - C1 = ONE - C2 = ONE - ELSE -C -C One step of incremental condition estimation. -C - CALL DLAIC1( IMIN, RANK, DWORK( ISMIN ), SMIN, A( 1, I ), - $ A( I, I ), SMINPR, S1, C1 ) - CALL DLAIC1( IMAX, RANK, DWORK( ISMAX ), SMAX, A( 1, I ), - $ A( I, I ), SMAXPR, S2, C2 ) - END IF -C - IF( SVLMAX*RCOND.LE.SMAXPR ) THEN - IF( SVLMAX*RCOND.LE.SMINPR ) THEN - IF( SMAXPR*RCOND.LE.SMINPR ) THEN -C -C Continue factorization, as rank is at least RANK. -C - IF( I.LT.N ) THEN -C -C Apply H(i) to A(i:m,i+1:n) from the left. -C - AII = A( I, I ) - A( I, I ) = ONE - CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, - $ TAU( I ), A( I, I+1 ), LDA, - $ DWORK( 2*N+1 ) ) - A( I, I ) = AII - END IF -C -C Update partial column norms. -C - DO 30 J = I + 1, N - IF( DWORK( J ).NE.ZERO ) THEN - TEMP = ABS( A( I, J ) ) / DWORK( J ) - TEMP = MAX( ( ONE + TEMP )*( ONE - TEMP ), ZERO) - TEMP2 = TEMP*( DWORK( J ) / DWORK( N+J ) )**2 - IF( TEMP2.LE.TOLZ ) THEN - IF( M-I.GT.0 ) THEN - DWORK( J ) = DNRM2( M-I, A( I+1, J ), 1 ) - DWORK( N+J ) = DWORK( J ) - ELSE - DWORK( J ) = ZERO - DWORK( N+J ) = ZERO - END IF - ELSE - DWORK( J ) = DWORK( J )*SQRT( TEMP ) - END IF - END IF - 30 CONTINUE -C - DO 40 I = 1, RANK - DWORK( ISMIN+I-1 ) = S1*DWORK( ISMIN+I-1 ) - DWORK( ISMAX+I-1 ) = S2*DWORK( ISMAX+I-1 ) - 40 CONTINUE -C - DWORK( ISMIN+RANK ) = C1 - DWORK( ISMAX+RANK ) = C2 - SMIN = SMINPR - SMAX = SMAXPR - RANK = RANK + 1 - GO TO 20 - END IF - END IF - END IF - END IF -C -C Restore the changed part of the (RANK+1)-th column and set SVAL. -C - IF ( RANK.LT.N ) THEN - IF ( I.LT.M ) THEN - CALL DSCAL( M-I, -A( I, I )*TAU( I ), A( I+1, I ), 1 ) - A( I, I ) = AII - END IF - END IF - IF ( RANK.EQ.0 ) THEN - SMIN = ZERO - SMINPR = ZERO - END IF - SVAL( 1 ) = SMAX - SVAL( 2 ) = SMIN - SVAL( 3 ) = SMINPR -C - RETURN -C *** Last line of MB03OY *** - END Deleted: trunk/octave-forge/main/control/devel/tf2ss/TB01ID.f =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/TB01ID.f 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/tf2ss/TB01ID.f 2011-09-18 19:17:54 UTC (rev 8557) @@ -1,402 +0,0 @@ - SUBROUTINE TB01ID( JOB, N, M, P, MAXRED, A, LDA, B, LDB, C, LDC, - $ SCALE, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To reduce the 1-norm of a system matrix -C -C S = ( A B ) -C ( C 0 ) -C -C corresponding to the triple (A,B,C), by balancing. This involves -C a diagonal similarity transformation inv(D)*A*D applied -C iteratively to A to make the rows and columns of -C -1 -C diag(D,I) * S * diag(D,I) -C -C as close in norm as possible. -C -C The balancing can be performed optionally on the following -C particular system matrices -C -C S = A, S = ( A B ) or S = ( A ) -C ( C ) -C -C ARGUMENTS -C -C Mode Parameters -C -C JOB CHARACTER*1 -C Indicates which matrices are involved in balancing, as -C follows: -C = 'A': All matrices are involved in balancing; -C = 'B': B and A matrices are involved in balancing; -C = 'C': C and A matrices are involved in balancing; -C = 'N': B and C matrices are not involved in balancing. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the matrix A, the number of rows of matrix B -C and the number of columns of matrix C. -C N represents the dimension of the state vector. N >= 0. -C -C M (input) INTEGER. -C The number of columns of matrix B. -C M represents the dimension of input vector. M >= 0. -C -C P (input) INTEGER. -C The number of rows of matrix C. -C P represents the dimension of output vector. P >= 0. -C -C MAXRED (input/output) DOUBLE PRECISION -C On entry, the maximum allowed reduction in the 1-norm of -C S (in an iteration) if zero rows or columns are -C encountered. -C If MAXRED > 0.0, MAXRED must be larger than one (to enable -C the norm reduction). -C If MAXRED <= 0.0, then the value 10.0 for MAXRED is -C used. -C On exit, if the 1-norm of the given matrix S is non-zero, -C the ratio between the 1-norm of the given matrix and the -C 1-norm of the balanced matrix. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the system state matrix A. -C On exit, the leading N-by-N part of this array contains -C the balanced matrix inv(D)*A*D. -C -C LDA INTEGER -C The leading dimension of the array A. LDA >= max(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (LDB,M) -C On entry, if M > 0, the leading N-by-M part of this array -C must contain the system input matrix B. -C On exit, if M > 0, the leading N-by-M part of this array -C contains the balanced matrix inv(D)*B. -C The array B is not referenced if M = 0. -C -C LDB INTEGER -C The leading dimension of the array B. -C LDB >= MAX(1,N) if M > 0. -C LDB >= 1 if M = 0. -C -C C (input/output) DOUBLE PRECISION array, dimension (LDC,N) -C On entry, if P > 0, the leading P-by-N part of this array -C must contain the system output matrix C. -C On exit, if P > 0, the leading P-by-N part of this array -C contains the balanced matrix C*D. -C The array C is not referenced if P = 0. -C -C LDC INTEGER -C The leading dimension of the array C. LDC >= MAX(1,P). -C -C SCALE (output) DOUBLE PRECISION array, dimension (N) -C The scaling factors applied to S. If D(j) is the scaling -C factor applied to row and column j, then SCALE(j) = D(j), -C for j = 1,...,N. -C -C Error Indicator -C -C INFO INTEGER -C = 0: successful exit. -C < 0: if INFO = -i, the i-th argument had an illegal -C value. -C -C METHOD -C -C Balancing consists of applying a diagonal similarity -C transformation -C -1 -C diag(D,I) * S * diag(D,I) -C -C to make the 1-norms of each row of the first N rows of S and its -C corresponding column nearly equal. -C -C Information about the diagonal matrix D is returned in the vector -C SCALE. -C -C REFERENCES -C -C [1] Anderson, E., Bai, Z., Bischof, C., Demmel, J., Dongarra, J., -C Du Croz, J., Greenbaum, A., Hammarling, S., McKenney, A., -C Ostrouchov, S., and Sorensen, D. -C LAPACK Users' Guide: Second Edition. -C SIAM, Philadelphia, 1995. -C -C NUMERICAL ASPECTS -C -C None. -C -C CONTRIBUTOR -C -C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, Jan. 1998. -C This subroutine is based on LAPACK routine DGEBAL, and routine -C BALABC (A. Varga, German Aerospace Research Establishment, DLR). -C -C REVISIONS -C -C - -C -C KEYWORDS -C -C Balancing, eigenvalue, matrix algebra, matrix operations, -C similarity transformation. -C -C ********************************************************************* -C -C .. Parameters .. - DOUBLE PRECISION ZERO, ONE - PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) - DOUBLE PRECISION SCLFAC - PARAMETER ( SCLFAC = 1.0D+1 ) - DOUBLE PRECISION FACTOR, MAXR - PARAMETER ( FACTOR = 0.95D+0, MAXR = 10.0D+0 ) -C .. -C .. Scalar Arguments .. - CHARACTER JOB - INTEGER INFO, LDA, LDB, LDC, M, N, P - DOUBLE PRECISION MAXRED -C .. -C .. Array Arguments .. - DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ), - $ SCALE( * ) -C .. -C .. Local Scalars .. - LOGICAL NOCONV, WITHB, WITHC - INTEGER I, ICA, IRA, J - DOUBLE PRECISION CA, CO, F, G, MAXNRM, RA, RO, S, SFMAX1, - $ SFMAX2, SFMIN1, SFMIN2, SNORM, SRED -C .. -C .. External Functions .. - LOGICAL LSAME - INTEGER IDAMAX - DOUBLE PRECISION DASUM, DLAMCH - EXTERNAL DASUM, DLAMCH, IDAMAX, LSAME -C .. -C .. External Subroutines .. - EXTERNAL DSCAL, XERBLA -C .. -C .. Intrinsic Functions .. - INTRINSIC ABS, MAX, MIN -C .. -C .. Executable Statements .. -C -C Test the scalar input arguments. -C - INFO = 0 - WITHB = LSAME( JOB, 'A' ) .OR. LSAME( JOB, 'B' ) - WITHC = LSAME( JOB, 'A' ) .OR. LSAME( JOB, 'C' ) -C - IF( .NOT.WITHB .AND. .NOT.WITHC .AND. .NOT.LSAME( JOB, 'N' ) ) - $ THEN - INFO = -1 - ELSE IF( N.LT.0 ) THEN - INFO = -2 - ELSE IF( M.LT.0 ) THEN - INFO = -3 - ELSE IF( P.LT.0 ) THEN - INFO = -4 - ELSE IF( MAXRED.GT.ZERO .AND. MAXRED.LT.ONE ) THEN - INFO = -5 - ELSE IF( LDA.LT.MAX( 1, N ) ) THEN - INFO = -7 - ELSE IF( ( M.GT.0 .AND. LDB.LT.MAX( 1, N ) ) .OR. - $ ( M.EQ.0 .AND. LDB.LT.1 ) ) THEN - INFO = -9 - ELSE IF( LDC.LT.MAX( 1, P ) ) THEN - INFO = -11 - END IF - IF( INFO.NE.0 ) THEN - CALL XERBLA( 'TB01ID', -INFO ) - RETURN - END IF -C - IF( N.EQ.0 ) - $ RETURN -C -C Compute the 1-norm of the required part of matrix S and exit if -C it is zero. -C - SNORM = ZERO -C - DO 10 J = 1, N - SCALE( J ) = ONE - CO = DASUM( N, A( 1, J ), 1 ) - IF( WITHC .AND. P.GT.0 ) - $ CO = CO + DASUM( P, C( 1, J ), 1 ) - SNORM = MAX( SNORM, CO ) - 10 CONTINUE -C - IF( WITHB ) THEN -C - DO 20 J = 1, M - SNORM = MAX( SNORM, DASUM( N, B( 1, J ), 1 ) ) - 20 CONTINUE -C - END IF -C - IF( SNORM.EQ.ZERO ) - $ RETURN -C -C Set some machine parameters and the maximum reduction in the -C 1-norm of S if zero rows or columns are encountered. -C - SFMIN1 = DLAMCH( 'S' ) / DLAMCH( 'P' ) - SFMAX1 = ONE / SFMIN1 - SFMIN2 = SFMIN1*SCLFAC - SFMAX2 = ONE / SFMIN2 -C - SRED = MAXRED - IF( SRED.LE.ZERO ) SRED = MAXR -C - MAXNRM = MAX( SNORM/SRED, SFMIN1 ) -C -C Balance the matrix. -C -C Iterative loop for norm reduction. -C - 30 CONTINUE - NOCONV = .FALSE. -C - DO 90 I = 1, N - CO = ZERO - RO = ZERO -C - DO 40 J = 1, N - IF( J.EQ.I ) - $ GO TO 40 - CO = CO + ABS( A( J, I ) ) - RO = RO + ABS( A( I, J ) ) - 40 CONTINUE -C - ICA = IDAMAX( N, A( 1, I ), 1 ) - CA = ABS( A( ICA, I ) ) - IRA = IDAMAX( N, A( I, 1 ), LDA ) - RA = ABS( A( I, IRA ) ) -C - IF( WITHC .AND. P.GT.0 ) THEN - CO = CO + DASUM( P, C( 1, I ), 1 ) - ICA = IDAMAX( P, C( 1, I ), 1 ) - CA = MAX( CA, ABS( C( ICA, I ) ) ) - END IF -C - IF( WITHB .AND. M.GT.0 ) THEN - RO = RO + DASUM( M, B( I, 1 ), LDB ) - IRA = IDAMAX( M, B( I, 1 ), LDB ) - RA = MAX( RA, ABS( B( I, IRA ) ) ) - END IF -C -C Special case of zero CO and/or RO. -C - IF( CO.EQ.ZERO .AND. RO.EQ.ZERO ) - $ GO TO 90 - IF( CO.EQ.ZERO ) THEN - IF( RO.LE.MAXNRM ) - $ GO TO 90 - CO = MAXNRM - END IF - IF( RO.EQ.ZERO ) THEN - IF( CO.LE.MAXNRM ) - $ GO TO 90 - RO = MAXNRM - END IF -C -C Guard against zero CO or RO due to underflow. -C - G = RO / SCLFAC - F = ONE - S = CO + RO - 50 CONTINUE - IF( CO.GE.G .OR. MAX( F, CO, CA ).GE.SFMAX2 .OR. - $ MIN( RO, G, RA ).LE.SFMIN2 )GO TO 60 - F = F*SCLFAC - CO = CO*SCLFAC - CA = CA*SCLFAC - G = G / SCLFAC - RO = RO / SCLFAC - RA = RA / SCLFAC - GO TO 50 -C - 60 CONTINUE - G = CO / SCLFAC - 70 CONTINUE - IF( G.LT.RO .OR. MAX( RO, RA ).GE.SFMAX2 .OR. - $ MIN( F, CO, G, CA ).LE.SFMIN2 )GO TO 80 - F = F / SCLFAC - CO = CO / SCLFAC - CA = CA / SCLFAC - G = G / SCLFAC - RO = RO*SCLFAC - RA = RA*SCLFAC - GO TO 70 -C -C Now balance. -C - 80 CONTINUE - IF( ( CO+RO ).GE.FACTOR*S ) - $ GO TO 90 - IF( F.LT.ONE .AND. SCALE( I ).LT.ONE ) THEN - IF( F*SCALE( I ).LE.SFMIN1 ) - $ GO TO 90 - END IF - IF( F.GT.ONE .AND. SCALE( I ).GT.ONE ) THEN - IF( SCALE( I ).GE.SFMAX1 / F ) - $ GO TO 90 - END IF - G = ONE / F - SCALE( I ) = SCALE( I )*F - NOCONV = .TRUE. -C - CALL DSCAL( N, G, A( I, 1 ), LDA ) - CALL DSCAL( N, F, A( 1, I ), 1 ) - IF( M.GT.0 ) CALL DSCAL( M, G, B( I, 1 ), LDB ) - IF( P.GT.0 ) CALL DSCAL( P, F, C( 1, I ), 1 ) -C - 90 CONTINUE -C - IF( NOCONV ) - $ GO TO 30 -C -C Set the norm reduction parameter. -C - MAXRED = SNORM - SNORM = ZERO -C - DO 100 J = 1, N - CO = DASUM( N, A( 1, J ), 1 ) - IF( WITHC .AND. P.GT.0 ) - $ CO = CO + DASUM( P, C( 1, J ), 1 ) - SNORM = MAX( SNORM, CO ) - 100 CONTINUE -C - IF( WITHB ) THEN -C - DO 110 J = 1, M - SNORM = MAX( SNORM, DASUM( N, B( 1, J ), 1 ) ) - 110 CONTINUE -C - END IF - MAXRED = MAXRED/SNORM - RETURN -C *** Last line of TB01ID *** - END Deleted: trunk/octave-forge/main/control/devel/tf2ss/TB01PD.f =================================================================== --- trunk/octave-forge/main/control/devel/tf2ss/TB01PD.f 2011-09-18 16:40:17 UTC (rev 8556) +++ trunk/octave-forge/main/control/devel/tf2ss/TB01PD.f 2011-09-18 19:17:54 UTC (rev 8557) @@ -1,352 +0,0 @@ - SUBROUTINE TB01PD( JOB, EQUIL, N, M, P, A, LDA, B, LDB, C, LDC, - $ NR, TOL, IWORK, DWORK, LDWORK, INFO ) -C -C SLICOT RELEASE 5.0. -C -C Copyright (c) 2002-2010 NICONET e.V. -C -C This program is free software: you can redistribute it and/or -C modify it under the terms of the GNU General Public License as -C published by the Free Software Foundation, either version 2 of -C the License, or (at your option) any later version. -C -C This program is distributed in the hope that it will be useful, -C but WITHOUT ANY WARRANTY; without even the implied warranty of -C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -C GNU General Public License for more details. -C -C You should have received a copy of the GNU General Public License -C along with this program. If not, see -C <http://www.gnu.org/licenses/>. -C -C PURPOSE -C -C To find a reduced (controllable, observable, or minimal) state- -C space representation (Ar,Br,Cr) for any original state-space -C representation (A,B,C). The matrix Ar is in upper block -C Hessenberg form. -C -C ARGUMENTS -C -C Mode Parameters -C -C JOB CHARACTER*1 -C Indicates whether the user wishes to remove the -C uncontrollable and/or unobservable parts as follows: -C = 'M': Remove both the uncontrollable and unobservable -C parts to get a minimal state-space representation; -C = 'C': Remove the uncontrollable part only to get a -C controllable state-space representation; -C = 'O': Remove the unobservable part only to get an -C observable state-space representation. -C -C EQUIL CHARACTER*1 -C Specifies whether the user wishes to preliminarily balance -C the triplet (A,B,C) as follows: -C = 'S': Perform balancing (scaling); -C = 'N': Do not perform balancing. -C -C Input/Output Parameters -C -C N (input) INTEGER -C The order of the original state-space representation, i.e. -C the order of the matrix A. N >= 0. -C -C M (input) INTEGER -C The number of system inputs. M >= 0. -C -C P (input) INTEGER -C The number of system outputs. P >= 0. -C -C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) -C On entry, the leading N-by-N part of this array must -C contain the original state dynamics matrix A. -C On exit, the leading NR-by-NR part of this array contains -C the upper block Hessenberg state dynamics matrix Ar of a -C minimal, controllable, or observable realization for the -C original system, depending on the value of JOB, JOB = 'M', -C JOB = 'C', or JOB = 'O', respectively. -C -C LDA INTEGER -C The leading dimension of array A. LDA >= MAX(1,N). -C -C B (input/output) DOUBLE PRECISION array, dimension (LDB,M), -C if JOB = 'C', or (LDB,MAX(M,P)), otherwise. -C On entry, the leading N-by-M part of this array must -C contain the original input/state matrix B; if JOB = 'M', -C or JOB = 'O', the remainder of the leading N-by-MAX(M,P) -C part is used as internal workspace. -C On exit, the leading NR-by-M part of this array contains -C the transformed input/state matrix Br of a minimal, -C ... [truncated message content] |
From: <par...@us...> - 2011-09-21 19:07:30
|
Revision: 8577 http://octave.svn.sourceforge.net/octave/?rev=8577&view=rev Author: paramaniac Date: 2011-09-21 19:07:24 +0000 (Wed, 21 Sep 2011) Log Message: ----------- control: add zpkdata Modified Paths: -------------- trunk/octave-forge/main/control/INDEX Added Paths: ----------- trunk/octave-forge/main/control/inst/@lti/zpkdata.m Modified: trunk/octave-forge/main/control/INDEX =================================================================== --- trunk/octave-forge/main/control/INDEX 2011-09-21 18:06:41 UTC (rev 8576) +++ trunk/octave-forge/main/control/INDEX 2011-09-21 19:07:24 UTC (rev 8577) @@ -17,6 +17,7 @@ @lti/set @lti/ssdata @lti/tfdata + @lti/zpkdata Model Conversions @lti/c2d @lti/d2c Added: trunk/octave-forge/main/control/inst/@lti/zpkdata.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/zpkdata.m (rev 0) +++ trunk/octave-forge/main/control/inst/@lti/zpkdata.m 2011-09-21 19:07:24 UTC (rev 8577) @@ -0,0 +1,66 @@ +## Copyright (C) 2011 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {[@var{z}, @var{p}, @var{k}, @var{tsam}] =} zpkdata (@var{sys}) +## @deftypefnx {Function File} {[@var{z}, @var{p}, @var{k}, @var{tsam}] =} zpkdata (@var{sys}, @var{"v"}) +## Access zero-pole-gain data. +## +## @strong{Inputs} +## @table @var +## @item sys +## Any type of LTI model. +## @item "v", "vector" +## For SISO models, return @var{z} and @var{p} directly as column vectors +## instead of cells containing a single column vector. +## @end table +## +## @strong{Outputs} +## @table @var +## @item z +## Cell of column vectors containing the zeros for each channel. +## z@{i,j@} contains the zeros from input j to output i. +## @item p +## Cell of column vectors containing the poles for each channel. +## p@{i,j@} contains the poles from input j to output i. +## @item k +## Matrix containing the gains for each channel. +## k(i,j) contains the gain from input j to output i. +## @item tsam +## Sampling time in seconds. If @var{sys} is a continuous-time model, +## a zero is returned. +## @end table +## @end deftypefn + +## Author: Lukas Reichlin <luk...@gm...> +## Created: September 2011 +## Version: 0.1 + +function [z, p, k, tsam] = zpkdata (sys, rtype = "cell") + + [num, den, tsam] = tfdata (sys); + + z = cellfun (@roots, num, "uniformoutput", false); + p = cellfun (@roots, den, "uniformoutput", false); + k = cellfun (@(n,d) n(1)/d(1), num, den); + + if (lower (rtype(1)) == "v" && issiso (sys)) + z = z{1}; + p = p{1}; + endif + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |