I had a question about how to get python-control library up and running. I'm a mechanical engineering student studying controls and I would love to be able to do my work in python so I don't have to buy matlab.
Problem
I can't get the control library to import and compile in my script but I can import the library when in terminal but certain commands don't work properly.
import control as cnt
sys = cnt.tf([1,5],[1,3,2,0])
When I run python through the terminal I can import the library just fine, but the rlocus command doesn't return a plot.
A python application starts up but doesn't have any windows.
I'm on Mac Yosemite, installed python-control via pip, and I've ran the setup.py test, results below:
Test Output
Matthews-MBP:control-0.7.0 Marek$ python setup.py test
running test
running egg_info
writing requirements to control.egg-info/requires.txt
writing control.egg-info/PKG-INFO
writing top-level names to control.egg-info/top_level.txt
writing dependency_links to control.egg-info/dependency_links.txt
reading manifest file 'control.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'tests/*.py'
writing manifest file 'control.egg-info/SOURCES.txt'
running build_ext
testSSSS1 (control.tests.bdalg_test.TestFeedback)
State space system with state space feedback block. ... ok
testSSSS2 (control.tests.bdalg_test.TestFeedback)
State space system with state space feedback block, including a ... ok
testSSScalar (control.tests.bdalg_test.TestFeedback)
State space system with scalar feedback block. ... ok
testSSTF (control.tests.bdalg_test.TestFeedback)
State space system with transfer function feedback block. ... ok
testScalarSS (control.tests.bdalg_test.TestFeedback)
Scalar system with state space feedback block. ... ok
testScalarScalar (control.tests.bdalg_test.TestFeedback)
Scalar system with scalar feedback block. ... ok
testScalarTF (control.tests.bdalg_test.TestFeedback)
Scalar system with transfer function feedback block. ... ok
testTFSS (control.tests.bdalg_test.TestFeedback)
Transfer function system with state space feedback block. ... ok
testTFScalar (control.tests.bdalg_test.TestFeedback)
Transfer function system with scalar feedback block. ... ok
testTFTF (control.tests.bdalg_test.TestFeedback)
Transfer function system with transfer function feedback block. ... ok
testConvert (control.tests.convert_test.TestConvert)
Test state space to transfer function conversion. ... ok
testAddition (control.tests.discrete_test.TestDiscrete) ... ok
testCopyConstructor (control.tests.discrete_test.TestDiscrete) ... ok
testFeedback (control.tests.discrete_test.TestDiscrete) ... ok
testMultiplication (control.tests.discrete_test.TestDiscrete) ... ok
testSimulation (control.tests.discrete_test.TestDiscrete) ... ok
testSystemInitialization (control.tests.discrete_test.TestDiscrete) ... ok
testTimebaseEqual (control.tests.discrete_test.TestDiscrete) ... ok
test_discrete_bode (control.tests.discrete_test.TestDiscrete) ... ok
test_sample_ss (control.tests.discrete_test.TestDiscrete) ... ok
test_sample_system (control.tests.discrete_test.TestDiscrete) ... ok
test_sample_tf (control.tests.discrete_test.TestDiscrete) ... ok
test_timebase (control.tests.discrete_test.TestDiscrete) ... ok
testisctime (control.tests.discrete_test.TestDiscrete) ... ok
testisdtime (control.tests.discrete_test.TestDiscrete) ... ok
testAgainstOctave (control.tests.frd_test.TestFRD) ... ok
testAuto (control.tests.frd_test.TestFRD) ... ok
testBadInputType (control.tests.frd_test.TestFRD)
Give the constructor invalid input types. ... ok
testFeedback (control.tests.frd_test.TestFRD) ... ok
testFeedback2 (control.tests.frd_test.TestFRD) ... ok
testInconsistentDimension (control.tests.frd_test.TestFRD) ... ok
testMIMO (control.tests.frd_test.TestFRD) ... ok
testMIMOMult (control.tests.frd_test.TestFRD) ... ok
testMIMOSmooth (control.tests.frd_test.TestFRD) ... ok
testMIMOfb (control.tests.frd_test.TestFRD) ... ok
testMIMOfb2 (control.tests.frd_test.TestFRD) ... ok
testNyquist (control.tests.frd_test.TestFRD) ... ok
testOperators (control.tests.frd_test.TestFRD) ... ok
testOperatorsTf (control.tests.frd_test.TestFRD) ... ok
testSISOtf (control.tests.frd_test.TestFRD) ... ok
testbdalg (control.tests.frd_test.TestFRD) ... ok
test_phase_crossover_frequencies (control.tests.margin_test.TestMargin) ... ok
test_stability_margins (control.tests.margin_test.TestMargin) ... ok
test_care (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_care_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dare (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dare_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dlyap (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dlyap_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dlyap_sylvester (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_lyap (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_lyap_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_lyap_sylvester (control.tests.mateqn_test.TestMatrixEquations) ... ok
testBalred (control.tests.matlab_test.TestMatlab) ... ok
testBode (control.tests.matlab_test.TestMatlab) ... ok
testCombi01 (control.tests.matlab_test.TestMatlab) ... SKIP: need to update margin command
testConnect (control.tests.matlab_test.TestMatlab) ... ok
testConnect2 (control.tests.matlab_test.TestMatlab) ... ok
testCtrb (control.tests.matlab_test.TestMatlab) ... ok
testDamp (control.tests.matlab_test.TestMatlab) ... ok
testDcgain (control.tests.matlab_test.TestMatlab) ... ok
testDrss (control.tests.matlab_test.TestMatlab) ... ok
testEvalfr (control.tests.matlab_test.TestMatlab) ... ok
testFRD (control.tests.matlab_test.TestMatlab) ... ok
testFeedback (control.tests.matlab_test.TestMatlab) ... ok
testFreqresp (control.tests.matlab_test.TestMatlab) ... ok
testGram (control.tests.matlab_test.TestMatlab) ... ok
testHsvd (control.tests.matlab_test.TestMatlab) ... ok
testImpulse (control.tests.matlab_test.TestMatlab) ... ok
testInitial (control.tests.matlab_test.TestMatlab) ... ok
testLQR (control.tests.matlab_test.TestMatlab) ... ok
testLsim (control.tests.matlab_test.TestMatlab) ... ok
testMIMOssdata (control.tests.matlab_test.TestMatlab) ... ok
testMargin (control.tests.matlab_test.TestMatlab) ... ok
testMinreal (control.tests.matlab_test.TestMatlab)
Test a minreal model reduction ... ok
testModred (control.tests.matlab_test.TestMatlab) ... ok
testNichols (control.tests.matlab_test.TestMatlab) ... ok
testNyquist (control.tests.matlab_test.TestMatlab) ... ok
testObsv (control.tests.matlab_test.TestMatlab) ... ok
testOpers (control.tests.matlab_test.TestMatlab) ... ok
testPZmap (control.tests.matlab_test.TestMatlab) ... /usr/local/lib/python2.7/site-packages/numpy/ma/core.py:3895: UserWarning: Warning: converting a masked element to nan.
warnings.warn("Warning: converting a masked element to nan.")
ok
testPade (control.tests.matlab_test.TestMatlab) ... ok
testParallel (control.tests.matlab_test.TestMatlab) ... ok
testPlace (control.tests.matlab_test.TestMatlab) ... ok
testPoleZero (control.tests.matlab_test.TestMatlab) ... ok
testRlocus (control.tests.matlab_test.TestMatlab) ... ok
testRss (control.tests.matlab_test.TestMatlab) ... ok
testSISOssdata (control.tests.matlab_test.TestMatlab) ... ok
testSISOtfdata (control.tests.matlab_test.TestMatlab) ... ok
testSS2cont (control.tests.matlab_test.TestMatlab) ... ok
testSeries (control.tests.matlab_test.TestMatlab) ... ok
testStep (control.tests.matlab_test.TestMatlab) ... ok
testUnwrap (control.tests.matlab_test.TestMatlab) ... ok
control.tests.matlab_test.test_suite ... ok
testMinrealBrute (control.tests.minreal_test.TestMinreal) ... ok
testMinrealSS (control.tests.minreal_test.TestMinreal)
Test a minreal model reduction ... ok
testMinrealtf (control.tests.minreal_test.TestMinreal)
Try the minreal function, and also test easy entry by creation ... ok
testBalredTruncate (control.tests.modelsimp_test.TestModelsimp) ... ok
testHSVD (control.tests.modelsimp_test.TestModelsimp) ... ok
testMarkov (control.tests.modelsimp_test.TestModelsimp) ... ok
testModredMatchDC (control.tests.modelsimp_test.TestModelsimp) ... ok
testModredTruncate (control.tests.modelsimp_test.TestModelsimp) ... ok
testNgrid (control.tests.nichols_test.TestStateSpace)
Generate a Nichols plot. ... ok
testNicholsPlain (control.tests.nichols_test.TestStateSpace)
Generate a Nichols plot. ... ok
testInvPendAuto (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendLogtime (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendNoSims (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendSims (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendTimePoints (control.tests.phaseplot_test.TestPhasePlot) ... ok
testOscillatorParams (control.tests.phaseplot_test.TestPhasePlot) ... ok
testRootLocus (control.tests.rlocus_test.TestRootLocus)
Basic root locus plot ... ok
test_without_gains (control.tests.rlocus_test.TestRootLocus) ... ok
control.tests.rlocus_test.test_suite ... ok
testFreqResp (control.tests.slycot_convert_test.TestSlycot)
Compare the bode reponses of the SS systems and TF systems to the original SS ... ok
testTF (control.tests.slycot_convert_test.TestSlycot)
Directly tests the functions tb04ad and td04ad through direct ... ok
testAcker (control.tests.statefbk_test.TestStatefbk) ... ok
testCtrbMIMO (control.tests.statefbk_test.TestStatefbk) ... ok
testCtrbObsvDuality (control.tests.statefbk_test.TestStatefbk) ... ok
testCtrbSISO (control.tests.statefbk_test.TestStatefbk) ... ok
testGramWc (control.tests.statefbk_test.TestStatefbk) ... ok
testGramWo (control.tests.statefbk_test.TestStatefbk) ... ok
testGramWo2 (control.tests.statefbk_test.TestStatefbk) ... ok
testGramsys (control.tests.statefbk_test.TestStatefbk) ... ok
testObsvMIMO (control.tests.statefbk_test.TestStatefbk) ... ok
testObsvSISO (control.tests.statefbk_test.TestStatefbk) ... ok
test_LQR_3args (control.tests.statefbk_test.TestStatefbk) ... ok
test_LQR_integrator (control.tests.statefbk_test.TestStatefbk) ... ok
control.tests.statefbk_test.test_suite ... ok
testPole (control.tests.statesp_test.TestDrss)
Test that the poles of drss outputs have less than unit magnitude. ... ok
testShape (control.tests.statesp_test.TestDrss)
Test that drss outputs have the right state, input, and output ... ok
testPole (control.tests.statesp_test.TestRss)
Test that the poles of rss outputs have a negative real part. ... ok
testShape (control.tests.statesp_test.TestRss)
Test that rss outputs have the right state, input, and output ... ok
testAdd (control.tests.statesp_test.TestStateSpace)
Add two MIMO systems. ... ok
testAppendSS (control.tests.statesp_test.TestStateSpace)
Test appending two state-space systems ... ok
testAppendTF (control.tests.statesp_test.TestStateSpace)
Test appending a state-space system with a tf ... ok
testArrayAccessSS (control.tests.statesp_test.TestStateSpace) ... ok
testEvalFr (control.tests.statesp_test.TestStateSpace)
Evaluate the frequency response at one frequency. ... ok
testFreqResp (control.tests.statesp_test.TestStateSpace)
Evaluate the frequency response at multiple frequencies. ... ok
testMinreal (control.tests.statesp_test.TestStateSpace)
Test a minreal model reduction ... ok
testMul (control.tests.statesp_test.TestStateSpace)
Multiply two MIMO systems. ... ok
testPole (control.tests.statesp_test.TestStateSpace)
Evaluate the poles of a MIMO system. ... ok
testSub (control.tests.statesp_test.TestStateSpace)
Subtract two MIMO systems. ... ok
testZero (control.tests.statesp_test.TestStateSpace)
Evaluate the zeros of a SISO system. ... ok
test_check_convert_shape (control.tests.test_control_matlab.TestControlMatlab) ... SKIP: skipping test_check_convert_shape, need to update test
test_convert_MIMO_to_SISO (control.tests.test_control_matlab.TestControlMatlab)
Convert mimo to siso systems ... ok
test_dcgain (control.tests.test_control_matlab.TestControlMatlab)
Test function dcgain with different systems ... ok
test_dcgain_2 (control.tests.test_control_matlab.TestControlMatlab)
Test function dcgain with different systems ... ok
test_impulse (control.tests.test_control_matlab.TestControlMatlab) ... ok
test_initial (control.tests.test_control_matlab.TestControlMatlab) ... ok
test_lsim (control.tests.test_control_matlab.TestControlMatlab) ... SKIP: skipping test_lsim, need to update test
test_step (control.tests.test_control_matlab.TestControlMatlab)
Test function step. ... ok
test_forced_response (control.tests.timeresp_test.TestTimeresp) ... ok
test_impulse_response (control.tests.timeresp_test.TestTimeresp) ... ok
test_initial_response (control.tests.timeresp_test.TestTimeresp) ... ok
test_initial_response_no_trim (control.tests.timeresp_test.TestTimeresp) ... ok
test_lsim_double_integrator (control.tests.timeresp_test.TestTimeresp) ... ok
test_step_response (control.tests.timeresp_test.TestTimeresp) ... ok
testAddInconsistentDimension (control.tests.xferfcn_test.TestXferFcn)
Add two transfer function matrices of different sizes. ... ok
testAddMIMO (control.tests.xferfcn_test.TestXferFcn)
Add two MIMO systems. ... ok
testAddSISO (control.tests.xferfcn_test.TestXferFcn)
Add two SISO systems. ... ok
testAddScalar (control.tests.xferfcn_test.TestXferFcn)
Add two direct feedthrough systems. ... ok
testBadInputType (control.tests.xferfcn_test.TestXferFcn)
Give the constructor invalid input types. ... ok
testConvertToTransferFunction (control.tests.xferfcn_test.TestXferFcn)
Test for correct state space to transfer function conversion. ... ok
testDivSISO (control.tests.xferfcn_test.TestXferFcn)
Divide two SISO systems. ... ok
testDivScalar (control.tests.xferfcn_test.TestXferFcn)
Divide two direct feedthrough systems. ... ok
testEvalFrMIMO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the frequency response of a MIMO system at one frequency. ... ok
testEvalFrSISO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the frequency response of a SISO system at one frequency. ... ok
testFeedbackSISO (control.tests.xferfcn_test.TestXferFcn)
Test for correct SISO transfer function feedback. ... ok
testFreqRespMIMO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the magnitude and phase of a MIMO system at multiple ... SKIP: skipping, known issue with Python 3
testFreqRespSISO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the magnitude and phase of a SISO system at multiple ... ok
testInconsistentColumns (control.tests.xferfcn_test.TestXferFcn)
Give the constructor inputs that do not have the same number of ... ok
testInconsistentDimension (control.tests.xferfcn_test.TestXferFcn)
Give the constructor a numerator and denominator of different ... ok
testMIMO (control.tests.xferfcn_test.TestXferFcn)
Test conversion of a single input, two-output state-space ... ok
testMatrixMult (control.tests.xferfcn_test.TestXferFcn)
MIMO transfer functions should be multiplyable by constant ... ok
testMinreal (control.tests.xferfcn_test.TestXferFcn)
Try the minreal function, and also test easy entry by creation ... ok
testMinreal2 (control.tests.xferfcn_test.TestXferFcn)
This one gave a problem, due to poly([]) giving simply 1 ... ok
testMulInconsistentDimension (control.tests.xferfcn_test.TestXferFcn)
Multiply two transfer function matrices of incompatible sizes. ... ok
testMulMIMO (control.tests.xferfcn_test.TestXferFcn)
Multiply two MIMO systems. ... ok
testMulSISO (control.tests.xferfcn_test.TestXferFcn)
Multiply two SISO systems. ... ok
testMulScalar (control.tests.xferfcn_test.TestXferFcn)
Multiply two direct feedthrough systems. ... ok
testNegMIMO (control.tests.xferfcn_test.TestXferFcn)
Negate a MIMO system. ... ok
testNegSISO (control.tests.xferfcn_test.TestXferFcn)
Negate a SISO system. ... ok
testNegScalar (control.tests.xferfcn_test.TestXferFcn)
Negate a direct feedthrough system. ... SKIP: skipping, known issue with Python 3
testPoleMIMO (control.tests.xferfcn_test.TestXferFcn)
Test for correct MIMO poles. ... ok
testSubMIMO (control.tests.xferfcn_test.TestXferFcn)
Add two MIMO systems. ... ok
testSubSISO (control.tests.xferfcn_test.TestXferFcn)
Add two SISO systems. ... ok
testSubScalar (control.tests.xferfcn_test.TestXferFcn)
Add two direct feedthrough systems. ... ok
testTruncateCoeff1 (control.tests.xferfcn_test.TestXferFcn)
Remove extraneous zeros in polynomial representations. ... ok
testTruncateCoeff2 (control.tests.xferfcn_test.TestXferFcn)
Remove extraneous zeros in polynomial representations. ... ok
testZeroDenominator (control.tests.xferfcn_test.TestXferFcn)
Give the constructor a transfer function with a zero denominator. ... ok
Ran 190 tests in 5.609s
OK (skipped=5)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a question about how to get python-control library up and running. I'm a mechanical engineering student studying controls and I would love to be able to do my work in python so I don't have to buy matlab.
Problem
I can't get the control library to import and compile in my script but I can import the library when in terminal but certain commands don't work properly.
import control as cnt
sys = cnt.tf([1,5],[1,3,2,0])
When I run python through the terminal I can import the library just fine, but the rlocus command doesn't return a plot.
import control as cnt
sys = cnt.tf([1,5],[1,3,2,0])
cnt.rlocus(sys)
Try adding
importmatplotlib.pyplotaspltplt.show()
after cnt.rlocus(sys).
~Scott
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not sure why things are not working in the script. Is the python-control package installed in the system directory (this would be the default, but usually requires root priviledge) or in your user directory? Perhaps there is something in that path that works differently in command line versus interactive mode?
In terms of running things interactively, you need to run python in a way that supports graphical output. The easiest way to do that is to use 'ipython -pylab' rather than just 'python'. ipython is an interactive version of python and the -pylab option tells it to load up the right graphics packages (mainly matplotlib, I think). I ran the commands you listed and got the attached (graphical) output.
Using Ipython I am able to generate the Root locus plots. Yay!
Found out what my issue was: The filename I used for testing out the library was titled 'control.py'. so "import control as cnt" was simply importing the file into itself...
The script will compile now but won't display a graph but that shouldn't be to hard to figure out.
Thanks again for your response and for writing this sweet library.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey,
I had a question about how to get python-control library up and running. I'm a mechanical engineering student studying controls and I would love to be able to do my work in python so I don't have to buy matlab.
Problem
I can't get the control library to import and compile in my script but I can import the library when in terminal but certain commands don't work properly.
import control as cnt
sys = cnt.tf([1,5],[1,3,2,0])
When I run python through the terminal I can import the library just fine, but the rlocus command doesn't return a plot.
A python application starts up but doesn't have any windows.
I'm on Mac Yosemite, installed python-control via pip, and I've ran the setup.py test, results below:
Test Output
Matthews-MBP:control-0.7.0 Marek$ python setup.py test
running test
running egg_info
writing requirements to control.egg-info/requires.txt
writing control.egg-info/PKG-INFO
writing top-level names to control.egg-info/top_level.txt
writing dependency_links to control.egg-info/dependency_links.txt
reading manifest file 'control.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'tests/*.py'
writing manifest file 'control.egg-info/SOURCES.txt'
running build_ext
testSSSS1 (control.tests.bdalg_test.TestFeedback)
State space system with state space feedback block. ... ok
testSSSS2 (control.tests.bdalg_test.TestFeedback)
State space system with state space feedback block, including a ... ok
testSSScalar (control.tests.bdalg_test.TestFeedback)
State space system with scalar feedback block. ... ok
testSSTF (control.tests.bdalg_test.TestFeedback)
State space system with transfer function feedback block. ... ok
testScalarSS (control.tests.bdalg_test.TestFeedback)
Scalar system with state space feedback block. ... ok
testScalarScalar (control.tests.bdalg_test.TestFeedback)
Scalar system with scalar feedback block. ... ok
testScalarTF (control.tests.bdalg_test.TestFeedback)
Scalar system with transfer function feedback block. ... ok
testTFSS (control.tests.bdalg_test.TestFeedback)
Transfer function system with state space feedback block. ... ok
testTFScalar (control.tests.bdalg_test.TestFeedback)
Transfer function system with scalar feedback block. ... ok
testTFTF (control.tests.bdalg_test.TestFeedback)
Transfer function system with transfer function feedback block. ... ok
testConvert (control.tests.convert_test.TestConvert)
Test state space to transfer function conversion. ... ok
testAddition (control.tests.discrete_test.TestDiscrete) ... ok
testCopyConstructor (control.tests.discrete_test.TestDiscrete) ... ok
testFeedback (control.tests.discrete_test.TestDiscrete) ... ok
testMultiplication (control.tests.discrete_test.TestDiscrete) ... ok
testSimulation (control.tests.discrete_test.TestDiscrete) ... ok
testSystemInitialization (control.tests.discrete_test.TestDiscrete) ... ok
testTimebaseEqual (control.tests.discrete_test.TestDiscrete) ... ok
test_discrete_bode (control.tests.discrete_test.TestDiscrete) ... ok
test_sample_ss (control.tests.discrete_test.TestDiscrete) ... ok
test_sample_system (control.tests.discrete_test.TestDiscrete) ... ok
test_sample_tf (control.tests.discrete_test.TestDiscrete) ... ok
test_timebase (control.tests.discrete_test.TestDiscrete) ... ok
testisctime (control.tests.discrete_test.TestDiscrete) ... ok
testisdtime (control.tests.discrete_test.TestDiscrete) ... ok
testAgainstOctave (control.tests.frd_test.TestFRD) ... ok
testAuto (control.tests.frd_test.TestFRD) ... ok
testBadInputType (control.tests.frd_test.TestFRD)
Give the constructor invalid input types. ... ok
testFeedback (control.tests.frd_test.TestFRD) ... ok
testFeedback2 (control.tests.frd_test.TestFRD) ... ok
testInconsistentDimension (control.tests.frd_test.TestFRD) ... ok
testMIMO (control.tests.frd_test.TestFRD) ... ok
testMIMOMult (control.tests.frd_test.TestFRD) ... ok
testMIMOSmooth (control.tests.frd_test.TestFRD) ... ok
testMIMOfb (control.tests.frd_test.TestFRD) ... ok
testMIMOfb2 (control.tests.frd_test.TestFRD) ... ok
testNyquist (control.tests.frd_test.TestFRD) ... ok
testOperators (control.tests.frd_test.TestFRD) ... ok
testOperatorsTf (control.tests.frd_test.TestFRD) ... ok
testSISOtf (control.tests.frd_test.TestFRD) ... ok
testbdalg (control.tests.frd_test.TestFRD) ... ok
test_phase_crossover_frequencies (control.tests.margin_test.TestMargin) ... ok
test_stability_margins (control.tests.margin_test.TestMargin) ... ok
test_care (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_care_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dare (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dare_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dlyap (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dlyap_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_dlyap_sylvester (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_lyap (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_lyap_g (control.tests.mateqn_test.TestMatrixEquations) ... ok
test_lyap_sylvester (control.tests.mateqn_test.TestMatrixEquations) ... ok
testBalred (control.tests.matlab_test.TestMatlab) ... ok
testBode (control.tests.matlab_test.TestMatlab) ... ok
testCombi01 (control.tests.matlab_test.TestMatlab) ... SKIP: need to update margin command
testConnect (control.tests.matlab_test.TestMatlab) ... ok
testConnect2 (control.tests.matlab_test.TestMatlab) ... ok
testCtrb (control.tests.matlab_test.TestMatlab) ... ok
testDamp (control.tests.matlab_test.TestMatlab) ... ok
testDcgain (control.tests.matlab_test.TestMatlab) ... ok
testDrss (control.tests.matlab_test.TestMatlab) ... ok
testEvalfr (control.tests.matlab_test.TestMatlab) ... ok
testFRD (control.tests.matlab_test.TestMatlab) ... ok
testFeedback (control.tests.matlab_test.TestMatlab) ... ok
testFreqresp (control.tests.matlab_test.TestMatlab) ... ok
testGram (control.tests.matlab_test.TestMatlab) ... ok
testHsvd (control.tests.matlab_test.TestMatlab) ... ok
testImpulse (control.tests.matlab_test.TestMatlab) ... ok
testInitial (control.tests.matlab_test.TestMatlab) ... ok
testLQR (control.tests.matlab_test.TestMatlab) ... ok
testLsim (control.tests.matlab_test.TestMatlab) ... ok
testMIMOssdata (control.tests.matlab_test.TestMatlab) ... ok
testMargin (control.tests.matlab_test.TestMatlab) ... ok
testMinreal (control.tests.matlab_test.TestMatlab)
Test a minreal model reduction ... ok
testModred (control.tests.matlab_test.TestMatlab) ... ok
testNichols (control.tests.matlab_test.TestMatlab) ... ok
testNyquist (control.tests.matlab_test.TestMatlab) ... ok
testObsv (control.tests.matlab_test.TestMatlab) ... ok
testOpers (control.tests.matlab_test.TestMatlab) ... ok
testPZmap (control.tests.matlab_test.TestMatlab) ... /usr/local/lib/python2.7/site-packages/numpy/ma/core.py:3895: UserWarning: Warning: converting a masked element to nan.
warnings.warn("Warning: converting a masked element to nan.")
ok
testPade (control.tests.matlab_test.TestMatlab) ... ok
testParallel (control.tests.matlab_test.TestMatlab) ... ok
testPlace (control.tests.matlab_test.TestMatlab) ... ok
testPoleZero (control.tests.matlab_test.TestMatlab) ... ok
testRlocus (control.tests.matlab_test.TestMatlab) ... ok
testRss (control.tests.matlab_test.TestMatlab) ... ok
testSISOssdata (control.tests.matlab_test.TestMatlab) ... ok
testSISOtfdata (control.tests.matlab_test.TestMatlab) ... ok
testSS2cont (control.tests.matlab_test.TestMatlab) ... ok
testSeries (control.tests.matlab_test.TestMatlab) ... ok
testStep (control.tests.matlab_test.TestMatlab) ... ok
testUnwrap (control.tests.matlab_test.TestMatlab) ... ok
control.tests.matlab_test.test_suite ... ok
testMinrealBrute (control.tests.minreal_test.TestMinreal) ... ok
testMinrealSS (control.tests.minreal_test.TestMinreal)
Test a minreal model reduction ... ok
testMinrealtf (control.tests.minreal_test.TestMinreal)
Try the minreal function, and also test easy entry by creation ... ok
testBalredTruncate (control.tests.modelsimp_test.TestModelsimp) ... ok
testHSVD (control.tests.modelsimp_test.TestModelsimp) ... ok
testMarkov (control.tests.modelsimp_test.TestModelsimp) ... ok
testModredMatchDC (control.tests.modelsimp_test.TestModelsimp) ... ok
testModredTruncate (control.tests.modelsimp_test.TestModelsimp) ... ok
testNgrid (control.tests.nichols_test.TestStateSpace)
Generate a Nichols plot. ... ok
testNicholsPlain (control.tests.nichols_test.TestStateSpace)
Generate a Nichols plot. ... ok
testInvPendAuto (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendLogtime (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendNoSims (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendSims (control.tests.phaseplot_test.TestPhasePlot) ... ok
testInvPendTimePoints (control.tests.phaseplot_test.TestPhasePlot) ... ok
testOscillatorParams (control.tests.phaseplot_test.TestPhasePlot) ... ok
testRootLocus (control.tests.rlocus_test.TestRootLocus)
Basic root locus plot ... ok
test_without_gains (control.tests.rlocus_test.TestRootLocus) ... ok
control.tests.rlocus_test.test_suite ... ok
testFreqResp (control.tests.slycot_convert_test.TestSlycot)
Compare the bode reponses of the SS systems and TF systems to the original SS ... ok
testTF (control.tests.slycot_convert_test.TestSlycot)
Directly tests the functions tb04ad and td04ad through direct ... ok
testAcker (control.tests.statefbk_test.TestStatefbk) ... ok
testCtrbMIMO (control.tests.statefbk_test.TestStatefbk) ... ok
testCtrbObsvDuality (control.tests.statefbk_test.TestStatefbk) ... ok
testCtrbSISO (control.tests.statefbk_test.TestStatefbk) ... ok
testGramWc (control.tests.statefbk_test.TestStatefbk) ... ok
testGramWo (control.tests.statefbk_test.TestStatefbk) ... ok
testGramWo2 (control.tests.statefbk_test.TestStatefbk) ... ok
testGramsys (control.tests.statefbk_test.TestStatefbk) ... ok
testObsvMIMO (control.tests.statefbk_test.TestStatefbk) ... ok
testObsvSISO (control.tests.statefbk_test.TestStatefbk) ... ok
test_LQR_3args (control.tests.statefbk_test.TestStatefbk) ... ok
test_LQR_integrator (control.tests.statefbk_test.TestStatefbk) ... ok
control.tests.statefbk_test.test_suite ... ok
testPole (control.tests.statesp_test.TestDrss)
Test that the poles of drss outputs have less than unit magnitude. ... ok
testShape (control.tests.statesp_test.TestDrss)
Test that drss outputs have the right state, input, and output ... ok
testPole (control.tests.statesp_test.TestRss)
Test that the poles of rss outputs have a negative real part. ... ok
testShape (control.tests.statesp_test.TestRss)
Test that rss outputs have the right state, input, and output ... ok
testAdd (control.tests.statesp_test.TestStateSpace)
Add two MIMO systems. ... ok
testAppendSS (control.tests.statesp_test.TestStateSpace)
Test appending two state-space systems ... ok
testAppendTF (control.tests.statesp_test.TestStateSpace)
Test appending a state-space system with a tf ... ok
testArrayAccessSS (control.tests.statesp_test.TestStateSpace) ... ok
testEvalFr (control.tests.statesp_test.TestStateSpace)
Evaluate the frequency response at one frequency. ... ok
testFreqResp (control.tests.statesp_test.TestStateSpace)
Evaluate the frequency response at multiple frequencies. ... ok
testMinreal (control.tests.statesp_test.TestStateSpace)
Test a minreal model reduction ... ok
testMul (control.tests.statesp_test.TestStateSpace)
Multiply two MIMO systems. ... ok
testPole (control.tests.statesp_test.TestStateSpace)
Evaluate the poles of a MIMO system. ... ok
testSub (control.tests.statesp_test.TestStateSpace)
Subtract two MIMO systems. ... ok
testZero (control.tests.statesp_test.TestStateSpace)
Evaluate the zeros of a SISO system. ... ok
test_check_convert_shape (control.tests.test_control_matlab.TestControlMatlab) ... SKIP: skipping test_check_convert_shape, need to update test
test_convert_MIMO_to_SISO (control.tests.test_control_matlab.TestControlMatlab)
Convert mimo to siso systems ... ok
test_dcgain (control.tests.test_control_matlab.TestControlMatlab)
Test function dcgain with different systems ... ok
test_dcgain_2 (control.tests.test_control_matlab.TestControlMatlab)
Test function dcgain with different systems ... ok
test_impulse (control.tests.test_control_matlab.TestControlMatlab) ... ok
test_initial (control.tests.test_control_matlab.TestControlMatlab) ... ok
test_lsim (control.tests.test_control_matlab.TestControlMatlab) ... SKIP: skipping test_lsim, need to update test
test_step (control.tests.test_control_matlab.TestControlMatlab)
Test function
step
. ... oktest_forced_response (control.tests.timeresp_test.TestTimeresp) ... ok
test_impulse_response (control.tests.timeresp_test.TestTimeresp) ... ok
test_initial_response (control.tests.timeresp_test.TestTimeresp) ... ok
test_initial_response_no_trim (control.tests.timeresp_test.TestTimeresp) ... ok
test_lsim_double_integrator (control.tests.timeresp_test.TestTimeresp) ... ok
test_step_response (control.tests.timeresp_test.TestTimeresp) ... ok
testAddInconsistentDimension (control.tests.xferfcn_test.TestXferFcn)
Add two transfer function matrices of different sizes. ... ok
testAddMIMO (control.tests.xferfcn_test.TestXferFcn)
Add two MIMO systems. ... ok
testAddSISO (control.tests.xferfcn_test.TestXferFcn)
Add two SISO systems. ... ok
testAddScalar (control.tests.xferfcn_test.TestXferFcn)
Add two direct feedthrough systems. ... ok
testBadInputType (control.tests.xferfcn_test.TestXferFcn)
Give the constructor invalid input types. ... ok
testConvertToTransferFunction (control.tests.xferfcn_test.TestXferFcn)
Test for correct state space to transfer function conversion. ... ok
testDivSISO (control.tests.xferfcn_test.TestXferFcn)
Divide two SISO systems. ... ok
testDivScalar (control.tests.xferfcn_test.TestXferFcn)
Divide two direct feedthrough systems. ... ok
testEvalFrMIMO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the frequency response of a MIMO system at one frequency. ... ok
testEvalFrSISO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the frequency response of a SISO system at one frequency. ... ok
testFeedbackSISO (control.tests.xferfcn_test.TestXferFcn)
Test for correct SISO transfer function feedback. ... ok
testFreqRespMIMO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the magnitude and phase of a MIMO system at multiple ... SKIP: skipping, known issue with Python 3
testFreqRespSISO (control.tests.xferfcn_test.TestXferFcn)
Evaluate the magnitude and phase of a SISO system at multiple ... ok
testInconsistentColumns (control.tests.xferfcn_test.TestXferFcn)
Give the constructor inputs that do not have the same number of ... ok
testInconsistentDimension (control.tests.xferfcn_test.TestXferFcn)
Give the constructor a numerator and denominator of different ... ok
testMIMO (control.tests.xferfcn_test.TestXferFcn)
Test conversion of a single input, two-output state-space ... ok
testMatrixMult (control.tests.xferfcn_test.TestXferFcn)
MIMO transfer functions should be multiplyable by constant ... ok
testMinreal (control.tests.xferfcn_test.TestXferFcn)
Try the minreal function, and also test easy entry by creation ... ok
testMinreal2 (control.tests.xferfcn_test.TestXferFcn)
This one gave a problem, due to poly([]) giving simply 1 ... ok
testMulInconsistentDimension (control.tests.xferfcn_test.TestXferFcn)
Multiply two transfer function matrices of incompatible sizes. ... ok
testMulMIMO (control.tests.xferfcn_test.TestXferFcn)
Multiply two MIMO systems. ... ok
testMulSISO (control.tests.xferfcn_test.TestXferFcn)
Multiply two SISO systems. ... ok
testMulScalar (control.tests.xferfcn_test.TestXferFcn)
Multiply two direct feedthrough systems. ... ok
testNegMIMO (control.tests.xferfcn_test.TestXferFcn)
Negate a MIMO system. ... ok
testNegSISO (control.tests.xferfcn_test.TestXferFcn)
Negate a SISO system. ... ok
testNegScalar (control.tests.xferfcn_test.TestXferFcn)
Negate a direct feedthrough system. ... SKIP: skipping, known issue with Python 3
testPoleMIMO (control.tests.xferfcn_test.TestXferFcn)
Test for correct MIMO poles. ... ok
testSubMIMO (control.tests.xferfcn_test.TestXferFcn)
Add two MIMO systems. ... ok
testSubSISO (control.tests.xferfcn_test.TestXferFcn)
Add two SISO systems. ... ok
testSubScalar (control.tests.xferfcn_test.TestXferFcn)
Add two direct feedthrough systems. ... ok
testTruncateCoeff1 (control.tests.xferfcn_test.TestXferFcn)
Remove extraneous zeros in polynomial representations. ... ok
testTruncateCoeff2 (control.tests.xferfcn_test.TestXferFcn)
Remove extraneous zeros in polynomial representations. ... ok
testZeroDenominator (control.tests.xferfcn_test.TestXferFcn)
Give the constructor a transfer function with a zero denominator. ... ok
Ran 190 tests in 5.609s
OK (skipped=5)
On 25/10/15 09:42, Matthew Kennedy wrote:
Could you send the error message that is printed when you attempt to run
your script?
~Scott
On 25/10/15 09:42, Matthew Kennedy wrote:
Try adding
after
cnt.rlocus(sys)
.~Scott
Not sure why things are not working in the script. Is the python-control package installed in the system directory (this would be the default, but usually requires root priviledge) or in your user directory? Perhaps there is something in that path that works differently in command line versus interactive mode?
In terms of running things interactively, you need to run python in a way that supports graphical output. The easiest way to do that is to use 'ipython -pylab' rather than just 'python'. ipython is an interactive version of python and the -pylab option tells it to load up the right graphics packages (mainly matplotlib, I think). I ran the commands you listed and got the attached (graphical) output.
Last edit: Richard Murray 2015-10-25
Thanks for the response!
Using Ipython I am able to generate the Root locus plots. Yay!
Found out what my issue was: The filename I used for testing out the library was titled 'control.py'. so "import control as cnt" was simply importing the file into itself...
The script will compile now but won't display a graph but that shouldn't be to hard to figure out.
Thanks again for your response and for writing this sweet library.