예제 #1
0
        public static bool AddMachineryInputToStock(Machinery1Stock machStock, double multiplier,
                                                    Machinery1Input machinput, string currentNodeName, bool adjustTotals)
        {
            bool bHasCalculations = false;

            //inheriting classes usually run this class, but adjust their own totals
            if (adjustTotals)
            {
                //multipliers (input.times, out.compositionamount, oc.amount, tp.amount)
                //don't change per hour machinery costs, only total costs
                if (currentNodeName.EndsWith(Input.INPUT_PRICE_TYPES.input.ToString()))
                {
                    //i.e. machinput.cost = machinput.cost * multiplier * input.ocamount
                    //multiplier = input.times * oc.amount * tp.amount
                    ChangeMachineryInputByInputMultipliers(machinput, multiplier);
                }
                else
                {
                    //i.e. machinput.cost = machinput.cost * multiplier (1 in stock analyzers)
                    ChangeMachineryInputByMultiplier(machinput, multiplier);
                }
            }
            machStock.TotalMarketValue               += (machinput.MarketValue);
            machStock.TotalSalvageValue              += (machinput.SalvageValue);
            machStock.TotalFuelAmount                += (machinput.FuelAmount);
            machStock.TotalFuelPrice                 += AgBudgetingRules.GetFuelPrice(machinput);
            machStock.TotalFuelCost                  += (machinput.FuelCost);
            machStock.TotalLubeOilAmount             += (machinput.LubeOilAmount);
            machStock.TotalLubeOilPrice              += (machinput.Constants.PriceOil);
            machStock.TotalLubeOilCost               += (machinput.LubeOilCost);
            machStock.TotalRepairCost                += (machinput.RepairCost);
            machStock.TotalLaborAmount               += (machinput.LaborAmount);
            machStock.TotalLaborPrice                += AgBudgetingRules.GetLaborPrice(machinput);
            machStock.TotalLaborCost                 += (machinput.LaborCost);
            machStock.TotalCapitalRecoveryCost       += (machinput.CapitalRecoveryCost);
            machStock.TotalTaxesHousingInsuranceCost += (machinput.TaxesHousingInsuranceCost);
            machStock.TotalPriceGas                  += (machinput.Constants.PriceGas);
            machStock.TotalPriceDiesel               += (machinput.Constants.PriceDiesel);
            machStock.TotalPriceLP              += (machinput.Constants.PriceLP);
            machStock.TotalPriceElectric        += (machinput.Constants.PriceElectric);
            machStock.TotalPriceNG              += (machinput.Constants.PriceNG);
            machStock.TotalPriceOil             += (machinput.Constants.PriceOil);
            machStock.TotalPriceRegularLabor    += (machinput.Constants.PriceRegularLabor);
            machStock.TotalPriceMachineryLabor  += (machinput.Constants.PriceMachineryLabor);
            machStock.TotalPriceSupervisorLabor += (machinput.Constants.PriceSupervisorLabor);
            machStock.TotalStartingHrs          += (machinput.Constants.StartingHrs);
            machStock.TotalPlannedUseHrs        += (machinput.Constants.PlannedUseHrs);
            machStock.TotalUsefulLifeHrs        += (machinput.Constants.UsefulLifeHrs);
            machStock.TotalHousingPercent       += (machinput.Constants.HousingPercent);
            machStock.TotalTaxPercent           += (machinput.Constants.TaxPercent);
            machStock.TotalInsurePercent        += (machinput.Constants.InsurePercent);
            machStock.TotalSpeed           += (machinput.Constants.FieldSpeedTypical);
            machStock.TotalWidth           += (machinput.Constants.Width);
            machStock.TotalHorsepower      += (machinput.Constants.HP);
            machStock.TotalHPPTOEquiv      += (machinput.Constants.HPPTOEquiv);
            machStock.TotalFieldEffTypical += (machinput.Constants.FieldEffTypical);
            bHasCalculations = true;
            return(bHasCalculations);
        }
