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
5c913741
Commit
5c913741
authored
Oct 01, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments added in the previous commit
parent
d3d76d75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+7
-7
dream/simulation/QueueJobShop.py
dream/simulation/QueueJobShop.py
+7
-4
No files found.
dream/simulation/MachineJobShop.py
View file @
5c913741
...
...
@@ -39,10 +39,11 @@ class MachineJobShop(Machine):
def
getEntity
(
self
):
Machine
.
getEntity
(
self
)
#run the default code
avtiveEntity
=
self
.
Res
.
activeQ
[
0
]
self
.
procTime
=
avtiveEntity
.
remainingRoute
[
0
][
1
]
self
.
nextStationId
=
avtiveEntity
.
remainingRoute
[
1
][
0
]
avtiveEntity
.
remainingRoute
.
pop
(
0
)
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
from
Globals
import
G
#loop through the objects to to assign the next station to the one that has the id
for
obj
in
G
.
ObjList
:
if
obj
.
id
==
self
.
nextStationId
:
self
.
nextStation
=
obj
...
...
@@ -50,8 +51,6 @@ class MachineJobShop(Machine):
#checks if the machine down or it can dispose the object
def
ifCanDisposeOrHaveFailure
(
self
):
return
self
.
Up
==
False
or
self
.
nextStation
.
canAccept
(
self
)
or
len
(
self
.
Res
.
activeQ
)
==
0
#the last part is added so that it is not removed and stack
#gotta think of it again
#calculates the processing time
def
calculateProcessingTime
(
self
):
...
...
@@ -59,9 +58,10 @@ class MachineJobShop(Machine):
#checks if the Machine can dispose an entity. Returns True only to the potential receiver
def
haveToDispose
(
self
,
callerObject
=
None
):
if
callerObject
!=
None
:
if
callerObject
!=
None
:
#check it the object that called the method holds an Entity that requests for current object
if
self
.
Res
.
activeQ
[
0
].
remainingRoute
[
0
][
0
]
==
callerObject
.
id
:
return
len
(
self
.
Res
.
activeQ
)
>
0
and
self
.
waitToDispose
and
self
.
Up
return
len
(
self
.
Res
.
activeQ
)
>
0
and
self
.
waitToDispose
and
self
.
Up
#return according to the state of the machine
return
False
...
...
dream/simulation/QueueJobShop.py
View file @
5c913741
...
...
@@ -39,16 +39,18 @@ class QueueJobShop(Queue):
#it checks also who called it and returns TRUE only to the object that will give the entity.
def
canAccept
(
self
,
callerObject
=
None
):
if
callerObject
!=
None
:
#check it the caller object holds an Entity that requests for current object
if
len
(
callerObject
.
Res
.
activeQ
)
>
0
:
activeEntity
=
callerObject
.
Res
.
activeQ
[
0
]
if
activeEntity
.
remainingRoute
[
0
][
0
]
==
self
.
id
:
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
#return according to the state of the Queue
return
False
#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
def
canAcceptAndIsRequested
(
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
.
Res
.
activeQ
)
>
0
and
now
()
!=
0
:
activeEntity
=
obj
.
Res
.
activeQ
[
0
]
...
...
@@ -60,8 +62,9 @@ class QueueJobShop(Queue):
#gets an entity from the predecessor that the predecessor index points to
def
getEntity
(
self
):
self
.
Res
.
activeQ
.
append
(
self
.
previousStation
.
Res
.
activeQ
[
0
])
#get the entity from the previous object
#and put it in front of the activeQ
self
.
previousStation
.
removeEntity
()
#remove the entity from the previous object
self
.
Res
.
activeQ
[
0
].
remainingRoute
[
0
][
0
]
=
""
#and put it in front of the activeQ
self
.
previousStation
.
removeEntity
()
#remove the entity from the previous object
self
.
Res
.
activeQ
[
0
].
remainingRoute
[
0
][
0
]
=
""
#remove data from the remaining route.
#This is needed so that the Queue will not request again for the Entity
\ No newline at end of file
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