Browse Source

Fixed JSON import after changes in BEs

tempestpy_adaptions
Matthias Volk 6 years ago
parent
commit
694c87c2b1
  1. 6
      src/storm-dft/parser/DFTJsonParser.cpp

6
src/storm-dft/parser/DFTJsonParser.cpp

@ -3,8 +3,9 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/lexical_cast.hpp>
#include "storm/exceptions/NotImplementedException.h" #include "storm/exceptions/NotImplementedException.h"
#include "storm/exceptions/FileIoException.h" #include "storm/exceptions/FileIoException.h"
#include "storm/exceptions/NotSupportedException.h" #include "storm/exceptions/NotSupportedException.h"
@ -92,11 +93,12 @@ namespace storm {
} else if (type == "pdep") { } else if (type == "pdep") {
ValueType probability = parseRationalExpression(parseJsonNumber(data.at("probability"))); ValueType probability = parseRationalExpression(parseJsonNumber(data.at("probability")));
success = builder.addDepElement(name, childNames, probability); success = builder.addDepElement(name, childNames, probability);
} else if (type == "be") {
} else if (boost::starts_with(type, "be")) {
std::string distribution = "exp"; // Set default of exponential distribution std::string distribution = "exp"; // Set default of exponential distribution
if (data.count("distribution") > 0) { if (data.count("distribution") > 0) {
distribution = data.at("distribution"); distribution = data.at("distribution");
} }
STORM_LOG_THROW(type == "be" || "be_" + distribution == type, storm::exceptions::WrongFormatException, "BE type '" << type << "' and distribution '" << distribution << " do not agree.");
if (distribution == "exp") { if (distribution == "exp") {
ValueType failureRate = parseRationalExpression(parseJsonNumber(data.at("rate"))); ValueType failureRate = parseRationalExpression(parseJsonNumber(data.at("rate")));
ValueType dormancyFactor = parseRationalExpression(parseJsonNumber(data.at("dorm"))); ValueType dormancyFactor = parseRationalExpression(parseJsonNumber(data.at("dorm")));

Loading…
Cancel
Save