Parameter Estimation of RIG Roll Experiments

Setup and descriptions

  • Without ACM model
  • Turn on wind tunnel
  • Only 1DoF for RIG roll movement
  • Use small-amplitude aileron command of CMP as inputs (in degrees) $$U = \delta_{a,cmp}(t)$$
  • Consider RIG roll angle and its derivative as States (in radians) $$X = \begin{pmatrix} \phi_{rig} \\ \dot{\phi}_{rig} \end{pmatrix}$$
  • Observe RIG roll angle and its derivative as Outputs (in degrees) $$Z = \begin{pmatrix} \phi_{rig} \\ \dot{\phi}_{rig} \end{pmatrix}$$
  • Use output error method based on most-likehood(ML) to estimate $$ \theta = \begin{pmatrix} C_{l,\delta_a,cmp} \\ C_{lp,cmp} \end{pmatrix} $$

Startup computation engines


In [2]:
%run matt_startup
%run -i matt_utils

button_qtconsole()

#import other needed modules in all used engines
#with dview.sync_imports():
#   import os


importing numpy on engine(s)
importing scipy on engine(s)
importing matplotlib on engine(s)
importing scipy.integrate on engine(s)
importing scipy.interpolate on engine(s)
importing math on engine(s)
importing time on engine(s)
importing itertools on engine(s)
importing random on engine(s)

Data preparation

Load raw data


In [3]:
filename = 'FIWT_Exp051_20150612163239.dat.npz'

def loadData():
    # Read and parse raw data
    global exp_data
    exp_data = np.load(filename)

    # Select colums
    global T_cmp, da1_cmp, da2_cmp, da3_cmp , da4_cmp
    T_cmp = exp_data['data33'][:,0]
    da1_cmp = exp_data['data33'][:,3]
    da2_cmp = exp_data['data33'][:,5]
    da3_cmp = exp_data['data33'][:,7]
    da4_cmp = exp_data['data33'][:,9]

    global T_rig, phi_rig
    T_rig = exp_data['data44'][:,0]
    phi_rig = exp_data['data44'][:,2]

loadData()

Check time sequence and inputs/outputs

Click 'Check data' button to show the raw data.

Click on curves to select time point and push into queue; click 'T/s' text to pop up last point in the queue; and click 'Output' text to print time sequence table.


In [4]:
def checkInputOutputData():

    #check inputs/outputs
    fig, ax = plt.subplots(2,1,True)
    ax[0].plot(T_cmp,da1_cmp,'r', T_cmp,da2_cmp,'g',
               T_cmp,da3_cmp,'b', T_cmp,da4_cmp,'m',
               picker=1)
    ax[1].plot(T_rig,phi_rig, 'b', picker=2)
    ax[0].set_ylabel('$\delta \/ / \/ ^o$')
    ax[1].set_ylabel('$\phi \/ / \/ ^o/s$')
    ax[1].set_xlabel('$T \/ / \/ s$', picker=True)
    ax[0].set_title('Output', picker=True)
    

    fig.canvas.mpl_connect('pick_event', onPickTime)
    fig.show()
    display(fig)

button_CheckData()

Input data set information and do processing

For each section,

  • Select time range and shift it to start from zero;
  • Resample Time, Inputs, Outputs in unique $\delta_T$;
  • Smooth Input/Observe data if flag bit0 is set;
  • Take derivatives of observe data if flag bit1 is set.

