Example #1
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     # signal used to initiate the generator of the Router
     self.isCalled=self.env.event()
     # list that holds all the objects that can receive
     self.pendingObjects=[]
     self.calledOperator=[]
     # list of the operators that may handle a machine at the current simulation time
     self.candidateOperators=[]
     # list of criteria
     self.multipleCriterionList=[]
     # TODO: find out which must be the default for the scheduling Rule
     self.schedulingRule='WT'
     # flag used to check if the Router is initialised
     self.isInitialized=True
     
     self.invoked=False
     
     self.criticalPending=[]
     self.preemptiveOperators=[]
     
     self.toBeSignalled=[]
     self.conflictingOperators=[]
     self.conflictingEntities=[]
     self.conflictingStations=[]
     self.occupiedReceivers=[]
     self.entitiesWithOccupiedReceivers=[]
Example #2
0
 def __init__(self, victim=None, shiftPattern=[], endUnfinished=False, receiveBeforeEndThreshold=0.0,**kw):
     ObjectInterruption.__init__(self,victim)
     self.type='ShiftScheduler'
     self.shiftPattern=shiftPattern
     self.endUnfinished=endUnfinished    #flag that shows if half processed Jobs should end after the shift ends
     # if the end of shift is below this threshold then the victim is on shift but does not accept new entities
     self.receiveBeforeEndThreshold=receiveBeforeEndThreshold   
Example #3
0
 def __init__(self, id="", name="", victim=None, distribution=None, index=0, repairman=None, **kw):
     ObjectInterruption.__init__(self, id, name, victim=victim)
     self.rngTTF = RandomNumberGenerator(self, distribution.get("TTF", {"Fixed": {"mean": 100}}))
     self.rngTTR = RandomNumberGenerator(self, distribution.get("TTR", {"Fixed": {"mean": 10}}))
     self.name = "F" + str(index)
     self.repairman = repairman  # the resource that may be needed to fix the failure
     # if now resource is needed this will be "None"
     self.type = "PeriodicMaintenance"
Example #4
0
 def __init__(self, id='', name='', operatedMachine=None):
     ObjectInterruption.__init__(self, id, name, victim=operatedMachine)
     self.type = "Broker"
     # variables that have to do with timing
     self.timeOperationStarted = 0
     self.timeLastOperationEnded = 0
     self.timeWaitForOperatorStarted = 0
     self.waitForOperator = False
Example #5
0
 def __init__(self, id='',name='',victim=None, distribution=None, index=0, repairman=None,**kw):
     ObjectInterruption.__init__(self,id,name,victim=victim)
     self.rngTTF=RandomNumberGenerator(self, distribution.get('TTF',{'Fixed':{'mean':100}}))
     self.rngTTR=RandomNumberGenerator(self, distribution.get('TTR',{'Fixed':{'mean':10}}))
     self.name="F"+str(index)
     self.repairman=repairman        # the resource that may be needed to fix the failure
                                     # if now resource is needed this will be "None" 
     self.type="PeriodicMaintenance"
Example #6
0
 def __init__(self, id='',name='', operatedMachine=None):
     ObjectInterruption.__init__(self,id,name,victim=operatedMachine)
     self.type = "Broker"
     # variables that have to do with timing
     self.timeOperationStarted = 0
     self.timeLastOperationEnded = 0
     self.timeWaitForOperatorStarted=0
     self.waitForOperator=False
Example #7
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.timeLastOperationEnded=0
     self.timeOperationStarted=0
     self.timeWaitForOperatorStarted=0
     self.waitForOperator=False
     # Broker events
     self.isCalled=self.env.event()
     self.resourceAvailable=self.env.event()
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.timeLastOperationEnded = 0
     self.timeOperationStarted = 0
     self.timeWaitForOperatorStarted = 0
     self.waitForOperator = False
     # Broker events
     self.isCalled = self.env.event()
     self.resourceAvailable = self.env.event()
