public override double?[] GetZynos(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData,
                                           IReadOnlyList <TimeVariantInputDTO> timeVariantData,
                                           double?[] unitOutput)
        {
            // We return negative value here because output value measure "Financial Benefits & Costs - OMA"
            // is defined as "Positive Weighting" for Value Function Usage, and it is used as output measure by mulitple Value Models.

            return(ConvertUnitsToZynos(HelperFunctions.scaleValues(months, unitOutput, -1d), CommonConstants.DollarToZynoConversionFactor));
        }
示例#2
0
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            var result = new double?[months];

            // return 0 values after the end of spend
            FillWithValueAfterEndOfSpend(months, timeInvariantData.InvestmentSpendByAccountType, ref result, 0);

            return(result);
        }
示例#3
0
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            if (timeInvariantData.NERC_32_Dollars.HasValue && timeInvariantData.NERC_32_Dollars.Value > 0)
            {
                return(PopulateOutputWithValue(months, CustomerConstants.probabilities_AlmostCertain / CommonConstants.MonthsInYear));
            }

            return(null);
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            if (timeInvariantData.Account_32_Type.ValueAsInteger != CustomerConstants.OMAAccountNumber)
            {
                return(null);
            }

            return(PopulateOutputWithValue(months, 0d));
        }
示例#5
0
 public override double?[] GetUnits(int startFiscalYear, int months,
                                    TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
 {
     return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                       startFiscalYear,
                                                       months, (x => (x.Number_32_of_32_Employees_32_Affected *
                                                                      timeInvariantData.Hours_32_Saved_32_per_32_Employee *
                                                                      timeInvariantData.SystemLabour_32_Cost_32_Per_32_hour *
                                                                      timeInvariantData.SystemProbability_32_of_32_Repurposing
                                                                      ))));
 }
示例#6
0
 public override double?[] GetUnits(int startFiscalYear, int months,
                                    TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
 {
     if (timeInvariantData.Cost_32_Savings_Cost_32_Savings_32__45__32_OMA_ConsqUnitOutput_B == null)
     {
         return(null);
     }
     return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                       startFiscalYear,
                                                       months, (x => (x.Costs_32_Saved))));
 }
示例#7
0
 public override double?[] GetUnits(int startFiscalYear, int months,
                                    TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
 {
     if (timeInvariantData.Additional_32_Costs_Additional_32_Costs_32__32__45__32_Capital_ConsqUnitOutput_B == null)
     {
         return(null);
     }
     return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                       startFiscalYear,
                                                       months, (x => - 1d * x.Additional_32_Costs)));
 }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            if (timeInvariantData.NERC_32_Dollars.HasValue && timeInvariantData.NERC_32_Dollars.Value > 0)
            {
                return(PopulateOutputWithValue(months,
                                               (2 * timeInvariantData.NERC_32_Dollars * CommonConstants.DollarToZynoConversionFactor)));
            }

            return(null);
        }
 public override double?[] GetUnits(int startFiscalYear, int months,
                                    TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
 {
     if (timeInvariantData.Account_32_Type.ValueAsInteger != CustomerConstants.OMAAccountNumber)
     {
         return(null);
     }
     return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                       startFiscalYear,
                                                       months, (x => x.Costs_32_incurred_32_after_32_this_32_investment_32_is_32_undertaken)));
 }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            if (timeInvariantData.InvestmentSpendByResource == null)
            {
                return(null);
            }
            var internalLabourHours = HelperFunctions.GetResourceCurrencyUnitsFromForecast(months, CustomerConstants.internalLabourCode, timeInvariantData.InvestmentSpendByResource);
            var contractLabourHours = HelperFunctions.GetResourceCurrencyUnitsFromForecast(months, CustomerConstants.contractLabourCode, timeInvariantData.InvestmentSpendByResource);

            return(HelperFunctions.CombineSeries(months, internalLabourHours, contractLabourHours));
        }
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula assumes that "BESS Risk Issue" is used consistently accross the all time-variant answers (i.e. once true - always true).

            // Measure ouptut is eliminated if "BESS Risk Issue" is true
            if (timeVariantData.Any(answer => answer.BES_32_Risk_32_Issue == true))
            {
                return(null);
            }

            return(PopulateOutputWithValue(months, CustomerConstants.annualExposurePercentage / 100d
                                           / CommonConstants.MonthsInYear));
        }
