Title: GitHub · Where software is built
Open Graph Title: python-control/python-control
X Title: python-control/python-control
Description: The Python Control Systems Library is a Python module that implements basic operations for analysis and design of feedback control systems. - python-control/python-control
Open Graph Description: The Python Control Systems Library is a Python module that implements basic operations for analysis and design of feedback control systems. - python-control/python-control
X Description: The Python Control Systems Library is a Python module that implements basic operations for analysis and design of feedback control systems. - python-control/python-control
Opengraph URL: https://github.com/python-control/python-control
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"This system broke step_info function test","articleBody":"The SettlingMin or SettlingMax or/and Peak values calculus depend on span time selección when the system is asymptotic system:\r\n\r\nstep_info test broke with this test (In this case Fail SettingMax):\r\n\r\n```\r\n@pytest.fixture\r\n def siso_tf_peak1(self):\r\n # Peak_value = Undershoot = y_final(y(t=inf))\r\n # step info time values depend on time vector discretization\r\n # use T=linspace(0,50,10000)\r\n T = TSys(TransferFunction([-1, 1],[1, 1]))\r\n T.step_info = {\r\n 'RiseTime': 2.2002,\r\n 'SettlingTime': 4.6104, \r\n 'SettlingMin': 0.9004, \r\n 'SettlingMax': 0.9999, \r\n 'Overshoot': 0, \r\n 'Undershoot': 100.0, \r\n 'Peak': 1.0, \r\n 'PeakTime': 0.0, \r\n 'SteadyStateValue': 1.0}\r\n return T\r\n```\r\n\r\n\r\nthe problem is with SettlingMax using T by deafault\r\n\r\n```\r\n\r\n========================================================================== FAILURES ===========================================================================\r\n__________________________________________________ TestTimeresp.test_step_info[siso_tf_peak1-ltisys-yfinal] ___________________________________________________\r\n\r\nself = \u003ccontrol.tests.timeresp_test.TestTimeresp object at 0x7f443b7aebb0\u003e, tsystem = TransferFunction(array([-1, 1]), array([1, 1])), systype = 'ltisys'\r\ntime_2d = False, yfinal = True\r\n\r\n @pytest.mark.parametrize(\r\n \"yfinal\", [True, False], ids=[\"yfinal\", \"no yfinal\"])\r\n @pytest.mark.parametrize(\r\n \"systype, time_2d\",\r\n [(\"ltisys\", False),\r\n (\"time response\", False),\r\n (\"time response\", True),\r\n ],\r\n ids=[\"ltisys\", \"time response (n,)\", \"time response (1,n)\"])\r\n @pytest.mark.parametrize(\r\n \"tsystem\",\r\n [\"siso_tf_step_matlab\",\r\n \"siso_ss_step_matlab\",\r\n \"siso_tf_kpos\",\r\n \"siso_tf_kneg\",\r\n \"siso_tf_type1\",\r\n \"siso_tf_peak1\"],\r\n indirect=[\"tsystem\"])\r\n def test_step_info(self, tsystem, systype, time_2d, yfinal):\r\n \"\"\"Test step info for SISO systems.\"\"\"\r\n step_info_kwargs = tsystem.kwargs.get('step_info', {})\r\n if systype == \"time response\":\r\n # simulate long enough for steady state value\r\n tfinal = 3 * tsystem.step_info['SettlingTime']\r\n if np.isnan(tfinal):\r\n pytest.skip(\"test system does not settle\")\r\n t, y = step_response(tsystem.sys, T=tfinal, T_num=5000)\r\n sysdata = y\r\n step_info_kwargs['T'] = t[np.newaxis, :] if time_2d else t\r\n else:\r\n sysdata = tsystem.sys\r\n if yfinal:\r\n step_info_kwargs['yfinal'] = tsystem.step_info['SteadyStateValue']\r\n \r\n info = step_info(sysdata, **step_info_kwargs)\r\n \r\n\u003e self.assert_step_info_match(tsystem.sys, info, tsystem.step_info)\r\n\r\ncontrol/tests/timeresp_test.py:509: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = \u003ccontrol.tests.timeresp_test.TestTimeresp object at 0x7f443b7aebb0\u003e, sys = TransferFunction(array([-1, 1]), array([1, 1]))\r\ninfo = {'Overshoot': 0, 'Peak': 1.0, 'PeakTime': 0.0, 'RiseTime': 2.1630344812974367, ...}\r\ninfo_ref = {'Overshoot': 0, 'Peak': 1.0, 'PeakTime': 0.0, 'RiseTime': 2.2002, ...}\r\n\r\n def assert_step_info_match(self, sys, info, info_ref):\r\n \"\"\"Assert reasonable step_info accuracy.\"\"\"\r\n if sys.isdtime(strict=True):\r\n dt = sys.dt\r\n else:\r\n _, dt = _ideal_tfinal_and_dt(sys, is_step=True)\r\n \r\n for k in ['RiseTime', 'SettlingTime', 'PeakTime']:\r\n np.testing.assert_allclose(info[k], info_ref[k], atol=dt,\r\n err_msg=f\"{k} does not match\")\r\n for k in ['Overshoot', 'Undershoot', 'Peak', 'SteadyStateValue']:\r\n np.testing.assert_allclose(info[k], info_ref[k], rtol=5e-3,\r\n err_msg=f\"{k} does not match\")\r\n \r\n # steep gradient right after RiseTime\r\n absrefinf = np.abs(info_ref['SteadyStateValue'])\r\n if info_ref['RiseTime'] \u003e 0:\r\n y_next_sample_max = 0.8*absrefinf/info_ref['RiseTime']*dt\r\n else:\r\n y_next_sample_max = 0\r\n for k in ['SettlingMin', 'SettlingMax']:\r\n if (np.abs(info_ref[k]) - 0.9 * absrefinf) \u003e y_next_sample_max:\r\n # local min/max peak well after signal has risen\r\n\u003e np.testing.assert_allclose(info[k], info_ref[k], rtol=1e-3)\r\nE AssertionError: \r\nE Not equal to tolerance rtol=0.001, atol=0\r\nE \r\nE Mismatched elements: 1 / 1 (100%)\r\nE Max absolute difference: 0.0019\r\nE Max relative difference: 0.00190019\r\nE x: array(0.998)\r\nE y: array(0.9999)\r\n\r\ncontrol/tests/timeresp_test.py:471: AssertionError\r\n_________________________________________________ TestTimeresp.test_step_info[siso_tf_peak1-ltisys-no yfinal] _________________________________________________\r\n\r\nself = \u003ccontrol.tests.timeresp_test.TestTimeresp object at 0x7f44b0132df0\u003e, tsystem = TransferFunction(array([-1, 1]), array([1, 1])), systype = 'ltisys'\r\ntime_2d = False, yfinal = False\r\n\r\n @pytest.mark.parametrize(\r\n \"yfinal\", [True, False], ids=[\"yfinal\", \"no yfinal\"])\r\n @pytest.mark.parametrize(\r\n \"systype, time_2d\",\r\n [(\"ltisys\", False),\r\n (\"time response\", False),\r\n (\"time response\", True),\r\n ],\r\n ids=[\"ltisys\", \"time response (n,)\", \"time response (1,n)\"])\r\n @pytest.mark.parametrize(\r\n \"tsystem\",\r\n [\"siso_tf_step_matlab\",\r\n \"siso_ss_step_matlab\",\r\n \"siso_tf_kpos\",\r\n \"siso_tf_kneg\",\r\n \"siso_tf_type1\",\r\n \"siso_tf_peak1\"],\r\n indirect=[\"tsystem\"])\r\n def test_step_info(self, tsystem, systype, time_2d, yfinal):\r\n \"\"\"Test step info for SISO systems.\"\"\"\r\n step_info_kwargs = tsystem.kwargs.get('step_info', {})\r\n if systype == \"time response\":\r\n # simulate long enough for steady state value\r\n tfinal = 3 * tsystem.step_info['SettlingTime']\r\n if np.isnan(tfinal):\r\n pytest.skip(\"test system does not settle\")\r\n t, y = step_response(tsystem.sys, T=tfinal, T_num=5000)\r\n sysdata = y\r\n step_info_kwargs['T'] = t[np.newaxis, :] if time_2d else t\r\n else:\r\n sysdata = tsystem.sys\r\n if yfinal:\r\n step_info_kwargs['yfinal'] = tsystem.step_info['SteadyStateValue']\r\n \r\n info = step_info(sysdata, **step_info_kwargs)\r\n \r\n\u003e self.assert_step_info_match(tsystem.sys, info, tsystem.step_info)\r\n\r\ncontrol/tests/timeresp_test.py:509: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = \u003ccontrol.tests.timeresp_test.TestTimeresp object at 0x7f44b0132df0\u003e, sys = TransferFunction(array([-1, 1]), array([1, 1]))\r\ninfo = {'Overshoot': 0, 'Peak': 1.0, 'PeakTime': 0.0, 'RiseTime': 2.1630344812974367, ...}\r\ninfo_ref = {'Overshoot': 0, 'Peak': 1.0, 'PeakTime': 0.0, 'RiseTime': 2.2002, ...}\r\n\r\n def assert_step_info_match(self, sys, info, info_ref):\r\n \"\"\"Assert reasonable step_info accuracy.\"\"\"\r\n if sys.isdtime(strict=True):\r\n dt = sys.dt\r\n else:\r\n _, dt = _ideal_tfinal_and_dt(sys, is_step=True)\r\n \r\n for k in ['RiseTime', 'SettlingTime', 'PeakTime']:\r\n np.testing.assert_allclose(info[k], info_ref[k], atol=dt,\r\n err_msg=f\"{k} does not match\")\r\n for k in ['Overshoot', 'Undershoot', 'Peak', 'SteadyStateValue']:\r\n np.testing.assert_allclose(info[k], info_ref[k], rtol=5e-3,\r\n err_msg=f\"{k} does not match\")\r\n \r\n # steep gradient right after RiseTime\r\n absrefinf = np.abs(info_ref['SteadyStateValue'])\r\n if info_ref['RiseTime'] \u003e 0:\r\n y_next_sample_max = 0.8*absrefinf/info_ref['RiseTime']*dt\r\n else:\r\n y_next_sample_max = 0\r\n for k in ['SettlingMin', 'SettlingMax']:\r\n if (np.abs(info_ref[k]) - 0.9 * absrefinf) \u003e y_next_sample_max:\r\n # local min/max peak well after signal has risen\r\n\u003e np.testing.assert_allclose(info[k], info_ref[k], rtol=1e-3)\r\nE AssertionError: \r\nE Not equal to tolerance rtol=0.001, atol=0\r\nE \r\nE Mismatched elements: 1 / 1 (100%)\r\nE Max absolute difference: 0.0019\r\nE Max relative difference: 0.00190019\r\nE x: array(0.998)\r\nE y: array(0.9999)\r\n\r\ncontrol/tests/timeresp_test.py:471: AssertionError\r\n====================================================================== warnings summary =======================================================================\r\ncontrol/tests/rlocus_test.py:79\r\n /home/jpp/github_repos/my_python_control/python-control/control/tests/rlocus_test.py:79: PytestUnknownMarkWarning: Unknown pytest.mark.timeout - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html\r\n @pytest.mark.timeout(2)\r\n\r\n-- Docs: https://docs.pytest.org/en/stable/warnings.html\r\n=================================================================== short test summary info ===================================================================\r\nSKIPPED [1] control/tests/matlab2_test.py:204: skipping test_check_convert_shape, need to update test\r\nSKIPPED [1] control/tests/matlab2_test.py:275: need to update test\r\nSKIPPED [4] control/tests/timeresp_test.py:498: test system does not settle\r\nSKIPPED [6] control/tests/timeresp_test.py:880: No continuous forced_response without time vector.\r\nSKIPPED [1] control/tests/type_conversion_test.py:162: future test; conversions not yet fully implemented\r\nSKIPPED [2] control/tests/xferfcn_test.py:742: .__matmul__ not implemented\r\nXFAIL control/tests/lti_test.py::TestLTI::test_timebaseEqual_deprecated[None-True-True]\r\n returns false\r\nXFAIL control/tests/optimal_test.py::test_discrete_lqr\r\n reason: discrete LQR not implemented\r\nXFAIL control/tests/statefbk_test.py::TestStatefbk::testLQR_warning\r\n warning not implemented\r\nFAILED control/tests/timeresp_test.py::TestTimeresp::test_step_info[siso_tf_peak1-ltisys-yfinal] - AssertionError: \r\nFAILED control/tests/timeresp_test.py::TestTimeresp::test_step_info[siso_tf_peak1-ltisys-no yfinal] - AssertionError: \r\n========================================= 2 failed, 2483 passed, 15 skipped, 3 xfailed, 1 warning in 93.49s (0:01:33) =========================================\r\n(control-dev) jpp@jpp-linux:~/github_repos/my_python_control/python-control$ /home/jpp/miniconda3/envs/control-dev/bin/python /home/jpp/github_repos/my_python_control/python-control/examples/step_info_example2.py\r\n```","author":{"url":"https://github.com/juanodecc","@type":"Person","name":"juanodecc"},"datePublished":"2021-03-30T12:23:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/598/python-control/issues/598"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:5ca7e9b0-69a8-bb39-095f-77072c069515 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 951E:33B429:161ECA4:1DC4AE1:697A93EF |
| html-safe-nonce | 057daa11b26bacf4b681b2f9a59e77e43dbbb01414d6b5ee4367e064bb87651f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTFFOjMzQjQyOToxNjFFQ0E0OjFEQzRBRTE6Njk3QTkzRUYiLCJ2aXNpdG9yX2lkIjoiMTk0NjkxMjU0NjgxMTk3NDYzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b49ffd7cd0401a3a02f44804f59622f73d45bd5c7a8b746f3f080553fe46e265 |
| hovercard-subject-tag | repository:22791752 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-control/python-control/issues/598 |
| twitter:image | https://opengraph.githubassets.com/d9b299786e8e42910943bab5fbf6f296576f2bc82adb0eb97126c354fdf0a23f/python-control/python-control |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d9b299786e8e42910943bab5fbf6f296576f2bc82adb0eb97126c354fdf0a23f/python-control/python-control |
| og:image:alt | The Python Control Systems Library is a Python module that implements basic operations for analysis and design of feedback control systems. - python-control/python-control |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0912f2a9aa0160e08239520d461a4b4c4ce1caa972a8370b7442b94a38a194c5 |
| turbo-cache-control | no-cache |
| go-import | github.com/python-control/python-control git https://github.com/python-control/python-control.git |
| octolytics-dimension-user_id | 2285872 |
| octolytics-dimension-user_login | python-control |
| octolytics-dimension-repository_id | 22791752 |
| octolytics-dimension-repository_nwo | python-control/python-control |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22791752 |
| octolytics-dimension-repository_network_root_nwo | python-control/python-control |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f8f5270c10a913bfa56f2dad4b864f1cda383754 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width