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
c1121f3d
Commit
c1121f3d
authored
Nov 07, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrections in CapacityStationController
parent
3f478bc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
22 deletions
+27
-22
dream/simulation/applications/CapacityStations/CapacityStationController.py
...pplications/CapacityStations/CapacityStationController.py
+27
-22
No files found.
dream/simulation/applications/CapacityStations/CapacityStationController.py
View file @
c1121f3d
...
@@ -309,8 +309,8 @@ class CapacityStationController(EventGenerator):
...
@@ -309,8 +309,8 @@ class CapacityStationController(EventGenerator):
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
assert
availableSpace
>=
0
,
'negative available space'
assert
availableSpace
>=
0
,
'negative available space'
# 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
if
totalRequestedCapacity
==
totalAvailableCapacity
:
if
totalRequestedCapacity
==
totalAvailableCapacity
:
# the capacity will be 0 since we consumed it all
# the capacity will be 0 since we consumed it all
...
@@ -373,32 +373,37 @@ class CapacityStationController(EventGenerator):
...
@@ -373,32 +373,37 @@ class CapacityStationController(EventGenerator):
# else break the entity according to rule
# else break the entity according to rule
else
:
else
:
self
.
breakEntity
(
entity
,
entityBuffer
,
entityStation
,
if
self
.
breakEntity
(
entity
,
entityBuffer
,
entityStation
,
totalAvailableCapacity
,
totalRequestedCapacity
)
totalAvailableCapacity
,
totalRequestedCapacity
)
:
# reduce the available space if there is need to
# reduce the available space if there is need to
if
entityBuffer
.
requireFullProject
and
\
if
entityBuffer
.
requireFullProject
and
\
(
not
self
.
checkIfProjectConsumesAssemblySpace
(
entity
,
entityBuffer
)):
(
not
self
.
checkIfProjectConsumesAssemblySpace
(
entity
,
entityBuffer
)):
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
availableSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
assert
availableSpace
>=
0
,
'negative available space'
assert
availableSpace
>=
0
,
'negative available space'
# breaks an entity in the part that should move and the one that should stay
# breaks an entity in the part that should move and the one that should stay
def
breakEntity
(
self
,
entity
,
buffer
,
station
,
totalAvailableCapacity
,
totalRequestedCapacity
):
def
breakEntity
(
self
,
entity
,
buffer
,
station
,
totalAvailableCapacity
,
totalRequestedCapacity
):
# calculate what is the capacity that should proceed and what that should remain
# calculate what is the capacity that should proceed and what that should remain
capacityToMove
=
totalAvailableCapacity
*
(
entity
.
requiredCapacity
)
/
float
(
totalRequestedCapacity
)
capacityToMove
=
totalAvailableCapacity
*
(
entity
.
requiredCapacity
)
/
float
(
totalRequestedCapacity
)
capacityToStay
=
entity
.
requiredCapacity
-
capacityToMove
capacityToStay
=
entity
.
requiredCapacity
-
capacityToMove
# remove the capacity entity by the buffer so that the broken ones are created
# if capacityToMove is equal to 0 no need to break. Return false.
buffer
.
getActiveObjectQueue
().
remove
(
entity
)
if
capacityToMove
==
0
:
entityToMoveName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToMove
)
return
False
entityToMove
=
CapacityEntity
(
name
=
entityToMoveName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToMove
)
else
:
entityToMove
.
initialize
()
# remove the capacity entity by the buffer so that the broken ones are created
entityToMove
.
currentStation
=
buffer
buffer
.
getActiveObjectQueue
().
remove
(
entity
)
entityToMove
.
shouldMove
=
True
entityToMoveName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToMove
)
entityToStayName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToStay
)
entityToMove
=
CapacityEntity
(
name
=
entityToMoveName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToMove
)
entityToStay
=
CapacityEntity
(
name
=
entityToStayName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToStay
)
entityToMove
.
initialize
()
entityToStay
.
initialize
()
entityToMove
.
currentStation
=
buffer
entityToStay
.
currentStation
=
buffer
entityToMove
.
shouldMove
=
True
import
dream.simulation.Globals
as
Globals
entityToStayName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToStay
)
Globals
.
setWIP
([
entityToMove
,
entityToStay
])
#set the new components as wip
entityToStay
=
CapacityEntity
(
name
=
entityToStayName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToStay
)
entityToStay
.
initialize
()
entityToStay
.
currentStation
=
buffer
import
dream.simulation.Globals
as
Globals
Globals
.
setWIP
([
entityToMove
,
entityToStay
])
#set the new components as wip
return
True
# merges the capacity entities if they belong to the same project
# merges the capacity entities if they belong to the same project
def
mergeEntities
(
self
):
def
mergeEntities
(
self
):
...
...
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