## octave-cvsupdate

 [Octave-cvsupdate] SF.net SVN: octave:[7744] trunk/octave-forge/main/control/inst/@ss From: - 2010-09-17 13:34:30 ```Revision: 7744 http://octave.svn.sourceforge.net/octave/?rev=7744&view=rev Author: paramaniac Date: 2010-09-17 13:34:24 +0000 (Fri, 17 Sep 2010) Log Message: ----------- control: support for descriptor models Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/__sys_connect__.m trunk/octave-forge/main/control/inst/@ss/__sys_group__.m trunk/octave-forge/main/control/inst/@ss/__sys_prune__.m Modified: trunk/octave-forge/main/control/inst/@ss/__sys_connect__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys_connect__.m 2010-09-17 12:18:32 UTC (rev 7743) +++ trunk/octave-forge/main/control/inst/@ss/__sys_connect__.m 2010-09-17 13:34:24 UTC (rev 7744) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -22,23 +22,23 @@ ## @example ## @group ## Problem: Solve the system equations of -## . -## x(t) = A x(t) + B e(t) +## . +## E x(t) = A x(t) + B e(t) ## -## y(t) = C x(t) + D e(t) +## y(t) = C x(t) + D e(t) ## -## e(t) = u(t) + M y(t) +## e(t) = u(t) + M y(t) ## ## in order to build -## . -## x(t) = F x(t) + G u(t) +## . +## K x(t) = F x(t) + G u(t) ## -## y(t) = H x(t) + J u(t) +## y(t) = H x(t) + J u(t) ## ## Solution: Laplace Transformation -## s X(s) = A X(s) + B U(s) + B M Y(s) [1] +## E s X(s) = A X(s) + B U(s) + B M Y(s) [1] ## -## Y(s) = C X(s) + D U(s) + D M Y(s) [2] +## Y(s) = C X(s) + D U(s) + D M Y(s) [2] ## ## solve [2] for Y(s) ## Y(s) = [I - D M]^(-1) C X(s) + [I - D M]^(-1) D U(s) @@ -47,41 +47,40 @@ ## Y(s) = Z C X(s) + Z D U(s) [3] ## ## insert [3] in [1], solve for X(s) -## X(s) = [s I - (A + B M Z C)]^(-1) (B + B M Z D) U(s) [4] +## X(s) = [s E - (A + B M Z C)]^(-1) (B + B M Z D) U(s) [4] ## ## inserting [4] in [3] finally yields -## Y(s) = Z C [s I - (A + B M Z C)]^(-1) (B + B M Z D) U(s) + Z D U(s) -## \ / \_____ _____/ \_____ _____/ \ / -## H F G J +## Y(s) = Z C [s E - (A + B M Z C)]^(-1) (B + B M Z D) U(s) + Z D U(s) +## \ / | \_____ _____/ \_____ _____/ \ / +## H K F G J ## @end group ## @end example ## @end deftypefn ## Author: Lukas Reichlin ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 -function sys = __sys_connect__ (sys, M) +function sys = __sys_connect__ (sys, m) - [p, m] = size (sys); + a = sys.a; + b = sys.b; + c = sys.c; + d = sys.d; - A = sys.a; - B = sys.b; - C = sys.c; - D = sys.d; + z = eye (rows (d)) - d*m; - I = eye (p); - Z = I - D*M; - - if (rcond (Z) < eps) # check for singularity - error ("ss: sys_connect: (I - D*M) not invertible"); + if (rcond (z) < eps) # check for singularity + error ("ss: sys_connect: (I - D*M) singular"); endif - Z = inv (Z); + z = inv (z); - sys.a = A + B*M*Z*C; # F - sys.b = B + B*M*Z*D; # G - sys.c = Z*C; # H - sys.d = Z*D; # J + sys.a = a + b*m*z*c; # F + sys.b = b + b*m*z*d; # G + sys.c = z*c; # H + sys.d = z*d; # J + ## sys.e remains constant: [] for ss models, e for dss models + endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__sys_group__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys_group__.m 2010-09-17 12:18:32 UTC (rev 7743) +++ trunk/octave-forge/main/control/inst/@ss/__sys_group__.m 2010-09-17 13:34:24 UTC (rev 7744) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -22,7 +22,7 @@ ## Author: Lukas Reichlin ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 function retsys = __sys_group__ (sys1, sys2) @@ -38,39 +38,33 @@ retsys.lti = __lti_group__ (sys1.lti, sys2.lti); - A1 = sys1.a; - B1 = sys1.b; - C1 = sys1.c; - D1 = sys1.d; - A2 = sys2.a; - B2 = sys2.b; - C2 = sys2.c; - D2 = sys2.d; + n1 = rows (sys1.a); + n2 = rows (sys2.a); - [m1, n1, p1] = __ss_dim__ (A1, B1, C1, D1); - [m2, n2, p2] = __ss_dim__ (A2, B2, C2, D2); + [p1, m1] = size (sys1.d); + [p2, m2] = size (sys2.d); - A12 = zeros (n1, n2); - B12 = zeros (n1, m2); - B21 = zeros (n2, m1); - C12 = zeros (p1, n2); - C21 = zeros (p2, n1); - D12 = zeros (p1, m2); - D21 = zeros (p2, m1); + retsys.a = [sys1.a, zeros(n1,n2); zeros(n2,n1), sys2.a]; - retsys.a = [A1 , A12; - A12.', A2 ]; + retsys.b = [sys1.b, zeros(n1,m2); zeros(n2,m1), sys2.b]; - retsys.b = [B1 , B12; - B21, B2 ]; + retsys.c = [sys1.c, zeros(p1,n2); zeros(p2,n1), sys2.c]; - retsys.c = [C1 , C12; - C21, C2 ]; + retsys.d = [sys1.d, zeros(p1,m2); zeros(p2,m1), sys2.d]; - retsys.d = [D1 , D12; - D21, D2 ]; + e1 = ! isempty (sys1.e); + e2 = ! isempty (sys2.e); - retsys.stname = [sys1.stname; - sys2.stname]; + if (e1 || e2) + if (e1 && e2) + retsys.e = [sys1.e, zeros(n1,n2); zeros(n2,n1), sys2.e]; + elseif (e1) + retsys.e = [sys1.e, zeros(n1,n2); zeros(n2,n1), eye(n2)]; + else + retsys.e = [eye(n1), zeros(n1,n2); zeros(n2,n1), sys2.e]; + endif + endif + retsys.stname = [sys1.stname; sys2.stname]; + endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/__sys_prune__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__sys_prune__.m 2010-09-17 12:18:32 UTC (rev 7743) +++ trunk/octave-forge/main/control/inst/@ss/__sys_prune__.m 2010-09-17 13:34:24 UTC (rev 7744) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -22,7 +22,7 @@ ## Author: Lukas Reichlin ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 function sys = __sys_prune__ (sys, out_idx, in_idx, st_idx = ":") @@ -33,6 +33,10 @@ sys.c = sys.c(out_idx, st_idx); sys.d = sys.d(out_idx, in_idx); + if (! isempty (sys.e)) + sys.e = sys.e(st_idx, st_idx); + endif + sys.stname = sys.stname(st_idx); 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. ```
 [Octave-cvsupdate] SF.net SVN: octave:[8213] trunk/octave-forge/main/control/inst/@ss From: - 2011-04-15 00:41:52 ```Revision: 8213 http://octave.svn.sourceforge.net/octave/?rev=8213&view=rev Author: paramaniac Date: 2011-04-15 00:41:45 +0000 (Fri, 15 Apr 2011) Log Message: ----------- control: add property "scaled" to state-space models Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/__get__.m trunk/octave-forge/main/control/inst/@ss/__property_names__.m trunk/octave-forge/main/control/inst/@ss/__set__.m trunk/octave-forge/main/control/inst/@ss/ss.m Modified: trunk/octave-forge/main/control/inst/@ss/__get__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__get__.m 2011-04-15 00:12:28 UTC (rev 8212) +++ trunk/octave-forge/main/control/inst/@ss/__get__.m 2011-04-15 00:41:45 UTC (rev 8213) @@ -43,6 +43,9 @@ case {"stname", "statename"} val = sys.stname; + case "scaled" + val = sys.scaled; + otherwise error ("ss: get: invalid property name"); Modified: trunk/octave-forge/main/control/inst/@ss/__property_names__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__property_names__.m 2011-04-15 00:12:28 UTC (rev 8212) +++ trunk/octave-forge/main/control/inst/@ss/__property_names__.m 2011-04-15 00:41:45 UTC (rev 8213) @@ -33,7 +33,8 @@ "c"; "d"; "e"; - "stname"}; + "stname"; + "scaled"}; ## cell vector of ss-specific assignable values vals = {"n-by-n matrix (n = number of states)"; @@ -41,7 +42,8 @@ "p-by-n matrix (p = number of outputs)"; "p-by-m matrix"; "n-by-n matrix"; - "n-by-1 cell vector of strings"}; + "n-by-1 cell vector of strings"; + "1-by-1 logical value"}; if (nargin == 1) [ltiprops, ltivals] = __property_names__ (sys.lti); Modified: trunk/octave-forge/main/control/inst/@ss/__set__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__set__.m 2011-04-15 00:12:28 UTC (rev 8212) +++ trunk/octave-forge/main/control/inst/@ss/__set__.m 2011-04-15 00:41:45 UTC (rev 8213) @@ -53,6 +53,14 @@ n = rows (sys.a); sys.stname = __adjust_labels__ (val, n); + case "scaled" + if (isscalar (val)) + sys.scaled = logical (val); + warning ("ss: set: property ""scaled"" has no influence yet"); + else + error ("ss: set: property ""scaled"" must be a logical value"); + endif + otherwise error ("ss: set: invalid property name"); Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2011-04-15 00:12:28 UTC (rev 8212) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2011-04-15 00:41:45 UTC (rev 8213) @@ -135,7 +135,8 @@ ssdata = struct ("a", a, "b", b, "c", c, "d", d, "e", [], - "stname", {stname}); + "stname", {stname}, + "scaled", false); ltisys = lti (p, m, tsam); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ```
 [Octave-cvsupdate] SF.net SVN: octave:[8498] trunk/octave-forge/main/control/inst/@ss From: - 2011-09-05 17:36:54 ```Revision: 8498 http://octave.svn.sourceforge.net/octave/?rev=8498&view=rev Author: paramaniac Date: 2011-09-05 17:36:47 +0000 (Mon, 05 Sep 2011) Log Message: ----------- control: add "zoh" option to d2c (matrix logarithm) Modified Paths: -------------- trunk/octave-forge/main/control/inst/@ss/__c2d__.m trunk/octave-forge/main/control/inst/@ss/__d2c__.m Modified: trunk/octave-forge/main/control/inst/@ss/__c2d__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-05 05:59:21 UTC (rev 8497) +++ trunk/octave-forge/main/control/inst/@ss/__c2d__.m 2011-09-05 17:36:47 UTC (rev 8498) @@ -38,8 +38,10 @@ [sys.a, sys.b, sys.c, sys.d] = slab04md (sys.a, sys.b, sys.c, sys.d, 1, 2/tsam, false); ## TODO: descriptor case + ## TODO: case "prewarp" + otherwise error ("ss: c2d: %s is an invalid or missing method", method); endswitch -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/inst/@ss/__d2c__.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-05 05:59:21 UTC (rev 8497) +++ trunk/octave-forge/main/control/inst/@ss/__d2c__.m 2011-09-05 17:36:47 UTC (rev 8498) @@ -27,17 +27,23 @@ switch (method) case {"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; + if (norm (imag (tmp), inf) > sqrt (eps)) + warning ("ss: d2c: possibly inaccurate results"); + endif + sys.a = real (tmp(1:n, 1:n)); + sys.b = real (tmp(1:n, n+1:n+m)); - error ("ss: d2c: zoh method not implemented yet"); - case {"tustin", "bilin"} [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 + ## TODO: case "prewarp" + otherwise error ("ss: d2c: %s is an invalid or missing method", method); - endswitch -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. ```