schedule of operators and entities now defined as dictionary

parent 1cf21501
...@@ -51,6 +51,6 @@ class Batch(Entity): ...@@ -51,6 +51,6 @@ class Batch(Entity):
route=[] route=[]
for child in self.subBatchList: for child in self.subBatchList:
for step in child.schedule: for step in child.schedule:
route.append(step[0]) route.append(step["station"])
route=list(set(route)) route=list(set(route))
return route return route
...@@ -299,7 +299,7 @@ class CoreObject(ManPyObject): ...@@ -299,7 +299,7 @@ class CoreObject(ManPyObject):
#remember that every entity has it's schedule which is supposed to be updated every time #remember that every entity has it's schedule which is supposed to be updated every time
# he entity enters a new object # he entity enters a new object
if entity.schedule: if entity.schedule:
entity.schedule[-1].append(self.env.now) entity.schedule[-1]["exitTime"] = self.env.now
# update wipStatList # update wipStatList
if self.gatherWipStat: if self.gatherWipStat:
...@@ -369,8 +369,9 @@ class CoreObject(ManPyObject): ...@@ -369,8 +369,9 @@ class CoreObject(ManPyObject):
#append the time to schedule so that it can be read in the result #append the time to schedule so that it can be read in the result
#remember that every entity has it's schedule which is supposed to be updated every time #remember that every entity has it's schedule which is supposed to be updated every time
# he entity enters a new object # the entity enters a new object
activeEntity.schedule.append([self,self.env.now]) activeEntity.schedule.append({"station": self,
"entranceTime": self.env.now})
#update variables #update variables
activeEntity.currentStation=self activeEntity.currentStation=self
self.timeLastEntityEntered=self.env.now self.timeLastEntityEntered=self.env.now
......
...@@ -33,12 +33,12 @@ def main(test=0): ...@@ -33,12 +33,12 @@ def main(test=0):
if test: if test:
returnSchedule=[] returnSchedule=[]
for record in J.schedule: for record in J.schedule:
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record["station"].objName,record["entranceTime"]])
return returnSchedule return returnSchedule
# print the results # print the results
for record in J.schedule: for record in J.schedule:
print J.name, "got into", record[0].objName, "at", record[1] print J.name, "got into", record["station"].objName, "at", record["entranceTime"]
if __name__ == '__main__': if __name__ == '__main__':
main() main()
\ No newline at end of file
...@@ -32,8 +32,8 @@ def main(): ...@@ -32,8 +32,8 @@ def main():
#loop in the schedule to print the results #loop in the schedule to print the results
schedule=[] schedule=[]
for record in J.schedule: for record in J.schedule:
schedule.append([record[0].objName,record[1]]) schedule.append([record["station"].objName,record["entranceTime"]])
print J.name, "got into", record[0].objName, "at", record[1] print J.name, "got into", record["station"].objName, "at", record["entranceTime"]
ExcelHandler.outputTrace('TRACE') ExcelHandler.outputTrace('TRACE')
return schedule return schedule
......
...@@ -57,13 +57,13 @@ def main(test=0): ...@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule=[] returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record["station"].objName,record["entranceTime"]])
return returnSchedule return returnSchedule
# print the results # print the results
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record["station"].objName, "at", record["entranceTime"]
print "-"*30 print "-"*30
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -57,13 +57,13 @@ def main(test=0): ...@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule=[] returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record["station"].objName,record["entranceTime"]])
return returnSchedule return returnSchedule
# print the results # print the results
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record["station"].objName, "at", record["entranceTime"]
print "-"*30 print "-"*30
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -57,13 +57,13 @@ def main(test=0): ...@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule=[] returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record["station"].objName,record["entranceTime"]])
return returnSchedule return returnSchedule
# print the results # print the results
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record["station"].objName, "at", record["entranceTime"]
print "-"*30 print "-"*30
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -57,13 +57,13 @@ def main(test=0): ...@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule=[] returnSchedule=[]
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
returnSchedule.append([record[0].objName,record[1]]) returnSchedule.append([record["station"].objName,record["entranceTime"]])
return returnSchedule return returnSchedule
# print the results # print the results
for job in [J1,J2,J3]: for job in [J1,J2,J3]:
for record in job.schedule: for record in job.schedule:
print job.name, "got into", record[0].objName, "at", record[1] print job.name, "got into", record["station"].objName, "at", record["entranceTime"]
print "-"*30 print "-"*30
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -47,9 +47,9 @@ def outputLog(fileName='Log', entityList=G.EntityList): ...@@ -47,9 +47,9 @@ def outputLog(fileName='Log', entityList=G.EntityList):
for entity in entityList: for entity in entityList:
for stop in entity.schedule: for stop in entity.schedule:
logSheet.write(logIndex,0,entity.name) logSheet.write(logIndex,0,entity.name)
logSheet.write(logIndex,1,stop[0].id) logSheet.write(logIndex,1,stop["station"].id)
logSheet.write(logIndex,2,stop[0].objName) logSheet.write(logIndex,2,stop["station"].objName)
logSheet.write(logIndex,3,stop[1]) logSheet.write(logIndex,3,stop["entranceTime"])
logIndex+=1 #increment the row logIndex+=1 #increment the row
#if we reach row 65536 we need to create a new sheet (excel limitation) #if we reach row 65536 we need to create a new sheet (excel limitation)
if(logIndex==65536): if(logIndex==65536):
......
...@@ -217,7 +217,8 @@ def setWIP(entityList): ...@@ -217,7 +217,8 @@ def setWIP(entityList):
if entity.currentStation: if entity.currentStation:
object=entity.currentStation #identify the object object=entity.currentStation #identify the object
object.getActiveObjectQueue().append(entity) #append the entity to its Queue object.getActiveObjectQueue().append(entity) #append the entity to its Queue
entity.schedule.append([object,G.env.now]) #append the time to schedule so that it can be read in the result entity.schedule.append({"station": object,
"entranceTime": G.env.now}) #append the time to schedule so that it can be read in the result
# if the entity is of type Job/OrderComponent/Order/Mould # if the entity is of type Job/OrderComponent/Order/Mould
...@@ -256,7 +257,8 @@ def setWIP(entityList): ...@@ -256,7 +257,8 @@ def setWIP(entityList):
object.next.append(nextObject) object.next.append(nextObject)
entity.remainingRoute.pop(0) # remove data from the remaining route. entity.remainingRoute.pop(0) # remove data from the remaining route.
entity.schedule.append([object,G.env.now]) #append the time to schedule so that it can be read in the result entity.schedule.append({"station": object,
"entranceTime": G.env.now}) #append the time to schedule so that it can be read in the result
# if the currentStation of the entity is of type Machine then the entity # if the currentStation of the entity is of type Machine then the entity
# must be processed first and then added to the pendingEntities list # must be processed first and then added to the pendingEntities list
......
...@@ -85,21 +85,21 @@ class Job(Entity): # inherits from the Entity c ...@@ -85,21 +85,21 @@ class Job(Entity): # inherits from the Entity c
# if there is schedule # if there is schedule
if self.schedule: if self.schedule:
#if the Job has reached an exit, input completion time in the results #if the Job has reached an exit, input completion time in the results
if self.schedule[-1][0].type=='Exit': if self.schedule[-1]["station"].type=='Exit':
json['results']['completionTime']=self.schedule[-1][1] json['results']['completionTime']=self.schedule[-1]["entranceTime"]
completionTime=self.schedule[-1][1] completionTime=self.schedule[-1]["entranceTime"]
# TODO # TODO
# if the entity is of type Mould and the last object holding it is orderDecomposition # if the entity is of type Mould and the last object holding it is orderDecomposition
# XXX now Orders do not run through the system but OrderDesigns do # XXX now Orders do not run through the system but OrderDesigns do
elif self.type=='OrderDesign' and self.schedule[-1][0].type=='OrderDecomposition': # elif self.type=='OrderDesign' and self.schedule[-1]["station"].type=='OrderDecomposition': #
json['results']['completionTime']=self.schedule[-1][1] json['results']['completionTime']=self.schedule[-1]["entranceTime"]
completionTime=self.schedule[-1][1] completionTime=self.schedule[-1]["entranceTime"]
# TODO : check if there is a need for setting a different 'type' for the MouldAssembly than 'Machine' # TODO : check if there is a need for setting a different 'type' for the MouldAssembly than 'Machine'
# ask Georgios if the method __class__.__name__ of finding the class type of the last step is correct # ask Georgios if the method __class__.__name__ of finding the class type of the last step is correct
# if the entity is of type orderComponent and the last step in it's schedule is Assembly # if the entity is of type orderComponent and the last step in it's schedule is Assembly
elif self.type=='OrderComponent' and self.schedule[-1][0].__class__.__name__ in set(['MouldAssemblyManaged','MouldAssembly']): elif self.type=='OrderComponent' and self.schedule[-1]["station"].__class__.__name__ in set(['MouldAssemblyManaged','MouldAssembly']):
json['results']['completionTime']=self.schedule[-1][1] json['results']['completionTime']=self.schedule[-1]["entranceTime"]
completionTime=self.schedule[-1][1] completionTime=self.schedule[-1]["entranceTime"]
#else input "still in progress" #else input "still in progress"
else: else:
json['results']['completionTime']="still in progress" json['results']['completionTime']="still in progress"
...@@ -112,9 +112,9 @@ class Job(Entity): # inherits from the Entity c ...@@ -112,9 +112,9 @@ class Job(Entity): # inherits from the Entity c
json['results']['schedule']=[] json['results']['schedule']=[]
i=0 i=0
for record in self.schedule: for record in self.schedule:
json['results']['schedule'].append({}) # dictionary holding time and json['results']['schedule'].append({}) # dictionary holding time and
json['results']['schedule'][i]['stationId']=record[0].id # id of the Object json['results']['schedule'][i]['stationId']=record["station"].id # id of the Object
json['results']['schedule'][i]['entranceTime']=record[1] # time entering the Object json['results']['schedule'][i]['entranceTime']=record["entranceTime"] # time entering the Object
i+=1 i+=1
G.outputJSON['elementList'].append(json) G.outputJSON['elementList'].append(json)
...@@ -322,21 +322,21 @@ class Job(Entity): # inherits from the Entity c ...@@ -322,21 +322,21 @@ class Job(Entity): # inherits from the Entity c
if self.schedule: if self.schedule:
for record in self.schedule: for record in self.schedule:
# find the station of this step # find the station of this step
station=record[0] # XXX should also hold a list with all the machines G.MachineList? station=record["station"] # XXX should also hold a list with all the machines G.MachineList?
# find the column corresponding to the machine # find the column corresponding to the machine
# XXX each machine should have at least 3 columns, 2 for the jobs and one for operators # XXX each machine should have at least 3 columns, 2 for the jobs and one for operators
if station in G.MachineList: if station in G.MachineList:
machine_index=G.MachineList.index(station) machine_index=G.MachineList.index(station)
# find the entrance time of this step # find the entrance time of this step
entrance_time=record[1] # the time entity entered station entrance_time=record["entranceTime"] # the time entity entered station
# find the row corresponding to the event and start placing the name of the Job in the cells # find the row corresponding to the event and start placing the name of the Job in the cells
entrance_time_index=G.events_list.index(entrance_time) entrance_time_index=G.events_list.index(entrance_time)
# find the exit time of this step # find the exit time of this step
if len(record)==3: if record.get("exitTime", None) != None:
exit_time=record[2] # the time the entity exited the station exit_time=record["exitTime"] # the time the entity exited the station
# find the row corresponding to the event and place the name of the Job in the cell, this is the last cell of this processing # find the row corresponding to the event and place the name of the Job in the cell, this is the last cell of this processing
exit_time_index=G.events_list.index(exit_time) exit_time_index=G.events_list.index(exit_time)
elif len(record)!=3: else:
exit_time_index=len(G.events_list) exit_time_index=len(G.events_list)
# for the rows with indices entrance_time_index to exit_time_index print the id of the Job in the column of the machine_index # for the rows with indices entrance_time_index to exit_time_index print the id of the Job in the column of the machine_index
for step in range(entrance_time_index,exit_time_index+1, 1): for step in range(entrance_time_index,exit_time_index+1, 1):
......
...@@ -1163,7 +1163,8 @@ class Machine(CoreObject): ...@@ -1163,7 +1163,8 @@ class Machine(CoreObject):
# this checks if the operator is working on the last element. # this checks if the operator is working on the last element.
# If yes the time that he was set off-shift should be updated # If yes the time that he was set off-shift should be updated
operator=self.currentOperator operator=self.currentOperator
operator.schedule[-1].append(self.env.now) operator.schedule[-1]["exitTime"] = self.env.now
operator.schedule[-1]["entity"] = self.getActiveObjectQueue()[0]
if not self.currentOperator.onShift: if not self.currentOperator.onShift:
operator.timeLastShiftEnded=self.env.now operator.timeLastShiftEnded=self.env.now
operator.unAssign() # set the flag operatorAssignedTo to None operator.unAssign() # set the flag operatorAssignedTo to None
......
...@@ -183,7 +183,7 @@ class MouldAssembly(MachineJobShop): ...@@ -183,7 +183,7 @@ class MouldAssembly(MachineJobShop):
temp_activeObjectQueue=list(activeObjectQueue) temp_activeObjectQueue=list(activeObjectQueue)
for element in temp_activeObjectQueue: for element in temp_activeObjectQueue:
# update their schedule # update their schedule
element.schedule[-1].append(self.env.now) element.schedule[-1]["exitTime"] = self.env.now
# remove the elements from the activeObjectQueue and reset the current station of the entity # remove the elements from the activeObjectQueue and reset the current station of the entity
activeObjectQueue.remove(element) activeObjectQueue.remove(element)
element.currentStation=None element.currentStation=None
......
...@@ -178,7 +178,7 @@ class MouldAssemblyManaged(MachineManagedJob): ...@@ -178,7 +178,7 @@ class MouldAssemblyManaged(MachineManagedJob):
temp_activeObjectQueue=list(activeObjectQueue) temp_activeObjectQueue=list(activeObjectQueue)
for element in temp_activeObjectQueue: for element in temp_activeObjectQueue:
# update their schedule # update their schedule
element.schedule[-1].append(self.env.now) element.schedule[-1]["exitTime"] = self.env.now
# remove the elements # remove the elements
activeObjectQueue.remove(element) activeObjectQueue.remove(element)
del temp_activeObjectQueue[:] del temp_activeObjectQueue[:]
......
...@@ -158,7 +158,8 @@ class Broker(ObjectInterruption): ...@@ -158,7 +158,8 @@ class Broker(ObjectInterruption):
if self.victim.expectedSignals['brokerIsSet']: if self.victim.expectedSignals['brokerIsSet']:
self.sendSignal(receiver=self.victim, signal=self.victim.brokerIsSet) self.sendSignal(receiver=self.victim, signal=self.victim.brokerIsSet)
# update the schedule of the operator # update the schedule of the operator
self.victim.currentOperator.schedule.append([self.victim, self.env.now]) self.victim.currentOperator.schedule.append({"station": self.victim,
"entranceTime": self.env.now})
# wait till the processing is over # wait till the processing is over
self.expectedSignals['isCalled']=1 self.expectedSignals['isCalled']=1
...@@ -186,8 +187,6 @@ class Broker(ObjectInterruption): ...@@ -186,8 +187,6 @@ class Broker(ObjectInterruption):
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers. # TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
self.victim.printTrace(self.victim.currentOperator.objName, finishWork=self.victim.id) self.victim.printTrace(self.victim.currentOperator.objName, finishWork=self.victim.id)
# update the schedule of the operator
self.victim.currentOperator.schedule[-1].append(self.env.now)
# the victim current operator must be cleared after the operator is released # the victim current operator must be cleared after the operator is released
self.timeLastOperationEnded = self.env.now self.timeLastOperationEnded = self.env.now
self.victim.currentOperator.workingStation=None self.victim.currentOperator.workingStation=None
......
...@@ -183,7 +183,7 @@ class Operator(ObjectResource): ...@@ -183,7 +183,7 @@ class Operator(ObjectResource):
for part in activeObjectQ: for part in activeObjectQ:
part.factor=0 part.factor=0
if part.schedule: if part.schedule:
part.factor=self.env.now-part.schedule[-1][1] part.factor=self.env.now-part.schedule[-1]["entranceTime"]
activeObjectQ.sort(key=lambda x: x.factor, reverse=True) activeObjectQ.sort(key=lambda x: x.factor, reverse=True)
#if the schedulingRule is earliest due date #if the schedulingRule is earliest due date
...@@ -294,18 +294,18 @@ class Operator(ObjectResource): ...@@ -294,18 +294,18 @@ class Operator(ObjectResource):
json['results']['schedule']=[] json['results']['schedule']=[]
for record in self.schedule: for record in self.schedule:
try: try:
stationId=record[0].id stationId=record["station"].id
except AttributeError: except AttributeError:
stationId=record[0]['id'] stationId=record["station"]['id']
if len(record)==3: if record.get("exitTime", None) != None:
json['results']['schedule'].append({ json['results']['schedule'].append({
'stationId':stationId, 'stationId':stationId,
'entranceTime':record[1], 'entranceTime':record["entranceTime"],
'exitTime':record[2]}) 'exitTime':record["exitTime"]})
else: else:
json['results']['schedule'].append({ json['results']['schedule'].append({
'stationId':stationId, 'stationId':stationId,
'entranceTime':record[1]}) 'entranceTime':record["entranceTime"]})
G.outputJSON['elementList'].append(json) G.outputJSON['elementList'].append(json)
#=========================================================================== #===========================================================================
...@@ -315,22 +315,22 @@ class Operator(ObjectResource): ...@@ -315,22 +315,22 @@ class Operator(ObjectResource):
if self.schedule: if self.schedule:
for record in self.schedule: for record in self.schedule:
# find the station of this step # find the station of this step
station=record[0] # XXX should also hold a list with all the machines G.MachineList? station=record["station"] # XXX should also hold a list with all the machines G.MachineList?
# find the column corresponding to the machine # find the column corresponding to the machine
from Globals import G from Globals import G
# XXX each machine should have at least 3 columns, 2 for the jobs and one for operators # XXX each machine should have at least 3 columns, 2 for the jobs and one for operators
if station in G.MachineList: if station in G.MachineList:
machine_index=G.MachineList.index(station) machine_index=G.MachineList.index(station)
# find the entrance time of this step # find the entrance time of this step
entrance_time=record[1] # the time entity entered station entrance_time=record["entranceTime"] # the time entity entered station
# find the row corresponding to the event and start placing the name of the Job in the G.cells_to_write # find the row corresponding to the event and start placing the name of the Job in the G.cells_to_write
entrance_time_index=G.events_list.index(entrance_time) entrance_time_index=G.events_list.index(entrance_time)
# find the exit time of this step # find the exit time of this step
if len(record)==3: try:
exit_time=record[2] # the time the entity exited the station exit_time=record["exitTime"] # the time the entity exited the station
# find the row corresponding to the event and place the name of the Job in the cell, this is the last cell of this processing # find the row corresponding to the event and place the name of the Job in the cell, this is the last cell of this processing
exit_time_index=G.events_list.index(exit_time) exit_time_index=G.events_list.index(exit_time)
elif len(record)!=3: except:
exit_time_index=len(G.events_list) exit_time_index=len(G.events_list)
# for the rows with indices entrance_time_index to exit_time_index print the id of the Job in the column of the machine_index # for the rows with indices entrance_time_index to exit_time_index print the id of the Job in the column of the machine_index
for step in range(entrance_time_index,exit_time_index+1, 1): for step in range(entrance_time_index,exit_time_index+1, 1):
......
...@@ -363,13 +363,16 @@ class Router(ObjectInterruption): ...@@ -363,13 +363,16 @@ class Router(ObjectInterruption):
# Sort candidateOperators # Sort candidateOperators
# sort the operators according to their idle time # sort the operators according to their idle time
#======================================================================= #=======================================================================
def sortOperators(self): def sortOperators(self):
if self.candidateOperators: if self.candidateOperators:
# calculate the time the operators have been waiting # calculate the time the operators have been waiting
for op in self.candidateOperators: for op in self.candidateOperators:
op.waitingTime=0 op.waitingTime=0
if op.schedule: if op.schedule:
op.waitingTime=self.env.now-op.schedule[-1][-1] if op.schedule[-1].get("exitTime", None) != None:
op.waitingTime=self.env.now-op.schedule[-1]["exitTime"]
elif op.schedule[-1].get("entranceTime", None) != None:
op.waitingTime = 0
elif self.env.now>0: elif self.env.now>0:
op.waitingTime=self.env.now op.waitingTime=self.env.now
self.candidateOperators.sort(key=lambda x: x.waitingTime, reverse=True) self.candidateOperators.sort(key=lambda x: x.waitingTime, reverse=True)
......
...@@ -21,11 +21,12 @@ def getEventsList(objectsList=[]): ...@@ -21,11 +21,12 @@ def getEventsList(objectsList=[]):
for object in objectsList: for object in objectsList:
if object.schedule: if object.schedule:
for record in object.schedule: for record in object.schedule:
if not record[1] in events_list: if not record["entranceTime"] in events_list:
events_list.append(record[1]) events_list.append(record["entranceTime"])
if len(record)==3: exit_time = record.get("exitTime", None)
if not record[2] in events_list: if exit_time != None:
events_list.append(record[2]) if not exit_time in events_list:
events_list.append(exit_time)
return events_list return events_list
def outputRoute(): def outputRoute():
......
...@@ -79,9 +79,10 @@ class ShiftScheduler(ObjectInterruption): ...@@ -79,9 +79,10 @@ class ShiftScheduler(ObjectInterruption):
self.interruptVictim() # interrupt the victim self.interruptVictim() # interrupt the victim
else: else:
if self.victim.schedule: if self.victim.schedule:
if len(self.victim.schedule[-1])==2: if not self.victim.schedule[-1].get("exitTime", None):
self.victim.schedule[-1].append(self.env.now) self.victim.schedule[-1]["exitTime"] = self.env.now
self.victim.schedule.append([{'id':'off-shift'},self.env.now]) self.victim.schedule.append({"station": {'id':'off-shift'},
"entranceTime": self.env.now})
self.requestAllocation() self.requestAllocation()
self.victim.timeLastShiftEnded=self.env.now self.victim.timeLastShiftEnded=self.env.now
...@@ -103,8 +104,8 @@ class ShiftScheduler(ObjectInterruption): ...@@ -103,8 +104,8 @@ class ShiftScheduler(ObjectInterruption):
self.reactivateVictim() # re-activate the victim in case it was interrupted self.reactivateVictim() # re-activate the victim in case it was interrupted
else: else:
if self.victim.schedule: if self.victim.schedule:
if len(self.victim.schedule[-1])==2: if not self.victim.schedule[-1].get("exitTime", None):
self.victim.schedule[-1].append(self.env.now) self.victim.schedule[-1]["exitTime"] = self.env.now
self.requestAllocation() self.requestAllocation()
# if the victim has interruptions that measure only the on-shift time, they have to be notified # if the victim has interruptions that measure only the on-shift time, they have to be notified
...@@ -157,9 +158,10 @@ class ShiftScheduler(ObjectInterruption): ...@@ -157,9 +158,10 @@ class ShiftScheduler(ObjectInterruption):
if not self.endUnfinished and station.expectedSignals['processOperatorUnavailable']: if not self.endUnfinished and station.expectedSignals['processOperatorUnavailable']:
self.sendSignal(receiver=station, signal=station.processOperatorUnavailable) self.sendSignal(receiver=station, signal=station.processOperatorUnavailable)
if self.victim.schedule: if self.victim.schedule:
if len(self.victim.schedule[-1])==2: if not self.victim.schedule[-1].get("exitTime", None):
self.victim.schedule[-1].append(self.env.now) self.victim.schedule[-1]["exitTime"] = self.env.now
self.victim.schedule.append([{'id':'off-shift'},self.env.now]) self.victim.schedule.append({"station": {'id':'off-shift'},
"entranceTime": self.env.now})
self.requestAllocation() self.requestAllocation()
# if the victim has interruptions that measure only the on-shift time, they have to be notified # if the victim has interruptions that measure only the on-shift time, they have to be notified
......
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