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
32ae236e
Commit
32ae236e
authored
Oct 20, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct priority to M1
parent
344f1bff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
dream/simulation/Examples/OperationalFailures.py
dream/simulation/Examples/OperationalFailures.py
+17
-4
No files found.
dream/simulation/Examples/OperationalFailures.py
View file @
32ae236e
...
...
@@ -17,7 +17,7 @@ f=0.2
maxSimTime
=
1000
# the capacity of B123
capacity
=
3
capacity
=
45
# float('inf')
class
OpQueue
(
Queue
):
# allow to be locked between the time periods
...
...
@@ -26,6 +26,14 @@ class OpQueue(Queue):
return
False
return
Queue
.
canAccept
(
self
,
callerObject
)
#override so that it chooses first M1 and the M2
def
selectGiver
(
self
,
possibleGivers
=
[]):
if
len
(
M1
.
getActiveObjectQueue
()):
return
M1
if
len
(
M2
.
getActiveObjectQueue
()):
return
M2
return
None
class
OpExit
(
Exit
):
# set numGoodParts=0 at every replication
def
initialize
(
self
):
...
...
@@ -89,14 +97,18 @@ def controllerMethod():
rn2
=
createRandomNumber
()
if
M
.
state
==
1
:
if
rn1
<
M
.
p
:
# print G.env.now, M.id,'to 0 (from 1)'
M
.
state
=
0
elif
rn2
<
M
.
g
:
# print G.env.now, M.id,'to -1'
M
.
state
=-
1
elif
M
.
state
==
0
:
if
rn1
<
M
.
r
:
# print G.env.now, M.id,'to 1'
M
.
state
=
1
elif
M
.
state
==-
1
:
if
rn1
<
M
.
f
:
# print G.env.now, M.id,'to 0 (from -1)'
M
.
state
=
0
# unlock E and let part get from M3 to E
...
...
@@ -114,7 +126,7 @@ def controllerMethod():
M3
.
locked
=
True
# unlock B123 and let parts get from M1 and M2 to B123
B123
.
locked
=
False
B123
.
locked
=
False
if
((
len
(
M1
.
getActiveObjectQueue
()))
and
(
not
M1
.
state
==
0
)
\
or
((
len
(
M2
.
getActiveObjectQueue
()))
and
not
M2
.
state
==
0
))
\
and
len
(
B123
.
getActiveObjectQueue
())
<
B123
.
capacity
:
...
...
@@ -195,7 +207,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
=
5
)
runSimulation
(
objectList
,
maxSimTime
,
numberOfReplications
=
5
0
,
trace
=
'No'
)
#print the results
PRt
=
sum
(
E
.
Exits
)
/
float
(
len
(
E
.
Exits
))
...
...
@@ -207,6 +219,7 @@ print 'PRg=',PRg/float(maxSimTime)
for
M
in
[
M1
,
M2
,
M3
]:
G
=
sum
(
M
.
GoodExits
)
/
float
(
len
(
M
.
GoodExits
))
print
'PRg'
+
M
.
id
,
'='
,
G
/
float
(
maxSimTime
)
# 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