Пример #1
0
        public SolarVsUtilityProjection CalculateFutureProjection(
            IYearlyKwhUsage solarEstimate,
            ProjectionParameters projectionParameters
            )
        {
            var projection      = new List <IYearlyKwhUsageCompare>();
            var utilityEstimate = projectionParameters.UtilityYear;

            var paidOffSolarEstimate = new YearlyKwhUsageFromAnnual(
                0, solarEstimate.TotalKiloWattHours
                );

            // Each year to project
            for (int i = 0; i < projectionParameters.YearsToProject; i++)
            {
                projection.Add(new YearlyKwhUsageCompare(
                                   FormulaHelpers.CompoundInterest(utilityEstimate.TotalCost, projectionParameters.PercentIncreasePerYear, 1, i),
                                   utilityEstimate.TotalKiloWattHours,
                                   i,
                                   // After financeYears, solar panels are no longer paid for
                                   i < projectionParameters.FinanceYears ?
                                   solarEstimate : paidOffSolarEstimate
                                   ));
            }

            return(new SolarVsUtilityProjection(solarEstimate, projection, projectionParameters.FinanceYears));
        }
 public SolarVsUtilityProjection(
     IYearlyKwhUsage solarEstimate,
     List <IYearlyKwhUsageCompare> futureProjection,
     int financeYears
     )
 {
     SolarEstimate    = solarEstimate;
     FutureProjection = futureProjection;
     FinanceYears     = financeYears;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="utilityYear">A utility year's <see cref="IYearlyKwhUsage"/>.</param>
 /// <param name="yearsToProject">The number of years to project into the future.</param>
 /// <param name="financeYears">The number of years the mortgage is active.</param>
 /// <param name="percentIncreasePerYear">The change in kw/h cost per year.</param>
 public ProjectionParameters(
     IYearlyKwhUsage utilityYear,
     int yearsToProject,
     int financeYears,
     double percentIncreasePerYear
     )
 {
     UtilityYear            = utilityYear;
     YearsToProject         = yearsToProject;
     FinanceYears           = financeYears;
     PercentIncreasePerYear = percentIncreasePerYear;
 }
        public YearlyKwhUsageCompare(
            double totalCost,
            int totalKiloWattHours,
            int purchaseYear,
            IYearlyKwhUsage solarProjection
            )
            : base(totalCost, totalKiloWattHours)
        {
            PurchaseYear    = purchaseYear;
            SolarProjection = solarProjection;

            CostSolar100Percent = CalculateTotalCost(1);
            CostSolar90Percent  = CalculateTotalCost(0.9);
            CostSolar80Percent  = CalculateTotalCost(0.8);

            TotalSavings100Percent = totalCost - CostSolar100Percent;
            TotalSavings90Percent  = totalCost - CostSolar90Percent;
            TotalSavings80Percent  = totalCost - CostSolar80Percent;
        }