Commit 606cf427 authored by Georgios Dagkakis's avatar Georgios Dagkakis

methods that EventGenerator calls do not need to take arguments as dicts

parent cc5d571e
...@@ -56,7 +56,7 @@ class EventGenerator(ObjectInterruption): ...@@ -56,7 +56,7 @@ class EventGenerator(ObjectInterruption):
if self.stop: if self.stop:
if self.env.now>self.stop: if self.env.now>self.stop:
break break
self.method(self.argumentDict) #call the method self.method(**self.argumentDict) #call the method
yield self.env.timeout(self.interval) #wait for the predetermined interval yield self.env.timeout(self.interval) #wait for the predetermined interval
......
...@@ -134,11 +134,11 @@ class G: ...@@ -134,11 +134,11 @@ class G:
# ======================================================================= # =======================================================================
# method to move entities exceeding a certain safety stock # method to move entities exceeding a certain safety stock
# ======================================================================= # =======================================================================
def moveExcess(argumentDict={}): def moveExcess(consumption=1,safetyStock=70, giverId=None, receiverId=None):
giver=findObjectById(argumentDict.get('from', None)) giver=findObjectById(giverId)
receiver=findObjectById(argumentDict.get('to', None)) receiver=findObjectById(receiverId)
safetyStock=int(argumentDict.get('safetyStock', 10)) safetyStock=int(safetyStock)
consumption=int(argumentDict.get('consumption', 1)) consumption=int(consumption)
if giver and receiver: if giver and receiver:
if len(giver.getActiveObjectQueue())>safetyStock: if len(giver.getActiveObjectQueue())>safetyStock:
giver.receiver=receiver giver.receiver=receiver
...@@ -285,8 +285,9 @@ def setWIP(entityList): ...@@ -285,8 +285,9 @@ def setWIP(entityList):
if not (entity.currentStation.initialWIP.triggered): if not (entity.currentStation.initialWIP.triggered):
entity.currentStation.initialWIP.succeed(G.env) entity.currentStation.initialWIP.succeed(G.env)
from Exit import Exit
def countIntervalThroughput(argumentDict={}): def countIntervalThroughput():
from Exit import Exit
currentExited=0 currentExited=0
for obj in G.ObjList: for obj in G.ObjList:
if isinstance(obj, Exit): if isinstance(obj, Exit):
......
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
"_class": "Dream.EventGenerator", "_class": "Dream.EventGenerator",
"argumentDict": { "argumentDict": {
"consumption": 20, "consumption": 20,
"from": "Q2", "giverId": "Q2",
"safetyStock": 70, "safetyStock": 70,
"to": "E1" "receiverId": "E1"
}, },
"interval": "60", "interval": "60",
"method": "Dream.Globals.moveExcess", "method": "Dream.Globals.moveExcess",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment