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
5daca64b
Commit
5daca64b
authored
Jun 22, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrections in CapacityStationController. Cleanup needed
parent
e62c5715
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
dream/simulation/applications/CapacityStations/CapacityStation.py
...mulation/applications/CapacityStations/CapacityStation.py
+3
-0
dream/simulation/applications/CapacityStations/CapacityStationController.py
...pplications/CapacityStations/CapacityStationController.py
+29
-7
No files found.
dream/simulation/applications/CapacityStations/CapacityStation.py
View file @
5daca64b
...
@@ -100,6 +100,9 @@ class CapacityStation(Queue):
...
@@ -100,6 +100,9 @@ class CapacityStation(Queue):
meanUtilization
=
0
meanUtilization
=
0
for
entry
in
self
.
utilisationDict
:
for
entry
in
self
.
utilisationDict
:
meanUtilization
+=
entry
[
'utilization'
]
/
float
(
len
(
self
.
utilisationDict
))
meanUtilization
+=
entry
[
'utilization'
]
/
float
(
len
(
self
.
utilisationDict
))
if
entry
[
'utilization'
]
>
1.0
:
print
'*************'
print
self
.
id
,
entry
[
'period'
],
entry
[
'utilization'
]
json
[
'results'
][
'meanUtilization'
]
=
meanUtilization
json
[
'results'
][
'meanUtilization'
]
=
meanUtilization
json
[
'results'
][
'detailedWorkPlan'
]
=
self
.
detailedWorkPlan
json
[
'results'
][
'detailedWorkPlan'
]
=
self
.
detailedWorkPlan
G
.
outputJSON
[
'elementList'
].
append
(
json
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
dream/simulation/applications/CapacityStations/CapacityStationController.py
View file @
5daca64b
...
@@ -230,12 +230,19 @@ class CapacityStationController(EventGenerator):
...
@@ -230,12 +230,19 @@ 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
self
.
env
.
now
==
21.0
:
if
buffer
.
id
==
'ASBTST_B'
:
pass
print
'FOUND'
pr
=
True
# 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
alreadyConsideredBuffers
.
append
(
buffer
)
alreadyConsideredBuffers
.
append
(
buffer
)
sharedBuffers
=
[]
sharedBuffers
=
[]
station
=
buffer
.
next
[
0
]
# get the station
station
=
buffer
.
next
[
0
]
# get the station
# find the stations that share resources with the one considered now
# find the stations that share resources with the one considered now
if
station
.
sharedResources
:
if
station
.
sharedResources
:
sharedStations
=
station
.
sharedResources
.
get
(
'stationIds'
,[])
sharedStations
=
station
.
sharedResources
.
get
(
'stationIds'
,[])
...
@@ -295,22 +302,32 @@ class CapacityStationController(EventGenerator):
...
@@ -295,22 +302,32 @@ class CapacityStationController(EventGenerator):
# 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
entityBuffer
=
entity
.
currentStation
entityBuffer
=
entity
.
currentStation
entityStation
=
entity
.
currentStation
.
next
[
0
]
entityStation
=
entity
.
currentStation
.
next
[
0
]
if
pr
:
print
'----->checking'
,
entity
.
capacityProject
.
id
print
self
.
checkIfThereIsEnoughSpace
(
entity
,
entityBuffer
,
consideredSpace
)
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
entityStation
)
and
\
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
entityStation
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
entityBuffer
))
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
entityBuffer
))
\
and
self
.
checkIfThereIsEnoughSpace
(
entity
,
entityBuffer
,
consideredSpace
):
and
self
.
checkIfThereIsEnoughSpace
(
entity
,
entityBuffer
,
consideredSpace
):
if
not
self
.
checkIfProjectConsumesAssemblySpace
(
entity
,
entityBuffer
):
consideredSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
consideredSpace
-=
entity
.
capacityProject
.
assemblySpaceRequirement
totalRequestedCapacity
+=
entity
.
requiredCapacity
totalRequestedCapacity
+=
entity
.
requiredCapacity
if
pr
:
print
totalRequestedCapacity
# 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
:
availableCapacity
=
float
(
totalAvailableCapacity
)
for
entity
in
entitiesWithinThreshold
:
for
entity
in
entitiesWithinThreshold
:
# 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
entityBuffer
=
entity
.
currentStation
entityBuffer
=
entity
.
currentStation
entityStation
=
entity
.
currentStation
.
next
[
0
]
entityStation
=
entity
.
currentStation
.
next
[
0
]
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
entityStation
)
and
\
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
entityStation
)
and
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
entityBuffer
))
\
(
not
self
.
checkIfProjectNeedsToBeAssembled
(
entity
.
capacityProject
,
entityBuffer
))
\
and
self
.
checkIfThereIsEnoughSpace
(
entity
,
entityBuffer
,
availableSpace
):
and
self
.
checkIfThereIsEnoughSpace
(
entity
,
entityBuffer
,
availableSpace
)
and
\
entity
.
requiredCapacity
<=
availableCapacity
:
entity
.
shouldMove
=
True
entity
.
shouldMove
=
True
availableCapacity
-=
entity
.
requiredCapacity
assert
availableCapacity
>=
0
,
'negative available capacity'
# 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
)):
...
@@ -380,9 +397,14 @@ class CapacityStationController(EventGenerator):
...
@@ -380,9 +397,14 @@ 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
pr
:
print
'breaking entity'
,
entity
.
capacityProject
.
id
print
totalAvailableCapacity
print
totalRequestedCapacity
print
entity
.
requiredCapacity
print
totalAvailableCapacity
*
(
entity
.
requiredCapacity
)
/
float
(
totalRequestedCapacity
)
if
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
...
...
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