public static bool AddMachinery1StockToStock(IrrPower1Stock totalsMach1Stock,
                                                     double multiplier, IrrPower1Stock currentMach1Stock)
        {
            bool bHasCalculations = false;

            //eliminate double counting before using this
            //add the base totals (fuelamount, fuelcost ...)
            BIMachineryStockCalculator.AddMachinery1StockToStock(totalsMach1Stock, multiplier,
                                                                 currentMach1Stock);
            //multipliers (input.times, out.compositionamount, oc.amount, tp.amount)
            //don't change per hour machinery costs, only total costs
            //add the totals for the irrpower stock
            totalsMach1Stock.TotalEngineEfficiency       += currentMach1Stock.TotalEngineEfficiency;
            totalsMach1Stock.TotalFuelConsumptionPerHour += currentMach1Stock.TotalFuelConsumptionPerHour;
            totalsMach1Stock.TotalWaterHP                            += currentMach1Stock.TotalWaterHP;
            totalsMach1Stock.TotalBrakeHP                            += currentMach1Stock.TotalBrakeHP;
            totalsMach1Stock.TotalFlowRate                           += currentMach1Stock.TotalFlowRate;
            totalsMach1Stock.TotalStaticHead                         += currentMach1Stock.TotalStaticHead;
            totalsMach1Stock.TotalPressureHead                       += currentMach1Stock.TotalPressureHead;
            totalsMach1Stock.TotalFrictionHead                       += currentMach1Stock.TotalFrictionHead;
            totalsMach1Stock.TotalOtherHead                          += currentMach1Stock.TotalOtherHead;
            totalsMach1Stock.TotalPumpEfficiency                     += currentMach1Stock.TotalPumpEfficiency;
            totalsMach1Stock.TotalGearDriveEfficiency                += currentMach1Stock.TotalGearDriveEfficiency;
            totalsMach1Stock.TotalExtraPower1                        += currentMach1Stock.TotalExtraPower1;
            totalsMach1Stock.TotalExtraPower2                        += currentMach1Stock.TotalExtraPower2;
            totalsMach1Stock.TotalEnergyExtraCostPerNetAcOrHa        += currentMach1Stock.TotalEnergyExtraCostPerNetAcOrHa;
            totalsMach1Stock.TotalEnergyExtraCost                    += currentMach1Stock.TotalEnergyExtraCost;
            totalsMach1Stock.TotalPumpCapacity                       += currentMach1Stock.TotalPumpCapacity;
            totalsMach1Stock.TotalEngineFlywheelPower                += currentMach1Stock.TotalEngineFlywheelPower;
            totalsMach1Stock.TotalFuelAmountRequired                 += currentMach1Stock.TotalFuelAmountRequired;
            totalsMach1Stock.TotalPumpingPlantPerformance            += currentMach1Stock.TotalPumpingPlantPerformance;
            totalsMach1Stock.TotalSeasonWaterNeed                    += currentMach1Stock.TotalSeasonWaterNeed;
            totalsMach1Stock.TotalSeasonWaterExtraCredit             += currentMach1Stock.TotalSeasonWaterExtraCredit;
            totalsMach1Stock.TotalSeasonWaterExtraDebit              += currentMach1Stock.TotalSeasonWaterExtraDebit;
            totalsMach1Stock.TotalWaterPrice                         += currentMach1Stock.TotalWaterPrice;
            totalsMach1Stock.TotalDistributionUniformity             += currentMach1Stock.TotalDistributionUniformity;
            totalsMach1Stock.TotalSeasonWaterApplied                 += currentMach1Stock.TotalSeasonWaterApplied;
            totalsMach1Stock.TotalWaterCost                          += currentMach1Stock.TotalWaterCost;
            totalsMach1Stock.TotalPumpHoursPerUnitArea               += currentMach1Stock.TotalPumpHoursPerUnitArea;
            totalsMach1Stock.TotalIrrigationTimes                    += currentMach1Stock.TotalIrrigationTimes;
            totalsMach1Stock.TotalIrrigationDurationPerSet           += currentMach1Stock.TotalIrrigationDurationPerSet;
            totalsMach1Stock.TotalIrrigationDurationLaborHoursPerSet += currentMach1Stock.TotalIrrigationDurationLaborHoursPerSet;
            totalsMach1Stock.TotalIrrigationNetArea                  += currentMach1Stock.TotalIrrigationNetArea;
            totalsMach1Stock.TotalEquipmentLaborAmount               += currentMach1Stock.TotalEquipmentLaborAmount;
            totalsMach1Stock.TotalEquipmentLaborCost                 += currentMach1Stock.TotalEquipmentLaborCost;
            totalsMach1Stock.TotalRepairCostsPerNetAcOrHa            += currentMach1Stock.TotalRepairCostsPerNetAcOrHa;
            totalsMach1Stock.TotalRandMPercent                       += currentMach1Stock.TotalRandMPercent;
            bHasCalculations = true;
            return(bHasCalculations);
        }
 public static void AddMachineryStockTotals(IrrPower1Stock mach1Stock,
                                            XElement machStockCalcElement)
 {
     //these have already been adjusted by input multipliers (ocamount, times)
     mach1Stock.TotalOC = mach1Stock.TotalFuelCost + mach1Stock.TotalLaborCost
                          + mach1Stock.TotalRepairCost + mach1Stock.TotalLubeOilCost
                          + mach1Stock.TotalEnergyExtraCost + mach1Stock.TotalWaterCost + mach1Stock.TotalEquipmentLaborCost;
     mach1Stock.TotalAOH = mach1Stock.TotalCapitalRecoveryCost
                           + mach1Stock.TotalTaxesHousingInsuranceCost;
     CalculatorHelpers.SetAttributeDoubleF2(machStockCalcElement,
                                            CostBenefitCalculator.TOC, mach1Stock.TotalOC);
     CalculatorHelpers.SetAttributeDoubleF2(machStockCalcElement,
                                            CostBenefitCalculator.TAOH, mach1Stock.TotalAOH);
 }
