Browse Source

Merge branch 'master' into prism-pomdp

main
Tim Quatmann 5 years ago
parent
commit
45f9c66602
  1. 1
      src/storm-dft-cli/storm-dft.cpp
  2. 18
      src/storm-dft/builder/ExplicitDFTModelBuilder.cpp
  3. 3
      src/storm-dft/storage/dft/elements/BEExponential.h
  4. 1
      src/storm/storage/BitVector.cpp

1
src/storm-dft-cli/storm-dft.cpp

@ -87,6 +87,7 @@ void processOptions() {
// Apply transformations // Apply transformations
// TODO transform later before actual analysis // TODO transform later before actual analysis
dft = storm::api::applyTransformations(*dft, faultTreeSettings.isUniqueFailedBE(), true); dft = storm::api::applyTransformations(*dft, faultTreeSettings.isUniqueFailedBE(), true);
STORM_LOG_DEBUG(dft->getElementsString());
dft->setDynamicBehaviorInfo(); dft->setDynamicBehaviorInfo();

18
src/storm-dft/builder/ExplicitDFTModelBuilder.cpp

@ -745,37 +745,35 @@ namespace storm {
storm::storage::BitVector coldBEs(subtree.size(), false); storm::storage::BitVector coldBEs(subtree.size(), false);
for (size_t i = 0; i < subtree.size(); ++i) { for (size_t i = 0; i < subtree.size(); ++i) {
size_t id = subtree[i]; size_t id = subtree[i];
// Consider only still operational BEs
if (state->isOperational(id)) { if (state->isOperational(id)) {
// Get BE rate
ValueType rate = state->getBERate(id);
if (storm::utility::isZero<ValueType>(rate)) {
// Get active failure rate for cold BE
auto be = dft.getBasicElement(id); auto be = dft.getBasicElement(id);
switch (be->type()) { switch (be->type()) {
case storm::storage::DFTElementType::BE_EXP: case storm::storage::DFTElementType::BE_EXP:
{ {
// Get BE rate
ValueType rate = state->getBERate(id);
if (storm::utility::isZero<ValueType>(rate)) {
// Get active failure rate for cold BE
auto beExp = std::static_pointer_cast<storm::storage::BEExponential<ValueType> const>(be); auto beExp = std::static_pointer_cast<storm::storage::BEExponential<ValueType> const>(be);
rate = beExp->activeFailureRate(); rate = beExp->activeFailureRate();
STORM_LOG_ASSERT(!storm::utility::isZero<ValueType>(rate), "Failure rate should not be zero."); STORM_LOG_ASSERT(!storm::utility::isZero<ValueType>(rate), "Failure rate should not be zero.");
// Mark BE as cold // Mark BE as cold
coldBEs.set(i, true); coldBEs.set(i, true);
}
rates.push_back(rate);
rateSum += rate;
break; break;
} }
case storm::storage::DFTElementType::BE_CONST: case storm::storage::DFTElementType::BE_CONST:
{
// Ignore BE which cannot fail // Ignore BE which cannot fail
continue; continue;
}
default: default:
STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "BE of type '" << be->type() << "' is not known."); STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "BE of type '" << be->type() << "' is not known.");
break; break;
} }
} }
rates.push_back(rate);
rateSum += rate;
} }
}
STORM_LOG_ASSERT(rates.size() > 0, "No rates failable"); STORM_LOG_ASSERT(rates.size() > 0, "No rates failable");
// Sort rates // Sort rates

3
src/storm-dft/storage/dft/elements/BEExponential.h

@ -67,7 +67,8 @@ namespace storm {
} }
bool canFail() const override { bool canFail() const override {
return !storm::utility::isZero(this->activeFailureRate());
STORM_LOG_ASSERT(!storm::utility::isZero(this->activeFailureRate()), "BEExp should have failure rate > 0");
return true;
} }
/*! /*!

1
src/storm/storage/BitVector.cpp

@ -156,6 +156,7 @@ namespace storm {
// Only perform the assignment if the source and target are not identical. // Only perform the assignment if the source and target are not identical.
if (this != &other) { if (this != &other) {
bitCount = other.bitCount; bitCount = other.bitCount;
other.bitCount = 0;
if (this->buckets) { if (this->buckets) {
delete[] this->buckets; delete[] this->buckets;
} }

Loading…
Cancel
Save