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
33ed93d2
Commit
33ed93d2
authored
Aug 07, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup in the method that calculates what is to be processed
parent
dca04b5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
41 deletions
+29
-41
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+29
-41
No files found.
dream/simulation/CapacityStationController.py
View file @
33ed93d2
...
...
@@ -189,48 +189,25 @@ class CapacityStationController(EventGenerator):
if
totalAvailableCapacity
<=
0
:
continue
# if the buffer is not assembly
if
not
buffer
.
requireFullProject
:
# calculate the total capacity that is requested
totalRequestedCapacity
=
0
for
entity
in
buffer
.
getActiveObjectQueue
():
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
)):
totalRequestedCapacity
+=
entity
.
requiredCapacity
# if there is enough capacity for all the entities set them that they all should move
if
totalRequestedCapacity
<=
totalAvailableCapacity
:
for
entity
in
buffer
.
getActiveObjectQueue
():
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
)):
entity
.
shouldMove
=
True
# else calculate the capacity for every entity and create the entities
else
:
entitiesInBuffer
=
list
(
buffer
.
getActiveObjectQueue
())
# loop through the entities
for
entity
in
entitiesInBuffer
:
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
self
.
breakEntity
(
entity
,
buffer
,
station
,
totalAvailableCapacity
,
totalRequestedCapacity
)
# if the buffer is assembly there are different calculations
else
:
# calculate the total capacity that is requested
# note that only the assembled projects do request capacity
totalRequestedCapacity
=
0
for
entity
in
buffer
.
getActiveObjectQueue
():
if
self
.
checkIfProjectAssembledInBuffer
(
entity
.
capacityProject
,
buffer
)
and
\
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
totalRequestedCapacity
+=
entity
.
requiredCapacity
# if there is enough capacity for all the assembled entities set them that they all should move
if
totalRequestedCapacity
<=
totalAvailableCapacity
:
for
entity
in
buffer
.
getActiveObjectQueue
():
if
self
.
checkIfProjectAssembledInBuffer
(
entity
.
capacityProject
,
buffer
)
and
\
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
entity
.
shouldMove
=
True
# else calculate the capacity for every entity and create the entities
else
:
entitiesInBuffer
=
list
(
buffer
.
getActiveObjectQueue
())
# loop through the entities
for
entity
in
entitiesInBuffer
:
# break only the assembled projects
if
self
.
checkIfProjectAssembledInBuffer
(
entity
.
capacityProject
,
buffer
)
and
\
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
buffer
)):
self
.
breakEntity
(
entity
,
buffer
,
station
,
totalAvailableCapacity
,
totalRequestedCapacity
)
# breaks an entity in the part that should move and the one that should stay
...
...
@@ -307,6 +284,17 @@ class CapacityStationController(EventGenerator):
return
False
return
True
# checks if a project cannot move because it needs to be assembled first
def
checkIfProjectNeedsToBeAssembled
(
self
,
project
,
buffer
):
# if we are not in assembly return false
if
not
buffer
.
requireFullProject
:
return
False
# if project is already assembled return false
if
self
.
checkIfProjectAssembledInBuffer
(
project
,
buffer
):
return
False
# at any other case return true
return
True
# checks if the given project is all in the buffer
def
checkIfProjectAssembledInBuffer
(
self
,
project
,
buffer
):
# loop through all the stations of the system
...
...
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