Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
bdc0c363
Commit
bdc0c363
authored
Feb 11, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Feb 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes in postProcessing of machine so that off-shift is added correctly
parent
29dbb708
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
17 deletions
+33
-17
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+12
-5
dream/simulation/Machine.py
dream/simulation/Machine.py
+17
-8
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+4
-4
No files found.
dream/simulation/CoreObject.py
View file @
bdc0c363
...
...
@@ -69,15 +69,19 @@ class CoreObject(Process):
self
.
nameLastEntityEnded
=
""
#holds the name of the last entity that ended processing in the object
self
.
timeLastEntityEntered
=
0
#holds the last time that an entity entered in the object
self
.
nameLastEntityEntered
=
""
#holds the name of the last entity that entered in the object
self
.
timeLastFailure
=
0
#holds the time that the last failure of the object started
self
.
timeLastFailureEnded
=
0
#holds the time that the last failure of the object ended
# ============================== shift related times =====================================
self
.
timeLastShiftStarted
=
0
#holds the time that the last shift of the object started
self
.
timeLastShiftEnded
=
0
#holds the time that the last shift of the object ended
self
.
offShiftTimeTryingToReleaseCurrentEntity
=
0
#holds the time that the object was off-shift while trying
#to release the current entity
# ============================== failure related times =====================================
self
.
timeLastFailure
=
0
#holds the time that the last failure of the object started
self
.
timeLastFailureEnded
=
0
#holds the time that the last failure of the object ended
self
.
downTimeProcessingCurrentEntity
=
0
#holds the time that the machine was down while
#processing the current entity
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
#holds the time that the object was down while trying
#to release the current entity
#to release the current entity
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
#object was down while holding current entity
self
.
timeLastEntityLeft
=
0
#holds the last time that an entity left the object
...
...
@@ -137,6 +141,7 @@ class CoreObject(Process):
self
.
failureTimeInCurrentEntity
=
0
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
self
.
offShiftTimeTryingToReleaseCurrentEntity
=
0
self
.
timeLastEntityLeft
=
now
()
self
.
outputTrace
(
activeEntity
.
name
,
"released "
+
self
.
objName
)
...
...
@@ -148,8 +153,10 @@ class CoreObject(Process):
# =======================================================================
def
addBlockage
(
self
):
self
.
totalTimeInCurrentEntity
=
now
()
-
self
.
timeLastEntityEntered
self
.
totalTimeWaitingForOperator
+=
self
.
operatorWaitTimeCurrentEntity
blockage
=
now
()
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
)
self
.
totalTimeWaitingForOperator
+=
self
.
operatorWaitTimeCurrentEntity
if
self
.
timeLastEntityEnded
<
self
.
timeLastShiftStarted
:
self
.
offShiftTimeTryingToReleaseCurrentEntity
=
self
.
timeLastShiftStarted
-
self
.
timeLastEntityEnded
blockage
=
now
()
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
+
self
.
offShiftTimeTryingToReleaseCurrentEntity
)
self
.
totalBlockageTime
+=
blockage
# =======================================================================
...
...
dream/simulation/Machine.py
View file @
bdc0c363
...
...
@@ -374,6 +374,11 @@ class Machine(CoreObject):
# set the variable that flags an Entity is ready to be disposed
self
.
waitToDispose
=
True
#do this so that if it is overtime working it is not counted as off-shift time
if
not
self
.
onShift
:
self
.
timeLastShiftEnded
=
now
()
# update the total working time
self
.
totalWorkingTime
+=
self
.
totalProcessingTimeInCurrentEntity
# the total processing time for this entity
# is what the distribution initially gave
...
...
@@ -651,7 +656,7 @@ class Machine(CoreObject):
# =======================================================================
# actions to be taken after the simulation ends
# =======================================================================
def
postProcessing
(
self
,
MaxSimtime
=
None
):
def
postProcessing
(
self
,
MaxSimtime
=
None
):
if
MaxSimtime
==
None
:
from
Globals
import
G
MaxSimtime
=
G
.
maxSimTime
...
...
@@ -668,16 +673,15 @@ class Machine(CoreObject):
mightBeBlocked
=
False
#calculate the offShift time for current entity
if
self
.
onShift
==
False
:
offShiftTimeInCurrentEntity
=
now
()
-
activeObject
.
timeLastShiftEnded
else
:
offShiftTimeInCurrentEntity
=
0
offShiftTimeInCurrentEntity
=
0
if
self
.
interruptCause
:
if
self
.
onShift
==
False
and
self
.
interruptCause
.
type
==
'ShiftScheduler'
:
offShiftTimeInCurrentEntity
=
now
()
-
activeObject
.
timeLastShiftEnded
# if there is an entity that finished processing in a Machine but did not get to reach
# the following Object till the end of simulation,
# we have to add this blockage to the percentage of blockage in Machine
# we should exclude the failure time in current entity though!
# if (len(self.Res.activeQ)>0) and (len(self.next[0].Res.activeQ)>0) and ((self.nameLastEntityEntered == self.nameLastEntityEnded)):
if
(
len
(
activeObjectQueue
)
>
0
)
and
(
mightBeBlocked
)
\
and
((
activeObject
.
nameLastEntityEntered
==
activeObject
.
nameLastEntityEnded
)):
# be careful here, might have to reconsider
...
...
@@ -721,7 +725,12 @@ class Machine(CoreObject):
#if the machine is off shift,add this to the off-shift time
# we also need to add the last blocking time to total blockage time
if
activeObject
.
onShift
==
False
:
self
.
totalOffShiftTime
+=
now
()
-
self
.
timeLastShiftEnded
#add the time only if the object is interrupted because of off-shift
if
self
.
interruptCause
:
if
self
.
interruptCause
.
type
==
'ShiftScheduler'
:
self
.
totalOffShiftTime
+=
now
()
-
self
.
timeLastShiftEnded
elif
len
(
self
.
getActiveObjectQueue
())
==
0
or
self
.
waitToDispose
:
self
.
totalOffShiftTime
+=
now
()
-
self
.
timeLastShiftEnded
# we add the value only if it hasn't already been added
if
((
mightBeBlocked
)
and
(
activeObject
.
nameLastEntityEnded
==
activeObject
.
nameLastEntityEntered
)
and
(
not
alreadyAdded
)):
activeObject
.
totalBlockageTime
+=
(
now
()
-
activeObject
.
timeLastEntityEnded
)
-
(
now
()
-
activeObject
.
timeLastShiftEnded
)
-
offShiftTimeInCurrentEntity
...
...
dream/simulation/ShiftScheduler.py
View file @
bdc0c363
...
...
@@ -40,9 +40,10 @@ class ShiftScheduler(ObjectInterruption):
# =======================================================================
def
__init__
(
self
,
victim
=
None
,
shiftPattern
=
[],
endUnfinished
=
False
):
ObjectInterruption
.
__init__
(
self
,
victim
)
self
.
type
=
'ShiftScheduler'
self
.
shiftPattern
=
shiftPattern
self
.
endUnfinished
=
endUnfinished
#flag that shows if half processed Jobs should end after the shift ends
# =======================================================================
...
...
@@ -57,14 +58,14 @@ class ShiftScheduler(ObjectInterruption):
# =======================================================================
def
run
(
self
):
self
.
victim
.
totalOffShiftTime
=
0
offShiftTime
=
now
()
self
.
victim
.
timeLastShiftEnded
=
now
()
self
.
victim
.
onShift
=
False
while
1
:
yield
hold
,
self
,
float
(
self
.
remainingShiftPattern
[
0
][
0
]
-
now
())
# wait for the onShift
if
(
len
(
self
.
getVictimQueue
())
>
0
and
self
.
victim
.
interruptCause
and
not
(
self
.
endUnfinished
)):
self
.
reactivateVictim
()
# re-activate the victim in case it was interrupted
self
.
victim
.
totalOffShiftTime
+=
now
()
-
offShiftTime
self
.
victim
.
totalOffShiftTime
+=
now
()
-
self
.
victim
.
timeLastShiftEnded
self
.
victim
.
onShift
=
True
self
.
victim
.
timeLastShiftStarted
=
now
()
self
.
outputTrace
(
"is on shift"
)
...
...
@@ -75,7 +76,6 @@ class ShiftScheduler(ObjectInterruption):
if
(
len
(
self
.
getVictimQueue
())
>
0
and
not
(
self
.
endUnfinished
)):
self
.
interruptVictim
()
# interrupt processing operations if any
self
.
victim
.
onShift
=
False
# get the victim off-shift
offShiftTime
=
now
()
self
.
victim
.
timeLastShiftEnded
=
now
()
self
.
outputTrace
(
"is off shift"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment