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
class CoreObject(ManPyObject):
class_name = 'Dream.CoreObject'
def __init__(self, id, name, **kw):
def __init__(self, environment,id, name, **kw):
ManPyObject.__init__(self,id,name)
self.environment=environment
self.objName = name
# lists that hold the previous and next objects in the flow
self.next=[] #list with the next objects in the flow
......
......@@ -37,15 +37,15 @@ class Exit(CoreObject):
family='Exit'
def __init__(self, id, name, cancelCondition={},**kw):
def __init__(self, environment,id, name, cancelCondition={},**kw):
self.type="Exit" # XXX needed ?
CoreObject.__init__(self, environment,id, name)
#lists to hold statistics of multiple runs
self.Exits=[]
self.UnitExits=[]
self.Lifespan=[]
self.TaktTime=[]
# if input is given in a dictionary
CoreObject.__init__(self, id, name)
self.cancelCondition=cancelCondition
def initialize(self):
......
......@@ -216,10 +216,10 @@ def createObjectResourcesAndCoreObjects(environment,json_data):
from dream.simulation.CoreObject import CoreObject
if issubclass(objectType, CoreObject):
# 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
coreObject=objectType(**inputDict)
coreObject.environment=environment
environment.ObjList.append(coreObject)
# update the nextIDs list of the object
coreObject.nextIds=getSuccessorList(element['id'])
......
......@@ -37,10 +37,10 @@ class Queue(CoreObject):
#===========================================================================
# 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):
self.type="Queue" # String that shows the type of object
CoreObject.__init__(self, id, name)
CoreObject.__init__(self, environment,id, name)
capacity=float(capacity)
if capacity<0 or capacity==float("inf"):
self.capacity=float("inf")
......
......@@ -82,7 +82,7 @@ class Source(CoreObject):
#===========================================================================
# 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
if not interArrivalTime:
interArrivalTime = {'Fixed': {'mean': 1}}
......@@ -90,7 +90,7 @@ class Source(CoreObject):
interArrivalTime['Normal'].get('max', None) is None:
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
self.totalinterArrivalTime = 0 # the total interarrival time
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