DevTreks.Extensions/NPVCalculators/BIs/BICalculator.cs
/// <summary>
///  Add ann equiv nodes each time an annuity is formed in analyses; store only in aoh section
///  Includes preprod annuity and regular complife>1 annuities.
///  Output is an addition to the collection of annuities that get added to subsequent time periods
///  the annuity added.
/// </summary>
Add ann equiv nodes each time an annuity is formed in analyses; store only in aoh section
Includes preprod annuity and regular complife>1 annuities.
Output is an addition to the collection of annuities that get added to subsequent time periods
the annuity added.
Add ann equiv nodes each time an annuity is formed in analyses ; store only in aoh section Includes preprod annuity and regular complife > 1 annuities . Output is an addition to the collection of annuities that get added to subsequent time periods the annuity added .
public void AddAnnualEquivalents1(CalculatorParameters calcParameters,
            TimePeriod.ANNUITY_TYPES annuityType, string nodeName, 
            int timePeriodId, int prodPeriods, DateTime timeDate, 
            int iStartAnnuityCount, double tAOH, double tAMAOH, double tINCENT, 
            double tAMINCENT)
        {
            string sName = string.Empty;
            OperationComponent annOpComponent = new OperationComponent();
            annOpComponent.TimePeriodId = timePeriodId;
            annOpComponent.AnnuityType = annuityType;
            annOpComponent.Id = CalculatorHelpers.GetRandomInteger(calcParameters); 
            if (nodeName.EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()) 
                || nodeName.EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString()))
            {
                annOpComponent.Name = string.Concat(
                    calcParameters.ParentOperationComponent.Name, "-", CAPRECOVERY);
                annOpComponent.EffectiveLife = calcParameters.ParentOperationComponent.EffectiveLife;
                annOpComponent.AnnuityCount = iStartAnnuityCount;
                annOpComponent.SalvageValue = calcParameters.ParentOperationComponent.SalvageValue;
                annOpComponent.Unit = BudgetInvestment.ANNUITY;
            }
            else if (nodeName == BudgetInvestment.BUDGET_TYPES.budgettimeperiod.ToString() 
                || nodeName == BudgetInvestment.INVESTMENT_TYPES.investmenttimeperiod.ToString())
            {
                annOpComponent.Name = PREPRODCAPRECOVERY;
                annOpComponent.EffectiveLife = (double) prodPeriods;
                annOpComponent.AnnuityCount = iStartAnnuityCount;
                annOpComponent.SalvageValue = 0;
                annOpComponent.Unit = BudgetInvestment.ANNUITY;
            }
            annOpComponent.TotalAMOC = 0;
            annOpComponent.TotalAMAOH = tAMAOH;
            annOpComponent.TotalAMCAP = 0;
            annOpComponent.TotalAMOC_INT = 0;
            annOpComponent.TotalAMAOH_INT = 0; 
            annOpComponent.TotalAMCAP_INT = 0;
            annOpComponent.TotalAMINCENT = tAMINCENT;
            annOpComponent.TotalOC = 0;
            annOpComponent.TotalAOH = 0;
            annOpComponent.TotalCAP = 0;
            annOpComponent.TotalINCENT = 0;
            annOpComponent.Amount = tAOH;
            annOpComponent.Date = timeDate;
            annOpComponent.IncentiveRate = 0;
            annOpComponent.IncentiveAmount = 0;
            Input annInput = new Input();
            annInput.Id = CalculatorHelpers.GetRandomInteger(calcParameters);
            annInput.AnnuityType = annuityType;
            if (nodeName.EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString())
                || nodeName.EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()))
            {
                annInput.OpCompId = annOpComponent.Id;
                annInput.Name = annOpComponent.Name;
            }
            else if (nodeName == BudgetInvestment.BUDGET_TYPES.budgettimeperiod.ToString()
                || nodeName == BudgetInvestment.INVESTMENT_TYPES.investmenttimeperiod.ToString())
            {
                annInput.Name = PREPRODCAPRECOVERY_ABB;
            }
            annInput.AOHAmount = 1;
            annInput.AOHPrice = tAOH;
            annInput.TotalINCENT = tINCENT;
            annInput.AOHUnit = BudgetInvestment.ANNUITY;
            annInput.TotalAMAOH = tAMAOH;
            annInput.TotalAMAOH_INT = 0;
            annInput.TotalAMINCENT = tAMINCENT;
            annInput.TotalOC = 0;
            annInput.TotalAOH = 0;
            annInput.TotalCAP = 0;
            annInput.TotalOC_INT = 0;
            annInput.TotalAOH_INT = 0;
            annInput.TotalCAP_INT = 0;
            annInput.TotalAMOC = 0;
            annInput.TotalAMCAP = 0;
            annInput.CAPAmount = 0;
            annInput.CAPPrice = 0;
            annInput.CAPUnit = BudgetInvestment.ANNUITY;
            annInput.OCAmount = 0;
            annInput.OCPrice = 0;
            annInput.OCUnit = BudgetInvestment.ANNUITY;
            annInput.UseAOH = false;
            annInput.Times = 0;
            annInput.Date = timeDate;
            annInput.InputGroupId = (int) annuityType;
            annInput.InputGroupName = BudgetInvestment.ANNUITY;
            annInput.TypeId = (int) annuityType;
            annInput.Name = BudgetInvestment.ANNUITY;
            if (annOpComponent.Inputs == null)
                annOpComponent.Inputs = new List<Input>();
            annOpComponent.Inputs.Add(annInput);
            if (calcParameters.ParentBudgetInvestment.AnnEquivalents == null)
                calcParameters.ParentBudgetInvestment.AnnEquivalents = new List<OperationComponent>();
            calcParameters.ParentBudgetInvestment.AnnEquivalents.Add(annOpComponent);
        }
