コード例 #1
0
 def __init__(self,
              id,
              name,
              capacity=-1,
              isDummy=False,
              schedulingRule="FIFO",
              **kw):
     QueueManagedJob.__init__(self,
                              id=id,
                              name=name,
                              capacity=capacity,
                              isDummy=isDummy,
                              schedulingRule=schedulingRule)
コード例 #2
0
ファイル: MouldAssemblyBuffer.py プロジェクト: mmariani/dream
 def sortEntities(self):
     activeObject = self.getActiveObject()
     # run the default sorting of the Queue first
     QueueManagedJob.sortEntities(self)
     # and in the end sort according to the ConditionalBuffer sorting rule
     activeObjectQueue = activeObject.getActiveObjectQueue()
     # if all the components of the same mould are present then move them to the front of the activeQ
     activeObjectQueue.sort(key=lambda x: x.order.componentsReadyForAssembly, reverse=True)
     '''
     maybe the below lines should go after
     if len(activeObjectQueue)>0:
     '''
     # keep the first entity of the activeQ
     activeEntity = activeObjectQueue[0]
     # bring the entities that have the same parentOrder as the first entity to the front
     activeObjectQueue.sort(key=lambda x: not x.order.name == activeEntity.order.name)
コード例 #3
0
 def sortEntities(self):
     activeObject = self.getActiveObject()
     # run the default sorting of the Queue first
     QueueManagedJob.sortEntities(self)
     # and in the end sort according to the ConditionalBuffer sorting rule
     activeObjectQueue = activeObject.getActiveObjectQueue()
     # if all the components of the same mould are present then move them to the front of the activeQ
     activeObjectQueue.sort(
         key=lambda x: x.order.componentsReadyForAssembly, reverse=True)
     '''
     maybe the below lines should go after
     if len(activeObjectQueue)>0:
     '''
     # keep the first entity of the activeQ
     activeEntity = activeObjectQueue[0]
     # bring the entities that have the same parentOrder as the first entity to the front
     activeObjectQueue.sort(
         key=lambda x: not x.order.name == activeEntity.order.name)
コード例 #4
0
    def haveToDispose(self, callerObject=None):
        # get active object and its queue
        activeObject = self.getActiveObject()
        activeObjectQueue = self.getActiveObjectQueue()

        # and then perform the default behaviour
        if QueueManagedJob.haveToDispose(self, callerObject):
            return activeObject.checkCondition()
        return False
コード例 #5
0
 def haveToDispose(self, callerObject=None):
     # get active object and its queue
     activeObject=self.getActiveObject()
     activeObjectQueue=self.getActiveObjectQueue()
     
     # and then perform the default behaviour
     if QueueManagedJob.haveToDispose(self,callerObject):
         return activeObject.checkCondition()
     return False
コード例 #6
0
 def getEntity(self):
     activeObject = self.getActiveObject()
     activeObjectQueue = activeObject.getActiveObjectQueue()
     activeEntity = QueueManagedJob.getEntity(
         self)  #execute default behaviour
     # if the activeEntity is of type orderComponent
     try:
         if activeEntity.componentType == 'Basic' or 'Secondary':
             activeEntity.readyForAssembly = 1
         # check if all the basics have finished being processed in the previous machines
         # if the componentType of the activeEntity just received is 'Basic',
         # go through the components of its parent order
         # and check if they are present in the activeObjectQueue
         if activeEntity.componentType == 'Basic':
             # local variable to notify when all the basics are received
             allBasicsPresent = True
             # run through all the basicComponentsList
             for entity in activeEntity.order.basicComponentsList:
                 # if a basic is not present then set the local variable False and break
                 if not (entity in activeObjectQueue):
                     allBasicsPresent = False
                     break
             # if all are present then basicsEnded
             if allBasicsPresent:
                 activeEntity.order.basicsEnded = 1
             # TODO: has to signal ConditionalBuffer to start sending entities again
             for secondary in [
                     x for x in activeEntity.order.secondaryComponentsList
                     if activeEntity.order.basicsEnded
             ]:
                 if secondary.currentStation.__class__.__name__ == 'ConditionalBufferManaged':
                     #                         print now(), self.id, '                                                    signalling conditional buffer'
                     if secondary.currentStation.expectedSignals[
                             'canDispose']:
                         self.sendSignal(
                             receiver=secondary.currentStation,
                             signal=secondary.currentStation.canDispose)
                     break
         # for all the components that have the same parent Order as the activeEntity
         activeEntity.order.componentsReadyForAssembly = 1
         for entity in activeEntity.order.basicComponentsList+\
                         activeEntity.order.secondaryComponentsList:
             # if one of them has not reach the Buffer yet,
             if not entity.readyForAssembly:
                 # the mould is not ready for assembly
                 activeEntity.order.componentsReadyForAssembly = 0
                 break
     # if the activeEntity is of type Mould
     except:
         pass
     return activeEntity
