|
@ -20,6 +20,11 @@ namespace storm { |
|
|
return static_cast<DFTElementState>(getElementStateInt(id)); |
|
|
return static_cast<DFTElementState>(getElementStateInt(id)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
DFTDependencyState DFTState<ValueType>::getDependencyState(size_t id) const { |
|
|
|
|
|
return static_cast<DFTDependencyState>(getElementStateInt(id)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
template<typename ValueType> |
|
|
int DFTState<ValueType>::getElementStateInt(size_t id) const { |
|
|
int DFTState<ValueType>::getElementStateInt(size_t id) const { |
|
|
return mStatus.getAsInt(mDft.failureIndex(id), 2); |
|
|
return mStatus.getAsInt(mDft.failureIndex(id), 2); |
|
@ -55,6 +60,20 @@ namespace storm { |
|
|
return getElementState(id) == DFTElementState::DontCare; |
|
|
return getElementState(id) == DFTElementState::DontCare; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
bool DFTState<ValueType>::dependencyTriggered(size_t id) const { |
|
|
|
|
|
return getElementStateInt(id) > 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
bool DFTState<ValueType>::dependencySuccessful(size_t id) const { |
|
|
|
|
|
return mStatus[mDft.failureIndex(id)]; |
|
|
|
|
|
} |
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
bool DFTState<ValueType>::dependencyUnsuccessful(size_t id) const { |
|
|
|
|
|
return mStatus[mDft.failureIndex(id)+1]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
template<typename ValueType> |
|
|
void DFTState<ValueType>::setFailed(size_t id) { |
|
|
void DFTState<ValueType>::setFailed(size_t id) { |
|
|
mStatus.set(mDft.failureIndex(id)); |
|
|
mStatus.set(mDft.failureIndex(id)); |
|
@ -70,6 +89,16 @@ namespace storm { |
|
|
mStatus.setFromInt(mDft.failureIndex(id), 2, static_cast<uint_fast64_t>(DFTElementState::DontCare) ); |
|
|
mStatus.setFromInt(mDft.failureIndex(id), 2, static_cast<uint_fast64_t>(DFTElementState::DontCare) ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
void DFTState<ValueType>::setDependencySuccessful(size_t id) { |
|
|
|
|
|
mStatus.set(mDft.failureIndex(id)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
void DFTState<ValueType>::setDependencyUnsuccessful(size_t id) { |
|
|
|
|
|
mStatus.set(mDft.failureIndex(id)+1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
template<typename ValueType> |
|
|
void DFTState<ValueType>::beNoLongerFailable(size_t id) { |
|
|
void DFTState<ValueType>::beNoLongerFailable(size_t id) { |
|
|
auto it = std::find(mIsCurrentlyFailableBE.begin(), mIsCurrentlyFailableBE.end(), id); |
|
|
auto it = std::find(mIsCurrentlyFailableBE.begin(), mIsCurrentlyFailableBE.end(), id); |
|
@ -84,7 +113,8 @@ namespace storm { |
|
|
for (size_t i = 0; i < mDft.getDependencies().size(); ++i) { |
|
|
for (size_t i = 0; i < mDft.getDependencies().size(); ++i) { |
|
|
std::shared_ptr<DFTDependency<ValueType> const> dependency = mDft.getDependency(mDft.getDependencies()[i]); |
|
|
std::shared_ptr<DFTDependency<ValueType> const> dependency = mDft.getDependency(mDft.getDependencies()[i]); |
|
|
if (dependency->triggerEvent()->id() == id) { |
|
|
if (dependency->triggerEvent()->id() == id) { |
|
|
if (!hasFailed(dependency->dependentEvent()->id())) { |
|
|
|
|
|
|
|
|
if (getElementState(dependency->dependentEvent()->id()) == DFTElementState::Operational) { |
|
|
|
|
|
assert(!isFailsafe(dependency->dependentEvent()->id())); |
|
|
mFailableDependencies.push_back(dependency->id()); |
|
|
mFailableDependencies.push_back(dependency->id()); |
|
|
STORM_LOG_TRACE("New dependency failure: " << dependency->toString()); |
|
|
STORM_LOG_TRACE("New dependency failure: " << dependency->toString()); |
|
|
} |
|
|
} |
|
@ -99,10 +129,12 @@ namespace storm { |
|
|
STORM_LOG_TRACE("currently failable: " << getCurrentlyFailableString()); |
|
|
STORM_LOG_TRACE("currently failable: " << getCurrentlyFailableString()); |
|
|
if (nrFailableDependencies() > 0) { |
|
|
if (nrFailableDependencies() > 0) { |
|
|
// Consider failure due to dependency
|
|
|
// Consider failure due to dependency
|
|
|
|
|
|
assert(index < nrFailableDependencies()); |
|
|
std::shared_ptr<DFTDependency<ValueType> const> dependency = mDft.getDependency(getDependencyId(index)); |
|
|
std::shared_ptr<DFTDependency<ValueType> const> dependency = mDft.getDependency(getDependencyId(index)); |
|
|
std::pair<std::shared_ptr<DFTBE<ValueType> const>,bool> res(mDft.getBasicElement(dependency->dependentEvent()->id()), true); |
|
|
std::pair<std::shared_ptr<DFTBE<ValueType> const>,bool> res(mDft.getBasicElement(dependency->dependentEvent()->id()), true); |
|
|
mFailableDependencies.erase(mFailableDependencies.begin() + index); |
|
|
mFailableDependencies.erase(mFailableDependencies.begin() + index); |
|
|
setFailed(res.first->id()); |
|
|
setFailed(res.first->id()); |
|
|
|
|
|
setDependencySuccessful(dependency->id()); |
|
|
return res; |
|
|
return res; |
|
|
} else { |
|
|
} else { |
|
|
// Consider "normal" failure
|
|
|
// Consider "normal" failure
|
|
@ -114,6 +146,14 @@ namespace storm { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
|
|
|
void DFTState<ValueType>::letDependencyBeUnsuccessful(size_t index) { |
|
|
|
|
|
assert(nrFailableDependencies() > 0 && index < nrFailableDependencies()); |
|
|
|
|
|
std::shared_ptr<DFTDependency<ValueType> const> dependency = mDft.getDependency(getDependencyId(index)); |
|
|
|
|
|
mFailableDependencies.erase(mFailableDependencies.begin() + index); |
|
|
|
|
|
setDependencyUnsuccessful(dependency->id()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
template<typename ValueType> |
|
|
template<typename ValueType> |
|
|
void DFTState<ValueType>::activate(size_t repr) { |
|
|
void DFTState<ValueType>::activate(size_t repr) { |
|
|
std::vector<size_t> const& module = mDft.module(repr); |
|
|
std::vector<size_t> const& module = mDft.module(repr); |
|
|