public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // TODO: Pass this as a value measure
            var    answers             = timeVariantData.FirstOrDefault();
            double estimatedDesignLife = timeInvariantData.Design_32_Life;


            CL.FormulaHelper.DTOs.TimePeriodDTO timePeriod = new CL.FormulaHelper.DTOs.TimePeriodDTO();
            var endOfSpendMonthOffset = FormulaBase.FindEndOfSpendMonth(timeInvariantData.InvestmentSpendByAccountType);

            if (!endOfSpendMonthOffset.HasValue)
            {
                return(null);
            }
            timePeriod.StartTime = FormulaBase.GetCalendarDateTime(startFiscalYear, fiscalPeriod: 1)
                                   .AddMonths(endOfSpendMonthOffset.Value + 1); // + 1 because the benefit starts in the first month after end of spend.

            TimeVariantLocalConditionDTO localTimeInvariantData =
                new TimeVariantLocalConditionDTO(answers.Condition, timePeriod);

            List <TimeVariantLocalConditionDTO> localTimeInvariantDataList
                = new List <TimeVariantLocalConditionDTO>();

            localTimeInvariantDataList.Add(localTimeInvariantData);

            // A generic end of life condition decay curve, generated based on the design life entered by user.
            XYCurveDTO conditionDecayCurve = HelperFunctions.GenericEndOfLifeModel.constructConditionDecayCurve(estimatedDesignLife);

            return(InterpolateCurve <TimeVariantLocalConditionDTO>(localTimeInvariantDataList,
                                                                   startFiscalYear,
                                                                   months,
                                                                   conditionDecayCurve,
                                                                   x => x.ConditionScoreLocal));
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            var    answers             = timeVariantData.FirstOrDefault();
            double estimatedDesignLife = timeInvariantData.Design_32_Life;

            TimeVariantLocalConditionDTO localTimeInvariantData =
                new TimeVariantLocalConditionDTO(answers.Condition, answers.TimePeriod);

            /*IReadOnly*/ List <TimeVariantLocalConditionDTO> localTimeInvariantDataList
                = new List <TimeVariantLocalConditionDTO>();

            localTimeInvariantDataList.Add(localTimeInvariantData);

            // A generic end of life condition decay curve, generated based on the design life entered by user.
            XYCurveDTO conditionDecayCurve = HelperFunctions.GenericEndOfLifeModel.constructConditionDecayCurve(estimatedDesignLife);

            // From Zeus v18
            var monthlyConditionScores = MonthlyConditionScores <TimeVariantLocalConditionDTO>(
                startFiscalYear,
                months,
                null, // assetInServiceDate
                localTimeInvariantDataList,
                conditionDecayCurve,
                x => x.ConditionScoreLocal);

            return(monthlyConditionScores);
        }
예제 #3
0
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            var estimatedDesignLifeMeasure = timeInvariantData.Transmission_32_Station_32_Equipment_32_Risk_Transmission_32_Station_32__45__32_Design_32_Life_ConsqUnitOutput_B;

            if (estimatedDesignLifeMeasure == null)
            {
                return(null);
            }

            double estimatedDesignLife     = estimatedDesignLifeMeasure[0].Value;
            double defaultOutcomeCondition = 10.0;

            TimePeriodDTO timePeriod            = new TimePeriodDTO();
            var           endOfSpendMonthOffset = FindEndOfSpendMonth(timeInvariantData.InvestmentSpendByAccountType);

            if (!endOfSpendMonthOffset.HasValue)
            {
                return(null);
            }
            timePeriod.StartTime = GetCalendarDateTime(startFiscalYear, fiscalPeriod: 1)
                                   .AddMonths(endOfSpendMonthOffset.Value + 1); // + 1 because the benefit starts in the first month after end of spend.

            TimeVariantLocalConditionDTO localTimeInvariantData =
                new TimeVariantLocalConditionDTO(defaultOutcomeCondition, timePeriod);

            List <TimeVariantLocalConditionDTO> localTimeInvariantDataList
                = new List <TimeVariantLocalConditionDTO>();

            localTimeInvariantDataList.Add(localTimeInvariantData);

            // A generic end of life condition decay curve, generated based on the design life entered by user.
            XYCurveDTO conditionDecayCurve = HelperFunctions.GenericEndOfLifeModel.constructConditionDecayCurve(estimatedDesignLife);

            return(InterpolateCurve <TimeVariantLocalConditionDTO>(localTimeInvariantDataList,
                                                                   startFiscalYear,
                                                                   months,
                                                                   conditionDecayCurve,
                                                                   x => x.ConditionScoreLocal));
        }