Exemplo n.º 3
0
        //add a IrrigationPower1Input to the baseStat.IrrPowerStocks dictionary
        public static bool AddIrrPower1StocksToDictionary(
            this IrrPower1Stock baseStat,
            int filePosition, int nodePosition, IrrigationPower1Input calculator)
        {
            bool bIsAdded = false;

            if (filePosition < 0 || nodePosition < 0)
            {
                baseStat.ErrorMessage
                    = Errors.MakeStandardErrorMsg("ANALYSES_INDEX_OUTOFBOUNDS");
                return(false);
            }
            if (baseStat.IrrPowerStocks == null)
            {
                baseStat.IrrPowerStocks
                    = new Dictionary <int, List <IrrigationPower1Input> >();
            }
            if (baseStat.IrrPowerStocks.ContainsKey(filePosition))
            {
                if (baseStat.IrrPowerStocks[filePosition] != null)
                {
                    for (int i = 0; i <= nodePosition; i++)
                    {
                        if (baseStat.IrrPowerStocks[filePosition].Count <= i)
                        {
                            baseStat.IrrPowerStocks[filePosition]
                            .Add(new IrrigationPower1Input());
                        }
                    }
                    baseStat.IrrPowerStocks[filePosition][nodePosition]
                             = calculator;
                    bIsAdded = true;
                }
            }
            else
            {
                //add the missing dictionary entry
                List <IrrigationPower1Input> baseStats
                    = new List <IrrigationPower1Input>();
                KeyValuePair <int, List <IrrigationPower1Input> > newStat
                    = new KeyValuePair <int, List <IrrigationPower1Input> >(
                          filePosition, baseStats);
                baseStat.IrrPowerStocks.Add(newStat);
                bIsAdded = AddIrrPower1StocksToDictionary(baseStat,
                                                          filePosition, nodePosition, calculator);
            }
            return(bIsAdded);
        }
