28 changed files with 635 additions and 385 deletions
-
22src/storm-dft/builder/DFTBuilder.cpp
-
4src/storm-dft/builder/DFTBuilder.h
-
22src/storm-dft/builder/ExplicitDFTModelBuilder.cpp
-
16src/storm-dft/generator/DftNextStateGenerator.cpp
-
8src/storm-dft/modelchecker/dft/DFTASFChecker.cpp
-
13src/storm-dft/parser/DFTJsonParser.cpp
-
25src/storm-dft/storage/dft/DFT.cpp
-
15src/storm-dft/storage/dft/DFT.h
-
68src/storm-dft/storage/dft/DFTElementType.h
-
3src/storm-dft/storage/dft/DFTElements.h
-
81src/storm-dft/storage/dft/DFTIsomorphism.h
-
52src/storm-dft/storage/dft/DFTState.cpp
-
26src/storm-dft/storage/dft/DftJsonExporter.cpp
-
61src/storm-dft/storage/dft/elements/BEConst.h
-
103src/storm-dft/storage/dft/elements/BEExponential.h
-
6src/storm-dft/storage/dft/elements/DFTAnd.h
-
125src/storm-dft/storage/dft/elements/DFTBE.h
-
58src/storm-dft/storage/dft/elements/DFTConst.h
-
10src/storm-dft/storage/dft/elements/DFTDependency.h
-
102src/storm-dft/storage/dft/elements/DFTElement.h
-
4src/storm-dft/storage/dft/elements/DFTOr.h
-
5src/storm-dft/storage/dft/elements/DFTPand.h
-
5src/storm-dft/storage/dft/elements/DFTPor.h
-
30src/storm-dft/storage/dft/elements/DFTRestriction.h
-
1src/storm-dft/storage/dft/elements/DFTSpare.h
-
5src/storm-dft/storage/dft/elements/DFTVot.h
-
53src/storm-dft/transformations/DftToGspnTransformator.cpp
-
19src/storm-dft/transformations/DftToGspnTransformator.h
@ -0,0 +1,61 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "DFTBE.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace storage { |
||||
|
|
||||
|
/*! |
||||
|
* BE which is either constant failed or constant failsafe. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
class BEConst : public DFTBE<ValueType> { |
||||
|
|
||||
|
public: |
||||
|
/*! |
||||
|
* Constructor. |
||||
|
* @param id Id. |
||||
|
* @param name Name. |
||||
|
* @param failed True iff the const BE is failed, otherwise it is failsafe. |
||||
|
*/ |
||||
|
BEConst(size_t id, std::string const& name, bool failed) : DFTBE<ValueType>(id, name), mFailed(failed) { |
||||
|
// Intentionally empty |
||||
|
} |
||||
|
|
||||
|
DFTElementType type() const override { |
||||
|
return DFTElementType::BE_CONST; |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Return whether the BE has failed. |
||||
|
* @return True iff the BE is const failed. |
||||
|
*/ |
||||
|
bool failed() const { |
||||
|
return mFailed; |
||||
|
} |
||||
|
|
||||
|
bool canFail() const override { |
||||
|
return this->failed(); |
||||
|
} |
||||
|
|
||||
|
bool isTypeEqualTo(DFTElement <ValueType> const& other) const override { |
||||
|
if (!DFTElement<ValueType>::isTypeEqualTo(other)) { |
||||
|
return false; |
||||
|
} |
||||
|
auto& otherBE = static_cast<BEConst<ValueType> const&>(other); |
||||
|
return this->failed() == otherBE.failed(); |
||||
|
} |
||||
|
|
||||
|
std::string toString() const override { |
||||
|
std::stringstream stream; |
||||
|
stream << "{" << this->name() << "} BE(const " << (this->failed() ? "failed" : "failsafe") << ")"; |
||||
|
return stream.str(); |
||||
|
} |
||||
|
|
||||
|
private: |
||||
|
bool mFailed; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,103 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "DFTBE.h" |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace storage { |
||||
|
|
||||
|
/*! |
||||
|
* BE with exponential failure rate. |
||||
|
*/ |
||||
|
template<typename ValueType> |
||||
|
class BEExponential : public DFTBE<ValueType> { |
||||
|
|
||||
|
public: |
||||
|
/*! |
||||
|
* Constructor. |
||||
|
* @param id Id. |
||||
|
* @param name Name. |
||||
|
* @param failureRate Active failure rate. |
||||
|
* @param dormancyFactor Dormancy factor. |
||||
|
* @param transient True iff the BE experiences transient failures. |
||||
|
*/ |
||||
|
BEExponential(size_t id, std::string const& name, ValueType failureRate, ValueType dormancyFactor, bool transient = false) : |
||||
|
DFTBE<ValueType>(id, name), mActiveFailureRate(failureRate), mPassiveFailureRate(dormancyFactor * failureRate), mTransient(transient) { |
||||
|
STORM_LOG_ASSERT(!storm::utility::isZero<ValueType>(failureRate), "Exponential failure rate should not be zero."); |
||||
|
} |
||||
|
|
||||
|
DFTElementType type() const override { |
||||
|
return DFTElementType::BE_EXP; |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Return failure rate in active state. |
||||
|
* @return Active failure rate. |
||||
|
*/ |
||||
|
ValueType const& activeFailureRate() const { |
||||
|
return mActiveFailureRate; |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Return failure rate in passive state. |
||||
|
* @return Passive failure rate. |
||||
|
*/ |
||||
|
ValueType const& passiveFailureRate() const { |
||||
|
return mPassiveFailureRate; |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Return dormancy factor given by passive_failure_rate/active_failure_rate. |
||||
|
* @return Dormancy factor. |
||||
|
*/ |
||||
|
ValueType dormancyFactor() const { |
||||
|
if (storm::utility::isZero<ValueType>(this->activeFailureRate())) { |
||||
|
// Return default value of 1 |
||||
|
return storm::utility::one<ValueType>(); |
||||
|
} else { |
||||
|
return this->passiveFailureRate() / this->activeFailureRate(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Return whether the BE experiences transient failures. |
||||
|
* @return True iff BE is transient. |
||||
|
*/ |
||||
|
bool isTransient() const { |
||||
|
return mTransient; |
||||
|
} |
||||
|
|
||||
|
bool canFail() const override { |
||||
|
return !storm::utility::isZero(this->activeFailureRate()); |
||||
|
} |
||||
|
|
||||
|
/*! |
||||
|
* Return whether the BE is a cold BE, i.e., passive failure rate = 0. |
||||
|
* @return True iff BE is cold BE. |
||||
|
*/ |
||||
|
bool isColdBasicElement() const { |
||||
|
return storm::utility::isZero(this->passiveFailureRate()); |
||||
|
} |
||||
|
|
||||
|
bool isTypeEqualTo(DFTElement <ValueType> const& other) const override { |
||||
|
if (!DFTElement<ValueType>::isTypeEqualTo(other)) { |
||||
|
return false; |
||||
|
} |
||||
|
auto& otherBE = static_cast<BEExponential<ValueType> const&>(other); |
||||
|
return (this->activeFailureRate() == otherBE.activeFailureRate()) && (this->passiveFailureRate() == otherBE.passiveFailureRate()); |
||||
|
} |
||||
|
|
||||
|
std::string toString() const override { |
||||
|
std::stringstream stream; |
||||
|
stream << "{" << this->name() << "} BE exp(" << this->activeFailureRate() << ", " << this->passiveFailureRate() << ")"; |
||||
|
return stream.str(); |
||||
|
} |
||||
|
|
||||
|
private: |
||||
|
ValueType mActiveFailureRate; |
||||
|
ValueType mPassiveFailureRate; |
||||
|
bool mTransient; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
@ -1,58 +0,0 @@ |
|||||
#pragma once |
|
||||
|
|
||||
|
|
||||
#include "DFTElement.h" |
|
||||
namespace storm { |
|
||||
namespace storage { |
|
||||
template<typename ValueType> |
|
||||
class DFTConst : public DFTElement<ValueType> { |
|
||||
|
|
||||
bool mFailed; |
|
||||
|
|
||||
public: |
|
||||
DFTConst(size_t id, std::string const& name, bool failed) : |
|
||||
DFTElement<ValueType>(id, name), mFailed(failed) |
|
||||
{} |
|
||||
|
|
||||
DFTElementType type() const override { |
|
||||
if(mFailed) { |
|
||||
return DFTElementType::CONSTF; |
|
||||
} else { |
|
||||
return DFTElementType::CONSTS; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
bool failed() const { |
|
||||
return mFailed; |
|
||||
} |
|
||||
|
|
||||
virtual bool isConstant() const override { |
|
||||
return true; |
|
||||
} |
|
||||
|
|
||||
virtual size_t nrChildren() const override { |
|
||||
return 0; |
|
||||
} |
|
||||
|
|
||||
std::string toString() const override { |
|
||||
std::stringstream stream; |
|
||||
stream << *this; |
|
||||
return stream.str(); |
|
||||
} |
|
||||
|
|
||||
bool isTypeEqualTo(DFTElement<ValueType> const& other) const override { |
|
||||
if(!DFTElement<ValueType>::isTypeEqualTo(other)) return false; |
|
||||
DFTConst<ValueType> const& otherCNST = static_cast<DFTConst<ValueType> const&>(other); |
|
||||
return (mFailed == otherCNST.mFailed); |
|
||||
} |
|
||||
|
|
||||
}; |
|
||||
|
|
||||
template<typename ValueType> |
|
||||
inline std::ostream& operator<<(std::ostream& os, DFTConst<ValueType> const& be) { |
|
||||
return os << "{" << be.name() << "} BE(const " << (be.failed() ? "failed" : "failsafe") << ")"; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue