Search in sources :

Example 1 with TemporalConstraint

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

the class AddFaultsToNodeVisitor method constrainFaultActive.

/**
 * Method constrains hardware faults to be permanent.
 *
 * @param hwf      HardwareFault to be constrained.
 * @param nameBase Name of fault.
 * @param builder  AgreeNodeBuilder will have assertions added.
 */
public void constrainFaultActive(HWFault hwf, String nameBase, AgreeNodeBuilder builder) {
    IdExpr independentlyActiveExpr = new IdExpr(this.createFaultIndependentActiveId(nameBase));
    IdExpr dependentlyActiveExpr = new IdExpr(this.createFaultDependentActiveId(nameBase));
    IdExpr independentEventExpr = new IdExpr(this.createFaultEventId(nameBase));
    List<Expr> faultExprs = new ArrayList<>();
    // collect the list of source faults in the propagations
    // whose target fault is the current fault
    // the names of those source faults are created through
    // createFaultIndependentActiveId
    getSrcFaultExprList(hwf, faultExprs);
    // create a disjunction of the source faults as the triggering event
    // for the dependent fault
    Expr dependentEventExpr = buildFaultDisjunctionExpr(faultExprs, 0);
    Expr assertIndependentExpr;
    Expr assertDependentExpr;
    TemporalConstraint tc = hwf.duration.getTc();
    if (tc instanceof PermanentConstraint) {
        assertIndependentExpr = createPermanentExpr(independentlyActiveExpr, independentEventExpr);
        assertDependentExpr = createPermanentExpr(dependentlyActiveExpr, dependentEventExpr);
    } else if (tc instanceof TransientConstraint) {
        System.out.println("WARNING: ignoring duration on transient faults");
        assertIndependentExpr = createTransientExpr(independentlyActiveExpr, independentEventExpr);
        assertDependentExpr = createTransientExpr(dependentlyActiveExpr, dependentEventExpr);
    } else {
        throw new SafetyException("Unknown constraint type during translation of fault " + hwf.id + ". Constraint must be 'permanent'.");
    }
    builder.addAssertion(new AgreeStatement("", assertIndependentExpr, hwf.hwFaultStatement));
    builder.addAssertion(new AgreeStatement("", assertDependentExpr, hwf.hwFaultStatement));
}
Also used : AgreeStatement(com.rockwellcollins.atc.agree.analysis.ast.AgreeStatement) IdExpr(jkind.lustre.IdExpr) RecordAccessExpr(jkind.lustre.RecordAccessExpr) UnaryExpr(jkind.lustre.UnaryExpr) Expr(jkind.lustre.Expr) IntExpr(jkind.lustre.IntExpr) NodeCallExpr(jkind.lustre.NodeCallExpr) BoolExpr(jkind.lustre.BoolExpr) BinaryExpr(jkind.lustre.BinaryExpr) ArrayAccessExpr(jkind.lustre.ArrayAccessExpr) IdExpr(jkind.lustre.IdExpr) IfThenElseExpr(jkind.lustre.IfThenElseExpr) TransientConstraint(edu.umn.cs.crisys.safety.safety.TransientConstraint) PermanentConstraint(edu.umn.cs.crisys.safety.safety.PermanentConstraint) ArrayList(java.util.ArrayList) TemporalConstraint(edu.umn.cs.crisys.safety.safety.TemporalConstraint) SafetyException(edu.umn.cs.crisys.safety.analysis.SafetyException)

Example 2 with TemporalConstraint

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

the class DurationStatementImpl method basicSetTc.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetTc(TemporalConstraint newTc, NotificationChain msgs) {
    TemporalConstraint oldTc = tc;
    tc = newTc;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SafetyPackage.DURATION_STATEMENT__TC, oldTc, newTc);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TemporalConstraint(edu.umn.cs.crisys.safety.safety.TemporalConstraint)

Example 3 with TemporalConstraint

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

the class AddFaultsToNodeVisitor method constrainFaultActive.

/**
 * Constrains fault activity to permanent expression. If user attempts to create
 * transient, exception is thrown.
 *
 * @param f        Fault
 * @param nameBase Lustre name of fault
 * @param builder  The node builder that will have these assertions added.
 */
