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
75b1e246
Commit
75b1e246
authored
Oct 25, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup in getEntity and removeEntity of jobshop coreobjects
parent
880c1dce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
38 deletions
+10
-38
dream/simulation/ExitJobShop.py
dream/simulation/ExitJobShop.py
+1
-20
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+3
-3
dream/simulation/QueueJobShop.py
dream/simulation/QueueJobShop.py
+6
-15
No files found.
dream/simulation/ExitJobShop.py
View file @
75b1e246
...
...
@@ -40,31 +40,12 @@ class ExitJobShop(Exit):
else
:
return
False
#gets an entity from the previous station
def
getEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
activeEntity
=
giverObjectQueue
[
0
]
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=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.
def
getGiverObject
(
self
):
from
Globals
import
G
#loop through the objects to see if there is one that holds an Entity requesting for current object
for
obj
in
G
.
ObjList
:
if
len
(
obj
.
getActiveObjectQueue
())
>
0
and
now
()
!=
0
:
if
len
(
obj
.
getActiveObjectQueue
())
>
0
and
(
obj
!=
self
)
and
now
()
!=
0
:
activeEntity
=
obj
.
getActiveObjectQueue
()[
0
]
if
activeEntity
.
remainingRoute
[
0
][
0
]
==
self
.
id
:
return
obj
...
...
dream/simulation/MachineJobShop.py
View file @
75b1e246
...
...
@@ -35,11 +35,11 @@ class MachineJobShop(Machine):
#gets an entity from the predecessor that the predecessor index points to
def
getEntity
(
self
):
Machine
.
getEntity
(
self
)
#run the default code
avtiveEntity
=
self
.
getActiveObjectQueue
()[
0
]
avtiveEntity
=
Machine
.
getEntity
(
self
)
#run the default code
self
.
procTime
=
avtiveEntity
.
remainingRoute
[
0
][
1
]
#read the processing time from the entity
self
.
nextStationId
=
avtiveEntity
.
remainingRoute
[
1
][
0
]
#read the next station id
avtiveEntity
.
remainingRoute
.
pop
(
0
)
#remove data from the remaining route of the entity
avtiveEntity
.
remainingRoute
.
pop
(
0
)
#remove data from the remaining route of the entity
return
avtiveEntity
#checks if the machine down or it can dispose the object
def
ifCanDisposeOrHaveFailure
(
self
):
...
...
dream/simulation/QueueJobShop.py
View file @
75b1e246
...
...
@@ -54,28 +54,19 @@ class QueueJobShop(Queue):
return
False
#gets an entity from the predecessor that the predecessor index points to
def
getEntity
(
self
):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
giverObjectQueue
=
self
.
getGiverObjectQueue
()
activeEntity
=
giverObjectQueue
[
0
]
activeObjectQueue
.
append
(
giverObjectQueue
[
0
])
#get the entity from the previous object
#and put it in front of the activeQ
giverObject
.
removeEntity
()
#remove the entity from the previous object
def
getEntity
(
self
):
activeEntity
=
Queue
.
getEntity
(
self
)
activeEntity
.
remainingRoute
[
0
][
0
]
=
""
#remove data from the remaining route.
#This is needed so that the Queue will not request again for the Entity
self
.
outputTrace
(
activeEntity
.
name
,
"got into "
+
activeObject
.
objName
)
activeEntity
.
schedule
.
append
([
activeObject
.
id
,
now
()])
#append the time to schedule so that it can be read in the result
return
activeEntity
#get the giver object in a getEntity transaction.
def
getGiverObject
(
self
):
from
Globals
import
G
#loop through the objects to see if there is one that holds an Entity requesting for current object
for
obj
in
G
.
ObjList
:
if
len
(
obj
.
getActiveObjectQueue
())
>
0
and
now
()
!=
0
:
if
len
(
obj
.
getActiveObjectQueue
())
>
0
and
(
obj
!=
self
)
and
now
()
!=
0
:
activeEntity
=
obj
.
getActiveObjectQueue
()[
0
]
if
activeEntity
.
remainingRoute
[
0
][
0
]
==
self
.
id
:
return
obj
...
...
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