11template<
typename ValueType>
16template<
typename ValueType>
18 bool mergeDCFailed,
bool extendPriorities) {
19 this->priorities = priorities;
20 this->dontCareElements = dontCareElements;
22 this->mergedDCFailed = mergeDCFailed;
23 this->dontCarePriority = 1;
24 this->extendedPriorities = extendPriorities;
25 builder.setGspnName(
"DftToGspnTransformation");
28 translateGSPNElements();
34template<
typename ValueType>
36 std::map<uint64_t, uint64_t> priorities;
39 uint64_t dependency_priority = 2;
40 for (std::size_t i = 0; i < mDft.nrElements(); i++) {
42 priorities[i] = dependency_priority;
44 priorities[i] = (-(mDft.getElement(i)->rank()) + mDft.maxRank()) * 2 + 5;
49 uint64_t maxNrOfChildren = 0;
50 uint64_t maxNrDependentEvents = 0;
52 std::list<size_t> elementList;
53 for (std::size_t i = 0; i < mDft.nrElements(); i++) {
56 auto dependency = std::static_pointer_cast<storm::dft::storage::elements::DFTDependency<ValueType>
const>(mDft.getElement(i));
57 uint64_t nrDependentEvents = (dependency->dependentEvents()).size();
58 if (nrDependentEvents > maxNrDependentEvents) {
59 maxNrDependentEvents = nrDependentEvents;
64 uint64_t nrChildren = mDft.getElement(i)->nrChildren();
68 if (maxNrOfChildren < nrChildren) {
69 maxNrOfChildren = nrChildren;
72 if (!elementList.empty()) {
73 std::list<size_t>::iterator it = elementList.begin();
75 while ((mDft.getElement(*it)->rank()) < (mDft.getElement(i)->rank()) ||
79 elementList.insert(it, i);
81 elementList.push_back(i);
86 uint64_t priorityIntervalLength = std::max(maxNrDependentEvents, maxNrOfChildren) + 4;
90 uint64_t currentPrio = mDft.nrElements() + priorityIntervalLength;
92 for (std::list<size_t>::iterator it = elementList.begin(); it != elementList.end(); ++it) {
93 priorities[*it] = currentPrio;
94 currentPrio += priorityIntervalLength;
101template<
typename ValueType>
103 STORM_LOG_ASSERT(failedPlaces.size() > mDft.getTopLevelIndex(),
"Failed place for top level element does not exist.");
104 return failedPlaces.at(mDft.getTopLevelIndex());
107template<
typename ValueType>
109 return builder.buildGspn();
112template<
typename ValueType>
113void DftToGspnTransformator<ValueType>::translateGSPNElements() {
115 for (std::size_t i = 0; i < mDft.nrElements(); i++) {
116 auto dftElement = mDft.getElement(i);
119 switch (dftElement->type()) {
150 STORM_LOG_THROW(
false, storm::exceptions::InvalidArgumentException,
"DFT type '" << dftElement->type() <<
"' not known.");
156template<
typename ValueType>
158 switch (dftBE->beType()) {
166 STORM_LOG_THROW(
false, storm::exceptions::InvalidArgumentException,
"BE type '" << dftBE->beType() <<
"' not known.");
171template<
typename ValueType>
172void DftToGspnTransformator<ValueType>::translateBEExponential(std::shared_ptr<storm::dft::storage::elements::BEExponential<ValueType>
const> dftBE) {
173 double xcenter = mDft.getElementLayoutInfo(dftBE->id()).x;
174 double ycenter = mDft.getElementLayoutInfo(dftBE->id()).y;
176 uint64_t failedPlace = addFailedPlace(dftBE, storm::gspn::LayoutInfo(xcenter + 3.0, ycenter));
178 uint64_t activePlace = builder.addPlace(
defaultCapacity, isActiveInitially(dftBE) ? 1 : 0, dftBE->name() + STR_ACTIVATED);
179 activePlaces.emplace(dftBE->id(), activePlace);
180 builder.setPlaceLayoutInfo(activePlace, storm::gspn::LayoutInfo(xcenter - 3.0, ycenter));
181 uint64_t tActive = builder.addTimedTransition(getFailPriority(dftBE), dftBE->activeFailureRate(), dftBE->name() +
"_activeFailing");
182 builder.setTransitionLayoutInfo(tActive, storm::gspn::LayoutInfo(xcenter, ycenter + 3.0));
183 builder.addInputArc(activePlace, tActive);
184 builder.addInhibitionArc(failedPlace, tActive);
185 builder.addOutputArc(tActive, activePlace);
186 builder.addOutputArc(tActive, failedPlace);
188 uint64_t tPassive = builder.addTimedTransition(getFailPriority(dftBE), dftBE->passiveFailureRate(), dftBE->name() +
"_passiveFailing");
189 builder.setTransitionLayoutInfo(tPassive, storm::gspn::LayoutInfo(xcenter, ycenter - 3.0));
190 builder.addInhibitionArc(activePlace, tPassive);
191 builder.addInhibitionArc(failedPlace, tPassive);
192 builder.addOutputArc(tPassive, failedPlace);
194 if (dontCareElements.count(dftBE->id()) && dftBE->id() != mDft.getTopLevelIndex()) {
195 uint64_t tDontCare = addDontcareTransition(dftBE, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter));
196 if (!mergedDCFailed) {
197 uint64_t dontCarePlace = builder.addPlace(1, 0, dftBE->name() + STR_DONTCARE);
198 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 5.0));
199 builder.addInhibitionArc(dontCarePlace, tDontCare);
200 builder.addOutputArc(tDontCare, dontCarePlace);
202 builder.addInhibitionArc(dontCarePlace, tActive);
203 builder.addInhibitionArc(dontCarePlace, tPassive);
206 if (!smart || dftBE->hasIngoingDependencies()) {
207 uint64_t dependencyPropagationPlace = builder.addPlace(1, 0, dftBE->name() +
"_dependency_prop");
208 dependencyPropagationPlaces.emplace(dftBE->id(), dependencyPropagationPlace);
209 builder.setPlaceLayoutInfo(dependencyPropagationPlace, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter - 5.0));
210 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftBE->name() +
"_prop_fail");
211 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 8.0, ycenter));
212 builder.addInhibitionArc(dependencyPropagationPlace, tPropagationFailed);
213 builder.addInputArc(failedPlace, tPropagationFailed);
214 builder.addOutputArc(tPropagationFailed, failedPlace);
215 builder.addOutputArc(tPropagationFailed, dependencyPropagationPlace);
216 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftBE->name() +
"_prop_dontCare");
217 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter));
218 builder.addInhibitionArc(dependencyPropagationPlace, tPropagationDontCare);
219 builder.addInputArc(dependencyPropagationPlace, tPropagationDontCare);
220 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
221 builder.addOutputArc(tPropagationDontCare, dependencyPropagationPlace);
224 builder.addInhibitionArc(failedPlace, tDontCare);
225 builder.addOutputArc(tDontCare, failedPlace);
229 if (!smart || dftBE->nrRestrictions() > 0) {
230 uint64_t disabledPlace = addDisabledPlace(dftBE, storm::gspn::LayoutInfo(xcenter - 9.0, ycenter));
231 builder.addInhibitionArc(disabledPlace, tActive);
232 builder.addInhibitionArc(disabledPlace, tPassive);
235 if (!smart || mDft.isRepresentative(dftBE->id())) {
236 uint64_t unavailablePlace = addUnavailablePlace(dftBE, storm::gspn::LayoutInfo(xcenter + 9.0, ycenter));
237 builder.addOutputArc(tActive, unavailablePlace);
238 builder.addOutputArc(tPassive, unavailablePlace);
241 if (extendedPriorities) {
246template<
typename ValueType>
247void DftToGspnTransformator<ValueType>::translateBEConst(std::shared_ptr<storm::dft::storage::elements::BEConst<ValueType>
const> dftConst) {
248 double xcenter = mDft.getElementLayoutInfo(dftConst->id()).x;
249 double ycenter = mDft.getElementLayoutInfo(dftConst->id()).y;
251 if (dftConst->failed()) {
253 addFailedPlace(dftConst, storm::gspn::LayoutInfo(xcenter, ycenter - 3.0),
true);
255 if (!smart || mDft.isRepresentative(dftConst->id())) {
256 addUnavailablePlace(dftConst, storm::gspn::LayoutInfo(xcenter, ycenter + 3.0),
false);
261 uint64_t failedPlace = builder.addPlace(capacity, 0, dftConst->name() + STR_FAILED);
262 STORM_LOG_ASSERT(failedPlaces.size() == dftConst->id(),
"Failed place index mismatch.");
263 failedPlaces.push_back(failedPlace);
264 builder.setPlaceLayoutInfo(failedPlace, storm::gspn::LayoutInfo(xcenter, ycenter - 3.0));
266 if (!smart || mDft.isRepresentative(dftConst->id())) {
267 uint64_t unavailablePlace = builder.addPlace(capacity, 0, dftConst->name() +
"_unavail");
268 unavailablePlaces.emplace(dftConst->id(), unavailablePlace);
269 builder.setPlaceLayoutInfo(unavailablePlace, storm::gspn::LayoutInfo(xcenter, ycenter + 3.0));
274template<
typename ValueType>
275void DftToGspnTransformator<ValueType>::translateAND(std::shared_ptr<storm::dft::storage::elements::DFTAnd<ValueType>
const> dftAnd) {
276 double xcenter = mDft.getElementLayoutInfo(dftAnd->id()).x;
277 double ycenter = mDft.getElementLayoutInfo(dftAnd->id()).y;
279 uint64_t failedPlace = addFailedPlace(dftAnd, storm::gspn::LayoutInfo(xcenter, ycenter - 3.0));
281 uint64_t tFailed = builder.addImmediateTransition(getFailPriority(dftAnd), 0.0, dftAnd->name() + STR_FAILING);
282 builder.setTransitionLayoutInfo(tFailed, storm::gspn::LayoutInfo(xcenter, ycenter + 3.0));
283 builder.addInhibitionArc(failedPlace, tFailed);
284 builder.addOutputArc(tFailed, failedPlace);
286 if (dontCareElements.count(dftAnd->id())) {
287 if (dftAnd->id() != mDft.getTopLevelIndex()) {
288 uint64_t tDontCare = addDontcareTransition(dftAnd, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter));
289 if (!mergedDCFailed) {
290 uint64_t dontCarePlace = builder.addPlace(1, 0, dftAnd->name() + STR_DONTCARE);
291 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter + 4.0));
292 builder.addInhibitionArc(dontCarePlace, tDontCare);
293 builder.addOutputArc(tDontCare, dontCarePlace);
295 uint64_t propagationPlace = builder.addPlace(1, 0, dftAnd->name() +
"_prop");
296 builder.setPlaceLayoutInfo(propagationPlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 8.0));
297 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftAnd->name() +
"_prop_fail");
298 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter + 6.0));
299 builder.addInhibitionArc(propagationPlace, tPropagationFailed);
300 builder.addInputArc(failedPlace, tPropagationFailed);
301 builder.addOutputArc(tPropagationFailed, failedPlace);
302 builder.addOutputArc(tPropagationFailed, propagationPlace);
303 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftAnd->name() +
"_prop_dontCare");
304 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 14.0, ycenter + 6.0));
305 builder.addInhibitionArc(propagationPlace, tPropagationDontCare);
306 builder.addInputArc(dontCarePlace, tPropagationDontCare);
307 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
308 builder.addOutputArc(tPropagationDontCare, propagationPlace);
309 for (
auto const &child : dftAnd->children()) {
310 if (dontCareElements.count(child->id())) {
311 uint64_t childDontCare = dontcareTransitions.at(child->id());
312 builder.addInputArc(propagationPlace, childDontCare);
313 builder.addOutputArc(childDontCare, propagationPlace);
317 builder.addInhibitionArc(failedPlace, tDontCare);
318 builder.addOutputArc(tDontCare, failedPlace);
319 for (
auto const &child : dftAnd->children()) {
320 if (dontCareElements.count(child->id())) {
321 uint64_t childDontCare = dontcareTransitions.at(child->id());
322 builder.addInputArc(failedPlace, childDontCare);
323 builder.addOutputArc(childDontCare, failedPlace);
329 for (
auto const &child : dftAnd->children()) {
330 if (dontCareElements.count(child->id())) {
331 uint64_t childDontCare = dontcareTransitions.at(child->id());
332 builder.addInputArc(failedPlace, childDontCare);
333 builder.addOutputArc(childDontCare, failedPlace);
339 if (!smart || mDft.isRepresentative(dftAnd->id())) {
340 uint64_t unavailablePlace = addUnavailablePlace(dftAnd, storm::gspn::LayoutInfo(xcenter + 6.0, ycenter - 3.0));
341 builder.addOutputArc(tFailed, unavailablePlace);
344 for (
auto const &child : dftAnd->children()) {
345 builder.addInputArc(getFailedPlace(child), tFailed);
346 builder.addOutputArc(tFailed, getFailedPlace(child));
348 if (extendedPriorities) {
353template<
typename ValueType>
354void DftToGspnTransformator<ValueType>::translateOR(std::shared_ptr<storm::dft::storage::elements::DFTOr<ValueType>
const> dftOr) {
355 double xcenter = mDft.getElementLayoutInfo(dftOr->id()).x;
356 double ycenter = mDft.getElementLayoutInfo(dftOr->id()).y;
358 uint64_t failedPlace = addFailedPlace(dftOr, storm::gspn::LayoutInfo(xcenter, ycenter - 3.0));
360 if (dontCareElements.count(dftOr->id())) {
361 if (dftOr->id() != mDft.getTopLevelIndex()) {
362 uint64_t tDontCare = addDontcareTransition(dftOr, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter));
363 if (!mergedDCFailed) {
364 uint64_t dontCarePlace = builder.addPlace(1, 0, dftOr->name() + STR_DONTCARE);
365 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter + 4.0));
366 builder.addInhibitionArc(dontCarePlace, tDontCare);
367 builder.addOutputArc(tDontCare, dontCarePlace);
369 uint64_t propagationPlace = builder.addPlace(1, 0, dftOr->name() +
"_prop");
370 builder.setPlaceLayoutInfo(propagationPlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 8.0));
371 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftOr->name() +
"_prop_fail");
372 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter + 6.0));
373 builder.addInhibitionArc(propagationPlace, tPropagationFailed);
374 builder.addInputArc(failedPlace, tPropagationFailed);
375 builder.addOutputArc(tPropagationFailed, failedPlace);
376 builder.addOutputArc(tPropagationFailed, propagationPlace);
377 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftOr->name() +
"_prop_dontCare");
378 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 14.0, ycenter + 6.0));
379 builder.addInhibitionArc(propagationPlace, tPropagationDontCare);
380 builder.addInputArc(dontCarePlace, tPropagationDontCare);
381 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
382 builder.addOutputArc(tPropagationDontCare, propagationPlace);
383 for (
auto const &child : dftOr->children()) {
384 if (dontCareElements.count(child->id())) {
385 uint64_t childDontCare = dontcareTransitions.at(child->id());
386 builder.addInputArc(propagationPlace, childDontCare);
387 builder.addOutputArc(childDontCare, propagationPlace);
391 builder.addInhibitionArc(failedPlace, tDontCare);
392 builder.addOutputArc(tDontCare, failedPlace);
393 for (
auto const &child : dftOr->children()) {
394 if (dontCareElements.count(child->id())) {
395 uint64_t childDontCare = dontcareTransitions.at(child->id());
396 builder.addInputArc(failedPlace, childDontCare);
397 builder.addOutputArc(childDontCare, failedPlace);
403 for (
auto const &child : dftOr->children()) {
404 if (dontCareElements.count(child->id())) {
405 uint64_t childDontCare = dontcareTransitions.at(child->id());
406 builder.addInputArc(failedPlace, childDontCare);
407 builder.addOutputArc(childDontCare, failedPlace);
413 bool isRepresentative = mDft.isRepresentative(dftOr->id());
414 uint64_t unavailablePlace = 0;
415 if (!smart || isRepresentative) {
416 unavailablePlace = addUnavailablePlace(dftOr, storm::gspn::LayoutInfo(xcenter + 6.0, ycenter - 3.0));
419 for (
size_t i = 0;
i < dftOr->nrChildren(); ++
i) {
420 auto const &child = dftOr->children().at(i);
421 uint64_t tFailed = 0;
422 if (extendedPriorities) {
423 tFailed = builder.addImmediateTransition(getFailPriority(dftOr) + i, 0.0, dftOr->name() + STR_FAILING + std::to_string(i));
425 tFailed = builder.addImmediateTransition(getFailPriority(dftOr), 0.0, dftOr->name() + STR_FAILING + std::to_string(i));
427 builder.setTransitionLayoutInfo(tFailed, storm::gspn::LayoutInfo(xcenter - 5.0 + i * 3.0, ycenter + 3.0));
428 builder.addInhibitionArc(failedPlace, tFailed);
429 builder.addOutputArc(tFailed, failedPlace);
430 if (!smart || isRepresentative) {
431 builder.addOutputArc(tFailed, unavailablePlace);
433 builder.addInputArc(getFailedPlace(child), tFailed);
434 builder.addOutputArc(tFailed, getFailedPlace(child));
436 if (extendedPriorities) {
441template<
typename ValueType>
442void DftToGspnTransformator<ValueType>::translateVOT(std::shared_ptr<storm::dft::storage::elements::DFTVot<ValueType>
const> dftVot) {
445 double xcenter = mDft.getElementLayoutInfo(dftVot->id()).x;
446 double ycenter = mDft.getElementLayoutInfo(dftVot->id()).y;
448 uint64_t failedPlace = addFailedPlace(dftVot, storm::gspn::LayoutInfo(xcenter, ycenter - 3.0));
450 uint64_t tFailed = builder.addImmediateTransition(getFailPriority(dftVot), 0.0, dftVot->name() + STR_FAILING);
451 builder.addOutputArc(tFailed, failedPlace);
452 builder.addInhibitionArc(failedPlace, tFailed);
454 if (!smart || mDft.isRepresentative(dftVot->id())) {
455 uint64_t unavailablePlace = addUnavailablePlace(dftVot, storm::gspn::LayoutInfo(xcenter + 6.0, ycenter - 3.0));
456 builder.addOutputArc(tFailed, unavailablePlace);
459 uint64_t collectorPlace = builder.addPlace(dftVot->nrChildren(), 0, dftVot->name() +
"_collector");
460 builder.setPlaceLayoutInfo(collectorPlace, storm::gspn::LayoutInfo(xcenter, ycenter));
461 builder.addInputArc(collectorPlace, tFailed, dftVot->threshold());
463 for (
size_t i = 0;
i < dftVot->nrChildren(); ++
i) {
464 auto const &child = dftVot->children().at(i);
465 uint64_t childNextPlace = builder.addPlace(
defaultCapacity, 1, dftVot->name() +
"_child_next" + std::to_string(i));
467 if (extendedPriorities) {
468 tCollect = builder.addImmediateTransition(getFailPriority(dftVot) + i, 0.0, dftVot->name() +
"_child_collect" + std::to_string(i));
470 tCollect = builder.addImmediateTransition(getFailPriority(dftVot), 0.0, dftVot->name() +
"_child_collect" + std::to_string(i));
472 builder.addOutputArc(tCollect, collectorPlace);
473 builder.addInputArc(childNextPlace, tCollect);
474 builder.addInputArc(getFailedPlace(child), tCollect);
475 builder.addOutputArc(tCollect, getFailedPlace(child));
478 if (dontCareElements.count(dftVot->id())) {
479 if (dftVot->id() != mDft.getTopLevelIndex()) {
480 uint64_t tDontCare = addDontcareTransition(dftVot, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter));
481 if (!mergedDCFailed) {
482 uint64_t dontCarePlace = builder.addPlace(1, 0, dftVot->name() + STR_DONTCARE);
483 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter + 4.0));
484 builder.addInhibitionArc(dontCarePlace, tDontCare);
485 builder.addOutputArc(tDontCare, dontCarePlace);
487 uint64_t propagationPlace = builder.addPlace(1, 0, dftVot->name() +
"_prop");
488 builder.setPlaceLayoutInfo(propagationPlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 8.0));
489 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftVot->name() +
"_prop_fail");
490 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter + 6.0));
491 builder.addInhibitionArc(propagationPlace, tPropagationFailed);
492 builder.addInputArc(failedPlace, tPropagationFailed);
493 builder.addOutputArc(tPropagationFailed, failedPlace);
494 builder.addOutputArc(tPropagationFailed, propagationPlace);
495 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftVot->name() +
"_prop_dontCare");
496 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 14.0, ycenter + 6.0));
497 builder.addInhibitionArc(propagationPlace, tPropagationDontCare);
498 builder.addInputArc(dontCarePlace, tPropagationDontCare);
499 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
500 builder.addOutputArc(tPropagationDontCare, propagationPlace);
501 for (
auto const &child : dftVot->children()) {
502 if (dontCareElements.count(child->id())) {
503 uint64_t childDontCare = dontcareTransitions.at(child->id());
504 builder.addInputArc(propagationPlace, childDontCare);
505 builder.addOutputArc(childDontCare, propagationPlace);
509 builder.addInhibitionArc(failedPlace, tDontCare);
510 builder.addOutputArc(tDontCare, failedPlace);
511 for (
auto const &child : dftVot->children()) {
512 if (dontCareElements.count(child->id())) {
513 uint64_t childDontCare = dontcareTransitions.at(child->id());
514 builder.addInputArc(failedPlace, childDontCare);
515 builder.addOutputArc(childDontCare, failedPlace);
521 for (
auto const &child : dftVot->children()) {
522 if (dontCareElements.count(child->id())) {
523 uint64_t childDontCare = dontcareTransitions.at(child->id());
524 builder.addInputArc(failedPlace, childDontCare);
525 builder.addOutputArc(childDontCare, failedPlace);
530 if (extendedPriorities) {
535template<
typename ValueType>
536void DftToGspnTransformator<ValueType>::translatePAND(std::shared_ptr<storm::dft::storage::elements::DFTPand<ValueType>
const> dftPand,
bool inclusive) {
538 double xcenter = mDft.getElementLayoutInfo(dftPand->id()).x;
539 double ycenter = mDft.getElementLayoutInfo(dftPand->id()).y;
541 uint64_t failedPlace = addFailedPlace(dftPand, storm::gspn::LayoutInfo(xcenter + 3.0, ycenter - 3.0));
544 uint64_t tFailed = builder.addImmediateTransition(
545 getFailPriority(dftPand) - 1, 0.0, dftPand->name() + STR_FAILING);
546 builder.setTransitionLayoutInfo(tFailed, storm::gspn::LayoutInfo(xcenter + 3.0, ycenter + 3.0));
547 builder.addInhibitionArc(failedPlace, tFailed);
548 builder.addOutputArc(tFailed, failedPlace);
550 if (!smart || mDft.isRepresentative(dftPand->id())) {
551 uint64_t unavailablePlace = addUnavailablePlace(dftPand, storm::gspn::LayoutInfo(xcenter + 9.0, ycenter - 3.0));
552 builder.addOutputArc(tFailed, unavailablePlace);
555 uint64_t failSafePlace = builder.addPlace(
defaultCapacity, 0, dftPand->name() + STR_FAILSAVE);
556 builder.setPlaceLayoutInfo(failSafePlace, storm::gspn::LayoutInfo(xcenter - 3.0, ycenter - 3.0));
558 builder.addInhibitionArc(failSafePlace, tFailed);
561 for (
auto const &child : dftPand->children()) {
562 builder.addInputArc(getFailedPlace(child), tFailed);
563 builder.addOutputArc(tFailed, getFailedPlace(child));
566 for (uint64_t i = 1;
i < dftPand->nrChildren(); ++
i) {
567 auto const &child = dftPand->children().at(i);
568 uint64_t tFailSafe = builder.addImmediateTransition(getFailPriority(dftPand), 0.0, dftPand->name() + STR_FAILSAVING + std::to_string(i));
569 builder.setTransitionLayoutInfo(tFailSafe, storm::gspn::LayoutInfo(xcenter - 6.0 + i * 3.0, ycenter + 3.0));
572 builder.addInputArc(getFailedPlace(child), tFailSafe);
573 builder.addOutputArc(tFailSafe, getFailedPlace(child));
574 builder.addInhibitionArc(getFailedPlace(dftPand->children().at(i - 1)), tFailSafe);
575 builder.addOutputArc(tFailSafe, failSafePlace);
576 builder.addInhibitionArc(failSafePlace, tFailSafe);
579 auto const &previousChild = dftPand->children().at(i - 1);
580 uint64_t delayPlace = builder.addPlace(1, 0, dftPand->name() +
"_delay_" + previousChild->name());
581 builder.setPlaceLayoutInfo(delayPlace, storm::gspn::LayoutInfo(xcenter - 5.0 + (i - 1) * 3.0, ycenter + 5.0));
583 uint64_t tDelay = builder.addImmediateTransition(getFailPriority(dftPand) - 1, 0.0, child->name() +
"_" + dftPand->name() +
"_delayTransition");
584 builder.setTransitionLayoutInfo(tDelay, storm::gspn::LayoutInfo(xcenter - 5.0 + (i - 1) * 3.0, ycenter + 3.0));
585 builder.addInputArc(getFailedPlace(previousChild), tDelay);
586 builder.addOutputArc(tDelay, getFailedPlace(dftPand->children().at(i - 1)));
587 builder.addOutputArc(tDelay, delayPlace);
588 builder.addInhibitionArc(delayPlace, tDelay);
590 builder.addInputArc(getFailedPlace(child), tFailSafe);
591 builder.addOutputArc(tFailSafe, getFailedPlace(child));
592 builder.addInhibitionArc(delayPlace, tFailSafe);
593 builder.addOutputArc(tFailSafe, failSafePlace);
594 builder.addInhibitionArc(failSafePlace, tFailSafe);
598 if (dontCareElements.count(dftPand->id())) {
600 uint64_t propagationPlace = builder.addPlace(1, 0, dftPand->name() +
"_prop");
601 builder.setPlaceLayoutInfo(propagationPlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 8.0));
602 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftPand->name() +
"_prop_fail");
603 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter + 6.0));
604 uint64_t tPropagationFailsafe = builder.addImmediateTransition(dontCarePriority, 0.0, dftPand->name() +
"_prop_failsafe");
605 builder.setTransitionLayoutInfo(tPropagationFailsafe, storm::gspn::LayoutInfo(xcenter + 8.0, ycenter + 6.0));
606 builder.addInhibitionArc(propagationPlace, tPropagationFailed);
607 builder.addInputArc(failedPlace, tPropagationFailed);
608 builder.addOutputArc(tPropagationFailed, failedPlace);
609 builder.addOutputArc(tPropagationFailed, propagationPlace);
611 builder.addInhibitionArc(propagationPlace, tPropagationFailsafe);
612 builder.addInputArc(failSafePlace, tPropagationFailsafe);
613 builder.addOutputArc(tPropagationFailsafe, failSafePlace);
614 builder.addOutputArc(tPropagationFailsafe, propagationPlace);
617 for (
auto const &child : dftPand->children()) {
618 if (dontCareElements.count(child->id())) {
619 uint64_t childDontCare = dontcareTransitions.at(child->id());
620 builder.addInputArc(propagationPlace, childDontCare);
621 builder.addOutputArc(childDontCare, propagationPlace);
625 if (dftPand->id() != mDft.getTopLevelIndex()) {
626 uint64_t tDontCare = addDontcareTransition(dftPand, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter));
627 if (!mergedDCFailed) {
628 uint64_t dontCarePlace = builder.addPlace(1, 0, dftPand->name() + STR_DONTCARE);
629 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter + 4.0));
630 builder.addInhibitionArc(dontCarePlace, tDontCare);
631 builder.addOutputArc(tDontCare, dontCarePlace);
632 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftPand->name() +
"_prop_dontCare");
633 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 14.0, ycenter + 6.0));
634 builder.addInhibitionArc(propagationPlace, tPropagationDontCare);
635 builder.addInputArc(dontCarePlace, tPropagationDontCare);
636 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
637 builder.addOutputArc(tPropagationDontCare, propagationPlace);
640 builder.addInhibitionArc(failedPlace, tDontCare);
641 builder.addOutputArc(tDontCare, failedPlace);
645 if (extendedPriorities) {
650template<
typename ValueType>
651void DftToGspnTransformator<ValueType>::translatePOR(std::shared_ptr<storm::dft::storage::elements::DFTPor<ValueType>
const> dftPor,
bool inclusive) {
652 double xcenter = mDft.getElementLayoutInfo(dftPor->id()).x;
653 double ycenter = mDft.getElementLayoutInfo(dftPor->id()).y;
655 uint64_t delayPlace = 0;
657 uint64_t failedPlace = addFailedPlace(dftPor, storm::gspn::LayoutInfo(xcenter + 3.0, ycenter - 3.0));
660 uint64_t tFailed = builder.addImmediateTransition(
661 getFailPriority(dftPor) - 1, 0.0, dftPor->name() + STR_FAILING);
662 builder.setTransitionLayoutInfo(tFailed, storm::gspn::LayoutInfo(xcenter + 3.0, ycenter + 3.0));
663 builder.addOutputArc(tFailed, failedPlace);
664 builder.addInhibitionArc(failedPlace, tFailed);
667 builder.addInputArc(getFailedPlace(dftPor->children().front()), tFailed);
668 builder.addOutputArc(tFailed, getFailedPlace(dftPor->children().front()));
670 if (!smart || mDft.isRepresentative(dftPor->id())) {
671 uint64_t unavailablePlace = addUnavailablePlace(dftPor, storm::gspn::LayoutInfo(xcenter + 9.0, ycenter - 3.0));
672 builder.addOutputArc(tFailed, unavailablePlace);
675 uint64_t failSafePlace = builder.addPlace(
defaultCapacity, 0, dftPor->name() + STR_FAILSAVE);
676 builder.setPlaceLayoutInfo(failSafePlace, storm::gspn::LayoutInfo(xcenter - 3.0, ycenter - 3.0));
678 builder.addInhibitionArc(failSafePlace, tFailed);
682 delayPlace = builder.addPlace(1, 0, dftPor->name() +
"_delay");
683 builder.setPlaceLayoutInfo(delayPlace, storm::gspn::LayoutInfo(xcenter - 5.0, ycenter + 5.0));
686 uint64_t tDelay = builder.addImmediateTransition(getFailPriority(dftPor) - 1, 0.0, dftPor->name() +
"_delayTransition");
687 builder.setTransitionLayoutInfo(tDelay, storm::gspn::LayoutInfo(xcenter - 5.0, ycenter + 3.0));
689 builder.addInputArc(getFailedPlace(dftPor->children().front()), tDelay);
690 builder.addOutputArc(tDelay, getFailedPlace(dftPor->children().front()));
691 builder.addOutputArc(tDelay, delayPlace);
692 builder.addInhibitionArc(delayPlace, tDelay);
696 for (
size_t i = 1;
i < dftPor->nrChildren(); ++
i) {
697 auto const &child = dftPor->children().at(i);
698 uint64_t tFailSafe = builder.addImmediateTransition(getFailPriority(dftPor), 0.0, dftPor->name() + STR_FAILSAVING + std::to_string(i));
699 builder.setTransitionLayoutInfo(tFailSafe, storm::gspn::LayoutInfo(xcenter - 3.0 + i * 3.0, ycenter + 3.0));
701 builder.addInputArc(getFailedPlace(child), tFailSafe);
702 builder.addOutputArc(tFailSafe, getFailedPlace(child));
703 builder.addOutputArc(tFailSafe, failSafePlace);
704 builder.addInhibitionArc(failSafePlace, tFailSafe);
706 builder.addInhibitionArc(getFailedPlace(dftPor->children().front()), tFailSafe);
708 builder.addInhibitionArc(delayPlace, tFailSafe);
713 if (dontCareElements.count(dftPor->id())) {
715 uint64_t propagationPlace = builder.addPlace(1, 0, dftPor->name() +
"_prop");
716 builder.setPlaceLayoutInfo(propagationPlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 8.0));
717 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftPor->name() +
"_prop_fail");
718 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter + 6.0));
719 uint64_t tPropagationFailsafe = builder.addImmediateTransition(dontCarePriority, 0.0, dftPor->name() +
"_prop_failsafe");
720 builder.setTransitionLayoutInfo(tPropagationFailsafe, storm::gspn::LayoutInfo(xcenter + 8.0, ycenter + 6.0));
721 builder.addInhibitionArc(propagationPlace, tPropagationFailed);
722 builder.addInputArc(failedPlace, tPropagationFailed);
723 builder.addOutputArc(tPropagationFailed, failedPlace);
724 builder.addOutputArc(tPropagationFailed, propagationPlace);
726 builder.addInhibitionArc(propagationPlace, tPropagationFailsafe);
727 builder.addInputArc(failSafePlace, tPropagationFailsafe);
728 builder.addOutputArc(tPropagationFailsafe, failSafePlace);
729 builder.addOutputArc(tPropagationFailsafe, propagationPlace);
732 for (
auto const &child : dftPor->children()) {
733 if (dontCareElements.count(child->id())) {
734 uint64_t childDontCare = dontcareTransitions.at(child->id());
735 builder.addInputArc(propagationPlace, childDontCare);
736 builder.addOutputArc(childDontCare, propagationPlace);
740 if (dftPor->id() != mDft.getTopLevelIndex()) {
741 uint64_t tDontCare = addDontcareTransition(dftPor, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter));
742 if (!mergedDCFailed) {
743 uint64_t dontCarePlace = builder.addPlace(1, 0, dftPor->name() + STR_DONTCARE);
744 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter + 4.0));
745 builder.addInhibitionArc(dontCarePlace, tDontCare);
746 builder.addOutputArc(tDontCare, dontCarePlace);
747 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftPor->name() +
"_prop_dontCare");
748 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 14.0, ycenter + 6.0));
749 builder.addInhibitionArc(propagationPlace, tPropagationDontCare);
750 builder.addInputArc(dontCarePlace, tPropagationDontCare);
751 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
752 builder.addOutputArc(tPropagationDontCare, propagationPlace);
755 builder.addInhibitionArc(failedPlace, tDontCare);
756 builder.addOutputArc(tDontCare, failedPlace);
760 if (extendedPriorities) {
765template<
typename ValueType>
766void DftToGspnTransformator<ValueType>::translateSPARE(std::shared_ptr<storm::dft::storage::elements::DFTSpare<ValueType>
const> dftSpare) {
767 double xcenter = mDft.getElementLayoutInfo(dftSpare->id()).x;
768 double ycenter = mDft.getElementLayoutInfo(dftSpare->id()).y;
770 uint64_t prio = getFailPriority(dftSpare);
772 uint64_t failedPlace = addFailedPlace(dftSpare, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter - 8.0));
774 bool isRepresentative = mDft.isRepresentative(dftSpare->id());
775 uint64_t unavailablePlace = 0;
776 if (!smart || isRepresentative) {
777 unavailablePlace = addUnavailablePlace(dftSpare, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter - 8.0));
780 uint64_t activePlace = builder.addPlace(
defaultCapacity, isActiveInitially(dftSpare) ? 1 : 0, dftSpare->name() + STR_ACTIVATED);
781 builder.setPlaceLayoutInfo(activePlace, storm::gspn::LayoutInfo(xcenter - 20.0, ycenter - 12.0));
782 activePlaces.emplace(dftSpare->id(), activePlace);
784 std::vector<uint64_t> tNextClaims;
785 std::vector<uint64_t> tNextConsiders;
786 for (
size_t i = 0;
i < dftSpare->nrChildren(); ++
i) {
787 auto const &child = dftSpare->children().at(i);
789 size_t considerPlace = builder.addPlace(
defaultCapacity, i == 0 ? 1 : 0, dftSpare->name() +
"_consider_" + child->name());
790 builder.setPlaceLayoutInfo(considerPlace, storm::gspn::LayoutInfo(xcenter - 15.0 + i * 14.0, ycenter - 8.0));
794 builder.addOutputArc(tNextClaims.back(), considerPlace);
796 builder.addOutputArc(tNextConsiders.back(), considerPlace);
800 uint64_t tConsiderNext = builder.addImmediateTransition(prio, 0.0, dftSpare->name() +
"_cannot_claim_" + child->name());
802 builder.setTransitionLayoutInfo(tConsiderNext, storm::gspn::LayoutInfo(xcenter - 7.0 + i * 14.0, ycenter - 8.0));
803 builder.addInputArc(considerPlace, tConsiderNext);
804 builder.addInputArc(unavailablePlaces.at(child->id()), tConsiderNext);
805 builder.addOutputArc(tConsiderNext, unavailablePlaces.at(child->id()));
806 tNextConsiders.push_back(tConsiderNext);
809 size_t claimedPlace = builder.addPlace(
defaultCapacity, 0, dftSpare->name() +
"_claimed_" + child->name());
810 builder.setPlaceLayoutInfo(claimedPlace, storm::gspn::LayoutInfo(xcenter - 15.0 + i * 14.0, ycenter + 5.0));
811 uint64_t tClaim = builder.addImmediateTransition(prio, 0.0, dftSpare->name() +
"_claim_" + child->name());
813 builder.setTransitionLayoutInfo(tClaim, storm::gspn::LayoutInfo(xcenter - 15.0 + i * 14.0, ycenter));
814 builder.addInhibitionArc(unavailablePlaces.at(child->id()), tClaim);
815 builder.addInputArc(considerPlace, tClaim);
816 builder.addOutputArc(tClaim, claimedPlace);
817 builder.addOutputArc(tClaim, unavailablePlaces.at(child->id()));
820 uint64_t tClaimNext = builder.addImmediateTransition(prio, 0.0, dftSpare->name() +
"_next_claim_" + std::to_string(i));
822 builder.setTransitionLayoutInfo(tClaimNext, storm::gspn::LayoutInfo(xcenter - 7.0 + i * 14.0, ycenter + 5.0));
823 builder.addInputArc(claimedPlace, tClaimNext);
824 builder.addInputArc(getFailedPlace(child), tClaimNext);
825 builder.addOutputArc(tClaimNext, getFailedPlace(child));
826 tNextClaims.push_back(tClaimNext);
830 for (uint64_t k : mDft.module(child->id()).getElements()) {
831 uint64_t tActivate = builder.addImmediateTransition(prio, 0.0, dftSpare->name() +
"_activate_" + std::to_string(i) +
"_" + std::to_string(k));
833 builder.setTransitionLayoutInfo(tActivate, storm::gspn::LayoutInfo(xcenter - 18.0 + (i + l) * 3, ycenter - 12.0));
834 builder.addInhibitionArc(activePlaces.at(k), tActivate);
835 builder.addInputArc(claimedPlace, tActivate);
836 builder.addInputArc(activePlace, tActivate);
837 builder.addOutputArc(tActivate, claimedPlace);
838 builder.addOutputArc(tActivate, activePlace);
839 builder.addOutputArc(tActivate, activePlaces.at(k));
845 builder.addOutputArc(tNextConsiders.back(), failedPlace);
846 builder.addOutputArc(tNextClaims.back(), failedPlace);
847 builder.addInhibitionArc(failedPlace, tNextConsiders.back());
848 builder.addInhibitionArc(failedPlace, tNextClaims.back());
851 if (dontCareElements.count(dftSpare->id())) {
852 if (dftSpare->id() != mDft.getTopLevelIndex()) {
853 uint64_t tDontCare = addDontcareTransition(dftSpare, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter));
854 if (!mergedDCFailed) {
855 uint64_t dontCarePlace = builder.addPlace(1, 0, dftSpare->name() + STR_DONTCARE);
856 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter + 4.0));
857 builder.addInhibitionArc(dontCarePlace, tDontCare);
858 builder.addOutputArc(tDontCare, dontCarePlace);
860 uint64_t propagationPlace = builder.addPlace(1, 0, dftSpare->name() +
"_prop");
861 builder.setPlaceLayoutInfo(propagationPlace, storm::gspn::LayoutInfo(xcenter + 12.0, ycenter + 8.0));
862 uint64_t tPropagationFailed = builder.addImmediateTransition(dontCarePriority, 0.0, dftSpare->name() +
"_prop_fail");
863 builder.setTransitionLayoutInfo(tPropagationFailed, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter + 6.0));
864 builder.addInhibitionArc(propagationPlace, tPropagationFailed);
865 builder.addInputArc(failedPlace, tPropagationFailed);
866 builder.addOutputArc(tPropagationFailed, failedPlace);
867 builder.addOutputArc(tPropagationFailed, propagationPlace);
868 uint64_t tPropagationDontCare = builder.addImmediateTransition(dontCarePriority, 0.0, dftSpare->name() +
"_prop_dontCare");
869 builder.setTransitionLayoutInfo(tPropagationDontCare, storm::gspn::LayoutInfo(xcenter + 14.0, ycenter + 6.0));
870 builder.addInhibitionArc(propagationPlace, tPropagationDontCare);
871 builder.addInputArc(dontCarePlace, tPropagationDontCare);
872 builder.addOutputArc(tPropagationDontCare, dontCarePlace);
873 builder.addOutputArc(tPropagationDontCare, propagationPlace);
874 for (
auto const &child : dftSpare->children()) {
875 if (dontCareElements.count(child->id())) {
876 uint64_t childDontCare = dontcareTransitions.at(child->id());
877 builder.addInputArc(propagationPlace, childDontCare);
878 builder.addOutputArc(childDontCare, propagationPlace);
882 builder.addInhibitionArc(failedPlace, tDontCare);
883 builder.addOutputArc(tDontCare, failedPlace);
884 for (
auto const &child : dftSpare->children()) {
885 if (dontCareElements.count(child->id())) {
886 uint64_t childDontCare = dontcareTransitions.at(child->id());
887 builder.addInputArc(failedPlace, childDontCare);
888 builder.addOutputArc(childDontCare, failedPlace);
894 for (
auto const &child : dftSpare->children()) {
895 if (dontCareElements.count(child->id())) {
896 uint64_t childDontCare = dontcareTransitions.at(child->id());
897 builder.addInputArc(failedPlace, childDontCare);
898 builder.addOutputArc(childDontCare, failedPlace);
904 if (!smart || isRepresentative) {
905 builder.addOutputArc(tNextConsiders.back(), unavailablePlace);
906 builder.addOutputArc(tNextClaims.back(), unavailablePlace);
908 if (extendedPriorities) {
913template<
typename ValueType>
914void DftToGspnTransformator<ValueType>::translatePDEP(std::shared_ptr<storm::dft::storage::elements::DFTDependency<ValueType>
const> dftDependency) {
915 double xcenter = mDft.getElementLayoutInfo(dftDependency->id()).x;
916 double ycenter = mDft.getElementLayoutInfo(dftDependency->id()).y;
918 uint64_t failedPlace = 0;
920 failedPlace = addFailedPlace(dftDependency, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter - 8.0));
921 addUnavailablePlace(dftDependency, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter - 8.0));
924 uint64_t forwardPlace = 0;
925 if (dftDependency->probability() < 1.0) {
927 forwardPlace = builder.addPlace(
defaultCapacity, 0, dftDependency->name() +
"_forward");
928 builder.setPlaceLayoutInfo(forwardPlace, storm::gspn::LayoutInfo(xcenter + 1.0, ycenter + 2.0));
930 uint64_t coinPlace = builder.addPlace(
defaultCapacity, 1, dftDependency->name() +
"_coin");
931 builder.setPlaceLayoutInfo(coinPlace, storm::gspn::LayoutInfo(xcenter - 5.0, ycenter + 2.0));
933 uint64_t tStartFlip = builder.addImmediateTransition(getFailPriority(dftDependency), 0.0, dftDependency->name() +
"_start_flip");
934 builder.addInputArc(coinPlace, tStartFlip);
935 builder.addInputArc(getFailedPlace(dftDependency->triggerEvent()), tStartFlip);
936 builder.addOutputArc(tStartFlip, getFailedPlace(dftDependency->triggerEvent()));
938 uint64_t flipPlace = builder.addPlace(
defaultCapacity, 0, dftDependency->name() +
"_flip");
939 builder.setPlaceLayoutInfo(flipPlace, storm::gspn::LayoutInfo(xcenter - 2.0, ycenter + 2.0));
940 builder.addOutputArc(tStartFlip, flipPlace);
943 builder.addImmediateTransition(getFailPriority(dftDependency) + 1, dftDependency->probability(), dftDependency->name() +
"_win_flip");
944 builder.addInputArc(flipPlace, tWinFlip);
945 builder.addOutputArc(tWinFlip, forwardPlace);
947 uint64_t tLooseFlip = builder.addImmediateTransition(
949 builder.addInputArc(flipPlace, tLooseFlip);
952 forwardPlace = getFailedPlace(dftDependency->triggerEvent());
956 uint64_t propagationPriority = getFailPriority(dftDependency);
957 for (
auto const &child : dftDependency->dependentEvents()) {
958 uint64_t tForwardFailure = builder.addImmediateTransition(propagationPriority, 0.0, dftDependency->name() +
"_propagate_" + child->name());
960 builder.addInputArc(forwardPlace, tForwardFailure);
961 builder.addOutputArc(tForwardFailure, forwardPlace);
962 builder.addOutputArc(tForwardFailure, getFailedPlace(child));
963 builder.addInhibitionArc(getFailedPlace(child), tForwardFailure);
964 if (!smart || child->nrRestrictions() > 0) {
965 builder.addInhibitionArc(disabledPlaces.at(child->id()), tForwardFailure);
967 if (!smart || mDft.isRepresentative(child->id())) {
968 builder.addOutputArc(tForwardFailure, unavailablePlaces.at(child->id()));
970 propagationPriority--;
974 if (dontCareElements.count(dftDependency->id())) {
975 uint64_t tDontCare = addDontcareTransition(dftDependency, storm::gspn::LayoutInfo(xcenter + 3.0, ycenter));
976 if (!mergedDCFailed) {
977 uint64_t dontCarePlace = builder.addPlace(1, 0, dftDependency->name() + STR_DONTCARE);
978 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 4.0, ycenter));
979 builder.addInhibitionArc(dontCarePlace, tDontCare);
980 builder.addOutputArc(tDontCare, dontCarePlace);
982 for (
auto const &dependentEvent : dftDependency->dependentEvents()) {
983 if (dontCareElements.count(dependentEvent->id())) {
984 uint64_t dependentEventPropagation = dependencyPropagationPlaces.at(dependentEvent->id());
985 builder.addInputArc(dependentEventPropagation, tDontCare);
986 builder.addOutputArc(tDontCare, dependentEventPropagation);
990 uint64_t triggerDontCare = dontcareTransitions.at(dftDependency->triggerEvent()->id());
991 builder.addInputArc(dontCarePlace, triggerDontCare);
992 builder.addOutputArc(triggerDontCare, dontCarePlace);
994 if (failedPlace == 0) {
995 failedPlace = addFailedPlace(dftDependency, storm::gspn::LayoutInfo(xcenter + 4.0, ycenter));
997 builder.addInhibitionArc(failedPlace, tDontCare);
998 builder.addOutputArc(tDontCare, failedPlace);
1001 for (
auto const &dependentEvent : dftDependency->dependentEvents()) {
1002 if (dontCareElements.count(dependentEvent->id())) {
1003 uint64_t dependentEventFailed = failedPlaces.at(dependentEvent->id());
1004 builder.addInputArc(dependentEventFailed, tDontCare);
1005 builder.addOutputArc(tDontCare, dependentEventFailed);
1009 uint64_t triggerDontCare = dontcareTransitions.at(dftDependency->triggerEvent()->id());
1010 builder.addInputArc(failedPlace, triggerDontCare);
1011 builder.addOutputArc(triggerDontCare, failedPlace);
1014 if (failedPlace == 0) {
1015 failedPlaces.push_back(failedPlace);
1017 if (extendedPriorities) {
1022template<
typename ValueType>
1023void DftToGspnTransformator<ValueType>::translateSeq(std::shared_ptr<storm::dft::storage::elements::DFTSeq<ValueType>
const> dftSeq) {
1024 STORM_LOG_THROW(dftSeq->allChildrenBEs(), storm::exceptions::NotImplementedException,
1025 "Sequence enforcers with gates as children are currently not supported.");
1026 double xcenter = mDft.getElementLayoutInfo(dftSeq->id()).x;
1027 double ycenter = mDft.getElementLayoutInfo(dftSeq->id()).y;
1028 uint64_t failedPlace = 0;
1030 failedPlace = addFailedPlace(dftSeq, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter - 8.0));
1031 addUnavailablePlace(dftSeq, storm::gspn::LayoutInfo(xcenter + 16.0, ycenter - 8.0));
1034 uint64_t tEnable = 0;
1035 uint64_t nextPlace = 0;
1036 for (
size_t i = 0;
i < dftSeq->nrChildren(); ++
i) {
1037 auto const &child = dftSeq->children().at(i);
1039 nextPlace = builder.addPlace(
defaultCapacity, i == 0 ? 1 : 0, dftSeq->name() +
"_next_" + child->name());
1040 builder.setPlaceLayoutInfo(nextPlace, storm::gspn::LayoutInfo(xcenter - 5.0 + i * 3.0, ycenter - 3.0));
1043 builder.addOutputArc(tEnable, nextPlace);
1045 tEnable = builder.addImmediateTransition(getFailPriority(dftSeq), 0.0, dftSeq->name() +
"_unblock_" + child->name());
1046 builder.setTransitionLayoutInfo(tEnable, storm::gspn::LayoutInfo(xcenter - 5.0 + i * 3.0, ycenter + 3.0));
1047 builder.addInputArc(nextPlace, tEnable);
1048 builder.addInputArc(disabledPlaces.at(child->id()), tEnable);
1050 builder.addInputArc(getFailedPlace(dftSeq->children().at(i - 1)), tEnable);
1054 if (dontCareElements.count(dftSeq->id())) {
1055 if (!mergedDCFailed) {
1056 uint64_t dontCarePlace = builder.addPlace(1, 0, dftSeq->name() + STR_DONTCARE);
1057 builder.setPlaceLayoutInfo(dontCarePlace, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter - 8.0));
1058 for (
auto const &child : dftSeq->children()) {
1059 if (dontCareElements.count(child->id())) {
1060 uint64_t childDontCare = dontcareTransitions.at(child->id());
1061 builder.addInputArc(dontCarePlace, childDontCare);
1065 if (failedPlace == 0) {
1066 failedPlace = addFailedPlace(dftSeq, storm::gspn::LayoutInfo(xcenter + 10.0, ycenter - 8.0));
1068 for (
auto const &child : dftSeq->children()) {
1069 if (dontCareElements.count(child->id())) {
1070 uint64_t childDontCare = dontcareTransitions.at(child->id());
1071 builder.addInputArc(failedPlace, childDontCare);
1078template<
typename ValueType>
1079uint64_t DftToGspnTransformator<ValueType>::addFailedPlace(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType>
const> dftElement,
1080 storm::gspn::LayoutInfo
const &layoutInfo,
bool initialFailed) {
1081 uint64_t failedPlace = builder.addPlace(
defaultCapacity, initialFailed ? 1 : 0, dftElement->name() + STR_FAILED);
1082 STORM_LOG_ASSERT(failedPlaces.size() == dftElement->id(),
"Failed place index mismatch.");
1083 failedPlaces.push_back(failedPlace);
1084 builder.setPlaceLayoutInfo(failedPlace, layoutInfo);
1088template<
typename ValueType>
1089uint64_t DftToGspnTransformator<ValueType>::addUnavailablePlace(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType>
const> dftElement,
1090 storm::gspn::LayoutInfo
const &layoutInfo,
bool initialAvailable) {
1091 unsigned int capacity = 2;
1092 uint64_t unavailablePlace = builder.addPlace(capacity, initialAvailable ? 0 : 1, dftElement->name() +
"_unavail");
1093 unavailablePlaces.emplace(dftElement->id(), unavailablePlace);
1094 builder.setPlaceLayoutInfo(unavailablePlace, layoutInfo);
1095 return unavailablePlace;
1098template<
typename ValueType>
1099uint64_t DftToGspnTransformator<ValueType>::addDisabledPlace(std::shared_ptr<
const storm::dft::storage::elements::DFTBE<ValueType>> dftBe,
1100 storm::gspn::LayoutInfo
const &layoutInfo) {
1101 uint64_t disabledPlace = builder.addPlace(dftBe->nrRestrictions(), dftBe->nrRestrictions(), dftBe->name() +
"_dabled");
1102 disabledPlaces.emplace(dftBe->id(), disabledPlace);
1103 builder.setPlaceLayoutInfo(disabledPlace, layoutInfo);
1104 return disabledPlace;
1107template<
typename ValueType>
1108uint64_t DftToGspnTransformator<ValueType>::addDontcareTransition(std::shared_ptr<
const storm::dft::storage::elements::DFTElement<ValueType>> dftElement,
1109 storm::gspn::LayoutInfo
const &layoutInfo) {
1110 uint64_t dontcareTransition;
1111 dontcareTransition = builder.addImmediateTransition(dontCarePriority, 0.0, dftElement->name() + STR_DONTCARE +
"_transition");
1112 dontcareTransitions.emplace(dftElement->id(), dontcareTransition);
1113 builder.setTransitionLayoutInfo(dontcareTransition, layoutInfo);
1114 return dontcareTransition;
1117template<
typename ValueType>
1118bool DftToGspnTransformator<ValueType>::isActiveInitially(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType>
const> dftElement) {
1120 return !mDft.hasRepresentant(dftElement->id());
1123template<
typename ValueType>
1124uint64_t DftToGspnTransformator<ValueType>::getFailPriority(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType>
const> dftElement) {
1126 return priorities.at(dftElement->id());
Represents a Dynamic Fault Tree.
BE which is either constant failed or constant failsafe.
BE with exponential failure distribution.
Abstract base class for basic events (BEs) in DFTs.
Dependency gate with probability p.
Priority AND (PAND) gate.
VOT gate with threshold k.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)