Commit f74adbb2 authored by Georgios Dagkakis's avatar Georgios Dagkakis

main script to pass the environment as argument

parent 4f304d49
...@@ -35,8 +35,9 @@ from ManPyObject import ManPyObject ...@@ -35,8 +35,9 @@ from ManPyObject import ManPyObject
class CoreObject(ManPyObject): class CoreObject(ManPyObject):
class_name = 'Dream.CoreObject' class_name = 'Dream.CoreObject'
def __init__(self, id, name, **kw): def __init__(self, environment,id, name, **kw):
ManPyObject.__init__(self,id,name) ManPyObject.__init__(self,id,name)
self.environment=environment
self.objName = name self.objName = name
# lists that hold the previous and next objects in the flow # lists that hold the previous and next objects in the flow
self.next=[] #list with the next objects in the flow self.next=[] #list with the next objects in the flow
......
...@@ -37,15 +37,15 @@ class Exit(CoreObject): ...@@ -37,15 +37,15 @@ class Exit(CoreObject):
family='Exit' family='Exit'
def __init__(self, id, name, cancelCondition={},**kw): def __init__(self, environment,id, name, cancelCondition={},**kw):
self.type="Exit" # XXX needed ? self.type="Exit" # XXX needed ?
CoreObject.__init__(self, environment,id, name)
#lists to hold statistics of multiple runs #lists to hold statistics of multiple runs
self.Exits=[] self.Exits=[]
self.UnitExits=[] self.UnitExits=[]
self.Lifespan=[] self.Lifespan=[]
self.TaktTime=[] self.TaktTime=[]
# if input is given in a dictionary # if input is given in a dictionary
CoreObject.__init__(self, id, name)
self.cancelCondition=cancelCondition self.cancelCondition=cancelCondition
def initialize(self): def initialize(self):
......
...@@ -217,9 +217,9 @@ def createObjectResourcesAndCoreObjects(environment,json_data): ...@@ -217,9 +217,9 @@ def createObjectResourcesAndCoreObjects(environment,json_data):
if issubclass(objectType, CoreObject): if issubclass(objectType, CoreObject):
# remove data that has to do with wip or object interruption. CoreObjects do not need it # remove data that has to do with wip or object interruption. CoreObjects do not need it
inputDict=dict(element) inputDict=dict(element)
inputDict['environment']=environment
# create the CoreObject # create the CoreObject
coreObject=objectType(**inputDict) coreObject=objectType(**inputDict)
coreObject.environment=environment
environment.ObjList.append(coreObject) environment.ObjList.append(coreObject)
# update the nextIDs list of the object # update the nextIDs list of the object
coreObject.nextIds=getSuccessorList(element['id']) coreObject.nextIds=getSuccessorList(element['id'])
......
...@@ -37,10 +37,10 @@ class Queue(CoreObject): ...@@ -37,10 +37,10 @@ class Queue(CoreObject):
#=========================================================================== #===========================================================================
# the __init__ method of the Queue # the __init__ method of the Queue
#=========================================================================== #===========================================================================
def __init__(self, id='', name='', capacity=1, isDummy=False, schedulingRule="FIFO", def __init__(self, environment,id='', name='', capacity=1, isDummy=False, schedulingRule="FIFO",
level=None, gatherWipStat=False, **kw): level=None, gatherWipStat=False, **kw):
self.type="Queue" # String that shows the type of object self.type="Queue" # String that shows the type of object
CoreObject.__init__(self, id, name) CoreObject.__init__(self, environment,id, name)
capacity=float(capacity) capacity=float(capacity)
if capacity<0 or capacity==float("inf"): if capacity<0 or capacity==float("inf"):
self.capacity=float("inf") self.capacity=float("inf")
......
...@@ -82,7 +82,7 @@ class Source(CoreObject): ...@@ -82,7 +82,7 @@ class Source(CoreObject):
#=========================================================================== #===========================================================================
# the __init__method of the Source class # the __init__method of the Source class
#=========================================================================== #===========================================================================
def __init__(self, id, name, interArrivalTime=None, entity='Dream.Part',**kw): def __init__(self, environment,id, name, interArrivalTime=None, entity='Dream.Part',**kw):
# Default values # Default values
if not interArrivalTime: if not interArrivalTime:
interArrivalTime = {'Fixed': {'mean': 1}} interArrivalTime = {'Fixed': {'mean': 1}}
...@@ -90,7 +90,7 @@ class Source(CoreObject): ...@@ -90,7 +90,7 @@ class Source(CoreObject):
interArrivalTime['Normal'].get('max', None) is None: interArrivalTime['Normal'].get('max', None) is None:
interArrivalTime['Normal']['max'] = interArrivalTime['Normal']['mean'] + 5 * interArrivalTime['Normal']['stdev'] interArrivalTime['Normal']['max'] = interArrivalTime['Normal']['mean'] + 5 * interArrivalTime['Normal']['stdev']
CoreObject.__init__(self, id, name) CoreObject.__init__(self, environment,id, name)
# properties used for statistics # properties used for statistics
self.totalinterArrivalTime = 0 # the total interarrival time self.totalinterArrivalTime = 0 # the total interarrival time
self.numberOfArrivals = 0 # the number of entities that were created self.numberOfArrivals = 0 # the number of entities that were created
......
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