Example #9
0
    def __init__(self, victim=None, distribution=None, index=0, repairman=None, offshift=False,
                 deteriorationType='constant',**kw):
        #Process.__init__(self)
        ObjectInterruption.__init__(self,victim)
        if distribution:
            self.distType=distribution.get('distributionType','No')              # the distribution that the failure duration follows
            self.MTTF=distribution.get('MTTF',60)                  # the MTTF
            self.MTTR=distribution.get('MTTR',5)                  # the MTTR  
            self.availability=distribution.get('availability',100)  # the availability      
        else:
            self.distType='No'
            self.MTTF=60
            self.MTTR=5
            self.availability=100
        self.name="F"+str(index)
        self.repairman=repairman        # the resource that may be needed to fix the failure
                                        # if now resource is needed this will be "None" 
        self.type="Failure"
        self.id=0

        # shows how the time to failure is measured
        # 'constant' means it counts not matter the state of the victim
        # 'onShift' counts only if the victim is onShift
        # 'working' counts only working time
        self.deteriorationType=deteriorationType
        
        if(self.distType=="Availability"):      
            
            # -------------------------------------------------------------- 
            #     the following are used if we have availability defined 
            #      (as in plant) the erlang is a special case of Gamma. 
            #        To model the Mu and sigma (that is given in plant) 
            #    as alpha and beta for gamma you should do the following:
            #                     beta=(sigma^2)/Mu    
            #                     alpha=Mu/beta
            # --------------------------------------------------------------    
            self.AvailabilityMTTF=self.MTTR*(float(availability)/100)/(1-(float(availability)/100))
            self.sigma=0.707106781185547*self.MTTR   
            self.theta=(pow(self.sigma,2))/float(self.MTTR)             
            self.beta=self.theta
            self.alpha=(float(self.MTTR)/self.theta)        
            self.rngTTF=RandomNumberGenerator(self, "Exp")
            self.rngTTF.avg=self.AvailabilityMTTF
            self.rngTTR=RandomNumberGenerator(self, "Erlang")
            self.rngTTR.alpha=self.alpha
            self.rngTTR.beta=self.beta       
        else:   
            # --------------------------------------------------------------
            #               if the distribution is fixed
            # --------------------------------------------------------------
            self.rngTTF=RandomNumberGenerator(self, self.distType)
            self.rngTTF.mean=self.MTTF
            self.rngTTR=RandomNumberGenerator(self, self.distType)
            self.rngTTR.mean=self.MTTR
        # flag used to identify if the time between failures should be counted while the victim is off-shift
        self.offshift=offshift
Example #10
0
 def __init__(self, id='', name='', victim=None, shiftPattern=[], endUnfinished=False, receiveBeforeEndThreshold=0.0,
              thresholdTimeIsOnShift=True,**kw):
     ObjectInterruption.__init__(self,victim=victim)
     self.type='ShiftScheduler'
     self.shiftPattern=shiftPattern
     self.endUnfinished=endUnfinished    #flag that shows if half processed Jobs should end after the shift ends
     # if the end of shift is below this threshold then the victim is on shift but does not accept new entities
     self.receiveBeforeEndThreshold=receiveBeforeEndThreshold   
     # flag that shows if the threshold time is counted as off-shift or waiting
     self.thresholdTimeIsOnShift=thresholdTimeIsOnShift
Example #11
0
 def __init__(self, id='',name='',victim=None, distribution={},
              endUnfinished=True,offShiftAnticipation=0,**kw):
     ObjectInterruption.__init__(self,id,name,victim=victim)
     self.rngTTB=RandomNumberGenerator(self, distribution.get('TTB',{'Fixed':{'mean':100}}))
     self.rngTTR=RandomNumberGenerator(self, distribution.get('TTR',{'Fixed':{'mean':10}}))
     self.type="Break"
     # end current wip before going to break
     self.endUnfinished=endUnfinished
     # if the break is close to end of shift below a limit it will be suspended
     self.offShiftAnticipation=offShiftAnticipation
 def __init__(self, id='', name='', operatedMachine=None):
     ObjectInterruption.__init__(self, id, name, victim=operatedMachine)
     self.type = "Broker"
     # variables that have to do with timing
     self.timeOperationStarted = 0
     self.timeLastOperationEnded = 0
     self.timeWaitForOperatorStarted = 0
     self.waitForOperator = False
     # flag that shows if broker was called to request or release operator.
     # Machine updates this before calling the broker
     self.invokeType = 'request'
