From: Rene v. P. <ren...@gm...> - 2013-06-15 08:09:21
|
On 15 June 2013 05:36, Ryan Krauss <rk...@si...> wrote: > That seems to work, but I am trying to wrap my head around the validity of > it. It seems to rescale the matrices to improve numeric conditioning. If > the relationship between the input and outputs is not affected, do I just > replace my old state-space model with this? > > Yes, no problem. The only thing is that you no longer have your original states; so if you needed those, make sure you send them out in in the C matrix before conditioning. You had a controllable canonical form of your state-space system. From somewhere near order 8 and up, this almost never works out right numerically. It also depends on the (time) scaling of your state variables. If you have a slow system, your 1st derivative is going to be a small number compared to the output state, the 2nd is even smaller, and by the time you get to the 5th or 6th derivative, it is going to be numerically insignificant. Another trick that is sometimes handy is picking another time scale, hours, minutes, whatever it takes to make 1st, 2nd etc derivatives comparable numerically to the signal itself. > -- > Ryan Krauss, Ph.D. > Associate Professor > Mechanical Engineering > Southern Illinois University Edwardsville > > > On Fri, Jun 14, 2013 at 4:16 PM, Rene van Paassen < > ren...@gm...> wrote: > >> How about balancing the matrix first? >> >> Today I made a little fix in tb01id, at https://github.com/repagh/Slycot >> >> I get no errors with the attached modification. Don't know if the result >> is valid, though. >> >> >> On 14 June 2013 19:59, Ryan Krauss <rk...@si...> wrote: >> >>> I assume this is most likely an ill conditioning problem on my part >>> (though I don't know how to fix the model if that is the case, since it is >>> fitting experimental data as well as an infinite dimensional model), but I >>> am getting the following error from control.lqr: >>> >>> /Users/rkrauss/siue/Research/papers/SFLR_2010_paper/CND_ASME_Special_Issue_Version/python/SFLR_ROM_2013/LQG_learn/lqr_problem.py >>> in <module>() >>> 54 >>> 55 #K = control.lqr(ol_sys, Q, 1.0) >>> ---> 56 K, S, E = control.lqr(A, B, Q, 0.01) >>> 57 >>> 58 >>> >>> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/control-0.6d-py2.7.egg/control/statefbk.pyc >>> in lqr(*args, **keywords) >>> 236 >>> 237 # Call the SLICOT function >>> --> 238 X,rcond,w,S,U,A_inv = sb02md(nstates, A_b, G, Q_b, 'C') >>> 239 >>> 240 # Now compute the return value >>> >>> /usr/local/lib/python2.7/site-packages/slycot/synthesis.pyc in sb02md(n, >>> A, G, Q, dico, hinv, uplo, scal, sort, ldwork) >>> 348 e = ValueError('the Hamiltonian or symplectic matrix H >>> has less than n stable eigenvalues') >>> 349 e.info = info >>> --> 350 raise e >>> 351 if info == 5: >>> 352 e = ValueError('if the N-th order system of linear >>> algebraic equations is singular to working precision') >>> >>> ValueError: the Hamiltonian or symplectic matrix H has less than n >>> stable eigenvalues >>> >>> In [5]: run lqr_problem.py >>> >>> --------------------------------------------------------------------------- >>> ValueError Traceback (most recent call >>> last) >>> /usr/local/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in >>> execfile(fname, *where) >>> 176 else: >>> 177 filename = fname >>> --> 178 __builtin__.execfile(filename, *where) >>> >>> /Users/rkrauss/siue/Research/papers/SFLR_2010_paper/CND_ASME_Special_Issue_Version/python/SFLR_ROM_2013/LQG_learn/lqr_problem.py >>> in <module>() >>> 53 Q = dot(Ca.T,Ca) >>> 54 >>> ---> 55 K, S, E = control.lqr(A, B, Q, 1.0) >>> 56 >>> 57 >>> >>> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/control-0.6d-py2.7.egg/control/statefbk.pyc >>> in lqr(*args, **keywords) >>> 236 >>> 237 # Call the SLICOT function >>> --> 238 X,rcond,w,S,U,A_inv = sb02md(nstates, A_b, G, Q_b, 'C') >>> 239 >>> 240 # Now compute the return value >>> >>> /usr/local/lib/python2.7/site-packages/slycot/synthesis.pyc in sb02md(n, >>> A, G, Q, dico, hinv, uplo, scal, sort, ldwork) >>> 348 e = ValueError('the Hamiltonian or symplectic matrix H >>> has less than n stable eigenvalues') >>> 349 e.info = info >>> --> 350 raise e >>> 351 if info == 5: >>> 352 e = ValueError('if the N-th order system of linear >>> algebraic equations is singular to working precision') >>> >>> ValueError: the Hamiltonian or symplectic matrix H has less than n >>> stable eigenvalues >>> >>> -- >>> Ryan Krauss, Ph.D. >>> Associate Professor >>> Mechanical Engineering >>> Southern Illinois University Edwardsville >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by Windows: >>> >>> Build for Windows Store. >>> >>> http://p.sf.net/sfu/windows-dev2dev >>> _______________________________________________ >>> python-control-discuss mailing list >>> pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/python-control-discuss >>> >>> >> >> >> -- >> René van Paassen | ______o____/_| Ren...@gm... >> <[___\_\_-----< t: +31 15 2628685 >> | o' mobile: +31 6 39846891 >> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev >> >> _______________________________________________ >> python-control-discuss mailing list >> pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-control-discuss >> >> > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > python-control-discuss mailing list > pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-control-discuss > > -- René van Paassen | ______o____/_| Ren...@gm... <[___\_\_-----< t: +31 15 2628685 | o' mobile: +31 6 39846891 |