Commit 879ccb58 authored by Georgios Dagkakis's avatar Georgios Dagkakis

all CoreObjects in the new way. 2 tests fail others pass

parent f969ec9a
...@@ -47,7 +47,7 @@ class BatchScrapMachine(Machine): ...@@ -47,7 +47,7 @@ class BatchScrapMachine(Machine):
processingTime=None, repairman='None',\ processingTime=None, repairman='None',\
scrapQuantity={}): scrapQuantity={}):
if not processingTime: if not processingTime:
processingTime = {'distribution': 'Fixed', processingTime = {'distributionType': 'Fixed',
'mean': 1} 'mean': 1}
# initialize using the default method of the object # initialize using the default method of the object
Machine.__init__(self,id=id,name=name,\ Machine.__init__(self,id=id,name=name,\
...@@ -56,6 +56,10 @@ class BatchScrapMachine(Machine): ...@@ -56,6 +56,10 @@ class BatchScrapMachine(Machine):
repairman=repairman) repairman=repairman)
# set the attributes of the scrap quantity distribution # set the attributes of the scrap quantity distribution
if not scrapQuantity:
scrapQuantity = {'distributionType': 'Fixed',
'mean': 0}
self.scrapRng=RandomNumberGenerator(self, **scrapQuantity) self.scrapRng=RandomNumberGenerator(self, **scrapQuantity)
from Globals import G from Globals import G
G.BatchScrapMachineList.append(self) G.BatchScrapMachineList.append(self)
......
...@@ -67,6 +67,8 @@ class CapacityStation(Queue): ...@@ -67,6 +67,8 @@ class CapacityStation(Queue):
self.isLocked=True self.isLocked=True
self.utilisationDict=[] # a list of dicts for the utilization results self.utilisationDict=[] # a list of dicts for the utilization results
self.detailedWorkPlan=[] # a list of dicts to keep detailed data self.detailedWorkPlan=[] # a list of dicts to keep detailed data
from Globals import G
G.CapacityStationList.append(self)
def canAccept(self, callerObject=None): def canAccept(self, callerObject=None):
if self.isLocked: if self.isLocked:
......
...@@ -39,7 +39,9 @@ class CapacityStationBuffer(Queue): ...@@ -39,7 +39,9 @@ class CapacityStationBuffer(Queue):
Queue.__init__(self, id, name, capacity=capacity) Queue.__init__(self, id, name, capacity=capacity)
self.isLocked=True self.isLocked=True
self.requireFullProject=requireFullProject # flag that shows if here the whole project is assembled self.requireFullProject=requireFullProject # flag that shows if here the whole project is assembled
from Globals import G
G.CapacityStationBufferList.append(self)
def initialize(self): def initialize(self):
Queue.initialize(self) Queue.initialize(self)
self.isLocked=True self.isLocked=True
......
...@@ -44,7 +44,9 @@ class CapacityStationExit(Exit): ...@@ -44,7 +44,9 @@ class CapacityStationExit(Exit):
self.nextCapacityStationBufferId=nextCapacityStationBufferId # the id of the next station. If it is None it self.nextCapacityStationBufferId=nextCapacityStationBufferId # the id of the next station. If it is None it
# means it is the end of the system. # means it is the end of the system.
self.nextCapacityStationBuffer=None # the next buffer. If it is None it self.nextCapacityStationBuffer=None # the next buffer. If it is None it
# means it is the end of the system. from Globals import G
G.CapacityStationExitList.append(self)
# means it is the end of the system.
def initialize(self): def initialize(self):
Exit.initialize(self) Exit.initialize(self)
self.isLocked=True self.isLocked=True
......
...@@ -243,8 +243,8 @@ def createObjects(): ...@@ -243,8 +243,8 @@ def createObjects():
# element itself # element itself
element = element.copy() element = element.copy()
element['id'] = element_id # create a new entry for the element (dictionary) element['id'] = element_id # create a new entry for the element (dictionary)
for k in ('element_id', 'top', 'left'): # for k in ('element_id', 'top', 'left'):
element.pop(k, None) # element.pop(k, None)
# with key 'id' and value the the element_id # with key 'id' and value the the element_id
resourceClass = element.pop('_class') # get the class type of the element resourceClass = element.pop('_class') # get the class type of the element
if resourceClass=='Dream.OperatorPool': if resourceClass=='Dream.OperatorPool':
...@@ -283,7 +283,9 @@ def createObjects(): ...@@ -283,7 +283,9 @@ def createObjects():
'Dream.Queue', 'Dream.RoutingQueue', 'Dream.QueueJobShop', 'Dream.QueueManagedJob', 'Dream.Queue', 'Dream.RoutingQueue', 'Dream.QueueJobShop', 'Dream.QueueManagedJob',
'Dream.Assembly', 'Dream.Dismantle', 'Dream.Source', 'Dream.Conveyer', 'Dream.Assembly', 'Dream.Dismantle', 'Dream.Source', 'Dream.Conveyer',
'Dream.BatchDecomposition', 'Dream.BatchReassembly', 'Dream.LineClearance', 'Dream.BatchDecomposition', 'Dream.BatchReassembly', 'Dream.LineClearance',
'Dream.BatchSource']: 'Dream.BatchSource', 'Dream.OrderDecomposition', 'Dream.MouldAssemblyBuffer',
'Dream.ConditionalBuffer', 'Dream.BatchDecompositionStartTime', 'Dream.ConditionalBuffer',
'Dream.CapacityStation','Dream.CapacityStationBuffer','Dream.CapacityStationExit']:
inputDict=dict(element) inputDict=dict(element)
if 'wip' in inputDict: if 'wip' in inputDict:
del inputDict['wip'] del inputDict['wip']
...@@ -291,6 +293,8 @@ def createObjects(): ...@@ -291,6 +293,8 @@ def createObjects():
del inputDict['failures'] del inputDict['failures']
if 'shift' in inputDict: if 'shift' in inputDict:
del inputDict['shift'] del inputDict['shift']
if 'scheduledMaintenance' in inputDict:
del inputDict['scheduledMaintenance']
objectType=Globals.getClassFromName(objClass) objectType=Globals.getClassFromName(objClass)
coreObject=objectType(**inputDict) coreObject=objectType(**inputDict)
# get the successorList for the 'Parts' # get the successorList for the 'Parts'
...@@ -298,61 +302,35 @@ def createObjects(): ...@@ -298,61 +302,35 @@ def createObjects():
# get the successorList for the 'Frames' # get the successorList for the 'Frames'
coreObject.nextFrameIds=getSuccessorList(element['id'], lambda source, destination, edge_data: edge_data.get('entity') == 'Frame') coreObject.nextFrameIds=getSuccessorList(element['id'], lambda source, destination, edge_data: edge_data.get('entity') == 'Frame')
coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the object coreObject.nextIds=getSuccessorList(element['id']) # update the nextIDs list of the object
elif objClass=='Dream.OrderDecomposition':
id=element.get('id', 'not found') # elif objClass=='Dream.CapacityStation':
name=element.get('name', 'not found') # id=element.get('id', 'not found')
OD=OrderDecomposition(id, name) # name=element.get('name', 'not found')
G.OrderDecompositionList.append(OD) # intervalCapacity=element.get('intervalCapacity', [])
G.ObjList.append(OD) # sharedResources=element.get('sharedResources', {})
# CS=CapacityStation(id,name,intervalCapacity=intervalCapacity, sharedResources=sharedResources)
elif objClass=='Dream.ConditionalBuffer': # CS.nextIds=getSuccessorList(id)
id=element.get('id', 'not found') # G.CapacityStationList.append(CS)
name=element.get('name', 'not found') # G.ObjList.append(CS)
CB=ConditionalBuffer(id, name) #
CB.nextIds=getSuccessorList(id) # elif objClass=='Dream.CapacityStationBuffer':
G.QueueList.append(CB) # id=element.get('id', 'not found')
G.QueueJobShopList.append(CB) # name=element.get('name', 'not found')
G.ConditionalBufferList.append(CB) # requireFullProject=bool(element.get('requireFullProject', 0))
G.ObjList.append(CB) # CB=CapacityStationBuffer(id,name,requireFullProject=requireFullProject)
# CB.nextIds=getSuccessorList(id)
elif objClass=='Dream.MouldAssemblyBuffer': # G.CapacityStationBufferList.append(CB)
id=element.get('id', 'not found') # G.ObjList.append(CB)
name=element.get('name', 'not found') #
MAB=MouldAssemblyBuffer(id, name) # elif objClass=='Dream.CapacityStationExit':
MAB.nextIds=getSuccessorList(id) # id=element.get('id', 'not found')
G.QueueList.append(MAB) # name=element.get('name', 'not found')
G.QueueJobShopList.append(MAB) # nextCapacityStationBufferId=element.get('nextCapacityStationBufferId', None)
G.MouldAssemblyBufferList.append(MAB) # CE=CapacityStationExit(id,name,nextCapacityStationBufferId=nextCapacityStationBufferId)
G.ObjList.append(MAB) # G.CapacityStationExitList.append(CE)
# G.ExitList.append(CE)
elif objClass=='Dream.CapacityStation': # G.ObjList.append(CE)
id=element.get('id', 'not found')
name=element.get('name', 'not found')
intervalCapacity=element.get('intervalCapacity', [])
sharedResources=element.get('sharedResources', {})
CS=CapacityStation(id,name,intervalCapacity=intervalCapacity, sharedResources=sharedResources)
CS.nextIds=getSuccessorList(id)
G.CapacityStationList.append(CS)
G.ObjList.append(CS)
elif objClass=='Dream.CapacityStationBuffer':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
requireFullProject=bool(element.get('requireFullProject', 0))
CB=CapacityStationBuffer(id,name,requireFullProject=requireFullProject)
CB.nextIds=getSuccessorList(id)
G.CapacityStationBufferList.append(CB)
G.ObjList.append(CB)
elif objClass=='Dream.CapacityStationExit':
id=element.get('id', 'not found')
name=element.get('name', 'not found')
nextCapacityStationBufferId=element.get('nextCapacityStationBufferId', None)
CE=CapacityStationExit(id,name,nextCapacityStationBufferId=nextCapacityStationBufferId)
G.CapacityStationExitList.append(CE)
G.ExitList.append(CE)
G.ObjList.append(CE)
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# loop through all the nodes to # loop through all the nodes to
......
...@@ -53,8 +53,8 @@ class Machine(CoreObject): ...@@ -53,8 +53,8 @@ class Machine(CoreObject):
repairman='None',\ repairman='None',\
operatorPool='None',operationType='None',\ operatorPool='None',operationType='None',\
setupTime=None, loadTime=None, setupTime=None, loadTime=None,
isPreemptive=False, resetOnPreemption=False, preemption={},
canDeliverOnInterruption=False, inputsDict={}, failures=None): canDeliverOnInterruption=False):
self.type="Machine" #String that shows the type of object self.type="Machine" #String that shows the type of object
CoreObject.__init__(self, id, name) CoreObject.__init__(self, id, name)
from Globals import G from Globals import G
...@@ -133,8 +133,11 @@ class Machine(CoreObject): ...@@ -133,8 +133,11 @@ class Machine(CoreObject):
self.multOperationTypeList.append(self.operationType) self.multOperationTypeList.append(self.operationType)
# flags used for preemption purposes # flags used for preemption purposes
self.isPreemptive=isPreemptive self.isPreemptive=False
self.resetOnPreemption=resetOnPreemption self.resetOnPreemption=False
if len(preemption)>0:
self.isPreemptive=bool(int(preemption.get('isPreemptive') or 0))
self.resetOnPreemption=bool(int(preemption.get('resetOnPreemption', 0)))
# flag notifying that there is operator assigned to the actievObject # flag notifying that there is operator assigned to the actievObject
self.assignedOperator=True self.assignedOperator=True
# flag notifying the the station can deliver entities that ended their processing while interrupted # flag notifying the the station can deliver entities that ended their processing while interrupted
......
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