/// <summary>
        /// Provides the surface of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the surface</param>
        /// <returns></returns>
        public override Surface createSurface(Interpreter.InterpretationContext context)
        {
            Surface retVal = null;

            Values.IValue firstValue   = context.findOnStack(First).Value;
            Values.IValue secondValue  = context.findOnStack(Second).Value;
            Surface       firstSurface = createSurfaceForValue(context, firstValue);

            if (firstSurface != null)
            {
                Surface secondSurface = createSurfaceForValue(context, secondValue);
                if (secondSurface != null)
                {
                    retVal = firstSurface.Min(secondSurface);
                }
                else
                {
                    Log.Error("Cannot create surface for " + Second.ToString());
                }
            }
            else
            {
                Log.Error("Cannot create surface for " + First.ToString());
            }

            return(retVal);
        }
예제 #2
0
        /// <summary>
        /// Provides the graph of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the graph</param>
        /// <returns></returns>
        public override Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = null;

            Graph firstGraph = createGraphForValue(context, context.findOnStack(First).Value);

            if (firstGraph != null)
            {
                Graph secondGraph = createGraphForValue(context, context.findOnStack(Second).Value);
                if (secondGraph != null)
                {
                    retVal = firstGraph.Min(secondGraph);
                }
                else
                {
                    Log.Error("Cannot create graph for " + Second.ToString());
                }
            }
            else
            {
                Log.Error("Cannot create graph for " + First.ToString());
            }

            return(retVal);
        }
예제 #3
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);
            Functions.Function function = context.findOnStack(Function).Value as Functions.Function;
            if (function != null)
            {
                double speed = Functions.Function.getDoubleValue(context.findOnStack(Speed).Value);

                Parameter parameter = (Parameter)function.FormalParameters[0];
                int       token2    = context.LocalScope.PushContext();
                context.LocalScope.setGraphParameter(parameter);
                Graph graph = function.createGraph(context, (Parameter)function.FormalParameters[0]);
                context.LocalScope.PopContext(token2);
                retVal = new Values.DoubleValue(EFSSystem.DoubleType, graph.SolutionX(speed));
            }
            else
            {
                Log.Error("Cannot get function for " + Function.ToString());
            }
            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #4
0
        /// <summary>
        /// Provides the surface of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the surface</param>
        /// <returns></returns>
        public override Surface createSurface(Interpreter.InterpretationContext context)
        {
            Surface retVal = null;

            Surface defaultSurface = createSurfaceForValue(context, context.findOnStack(DefaultFunction).Value);

            if (defaultSurface != null)
            {
                Surface overrideSurface = createSurfaceForValue(context, context.findOnStack(OverrideFunction).Value);
                if (overrideSurface != null)
                {
                    retVal = defaultSurface.Override(overrideSurface);
                }
                else
                {
                    Log.Error("Cannot create graph for OVERRIDE argument");
                }
            }
            else
            {
                Log.Error("Cannot create graph for DEFAULT argument");
            }

            return(retVal);
        }
        /// <summary>
        /// Provides the graph of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the graph</param>
        /// <returns></returns>
        public override Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = null;

            Graph graph = null;

            Function function = context.findOnStack(Function).Value as Function;

            if (function != null)
            {
                int       token = context.LocalScope.PushContext();
                Parameter p     = (Parameter)function.FormalParameters[0];
                context.LocalScope.setGraphParameter(p);
                graph = createGraphForValue(context, function, p);
                context.LocalScope.PopContext(token);
            }

            if (graph != null)
            {
                Function increment = context.findOnStack(Increment).Value as Function;
                retVal = graph.AddIncrement(context, increment);
            }
            else
            {
                Log.Error("Cannot create graph for " + Function.ToString());
            }

            return(retVal);
        }
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            AssignParameters(context, actuals);
            Graph graph = createGraphForValue(context, context.findOnStack(FunctionA).Value);

            if (graph != null)
            {
                foreach (Graph.Segment segment in graph.Segments)
                {
                    if (segment.Expression.a == 0.0)
                    {
                        double speed = segment.Expression.v0;

                        Function function = context.findOnStack(FunctionB).Value as Function;
                        if (function.FormalParameters.Count > 0)
                        {
                            Parameter        functionParameter = function.FormalParameters[0] as Parameter;
                            Variables.Actual actual            = functionParameter.createActual();
                            actual.Value = new Values.DoubleValue(EFSSystem.DoubleType, speed);
                            Dictionary <Variables.Actual, Values.IValue> values = new Dictionary <Variables.Actual, Values.IValue>();
                            values[actual] = new Values.DoubleValue(EFSSystem.DoubleType, speed);
                            Values.IValue solution    = function.Evaluate(context, values);
                            double        doubleValue = getDoubleValue(solution);

                            if (doubleValue >= segment.Start && doubleValue <= segment.End)
                            {
                                retVal = new Values.DoubleValue(EFSSystem.DoubleType, doubleValue);
                                break;
                            }
                        }
                        else
                        {
                            Log.Error("The FunctionB doesn't have any parameter");
                            break;
                        }
                    }
                    else
                    {
                        Log.Error("The FunctionA is not a step function");
                        break;
                    }
                }
            }
            else
            {
                Log.Error("Cannot create graph for " + FunctionA.ToString());
            }

            if (retVal == null)
            {
                Log.Error("Cannot compute the intersection of " + FunctionA.ToString() + " and " + FunctionB.ToString());
            }

            return(retVal);
        }
