DevTreks.Extensions/AgBudgetingCalculators/InputsCapital/LCC1Input.cs
/// <summary>
/// Purpose     Calculate life cycle costs.
///             Calculations come from NIST 135.
/// </summary>
Purpose     Calculate life cycle costs.
Calculations come from NIST 135.
Purpose Calculate life cycle costs . Calculations come from NIST 135 .
public bool RunCostCalculations(LCC1Input lifeCycleInput)
        {
            bool bHasCalcs = false;
            GeneralRules.GROWTH_SERIES_TYPES eGrowthType;
            double dbSubPrice1Total = 0;
            double dbNominalRate = 0;
            double dbRealRate = 0;
            double dbInflationRate = 0;
            dbSubPrice1Total = lifeCycleInput.SubPrice1.SubPAmount * lifeCycleInput.SubPrice1.SubPPrice;
            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;
            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;
            SetCostTotals(lifeCycleInput);
            UpdateBaseInputUnitPrices(lifeCycleInput);
            bHasCalcs = true;
            return bHasCalcs;
        }
public bool RunCostCalculations ( LCC1Input lifeCycleInput ) { bool bHasCalcs = false ; GeneralRules . GROWTH_SERIES_TYPES eGrowthType ; double dbSubPrice1Total = 0 ; double dbNominalRate = 0 ; double dbRealRate = 0 ; double dbInflationRate = 0 ; dbSubPrice1Total = lifeCycleInput . SubPrice1 . SubPAmount * lifeCycleInput . SubPrice1 . SubPPrice ; 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 ; 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 ; SetCostTotals ( lifeCycleInput ) ; UpdateBaseInputUnitPrices ( lifeCycleInput ) ; bHasCalcs = true ; return bHasCalcs ; }
Purpose     Calculate life cycle costs.
Purpose Calculate life cycle costs .
//one subcost to calculate //only the real rate and constant dollars are used //but keep these for possible future use //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 //init calculation parameters //get the recurring cost factors //ok to use the default order of the subcosts //set lifeCyleInput's total properties to these values //update the base input's prices (unit costs, not full costs)
lifeCycleInput
LCC1Input