# ERR INIT switch_r_nr print ('\n ERR INIT switch_r_nr \nswitch_r_nr must be 1 or 0 !!!') # </editor-fold> # test plt.plot(sampled_data_FC1[:,1]) plt.plot(sampled_data_FC2[:,1]) plt.show() ## use the svr fit the FC1-FC2 and get the FC2 predict value FC2_prog_pred=svr_p.svr_predict(sampled_data_FC1,sampled_data_FC2,len_real=len_prognosis_FC2,len_train=len_learn_FC2) ## get the init parameter para_FC1=sip.get_init_para(sampled_data_FC1,re_calc_len=len_prognosis_FC1) para_FC2=sip.get_init_para(sampled_data_FC2,re_calc_len=len_prognosis_FC2) #para_FC1_minus_FC2=sip.get_init_para(sampled_data_FC1_minus_FC2,re_calc_len=len_prognosis_FC2) print ('\n get the init parameter successfully!') ## prognostics method 1: particle filter to parameter identification # ----------------------------------------------------------------------------------- ### model_linear good parameter, should save [[filter_data,real_fil],[predictions_data,real_pred],[fil_pred,real_all]]=rp_ps.Run_ParticleFilter( sampled_data=sampled_data_FC2, x_svr_pred=FC2_prog_pred,para=para_FC2, x_process_noise_sigma=0.2,
x is the system's state, and it's derivatives are some settings about the state. alpha, beta are the parameters, and their derivations are some settings about the parameters. z is the system's observation. ''' import numpy as np import pf_class as PF_C import matplotlib.pyplot as plt import read_sam_data as rsd import solve_init_para as sip len_prognostic = 1000 sampled_data_FC1=rsd.re_sam_data(FC='FC1') sampled_data_FC2=rsd.re_sam_data(FC='FC2') para=sip.get_init_para(sampled_data_FC1,re_calc_len=len_prognostic) def Run_ParticleFilter(sampled_data,para, x_process_noise_sigma=0.02,beta_process_noise_sigma=0.02, sensor_std_err = 0.01, x_init_gauss_sigma=0.1,beta_init_gauss_sigma=0.1, x_init_uniform_bound=0.1,beta_init_uniform_bound=0.01, len_prognostic=len_prognostic,num_particles=2000,iterations=100, ): t_real = sampled_data[0:len_prognostic,0] x_obs= sampled_data[0:len_prognostic,1] para_0=para[0][4] para_linear_beta=para[1][4,:] x_init_range=np.array([x_obs[0]-x_init_uniform_bound,x_obs[0]+x_init_uniform_bound]) beta_init_range=np.array([para_0-beta_init_uniform_bound,para_0+beta_init_uniform_bound])