use of org.osate.result.AnalysisResult in project osate2 by osate.
the class ResultUtil method createAnalysisResult.
public static AnalysisResult createAnalysisResult(String name, EObject target) {
AnalysisResult result = ResultFactory.eINSTANCE.createAnalysisResult();
result.setModelElement(target);
result.setAnalysis(name);
return result;
}
use of org.osate.result.AnalysisResult in project osate2 by osate.
the class CreateFTAModel method createFTAAnalysisResult.
public static AnalysisResult createFTAAnalysisResult(EObject root, final String startingPoint, FaultTree ft) {
AnalysisResult ftaResults = ResultUtil.createAnalysisResult("FTA", root);
ResultUtil.addParameter(ftaResults, startingPoint);
ftaResults.setModelElement(root);
if (ft != null) {
Result result = ResultFactory.eINSTANCE.createResult();
ftaResults.getResults().add(result);
result.setModelElement(root);
result.setMessage("FTA occurrence probability results for " + ((InstanceObject) root).getName() + ":" + startingPoint);
Event rootevent = ft.getRoot();
BigDecimal asP = rootevent.getAssignedProbability();
BigDecimal coP = rootevent.getComputedProbability();
if (coP == null) {
addRealValue(result, 0.0);
} else {
addRealValue(result, coP.doubleValue());
}
if (asP == null) {
addRealValue(result, 0.0);
} else {
addRealValue(result, asP.doubleValue());
}
} else {
ftaResults.getResults().add(ResultUtil.createErrorResult("Fault tree analysis failed to run", root));
}
return ftaResults;
}
Aggregations