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
236e141f
Commit
236e141f
authored
Oct 24, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
in-line comments added to Job.py
parent
5e38cf4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
dream/simulation/Job.py
dream/simulation/Job.py
+21
-14
No files found.
dream/simulation/Job.py
View file @
236e141f
...
...
@@ -29,37 +29,44 @@ in the system and also in the processing times at each station
from
Globals
import
G
from
Entity
import
Entity
#
The part object
class
Job
(
Entity
):
#
============================ The part object ==============================
class
Job
(
Entity
):
# inherits from the Entity class
type
=
"Job"
def
__init__
(
self
,
id
,
name
,
route
=
[],
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
):
Entity
.
__init__
(
self
,
name
,
priority
=
priority
,
dueDate
=
dueDate
,
orderDate
=
orderDate
)
self
.
id
=
id
self
.
route
=
route
#the route that the job follows, also contains the processing times in each station
self
.
remainingRoute
=
route
#the remaining route. in the beginning this should be the same as the full route
self
.
schedule
=
[]
#keeps the result of the simulation. A list with the stations and time of entrance
# instance specific attributes
self
.
id
=
id
# id
# information on the routing and the stops of the entity
self
.
route
=
route
# the route that the job follows,
# also contains the processing times in each station
self
.
remainingRoute
=
route
# the remaining route. in the beginning
# this should be the same as the full route
# the scheduling of the entity as resolved by the simulation
self
.
schedule
=
[]
# keeps the result of the simulation.
# A list with the stations and time of entrance
#
outputs results to JSON File
#
==================== outputs results to JSON File ======================
def
outputResultsJSON
(
self
):
from
Globals
import
G
if
(
G
.
numberOfReplications
==
1
):
#if we had just one replication output the results to excel
json
=
{}
if
(
G
.
numberOfReplications
==
1
):
#if we had just one replication output the results to excel
json
=
{}
# dictionary holding information related to the specific entity
json
[
'_class'
]
=
'Dream.Job'
;
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'results'
]
=
{}
json
[
'results'
][
'schedule'
]
=
{}
i
=
0
for
record
in
self
.
schedule
:
json
[
'results'
][
'schedule'
][
str
(
i
)]
=
{}
json
[
'results'
][
'schedule'
][
str
(
i
)][
'stationId'
]
=
record
[
0
]
json
[
'results'
][
'schedule'
][
str
(
i
)][
'entranceTime'
]
=
record
[
1
]
json
[
'results'
][
'schedule'
][
str
(
i
)]
=
{}
# dictionary holding time and
json
[
'results'
][
'schedule'
][
str
(
i
)][
'stationId'
]
=
record
[
0
]
# id of the Object
json
[
'results'
][
'schedule'
][
str
(
i
)][
'entranceTime'
]
=
record
[
1
]
# time entering the Object
i
+=
1
G
.
outputJSON
[
'elementList'
].
append
(
json
)
#
initializes all the Entity for a new simulation replication
#
==== initializes all the Entity for a new simulation replication ======
def
initialize
(
self
):
# has to be re-initialized each time a new Job is added
self
.
remainingRoute
=
self
.
route
self
.
currentStation
=
self
.
route
[
0
][
0
]
self
.
currentStation
=
self
.
route
[
0
][
0
]
\ 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