Commit 4749c80e authored by Georgios Dagkakis's avatar Georgios Dagkakis

object to hold a list with interruptions for which they are victims

parent 8686c3ed
...@@ -49,6 +49,9 @@ class CoreObject(object): ...@@ -49,6 +49,9 @@ class CoreObject(object):
self.Waiting=[] self.Waiting=[]
self.OffShift=[] self.OffShift=[]
# list that holds the objectInterruptions that have this element as victim
self.objectInterruptions=[]
#default attributes set so that the CoreObject has them #default attributes set so that the CoreObject has them
self.isPreemptive=False self.isPreemptive=False
self.resetOnPreemption=False self.resetOnPreemption=False
......
...@@ -1318,6 +1318,7 @@ def createObjectInterruptions(): ...@@ -1318,6 +1318,7 @@ def createObjectInterruptions():
duration=float(scheduledMaintenance.get('duration', 1)) duration=float(scheduledMaintenance.get('duration', 1))
victim=Globals.findObjectById(element['id']) victim=Globals.findObjectById(element['id'])
SM=ScheduledMaintenance(victim=victim, start=start, duration=duration) SM=ScheduledMaintenance(victim=victim, start=start, duration=duration)
victim.objectInterruptions.append(SM)
G.ObjectInterruptionList.append(SM) G.ObjectInterruptionList.append(SM)
G.ScheduledMaintenanceList.append(SM) G.ScheduledMaintenanceList.append(SM)
failure=element.get('failures', None) failure=element.get('failures', None)
...@@ -1331,6 +1332,7 @@ def createObjectInterruptions(): ...@@ -1331,6 +1332,7 @@ def createObjectInterruptions():
victim=Globals.findObjectById(element['id']) victim=Globals.findObjectById(element['id'])
deteriorationType=failure.get('deteriorationType', 'constant') deteriorationType=failure.get('deteriorationType', 'constant')
F=Failure(victim, distribution=failure, repairman=victim.repairman, deteriorationType=deteriorationType) F=Failure(victim, distribution=failure, repairman=victim.repairman, deteriorationType=deteriorationType)
victim.objectInterruptions.append(F)
G.ObjectInterruptionList.append(F) G.ObjectInterruptionList.append(F)
G.FailureList.append(F) G.FailureList.append(F)
# if there is a shift pattern defined # if there is a shift pattern defined
...@@ -1350,6 +1352,7 @@ def createObjectInterruptions(): ...@@ -1350,6 +1352,7 @@ def createObjectInterruptions():
shiftPattern.remove(next) shiftPattern.remove(next)
endUnfinished=bool(int(shift.get('endUnfinished', 0))) endUnfinished=bool(int(shift.get('endUnfinished', 0)))
SS=ShiftScheduler(victim, shiftPattern, endUnfinished) SS=ShiftScheduler(victim, shiftPattern, endUnfinished)
victim.objectInterruptions.append(SS)
G.ObjectInterruptionList.append(SS) G.ObjectInterruptionList.append(SS)
G.ShiftSchedulerList.append(SS) G.ShiftSchedulerList.append(SS)
......
...@@ -34,6 +34,8 @@ class ObjectResource(object): ...@@ -34,6 +34,8 @@ class ObjectResource(object):
def __init__(self): def __init__(self):
self.initialized = False self.initialized = False
# list that holds the objectInterruptions that have this element as victim
self.objectInterruptions=[]
# alias used for printing the trace # alias used for printing the trace
self.alias=None self.alias=None
......
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