Esempio n. 1
0
    def getEntity(self):
        activeObject = self.getActiveObject()
        giverObject = activeObject.getGiverObject()
        # get the first entity from the predecessor
        # TODO: each MachineJobShop.getEntity is invoked,
        #     the self.procTime is updated. Have to decide where to assign
        #     the processing time of the assembler
        activeEntity = MachineJobShop.getEntity(self)
        # this is kept so that in the next loop it will not try to re-get this Entity
        firstObtained = activeEntity
        # check weather the activeEntity is of type Mould
        if activeEntity.type == 'Mould':
            # and return the mould received
            return activeEntity
        # otherwise, collect all the entities to be assembled

        # read the number of basic and secondary components of the moulds
        capacity = len(activeEntity.order.getAssemblyComponents())
        # clear the active object queue
        del activeObject.getActiveObjectQueue()[:]
        # and set the capacity of the internal queue of the assembler
        activeObject.updateCapacity(capacity)
        # append the activeEntity to the activeObjectQueue
        activeObjectQueue = activeObject.getActiveObjectQueue()
        activeObjectQueue.append(activeEntity)
        # loop through the basic/secondary components of the order that is currently obtained
        # all the components are received at the same time
        for entity in activeEntity.order.getAssemblyComponents():
            # continue for the one that is already  obtained before
            if entity is firstObtained:
                continue

            self.entityToGet = entity
            # get the next component
            activeEntity = MachineJobShop.getEntity(self)
            # check whether the activeEntity is of type Mould
            try:
                if activeEntity.type == 'Mould':
                    # and return the mould received
                    raise AssembleMouldError(
                        'Having already received an orderComponent the assembler\
                                                is not supposed to receive an object of type Mould'
                    )
            # check if the last component received has the same parent order as the previous one
                elif not (activeEntity.order is activeObjectQueue[1].order):
                    raise AssembleMouldError(
                        'The orderComponents received by the assembler must have the\
                                                same parent order')
            except AssembleMouldError as mouldError:
                print 'Mould Assembly Error: {0}'.format(mouldError)
                return False
        # perform the assembly-action and return the assembled mould
        activeEntity = activeObject.assemble()
        return activeEntity
Esempio n. 2
0
    def getEntity(self):
        activeObject = self.getActiveObject()
        giverObject = activeObject.getGiverObject()
        # get the first entity from the predecessor
        # TODO: each MachineJobShop.getEntity is invoked, 
        #     the self.procTime is updated. Have to decide where to assign 
        #     the processing time of the assembler
        activeEntity=MachineJobShop.getEntity(self)
        # this is kept so that in the next loop it will not try to re-get this Entity
        firstObtained=activeEntity  
        # check weather the activeEntity is of type Mould
        if activeEntity.type=='Mould':
            # and return the mould received
            return activeEntity
        # otherwise, collect all the entities to be assembled
        
        # read the number of basic and secondary components of the moulds
        capacity = len(activeEntity.order.getAssemblyComponents())
        # clear the active object queue
        del activeObject.getActiveObjectQueue()[:]
        # and set the capacity of the internal queue of the assembler
        activeObject.updateCapacity(capacity)
        # append the activeEntity to the activeObjectQueue
        activeObjectQueue = activeObject.getActiveObjectQueue()
        activeObjectQueue.append(activeEntity)
        # loop through the basic/secondary components of the order that is currently obtained
        # all the components are received at the same time
        for entity in activeEntity.order.getAssemblyComponents():
            # continue for the one that is already  obtained before
            if entity is firstObtained:
                continue

            self.entityToGet=entity
            # get the next component
            activeEntity=MachineJobShop.getEntity(self)
            # check whether the activeEntity is of type Mould
            try:
                if activeEntity.type=='Mould':
            # and return the mould received
                    raise AssembleMouldError('Having already received an orderComponent the assembler\
                                                is not supposed to receive an object of type Mould')
            # check if the last component received has the same parent order as the previous one
                elif not (activeEntity.order is activeObjectQueue[1].order):
                    raise AssembleMouldError('The orderComponents received by the assembler must have the\
                                                same parent order')
            except AssembleMouldError as mouldError:
                print 'Mould Assembly Error: {0}'.format(mouldError)
                return False
        # perform the assembly-action and return the assembled mould
        activeEntity = activeObject.assemble()
        return activeEntity
Esempio n. 3
0
 def initialize(self):
     MachineJobShop.initialize(self)
     self.type="MachineManagedJob"
     #create an empty Operator Pool. This will be updated by canAcceptAndIsRequested
     id = self.id+'_OP'
     name=self.objName+'_operatorPool'
     self.operatorPool=OperatorPool(id, name, operatorsList=[])
     self.operatorPool.initialize()
     self.operatorPool.operators=[]
     #create a Broker
     self.broker = Broker(self)
     activate(self.broker,self.broker.run())
     #create a Router
     from Globals import G
     if len(G.RoutersList)==0:
         self.router=Router()
         activate(self.router,self.router.run())
         G.RoutersList.append(self.router)
     # otherwise set the already existing router as the machines Router
     else:
         self.router=G.RoutersList[0]
     # holds the Entity that is to be obtained and will be updated by canAcceptAndIsRequested
     self.entityToGet=None
Esempio n. 4
0
 def initialize(self):
     self.mouldParent = None  # the mould's to be assembled parent order
     self.mouldToBeCreated = None  # the mould to be assembled
     MachineJobShop.initialize(self)  # run default behaviour
Esempio n. 5
0
 def initialize(self):
     self.mouldParent = None                 # the mould's to be assembled parent order
     self.mouldToBeCreated = None            # the mould to be assembled
     MachineJobShop.initialize(self)      # run default behaviour
Esempio n. 6
0
 def initialize(self):
     MachineJobShop.initialize(self)
     self.type="MachineManagedJob"
     # holds the Entity that is to be obtained and will be updated by canAcceptAndIsRequested
     self.entityToGet=None
Esempio n. 7
0
 def initialize(self):
     MachineJobShop.initialize(self)
     self.type = "MachineManagedJob"
     # holds the Entity that is to be obtained and will be updated by canAcceptAndIsRequested
     self.entityToGet = None