Search in sources :

Example 1 with SafetyJKindResult

use of edu.umn.cs.crisys.safety.analysis.results.SafetyJKindResult in project AMASE by loonwerks.

the class FaultsVerifyAllHandler method createVerification.

private AnalysisResult createVerification(String resultName, ComponentInstance compInst, Program lustreProgram, AgreeProgram agreeProgram, AnalysisType analysisType) {
    AgreeAutomaterRegistry aAReg = (AgreeAutomaterRegistry) ExtensionRegistry.getRegistry(ExtensionRegistry.AGREE_AUTOMATER_EXT_ID);
    List<AgreeAutomater> automaters = aAReg.getAgreeAutomaters();
    AgreeRenaming renaming = new AgreeRenaming();
    AgreeLayout layout = new AgreeLayout();
    Node mainNode = null;
    for (Node node : lustreProgram.nodes) {
        if (node.id.equals(lustreProgram.main)) {
            mainNode = node;
            break;
        }
    }
    if (mainNode == null) {
        throw new AgreeException("Could not find main lustre node after translation");
    }
    List<String> properties = new ArrayList<>();
    RenamingVisitor.addRenamings(lustreProgram, renaming, compInst, layout);
    addProperties(renaming, properties, mainNode, agreeProgram);
    for (AgreeAutomater aa : automaters) {
        renaming = aa.rename(renaming);
        layout = aa.transformLayout(layout);
    }
    JKindResult result;
    switch(analysisType) {
        case Consistency:
            result = new ConsistencyResult(resultName, mainNode.properties, Collections.singletonList(true), renaming);
            break;
        case Realizability:
            result = new JRealizabilityResult(resultName, renaming);
            break;
        case AssumeGuarantee:
            result = new SafetyJKindResult(resultName, properties, renaming);
            break;
        default:
            throw new AgreeException("Unhandled Analysis Type");
    }
    queue.add(result);
    ComponentImplementation compImpl = AgreeUtils.getInstanceImplementation(compInst);
    linker.setProgram(result, lustreProgram);
    linker.setComponent(result, compImpl);
    linker.setContract(result, getContract(compImpl));
    linker.setLayout(result, layout);
    linker.setReferenceMap(result, renaming.getRefMap());
    linker.setLog(result, AgreeLogger.getLog());
    linker.setRenaming(result, renaming);
    // System.out.println(program);
    return result;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) JRealizabilityResult(jkind.api.results.JRealizabilityResult) AgreeRenaming(com.rockwellcollins.atc.agree.analysis.AgreeRenaming) SafetyJKindResult(edu.umn.cs.crisys.safety.analysis.results.SafetyJKindResult) Node(jkind.lustre.Node) ArrayList(java.util.ArrayList) SafetyJKindResult(edu.umn.cs.crisys.safety.analysis.results.SafetyJKindResult) JKindResult(jkind.api.results.JKindResult) AgreeAutomaterRegistry(com.rockwellcollins.atc.agree.analysis.extentions.AgreeAutomaterRegistry) AgreeLayout(com.rockwellcollins.atc.agree.analysis.AgreeLayout) ConsistencyResult(com.rockwellcollins.atc.agree.analysis.ConsistencyResult) AgreeAutomater(com.rockwellcollins.atc.agree.analysis.extentions.AgreeAutomater) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException)

Aggregations

AgreeException (com.rockwellcollins.atc.agree.analysis.AgreeException)1 AgreeLayout (com.rockwellcollins.atc.agree.analysis.AgreeLayout)1 AgreeRenaming (com.rockwellcollins.atc.agree.analysis.AgreeRenaming)1 ConsistencyResult (com.rockwellcollins.atc.agree.analysis.ConsistencyResult)1 AgreeAutomater (com.rockwellcollins.atc.agree.analysis.extentions.AgreeAutomater)1 AgreeAutomaterRegistry (com.rockwellcollins.atc.agree.analysis.extentions.AgreeAutomaterRegistry)1 SafetyJKindResult (edu.umn.cs.crisys.safety.analysis.results.SafetyJKindResult)1 ArrayList (java.util.ArrayList)1 JKindResult (jkind.api.results.JKindResult)1 JRealizabilityResult (jkind.api.results.JRealizabilityResult)1 Node (jkind.lustre.Node)1 ComponentImplementation (org.osate.aadl2.ComponentImplementation)1