In [8]:
# Decide DT,U,Z and their processing method
process_set1 = {
            # Pick up focused time ranges
            'time_marks' : [
                [10.244684487,71.0176928039,"ramp cmp1 u1"],
                [75.590251771,136.676120954,"ramp cmp1 d1"],
                [138.085246353,198.267991292,"ramp cmp2 u1"],
                [202.947148504,263.947709116,"ramp cmp2 d1"],
                [265.320787191,326.086083756,"ramp cmp2 d2"],
                [328.651258032,387.065040394,"ramp cmp3 u1"],
                [391.213644461,451.562391555,"ramp cmp3 d1"],
                [454.129343981,513.129351723,"ramp cmp4 u1"],
                [515.902028523,577.039776316,"ramp cmp4 d1"],
                [580.1785085,679.5971965,"ramp cmp1/3 d1"],
                [683.479931261,783.589410569,"ramp cmp1/3 d2"],
                [785.543756555,885.058700497,"ramp cmp1/3 u1"],
                [889.116441348,987.763826608,"ramp cmp2/4 d1"],
                [992.08250855,1089.55268169,"ramp cmp2/4 u1"],
                [1098.5355005,1216.24487648,"ramp cmpall u1"],
                [1220.27886043,1340.49709824,"ramp cmpall u2"],
                [1343.59303659,1464.78924788,"ramp cmpall d1"],
            ],
            'U':[(T_cmp, da1_cmp,0),
                (T_cmp, da2_cmp,0),
                (T_cmp, da3_cmp,0),
                (T_cmp, da4_cmp,0),],
            'U_names' : ['$\delta_{a1,cmp} \, / \, ^o$',
                      '$\delta_{a2,cmp} \, / \, ^o$',
                      '$\delta_{a3,cmp} \, / \, ^o$',
                      '$\delta_{a4,cmp} \, / \, ^o$'],
            'Z':[(T_rig, phi_rig,1),],
            'Z_names' : ['$\phi_{a,rig} \, / \, ^o$'],
            'cutoff_freq': 1, #Hz
            'consts' : {'DT':0.1, 'id':0, 'V':30}
           }

display_data_set(process_set1)
resample(process_set1, append=False);


Time ranges
IdxStart(s)Spam(s)Description
1610.2460.77ramp cmp1 u1
1775.5961.09ramp cmp1 d1
18138.0960.18ramp cmp2 u1
19202.9561.00ramp cmp2 d1
20265.3260.77ramp cmp2 d2
21328.6558.41ramp cmp3 u1
22391.2160.35ramp cmp3 d1
23454.1359.00ramp cmp4 u1
24515.9061.14ramp cmp4 d1
25580.1899.42ramp cmp1/3 d1
26683.48100.11ramp cmp1/3 d2
27785.5499.51ramp cmp1/3 u1
28889.1298.65ramp cmp2/4 d1
29992.0897.47ramp cmp2/4 u1
301098.54117.71ramp cmpall u1
311220.28120.22ramp cmpall u2
321343.59121.20ramp cmpall d1
$U$
$\delta_{a1,cmp} \, / \, ^o$
$\delta_{a2,cmp} \, / \, ^o$
$\delta_{a3,cmp} \, / \, ^o$
$\delta_{a4,cmp} \, / \, ^o$
$Z$
$\phi_{a,rig} \, / \, ^o$
ConstantValue
DT0.1
id0
V30

Define dynamic model to be estimated

