Commit 34b02de8 authored by Georgios Dagkakis's avatar Georgios Dagkakis

additions so that break interrupts the victim

parent 9b24d077
This diff is collapsed.
...@@ -47,6 +47,10 @@ class ObjectResource(ManPyObject): ...@@ -47,6 +47,10 @@ class ObjectResource(ManPyObject):
def initialize(self): def initialize(self):
from Globals import G from Globals import G
# flag that shows if the resource is on shift
self.onShift=True
# flag that shows if the resource is on break
self.onBreak=False
self.env=G.env self.env=G.env
self.timeLastOperationStarted=0 #holds the time that the last repair was started self.timeLastOperationStarted=0 #holds the time that the last repair was started
self.Res=simpy.Resource(self.env, capacity=self.capacity) self.Res=simpy.Resource(self.env, capacity=self.capacity)
...@@ -67,7 +71,7 @@ class ObjectResource(ManPyObject): ...@@ -67,7 +71,7 @@ class ObjectResource(ManPyObject):
# ======================================================================= # =======================================================================
def checkIfResourceIsAvailable(self,callerObject=None): def checkIfResourceIsAvailable(self,callerObject=None):
# return true if the operator is idle and on shift # return true if the operator is idle and on shift
return len(self.Res.users)<self.capacity and self.onShift and (not self.isLocked) return len(self.Res.users)<self.capacity and self.onShift and (not self.isLocked) and (not self.onBreak)
# ======================================================================= # =======================================================================
......
...@@ -97,8 +97,6 @@ class Operator(ObjectResource): ...@@ -97,8 +97,6 @@ class Operator(ObjectResource):
def initialize(self): def initialize(self):
ObjectResource.initialize(self) ObjectResource.initialize(self)
# flag that shows if the resource is on shift
self.onShift=True
self.totalWorkingTime=0 #holds the total working time self.totalWorkingTime=0 #holds the total working time
self.totalWaitingTime=0 #holds the total waiting time self.totalWaitingTime=0 #holds the total waiting time
self.totalOffShiftTime=0 #holds the total off-shift time self.totalOffShiftTime=0 #holds the total off-shift time
......
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