Skip to content
Permalink
Browse files

Fixed infinite scheduler loop

  • Loading branch information...
m-hoff committed Aug 7, 2019
1 parent cd3bfec commit 34278d22693b08755dda061d4df46c48b379c5b3
Showing with 10 additions and 4 deletions.
  1. +5 −2 maintsim/Machine.py
  2. +5 −2 maintsim/Scheduler.py
@@ -177,8 +177,11 @@ def working(self):
yield self.env.process(self.maintain())

# stop production until online
while self.down:
yield self.env.timeout(1)
# while self.down:
# yield self.env.timeout(1)

if not self.system.allow_new_maintenance:
self.degradation = np.eye(self.failed_state+1)

def maintain(self):
if self.repair_type == 'CBM':
@@ -37,7 +37,7 @@ def choose_next(self, queue):

if self.system.debug:
print(f'Scheduler interrupting M{next_machine.i} processing at t={self.env.now}', f'Available maintenance {self.system.available_maintenance}')
next_machine.process.interrupt()
#next_machine.process.interrupt()

return next_machines # returns machine that will begin maintenance

@@ -68,7 +68,10 @@ def scheduling(self):
else: # len(queue) > capacity
# flag all next machines for maintenance
for machine in self.choose_next(queue):
machine.assigned_maintenance = True
#machine.assigned_maintenance = True
if self.system.debug:
print(f'M{machine.i} chosen next for maintenance at t={self.env.now}')
machine.process.interrupt()

yield self.env.timeout(1)

0 comments on commit 34278d2

Please sign in to comment.
You can’t perform that action at this time.