예제 #7
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = EFSSystem.BoolType.False;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);

            Values.ListValue collection = context.findOnStack(Collection).Value as Values.ListValue;
            if (collection != null)
            {
                Values.IValue expectedFirst = context.findOnStack(ExpectedFirst).Value;
                if (expectedFirst != null)
                {
                    int firstIndex = collection.Val.IndexOf(expectedFirst);
                    if (firstIndex >= 0)
                    {
                        Values.IValue expectedSecond = context.findOnStack(ExpectedSecond).Value;
                        if (expectedSecond != null)
                        {
                            int secondIndex = collection.Val.IndexOf(expectedSecond);

                            if (secondIndex >= 0)
                            {
                                if (firstIndex < secondIndex)
                                {
                                    retVal = EFSSystem.BoolType.True;
                                }
                            }
                            else
                            {
                                Collection.AddError("Cannot find " + expectedSecond.FullName + " in " + collection.ToString() + " to evaluate " + Name);
                            }
                        }
                        else
                        {
                            Collection.AddError("Cannot evaluate second element to evaluate " + Name);
                        }
                    }
                    else
                    {
                        Collection.AddError("Cannot find " + expectedFirst.FullName + " in " + collection.ToString() + " to evaluate " + Name);
                    }
                }
                else
                {
                    Collection.AddError("Cannot evaluate first element to evaluate " + Name);
                }
            }
            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #8
0
        /// <summary>
        /// Indicates whether the expression is based on a placeholder value, ommiting the parameter provided
        /// </summary>
        /// <param name="context">The current interpretation context</param>
        /// <param name="expression">The expression to evaluate</param>
        /// <returns></returns>
        private bool ExpressionBasedOnPlaceHolder(Interpreter.InterpretationContext context, Interpreter.BinaryExpression expression)
        {
            bool retVal = false;

            if (expression != null)
            {
                foreach (Types.ITypedElement element in expression.GetRightSides())
                {
                    Parameter parameter = element as Parameter;
                    if (parameter != null)
                    {
                        Variables.IVariable variable = context.findOnStack(parameter);
                        if (variable != null)
                        {
                            Values.PlaceHolder placeHolder = variable.Value as Values.PlaceHolder;

                            if (placeHolder != null)
                            {
                                retVal = true;
                                break;
                            }
                        }
                    }
                }
            }

            return(retVal);
        }
