Commit f76fc654 authored by Georgios Dagkakis's avatar Georgios Dagkakis

Operator to output break ratio

parent 34b02de8
......@@ -159,10 +159,8 @@ class Break(ObjectInterruption):
self.victim.schedule.append({"station": {'id':'on-break'},
"entranceTime": self.env.now})
self.requestAllocation()
self.victim.Up=False
self.victim.timeBreakStarted=self.env.now
self.victim.timeLastBreakStarted=self.env.now
self.victim.onBreak=True # get the victim on break
self.outputTrace(self.victim.name,"starts break")
# update the break time
......@@ -193,6 +191,6 @@ class Break(ObjectInterruption):
self.victim.schedule[-1]["exitTime"] = self.env.now
self.requestAllocation()
self.victim.timeBreakEnded=self.env.now
self.victim.timeLastBreakEnded=self.env.now
self.victim.onBreak=False # get the victim on break
self.outputTrace(self.victim.name,"returns from break")
{
"graph": {
"node": {
"E1": {
"interruptions": {},
"top": 0.05688622754491013,
"_class": "Dream.Exit",
"left": 0.7083333333333333
},
"S1": {
"name": "Source",
"top": 0.9431137724550899,
"entity": "Dream.Part",
"interArrivalTime": {
"Fixed": {
"distributionType": "Fixed",
"mean": 6
}
},
"interruptions": {},
"_class": "Dream.Source",
"left": 0.30208333333333337
},
"M1": {
"name": "Machine1",
"top": 0.5,
"processingTime": {
"Fixed": {
"mean": 3.0
}
},
"operationType": "MT-Load-Processing",
"interruptions": {},
"_class": "Dream.Machine",
"left": 0.5625
},
"O1": {
"capacity": 1,
"name": "Operator1",
"top": 0.721556886227545,
"interruptions": {
"break": {
"TTR": {
"Fixed": {
"mean": 5
}
},
"TTB": {
"Fixed": {
"mean": 40
}
}
}
},
"_class": "Dream.Operator",
"left": 0.8489583333333334
}
},
"edge": {
"0": {
"source": "O1",
"destination": "M1",
"data": {},
"_class": "Dream.Edge"
},
"3": {
"source": "M1",
"destination": "E1",
"data": {},
"_class": "Dream.Edge"
},
"2": {
"source": "S1",
"destination": "M1",
"data": {},
"_class": "Dream.Edge"
}
}
},
"_class": "Dream.Simulation",
"general": {
"console": "No",
"numberOfReplications": "1",
"trace": "Yes",
"confidenceLevel": "0.95",
"maxSimTime": "100",
"_class": "Dream.Configuration"
}
}
\ No newline at end of file
......@@ -46,6 +46,7 @@ class Operator(ObjectResource):
self.Waiting=[] # holds the percentage of waiting time
self.Working=[] # holds the percentage of working time
self.OffShift=[] # holds the percentage of working time
self.OnBreak=[] # holds the percentage of break time
# the following attributes are not used by the Repairman
......@@ -104,6 +105,8 @@ class Operator(ObjectResource):
self.timeLastShiftEnded=0 #holds the time that the last shift of the object ended
self.candidateStation=None #holds the candidate receiver of the entity the resource will work on - used by router
self.totalBreakTime=0
self.timeLastBreakStarted=0
self.timeLastBreakEnded=0
@staticmethod
def getSupportedSchedulingRules():
......@@ -270,13 +273,22 @@ class Operator(ObjectResource):
# if the Operator is currently off-shift we have to count the time of this work
if not self.onShift and len(self.getResourceQueue())==0:
self.totalOffShiftTime+=G.maxSimTime-self.timeLastShiftEnded
# if the Operator is on break we have to add this break time to its total break time
if self.onBreak:
if self.onShift:
self.totalBreakTime+=self.env.now-self.timeLastBreakStarted
# if object is off shift add only the break time before the shift ended
if not self.onShift and self.timeBreakStarted < self.timeLastShiftEnded:
self.totalBreakTime+=self.timeLastShiftEnded-self.timeLastBreakStarted
# Operator was idle when he was not in any other state
self.totalWaitingTime=MaxSimtime-self.totalWorkingTime-self.totalOffShiftTime
self.totalWaitingTime=MaxSimtime-self.totalWorkingTime-self.totalOffShiftTime-self.totalBreakTime
# update the waiting/working time percentages lists
self.Waiting.append(100*self.totalWaitingTime/MaxSimtime)
self.Working.append(100*self.totalWorkingTime/MaxSimtime)
self.OffShift.append(100*self.totalOffShiftTime/MaxSimtime)
self.OnBreak.append(100*self.totalBreakTime/MaxSimtime)
# in the last element of the schedule if there is no exit time set it to now
if self.schedule:
......@@ -295,6 +307,7 @@ class Operator(ObjectResource):
json['results']['working_ratio'] = self.Working
json['results']['waiting_ratio'] = self.Waiting
json['results']['off_shift_ratio'] = self.OffShift
json['results']['on_break_ratio'] = self.OnBreak
if self.ouputSchedule:
json['results']['schedule']=[]
for record in self.schedule:
......
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