示例#12
0
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // Cannot calculate cosequence if system parameters are missing or have no values
            if (!timeInvariantData.SystemValue_32_of_32_Improvement_32_Affecting_32_All_32_Public.HasValue)
            {
                return(null);
            }

            var publicPerceptionValue = timeInvariantData.SystemValue_32_of_32_Improvement_32_Affecting_32_All_32_Public.Value *
                                        timeInvariantData.Percentage_32_Public / 100d;

            return(PopulateOutputWithValue(months, publicPerceptionValue));
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula presumes that COF & POF values, if entered, are consistently used accross all time-variant answers.

            // When COF amount is used, we invalidate entire value measure
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.COF != null)
            {
                return(null);
            }

            return(PopulateOutputWithValue(months, CustomerConstants.consequence_Major));
        }
示例#14
0
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // Risk consequence is the COF if it was entered in the questionnaire
            // NOTE: Formula presumes that COF value, once entered, is consistently used accross all time-variant answers.
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.COF != null)
            {
                return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                                  (x => x.COF * CommonConstants.DollarToZynoConversionFactor))); // COF is in Dollars ($)
            }

            return(null);
        }
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula presumes that COF & POF values, if entered, are consistently used accross all time-variant answers.

            // When COF amount is used, we invalidate entire value measure
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.COF != null)
            {
                return(null);
            }

            // Risk likelihood is the POF value if it was entered in the questionnaire.
            // Otherwise, risk likelihood is calculated using Condition and Design Life.
            // The likelihood is then being modified by the probability modifying values.

            var probabilityModifyingValues = InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear,
                                                                                        months, (x => (x.Number_32_of_32_Assets ?? 1)
                                                                                                 * (x.Self_32_Monitored ? 0.33 : 1)
                                                                                                 * ((x.Manufacturer_32_Support && x.Standard_32_OS) ? 1 : 3)
                                                                                                 * ((x.Additional_32_Failures_32_Required.HasValue && x.Additional_32_Failures_32_Required.Value > 0)
                                                            ? (System.Math.Pow(0.1, x.Additional_32_Failures_32_Required.Value))
                                                            : 1)));

            if (answers != null && answers.POF != null)
            {
                var pofMonthlyProbabilities = InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                                                         (x => x.POF / 100d / CommonConstants.MonthsInYear));

                return(HelperFunctions.MultiplySeries(months, pofMonthlyProbabilities, probabilityModifyingValues));
            }
            else
            {
                var condition = timeInvariantData.Transmission_32_Electronic_32_Asset_32_Risk_Transmission_32_Electronic_32__45__32_Condition_ConsqUnitOutput;
                if (condition == null)
                {
                    return(null);
                }

                var eomConditionToFailureCurve = HelperFunctions.GenericEndOfLifeModel.constructGenericEndOfLifePofCurve();

                var monthlyProbabilities = ConvertConditionToMonthlyProbability(
                    condition, eomConditionToFailureCurve, treatProbabilityAsFrequency: true);

                return(HelperFunctions.MultiplySeries(months, monthlyProbabilities, probabilityModifyingValues));
            }
        }
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula assumes that "BESS Risk Issue" is used consistently accross the all time-variant answers (i.e. once true - always true).

            // Measure is calculated only if "BESS Risk Issue" is true
            if (timeVariantData.Any(answer => answer.BES_32_Risk_32_Issue == true))
            {
                return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                                  startFiscalYear,
                                                                  months, (x => x.BES_32_Risk_32_Issue
                                            ? (CustomerConstants.probabilities_AlmostCertain / CommonConstants.MonthsInYear)
                                            : CustomerConstants.probabilities_None)));
            }

            return(null);
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula assumes that "BESS Risk Issue" is used consistently accross the all time-variant answers (i.e. once true - always true).

            // Measure is calculated only if "BESS Risk Issue" is true
            if (timeVariantData.Any(answer => answer.BES_32_Risk_32_Issue == true))
            {
                return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                                  startFiscalYear,
                                                                  months, (x => x.BES_32_Risk_32_Issue
                                                ? (CustomerConstants.consequence_Catastrophic)
                                                : CustomerConstants.consequence_None)));
            }

            return(null);
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            var renewableCapacityValues = timeInvariantData.SystemRenewable_32_Capacity_32_Value_32__40__36__47_MW_41__32_TimeSeries;
            var renewableCapacityAdded  = InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                                                     startFiscalYear,
                                                                                     months, (x => x.Renewable_32_Capacity_32_Added));

            if (renewableCapacityValues == null || renewableCapacityAdded == null)
            {
                return(null);
            }

            var result = HelperFunctions.scaleValues(startFiscalYear, months, renewableCapacityAdded, renewableCapacityValues);

            return(result);
        }
