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
2a1badf7
Commit
2a1badf7
authored
May 28, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Jun 26, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug in Exit fixed
parent
eabdc79d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
7 deletions
+33
-7
DREAM/dream/simulation/src/Conveyer.py
DREAM/dream/simulation/src/Conveyer.py
+30
-5
DREAM/dream/simulation/src/Exit.py
DREAM/dream/simulation/src/Exit.py
+3
-2
DREAM/dream/simulation/src/output.xls
DREAM/dream/simulation/src/output.xls
+0
-0
DREAM/dream/simulation/src/trace1.xls
DREAM/dream/simulation/src/trace1.xls
+0
-0
No files found.
DREAM/dream/simulation/src/Conveyer.py
View file @
2a1badf7
...
...
@@ -64,26 +64,32 @@ class Conveyer(Process):
self
.
justDisposed
=
False
self
.
timeToReachEnd
=-
1
self
.
justReachedEnd
=
False
self
.
conveyerMover
=
ConveyerMover
(
self
)
self
.
call
=
False
def
run
(
self
):
#these are just for the first Entity
activate
(
self
.
conveyerMover
,
self
.
conveyerMover
.
run
())
yield
waituntil
,
self
,
self
.
canAcceptAndIsRequested
#wait until the Queue can accept an entity #and one predecessor requests it
self
.
getEntity
()
#get the entity
self
.
timeLastMoveHappened
=
now
()
while
1
:
if
(
len
(
self
.
position
)
>
0
and
(
not
self
.
length
==
self
.
position
[
0
])):
self
.
timeToReachEnd
=
now
()
*
60.0
+
self
.
speed
/
(
self
.
length
-
self
.
position
[
0
])
print
self
.
speed
/
(
self
.
length
-
self
.
position
[
0
])
print
now
(),
"timeToReachEnd="
,
self
.
timeToReachEnd
/
60.0
activate
(
self
,
self
.
reachedEnd
())
self
.
call
=
True
self
.
conveyerMover
.
timeToWait
=
self
.
timeToReachEnd
/
60.0
yield
waituntil
,
self
,
self
.
somethingHappened
#wait for an important event in order to move the items
self
.
moveEntities
()
#
self.moveEntities()
if
self
.
canAcceptAndIsRequested
():
print
now
(),
":canAcceptAndIsRequested"
#
print now(), ":canAcceptAndIsRequested"
self
.
getEntity
()
if
self
.
waitToDispose
:
print
now
(),
":waitToDispose"
#
print now(), ":waitToDispose"
continue
'''
now we have to wait until something happens. The things that are important are (may be not a full list)
...
...
@@ -194,12 +200,15 @@ class Conveyer(Process):
return False
'''
def
callMover
(
self
):
return
self
.
call
def
reachedEnd
(
self
):
print
"-"
*
50
yield
waituntil
,
self
,
self
.
somethingHappened
#wait for an important event in order to move the items
def
somethingHappened
(
self
):
print
now
()
#
print now()
if
(
len
(
self
.
position
)
>
0
):
if
(
self
.
timeToReachEnd
==
now
()
and
(
not
self
.
position
[
0
]
==
self
.
length
)):
self
.
waitToDispose
==
True
...
...
@@ -310,5 +319,21 @@ class Conveyer(Process):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
#Process that handles the moves of the conveyer
class
ConveyerMover
(
Process
):
def
__init__
(
self
,
conveyer
):
Process
.
__init__
(
self
)
self
.
conveyer
=
conveyer
self
.
timeToWait
=
0
def
run
(
self
):
while
1
:
yield
waituntil
,
self
,
self
.
conveyer
.
callMover
yield
hold
,
self
,
self
.
timeToWait
#print now()
self
.
conveyer
.
moveEntities
()
self
.
conveyer
.
call
=
False
\ No newline at end of file
DREAM/dream/simulation/src/Exit.py
View file @
2a1badf7
...
...
@@ -93,8 +93,9 @@ class Exit(Process):
#gets an entity from the predecessor
def
getEntity
(
self
):
name
=
self
.
previous
[
0
].
Res
.
activeQ
[
0
].
name
#get the name of the entity for the trace
self
.
previous
[
0
].
removeEntity
()
#remove the entity from the previous object
name
=
self
.
previous
[
self
.
predecessorIndex
].
Res
.
activeQ
[
0
].
name
#get the name of the entity for the trace
self
.
totalLifespan
+=
now
()
-
self
.
previous
[
self
.
predecessorIndex
].
Res
.
activeQ
[
0
].
startTime
#Add the entity's lifespan to the total one.
self
.
previous
[
self
.
predecessorIndex
].
removeEntity
()
#remove the entity from the previous object
self
.
outputTrace
(
name
)
#actions to be taken after the simulation ends
...
...
DREAM/dream/simulation/src/output.xls
View file @
2a1badf7
No preview for this file type
DREAM/dream/simulation/src/trace1.xls
View file @
2a1badf7
No preview for this file type
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