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
40253aa2
Commit
40253aa2
authored
Oct 25, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getEntity and removeEntity code cleaned in many CoreObjects
parent
faa167cd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
66 deletions
+35
-66
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+3
-5
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+2
-4
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+4
-2
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+8
-10
dream/simulation/Exit.py
dream/simulation/Exit.py
+4
-26
dream/simulation/ExitJobShop.py
dream/simulation/ExitJobShop.py
+6
-2
dream/simulation/Machine.py
dream/simulation/Machine.py
+4
-11
dream/simulation/Queue.py
dream/simulation/Queue.py
+4
-6
No files found.
dream/simulation/Assembly.py
View file @
40253aa2
...
...
@@ -183,11 +183,9 @@ class Assembly(CoreObject):
#removes an entity from the Assembly
def
removeEntity
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
self
.
outputTrace
(
activeObjectQueue
[
0
].
name
,
"releases "
+
self
.
objName
)
activeObjectQueue
.
pop
(
0
)
self
.
waitToDispose
=
False
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
self
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
self
.
objName
)
#output trace
self
.
waitToDispose
=
False
#the object does not wait to dispose now
#gets an entity from the predecessor
#it may handle both Parts and Frames
...
...
dream/simulation/Conveyer.py
View file @
40253aa2
...
...
@@ -223,11 +223,9 @@ class Conveyer(CoreObject):
#removes an entity from the Conveyer
def
removeEntity
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
self
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
self
.
objName
)
activeObjectQueue
.
pop
(
0
)
self
.
position
.
pop
(
0
)
self
.
waitToDispose
=
False
#if the conveyer was full, it means that it also was blocked
...
...
dream/simulation/CoreObject.py
View file @
40253aa2
...
...
@@ -75,8 +75,10 @@ class CoreObject(Process):
# ================================== removes an entity from the Object ==========================
def
removeEntity
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
.
pop
(
0
)
#remove the Entity from the queue
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeObjectQueue
.
pop
(
0
)
#remove the Entity from the queue
return
activeEntity
# ================================== gets an entity from the ====================================
# ===================== predecessor that the predecessor index points to ========================
...
...
dream/simulation/Dismantle.py
View file @
40253aa2
...
...
@@ -187,18 +187,16 @@ class Dismantle(CoreObject):
#removes an entity from the Dismantle
def
removeEntity
(
self
):
#to release the Frame if it is empty
if
(
len
(
self
.
Res
.
activeQ
)
==
1
):
self
.
outputTrace
(
self
.
Res
.
activeQ
[
0
].
name
,
" releases "
+
self
.
objName
)
self
.
Res
.
activeQ
.
pop
(
0
)
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
self
.
outputTrace
(
activeEntity
.
name
,
" releases "
+
self
.
objName
)
#output the trace
#update the flags
if
(
len
(
activeObjectQueue
)
==
0
):
self
.
waitToDisposeFrame
=
False
elif
(
len
(
self
.
Res
.
activeQ
)
>
1
):
self
.
outputTrace
(
self
.
Res
.
activeQ
[
0
].
name
,
" releases "
+
self
.
objName
)
self
.
Res
.
activeQ
.
pop
(
0
)
if
(
len
(
self
.
Res
.
activeQ
)
==
1
):
else
:
if
(
len
(
activeObjectQueue
)
==
1
):
self
.
waitToDisposePart
=
False
#outputs message to the trace.xls. Format is (Simulation Time | Entity or Frame Name | message)
def
outputTrace
(
self
,
name
,
message
):
from
Globals
import
G
...
...
dream/simulation/Exit.py
View file @
40253aa2
...
...
@@ -144,32 +144,10 @@ class Exit(CoreObject):
# gets an entity from the predecessor
# =======================================================================
def
getEntity
(
self
):
# # get giver object, its queue, and sort the entities according to this object priorities
# giverObject=self.getGiverObject()
# # sort the Entities of the giver according to the scheduling rule if applied
# giverObject.sortEntities()
# giverObjectQueue=self.getGiverObjectQueue()
# # get active object and its queue, as well as the active (to be) entity
# #(after the sorting of the entities in the queue of the giver object)
# activeObject=self.getActiveObject()
# activeObjectQueue=self.getActiveObjectQueue()
# activeEntity=giverObjectQueue[0]
# #get the entity from the previous object and put it in front of the activeQ
# activeObjectQueue.append(activeEntity)
# #remove the entity from the previous object
# giverObject.removeEntity()
# #append the time to schedule so that it can be read in the result
# #remember that every entity has it's schedule which is supposed to be updated every time
# # the entity enters a new object
# activeEntity.schedule.append([activeObject.id,now()])
# activeEntity.currentStation=self
activeEntity
=
CoreObject
.
getEntity
(
self
)
# get the name of the entity for the trace
# Add the entity's lifespan to the total one.
name
=
activeEntity
.
name
self
.
totalLifespan
+=
now
()
-
activeEntity
.
startTime
self
.
outputTrace
(
name
)
activeEntity
=
CoreObject
.
getEntity
(
self
)
#run the default method
self
.
totalLifespan
+=
now
()
-
activeEntity
.
startTime
#Add the entity's lifespan to the total one.
self
.
outputTrace
(
activeEntity
.
name
)
return
activeEntity
# =======================================================================
# actions to be taken after the simulation ends
...
...
dream/simulation/ExitJobShop.py
View file @
40253aa2
...
...
@@ -42,6 +42,7 @@ class ExitJobShop(Exit):
#gets an entity from the previous station
def
getEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
...
...
@@ -51,8 +52,11 @@ class ExitJobShop(Exit):
name
=
activeEntity
.
name
#get the name of the entity for the trace
self
.
totalLifespan
+=
now
()
-
activeEntity
.
startTime
#Add the entity's lifespan to the total one.
giverObject
.
removeEntity
()
#remove the entity from the previous object
self
.
outputTrace
(
name
)
activeEntity
.
schedule
.
append
([
activeObject
.
id
,
now
()])
#append the time to schedule so that it can be read in the result
self
.
outputTrace
(
name
)
#activeEntity=Exit.getEntity(self)
#activeEntity.remainingRoute=[]
activeEntity
.
schedule
.
append
([
self
.
id
,
now
()])
#append the time to schedule so that it can be read in the result
activeEntity
.
currentStation
=
self
#get the giver object in a getEntity transaction.
...
...
dream/simulation/Machine.py
View file @
40253aa2
...
...
@@ -237,10 +237,6 @@ class Machine(CoreObject):
# this is done to achieve better (cpu) processing time
if
(
len
(
activeObject
.
previous
)
==
1
or
callerObject
==
None
):
return
activeObject
.
Up
and
len
(
activeObjectQueue
)
==
0
# # if the machine is busy return False immediately
# if len(activeObjectQueue)==activeObject.capacity:
# return False
thecaller
=
callerObject
# return True ONLY if the length of the activeOjbectQue is smaller than
...
...
@@ -297,14 +293,11 @@ class Machine(CoreObject):
# removes an entity from the Machine
# =======================================================================
def
removeEntity
(
self
):
# get active and its queue
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObject
.
timeLastEntityLeft
=
now
()
# set the time that the last Entity was removed from this object
activeObject
=
self
.
getActiveObject
()
activeObject
.
outputTrace
(
"releases "
+
activeObject
.
objName
)
# output to trace that the Entity was released from the currentObject
CoreObject
.
removeEntity
(
self
)
#run the default method
activeObject
.
timeLastEntityLeft
=
now
()
# set the time that the last Entity was removed from this object
activeObject
.
waitToDispose
=
False
# update the waitToDispose flag
activeObjectQueue
.
pop
(
0
)
# remove the Entity from the activeQ
activeObject
.
downTimeInTryingToReleaseCurrentEntity
=
0
# re-initialize the timer downTimeInTryingToReleaseCurrentEntity
# =======================================================================
...
...
@@ -409,7 +402,7 @@ class Machine(CoreObject):
if
(
G
.
trace
==
"Yes"
):
#output only if the user has selected to
#handle the 3 columns
G
.
traceSheet
.
write
(
G
.
traceIndex
,
0
,
str
(
now
()))
G
.
traceSheet
.
write
(
G
.
traceIndex
,
1
,
self
.
Res
.
activeQ
[
0
].
name
)
G
.
traceSheet
.
write
(
G
.
traceIndex
,
1
,
self
.
getActiveObjectQueue
()
[
0
].
name
)
G
.
traceSheet
.
write
(
G
.
traceIndex
,
2
,
message
)
G
.
traceIndex
+=
1
#increment the row
...
...
dream/simulation/Queue.py
View file @
40253aa2
...
...
@@ -164,12 +164,10 @@ class Queue(CoreObject):
return
len
(
self
.
Res
.
activeQ
)
>
0
and
(
thecaller
is
receiverObject
)
#removes an entity from the Object
def
removeEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObject
.
outputTrace
(
activeObjectQueue
[
0
].
name
,
"releases "
+
self
.
objName
)
activeObjectQueue
.
pop
(
0
)
#remove the Entity
def
removeEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeObject
.
outputTrace
(
activeEntity
.
name
,
"releases "
+
activeObject
.
objName
)
#output trace
#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
...
...
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