public void constrainFaultActive(Fault f, String nameBase, AgreeNodeBuilder builder) {
    IdExpr independentlyActiveExpr = new IdExpr(this.createFaultIndependentActiveId(nameBase));
    IdExpr dependentlyActiveExpr = new IdExpr(this.createFaultDependentActiveId(nameBase));
    IdExpr independentEventExpr = new IdExpr(this.createFaultEventId(nameBase));
    List<Expr> faultExprs = new ArrayList<>();
    // collect the list of source faults in the propagations
    // whose target fault is the current fault
    // the names of those source faults are created through
    // createFaultIndependentActiveId
    getSrcFaultExprList(f, faultExprs);
    // create a disjunction of the source faults as the triggering event
    // for the dependent fault
    Expr dependentEventExpr = buildFaultDisjunctionExpr(faultExprs, 0);
    Expr assertIndependentExpr;
    Expr assertDependentExpr;
    TemporalConstraint tc = f.duration.getTc();
    if (tc instanceof PermanentConstraint) {
        assertIndependentExpr = createPermanentExpr(independentlyActiveExpr, independentEventExpr);
        assertDependentExpr = createPermanentExpr(dependentlyActiveExpr, dependentEventExpr);
    } else if (tc instanceof TransientConstraint) {
        System.out.println("WARNING: ignoring duration on transient faults");
        assertIndependentExpr = createTransientExpr(independentlyActiveExpr, independentEventExpr);
        assertDependentExpr = createTransientExpr(dependentlyActiveExpr, dependentEventExpr);
    } else {
        throw new SafetyException("Unknown constraint type during translation of fault " + f.id + ". Constraint must be 'permanent'.");
    }
    builder.addAssertion(new AgreeStatement("", assertIndependentExpr, f.faultStatement));
    builder.addAssertion(new AgreeStatement("", assertDependentExpr, f.faultStatement));
}
Also used : AgreeStatement(com.rockwellcollins.atc.agree.analysis.ast.AgreeStatement) IdExpr(jkind.lustre.IdExpr) RecordAccessExpr(jkind.lustre.RecordAccessExpr) UnaryExpr(jkind.lustre.UnaryExpr) Expr(jkind.lustre.Expr) IntExpr(jkind.lustre.IntExpr) NodeCallExpr(jkind.lustre.NodeCallExpr) BoolExpr(jkind.lustre.BoolExpr) BinaryExpr(jkind.lustre.BinaryExpr) ArrayAccessExpr(jkind.lustre.ArrayAccessExpr) IdExpr(jkind.lustre.IdExpr) IfThenElseExpr(jkind.lustre.IfThenElseExpr) TransientConstraint(edu.umn.cs.crisys.safety.safety.TransientConstraint) PermanentConstraint(edu.umn.cs.crisys.safety.safety.PermanentConstraint) ArrayList(java.util.ArrayList) TemporalConstraint(edu.umn.cs.crisys.safety.safety.TemporalConstraint) SafetyException(edu.umn.cs.crisys.safety.analysis.SafetyException)

Aggregations

TemporalConstraint (edu.umn.cs.crisys.safety.safety.TemporalConstraint)3 AgreeStatement (com.rockwellcollins.atc.agree.analysis.ast.AgreeStatement)2 SafetyException (edu.umn.cs.crisys.safety.analysis.SafetyException)2 PermanentConstraint (edu.umn.cs.crisys.safety.safety.PermanentConstraint)2 TransientConstraint (edu.umn.cs.crisys.safety.safety.TransientConstraint)2 ArrayList (java.util.ArrayList)2 ArrayAccessExpr (jkind.lustre.ArrayAccessExpr)2 BinaryExpr (jkind.lustre.BinaryExpr)2 BoolExpr (jkind.lustre.BoolExpr)2 Expr (jkind.lustre.Expr)2 IdExpr (jkind.lustre.IdExpr)2 IfThenElseExpr (jkind.lustre.IfThenElseExpr)2 IntExpr (jkind.lustre.IntExpr)2 NodeCallExpr (jkind.lustre.NodeCallExpr)2 RecordAccessExpr (jkind.lustre.RecordAccessExpr)2 UnaryExpr (jkind.lustre.UnaryExpr)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1