예제 #9
0
        /// <summary>
        /// Provides the graph of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the graph</param>
        /// <returns></returns>
        public virtual Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = Graph;

            if (retVal == null)
            {
                try
                {
                    Interpreter.InterpretationContext ctxt = new Interpreter.InterpretationContext(context);
                    if (Cases.Count > 0)
                    {
                        // For now, just create graphs for functions using 0 or 1 parameter.
                        if (FormalParameters.Count == 0)
                        {
                            Values.IValue value = Evaluate(ctxt, new Dictionary <Variables.Actual, Values.IValue>());
                            retVal = Graph.createGraph(value, parameter);
                        }
                        else if (FormalParameters.Count == 1)
                        {
                            Parameter     param       = (Parameter)FormalParameters[0];
                            int           token       = ctxt.LocalScope.PushContext();
                            Values.IValue actualValue = null;
                            if (parameter != null)
                            {
                                Variables.IVariable actual = ctxt.findOnStack(parameter);
                                if (actual != null)
                                {
                                    actualValue = actual.Value;
                                }
                                else
                                {
                                    actualValue = new Values.PlaceHolder(parameter.Type, 1);
                                }

                                ctxt.LocalScope.setParameter(param, actualValue);
                            }
                            retVal = createGraphForParameter(ctxt, param);

                            if (getCacheable() && actualValue is Values.PlaceHolder)
                            {
                                Graph = retVal;
                            }

                            ctxt.LocalScope.PopContext(token);
                        }
                        else
                        {
                            Values.IValue value = Evaluate(ctxt, new Dictionary <Variables.Actual, Values.IValue>());
                            retVal = Graph.createGraph(value, parameter);
                        }
                    }
                }
                catch (Exception e)
                {
                    AddError("Cannot create graph of function, reason : " + e.Message);
                }
            }

            return(retVal);
        }
예제 #10
0
        /// <summary>
        /// Provides the graph of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the graph</param>
        /// <returns></returns>
        public override Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = null;

            Graph graph = createGraphForValue(context, context.findOnStack(Function).Value, parameter);

            if (graph != null)
            {
                double speed = Functions.Function.getDoubleValue(context.findOnStack(Speed).Value);
                retVal = Graph.createGraph(graph.SolutionX(speed));
            }
            else
            {
                Log.Error("Cannot create graph for " + Function.ToString());
            }

            return(retVal);
        }
예제 #11
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);

            Types.Collection collectionType = (Types.Collection)EFSSystem.findType(OverallNameSpaceFinder.INSTANCE.findByName(EFSSystem.Dictionaries[0], "Kernel.SpeedAndDistanceMonitoring.TargetSupervision"), "Kernel.SpeedAndDistanceMonitoring.TargetSupervision.Targets");
            Values.ListValue collection     = new Values.ListValue(collectionType, new List <Values.IValue>());

            // compute targets from the MRSP
            Function function1 = context.findOnStack(Targets1).Value as Functions.Function;

            if (function1 != null && !function1.Name.Equals("EMPTY"))
            {
                Graph graph1 = createGraphForValue(context, function1);
                ComputeTargets(graph1.Function, collection);
            }

            // compute targets from the MA
            Function function2 = context.findOnStack(Targets2).Value as Functions.Function;

            if (function2 != null && !function2.Name.Equals("EMPTY"))
            {
                Graph graph2 = createGraphForValue(context, function2);
                ComputeTargets(graph2.Function, collection);
            }

            // compute targets from the SR
            Function function3 = context.findOnStack(Targets3).Value as Functions.Function;

            if (function3 != null && !function3.Name.Equals("EMPTY"))
            {
                Graph graph3 = createGraphForValue(context, function3);
                ComputeTargets(graph3.Function, collection);
            }

            context.LocalScope.PopContext(token);

            retVal = collection;
            return(retVal);
        }
예제 #12
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);

            Values.DoubleValue value    = context.findOnStack(Value).Value as Values.DoubleValue;
            Values.DoubleValue multiple = context.findOnStack(Multiple).Value as Values.DoubleValue;
            if (value != null && multiple != null)
            {
                double res = Math.Floor(value.Val);
                while (res > 0 && res % multiple.Val != 0)
                {
                    res--;
                }
                retVal = new Values.DoubleValue(ReturnType, res);
            }

            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #13
