def test_generate_network_evolution_condition(): t_start = time.time() T = 100 # gpath = os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + '.') + os.sep + '' gpath = networkEvolutionObjectModel.test() evol = generate_network_evolution_condition(gpath, T) t_end = time.time() print(t_end - t_start) evol.to_excel('e.xlsx') return evol
def test_generate_failure_state_single_component_single_failuremode(): T = 100 g = networkEvolutionObjectModel.test() ndf = g.graph["node_info"] fdf = g.graph["fail_info"] ndf = pd.merge(ndf, fdf, on="Type") ndf = ndf.rename(columns={'NodeID': "ID"}) T, cdf = read_data(g, T) x = cdf.iloc[0] return generate_failure_state_single_component_single_failuremode( x, T, ndf)
def test_single_componet_multi_failmode_multitimes(): T = 10000 N = 10 g = networkEvolutionObjectModel.test() T, cdf = read_data(g, T) mtbf_df = pd.DataFrame(columns=list(range(N))) component_df = cdf[['ID', 'Type', 'MTBF', 'MTTR']] for i in range(N): test_component_info = generate_failure_state_multi_component_single_failuremode( cdf, T) temp = test_component_info.apply(lambda x: test_MTBF(x, T), axis=1) mtbf_df[i] = temp component_df['MTBF_CAL'] = mtbf_df.apply(np.mean, axis=1) print(component_df)
def test_read_data(): g = networkEvolutionObjectModel.test() t, cdf = read_data(g, 10) print(t) print(cdf)
def test_update_application_to_components(): g = networkEvolutionObjectModel.test() cdf = update_application_to_components(g) return cdf
def test_network_evolutin_rules_analysis_for_evolution_condition(): g = networkEvolutionObjectModel.test() evol = pd.DataFrame() network_evolutin_rules_analysis_for_evolution_condition(g, evol_input=evol)