Search in sources :

Example 1 with EvaluationException

use of edu.uah.rsesc.aadlsimulator.agree.eval.EvaluationException in project AGREE by loonwerks.

the class AGREESimulationState method createEvaluator.

private Evaluator createEvaluator(final Collection<Expr> constraints, final Set<SimulationProperty> disabledProperties) {
    try {
        final SimulationFrameResults lastFrameResults = frameInfos.size() == 0 ? null : frameInfos.get(frameInfos.size() - 1).getFrameResults();
        final List<Expr> assertions = new ArrayList<Expr>();
        FrameAssertionHelper.addNextFrameAssertions(simulationProgram, lastFrameResults, assertions);
        assertions.addAll(constraints);
        // Add assertions for property enablement variables
        for (final SimulationProperty simProp : simulationProgram.getSimulationProperties()) {
            if (simProp.getEnablementVariableId() != null) {
                assertions.add(new BinaryExpr(new IdExpr(simProp.getEnablementVariableId()), BinaryOp.EQUAL, new BoolExpr(disabledProperties.contains(simProp) ? false : true)));
            }
        }
        // Create the new evaluator
        return new Evaluator(baseEvaluator, assertions);
    } catch (EvaluationException ex) {
        return null;
    }
}
Also used : BoolExpr(jkind.lustre.BoolExpr) SimulationFrameResults(edu.uah.rsesc.aadlsimulator.agree.sim.SimulationFrameResults) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) Expr(jkind.lustre.Expr) BoolExpr(jkind.lustre.BoolExpr) BinaryExpr(jkind.lustre.BinaryExpr) IdExpr(jkind.lustre.IdExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) IdExpr(jkind.lustre.IdExpr) BinaryExpr(jkind.lustre.BinaryExpr) ArrayList(java.util.ArrayList) SimulationProperty(edu.uah.rsesc.aadlsimulator.agree.SimulationProperty) EvaluationException(edu.uah.rsesc.aadlsimulator.agree.eval.EvaluationException) Evaluator(edu.uah.rsesc.aadlsimulator.agree.eval.Evaluator)

Aggregations

BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)1 IntLitExpr (com.rockwellcollins.atc.agree.agree.IntLitExpr)1 RealLitExpr (com.rockwellcollins.atc.agree.agree.RealLitExpr)1 SimulationProperty (edu.uah.rsesc.aadlsimulator.agree.SimulationProperty)1 EvaluationException (edu.uah.rsesc.aadlsimulator.agree.eval.EvaluationException)1 Evaluator (edu.uah.rsesc.aadlsimulator.agree.eval.Evaluator)1 SimulationFrameResults (edu.uah.rsesc.aadlsimulator.agree.sim.SimulationFrameResults)1 ArrayList (java.util.ArrayList)1 BinaryExpr (jkind.lustre.BinaryExpr)1 BoolExpr (jkind.lustre.BoolExpr)1 Expr (jkind.lustre.Expr)1 IdExpr (jkind.lustre.IdExpr)1