Commit 16c0767d authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

ConditionalBuffer and MouldAssemblyBuffer to inherit fromQueueManagedJob....

ConditionalBuffer and MouldAssemblyBuffer to inherit fromQueueManagedJob. MouldAssembly to inherit from MachineManagedJob
parent cdec2b01
...@@ -22,10 +22,10 @@ Created on 15 Jan 2014 ...@@ -22,10 +22,10 @@ Created on 15 Jan 2014
@author: Ioannis @author: Ioannis
''' '''
''' '''
Inherits from QueueJobShop. Checks the condition of (a) component(s) before it can dispose them/it Inherits from QueueManagedJob. Checks the condition of (a) component(s) before it can dispose them/it
''' '''
from QueueJobShop import QueueJobShop from QueueManagedJob import QueueManagedJob
from SimPy.Simulation import now from SimPy.Simulation import now
# =========================================================================== # ===========================================================================
...@@ -38,13 +38,13 @@ class NoCallerError(Exception): ...@@ -38,13 +38,13 @@ class NoCallerError(Exception):
# =========================================================================== # ===========================================================================
# the ConditionalBuffer object # the ConditionalBuffer object
# =========================================================================== # ===========================================================================
class ConditionalBuffer(QueueJobShop): class ConditionalBuffer(QueueManagedJob):
# ======================================================================= # =======================================================================
# the default __init__ method of the QueueJobShop class # the default __init__ method of the QueueManagedJob class
# whereas the default capacity is set to infinity # whereas the default capacity is set to infinity
# ======================================================================= # =======================================================================
def __init__(self, id, name, capacity=-1, dummy=False, schedulingRule="FIFO"): def __init__(self, id, name, capacity=-1, dummy=False, schedulingRule="FIFO"):
QueueJobShop.__init__(self, id=id, name=name, capacity=capacity, dummy=dummy, schedulingRule=schedulingRule) QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity, dummy=dummy, schedulingRule=schedulingRule)
# ======================================================================= # =======================================================================
# checks if the Buffer can dispose an entity. # checks if the Buffer can dispose an entity.
...@@ -132,7 +132,7 @@ class ConditionalBuffer(QueueJobShop): ...@@ -132,7 +132,7 @@ class ConditionalBuffer(QueueJobShop):
def sortEntities(self): def sortEntities(self):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
# run the default sorting of the Queue first # run the default sorting of the Queue first
QueueJobShop.sortEntities(self) QueueManagedJob.sortEntities(self)
# and in the end sort according to the ConditionalBuffer sorting rule # and in the end sort according to the ConditionalBuffer sorting rule
activeObjectQueue = activeObject.getActiveObjectQueue() activeObjectQueue = activeObject.getActiveObjectQueue()
# if the componentType of the entities in the activeQueue is Basic then don't move it to the end of the activeQ # if the componentType of the entities in the activeQueue is Basic then don't move it to the end of the activeQ
......
...@@ -22,7 +22,7 @@ Created on 16 Jan 2014 ...@@ -22,7 +22,7 @@ Created on 16 Jan 2014
@author: Ioannis @author: Ioannis
''' '''
''' '''
inherits from MachineJobShop. It takes the components of an order and reassembles them as mould inherits from MachineManagedJob. It takes the components of an order and reassembles them as mould
''' '''
''' '''
...@@ -63,7 +63,7 @@ as a dictionary with the following layout if the mould is not already in WIP ...@@ -63,7 +63,7 @@ as a dictionary with the following layout if the mould is not already in WIP
There is no need to assign an exit, exit is assigned automatically by the createMould method There is no need to assign an exit, exit is assigned automatically by the createMould method
TODOs: check the case when a mould is already in the WIP by the beginning of the simulation TODOs: check the case when a mould is already in the WIP by the beginning of the simulation
''' '''
from MachineJobShop import MachineJobShop from MachineManagedJob import MachineManagedJob
from SimPy.Simulation import Resource, reactivate, now from SimPy.Simulation import Resource, reactivate, now
from Globals import G from Globals import G
...@@ -75,16 +75,16 @@ class AssembleMouldError(Exception): ...@@ -75,16 +75,16 @@ class AssembleMouldError(Exception):
Exception.__init__(self, mouldAssembleError) Exception.__init__(self, mouldAssembleError)
# =========================================================================== # ===========================================================================
# the MachineJobShop object # the MachineManagedJob object
# =========================================================================== # ===========================================================================
class MouldAssembly(MachineJobShop): class MouldAssembly(MachineManagedJob):
# ======================================================================= # =======================================================================
# the initialize method # the initialize method
# ======================================================================= # =======================================================================
def initialize(self): def initialize(self):
self.mouldParent = None # the mould's to be assembled parent order self.mouldParent = None # the mould's to be assembled parent order
self.mouldToBeCreated = None # the mould to be assembled self.mouldToBeCreated = None # the mould to be assembled
MachineJobShop.initialize(self) # run default behaviour MachineManagedJob.initialize(self) # run default behaviour
# ======================================================================= # =======================================================================
# getEntity method that gets the entity from the giver # getEntity method that gets the entity from the giver
...@@ -96,10 +96,10 @@ class MouldAssembly(MachineJobShop): ...@@ -96,10 +96,10 @@ class MouldAssembly(MachineJobShop):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
giverObejct = activeObject.getGiverObject() giverObejct = activeObject.getGiverObject()
# get the first entity from the predecessor # get the first entity from the predecessor
# TODO: each MachineJobShop.getEntity is invoked, # TODO: each MachineManagedJob.getEntity is invoked,
# the self.procTime is updated. Have to decide where to assign # the self.procTime is updated. Have to decide where to assign
# the processing time of the assembler # the processing time of the assembler
activeEntity=MachineJobShop.getEntity(self) activeEntity=MachineManagedJob.getEntity(self)
# check weather the activeEntity is of type Mould # check weather the activeEntity is of type Mould
if activeEntity.type=='Mould': if activeEntity.type=='Mould':
# and return the mould received # and return the mould received
...@@ -122,7 +122,7 @@ class MouldAssembly(MachineJobShop): ...@@ -122,7 +122,7 @@ class MouldAssembly(MachineJobShop):
# all the components are received at the same time # all the components are received at the same time
while not orderGroupReceived: while not orderGroupReceived:
# get the next component # get the next component
activeEntity=MachineJobShop.getEntity(self) activeEntity=MachineManagedJob.getEntity(self)
# check weather the activeEntity is of type Mould # check weather the activeEntity is of type Mould
try: try:
if activeEntity.type=='Mould': if activeEntity.type=='Mould':
......
...@@ -22,11 +22,11 @@ Created on 15 Jan 2014 ...@@ -22,11 +22,11 @@ Created on 15 Jan 2014
@author: Ioannis @author: Ioannis
''' '''
''' '''
Inherits from QueueJobShop. It is the buffer before the MouldAssembly. Inherits from QueueManagedJob. It is the buffer before the MouldAssembly.
Only if all the mould (order) components are present, will it be able to dispose them Only if all the mould (order) components are present, will it be able to dispose them
''' '''
from QueueJobShop import QueueJobShop from QueueManagedJob import QueueManagedJob
from SimPy.Simulation import now from SimPy.Simulation import now
# =========================================================================== # ===========================================================================
...@@ -39,13 +39,13 @@ class NoCallerError(Exception): ...@@ -39,13 +39,13 @@ class NoCallerError(Exception):
# =========================================================================== # ===========================================================================
# the MouldAssemblyBuffer object # the MouldAssemblyBuffer object
# =========================================================================== # ===========================================================================
class MouldAssemblyBuffer(QueueJobShop): class MouldAssemblyBuffer(QueueManagedJob):
# ======================================================================= # =======================================================================
# the default __init__ method of the QueueJobShop class # the default __init__ method of the QueueManagedJob class
# whereas the default capacity is set to infinity # whereas the default capacity is set to infinity
# ======================================================================= # =======================================================================
def __init__(self, id, name, capacity=-1, dummy=False, schedulingRule="FIFO"): def __init__(self, id, name, capacity=-1, dummy=False, schedulingRule="FIFO"):
QueueJobShop.__init__(self, id=id, name=name, capacity=capacity, dummy=dummy, schedulingRule=schedulingRule) QueueManagedJob.__init__(self, id=id, name=name, capacity=capacity, dummy=dummy, schedulingRule=schedulingRule)
# ======================================================================= # =======================================================================
# Sort the entities of the activeQ # Sort the entities of the activeQ
...@@ -54,7 +54,7 @@ class MouldAssemblyBuffer(QueueJobShop): ...@@ -54,7 +54,7 @@ class MouldAssemblyBuffer(QueueJobShop):
def sortEntities(self): def sortEntities(self):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
# run the default sorting of the Queue first # run the default sorting of the Queue first
QueueJobShop.sortEntities(self) QueueManagedJob.sortEntities(self)
# and in the end sort according to the ConditionalBuffer sorting rule # and in the end sort according to the ConditionalBuffer sorting rule
activeObjectQueue = activeObject.getActiveObjectQueue() activeObjectQueue = activeObject.getActiveObjectQueue()
# if all the components of the same mould are present then move them to the front of the activeQ # if all the components of the same mould are present then move them to the front of the activeQ
...@@ -77,7 +77,7 @@ class MouldAssemblyBuffer(QueueJobShop): ...@@ -77,7 +77,7 @@ class MouldAssemblyBuffer(QueueJobShop):
def getEntity(self): def getEntity(self):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
activeObjectQueue = activeObject.getActiveObjectQueue() activeObjectQueue = activeObject.getActiveObjectQueue()
activeEntity=QueueJobShop.getEntity(self) #execute default behaviour activeEntity=QueueManagedJob.getEntity(self) #execute default behaviour
# if the activeEntity is of type orderComponent # if the activeEntity is of type orderComponent
try: try:
if activeEntity.componentType=='Basic' or 'Secondary': if activeEntity.componentType=='Basic' or 'Secondary':
......
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