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
8e47f2ba
Commit
8e47f2ba
authored
Aug 19, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'george3'
parents
1b6c0b9f
fa2b8625
Changes
33
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
488 additions
and
396 deletions
+488
-396
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+5
-22
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+3
-17
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+118
-0
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+6
-5
dream/simulation/Entity.py
dream/simulation/Entity.py
+40
-0
dream/simulation/Exit.py
dream/simulation/Exit.py
+7
-13
dream/simulation/Failure.py
dream/simulation/Failure.py
+2
-5
dream/simulation/Frame.py
dream/simulation/Frame.py
+3
-1
dream/simulation/JSONInputs/Topology01.json
dream/simulation/JSONInputs/Topology01.json
+8
-11
dream/simulation/JSONInputs/Topology02.json
dream/simulation/JSONInputs/Topology02.json
+1
-3
dream/simulation/JSONInputs/Topology03.json
dream/simulation/JSONInputs/Topology03.json
+9
-12
dream/simulation/JSONInputs/Topology04.json
dream/simulation/JSONInputs/Topology04.json
+8
-11
dream/simulation/JSONInputs/Topology05.json
dream/simulation/JSONInputs/Topology05.json
+1
-3
dream/simulation/JSONInputs/Topology06.json
dream/simulation/JSONInputs/Topology06.json
+8
-11
dream/simulation/JSONInputs/Topology07.json
dream/simulation/JSONInputs/Topology07.json
+1
-3
dream/simulation/JSONInputs/Topology08.json
dream/simulation/JSONInputs/Topology08.json
+1
-3
dream/simulation/JSONInputs/Topology09.json
dream/simulation/JSONInputs/Topology09.json
+1
-3
dream/simulation/JSONInputs/Topology10.json
dream/simulation/JSONInputs/Topology10.json
+1
-3
dream/simulation/JSONInputs/Topology11.json
dream/simulation/JSONInputs/Topology11.json
+9
-13
dream/simulation/JSONInputs/Topology12.json
dream/simulation/JSONInputs/Topology12.json
+10
-14
dream/simulation/JSONInputs/Topology13.json
dream/simulation/JSONInputs/Topology13.json
+1
-3
dream/simulation/JSONInputs/Topology14.json
dream/simulation/JSONInputs/Topology14.json
+1
-3
dream/simulation/JSONInputs/Topology15.json
dream/simulation/JSONInputs/Topology15.json
+9
-12
dream/simulation/JSONInputs/Topology16.json
dream/simulation/JSONInputs/Topology16.json
+10
-16
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+88
-100
dream/simulation/Machine.py
dream/simulation/Machine.py
+14
-32
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+40
-0
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+66
-0
dream/simulation/Part.py
dream/simulation/Part.py
+2
-1
dream/simulation/Queue.py
dream/simulation/Queue.py
+5
-30
dream/simulation/Repairman.py
dream/simulation/Repairman.py
+8
-22
dream/simulation/Source.py
dream/simulation/Source.py
+2
-24
dream/simulation/documents/ClassHierarchy.png
dream/simulation/documents/ClassHierarchy.png
+0
-0
No files found.
dream/simulation/Assembly.py
View file @
8e47f2ba
...
@@ -21,8 +21,6 @@ Created on 18 Feb 2013
...
@@ -21,8 +21,6 @@ Created on 18 Feb 2013
@author: George
@author: George
'''
'''
'''
'''
Models an assembly object
Models an assembly object
it gathers frames and parts which are loaded to the frames
it gathers frames and parts which are loaded to the frames
...
@@ -32,9 +30,10 @@ from SimPy.Simulation import *
...
@@ -32,9 +30,10 @@ from SimPy.Simulation import *
import
xlwt
import
xlwt
from
RandomNumberGenerator
import
RandomNumberGenerator
from
RandomNumberGenerator
import
RandomNumberGenerator
import
scipy.stats
as
stat
import
scipy.stats
as
stat
from
CoreObject
import
CoreObject
#the Assembly object
#the Assembly object
class
Assembly
(
Process
):
class
Assembly
(
CoreObject
):
#initialize the object
#initialize the object
def
__init__
(
self
,
id
,
name
,
dist
,
time
):
def
__init__
(
self
,
id
,
name
,
dist
,
time
):
...
@@ -182,18 +181,12 @@ class Assembly(Process):
...
@@ -182,18 +181,12 @@ class Assembly(Process):
def
haveToDispose
(
self
):
def
haveToDispose
(
self
):
return
len
(
self
.
Res
.
activeQ
)
>
0
and
self
.
waitToDispose
return
len
(
self
.
Res
.
activeQ
)
>
0
and
self
.
waitToDispose
#sets the routing in and out elements for the Assembly
def
defineRouting
(
self
,
p
,
n
):
self
.
next
=
n
self
.
previous
=
p
#removes an entity from the Assembly
#removes an entity from the Assembly
def
removeEntity
(
self
):
def
removeEntity
(
self
):
self
.
outputTrace
(
self
.
Res
.
activeQ
[
0
].
name
,
"releases "
+
self
.
objName
)
self
.
outputTrace
(
self
.
Res
.
activeQ
[
0
].
name
,
"releases "
+
self
.
objName
)
self
.
Res
.
activeQ
.
pop
(
0
)
self
.
Res
.
activeQ
.
pop
(
0
)
self
.
waitToDispose
=
False
self
.
waitToDispose
=
False
#gets an entity from the predecessor
#gets an entity from the predecessor
#it may handle both Parts and Frames
#it may handle both Parts and Frames
def
getEntity
(
self
,
type
):
def
getEntity
(
self
,
type
):
...
@@ -341,15 +334,5 @@ class Assembly(Process):
...
@@ -341,15 +334,5 @@ class Assembly(Process):
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
G
.
outputJSON
[
'coreObject'
].
append
(
json
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
\ No newline at end of file
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
dream/simulation/Conveyer.py
View file @
8e47f2ba
...
@@ -29,9 +29,10 @@ it gathers entities and transfers them with a certain speed
...
@@ -29,9 +29,10 @@ it gathers entities and transfers them with a certain speed
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
import
xlwt
import
xlwt
import
scipy.stats
as
stat
import
scipy.stats
as
stat
from
CoreObject
import
CoreObject
#The conveyer object
#The conveyer object
class
Conveyer
(
Process
):
class
Conveyer
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
length
,
speed
):
def
__init__
(
self
,
id
,
name
,
length
,
speed
):
self
.
id
=
id
self
.
id
=
id
...
@@ -224,11 +225,6 @@ class Conveyer(Process):
...
@@ -224,11 +225,6 @@ class Conveyer(Process):
else
:
else
:
return
False
return
False
#sets the routing in and out elements for the Conveyer
def
defineRouting
(
self
,
p
,
n
):
self
.
next
=
n
self
.
previous
=
p
#checks if the conveyer is full to count the blockage. for some reason Plant regards
#checks if the conveyer is full to count the blockage. for some reason Plant regards
#the conveyer full even when it has one place
#the conveyer full even when it has one place
def
isFull
(
self
):
def
isFull
(
self
):
...
@@ -253,7 +249,6 @@ class Conveyer(Process):
...
@@ -253,7 +249,6 @@ class Conveyer(Process):
else
:
else
:
return
self
.
canAcceptAndIsRequested
()
return
self
.
canAcceptAndIsRequested
()
#actions to be taken after the simulation ends
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
def
postProcessing
(
self
,
MaxSimtime
):
self
.
moveEntities
()
#move the entities to count the working time
self
.
moveEntities
()
#move the entities to count the working time
...
@@ -382,16 +377,7 @@ class Conveyer(Process):
...
@@ -382,16 +377,7 @@ class Conveyer(Process):
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'min'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
G
.
outputJSON
[
'coreObject'
].
append
(
json
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
#Process that handles the moves of the conveyer
#Process that handles the moves of the conveyer
class
ConveyerMover
(
Process
):
class
ConveyerMover
(
Process
):
...
...
dream/simulation/CoreObject.py
0 → 100644
View file @
8e47f2ba
# ===========================================================================
# Copyright 2013 Georgios Dagkakis
#
# 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 12 Jul 2012
@author: George
'''
'''
Class that acts as an abstract. It should have no instances. All the core-objects should inherit from it
'''
from
SimPy.Simulation
import
Process
,
Resource
#the core object
class
CoreObject
(
Process
):
def
initilize
(
self
):
Process
.
__init__
(
self
)
self
.
predecessorIndex
=
0
#holds the index of the predecessor from which the Machine will take an entity next
self
.
successorIndex
=
0
#holds the index of the successor where the Machine will dispose an entity next
self
.
Up
=
True
#Boolean that shows if the machine is in failure ("Down") or not ("up")
self
.
currentEntity
=
None
self
.
totalBlockageTime
=
0
#holds the total blockage time
self
.
totalFailureTime
=
0
#holds the total failure time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
completedJobs
=
0
#holds the number of completed jobs
self
.
timeLastEntityEnded
=
0
#holds the last time that an entity ended processing in the object
self
.
nameLastEntityEnded
=
""
#holds the name of the last entity that ended processing in the object
self
.
timeLastEntityEntered
=
0
#holds the last time that an entity entered in the object
self
.
nameLastEntityEntered
=
""
#holds the name of the last entity that entered in the object
self
.
timeLastFailure
=
0
#holds the time that the last failure of the object started
self
.
timeLastFailureEnded
=
0
#holds the time that the last failure of the object Ended
self
.
downTimeProcessingCurrentEntity
=
0
#holds the time that the machine was down while processing the current entity
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
#holds the time that the object was down while trying
#to release the current entity
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the object was down while holding current entity
self
.
timeLastEntityLeft
=
0
#holds the last time that an entity left the object
self
.
processingTimeOfCurrentEntity
=
0
#holds the total processing time that the current entity required
self
.
waitToDispose
=
False
#shows if the object waits to dispose an entity
#the main process of the core object
#this is dummy, every object must have its own implementation
def
run
(
self
):
raise
NotImplementedError
(
"Subclass must define 'run' method"
)
#sets the routing in and out elements for the Object
def
defineRouting
(
self
,
p
,
n
):
self
.
next
=
n
self
.
previous
=
p
#removes an entity from the Object
def
removeEntity
(
self
):
self
.
Res
.
activeQ
.
pop
(
0
)
#gets an entity from the predecessor that the predecessor index points to
def
getEntity
(
self
):
self
.
Res
.
activeQ
=
[
self
.
previous
[
self
.
predecessorIndex
].
Res
.
activeQ
[
0
]]
+
self
.
Res
.
activeQ
#get the entity from the previous object
#and put it in front of the activeQ
self
.
previous
[
self
.
predecessorIndex
].
removeEntity
()
#remove the entity from the previous object
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
pass
#outputs message to the trace.xls
def
outputTrace
(
self
,
message
):
pass
#outputs data to "output.xls"
def
outputResultsXL
(
self
,
MaxSimtime
):
pass
#outputs results to JSON File
def
outputResultsJSON
(
self
):
pass
#checks if the Object can dispose an entity to the following object
def
haveToDispose
(
self
):
return
len
(
self
.
Res
.
activeQ
)
>
0
#checks if the Object can accept an entity and there is an entity in some predecessor waiting for it
def
canAcceptAndIsRequested
(
self
):
pass
#checks if the Object can accept an entity
def
canAccept
(
self
):
pass
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
\ No newline at end of file
dream/simulation/Dismantle.py
View file @
8e47f2ba
...
@@ -30,9 +30,10 @@ from SimPy.Simulation import *
...
@@ -30,9 +30,10 @@ from SimPy.Simulation import *
import
xlwt
import
xlwt
from
RandomNumberGenerator
import
RandomNumberGenerator
from
RandomNumberGenerator
import
RandomNumberGenerator
import
scipy.stats
as
stat
import
scipy.stats
as
stat
from
CoreObject
import
CoreObject
#the Dismantle object
#the Dismantle object
class
Dismantle
(
Process
):
class
Dismantle
(
CoreObject
):
#initialize the object
#initialize the object
def
__init__
(
self
,
id
,
name
,
dist
,
time
):
def
__init__
(
self
,
id
,
name
,
dist
,
time
):
...
@@ -52,6 +53,7 @@ class Dismantle(Process):
...
@@ -52,6 +53,7 @@ class Dismantle(Process):
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
nextPartIds
=
[]
#list with the ids of the next objects that receive parts
self
.
nextPartIds
=
[]
#list with the ids of the next objects that receive parts
self
.
nextFrameIds
=
[]
#list with the ids of the next objects that receive frames
self
.
nextFrameIds
=
[]
#list with the ids of the next objects that receive frames
self
.
next
=
[]
#lists to hold statistics of multiple runs
#lists to hold statistics of multiple runs
self
.
Waiting
=
[]
self
.
Waiting
=
[]
...
@@ -131,9 +133,8 @@ class Dismantle(Process):
...
@@ -131,9 +133,8 @@ class Dismantle(Process):
def
canAccept
(
self
):
def
canAccept
(
self
):
return
len
(
self
.
Res
.
activeQ
)
==
0
return
len
(
self
.
Res
.
activeQ
)
==
0
#sets the routing in and out elements for the Dismantle
#defines where parts and frames go after they leave the object
def
defineRouting
(
self
,
p
,
np
,
nf
):
def
definePartFrameRouting
(
self
,
np
,
nf
):
self
.
previous
=
p
self
.
nextPart
=
np
self
.
nextPart
=
np
self
.
nextFrame
=
nf
self
.
nextFrame
=
nf
...
@@ -339,7 +340,7 @@ class Dismantle(Process):
...
@@ -339,7 +340,7 @@ class Dismantle(Process):
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
G
.
outputJSON
[
'
coreObjec
t'
].
append
(
json
)
G
.
outputJSON
[
'
elementLis
t'
].
append
(
json
)
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
#needed because if somebody runs multiple runs in deterministic case it would crash!
...
...
dream/simulation/Entity.py
0 → 100644
View file @
8e47f2ba
# ===========================================================================
# Copyright 2013 Georgios Dagkakis
#
# 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 18 Aug 2013
@author: George
'''
'''
Class that acts as an abstract. It should have no instances. All the Entities should inherit from it
'''
#The entity object
class
Entity
(
object
):
def
__init__
(
self
,
name
):
self
.
type
=
"Entity"
self
.
name
=
name
self
.
currentStop
=
None
#contains the current object that the material is in
self
.
creationTime
=
0
self
.
startTime
=
0
#holds the startTime for the lifespan
#dimension data
self
.
width
=
1.0
self
.
height
=
1.0
self
.
length
=
1.0
\ No newline at end of file
dream/simulation/Exit.py
View file @
8e47f2ba
...
@@ -28,9 +28,10 @@ models the exit of the model
...
@@ -28,9 +28,10 @@ models the exit of the model
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
import
xlwt
import
xlwt
import
scipy.stats
as
stat
import
scipy.stats
as
stat
from
CoreObject
import
CoreObject
#The exit object
#The exit object
class
Exit
(
Process
):
class
Exit
(
CoreObject
):
def
__init__
(
self
,
id
,
name
):
def
__init__
(
self
,
id
,
name
):
Process
.
__init__
(
self
)
Process
.
__init__
(
self
)
...
@@ -213,8 +214,9 @@ class Exit(Process):
...
@@ -213,8 +214,9 @@ class Exit(Process):
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'id'
]
=
str
(
self
.
id
)
json
[
'results'
]
=
{}
json
[
'results'
]
=
{}
json
[
'results'
][
'throughput'
]
=
self
.
numOfExits
json
[
'results'
][
'throughput'
]
=
self
.
numOfExits
json
[
'results'
][
'lifespan'
]
=
((
self
.
totalLifespan
)
/
self
.
numOfExits
)
/
G
.
Base
json
[
'results'
][
'lifespan'
]
=
self
.
Lifespan
[
0
]
json
[
'results'
][
'takt_time'
]
=
((
self
.
totalTaktTime
)
/
self
.
numOfExits
)
/
G
.
Base
json
[
'results'
][
'takt_time'
]
=
self
.
TaktTime
[
0
]
else
:
#if we had multiple replications we output confidence intervals to excel
else
:
#if we had multiple replications we output confidence intervals to excel
#for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
#for some outputs the results may be the same for each run (eg model is stochastic but failures fixed
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
#so failurePortion will be exactly the same in each run). That will give 0 variability and errors.
...
@@ -251,13 +253,5 @@ class Exit(Process):
...
@@ -251,13 +253,5 @@ class Exit(Process):
json
[
'results'
][
'taktTime'
][
'min'
]
=
self
.
TaktTime
[
0
]
json
[
'results'
][
'taktTime'
][
'min'
]
=
self
.
TaktTime
[
0
]
json
[
'results'
][
'taktTime'
][
'avg'
]
=
self
.
TaktTime
[
0
]
json
[
'results'
][
'taktTime'
][
'avg'
]
=
self
.
TaktTime
[
0
]
json
[
'results'
][
'taktTime'
][
'max'
]
=
self
.
TaktTime
[
0
]
json
[
'results'
][
'taktTime'
][
'max'
]
=
self
.
TaktTime
[
0
]
G
.
outputJSON
[
'
coreObjec
t'
].
append
(
json
)
G
.
outputJSON
[
'
elementLis
t'
].
append
(
json
)
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
\ No newline at end of file
dream/simulation/Failure.py
View file @
8e47f2ba
...
@@ -26,12 +26,12 @@ Created on 9 Nov 2012
...
@@ -26,12 +26,12 @@ Created on 9 Nov 2012
models the failures that servers can have
models the failures that servers can have
'''
'''
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
import
math
import
math
from
RandomNumberGenerator
import
RandomNumberGenerator
from
RandomNumberGenerator
import
RandomNumberGenerator
from
ObjectInterruption
import
ObjectInterruption
class
Failure
(
Process
):
class
Failure
(
ObjectInterruption
):
def
__init__
(
self
,
victim
,
dist
,
MTTF
,
MTTR
,
availability
,
index
,
repairman
):
def
__init__
(
self
,
victim
,
dist
,
MTTF
,
MTTR
,
availability
,
index
,
repairman
):
Process
.
__init__
(
self
)
Process
.
__init__
(
self
)
...
@@ -122,6 +122,3 @@ class Failure(Process):
...
@@ -122,6 +122,3 @@ class Failure(Process):
G
.
sheetIndex
+=
1
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#outputs data to "output.xls"
def
outputResultsXL
(
self
,
MaxSimtime
):
pass
\ No newline at end of file
dream/simulation/Frame.py
View file @
8e47f2ba
...
@@ -28,13 +28,15 @@ models a frame entity. This can flow through the system and carry parts
...
@@ -28,13 +28,15 @@ models a frame entity. This can flow through the system and carry parts
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
from
Globals
import
G
from
Globals
import
G
from
Entity
import
Entity
#The entity object
#The entity object
class
Frame
(
object
):
class
Frame
(
Entity
):
type
=
"Frame"
type
=
"Frame"
numOfParts
=
4
#the number of parts that the frame can take
numOfParts
=
4
#the number of parts that the frame can take
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
self
.
type
=
"Frame"
self
.
name
=
name
self
.
name
=
name
self
.
currentStop
=
None
#contains the current object that the material is in
self
.
currentStop
=
None
#contains the current object that the material is in
self
.
creationTime
=
0
self
.
creationTime
=
0
...
...
dream/simulation/JSONInputs/Topology01.json
View file @
8e47f2ba
...
@@ -6,14 +6,13 @@
...
@@ -6,14 +6,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"
modelResource
"
:
[
"
elementList
"
:
[
{
"_class"
:
"Dream.Repairman"
,
{
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
@@ -35,8 +34,7 @@
...
@@ -35,8 +34,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"Q1"
]
"successorList"
:
[
"Q1"
]
},
},
...
@@ -50,8 +48,7 @@
...
@@ -50,8 +48,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"E1"
]
"successorList"
:
[
"E1"
]
},
},
...
...
dream/simulation/JSONInputs/Topology02.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Parts"
,
"name"
:
"Parts"
,
...
...
dream/simulation/JSONInputs/Topology03.json
View file @
8e47f2ba
...
@@ -6,14 +6,13 @@
...
@@ -6,14 +6,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"
modelResource
"
:
[
"
elementList
"
:
[
{
"_class"
:
"Dream.Repairman"
,
{
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
@@ -35,8 +34,7 @@
...
@@ -35,8 +34,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M2"
]
"successorList"
:
[
"M2"
]
},
},
...
@@ -50,8 +48,7 @@
...
@@ -50,8 +48,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"E1"
]
"successorList"
:
[
"E1"
]
},
},
...
...
dream/simulation/JSONInputs/Topology04.json
View file @
8e47f2ba
...
@@ -6,14 +6,13 @@
...
@@ -6,14 +6,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"
modelResource
"
:
[
"
elementList
"
:
[
{
"_class"
:
"Dream.Repairman"
,
{
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
@@ -35,8 +34,7 @@
...
@@ -35,8 +34,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"E1"
]
"successorList"
:
[
"E1"
]
},
},
...
@@ -50,8 +48,7 @@
...
@@ -50,8 +48,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"Q1"
]
"successorList"
:
[
"Q1"
]
},
},
...
...
dream/simulation/JSONInputs/Topology05.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Parts"
,
"name"
:
"Parts"
,
...
...
dream/simulation/JSONInputs/Topology06.json
View file @
8e47f2ba
...
@@ -6,14 +6,13 @@
...
@@ -6,14 +6,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"
modelResource
"
:
[
"
elementList
"
:
[
{
"_class"
:
"Dream.Repairman"
,
{
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
@@ -35,8 +34,7 @@
...
@@ -35,8 +34,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"Q1"
]
"successorList"
:
[
"Q1"
]
},
},
...
@@ -50,8 +48,7 @@
...
@@ -50,8 +48,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M3"
]
"successorList"
:
[
"M3"
]
},
},
...
...
dream/simulation/JSONInputs/Topology07.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material 1"
,
"name"
:
"Raw Material 1"
,
...
...
dream/simulation/JSONInputs/Topology08.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material 1"
,
"name"
:
"Raw Material 1"
,
...
...
dream/simulation/JSONInputs/Topology09.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
...
dream/simulation/JSONInputs/Topology10.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material 1"
,
"name"
:
"Raw Material 1"
,
...
...
dream/simulation/JSONInputs/Topology11.json
View file @
8e47f2ba
...
@@ -7,15 +7,13 @@
...
@@ -7,15 +7,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
{
{
"_class"
:
"Dream.Repairman"
,
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
{
"_class"
:
"Dream.Source"
,
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
...
@@ -38,8 +36,7 @@
...
@@ -38,8 +36,7 @@
"failures"
:
{
"failures"
:
{
"failureDistribution"
:
"No"
,
"failureDistribution"
:
"No"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M3"
]
"successorList"
:
[
"M3"
]
},
},
...
@@ -54,8 +51,7 @@
...
@@ -54,8 +51,7 @@
"failures"
:
{
"failures"
:
{
"failureDistribution"
:
"No"
,
"failureDistribution"
:
"No"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M3"
]
"successorList"
:
[
"M3"
]
},
},
...
...
dream/simulation/JSONInputs/Topology12.json
View file @
8e47f2ba
...
@@ -7,15 +7,13 @@
...
@@ -7,15 +7,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
{
{
"_class"
:
"Dream.Repairman"
,
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[]
],
},
"coreObject"
:
[
{
{
"_class"
:
"Dream.Source"
,
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
...
@@ -38,8 +36,7 @@
...
@@ -38,8 +36,7 @@
"failures"
:
{
"failures"
:
{
"failureDistribution"
:
"No"
,
"failureDistribution"
:
"No"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M3"
,
"M4"
]
"successorList"
:
[
"M3"
,
"M4"
]
},
},
...
@@ -54,8 +51,7 @@
...
@@ -54,8 +51,7 @@
"failures"
:
{
"failures"
:
{
"failureDistribution"
:
"No"
,
"failureDistribution"
:
"No"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M3"
,
"M4"
]
"successorList"
:
[
"M3"
,
"M4"
]
},
},
...
...
dream/simulation/JSONInputs/Topology13.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Parts"
,
"name"
:
"Parts"
,
...
...
dream/simulation/JSONInputs/Topology14.json
View file @
8e47f2ba
...
@@ -6,9 +6,7 @@
...
@@ -6,9 +6,7 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"modelResource"
:
[
"elementList"
:
[
],
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Parts"
,
"name"
:
"Parts"
,
...
...
dream/simulation/JSONInputs/Topology15.json
View file @
8e47f2ba
...
@@ -6,14 +6,13 @@
...
@@ -6,14 +6,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"
modelResource
"
:
[
"
elementList
"
:
[
{
"_class"
:
"Dream.Repairman"
,
{
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
@@ -35,8 +34,7 @@
...
@@ -35,8 +34,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"C1"
]
"successorList"
:
[
"C1"
]
},
},
...
@@ -50,8 +48,7 @@
...
@@ -50,8 +48,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"E1"
]
"successorList"
:
[
"E1"
]
},
},
...
...
dream/simulation/JSONInputs/Topology16.json
View file @
8e47f2ba
...
@@ -6,14 +6,13 @@
...
@@ -6,14 +6,13 @@
"trace"
:
"No"
,
"trace"
:
"No"
,
"confidenceLevel"
:
"0.95"
"confidenceLevel"
:
"0.95"
},
},
"
modelResource
"
:
[
"
elementList
"
:
[
{
"_class"
:
"Dream.Repairman"
,
{
"_class"
:
"Dream.Repairman"
,
"id"
:
"W1"
,
"id"
:
"W1"
,
"name"
:
"W1"
,
"name"
:
"W1"
,
"capacity"
:
"1"
"capacity"
:
"1"
,
}
"successorList"
:
[
"M1"
,
"M2"
]
],
},
"coreObject"
:
[
{
"_class"
:
"Dream.Source"
,
{
"_class"
:
"Dream.Source"
,
"id"
:
"S1"
,
"id"
:
"S1"
,
"name"
:
"Raw Material"
,
"name"
:
"Raw Material"
,
...
@@ -35,8 +34,7 @@
...
@@ -35,8 +34,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"60"
,
"MTTF"
:
"60"
,
"MTTR"
:
"5"
,
"MTTR"
:
"5"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"C1"
]
"successorList"
:
[
"C1"
]
},
},
...
@@ -50,8 +48,7 @@
...
@@ -50,8 +48,7 @@
"failures"
:{
"failures"
:{
"failureDistribution"
:
"Fixed"
,
"failureDistribution"
:
"Fixed"
,
"MTTF"
:
"40"
,
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"MTTR"
:
"10"
"repairman"
:
"W1"
},
},
"successorList"
:
[
"M3"
]
"successorList"
:
[
"M3"
]
},
},
...
@@ -77,10 +74,7 @@
...
@@ -77,10 +74,7 @@
"mean"
:
"3"
"mean"
:
"3"
},
},
"failures"
:{
"failures"
:{
"failureDistribution"
:
"No"
,
"failureDistribution"
:
"No"
"MTTF"
:
"40"
,
"MTTR"
:
"10"
,
"repairman"
:
"W1"
},
},
"successorList"
:
[
"E1"
]
"successorList"
:
[
"E1"
]
},
},
...
...
dream/simulation/LineGenerationJSON.py
View file @
8e47f2ba
This diff is collapsed.
Click to expand it.
dream/simulation/Machine.py
View file @
8e47f2ba
...
@@ -29,12 +29,14 @@ from SimPy.Simulation import Process, Resource
...
@@ -29,12 +29,14 @@ from SimPy.Simulation import Process, Resource
from
SimPy.Simulation
import
activate
,
passivate
,
waituntil
,
now
,
hold
from
SimPy.Simulation
import
activate
,
passivate
,
waituntil
,
now
,
hold
from
Failure
import
Failure
from
Failure
import
Failure
from
CoreObject
import
CoreObject
from
RandomNumberGenerator
import
RandomNumberGenerator
from
RandomNumberGenerator
import
RandomNumberGenerator
import
scipy.stats
as
stat
import
scipy.stats
as
stat
import
sys
import
sys
#the Machine object
#the Machine object
class
Machine
(
Process
):
class
Machine
(
CoreObject
):
#initialize the id the capacity, of the resource and the distribution
#initialize the id the capacity, of the resource and the distribution
def
__init__
(
self
,
id
,
name
,
capacity
,
dist
,
time
,
fDist
,
MTTF
,
MTTR
,
availability
,
repairman
):
def
__init__
(
self
,
id
,
name
,
capacity
,
dist
,
time
,
fDist
,
MTTF
,
MTTR
,
availability
,
repairman
):
...
@@ -186,12 +188,6 @@ class Machine(Process):
...
@@ -186,12 +188,6 @@ class Machine(Process):
self
.
totalBlockageTime
+=
totalTime
-
(
tinMStart
+
failureTime
)
#the time of blockage is derived from
self
.
totalBlockageTime
+=
totalTime
-
(
tinMStart
+
failureTime
)
#the time of blockage is derived from
#the whole time in the machine
#the whole time in the machine
#minus the processing time and the failure time
#minus the processing time and the failure time
#sets the routing in and out elements for the queue
def
defineRouting
(
self
,
p
,
n
):
self
.
next
=
n
self
.
previous
=
p
#checks if the waitQ of the machine is empty
#checks if the waitQ of the machine is empty
def
checkIfWaitQEmpty
(
self
):
def
checkIfWaitQEmpty
(
self
):
return
len
(
self
.
M
.
waitQ
)
==
0
return
len
(
self
.
M
.
waitQ
)
==
0
...
@@ -260,6 +256,14 @@ class Machine(Process):
...
@@ -260,6 +256,14 @@ class Machine(Process):
return
self
.
Up
==
False
or
self
.
next
[
0
].
canAccept
()
or
len
(
self
.
Res
.
activeQ
)
==
0
#the last part is added so that it is not removed and stack
return
self
.
Up
==
False
or
self
.
next
[
0
].
canAccept
()
or
len
(
self
.
Res
.
activeQ
)
==
0
#the last part is added so that it is not removed and stack
#gotta think of it again
#gotta think of it again
#removes an entity from the Machine
def
removeEntity
(
self
):
self
.
timeLastEntityLeft
=
now
()
self
.
outputTrace
(
"releases "
+
self
.
objName
)
self
.
waitToDispose
=
False
self
.
Res
.
activeQ
.
pop
(
0
)
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
#checks if the Machine can dispose an entity to the following object
#checks if the Machine can dispose an entity to the following object
def
haveToDispose
(
self
):
def
haveToDispose
(
self
):
#if we have only one successor just check if machine waits to dispose and also is up
#if we have only one successor just check if machine waits to dispose and also is up
...
@@ -295,19 +299,6 @@ class Machine(Process):
...
@@ -295,19 +299,6 @@ class Machine(Process):
flag
=
True
flag
=
True
return
len
(
self
.
Res
.
activeQ
)
>
0
and
self
.
waitToDispose
and
self
.
Up
and
flag
return
len
(
self
.
Res
.
activeQ
)
>
0
and
self
.
waitToDispose
and
self
.
Up
and
flag
#removes an entity from the Machine
def
removeEntity
(
self
):
self
.
timeLastEntityLeft
=
now
()
self
.
outputTrace
(
"releases "
+
self
.
objName
)
self
.
waitToDispose
=
False
self
.
Res
.
activeQ
.
pop
(
0
)
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
#gets an entity from the predecessor that the predecessor index points to
def
getEntity
(
self
):
self
.
Res
.
activeQ
.
append
(
self
.
previous
[
self
.
predecessorIndex
].
Res
.
activeQ
[
0
])
#get the entity from the predecessor
self
.
previous
[
self
.
predecessorIndex
].
removeEntity
()
#actions to be taken after the simulation ends
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
def
postProcessing
(
self
,
MaxSimtime
):
...
@@ -496,14 +487,5 @@ class Machine(Process):
...
@@ -496,14 +487,5 @@ class Machine(Process):
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
G
.
outputJSON
[
'coreObject'
].
append
(
json
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
\ No newline at end of file
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
\ No newline at end of file
dream/simulation/ObjectInterruption.py
0 → 100644
View file @
8e47f2ba
# ===========================================================================
# Copyright 2013 Georgios Dagkakis
#
# 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 18 Aug 2013
@author: George
'''
'''
Class that acts as an abstract. It should have no instances. All object interruptions (eg failures, breaks) should inherit from it
'''
from
SimPy.Simulation
import
Process
,
Resource
class
ObjectInterruption
(
Process
):
#the main process of the core object
#this is dummy, every object must have its own implementation
def
run
(
self
):
raise
NotImplementedError
(
"Subclass must define 'run' method"
)
#outputs data to "output.xls"
def
outputResultsXL
(
self
,
MaxSimtime
):
pass
\ No newline at end of file
dream/simulation/ObjectResource.py
0 → 100644
View file @
8e47f2ba
# ===========================================================================
# Copyright 2013 Georgios Dagkakis
#
# 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 18 Aug 2013
@author: George
'''
'''
Class that acts as an abstract. It should have no instances. All the Resources should inherit from it
'''
from
SimPy.Simulation
import
Resource
#the resource that repairs the machines
class
ObjectResource
(
object
):
def
initialize
(
self
):
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
timeLastRepairStarted
=
0
#holds the time that the last repair was started
self
.
Res
=
Resource
(
self
.
capacity
)
#checks if the worker is available
def
checkIfResourceIsAvailable
(
self
):
return
len
(
self
.
W
.
activeQ
)
<
self
.
capacity
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
pass
#outputs message to the trace.xls
def
outputTrace
(
self
,
message
):
pass
#outputs data to "output.xls"
def
outputResultsXL
(
self
,
MaxSimtime
):
pass
#outputs results to JSON File
def
outputResultsJSON
(
self
):
pass
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
\ No newline at end of file
dream/simulation/Part.py
View file @
8e47f2ba
...
@@ -29,10 +29,11 @@ models a part entity that flows through the system
...
@@ -29,10 +29,11 @@ models a part entity that flows through the system
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
from
Globals
import
G
from
Globals
import
G
from
Entity
import
Entity
#The entity object
#The entity object
class
Part
(
object
):
class
Part
(
Entity
):
type
=
"Part"
type
=
"Part"
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
...
...
dream/simulation/Queue.py
View file @
8e47f2ba
...
@@ -27,10 +27,12 @@ Models a FIFO queue where entities can wait in order to get into a server
...
@@ -27,10 +27,12 @@ Models a FIFO queue where entities can wait in order to get into a server
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
from
CoreObject
import
CoreObject
#import sys
#import sys
#the Queue object
#the Queue object
class
Queue
(
Process
):
class
Queue
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
capacity
,
dummy
):
def
__init__
(
self
,
id
,
name
,
capacity
,
dummy
):
Process
.
__init__
(
self
)
Process
.
__init__
(
self
)
...
@@ -88,11 +90,6 @@ class Queue(Process):
...
@@ -88,11 +90,6 @@ class Queue(Process):
if
self
.
isDummy
:
if
self
.
isDummy
:
self
.
Res
.
activeQ
[
0
].
startTime
=
now
()
self
.
Res
.
activeQ
[
0
].
startTime
=
now
()
#sets the routing in and out elements for the queue
def
defineRouting
(
self
,
p
,
n
):
self
.
next
=
n
self
.
previous
=
p
#checks if the Q has one available place
#checks if the Q has one available place
def
checkIfQHasPlace
(
self
):
def
checkIfQHasPlace
(
self
):
return
len
(
self
.
Q
.
activeQ
)
<
self
.
capacity
return
len
(
self
.
Q
.
activeQ
)
<
self
.
capacity
...
@@ -184,20 +181,6 @@ class Queue(Process):
...
@@ -184,20 +181,6 @@ class Queue(Process):
maxTimeWaiting
=
timeWaiting
maxTimeWaiting
=
timeWaiting
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
and
isRequested
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
and
isRequested
#gets an entity from the predecessor that the predecessor index points to
def
getEntity
(
self
):
self
.
Res
.
activeQ
=
[
self
.
previous
[
self
.
predecessorIndex
].
Res
.
activeQ
[
0
]]
+
self
.
Res
.
activeQ
#get the entity from the previous object
#and put it in front of the activeQ
self
.
previous
[
self
.
predecessorIndex
].
removeEntity
()
#remove the entity from the previous object
#removes an entity from the Queue (this is FIFO for now)
def
removeEntity
(
self
):
self
.
Res
.
activeQ
.
pop
(
0
)
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
pass
#no actions for the Queue
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | message)
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | message)
def
outputTrace
(
self
,
message
):
def
outputTrace
(
self
,
message
):
from
Globals
import
G
from
Globals
import
G
...
@@ -212,11 +195,3 @@ class Queue(Process):
...
@@ -212,11 +195,3 @@ class Queue(Process):
G
.
traceIndex
=
0
G
.
traceIndex
=
0
G
.
sheetIndex
+=
1
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#outputs data to "output.xls"
def
outputResultsXL
(
self
,
MaxSimtime
):
pass
#outputs results to JSON File
def
outputResultsJSON
(
self
):
pass
\ No newline at end of file
dream/simulation/Repairman.py
View file @
8e47f2ba
...
@@ -26,12 +26,13 @@ Created on 14 Nov 2012
...
@@ -26,12 +26,13 @@ Created on 14 Nov 2012
models a repairman that can fix a machine when it gets failures
models a repairman that can fix a machine when it gets failures
'''
'''
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
Resource
import
xlwt
import
xlwt
import
scipy.stats
as
stat
import
scipy.stats
as
stat
from
ObjectResource
import
ObjectResource
#the resource that repairs the machines
#the resource that repairs the machines
class
Repairman
(
object
):
class
Repairman
(
ObjectResource
):
def
__init__
(
self
,
id
,
name
,
capacity
):
def
__init__
(
self
,
id
,
name
,
capacity
):
self
.
id
=
id
self
.
id
=
id
...
@@ -43,15 +44,8 @@ class Repairman(object):
...
@@ -43,15 +44,8 @@ class Repairman(object):
self
.
Waiting
=
[]
self
.
Waiting
=
[]
self
.
Working
=
[]
self
.
Working
=
[]
def
initialize
(
self
):
self
.
coreObjectIds
=
[]
#list with the coreObjects that the repairman repairs
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
timeLastRepairStarted
=
0
#holds the time that the last repair was started
self
.
Res
=
Resource
(
self
.
capacity
)
#checks if the worker is available
def
checkIfWorkerIsAvailable
(
self
):
return
len
(
self
.
W
.
activeQ
)
<
self
.
capacity
#actions to be taken after the simulation ends
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
def
postProcessing
(
self
,
MaxSimtime
):
...
@@ -140,13 +134,5 @@ class Repairman(object):
...
@@ -140,13 +134,5 @@ class Repairman(object):
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'avg'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
json
[
'results'
][
'waiting_ratio'
][
'max'
]
=
self
.
Waiting
[
0
]
G
.
outputJSON
[
'
coreObjec
t'
].
append
(
json
)
G
.
outputJSON
[
'
elementLis
t'
].
append
(
json
)
#takes the array and checks if all its values are identical (returns false) or not (returns true)
#needed because if somebody runs multiple runs in deterministic case it would crash!
def
checkIfArrayHasDifValues
(
self
,
array
):
difValuesFlag
=
False
for
i
in
range
(
1
,
len
(
array
)):
if
(
array
[
i
]
!=
array
[
1
]):
difValuesFlag
=
True
return
difValuesFlag
\ No newline at end of file
dream/simulation/Source.py
View file @
8e47f2ba
...
@@ -29,9 +29,10 @@ models the source object that generates the entities
...
@@ -29,9 +29,10 @@ models the source object that generates the entities
from
SimPy.Simulation
import
*
from
SimPy.Simulation
import
*
from
Part
import
Part
from
Part
import
Part
from
RandomNumberGenerator
import
RandomNumberGenerator
from
RandomNumberGenerator
import
RandomNumberGenerator
from
CoreObject
import
CoreObject
#The Source object is a Process
#The Source object is a Process
class
Source
(
Process
):
class
Source
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
dist
,
time
,
item
):
def
__init__
(
self
,
id
,
name
,
dist
,
time
,
item
):
Process
.
__init__
(
self
)
Process
.
__init__
(
self
)
self
.
id
=
id
self
.
id
=
id
...
@@ -123,21 +124,6 @@ class Source(Process):
...
@@ -123,21 +124,6 @@ class Source(Process):
def
defineRouting
(
self
,
n
):
def
defineRouting
(
self
,
n
):
self
.
next
=
n
self
.
next
=
n
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
):
pass
#no actions for the Source
#checks if the Source can dispose an entity to the following object
def
haveToDispose
(
self
):
#return self.waitToDispose
return
len
(
self
.
Res
.
activeQ
)
>
0
#removes an entity from the Source
def
removeEntity
(
self
):
self
.
Res
.
activeQ
.
pop
(
0
)
#if(len(self.Res.activeQ)==0):
#self.waitToDispose=False
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | "generated")
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | "generated")
def
outputTrace
(
self
,
message
):
def
outputTrace
(
self
,
message
):
from
Globals
import
G
from
Globals
import
G
...
@@ -153,11 +139,3 @@ class Source(Process):
...
@@ -153,11 +139,3 @@ class Source(Process):
G
.
traceIndex
=
0
G
.
traceIndex
=
0
G
.
sheetIndex
+=
1
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#outputs data to "output.xls"
def
outputResultsXL
(
self
,
MaxSimtime
):
pass
#outputs results to JSON File
def
outputResultsJSON
(
self
):
pass
dream/simulation/documents/ClassHierarchy.png
0 → 100644
View file @
8e47f2ba
50.2 KB
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