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
699aef8b
Commit
699aef8b
authored
Nov 04, 2014
by
Georgios Dagkakis
Committed by
Jérome Perrin
Feb 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
applications folder intoduced and CapacityObjects added there
parent
8b96e847
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
952 additions
and
0 deletions
+952
-0
dream/simulation/applications/CapacityStations/CapacityEntity.py
...imulation/applications/CapacityStations/CapacityEntity.py
+56
-0
dream/simulation/applications/CapacityStations/CapacityProject.py
...mulation/applications/CapacityStations/CapacityProject.py
+67
-0
dream/simulation/applications/CapacityStations/CapacityStation.py
...mulation/applications/CapacityStations/CapacityStation.py
+96
-0
dream/simulation/applications/CapacityStations/CapacityStationBuffer.py
...on/applications/CapacityStations/CapacityStationBuffer.py
+65
-0
dream/simulation/applications/CapacityStations/CapacityStationController.py
...pplications/CapacityStations/CapacityStationController.py
+535
-0
dream/simulation/applications/CapacityStations/CapacityStationExit.py
...tion/applications/CapacityStations/CapacityStationExit.py
+85
-0
dream/simulation/applications/CapacityStations/__init__.py
dream/simulation/applications/CapacityStations/__init__.py
+24
-0
dream/simulation/applications/__init__.py
dream/simulation/applications/__init__.py
+24
-0
No files found.
dream/simulation/applications/CapacityStations/CapacityEntity.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 5 June 2013
@author: George
'''
'''
entity that requires specific capacity from a station
'''
from
dream.simulation.Entity
import
Entity
# ===========================================================================
# The CapacityEntity object
# ===========================================================================
class
CapacityEntity
(
Entity
):
type
=
"CapacityEntity"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityProjectId
=
None
,
requiredCapacity
=
10
,
priority
=
0
,
dueDate
=
0
,
orderDate
=
0
,
currentStation
=
None
,
isCritical
=
False
,
**
kw
):
Entity
.
__init__
(
self
,
id
,
name
,
priority
,
dueDate
,
orderDate
,
isCritical
,
currentStation
=
currentStation
)
self
.
capacityProjectId
=
capacityProjectId
# the project id hat the capacity Entity is part of
self
.
capacityProject
=
None
# the project that the capacity Entity is part of. It is defined in initialize
self
.
requiredCapacity
=
requiredCapacity
# the capacity that the capacity entity requires from the following station
self
.
shouldMove
=
False
from
dream.simulation.Globals
import
G
G
.
CapacityEntityList
.
append
(
self
)
def
initialize
(
self
):
Entity
.
initialize
(
self
)
self
.
shouldMove
=
False
from
dream.simulation.Globals
import
G
# find the project that the capacity entity is part of
for
project
in
G
.
CapacityProjectList
:
if
project
.
id
==
self
.
capacityProjectId
:
self
.
capacityProject
=
project
break
\ No newline at end of file
dream/simulation/applications/CapacityStations/CapacityProject.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 5 June 2013
@author: George
'''
'''
a project that requires specific capacity from each station
'''
from
dream.simulation.Entity
import
Entity
# ===========================================================================
# The CapacityEntityProject object
# ===========================================================================
class
CapacityProject
(
Entity
):
type
=
"CapacityProject"
def
__init__
(
self
,
id
=
None
,
name
=
None
,
capacityRequirementDict
=
{},
earliestStartDict
=
{},
dueDate
=
0
,
assemblySpaceRequirement
=
0
,
**
kw
):
Entity
.
__init__
(
self
,
id
,
name
,
dueDate
=
dueDate
)
# 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
# the assembly space the project requires
self
.
assemblySpaceRequirement
=
assemblySpaceRequirement
from
dream.simulation.Globals
import
G
G
.
CapacityProjectList
.
append
(
self
)
def
initialize
(
self
):
self
.
projectSchedule
=
[]
# a list of dicts to keep the schedule
self
.
alreadyWorkedDict
=
{}
# a dict that hold what has been processed at every station
for
stationId
in
self
.
capacityRequirementDict
:
self
.
alreadyWorkedDict
[
stationId
]
=
0
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
from
dream.simulation.Globals
import
G
json
=
{
'_class'
:
'Dream.%s'
%
(
self
.
__class__
.
__name__
),
'id'
:
self
.
id
,
'family'
:
'Job'
,
'results'
:
{}}
if
(
G
.
numberOfReplications
==
1
):
# if we had just one replication output the results as numbers
json
[
'results'
][
'schedule'
]
=
self
.
projectSchedule
G
.
outputJSON
[
'elementList'
].
append
(
json
)
dream/simulation/applications/CapacityStations/CapacityStation.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 5 June 2013
@author: George
'''
'''
a station that can process a specified capacity in every time period
'''
from
dream.simulation.Queue
import
Queue
import
simpy
# ===========================================================================
# the CapacityStation object
# ===========================================================================
class
CapacityStation
(
Queue
):
family
=
'CapacityStation'
#===========================================================================
# the __init__ method of the CapacityStation
#===========================================================================
def
__init__
(
self
,
id
,
name
,
capacity
=
float
(
"inf"
),
intervalCapacity
=
[],
schedulingRule
=
"FIFO"
,
gatherWipStat
=
False
,
sharedResources
=
{},
**
kw
):
Queue
.
__init__
(
self
,
id
,
name
,
capacity
=
capacity
)
# a list that holds the capacity (manhours) that is available in each interval
self
.
intervalCapacity
=
intervalCapacity
# a list that holds the capacity (manhours) that is available in each interval for the remaining time
self
.
remainingIntervalCapacity
=
list
(
self
.
intervalCapacity
)
# blocks the entry of the capacity station, so that it can be manipulated to accept only in certain moments of simulation time
self
.
isLocked
=
True
# dict that holds information if station shares workpower with some other station
self
.
sharedResources
=
sharedResources
def
initialize
(
self
):
Queue
.
initialize
(
self
)
# if the station shares resources and the capacity is not defined in this
# then read it from some other of the sharing stations
if
not
self
.
intervalCapacity
and
self
.
sharedResources
:
for
stationId
in
self
.
sharedResources
.
get
(
'stationIds'
,[]):
import
dream.simulation.Globals
station
=
Globals
.
findObjectById
(
stationId
)
if
station
.
intervalCapacity
:
self
.
intervalCapacity
=
station
.
intervalCapacity
break
# initialize variables
self
.
remainingIntervalCapacity
=
list
(
self
.
intervalCapacity
)
self
.
isLocked
=
True
self
.
utilisationDict
=
[]
# a list of dicts for the utilization results
self
.
detailedWorkPlan
=
[]
# a list of dicts to keep detailed data
from
dream.simulation.Globals
import
G
G
.
CapacityStationList
.
append
(
self
)
def
canAccept
(
self
,
callerObject
=
None
):
if
self
.
isLocked
:
return
False
return
Queue
.
canAccept
(
self
)
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
from
dream.simulation.Globals
import
G
json
=
{
'_class'
:
'Dream.%s'
%
self
.
__class__
.
__name__
,
'id'
:
self
.
id
,
'family'
:
self
.
family
,
'results'
:
{}}
if
(
G
.
numberOfReplications
==
1
):
# if we had just one replication output the results as numbers
json
[
'results'
][
'capacityUsed'
]
=
self
.
utilisationDict
meanUtilization
=
0
for
entry
in
self
.
utilisationDict
:
meanUtilization
+=
entry
[
'utilization'
]
/
float
(
len
(
self
.
utilisationDict
))
json
[
'results'
][
'meanUtilization'
]
=
meanUtilization
json
[
'results'
][
'detailedWorkPlan'
]
=
self
.
detailedWorkPlan
G
.
outputJSON
[
'elementList'
].
append
(
json
)
\ No newline at end of file
dream/simulation/applications/CapacityStations/CapacityStationBuffer.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 6 June 2013
@author: George
'''
'''
the buffer of the capacity station. Only change from queue that it can be blocked.
'''
import
simpy
from
dream.simulation.Queue
import
Queue
# ===========================================================================
# the Queue object
# ===========================================================================
class
CapacityStationBuffer
(
Queue
):
#===========================================================================
# the __init__ method of the CapacityStationBuffer
#===========================================================================
def
__init__
(
self
,
id
,
name
,
requireFullProject
=
False
,
capacity
=
float
(
"inf"
),
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
gatherWipStat
=
False
,
**
kw
):
Queue
.
__init__
(
self
,
id
,
name
,
capacity
=
capacity
)
self
.
isLocked
=
True
self
.
requireFullProject
=
requireFullProject
# flag that shows if here the whole project is assembled
from
dream.simulation.Globals
import
G
G
.
CapacityStationBufferList
.
append
(
self
)
def
initialize
(
self
):
Queue
.
initialize
(
self
)
self
.
isLocked
=
True
def
canAccept
(
self
,
callerObject
=
None
):
if
self
.
isLocked
:
return
False
return
Queue
.
canAccept
(
self
)
def
haveToDispose
(
self
,
callerObject
=
None
):
activeObjectQ
=
self
.
getActiveObjectQueue
()
if
len
(
activeObjectQ
)
==
0
:
return
False
if
not
activeObjectQ
[
0
].
shouldMove
:
return
False
# put the entities that should move in front
def
sortEntities
(
self
):
activeObjectQ
=
self
.
getActiveObjectQueue
()
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
shouldMove
,
reverse
=
True
)
dream/simulation/applications/CapacityStations/CapacityStationController.py
0 → 100644
View file @
699aef8b
This diff is collapsed.
Click to expand it.
dream/simulation/applications/CapacityStations/CapacityStationExit.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 6 June 2013
@author: George
'''
'''
the exit of the capacity station. Only change from buffer that it can be blocked.
'''
from
dream.simulation.Exit
import
Exit
import
simpy
# ===========================================================================
# the CapacityStationExit object
# ===========================================================================
class
CapacityStationExit
(
Exit
):
#===========================================================================
# the __init__ method of the CapacityStationExit
#===========================================================================
def
__init__
(
self
,
id
,
name
=
None
,
nextCapacityStationBufferId
=
None
,
**
kw
):
Exit
.
__init__
(
self
,
id
,
name
)
self
.
isLocked
=
True
self
.
nextCapacityStationBufferId
=
nextCapacityStationBufferId
# the id of the next station. If it is None it
# means it is the end of the system.
self
.
nextCapacityStationBuffer
=
None
# the next buffer. If it is None it
from
dream.simulation.Globals
import
G
G
.
CapacityStationExitList
.
append
(
self
)
# means it is the end of the system.
def
initialize
(
self
):
Exit
.
initialize
(
self
)
self
.
isLocked
=
True
# list that contains the entities that are just obtained so that they can be
# moved to the next buffer
self
.
currentlyObtainedEntities
=
[]
# find the next buffer
if
self
.
nextCapacityStationBufferId
:
from
dream.simulation.Globals
import
G
# find the project that the capacity entity is part of
for
capacityStationBuffer
in
G
.
CapacityStationBufferList
:
if
capacityStationBuffer
.
id
==
self
.
nextCapacityStationBufferId
:
self
.
nextCapacityStationBuffer
=
capacityStationBuffer
break
def
canAccept
(
self
,
callerObject
=
None
):
if
self
.
isLocked
:
return
False
return
Exit
.
canAccept
(
self
)
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
# output results only for the last exit
if
not
self
.
nextCapacityStationBuffer
:
Exit
.
outputResultsJSON
(
self
)
# extend so that it updates alreadyWorkedDict of the project
def
getEntity
(
self
):
activeEntity
=
Exit
.
getEntity
(
self
)
alreadyWorkedDict
=
activeEntity
.
capacityProject
.
alreadyWorkedDict
stationId
=
self
.
giver
.
id
alreadyWorkedDict
[
stationId
]
+=
activeEntity
.
requiredCapacity
\ No newline at end of file
dream/simulation/applications/CapacityStations/__init__.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
\ No newline at end of file
dream/simulation/applications/__init__.py
0 → 100644
View file @
699aef8b
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
\ No newline at end of file
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