|
From: <kk...@us...> - 2011-02-08 22:15:28
|
Revision: 69
http://python-control.svn.sourceforge.net/python-control/?rev=69&view=rev
Author: kkchen
Date: 2011-02-08 22:15:21 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
Fixed hsv output, changed balred inputs to be less redundant (no longer takes 'elimination' argument, method='truncate' instead).
Steven Brunton <sbr...@pr...>
Modified Paths:
--------------
branches/control-0.4a/src/TestModelsimp.py
branches/control-0.4a/src/modelsimp.py
branches/control-0.4a/src/statefbk.py
Modified: branches/control-0.4a/src/TestModelsimp.py
===================================================================
--- branches/control-0.4a/src/TestModelsimp.py 2011-02-08 22:15:17 UTC (rev 68)
+++ branches/control-0.4a/src/TestModelsimp.py 2011-02-08 22:15:21 UTC (rev 69)
@@ -78,7 +78,7 @@
D = np.matrix('0.')
sys = ss(A,B,C,D)
orders = 1
- rsys = balred(sys,orders,'elimination','matchdc')
+ rsys = balred(sys,orders,method='matchdc')
Artrue = np.matrix('-0.566')
Brtrue = np.matrix('-0.414')
Crtrue = np.matrix('-0.5728')
@@ -100,7 +100,7 @@
D = np.matrix('0.')
sys = ss(A,B,C,D)
orders = 2
- rsys = balred(sys,orders,'elimination','truncate')
+ rsys = balred(sys,orders,method='truncate')
Artrue = np.matrix('-1.958, -1.194; -1.194, -0.8344')
Brtrue = np.matrix('0.9057; 0.4068')
Crtrue = np.matrix('0.9057, 0.4068')
Modified: branches/control-0.4a/src/modelsimp.py
===================================================================
--- branches/control-0.4a/src/modelsimp.py 2011-02-08 22:15:17 UTC (rev 68)
+++ branches/control-0.4a/src/modelsimp.py 2011-02-08 22:15:21 UTC (rev 69)
@@ -75,6 +75,8 @@
hsv = np.sqrt(w)
hsv = np.matrix(hsv)
+ hsv = np.sort(hsv)
+ hsv = np.fliplr(hsv)
# Return the Hankel singular values
return hsv
@@ -115,9 +117,9 @@
raise ValueError, "Oops, the system is unstable!"
if method=='matchdc':
- print "matchdc"
+ raise ValueError, "Not supported yet!"
elif method=='truncate':
- print "truncate"
+ raise ValueError, "Not supported yet!"
else:
raise ValueError, "Oops, method is not supported!"
@@ -130,7 +132,7 @@
rsys = 0.
return rsys
-def balred(sys,orders,elimination,method):
+def balred(sys,orders,method='truncate'):
"""Balanced reduced order model of sys of a given order. States are eliminated based on Hankel singular value.
Usage
Modified: branches/control-0.4a/src/statefbk.py
===================================================================
--- branches/control-0.4a/src/statefbk.py 2011-02-08 22:15:17 UTC (rev 68)
+++ branches/control-0.4a/src/statefbk.py 2011-02-08 22:15:21 UTC (rev 69)
@@ -265,11 +265,9 @@
raise ValueError, "Oops, the system is unstable!"
if type=='c':
- print "controllable"
trana = 'T'
C = -np.dot(sys.B,sys.B.transpose())
elif type=='o':
- print "observable"
trana = 'N'
C = -np.dot(sys.C.transpose(),sys.C)
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|