示例#19
0
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            var cO2Prices      = timeInvariantData.SystemCO2_32_Credits_32_Value_32__40__36__32__47__32_MWh_41__32_TimeSeries;
            var tonsCO2Avoided = InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                                            startFiscalYear,
                                                                            months, (x => x.CO2_32_Reduction));

            if (cO2Prices == null || tonsCO2Avoided == null)
            {
                return(null);
            }

            var result = HelperFunctions.scaleValues(startFiscalYear, months, tonsCO2Avoided, cO2Prices);

            return(result);
        }
示例#20
0
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // Do not produce any result unless there is a baseline calculated
            var baselineFinRiskConsequences = timeInvariantData.Transmission_32_Line_32_Risk_Transmission_32_Line_32__45__32_Financial_ConsqUnitOutput_B;

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

            // Return 0 values after the end of spend
            var result = new double?[months];

            FillWithValueAfterEndOfSpend(months, timeInvariantData.InvestmentSpendByAccountType, ref result, 0);

            return(result);
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula presumes that COF & POF values, if entered, are consistently used accross all time-variant answers.

            // When COF amount is used, we invalidate entire value measure
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.COF != null)
            {
                return(null);
            }

            return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                              (x => x.Consequence_32_of_32_Environment_32_Risk != null
                                                    ? x.Consequence_32_of_32_Environment_32_Risk.Value
                                                    : 0)));
        }
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // In case COF is provided, we invalidate the entire measure calculation based on the Reliability Risk output
            var monthlyReliabilityProbabilities = timeInvariantData.Transmission_32_Line_32_Risk_Transmission_32_Line_32__45__32_Reliability_LikelihoodUnitOutput_B;

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

            // Return 0 values after the end of spend
            var result = new double?[months];

            FillWithValueAfterEndOfSpend(months, timeInvariantData.InvestmentSpendByAccountType, ref result, 0);

            return(result);
        }
示例#23
0
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // In baseline Compliance likelihood is not provided, do not output Automatic Output
            var monthlyBaselineComplianceProbabilities = timeInvariantData.Transmission_32_Electronic_32_Asset_32_Risk_Transmission_32_Electronic_32__45__32_Compliance_ConsqUnitOutput_B;

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

            // Return 0 values after the end of spend
            var result = new double?[months];

            FillWithValueAfterEndOfSpend(months, timeInvariantData.InvestmentSpendByAccountType, ref result, 0);

            return(result);
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula presumes that COF & POF values, if entered, are consistently used accross all time-variant answers.

            // When COF amount is used, we invalidate entire value measure
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.COF != null)
            {
                return(null);
            }

            // The LineVoltage is in USD/Day (in zynos), and the TimeToRepair is ih Hours
            return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                              (x => (x.Line_32_Voltage != null ?
                                                                     (x.Line_32_Voltage.Value / CommonConstants.HoursInDay) : 0)
                                                               * (x.Time_32_to_32_Repair ?? 0))));
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // Cannot calculate cosequence if system parameters are missing or have no values
            if (!timeInvariantData.SystemEmployee_32_Productivity_32_Cost_32_Per_32_Year.HasValue ||
                !timeInvariantData.SystemImpact_32_to_32_Critical_32_Process.HasValue)
            {
                return(null);
            }

            return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                              (x => (x.Business_32_Continuity_32_Employees_32_Affected
                                                                     * x.Productivity_32_Impact.Value
                                                                     * timeInvariantData.SystemEmployee_32_Productivity_32_Cost_32_Per_32_Year.Value)
                                                               + ((timeInvariantData.BIA_32_Critical ? 1 : 0)
                                                                  * (timeInvariantData.Interruption_32_Exceeds_32_RTO ? 1 : 0)
                                                                  * timeInvariantData.SystemImpact_32_to_32_Critical_32_Process)
                                                              )));
        }
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // We cannot use prompts in Automatic Outcome questionnaire, so we cannot check for the selected Account Type directly.
            // Instead, we are checking if the Capital related measure has any output

            // This will return null if the Capital account type is not selected by user.
            var capitalSpends = timeInvariantData.Cost_32_Avoidance_Cost_32_Avoidance_32__32__45__32_Capital_ConsqUnitOutput_B;

            if (capitalSpends == null)
            {
                return(null); // this eliminate measure output
            }

            // Return 0 values after the end of spend
            var result = new double?[months];

            FillWithValueAfterEndOfSpend(months, timeInvariantData.InvestmentSpendByAccountType, ref result, 0);

            return(result); // this eliminate risk at the end of investment
        }
