//need to add the correct subcost price type with the correct parent pricetotal private static void SetCostTotals(LCC1Input lifeCycleInput) { //init at zero (these get summed in npv and lcc comp and investment calcors) lifeCycleInput.OCPrice = 0; lifeCycleInput.AOHPrice = 0; lifeCycleInput.CAPPrice = 0; lifeCycleInput.OCTotalCost = 0; lifeCycleInput.AOHTotalCost = 0; lifeCycleInput.CAPTotalCost = 0; //set the totals //ok to use the default order of the subcosts SetInputBasePrice(lifeCycleInput, lifeCycleInput.SubPrice1.SubPType, lifeCycleInput.SubPrice1.SubPTotal); //set lcc total lifeCycleInput.LCCTotalCost = lifeCycleInput.OCTotalCost + lifeCycleInput.AOHTotalCost + lifeCycleInput.CAPTotalCost; //set eaa total lifeCycleInput.EAATotalCost = GeneralRules.CalculateEquivalentAnnualAnnuity(lifeCycleInput.LCCTotalCost, lifeCycleInput.ServiceLifeYears, lifeCycleInput.Local.RealRate, lifeCycleInput.Local.NominalRate); //set unit cost if (lifeCycleInput.PerUnitAmount == 0) { lifeCycleInput.PerUnitAmount = 1; } lifeCycleInput.UnitTotalCost = lifeCycleInput.LCCTotalCost / lifeCycleInput.PerUnitAmount; }
/// <summary> /// Purpose Calculate life cycle costs. /// Calculations come from NIST 135. /// </summary> public bool RunCostCalculations(LCC1Input lifeCycleInput) { bool bHasCalcs = false; GeneralRules.GROWTH_SERIES_TYPES eGrowthType; //one subcost to calculate double dbSubPrice1Total = 0; //only the real rate and constant dollars are used //but keep these for possible future use double dbNominalRate = 0; double dbRealRate = 0; double dbInflationRate = 0; //the totals have to be discounted and escalated from these initial totals //(multiplicative means that price does not have to be used) //ok to use the default order of the subcosts dbSubPrice1Total = lifeCycleInput.SubPrice1.SubPAmount * lifeCycleInput.SubPrice1.SubPPrice; //init calculation parameters dbRealRate = lifeCycleInput.Local.RealRate; dbNominalRate = lifeCycleInput.Local.NominalRate; dbInflationRate = 0; GeneralRules.MissingRate(ref dbRealRate, ref dbNominalRate, ref dbInflationRate); if (dbRealRate > 0.999) { dbRealRate = dbRealRate / 100; } if (dbNominalRate > 0.999) { dbNominalRate = dbNominalRate / 100; } if (dbInflationRate > 0.999) { dbInflationRate = dbInflationRate / 100; } lifeCycleInput.Local.RealRate = dbRealRate; lifeCycleInput.Local.NominalRate = dbNominalRate; lifeCycleInput.Local.InflationRate = dbInflationRate; //get the recurring cost factors //ok to use the default order of the subcosts eGrowthType = GeneralRules.GetGrowthType(lifeCycleInput.SubPrice1.SubPEscType); lifeCycleInput.SubPrice1.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice1Total, dbRealRate, lifeCycleInput.ServiceLifeYears, lifeCycleInput.YearsFromBaseDate, lifeCycleInput.PlanningConstructionYears, eGrowthType, lifeCycleInput.SubPrice1.SubPEscRate, lifeCycleInput.SubPrice1.SubPFactor, lifeCycleInput.SubPrice1.SubPYears, lifeCycleInput.SubPrice1.SubPYearTimes, lifeCycleInput.SubPrice1.SubPSalvValue); lifeCycleInput.SubPrice1.SubPTotalPerUnit = lifeCycleInput.SubPrice1.SubPTotal / lifeCycleInput.PerUnitAmount; //set lifeCyleInput's total properties to these values SetCostTotals(lifeCycleInput); //update the base input's prices (unit costs, not full costs) UpdateBaseInputUnitPrices(lifeCycleInput); bHasCalcs = true; return(bHasCalcs); }
private void UpdateBaseInputUnitPrices(LCC1Input lifeCycleInput) { //base input prices are entered as total costs (composite capital input) //they have to enter units and amounts, units should generally be "each" lifeCycleInput.OCPrice = lifeCycleInput.OCTotalCost; lifeCycleInput.AOHPrice = lifeCycleInput.AOHTotalCost; lifeCycleInput.CAPPrice = lifeCycleInput.CAPTotalCost; //operating and capital budgets use TotalAMAOH lifeCycleInput.SubPrice1.TotalAMAOH = lifeCycleInput.EAATotalCost; }
private static void SetInputBasePrice(LCC1Input lifeCycleInput, string priceType, double cost) { if (priceType == SubPrice1.PRICE_TYPE.oc.ToString()) { lifeCycleInput.OCTotalCost += cost; } else if (priceType == SubPrice1.PRICE_TYPE.aoh.ToString()) { lifeCycleInput.AOHTotalCost += cost; } else if (priceType == SubPrice1.PRICE_TYPE.cap.ToString()) { lifeCycleInput.CAPTotalCost += cost; } }
public virtual void CopyLCC1Properties( LCC1Input calculator) { this.CopyCalculatorProperties(calculator); this.CopySharedObjectProperties(calculator); //this.CopySubPrice1sProperties(calculator); this.ServiceLifeYears = calculator.ServiceLifeYears; this.YearsFromBaseDate = calculator.YearsFromBaseDate; this.PlanningConstructionYears = calculator.PlanningConstructionYears; this.PerUnitAmount = calculator.PerUnitAmount; this.PerUnitUnit = calculator.PerUnitUnit; this.SubPrice1 = new SubPrice1(calculator.SubPrice1); this.OCTotalCost = calculator.OCTotalCost; this.AOHTotalCost = calculator.AOHTotalCost; this.CAPTotalCost = calculator.CAPTotalCost; this.LCCTotalCost = calculator.LCCTotalCost; this.EAATotalCost = calculator.EAATotalCost; this.UnitTotalCost = calculator.UnitTotalCost; }
//copy constructor public LCC1Input(LCC1Input lca1Calc) : base(lca1Calc) { CopyLCC1Properties(lca1Calc); }