From: <kk...@us...> - 2011-02-08 22:19:58
|
Revision: 122 http://python-control.svn.sourceforge.net/python-control/?rev=122&view=rev Author: kkchen Date: 2011-02-08 22:19:52 +0000 (Tue, 08 Feb 2011) Log Message: ----------- Modified tb04ad and td04ad function calls to match changes to the slycot wrappers. Lauren Padilla <lpa...@pr...> Modified Paths: -------------- branches/control-0.4a/src/TestConvert.py branches/control-0.4a/src/statesp.py branches/control-0.4a/src/xferfcn.py Modified: branches/control-0.4a/src/TestConvert.py =================================================================== --- branches/control-0.4a/src/TestConvert.py 2011-02-08 22:19:48 UTC (rev 121) +++ branches/control-0.4a/src/TestConvert.py 2011-02-08 22:19:52 UTC (rev 122) @@ -25,13 +25,13 @@ """Set up testing parameters.""" # Number of times to run each of the randomized tests. - self.numTests = 10 #almost guarantees failure + self.numTests = 1 #almost guarantees failure # Maximum number of states to test + 1 self.maxStates = 20 # Maximum number of inputs and outputs to test + 1 self.maxIO = 20 # Set to True to print systems to the output. - self.debug = False + self.debug = True def printSys(self, sys, ind): """Print system to the standard output.""" Modified: branches/control-0.4a/src/statesp.py =================================================================== --- branches/control-0.4a/src/statesp.py 2011-02-08 22:19:48 UTC (rev 121) +++ branches/control-0.4a/src/statesp.py 2011-02-08 22:19:52 UTC (rev 122) @@ -163,6 +163,7 @@ useless = [] # Search for useless states. + tol = 1e-16 for i in range(self.states): if (all(self.A[i, :] == zeros((1, self.states))) and all(self.B[i, :] == zeros((1, self.inputs)))): @@ -473,7 +474,7 @@ is still buggy! Advise converting state space sys back to tf to verify the transformation was correct." #print num #print shape(num) - ssout = td04ad(sys.inputs, sys.outputs, index, den, num) + ssout = td04ad('R',sys.inputs, sys.outputs, index, den, num,tol=1e-8) states = ssout[0] return StateSpace(ssout[1][:states, :states], Modified: branches/control-0.4a/src/xferfcn.py =================================================================== --- branches/control-0.4a/src/xferfcn.py 2011-02-08 22:19:48 UTC (rev 121) +++ branches/control-0.4a/src/xferfcn.py 2011-02-08 22:19:52 UTC (rev 122) @@ -212,6 +212,7 @@ """ # Beware: this is a shallow copy. This should be okay. + tol = 1e-16 data = [self.num, self.den] for p in range(len(data)): for i in range(self.outputs): @@ -219,7 +220,7 @@ # Find the first nontrivial coefficient. nonzero = None for k in range(data[p][i][j].size): - if data[p][i][j][k]: + if (data[p][i][j][k]): nonzero = k break @@ -594,6 +595,8 @@ # Modify the numerators so that they each take the common denominator. num = deepcopy(self.num) + if isinstance(den,float): + den = array([den]) for i in range(self.outputs): for j in range(self.inputs): # The common denominator has leading coefficient 1. Scale out @@ -713,8 +716,8 @@ # buggy! print "Warning: state space to transfer function conversion by tb04ad \ is still buggy!" - tfout = tb04ad(sys.states, sys.inputs, sys.outputs, sys.A, sys.B, sys.C, - sys.D, sys.outputs, sys.outputs, sys.inputs) + tfout = tb04ad('R',sys.states, sys.inputs, sys.outputs, sys.A, sys.B, sys.C, + sys.D,tol1=1e-10) # Preallocate outputs. num = [[[] for j in range(sys.inputs)] for i in range(sys.outputs)] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |