Exemplo n.º 1
0
        public static double GetInputFullCostMultiplier(Machinery1Input machInput,
                                                        CalculatorParameters calcParams)
        {
            //to keep all machinery stock analysis consistent, put the totals
            //in the inputs, then all can be compared consistently
            //input.times
            double dbInputMultiplier = IOMachineryStockSubscriber
                                       .GetMultiplierForTechInput(machInput);
            //oc.amount
            double dbOCMultiplier = OCMachineryStockSubscriber
                                    .GetMultiplierForOperation(calcParams.ParentOperationComponent);
            double dbTPAmount = BIMachineryStockSubscriber.GetMultiplierForTimePeriod(
                calcParams.ParentTimePeriod);
            double dbMultiplier = dbInputMultiplier * dbOCMultiplier * dbTPAmount;

            return(dbMultiplier);
        }
Exemplo n.º 2
0
        public async Task <bool> RunCalculations()
        {
            bool bHasCalculations = false;

            //these calculators use a mix of calculator and analyzer patterns
            this.ARSCalculatorParams.RunCalculatorType
                = CalculatorHelpers.RUN_CALCULATOR_TYPES.iotechnology;
            //urisToAnalyze has the summary calculated results path in position 0.
            //This calculator uses that path to derive the full calculated
            //results path. The full path document is used to run the calculations
            //(it has the input and output calculated results that are
            //the basis for most resource stock calculations).
            this.ARSCalculatorParams.AnalyzerParms.ObservationsPath
                = await CalculatorHelpers.GetFullCalculatorResultsPath(
                      this.ARSCalculatorParams);

            if (!await CalculatorHelpers.URIAbsoluteExists(this.ARSCalculatorParams.ExtensionDocToCalcURI,
                                                           this.ARSCalculatorParams.AnalyzerParms.ObservationsPath))
            {
                this.ARSCalculatorParams.ErrorMessage
                    = Errors.MakeStandardErrorMsg("ANALYZER_BASECALCS_MISSING");
                return(false);
            }
            //can run npv calcs or base input calculators
            if (this.ARSCalculatorParams.CalculatorType
                == CalculatorHelpers.CALCULATOR_TYPES.input.ToString() ||
                this.ARSCalculatorParams.CalculatorType
                == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery.ToString() ||
                this.ARSCalculatorParams.CalculatorType
                == AgBudgetingHelpers.CALCULATOR_TYPES.irrpower.ToString() ||
                this.ARSCalculatorParams.CalculatorType
                == AgBudgetingHelpers.CALCULATOR_TYPES.gencapital.ToString())
            {
                IOMachineryStockSubscriber subInput
                    = new IOMachineryStockSubscriber(this.ARSCalculatorParams);
                bHasCalculations = await subInput.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ARSCalculatorParams,
                                                         subInput.GCCalculatorParams);
                subInput = null;
            }
            else if (this.ARSCalculatorParams.CalculatorType.StartsWith(
                         CalculatorHelpers.CALCULATOR_TYPES.operation.ToString()) ||
                     this.ARSCalculatorParams.CalculatorType.StartsWith(
                         CalculatorHelpers.CALCULATOR_TYPES.component.ToString()))
            {
                OCMachineryStockSubscriber subOperation
                    = new OCMachineryStockSubscriber(this.ARSCalculatorParams);
                bHasCalculations = await subOperation.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ARSCalculatorParams,
                                                         subOperation.GCCalculatorParams);
                subOperation = null;
            }
            else if (this.ARSCalculatorParams.CalculatorType
                     == CalculatorHelpers.CALCULATOR_TYPES.budget.ToString() ||
                     this.ARSCalculatorParams.CalculatorType
                     == CalculatorHelpers.CALCULATOR_TYPES.investment.ToString())
            {
                BIMachineryStockSubscriber subBudget
                    = new BIMachineryStockSubscriber(this.ARSCalculatorParams);
                bHasCalculations = await subBudget.RunCalculator();

                CalculatorHelpers.UpdateCalculatorParams(this.ARSCalculatorParams,
                                                         subBudget.GCCalculatorParams);
                subBudget = null;
            }
            return(bHasCalculations);
        }