コード例 #7
0
ファイル: MouldAssemblyBuffer.py プロジェクト: Kodextor/dream
    def getEntity(self):
        activeObject = self.getActiveObject()
        activeObjectQueue = activeObject.getActiveObjectQueue()
        activeEntity=QueueManagedJob.getEntity(self)   #execute default behaviour
        # if the activeEntity is of type orderComponent
        try:
            if activeEntity.componentType=='Basic' or 'Secondary':
                activeEntity.readyForAssembly=1
            # check if all the basics have finished being processed in the previous machines
            # if the componentType of the activeEntity just received is 'Basic', 
            # go through the components of its parent order
            # and check if they are present in the activeObjectQueue
            if activeEntity.componentType=='Basic':
                # local variable to notify when all the basics are received
                allBasicsPresent = True
                # run through all the basicComponentsList
                for entity in activeEntity.order.basicComponentsList:
                    # if a basic is not present then set the local variable False and break
                    if not (entity in activeObjectQueue):
                        allBasicsPresent = False
                        break
                # if all are present then basicsEnded
                if allBasicsPresent:
                    activeEntity.order.basicsEnded = 1
                # TODO: has to signal ConditionalBuffer to start sending entities again
                for secondary in [x for x in activeEntity.order.secondaryComponentsList if activeEntity.order.basicsEnded]:
                    if secondary.currentStation.__class__.__name__=='ConditionalBuffer':
#                         print now(), self.id, '                                                    signalling conditional buffer'
                        if secondary.currentStation.expectedSignals['canDispose']:
                            self.sendSignal(receiver=secondary.currentStation,signal=secondary.currentStation.canDispose)
                        break
            # for all the components that have the same parent Order as the activeEntity
            activeEntity.order.componentsReadyForAssembly = 1
            for entity in activeEntity.order.basicComponentsList+\
                            activeEntity.order.secondaryComponentsList:
            # if one of them has not reach the Buffer yet,
                if not entity.readyForAssembly:
            # the mould is not ready for assembly
                    activeEntity.order.componentsReadyForAssembly = 0
                    break
        # if the activeEntity is of type Mould
        except:
            pass
        return activeEntity
コード例 #8
0
ファイル: MouldAssemblyBuffer.py プロジェクト: mmariani/dream
 def getEntity(self):
     activeObject = self.getActiveObject()
     activeObjectQueue = activeObject.getActiveObjectQueue()
     activeEntity=QueueManagedJob.getEntity(self)   #execute default behaviour
     # if the activeEntity is of type orderComponent
     try:
         if activeEntity.componentType=='Basic' or 'Secondary':
             activeEntity.readyForAssembly=1
         # check if all the basics have finished being processed in the previous machines
         # if the componentType of the activeEntity just received is 'Basic', 
         # go through the components of its parent order
         # and check if they are present in the activeObjectQueue
         if activeEntity.componentType=='Basic':
             # local variable to notify when all the basics are received
             allBasicsPresent = True
             # run through all the basicComponentsList
             for entity in activeEntity.order.basicComponentsList:
                 # if a basic is not present then set the local variable False and break
                 if not (entity in activeObjectQueue):
                     allBasicsPresent = False
                     break
             # if all are present then basicsEnded
             if allBasicsPresent:
                 activeEntity.order.basicsEnded = 1
         # for all the components that have the same parent Order as the activeEntity
         activeEntity.order.componentsReadyForAssembly = 1
         for entity in activeEntity.order.basicComponentsList+\
                         activeEntity.order.secondaryComponentsList:
         # if one of them has not reach the Buffer yet,
             if not entity.readyForAssembly:
         # the mould is not ready for assembly
                 activeEntity.order.componentsReadyForAssembly = 0
                 break
     # if the activeEntity is of type Mould
     except:
         pass
     return activeEntity
コード例 #9
0
ファイル: MouldAssemblyBuffer.py プロジェクト: mmariani/dream
 def __init__(self,  id, name, capacity=-1, isDummy=False,
              schedulingRule="FIFO"):
     QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity,
                              isDummy=isDummy, schedulingRule=schedulingRule)