Exemple #1
0
        public static object eqMathGet1DInterpolation(
            [ExcelArgument(Description = "interpolation obj id")] string objId,
            [ExcelArgument(Description = "variable x ")] double x,
            [ExcelArgument(Description = "Linear/LogLinear ")] string type)
        {
            if (ExcelUtil.CallFromWizard())
            {
                return("");
            }

            string callerAddress = "";

            callerAddress = ExcelUtil.getActiveCellAddress();

            try
            {
                if (type.ToUpper() == "LINEAR")
                {
                    LinearInterpolation interp = OHRepository.Instance.getObject <LinearInterpolation>(objId);
                    double ret = interp.call(x, true);

                    return(ret);
                }
                else if (type.ToUpper() == "LOGLINEAR")
                {
                    LogLinearInterpolation interp = OHRepository.Instance.getObject <LogLinearInterpolation>(objId);
                    double ret = interp.call(x, true);

                    return(ret);
                }
                else
                {
                    return("Unknown interpolation type");
                }
            }
            catch (Exception e)
            {
                ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message);
                return(e.Message);
            }
        }