0
        public override Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = null;

            Variables.IVariable variable = context.findOnStack(Value);

            if (variable != null)
            {
                retVal = Graph.createGraph(Functions.Function.getDoubleValue(variable.Value), parameter);
            }
            else
            {
                AddError("Cannot find variable " + Value + " on the stack");
            }

            return(retVal);
        }
예제 #14
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = EFSSystem.BoolType.False;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);

            if (context.findOnStack(Element).Value != EFSSystem.EmptyValue)
            {
                retVal = EFSSystem.BoolType.True;
            }

            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #15
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);
            Values.IValue value = context.findOnStack(Value).Value;
            if (value is Function)
            {
                retVal = value;
            }
            else
            {
                retVal = Range.convert(value);
            }
            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #16
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);
            Values.BoolValue val = context.findOnStack(Value).Value as Values.BoolValue;
            if (val != null)
            {
                if (val.Val)
                {
                    retVal = EFSSystem.BoolType.False;
                }
                else
                {
                    retVal = EFSSystem.BoolType.True;
                }
            }
            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #17
0
        /// <summary>
        /// Provides the value of the function
        /// </summary>
        /// <param name="instance">the instance on which the function is evaluated</param>
        /// <param name="actuals">the actual parameters values</param>
        /// <param name="localScope">the values of local variables</param>
        /// <returns>The value for the function application</returns>
        public override Values.IValue Evaluate(Interpreter.InterpretationContext context, Dictionary <Variables.Actual, Values.IValue> actuals)
        {
            Values.IValue retVal = null;

            int token = context.LocalScope.PushContext();

            AssignParameters(context, actuals);

            Values.ListValue value = context.findOnStack(Collection) as Values.ListValue;
            if (value != null)
            {
                Types.Collection collectionType = value.Type as Types.Collection;
                if (collectionType != null && collectionType.Type != null)
                {
                    Types.Type elementType = collectionType.Type;

                    int i = 0;
                    while (i < value.Val.Count && value.Val[i] != EFSSystem.EmptyValue)
                    {
                        i += 1;
                    }

                    if (i < value.Val.Count)
                    {
                        retVal       = elementType.DefaultValue;
                        value.Val[i] = retVal;
                    }
                    else
                    {
                        AddError("Cannot allocate element in list : list full");
                    }
                }
            }
            context.LocalScope.PopContext(token);

            return(retVal);
        }
예제 #18
0
        /// <summary>
        /// Provides the graph of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the graph</param>
        /// <returns></returns>
        public virtual Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = Graph;

            if (retVal == null)
            {
                try
                {
                    Interpreter.InterpretationContext ctxt = new Interpreter.InterpretationContext(context);
                    if (Cases.Count > 0)
                    {
                        // For now, just create graphs for functions using 0 or 1 parameter.
                        if (FormalParameters.Count == 0)
                        {
                            Values.IValue value = Evaluate(ctxt, new Dictionary<Variables.Actual, Values.IValue>());
                            retVal = Graph.createGraph(value, parameter);
                        }
                        else if (FormalParameters.Count == 1)
                        {
                            Parameter param = (Parameter)FormalParameters[0];
                            int token = ctxt.LocalScope.PushContext();
                            Values.IValue actualValue = null;
                            if (parameter != null)
                            {
                                Variables.IVariable actual = ctxt.findOnStack(parameter);
                                if (actual != null)
                                {
                                    actualValue = actual.Value;
                                }
                                else
                                {
                                    actualValue = new Values.PlaceHolder(parameter.Type, 1);
                                }

                                ctxt.LocalScope.setParameter(param, actualValue);
                            }
                            retVal = createGraphForParameter(ctxt, param);

                            if (getCacheable() && actualValue is Values.PlaceHolder)
                            {
                                Graph = retVal;
                            }

                            ctxt.LocalScope.PopContext(token);
                        }
                        else
                        {
                            Values.IValue value = Evaluate(ctxt, new Dictionary<Variables.Actual, Values.IValue>());
                            retVal = Graph.createGraph(value, parameter);
                        }
                    }
                }
                catch (Exception e)
                {
                    AddError("Cannot create graph of function, reason : " + e.Message);
                }
            }

            return retVal;
        }
        /// <summary>
        /// Provides the graph of this function if it has been statically defined
        /// </summary>
        /// <param name="context">the context used to create the graph</param>
        /// <returns></returns>
        public override Graph createGraph(Interpreter.InterpretationContext context, Parameter parameter)
        {
            Graph retVal = null;

            Graph    MRSPGraph        = null;
            Function speedRestriction = context.findOnStack(SpeedRestrictions).Value as Function;

            if (speedRestriction != null)
            {
                Parameter p = (Parameter)speedRestriction.FormalParameters[0];

                int token = context.LocalScope.PushContext();
                context.LocalScope.setGraphParameter(p);
                MRSPGraph = createGraphForValue(context, context.findOnStack(SpeedRestrictions).Value, p);
                context.LocalScope.PopContext(token);
            }

            if (MRSPGraph != null)
            {
                Function deceleratorFactor = context.findOnStack(DecelerationFactor).Value as Function;
                if (deceleratorFactor != null)
                {
                    Surface DecelerationSurface = deceleratorFactor.createSurface(context);
                    if (DecelerationSurface != null)
                    {
                        FlatSpeedDistanceCurve           MRSPCurve           = MRSPGraph.FlatSpeedDistanceCurve(MRSPGraph.ExpectedEndX());
                        AccelerationSpeedDistanceSurface accelerationSurface = DecelerationSurface.createAccelerationSpeedDistanceSurface(double.MaxValue, double.MaxValue);
                        QuadraticSpeedDistanceCurve      BrakingCurve        = null;
                        try
                        {
                            BrakingCurve = EtcsBrakingCurveBuilder.Build_A_Safe_Backward(accelerationSurface, MRSPCurve);
                        }
                        catch (System.Exception e)
                        {
                            retVal = new Graph();
                            retVal.addSegment(new Graph.Segment(0, double.MaxValue, new Graph.Segment.Curve(0, 0, 0)));
                        }

                        if (BrakingCurve != null)
                        {
                            retVal = new Graph();

                            // TODO : Remove the distinction between linear curves and quadratic curves
                            bool isLinear = true;
                            for (int i = 0; i < BrakingCurve.SegmentCount; i++)
                            {
                                QuadraticCurveSegment segment = BrakingCurve[i];
                                if (segment.A.ToUnits() != 0.0 || segment.V0.ToUnits() != 0.0)
                                {
                                    isLinear = false;
                                    break;
                                }
                            }

                            for (int i = 0; i < BrakingCurve.SegmentCount; i++)
                            {
                                QuadraticCurveSegment segment = BrakingCurve[i];

                                Graph.Segment newSegment;
                                if (isLinear)
                                {
                                    newSegment = new Graph.Segment(
                                        segment.X.X0.ToUnits(),
                                        segment.X.X1.ToUnits(),
                                        new Graph.Segment.Curve(0.0, segment.V0.ToSubUnits(SiSpeed_SubUnits.KiloMeter_per_Hour), 0.0));
                                }
                                else
                                {
                                    newSegment = new Graph.Segment(
                                        segment.X.X0.ToUnits(),
                                        segment.X.X1.ToUnits(),
                                        new Graph.Segment.Curve(
                                            segment.A.ToSubUnits(SiAcceleration_SubUnits.Meter_per_SecondSquare),
                                            segment.V0.ToSubUnits(SiSpeed_SubUnits.KiloMeter_per_Hour),
                                            segment.D0.ToSubUnits(SiDistance_SubUnits.Meter)
                                            )
                                        );
                                }
                                retVal.addSegment(newSegment);
                            }
                        }
                    }
                    else
                    {
                        Log.Error("Cannot create surface for " + DecelerationFactor.ToString());
                    }
                }
                else
                {
                    Log.Error("Cannot evaluate " + DecelerationFactor.ToString() + " as a function");
                }
            }
            else
            {
                Log.Error("Cannot create graph for " + SpeedRestrictions.ToString());
            }

            return(retVal);
        }