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
45ef0893
Commit
45ef0893
authored
Aug 12, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BatchReassembly to be able to accept WIP
parent
39976f90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
15 deletions
+28
-15
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+23
-13
dream/simulation/Globals.py
dream/simulation/Globals.py
+5
-2
No files found.
dream/simulation/BatchReassembly.py
View file @
45ef0893
...
@@ -77,7 +77,7 @@ class BatchReassembly(CoreObject):
...
@@ -77,7 +77,7 @@ class BatchReassembly(CoreObject):
self
.
initialSignalReceiver
()
self
.
initialSignalReceiver
()
while
1
:
while
1
:
while
1
:
while
1
:
receivedEvent
=
yield
self
.
isRequested
|
self
.
interruptionStart
receivedEvent
=
yield
self
.
isRequested
|
self
.
interruptionStart
|
self
.
initialWIP
if
self
.
interruptionStart
in
receivedEvent
:
if
self
.
interruptionStart
in
receivedEvent
:
assert
self
.
interruptionStart
.
value
==
self
.
env
.
now
,
'the interruptionStart received by BatchReassembly later than created'
assert
self
.
interruptionStart
.
value
==
self
.
env
.
now
,
'the interruptionStart received by BatchReassembly later than created'
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
interruptionStart
=
self
.
env
.
event
()
...
@@ -86,21 +86,31 @@ class BatchReassembly(CoreObject):
...
@@ -86,21 +86,31 @@ class BatchReassembly(CoreObject):
self
.
interruptionEnd
=
self
.
env
.
event
()
self
.
interruptionEnd
=
self
.
env
.
event
()
if
self
.
signalGiver
():
if
self
.
signalGiver
():
break
break
else
:
# if we have initial wip
elif
self
.
initialWIP
in
receivedEvent
:
assert
self
.
initialWIP
.
value
==
self
.
env
,
'initial wip was not sent by the Environment'
self
.
initialWIP
=
self
.
env
.
event
()
self
.
isProcessingInitialWIP
=
True
break
break
# otherwise proceed with getEntity
else
:
requestingObject
=
self
.
isRequested
.
value
requestingObject
=
self
.
isRequested
.
value
assert
requestingObject
==
self
.
giver
,
'the giver is not the requestingObject'
assert
requestingObject
==
self
.
giver
,
'the giver is not the requestingObject'
self
.
isRequested
=
self
.
env
.
event
()
self
.
isRequested
=
self
.
env
.
event
()
break
if
not
self
.
isProcessingInitialWIP
:
# if we are in the state of having initial wip no need to take an Entity
self
.
currentEntity
=
self
.
getEntity
()
self
.
currentEntity
=
self
.
getEntity
()
# initialize the timer timeLastEntityEntered
# initialize the timer timeLastEntityEntered
self
.
nameLastEntityEntered
=
self
.
currentEntity
.
name
# this holds the name of the last entity that got into Machine
self
.
nameLastEntityEntered
=
self
.
currentEntity
.
name
# this holds the name of the last entity that got into Machine
self
.
timeLastEntityEntered
=
self
.
env
.
now
#this holds the last time that an entity got into Machine
self
.
timeLastEntityEntered
=
self
.
env
.
now
#this holds the last time that an entity got into Machine
# self.tinM=self.totalProcessingTimeInCurrentEntity # timer to hold the processing time left
if
(
len
(
self
.
getActiveObjectQueue
())
==
self
.
numberOfSubBatches
and
self
.
currentEntity
.
type
!=
'Batch'
)
\
or
(
self
.
isProcessingInitialWIP
and
self
.
currentEntity
.
type
==
'Batch'
):
# this needed for initial
if
len
(
self
.
getActiveObjectQueue
())
==
self
.
numberOfSubBatches
and
self
.
currentEntity
.
type
!=
'Batch'
:
# WIP that may be batch
# Reassemble only if current entity is SubBatch
if
self
.
currentEntity
.
type
==
'SubBatch'
:
yield
self
.
env
.
timeout
(
self
.
calculateProcessingTime
())
yield
self
.
env
.
timeout
(
self
.
calculateProcessingTime
())
self
.
reassemble
()
self
.
reassemble
()
if
not
self
.
signalReceiver
():
if
not
self
.
signalReceiver
():
...
...
dream/simulation/Globals.py
View file @
45ef0893
...
@@ -255,8 +255,11 @@ def setWIP(entityList):
...
@@ -255,8 +255,11 @@ def setWIP(entityList):
if
G
.
env
.
now
==
0
and
entity
.
currentStation
:
if
G
.
env
.
now
==
0
and
entity
.
currentStation
:
if
entity
.
currentStation
.
class_name
:
if
entity
.
currentStation
.
class_name
:
stationClass
=
entity
.
currentStation
.
__class__
.
__name__
stationClass
=
entity
.
currentStation
.
__class__
.
__name__
if
stationClass
in
[
'Machine'
,
'BatchScrapMachine'
,
'MachineJobShop'
,
'BatchDecomposition'
]:
if
stationClass
in
[
'Machine'
,
'BatchScrapMachine'
,
'MachineJobShop'
,
'BatchDecomposition'
,
'BatchReassembly'
]:
entity
.
currentStation
.
currentEntity
=
entity
entity
.
currentStation
.
currentEntity
=
entity
# trigger initialWIP event only if it has not been triggered. Otherwise
# if we set more than one entities (e.g. in reassembly) it will crash
if
not
(
entity
.
currentStation
.
initialWIP
.
triggered
):
entity
.
currentStation
.
initialWIP
.
succeed
(
G
.
env
)
entity
.
currentStation
.
initialWIP
.
succeed
(
G
.
env
)
from
Exit
import
Exit
from
Exit
import
Exit
...
...
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