def plot_healthy_and_damaged_at_operating_condition(): fig,axs = plt.subplots(2,2) response_list = [] for oc in enumerate([5,10]): for health in enumerate([0, 0.5 ]): # oc = (oc[0],10) # health = (health[0],0) stiffness_reduction = np.array([health[1]]) obj = g_maps.Chen2011(theta, stiffness_reduction) t = obj.constants["t_range"][obj.samples_before_fault:] #axs[oc[0],health[0]].text(0,0,str(stiffness_reduction[0]) y = obj.get_y(np.array([oc[1]])) response_list.append(y) max_oc_0 = np.max([np.max(response_list[0]), np.max(response_list[1])]) min_oc_0 = np.min([np.min(response_list[0]), np.min(response_list[1])]) max_oc_1 = np.max([np.max(response_list[2]), np.max(response_list[3])]) min_oc_1 = np.min([np.min(response_list[2]), np.min(response_list[3])]) count = 0 for oc in enumerate(["5 Nm","10 Nm"]): for health in enumerate(["Healthy","Damaged"]): axs[oc[0], health[0]].plot(t,response_list[count],"k") axs[oc[0], health[0]].set_xlabel("time [s]") axs[oc[0], health[0]].set_ylabel(r"ring acceleration [m/$s^2$]") axs[oc[0], health[0]].set_title(health[1] + " " + oc[1]) if oc[0]>0: axs[oc[0], health[0]].set_ylim(min_oc_1,max_oc_1) axs[oc[0], health[0]].set_ylabel(r"acceleration [m/$s^2$]") else: axs[oc[0], health[0]].set_ylim(min_oc_0,max_oc_0) axs[oc[0], health[0]].set_ylabel(r"acceleration [m/$s^2$]") count+=1 # Plot the time varying stiffness # tvms = np.array([obj.tvms(ti, stiffness_reduction) for ti in t]) # # plt.plot(t,tvms, label = str(stiff_red) + " N/m reduction") # plt.legend(loc= "lower right") #plt.subplot_tool() plt.subplots_adjust(wspace=0.4, hspace=0.53) save_plot_to_directory("chen_2011_response") return
def plot_healthy_and_damged_TVMS(): plt.figure() plt.xlabel("Time [s]") plt.ylabel("Meshing stiffness [N/m]") for stiff_red in np.linspace(0,1,4): stiffness_reduction = np.array([stiff_red])*0.5 obj = g_maps.Chen2011(theta, stiffness_reduction,cycles_before_fault=2) t = np.linspace(0,obj.constants["t_range"][-1]*2,1000) # Plot the time varying stiffness k_at_first_transition_end = obj.smooth_square(obj.first_transition_end_time) - obj.x*1e8 k_at_second_transition_start = obj.smooth_square(obj.second_transition_start_time) - obj.x*1e8 first_transition_gradient = (obj.k_at_first_transition_start - k_at_first_transition_end) /obj.transition_time second_transition_gradient = (k_at_second_transition_start - obj.k_at_second_transition_end) / obj.transition_time tvms = np.array([obj.tvms(ti, first_transition_gradient,second_transition_gradient,k_at_second_transition_start) for ti in t]) plt.plot(t,tvms, label = str(np.round(stiffness_reduction[0],3)) + "e8 N/m reduction") plt.legend(loc= "lower right") save_plot_to_directory("TVMS_20201119") return
import numpy as np t_start = time.time() # Define the true model parameters theta_real = np.array([1.116, 6.405]) # theta = [m_ring, I_ring, k1 ,k2] # I is adjusted for 1e-3 phi_real = np.array([np.sin(np.deg2rad(20))]) # Measurement model transfer function is multiplication by constant. # Fraction of pressure angle # Define healthy state of health x_real_d0 = np.array([0]) # 0 N/m mean stiffness reduction (healthy) # Define the real measurement model (Independent of health state) h_real = h_maps.Constant(phi_real) # Define the real physics based model g for healthy and damaged states g_real_d0 = g_maps.Chen2011(theta_real, x_real_d0) # Define the system sys_real_d0 = sys_model.System(g_real_d0, h_real) # Define the operating conditions where measurements were made c = [np.array([i]) for i in np.linspace(10, 1, 4) * 1] # c is applied moment 10Nm-100Nm #c = [np.array([i]) for i in [5]] # c is applied moment 10Nm-100Nm # Get the Measured data under healthy conditions noise = {"sd": 0.1} # Small noise z_real_d0 = sys_real_d0.simulate(c, noise=noise, plot=True) # INFO: Toggle if plot #plt.title("Measured data at healthy condition") #plt.ylabel("Acceleration of ring gear") #plt.show()
import matplotlib.pyplot as plt import src.models.h_mappings as h_maps import src.models.g_mappings as g_maps import src.models.system_modeller as sys_model import numpy as np #1 get tvms with a fault # if t_fault_start<t<t_fault_end # use a completely different profile # Just make sure your synchronize the periods obj = g_maps.Chen2011(np.array([22]), np.array([33])) opperating_condition = 12 t = obj.constants["t_range"] frequency = 10 #Hz k = np.array([obj.tvms(t_inc, 500) for t_inc in t]) plt.figure() plt.plot(t, k) # y = obj.get_y(opperating_condition) # Plot the time varying stiffness # Plot the lumped mass response. First transients and then the steady state response # t = obj.constants["t_range"] # # plt.figure() # plt.plot(t, y) # plt.xlabel("time [s]") # plt.ylabel(r"Measured ring gear acceleration [$m/s^2$]")