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 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); }
public bool SetInputMachineryStockCalculations(XElement currentCalculationsElement, XElement currentElement) { bool bHasCalculations = false; //set the parent opcomp for holding collection of machinputs if (this.OpComp == null) { this.OpComp = new OperationComponent(); } if (currentCalculationsElement != null) { //note that the machinput calculator can not change Input properties //when running from opOrComps or budgets //but needs several properties from the Input (i.e. Id, Times) this.IrrPower1Input = new IrrigationPower1Input(); //deserialize xml to object this.IrrPower1Input.SetIrrigationPower1InputProperties(this.GCCalculatorParams, currentCalculationsElement, currentElement); //init analyzer props this.IrrPower1Input.SetCalculatorProperties(currentCalculationsElement); //all stocks analyzers put full costs in inputs (easier to manipulate collections) double dbMultiplier = BIMachineryStockCalculator.GetInputFullCostMultiplier( this.IrrPower1Input, this.GCCalculatorParams); //change fuel cost, repair cost, by input.times * input.ocamount or input.aohamount ChangeMachineryInputByInputMultipliers(this.IrrPower1Input, dbMultiplier); //serialize calculator object back to xml //(calculator doesn't change opOrComp, so don't serialize it) string sAttNameExtension = string.Empty; //set new machinery input totals this.IrrPower1Input.SetAndRemoveCalculatorAttributes(sAttNameExtension, currentCalculationsElement); this.IrrPower1Input.SetIrrigationPower1Attributes(this.GCCalculatorParams, currentCalculationsElement, currentElement); //set the totaloc and totalaoh AddIrrPower1InputTotals(this.IrrPower1Input, currentCalculationsElement); //set calculatorid (primary way to display calculation attributes) CalculatorHelpers.SetCalculatorId( currentCalculationsElement, currentElement); //add the machinput to the machStock.machstocks dictionary //the count is 1-based, while iNodePosition is 0-based //so the count is the correct next index position int iNodePosition = this.IrrPowerStock.GetNodePositionCount( this.GCCalculatorParams.AnalyzerParms.FilePositionIndex, this.IrrPower1Input); if (iNodePosition < 0) { iNodePosition = 0; } bHasCalculations = this.IrrPowerStock .AddIrrPower1StocksToDictionary( this.GCCalculatorParams.AnalyzerParms.FilePositionIndex, iNodePosition, this.IrrPower1Input); //add to collection if (this.OpComp.Inputs == null) { this.OpComp.Inputs = new List <Input>(); } //note that machinput can be retrieved by converting the input to the //IrrPower1Input type (machinput = (IrrPower1Input) input) this.OpComp.Inputs.Add(this.IrrPower1Input); bHasCalculations = true; } return(bHasCalculations); }
public bool AddMachineryInputToStock(double multiplier, IrrigationPower1Input machinput, string currentNodeName) { bool bHasCalculations = false; //add the base machinput properties bool bAdjustTotals = false; bHasCalculations = BIMachineryStockCalculator .AddMachineryInputToStock(this.IrrPowerStock, multiplier, machinput, currentNodeName, bAdjustTotals); //multipliers (input.times, input.ocamount, out.compositionamount, oc.amount, tp.amount) //are not used with per hourly costs, but are used with total op and aoh costs (fuelcost, capitalrecovery) if (currentNodeName.EndsWith(Input.INPUT_PRICE_TYPES.input.ToString())) { //i.e. machinput.cost = input.times * input.ocamount ChangeMachineryInputByInputMultipliers(machinput, multiplier); } else { //i.e. budget adjustment = if operation multiplier = op.amount, //if timeperiod multiplier = tp.amount) ChangeMachineryInputByMultiplier(machinput, multiplier); } this.IrrPowerStock.TotalEngineEfficiency += machinput.EngineEfficiency; this.IrrPowerStock.TotalFuelConsumptionPerHour += machinput.FuelConsumptionPerHour; this.IrrPowerStock.TotalWaterHP += machinput.WaterHP; this.IrrPowerStock.TotalBrakeHP += machinput.BrakeHP; this.IrrPowerStock.TotalFlowRate += machinput.FlowRate; this.IrrPowerStock.TotalStaticHead += machinput.StaticHead; this.IrrPowerStock.TotalPressureHead += machinput.PressureHead; this.IrrPowerStock.TotalFrictionHead += machinput.FrictionHead; this.IrrPowerStock.TotalOtherHead += machinput.OtherHead; this.IrrPowerStock.TotalPumpEfficiency += machinput.PumpEfficiency; this.IrrPowerStock.TotalGearDriveEfficiency += machinput.GearDriveEfficiency; this.IrrPowerStock.TotalExtraPower1 += machinput.ExtraPower1; this.IrrPowerStock.TotalExtraPower2 += machinput.ExtraPower2; this.IrrPowerStock.TotalEnergyExtraCostPerNetAcOrHa += machinput.EnergyExtraCostPerNetAcOrHa; this.IrrPowerStock.TotalEnergyExtraCost += machinput.EnergyExtraCost; this.IrrPowerStock.TotalPumpCapacity += machinput.PumpCapacity; this.IrrPowerStock.TotalEngineFlywheelPower += machinput.EngineFlywheelPower; this.IrrPowerStock.TotalFuelAmountRequired += machinput.FuelAmountRequired; this.IrrPowerStock.TotalPumpingPlantPerformance += machinput.PumpingPlantPerformance; this.IrrPowerStock.TotalSeasonWaterNeed += machinput.SeasonWaterNeed; this.IrrPowerStock.TotalSeasonWaterExtraCredit += machinput.SeasonWaterExtraCredit; this.IrrPowerStock.TotalSeasonWaterExtraDebit += machinput.SeasonWaterExtraDebit; this.IrrPowerStock.TotalWaterPrice += machinput.WaterPrice; this.IrrPowerStock.TotalDistributionUniformity += machinput.DistributionUniformity; this.IrrPowerStock.TotalSeasonWaterApplied += machinput.SeasonWaterApplied; this.IrrPowerStock.TotalWaterCost += machinput.WaterCost; this.IrrPowerStock.TotalPumpHoursPerUnitArea += machinput.PumpHoursPerUnitArea; this.IrrPowerStock.TotalIrrigationTimes += machinput.IrrigationTimes; this.IrrPowerStock.TotalIrrigationDurationPerSet += machinput.IrrigationDurationPerSet; this.IrrPowerStock.TotalIrrigationDurationLaborHoursPerSet += machinput.IrrigationDurationLaborHoursPerSet; this.IrrPowerStock.TotalIrrigationNetArea += machinput.IrrigationNetArea; this.IrrPowerStock.TotalEquipmentLaborAmount += machinput.EquipmentLaborAmount; this.IrrPowerStock.TotalEquipmentLaborCost += machinput.EquipmentLaborCost; this.IrrPowerStock.TotalRepairCostsPerNetAcOrHa += machinput.RepairCostsPerNetAcOrHa; this.IrrPowerStock.TotalRandMPercent += machinput.RandMPercent; bHasCalculations = true; return(bHasCalculations); }
public IOMachineryStockCalculator(CalculatorParameters calcParameters) { BIM1Calculator = new BIMachineryStockCalculator(calcParameters); }