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
c8111a5d
Commit
c8111a5d
authored
Aug 06, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
earliest start logic incorporated in CapacityStations first implementation
parent
75678d6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
21 deletions
+34
-21
dream/simulation/CapacityProject.py
dream/simulation/CapacityProject.py
+3
-1
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+29
-19
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+2
-1
No files found.
dream/simulation/CapacityProject.py
View file @
c8111a5d
...
...
@@ -34,10 +34,12 @@ from Entity import Entity
class
CapacityProject
(
Entity
):
type
=
"CapacityProject"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityRequirementDict
=
{}):
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityRequirementDict
=
{}
,
earliestStartDict
=
{}
):
Entity
.
__init__
(
self
,
id
,
name
)
# a dict that shows the required capacity from every station
self
.
capacityRequirementDict
=
capacityRequirementDict
# a dict that shows the earliest start in every station
self
.
earliestStartDict
=
earliestStartDict
def
initialize
(
self
):
self
.
projectSchedule
=
[]
# a list of dicts to keep the schedule
...
...
dream/simulation/CapacityStationController.py
View file @
c8111a5d
...
...
@@ -193,32 +193,35 @@ class CapacityStationController(EventGenerator):
# calculate the total capacity that is requested
totalRequestedCapacity
=
0
for
entity
in
buffer
.
getActiveObjectQueue
():
totalRequestedCapacity
+=
entity
.
requiredCapacity
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
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
():
entity
.
shouldMove
=
True
if
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
:
# calculate what is the capacity that should proceed and what that should remain
capacityToMove
=
totalAvailableCapacity
*
(
entity
.
requiredCapacity
)
/
float
(
totalRequestedCapacity
)
capacityToStay
=
entity
.
requiredCapacity
-
capacityToMove
# remove the capacity entity by the buffer so that the broken ones are created
buffer
.
getActiveObjectQueue
().
remove
(
entity
)
entityToMoveName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToMove
)
entityToMove
=
CapacityEntity
(
name
=
entityToMoveName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToMove
)
entityToMove
.
initialize
()
entityToMove
.
currentStation
=
buffer
entityToMove
.
shouldMove
=
True
entityToStayName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToStay
)
entityToStay
=
CapacityEntity
(
name
=
entityToStayName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToStay
)
entityToStay
.
initialize
()
entityToStay
.
currentStation
=
buffer
import
Globals
Globals
.
setWIP
([
entityToMove
,
entityToStay
])
#set the new components as wip
if
self
.
checkIfProjectCanStartInStation
(
entity
.
capacityProject
,
station
):
# calculate what is the capacity that should proceed and what that should remain
capacityToMove
=
totalAvailableCapacity
*
(
entity
.
requiredCapacity
)
/
float
(
totalRequestedCapacity
)
capacityToStay
=
entity
.
requiredCapacity
-
capacityToMove
# remove the capacity entity by the buffer so that the broken ones are created
buffer
.
getActiveObjectQueue
().
remove
(
entity
)
entityToMoveName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToMove
)
entityToMove
=
CapacityEntity
(
name
=
entityToMoveName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToMove
)
entityToMove
.
initialize
()
entityToMove
.
currentStation
=
buffer
entityToMove
.
shouldMove
=
True
entityToStayName
=
entity
.
capacityProjectId
+
'_'
+
station
.
objName
+
'_'
+
str
(
capacityToStay
)
entityToStay
=
CapacityEntity
(
name
=
entityToStayName
,
capacityProjectId
=
entity
.
capacityProjectId
,
requiredCapacity
=
capacityToStay
)
entityToStay
.
initialize
()
entityToStay
.
currentStation
=
buffer
import
Globals
Globals
.
setWIP
([
entityToMove
,
entityToStay
])
#set the new components as wip
# if the buffer is assembly there are different calculations
else
:
# calculate the total capacity that is requested
...
...
@@ -324,5 +327,12 @@ class CapacityStationController(EventGenerator):
return
False
# if nothing was found return true
return
True
# checks if the given project can start in the station or not because there is an earliest start defined
def
checkIfProjectCanStartInStation
(
self
,
project
,
station
):
earliestStartInStation
=
project
.
earliestStartDict
.
get
(
station
.
id
,
0
)
if
self
.
env
.
now
<
earliestStartInStation
:
return
False
return
True
\ No newline at end of file
dream/simulation/LineGenerationJSON.py
View file @
c8111a5d
...
...
@@ -1262,7 +1262,8 @@ def createWIP():
id
=
entity
.
get
(
'id'
,
'not found'
)
name
=
entity
.
get
(
'name'
,
'not found'
)
capacityRequirementDict
=
entity
.
get
(
'capacityRequirementDict'
,
{})
CP
=
CapacityProject
(
id
=
id
,
name
=
name
,
capacityRequirementDict
=
capacityRequirementDict
)
earliestStartDict
=
entity
.
get
(
'earliestStartDict'
,
{})
CP
=
CapacityProject
(
id
=
id
,
name
=
name
,
capacityRequirementDict
=
capacityRequirementDict
,
earliestStartDict
=
earliestStartDict
)
G
.
EntityList
.
append
(
CP
)
G
.
CapacityProjectList
.
append
(
CP
)
...
...
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