public void GetPiezometricHeadExit_ValidInput_SetsParametersForCalculatorAndReturnsNotNaN() { // Setup var input = new TestPipingInput(); using (new PipingSubCalculatorFactoryConfig()) { // Setup var assessmentLevel = (RoundedDouble)1.1; // Call RoundedDouble piezometricHead = DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(input, assessmentLevel); // Assert Assert.AreEqual(2, piezometricHead.NumberOfDecimalPlaces); Assert.IsFalse(double.IsNaN(piezometricHead)); var factory = (TestPipingSubCalculatorFactory)PipingSubCalculatorFactory.Instance; PiezoHeadCalculatorStub piezometricHeadAtExitCalculator = factory.LastCreatedPiezometricHeadAtExitCalculator; Assert.AreEqual(assessmentLevel, piezometricHeadAtExitCalculator.HRiver, assessmentLevel.GetAccuracy()); Assert.AreEqual(PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.PhiPolder, input.PhreaticLevelExit.GetAccuracy()); Assert.AreEqual(SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.RExit, input.DampingFactorExit.GetAccuracy()); } }
public void GetPiezometricHeadExit_InputNull_ThrowsArgumentNullException() { // Call void Call() => DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(null, RoundedDouble.NaN); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("input", exception.ParamName); }
public void GetPiezometricHeadExit_AssessmentLevelNaN_ReturnsNaN() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(1.0, 1.0); // Call RoundedDouble piezometricHead = DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(input, RoundedDouble.NaN); // Assert Assert.IsNaN(piezometricHead); }
private static IEnumerable <string> ValidateHydraulics(SemiProbabilisticPipingInput input, RoundedDouble normativeAssessmentLevel) { var validationResults = new List <string>(); if (!input.UseAssessmentLevelManualInput && input.HydraulicBoundaryLocation == null) { validationResults.Add(RiskeerCommonServiceResources.CalculationService_ValidateInput_No_hydraulic_boundary_location_selected); } else { validationResults.AddRange(ValidateAssessmentLevel(input, normativeAssessmentLevel)); RoundedDouble piezometricHeadExit = DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(input, GetEffectiveAssessmentLevel(input, normativeAssessmentLevel)); if (double.IsNaN(piezometricHeadExit) || double.IsInfinity(piezometricHeadExit)) { validationResults.Add(Resources.SemiProbabilisticPipingCalculationService_ValidateInput_Cannot_determine_PiezometricHeadExit); } } return(validationResults); }
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 })); }