本文整理汇总了Python中ObjectInterruption.ObjectInterruption类的典型用法代码示例。如果您正苦于以下问题:Python ObjectInterruption类的具体用法?Python ObjectInterruption怎么用?Python ObjectInterruption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectInterruption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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
示例2: initialize
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=[]
示例3: __init__
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"
示例4: __init__
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
示例5: initialize
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()
示例6: __init__
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
示例7: __init__
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
示例8: __init__
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
示例9: __init__
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
示例10: __init__
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'
示例11: __init__
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
示例12: __init__
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)
示例13: initialize
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
示例14: __init__
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
示例15: __init__
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)