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
880c1dce
Commit
880c1dce
authored
Oct 25, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more cleanup in getEntity and removeEntity of coreobjects
parent
40253aa2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
24 deletions
+20
-24
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+3
-1
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+6
-11
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+5
-9
dream/simulation/Machine.py
dream/simulation/Machine.py
+3
-2
dream/simulation/Queue.py
dream/simulation/Queue.py
+3
-1
No files found.
dream/simulation/Assembly.py
View file @
880c1dce
...
@@ -185,7 +185,8 @@ class Assembly(CoreObject):
...
@@ -185,7 +185,8 @@ class Assembly(CoreObject):
def
removeEntity
(
self
):
def
removeEntity
(
self
):
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
self
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
self
.
objName
)
#output trace
self
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
self
.
objName
)
#output trace
self
.
waitToDispose
=
False
#the object does not wait to dispose now
self
.
waitToDispose
=
False
return
activeEntity
#the object does not wait to dispose now
#gets an entity from the predecessor
#gets an entity from the predecessor
#it may handle both Parts and Frames
#it may handle both Parts and Frames
...
@@ -208,6 +209,7 @@ class Assembly(CoreObject):
...
@@ -208,6 +209,7 @@ class Assembly(CoreObject):
self
.
nameLastEntityEntered
=
activeEntity
.
name
self
.
nameLastEntityEntered
=
activeEntity
.
name
self
.
timeLastEntityEntered
=
now
()
self
.
timeLastEntityEntered
=
now
()
activeEntity
.
currentStation
=
self
activeEntity
.
currentStation
=
self
return
activeEntity
#actions to be taken after the simulation ends
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
=
None
):
def
postProcessing
(
self
,
MaxSimtime
=
None
):
...
...
dream/simulation/Conveyer.py
View file @
880c1dce
...
@@ -205,21 +205,15 @@ class Conveyer(CoreObject):
...
@@ -205,21 +205,15 @@ class Conveyer(CoreObject):
#gets an entity from the predecessor
#gets an entity from the predecessor
def
getEntity
(
self
):
def
getEntity
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeEntity
=
CoreObject
.
getEntity
(
self
)
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
giverObject
.
sortEntities
()
#sort the Entities of the giver according to the scheduling rule if applied
activeEntity
=
giverObjectQueue
[
0
]
activeObjectQueue
.
append
(
activeEntity
)
#get the entity from the predecessor
self
.
position
.
append
(
0
)
#the entity is placed in the start of the conveyer
self
.
position
.
append
(
0
)
#the entity is placed in the start of the conveyer
giverObject
.
removeEntity
()
#remove the entity from the previous object
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
#output trace
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
activeEntity
.
currentStation
=
self
#check if the conveyer became full to start counting blockage
#check if the conveyer became full to start counting blockage
if
self
.
isFull
():
if
self
.
isFull
():
self
.
timeBlockageStarted
=
now
()
self
.
timeBlockageStarted
=
now
()
self
.
wasFull
=
True
self
.
wasFull
=
True
return
activeEntity
#removes an entity from the Conveyer
#removes an entity from the Conveyer
def
removeEntity
(
self
):
def
removeEntity
(
self
):
...
@@ -237,6 +231,7 @@ class Conveyer(CoreObject):
...
@@ -237,6 +231,7 @@ class Conveyer(CoreObject):
self
.
timeToBecomeAvailable
=
((
self
.
position
[
-
1
]
+
self
.
currentRequestedLength
)
/
float
(
self
.
speed
))
/
60
self
.
timeToBecomeAvailable
=
((
self
.
position
[
-
1
]
+
self
.
currentRequestedLength
)
/
float
(
self
.
speed
))
/
60
self
.
conveyerMover
.
timeToWait
=
self
.
timeToBecomeAvailable
self
.
conveyerMover
.
timeToWait
=
self
.
timeToBecomeAvailable
self
.
call
=
True
self
.
call
=
True
return
activeEntity
#checks if the Conveyer can dispose an entity to the following object
#checks if the Conveyer can dispose an entity to the following object
def
haveToDispose
(
self
,
callerObject
=
None
):
def
haveToDispose
(
self
,
callerObject
=
None
):
...
...
dream/simulation/Dismantle.py
View file @
880c1dce
...
@@ -165,25 +165,20 @@ class Dismantle(CoreObject):
...
@@ -165,25 +165,20 @@ class Dismantle(CoreObject):
#gets a frame from the predecessor that the predecessor index points to
#gets a frame from the predecessor that the predecessor index points to
def
getEntity
(
self
):
def
getEntity
(
self
):
activeEntity
=
CoreObject
.
getEntity
(
self
)
#run the default method
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
#get also the parts of the frame so that they can be popped
giverObject
.
sortEntities
()
#sort the Entities of the giver according to the scheduling rule if applied
giverObjectQueue
=
self
.
getGiverObjectQueue
()
activeEntity
=
giverObjectQueue
[
0
]
activeObjectQueue
.
append
(
activeEntity
)
#get the frame from the predecessor
giverObject
.
removeEntity
()
activeEntity
.
currentStation
=
self
#append also the parts in the res so that they can be popped
for
part
in
activeEntity
.
getFrameQueue
():
for
part
in
activeEntity
.
getFrameQueue
():
activeObjectQueue
.
append
(
part
)
activeObjectQueue
.
append
(
part
)
part
.
currentStation
=
self
part
.
currentStation
=
self
activeEntity
.
getFrameQueue
=
[]
#empty the frame
activeEntity
.
getFrameQueue
=
[]
#empty the frame
#move the frame to the end of the internal queue since we want the frame to be disposed first
#move the frame to the end of the internal queue since we want the frame to be disposed first
activeObjectQueue
.
append
(
activeEntity
)
activeObjectQueue
.
append
(
activeEntity
)
activeObjectQueue
.
pop
(
0
)
activeObjectQueue
.
pop
(
0
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
return
activeEntity
#removes an entity from the Dismantle
#removes an entity from the Dismantle
def
removeEntity
(
self
):
def
removeEntity
(
self
):
...
@@ -196,6 +191,7 @@ class Dismantle(CoreObject):
...
@@ -196,6 +191,7 @@ class Dismantle(CoreObject):
else
:
else
:
if
(
len
(
activeObjectQueue
)
==
1
):
if
(
len
(
activeObjectQueue
)
==
1
):
self
.
waitToDisposePart
=
False
self
.
waitToDisposePart
=
False
return
activeEntity
#outputs message to the trace.xls. Format is (Simulation Time | Entity or Frame Name | message)
#outputs message to the trace.xls. Format is (Simulation Time | Entity or Frame Name | message)
def
outputTrace
(
self
,
name
,
message
):
def
outputTrace
(
self
,
name
,
message
):
...
...
dream/simulation/Machine.py
View file @
880c1dce
...
@@ -295,10 +295,11 @@ class Machine(CoreObject):
...
@@ -295,10 +295,11 @@ class Machine(CoreObject):
def
removeEntity
(
self
):
def
removeEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObject
.
outputTrace
(
"releases "
+
activeObject
.
objName
)
# output to trace that the Entity was released from the currentObject
activeObject
.
outputTrace
(
"releases "
+
activeObject
.
objName
)
# output to trace that the Entity was released from the currentObject
CoreObject
.
removeEntity
(
self
)
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeObject
.
timeLastEntityLeft
=
now
()
# set the time that the last Entity was removed from this object
activeObject
.
timeLastEntityLeft
=
now
()
# set the time that the last Entity was removed from this object
activeObject
.
waitToDispose
=
False
# update the waitToDispose flag
activeObject
.
waitToDispose
=
False
# update the waitToDispose flag
activeObject
.
downTimeInTryingToReleaseCurrentEntity
=
0
# re-initialize the timer downTimeInTryingToReleaseCurrentEntity
activeObject
.
downTimeInTryingToReleaseCurrentEntity
=
0
# re-initialize the timer downTimeInTryingToReleaseCurrentEntity
return
activeEntity
# =======================================================================
# =======================================================================
# checks if the Machine can dispose an entity to the following object
# checks if the Machine can dispose an entity to the following object
...
...
dream/simulation/Queue.py
View file @
880c1dce
...
@@ -168,6 +168,7 @@ class Queue(CoreObject):
...
@@ -168,6 +168,7 @@ class Queue(CoreObject):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeObject
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
activeObject
.
objName
)
#output trace
activeObject
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
activeObject
.
objName
)
#output trace
return
activeEntity
#checks if the Queue can accept an entity and there is an entity in some predecessor waiting for it
#checks if the Queue can accept an entity and there is an entity in some predecessor waiting for it
#also updates the predecessorIndex to the one that is to be taken
#also updates the predecessorIndex to the one that is to be taken
...
@@ -205,6 +206,7 @@ class Queue(CoreObject):
...
@@ -205,6 +206,7 @@ class Queue(CoreObject):
activeEntity
=
CoreObject
.
getEntity
(
self
)
#run the default behavior
activeEntity
=
CoreObject
.
getEntity
(
self
)
#run the default behavior
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
self
.
objName
)
return
activeEntity
#sorts the Entities of the Queue according to the scheduling rule
#sorts the Entities of the Queue according to the scheduling rule
def
sortEntities
(
self
):
def
sortEntities
(
self
):
...
...
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