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
3938d177
Commit
3938d177
authored
Aug 11, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BatchDecomposition can receive wip
parent
bb096f30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
15 deletions
+33
-15
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+25
-11
dream/simulation/Globals.py
dream/simulation/Globals.py
+4
-2
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+2
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+2
-2
No files found.
dream/simulation/BatchDecomposition.py
View file @
3938d177
...
...
@@ -81,7 +81,7 @@ class BatchDecomposition(CoreObject):
while
1
:
# wait for an event or an interruption
while
1
:
receivedEvent
=
yield
self
.
isRequested
|
self
.
interruptionStart
receivedEvent
=
yield
self
.
isRequested
|
self
.
interruptionStart
|
self
.
initialWIP
# if an interruption has occurred
if
self
.
interruptionStart
in
receivedEvent
:
assert
self
.
interruptionStart
.
value
==
self
.
env
.
now
,
'the interruption received by batchDecomposition was created earlier'
...
...
@@ -92,26 +92,39 @@ class BatchDecomposition(CoreObject):
self
.
interruptionEnd
=
self
.
env
.
event
()
if
self
.
signalGiver
():
break
# 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
# otherwise proceed with getEntity
else
:
else
:
requestingObject
=
self
.
isRequested
.
value
assert
requestingObject
==
self
.
giver
,
'the giver is not the requestingObject'
self
.
isRequested
=
self
.
env
.
event
()
break
requestingObject
=
self
.
isRequested
.
value
assert
requestingObject
==
self
.
giver
,
'the giver is not the requestingObject'
self
.
isRequested
=
self
.
env
.
event
()
self
.
currentEntity
=
self
.
getEntity
()
if
not
self
.
isProcessingInitialWIP
:
# if we are in the state of having initial wip no need to take an Entity
self
.
currentEntity
=
self
.
getEntity
()
# set the currentEntity as the Entity just received and initialize the timer timeLastEntityEntered
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
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
# if we have batch in the decomposition (initial wip may be in sub-batch)
if
self
.
getActiveObjectQueue
()[
0
].
__class__
.
__name__
==
'Batch'
:
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
yield
self
.
env
.
timeout
(
self
.
totalProcessingTimeInCurrentEntity
)
self
.
decompose
()
yield
self
.
env
.
timeout
(
self
.
totalProcessingTimeInCurrentEntity
)
self
.
decompose
()
# reset the variable
self
.
isProcessingInitialWIP
=
False
# TODO: add failure control
# as long as there are sub-Batches in the internal Resource
for
i
in
range
(
self
.
numberOfSubBatches
):
numberOfSubBatches
=
int
(
len
(
self
.
getActiveObjectQueue
()))
for
i
in
range
(
numberOfSubBatches
):
# added here temporarily, it is supposed to break when i==numberOfSubBatches
if
not
self
.
getActiveObjectQueue
():
break
...
...
@@ -242,3 +255,4 @@ class BatchDecomposition(CoreObject):
giverObject
=
callerObject
assert
giverObject
,
'there must be a caller for canAcceptAndIsRequested'
return
activeObject
.
Up
and
len
(
activeObjectQueue
)
==
0
and
giverObject
.
haveToDispose
(
activeObject
)
dream/simulation/Globals.py
View file @
3938d177
...
...
@@ -250,10 +250,12 @@ def setWIP(entityList):
entity
.
hot
=
True
# add the entity to the pendingEntities list
G
.
pendingEntities
.
append
(
entity
)
# if we are in the start of the simulation the object is of Machine type then we should send initialWIP signal
# if we are in the start of the simulation the object is of server type then we should send initialWIP signal
# TODO, maybe use 'class_family attribute here'
if
G
.
env
.
now
==
0
and
entity
.
currentStation
:
if
entity
.
currentStation
.
class_name
:
if
entity
.
currentStation
.
class_name
==
'Dream.Machine'
:
stationClass
=
entity
.
currentStation
.
__class__
.
__name__
if
stationClass
in
[
'Machine'
,
'BatchScrapMachine'
,
'MachineJobShop'
,
'BatchDecomposition'
]:
entity
.
currentStation
.
currentEntity
=
entity
entity
.
currentStation
.
initialWIP
.
succeed
(
G
.
env
)
...
...
dream/simulation/LineGenerationJSON.py
View file @
3938d177
...
...
@@ -1168,6 +1168,7 @@ def createWIP():
G
.
EntityList
.
append
(
B
)
object
=
Globals
.
findObjectById
(
element
[
'id'
])
B
.
unitsToProcess
=
int
(
entity
.
get
(
'unitsToProcess'
,
numberOfUnits
))
B
.
remainingProcessingTime
=
float
(
entity
.
get
(
'remainingProcessingTime'
,
0
))
B
.
currentStation
=
object
elif
entityClass
==
'Dream.SubBatch'
:
...
...
@@ -1196,6 +1197,7 @@ def createWIP():
G
.
EntityList
.
append
(
SB
)
object
=
Globals
.
findObjectById
(
element
[
'id'
])
SB
.
unitsToProcess
=
int
(
entity
.
get
(
'unitsToProcess'
,
numberOfUnits
))
SB
.
remainingProcessingTime
=
float
(
entity
.
get
(
'remainingProcessingTime'
,
0
))
SB
.
currentStation
=
object
if
entityClass
==
'Dream.Order'
:
...
...
dream/simulation/Machine.py
View file @
3938d177
...
...
@@ -378,11 +378,11 @@ class Machine(CoreObject):
# TODO: reset the requestinEntity before receiving the currentEntity
self
.
requestingEntity
=
None
# get the entity
# get the entity
# TODO: if there was loading time then we must solve the problem of getting an entity
# from an unidentified giver or not getting an entity at all as the giver
# may fall in failure mode (assignExit()?)
if
not
self
.
isProcessingInitialWIP
:
if
not
self
.
isProcessingInitialWIP
:
# if we are in the state of having initial wip no need to take an Entity
self
.
currentEntity
=
self
.
getEntity
()
# TODO: the Machine receive the entity after the operator is available
# the canAcceptAndIsRequested method checks only in case of Load type of operation
...
...
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