Exemplo n.º 4
0
        public static int GetNodePositionCount(this IrrPower1Stock baseStat,
                                               int filePosition, IrrigationPower1Input calculator)
        {
            int iNodeCount = 0;

            if (baseStat.IrrPowerStocks == null)
            {
                return(iNodeCount);
            }
            if (baseStat.IrrPowerStocks.ContainsKey(filePosition))
            {
                if (baseStat.IrrPowerStocks[filePosition] != null)
                {
                    iNodeCount = baseStat.IrrPowerStocks[filePosition].Count;
                }
            }
            return(iNodeCount);
        }
Exemplo n.º 5
0
 public virtual void CopyTotalIrrPower1StockProperties(
     IrrPower1Stock calculator)
 {
     this.TotalEngineEfficiency       = calculator.TotalEngineEfficiency;
     this.TotalFuelConsumptionPerHour = calculator.TotalFuelConsumptionPerHour;
     this.TotalWaterHP                            = calculator.TotalWaterHP;
     this.TotalBrakeHP                            = calculator.TotalBrakeHP;
     this.TotalFlowRate                           = calculator.TotalFlowRate;
     this.TotalStaticHead                         = calculator.TotalStaticHead;
     this.TotalPressureHead                       = calculator.TotalPressureHead;
     this.TotalFrictionHead                       = calculator.TotalFrictionHead;
     this.TotalOtherHead                          = calculator.TotalOtherHead;
     this.TotalPumpEfficiency                     = calculator.TotalPumpEfficiency;
     this.TotalGearDriveEfficiency                = calculator.TotalGearDriveEfficiency;
     this.TotalExtraPower1                        = calculator.TotalExtraPower1;
     this.TotalExtraPower2                        = calculator.TotalExtraPower2;
     this.TotalEnergyExtraCostPerNetAcOrHa        = calculator.TotalEnergyExtraCostPerNetAcOrHa;
     this.TotalEnergyExtraCost                    = calculator.TotalEnergyExtraCost;
     this.TotalPumpCapacity                       = calculator.TotalPumpCapacity;
     this.TotalEngineFlywheelPower                = calculator.TotalEngineFlywheelPower;
     this.TotalFuelAmountRequired                 = calculator.TotalFuelAmountRequired;
     this.TotalPumpingPlantPerformance            = calculator.TotalPumpingPlantPerformance;
     this.TotalSeasonWaterNeed                    = calculator.TotalSeasonWaterNeed;
     this.TotalSeasonWaterExtraCredit             = calculator.TotalSeasonWaterExtraCredit;
     this.TotalSeasonWaterExtraDebit              = calculator.TotalSeasonWaterExtraDebit;
     this.TotalWaterPrice                         = calculator.TotalWaterPrice;
     this.TotalDistributionUniformity             = calculator.TotalDistributionUniformity;
     this.TotalSeasonWaterApplied                 = calculator.TotalSeasonWaterApplied;
     this.TotalWaterCost                          = calculator.TotalWaterCost;
     this.TotalPumpHoursPerUnitArea               = calculator.TotalPumpHoursPerUnitArea;
     this.TotalIrrigationTimes                    = calculator.TotalIrrigationTimes;
     this.TotalIrrigationDurationPerSet           = calculator.TotalIrrigationDurationPerSet;
     this.TotalIrrigationDurationLaborHoursPerSet = calculator.TotalIrrigationDurationLaborHoursPerSet;
     this.TotalIrrigationNetArea                  = calculator.TotalIrrigationNetArea;
     this.TotalEquipmentLaborAmount               = calculator.TotalEquipmentLaborAmount;
     this.TotalEquipmentLaborCost                 = calculator.TotalEquipmentLaborCost;
     this.TotalRepairCostsPerNetAcOrHa            = calculator.TotalRepairCostsPerNetAcOrHa;
     this.TotalRandMPercent                       = calculator.TotalRandMPercent;
 }
        public static bool AddMachineryInputToStock(IrrPower1Stock machStock, double multiplier,
                                                    IrrigationPower1Input machinput, string currentNodeName)
        {
            bool bHasCalculations = false;
            bool bAdjustTotals    = false;

            //eliminate double counting before using this
            //add the base totals (fuelamount, fuelcost ...)
            BIMachineryStockCalculator.AddMachineryInputToStock(machStock, multiplier,
                                                                machinput, currentNodeName, bAdjustTotals);
            //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);
            }
            //add the totals for the irrpower stock
            machStock.TotalEngineEfficiency       += machinput.EngineEfficiency;
            machStock.TotalFuelConsumptionPerHour += machinput.FuelConsumptionPerHour;
            machStock.TotalWaterHP                            += machinput.WaterHP;
            machStock.TotalBrakeHP                            += machinput.BrakeHP;
            machStock.TotalFlowRate                           += machinput.FlowRate;
            machStock.TotalStaticHead                         += machinput.StaticHead;
            machStock.TotalPressureHead                       += machinput.PressureHead;
            machStock.TotalFrictionHead                       += machinput.FrictionHead;
            machStock.TotalOtherHead                          += machinput.OtherHead;
            machStock.TotalPumpEfficiency                     += machinput.PumpEfficiency;
            machStock.TotalGearDriveEfficiency                += machinput.GearDriveEfficiency;
            machStock.TotalExtraPower1                        += machinput.ExtraPower1;
            machStock.TotalExtraPower2                        += machinput.ExtraPower2;
            machStock.TotalEnergyExtraCostPerNetAcOrHa        += machinput.EnergyExtraCostPerNetAcOrHa;
            machStock.TotalEnergyExtraCost                    += machinput.EnergyExtraCost;
            machStock.TotalPumpCapacity                       += machinput.PumpCapacity;
            machStock.TotalEngineFlywheelPower                += machinput.EngineFlywheelPower;
            machStock.TotalFuelAmountRequired                 += machinput.FuelAmountRequired;
            machStock.TotalPumpingPlantPerformance            += machinput.PumpingPlantPerformance;
            machStock.TotalSeasonWaterNeed                    += machinput.SeasonWaterNeed;
            machStock.TotalSeasonWaterExtraCredit             += machinput.SeasonWaterExtraCredit;
            machStock.TotalSeasonWaterExtraDebit              += machinput.SeasonWaterExtraDebit;
            machStock.TotalWaterPrice                         += machinput.WaterPrice;
            machStock.TotalDistributionUniformity             += machinput.DistributionUniformity;
            machStock.TotalSeasonWaterApplied                 += machinput.SeasonWaterApplied;
            machStock.TotalWaterCost                          += machinput.WaterCost;
            machStock.TotalPumpHoursPerUnitArea               += machinput.PumpHoursPerUnitArea;
            machStock.TotalIrrigationTimes                    += machinput.IrrigationTimes;
            machStock.TotalIrrigationDurationPerSet           += machinput.IrrigationDurationPerSet;
            machStock.TotalIrrigationDurationLaborHoursPerSet += machinput.IrrigationDurationLaborHoursPerSet;
            machStock.TotalIrrigationNetArea                  += machinput.IrrigationNetArea;
            machStock.TotalEquipmentLaborAmount               += machinput.EquipmentLaborAmount;
            machStock.TotalEquipmentLaborCost                 += machinput.EquipmentLaborCost;
            machStock.TotalRepairCostsPerNetAcOrHa            += machinput.RepairCostsPerNetAcOrHa;
            machStock.TotalRandMPercent                       += machinput.RandMPercent;
            bHasCalculations = true;
            return(bHasCalculations);
        }
Exemplo n.º 7
0
 //copy constructor
 public IrrPower1Stock(IrrPower1Stock calculator)
     : base(calculator)
 {
     CopyTotalIrrPower1StockProperties(calculator);
 }