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