示例#27
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));
        }
示例#28
0
        public override double?[] GetUnits(int startFiscalYear, int months,
                                           TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // Cannot calculate cosequence if system parameters are missing or have no values
            if (!timeInvariantData.SystemValue_32_per_32_Candidate_32_Attracted.HasValue ||
                !timeInvariantData.SystemEmployee_32_Productivity_32_Value.HasValue ||
                !timeInvariantData.SystemEmployee_32_Cost_32_to_32_Replace.HasValue)
            {
                return(null);
            }

            return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData,
                                                              startFiscalYear,
                                                              months, (x =>
                                                                       (x.Number_32_of_32_Candidates_32_Attracted * x.Workplace_32_Impact_32_On_32_Attractiveness.Value
                                                                        * timeInvariantData.SystemValue_32_per_32_Candidate_32_Attracted.Value) +
                                                                       (x.Number_32_of_32_Employees_32_Affected * x.Workplace_32_Impact_32_On_32_Productivity.Value
                                                                        * timeInvariantData.SystemEmployee_32_Productivity_32_Value.Value) +
                                                                       (x.Number_32_of_32_Employees_32_At_32_Risk_32_Of_32_Leaving * x.Workplace_32_Impact_32_On_32_Productivity.Value
                                                                        * timeInvariantData.SystemEmployee_32_Cost_32_to_32_Replace.Value)
                                                                       )));
        }
示例#29
0
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            // NOTE: Formula presumes that COF & POF values, if entered, are consistently used accross all time-variant answers.

            // When COF amount is used, we invalidate entire value measure
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.COF != null)
            {
                return(null);
            }

            // Risk probability is the POF if it was entered in the questionnaire.
            // Otherwise, risk likelihood is calculated using Condition and Design Life.

            if (answers != null && answers.POF != null)
            {
                return(InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                                  (x => x.POF / 100d / CommonConstants.MonthsInYear)));
            }
            else
            {
                var condition = timeInvariantData.Transmission_32_Line_32_Risk_Transmission_32_Line_32__45__32_Condition_ConsqUnitOutput;
                if (condition == null)
                {
                    return(null);
                }

                var eomConditionToFailureCurve = HelperFunctions.GenericEndOfLifeModel.constructGenericEndOfLifePofCurve();

                var monthlyProbabilities = ConvertConditionToMonthlyProbability(
                    condition, eomConditionToFailureCurve, treatProbabilityAsFrequency: true);

                return(monthlyProbabilities);
            }
        }
示例#30
0
        public override double?[] GetLikelihoodValues(int startFiscalYear, int months,
                                                      TimeInvariantInputDTO timeInvariantData, IReadOnlyList <TimeVariantInputDTO> timeVariantData)
        {
            double?[] monthlyFailureProbabilities = null;

            // Risk probability is the POF if it was entered in the questionnaire;
            // otherwise, risk likelihood is calculated using Condition and Design Life

            // NOTE: Formula presumes that POF value, if entered, is consistently used accross all time-variant answers.
            var answers = timeVariantData.FirstOrDefault();

            if (answers != null && answers.POF != null)
            {
                monthlyFailureProbabilities = InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                                                         (x => x.POF / 100d / CommonConstants.MonthsInYear));
            }
            else
            {
                var condition = timeInvariantData.Transmission_32_Station_32_Equipment_32_Risk_Transmission_32_Station_32__45__32_Condition_ConsqUnitOutput;
                if (condition == null)
                {
                    return(null);
                }

                var eomConditionToFailureCurve = HelperFunctions.GenericEndOfLifeModel.constructGenericEndOfLifePofCurve();

                monthlyFailureProbabilities = ConvertConditionToMonthlyProbability(
                    condition, eomConditionToFailureCurve, treatProbabilityAsFrequency: true);
            }

            // Probability of Collateral Damage is mandatory input variable
            var collateralDamageProbabilities = InterpolatePropagate <TimeVariantInputDTO>(timeVariantData, startFiscalYear, months,
                                                                                           (x => (x.Probability_32_of_32_Collateral_32_Damage / 100d)));

            return(HelperFunctions.MultiplySeries(months, monthlyFailureProbabilities, collateralDamageProbabilities));
        }