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
Show 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):
...
@@ -222,6 +222,7 @@ class CapacityStationController(EventGenerator):
def
calculateWhatIsToBeProcessed
(
self
):
def
calculateWhatIsToBeProcessed
(
self
):
import
dream.simulation.Globals
as
Globals
import
dream.simulation.Globals
as
Globals
# calculate what space is available
# calculate what space is available
availableSpace
=
self
.
assemblySpace
-
self
.
calculateConsumedSpace
()
availableSpace
=
self
.
assemblySpace
-
self
.
calculateConsumedSpace
()
assert
availableSpace
>=
0
,
'negative available space'
assert
availableSpace
>=
0
,
'negative available space'
...
@@ -230,7 +231,6 @@ class CapacityStationController(EventGenerator):
...
@@ -230,7 +231,6 @@ class CapacityStationController(EventGenerator):
# loop through the capacity station buffers
# loop through the capacity station buffers
for
buffer
in
G
.
CapacityStationBufferList
:
for
buffer
in
G
.
CapacityStationBufferList
:
pr
=
False
# if the buffer was considered before (due to shared resources) continue
# if the buffer was considered before (due to shared resources) continue
if
buffer
in
alreadyConsideredBuffers
:
if
buffer
in
alreadyConsideredBuffers
:
continue
continue
...
@@ -258,7 +258,6 @@ class CapacityStationController(EventGenerator):
...
@@ -258,7 +258,6 @@ class CapacityStationController(EventGenerator):
totalAvailableCapacity
=
station
.
remainingIntervalCapacity
[
0
]
# get the available capacity of the station
totalAvailableCapacity
=
station
.
remainingIntervalCapacity
[
0
]
# get the available capacity of the station
# for this interval
# for this interval
# list to keep entities that have not been already allocated
# list to keep entities that have not been already allocated
entitiesNotAllocated
=
list
(
entitiesConsidered
)
entitiesNotAllocated
=
list
(
entitiesConsidered
)
allCapacityConsumed
=
False
allCapacityConsumed
=
False
...
@@ -360,12 +359,24 @@ class CapacityStationController(EventGenerator):
...
@@ -360,12 +359,24 @@ class CapacityStationController(EventGenerator):
else
:
else
:
allCapacityConsumed
=
True
allCapacityConsumed
=
True
entitiesToBeBroken
=
list
(
entitiesWithinThreshold
)
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
\
entitiesToBeBroken
.
sort
(
key
=
lambda
\
x
:
self
.
checkIfAProjectCanBeFinishedInStation
(
x
,
x
.
currentStation
.
next
[
0
],
x
:
x
.
willFinishNow
and
self
.
prioritizeIfCanFinish
,
reverse
=
True
)
totalAvailableCapacity
)
\
and
self
.
prioritizeIfCanFinish
,
reverse
=
True
)
# loop through the entities
# 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
# get buffer where the entity is and the station it requests to get in
...
@@ -388,6 +399,7 @@ class CapacityStationController(EventGenerator):
...
@@ -388,6 +399,7 @@ class CapacityStationController(EventGenerator):
# update the values
# update the values
totalAvailableCapacity
-=
entity
.
requiredCapacity
totalAvailableCapacity
-=
entity
.
requiredCapacity
totalRequestedCapacity
-=
entity
.
requiredCapacity
totalRequestedCapacity
-=
entity
.
requiredCapacity
# else break the entity according to rule
# else break the entity according to rule
else
:
else
:
if
self
.
breakEntity
(
entity
,
entityBuffer
,
entityStation
,
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