Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DftToGspnTransformator.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace storm::dft {
8namespace transformations {
9
13template<typename ValueType>
15 public:
22
33 void transform(std::map<uint64_t, uint64_t> const &priorities, std::set<uint64_t> const &dontCareElements, bool smart = true, bool mergeDCFailed = true,
34 bool extendPriorities = false);
35
42 std::map<uint64_t, uint64_t> computePriorities(bool extendedPrio);
43
49
53 uint64_t toplevelFailedPlaceId();
54
55 private:
59 void translateGSPNElements();
60
66 void translateBE(std::shared_ptr<storm::dft::storage::elements::DFTBE<ValueType> const> dftBE);
67
73 void translateBEExponential(std::shared_ptr<storm::dft::storage::elements::BEExponential<ValueType> const> dftBE);
74
80 void translateBEConst(std::shared_ptr<storm::dft::storage::elements::BEConst<ValueType> const> dftConst);
81
87 void translateAND(std::shared_ptr<storm::dft::storage::elements::DFTAnd<ValueType> const> dftAnd);
88
94 void translateOR(std::shared_ptr<storm::dft::storage::elements::DFTOr<ValueType> const> dftOr);
95
101 void translateVOT(std::shared_ptr<storm::dft::storage::elements::DFTVot<ValueType> const> dftVot);
102
109 void translatePAND(std::shared_ptr<storm::dft::storage::elements::DFTPand<ValueType> const> dftPand, bool inclusive = true);
110
117 void translatePOR(std::shared_ptr<storm::dft::storage::elements::DFTPor<ValueType> const> dftPor, bool inclusive = true);
118
124 void translateSPARE(std::shared_ptr<storm::dft::storage::elements::DFTSpare<ValueType> const> dftSpare);
125
131 void translatePDEP(std::shared_ptr<storm::dft::storage::elements::DFTDependency<ValueType> const> dftDependency);
132
138 void translateSeq(std::shared_ptr<storm::dft::storage::elements::DFTSeq<ValueType> const> dftSeq);
139
147 bool isActiveInitially(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> dFTElement);
148
157 uint64_t getFailPriority(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> dFTElement);
158
168 uint64_t addFailedPlace(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> dftElement, storm::gspn::LayoutInfo const &layoutInfo,
169 bool initialFailed = false);
170
180 uint64_t addUnavailablePlace(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> dftElement,
181 storm::gspn::LayoutInfo const &layoutInfo, bool initialAvailable = true);
182
191 uint64_t addDisabledPlace(std::shared_ptr<storm::dft::storage::elements::DFTBE<ValueType> const> dftBe, storm::gspn::LayoutInfo const &layoutInfo);
192
201 uint64_t addDontcareTransition(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> dftElement,
202 storm::gspn::LayoutInfo const &layoutInfo);
203
211 uint64_t getFailedPlace(std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> dftElement) {
212 return failedPlaces.at(dftElement->id());
213 }
214
217
218 // Transformation options
219 // Flag indicating if smart semantics should be used. Smart semantics will only generate necessary parts of the GSPNs.
220 bool smart;
221 // Flag indicating if Don't Care places and Failed places should be merged.
222 bool mergedDCFailed;
223 // Flag indicating if extended priorities should be used for extended GreatSPN compatibility
224 bool extendedPriorities;
225 // Set of DFT elements which should have Don't Care propagation.
226 std::set<uint64_t> dontCareElements;
227 // Map from DFT elements to their GSPN priorities
228 std::map<uint64_t, uint64_t> priorities;
229 // Priority for Don't Care Transitions
230 uint64_t dontCarePriority;
231
232 // Interface places for DFT elements
233 std::vector<uint64_t> failedPlaces;
234 std::map<uint64_t, uint64_t> unavailablePlaces;
235 std::map<uint64_t, uint64_t> activePlaces;
236 std::map<uint64_t, uint64_t> disabledPlaces;
237 std::map<uint64_t, uint64_t> dependencyPropagationPlaces;
238 std::map<uint64_t, uint64_t> dontcareTransitions;
239
240 static constexpr const char *STR_FAILING =
241 "_failing"; // Name standard for transitions that point towards a place, which in turn indicates the failure of a gate.
242 static constexpr const char *STR_FAILED = "_failed"; // Name standard for place which indicates the failure of a gate.
243 static constexpr const char *STR_FAILSAVING =
244 "_failsaving"; // Name standard for transition that point towards a place, which in turn indicates the failsave state of a gate.
245 static constexpr const char *STR_FAILSAVE = "_failsave"; // Name standard for place which indicates the failsave state of a gate.
246 static constexpr const char *STR_ACTIVATING =
247 "_activating"; // Name standard for transition that point towards a place, which in turn indicates its activity.
248 static constexpr const char *STR_ACTIVATED = "_active"; // Name standard for place which indicates the activity.
249 static constexpr const char *STR_DONTCARE = "_dontcare"; // Name standard for place which indicates Don't Care.
250};
251
252} // namespace transformations
253} // namespace storm::dft
Represents a Dynamic Fault Tree.
Definition DFT.h:52
BE which is either constant failed or constant failsafe.
Definition BEConst.h:14
BE with exponential failure distribution.
Abstract base class for basic events (BEs) in DFTs.
Definition DFTBE.h:14
Dependency gate with probability p.
Abstract base class for DFT elements.
Definition DFTElement.h:39
Priority AND (PAND) gate.
Definition DFTPand.h:17
Priority OR (POR) gate.
Definition DFTPor.h:17
Sequence enforcer (SEQ).
Definition DFTSeq.h:15
VOT gate with threshold k.
Definition DFTVot.h:14
void transform(std::map< uint64_t, uint64_t > const &priorities, std::set< uint64_t > const &dontCareElements, bool smart=true, bool mergeDCFailed=true, bool extendPriorities=false)
Transform the DFT to a GSPN.
uint64_t toplevelFailedPlaceId()
Get failed place id of top level element.
std::map< uint64_t, uint64_t > computePriorities(bool extendedPrio)
Compute priorities used for GSPN transformation.