예제 #2
0
 public static void AddMachineryStockTotals(Machinery1Stock mach1Stock,
                                            ref XElement machStockCalcElement)
 {
     //these have already been adjusted by input multipliers (ocamount, times)
     mach1Stock.TotalOC = mach1Stock.TotalFuelCost + mach1Stock.TotalLaborCost
                          + mach1Stock.TotalRepairCost + mach1Stock.TotalLubeOilCost;
     mach1Stock.TotalAOH = mach1Stock.TotalCapitalRecoveryCost
                           + mach1Stock.TotalTaxesHousingInsuranceCost;
     CalculatorHelpers.SetAttributeDoubleF2(machStockCalcElement,
                                            CostBenefitCalculator.TOC, mach1Stock.TotalOC);
     CalculatorHelpers.SetAttributeDoubleF2(machStockCalcElement,
                                            CostBenefitCalculator.TAOH, mach1Stock.TotalAOH);
 }
 public static void AddStock1TotalsToElement(Machinery1Stock mach1Stock,
                                             TimelinessOpComp1 currentTOC, ref XElement opCompCalcElement)
 {
     //these have already been adjusted by input multipliers (ocamount, times)
     //and opcomp mulipliers (amount)
     currentTOC.TotalOC = mach1Stock.TotalFuelCost + mach1Stock.TotalLaborCost
                          + mach1Stock.TotalRepairCost + mach1Stock.TotalLubeOilCost;
     currentTOC.TotalAOH = mach1Stock.TotalCapitalRecoveryCost
                           + mach1Stock.TotalTaxesHousingInsuranceCost;
     CalculatorHelpers.SetAttributeDoubleF2(opCompCalcElement,
                                            CostBenefitCalculator.TOC, currentTOC.TotalOC);
     CalculatorHelpers.SetAttributeDoubleF2(opCompCalcElement,
                                            CostBenefitCalculator.TAOH, currentTOC.TotalAOH);
 }
예제 #4
0
        //add a Machinery1Input to the baseStat.MachineryStocks dictionary
        public static bool AddMachinery1StocksToDictionary(
            this Machinery1Stock baseStat,
            int filePosition, int nodePosition, Machinery1Input calculator)
        {
            bool bIsAdded = false;

            if (filePosition < 0 || nodePosition < 0)
            {
                baseStat.ErrorMessage
                    = Errors.MakeStandardErrorMsg("ANALYSES_INDEX_OUTOFBOUNDS");
                return(false);
            }
            if (baseStat.MachineryStocks == null)
            {
                baseStat.MachineryStocks
                    = new Dictionary <int, List <Machinery1Input> >();
            }
            if (baseStat.MachineryStocks.ContainsKey(filePosition))
            {
                if (baseStat.MachineryStocks[filePosition] != null)
                {
                    for (int i = 0; i <= nodePosition; i++)
                    {
                        if (baseStat.MachineryStocks[filePosition].Count <= i)
                        {
                            baseStat.MachineryStocks[filePosition]
                            .Add(new Machinery1Input());
                        }
                    }
                    baseStat.MachineryStocks[filePosition][nodePosition]
                             = calculator;
                    bIsAdded = true;
                }
            }
            else
            {
                //add the missing dictionary entry
                List <Machinery1Input> baseStats
                    = new List <Machinery1Input>();
                KeyValuePair <int, List <Machinery1Input> > newStat
                    = new KeyValuePair <int, List <Machinery1Input> >(
                          filePosition, baseStats);
                baseStat.MachineryStocks.Add(newStat);
                bIsAdded = AddMachinery1StocksToDictionary(baseStat,
                                                           filePosition, nodePosition, calculator);
            }
            return(bIsAdded);
        }
