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
e39066a0
Commit
e39066a0
authored
Oct 22, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction on how BatchReassemblyBlocking calculates the blocking time
parent
2259bd6a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
24 deletions
+32
-24
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+2
-1
dream/simulation/BatchReassemblyBlocking.py
dream/simulation/BatchReassemblyBlocking.py
+19
-21
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+3
-0
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+4
-1
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+4
-1
No files found.
dream/simulation/BatchReassembly.py
View file @
e39066a0
...
...
@@ -133,7 +133,8 @@ class BatchReassembly(CoreObject):
self
.
reassemble
()
self
.
isProcessingInitialWIP
=
False
# signal the receiver that the activeObject has something to dispose of
self
.
timeLastBlockageStarted
=
self
.
env
.
now
self
.
timeLastBlockageStarted
=
self
.
env
.
now
self
.
isBlocked
=
True
if
not
self
.
signalReceiver
():
# if there was no available receiver, get into blocking control
while
1
:
...
...
dream/simulation/BatchReassemblyBlocking.py
View file @
e39066a0
...
...
@@ -57,28 +57,26 @@ class BatchReassemblyBlocking(BatchReassembly):
# find the previous station
station
=
self
.
previous
[
0
]
from
Globals
import
G
from
ShiftScheduler
import
ShiftScheduler
shift
=
[]
# find the shiftPattern of the previous station
for
oi
in
G
.
ObjectInterruptionList
:
if
issubclass
(
oi
.
__class__
,
ShiftScheduler
):
if
oi
.
victim
is
station
:
shift
=
oi
.
shiftPattern
break
from
ShiftScheduler
import
ShiftScheduler
if
self
.
timeLastBlockageStarted
:
# calculate how much time the previous station was offShift
offShift
=
0
for
i
,
record
in
enumerate
(
shift
):
start
=
record
[
0
]
end
=
record
[
1
]
if
start
>
self
.
env
.
now
:
break
if
end
<
self
.
timeLastBlockageStarted
:
continue
# if the there is offShift time in the blockage
if
end
<
self
.
env
.
now
:
try
:
offShift
+=
shift
[
i
+
1
][
0
]
-
end
except
IndexError
:
pass
for
endShiftTime
in
station
.
endShiftTimes
:
# if there was end of shift while the station was blocked
if
endShiftTime
>=
self
.
timeLastBlockageStarted
:
end
=
endShiftTime
lastShift
=
True
# find the start of the next shift
for
startShiftTime
in
station
.
startShiftTimes
:
if
startShiftTime
>
end
:
lastShift
=
False
nextStart
=
startShiftTime
break
# if there is not start of next shift, then it was the last shift, so
# the station is currently off. Subtract this off-shift time
if
lastShift
:
offShift
+=
self
.
env
.
now
-
end
# else, subtract the whole off-shift time of that shift
else
:
offShift
+=
nextStart
-
end
self
.
totalBlockageTime
+=
self
.
env
.
now
-
self
.
timeLastBlockageStarted
-
offShift
dream/simulation/CoreObject.py
View file @
e39066a0
...
...
@@ -223,6 +223,9 @@ class CoreObject(ManPyObject):
"entityCreated"
:
0
,
"moveEnd"
:
0
}
# lists that keep the start/endShiftTimes of the victim
self
.
endShiftTimes
=
[]
self
.
startShiftTimes
=
[]
# =======================================================================
# the main process of the core object
...
...
dream/simulation/ObjectResource.py
View file @
e39066a0
...
...
@@ -58,7 +58,10 @@ class ObjectResource(ManPyObject):
self
.
coreObjects
=
[]
# flag that locks the resource so that it cannot get new jobs
self
.
isLocked
=
False
# lists that keep the start/endShiftTimes of the victim
self
.
endShiftTimes
=
[]
self
.
startShiftTimes
=
[]
# =======================================================================
# checks if the worker is available
# =======================================================================
...
...
dream/simulation/ShiftScheduler.py
View file @
e39066a0
...
...
@@ -58,7 +58,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
remainingShiftPattern
=
list
(
self
.
shiftPattern
)
# self.victimEndedLastProcessing=self.env.event()
self
.
waitingSignal
=
False
# =======================================================================
# The run method for the failure which has to served by a repairman
# =======================================================================
...
...
@@ -81,6 +81,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
requestAllocation
()
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
self
.
victim
.
endShiftTimes
.
append
(
self
.
env
.
now
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is off shift"
)
while
1
:
...
...
@@ -91,6 +92,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
victim
.
onShift
=
True
self
.
victim
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
victim
.
timeLastShiftEnded
self
.
victim
.
timeLastShiftStarted
=
self
.
env
.
now
self
.
victim
.
startShiftTimes
.
append
(
self
.
env
.
now
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is on shift"
)
startShift
=
self
.
env
.
now
if
issubclass
(
self
.
victim
.
__class__
,
CoreObject
):
...
...
@@ -143,6 +145,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
victim
.
onShift
=
False
# get the victim off-shift
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
self
.
victim
.
endShiftTimes
.
append
(
self
.
env
.
now
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is off shift"
)
self
.
remainingShiftPattern
.
pop
(
0
)
...
...
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