Browse Source

Extended Galileo parser to support parsing of Erlang distributions

tempestpy_adaptions
Matthias Volk 6 years ago
parent
commit
9cb53298fa
  1. 31
      src/storm-dft/parser/DFTGalileoParser.cpp
  2. 2
      src/storm-dft/parser/DFTGalileoParser.h

31
src/storm-dft/parser/DFTGalileoParser.cpp

@ -218,15 +218,23 @@ namespace storm {
STORM_LOG_THROW(distribution == Distribution::None, storm::exceptions::WrongFormatException, "A different distribution was already defined for this basic element.");
firstValDistribution = result.second;
distribution = Distribution::Constant;
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Constant distribution is not supported.");
}
// Exponential distribution
result = parseValue("lambda", line, valueParser);
if (result.first) {
STORM_LOG_THROW(distribution == Distribution::None, storm::exceptions::WrongFormatException, "A different distribution was already defined for this basic element.");
STORM_LOG_THROW(distribution == Distribution::None || distribution == Distribution::Erlang, storm::exceptions::WrongFormatException, "A different distribution was already defined for this basic element.");
firstValDistribution = result.second;
if (distribution == Distribution::None) {
distribution = Distribution::Exponential;
}
}
// Erlang distribution
result = parseValue("phases", line, valueParser);
if (result.first) {
STORM_LOG_THROW(distribution == Distribution::None || distribution == Distribution::Exponential, storm::exceptions::WrongFormatException, "A different distribution was already defined for this basic element.");
secondValDistribution = result.second;
distribution = Distribution::Erlang;
}
// Weibull distribution
result = parseValue("rate", line, valueParser);
if (result.first) {
@ -263,10 +271,14 @@ namespace storm {
STORM_LOG_WARN("Restoration is not supported and will be ignored.");
}
std::pair<bool, unsigned> resultNum = parseNumber("repl", line);
if (result.first) {
if (resultNum.first) {
replication = resultNum.second;
STORM_LOG_THROW(replication == 1, storm::exceptions::NotSupportedException, "Replication > 1 is not supported.");
}
result = parseValue("interval", line, valueParser);
if (result.first) {
STORM_LOG_WARN("Interval is not supported and will be ignored.");
}
result = parseValue("dorm", line, valueParser);
if (result.first) {
dormancyFactor = result.second;
@ -283,8 +295,21 @@ namespace storm {
case Exponential:
return builder.addBasicElement(parseName(name), firstValDistribution, dormancyFactor, false); // TODO set transient BEs
break;
case Erlang:
if (storm::utility::isOne<ValueType>(secondValDistribution)) {
// Erlang distribution reduces to exponential distribution
return builder.addBasicElement(parseName(name), firstValDistribution, dormancyFactor, false); // TODO set transient BEs
} else {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Erlang distribution is not supported.");
}
break;
case Weibull:
if (storm::utility::isOne<ValueType>(secondValDistribution)) {
// Weibull distribution reduces to exponential distribution
return builder.addBasicElement(parseName(name), firstValDistribution, dormancyFactor, false); // TODO set transient BEs
} else {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Weibull distribution is not supported.");
}
break;
case LogNormal:
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "LogNormal distribution is not supported.");

2
src/storm-dft/parser/DFTGalileoParser.h

@ -75,7 +75,7 @@ namespace storm {
*/
static std::pair<bool, unsigned> parseNumber(std::string name, std::string& line);
enum Distribution { None, Constant, Exponential, Weibull, LogNormal };
enum Distribution { None, Constant, Exponential, Erlang, Weibull, LogNormal };
};
}
}
Loading…
Cancel
Save