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
9ba2ae2a
Commit
9ba2ae2a
authored
Oct 22, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impose M1 priority more strongly
parent
775857e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
dream/simulation/Examples/OperationalFailures.py
dream/simulation/Examples/OperationalFailures.py
+6
-4
No files found.
dream/simulation/Examples/OperationalFailures.py
View file @
9ba2ae2a
...
...
@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, Queue, NonStarvingEntry, Exit, Par
from
dream.simulation.Globals
import
runSimulation
,
G
import
random
from
random
import
Random
Rnd
=
Random
(
3
)
Rnd
=
Random
(
20
)
import
time
start
=
time
.
time
()
...
...
@@ -17,7 +17,7 @@ f=0.2
maxSimTime
=
1000
# the capacity of B123
capacity
=
3
# float('inf')
capacity
=
42
# float('inf')
class
OpQueue
(
Queue
):
# allow to be locked between the time periods
...
...
@@ -136,6 +136,8 @@ def controllerMethod():
i
=
0
while
(
len
(
M1
.
getActiveObjectQueue
())
and
(
not
M1
.
state
==
0
))
\
or
(
len
(
M2
.
getActiveObjectQueue
())
and
(
not
M2
.
state
==
0
)):
if
(
len
(
M1
.
getActiveObjectQueue
())
and
(
not
M1
.
state
==
0
)):
B123
.
giver
=
M1
yield
G
.
env
.
timeout
(
0
)
if
len
(
B123
.
getActiveObjectQueue
())
==
B123
.
capacity
:
break
...
...
@@ -209,7 +211,7 @@ M3.r=0.1
M3
.
f
=
0.2
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
numberOfReplications
=
50
,
trace
=
'No
'
)
runSimulation
(
objectList
,
maxSimTime
,
numberOfReplications
=
1
,
trace
=
'Yes
'
)
#print the results
PRt
=
sum
(
E
.
Exits
)
/
float
(
len
(
E
.
Exits
))
...
...
@@ -222,6 +224,6 @@ for M in [M1,M2,M3]:
G
=
sum
(
M
.
GoodExits
)
/
float
(
len
(
M
.
GoodExits
))
print
'PRg'
+
M
.
id
,
'='
,
G
/
float
(
maxSimTime
)
#
ExcelHandler.outputTrace('OperationalFailures')
ExcelHandler
.
outputTrace
(
'OperationalFailures'
)
print
"running time="
,
time
.
time
()
-
start
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