Search in sources :

Example 1 with SoteriaCompInst

use of edu.umn.cs.crisys.safety.analysis.soteria.SoteriaCompInst 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;
}
Also used : CompContractViolation(edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation) SoteriaCompInst(edu.umn.cs.crisys.safety.analysis.soteria.SoteriaCompInst) SoteriaCompConnection(edu.umn.cs.crisys.safety.analysis.soteria.SoteriaCompConnection)

Aggregations

CompContractViolation (edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation)1 SoteriaCompConnection (edu.umn.cs.crisys.safety.analysis.soteria.SoteriaCompConnection)1 SoteriaCompInst (edu.umn.cs.crisys.safety.analysis.soteria.SoteriaCompInst)1