Commit 9bf2a5a0 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

Topology37-results in agreement with Ulbranch results prior to the changes in...

Topology37-results in agreement with Ulbranch results prior to the changes in the entity-route definition. OrderDecomposition corrected
parent 230909cb
...@@ -94,17 +94,9 @@ class OrderDecomposition(CoreObject): ...@@ -94,17 +94,9 @@ class OrderDecomposition(CoreObject):
# dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject) # dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject)
isRequested=False # is requested is dummyVariable checking if it is requested to accept an item isRequested=False # is requested is dummyVariable checking if it is requested to accept an item
maxTimeWaiting=0 # dummy variable counting the time a predecessor is blocked maxTimeWaiting=0 # dummy variable counting the time a predecessor is blocked
# print 'time', now()
# for obj in activeObject.previous:
# print 'orderDecompose previous', obj.id, obj.objName
# loop through the possible givers to see which have to dispose and which is the one blocked for longer # loop through the possible givers to see which have to dispose and which is the one blocked for longer
for object in activeObject.previous: for object in activeObject.previous:
# print 'object in previous', object.objName
# print 'has to dispose', object.haveToDispose(activeObject)
# if object.receiver!=None:
# print 'has receiver', object.receiver.objName
# else:
# print 'has no receiver'
if(object.haveToDispose(activeObject) and object.receiver==self): if(object.haveToDispose(activeObject) and object.receiver==self):
isRequested=True # if the predecessor objects have entities to dispose of isRequested=True # if the predecessor objects have entities to dispose of
if(object.downTimeInTryingToReleaseCurrentEntity>0):# and the predecessor has been down while trying to give away the Entity if(object.downTimeInTryingToReleaseCurrentEntity>0):# and the predecessor has been down while trying to give away the Entity
...@@ -117,9 +109,7 @@ class OrderDecomposition(CoreObject): ...@@ -117,9 +109,7 @@ class OrderDecomposition(CoreObject):
activeObject.giver=object # the object to deliver the Entity to the activeObject is set to the ith member of the previous list activeObject.giver=object # the object to deliver the Entity to the activeObject is set to the ith member of the previous list
maxTimeWaiting=timeWaiting maxTimeWaiting=timeWaiting
# in the next loops, check the other predecessors in the previous list # in the next loops, check the other predecessors in the previous list
# print 'orderDecompose giver:', activeObject.giver.objName , activeObject.giver.id
# print 'canAcceptAndIsRequested returns', activeObject.Up and isRequested
# print ''
return activeObject.Up and isRequested return activeObject.Up and isRequested
# ======================================================================= # =======================================================================
...@@ -127,7 +117,9 @@ class OrderDecomposition(CoreObject): ...@@ -127,7 +117,9 @@ class OrderDecomposition(CoreObject):
# an entity to the following object # an entity to the following object
# ======================================================================= # =======================================================================
def haveToDispose(self, callerObject=None): def haveToDispose(self, callerObject=None):
activeObject = self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
thecaller = callerObject
#if there is no Entity return False #if there is no Entity return False
if len(activeObjectQueue)==0: if len(activeObjectQueue)==0:
return False return False
...@@ -136,11 +128,30 @@ class OrderDecomposition(CoreObject): ...@@ -136,11 +128,30 @@ class OrderDecomposition(CoreObject):
import Globals import Globals
# update the next list of the object # update the next list of the object
nextObjectIds=activeEntity.remainingRoute[0].get('stationIdsList',[]) nextObjectIds=activeEntity.remainingRoute[0].get('stationIdsList',[])
nextObjects = []
for nextObjectId in nextObjectIds: for nextObjectId in nextObjectIds:
self.next.append(Globals.findObjectById(nextObjectId)) nextObject = Globals.findObjectById(nextObjectId)
# self.next = Globals.findObjectById(activeEntity.remainingRoute[0].get('stationIdsList',[])) nextObjects.append(nextObject)
self.next=nextObjects
# find the suitable receiver # find the suitable receiver
self.receiver = self.updateReceiverObject()
#if we have only one possible receiver just check if the Queue holds one or more entities
if(len(activeObject.next)==1 or callerObject==None):
activeObject.receiver=activeObject.next[0]
return len(activeObjectQueue)>0\
and thecaller==activeObject.receiver
#give the entity to the possible receiver that is waiting for the most time.
#plant does not do this in every occasion!
maxTimeWaiting=0
# loop through the object in the successor list
for object in activeObject.next:
if(object.canAccept()): # if the object can accept
timeWaiting=now()-object.timeLastEntityLeft # compare the time that it has been waiting
if(timeWaiting>maxTimeWaiting or maxTimeWaiting==0):# with the others'
maxTimeWaiting=timeWaiting
self.receiver=object # and update the receiver to the index of this object
# self.receiver=Globals.findObjectById(activeEntity.remainingRoute[0][0]) #read the next station # self.receiver=Globals.findObjectById(activeEntity.remainingRoute[0][0]) #read the next station
#return True if the OrderDecomposition in the state of disposing and the caller is the receiver #return True if the OrderDecomposition in the state of disposing and the caller is the receiver
return self.Up and (callerObject is self.receiver) return self.Up and (callerObject is self.receiver)
...@@ -195,14 +206,8 @@ class OrderDecomposition(CoreObject): ...@@ -195,14 +206,8 @@ class OrderDecomposition(CoreObject):
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
routeentity.pop(str(stepNumber),None) # remove the stepNumber key # routeentity.pop(str(stepNumber),None) # remove the stepNumber key
# nextId=routeentity.get('stationId', 'not found') # the stationId route[stepNumber]=routeentity
# processingTime=routeentity['processingTime'] # and the 'processingTime' dictionary
# distributionType=processingTime.get('distributionType', 'not found')# and from that dictionary
# mean=float(processingTime.get('mean', 'not found')) # get the 'mean'
# route[stepNumber]=[nextId, mean] # finally add the 'nextId' and 'mean'
# # to the job route
route[stepNumber]=routeEntity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
...@@ -228,7 +233,7 @@ class OrderDecomposition(CoreObject): ...@@ -228,7 +233,7 @@ class OrderDecomposition(CoreObject):
break break
if exitId: if exitId:
# route.append([exitId, 0]) # route.append([exitId, 0])
route.append({'stationIdsList':str([exitId]),\ route.append({'stationIdsList':[str(exitId)],\
'processingTime':{}}) 'processingTime':{}})
# initiate the OrderComponent # initiate the OrderComponent
...@@ -241,6 +246,7 @@ class OrderDecomposition(CoreObject): ...@@ -241,6 +246,7 @@ class OrderDecomposition(CoreObject):
orderDate=self.orderToBeDecomposed.orderDate, \ orderDate=self.orderToBeDecomposed.orderDate, \
extraPropertyDict=extraPropertyDict,\ extraPropertyDict=extraPropertyDict,\
isCritical=self.orderToBeDecomposed.isCritical) isCritical=self.orderToBeDecomposed.isCritical)
# check the componentType of the component and accordingly add to the corresponding list of the parent order # check the componentType of the component and accordingly add to the corresponding list of the parent order
if OC.componentType == 'Basic': if OC.componentType == 'Basic':
self.orderToBeDecomposed.basicComponentsList.append(OC) self.orderToBeDecomposed.basicComponentsList.append(OC)
......
...@@ -4,35 +4,43 @@ ...@@ -4,35 +4,43 @@
"extraPropertyDict": { "extraPropertyDict": {
"route": [ "route": [
{ {
"stationIdsList": [
"OD0"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
}, },
"stationId": "OD0",
"stepNumber": "0" "stepNumber": "0"
}, },
{ {
"stationIdsList": [
"Q1"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
}, },
"stationId": "Q1",
"stepNumber": "1" "stepNumber": "1"
}, },
{ {
"stationIdsList": [
"M1"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "1" "mean": "1"
}, },
"stationId": "M1",
"stepNumber": "2" "stepNumber": "2"
}, },
{ {
"stationIdsList": [
"E1"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
}, },
"stationId": "E1",
"stepNumber": "3" "stepNumber": "3"
} }
], ],
...@@ -70,35 +78,43 @@ ...@@ -70,35 +78,43 @@
"extraPropertyDict": { "extraPropertyDict": {
"route": [ "route": [
{ {
"stationIdsList": [
"OD0"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
}, },
"stationId": "OD0",
"stepNumber": "0" "stepNumber": "0"
}, },
{ {
"stationIdsList": [
"Q2"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
}, },
"stationId": "Q2",
"stepNumber": "1" "stepNumber": "1"
}, },
{ {
"stationIdsList": [
"M2"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "1" "mean": "1"
}, },
"stationId": "M2",
"stepNumber": "2" "stepNumber": "2"
}, },
{ {
"stationIdsList": [
"E1"
],
"processingTime": { "processingTime": {
"distributionType": "Fixed", "distributionType": "Fixed",
"mean": "0" "mean": "0"
}, },
"stationId": "E1",
"stepNumber": "3" "stepNumber": "3"
} }
], ],
......
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