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
313880c9
Commit
313880c9
authored
Aug 19, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug in CapacityStationController fixed
parent
0f674ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
dream/simulation/applications/CapacityStations/CapacityStationController.py
...pplications/CapacityStations/CapacityStationController.py
+21
-9
No files found.
dream/simulation/applications/CapacityStations/CapacityStationController.py
View file @
313880c9
...
...
@@ -222,6 +222,7 @@ class CapacityStationController(EventGenerator):
def
calculateWhatIsToBeProcessed
(
self
):
import
dream.simulation.Globals
as
Globals
# calculate what space is available
availableSpace
=
self
.
assemblySpace
-
self
.
calculateConsumedSpace
()
assert
availableSpace
>=
0
,
'negative available space'
...
...
@@ -230,7 +231,6 @@ class CapacityStationController(EventGenerator):
# loop through the capacity station buffers
for
buffer
in
G
.
CapacityStationBufferList
:
pr
=
False
# if the buffer was considered before (due to shared resources) continue
if
buffer
in
alreadyConsideredBuffers
:
continue
...
...
@@ -258,7 +258,6 @@ class CapacityStationController(EventGenerator):
totalAvailableCapacity
=
station
.
remainingIntervalCapacity
[
0
]
# get the available capacity of the station
# for this interval
# list to keep entities that have not been already allocated
entitiesNotAllocated
=
list
(
entitiesConsidered
)
allCapacityConsumed
=
False
...
...
@@ -304,7 +303,7 @@ class CapacityStationController(EventGenerator):
if
not
self
.
checkIfProjectConsumesAssemblySpace
(
entity
,
entityBuffer
):
consideredSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
totalRequestedCapacity
+=
entity
.
requiredCapacity
# if there is enough capacity for all the entities set them that they all should move
if
totalRequestedCapacity
<=
totalAvailableCapacity
:
availableCapacity
=
float
(
totalAvailableCapacity
)
...
...
@@ -360,14 +359,26 @@ class CapacityStationController(EventGenerator):
else
:
allCapacityConsumed
=
True
entitiesToBeBroken
=
list
(
entitiesWithinThreshold
)
# we sort the entities so the ones that can finish in current period (if any) go in front
leftCapacity
=
totalAvailableCapacity
leftSpace
=
availableSpace
# with the below we calculate the projects that can finish in the current period
# and sort the entities so the ones that can finish in current period (if any) go in front
for
e
in
entitiesToBeBroken
:
e
.
willFinishNow
=
False
if
self
.
checkIfAProjectCanBeFinishedInStation
(
e
,
e
.
currentStation
.
next
[
0
],
leftCapacity
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
e
.
capacityProject
,
e
.
currentStation
))
and
\
self
.
checkIfProjectCanStartInStation
(
e
.
capacityProject
,
e
.
currentStation
.
next
[
0
])
and
\
self
.
checkIfThereIsEnoughSpace
(
entity
,
entityBuffer
,
leftSpace
):
leftCapacity
-=
e
.
requiredCapacity
if
e
.
currentStation
.
requireFullProject
and
\
(
not
self
.
checkIfProjectConsumesAssemblySpace
(
e
,
e
.
currentStation
)):
leftSpace
-=
e
.
capacityProject
.
assemblySpaceRequirement
e
.
willFinishNow
=
True
entitiesToBeBroken
.
sort
(
key
=
lambda
\
x
:
self
.
checkIfAProjectCanBeFinishedInStation
(
x
,
x
.
currentStation
.
next
[
0
],
totalAvailableCapacity
)
\
and
self
.
prioritizeIfCanFinish
,
reverse
=
True
)
x
:
x
.
willFinishNow
and
self
.
prioritizeIfCanFinish
,
reverse
=
True
)
# loop through the entities
for
entity
in
entitiesToBeBroken
:
for
entity
in
entitiesToBeBroken
:
# get buffer where the entity is and the station it requests to get in
entityBuffer
=
entity
.
currentStation
entityStation
=
entity
.
currentStation
.
next
[
0
]
...
...
@@ -388,6 +399,7 @@ class CapacityStationController(EventGenerator):
# update the values
totalAvailableCapacity
-=
entity
.
requiredCapacity
totalRequestedCapacity
-=
entity
.
requiredCapacity
# else break the entity according to rule
else
:
if
self
.
breakEntity
(
entity
,
entityBuffer
,
entityStation
,
...
...
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