Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-plantsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sellers
python-plantsim
Commits
e7450a1e
Commit
e7450a1e
authored
2 years ago
by
KeSellers
Browse files
Options
Downloads
Patches
Plain Diff
database, graph_utils
parent
34f3f879
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
API.py
+11
-21
11 additions, 21 deletions
API.py
DataBase.py
+1
-0
1 addition, 0 deletions
DataBase.py
graph_utils.py
+20
-0
20 additions, 0 deletions
graph_utils.py
with
32 additions
and
21 deletions
API.py
+
11
−
21
View file @
e7450a1e
...
...
@@ -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
This diff is collapsed.
Click to expand it.
DataBase.py
+
1
−
0
View file @
e7450a1e
...
...
@@ -19,6 +19,7 @@ Einzelstation = {
"
Rüstzeit
"
,
"
Erholzeit
"
,
"
Zykluszeit
"
,
],
"
PackstationRitzelwellen
"
:{
"
name
"
:
"
PackstationRitzelwellen
"
,
"
origin
"
:
"
Lager
"
,
...
...
This diff is collapsed.
Click to expand it.
graph_utils.py
0 → 100644
+
20
−
0
View file @
e7450a1e
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment