summaryrefslogtreecommitdiff
path: root/esds/platform.py
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-06-28 15:46:15 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-06-28 15:46:15 +0200
commitf84359ec7a79c07bc2ae86ad81db823e1912a9e8 (patch)
tree2c9269c65456941c55270d5a2ff110c4d472d07b /esds/platform.py
parente95d50d0ff8465988841a319efb3829109c154d1 (diff)
Add nodes groups features
Diffstat (limited to 'esds/platform.py')
-rw-r--r--esds/platform.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/esds/platform.py b/esds/platform.py
index 341ca13..40f8301 100644
--- a/esds/platform.py
+++ b/esds/platform.py
@@ -58,6 +58,7 @@ class YAMLPlatformFile:
"node_count": 0,
"implementations": [],
"arguments": [],
+ "groups": dict(),
"interfaces": dict()
}
@@ -145,6 +146,14 @@ class YAMLPlatformFile:
self.default["node_count"]=nodes["count"]
else:
self.parsing_error("node count not provided")
+ if "groups" in nodes:
+ if type(nodes["groups"]) != list:
+ self.parsing_error("nodes groups should be a list")
+ for grp in nodes["groups"]:
+ words=grp.split()
+ r=UnitsParser.node_range(words[0],self.default["node_count"])
+ for node in r:
+ self.default["groups"][node]=words[1]
if "implementations" in nodes:
if type(nodes["implementations"]) != list:
self.parsing_error("nodes implementations should be a list of file path")
@@ -210,7 +219,10 @@ class YAMLPlatformFile:
##### Create simulator
simulator=Simulator(self.default["interfaces"])
for node_id in range(0,self.default["node_count"]):
- simulator.create_node(self.default["implementations"][node_id], args=self.default["arguments"][node_id])
+ if node_id in self.default["groups"]:
+ simulator.create_node(self.default["implementations"][node_id], args=self.default["arguments"][node_id],grp=self.default["groups"][node_id])
+ else:
+ simulator.create_node(self.default["implementations"][node_id], args=self.default["arguments"][node_id])
##### Run simulation
simulator.run(
breakpoints=self.default["breakpoints"],