|
From: <kk...@us...> - 2011-02-08 22:18:20
|
Revision: 103
http://python-control.svn.sourceforge.net/python-control/?rev=103&view=rev
Author: kkchen
Date: 2011-02-08 22:18:14 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
Changed gram back to not needed 'deepcopy' now that slycot sb03md is fixed. Also added a unittest to check that an exception is raised when gram is give something other than StateSpace object.
Lauren Padilla <lpa...@pr...>
Modified Paths:
--------------
branches/control-0.4a/doc/Makefile
branches/control-0.4a/src/TestStatefbk.py
branches/control-0.4a/src/statefbk.py
Modified: branches/control-0.4a/doc/Makefile
===================================================================
--- branches/control-0.4a/doc/Makefile 2011-02-08 22:18:08 UTC (rev 102)
+++ branches/control-0.4a/doc/Makefile 2011-02-08 22:18:14 UTC (rev 103)
@@ -3,7 +3,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
-SPHINXBUILD = /Users/steve/CODES/Sphinx-1.0.6/sphinx-build.py
+SPHINXBUILD = /Applications/Sphinx-1.0.6/sphinx-build.py
PAPER =
BUILDDIR = _build
Modified: branches/control-0.4a/src/TestStatefbk.py
===================================================================
--- branches/control-0.4a/src/TestStatefbk.py 2011-02-08 22:18:08 UTC (rev 102)
+++ branches/control-0.4a/src/TestStatefbk.py 2011-02-08 22:18:14 UTC (rev 103)
@@ -73,6 +73,12 @@
Wo = gram(sys,'o')
np.testing.assert_array_almost_equal(Wo, Wotrue)
+ def testGramsys(self):
+ num =[1.]
+ den = [1., 1., 1.]
+ sys = tf(num,den)
+ self.assertRaises(ValueError, gram, sys, 'o')
+ self.assertRaises(ValueError, gram, sys, 'c')
if __name__ == '__main__':
unittest.main()
Modified: branches/control-0.4a/src/statefbk.py
===================================================================
--- branches/control-0.4a/src/statefbk.py 2011-02-08 22:18:08 UTC (rev 102)
+++ branches/control-0.4a/src/statefbk.py 2011-02-08 22:18:14 UTC (rev 103)
@@ -43,6 +43,7 @@
import numpy as np
import ctrlutil
from exception import *
+import statesp
# Pole placement
def place(A, B, p):
@@ -255,6 +256,7 @@
Raises
------
ValueError
+ if system is not instance of StateSpace class
if `type` is not 'c' or 'o'
if system is unstable (sys.A has eigenvalues not in left half plane)
ImportError
@@ -267,10 +269,10 @@
"""
- from copy import deepcopy
-
- #Check for ss system object, need a utility for this?
-
+ #Check for ss system object
+ if not isinstance(sys,statesp.StateSpace):
+ raise ValueError, "System must be StateSpace!"
+
#TODO: Check for continous or discrete, only continuous supported right now
# if isCont():
# dico = 'C'
@@ -302,7 +304,7 @@
raise ControlSlycot("can't find slycot module 'sb03md'")
n = sys.states
U = np.zeros((n,n))
- A = deepcopy(sys.A)
+ A = sys.A
out = sb03md(n, C, A, U, dico, 'X', 'N', trana)
gram = out[0]
return gram
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|