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
357dd57c
Commit
357dd57c
authored
Sep 16, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples editted not to print in test mode
parent
80b518d9
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
361 additions
and
238 deletions
+361
-238
dream/simulation/Examples/AssemblyLine.py
dream/simulation/Examples/AssemblyLine.py
+11
-5
dream/simulation/Examples/BalancingABuffer.py
dream/simulation/Examples/BalancingABuffer.py
+10
-4
dream/simulation/Examples/ChangingPredecessors.py
dream/simulation/Examples/ChangingPredecessors.py
+10
-5
dream/simulation/Examples/ClearBatchLines.py
dream/simulation/Examples/ClearBatchLines.py
+27
-23
dream/simulation/Examples/DecompositionOfBatches.py
dream/simulation/Examples/DecompositionOfBatches.py
+15
-9
dream/simulation/Examples/JobShop1.py
dream/simulation/Examples/JobShop1.py
+9
-5
dream/simulation/Examples/JobShop2EDD.py
dream/simulation/Examples/JobShop2EDD.py
+12
-10
dream/simulation/Examples/JobShop2MC.py
dream/simulation/Examples/JobShop2MC.py
+12
-10
dream/simulation/Examples/JobShop2Priority.py
dream/simulation/Examples/JobShop2Priority.py
+12
-10
dream/simulation/Examples/JobShop2RPC.py
dream/simulation/Examples/JobShop2RPC.py
+12
-10
dream/simulation/Examples/NonStarvingLine.py
dream/simulation/Examples/NonStarvingLine.py
+10
-5
dream/simulation/Examples/NonStarvingLineBatches.py
dream/simulation/Examples/NonStarvingLineBatches.py
+10
-5
dream/simulation/Examples/ParallelServers1.py
dream/simulation/Examples/ParallelServers1.py
+11
-6
dream/simulation/Examples/ParallelServers2.py
dream/simulation/Examples/ParallelServers2.py
+12
-7
dream/simulation/Examples/ParallelServers3.py
dream/simulation/Examples/ParallelServers3.py
+11
-7
dream/simulation/Examples/ParallelServers4.py
dream/simulation/Examples/ParallelServers4.py
+14
-8
dream/simulation/Examples/SerialBatchProcessing.py
dream/simulation/Examples/SerialBatchProcessing.py
+27
-23
dream/simulation/Examples/ServerWithShift1.py
dream/simulation/Examples/ServerWithShift1.py
+11
-6
dream/simulation/Examples/ServerWithShift2.py
dream/simulation/Examples/ServerWithShift2.py
+11
-6
dream/simulation/Examples/ServerWithShift3.py
dream/simulation/Examples/ServerWithShift3.py
+11
-6
dream/simulation/Examples/ServerWithShift4.py
dream/simulation/Examples/ServerWithShift4.py
+11
-6
dream/simulation/Examples/SettingWip1.py
dream/simulation/Examples/SettingWip1.py
+10
-5
dream/simulation/Examples/SettingWip2.py
dream/simulation/Examples/SettingWip2.py
+11
-6
dream/simulation/Examples/SettingWip3.py
dream/simulation/Examples/SettingWip3.py
+11
-6
dream/simulation/Examples/SingleServer.py
dream/simulation/Examples/SingleServer.py
+11
-5
dream/simulation/Examples/TwoServers.py
dream/simulation/Examples/TwoServers.py
+12
-6
dream/simulation/Examples/TwoServersPlots.py
dream/simulation/Examples/TwoServersPlots.py
+11
-8
dream/tests/testSimulationExamples.py
dream/tests/testSimulationExamples.py
+26
-26
No files found.
dream/simulation/Examples/AssemblyLine.py
View file @
357dd57c
...
...
@@ -18,20 +18,26 @@ A.defineRouting([Sp,Sf],[M])
M
.
defineRouting
([
A
],[
E
])
E
.
defineRouting
([
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
Sp
,
Sf
,
M
,
A
,
E
,
F
]
# set the length of the experiment
maxSimTime
=
1440.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio
=
(
A
.
totalWorkingTime
/
maxSimTime
)
*
100
#print the results
# return results for the test
if
test
:
return
{
"frames"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"frames"
working_ratio
=
(
A
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
A
.
objName
,
"is"
,
working_ratio
,
"%"
return
{
"frames"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
...
...
dream/simulation/Examples/BalancingABuffer.py
View file @
357dd57c
...
...
@@ -39,7 +39,7 @@ Q.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
Q
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
Q
,
M
,
E
,
EV
]
# set the length of the experiment
...
...
@@ -47,13 +47,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
'='
*
50
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ChangingPredecessors.py
View file @
357dd57c
...
...
@@ -49,22 +49,27 @@ E.defineRouting(predecessorList=[M])
EV
=
EventGenerator
(
'EV'
,
'PredecessorChanger'
,
start
=
0
,
stop
=
50
,
interval
=
10
,
method
=
changeMachinePredecessor
,
argumentDict
=
{
'machine'
:
M
,
'possiblePredecessors'
:[
Q1
,
Q2
]})
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
Q1
,
Q2
,
M
,
E
,
EV
]
+
entityList
# set the length of the experiment
maxSimTime
=
float
(
'inf'
)
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
trace
=
'Yes'
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
E
.
timeLastEntityLeft
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
#print the results
print
'='
*
50
print
"the system produced"
,
E
.
numOfExits
,
"parts in"
,
E
.
timeLastEntityLeft
,
"minutes"
working_ratio
=
(
M
.
totalWorkingTime
/
E
.
timeLastEntityLeft
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
ExcelHandler
.
outputTrace
(
'ChangingPredecessors'
)
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ClearBatchLines.py
View file @
357dd57c
...
...
@@ -24,7 +24,7 @@ BRA.defineRouting([M2],[M3])
M3
.
defineRouting
([
BRA
],[
E
])
E
.
defineRouting
([
M3
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
BD
,
M1
,
Q1
,
M2
,
BRA
,
M3
,
E
]
...
...
@@ -33,39 +33,43 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
trace
=
'Yes'
)
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"batches"
# calculate metrics
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M1
=
(
M1
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M1
=
(
M1
.
totalWaitingTime
/
maxSimTime
)
*
100
waiting_ratio_M1
=
(
M1
.
totalWaitingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M2
=
(
M2
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M2
=
(
M2
.
totalWaitingTime
/
maxSimTime
)
*
100
working_ratio_M3
=
(
M3
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M3
=
(
M3
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M3
=
(
M3
.
totalWaitingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"batches"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"blockage_ratio_M1"
:
blockage_ratio_M1
,
"waiting_ratio_M1"
:
waiting_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
"blockage_ratio_M2"
:
blockage_ratio_M2
,
"waiting_ratio_M2"
:
waiting_ratio_M2
,
"working_ratio_M3"
:
working_ratio_M3
,
"blockage_ratio_M3"
:
blockage_ratio_M3
,
"waiting_ratio_M3"
:
waiting_ratio_M3
,
}
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"batches"
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
working_ratio_M1
print
"the blockage ratio of"
,
M1
.
objName
,
'is'
,
blockage_ratio_M1
print
"the waiting ratio of"
,
M1
.
objName
,
'is'
,
waiting_ratio_M1
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M2
=
(
M2
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M2
=
(
M2
.
totalWaitingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
working_ratio_M2
print
"the blockage ratio of"
,
M2
.
objName
,
'is'
,
blockage_ratio_M2
print
"the waiting ratio of"
,
M2
.
objName
,
'is'
,
waiting_ratio_M2
working_ratio_M3
=
(
M3
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M3
=
(
M3
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M3
=
(
M3
.
totalWaitingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M3
.
objName
,
"is"
,
working_ratio_M3
print
"the blockage ratio of"
,
M3
.
objName
,
'is'
,
blockage_ratio_M3
print
"the waiting ratio of"
,
M3
.
objName
,
'is'
,
waiting_ratio_M3
ExcelHandler
.
outputTrace
(
'TRACE'
)
return
{
"batches"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"blockage_ratio_M1"
:
blockage_ratio_M1
,
"waiting_ratio_M1"
:
waiting_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
"blockage_ratio_M2"
:
blockage_ratio_M2
,
"waiting_ratio_M2"
:
waiting_ratio_M2
,
"working_ratio_M3"
:
working_ratio_M3
,
"blockage_ratio_M3"
:
blockage_ratio_M3
,
"waiting_ratio_M3"
:
waiting_ratio_M3
,
}
if
__name__
==
'__main__'
:
main
()
dream/simulation/Examples/DecompositionOfBatches.py
View file @
357dd57c
...
...
@@ -15,7 +15,7 @@ BD.defineRouting([Q],[M])
M
.
defineRouting
([
BD
],[
E
])
E
.
defineRouting
([
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
BD
,
M
,
E
]
...
...
@@ -24,18 +24,24 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"subbatches"
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio
=
(
M
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio
=
(
M
.
totalWaitingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"subbatches"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
,
"blockage_ratio"
:
blockage_ratio
,
"waiting_ratio"
:
waiting_ratio
}
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"subbatches"
print
"the working ratio of"
,
M
.
objName
,
"is"
,
working_ratio
print
"the blockage ratio of"
,
M
.
objName
,
'is'
,
blockage_ratio
print
"the waiting ratio of"
,
M
.
objName
,
'is'
,
waiting_ratio
return
{
"subbatches"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
,
"blockage_ratio"
:
blockage_ratio
,
"waiting_ratio"
:
waiting_ratio
}
print
"the blockage ratio of"
,
M
.
objName
,
"is"
,
blockage_ratio
print
"the waiting ratio of"
,
M
.
objName
,
"is"
,
waiting_ratio
if
__name__
==
'__main__'
:
main
()
dream/simulation/Examples/JobShop1.py
View file @
357dd57c
...
...
@@ -21,7 +21,7 @@ route=[{"stationIdsList": ["Q1"]},
#define the Jobs
J
=
Job
(
'J1'
,
'Job1'
,
route
=
route
)
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
M1
,
M2
,
M3
,
Q1
,
Q2
,
Q3
,
E
,
J
]
# set the length of the experiment
...
...
@@ -29,12 +29,16 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
#loop in the schedule to print the results
returnSchedule
=
[]
# dummy variable used just for returning values and testing
# return results for the test
if
test
:
returnSchedule
=
[]
for
record
in
J
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
return
returnSchedule
# print the results
for
record
in
J
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
print
J
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
return
returnSchedule
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/JobShop2EDD.py
View file @
357dd57c
...
...
@@ -44,25 +44,27 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2
=
Job
(
'J2'
,
'Job2'
,
route
=
J2Route
,
priority
=
1
,
dueDate
=
90
)
J3
=
Job
(
'J3'
,
'Job3'
,
route
=
J3Route
,
priority
=
0
,
dueDate
=
110
)
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
M1
,
M2
,
M3
,
Q1
,
Q2
,
Q3
,
E
,
J1
,
J2
,
J3
]
# set the length of the experiment
maxSimTime
=
float
(
'inf'
)
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# return results for the test
if
test
:
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
return
returnSchedule
#output the schedule of every job
returnSchedule
=
[]
# dummy variable used just for returning values and testing
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
#loop in the schedule to print the results
for
record
in
job
.
schedule
:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name
=
None
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
"-"
*
30
return
returnSchedule
print
"-"
*
30
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/JobShop2MC.py
View file @
357dd57c
...
...
@@ -44,25 +44,27 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2
=
Job
(
'J2'
,
'Job2'
,
route
=
J2Route
,
priority
=
1
,
dueDate
=
90
)
J3
=
Job
(
'J3'
,
'Job3'
,
route
=
J3Route
,
priority
=
0
,
dueDate
=
110
)
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
M1
,
M2
,
M3
,
Q1
,
Q2
,
Q3
,
E
,
J1
,
J2
,
J3
]
# set the length of the experiment
maxSimTime
=
float
(
'inf'
)
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# return results for the test
if
test
:
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
return
returnSchedule
#output the schedule of every job
returnSchedule
=
[]
# dummy variable used just for returning values and testing
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
#loop in the schedule to print the results
for
record
in
job
.
schedule
:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name
=
None
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
"-"
*
30
return
returnSchedule
print
"-"
*
30
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/JobShop2Priority.py
View file @
357dd57c
...
...
@@ -44,25 +44,27 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2
=
Job
(
'J2'
,
'Job2'
,
route
=
J2Route
,
priority
=
1
,
dueDate
=
90
)
J3
=
Job
(
'J3'
,
'Job3'
,
route
=
J3Route
,
priority
=
0
,
dueDate
=
110
)
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
M1
,
M2
,
M3
,
Q1
,
Q2
,
Q3
,
E
,
J1
,
J2
,
J3
]
# set the length of the experiment
maxSimTime
=
float
(
'inf'
)
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# return results for the test
if
test
:
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
return
returnSchedule
#output the schedule of every job
returnSchedule
=
[]
# dummy variable used just for returning values and testing
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
#loop in the schedule to print the results
for
record
in
job
.
schedule
:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name
=
None
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
"-"
*
30
return
returnSchedule
print
"-"
*
30
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/JobShop2RPC.py
View file @
357dd57c
...
...
@@ -44,25 +44,27 @@ J1=Job('J1','Job1',route=J1Route, priority=1, dueDate=100)
J2
=
Job
(
'J2'
,
'Job2'
,
route
=
J2Route
,
priority
=
1
,
dueDate
=
90
)
J3
=
Job
(
'J3'
,
'Job3'
,
route
=
J3Route
,
priority
=
0
,
dueDate
=
110
)
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
M1
,
M2
,
M3
,
Q1
,
Q2
,
Q3
,
E
,
J1
,
J2
,
J3
]
# set the length of the experiment
maxSimTime
=
float
(
'inf'
)
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# return results for the test
if
test
:
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
return
returnSchedule
#output the schedule of every job
returnSchedule
=
[]
# dummy variable used just for returning values and testing
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
#loop in the schedule to print the results
for
record
in
job
.
schedule
:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name
=
None
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
"-"
*
30
return
returnSchedule
print
"-"
*
30
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/NonStarvingLine.py
View file @
357dd57c
...
...
@@ -11,20 +11,25 @@ NS.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
NS
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
NS
,
M
,
E
]
# set the length of the experiment
maxSimTime
=
10
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/NonStarvingLineBatches.py
View file @
357dd57c
...
...
@@ -11,20 +11,25 @@ NS.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
NS
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
NS
,
M
,
E
]
# set the length of the experiment
maxSimTime
=
10
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"batches"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"batches"
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
return
{
"batches"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ParallelServers1.py
View file @
357dd57c
...
...
@@ -16,7 +16,7 @@ M1.defineRouting([Q],[E])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
M1
,
M2
,
E
,
F
]
...
...
@@ -25,15 +25,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
working_ratio_M1
,
"%"
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
working_ratio_M2
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
}
if
__name__
==
'__main__'
:
main
()
...
...
dream/simulation/Examples/ParallelServers2.py
View file @
357dd57c
...
...
@@ -26,8 +26,8 @@ M1.defineRouting([Q],[E])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
M1
,
M2
,
E
,
F
]
# set the length of the experiment
...
...
@@ -35,15 +35,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
working_ratio_M1
,
"%"
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
working_ratio_M2
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ParallelServers3.py
View file @
357dd57c
...
...
@@ -32,7 +32,7 @@ M1.defineRouting([Q],[E])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
M1
,
M2
,
E
,
F
]
...
...
@@ -41,16 +41,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
working_ratio_M1
,
"%"
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
working_ratio_M2
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
}
if
__name__
==
'__main__'
:
main
()
dream/simulation/Examples/ParallelServers4.py
View file @
357dd57c
...
...
@@ -55,7 +55,7 @@ M1.defineRouting([Q],[E])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M1
,
M2
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
M1
,
M2
,
E
,
F
]
...
...
@@ -64,19 +64,25 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
"NumM1"
:
G
.
NumM1
,
"NumM2"
:
G
.
NumM2
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
working_ratio_M1
,
"%"
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
working_ratio_M2
,
"%"
print
M1
.
objName
,
"produced"
,
G
.
NumM1
,
"parts"
print
M2
.
objName
,
"produced"
,
G
.
NumM2
,
"parts"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
"NumM1"
:
G
.
NumM1
,
"NumM2"
:
G
.
NumM2
}
if
__name__
==
'__main__'
:
main
()
dream/simulation/Examples/SerialBatchProcessing.py
View file @
357dd57c
...
...
@@ -23,46 +23,50 @@ BRA.defineRouting([M2],[M3])
M3
.
defineRouting
([
BRA
],[
E
])
E
.
defineRouting
([
M3
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
Q
,
BD
,
M1
,
Q1
,
M2
,
BRA
,
M3
,
E
]
# set the length of the experiment
maxSimTime
=
1440.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"batches"
# calculate metrics
working_ratio_M1
=
(
M1
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M1
=
(
M1
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M1
=
(
M1
.
totalWaitingTime
/
maxSimTime
)
*
100
waiting_ratio_M1
=
(
M1
.
totalWaitingTime
/
maxSimTime
)
*
100
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M2
=
(
M2
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M2
=
(
M2
.
totalWaitingTime
/
maxSimTime
)
*
100
working_ratio_M3
=
(
M3
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M3
=
(
M3
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M3
=
(
M3
.
totalWaitingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"batches"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"blockage_ratio_M1"
:
blockage_ratio_M1
,
"waiting_ratio_M1"
:
waiting_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
"blockage_ratio_M2"
:
blockage_ratio_M2
,
"waiting_ratio_M2"
:
waiting_ratio_M2
,
"working_ratio_M3"
:
working_ratio_M3
,
"blockage_ratio_M3"
:
blockage_ratio_M3
,
"waiting_ratio_M3"
:
waiting_ratio_M3
,
}
# print the results
print
"the system produced"
,
E
.
numOfExits
,
"batches"
print
"the working ratio of"
,
M1
.
objName
,
"is"
,
working_ratio_M1
print
"the blockage ratio of"
,
M1
.
objName
,
'is'
,
blockage_ratio_M1
print
"the waiting ratio of"
,
M1
.
objName
,
'is'
,
waiting_ratio_M1
working_ratio_M2
=
(
M2
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M2
=
(
M2
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M2
=
(
M2
.
totalWaitingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M2
.
objName
,
"is"
,
working_ratio_M2
print
"the blockage ratio of"
,
M2
.
objName
,
'is'
,
blockage_ratio_M2
print
"the waiting ratio of"
,
M2
.
objName
,
'is'
,
waiting_ratio_M2
working_ratio_M3
=
(
M3
.
totalWorkingTime
/
maxSimTime
)
*
100
blockage_ratio_M3
=
(
M3
.
totalBlockageTime
/
maxSimTime
)
*
100
waiting_ratio_M3
=
(
M3
.
totalWaitingTime
/
maxSimTime
)
*
100
print
"the working ratio of"
,
M3
.
objName
,
"is"
,
working_ratio_M3
print
"the blockage ratio of"
,
M3
.
objName
,
'is'
,
blockage_ratio_M3
print
"the waiting ratio of"
,
M3
.
objName
,
'is'
,
waiting_ratio_M3
return
{
"batches"
:
E
.
numOfExits
,
"working_ratio_M1"
:
working_ratio_M1
,
"blockage_ratio_M1"
:
blockage_ratio_M1
,
"waiting_ratio_M1"
:
waiting_ratio_M1
,
"working_ratio_M2"
:
working_ratio_M2
,
"blockage_ratio_M2"
:
blockage_ratio_M2
,
"waiting_ratio_M2"
:
waiting_ratio_M2
,
"working_ratio_M3"
:
working_ratio_M3
,
"blockage_ratio_M3"
:
blockage_ratio_M3
,
"waiting_ratio_M3"
:
waiting_ratio_M3
,
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ServerWithShift1.py
View file @
357dd57c
...
...
@@ -13,7 +13,7 @@ S.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M
,
E
,
SS
]
...
...
@@ -21,15 +21,20 @@ def main():
maxSimTime
=
20.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
print
"the total off-shift ratio of the Machine is"
,
off_shift_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ServerWithShift2.py
View file @
357dd57c
...
...
@@ -22,7 +22,7 @@ S.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M
,
E
,
SS
]
...
...
@@ -30,15 +30,20 @@ def main():
maxSimTime
=
100.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
print
"the total off-shift ratio of the Machine is"
,
off_shift_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ServerWithShift3.py
View file @
357dd57c
...
...
@@ -13,7 +13,7 @@ S.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M
,
E
,
SS
]
...
...
@@ -21,15 +21,20 @@ def main():
maxSimTime
=
20.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
print
"the total off-shift ratio of the Machine is"
,
off_shift_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/ServerWithShift4.py
View file @
357dd57c
...
...
@@ -13,7 +13,7 @@ S.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M
,
E
,
SS
]
...
...
@@ -21,15 +21,20 @@ def main():
maxSimTime
=
20.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
print
"the total off-shift ratio of the Machine is"
,
off_shift_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/SettingWip1.py
View file @
357dd57c
...
...
@@ -12,7 +12,7 @@ Q.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
Q
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
Q
,
M
,
E
,
P1
]
# set the length of the experiment
...
...
@@ -20,14 +20,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
trace
=
'Yes'
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts in"
,
E
.
timeLastEntityLeft
,
"minutes"
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
ExcelHandler
.
outputTrace
(
'Wip1'
)
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/SettingWip2.py
View file @
357dd57c
...
...
@@ -13,7 +13,7 @@ Q.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
Q
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
Q
,
M
,
E
,
P1
,
P2
]
# set the length of the experiment
...
...
@@ -21,14 +21,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
trace
=
'Yes'
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts in"
,
E
.
timeLastEntityLeft
,
"minutes"
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
ExcelHandler
.
outputTrace
(
'Wip2'
)
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/SettingWip3.py
View file @
357dd57c
...
...
@@ -13,7 +13,7 @@ Q.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
Q
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
Q
,
M
,
E
,
P1
,
P2
]
# set the length of the experiment
...
...
@@ -21,14 +21,19 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
,
trace
=
'Yes'
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts in"
,
E
.
timeLastEntityLeft
,
"minutes"
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
ExcelHandler
.
outputTrace
(
'Wip3'
)
return
{
"parts"
:
E
.
numOfExits
,
"simulationTime"
:
E
.
timeLastEntityLeft
,
"working_ratio"
:
working_ratio
}
ExcelHandler
.
outputTrace
(
'Wip1'
)
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/SingleServer.py
View file @
357dd57c
...
...
@@ -11,20 +11,26 @@ S.defineRouting(successorList=[M])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M
,
E
]
# set the length of the experiment
maxSimTime
=
1440.0
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio
=
(
M
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the total working ratio of the Machine is"
,
working_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/TwoServers.py
View file @
357dd57c
...
...
@@ -19,7 +19,7 @@ Q.defineRouting([M1],[M2])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M2
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M1
,
M2
,
E
,
Q
,
R
,
F1
,
F2
]
...
...
@@ -28,15 +28,21 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
# calculate metrics
blockage_ratio
=
(
M1
.
totalBlockageTime
/
maxSimTime
)
*
100
working_ratio
=
(
R
.
totalWorkingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"blockage_ratio"
:
blockage_ratio
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
blockage_ratio
=
(
M1
.
totalBlockageTime
/
maxSimTime
)
*
100
working_ratio
=
(
R
.
totalWorkingTime
/
maxSimTime
)
*
100
print
"the blockage ratio of"
,
M1
.
objName
,
"is"
,
blockage_ratio
,
"%"
print
"the working ratio of"
,
R
.
objName
,
"is"
,
working_ratio
,
"%"
return
{
"parts"
:
E
.
numOfExits
,
"blockage_ratio"
:
blockage_ratio
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
dream/simulation/Examples/TwoServersPlots.py
View file @
357dd57c
...
...
@@ -19,7 +19,7 @@ Q.defineRouting([M1],[M2])
M2
.
defineRouting
([
Q
],[
E
])
E
.
defineRouting
([
M2
])
def
main
():
def
main
(
test
=
0
):
# add all the objects in a list
objectList
=
[
S
,
M1
,
M2
,
E
,
Q
,
R
,
F1
,
F2
]
...
...
@@ -28,12 +28,20 @@ def main():
# call the runSimulation giving the objects and the length of the experiment
runSimulation
(
objectList
,
maxSimTime
)
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
# calculate metrics
blockage_ratio
=
(
M1
.
totalBlockageTime
/
maxSimTime
)
*
100
blockage_ratio
=
(
M1
.
totalBlockageTime
/
maxSimTime
)
*
100
working_ratio
=
(
R
.
totalWorkingTime
/
maxSimTime
)
*
100
waiting_ratio
=
(
R
.
totalWaitingTime
/
maxSimTime
)
*
100
# return results for the test
if
test
:
return
{
"parts"
:
E
.
numOfExits
,
"blockage_ratio"
:
blockage_ratio
,
"working_ratio"
:
working_ratio
}
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
print
"the blockage ratio of"
,
M1
.
objName
,
"is"
,
blockage_ratio
,
"%"
print
"the working ratio of"
,
R
.
objName
,
"is"
,
working_ratio
,
"%"
...
...
@@ -43,11 +51,6 @@ def main():
#create the pie
graph
.
Pie
([
working_ratio
,
waiting_ratio
],
"repairmanPie.jpg"
)
return
{
"parts"
:
E
.
numOfExits
,
"blockage_ratio"
:
blockage_ratio
,
"working_ratio"
:
working_ratio
}
if
__name__
==
'__main__'
:
main
()
...
...
dream/tests/testSimulationExamples.py
View file @
357dd57c
...
...
@@ -36,26 +36,26 @@ class SimulationExamples(TestCase):
"""
def
testTwoServers
(
self
):
from
dream.simulation.Examples.TwoServers
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
732
)
self
.
assertTrue
(
78.17
<
result
[
"blockage_ratio"
]
<
78.18
)
self
.
assertTrue
(
26.73
<
result
[
"working_ratio"
]
<
27.74
)
def
testAssemblyLine
(
self
):
from
dream.simulation.Examples.AssemblyLine
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'frames'
],
664
)
self
.
assertTrue
(
92.36
<
result
[
"working_ratio"
]
<
93.37
)
def
testSingleServer
(
self
):
from
dream.simulation.Examples.SingleServer
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2880
)
self
.
assertTrue
(
49.99
<
result
[
"working_ratio"
]
<
50.01
)
def
testClearBatchLines
(
self
):
from
dream.simulation.Examples.ClearBatchLines
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'batches'
],
89
)
self
.
assertTrue
(
0.069
<
result
[
"waiting_ratio_M1"
]
<
0.07
)
self
.
assertTrue
(
0.104
<
result
[
"waiting_ratio_M2"
]
<
0.105
)
...
...
@@ -63,7 +63,7 @@ class SimulationExamples(TestCase):
def
testDecompositionOfBatches
(
self
):
from
dream.simulation.Examples.DecompositionOfBatches
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'subbatches'
],
2302
)
self
.
assertTrue
(
79.96
<
result
[
"working_ratio"
]
<
79.97
)
self
.
assertEquals
(
result
[
"blockage_ratio"
]
,
0.0
)
...
...
@@ -71,7 +71,7 @@ class SimulationExamples(TestCase):
def
testSerialBatchProcessing
(
self
):
from
dream.simulation.Examples.SerialBatchProcessing
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'batches'
],
359
)
self
.
assertTrue
(
0.104
<
result
[
"waiting_ratio_M1"
]
<
0.105
)
self
.
assertTrue
(
0.104
<
result
[
"waiting_ratio_M2"
]
<
0.105
)
...
...
@@ -79,13 +79,13 @@ class SimulationExamples(TestCase):
def
testJobShop1
(
self
):
from
dream.simulation.Examples.JobShop1
import
main
result
=
main
()
result
=
main
(
test
=
1
)
expectedResult
=
[[
'Queue1'
,
0
],
[
'Machine1'
,
0
],
[
'Queue3'
,
1.0
],
[
'Machine3'
,
1.0
],
[
'Queue2'
,
4.0
],
[
'Machine2'
,
4.0
],
[
'Exit'
,
6.0
]]
self
.
assertEquals
(
result
,
expectedResult
)
def
testJobShop2EDD
(
self
):
from
dream.simulation.Examples.JobShop2EDD
import
main
result
=
main
()
result
=
main
(
test
=
1
)
expectedResult
=
[[
'Queue1'
,
0
],
[
'Machine1'
,
2.0
],
[
'Queue3'
,
3.0
],
[
'Machine3'
,
3.0
],
[
'Queue2'
,
6.0
],
[
'Machine2'
,
6.0
],
[
'Exit'
,
8.0
],
\
[
'Queue1'
,
0
],
[
'Machine1'
,
0
],
[
'Queue2'
,
2.0
],
[
'Machine2'
,
2.0
],
[
'Queue3'
,
6.0
],
[
'Machine3'
,
6.0
],
[
'Exit'
,
12.0
],
[
'Queue1'
,
0
],
\
[
'Machine1'
,
3.0
],
[
'Queue3'
,
13.0
],
[
'Machine3'
,
13.0
],
[
'Exit'
,
16.0
]]
...
...
@@ -93,7 +93,7 @@ class SimulationExamples(TestCase):
def
testJobShop2MC
(
self
):
from
dream.simulation.Examples.JobShop2MC
import
main
result
=
main
()
result
=
main
(
test
=
1
)
expectedResult
=
[[
'Queue1'
,
0
],
[
'Machine1'
,
12.0
],
[
'Queue3'
,
13.0
],
[
'Machine3'
,
13.0
],
[
'Queue2'
,
16.0
],
\
[
'Machine2'
,
16.0
],
[
'Exit'
,
18.0
],
[
'Queue1'
,
0
],
[
'Machine1'
,
10.0
],
[
'Queue2'
,
12.0
],
[
'Machine2'
,
12.0
],
\
[
'Queue3'
,
16.0
],
[
'Machine3'
,
16.0
],
[
'Exit'
,
22.0
],
[
'Queue1'
,
0
],
[
'Machine1'
,
0
],
[
'Queue3'
,
10.0
],
[
'Machine3'
,
10.0
],
[
'Exit'
,
13.0
]]
...
...
@@ -101,7 +101,7 @@ class SimulationExamples(TestCase):
def
testJobShop2Priority
(
self
):
from
dream.simulation.Examples.JobShop2Priority
import
main
result
=
main
()
result
=
main
(
test
=
1
)
expectedResult
=
[[
'Queue1'
,
0
],
[
'Machine1'
,
10.0
],
[
'Queue3'
,
11.0
],
[
'Machine3'
,
13.0
],
[
'Queue2'
,
16.0
],
\
[
'Machine2'
,
17.0
],
[
'Exit'
,
19.0
],
[
'Queue1'
,
0
],
[
'Machine1'
,
11.0
],
[
'Queue2'
,
13.0
],
[
'Machine2'
,
13.0
],
[
'Queue3'
,
17.0
],
\
[
'Machine3'
,
17.0
],
[
'Exit'
,
23.0
],
[
'Queue1'
,
0
],
[
'Machine1'
,
0
],
[
'Queue3'
,
10.0
],
[
'Machine3'
,
10.0
],
[
'Exit'
,
13.0
]]
...
...
@@ -109,7 +109,7 @@ class SimulationExamples(TestCase):
def
testJobShop2RPC
(
self
):
from
dream.simulation.Examples.JobShop2RPC
import
main
result
=
main
()
result
=
main
(
test
=
1
)
expectedResult
=
[[
'Queue1'
,
0
],
[
'Machine1'
,
12.0
],
[
'Queue3'
,
13.0
],
[
'Machine3'
,
13.0
],
[
'Queue2'
,
16.0
],
\
[
'Machine2'
,
16.0
],
[
'Exit'
,
18.0
],
[
'Queue1'
,
0
],
[
'Machine1'
,
10.0
],
[
'Queue2'
,
12.0
],
[
'Machine2'
,
12.0
],
[
'Queue3'
,
16.0
],
\
[
'Machine3'
,
16.0
],
[
'Exit'
,
22.0
],
[
'Queue1'
,
0
],
[
'Machine1'
,
0
],
[
'Queue3'
,
10.0
],
[
'Machine3'
,
10.0
],
[
'Exit'
,
13.0
]]
...
...
@@ -117,14 +117,14 @@ class SimulationExamples(TestCase):
def
testParallelServers1
(
self
):
from
dream.simulation.Examples.ParallelServers1
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2880
)
self
.
assertTrue
(
23.09
<
result
[
"working_ratio_M1"
]
<
23.1
)
self
.
assertTrue
(
26.9
<
result
[
"working_ratio_M2"
]
<
26.91
)
def
testParallelServers2
(
self
):
from
dream.simulation.Examples.ParallelServers3
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2880
)
self
.
assertTrue
(
46.18
<
result
[
"working_ratio_M1"
]
<
46.19
)
self
.
assertTrue
(
3.81
<
result
[
"working_ratio_M2"
]
<
3.82
)
...
...
@@ -132,7 +132,7 @@ class SimulationExamples(TestCase):
#NOTE: testParallelServers4 is extension of testParallelServers4 so this test really tests if they both run
def
testParallelServers4
(
self
):
from
dream.simulation.Examples.ParallelServers4
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2880
)
self
.
assertTrue
(
46.18
<
result
[
"working_ratio_M1"
]
<
46.19
)
self
.
assertTrue
(
3.81
<
result
[
"working_ratio_M2"
]
<
3.82
)
...
...
@@ -141,77 +141,77 @@ class SimulationExamples(TestCase):
def
testServerWithShift1
(
self
):
from
dream.simulation.Examples.ServerWithShift1
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
3
)
self
.
assertTrue
(
49.99
<
result
[
"working_ratio"
]
<
50.01
)
def
testServerWithShift2
(
self
):
from
dream.simulation.Examples.ServerWithShift2
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
16
)
self
.
assertTrue
(
49.99
<
result
[
"working_ratio"
]
<
50.01
)
def
testServerWithShift3
(
self
):
from
dream.simulation.Examples.ServerWithShift3
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
4
)
self
.
assertTrue
(
59.99
<
result
[
"working_ratio"
]
<
60.01
)
def
testServerWithShift4
(
self
):
from
dream.simulation.Examples.ServerWithShift4
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2
)
self
.
assertTrue
(
29.99
<
result
[
"working_ratio"
]
<
30.01
)
def
testSettingWip1
(
self
):
from
dream.simulation.Examples.SettingWip1
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
1
)
self
.
assertEquals
(
result
[
'simulationTime'
],
0.25
)
self
.
assertEquals
(
result
[
"working_ratio"
],
100
)
def
testSettingWip2
(
self
):
from
dream.simulation.Examples.SettingWip2
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2
)
self
.
assertEquals
(
result
[
'simulationTime'
],
0.50
)
self
.
assertEquals
(
result
[
"working_ratio"
],
100
)
def
testSettingWip3
(
self
):
from
dream.simulation.Examples.SettingWip3
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2
)
self
.
assertEquals
(
result
[
'simulationTime'
],
0.35
)
self
.
assertEquals
(
result
[
"working_ratio"
],
100
)
def
testBalancingABuffer
(
self
):
from
dream.simulation.Examples.BalancingABuffer
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
13
)
self
.
assertEquals
(
result
[
"working_ratio"
],
80
)
def
testChangingPredecessors
(
self
):
from
dream.simulation.Examples.ChangingPredecessors
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
10
)
self
.
assertEquals
(
result
[
'simulationTime'
],
36.0
)
self
.
assertTrue
(
83.32
<
result
[
"working_ratio"
]
<
83.34
)
def
testSettingWip3
(
self
):
from
dream.simulation.Examples.SettingWip3
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
2
)
self
.
assertEquals
(
result
[
'simulationTime'
],
0.35
)
self
.
assertEquals
(
result
[
"working_ratio"
],
100
)
def
testNonStarvingLine
(
self
):
from
dream.simulation.Examples.NonStarvingLine
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'parts'
],
9
)
self
.
assertEquals
(
result
[
"working_ratio"
],
100
)
def
testNonStarvingLineBatches
(
self
):
from
dream.simulation.Examples.NonStarvingLineBatches
import
main
result
=
main
()
result
=
main
(
test
=
1
)
self
.
assertEquals
(
result
[
'batches'
],
4
)
self
.
assertEquals
(
result
[
"working_ratio"
],
100
)
\ 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