Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BEExponential.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 BEExponential : public DFTBE<ValueType> {
14 public:
23 BEExponential(size_t id, std::string const& name, ValueType failureRate, ValueType dormancyFactor, bool transient = false)
24 : DFTBE<ValueType>(id, name), mActiveFailureRate(failureRate), mPassiveFailureRate(dormancyFactor * failureRate), mTransient(transient) {
25 STORM_LOG_ASSERT(!storm::utility::isZero<ValueType>(failureRate), "Exponential failure rate should not be zero.");
26 }
27
28 std::shared_ptr<DFTElement<ValueType>> clone() const override {
29 return std::shared_ptr<DFTElement<ValueType>>(
30 new BEExponential<ValueType>(this->id(), this->name(), this->activeFailureRate(), this->dormancyFactor(), this->isTransient()));
31 }
32
36
41 ValueType const& activeFailureRate() const {
42 return mActiveFailureRate;
43 }
44
49 ValueType const& passiveFailureRate() const {
50 return mPassiveFailureRate;
51 }
52
57 ValueType dormancyFactor() const {
58 STORM_LOG_ASSERT(!storm::utility::isZero<ValueType>(this->activeFailureRate()), "Active failure rate should not be zero.");
59 return this->passiveFailureRate() / this->activeFailureRate();
60 }
61
62 ValueType getUnreliability(ValueType time) const override;
63
68 bool isTransient() const {
69 return mTransient;
70 }
71
72 bool canFail() const override {
73 STORM_LOG_ASSERT(!storm::utility::isZero(this->activeFailureRate()), "BE EXP should have failure rate > 0.");
74 return true;
75 }
76
81 bool isColdBasicElement() const {
83 }
84
85 std::string distributionString() const override {
86 std::stringstream stream;
87 stream << "exp " << this->activeFailureRate() << ", " << this->passiveFailureRate();
88 return stream.str();
89 }
90
91 private:
92 ValueType mActiveFailureRate;
93 ValueType mPassiveFailureRate;
94 bool mTransient;
95};
96
97} // namespace elements
98} // namespace storage
99} // namespace storm::dft
BE with exponential failure distribution.
std::string distributionString() const override
Print information about failure distribution to string.
std::shared_ptr< DFTElement< ValueType > > clone() const override
Create a shallow copy of the element.
ValueType const & passiveFailureRate() const
Return failure rate in passive state.
ValueType const & activeFailureRate() const
Return failure rate in active state.
ValueType getUnreliability(ValueType time) const override
Return the unreliability of the BE up to the given time point.
bool canFail() const override
Return whether the BE can fail.
bool isColdBasicElement() const
Return whether the BE is a cold BE, i.e., passive failure rate = 0.
BEExponential(size_t id, std::string const &name, ValueType failureRate, ValueType dormancyFactor, bool transient=false)
Constructor.
storm::dft::storage::elements::BEType beType() const override
Get type of BE (constant, exponential, etc.).
bool isTransient() const
Return whether the BE experiences transient failures.
ValueType dormancyFactor() const
Return dormancy factor given by passive_failure_rate / active_failure_rate.
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