Ejemplo n.º 1
0
        public static CALCULATOR_TYPES GetCalculatorType(string calcType)
        {
            CALCULATOR_TYPES eCalculatorType = CALCULATOR_TYPES.none;

            if (calcType == CALCULATOR_TYPES.agmachinery.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.agmachinery;
            }
            else if (calcType == CALCULATOR_TYPES.irrpower.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.irrpower;
            }
            else if (calcType == CALCULATOR_TYPES.lifecycle.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.lifecycle;
            }
            else if (calcType == CALCULATOR_TYPES.gencapital.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.gencapital;
            }
            else if (calcType == CALCULATOR_TYPES.capitalservices.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.capitalservices;
            }
            return(eCalculatorType);
        }
Ejemplo n.º 2
0
        public bool RunMN1CalculatorCalculations()
        {
            bool             bHasCalculations = false;
            CALCULATOR_TYPES eCalculatorType
                = GetCalculatorType(this.MN1CalculatorParams.CalculatorType);

            this.MN1CalculatorParams.RunCalculatorType
                = CalculatorHelpers.RUN_CALCULATOR_TYPES.basic;
            this.MN1CalculatorParams.AnalyzerParms.ObservationsPath
                = this.MN1CalculatorParams.ExtensionDocToCalcURI.URIDataManager.TempDocPath;
            //note that running descendant calculations inserts a calculator
            //with all of its attributes into the descendant, but the descendant
            //may still need to have a calculation run
            IOMN1StockSubscriber subMN1Calculator
                = new IOMN1StockSubscriber(this.MN1CalculatorParams);

            switch (eCalculatorType)
            {
            case CALCULATOR_TYPES.foodnutSR01:
                bHasCalculations = subMN1Calculator.RunCalculator();
                break;

            case CALCULATOR_TYPES.foodnutSR02:
                bHasCalculations = subMN1Calculator.RunCalculator();
                break;

            default:
                break;
            }
            CalculatorHelpers.UpdateCalculatorParams(this.MN1CalculatorParams, subMN1Calculator.GCCalculatorParams);
            //set parameters/attributes needed to update db and display this analysis
            SetCalculatorParameters();
            return(bHasCalculations);
        }
Ejemplo n.º 3
0
        public async Task <bool> RunCalculations()
        {
            bool bHasCalculations = false;

            //these calculators use a basic calculatorpatterns
            this.ABCalculatorParams.RunCalculatorType
                = CalculatorHelpers.RUN_CALCULATOR_TYPES.basic;
            CALCULATOR_TYPES eCalculatorType
                = GetCalculatorType(this.ABCalculatorParams.CalculatorType);

            //both calculators and analyzers both calculate a file in this path:
            this.ABCalculatorParams.AnalyzerParms.ObservationsPath
                = this.ABCalculatorParams.ExtensionDocToCalcURI.URIDataManager.TempDocPath;
            ABIOSubscriber subInput
                = new ABIOSubscriber(this.ABCalculatorParams, eCalculatorType);

            //note that running descendant calculations inserts a calculator
            //with all of its attributes into the descendant, but the descendant
            //may still need to have a calculation run
            switch (eCalculatorType)
            {
            case CALCULATOR_TYPES.agmachinery:
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ABCalculatorParams, subInput.GCCalculatorParams);
                break;

            case CALCULATOR_TYPES.irrpower:
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ABCalculatorParams, subInput.GCCalculatorParams);
                break;

            case CALCULATOR_TYPES.lifecycle:
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ABCalculatorParams, subInput.GCCalculatorParams);
                break;

            case CALCULATOR_TYPES.gencapital:
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ABCalculatorParams, subInput.GCCalculatorParams);
                break;

            case CALCULATOR_TYPES.capitalservices:
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ABCalculatorParams, subInput.GCCalculatorParams);
                break;

            default:
                break;
            }
            subInput = null;
            //set parameters/attributes needed to update db and display this analysis
            SetCalculatorParameters();
            return(bHasCalculations);
        }
Ejemplo n.º 4
0
        public static CALCULATOR_TYPES GetCalculatorType(string calculatorType)
        {
            CALCULATOR_TYPES eCalculatorType = CALCULATOR_TYPES.none;

            if (calculatorType == CALCULATOR_TYPES.npv.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.npv;
            }
            return(eCalculatorType);
        }
