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
b5a77558
Commit
b5a77558
authored
Dec 22, 2014
by
Georgios Dagkakis
Committed by
Ioannis Papagiannopoulos
Jan 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Failure to read in new formay
parent
ae89be95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
52 deletions
+12
-52
dream/simulation/Failure.py
dream/simulation/Failure.py
+4
-40
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+8
-12
No files found.
dream/simulation/Failure.py
View file @
b5a77558
...
@@ -34,58 +34,22 @@ from ObjectInterruption import ObjectInterruption
...
@@ -34,58 +34,22 @@ from ObjectInterruption import ObjectInterruption
class
Failure
(
ObjectInterruption
):
class
Failure
(
ObjectInterruption
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
distribution
=
None
,
index
=
0
,
repairman
=
None
,
offshift
=
False
,
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
distribution
=
{}
,
index
=
0
,
repairman
=
None
,
offshift
=
False
,
deteriorationType
=
'constant'
,
deteriorationType
=
'constant'
,
waitOnTie
=
False
,
**
kw
):
waitOnTie
=
False
,
**
kw
):
ObjectInterruption
.
__init__
(
self
,
id
,
name
,
victim
=
victim
)
ObjectInterruption
.
__init__
(
self
,
id
,
name
,
victim
=
victim
)
if
distribution
:
self
.
rngTTF
=
RandomNumberGenerator
(
self
,
distribution
.
get
(
'TTF'
,{
'Fixed'
:{
'mean'
:
100
}}))
self
.
distType
=
distribution
.
get
(
'distributionType'
,
'No'
)
# the distribution that the failure duration follows
self
.
rngTTR
=
RandomNumberGenerator
(
self
,
distribution
.
get
(
'TTR'
,{
'Fixed'
:{
'mean'
:
10
}}))
self
.
MTTF
=
distribution
.
get
(
'MTTF'
,
60
)
# the MTTF
self
.
MTTR
=
distribution
.
get
(
'MTTR'
,
5
)
# the MTTR
self
.
availability
=
distribution
.
get
(
'availability'
,
100
)
# the availability
else
:
self
.
distType
=
'No'
self
.
MTTF
=
60
self
.
MTTR
=
5
self
.
availability
=
100
self
.
name
=
"F"
+
str
(
index
)
self
.
name
=
"F"
+
str
(
index
)
self
.
repairman
=
repairman
# the resource that may be needed to fix the failure
self
.
repairman
=
repairman
# the resource that may be needed to fix the failure
# if now resource is needed this will be "None"
# if now resource is needed this will be "None"
self
.
type
=
"Failure"
self
.
type
=
"Failure"
# shows how the time to failure is measured
# shows how the time to failure is measured
# 'constant' means it counts not matter the state of the victim
# 'constant' means it counts not matter the state of the victim
# 'onShift' counts only if the victim is onShift
# 'onShift' counts only if the victim is onShift
# 'working' counts only working time
# 'working' counts only working time
self
.
deteriorationType
=
deteriorationType
self
.
deteriorationType
=
deteriorationType
if
(
self
.
distType
==
"Availability"
):
# --------------------------------------------------------------
# the following are used if we have availability defined
# (as in plant) the erlang is a special case of Gamma.
# To model the Mu and sigma (that is given in plant)
# as alpha and beta for gamma you should do the following:
# beta=(sigma^2)/Mu
# alpha=Mu/beta
# --------------------------------------------------------------
self
.
AvailabilityMTTF
=
self
.
MTTR
*
(
float
(
availability
)
/
100
)
/
(
1
-
(
float
(
availability
)
/
100
))
self
.
sigma
=
0.707106781185547
*
self
.
MTTR
self
.
theta
=
(
pow
(
self
.
sigma
,
2
))
/
float
(
self
.
MTTR
)
self
.
beta
=
self
.
theta
self
.
alpha
=
(
float
(
self
.
MTTR
)
/
self
.
theta
)
self
.
rngTTF
=
RandomNumberGenerator
(
self
,
"Exp"
)
self
.
rngTTF
.
avg
=
self
.
AvailabilityMTTF
self
.
rngTTR
=
RandomNumberGenerator
(
self
,
"Erlang"
)
self
.
rngTTR
.
alpha
=
self
.
alpha
self
.
rngTTR
.
beta
=
self
.
beta
else
:
# --------------------------------------------------------------
# if the distribution is fixed
# --------------------------------------------------------------
self
.
rngTTF
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rngTTF
.
mean
=
self
.
MTTF
self
.
rngTTR
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rngTTR
.
mean
=
self
.
MTTR
# flag used to identify if the time between failures should be counted while the victim is off-shift
# flag used to identify if the time between failures should be counted while the victim is off-shift
self
.
offshift
=
offshift
self
.
offshift
=
offshift
# flag to show if the failure will wait on tie with other events before interrupting the victim
# flag to show if the failure will wait on tie with other events before interrupting the victim
...
...
dream/simulation/LineGenerationJSON.py
View file @
b5a77558
...
@@ -291,21 +291,17 @@ def createObjectInterruptions():
...
@@ -291,21 +291,17 @@ def createObjectInterruptions():
SM
=
ScheduledMaintenance
(
victim
=
victim
,
start
=
start
,
duration
=
duration
)
SM
=
ScheduledMaintenance
(
victim
=
victim
,
start
=
start
,
duration
=
duration
)
G
.
ObjectInterruptionList
.
append
(
SM
)
G
.
ObjectInterruptionList
.
append
(
SM
)
G
.
ScheduledMaintenanceList
.
append
(
SM
)
G
.
ScheduledMaintenanceList
.
append
(
SM
)
failure
=
element
.
get
(
'
failures
'
,
None
)
failure
=
element
.
get
(
'
interruptions'
,{}).
get
(
'failure
'
,
None
)
# if there are failures assigned
# if there are failures assigned
# initiate them
# initiate them
if
failure
:
if
failure
:
distributionType
=
failure
.
get
(
'distributionType'
,
'No'
)
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
if
distributionType
==
'No'
:
deteriorationType
=
failure
.
get
(
'deteriorationType'
,
'constant'
)
pass
waitOnTie
=
failure
.
get
(
'waitOnTie'
,
False
)
else
:
F
=
Failure
(
victim
=
victim
,
distribution
=
failure
,
repairman
=
victim
.
repairman
,
deteriorationType
=
deteriorationType
,
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
waitOnTie
=
waitOnTie
)
deteriorationType
=
failure
.
get
(
'deteriorationType'
,
'constant'
)
G
.
ObjectInterruptionList
.
append
(
F
)
waitOnTie
=
failure
.
get
(
'waitOnTie'
,
False
)
G
.
FailureList
.
append
(
F
)
F
=
Failure
(
victim
=
victim
,
distribution
=
failure
,
repairman
=
victim
.
repairman
,
deteriorationType
=
deteriorationType
,
waitOnTie
=
waitOnTie
)
G
.
ObjectInterruptionList
.
append
(
F
)
G
.
FailureList
.
append
(
F
)
# if there are periodic maintenances assigned
# if there are periodic maintenances assigned
# initiate them
# initiate them
periodicMaintenance
=
element
.
get
(
'periodicMaintenance'
,
None
)
periodicMaintenance
=
element
.
get
(
'periodicMaintenance'
,
None
)
...
...
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