preemption enabled for unoperated MachineJobShops

parent e2e10cac
...@@ -566,12 +566,6 @@ class CoreObject(Process): ...@@ -566,12 +566,6 @@ class CoreObject(Process):
def unAssignExit(self): def unAssignExit(self):
self.exitAssignedToReceiver = None self.exitAssignedToReceiver = None
# # =======================================================================
# # actions to be carried whenever the object is preemptied
# # =======================================================================
# def preempt(self):
# pass
# ======================================================================= # =======================================================================
# actions to be carried whenever the object is interrupted # actions to be carried whenever the object is interrupted
# (failure, break, preemption, etc) # (failure, break, preemption, etc)
......
This diff is collapsed.
...@@ -86,12 +86,16 @@ class MachineJobShop(Machine): ...@@ -86,12 +86,16 @@ class MachineJobShop(Machine):
if not activeObject.onShift: if not activeObject.onShift:
activeObject.timeLastShiftEnded=now() activeObject.timeLastShiftEnded=now()
# update the total working time # the total processing time for this entity is what the distribution initially gave # update the total working time # the total processing time for this entity is what the distribution initially gave
activeObject.totalWorkingTime+=activeObject.totalProcessingTimeInCurrentEntity if not self.shouldPreempt:
activeObject.totalWorkingTime+=activeObject.totalProcessingTimeInCurrentEntity
else:
activeObject.totalWorkingTime+=now()-(self.timeLastEntityEntered)
# update the variables keeping track of Entity related attributes of the machine # update the variables keeping track of Entity related attributes of the machine
activeObject.timeLastEntityEnded=now() # this holds the time that the last entity ended processing in Machine activeObject.timeLastEntityEnded=now() # this holds the time that the last entity ended processing in Machine
activeObject.nameLastEntityEnded=activeObject.currentEntity.name # this holds the name of the last entity that ended processing in Machine activeObject.nameLastEntityEnded=activeObject.currentEntity.name # this holds the name of the last entity that ended processing in Machine
activeObject.completedJobs+=1 # Machine completed one more Job activeObject.completedJobs+=1 # Machine completed one more Job
# reseting the preemption flag
self.shouldPreempt=False
# TODO: collapse that to Machine # TODO: collapse that to Machine
...@@ -214,37 +218,40 @@ class MachineJobShop(Machine): ...@@ -214,37 +218,40 @@ class MachineJobShop(Machine):
and (thecaller in activeObject.next)\ and (thecaller in activeObject.next)\
and thecaller.isInRoute(activeObject) and thecaller.isInRoute(activeObject)
# # ======================================================================= # =======================================================================
# # method to execute preemption # method to execute preemption
# # ======================================================================= # =======================================================================
# def preempt(self): def preempt(self):
# activeObject=self.getActiveObject() activeObject=self.getActiveObject()
# activeEntity=self.getActiveObjectQueue()[0] #get the active Entity activeEntity=self.getActiveObjectQueue()[0] #get the active Entity
# #calculate the remaining processing time #calculate the remaining processing time
# #if it is reset then set it as the original processing time #if it is reset then set it as the original processing time
# if self.resetOnPreemption: if self.resetOnPreemption:
# remainingProcessingTime=self.procTime remainingProcessingTime=self.procTime
# #else subtract the time that passed since the entity entered #else subtract the time that passed since the entity entered
# #(may need also failure time if there was. TO BE MELIORATED) #(may need also failure time if there was. TO BE MELIORATED)
# else: else:
# remainingProcessingTime=self.procTime-(now()-self.timeLastEntityEntered) remainingProcessingTime=self.procTime-(now()-self.timeLastEntityEntered)
# #update the remaining route of activeEntity #update the remaining route of activeEntity
# activeEntity.remainingRoute.insert(0, {'stationIdsList':[str(self.id)],\ activeEntity.remainingRoute.insert(0, {'stationIdsList':[str(self.id)],\
# 'processingTime':\ 'processingTime':\
# {'distributionType':'Fixed',\ {'distributionType':'Fixed',\
# 'mean':str(remainingProcessingTime)}}) 'mean':str(remainingProcessingTime)}})
# # activeEntity.remainingRoute.insert(0, [self.id, remainingProcessingTime]) # activeEntity.remainingRoute.insert(0, [self.id, remainingProcessingTime])
# activeEntity.remainingRoute.insert(0, {'stationIdsList':[str(self.lastGiver.id)],\ activeEntity.remainingRoute.insert(0, {'stationIdsList':[str(self.lastGiver.id)],\
# 'processingTime':\ 'processingTime':\
# {'distributionType':'Fixed',\ {'distributionType':'Fixed',\
# 'mean':'0'}}) 'mean':'0'}})
# # activeEntity.remainingRoute.insert(0, [self.lastGiver.id, 0]) # activeEntity.remainingRoute.insert(0, [self.lastGiver.id, 0])
# #set the receiver as the object where the active entity was preempted from #set the receiver as the object where the active entity was preempted from
# self.receiver=self.lastGiver self.receiver=self.lastGiver
# self.next=[self.receiver] self.next=[self.receiver]
# self.waitToDispose=True #set that I have to dispose self.waitToDispose=True #set that I have to dispose
# self.receiver.timeLastEntityEnded=now() #required to count blockage correctly in the preemptied station self.receiver.timeLastEntityEnded=now() #required to count blockage correctly in the preemptied station
# reactivate(self) # TODO: use a signal and wait for it, reactivation is not recognised as interruption
reactivate(self)
# TODO: consider the case when a failure has the Station down. The event preempt will not be received now()
# but at a later simulation time.
#=========================================================================== #===========================================================================
# extend the default behaviour to check if whether the station # extend the default behaviour to check if whether the station
......
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