예제 #5
0
        public static int GetNodePositionCount(this Machinery1Stock baseStat,
                                               int filePosition, Machinery1Input calculator)
        {
            int iNodeCount = 0;

            if (baseStat.MachineryStocks == null)
            {
                return(iNodeCount);
            }
            if (baseStat.MachineryStocks.ContainsKey(filePosition))
            {
                if (baseStat.MachineryStocks[filePosition] != null)
                {
                    iNodeCount = baseStat.MachineryStocks[filePosition].Count;
                }
            }
            return(iNodeCount);
        }
예제 #6
0
 public virtual void CopyTotalMachinery1StockProperties(
     Machinery1Stock calculator)
 {
     this.TotalMarketValue               = calculator.TotalMarketValue;
     this.TotalSalvageValue              = calculator.TotalSalvageValue;
     this.TotalFuelAmount                = calculator.TotalFuelAmount;
     this.TotalFuelPrice                 = calculator.TotalFuelPrice;
     this.TotalFuelCost                  = calculator.TotalFuelCost;
     this.TotalLubeOilPrice              = calculator.TotalLubeOilPrice;
     this.TotalLubeOilAmount             = calculator.TotalLubeOilAmount;
     this.TotalLubeOilCost               = calculator.TotalLubeOilCost;
     this.TotalRepairCost                = calculator.TotalRepairCost;
     this.TotalLaborAmount               = calculator.TotalLaborAmount;
     this.TotalLaborPrice                = calculator.TotalLaborPrice;
     this.TotalLaborCost                 = calculator.TotalLaborCost;
     this.TotalCapitalRecoveryCost       = calculator.TotalCapitalRecoveryCost;
     this.TotalTaxesHousingInsuranceCost = calculator.TotalTaxesHousingInsuranceCost;
 }
예제 #7
0
        public static bool AddMachinery1StockToStock(Machinery1Stock totalsMach1Stock,
                                                     double multiplier, Machinery1Stock currentMach1Stock)
        {
            bool bHasCalculations = false;

            //multipliers (input.times, out.compositionamount, oc.amount, tp.amount)
            //don't change per hour machinery costs, only total costs
            totalsMach1Stock.TotalMarketValue               += (currentMach1Stock.TotalMarketValue);
            totalsMach1Stock.TotalSalvageValue              += (currentMach1Stock.TotalSalvageValue);
            totalsMach1Stock.TotalFuelAmount                += (currentMach1Stock.TotalFuelAmount * multiplier);
            totalsMach1Stock.TotalFuelPrice                 += AgBudgetingRules.GetFuelPrice(currentMach1Stock);
            totalsMach1Stock.TotalFuelCost                  += (currentMach1Stock.TotalFuelCost * multiplier);
            totalsMach1Stock.TotalLubeOilAmount             += (currentMach1Stock.TotalLubeOilAmount * multiplier);
            totalsMach1Stock.TotalLubeOilPrice              += (currentMach1Stock.Constants.PriceOil);
            totalsMach1Stock.TotalLubeOilCost               += (currentMach1Stock.TotalLubeOilCost * multiplier);
            totalsMach1Stock.TotalRepairCost                += (currentMach1Stock.TotalRepairCost * multiplier);
            totalsMach1Stock.TotalLaborAmount               += (currentMach1Stock.TotalLaborAmount * multiplier);
            totalsMach1Stock.TotalLaborPrice                += AgBudgetingRules.GetLaborPrice(currentMach1Stock);
            totalsMach1Stock.TotalLaborCost                 += (currentMach1Stock.TotalLaborCost * multiplier);
            totalsMach1Stock.TotalCapitalRecoveryCost       += (currentMach1Stock.TotalCapitalRecoveryCost * multiplier);
            totalsMach1Stock.TotalTaxesHousingInsuranceCost += (currentMach1Stock.TotalTaxesHousingInsuranceCost * multiplier);
            totalsMach1Stock.TotalPriceGas                  += (currentMach1Stock.Constants.PriceGas);
            totalsMach1Stock.TotalPriceDiesel               += (currentMach1Stock.Constants.PriceDiesel);
            totalsMach1Stock.TotalPriceLP              += (currentMach1Stock.Constants.PriceLP);
            totalsMach1Stock.TotalPriceElectric        += (currentMach1Stock.Constants.PriceElectric);
            totalsMach1Stock.TotalPriceNG              += (currentMach1Stock.Constants.PriceNG);
            totalsMach1Stock.TotalPriceOil             += (currentMach1Stock.Constants.PriceOil);
            totalsMach1Stock.TotalPriceRegularLabor    += (currentMach1Stock.Constants.PriceRegularLabor);
            totalsMach1Stock.TotalPriceMachineryLabor  += (currentMach1Stock.Constants.PriceMachineryLabor);
            totalsMach1Stock.TotalPriceSupervisorLabor += (currentMach1Stock.Constants.PriceSupervisorLabor);
            totalsMach1Stock.TotalStartingHrs          += (currentMach1Stock.Constants.StartingHrs);
            totalsMach1Stock.TotalPlannedUseHrs        += (currentMach1Stock.Constants.PlannedUseHrs);
            totalsMach1Stock.TotalUsefulLifeHrs        += (currentMach1Stock.Constants.UsefulLifeHrs);
            totalsMach1Stock.TotalHousingPercent       += (currentMach1Stock.Constants.HousingPercent);
            totalsMach1Stock.TotalTaxPercent           += (currentMach1Stock.Constants.TaxPercent);
            totalsMach1Stock.TotalInsurePercent        += (currentMach1Stock.Constants.InsurePercent);
            totalsMach1Stock.TotalSpeed           += (currentMach1Stock.Constants.FieldSpeedTypical);
            totalsMach1Stock.TotalWidth           += (currentMach1Stock.Constants.Width);
            totalsMach1Stock.TotalHorsepower      += (currentMach1Stock.Constants.HP);
            totalsMach1Stock.TotalHPPTOEquiv      += (currentMach1Stock.Constants.HPPTOEquiv);
            totalsMach1Stock.TotalFieldEffTypical += (currentMach1Stock.Constants.FieldEffTypical);
            bHasCalculations = true;
            return(bHasCalculations);
        }
