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
c7d7da94
Commit
c7d7da94
authored
Feb 28, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instanciate BatchScrapMachine the new way
parent
75543fda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
14 deletions
+7
-14
dream/simulation/BatchScrapMachine.py
dream/simulation/BatchScrapMachine.py
+5
-7
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+2
-7
No files found.
dream/simulation/BatchScrapMachine.py
View file @
c7d7da94
...
...
@@ -40,21 +40,20 @@ class BatchScrapMachine(Machine):
# have to find which distribution returns random integers - Discrete distribution
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
\
processingTime
=
None
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
\
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
,
\
scrapDistribution
=
'Fixed'
,
scrMean
=
1
,
scrStdev
=
0
,
scrMin
=
0
,
scrMax
=
10
,
**
kw
):
if
not
processingTime
:
print
"TODO"
processingTime
=
{
'distribution'
:
'Fixed'
,
'mean'
:
1
}
# initialize using the default method of the object
Machine
.
__init__
(
self
,
id
=
id
,
name
=
name
,
\
capacity
=
capacity
,
\
processingTime
=
dict
(
distributionType
=
distribution
,
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
,),
processingTime
=
processingTime
,
failureDistribution
=
failureDistribution
,
MTTF
=
MTTF
,
MTTR
=
MTTR
,
\
availability
=
availability
,
repairman
=
repairman
,
**
kw
)
self
.
scrapDistType
=
scrapDistribution
#the distribution that the failure follows
# Sets the attributes of the scrap quantity distribution
self
.
scrapRng
=
RandomNumberGenerator
(
self
,
self
.
scrapDistType
)
...
...
@@ -62,8 +61,7 @@ class BatchScrapMachine(Machine):
self
.
scrapRng
.
stdev
=
scrStdev
self
.
scrapRng
.
min
=
scrMin
self
.
scrapRng
.
max
=
scrMax
def
removeEntity
(
self
,
entity
=
None
):
activeEntity
=
Machine
.
removeEntity
(
self
,
entity
)
scrapQuantity
=
self
.
scrapRng
.
generateNumber
()
...
...
dream/simulation/LineGenerationJSON.py
View file @
c7d7da94
...
...
@@ -352,11 +352,6 @@ def createObjects():
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
processingTime
=
element
.
get
(
'processingTime'
,{})
distributionType
=
processingTime
.
get
(
'distributionType'
,
'not found'
)
mean
=
float
(
processingTime
.
get
(
'mean'
)
or
0
)
stdev
=
float
(
processingTime
.
get
(
'stdev'
)
or
0
)
min
=
float
(
processingTime
.
get
(
'min'
)
or
0
)
max
=
float
(
processingTime
.
get
(
'max'
)
or
mean
+
5
*
stdev
)
scrapQuantity
=
element
.
get
(
'scrapQuantity'
,
{})
scrapDistributionType
=
scrapQuantity
.
get
(
'distributionType'
,
'not found'
)
scrMean
=
int
(
scrapQuantity
.
get
(
'mean'
)
or
0
)
...
...
@@ -373,9 +368,9 @@ def createObjects():
if
(
id
in
repairman
.
coreObjectIds
):
# (if any) is assigned to repair
r
=
repairman
# the machine with ID equal to id
M
=
BatchScrapMachine
(
id
,
name
,
1
,
distribution
=
distributionType
,
failureDistribution
=
failureDistribution
,
M
=
BatchScrapMachine
(
id
,
name
,
1
,
processingTime
,
failureDistribution
=
failureDistribution
,
MTTF
=
MTTF
,
MTTR
=
MTTR
,
availability
=
availability
,
repairman
=
r
,
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
,
scrMean
=
scrMean
,
scrMean
=
scrMean
,
scrStdev
=
scrStdev
,
scrMin
=
scrMin
,
scrMax
=
scrMax
)
M
.
nextIds
=
getSuccessorList
(
id
)
# update the nextIDs list of the machine
G
.
MachineList
.
append
(
M
)
# add machine to global MachineList
...
...
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