Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoDikeAssessmentSectionCommandTest.cs =================================================================== diff -u -r28efef3cbb613e85c8ea893493e2618de2236f0b -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoDikeAssessmentSectionCommandTest.cs (.../AddNewDemoDikeAssessmentSectionCommandTest.cs) (revision 28efef3cbb613e85c8ea893493e2618de2236f0b) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoDikeAssessmentSectionCommandTest.cs (.../AddNewDemoDikeAssessmentSectionCommandTest.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -135,9 +135,9 @@ PipingCalculationService.Calculate(calculation); Assert.IsTrue(calculation.HasOutput); Assert.AreEqual(99.0, calculation.Output.HeaveFactorOfSafety, 1e-3); - Assert.AreEqual(116.586, calculation.Output.HeaveZValue, 1e-3); + Assert.AreEqual(426.608, calculation.Output.HeaveZValue, 1e-3); Assert.AreEqual(99.0, calculation.Output.UpliftFactorOfSafety, 1e-3); - Assert.AreEqual(3.655, calculation.Output.UpliftZValue, 1e-3); + Assert.AreEqual(4.968, calculation.Output.UpliftZValue, 1e-3); Assert.AreEqual(-1.391, calculation.Output.SellmeijerFactorOfSafety, 1e-3); Assert.AreEqual(3.249, calculation.Output.SellmeijerZValue, 1e-3); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/PipingCalculator.cs =================================================================== diff -u -rcd01ebb93138126cff40f436c309ee8b4bc9069e -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/PipingCalculator.cs (.../PipingCalculator.cs) (revision cd01ebb93138126cff40f436c309ee8b4bc9069e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/PipingCalculator.cs (.../PipingCalculator.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -25,7 +25,6 @@ using Deltares.WTIPiping; using Ringtoets.Piping.Calculation.Properties; using Ringtoets.Piping.Calculation.SubCalculator; - using EffectiveThicknessCalculator = Ringtoets.Piping.Calculation.SubCalculator.EffectiveThicknessCalculator; using HeaveCalculator = Ringtoets.Piping.Calculation.SubCalculator.HeaveCalculator; @@ -97,7 +96,7 @@ { upliftCalculatorValidationResults = ValidateUpliftCalculator(); } - List heaveCalculatorValidationResults = CreateHeaveCalculator().Validate(); + List heaveCalculatorValidationResults = CreateHeaveCalculator(CalculatePiezometricHeadAtExit()).Validate(); List sellmeijerCalculatorValidationResults = CreateSellmeijerCalculator().Validate(); return upliftCalculatorValidationResults @@ -123,7 +122,15 @@ { try { - return CalculateEffectiveThickness().EffectiveHeight; + var calculator = factory.CreateEffectiveThicknessCalculator(); + calculator.ExitPointXCoordinate = input.ExitPointXCoordinate; + calculator.PhreaticLevel = input.PhreaticLevelExit; + calculator.SoilProfile = PipingProfileCreator.Create(input.SoilProfile); + calculator.SurfaceLine = PipingSurfaceLineCreator.Create(input.SurfaceLine); + calculator.VolumicWeightOfWater = input.WaterVolumetricWeight; + calculator.Calculate(); + + return calculator.EffectiveHeight; } catch (SoilVolumicMassCalculatorException e) { @@ -135,6 +142,21 @@ } } + /// + /// Calculates the piezometric head at the exit point based on the values of the . + /// + /// The piezometric head at the exit point. + public double CalculatePiezometricHeadAtExit() + { + var calculator = factory.CreatePiezometricHeadAtExitCalculator(); + calculator.PhiPolder = input.PhreaticLevelExit; + calculator.HRiver = input.AssessmentLevel; + calculator.RExit = input.DampingFactorExit; + calculator.Calculate(); + + return calculator.PhiExit; + } + private List ValidateSurfaceLine() { var validationResults = new List(); @@ -181,8 +203,7 @@ { try { - IEffectiveThicknessCalculator effectiveThicknessCalculator = CalculateEffectiveThickness(); - return CreateUpliftCalculator(effectiveThicknessCalculator.EffectiveStress).Validate(); + return CreateUpliftCalculator(CalculatePiezometricHeadAtExit()).Validate(); } catch (Exception exception) { @@ -215,7 +236,7 @@ private IHeaveCalculator CalculateHeave() { - var heaveCalculator = CreateHeaveCalculator(); + var heaveCalculator = CreateHeaveCalculator(CalculatePiezometricHeadAtExit()); try { @@ -231,8 +252,7 @@ private IUpliftCalculator CalculateUplift() { - IEffectiveThicknessCalculator calculatedEffectiveStressResult = CalculateEffectiveThickness(); - IUpliftCalculator upliftCalculator = CreateUpliftCalculator(calculatedEffectiveStressResult.EffectiveStress); + IUpliftCalculator upliftCalculator = CreateUpliftCalculator(CalculatePiezometricHeadAtExit()); try { @@ -250,26 +270,28 @@ return upliftCalculator; } - private IHeaveCalculator CreateHeaveCalculator() + private IHeaveCalculator CreateHeaveCalculator(double phiExit) { var calculator = factory.CreateHeaveCalculator(); calculator.Ich = input.CriticalHeaveGradient; - calculator.PhiExit = input.PiezometricHeadExit; + calculator.PhiExit = phiExit; calculator.DTotal = input.ThicknessCoverageLayer; calculator.PhiPolder = input.PhreaticLevelExit; calculator.RExit = input.DampingFactorExit; calculator.HExit = input.PhreaticLevelExit; return calculator; } - private IUpliftCalculator CreateUpliftCalculator(double effectiveStress) + private IUpliftCalculator CreateUpliftCalculator(double phiExit) { + var effectiveStress = DetermineEffectiveStressForOneLayerProfile(input.ThicknessCoverageLayer, input.SaturatedVolumicWeightOfCoverageLayer, input.WaterVolumetricWeight); + var calculator = factory.CreateUpliftCalculator(); calculator.VolumetricWeightOfWater = input.WaterVolumetricWeight; calculator.ModelFactorUplift = input.UpliftModelFactor; calculator.EffectiveStress = effectiveStress; calculator.HRiver = input.AssessmentLevel; - calculator.PhiExit = input.PiezometricHeadExit; + calculator.PhiExit = phiExit; calculator.RExit = input.DampingFactorExit; calculator.HExit = input.PhreaticLevelExit; calculator.PhiPolder = input.PhreaticLevelExit; @@ -298,23 +320,16 @@ return calculator; } - private IEffectiveThicknessCalculator CalculateEffectiveThickness() + /// + /// Determines the effective stress for a one layer profile. + /// + /// The thickness of aquitard layer. + /// The saturated volumic weight of aquitard layer. + /// + /// + private static double DetermineEffectiveStressForOneLayerProfile(double thicknessOfCoverageLayer, double volumicWeightOfCoverageLayer, double waterVolumetricWeight) { - try - { - var calculator = factory.CreateEffectiveThicknessCalculator(); - calculator.ExitPointXCoordinate = input.ExitPointXCoordinate; - calculator.PhreaticLevel = input.PhreaticLevelExit; - calculator.SoilProfile = PipingProfileCreator.Create(input.SoilProfile); - calculator.SurfaceLine = PipingSurfaceLineCreator.Create(input.SurfaceLine); - calculator.VolumicWeightOfWater = input.WaterVolumetricWeight; - calculator.Calculate(); - return calculator; - } - catch (SoilVolumicMassCalculatorException e) - { - throw new PipingCalculatorException(e.Message, e); - } + return thicknessOfCoverageLayer * (volumicWeightOfCoverageLayer - waterVolumetricWeight); } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/PipingCalculatorInput.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/PipingCalculatorInput.cs (.../PipingCalculatorInput.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/PipingCalculatorInput.cs (.../PipingCalculatorInput.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -52,12 +52,14 @@ private readonly double exitPointXCoordinate; private readonly RingtoetsPipingSurfaceLine surfaceLine; private readonly PipingSoilProfile soilProfile; + private readonly double saturatedVolumicWeightOfCoverageLayer; /// /// Constructs a new , which contains values for the parameters used /// in the piping sub calculations. /// /// The volumetric weight of water. [kN/m³] + /// /// The calculation value used to account for uncertainty in the model for uplift. /// The outside high water level. [m] /// The piezometric head at the exit point. [m] @@ -81,9 +83,10 @@ /// The x coordinate of the exit point. [m] /// The surface line. /// The profile which contains a 1 dimensional definition of soil layers with properties. - public PipingCalculatorInput(double waterVolumetricWeight, double upliftModelFactor, double assessmentLevel, double piezometricHeadExit, double dampingFactorExit, double phreaticLevelExit, double piezometricHeadPolder, double criticalHeaveGradient, double thicknessCoverageLayer, double sellmeijerModelFactor, double sellmeijerReductionFactor, double seepageLength, double sandParticlesVolumicWeight, double whitesDragCoefficient, double diameter70, double darcyPermeability, double waterKinematicViscosity, double gravity, double thicknessAquiferLayer, double meanDiameter70, double beddingAngle, double exitPointXCoordinate, RingtoetsPipingSurfaceLine surfaceLine, PipingSoilProfile soilProfile) + public PipingCalculatorInput(double waterVolumetricWeight, double saturatedVolumicWeightOfCoverageLayer, double upliftModelFactor, double assessmentLevel, double piezometricHeadExit, double dampingFactorExit, double phreaticLevelExit, double piezometricHeadPolder, double criticalHeaveGradient, double thicknessCoverageLayer, double sellmeijerModelFactor, double sellmeijerReductionFactor, double seepageLength, double sandParticlesVolumicWeight, double whitesDragCoefficient, double diameter70, double darcyPermeability, double waterKinematicViscosity, double gravity, double thicknessAquiferLayer, double meanDiameter70, double beddingAngle, double exitPointXCoordinate, RingtoetsPipingSurfaceLine surfaceLine, PipingSoilProfile soilProfile) { this.waterVolumetricWeight = waterVolumetricWeight; + this.saturatedVolumicWeightOfCoverageLayer = saturatedVolumicWeightOfCoverageLayer; this.upliftModelFactor = upliftModelFactor; this.assessmentLevel = assessmentLevel; this.piezometricHeadExit = piezometricHeadExit; @@ -391,6 +394,16 @@ } } + /// + /// Gets the volumic weight of the coverage layer when saturated. + /// + public double SaturatedVolumicWeightOfCoverageLayer { + get + { + return saturatedVolumicWeightOfCoverageLayer; + } + } + #endregion } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Ringtoets.Piping.Calculation.csproj =================================================================== diff -u -ree0616189b53da348c17a4cf75328425beaf360b -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Ringtoets.Piping.Calculation.csproj (.../Ringtoets.Piping.Calculation.csproj) (revision ee0616189b53da348c17a4cf75328425beaf360b) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Ringtoets.Piping.Calculation.csproj (.../Ringtoets.Piping.Calculation.csproj) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -67,9 +67,11 @@ + + Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IEffectiveThicknessCalculator.cs =================================================================== diff -u -ra2675f58f4d57204df1b8378e9dc1134cd11186e -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IEffectiveThicknessCalculator.cs (.../IEffectiveThicknessCalculator.cs) (revision a2675f58f4d57204df1b8378e9dc1134cd11186e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IEffectiveThicknessCalculator.cs (.../IEffectiveThicknessCalculator.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -2,6 +2,9 @@ namespace Ringtoets.Piping.Calculation.SubCalculator { + /// + /// Interface with operations for performing an effective thickness sub calculation. + /// public interface IEffectiveThicknessCalculator { /// Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IPiezoHeadCalculator.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IPiezoHeadCalculator.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IPiezoHeadCalculator.cs (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -0,0 +1,33 @@ +namespace Ringtoets.Piping.Calculation.SubCalculator +{ + /// + /// Interface with operations for performing an piezometric head at exit sub calculation. + /// + public interface IPiezoHeadCalculator + { + /// + /// Sets the piezometric head at polder parameter. + /// + double PhiPolder { set; } + + /// + /// Sets the damping factor at exit parameter. + /// + double RExit { set; } + + /// + /// Sets the assessment level parameter. + /// + double HRiver { set; } + + /// + /// Gets the piezometric head exit result. + /// + double PhiExit { get; } + + /// + /// Performs the piezomteric head at exit calculation. + /// + void Calculate(); + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IPipingSubCalculatorFactory.cs =================================================================== diff -u -ree0616189b53da348c17a4cf75328425beaf360b -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IPipingSubCalculatorFactory.cs (.../IPipingSubCalculatorFactory.cs) (revision ee0616189b53da348c17a4cf75328425beaf360b) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/IPipingSubCalculatorFactory.cs (.../IPipingSubCalculatorFactory.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -28,5 +28,11 @@ /// /// A new . IEffectiveThicknessCalculator CreateEffectiveThicknessCalculator(); + + /// + /// Creates the piezometric head at exit calculator. + /// + /// A new . + IPiezoHeadCalculator CreatePiezometricHeadAtExitCalculator(); } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/PiezoHeadCalculator.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/PiezoHeadCalculator.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/PiezoHeadCalculator.cs (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -0,0 +1,21 @@ +namespace Ringtoets.Piping.Calculation.SubCalculator +{ + /// + /// Class which wraps the . + /// + public class PiezoHeadCalculator : IPiezoHeadCalculator { + + public double PhiPolder { private get; set; } + + public double RExit { private get; set; } + + public double HRiver { private get; set; } + + public double PhiExit { get; private set; } + + public void Calculate() + { + PhiExit = Deltares.WTIPiping.PiezoHeadCalculator.CalculatePhiExit(PhiPolder, RExit, HRiver); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/PipingSubCalculatorFactory.cs =================================================================== diff -u -ree0616189b53da348c17a4cf75328425beaf360b -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/PipingSubCalculatorFactory.cs (.../PipingSubCalculatorFactory.cs) (revision ee0616189b53da348c17a4cf75328425beaf360b) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/SubCalculator/PipingSubCalculatorFactory.cs (.../PipingSubCalculatorFactory.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -24,5 +24,10 @@ { return new EffectiveThicknessCalculator(); } + + public IPiezoHeadCalculator CreatePiezometricHeadAtExitCalculator() + { + return new PiezoHeadCalculator(); + } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Extensions/PipingInputExtensions.cs =================================================================== diff -u -r93b256575fba3e4068baadeeb62140533336371a -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Extensions/PipingInputExtensions.cs (.../PipingInputExtensions.cs) (revision 93b256575fba3e4068baadeeb62140533336371a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Extensions/PipingInputExtensions.cs (.../PipingInputExtensions.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -125,14 +125,7 @@ { if (input.SurfaceLine != null && input.SoilProfile != null && !double.IsNaN(input.ExitPointL)) { - try - { - return PipingCalculationService.CalculateThicknessCoverageLayer(input); - } - catch (PipingCalculatorException) - { - return double.NaN; - } + return PipingCalculationService.CalculateThicknessCoverageLayer(input); } return double.NaN; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs =================================================================== diff -u -rb70eb58b18e2937e6c694b5ef1ba2d284596bfac -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision b70eb58b18e2937e6c694b5ef1ba2d284596bfac) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -106,22 +106,24 @@ /// Calculates the thickness of the coverage layer based on the values of the . /// /// The thickness of the coverage layer, or -1 if the thickness could not be calculated. - /// Thrown when: - /// - /// surface at exit point's x-coordinate is higher than the soil profile - /// surface line is null - /// soil profile is null - /// soil profile's aquifer layer - /// public static double CalculateThicknessCoverageLayer(PipingInput input) { - return new PipingCalculator(CreateInputFromData(input), SubCalculatorFactory).CalculateThicknessCoverageLayer(); + try + { + return new PipingCalculator(CreateInputFromData(input), SubCalculatorFactory).CalculateThicknessCoverageLayer(); + } + catch (PipingCalculatorException e) + { + LogMessagesAsError(Resources.Error_in_thickness_coverage_calculation_0, e.Message); + } + return double.NaN; } private static PipingCalculatorInput CreateInputFromData(PipingInput inputParameters) { return new PipingCalculatorInput( inputParameters.WaterVolumetricWeight, + inputParameters.WaterVolumetricWeight, inputParameters.UpliftModelFactor, inputParameters.AssessmentLevel, inputParameters.PiezometricHeadExit, @@ -147,5 +149,10 @@ inputParameters.SoilProfile ); } + + public static double CalculatePiezometricHeadAtExit(PipingInput input) + { + return new PipingCalculator(CreateInputFromData(input), SubCalculatorFactory).CalculatePiezometricHeadAtExit(); + } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs =================================================================== diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c8848af0c6f8780634dcce2013e606f090da6577) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -97,6 +97,15 @@ } /// + /// Looks up a localized string similar to Berekenen van de dikte van de deklaag niet gelukt: {0}. + /// + internal static string Error_in_thickness_coverage_calculation_0 { + get { + return ResourceManager.GetString("Error_in_thickness_coverage_calculation_0", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Validatie van '{0}' beëindigd om: {1}. /// internal static string Validation_Subject_0_ended_Time_1_ { Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx =================================================================== diff -u -r6fe344de0a63225913ee3feda5eac7b09b07a970 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx (.../Resources.resx) (revision 6fe344de0a63225913ee3feda5eac7b09b07a970) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx (.../Resources.resx) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -129,6 +129,9 @@ Validatie mislukt: {0} + + Berekenen van de dikte van de deklaag niet gelukt: {0} + Validatie van '{0}' beëindigd om: {1} Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorInputTest.cs =================================================================== diff -u -re47cee04d169bb53197aeb1ce567f1a286217594 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorInputTest.cs (.../PipingCalculatorInputTest.cs) (revision e47cee04d169bb53197aeb1ce567f1a286217594) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorInputTest.cs (.../PipingCalculatorInputTest.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -14,6 +14,7 @@ var random = new Random(22); double volumetricWeightOfWaterValue = random.NextDouble(); + double saturatedVolumicWeightOfCoverageLayer = random.NextDouble(); double modelFactorUpliftValue = random.NextDouble(); double hRiverValue = random.NextDouble(); double phiExitValue = random.NextDouble(); @@ -46,6 +47,7 @@ var input = new PipingCalculatorInput( volumetricWeightOfWaterValue, + saturatedVolumicWeightOfCoverageLayer, modelFactorUpliftValue, hRiverValue, phiExitValue, @@ -71,6 +73,7 @@ soilProfile); Assert.AreEqual(volumetricWeightOfWaterValue, input.WaterVolumetricWeight); + Assert.AreEqual(saturatedVolumicWeightOfCoverageLayer, input.SaturatedVolumicWeightOfCoverageLayer); Assert.AreEqual(modelFactorUpliftValue, input.UpliftModelFactor); Assert.AreEqual(hRiverValue, input.AssessmentLevel); Assert.AreEqual(phiExitValue, input.PiezometricHeadExit); Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs =================================================================== diff -u -ra5b051a25a6bb059d5928e29a8d741a8ec31fcd5 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision a5b051a25a6bb059d5928e29a8d741a8ec31fcd5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/PipingCalculatorTest.cs (.../PipingCalculatorTest.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -140,8 +140,8 @@ // Setup PipingCalculatorInput input = new TestPipingInput { - PiezometricHeadExit = level, - PhreaticLevelExit = level + PhreaticLevelExit = level, + AssessmentLevel = (RoundedDouble) level }.AsRealInput(); var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); @@ -151,12 +151,12 @@ // Assert Assert.AreEqual(2, validationMessages.Count); - Assert.IsTrue(validationMessages.Any(message => message.Contains("PhiExit - HExit"))); - Assert.IsTrue(validationMessages.Any(message => message.Contains("phiExit - hExit"))); + Assert.AreEqual(1, validationMessages.Count(message => message.Contains("PhiExit - HExit"))); + Assert.AreEqual(1, validationMessages.Count(message => message.Contains("phiExit - hExit"))); } [Test] - public void Validate_PhreaticLevelExitZero_TwoValidationMessageForRExit() + public void Validate_DampingFactorExitZero_TwoValidationMessageForRExitTwoValidationMessagesForPhiExitAndHExitDifference() { // Setup PipingCalculatorInput input = new TestPipingInput @@ -170,8 +170,10 @@ List validationMessages = calculation.Validate(); // Assert - Assert.AreEqual(2, validationMessages.Count); + Assert.AreEqual(4, validationMessages.Count); Assert.AreEqual(2, validationMessages.Count(message => message.Contains("Rexit"))); + Assert.AreEqual(1, validationMessages.Count(message => message.Contains("PhiExit - HExit"))); + Assert.AreEqual(1, validationMessages.Count(message => message.Contains("phiExit - hExit"))); } [Test] @@ -233,7 +235,7 @@ [Test] // Validate_DifferenceAssessmentLevelAndPhreaticLevelExitEqualToSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidationMessageForHRiverHExitRcDTotal [TestCase(2, 1, 2, 0.5, TestName = "AssessmntLvlPhreaticLevelExitEqualsSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidateMsgHRiverHExitRcDTotal(2,1,2,0.5)")] - [TestCase(1, 1, 0, 2, TestName = "AssessmntLvlPhreaticLevelExitEqualsSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidateMsgHRiverHExitRcDTotal(1,1,0,2)")] + [TestCase(2, 1.5, 0.5, 1, TestName = "AssessmntLvlPhreaticLevelExitEqualsSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidateMsgHRiverHExitRcDTotal(2,1.5,0.5,1)")] [TestCase(8, 4, 2, 2, TestName = "AssessmntLvlPhreaticLevelExitEqualsSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidateMsgHRiverHExitRcDTotal(8,4,2,2)")] public void Validate_DifferenceAssessmentLevelAndPhreaticLevelExitEqualToSellmeijerReductionFactorTimesThicknessCoverageLayer_ValidationMessageForHRiverHExitRcDTotal( double assessmentLevel, double phreaticLevelExit, double sellmeijerReductionFactor, double thicknessCoverageLayer) @@ -294,16 +296,19 @@ Assert.AreEqual(1, validationMessages.Count); Assert.AreEqual("Een ondergrondschematisering moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren.", validationMessages[0]); } - + [Test] - public void Validate_SoilProfileWithoutAquiferSet_ValidationWithDefaultNullReferenceMessage() + [TestCase(-1e-8)] + [TestCase(0)] + public void Validate_SoilProfileBottomAtTopLevel_ValidationMessageForHavingTooHighBottom(double bottom) { // Setup + var top = 0; PipingCalculatorInput input = new TestPipingInput { - SoilProfile = new PipingSoilProfile(String.Empty, -1.0,new [] + SoilProfile = new PipingSoilProfile(String.Empty, bottom, new[] { - new PipingSoilLayer(0) + new PipingSoilLayer(top) }) }.AsRealInput(); @@ -313,59 +318,79 @@ List validationMessages = calculation.Validate(); // Assert + var message = string.Format("The bottomlevel ({0}) of the profile is not deep enough. It must be below at least {1} m below the toplevel of the deepest layer ({2}).", bottom, 0.001, top); Assert.AreEqual(1, validationMessages.Count); - var nullReferenceException = new NullReferenceException(); - Assert.IsTrue(validationMessages.Any(vm => vm.Contains(nullReferenceException.Message))); + Assert.IsTrue(validationMessages.Any(vm => vm.Contains(message))); } [Test] - [TestCase(-1e-8)] - [TestCase(0)] - public void Validate_SoilProfileBottomAtTopLevel_ValidationMessageForHavingTooHighBottom(double bottom) + public void CalculateThicknessCoverageLayer_SoilProfileWithoutAquiferSet_ThrowsPipingCalculatorException() { // Setup - var top = 0; PipingCalculatorInput input = new TestPipingInput { - SoilProfile = new PipingSoilProfile(String.Empty, bottom, new[] + SoilProfile = new PipingSoilProfile(String.Empty, -1.0, new[] { - new PipingSoilLayer(top) + new PipingSoilLayer(0) }) }.AsRealInput(); var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); // Call - List validationMessages = calculation.Validate(); + TestDelegate call = () => calculation.CalculateThicknessCoverageLayer(); // Assert - var message = string.Format("The bottomlevel ({0}) of the profile is not deep enough. It must be below at least {1} m below the toplevel of the deepest layer ({2}).", bottom, 0.001, top); - Assert.AreEqual(1, validationMessages.Count); - Assert.IsTrue(validationMessages.Any(vm => vm.Contains(message))); + var exception = Assert.Throws(call); + Assert.IsInstanceOf(exception.InnerException); } [Test] - public void Validate_AssessmentLevelPhreaticLevelExitSellmeijerReductionFactorThicknessCoverageLayerZero_ValidationMessageForHRiverHExitRcDTotalAndDTotal() + public void CalculateThicknessCoverageLayer_WithValidInput_ReturnsSomeThickness() { // Setup + PipingCalculatorInput input = new TestPipingInput().AsRealInput(); + + var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); + + // Call + var result = calculation.CalculateThicknessCoverageLayer(); + + // Assert + Assert.IsFalse(double.IsNaN(result)); + } + + [Test] + public void CalculateThicknessCoverageLayer_WithExitPointLBeyondSurfaceLineInput_ReturnsNaN() + { + // Setup PipingCalculatorInput input = new TestPipingInput { - AssessmentLevel = (RoundedDouble) 0, - PhreaticLevelExit = 0, - SellmeijerReductionFactor = 0, - ThicknessCoverageLayer = 0 + ExitPointXCoordinate = (RoundedDouble)2.1 }.AsRealInput(); var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); // Call - List validationMessages = calculation.Validate(); + var result = calculation.CalculateThicknessCoverageLayer(); // Assert - Assert.AreEqual(2, validationMessages.Count); - Assert.IsTrue(validationMessages.Any(message => message.Contains("HRiver - HExit - (Rc*DTotal)"))); - Assert.IsTrue(validationMessages.Any(message => message.Contains("Dtotal"))); + Assert.IsNaN(result); } + [Test] + public void CalculatePiezometricHeadAtExit_WithValidInput_ReturnsSomeValue() + { + // Setup + PipingCalculatorInput input = new TestPipingInput().AsRealInput(); + + var calculation = new PipingCalculator(input, new PipingSubCalculatorFactory()); + + // Call + var result = calculation.CalculatePiezometricHeadAtExit(); + + // Assert + Assert.IsFalse(double.IsNaN(result)); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Ringtoets.Piping.Calculation.Test.csproj =================================================================== diff -u -ra2675f58f4d57204df1b8378e9dc1134cd11186e -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Ringtoets.Piping.Calculation.Test.csproj (.../Ringtoets.Piping.Calculation.Test.csproj) (revision a2675f58f4d57204df1b8378e9dc1134cd11186e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Ringtoets.Piping.Calculation.Test.csproj (.../Ringtoets.Piping.Calculation.Test.csproj) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -62,6 +62,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/SubCalculator/PiezoHeadCalculatorTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/SubCalculator/PiezoHeadCalculatorTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/SubCalculator/PiezoHeadCalculatorTest.cs (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -0,0 +1,19 @@ +using NUnit.Framework; +using Ringtoets.Piping.Calculation.SubCalculator; + +namespace Ringtoets.Piping.Calculation.Test.SubCalculator +{ + public class PiezoHeadCalculatorTest + { + [Test] + public void Constructor_WithInput_PropertiesSet() + { + // Call + var calculator = new PiezoHeadCalculator(); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.AreEqual(0.0, calculator.PhiExit); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/SubCalculator/PipingSubCalculatorFactoryTest.cs =================================================================== diff -u -ree0616189b53da348c17a4cf75328425beaf360b -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/SubCalculator/PipingSubCalculatorFactoryTest.cs (.../PipingSubCalculatorFactoryTest.cs) (revision ee0616189b53da348c17a4cf75328425beaf360b) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/SubCalculator/PipingSubCalculatorFactoryTest.cs (.../PipingSubCalculatorFactoryTest.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -17,7 +17,7 @@ } [Test] - public void CreateHeaveCalculator_WithInput_NewHeaveCalculator() + public void CreateHeaveCalculator_Always_NewHeaveCalculator() { // Setup var factory = new PipingSubCalculatorFactory(); @@ -30,7 +30,7 @@ } [Test] - public void CreateUpliftCalculator_WithInput_NewUpliftCalculator() + public void CreateUpliftCalculator_Always_NewUpliftCalculator() { // Setup var factory = new PipingSubCalculatorFactory(); @@ -43,7 +43,7 @@ } [Test] - public void CreateSellmeijerCalculator_WithInput_NewSellmeijerCalculator() + public void CreateSellmeijerCalculator_Always_NewSellmeijerCalculator() { // Setup var factory = new PipingSubCalculatorFactory(); @@ -56,7 +56,7 @@ } [Test] - public void CreateEffectiveThicknessCalculator_WithInput_NewSellmeijerCalculator() + public void CreateEffectiveThicknessCalculator_Always_NewSellmeijerCalculator() { // Setup var factory = new PipingSubCalculatorFactory(); @@ -67,5 +67,18 @@ // Assert Assert.IsInstanceOf(calculator); } + + [Test] + public void CreatPiezometricHeadAtExitCalculator_Always_NewPizometricHeadAtExitCalculator() + { + // Setup + var factory = new PipingSubCalculatorFactory(); + + // Call + var calculator = factory.CreatePiezometricHeadAtExitCalculator(); + + // Assert + Assert.IsInstanceOf(calculator); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil.Test/SubCalculator/TestPipingSubCalculatorFactoryTest.cs =================================================================== diff -u -rbbca58832f24a62d39dc744c2db663ed696cfac1 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil.Test/SubCalculator/TestPipingSubCalculatorFactoryTest.cs (.../TestPipingSubCalculatorFactoryTest.cs) (revision bbca58832f24a62d39dc744c2db663ed696cfac1) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil.Test/SubCalculator/TestPipingSubCalculatorFactoryTest.cs (.../TestPipingSubCalculatorFactoryTest.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -72,5 +72,18 @@ // Assert Assert.AreSame(factory.LastCreatedSellmeijerCalculator, subCalculator); } + + [Test] + public void CreatePiezometricHeadAtExitCalculator_Always_LastCreatedPiezometricHeadAtExitSetToReturnValue() + { + // Setup + var factory = new TestPipingSubCalculatorFactory(); + + // Call + var subCalculator = factory.CreatePiezometricHeadAtExitCalculator(); + + // Assert + Assert.AreSame(factory.LastCreatedPiezometricHeadAtExitCalculator, subCalculator); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/Ringtoets.Piping.Calculation.TestUtil.csproj =================================================================== diff -u -rbbca58832f24a62d39dc744c2db663ed696cfac1 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/Ringtoets.Piping.Calculation.TestUtil.csproj (.../Ringtoets.Piping.Calculation.TestUtil.csproj) (revision bbca58832f24a62d39dc744c2db663ed696cfac1) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/Ringtoets.Piping.Calculation.TestUtil.csproj (.../Ringtoets.Piping.Calculation.TestUtil.csproj) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -53,6 +53,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/SubCalculator/PiezoHeadCalculatorStub.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/SubCalculator/PiezoHeadCalculatorStub.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/SubCalculator/PiezoHeadCalculatorStub.cs (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -0,0 +1,17 @@ +using Ringtoets.Piping.Calculation.SubCalculator; + +namespace Ringtoets.Piping.Calculation.TestUtil.SubCalculator +{ + /// + /// Stub for the real piezometric head at exit sub calculator of piping. + /// + public class PiezoHeadCalculatorStub : IPiezoHeadCalculator { + public double PhiPolder { get; set; } + public double RExit { get; set; } + public double HRiver { get; set; } + public double PhiExit { get; private set; } + public void Calculate() + { + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/SubCalculator/TestPipingSubCalculatorFactory.cs =================================================================== diff -u -rbbca58832f24a62d39dc744c2db663ed696cfac1 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/SubCalculator/TestPipingSubCalculatorFactory.cs (.../TestPipingSubCalculatorFactory.cs) (revision bbca58832f24a62d39dc744c2db663ed696cfac1) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/SubCalculator/TestPipingSubCalculatorFactory.cs (.../TestPipingSubCalculatorFactory.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -32,9 +32,16 @@ return LastCreatedEffectiveThicknessCalculator; } + public IPiezoHeadCalculator CreatePiezometricHeadAtExitCalculator() + { + LastCreatedPiezometricHeadAtExitCalculator = new PiezoHeadCalculatorStub(); + return LastCreatedPiezometricHeadAtExitCalculator; + } + public EffectiveThicknessCalculatorStub LastCreatedEffectiveThicknessCalculator { get; private set; } public UpliftCalculatorStub LastCreatedUpliftCalculator { get; private set; } public SellmeijerCalculatorStub LastCreatedSellmeijerCalculator { get; private set; } public HeaveCalculatorStub LastCreatedHeaveCalculator { get; private set; } + public PiezoHeadCalculatorStub LastCreatedPiezometricHeadAtExitCalculator { get; private set; } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs =================================================================== diff -u -ra5b051a25a6bb059d5928e29a8d741a8ec31fcd5 -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision a5b051a25a6bb059d5928e29a8d741a8ec31fcd5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -10,6 +10,7 @@ public class TestPipingInput { public double WaterVolumetricWeight; + public double SaturatedVolumicWeightOfCoverageLayer; public double UpliftModelFactor; public RoundedDouble AssessmentLevel; public double PiezometricHeadExit; @@ -40,6 +41,7 @@ public TestPipingInput() { WaterVolumetricWeight = NextIncrementalDouble(); + SaturatedVolumicWeightOfCoverageLayer = NextIncrementalDouble(); UpliftModelFactor = NextIncrementalDouble(); AssessmentLevel = (RoundedDouble)NextIncrementalDouble(); PiezometricHeadExit = NextIncrementalDouble(); @@ -57,7 +59,7 @@ DarcyPermeability = NextIncrementalDouble(); WaterKinematicViscosity = NextIncrementalDouble(); Gravity = NextIncrementalDouble(); - ExitPointXCoordinate = (RoundedDouble)NextIncrementalDouble(); + ExitPointXCoordinate = (RoundedDouble) 0.5; BeddingAngle = NextIncrementalDouble(); MeanDiameter70 = NextIncrementalDouble(); ThicknessAquiferLayer = NextIncrementalDouble(); @@ -105,6 +107,7 @@ { return new PipingCalculatorInput( WaterVolumetricWeight, + SaturatedVolumicWeightOfCoverageLayer, UpliftModelFactor, AssessmentLevel, PiezometricHeadExit, Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs =================================================================== diff -u -rcd01ebb93138126cff40f436c309ee8b4bc9069e -r1069905ff1d4bb81d6acff6c130a4bed0b041b58 --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision cd01ebb93138126cff40f436c309ee8b4bc9069e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 1069905ff1d4bb81d6acff6c130a4bed0b041b58) @@ -56,7 +56,7 @@ } [Test] - public void Calculate_InValidPipingCalculationWithOutput_LogsError() + public void CalculateThicknessCoverageLayer_InValidPipingCalculationWithOutput_LogsError() { // Setup PipingCalculation invalidPipingCalculation = PipingCalculationFactory.CreateCalculationWithValidInput(); @@ -74,16 +74,13 @@ }); // Call - Action call = () => PipingCalculationService.Calculate(invalidPipingCalculation); + Action call = () => PipingCalculationService.CalculateThicknessCoverageLayer(invalidPipingCalculation.InputParameters); // Assert - TestHelper.AssertLogMessages(call, messages => { var msgs = messages.ToArray(); - StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", invalidPipingCalculation.Name), msgs[0]); - StringAssert.StartsWith("Piping berekening niet gelukt: ", msgs[1]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", invalidPipingCalculation.Name), msgs[2]); + StringAssert.StartsWith("Berekenen van de dikte van de deklaag niet gelukt: ", msgs[0]); }); } @@ -96,12 +93,12 @@ ExitPointL = (RoundedDouble)10, SurfaceLine = new RingtoetsPipingSurfaceLine() }; - input.SurfaceLine.SetGeometry(new [] + input.SurfaceLine.SetGeometry(new[] { new Point3D(0, 0, 10), new Point3D(20, 0, 10) }); - input.SoilProfile = new PipingSoilProfile(string.Empty, 0, new [] + input.SoilProfile = new PipingSoilProfile(string.Empty, 0, new[] { new PipingSoilLayer(5) { @@ -120,38 +117,21 @@ Assert.AreEqual(5, thickness); } + [Test] - public void CalculateThicknessCoverageLayer_SurfaceLineOutsideProfile_ThrowsPipingCalculatorException() + public void CalculatePiezometricHeadAtExit_Always_ReturnsResult() { // Setup PipingInput input = new PipingInput(new GeneralPipingInput()) { - ExitPointL = (RoundedDouble)10, - SurfaceLine = new RingtoetsPipingSurfaceLine() + AssessmentLevel = (RoundedDouble) 0.0 }; - input.SurfaceLine.SetGeometry(new[] - { - new Point3D(0, 0, 10), - new Point3D(10, 0, 20+1e-3), - new Point3D(20, 0, 10) - }); - input.SoilProfile = new PipingSoilProfile(string.Empty, 0, new[] - { - new PipingSoilLayer(5) - { - IsAquifer = true - }, - new PipingSoilLayer(20) - { - IsAquifer = false - } - }); // Call - TestDelegate test = () => PipingCalculationService.CalculateThicknessCoverageLayer(input); + var result = PipingCalculationService.CalculatePiezometricHeadAtExit(input); // Assert - Assert.Throws(test); + Assert.IsFalse(double.IsNaN(result)); } [Test] @@ -250,35 +230,60 @@ } } + [Test] + public void CalculateThicknessCoverageLayer_CompleteInput_InputSetOnSubCalculator() + { + + // Setup + PipingCalculation validPipingCalculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + PipingInput input = validPipingCalculation.InputParameters; + + using (new PipingCalculationServiceConfig()) + { + // Call + PipingCalculationService.CalculateThicknessCoverageLayer(validPipingCalculation.InputParameters); + + // Assert + var testFactory = (TestPipingSubCalculatorFactory)PipingCalculationService.SubCalculatorFactory; + var effectiveThicknessCalculator = testFactory.LastCreatedEffectiveThicknessCalculator; + + Assert.AreEqual(input.ExitPointL.Value, effectiveThicknessCalculator.ExitPointXCoordinate); + Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), effectiveThicknessCalculator.PhreaticLevel); + AssertEqualSoilProfiles(input.SoilProfile, effectiveThicknessCalculator.SoilProfile); + AssertEqualSurfaceLines(input.SurfaceLine, effectiveThicknessCalculator.SurfaceLine); + Assert.AreEqual(input.WaterVolumetricWeight, effectiveThicknessCalculator.VolumicWeightOfWater); + } + + } + private void AssertSubCalculatorInputs(PipingInput input) { var testFactory = (TestPipingSubCalculatorFactory) PipingCalculationService.SubCalculatorFactory; var heaveCalculator = testFactory.LastCreatedHeaveCalculator; var upliftCalculator = testFactory.LastCreatedUpliftCalculator; - var effectiveThicknessCalculator = testFactory.LastCreatedEffectiveThicknessCalculator; var sellmeijerCalculator = testFactory.LastCreatedSellmeijerCalculator; + var piezometricHeadAtExitCalculator = testFactory.LastCreatedPiezometricHeadAtExitCalculator; - Assert.AreEqual(input.ExitPointL.Value, effectiveThicknessCalculator.ExitPointXCoordinate); - Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), effectiveThicknessCalculator.PhreaticLevel); - AssertEqualSoilProfiles(input.SoilProfile, effectiveThicknessCalculator.SoilProfile); - AssertEqualSurfaceLines(input.SurfaceLine, effectiveThicknessCalculator.SurfaceLine); - Assert.AreEqual(input.WaterVolumetricWeight, effectiveThicknessCalculator.VolumicWeightOfWater); + Assert.AreEqual(input.AssessmentLevel.Value, piezometricHeadAtExitCalculator.HRiver); + Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.PhiPolder); + Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.RExit); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(input).GetDesignValue(), heaveCalculator.DTotal); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), heaveCalculator.HExit); Assert.AreEqual(input.CriticalHeaveGradient, heaveCalculator.Ich); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), heaveCalculator.PhiPolder); - Assert.AreEqual(input.PiezometricHeadExit, heaveCalculator.PhiExit); + Assert.AreEqual(piezometricHeadAtExitCalculator.PhiExit, heaveCalculator.PhiExit); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(), heaveCalculator.RExit); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), upliftCalculator.HExit); Assert.AreEqual(input.AssessmentLevel.Value, upliftCalculator.HRiver); Assert.AreEqual(input.UpliftModelFactor, upliftCalculator.ModelFactorUplift); - Assert.AreEqual(input.PiezometricHeadExit, upliftCalculator.PhiExit); + Assert.AreEqual(piezometricHeadAtExitCalculator.PhiExit, upliftCalculator.PhiExit); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), upliftCalculator.PhiPolder); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(), upliftCalculator.RExit); Assert.AreEqual(input.WaterVolumetricWeight, upliftCalculator.VolumetricWeightOfWater); - Assert.AreEqual(effectiveThicknessCalculator.EffectiveStress, upliftCalculator.EffectiveStress); + var effectiveStress = PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(input).GetDesignValue() * (input.WaterVolumetricWeight - input.WaterVolumetricWeight); + Assert.AreEqual(effectiveStress, upliftCalculator.EffectiveStress); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetSeepageLength(input).GetDesignValue(), sellmeijerCalculator.SeepageLength); Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), sellmeijerCalculator.HExit);