Example #13
0
 def __init__(self, id='',name='', operatedMachine=None):
     ObjectInterruption.__init__(self,id,name,victim=operatedMachine)
     self.type = "Broker"
     # variables that have to do with timing
     self.timeOperationStarted = 0
     self.timeLastOperationEnded = 0
     self.timeWaitForOperatorStarted=0
     self.waitForOperator=False
     # flag that shows if broker was called to request or release operator. 
     # Machine updates this before calling the broker
     self.invokeType='request'
Example #14
0
 def __init__(self, id=id, name=None, start=None, stop=None, interval=None,
              duration=None, method=None, argumentDict=None):
     ObjectInterruption.__init__(self)
     self.id=id
     self.name=name
     self.start=start                #the time that the generator will be activated for the first time
     self.stop=stop                  #the time that the generator will stop to trigger events
     self.interval=interval          #the interval that the generator sleeps
     self.duration=duration          #the duration that the generation is awake (this is not active for now)
     self.method=method              #the method to be invoked
     self.argumentDict=argumentDict  #the arguments of the method given in a dict
Example #15
0
 def __init__(self, victim=None, start=0, duration=1, endStatus='interrupted',**kw):
     '''
         interrupted    : the maintenance starts immediately
         loaded         : the maintenance starts as soon as the victim has ended processing
         emptied        : the maintenance starts as soon as the victim is empty
     '''
     self.type="ScheduledMaintenance"
     ObjectInterruption.__init__(self,victim)
     self.start=start
     self.duration=duration
     # the victim can be 'interrupted', 'loaded' or 'emptied' when the maintenance interruption happens
     self.endStatus=endStatus
Example #16
0
 def __init__(self):
     ObjectInterruption.__init__(self)
     self.type = "Router"
     self.isInitialized=False
     self.isActivated=False
     self.candidateOperators=[]
     # list of objects to be signalled by the Router
     self.toBeSignalled=[]
     # flag to notify whether the router is already invoked
     self.invoked=False
     self.preemptiveOperators=[]                  # list of preemptiveOperators that should preempt their machines
     self.criticalQueues=[]
     self.pending=[]                              # list of entities that require operators now
Example #17
0
 def __init__(self):
     ObjectInterruption.__init__(self)
     self.type = "Router"
     self.isInitialized=False
     self.isActivated=False
     self.candidateOperators=[]
     # list of objects to be signalled by the Router
     self.toBeSignalled=[]
     # flag to notify whether the router is already invoked
     self.invoked=False
     self.preemptiveOperators=[]                  # list of preemptiveOperators that should preempt their machines
     self.criticalQueues=[]
     self.pending=[]                              # list of entities that require operators now
     from Globals import G
     G.RouterList.append(self)
Example #18
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     # signal used to initiate the generator of the Router
     self.isCalled=self.env.event()
     # lists that hold all the objects that can receive
     self.pendingMachines=[]
     self.pendingQueues=[]
     # list of the operators that may handle a machine at the current simulation time
     self.candidateOperators=[]
     # flag used to check if the Router is initialised
     self.isInitialized=True
     self.invoked=False
     self.preemptiveOperators=[]
     self.toBeSignalled=[]
     self.criticalQueues=[]
     self.pending=[]                              # list of entities that require operators now
Example #19
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     # signal used to initiate the generator of the Router
     self.isCalled = self.env.event()
     # lists that hold all the objects that can receive
     self.pendingMachines = []
     self.pendingQueues = []
     # list of the operators that may handle a machine at the current simulation time
     self.candidateOperators = []
     # flag used to check if the Router is initialised
     self.isInitialized = True
     self.invoked = False
     self.preemptiveOperators = []
     self.toBeSignalled = []
     self.criticalQueues = []
     self.pending = []  # list of entities that require operators now
Example #20
0
    def __init__(self, victim=None, distribution=None, index=0, repairman=None):
        #Process.__init__(self)
        ObjectInterruption.__init__(self,victim)
        if distribution:
            self.distType=distribution.get('distributionType','No')              # the distribution that the failure duration follows
            self.MTTF=distribution.get('MTTF',60)                  # the MTTF
            self.MTTR=distribution.get('MTTR',5)                  # the MTTR  
            self.availability=distribution.get('availability',100)  # the availability      
        else:
            self.distType='No'
            self.MTTF=60
            self.MTTR=5
            self.availability=100
        self.name="F"+str(index)
        self.repairman=repairman        # the resource that may be needed to fix the failure
                                        # if now resource is needed this will be "None" 
        self.type="Failure"
        self.id=0

        if(self.distType=="Availability"):      
            
            # -------------------------------------------------------------- 
            #     the following are used if we have availability defined 
            #      (as in plant) the erlang is a special case of Gamma. 
            #        To model the Mu and sigma (that is given in plant) 
            #    as alpha and beta for gamma you should do the following:
            #                     beta=(sigma^2)/Mu    
            #                     alpha=Mu/beta
            # --------------------------------------------------------------    
            self.AvailabilityMTTF=self.MTTR*(float(availability)/100)/(1-(float(availability)/100))
            self.sigma=0.707106781185547*self.MTTR   
            self.theta=(pow(self.sigma,2))/float(self.MTTR)             
            self.beta=self.theta
            self.alpha=(float(self.MTTR)/self.theta)        
            self.rngTTF=RandomNumberGenerator(self, "Exp")
            self.rngTTF.avg=self.AvailabilityMTTF
            self.rngTTR=RandomNumberGenerator(self, "Erlang")
            self.rngTTR.alpha=self.alpha
            self.rngTTR.beta=self.beta       
        else:   
            # --------------------------------------------------------------
            #               if the distribution is fixed
            # --------------------------------------------------------------
            self.rngTTF=RandomNumberGenerator(self, self.distType)
            self.rngTTF.mean=self.MTTF
            self.rngTTR=RandomNumberGenerator(self, self.distType)
            self.rngTTR.mean=self.MTTR
Example #21
0
 def __init__(self, id=id, name=None, start=0, stop=float('inf'), interval=1,
              duration=0, method=None, argumentDict={}, **kw):
     ObjectInterruption.__init__(self)
     self.id=id
     self.name=name
     self.start=float(start)                #the time that the generator will be activated for the first time
     self.stop=float(stop)                  #the time that the generator will stop to trigger events
     self.interval=float(interval)          #the interval that the generator sleeps
     self.duration=float(duration)          #the duration that the generation is awake (this is not active for now)
     self.method=method              #the method to be invoked
     self.argumentDict=argumentDict  #the arguments of the method given in a dict
     from Globals import G
     G.EventGeneratorList.append(self)
     self.method=method
     if isinstance(method, basestring):
         import Globals
         self.method=Globals.getMethodFromName(method)
Example #22
0
 def __init__(self,
              id='',
              name='',
              victim=None,
              shiftPattern=[],
              endUnfinished=False,
              receiveBeforeEndThreshold=0.0,
              thresholdTimeIsOnShift=True,
              **kw):
     ObjectInterruption.__init__(self, victim=victim)
     self.type = 'ShiftScheduler'
     self.shiftPattern = shiftPattern
     self.endUnfinished = endUnfinished  #flag that shows if half processed Jobs should end after the shift ends
     # if the end of shift is below this threshold then the victim is on shift but does not accept new entities
     self.receiveBeforeEndThreshold = receiveBeforeEndThreshold
     # flag that shows if the threshold time is counted as off-shift or waiting
     self.thresholdTimeIsOnShift = thresholdTimeIsOnShift
 def __init__(self,
              id='',
              name='',
              victim=None,
              start=0,
              duration=1,
              endStatus='interrupted',
              **kw):
     '''
         interrupted    : the maintenance starts immediately
         loaded         : the maintenance starts as soon as the victim has ended processing
         emptied        : the maintenance starts as soon as the victim is empty
     '''
     self.type = "ScheduledMaintenance"
     ObjectInterruption.__init__(self, victim=victim)
     self.start = start
     self.duration = duration
     # the victim can be 'interrupted', 'loaded' or 'emptied' when the maintenance interruption happens
     self.endStatus = endStatus
Example #24
0
 def __init__(self, id='',name='',victim=None, distribution={}, index=0, repairman=None, offshift=False,
              deteriorationType='constant',
              waitOnTie=False,**kw):
     ObjectInterruption.__init__(self,id,name,victim=victim)
     self.rngTTF=RandomNumberGenerator(self, distribution.get('TTF',{'Fixed':{'mean':100}}))
     self.rngTTR=RandomNumberGenerator(self, distribution.get('TTR',{'Fixed':{'mean':10}}))
     self.name="F"+str(index)
     self.repairman=repairman        # the resource that may be needed to fix the failure
                                     # if now resource is needed this will be "None" 
     self.type="Failure"
     
     # shows how the time to failure is measured
     # 'constant' means it counts not matter the state of the victim
     # 'onShift' counts only if the victim is onShift
     # 'working' counts only working time
     self.deteriorationType=deteriorationType
     # flag used to identify if the time between failures should be counted while the victim is off-shift
     self.offshift=offshift
     # flag to show if the failure will wait on tie with other events before interrupting the victim
     self.waitOnTie=waitOnTie
Example #25
0
 def __init__(self,
              id='',
              name='',
              victim=None,
              distribution={},
              endUnfinished=True,
              offShiftAnticipation=0,
              **kw):
     ObjectInterruption.__init__(self, id, name, victim=victim)
     self.rngTTB = RandomNumberGenerator(
         self, distribution.get('TTB', {'Fixed': {
             'mean': 100
         }}))
     self.rngTTR = RandomNumberGenerator(
         self, distribution.get('TTR', {'Fixed': {
             'mean': 10
         }}))
     self.type = "Break"
     # end current wip before going to break
     self.endUnfinished = endUnfinished
     # if the break is close to end of shift below a limit it will be suspended
     self.offShiftAnticipation = offShiftAnticipation
Example #26
0
 def __init__(self,
              id=id,
              name=None,
              start=0,
              stop=float('inf'),
              interval=1,
              duration=0,
              method=None,
              argumentDict={},
              **kw):
     ObjectInterruption.__init__(self)
     self.id = id
     self.name = name
     self.start = float(
         start
     )  #the time that the generator will be activated for the first time
     self.stop = float(
         stop)  #the time that the generator will stop to trigger events
     # negative stop means infinity
     if self.stop < 0:
         self.stop = float('inf')
     self.interval = float(
         interval)  #the interval that the generator sleeps
     self.duration = float(
         duration
     )  #the duration that the generation is awake (this is not active for now)
     self.method = method  #the method to be invoke
     self.argumentDict = argumentDict
     # if the argumentDict is passed as string convert it to dict
     if isinstance(self.argumentDict, basestring):
         import ast
         self.argumentDict = ast.literal_eval(self.argumentDict)
     from Globals import G
     G.EventGeneratorList.append(self)
     self.method = method
     if isinstance(method, basestring):
         import Globals
         self.method = Globals.getMethodFromName(method)
