Esempio n. 1
0
        private EInterpretationCategory AssembleInterpretationCategory(FailureMechanismSectionAssemblyInput input, IAssessmentResultsTranslator kernel, Probability probability)
        {
            ICategoryLimitsCalculator assemblyGroupsKernel = factory.CreateAssemblyGroupsKernel();
            CategoriesList <InterpretationCategory> interpretationCategories = assemblyGroupsKernel.CalculateInterpretationCategoryLimitsBoi01(
                new AssessmentSection(AssemblyCalculatorInputCreator.CreateProbability(input.SignalFloodingProbability),
                                      AssemblyCalculatorInputCreator.CreateProbability(input.MaximumAllowableFloodingProbability)));

            return(kernel.DetermineInterpretationCategoryFromFailureMechanismSectionProbabilityBoi0B1(
                       probability, interpretationCategories));
        }
        public void CreateAssemblyGroupsKernel_Always_ReturnsKernelCategoryLimitsCalculator()
        {
            // Setup
            IAssemblyToolKernelFactory factory = AssemblyToolKernelFactory.Instance;

            // Call
            ICategoryLimitsCalculator assemblyGroupsKernel = factory.CreateAssemblyGroupsKernel();

            // Assert
            Assert.IsInstanceOf <CategoryLimitsCalculator>(assemblyGroupsKernel);
        }
Esempio n. 3
0
        public IEnumerable <AssessmentSectionAssemblyGroupBoundaries> CalculateAssessmentSectionAssemblyGroupBoundaries(double signalFloodingProbability, double maximumAllowableFloodingProbability)
        {
            try
            {
                ICategoryLimitsCalculator kernel = factory.CreateAssemblyGroupsKernel();
                CategoriesList <AssessmentSectionCategory> assessmentSectionCategories = kernel.CalculateAssessmentSectionCategoryLimitsBoi21(
                    new AssessmentSection(AssemblyCalculatorInputCreator.CreateProbability(signalFloodingProbability),
                                          AssemblyCalculatorInputCreator.CreateProbability(maximumAllowableFloodingProbability)));

                return(AssessmentSectionAssemblyGroupCreator.CreateAssessmentSectionAssemblyGroupBoundaries(assessmentSectionCategories));
            }
            catch (AssemblyException e)
            {
                throw new AssessmentSectionAssemblyGroupBoundariesCalculatorException(AssemblyErrorMessageCreator.CreateErrorMessage(e.Errors), e);
            }
            catch (Exception e)
            {
                throw new AssessmentSectionAssemblyGroupBoundariesCalculatorException(AssemblyErrorMessageCreator.CreateGenericErrorMessage(), e);
            }
        }
Esempio n. 4
0
        public AssessmentSectionAssemblyResultWrapper AssembleAssessmentSection(IEnumerable <double> failureMechanismProbabilities,
                                                                                double maximumAllowableFloodingProbability,
                                                                                double signalFloodingProbability)
        {
            if (failureMechanismProbabilities == null)
            {
                throw new ArgumentNullException(nameof(failureMechanismProbabilities));
            }

            try
            {
                ICategoryLimitsCalculator categoryLimitsKernel = factory.CreateAssemblyGroupsKernel();
                CategoriesList <AssessmentSectionCategory> assessmentSectionCategories = categoryLimitsKernel.CalculateAssessmentSectionCategoryLimitsBoi21(
                    new AssessmentSection(AssemblyCalculatorInputCreator.CreateProbability(signalFloodingProbability),
                                          AssemblyCalculatorInputCreator.CreateProbability(maximumAllowableFloodingProbability)));

                IAssessmentGradeAssembler assessmentSectionAssemblyKernel = factory.CreateAssessmentSectionAssemblyKernel();
                IEnumerable <Probability> probabilities = failureMechanismProbabilities.Select(AssemblyCalculatorInputCreator.CreateProbability)
                                                          .ToArray();

                Probability      assemblyProbability = assessmentSectionAssemblyKernel.CalculateAssessmentSectionFailureProbabilityBoi2A1(probabilities, false);
                EAssessmentGrade assemblyCategory    = assessmentSectionAssemblyKernel.DetermineAssessmentGradeBoi2B1(assemblyProbability, assessmentSectionCategories);

                return(new AssessmentSectionAssemblyResultWrapper(
                           new AssessmentSectionAssemblyResult(assemblyProbability,
                                                               AssessmentSectionAssemblyGroupCreator.CreateAssessmentSectionAssemblyGroup(assemblyCategory)),
                           AssemblyMethod.BOI2A1, AssemblyMethod.BOI2B1));
            }
            catch (AssemblyException e)
            {
                throw new AssessmentSectionAssemblyCalculatorException(AssemblyErrorMessageCreator.CreateErrorMessage(e.Errors), e);
            }
            catch (Exception e)
            {
                throw new AssessmentSectionAssemblyCalculatorException(AssemblyErrorMessageCreator.CreateGenericErrorMessage(), e);
            }
        }