Closed Bemnet-Won closed 1 year ago
I used the control-0.9.2 which caused the error
downgrading it to control-0.8.4 solved the problem
The problem persists with the latest control-0.9.3
Dear All,
first of all thanks for the interest in SIPPY.
This is a problem we are also dealing with the control package developing group.
The quick trick to solve this issue is to downgrade the control package to a version <0.9.0.
In the meantime we will keep you posted on the news.
Marco from SIPPY team
On Aug 19, 2022, at 3:44 AM, Bemnet-Won @.**@.>> wrote:
Thanks for sharing the system identification codes. Professor Gabriele Pannocchia introduced the CPCLAB-UNIPI github page in his lectures at the Chinese MPC school.
When I tried to execute the example codes, I found that the majority of them had a common problem with the fset.validation function. Is it a common bug or is it because I am using a different version of some of the packages? An inconsistent shape in line 805 of the fset.validation function is the cause of the issue. The Ex ARMAX, Ex ARMAX MIMO, Ex CST, Ex OPT GEN-INOUT, and Ex RECURSIVE all use fset.validation and all have the same issue.
The Ex ARX MIMO and Ex SS both function well.
Traceback (most recent call last): File "C:/Users/bemnet/Desktop/First_Model/SIPPY-PYCHRM-master/Examples/Ex_ARMAX.py", line 174, in Yv_armaxi = fset.validation(Id_ARMAXi,U_valid,Ytotvalid,Time) File "C:\Users\bemnet\Desktop\First_Model\SIPPY-PYCHRM-master\sippy\functionset.py", line 196, in validation Y_u, T, Xv = cnt.lsim((1/SYS.H[i,0])*SYS.G[i,:], u, Time) File "C:\Users\bemnet\anaconda3\envs\SYSID_4PYCHRM\lib\site-packages\control\matlab\timeresp.py", line 297, in lsim out = forced_response(sys, T, U, X0, return_x=True, transpose=True) File "C:\Users\bemnet\anaconda3\envs\SYSID_4PYCHRM\lib\site-packages\control\timeresp.py", line 1007, in forced_response U = _check_convert_array(U, legal_shapes, File "C:\Users\bemnet\anaconda3\envs\SYSID_4PYCHRM\lib\site-packages\control\timeresp.py", line 805, in _check_convert_array raise ValueError(err_msg_start + err_msg) ValueError: Parameter U: Wrong shape (rows, columns): (401, 1). Expected: (401,) or (1, 401).
— Reply to this email directly, view it on GitHubhttps://es.sonicurlprotection-fra.com/click?PV=2&MSGID=202208190144460795227&URLID=2&ESV=10.0.18.7423&IV=3BC4EAC4F03317F7BBD67B068053F504&TT=1660873488332&ESN=8f7m%2FJrpuRuH3IwI32KNKGd6490KApvPPT7V%2BwkC9%2BY%3D&KV=1536961729280&B64_ENCODED_URL=aHR0cHM6Ly9naXRodWIuY29tL0NQQ0xBQi1VTklQSS9TSVBQWS9pc3N1ZXMvNDg&HK=778CEA53ADC68008AF273BFBFD630A00C4CADEDB450A4DA4E64040C3B9FB74D3, or unsubscribehttps://es.sonicurlprotection-fra.com/click?PV=2&MSGID=202208190144460795227&URLID=1&ESV=10.0.18.7423&IV=4E2C1A9268359E09F9DF1513F91A5B4F&TT=1660873488332&ESN=Zy7ivDKG4ZWDqUj4NNWp8HyWLUdaCSitZs1cndRRT9M%3D&KV=1536961729280&B64_ENCODED_URL=aHR0cHM6Ly9naXRodWIuY29tL25vdGlmaWNhdGlvbnMvdW5zdWJzY3JpYmUtYXV0aC9BSDQ2UjRCVlZORFFUUUdJNlZPU0tHTFZaM1JJNUFOQ05GU001NjdEQkVRQQ&HK=1ECB457AE1A2E743A56B587F7F99B76E738C9F6900370322DB7756DF355B4733. You are receiving this because you are subscribed to this thread.Message ID: @.***>
It helped to me replace the function lsim with forced_response (in the validation function) and I no longer get the ValueError. Y_u, T, Xv = cnt.lsim((1/SYS.H[i,0])SYS.G[i,:], u, Time) Y_y, T, Xv = cnt.lsim(1 - (1/SYS.H[i,0]), y[i,:] - y_rif[i], Time) -> Y_u, T = cnt.forced_response((1/SYS.H[i,0])SYS.G[i,:], Time, u) Y_y, T = cnt.forced_response(1 - (1/SYS.H[i,0]), Time, y[i,:] - y_rif[i]) HTH
Hi Miroslav, thank you very much for your comment. We have just tested your solution on our SIPPY, but it seems still dependent on the control version. Indeed, with control 0.8.3 we need to swap the output position in cnt.forced_response: Y_y, T --> T, Y_y. Keep in touch when a definitive solution will be possible! Best Riccardo
Thanks for sharing the system identification codes. Professor Gabriele Pannocchia introduced the CPCLAB-UNIPI github page in his lectures at the Chinese MPC school.
When I tried to execute the example codes, I found that the majority of them had a common problem with the fset.validation function. Is it a common bug or is it because I am using a different version of some of the packages? An inconsistent shape in line 805 of the fset.validation function is the cause of the issue. The Ex ARMAX, Ex ARMAX MIMO, Ex CST, Ex OPT GEN-INOUT, and Ex RECURSIVE all use fset.validation and all have the same issue.
The Ex ARX MIMO and Ex SS both function well.
Traceback (most recent call last): File "C:/Users/bemnet/Desktop/First_Model/SIPPY-PYCHRM-master/Examples/Ex_ARMAX.py", line 174, in
Yv_armaxi = fset.validation(Id_ARMAXi,U_valid,Ytotvalid,Time)
File "C:\Users\bemnet\Desktop\First_Model\SIPPY-PYCHRM-master\sippy\functionset.py", line 196, in validation
Y_u, T, Xv = cnt.lsim((1/SYS.H[i,0])*SYS.G[i,:], u, Time)
File "C:\Users\bemnet\anaconda3\envs\SYSID_4PYCHRM\lib\site-packages\control\matlab\timeresp.py", line 297, in lsim
out = forced_response(sys, T, U, X0, return_x=True, transpose=True)
File "C:\Users\bemnet\anaconda3\envs\SYSID_4PYCHRM\lib\site-packages\control\timeresp.py", line 1007, in forced_response
U = _check_convert_array(U, legal_shapes,
File "C:\Users\bemnet\anaconda3\envs\SYSID_4PYCHRM\lib\site-packages\control\timeresp.py", line 805, in _check_convert_array
raise ValueError(err_msg_start + err_msg)
ValueError: Parameter
U
: Wrong shape (rows, columns): (401, 1). Expected: (401,) or (1, 401).