$$\left\{\begin{matrix}\begin{align} M_{x,rig} &= M_{x,a} + M_{x,f} + M_{x,cg} = 0 \\ M_{x,a} &= \frac{1}{2} \rho V^2S_cb_c C_{la,cmp}\delta_{a,cmp} \\ M_{x,f} &= -F_c \, sign(\dot{\phi}_{rig}) \\ M_{x,cg} &= -m_T g l_{zT} \sin \left ( \phi - \phi_0 \right ) \end{align}\end{matrix}\right.$$

In [9]:
%%px --local
#update common const parameters in all engines

angles = range(-40,41,5)
angles[0] -= 1
angles[-1] += 1
del angles[angles.index(0)]
angles_num = len(angles)

#problem size
Nx = 0
Nu = 4
Ny = 1
Npar = 4*angles_num+1

#reference
S_c = 0.1254   #S_c(m2) 
b_c = 0.7      #b_c(m)
g = 9.81       #g(m/s2)

#static measurement
m_T = 7.5588   #m_T(kg)
l_z_T = 0.0424250531303 #l_z_T(m)

#previous estimations
F_c = 0.0532285873599 #F_c(N*m)
Clda_cmp = -0.315904095782 #Clda_cmp(1/rad)
Clphi_cmp = -0.0131776778575 #Clphi_cmp(1/rad)

#for short
_m_T_l_z_T_g = -(m_T*l_z_T)*g


def obs(Z,T,U,params,consts):
    DT = consts['DT']
    ID = consts['id']
    V  = consts['V']

    k1 = np.array(params[0:angles_num])
    k2 = np.array(params[angles_num:angles_num*2])
    k3 = np.array(params[angles_num*2:angles_num*3])
    k4 = np.array(params[angles_num*3:angles_num*4])
    phi0 = params[-1]

    Clda1 = scipy.interpolate.interp1d(angles, Clda_cmp*0.00436332313*k1*angles,assume_sorted=True)
    Clda2 = scipy.interpolate.interp1d(angles, Clda_cmp*0.00436332313*k2*angles,assume_sorted=True)
    Clda3 = scipy.interpolate.interp1d(angles, Clda_cmp*0.00436332313*k3*angles,assume_sorted=True)
    Clda4 = scipy.interpolate.interp1d(angles, Clda_cmp*0.00436332313*k4*angles,assume_sorted=True)
    
    s = T.size
    qbarSb = 0.5*1.225*V*V*S_c*b_c
    moments_a = qbarSb*(Clda1(U[:s,0])+Clda2(U[:s,1])
                       +Clda3(U[:s,2])+Clda4(U[:s,3]))

    phi = phi0+np.arcsin(np.clip(-moments_a/_m_T_l_z_T_g, -1, 1))
    
    moments_f = np.copysign(F_c, phi);
    moments_p = qbarSb*Clphi_cmp*phi;
    
    phi = phi0+np.arcsin(np.clip(-(moments_a+moments_p+moments_f)/_m_T_l_z_T_g, -1, 1))

    return (phi*57.3).reshape((-1,1))

In [11]:
display(HTML('<b>Constant Parameters</b>'))
table = ListTable()
table.append(['Name','Value','unit'])
table.append(['$S_c$',S_c,'$m^2$'])
table.append(['$b_c$',b_c,'$m$'])
table.append(['$g$',g,'$m/s^2$'])
table.append(['$m_T$',m_T,'$kg$'])
table.append(['$l_{zT}$',l_z_T,'$m$'])
table.append(['$F_c$',F_c,'$Nm$'])
table.append(['$C_{l \delta a,cmp}$',Clda_cmp,'$rad^{-1}$'])
table.append(['$C_{l \phi,cmp}$',Clphi_cmp,'$rad^{-1}$'])
display(table)


Constant Parameters
NameValueunit
$S_c$0.1254$m^2$
$b_c$0.7$m$
$g$9.81$m/s^2$
$m_T$7.5588$kg$
$l_{zT}$0.0424250531303$m$
$F_c$0.0532285873599$Nm$
$C_{l \delta a,cmp}$-0.315904095782$rad^{-1}$
$C_{l \phi,cmp}$-0.0131776778575$rad^{-1}$

Initial guess

  • Input default values and ranges for parameters
  • Select sections for trainning
  • Adjust parameters based on simulation results
  • Decide start values of parameters for optimization

In [12]:
#initial guess
param0 = [1]*(4*angles_num)+[0]

param_name = ['k_{}_{}'.format(i/angles_num+1, angles[i%angles_num]) for i in range(4*angles_num)] + ['$phi_0$']
param_unit = ['1']*(4*angles_num) + ['$rad$']

NparID = Npar
opt_idx = range(Npar)
opt_param0 = [param0[i] for i in opt_idx]
par_del = [0.001]*(4*angles_num) + [0.0001]
bounds =  [(0,1.5)]*(4*angles_num) +[(-0.1, 0.1)]
display_default_params()

#select sections for training
section_idx = range(9)
del section_idx[3]
display_data_for_train()

#push parameters to engines
push_opt_param()


Default Parameters for optimization
IdxDescription$x_0$unitopt$\delta_{par}$minmax
0k_1_-4111*0.00101.5
1k_1_-3511*0.00101.5
2k_1_-3011*0.00101.5
3k_1_-2511*0.00101.5
4k_1_-2011*0.00101.5
5k_1_-1511*0.00101.5
6k_1_-1011*0.00101.5
7k_1_-511*0.00101.5
8k_1_511*0.00101.5
9k_1_1011*0.00101.5
10k_1_1511*0.00101.5
11k_1_2011*0.00101.5
12k_1_2511*0.00101.5
13k_1_3011*0.00101.5
14k_1_3511*0.00101.5
15k_1_4111*0.00101.5
16k_2_-4111*0.00101.5
17k_2_-3511*0.00101.5
18k_2_-3011*0.00101.5
19k_2_-2511*0.00101.5
20k_2_-2011*0.00101.5
21k_2_-1511*0.00101.5
22k_2_-1011*0.00101.5
23k_2_-511*0.00101.5
24k_2_511*0.00101.5
25k_2_1011*0.00101.5
26k_2_1511*0.00101.5
27k_2_2011*0.00101.5
28k_2_2511*0.00101.5
29k_2_3011*0.00101.5
30k_2_3511*0.00101.5
31k_2_4111*0.00101.5
32k_3_-4111*0.00101.5
33k_3_-3511*0.00101.5
34k_3_-3011*0.00101.5
35k_3_-2511*0.00101.5
36k_3_-2011*0.00101.5
37k_3_-1511*0.00101.5
38k_3_-1011*0.00101.5
39k_3_-511*0.00101.5
40k_3_511*0.00101.5
41k_3_1011*0.00101.5
42k_3_1511*0.00101.5
43k_3_2011*0.00101.5
44k_3_2511*0.00101.5
45k_3_3011*0.00101.5
46k_3_3511*0.00101.5
47k_3_4111*0.00101.5
48k_4_-4111*0.00101.5
49k_4_-3511*0.00101.5
50k_4_-3011*0.00101.5
51k_4_-2511*0.00101.5
52k_4_-2011*0.00101.5
53k_4_-1511*0.00101.5
54k_4_-1011*0.00101.5
55k_4_-511*0.00101.5
56k_4_511*0.00101.5
57k_4_1011*0.00101.5
58k_4_1511*0.00101.5
59k_4_2011*0.00101.5
60k_4_2511*0.00101.5
61k_4_3011*0.00101.5
62k_4_3511*0.00101.5
63k_4_4111*0.00101.5
64$phi_0$0$rad$*0.0001-0.10.1
Training Data
IdxStart(s)Spam(s)Description
010.2460.77ramp cmp1 u1
175.5961.09ramp cmp1 d1
2138.0960.18ramp cmp2 u1
4265.3260.77ramp cmp2 d2
5328.6558.41ramp cmp3 u1
6391.2160.35ramp cmp3 d1
7454.1359.00ramp cmp4 u1
8515.9061.14ramp cmp4 d1

In [13]:
# select 4 section from training data
#idx = random.sample(section_idx, 4)
idx = section_idx[:]

interact_guess();


Optimize using ML


In [14]:
display_preopt_params()

if False:
    InfoMat = None
    method = 'trust-ncg'
    def hessian(opt_params, index):
        global InfoMat
        return InfoMat
    dview['enable_infomat']=True
    options={'gtol':1}
    opt_bounds = None
else:
    method = 'L-BFGS-B'
    hessian = None
    dview['enable_infomat']=False
    options={'ftol':1e-6,'maxfun':400}
    opt_bounds = bounds

cnt = 0
tmp_rslt = None
T0 = time.time()
print('#cnt,     Time,      |R|')

%time res =  sp.optimize.minimize(fun=costfunc, x0=opt_param0, \
        args=(opt_idx,), method=method, jac=True, hess=hessian, \
        bounds=opt_bounds, options=options)


Parameters for optimization
IdxDescription$x_0$unitopt$\delta_{par}$minmax
0k_1_-411.01*0.00101.5
1k_1_-351.01*0.00101.5
2k_1_-301.01*0.00101.5
3k_1_-251.01*0.00101.5
4k_1_-201.01*0.00101.5
5k_1_-151.01*0.00101.5
6k_1_-101.01*0.00101.5
7k_1_-51.01*0.00101.5
8k_1_51.01*0.00101.5
9k_1_101.01*0.00101.5
10k_1_151.01*0.00101.5
11k_1_201.01*0.00101.5
12k_1_251.01*0.00101.5
13k_1_301.01*0.00101.5
14k_1_351.01*0.00101.5
15k_1_411.01*0.00101.5
16k_2_-411.01*0.00101.5
17k_2_-351.01*0.00101.5
18k_2_-301.01*0.00101.5
19k_2_-251.01*0.00101.5
20k_2_-201.01*0.00101.5
21k_2_-151.01*0.00101.5
22k_2_-101.01*0.00101.5
23k_2_-51.01*0.00101.5
24k_2_51.01*0.00101.5
25k_2_101.01*0.00101.5
26k_2_151.01*0.00101.5
27k_2_201.01*0.00101.5
28k_2_251.01*0.00101.5
29k_2_301.01*0.00101.5
30k_2_351.01*0.00101.5
31k_2_411.01*0.00101.5
32k_3_-411.01*0.00101.5
33k_3_-351.01*0.00101.5
34k_3_-301.01*0.00101.5
35k_3_-251.01*0.00101.5
36k_3_-201.01*0.00101.5
37k_3_-151.01*0.00101.5
38k_3_-101.01*0.00101.5
39k_3_-51.01*0.00101.5
40k_3_51.01*0.00101.5
41k_3_101.01*0.00101.5
42k_3_151.01*0.00101.5
43k_3_201.01*0.00101.5
44k_3_251.01*0.00101.5
45k_3_301.01*0.00101.5
46k_3_351.01*0.00101.5
47k_3_411.01*0.00101.5
48k_4_-411.01*0.00101.5
49k_4_-351.01*0.00101.5
50k_4_-301.01*0.00101.5
51k_4_-251.01*0.00101.5
52k_4_-201.01*0.00101.5
53k_4_-151.01*0.00101.5
54k_4_-101.01*0.00101.5
55k_4_-51.01*0.00101.5
56k_4_51.01*0.00101.5
57k_4_101.01*0.00101.5
58k_4_151.01*0.00101.5
59k_4_201.01*0.00101.5
60k_4_251.01*0.00101.5
61k_4_301.01*0.00101.5
62k_4_351.01*0.00101.5
63k_4_411.01*0.00101.5
64$phi_0$0.0$rad$*0.0001-0.10.1
#cnt,     Time,      |R|
0001,    0.602,       50.5
0002,    1.042,      681.2
0003,    1.523,       13.6
0004,    2.074,       16.1
0005,    2.643,       44.4
0006,    3.223,       11.3
0007,    3.972,        8.9
0008,    4.842,      405.5
0009,    5.441,       25.6
0010,    6.001,       12.5
0011,    6.550,        9.3
0012,    7.120,        8.8
0013,    7.688,       12.7
0014,    8.200,        9.6
0015,    8.687,        8.9
0016,    9.199,        8.7
0017,    9.674,       11.3
0018,   10.206,        9.2
0019,   10.789,        8.7
0020,   11.288,        8.5
0021,   11.763,        8.4
0022,   12.385,        8.1
0023,   12.862,        7.2
0024,   13.375,        5.9
0025,   13.865,        5.7
0026,   14.335,        5.2
0027,   14.831,        4.6
0028,   15.311,        3.6
0029,   15.835,        3.4
0030,   16.414,        3.0
0031,   16.924,        2.8
0032,   17.401,        2.7
0033,   17.910,        2.5
0034,   18.409,        2.6
0035,   18.901,        2.5
0036,   19.421,        2.4
0037,   19.918,        2.3
0038,   20.399,        2.2
0039,   20.876,        3.6
0040,   21.378,        2.6
0041,   21.906,        2.3
0042,   22.458,        2.2
0043,   22.945,        2.2
0044,   23.436,        2.1
0045,   23.929,        2.1
0046,   24.449,        2.0
0047,   24.924,        1.9
0048,   25.466,        1.9
0049,   25.954,        1.9
0050,   26.475,        1.9
0051,   26.960,        1.9
0052,   27.457,        1.9
0053,   27.991,        1.9
0054,   28.489,        1.9
0055,   28.975,        1.9
0056,   29.601,        1.9
0057,   30.145,        1.9
0058,   30.597,        1.9
0059,   31.099,        1.9
0060,   31.590,        1.9
0061,   32.095,        1.9
0062,   32.562,        1.9
0063,   33.025,        1.9
0064,   33.637,        1.9
0065,   34.132,        1.9
0066,   34.648,        1.9
0067,   35.323,        1.9
0068,   35.834,        1.9
0069,   36.313,        1.9
0070,   36.825,        1.9
0071,   37.581,        1.9
0072,   38.076,        1.9
0073,   38.581,        1.9
0074,   39.237,        1.9
0075,   39.934,        1.9
0076,   40.587,        1.9
0077,   41.305,        1.9
0078,   41.960,        1.9
0079,   42.413,      306.9
0080,   43.118,       23.8
0081,   43.767,        5.5
0082,   44.428,        2.6
0083,   44.929,        1.9
0084,   45.472,        1.8
0085,   45.970,        1.8
0086,   46.489,        2.0
0087,   46.996,        1.9
0088,   47.494,        1.8
0089,   48.002,        1.8
0090,   48.513,        1.8
0091,   49.002,        1.8
0092,   49.534,        1.8
0093,   50.053,        1.8
0094,   50.678,        1.8
0095,   51.271,        1.8
0096,   52.007,        1.8
0097,   52.588,        1.8
0098,   53.487,        1.8
0099,   54.222,        1.8
0100,   54.890,        1.8
0101,   55.580,        1.8
0102,   56.360,        1.8
0103,   57.145,        1.8
0104,   57.776,        1.8
0105,   58.480,        1.8
0106,   59.009,        1.8
0107,   59.525,        1.8
0108,   60.027,        1.8
0109,   60.557,        1.8
0110,   61.033,        1.8
0111,   61.564,        1.8
0112,   62.054,        1.8
0113,   62.586,        1.8
0114,   63.080,        1.8
0115,   63.649,      437.5
0116,   64.167,       26.0
0117,   64.642,        7.3
0118,   65.154,        3.3
0119,   65.721,        2.2
0120,   66.242,        1.9
0121,   66.716,        1.8
0122,   67.284,        1.8
0123,   67.777,        1.8
0124,   68.354,        1.8
0125,   68.840,        1.8
0126,   69.358,        1.8
0127,   69.843,        1.8
0128,   70.380,        1.8
0129,   70.853,        1.7
0130,   71.337,        1.7
0131,   71.825,        1.7
0132,   72.407,        3.1
0133,   72.905,        2.1
0134,   73.437,        1.8
0135,   73.979,        1.7
0136,   74.482,        1.7
0137,   74.970,        1.7
0138,   75.453,        1.7
0139,   75.969,        1.7
0140,   76.499,        1.7
0141,   76.993,        1.7
0142,   77.493,        1.7
0143,   77.970,        1.7
0144,   78.573,        1.7
0145,   79.043,        1.7
0146,   79.640,        1.7
0147,   80.127,        1.7
0148,   80.636,        1.7
0149,   81.095,        1.7
0150,   81.583,        1.7
0151,   82.049,        1.7
0152,   82.598,        1.7
0153,   83.071,        1.7
0154,   83.582,        1.7
0155,   84.035,        1.7
0156,   84.556,        1.7
0157,   85.027,        1.7
0158,   85.599,        1.7
0159,   86.080,        1.7
0160,   86.584,        1.7
0161,   87.083,        1.7
0162,   87.579,        1.7
0163,   88.126,        1.7
0164,   88.693,        1.7
0165,   89.186,        1.7
0166,   89.663,        1.7
0167,   90.139,        1.7
0168,   90.650,        1.7
0169,   91.168,        1.7
0170,   91.680,        1.7
0171,   92.221,        1.7
0172,   92.728,        1.7
0173,   93.218,        1.7
0174,   93.739,        1.7
0175,   94.201,        1.7
0176,   94.749,        2.1
0177,   95.234,        1.8
0178,   95.752,        1.7
0179,   96.236,        1.7
0180,   96.821,        1.7
0181,   97.324,        1.7
0182,   97.849,        1.7
0183,   98.329,        1.7
0184,   98.833,        1.7
0185,   99.307,        1.7
0186,   99.843,        1.7
0187,  100.371,        1.7
0188,  100.872,        1.7
0189,  101.349,        1.7
0190,  101.835,        1.7
0191,  102.378,        1.6
0192,  102.955,        1.6
0193,  103.484,        1.6
0194,  103.988,        1.6
0195,  104.663,        2.7
0196,  105.194,        2.0
0197,  105.677,        1.7
0198,  106.159,        1.7
0199,  106.709,        1.6
0200,  107.184,        1.6
0201,  107.678,        1.6
0202,  108.201,        1.6
0203,  108.742,        1.6
0204,  109.213,        1.6
0205,  109.756,        1.6
0206,  110.252,        1.6
0207,  110.744,        1.6
0208,  111.235,        1.6
0209,  111.719,        1.6
0210,  112.214,        1.6
0211,  112.699,        1.6
0212,  113.209,        1.6
0213,  113.701,        1.6
0214,  114.255,        1.6
0215,  114.745,        1.6
0216,  115.262,        1.6
0217,  115.756,        1.6
0218,  116.267,        1.6
0219,  116.749,        1.6
0220,  117.248,        1.6
0221,  117.718,        1.6
0222,  118.219,        1.6
0223,  118.760,        1.6
0224,  119.254,        1.6
0225,  119.818,        1.6
0226,  120.341,        1.6
0227,  120.832,        1.6
0228,  121.368,        1.6
0229,  121.880,        1.6
0230,  122.533,        1.6
0231,  123.041,        1.6
0232,  123.495,        1.6
0233,  123.981,        1.6
0234,  124.490,        1.6
Wall time: 2min 4s

Show and test results


In [16]:
display_opt_params()

# show result
idx = range(len(sections))
display_data_for_test();

update_guess();


Parameters from optimization
IdxDescription$x$
0k_1_-411.05607186044
1k_1_-351.14674232314
2k_1_-301.13577858878
3k_1_-251.12871891243
4k_1_-201.14706612554
5k_1_-151.31098200523
6k_1_-101.3343763375
7k_1_-51.3069849105
8k_1_50.7214486402
9k_1_101.02138245625
10k_1_151.10256258117
11k_1_200.945959037185
12k_1_250.916700758638
13k_1_300.922370248132
14k_1_350.95479115247
15k_1_410.959648903486
16k_2_-410.853196740435
17k_2_-350.838146638497
18k_2_-300.820786274329
19k_2_-250.803495858278
20k_2_-200.810448070977
21k_2_-150.891756761149
22k_2_-100.923326626898
23k_2_-51.07306705324
24k_2_50.652222702978
25k_2_100.652522319834
26k_2_150.787796656255
27k_2_200.723544174305
28k_2_250.731904626233
29k_2_300.750440818738
30k_2_350.791706646492
31k_2_410.860288037378
32k_3_-410.749471750713
33k_3_-350.756621769165
34k_3_-300.72326416791
35k_3_-250.726954929265
36k_3_-200.682289146229
37k_3_-150.742777015667
38k_3_-100.813968116745
39k_3_-50.986442208787
40k_3_50.596217146812
41k_3_100.628969883286
42k_3_150.733605202239
43k_3_200.723943403196
44k_3_250.742363604065
45k_3_300.731295612976
46k_3_350.718153811718
47k_3_410.698768123091
48k_4_-410.600476234357
49k_4_-350.629785114865
50k_4_-300.627901769714
51k_4_-250.655553727362
52k_4_-200.677643818019
53k_4_-150.701579199498
54k_4_-100.631376189235
55k_4_-50.829565055046
56k_4_50.646540564211
57k_4_100.622657883062
58k_4_150.625657490789
59k_4_200.547173876207
60k_4_250.56184226031
61k_4_300.588573899419
62k_4_350.632626157373
63k_4_410.621799340747
64$phi_0$-0.0230671641128
Test Data
IdxStart(s)Spam(s)Description
010.2460.77ramp cmp1 u1
175.5961.09ramp cmp1 d1
2138.0960.18ramp cmp2 u1
3202.9561.00ramp cmp2 d1
4265.3260.77ramp cmp2 d2
5328.6558.41ramp cmp3 u1
6391.2160.35ramp cmp3 d1
7454.1359.00ramp cmp4 u1
8515.9061.14ramp cmp4 d1
9580.1899.42ramp cmp1/3 d1
10683.48100.11ramp cmp1/3 d2
11785.5499.51ramp cmp1/3 u1
12889.1298.65ramp cmp2/4 d1
13992.0897.47ramp cmp2/4 u1
141098.54117.71ramp cmpall u1
151220.28120.22ramp cmpall u2
161343.59121.20ramp cmpall d1

In [17]:
res_params = res['x']
params = param0[:]
for i,j in enumerate(opt_idx):
    params[j] = res_params[i]

k1 = np.array(params[0:angles_num])
k2 = np.array(params[angles_num:angles_num*2])
k3 = np.array(params[angles_num*2:angles_num*3])
k4 = np.array(params[angles_num*3:angles_num*4])

Clda_cmp1 = Clda_cmp*0.00436332313*k1*angles
Clda_cmp2 = Clda_cmp*0.00436332313*k2*angles
Clda_cmp3 = Clda_cmp*0.00436332313*k3*angles
Clda_cmp4 = Clda_cmp*0.00436332313*k4*angles

print('angeles = ')
print(angles)
print('Clda_cmpx = ')
print(np.vstack((Clda_cmp1,Clda_cmp2,Clda_cmp3,Clda_cmp4)))

%matplotlib inline
plt.figure(figsize=(12,8),dpi=300)
plt.plot(angles,  Clda_cmp1, 'r')
plt.plot(angles,  Clda_cmp2, 'g')
plt.plot(angles,  Clda_cmp3, 'b')
plt.plot(angles,  Clda_cmp4, 'm')
plt.xlabel('$\delta_{a,cmp}$')
plt.ylabel('$C_{l \delta a,cmp}$')
plt.show()


angeles = 
[-41, -35, -30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30, 35, 41]
Clda_cmpx = 
[[ 0.05968291  0.0553231   0.04696643  0.03889542  0.03162213  0.0271057
   0.01839293  0.00900769 -0.00497219 -0.01407865 -0.02279645 -0.02607804
  -0.03158932 -0.03814162 -0.04606267 -0.05423365]
 [ 0.04821761  0.0404353   0.03394095  0.0276883   0.0223423   0.01843785
   0.01272706  0.00739553 -0.00449509 -0.00899431 -0.01628838 -0.01994654
  -0.02522128 -0.03103204 -0.03819486 -0.04861837]
 [ 0.04235569  0.03650224  0.02990824  0.02505072  0.01880923  0.01535756
   0.01121967  0.00679852 -0.0041091  -0.00866967 -0.01516793 -0.01995755
  -0.02558169 -0.03024035 -0.0346464  -0.03949022]
 [ 0.03393535  0.03038317  0.02596484  0.02259024  0.01868117  0.01450576
   0.00870284  0.00571733 -0.00445593 -0.00858266 -0.01293602 -0.0150844
  -0.01936097 -0.02433856 -0.03052023 -0.0351404 ]]

In [14]:
toggle_inputs()
button_qtconsole()



In [15]:
(-0.05-0.05)/(80/57.3)


Out[15]:
-0.07162500000000001

In [16]:
Clda_cmp/4


Out[16]:
-0.075975

In [ ]: