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
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'
,
waitOnTie
=
False
,
**
kw
):
ObjectInterruption
.
__init__
(
self
,
id
,
name
,
victim
=
victim
)
if
distribution
:
self
.
distType
=
distribution
.
get
(
'distributionType'
,
'No'
)
# the distribution that the failure duration follows
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
.
rngTTF
=
RandomNumberGenerator
(
self
,
distribution
.
get
(
'TTF'
,{
'Fixed'
:{
'mean'
:
100
}}))
self
.
rngTTR
=
RandomNumberGenerator
(
self
,
distribution
.
get
(
'TTR'
,{
'Fixed'
:{
'mean'
:
10
}}))
self
.
name
=
"F"
+
str
(
index
)
self
.
repairman
=
repairman
# the resource that may be needed to fix the failure
# if now resource is needed this will be "None"
self
.
type
=
"Failure"
# shows how the time to failure is measured
# 'constant' means it counts not matter the state of the victim
# 'onShift' counts only if the victim is onShift
# 'working' counts only working time
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
self
.
offshift
=
offshift
# 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():
SM
=
ScheduledMaintenance
(
victim
=
victim
,
start
=
start
,
duration
=
duration
)
G
.
ObjectInterruptionList
.
append
(
SM
)
G
.
ScheduledMaintenanceList
.
append
(
SM
)
failure
=
element
.
get
(
'
failures
'
,
None
)
failure
=
element
.
get
(
'
interruptions'
,{}).
get
(
'failure
'
,
None
)
# if there are failures assigned
# initiate them
if
failure
:
distributionType
=
failure
.
get
(
'distributionType'
,
'No'
)
if
distributionType
==
'No'
:
pass
else
:
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
deteriorationType
=
failure
.
get
(
'deteriorationType'
,
'constant'
)
waitOnTie
=
failure
.
get
(
'waitOnTie'
,
False
)
F
=
Failure
(
victim
=
victim
,
distribution
=
failure
,
repairman
=
victim
.
repairman
,
deteriorationType
=
deteriorationType
,
waitOnTie
=
waitOnTie
)
G
.
ObjectInterruptionList
.
append
(
F
)
G
.
FailureList
.
append
(
F
)
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
deteriorationType
=
failure
.
get
(
'deteriorationType'
,
'constant'
)
waitOnTie
=
failure
.
get
(
'waitOnTie'
,
False
)
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
# initiate them
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