예제 #8
0
 public virtual void CopyTotalMachinery1ConstantProperties(
     Machinery1Stock calculator)
 {
     this.TotalPriceGas             = calculator.TotalPriceGas;
     this.TotalPriceDiesel          = calculator.TotalPriceDiesel;
     this.TotalPriceLP              = calculator.TotalPriceLP;
     this.TotalPriceElectric        = calculator.TotalPriceElectric;
     this.TotalPriceNG              = calculator.TotalPriceNG;
     this.TotalPriceOil             = calculator.TotalPriceOil;
     this.TotalPriceRegularLabor    = calculator.TotalPriceRegularLabor;
     this.TotalPriceMachineryLabor  = calculator.TotalPriceMachineryLabor;
     this.TotalPriceSupervisorLabor = calculator.TotalPriceSupervisorLabor;
     this.TotalStartingHrs          = calculator.TotalStartingHrs;
     this.TotalPlannedUseHrs        = calculator.TotalPlannedUseHrs;
     this.TotalUsefulLifeHrs        = calculator.TotalUsefulLifeHrs;
     this.TotalHousingPercent       = calculator.TotalHousingPercent;
     this.TotalTaxPercent           = calculator.TotalTaxPercent;
     this.TotalInsurePercent        = calculator.TotalInsurePercent;
     this.TotalSpeed           = calculator.TotalSpeed;
     this.TotalWidth           = calculator.TotalWidth;
     this.TotalHorsepower      = calculator.TotalHorsepower;
     this.TotalHPPTOEquiv      = calculator.TotalHPPTOEquiv;
     this.TotalFieldEffTypical = calculator.TotalFieldEffTypical;
 }
예제 #9
0
 //copy constructor
 public Machinery1Stock(Machinery1Stock calculator)
     : base(calculator)
 {
     CopyTotalMachinery1StockProperties(calculator);
     CopyTotalMachinery1ConstantProperties(calculator);
 }