Ejemplo n.º 5
0
        public static CALCULATOR_TYPES GetCalculatorType(string calculatorType)
        {
            CALCULATOR_TYPES eCalculatorType = CALCULATOR_TYPES.none;

            if (calculatorType == CALCULATOR_TYPES.foodfactUSA1.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.foodfactUSA1;
            }
            else if (calculatorType == CALCULATOR_TYPES.foodnutSR01.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.foodnutSR01;
            }
            return(eCalculatorType);
        }
Ejemplo n.º 6
0
        public static CALCULATOR_TYPES GetCalculatorType(string calculatorType)
        {
            CALCULATOR_TYPES eCalculatorType = CALCULATOR_TYPES.none;

            if (calculatorType == CALCULATOR_TYPES.healthcost1.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.healthcost1;
            }
            else if (calculatorType == CALCULATOR_TYPES.hcbenefit1.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.hcbenefit1;
            }
            return(eCalculatorType);
        }
Ejemplo n.º 7
0
        public async Task <bool> RunInputOrOutputCalculations()
        {
            bool             bHasCalculations = false;
            CALCULATOR_TYPES eCalculatorType
                = GetCalculatorType(this.HCCalculatorParams.CalculatorType);

            this.HCCalculatorParams.RunCalculatorType
                = CalculatorHelpers.RUN_CALCULATOR_TYPES.iotechnology;
            if (this.HCCalculatorParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                == Constants.SUBAPPLICATION_TYPES.inputprices.ToString() ||
                this.HCCalculatorParams.ExtensionDocToCalcURI.URIDataManager.SubAppType
                == Constants.SUBAPPLICATION_TYPES.outputprices.ToString())
            {
                this.HCCalculatorParams.RunCalculatorType
                    = CalculatorHelpers.RUN_CALCULATOR_TYPES.basic;
            }
            this.HCCalculatorParams.AnalyzerParms.ObservationsPath
                = this.HCCalculatorParams.ExtensionDocToCalcURI.URIDataManager.TempDocPath;
            //note that running descendant calculations inserts a calculator
            //with all of its attributes into the descendant, but the descendant
            //may still need to have a calculation run
            switch (eCalculatorType)
            {
            case CALCULATOR_TYPES.healthcost1:
                IOHCStockSubscriber subInput
                    = new IOHCStockSubscriber(this.HCCalculatorParams);
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.HCCalculatorParams,
                                                         subInput.GCCalculatorParams);
                break;

            case CALCULATOR_TYPES.hcbenefit1:
                IOHCStockSubscriber subOutput
                    = new IOHCStockSubscriber(this.HCCalculatorParams);
                bHasCalculations = await subOutput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.HCCalculatorParams,
                                                         subOutput.GCCalculatorParams);
                break;

            default:
                break;
            }
            //set parameters/attributes needed to update db and display this analysis
            SetCalculatorParameters();
            return(bHasCalculations);
        }
Ejemplo n.º 8
0
        public static CALCULATOR_TYPES GetCalculatorType(string calculatorType)
        {
            CALCULATOR_TYPES eCalculatorType = CALCULATOR_TYPES.none;

            if (calculatorType == CALCULATOR_TYPES.sb101.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.sb101;
            }
            else if (calculatorType == CALCULATOR_TYPES.sb102.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.sb102;
            }
            else if (calculatorType == CALCULATOR_TYPES.sb01.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.sb01;
            }
            return(eCalculatorType);
        }
Ejemplo n.º 9
0
        public static CALCULATOR_TYPES GetCalculatorType(string calculatorType)
        {
            CALCULATOR_TYPES eCalculatorType = CALCULATOR_TYPES.none;

            if (calculatorType == CALCULATOR_TYPES.buildcost1.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.buildcost1;
            }
            else if (calculatorType == CALCULATOR_TYPES.buildbenefit1.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.buildbenefit1;
            }
            else if (calculatorType == CALCULATOR_TYPES.lifecycle1.ToString())
            {
                eCalculatorType = CALCULATOR_TYPES.lifecycle1;
            }
            return(eCalculatorType);
        }
