Search in sources :

Example 6 with FaultSubcomponent

use of edu.umn.cs.crisys.safety.safety.FaultSubcomponent in project AMASE by loonwerks.

the class FaultASTBuilder method createCommNode.

/**
 * Create Lustre node for asymmetric fault connection nodes.
 *
 * @param node AgreeNode corresponds to the "sender" node that has the fan out connections.
 * 			   This is needed to access the type of connection for input/output of this node.
 * @param fstmt FaultStatement associated with the sender component output.
 * @param fault	Fault built from fault statement.
 * @param nodeName Name of asymmetric node.
 * @param connNumber How many connections from sender to receivers (used in naming).
 * @return Node : lustre node of this communication node.
 */
private Node createCommNode(AgreeNode node, FaultStatement fstmt, Fault fault, String nodeName, int connNumber) {
    // 1. Create unique node name
    NodeBuilder newNode = new NodeBuilder(nodeName);
    // 2. Get the output/input type from the node and the fstmt
    List<AgreeVar> nodeOutputs = node.outputs;
    AgreeVar outputOfInterest = null;
    // Assume asymmetric fault first in list.
    // Will have to display this to user somewhere.
    List<NamedElement> nomFaultConn = new ArrayList<NamedElement>();
    // Get the nominal connection
    for (FaultSubcomponent fs : fstmt.getFaultDefinitions()) {
        if (fs instanceof OutputStatement) {
            nomFaultConn = ((OutputStatement) fs).getNom_conn();
        }
    }
    // Get the agree node output that this fault is connected to
    for (AgreeVar agreeVar : nodeOutputs) {
        String temp = agreeVar.id;
        if (temp.contentEquals(nomFaultConn.get(0).getName())) {
            // This agreeVar is the sender var we want to save for the
            // later mapping to the receiver var.
            outputOfInterest = agreeVar;
        }
    }
    // Now the same type on the AgreeNode outputOfInterest
    // is the same as what we will create for the type of
    // both input and output of commNode.
    Type type = outputOfInterest.type;
    newNode = createInputForCommNode(newNode, fault, outputOfInterest.type, nodeName);
    newNode = createOutputForCommNode(newNode);
    newNode = createLocalsForCommNode(newNode, fault);
    newNode = createEquationsForCommNode(newNode, fault, type, nodeName);
    return newNode.build();
}
Also used : RecordType(jkind.lustre.RecordType) Type(jkind.lustre.Type) NamedType(jkind.lustre.NamedType) FaultSubcomponent(edu.umn.cs.crisys.safety.safety.FaultSubcomponent) ArrayList(java.util.ArrayList) NodeBuilder(jkind.lustre.builders.NodeBuilder) NamedElement(org.osate.aadl2.NamedElement) AgreeVar(com.rockwellcollins.atc.agree.analysis.ast.AgreeVar) OutputStatement(edu.umn.cs.crisys.safety.safety.OutputStatement)

Example 7 with FaultSubcomponent

use of edu.umn.cs.crisys.safety.safety.FaultSubcomponent in project AMASE by loonwerks.

the class SafetyScopeProvider method getNamedElementsFromSafetySpecs.

private Set<NamedElement> getNamedElementsFromSafetySpecs(EList<edu.umn.cs.crisys.safety.safety.SpecStatement> safetySpecs) {
    Set<NamedElement> nelms = new HashSet<>();
    EList<FaultSubcomponent> faultDefs = null;
    for (SpecStatement spec : safetySpecs) {
        if (spec instanceof FaultStatement) {
            FaultStatement fs = (FaultStatement) spec;
            faultDefs = fs.getFaultDefinitions();
            for (FaultSubcomponent fsub : faultDefs) {
                if (fsub instanceof SafetyEqStatement) {
                    SafetyEqStatement seq = (SafetyEqStatement) fsub;
                    if (seq instanceof EqValue) {
                        EqValue eqVal = (EqValue) seq;
                        nelms.addAll(eqVal.getLhs());
                    } else if (seq instanceof IntervalEq) {
                        IntervalEq eqVal = (IntervalEq) seq;
                        nelms.add(eqVal.getLhs_int());
                    }
                }
            }
        // nelms.add((NamedElement) spec);
        }
    }
    return nelms;
}
Also used : SafetyEqStatement(edu.umn.cs.crisys.safety.safety.SafetyEqStatement) FaultSubcomponent(edu.umn.cs.crisys.safety.safety.FaultSubcomponent) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) FaultStatement(edu.umn.cs.crisys.safety.safety.FaultStatement) IntervalEq(edu.umn.cs.crisys.safety.safety.IntervalEq) NamedElement(org.osate.aadl2.NamedElement) EqValue(edu.umn.cs.crisys.safety.safety.EqValue) HashSet(java.util.HashSet)

Aggregations

FaultSubcomponent (edu.umn.cs.crisys.safety.safety.FaultSubcomponent)7 NamedElement (org.osate.aadl2.NamedElement)3 FaultStatement (edu.umn.cs.crisys.safety.safety.FaultStatement)2 OutputStatement (edu.umn.cs.crisys.safety.safety.OutputStatement)2 FaultStatementImpl (edu.umn.cs.crisys.safety.safety.impl.FaultStatementImpl)2 ProbabilityStatementImpl (edu.umn.cs.crisys.safety.safety.impl.ProbabilityStatementImpl)2 ArrayList (java.util.ArrayList)2 SpecStatement (com.rockwellcollins.atc.agree.agree.SpecStatement)1 AgreeVar (com.rockwellcollins.atc.agree.analysis.ast.AgreeVar)1 SafetyException (edu.umn.cs.crisys.safety.analysis.SafetyException)1 FTLeafNode (edu.umn.cs.crisys.safety.analysis.faultTree.FTLeafNode)1 CompFaultActivation (edu.umn.cs.crisys.safety.analysis.soteria.CompFaultActivation)1 SoteriaFault (edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFault)1 DisableStatement (edu.umn.cs.crisys.safety.safety.DisableStatement)1 EqValue (edu.umn.cs.crisys.safety.safety.EqValue)1 HWFaultStatement (edu.umn.cs.crisys.safety.safety.HWFaultStatement)1 IntervalEq (edu.umn.cs.crisys.safety.safety.IntervalEq)1 PermanentConstraint (edu.umn.cs.crisys.safety.safety.PermanentConstraint)1 PropagationTypeStatement (edu.umn.cs.crisys.safety.safety.PropagationTypeStatement)1 SafetyEqStatement (edu.umn.cs.crisys.safety.safety.SafetyEqStatement)1