17 for (
size_t i = 0; i < dft.nrElements(); ++i) {
18 std::shared_ptr<storm::dft::storage::elements::DFTElement<ParametricType>
const> element = dft.getElement(i);
19 switch (element->type()) {
22 auto be = std::static_pointer_cast<storm::dft::storage::elements::DFTBE<ParametricType>
const>(element);
23 switch (be->beType()) {
25 auto beConst = std::static_pointer_cast<storm::dft::storage::elements::BEConst<ParametricType>
const>(element);
26 builder.addBasicElementConst(beConst->name(), beConst->canFail());
30 auto beProb = std::static_pointer_cast<storm::dft::storage::elements::BEProbability<ParametricType>
const>(element);
31 ConstantType activeFailureProbability = instantiate_helper(beProb->activeFailureProbability(), valuation);
32 ConstantType dormancyFactor = instantiate_helper(beProb->dormancyFactor(), valuation);
33 builder.addBasicElementProbability(beProb->name(), activeFailureProbability, dormancyFactor);
37 auto beExp = std::static_pointer_cast<storm::dft::storage::elements::BEExponential<ParametricType>
const>(element);
38 ConstantType activeFailureRate = instantiate_helper(beExp->activeFailureRate(), valuation);
39 ConstantType dormancyFactor = instantiate_helper(beExp->dormancyFactor(), valuation);
40 builder.addBasicElementExponential(beExp->name(), activeFailureRate, dormancyFactor, beExp->isTransient());
44 auto beErlang = std::static_pointer_cast<storm::dft::storage::elements::BEErlang<ParametricType>
const>(element);
45 ConstantType activeFailureRate = instantiate_helper(beErlang->activeFailureRate(), valuation);
46 ConstantType dormancyFactor = instantiate_helper(beErlang->dormancyFactor(), valuation);
47 builder.addBasicElementErlang(beErlang->name(), activeFailureRate, beErlang->phases(), dormancyFactor);
51 auto beWeibull = std::static_pointer_cast<storm::dft::storage::elements::BEWeibull<ParametricType>
const>(element);
52 ConstantType shape = instantiate_helper(beWeibull->shape(), valuation);
53 ConstantType rate = instantiate_helper(beWeibull->rate(), valuation);
54 builder.addBasicElementWeibull(beWeibull->name(), shape, rate);
58 auto beLogNormal = std::static_pointer_cast<storm::dft::storage::elements::BELogNormal<ParametricType>
const>(element);
59 ConstantType mean = instantiate_helper(beLogNormal->mean(), valuation);
60 ConstantType stddev = instantiate_helper(beLogNormal->standardDeviation(), valuation);
61 builder.addBasicElementLogNormal(beLogNormal->name(), mean, stddev);
65 auto beSamples = std::static_pointer_cast<storm::dft::storage::elements::BESamples<ParametricType>
const>(element);
66 std::map<ConstantType, ConstantType> activeSamples{};
67 for (
auto &[time, prob] : beSamples->activeSamples()) {
68 ConstantType timeInst = instantiate_helper(time, valuation);
69 ConstantType probInst = instantiate_helper(prob, valuation);
70 activeSamples[timeInst] = probInst;
72 builder.addBasicElementSamples(beSamples->name(), activeSamples);
76 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"BE type '" << be->beType() <<
"' not known.");
83 builder.addAndGate(element->name(), getChildrenVector(element));
86 builder.addOrGate(element->name(), getChildrenVector(element));
89 auto vot = std::static_pointer_cast<storm::dft::storage::elements::DFTVot<ParametricType>
const>(element);
90 builder.addVotingGate(vot->name(), vot->threshold(), getChildrenVector(vot));
94 auto pand = std::static_pointer_cast<storm::dft::storage::elements::DFTPand<ParametricType>
const>(element);
95 builder.addPandGate(pand->name(), getChildrenVector(pand), pand->isInclusive());
99 auto por = std::static_pointer_cast<storm::dft::storage::elements::DFTPor<ParametricType>
const>(element);
100 builder.addPorGate(por->name(), getChildrenVector(por), por->isInclusive());
104 builder.addSpareGate(element->name(), getChildrenVector(element));
107 builder.addSequenceEnforcer(element->name(), getChildrenVector(element));
110 builder.addMutex(element->name(), getChildrenVector(element));
113 auto dependency = std::static_pointer_cast<storm::dft::storage::elements::DFTDependency<ParametricType>
const>(element);
115 ConstantType probability = instantiate_helper(dependency->probability(), valuation);
116 std::vector<std::string> children = {dependency->triggerEvent()->name()};
117 for (
auto const &depEvent : dependency->dependentEvents()) {
118 children.push_back(depEvent->name());
120 builder.addPdep(dependency->name(), children, probability);
124 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"DFT type '" << element->type() <<
"' not known.");
129 builder.setTopLevel(dft.getTopLevelElement()->name());
130 return std::make_shared<storm::dft::storage::DFT<ConstantType>>(
builder.build());