Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BEErlang.h
Go to the documentation of this file.
1#pragma once
2
3#include "DFTBE.h"
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
12template<typename ValueType>
13class BEErlang : public DFTBE<ValueType> {
14 public:
23 BEErlang(size_t id, std::string const& name, ValueType failureRate, unsigned phases, ValueType dormancyFactor)
24 : DFTBE<ValueType>(id, name), mActiveFailureRate(failureRate), mPassiveFailureRate(dormancyFactor * failureRate), mPhases(phases) {
25 // Intentionally empty
26 }
27
28 std::shared_ptr<DFTElement<ValueType>> clone() const override {
29 return std::shared_ptr<DFTElement<ValueType>>(
30 new BEErlang<ValueType>(this->id(), this->name(), this->activeFailureRate(), this->phases(), this->dormancyFactor()));
31 }
32
36
37 bool canFail() const override {
38 STORM_LOG_ASSERT(!storm::utility::isZero(this->activeFailureRate()), "BE ERLANG should have failure rate > 0.");
39 return true;
40 }
41
46 ValueType const& activeFailureRate() const {
47 return mActiveFailureRate;
48 }
49
54 ValueType const& passiveFailureRate() const {
55 return mPassiveFailureRate;
56 }
57
62 unsigned phases() const {
63 return mPhases;
64 }
65
70 ValueType dormancyFactor() const {
71 STORM_LOG_ASSERT(!storm::utility::isZero<ValueType>(this->activeFailureRate()), "Active failure rate should not be zero.");
72 return this->passiveFailureRate() / this->activeFailureRate();
73 }
74
75 ValueType getUnreliability(ValueType time) const override;
76
77 std::string distributionString() const override {
78 std::stringstream stream;
79 stream << "erlang " << this->phases() << " phases with " << this->activeFailureRate() << ", " << this->passiveFailureRate();
80 return stream.str();
81 }
82
83 private:
84 ValueType mActiveFailureRate;
85 ValueType mPassiveFailureRate;
86 unsigned mPhases;
87};
88
89} // namespace elements
90} // namespace storage
91} // namespace storm::dft
BE with Erlang failure distribution.
Definition BEErlang.h:13
BEErlang(size_t id, std::string const &name, ValueType failureRate, unsigned phases, ValueType dormancyFactor)
Constructor.
Definition BEErlang.h:23
ValueType getUnreliability(ValueType time) const override
Return the unreliability of the BE up to the given time point.
Definition BEErlang.cpp:28
ValueType const & passiveFailureRate() const
Return failure probability in passive state.
Definition BEErlang.h:54
ValueType const & activeFailureRate() const
Return failure probability in active state.
Definition BEErlang.h:46
std::string distributionString() const override
Print information about failure distribution to string.
Definition BEErlang.h:77
storm::dft::storage::elements::BEType beType() const override
Get type of BE (constant, exponential, etc.).
Definition BEErlang.h:33
bool canFail() const override
Return whether the BE can fail.
Definition BEErlang.h:37
ValueType dormancyFactor() const
Return dormancy factor given by passive_failure_rate / active_failure_rate.
Definition BEErlang.h:70
std::shared_ptr< DFTElement< ValueType > > clone() const override
Create a shallow copy of the element.
Definition BEErlang.h:28
unsigned phases() const
Return number of phases (also called the shape).
Definition BEErlang.h:62
Abstract base class for basic events (BEs) in DFTs.
Definition DFTBE.h:14
virtual size_t id() const
Get id.
Definition DFTElement.h:73
virtual std::string const & name() const
Get name.
Definition DFTElement.h:89
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
bool isZero(ValueType const &a)
Definition constants.cpp:41