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
3ae61b98
Commit
3ae61b98
authored
Nov 04, 2013
by
Georgios Dagkakis
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JobSope1Trace.py added to the examples so that it can be added in the documentation - to do
parent
e968c6d1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
5 deletions
+97
-5
dream/simulation/Examples/JobShop1Trace.py
dream/simulation/Examples/JobShop1Trace.py
+64
-0
dream/simulation/ExcelHandler.py
dream/simulation/ExcelHandler.py
+30
-2
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+1
-1
dream/simulation/imports.py
dream/simulation/imports.py
+2
-2
No files found.
dream/simulation/Examples/JobShop1Trace.py
0 → 100644
View file @
3ae61b98
from
SimPy.Simulation
import
simulate
,
activate
,
initialize
,
infinity
,
now
from
simulation.MachineJobShop
import
MachineJobShop
from
simulation.QueueJobShop
import
QueueJobShop
from
simulation.ExitJobShop
import
ExitJobShop
from
simulation.Job
import
Job
from
simulation.Globals
import
G
import
simulation.ExcelHandler
G
.
trace
=
"Yes"
#define the objects of the model
Q1
=
QueueJobShop
(
'Q1'
,
'Queue1'
,
capacity
=
infinity
)
Q2
=
QueueJobShop
(
'Q2'
,
'Queue2'
,
capacity
=
infinity
)
Q3
=
QueueJobShop
(
'Q3'
,
'Queue3'
,
capacity
=
infinity
)
M1
=
MachineJobShop
(
'M1'
,
'Machine1'
)
M2
=
MachineJobShop
(
'M2'
,
'Machine2'
)
M3
=
MachineJobShop
(
'M3'
,
'Machine3'
)
E
=
ExitJobShop
(
'E'
,
'Exit'
)
G
.
ObjList
=
[
M1
,
M2
,
M3
,
Q1
,
Q2
,
Q3
,
E
]
#add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
Q1
.
defineRouting
(
successorList
=
[
M1
])
Q2
.
defineRouting
(
successorList
=
[
M2
])
Q3
.
defineRouting
(
successorList
=
[
M3
])
M1
.
defineRouting
(
predecessorList
=
[
Q1
])
M2
.
defineRouting
(
predecessorList
=
[
Q2
])
M3
.
defineRouting
(
predecessorList
=
[
Q3
])
#define the Jobs
J
=
Job
(
'J1'
,
'Job1'
,
route
=
[[
'Q1'
,
1
],[
'Q3'
,
3
],[
'Q2'
,
2
],[
'E'
,
0
]])
initialize
()
#initialize the simulation (SimPy method)
#initialize all the objects
for
object
in
G
.
ObjList
:
object
.
initialize
()
J
.
initialize
()
#set the WIP
Q1
.
getActiveObjectQueue
().
append
(
J
)
#place the Job at 'Q1'
J
.
remainingRoute
[
0
][
0
]
=
''
#remove data from the remaining route since it is already added in Q1.
#this is to make sure that the Job will not get again into Queue1 while it waits in Queue1
J
.
schedule
.
append
([
'Q1'
,
now
()])
#add the data in the schedule that the Job entered Q1 at time=0
#activate all the objects
for
object
in
G
.
ObjList
:
activate
(
object
,
object
.
run
())
simulate
(
until
=
infinity
)
#run the simulation until there are no more events
G
.
maxSimTime
=
E
.
timeLastEntityLeft
#calculate the maxSimTime as the time that the last Job left
#loop in the schedule to print the results
for
record
in
J
.
schedule
:
#schedule holds ids of objects. The following loop will identify the name of the CoreObject with the given id
name
=
None
for
obj
in
G
.
ObjList
:
if
obj
.
id
==
record
[
0
]:
name
=
obj
.
objName
print
J
.
name
,
"got into"
,
name
,
"at"
,
record
[
1
]
simulation
.
ExcelHandler
.
outputTrace
(
'TRACE'
)
dream/simulation/ExcelHandler.py
View file @
3ae61b98
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 4 Nov 2013
@author: George
'''
'''
auxiliary script to handle excel related methods
'''
from
Globals
import
G
import
xlwt
import
xlrd
def
outputTrace
(
fileN
umber
=
1
):
G
.
traceFile
.
save
(
'trace'
+
str
(
fileNumber
)
+
'.xls'
)
def
outputTrace
(
fileN
ame
=
'Trace'
):
G
.
traceFile
.
save
(
str
(
fileName
)
+
'.xls'
)
G
.
traceIndex
=
0
#index that shows in what row we are
G
.
sheetIndex
=
1
#index that shows in what sheet we are
G
.
traceFile
=
xlwt
.
Workbook
()
#create excel file
...
...
dream/simulation/LineGenerationJSON.py
View file @
3ae61b98
...
...
@@ -556,7 +556,7 @@ def main(argv=[], input_data=None):
#output trace to excel
if
(
G
.
trace
==
"Yes"
):
ExcelHandler
.
outputTrace
(
i
)
ExcelHandler
.
outputTrace
(
'trace'
+
str
(
i
)
)
G
.
outputJSONFile
=
open
(
'outputJSON.json'
,
mode
=
'w'
)
G
.
outputJSON
[
'_class'
]
=
'Dream.Simulation'
;
...
...
dream/simulation/imports.py
View file @
3ae61b98
...
...
@@ -17,7 +17,7 @@
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on
8 Nov 2012
Created on
23 Oct 2013
@author: George and Dipo
'''
...
...
@@ -63,7 +63,7 @@ from simulation.Failure import Failure
#Auxiliary
from
simulation.Globals
import
G
from
simulation.RandomNumberGenerator
import
RandomNumberGenerator
import
ExcelHandler
...
...
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