|
|
@ -259,11 +259,13 @@ namespace storm { |
|
|
|
virtual void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const = 0; |
|
|
|
|
|
|
|
virtual void extendSpareModule(std::set<size_t>& elementsInSpareModule) const override { |
|
|
|
DFTElement<ValueType>::extendSpareModule(elementsInSpareModule); |
|
|
|
for(auto const& child : mChildren) { |
|
|
|
if(elementsInSpareModule.count(child->id()) == 0) { |
|
|
|
elementsInSpareModule.insert(child->id()); |
|
|
|
child->extendSpareModule(elementsInSpareModule); |
|
|
|
if (!this->isSpareGate()) { |
|
|
|
DFTElement<ValueType>::extendSpareModule(elementsInSpareModule); |
|
|
|
for( auto const& child : mChildren) { |
|
|
|
if(elementsInSpareModule.count(child->id()) == 0) { |
|
|
|
elementsInSpareModule.insert(child->id()); |
|
|
|
child->extendSpareModule(elementsInSpareModule); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -350,6 +352,10 @@ namespace storm { |
|
|
|
} |
|
|
|
} |
|
|
|
state.setFailed(this->mId); |
|
|
|
if (this->isSpareGate()) { |
|
|
|
this->finalizeSpare(state); |
|
|
|
} |
|
|
|
this->childrenDontCare(state, queues); |
|
|
|
} |
|
|
|
|
|
|
|
void failsafe(DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const { |
|
|
@ -359,12 +365,30 @@ namespace storm { |
|
|
|
} |
|
|
|
} |
|
|
|
state.setFailsafe(this->mId); |
|
|
|
if (this->isSpareGate()) { |
|
|
|
this->finalizeSpare(state); |
|
|
|
} |
|
|
|
this->childrenDontCare(state, queues); |
|
|
|
} |
|
|
|
|
|
|
|
void childrenDontCare(DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const { |
|
|
|
queues.propagateDontCare(mChildren); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Finish failed/failsafe spare gate by activating the children and setting the useIndex to zero. |
|
|
|
* This prevents multiple fail states with different usages or activations. |
|
|
|
* @param state The current state. |
|
|
|
*/ |
|
|
|
void finalizeSpare(DFTState<ValueType>& state) const { |
|
|
|
state.setUses(this->mId, 0); |
|
|
|
for (auto child : this->children()) { |
|
|
|
if (!state.isActive(child->id())) { |
|
|
|
state.activate(child->id()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool hasFailsafeChild(DFTState<ValueType>& state) const { |
|
|
|
for(auto const& child : mChildren) { |
|
|
|
if(state.isFailsafe(child->id())) |
|
|
@ -726,60 +750,6 @@ namespace storm { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
class DFTSeqAnd : public DFTGate<ValueType> { |
|
|
|
|
|
|
|
public: |
|
|
|
DFTSeqAnd(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : |
|
|
|
DFTGate<ValueType>(id, name, children) |
|
|
|
{} |
|
|
|
|
|
|
|
void checkFails(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const { |
|
|
|
if(!state.hasFailed(this->mId)) { |
|
|
|
bool childOperationalBefore = false; |
|
|
|
for(auto const& child : this->mChildren) |
|
|
|
{ |
|
|
|
if(!state.hasFailed(child->id())) { |
|
|
|
childOperationalBefore = true; |
|
|
|
} |
|
|
|
else { |
|
|
|
if(childOperationalBefore) { |
|
|
|
state.markAsInvalid(); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(!childOperationalBefore) { |
|
|
|
fail(state, queues); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const{ |
|
|
|
assert(hasFailsafeChild(state)); |
|
|
|
if(state.isOperational(this->mId)) { |
|
|
|
failsafe(state, queues); |
|
|
|
//return true; |
|
|
|
} |
|
|
|
//return false; |
|
|
|
} |
|
|
|
|
|
|
|
virtual DFTElementType type() const override { |
|
|
|
return DFTElementType::SEQAND; |
|
|
|
} |
|
|
|
|
|
|
|
std::string typestring() const override { |
|
|
|
return "SEQAND"; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
inline std::ostream& operator<<(std::ostream& os, DFTSeqAnd<ValueType> const& gate) { |
|
|
|
return os << gate.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
class DFTPand : public DFTGate<ValueType> { |
|
|
|