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
1265cd86
Commit
1265cd86
authored
Aug 15, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4 examples with shifts added
parent
7656279a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
166 additions
and
11 deletions
+166
-11
dream/simulation/Examples/ServerWithShift1.py
dream/simulation/Examples/ServerWithShift1.py
+5
-11
dream/simulation/Examples/ServerWithShift2.py
dream/simulation/Examples/ServerWithShift2.py
+59
-0
dream/simulation/Examples/ServerWithShift3.py
dream/simulation/Examples/ServerWithShift3.py
+51
-0
dream/simulation/Examples/ServerWithShift4.py
dream/simulation/Examples/ServerWithShift4.py
+51
-0
No files found.
dream/simulation/Examples/ServerWithShift1.py
View file @
1265cd86
...
...
@@ -6,7 +6,7 @@ G.env=simpy.Environment() # define a simpy environment
#define the objects of the model
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
M
=
Machine
(
'M1'
,
'Machine'
,
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
})
M
=
Machine
(
'M1'
,
'Machine'
,
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
3
})
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M
,
E
]
#add all the objects in a list so that they can be easier accessed later
...
...
@@ -23,18 +23,12 @@ E.defineRouting(predecessorList=[M])
def
main
():
#initialize all the objects
for
object
in
G
.
ObjList
:
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
object
.
initialize
()
for
objectInterruption
in
G
.
ObjectInterruptionList
:
objectInterruption
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
:
G
.
env
.
process
(
object
.
run
())
for
objectInterruption
in
G
.
ObjectInterruptionList
:
G
.
env
.
process
(
objectInterruption
.
run
())
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
G
.
env
.
process
(
object
.
run
())
G
.
maxSimTime
=
20
#set G.maxSimTime 1440.0 minutes (1 day)
...
...
dream/simulation/Examples/ServerWithShift2.py
0 → 100644
View file @
1265cd86
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
G
,
ShiftScheduler
from
dream.simulation.imports
import
simpy
G
.
env
=
simpy
.
Environment
()
# define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
M
=
Machine
(
'M1'
,
'Machine'
,
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
3
})
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M
,
E
]
#add all the objects in a list so that they can be easier accessed later
# create a repeated shift pattern
shiftPattern
=
[]
i
=
0
while
i
<
100
:
shiftPattern
.
append
([
i
,
i
+
5
])
i
+=
10
print
shiftPattern
#create the shift
SS
=
ShiftScheduler
(
victim
=
M
,
shiftPattern
=
shiftPattern
)
G
.
ObjectInterruptionList
=
[
SS
]
#add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
(
successorList
=
[
M
])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
#initialize all the objects
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
object
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
G
.
env
.
process
(
object
.
run
())
G
.
maxSimTime
=
100
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
env
.
run
(
G
.
maxSimTime
)
#run the simulation
#carry on the post processing operations for every object in the topology
for
object
in
G
.
ObjList
:
object
.
postProcessing
()
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
G
.
maxSimTime
)
*
100
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
0 → 100644
View file @
1265cd86
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
G
,
ShiftScheduler
from
dream.simulation.imports
import
simpy
G
.
env
=
simpy
.
Environment
()
# define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
M
=
Machine
(
'M1'
,
'Machine'
,
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
3
})
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M
,
E
]
#add all the objects in a list so that they can be easier accessed later
#create the shift
SS
=
ShiftScheduler
(
victim
=
M
,
shiftPattern
=
[[
0
,
5
],[
10
,
15
]],
endUnfinished
=
True
)
G
.
ObjectInterruptionList
=
[
SS
]
#add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
(
successorList
=
[
M
])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
#initialize all the objects
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
object
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
G
.
env
.
process
(
object
.
run
())
G
.
maxSimTime
=
20
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
env
.
run
(
G
.
maxSimTime
)
#run the simulation
#carry on the post processing operations for every object in the topology
for
object
in
G
.
ObjList
:
object
.
postProcessing
()
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
G
.
maxSimTime
)
*
100
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
0 → 100644
View file @
1265cd86
from
dream.simulation.imports
import
Machine
,
Source
,
Exit
,
Part
,
G
,
ShiftScheduler
from
dream.simulation.imports
import
simpy
G
.
env
=
simpy
.
Environment
()
# define a simpy environment
# this is where all the simulation object 'live'
#define the objects of the model
S
=
Source
(
'S1'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
M
=
Machine
(
'M1'
,
'Machine'
,
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
3
})
E
=
Exit
(
'E1'
,
'Exit'
)
G
.
ObjList
=
[
S
,
M
,
E
]
#add all the objects in a list so that they can be easier accessed later
#create the shift
SS
=
ShiftScheduler
(
victim
=
M
,
shiftPattern
=
[[
0
,
5
],[
10
,
15
]],
receiveBeforeEndThreshold
=
3
)
G
.
ObjectInterruptionList
=
[
SS
]
#add all the interruptions in a list so that they can be easier accessed later
#define predecessors and successors for the objects
S
.
defineRouting
(
successorList
=
[
M
])
M
.
defineRouting
(
predecessorList
=
[
S
],
successorList
=
[
E
])
E
.
defineRouting
(
predecessorList
=
[
M
])
def
main
():
#initialize all the objects
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
object
.
initialize
()
#activate all the objects
for
object
in
G
.
ObjList
+
G
.
ObjectInterruptionList
:
G
.
env
.
process
(
object
.
run
())
G
.
maxSimTime
=
20
#set G.maxSimTime 1440.0 minutes (1 day)
G
.
env
.
run
(
G
.
maxSimTime
)
#run the simulation
#carry on the post processing operations for every object in the topology
for
object
in
G
.
ObjList
:
object
.
postProcessing
()
#print the results
print
"the system produced"
,
E
.
numOfExits
,
"parts"
working_ratio
=
(
M
.
totalWorkingTime
/
G
.
maxSimTime
)
*
100
off_shift_ratio
=
(
M
.
totalOffShiftTime
/
G
.
maxSimTime
)
*
100
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
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