Search in sources :

Example 1 with SafetyPropagation

use of edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation in project AMASE by loonwerks.

the class AddFaultsToNodeVisitor method getSrcFaultExprList.

/**
 * Method collect the list of expressions for the source faults in the
 * propagations whose target fault is the current fault.
 *
 * @param f          Fault in question (base fault)
 * @param faultExprs List of all fault expressions.
 */
public void getSrcFaultExprList(BaseFault f, List<Expr> faultExprs) {
    for (SafetyPropagation propagation : propagations) {
        if (propagation.destFault.equals(f)) {
            if (propagation.srcFault instanceof HWFault) {
                // use the triggering event for HW fault in the src fault expr, so to get the
                // effect
                // from both hw dependent and hw independent faults
                String interfaceVarId = addPathDelimiters(((HWFault) propagation.srcFault).path, this.createFaultNodeTriggerId(((HWFault) propagation.srcFault).id));
                faultExprs.add(new IdExpr(interfaceVarId));
            } else if (propagation.srcFault instanceof Fault) {
                String base = addPathDelimiters(((Fault) propagation.srcFault).path, ((Fault) propagation.srcFault).id);
                faultExprs.add(new IdExpr(this.createFaultIndependentActiveId(base)));
            }
        }
    }
}
Also used : IdExpr(jkind.lustre.IdExpr) SafetyPropagation(edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation) HWFault(edu.umn.cs.crisys.safety.analysis.transform.HWFault) BaseFault(edu.umn.cs.crisys.safety.analysis.transform.BaseFault) Fault(edu.umn.cs.crisys.safety.analysis.transform.Fault) HWFault(edu.umn.cs.crisys.safety.analysis.transform.HWFault)

Example 2 with SafetyPropagation

use of edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation in project AMASE by loonwerks.

the class AddFaultsToNodeVisitor method gatherFaultPropagation.

/**
 * Method gathers source and destination faults for hardware (dependent) faults.
 * Adds these to propagations list.
 *
 * @param node Agree Node with these spec statements.
 */
public void gatherFaultPropagation(AgreeNode node) {
    List<SpecStatement> specs = SafetyUtil.collapseAnnexes(SafetyUtil.getSafetyAnnexes(node, true));
    for (SpecStatement s : specs) {
        if (s instanceof PropagateStatement) {
            PropagateStatement ps = (PropagateStatement) s;
            Iterator<String> srcFaultIt = ps.getSrcFaultList().iterator();
            Iterator<NamedElement> srcCompPathIt = ps.getSrcComp_path().iterator();
            // create a SafetyPropagation
            BaseFault srcFault = null;
            // for each src fault name and path, locate the fault
            while (srcFaultIt.hasNext() && srcCompPathIt.hasNext()) {
                NamedElement srcCompPath = srcCompPathIt.next();
                String srcFaultName = srcFaultIt.next();
                srcFault = findFaultInCompInst(srcFaultName, srcCompPath);
                if (srcFault != null) {
                    // for each destination fault name and path, locate the fault
                    BaseFault destFault = null;
                    Iterator<String> destFaultIt = ps.getDestFaultList().iterator();
                    Iterator<NamedElement> destCompPathIt = ps.getDestComp_path().iterator();
                    while (destFaultIt.hasNext() && destCompPathIt.hasNext()) {
                        NamedElement destCompPath = destCompPathIt.next();
                        String destFaultName = destFaultIt.next();
                        destFault = findFaultInCompInst(destFaultName, destCompPath);
                        SafetyPropagation propagation = new SafetyPropagation(srcFault, destFault);
                        propagations.add(propagation);
                    }
                } else {
                    throw new SafetyException("Unable to identify fault in propagation statement:" + " a possibility is that the source or destination fault is disabled.");
                }
            }
        }
    }
}
Also used : BaseFault(edu.umn.cs.crisys.safety.analysis.transform.BaseFault) SafetyPropagation(edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation) SpecStatement(edu.umn.cs.crisys.safety.safety.SpecStatement) PropagateStatement(edu.umn.cs.crisys.safety.safety.PropagateStatement) SafetyException(edu.umn.cs.crisys.safety.analysis.SafetyException) NamedElement(org.osate.aadl2.NamedElement)

Example 3 with SafetyPropagation

use of edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation in project AMASE by loonwerks.

the class AddFaultsToNodeVisitor method adjustForDependentFaults.

/**
 * Method adjusts allowable combinations for the dependent faults.
 *
 * If the propagations set is not empty, then for each fault in each valid fault
 * combination, see if it appears as a source fault in the propagations. If yes,
 * insert the destination fault in the same valid fault combination (fault set)
 * without changing the fault set's probability.
 *
 * @param faultCombinationsAboveThreshold Allowable combinations
 * @param elementProbabilities            Prob of elements
 */
private void adjustForDependentFaults(ArrayList<FaultSetProbability> faultCombinationsAboveThreshold, ArrayList<FaultProbability> elementProbabilities) {
    if (!propagations.isEmpty()) {
        int index = 0;
        // go through the fault combinations
        for (FaultSetProbability fsp : faultCombinationsAboveThreshold) {
            FaultSetProbability currentSet = fsp;
            boolean changed = false;
            // for each fault probability in a combination set
            for (FaultProbability fp : fsp.elements) {
                // see if the fault appears as a source fault in a propagation
                for (SafetyPropagation propagation : propagations) {
                    // if yes, get the destination fault
                    if (propagation.srcFault.equals(fp.fault)) {
                        BaseFault newFault = propagation.destFault;
                        changed = true;
                        // will be removed from the original list later)
                        for (FaultProbability element : elementProbabilities) {
                            if (newFault.equals(element.fault)) {
                                currentSet = new FaultSetProbability(fsp.probability, currentSet, element);
                            }
                        }
                    }
                }
            }
            if (changed) {
                faultCombinationsAboveThreshold.set(index, currentSet);
            }
            index++;
        }
    }
}
Also used : BaseFault(edu.umn.cs.crisys.safety.analysis.transform.BaseFault) SafetyPropagation(edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation) TransientConstraint(edu.umn.cs.crisys.safety.safety.TransientConstraint) PermanentConstraint(edu.umn.cs.crisys.safety.safety.PermanentConstraint) TemporalConstraint(edu.umn.cs.crisys.safety.safety.TemporalConstraint)

Aggregations

SafetyPropagation (edu.umn.cs.crisys.safety.analysis.ast.SafetyPropagation)3 BaseFault (edu.umn.cs.crisys.safety.analysis.transform.BaseFault)3 SafetyException (edu.umn.cs.crisys.safety.analysis.SafetyException)1 Fault (edu.umn.cs.crisys.safety.analysis.transform.Fault)1 HWFault (edu.umn.cs.crisys.safety.analysis.transform.HWFault)1 PermanentConstraint (edu.umn.cs.crisys.safety.safety.PermanentConstraint)1 PropagateStatement (edu.umn.cs.crisys.safety.safety.PropagateStatement)1 SpecStatement (edu.umn.cs.crisys.safety.safety.SpecStatement)1 TemporalConstraint (edu.umn.cs.crisys.safety.safety.TemporalConstraint)1 TransientConstraint (edu.umn.cs.crisys.safety.safety.TransientConstraint)1 IdExpr (jkind.lustre.IdExpr)1 NamedElement (org.osate.aadl2.NamedElement)1