def Build(state): aux = [] aux.append(state) for cada in aux: FS = Step1(state) aux = [] for each in FS: eachname = DiagnoserFunctions.GetNextStatesInNames(str(each)) if DiagnoserFunctions.IsNormal(eachname) == True: if DiagnoserFunctions.IsOnlySelfloop(each) == 0: x = Step1(each) for cada in x: FS.append(str(cada)) elif DiagnoserFunctions.IsCertain(eachname) == True: FCs.append(str(each)) elif DiagnoserFunctions.IsUncertain(eachname) == True: FUax.append(str(each))
def IsNormalCycle(diag_statestring_IDs): # find uncertain loop in a given string # mark all uncertain states on each string NormalCycle = False i = 0 Eventos_falhas = list() while i < len(diag_statestring_IDs): j = 0 for each in diag_statestring_IDs[i]: if DiagnoserFunctions.GetNextStatesInID(each)[0] == each or len(DiagnoserFunctions.GetNextStatesInID(each)) == 0: name = DiagnoserFunctions.GetStateName(each) if DiagnoserFunctions.IsNormal(name): NormalCycle = True Eventos_falhas.append(diag_statestring_IDs[i][j]) j += 1 i += 1 if NormalCycle: return NormalCycle, Eventos_falhas a = '-1' Eventos_falhas.append(a) return NormalCycle, Eventos_falhas