use of edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation in project AMASE by loonwerks.
the class SoteriaPrettyPrintVisitor method visit.
@Override
public Void visit(SoteriaModel model) {
write(model.includeStr);
newline();
model.compLib.accept(this);
newline();
// create a model for each top level fault
String firstModelName = null;
for (CompContractViolation topLevelFault : model.topLevelFaults) {
String modelName = "model_" + topLevelFault.contractString.replace(" ", "_");
String compLibName = model.compLib.compLibName;
writeln("(* ----- COMPONENT INSTANCES, CONNECTIONS, OUT RANGE TOP LEVEL FAULT ----- *)");
writeln("let " + modelName + " = ");
// write instances and connections declarations in the first model
if (firstModelName == null) {
firstModelName = modelName;
writeln("{instances = ");
write("[");
for (SoteriaCompInst compInst : model.compInstList) {
compInst.accept(this);
}
writeln("];");
writeln("connections = ");
write("[");
for (SoteriaCompConnection connection : model.connectionList) {
connection.accept(this);
}
writeln("];");
} else // create references to the instances and connections declarations in subsequent models
{
writeln("{instances = " + firstModelName + ".instances;");
writeln("connections=" + firstModelName + ".connections;");
}
// write top level fault for the model
write("top_fault = (");
write("\"" + topLevelFault.compName + "\", ");
write("F[\"" + topLevelFault.contractString + "\"; ");
write("\"" + topLevelFault.contractViolationFaultStr + "\"]");
write(")");
writeln("} ;;");
newline();
// create model checks
createModelChecks(modelName, compLibName);
// create pre-analyses model visualizations
preAnalysesVisualizations(modelName, compLibName);
// model analyses
// TODO: uncomment the following after further investigation
// with regard to why soteria model_to_ftree not able to handle more than
// 5 conjunctions in a formula
// modelAnalysesAndVisualization(modelName, compLibName);
// create post-analyses model visualizations
}
return null;
}
use of edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation in project AMASE by loonwerks.
the class IvcToSoteriaGenerator method extractContractIvcElem.
private void extractContractIvcElem(SoteriaComp comp, SoteriaFormulaSubgroup formulaSubgroup, String propertyName) {
// add each ivc element that are verified contracts from subsequent layer to component inputs (sans duplicate)
comp.addInput(propertyName);
CompContractViolation contractViolation = new CompContractViolation(comp.componentName, propertyName);
formulaSubgroup.addFormulaElem(contractViolation);
}
use of edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation in project AMASE by loonwerks.
the class IvcToSoteriaGenerator method extractPropertyResult.
private void extractPropertyResult(SoteriaComp comp, AgreeRenaming renaming, PropertyResult propertyResult) {
// get original property name
String origPropertyName = propertyResult.getName();
String lustreName = renaming.getLustreNameFromAgreeVar(origPropertyName);
String propertyName = updateElemName(comp.componentName + "_" + lustreName);
// if it is a guarantee
if (lustreName.startsWith("__GUARANTEE")) {
// if it's a valid guarantee
if (propertyResult.getStatus().equals(jkind.api.results.Status.VALID)) {
// add property as an output to the soteria map
comp.addOutput(propertyName);
// add property violation as a top level fault to the model
if (!isLowerLevel) {
CompContractViolation contractViolation = new CompContractViolation(comp.componentName, propertyName);
model.addTopLevelFault(contractViolation);
}
ValidProperty property = (ValidProperty) propertyResult.getProperty();
SoteriaFormula formula = new SoteriaFormula(propertyName);
// handle multiple ivc sets
for (List<String> ivcSet : property.getIvcSets()) {
SoteriaFormulaSubgroup formulaSubgroup = new SoteriaFormulaSubgroup(propertyName);
extractIvcSets(comp, renaming, formulaSubgroup, ivcSet);
if (!formulaSubgroup.elmeList.isEmpty()) {
formula.addFormulaSubgroup(formulaSubgroup);
}
}
if (!formula.formulaBody.isEmpty()) {
comp.addFormula(propertyName, formula);
}
} else if (propertyResult.getStatus().equals(jkind.api.results.Status.CANCELED)) {
throw new SafetyException("One of the properties was canceled in the process of model checking." + " Rerun this analysis to proceed.");
} else if (propertyResult.getStatus().equals(jkind.api.results.Status.INVALID)) {
throw new SafetyException("One of the properties is invalid. The model must be valid using AGREE Verify All Layers.");
}
}
}
Aggregations