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
c327ada6
Commit
c327ada6
authored
Jun 10, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jun 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CapacityProjects to output the start and finish time on each station
parent
b0be22a6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
dream/simulation/CapacityProject.py
dream/simulation/CapacityProject.py
+17
-0
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+15
-1
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+3
-0
No files found.
dream/simulation/CapacityProject.py
View file @
c327ada6
...
...
@@ -33,8 +33,25 @@ from Entity import Entity
# ===========================================================================
class
CapacityProject
(
Entity
):
type
=
"CapacityProject"
class_name
=
'Dream.CapacityProject'
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityRequirementDict
=
{}):
Entity
.
__init__
(
self
,
id
,
name
)
# a dict that shows the required capacity from every station
self
.
capacityRequirementDict
=
capacityRequirementDict
def
initialize
(
self
):
self
.
projectSchedule
=
[]
# a list of dicts to keep the schedule
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
from
Globals
import
G
json
=
{
'_class'
:
self
.
class_name
,
'id'
:
self
.
id
,
'results'
:
{}}
if
(
G
.
numberOfReplications
==
1
):
# if we had just one replication output the results as numbers
json
[
'results'
][
'schedule'
]
=
self
.
projectSchedule
G
.
outputJSON
[
'elementList'
].
append
(
json
)
dream/simulation/CapacityStationController.py
View file @
c327ada6
...
...
@@ -71,6 +71,10 @@ class CapacityStationController(EventGenerator):
yield
station
.
entityRemoved
exit
.
currentlyObtainedEntities
.
append
(
entity
)
station
.
entityRemoved
=
self
.
env
.
event
()
project
=
entity
.
capacityProject
for
entry
in
project
.
projectSchedule
:
if
entry
[
'station'
]
==
station
.
id
:
entry
[
'finish'
]
=
self
.
env
.
now
# lock the exit again
exit
.
isLocked
=
True
...
...
@@ -110,8 +114,11 @@ class CapacityStationController(EventGenerator):
# wait until the entity is removed
yield
buffer
.
entityRemoved
buffer
.
entityRemoved
=
self
.
env
.
event
()
periodDict
[
entity
.
capacityProject
.
id
]
=
entity
.
requiredCapacity
project
=
entity
.
capacityProject
periodDict
[
project
.
id
]
=
entity
.
requiredCapacity
capacityAllocated
+=
entity
.
requiredCapacity
if
self
.
checkIfProjectJustStartsInStation
(
project
,
station
):
project
.
projectSchedule
.
append
({
"station"
:
station
.
id
,
"start"
:
self
.
env
.
now
})
# lock the station
station
.
isLocked
=
True
periodDict
[
'utilization'
]
=
capacityAllocated
/
float
(
capacityAvailable
)
...
...
@@ -231,4 +238,11 @@ class CapacityStationController(EventGenerator):
if
len
(
object
.
getActiveObjectQueue
()):
return
False
return
True
# checks if a project is just starting in station
def
checkIfProjectJustStartsInStation
(
self
,
project
,
station
):
for
entry
in
project
.
projectSchedule
:
if
entry
[
'station'
]
==
station
.
id
:
return
False
return
True
\ No newline at end of file
dream/simulation/LineGenerationJSON.py
View file @
c327ada6
...
...
@@ -1415,6 +1415,9 @@ def main(argv=[], input_data=None):
for
job
in
G
.
JobList
:
job
.
outputResultsJSON
()
for
capacityProject
in
G
.
CapacityProjectList
:
capacityProject
.
outputResultsJSON
()
outputJSONString
=
json
.
dumps
(
G
.
outputJSON
,
indent
=
True
)
G
.
outputJSONFile
.
write
(
outputJSONString
)
...
...
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