Example #27
0
 def __init__(self,sorting=False):
     ObjectInterruption.__init__(self)
     self.type = "Router"
     self.isInitialized=False
     self.isActivated=False
     self.candidateOperators=[]
     self.multipleCriterionList=[]
     self.schedulingRule='WT'
     # boolean flag to check whether the Router should perform sorting on operators and on pendingEntities
     self.sorting=sorting
     # list of objects to be signalled by the Router
     self.toBeSignalled=[]
     # flag to notify whether the router is already invoked
     self.invoked=False
     
     self.criticalPending=[]                      # list of critical entities that are pending
     self.preemptiveOperators=[]                  # list of preemptiveOperators that should preempt their machines
     
     self.conflictingOperators=[]                 # list with the operators that have candidateEntity with conflicting candidateReceivers
     self.conflictingEntities=[]                  # entities with conflictingReceivers
     self.conflictingStations=[]                  # stations with conflicting operators
     self.occupiedReceivers=[]                    # occupied candidateReceivers of a candidateEntity
     self.entitiesWithOccupiedReceivers=[]        # list of entities that have no available receivers
Example #28
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.remainingBreakPattern=list(self.breakPattern) 
     self.waitingSignal=False
Example #29
0
    def initialize(self):
        ObjectInterruption.initialize(self)
        self.remainingShiftPattern=list(self.shiftPattern) 
#         self.victimEndedLastProcessing=self.env.event()
        self.waitingSignal=False
Example #30
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.readData()
     self.FDC=FutureDemandCreator()
Example #31
0
 def __init__(self, victim=None, shiftPattern=[], endUnfinished=False):
     ObjectInterruption.__init__(self,victim)
     self.type='ShiftScheduler'
     self.shiftPattern=shiftPattern
     self.endUnfinished=endUnfinished    #flag that shows if half processed Jobs should end after the shift ends
Example #32
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.remainingShiftPattern=list(self.shiftPattern) 
Example #33
0
    def initialize(self):
        ObjectInterruption.initialize(self) 
#         self.victimEndedLastProcessing=self.env.event()
        self.waitingSignal=False
        # not used yet
        self.victimIsEmptyBeforeMaintenance=self.env.event()
Example #34
0
 def __init__(self, id=id, name=None, argumentDict={}):
     ObjectInterruption.__init__(self)
     self.id=id
     self.name=name
     self.argumentDict=argumentDict  #the arguments of the method given in a dict        
     self.initialize()
Example #35
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.readData()
     self.FDC=FutureDemandCreator()
     from Globals import G
     G.AllocationManagementList.append(self)
Example #36
0
 def __init__(self, victim=None, start=0, duration=1):
     ObjectInterruption.__init__(self,victim)
     self.start=start
     self.duration=duration
Example #37
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.readData()
     self.FDC = FutureDemandCreator()
     from Globals import G
     G.AllocationManagementList.append(self)
Example #38
0
 def __init__(self, id=id, name=None, argumentDict={}):
     ObjectInterruption.__init__(self)
     self.id = id
     self.name = name
     self.argumentDict = argumentDict  #the arguments of the method given in a dict
     self.initialize()
Example #39
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.victimStartsProcess = self.env.event()
     self.victimEndsProcess = self.env.event()
Example #40
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.remainingShiftPattern = list(self.shiftPattern)
     #         self.victimEndedLastProcessing=self.env.event()
     self.waitingSignal = False
 def initialize(self):
     ObjectInterruption.initialize(self)
     #         self.victimEndedLastProcessing=self.env.event()
     self.waitingSignal = False
     # not used yet
     self.victimIsEmptyBeforeMaintenance = self.env.event()
Example #42
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.remainingBreakPattern = list(self.breakPattern)
     self.waitingSignal = False
Example #43
0
 def initialize(self):
     ObjectInterruption.initialize(self)
     self.victimStartsProcess = self.env.event()
     self.victimEndsProcess = self.env.event()