public void AddAnnualEquivalents1 ( CalculatorParameters calcParameters , TimePeriod . ANNUITY_TYPES annuityType , string nodeName , int timePeriodId , int prodPeriods , DateTime timeDate , int iStartAnnuityCount , double tAOH , double tAMAOH , double tINCENT , double tAMINCENT ) { string sName = string . Empty ; OperationComponent annOpComponent = new OperationComponent ( ) ; annOpComponent . TimePeriodId = timePeriodId ; annOpComponent . AnnuityType = annuityType ; annOpComponent . Id = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; if ( nodeName . EndsWith ( OperationComponent . OPERATION_PRICE_TYPES . operation . ToString ( ) ) || nodeName . EndsWith ( OperationComponent . COMPONENT_PRICE_TYPES . component . ToString ( ) ) ) { annOpComponent . Name = string . Concat ( calcParameters . ParentOperationComponent . Name , " " , CAPRECOVERY ) ; annOpComponent . EffectiveLife = calcParameters . ParentOperationComponent . EffectiveLife ; annOpComponent . AnnuityCount = iStartAnnuityCount ; annOpComponent . SalvageValue = calcParameters . ParentOperationComponent . SalvageValue ; annOpComponent . Unit = BudgetInvestment . ANNUITY ; } else if ( nodeName == BudgetInvestment . BUDGET_TYPES . budgettimeperiod . ToString ( ) || nodeName == BudgetInvestment . INVESTMENT_TYPES . investmenttimeperiod . ToString ( ) ) { annOpComponent . Name = PREPRODCAPRECOVERY ; annOpComponent . EffectiveLife = ( double ) prodPeriods ; annOpComponent . AnnuityCount = iStartAnnuityCount ; annOpComponent . SalvageValue = 0 ; annOpComponent . Unit = BudgetInvestment . ANNUITY ; } annOpComponent . TotalAMOC = 0 ; annOpComponent . TotalAMAOH = tAMAOH ; annOpComponent . TotalAMCAP = 0 ; annOpComponent . TotalAMOC_INT = 0 ; annOpComponent . TotalAMAOH_INT = 0 ; annOpComponent . TotalAMCAP_INT = 0 ; annOpComponent . TotalAMINCENT = tAMINCENT ; annOpComponent . TotalOC = 0 ; annOpComponent . TotalAOH = 0 ; annOpComponent . TotalCAP = 0 ; annOpComponent . TotalINCENT = 0 ; annOpComponent . Amount = tAOH ; annOpComponent . Date = timeDate ; annOpComponent . IncentiveRate = 0 ; annOpComponent . IncentiveAmount = 0 ; Input annInput = new Input ( ) ; annInput . Id = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; annInput . AnnuityType = annuityType ; if ( nodeName . EndsWith ( OperationComponent . COMPONENT_PRICE_TYPES . component . ToString ( ) ) || nodeName . EndsWith ( OperationComponent . OPERATION_PRICE_TYPES . operation . ToString ( ) ) ) { annInput . OpCompId = annOpComponent . Id ; annInput . Name = annOpComponent . Name ; } else if ( nodeName == BudgetInvestment . BUDGET_TYPES . budgettimeperiod . ToString ( ) || nodeName == BudgetInvestment . INVESTMENT_TYPES . investmenttimeperiod . ToString ( ) ) { annInput . Name = PREPRODCAPRECOVERY_ABB ; } annInput . AOHAmount = 1 ; annInput . AOHPrice = tAOH ; annInput . TotalINCENT = tINCENT ; annInput . AOHUnit = BudgetInvestment . ANNUITY ; annInput . TotalAMAOH = tAMAOH ; annInput . TotalAMAOH_INT = 0 ; annInput . TotalAMINCENT = tAMINCENT ; annInput . TotalOC = 0 ; annInput . TotalAOH = 0 ; annInput . TotalCAP = 0 ; annInput . TotalOC_INT = 0 ; annInput . TotalAOH_INT = 0 ; annInput . TotalCAP_INT = 0 ; annInput . TotalAMOC = 0 ; annInput . TotalAMCAP = 0 ; annInput . CAPAmount = 0 ; annInput . CAPPrice = 0 ; annInput . CAPUnit = BudgetInvestment . ANNUITY ; annInput . OCAmount = 0 ; annInput . OCPrice = 0 ; annInput . OCUnit = BudgetInvestment . ANNUITY ; annInput . UseAOH = false ; annInput . Times = 0 ; annInput . Date = timeDate ; annInput . InputGroupId = ( int ) annuityType ; annInput . InputGroupName = BudgetInvestment . ANNUITY ; annInput . TypeId = ( int ) annuityType ; annInput . Name = BudgetInvestment . ANNUITY ; if ( annOpComponent . Inputs == null ) annOpComponent . Inputs = new List < Input > ( ) ; annOpComponent . Inputs . Add ( annInput ) ; if ( calcParameters . ParentBudgetInvestment . AnnEquivalents == null ) calcParameters . ParentBudgetInvestment . AnnEquivalents = new List < OperationComponent > ( ) ; calcParameters . ParentBudgetInvestment . AnnEquivalents . Add ( annOpComponent ) ; }
Add ann equiv nodes each time an annuity is formed in analyses; store only in aoh section
Includes preprod annuity and regular complife>1 annuities.
Add ann equiv nodes each time an annuity is formed in analyses ; store only in aoh section Includes preprod annuity and regular complife > 1 annuities .
//Rules on adding //preprods: no interest included year0, and regular p&I thereafter //regs: don't go through here in year0, I only in year 1, and regular p&I thereafter //a) create new objects //set the properties of a new operationcomponent object //interest set each time annuity is added to a tp; //first year is interest only; last year can be fractional and includes salvage value //set each time added to tp //annuities never added to regular totals columns rule enforced //add an input object to opcomp //the sum being amortized - for display only - inputs not used with annuities except for display //add it to annequivs collection
calcParameters
CalculatorParameters
annuityType
TimePeriod.ANNUITY_TYPES
nodeName
string
timePeriodId
int
prodPeriods
int
timeDate
DateTime
iStartAnnuityCount
int
tAOH
double
tAMAOH
double
tINCENT
double
tAMINCENT
double