def neg_monotonicity(self, data): ''' Negative Prognosability: Characterizes an decreasing trend. Liao, Linxia, Wenjing Jin, and Radu Pavel. "Enhanced restricted Boltzmann machine with prognosability regularization for prognostics and health assessment." IEEE Transactions on Industrial Electronics 63.11 (2016): 7076-7083. ''' utils = Utils() temp1 = np.diff(data, axis=0) temp2 = np.diff(data,2,axis=0) score = (utils.count_neg(temp1)/(data.shape[0]-1) + utils.count_neg(temp2)/(data.shape[0]-2))/2 return score
def monotonicity(self, data): ''' Monotonicity characterizes an increasing or decreasing trend. It can be measured by the absolute difference of “positive” and “negative” derivatives for each feature. Javed, Kamran, et al. "Enabling health monitoring approach based on vibration data for accurate prognostics." IEEE Transactions on Industrial Electronics 62.1 (2014): 647-656. Monotonicity will only the metrics with time ''' utils = Utils() temp = np.diff(data, axis=0) score = np.abs(utils.count_pos(temp)-utils.count_neg(temp))/(data.shape[0]-1) return score
def __init__(self): utils = Utils() # i-th data-set out of 218 data-sets # step 1: Get Features soh = utils.get_features('battery') Y = soh X = np.array([i for i in range(len(soh))]).reshape(len(soh), 1) # initial observation obs = 1 train_X = X[:obs] train_y = Y[:obs] test_X = X test_y = Y self.model = BatteryRULModel(train_y, train_y) # use initial 100 obs to prepare model self.model.t_incipient = 0 self.model.t_current = obs - 1 self.model.initialize_model() self.i = 0
rul = round(rul, 2) if (rul_ready and self.i >= alarm_index): status = 'ALARM' action = 'REPLACE' self.model.observe(new_obs.reshape(1, 1)) self.model.update() return Yp, Vp, status, action, rul def date_diff_in_Seconds(dt2, dt1): timedelta = dt2 - dt1 return timedelta.days * 24 * 3600 + timedelta.seconds utils = Utils() # i-th data-set out of 218 data-sets # step 1: Get Features soh = utils.get_features('battery')[1:] # updated_times = [] # for t in times: # time_string = (str(t.squeeze())) # t_ = time_string.split(',', 2) # date_string = t_[0] # time_string = t_[1] # day, month, year = date_string.split(' ', 3) # h, m, s = time_string.split(':', 3) # if (month == 'Apr'): # month = '04'
def observe(self, X): # new raw observation self.obs = np.concatenate((self.obs, X), axis=0) self.HI = self.health_indicator(self.obs) # new observations return self.HI def predict(self, X): Yp, Vp = DegradationModel.predict(self, X) return Yp, Vp def update(self): l = len(self.obs) X = np.array([i for i in range(l)]).reshape(l, 1) DegradationModel.update(self, X, self.HI) utils = Utils() # i-th data-set out of 218 data-sets # step 1: Get Features all_observations = utils.get_features('turboengine') # step 2: Identify the health indicator # use the initial data (normal) for feature fusion old_obs = all_observations[:120] # assuming first 50 datapoints are normal new_obs = all_observations[120:] train_HI_data = old_obs[:100] obs = old_obs[100:] model = TurboEngineRULModel(train_HI_data, obs) # use initial 100 obs to prepare model
Yp, Vp = GPRDegradationModel.predict(self, X) self.t_current += next_steps return Yp, Vp def initialize_model(self): GPRDegradationModel.__init__(self, self.HI[self.t_incipient]) def update(self): l = self.t_current X = np.array([i for i in range(self.t_current)]).reshape(l, 1) GPRDegradationModel.update( self, X, self.HI[self.t_incipient:self.t_incipient + self.t_current]) utils = Utils() # i-th data-set out of 218 data-sets # step 1: Get Features all_observations = utils.get_features('bearing') data = all_observations[:, 0] zscore = stats.zscore(data) plt.plot(zscore) plt.show() # step 2: Identify the health indicator # use the initial data (normal) for feature fusion # old_obs = all_observations[:600] # assuming these datapoints are normal # new_obs = all_observations[600:]