Example #1
0
# 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()

with open("real_d0_20201101.pkl", "wb") as fname:
    pickle.dump(sys_real_d0, fname)
# Define different states of health (Stiffness of k1)
x_real_d0 = np.array([100])  # Healthy condition
x_real_d1 = np.array([50])  # Damaged condition

# Define the real physics based model g for healthy and damaged states
g_real_d1 = g_maps.InitCond2DOFv2G(
    theta_real, x_real_d1)  # notice v2 (version 2 is more flexible than 1)
g_real_d0 = g_maps.InitCond2DOFv2G(theta_real, x_real_d0)

# Define the real measurement model (Independent of health state)
h_real = h_maps.InitCond2DOFv1H(
    phi_real)  # still v1 (constant) measurement func

# Define the system for healthy and damaged states
sys_real_d0 = sys_model.System(g_real_d0, h_real)
sys_real_d0.get_parameter_summary(print_addition="True system parameters")
sys_real_d1 = sys_model.System(g_real_d1, h_real)

# Define the operating conditions measured at
c = [np.array([i]) for i in np.linspace(0.1, 1, 10, dtype="float32") * 150
     ]  # c in this case is force

# Get the measured data under healthy conditions
noise = {"sd": 5}
z_real_d0 = sys_real_d0.simulate(c, noise=noise, plot=True)
plt.title("Measured data at healthy condition")
plt.ylabel("Acceleration of mass 1")
plt.savefig("..\\reports\\healthy_measured_1DOF_for_2DOF_all_param2.png")
plt.show()