Commit 33d8a5a6 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Sebastien Robin

__init__ method for CoreObject created

parent 4146eca1
......@@ -30,8 +30,17 @@ from SimPy.Simulation import Process, Resource, now
# =================================== the core object ==============================================
class CoreObject(Process):
def initialize(self):
def __init__(self):
Process.__init__(self)
# lists that hold the previous and next objects in the flow
self.next=[] #list with the next objects in the flow
self.previous=[] #list with the previous objects in the flow
self.nextIds=[] #list with the ids of the next objects in the flow
self.previousIds=[] #list with the ids of the previous objects in the flow
def initialize(self):
# Process.__init__(self)
self.predecessorIndex=0 #holds the index of the predecessor from which the Machine will take an entity next
self.successorIndex=0 #holds the index of the successor where the Machine will dispose an entity next
self.Up=True #Boolean that shows if the machine is in failure ("Down") or not ("up")
......@@ -70,6 +79,11 @@ class CoreObject(Process):
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
# ============================== lists to hold statistics of multiple runs =====================
self.Failure=[]
self.Working=[]
self.Blockage=[]
self.Waiting=[]
# ======================== the main process of the core object =================================
# ================ this is dummy, every object must have its own implementation ================
......
......@@ -35,16 +35,17 @@ from CoreObject import CoreObject
class Exit(CoreObject):
def __init__(self, id, name):
CoreObject.__init__(self)
Process.__init__(self)
self.predecessorIndex=0 # holds the index of the predecessor from which the Exit will take an entity next
# general properties of the Exit
self.id=id
self.objName=name
self.type="Exit"
# list with routing information
self.previous=[] # list with the previous objects in the flow
self.nextIds=[] # list with the ids of the next objects in the flow. For the exit it is always empty!
self.previousIds=[] # list with the ids of the previous objects in the flow
# # list with routing information
# self.previous=[] # list with the previous objects in the flow
# self.nextIds=[] # list with the ids of the next objects in the flow. For the exit it is always empty!
# self.previousIds=[] # list with the ids of the previous objects in the flow
#lists to hold statistics of multiple runs
self.Exits=[]
......
......@@ -42,7 +42,8 @@ class Machine(CoreObject):
#initialize the id the capacity, of the resource and the distribution
def __init__(self, id, name, capacity=1, distribution='Fixed', mean=1, stdev=0, min=0, max=10,\
failureDistribution='No', MTTF=0, MTTR=0, availability=0, repairman='None'):
Process.__init__(self)
# Process.__init__(self)
CoreObject.__init__(self)
# used for the routing of the entities
self.predecessorIndex=0 #holds the index of the predecessor from which the Machine will take an entity next
self.successorIndex=0 #holds the index of the successor where the Machine will dispose an entity next
......@@ -66,16 +67,16 @@ class Machine(CoreObject):
self.MTTF=MTTF
self.MTTR=MTTR
self.availability=availability
# lists that hold the previous and next objects in the flow
self.next=[] #list with the next objects in the flow
self.previous=[] #list with the previous objects in the flow
self.nextIds=[] #list with the ids of the next objects in the flow
self.previousIds=[] #list with the ids of the previous objects in the flow
# lists to hold statistics of multiple runs
self.Failure=[]
self.Working=[]
self.Blockage=[]
self.Waiting=[]
# # lists that hold the previous and next objects in the flow
# self.next=[] #list with the next objects in the flow
# self.previous=[] #list with the previous objects in the flow
# self.nextIds=[] #list with the ids of the next objects in the flow
# self.previousIds=[] #list with the ids of the previous objects in the flow
# # lists to hold statistics of multiple runs
# self.Failure=[]
# self.Working=[]
# self.Blockage=[]
# self.Waiting=[]
# =======================================================================
# initialize the Machine object
......
......@@ -35,7 +35,8 @@ from CoreObject import CoreObject
class Queue(CoreObject):
def __init__(self, id, name, capacity=1, dummy=False, schedulingRule="FIFO"):
Process.__init__(self)
CoreObject.__init__(self)
# Process.__init__(self)
# used for the routing of the entities
self.predecessorIndex=0 # holds the index of the predecessor from which the Queue will take an entity next
self.successorIndex=0 # holds the index of the successor where the Queue will dispose an entity next
......@@ -54,11 +55,11 @@ class Queue(CoreObject):
# No failures are considered for the Queue
# lists that hold the previous and next objects in the flow
self.next=[] #list with the next objects in the flow
self.previous=[] #list with the previous objects in the flow
self.nextIds=[] #list with the ids of the next objects in the flow
self.previousIds=[] #list with the ids of the previous 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.previous=[] #list with the previous objects in the flow
# self.nextIds=[] #list with the ids of the next objects in the flow
# self.previousIds=[] #list with the ids of the previous objects in the flow
self.isDummy=dummy #Boolean that shows if it is the dummy first Queue
self.schedulingRule=schedulingRule #the scheduling rule that the Queue follows
......
......@@ -36,7 +36,8 @@ from Globals import G
#============================================================================
class Source(CoreObject):
def __init__(self, id, name, distribution='Fixed', mean=1, item=Part):
Process.__init__(self)
CoreObject.__init__(self)
# Process.__init__(self)
# general properties
self.id=id
self.objName=name
......@@ -44,11 +45,11 @@ class Source(CoreObject):
# properties used for statistics
self.totalInterArrivalTime=0 # the total interarrival time
self.numberOfArrivals=0 # the number of entities that were created
# list containing objects that follow in the routing
self.next=[] # list with the next objects in the flow
self.nextIds=[] # list with the ids of the next objects in the flow
self.previousIds=[] # list with the ids of the previous objects in the flow.
# For the source it is always empty!
# # list containing objects that follow in the routing
# self.next=[] # list with the next objects in the flow
# self.nextIds=[] # list with the ids of the next objects in the flow
# self.previousIds=[] # list with the ids of the previous objects in the flow.
# # For the source it is always empty!
self.type="Source" #String that shows the type of object
self.rng=RandomNumberGenerator(self, self.distType)
self.rng.avg=mean
......
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