-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pass through kwargs to norm calculations #542
base: dev
Are you sure you want to change the base?
Conversation
Something failed when generating plots. See the log at https://github.com/JuliaControl/ControlExamplePlots.jl/actions/runs/981759170?check_suite_focus=true for more details. |
That's annoying. But it works if you make the tolerance smaller? Is it for discrete-time or continuous-time systems that you are seeing problems? Perhaps the default settings should be changed or some logic should be added? My feeling is that it should be possible to handle most cases decently without having to manually changing the tolerance. Regarding this PR, I think it would be better to avoid the issue altogether by getting rid of |
Both, usually high-order systems that arise as the difference between two medium-order systems. Mostly argument
Every time there is a tolerance to be set there will e cases where it must be changed, so tuning the defaults is orthogonal to this PR, they still must be settable no matter what we call the function. |
Here's an example that fails sys = let
tempA = [-0.015948101119319734 0.0 0.04185849126302005 0.0 0.0 0.0 0.0 0.0 -146.95069642667306 289.4992329744848 -0.6214689449642664 1.0704998483003605 835.1753029801306 -1721.6495755545525 -7702.15700721084 15903.631585610927 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 -0.011069870050970518 0.0 0.03334113387614947 0.0 0.0 0.0 0.0 171.47704409013375 -5185.652046267557 3.3853119792828963 -18.510208955016036 -1295.0940843796357 30687.836682759582 12063.273549901081 -283424.94458045386 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 -0.04185849126302005 0.0 0.0 0.0 0.0 0.0 130.64917644962574 -3950.9729876324254 2.579285317548874 -14.103016346678887 -986.7383500035321 23381.208901150163 9191.065561829399 -215942.81491844106 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 -0.03334113387614947 0.0 0.0 0.0 0.0 -55.106511160002405 108.56221236543183 -0.23305085436159995 0.40143744311263524 313.190738617549 -645.6185908329572 -2888.3088777040653 5963.861844604099 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.5 0.0 0.0 0.0 -0.001 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 -0.5 0.0 0.0 0.0 -0.001 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.5 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.5 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -146.96664452779237 289.49923297448487 -0.5796104537012463 1.0704998483003607 835.1753029801307 -1721.6495755545525 -7702.157007210841 15903.631585610929 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 171.47704409013372 -5185.663116137608 3.3853119792828963 -18.476867821139884 -1295.0940843796354 30687.836682759582 12063.273549901081 -283424.9445804538 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 130.64917644962574 -3950.9729876324254 2.5374268262858544 -14.103016346678887 -986.7383500035321 23381.208901150167 9191.065561829399 -215942.8149184411 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -55.106511160002405 108.56221236543182 -0.23305085436159992 0.3680963092364858 313.190738617549 -645.6185908329572 -2888.3088777040653 5963.861844604098 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; -0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.001 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 -0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.001 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.015948101119319734 0.0 0.04185849126302005 0.0 0.0 0.0 0.0 0.0 0.004690578665071557 0.0006398399358145708 0.01118190035871929 -0.015681911812312804 0.010027514385474409 -0.011629389298868609 0.20339473112213025; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.011069870050970518 0.0 0.03334113387614947 0.0 0.0 0.0 0.0 -0.0017662234961502664 0.003157798881021944 0.011480910174226058 0.009124939421717741 0.004397494815906041 -0.00489420105554904 0.005051401793661087; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.04185849126302005 0.0 0.0 0.0 0.0 0.0 -0.0013456940923049652 0.0024059420045881483 0.008747360132743664 0.006952334797499233 0.0033504722406903177 -0.0037289150899421264 0.0038486870808846383; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.03334113387614947 0.0 0.0 0.0 0.0 0.0017589669994018341 0.0002399399759304641 0.0041932126345197345 -0.005880716929617303 0.003760317894552904 -0.0043610209870757295 0.07627302417079886; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.5 0.0 0.0 0.0 -0.001 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.5 0.0 0.0 0.0 -0.001 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.4363666584525321 0.362557845392374 0.0 0.0 0.0 0.0 0.0 0.0 -0.0008848291499142228 0.0001061582446057077 0.000990837874059477 -0.002752340153101867 -0.00023260569512457825 -0.0022088222335968307 0.016692480990276395; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.00968032967397838 -0.2163818771142806 0.0 0.0 0.0 0.0 0.0 0.0 0.0005725842954244927 -0.0008117178293962256 0.007084115841708504 0.0006259604877735263 -0.0012564059559961249 0.004360178779816776 -0.0681203395862217; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.3070702899708752 -0.6039394816704914 0.0 0.0 0.0 0.0 0.0 0.0 -0.005644601556115492 -0.02319369209218443 -0.031240644104023642 -0.08735969799738057 0.17110673694239079 -0.39261907759479175 6.082378390491541; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5228352872992956 0.3897929030424615 0.0 0.0 0.0 0.0 0.0 0.0 0.03153039161208072 -0.010044403248080081 0.10682019709609707 -0.0427586715326576 0.05113570263190072 0.3204195908239575 -7.969471302442518; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -4.285695892581991 -9.912198831778479 0.0 0.0 0.0 0.0 0.0 0.0 -0.043762150614295225 -0.029290551640687734 -1.7301671011169644 -0.21712779704417307 -0.09884505570776442 -0.02645583454534342 1.0149889946264474; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 66.11982513396354 26.087254882472426 0.0 0.0 0.0 0.0 0.0 0.0 0.3445587746713475 -0.014446998182097577 11.553271048107813 -7.361194537228241 0.8066820208094543 -0.4147741824323043 3.894560106064139; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1865.03950916407 -61.387026027658464 0.0 0.0 0.0 0.0 0.0 0.0 -7.966357949754776 2.8858392600627543 -246.72396844717483 263.8141390592907 -18.422004802740148 10.486612870143544 -137.75226868441615]
tempB = [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 1.0 0.0; 0.0 1.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 1.0 0.0; 0.0 1.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 1.0 0.0; 0.0 1.0; 0.0 0.0; 0.0 0.0; 0.8727333169050642 -0.725115690784748; -0.01936065934795676 0.4327637542285612; -0.6141405799417504 1.2078789633409828; -1.0456705745985913 -0.779585806084923; 8.571391785163982 19.824397663556958; -132.2396502679271 -52.17450976494485; 3730.07901832814 122.77405205531693]
tempC = [-0.05 0.0 0.0 0.0 0.0999 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.05 -0.0 -0.0 -0.0 -0.0999 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0; 0.0 -0.05 0.0 0.0 0.0 0.0999 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 0.05 -0.0 -0.0 -0.0 -0.0999 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -17.651735306507273 34.774682639577755 -0.074650924320032 0.12858857036640967 100.321357715331 -206.80475382036664 -925.1840248901909 1910.3461364097209 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0005634328726812681 -7.685764994769618e-5 -0.0013431712142605754 0.0018837131306081445 -0.0012045062324894185 0.0013969236395037369 -0.024431799534189818; 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 27.299827914847164 -825.5764451769246 0.5389551409803617 -2.946898938112006 -206.18413283655894 4885.62574053884 1920.521162173307 -45122.37923668917 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 0.0002811898103323808 -0.0005027341502124488 -0.001827806594901661 -0.0014527266741043172 -0.0007000986771591708 0.0007791762874505935 -0.0008042032706326109; 5.0 0.0 0.0 0.0 0.0 0.0 -9.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -5.0 -0.0 -0.0 -0.0 -0.0 -0.0 9.9 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0; 0.0 5.0 0.0 0.0 0.0 0.0 0.0 -9.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -0.0 -5.0 -0.0 -0.0 -0.0 -0.0 -0.0 9.9 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0 -0.0]
tempD = [0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0; 0.0 0.0]
ss(tempA, tempB, tempC, tempD)
end And here's a test to pass hinfn = ControlSystems._infnorm_two_steps_ct(sys, :hinf, 1e-9, 1000, 1e-6)[1]
@test hinfn ≈ 14.88609988 rtol=1e-3 |
Ah, right, didn't look too closely. Good that you added the kwargs to the Yes, the tuning parameters are definitely an orthogonal issue. Thanks for this example. I believe that the issue is largely due to that the condition number of FYI, I don't think that max_iters shouldn't have to be changed, the convergence is quadratic (if I remermber correctly), and typically it only takes some tens of iterations for convergence, 17 in your mwe. The max_iter termination is primarily there to guard against infinite loops when there are problems with convergence. |
hinfnorm
fails to converge quite often and requires argument tuning, this PR allows you to set those arguments