Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BEErlang.cpp
Go to the documentation of this file.
1#include "BEErlang.h"
2
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
9template<>
10double BEErlang<double>::getUnreliability(double time) const {
11 // 1 - \sum_{n=0}^{k-1} 1/n! * e^(-lambda * t) * (lambda * t)^n
12 // where lambda is the rate and k the number of phases
13 double res = 1;
14 double factorFactorial = 1;
15 double factorExp = std::exp(-this->activeFailureRate() * time);
16 double factorPow = 1;
17 for (unsigned i = 0; i <= this->phases() - 1; ++i) {
18 if (i > 0) {
19 factorFactorial /= i;
20 factorPow *= this->activeFailureRate() * time;
21 }
22 res -= factorFactorial * factorExp * factorPow;
23 }
24 return res;
25}
26
27template<typename ValueType>
28ValueType BEErlang<ValueType>::getUnreliability(ValueType time) const {
29 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Computing cumulative failure probability not supported for this data type.");
30}
31
32// Explicitly instantiate the class.
33template class BEErlang<double>;
34template class BEErlang<RationalFunction>;
35
36} // namespace elements
37} // namespace storage
38} // namespace storm::dft
BE with Erlang failure distribution.
Definition BEErlang.h:13
ValueType getUnreliability(ValueType time) const override
Return the unreliability of the BE up to the given time point.
Definition BEErlang.cpp:28
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30