Ejemplo n.º 10
0
        public async Task <bool> RunSB1CalculatorCalculationsAsync()
        {
            bool             bHasCalculations = false;
            CALCULATOR_TYPES eCalculatorType
                = GetCalculatorType(this.SB1CalculatorParams.CalculatorType);

            this.SB1CalculatorParams.RunCalculatorType
                = CalculatorHelpers.RUN_CALCULATOR_TYPES.basic;
            this.SB1CalculatorParams.AnalyzerParms.ObservationsPath
                = this.SB1CalculatorParams.ExtensionDocToCalcURI.URIDataManager.TempDocPath;
            //note that running descendant calculations inserts a calculator
            //with all of its attributes into the descendant, but the descendant
            //may still need to have a calculation run
            IOSB1CalculatorAsync subSB1CalculatorAsync
                = new IOSB1CalculatorAsync(this.SB1CalculatorParams);

            switch (eCalculatorType)
            {
            case CALCULATOR_TYPES.sb101:
                bHasCalculations = await subSB1CalculatorAsync.RunCalculatorAsync();

                break;

            case CALCULATOR_TYPES.sb102:
                bHasCalculations = await subSB1CalculatorAsync.RunCalculatorAsync();

                break;

            default:
                break;
            }
            CalculatorHelpers.UpdateCalculatorParams(this.SB1CalculatorParams, subSB1CalculatorAsync.GCCalculatorParams);
            //set parameters/attributes needed to update db and display this analysis
            SetCalculatorParameters();
            return(bHasCalculations);
        }
Ejemplo n.º 11
0
        public bool RunME2CalculatorCalculations()
        {
            bool             bHasCalculations = false;
            CALCULATOR_TYPES eCalculatorType
                = GetCalculatorType(this.ME2CalculatorParams.CalculatorType);

            this.ME2CalculatorParams.RunCalculatorType
                = CalculatorHelpers.RUN_CALCULATOR_TYPES.basic;
            this.ME2CalculatorParams.AnalyzerParms.ObservationsPath
                = this.ME2CalculatorParams.ExtensionDocToCalcURI.URIDataManager.TempDocPath;
            //note that running descendant calculations inserts a calculator
            //with all of its attributes into the descendant, but the descendant
            //may still need to have a calculation run
            switch (eCalculatorType)
            {
            case CALCULATOR_TYPES.me2:
                if (this.ME2CalculatorParams.SubApplicationType
                    == Constants.SUBAPPLICATION_TYPES.budgets ||
                    this.ME2CalculatorParams.SubApplicationType
                    == Constants.SUBAPPLICATION_TYPES.investments)
                {
                    BIME2StockSubscriber subME2Calculator
                        = new BIME2StockSubscriber(this.ME2CalculatorParams);
                    bHasCalculations = subME2Calculator.RunCalculator();
                    CalculatorHelpers.UpdateCalculatorParams(this.ME2CalculatorParams, subME2Calculator.GCCalculatorParams);
                }
                else if (this.ME2CalculatorParams.SubApplicationType
                         == Constants.SUBAPPLICATION_TYPES.outcomeprices)
                {
                    OutcomeME2StockSubscriber subME2Calculator
                        = new OutcomeME2StockSubscriber(this.ME2CalculatorParams);
                    bHasCalculations = subME2Calculator.RunCalculator();
                    CalculatorHelpers.UpdateCalculatorParams(this.ME2CalculatorParams, subME2Calculator.GCCalculatorParams);
                }
                else if (this.ME2CalculatorParams.SubApplicationType
                         == Constants.SUBAPPLICATION_TYPES.operationprices ||
                         this.ME2CalculatorParams.SubApplicationType
                         == Constants.SUBAPPLICATION_TYPES.componentprices)
                {
                    OCME2StockSubscriber subME2Calculator
                        = new OCME2StockSubscriber(this.ME2CalculatorParams);
                    //build the me2s object collections
                    bHasCalculations = subME2Calculator.RunCalculator();
                    CalculatorHelpers.UpdateCalculatorParams(this.ME2CalculatorParams, subME2Calculator.GCCalculatorParams);
                }
                else if (this.ME2CalculatorParams.SubApplicationType
                         == Constants.SUBAPPLICATION_TYPES.inputprices ||
                         this.ME2CalculatorParams.SubApplicationType
                         == Constants.SUBAPPLICATION_TYPES.outputprices)
                {
                    IOME2StockSubscriber subME2Calculator
                        = new IOME2StockSubscriber(this.ME2CalculatorParams);
                    bHasCalculations = subME2Calculator.RunCalculator();
                    CalculatorHelpers.UpdateCalculatorParams(this.ME2CalculatorParams, subME2Calculator.GCCalculatorParams);
                }
                break;

            default:
                break;
            }
            //set parameters/attributes needed to update db and display this analysis
            SetCalculatorParameters();
            return(bHasCalculations);
        }