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