Matthias Volk
6 years ago
8 changed files with 134 additions and 59 deletions
-
5src/storm-dft/builder/DFTBuilder.cpp
-
2src/storm-dft/parser/DFTGalileoParser.cpp
-
2src/storm-dft/parser/DFTJsonParser.cpp
-
3src/storm-dft/storage/dft/DFTElements.h
-
5src/storm-dft/storage/dft/DftJsonExporter.cpp
-
61src/storm-dft/storage/dft/elements/DFTMutex.h
-
56src/storm-dft/storage/dft/elements/DFTRestriction.h
-
59src/storm-dft/storage/dft/elements/DFTSeq.h
@ -0,0 +1,61 @@ |
|||
#pragma once |
|||
|
|||
#include "DFTRestriction.h" |
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
|
|||
/*! |
|||
* Mutex restriction (MUTEX). |
|||
* Only one of the children can fail. |
|||
* A child which has failed prevents the failure of all other children. |
|||
*/ |
|||
template<typename ValueType> |
|||
class DFTMutex : public DFTRestriction<ValueType> { |
|||
|
|||
public: |
|||
/*! |
|||
* Constructor. |
|||
* @param id Id. |
|||
* @param name Name. |
|||
* @param children Children. |
|||
*/ |
|||
DFTMutex(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : DFTRestriction<ValueType>(id, name, children) { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
DFTElementType type() const override { |
|||
return DFTElementType::MUTEX; |
|||
} |
|||
|
|||
bool isSeqEnforcer() const override { |
|||
return true; |
|||
} |
|||
|
|||
void checkFails(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
STORM_LOG_ASSERT(queues.failurePropagationDone(), "Failure propagation not finished."); |
|||
bool childFailed = false; |
|||
for (auto const& child : this->children()) { |
|||
if (state.hasFailed(child->id())) { |
|||
if (childFailed) { |
|||
// Two children have failed |
|||
this->fail(state, queues); |
|||
return; |
|||
} else { |
|||
childFailed = true; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
} |
|||
|
|||
bool checkDontCareAnymore(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
// Actually, it doesnt matter what we return here.. |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
} |
|||
} |
@ -0,0 +1,59 @@ |
|||
#pragma once |
|||
|
|||
#include "DFTRestriction.h" |
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
|
|||
/*! |
|||
* Sequence enforcer (SEQ). |
|||
* All children can only fail in order from first to last child. |
|||
* A child which has not failed yet prevents the failure of all children to the right of it. |
|||
*/ |
|||
template<typename ValueType> |
|||
class DFTSeq : public DFTRestriction<ValueType> { |
|||
|
|||
public: |
|||
/*! |
|||
* Constructor. |
|||
* @param id Id. |
|||
* @param name Name. |
|||
* @param children Children. |
|||
*/ |
|||
DFTSeq(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : DFTRestriction<ValueType>(id, name, children) { |
|||
// Intentionally left empty. |
|||
} |
|||
|
|||
DFTElementType type() const override { |
|||
return DFTElementType::SEQ; |
|||
} |
|||
|
|||
bool isSeqEnforcer() const override { |
|||
return true; |
|||
} |
|||
|
|||
void checkFails(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
STORM_LOG_ASSERT(queues.failurePropagationDone(), "Failure propagation not finished."); |
|||
bool childOperationalBefore = false; |
|||
for (auto const& child : this->children()) { |
|||
if (!state.hasFailed(child->id())) { |
|||
childOperationalBefore = true; |
|||
} else if (childOperationalBefore && state.hasFailed(child->id())) { |
|||
// Child has failed before left sibling. |
|||
this->fail(state, queues); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
|
|||
void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
} |
|||
|
|||
bool checkDontCareAnymore(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
// Actually, it doesnt matter what we return here.. |
|||
return false; |
|||
} |
|||
}; |
|||
|
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue