예제 #1
0
파일: myPODEM_v2.py 프로젝트: cpr888/PODEM
def write_result():
	global G	
	global untestable_flag
	global faulty_edge_list
	output =str(faulty_edge_list) +"\n"
	print "faulty_edge_list",faulty_edge_list
	for item in G.edges(data=True):
					#print item
			if(G.nodes(data=True)[item[0]]['type'] =='input'):# or G.nodes(data=True)[item[1]]['type'] =='output'):
					
					print item[0],item[2]['value_non_fault'] ,item[2]['value_faulty']
#					output +=str(item[0])+" " + str(item[1])+" " + str(item[2]['value_non_fault'])+" " +str(item[2]['value_faulty']) +"\n" 
					output +=str(item[0])+"  input value =" + str(item[2]['value_non_fault'])+"\n" 	
			
			if(G.nodes(data=True)[item[1]]['type'] =='output'):
					
					print item[0],item[2]['value_non_fault'] ,item[2]['value_faulty']
#					output +=str(item[0])+" " + str(item[1])+" " + str(item[2]['value_non_fault'])+" " +str(item[2]['value_faulty']) +"\n" 
					output +=str(item[0])+": non faulty output value =" + str(item[2]['value_non_fault'])+",  faulty value=" +str(item[2]['value_faulty']) +"\n" 	
	

	if (untestable_flag==1):
		output += " Untestable/Redundant fault \n"
	else:
		output += "\n"

	f = open("PODEM_output.txt", 'a+')
	f.write(output)
	f.close()
예제 #2
0
파일: myPODEM_v2.py 프로젝트: cpr888/PODEM
def Initialising() :
	global G 
	for node in G.nodes(data=True):
		if( node[1]['type']!= 'input' and node[1]['cc0'] == 1 and node[1]['cc1'] == 1):
			Controllability_init(node[0])
	print "********************************************initialised_controllability**************************"	
	for node in G.nodes(data=True):
		if (node[1]['type']!='check'):
			flag = 0
#			print "inside Observability", node
			for incoming_edge in G.in_edges(node[0]):
				if G.edges[incoming_edge]['CO'] == 'x':
					flag = 1
			if flag==1:
				Observability_init(node[0])
	print "********************************************Observability_Initialised**************************"	
예제 #3
0
파일: myPODEM_v2.py 프로젝트: cpr888/PODEM
def assign_undefined_ip(node_D_fronteir):
		#Assigning a non-controlling value to the gate
	print "-------------------------------------assign_undefined_ip------------------------------------------"
	print "node_D_fronteir",node_D_fronteir 
	global G
	print "NODES" , G.nodes(data=True)
	gate_type =G.nodes[node_D_fronteir]['gate_type']
	gate_ip_edge = list(G.in_edges(nbunch=node_D_fronteir, data=False))
	#new_D_fronteir_edge=list(list(G.out_edges(nbunch=node_D_fronteir, data=False))[0])
	if (gate_type =='not'):
		#print "gate_ip_edge",list(gate_ip_edge[0])
		return list(gate_ip_edge[0])
	else:
		if(gate_type=='and' or  gate_type=='nand'):
			control_val =0
		elif(gate_type=='or' or  gate_type=='nor'):
			control_val =1
		for i in range(len(gate_ip_edge)):
				if(G.edges[gate_ip_edge[i]]['value_non_fault']=='x' or G.edges[gate_ip_edge[i]]['value_faulty']=='x'):
					if (gate_type == 'xor' or gate_type == 'xnor') and (G.node[gate_ip_edge[i][0]]['cc0'] < G.edges[gate_ip_edge[i]][0]['cc1']):
       						control_val = 1
   					else:
       						control_val = 0
					return gate_ip_edge[i],str(int(not control_val))
	return 0
예제 #4
0
파일: myPODEM_v2.py 프로젝트: cpr888/PODEM
def primary_output():
	POedge_list= []
	for item in G.nodes(data=True):
		if(item[1]['type']=='output'):
			list_outedge =list(G.in_edges(nbunch=item[0], data=False))	
			POedge_list.append(list_outedge[0])
	return POedge_list