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
03f872ba
Commit
03f872ba
authored
Aug 08, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CapacityStationController does not start the assembly of a project if there is not enough space
parent
274f5afd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+28
-4
No files found.
dream/simulation/CapacityStationController.py
View file @
03f872ba
...
@@ -208,6 +208,7 @@ class CapacityStationController(EventGenerator):
...
@@ -208,6 +208,7 @@ class CapacityStationController(EventGenerator):
exit
.
currentlyObtainedEntities
=
[]
exit
.
currentlyObtainedEntities
=
[]
def
calculateWhatIsToBeProcessed
(
self
):
def
calculateWhatIsToBeProcessed
(
self
):
availableSpace
=
self
.
assemblySpace
# loop through the capacity station buffers
# loop through the capacity station buffers
for
buffer
in
G
.
CapacityStationBufferList
:
for
buffer
in
G
.
CapacityStationBufferList
:
activeObjectQueue
=
buffer
.
getActiveObjectQueue
()
activeObjectQueue
=
buffer
.
getActiveObjectQueue
()
...
@@ -245,15 +246,20 @@ class CapacityStationController(EventGenerator):
...
@@ -245,15 +246,20 @@ class CapacityStationController(EventGenerator):
totalRequestedCapacity
=
0
totalRequestedCapacity
=
0
for
entity
in
entitiesWithinThreshold
:
for
entity
in
entitiesWithinThreshold
:
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
)):
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
))
and
\
self
.
checkIfThereIsEnoughSpace
(
entity
,
buffer
,
availableSpace
):
totalRequestedCapacity
+=
entity
.
requiredCapacity
totalRequestedCapacity
+=
entity
.
requiredCapacity
# if there is enough capacity for all the entities set them that they all should move
# if there is enough capacity for all the entities set them that they all should move
if
totalRequestedCapacity
<=
totalAvailableCapacity
:
if
totalRequestedCapacity
<=
totalAvailableCapacity
:
for
entity
in
entitiesWithinThreshold
:
for
entity
in
entitiesWithinThreshold
:
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
)):
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
))
and
\
self
.
checkIfThereIsEnoughSpace
(
entity
,
buffer
,
availableSpace
):
entity
.
shouldMove
=
True
entity
.
shouldMove
=
True
# reduce the available space if there is need to
if
buffer
.
requireFullProject
:
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
# remove the entity from the none allocated ones
# remove the entity from the none allocated ones
entitiesNotAllocated
.
remove
(
entity
)
entitiesNotAllocated
.
remove
(
entity
)
# check if all the capacity is consumed to update the flag and break the loop
# check if all the capacity is consumed to update the flag and break the loop
...
@@ -267,7 +273,8 @@ class CapacityStationController(EventGenerator):
...
@@ -267,7 +273,8 @@ class CapacityStationController(EventGenerator):
haveMoreEntitiesToAllocate
=
False
haveMoreEntitiesToAllocate
=
False
for
entity
in
entitiesOutsideThreshold
:
for
entity
in
entitiesOutsideThreshold
:
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
)):
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
))
and
\
self
.
checkIfThereIsEnoughSpace
(
entity
,
buffer
,
availableSpace
):
haveMoreEntitiesToAllocate
=
True
haveMoreEntitiesToAllocate
=
True
break
break
...
@@ -293,12 +300,19 @@ class CapacityStationController(EventGenerator):
...
@@ -293,12 +300,19 @@ class CapacityStationController(EventGenerator):
and
self
.
prioritizeIfCanFinish
:
and
self
.
prioritizeIfCanFinish
:
# set that the entity can move
# set that the entity can move
entity
.
shouldMove
=
True
entity
.
shouldMove
=
True
# reduce the available space if there is need to
if
buffer
.
requireFullProject
:
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
# 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
:
self
.
breakEntity
(
entity
,
buffer
,
station
,
totalAvailableCapacity
,
totalRequestedCapacity
)
self
.
breakEntity
(
entity
,
buffer
,
station
,
totalAvailableCapacity
,
totalRequestedCapacity
)
# reduce the available space if there is need to
if
buffer
.
requireFullProject
:
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
# the capacity will be 0 since we consumed it all
# the capacity will be 0 since we consumed it all
totalAvailableCapacity
=
0
totalAvailableCapacity
=
0
# if the station shares capacity with other stations then we have to
# if the station shares capacity with other stations then we have to
...
@@ -432,6 +446,16 @@ class CapacityStationController(EventGenerator):
...
@@ -432,6 +446,16 @@ class CapacityStationController(EventGenerator):
return
True
return
True
return
False
return
False
# returns true if there is enough space for the entity to move
def
checkIfThereIsEnoughSpace
(
self
,
entity
,
buffer
,
availableSpace
):
if
buffer
.
requireFullProject
:
return
entity
.
capacityProject
.
assemblySpaceRequirement
<=
availableSpace
return
True
def
checkIfEntityCanMove
(
self
):
pass
# sorts the buffers so if they have shared resources the ones with highest priority will go in front
# sorts the buffers so if they have shared resources the ones with highest priority will go in front
def
sortBuffers
(
self
):
def
sortBuffers
(
self
):
for
buffer
in
G
.
CapacityStationBufferList
:
for
buffer
in
G
.
CapacityStationBufferList
:
...
...
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