public void GetUpliftModelFactorDesignVariable_GeneralPipingInput_CreateDeterministicDesignVariableForUpliftModelFactor() { // Setup var generalPipingInput = new GeneralPipingInput(); // Call DeterministicDesignVariable <LogNormalDistribution> upliftModelFactor = SemiProbabilisticPipingDesignVariableFactory.GetUpliftModelFactorDesignVariable(generalPipingInput); // Assert DistributionAssert.AreEqual(generalPipingInput.UpliftModelFactor, upliftModelFactor.Distribution); Assert.AreEqual(generalPipingInput.UpliftModelFactor.Mean, upliftModelFactor.GetDesignValue()); }
public void WaterVolumetricWeight_SetValidValue_ValueSetAndSandParticlesVolumicWeightUpdated(double newValue) { // Setup var inputParameters = new GeneralPipingInput(); // Call inputParameters.WaterVolumetricWeight = (RoundedDouble)newValue; // Assert Assert.AreEqual(newValue, inputParameters.WaterVolumetricWeight, inputParameters.WaterVolumetricWeight.GetAccuracy()); Assert.AreEqual(26.0 - newValue, inputParameters.SandParticlesVolumicWeight, inputParameters.SandParticlesVolumicWeight.GetAccuracy()); }
public void ReadGeneralPipingInput_EntityNull_ThrowsArgumentNullException() { // Setup var input = new GeneralPipingInput(); // Call void Call() => ((PipingFailureMechanismMetaEntity)null).ReadGeneralPipingInput(input); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("entity", exception.ParamName); }
public static void CalculateEffectiveThicknessCoverageLayer_WithMultipleCharacteristicTypesOnSamePoint_ReturnsThickness() { // Setup var surfaceLine = new PipingSurfaceLine(string.Empty); surfaceLine.SetGeometry(new[] { new Point3D(0, 0, 10), new Point3D(20, 0, 10) }); surfaceLine.SetDikeToeAtRiverAt(surfaceLine.Points.ElementAt(0)); surfaceLine.SetDikeToeAtPolderAt(surfaceLine.Points.ElementAt(0)); surfaceLine.SetDitchDikeSideAt(surfaceLine.Points.ElementAt(0)); surfaceLine.SetBottomDitchPolderSideAt(surfaceLine.Points.ElementAt(1)); surfaceLine.SetBottomDitchDikeSideAt(surfaceLine.Points.ElementAt(1)); surfaceLine.SetDitchPolderSideAt(surfaceLine.Points.ElementAt(1)); var stochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile(string.Empty, 0, new[] { new PipingSoilLayer(5) { IsAquifer = true }, new PipingSoilLayer(20) { IsAquifer = false } }, SoilProfileType.SoilProfile1D)); var input = new TestPipingInput { ExitPointL = (RoundedDouble)10, SurfaceLine = surfaceLine, StochasticSoilProfile = stochasticSoilProfile }; var generalInput = new GeneralPipingInput(); // Call double thickness = InputParameterCalculationService.CalculateEffectiveThicknessCoverageLayer( generalInput.WaterVolumetricWeight, PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(), input.ExitPointL, input.SurfaceLine, input.StochasticSoilProfile.SoilProfile); // Assert Assert.AreEqual(5, thickness); }
public void ReadGeneralPipingInput_ValidParameters_SetGeneralPipingInputWithProperties() { // Setup var inputToUpdate = new GeneralPipingInput(); var entity = new PipingFailureMechanismMetaEntity { WaterVolumetricWeight = new Random(31).NextDouble() }; // Call entity.ReadGeneralPipingInput(inputToUpdate); // Assert Assert.AreEqual(entity.WaterVolumetricWeight, inputToUpdate.WaterVolumetricWeight, inputToUpdate.WaterVolumetricWeight.GetAccuracy()); }
public void GetEffectiveThicknessCoverageLayer_PipingInputWithCoverLayer_CreatePercentileBasedDesignVariableForEffectiveThicknessCoverageLayer() { // Setup PipingInput pipingInput = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); var generalPipingInput = new GeneralPipingInput(); // Call DesignVariable <LogNormalDistribution> effectiveThicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetEffectiveThicknessCoverageLayer(pipingInput, generalPipingInput); // Assert Assert.IsInstanceOf <PercentileBasedDesignVariable <LogNormalDistribution> >(effectiveThicknessCoverageLayer); DistributionAssert.AreEqual(DerivedPipingInput.GetEffectiveThicknessCoverageLayer(pipingInput, generalPipingInput), effectiveThicknessCoverageLayer.Distribution); AssertPercentile(0.05, effectiveThicknessCoverageLayer); }
public void GetEffectiveThicknessCoverageLayer_PipingInputWithoutCoverLayer_CreateDeterministicDesignVariableForEffectiveThicknessCoverageLayer() { // Setup var pipingInput = new TestPipingInput(); var generalPipingInput = new GeneralPipingInput(); // Call DesignVariable <LogNormalDistribution> effectiveThicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetEffectiveThicknessCoverageLayer(pipingInput, generalPipingInput); // Assert Assert.IsInstanceOf <DeterministicDesignVariable <LogNormalDistribution> >(effectiveThicknessCoverageLayer); DistributionAssert.AreEqual(DerivedPipingInput.GetEffectiveThicknessCoverageLayer(pipingInput, generalPipingInput), effectiveThicknessCoverageLayer.Distribution); Assert.AreEqual(new RoundedDouble(2), effectiveThicknessCoverageLayer.GetDesignValue()); }
/// <summary> /// Read the <see cref="PipingFailureMechanismMetaEntity"/> and use the information to update the /// <paramref name="generalPipingInput"/>. /// </summary> /// <param name="entity">The <see cref="PipingFailureMechanismMetaEntity"/> to use to update the /// <paramref name="generalPipingInput"/>.</param> /// <param name="generalPipingInput">The <see cref="GeneralPipingInput"/> to be updated.</param> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> internal static void ReadGeneralPipingInput(this PipingFailureMechanismMetaEntity entity, GeneralPipingInput generalPipingInput) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (generalPipingInput == null) { throw new ArgumentNullException(nameof(generalPipingInput)); } generalPipingInput.WaterVolumetricWeight = (RoundedDouble)entity.WaterVolumetricWeight; }
/// <summary> /// Creates a new instance of <see cref="SemiProbabilisticPipingCalculationActivity"/>. /// </summary> /// <param name="calculation">The <see cref="SemiProbabilisticPipingCalculation"/> to perform.</param> /// <param name="generalPipingInput">The <see cref="GeneralPipingInput"/> to use during the calculation.</param> /// <param name="normativeAssessmentLevel">The normative assessment level to use in case the manual assessment level is not applicable.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/> or <paramref name="generalPipingInput"/> /// is <c>null</c>.</exception> public SemiProbabilisticPipingCalculationActivity(SemiProbabilisticPipingCalculation calculation, GeneralPipingInput generalPipingInput, RoundedDouble normativeAssessmentLevel) : base(calculation) { if (generalPipingInput == null) { throw new ArgumentNullException(nameof(generalPipingInput)); } this.calculation = calculation; this.generalPipingInput = generalPipingInput; this.normativeAssessmentLevel = normativeAssessmentLevel; Description = string.Format(RiskeerCommonServiceResources.Perform_calculation_with_name_0_, calculation.Name); }
public void Constructor_ExpectedValues() { // Setup var mocks = new MockRepository(); var handler = mocks.Stub <IFailureMechanismPropertyChangeHandler <PipingFailureMechanism> >(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); // Call var properties = new PipingFailureMechanismProperties(failureMechanism, handler); // Assert Assert.IsInstanceOf <PipingFailureMechanismPropertiesBase>(properties); Assert.AreEqual(failureMechanism.Name, properties.Name); Assert.AreEqual(failureMechanism.Code, properties.Code); GeneralPipingInput generalInput = failureMechanism.GeneralInput; Assert.AreEqual(generalInput.UpliftModelFactor.Mean, properties.UpliftModelFactor.Mean); Assert.AreEqual(generalInput.UpliftModelFactor.StandardDeviation, properties.UpliftModelFactor.StandardDeviation); Assert.AreEqual(SemiProbabilisticPipingDesignVariableFactory.GetUpliftModelFactorDesignVariable(generalInput).GetDesignValue(), properties.UpliftModelFactor.DesignValue); Assert.AreEqual(generalInput.SellmeijerModelFactor.Mean, properties.SellmeijerModelFactor.Mean); Assert.AreEqual(generalInput.SellmeijerModelFactor.StandardDeviation, properties.SellmeijerModelFactor.StandardDeviation); Assert.AreEqual(SemiProbabilisticPipingDesignVariableFactory.GetSellmeijerModelFactorDesignVariable(generalInput).GetDesignValue(), properties.SellmeijerModelFactor.DesignValue); Assert.AreEqual(generalInput.WaterVolumetricWeight, properties.WaterVolumetricWeight); Assert.AreEqual(generalInput.CriticalHeaveGradient.Mean, properties.CriticalHeaveGradient.Mean); Assert.AreEqual(generalInput.CriticalHeaveGradient.StandardDeviation, properties.CriticalHeaveGradient.StandardDeviation); Assert.AreEqual(SemiProbabilisticPipingDesignVariableFactory.GetCriticalHeaveGradientDesignVariable(generalInput).GetDesignValue(), properties.CriticalHeaveGradient.DesignValue); Assert.AreEqual(generalInput.SandParticlesVolumicWeight, properties.SandParticlesVolumicWeight); Assert.AreEqual(generalInput.WhitesDragCoefficient, properties.WhitesDragCoefficient); Assert.AreEqual(generalInput.BeddingAngle, properties.BeddingAngle); Assert.AreEqual(generalInput.WaterKinematicViscosity, properties.WaterKinematicViscosity); Assert.AreEqual(generalInput.Gravity, properties.Gravity); Assert.AreEqual(generalInput.MeanDiameter70, properties.MeanDiameter70); Assert.AreEqual(generalInput.SellmeijerReductionFactor, properties.SellmeijerReductionFactor); mocks.VerifyAll(); }
/// <summary> /// Performs a piping calculation based on the supplied <see cref="SemiProbabilisticPipingCalculation"/> and sets /// <see cref="SemiProbabilisticPipingCalculation.Output"/> if the calculation was successful. Error and status /// information is logged during the execution of the operation. /// </summary> /// <param name="calculation">The <see cref="SemiProbabilisticPipingCalculation"/> to base the input for the calculation upon.</param> /// <param name="generalInput">The <see cref="GeneralPipingInput"/> to derive values from during the calculation.</param> /// <param name="normativeAssessmentLevel">The normative assessment level to use in case the manual assessment level is not applicable.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/> or <paramref name="generalInput"/> is <c>null</c>.</exception> /// <exception cref="PipingCalculatorException">Thrown when an unexpected error occurred during the calculation.</exception> /// <remarks>Consider calling <see cref="Validate"/> first to see if calculation is possible.</remarks> public static void Calculate(SemiProbabilisticPipingCalculation calculation, GeneralPipingInput generalInput, RoundedDouble normativeAssessmentLevel) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } if (generalInput == null) { throw new ArgumentNullException(nameof(generalInput)); } CalculationServiceHelper.LogCalculationBegin(); try { PipingCalculatorResult pipingResult = new PipingCalculator(CreateInputFromData(calculation.InputParameters, generalInput, normativeAssessmentLevel), PipingSubCalculatorFactory.Instance).Calculate(); calculation.Output = new SemiProbabilisticPipingOutput(new SemiProbabilisticPipingOutput.ConstructionProperties { UpliftFactorOfSafety = pipingResult.UpliftFactorOfSafety, HeaveFactorOfSafety = pipingResult.HeaveFactorOfSafety, SellmeijerFactorOfSafety = pipingResult.SellmeijerFactorOfSafety, UpliftEffectiveStress = pipingResult.UpliftEffectiveStress, HeaveGradient = pipingResult.HeaveGradient, SellmeijerCreepCoefficient = pipingResult.SellmeijerCreepCoefficient, SellmeijerCriticalFall = pipingResult.SellmeijerCriticalFall, SellmeijerReducedFall = pipingResult.SellmeijerReducedFall }); } catch (PipingCalculatorException e) { CalculationServiceHelper.LogExceptionAsError(RiskeerCommonServiceResources.CalculationService_Calculate_unexpected_error, e); throw; } finally { CalculationServiceHelper.LogCalculationEnd(); } }
public void Constructor_ExpectedValues() { // Call var inputParameters = new GeneralPipingInput(); // Assert var upliftModelFactor = new LogNormalDistribution(2) { Mean = (RoundedDouble)1.0, StandardDeviation = (RoundedDouble)0.1 }; var sellmeijerModelFactor = new LogNormalDistribution(2) { Mean = (RoundedDouble)1.0, StandardDeviation = (RoundedDouble)0.12 }; var criticalHeaveGradient = new LogNormalDistribution(2) { Mean = (RoundedDouble)0.5, StandardDeviation = (RoundedDouble)0.1 }; DistributionAssert.AreEqual(upliftModelFactor, inputParameters.UpliftModelFactor); DistributionAssert.AreEqual(sellmeijerModelFactor, inputParameters.SellmeijerModelFactor); Assert.AreEqual(9.81, inputParameters.WaterVolumetricWeight.Value); Assert.AreEqual(2, inputParameters.WaterVolumetricWeight.NumberOfDecimalPlaces); DistributionAssert.AreEqual(criticalHeaveGradient, inputParameters.CriticalHeaveGradient); Assert.AreEqual(16.19, inputParameters.SandParticlesVolumicWeight, inputParameters.SandParticlesVolumicWeight.GetAccuracy()); Assert.AreEqual(2, inputParameters.SandParticlesVolumicWeight.NumberOfDecimalPlaces); Assert.AreEqual(0.25, inputParameters.WhitesDragCoefficient); Assert.AreEqual(37, inputParameters.BeddingAngle); Assert.AreEqual(1.33e-6, inputParameters.WaterKinematicViscosity); Assert.AreEqual(9.81, inputParameters.Gravity); Assert.AreEqual(2.08e-4, inputParameters.MeanDiameter70); Assert.AreEqual(0.3, inputParameters.SellmeijerReductionFactor); Assert.IsTrue(inputParameters.ApplyLengthEffectInSection); }
public void CreateSemiProbabilisticPipingCalculationActivity_WithValidCalculation_ReturnsActivityWithParametersSet() { // Setup var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); var assessmentSection = new AssessmentSectionStub { FailureMechanismContribution = { NormativeProbabilityType = NormativeProbabilityType.MaximumAllowableFloodingProbability } }; assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] { hydraulicBoundaryLocation }); var random = new Random(39); HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation = assessmentSection.WaterLevelCalculationsForMaximumAllowableFloodingProbability.Single(); hydraulicBoundaryLocationCalculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(random.NextDouble()); var calculation = SemiProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <TestSemiProbabilisticPipingCalculation>( hydraulicBoundaryLocation); var generalPipingInput = new GeneralPipingInput(); // Call CalculatableActivity activity = PipingCalculationActivityFactory.CreateSemiProbabilisticPipingCalculationActivity(calculation, generalPipingInput, assessmentSection); // Assert Assert.IsInstanceOf <SemiProbabilisticPipingCalculationActivity>(activity); AssertSemiProbabilisticPipingCalculationActivity(activity, calculation, hydraulicBoundaryLocationCalculation); }
private static PipingCalculatorInput CreateInputFromData(SemiProbabilisticPipingInput input, GeneralPipingInput generalPipingInput, RoundedDouble normativeAssessmentLevel) { RoundedDouble effectiveAssessmentLevel = GetEffectiveAssessmentLevel(input, normativeAssessmentLevel); return(new PipingCalculatorInput( new PipingCalculatorInput.ConstructionProperties { WaterVolumetricWeight = generalPipingInput.WaterVolumetricWeight, SaturatedVolumicWeightOfCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetSaturatedVolumicWeightOfCoverageLayer(input).GetDesignValue(), UpliftModelFactor = SemiProbabilisticPipingDesignVariableFactory.GetUpliftModelFactorDesignVariable(generalPipingInput).GetDesignValue(), AssessmentLevel = effectiveAssessmentLevel, PiezometricHeadExit = DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(input, effectiveAssessmentLevel), DampingFactorExit = SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(), PhreaticLevelExit = PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(), CriticalHeaveGradient = SemiProbabilisticPipingDesignVariableFactory.GetCriticalHeaveGradientDesignVariable(generalPipingInput).GetDesignValue(), ThicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessCoverageLayer(input).GetDesignValue(), EffectiveThicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetEffectiveThicknessCoverageLayer(input, generalPipingInput).GetDesignValue(), SellmeijerModelFactor = SemiProbabilisticPipingDesignVariableFactory.GetSellmeijerModelFactorDesignVariable(generalPipingInput).GetDesignValue(), SellmeijerReductionFactor = generalPipingInput.SellmeijerReductionFactor, SeepageLength = SemiProbabilisticPipingDesignVariableFactory.GetSeepageLength(input).GetDesignValue(), SandParticlesVolumicWeight = generalPipingInput.SandParticlesVolumicWeight, WhitesDragCoefficient = generalPipingInput.WhitesDragCoefficient, Diameter70 = SemiProbabilisticPipingDesignVariableFactory.GetDiameter70(input).GetDesignValue(), DarcyPermeability = SemiProbabilisticPipingDesignVariableFactory.GetDarcyPermeability(input).GetDesignValue(), WaterKinematicViscosity = generalPipingInput.WaterKinematicViscosity, Gravity = generalPipingInput.Gravity, ThicknessAquiferLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessAquiferLayer(input).GetDesignValue(), MeanDiameter70 = generalPipingInput.MeanDiameter70, BeddingAngle = generalPipingInput.BeddingAngle, ExitPointXCoordinate = input.ExitPointL, SurfaceLine = input.SurfaceLine, SoilProfile = input.StochasticSoilProfile?.SoilProfile })); }
public static void CalculateEffectiveThicknessCoverageLayer_InvalidPipingCalculationWithOutput_ReturnsNaN() { // Setup var invalidPipingCalculation = SemiProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <TestSemiProbabilisticPipingCalculation>( new TestHydraulicBoundaryLocation()); // Make invalid by having surface line partially above soil profile: double highestLevelSurfaceLine = invalidPipingCalculation.InputParameters.SurfaceLine.Points.Max(p => p.Z); double soilProfileTop = highestLevelSurfaceLine - 0.5; double soilProfileBottom = soilProfileTop - 0.5; invalidPipingCalculation.InputParameters.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile("A", soilProfileBottom, new[] { new PipingSoilLayer(soilProfileTop) { IsAquifer = true } }, SoilProfileType.SoilProfile1D)); var generalInput = new GeneralPipingInput(); // Call PipingInput input = invalidPipingCalculation.InputParameters; double result = InputParameterCalculationService.CalculateEffectiveThicknessCoverageLayer( generalInput.WaterVolumetricWeight, PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(), input.ExitPointL, input.SurfaceLine, input.StochasticSoilProfile.SoilProfile); // Assert Assert.IsNaN(result); }
/// <summary> /// Performs validation over the values on the given <paramref name="calculation"/>. Error and status information is logged during /// the execution of the operation. /// </summary> /// <param name="calculation">The <see cref="SemiProbabilisticPipingCalculation"/> for which to validate the values.</param> /// <param name="generalInput">The <see cref="GeneralPipingInput"/> to derive values from during the validation.</param> /// <param name="normativeAssessmentLevel">The normative assessment level to use in case the manual assessment level is not applicable.</param> /// <returns><c>false</c> if <paramref name="calculation"/> contains validation errors; <c>true</c> otherwise.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/> or <paramref name="generalInput"/> is <c>null</c>.</exception> public static bool Validate(SemiProbabilisticPipingCalculation calculation, GeneralPipingInput generalInput, RoundedDouble normativeAssessmentLevel) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } if (generalInput == null) { throw new ArgumentNullException(nameof(generalInput)); } CalculationServiceHelper.LogValidationBegin(); LogAnyWarnings(calculation); bool hasErrors = LogAnyErrors(calculation, generalInput, normativeAssessmentLevel); CalculationServiceHelper.LogValidationEnd(); return(!hasErrors); }
private static IEnumerable <string> ValidateCoverageLayers(PipingInput input, GeneralPipingInput generalInput) { if (!double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(input).Mean)) { LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); if (saturatedVolumicWeightOfCoverageLayer.Shift < generalInput.WaterVolumetricWeight) { yield return(Resources.ProbabilisticPipingCalculationService_ValidateInput_SaturatedVolumicWeightCoverageLayer_shift_must_be_larger_than_WaterVolumetricWeight); } } }
private static bool LogAnyErrors(SemiProbabilisticPipingCalculation calculation, GeneralPipingInput generalInput, RoundedDouble normativeAssessmentLevel) { string[] messages = ValidateInput(calculation.InputParameters, generalInput, normativeAssessmentLevel).ToArray(); if (messages.Length > 0) { CalculationServiceHelper.LogMessagesAsError(messages); return(true); } messages = new PipingCalculator(CreateInputFromData(calculation.InputParameters, generalInput, normativeAssessmentLevel), PipingSubCalculatorFactory.Instance).Validate().ToArray(); if (messages.Length > 0) { CalculationServiceHelper.LogMessagesAsError(messages); return(true); } return(false); }
private static List <string> ValidateInput(SemiProbabilisticPipingInput input, GeneralPipingInput generalInput, RoundedDouble normativeAssessmentLevel) { var validationResults = new List <string>(); validationResults.AddRange(ValidateHydraulics(input, normativeAssessmentLevel)); validationResults.AddRange(PipingCalculationValidationHelper.GetValidationErrors(input)); if (!validationResults.Any()) { validationResults.AddRange(ValidateCoverageLayers(input, generalInput)); } return(validationResults); }
private static IEnumerable <string> ValidateCoverageLayers(PipingInput input, GeneralPipingInput generalInput) { if (!double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(input).Mean)) { RoundedDouble saturatedVolumicWeightOfCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetSaturatedVolumicWeightOfCoverageLayer(input).GetDesignValue(); if (!double.IsNaN(saturatedVolumicWeightOfCoverageLayer) && saturatedVolumicWeightOfCoverageLayer < generalInput.WaterVolumetricWeight) { yield return(Resources.SemiProbabilisticPipingCalculationService_ValidateInput_SaturatedVolumicWeightCoverageLayer_must_be_larger_than_WaterVolumetricWeight); } } }
/// <summary> /// Creates a <see cref="CalculatableActivity"/> based on the given <paramref name="calculation"/>. /// </summary> /// <param name="calculation">The calculation to create an activity for.</param> /// <param name="generalPipingInput">The general piping input that is used during the calculation.</param> /// <param name="assessmentSection">The assessment section the <paramref name="calculation"/> belongs to.</param> /// <returns>A <see cref="CalculatableActivity"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> public static CalculatableActivity CreateSemiProbabilisticPipingCalculationActivity(SemiProbabilisticPipingCalculation calculation, GeneralPipingInput generalPipingInput, IAssessmentSection assessmentSection) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } if (generalPipingInput == null) { throw new ArgumentNullException(nameof(generalPipingInput)); } if (assessmentSection == null) { throw new ArgumentNullException(nameof(assessmentSection)); } return(new SemiProbabilisticPipingCalculationActivity(calculation, generalPipingInput, assessmentSection.GetNormativeAssessmentLevel(calculation.InputParameters.HydraulicBoundaryLocation))); }
/// <summary> /// Creates the deterministic design variable for the sellmeijer model factor. /// </summary> /// <param name="generalPipingInput">The general piping input.</param> /// <returns>The created <see cref="DeterministicDesignVariable{LogNormalDistribution}"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="generalPipingInput"/> is <c>null</c>.</exception> public static DeterministicDesignVariable <LogNormalDistribution> GetSellmeijerModelFactorDesignVariable(GeneralPipingInput generalPipingInput) { if (generalPipingInput == null) { throw new ArgumentNullException(nameof(generalPipingInput)); } return(new DeterministicDesignVariable <LogNormalDistribution>(generalPipingInput.SellmeijerModelFactor, generalPipingInput.SellmeijerModelFactor.Mean)); }
private static PipingCalculationInput CreateInput(ProbabilisticPipingCalculation calculation, GeneralPipingInput generalInput, double sectionLength, string hydraulicBoundaryDatabaseFilePath, bool usePreprocessor) { ProbabilisticPipingInput pipingInput = calculation.InputParameters; LogNormalDistribution thicknessCoverageLayer = DerivedPipingInput.GetThicknessCoverageLayer(pipingInput); VariationCoefficientLogNormalDistribution seepageLength = DerivedPipingInput.GetSeepageLength(pipingInput); LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(pipingInput); VariationCoefficientLogNormalDistribution darcyPermeability = DerivedPipingInput.GetDarcyPermeability(pipingInput); VariationCoefficientLogNormalDistribution diameterD70 = DerivedPipingInput.GetDiameterD70(pipingInput); PipingCalculationInput input; if (double.IsNaN(thicknessCoverageLayer.Mean)) { input = new PipingCalculationInput( pipingInput.HydraulicBoundaryLocation.Id, sectionLength, pipingInput.PhreaticLevelExit.Mean, pipingInput.PhreaticLevelExit.StandardDeviation, generalInput.WaterVolumetricWeight, generalInput.UpliftModelFactor.Mean, generalInput.UpliftModelFactor.StandardDeviation, pipingInput.DampingFactorExit.Mean, pipingInput.DampingFactorExit.StandardDeviation, seepageLength.Mean, seepageLength.CoefficientOfVariation, thicknessAquiferLayer.Mean, thicknessAquiferLayer.StandardDeviation, generalInput.SandParticlesVolumicWeight, generalInput.SellmeijerModelFactor.Mean, generalInput.SellmeijerModelFactor.StandardDeviation, generalInput.BeddingAngle, generalInput.WhitesDragCoefficient, generalInput.WaterKinematicViscosity, darcyPermeability.Mean, darcyPermeability.CoefficientOfVariation, diameterD70.Mean, diameterD70.CoefficientOfVariation, generalInput.Gravity, generalInput.CriticalHeaveGradient.Mean, generalInput.CriticalHeaveGradient.StandardDeviation); } else { LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(pipingInput, generalInput); LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(pipingInput); input = new PipingCalculationInput( pipingInput.HydraulicBoundaryLocation.Id, sectionLength, pipingInput.PhreaticLevelExit.Mean, pipingInput.PhreaticLevelExit.StandardDeviation, generalInput.WaterVolumetricWeight, effectiveThicknessCoverageLayer.Mean, effectiveThicknessCoverageLayer.StandardDeviation, saturatedVolumicWeightOfCoverageLayer.Mean, saturatedVolumicWeightOfCoverageLayer.StandardDeviation, saturatedVolumicWeightOfCoverageLayer.Shift, generalInput.UpliftModelFactor.Mean, generalInput.UpliftModelFactor.StandardDeviation, pipingInput.DampingFactorExit.Mean, pipingInput.DampingFactorExit.StandardDeviation, seepageLength.Mean, seepageLength.CoefficientOfVariation, thicknessAquiferLayer.Mean, thicknessAquiferLayer.StandardDeviation, generalInput.SandParticlesVolumicWeight, generalInput.SellmeijerModelFactor.Mean, generalInput.SellmeijerModelFactor.StandardDeviation, generalInput.BeddingAngle, generalInput.WhitesDragCoefficient, generalInput.WaterKinematicViscosity, darcyPermeability.Mean, darcyPermeability.CoefficientOfVariation, diameterD70.Mean, diameterD70.CoefficientOfVariation, generalInput.Gravity, generalInput.CriticalHeaveGradient.Mean, generalInput.CriticalHeaveGradient.StandardDeviation); } HydraRingSettingsDatabaseHelper.AssignSettingsFromDatabase(input, hydraulicBoundaryDatabaseFilePath, usePreprocessor); return(input); }
/// <summary> /// Creates the deterministic design variable for the critical exit gradient for heave. /// </summary> /// <param name="generalPipingInput">The general piping input.</param> /// <returns>The created <see cref="DeterministicDesignVariable{LogNormalDistribution}"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="generalPipingInput"/> is <c>null</c>.</exception> public static DeterministicDesignVariable <LogNormalDistribution> GetCriticalHeaveGradientDesignVariable(GeneralPipingInput generalPipingInput) { if (generalPipingInput == null) { throw new ArgumentNullException(nameof(generalPipingInput)); } return(new DeterministicDesignVariable <LogNormalDistribution>(generalPipingInput.CriticalHeaveGradient, 0.3)); }
private static IEnumerable <string> ValidateInput(ProbabilisticPipingInput input, GeneralPipingInput generalInput) { var validationResults = new List <string>(); if (input.HydraulicBoundaryLocation == null) { validationResults.Add(RiskeerCommonServiceResources.CalculationService_ValidateInput_No_hydraulic_boundary_location_selected); } validationResults.AddRange(PipingCalculationValidationHelper.GetValidationErrors(input)); if (!validationResults.Any()) { validationResults.AddRange(ValidateCoverageLayers(input, generalInput)); } return(validationResults); }
/// <summary> /// Performs a section specific calculation. /// </summary> /// <param name="calculation">The calculation containing the input for the section specific calculation.</param> /// <param name="generalInput">The general piping calculation input parameters.</param> /// <param name="sectionLength">The length of the section.</param> /// <param name="hydraulicBoundaryDatabaseFilePath">The path which points to the hydraulic boundary database file.</param> /// <param name="usePreprocessor">Indicator whether to use the preprocessor in the calculation.</param> /// <returns>A <see cref="PartialProbabilisticFaultTreePipingOutput"/>.</returns> /// <exception cref="HydraRingCalculationException">Thrown when an error occurs while performing the calculation.</exception> private IPartialProbabilisticPipingOutput CalculateSectionSpecific(ProbabilisticPipingCalculation calculation, GeneralPipingInput generalInput, double sectionLength, string hydraulicBoundaryDatabaseFilePath, bool usePreprocessor) { NotifyProgress(string.Format(Resources.ProbabilisticPipingCalculationService_Calculate_Executing_calculation_of_type_0, Resources.ProbabilisticPipingCalculationService_SectionSpecific), 2, numberOfCalculators); PipingCalculationInput sectionSpecificCalculationInput = CreateInput( calculation, generalInput, sectionLength, hydraulicBoundaryDatabaseFilePath, usePreprocessor); PerformCalculation(() => sectionSpecificCalculator.Calculate(sectionSpecificCalculationInput), () => sectionSpecificCalculator.LastErrorFileContent, () => sectionSpecificCalculator.OutputDirectory, calculation.Name, Resources.ProbabilisticPipingCalculationService_SectionSpecific); LogNormalDistribution thicknessCoverageLayer = DerivedPipingInput.GetThicknessCoverageLayer(calculation.InputParameters); GeneralResult <TopLevelFaultTreeIllustrationPoint> faultTreeGeneralResult = null; GeneralResult <TopLevelSubMechanismIllustrationPoint> subMechanismGeneralResult = null; if (calculation.InputParameters.ShouldSectionSpecificIllustrationPointsBeCalculated) { try { if (double.IsNaN(thicknessCoverageLayer.Mean)) { subMechanismGeneralResult = ConvertSubMechanismIllustrationPointsResult( sectionSpecificCalculator.IllustrationPointsResult, sectionSpecificCalculator.IllustrationPointsParserErrorMessage); } else { faultTreeGeneralResult = ConvertFaultTreeIllustrationPointsResult( sectionSpecificCalculator.IllustrationPointsResult, sectionSpecificCalculator.IllustrationPointsParserErrorMessage); } } catch (ArgumentException e) { log.WarnFormat(Resources.ProbabilisticPipingCalculationService_Calculate_Error_in_reading_illustrationPoints_for_CalculationName_0_CalculationType_1_with_ErrorMessage_2, calculation.Name, Resources.ProbabilisticPipingCalculationService_SectionSpecific, e.Message); } } return(double.IsNaN(thicknessCoverageLayer.Mean) ? (IPartialProbabilisticPipingOutput) new PartialProbabilisticSubMechanismPipingOutput( sectionSpecificCalculator.ExceedanceProbabilityBeta, subMechanismGeneralResult) : new PartialProbabilisticFaultTreePipingOutput( sectionSpecificCalculator.ExceedanceProbabilityBeta, faultTreeGeneralResult)); }
/// <summary> /// Creates the design variable for the effective thickness of the coverage layers at the exit point. /// </summary> /// <param name="pipingInput">The piping input.</param> /// <param name="generalInput">The general piping input.</param> /// <returns>The created <see cref="DesignVariable{LogNormalDistribution}"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when any input parameter is <c>null</c>.</exception> public static DesignVariable <LogNormalDistribution> GetEffectiveThicknessCoverageLayer(PipingInput pipingInput, GeneralPipingInput generalInput) { LogNormalDistribution thicknessCoverageLayer = DerivedPipingInput.GetThicknessCoverageLayer(pipingInput); LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(pipingInput, generalInput); if (double.IsNaN(thicknessCoverageLayer.Mean)) { return(new DeterministicDesignVariable <LogNormalDistribution>(effectiveThicknessCoverageLayer)); } return(new LogNormalDistributionDesignVariable(effectiveThicknessCoverageLayer) { Percentile = 0.05 }); }