Skip to content
Snippets Groups Projects
Commit e7450a1e authored by KeSellers's avatar KeSellers
Browse files

database, graph_utils

parent 34f3f879
No related branches found
No related tags found
No related merge requests found
......@@ -3,31 +3,21 @@ from plantsim.table import Table
import networkx as nx
from DataBase import Lager,Einzelstation,Quelle,Puffer
from api_utils import build_model_edges, build_model_nodes
from graph_utils import draw_edges,draw_graph,draw_nodes
plantsim = Plantsim(version='', license_type='Student',visible=False)
plantsim.load_model("C:\\Users\\selle\\Desktop\\Masterarbeit\\001_Plant_simulation\\Simulation.spp")
plantsim.set_path_context(".Models.Lager")
plantsim.get_value()
#Lager_nodes = build_model_nodes(Lager,plantsim)
#Lager_edges = build_model_edges(Lager,Lager_nodes)
#plantsim.set_event_controller()
#plantsim.start_simulation()
#plantsim.CloseModel("C:\\Users\\selle\\Desktop\\Masterarbeit\\001_Plant_simulation\\Simulation.spp")
Lager_nodes = build_model_nodes(Lager,plantsim)
Lager_edges = build_model_edges(Lager,Lager_nodes)
#Lager_graph = nx.DiGraph()
#Lager_graph = draw_nodes(Lager_graph,Lager_nodes)
#Lager_graph = draw_edges(Lager_graph,Lager_edges)
#draw_graph(Lager_graph)
Lager_graph = nx.Graph()
for node in Lager_nodes:
for k, v in node.items():
if k=="name":
name = v
Lager_graph.add_node(v)
break
for edge in Lager_edges:
if edge :
Lager_graph.add_edge(edge[0],edge[1])
import matplotlib.pyplot as plt
nx.draw_networkx(Lager_graph,with_labels=True)
#nx.draw_planar(Lager)
plt.show()
\ No newline at end of file
......@@ -19,6 +19,7 @@ Einzelstation = {
"Rüstzeit" ,
"Erholzeit" ,
"Zykluszeit" ,
],
"PackstationRitzelwellen":{ "name":"PackstationRitzelwellen",
"origin" : "Lager",
......
import matplotlib.pyplot as plt
import networkx as nx
def draw_nodes(graph,nodes):
for node in nodes:
for k, v in node.items():
if k=="name":
name = v
graph.add_node(v)
break
return graph
def draw_edges(graph,edges):
for edge in edges:
if edge :
graph.add_edge(edge[0],edge[1])
return graph
def draw_graph(graph):
nx.draw_networkx(graph,with_labels=True)
plt.show()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment