/// <summary>
 /// Asserts whether <paramref name="actual"/> is equal to <paramref name="expected"/>.
 /// </summary>
 /// <param name="expected">The expected <see cref="WaternetCreatorInput"/>.</param>
 /// <param name="actual">The actual <see cref="WaternetCreatorInput"/>.</param>
 /// <exception cref="AssertionException">Thrown when <paramref name="actual"/>
 /// is not equal to <paramref name="expected"/>.</exception>
 public static void AssertWaternetCreatorInput(WaternetCreatorInput expected, WaternetCreatorInput actual)
 {
     Assert.AreEqual(expected.DikeSoilScenario, actual.DikeSoilScenario);
     Assert.AreEqual(expected.WaterLevelRiver, actual.WaterLevelRiver);
     Assert.AreEqual(expected.WaterLevelRiverAverage, actual.WaterLevelRiverAverage);
     Assert.AreEqual(expected.WaterLevelPolder, actual.WaterLevelPolder);
     Assert.AreEqual(expected.DrainageConstructionPresent, actual.DrainageConstructionPresent);
     Assert.AreEqual(expected.DrainageConstruction, actual.DrainageConstruction);
     Assert.AreEqual(expected.MinimumLevelPhreaticLineAtDikeTopRiver, actual.MinimumLevelPhreaticLineAtDikeTopRiver);
     Assert.AreEqual(expected.MinimumLevelPhreaticLineAtDikeTopPolder, actual.MinimumLevelPhreaticLineAtDikeTopPolder);
     Assert.AreEqual(expected.UseDefaultOffsets, actual.UseDefaultOffsets);
     Assert.AreEqual(expected.PlLineOffsetBelowPointBRingtoetsWti2017, actual.PlLineOffsetBelowPointBRingtoetsWti2017);
     Assert.AreEqual(expected.PlLineOffsetBelowDikeTopAtPolder, actual.PlLineOffsetBelowDikeTopAtPolder);
     Assert.AreEqual(expected.PlLineOffsetBelowShoulderBaseInside, actual.PlLineOffsetBelowShoulderBaseInside);
     Assert.AreEqual(expected.PlLineOffsetBelowDikeToeAtPolder, actual.PlLineOffsetBelowDikeToeAtPolder);
     Assert.AreEqual(expected.AdjustPl3And4ForUplift, actual.AdjustPl3And4ForUplift);
     Assert.AreEqual(expected.LeakageLengthOutwardsPl3, actual.LeakageLengthOutwardsPl3);
     Assert.AreEqual(expected.LeakageLengthInwardsPl3, actual.LeakageLengthInwardsPl3);
     Assert.AreEqual(expected.LeakageLengthOutwardsPl4, actual.LeakageLengthOutwardsPl4);
     Assert.AreEqual(expected.LeakageLengthInwardsPl4, actual.LeakageLengthInwardsPl4);
     Assert.AreEqual(expected.HeadInPlLine2Outwards, actual.HeadInPlLine2Outwards);
     Assert.AreEqual(expected.HeadInPlLine2Inwards, actual.HeadInPlLine2Inwards);
     Assert.AreEqual(expected.PenetrationLength, actual.PenetrationLength);
     Assert.AreEqual(expected.UnitWeightWater, actual.UnitWeightWater);
 }
Exemple #2
0
 private static MacroStabilityInput CreateWaternet(ICollection <Soil> soils, SurfaceLine surfaceLine,
                                                   SoilProfile soilProfile, WaternetCreatorInput waternetCreatorInput)
 {
     return(new MacroStabilityInput
     {
         StabilityModel =
         {
             ConstructionStages  =
             {
                 new ConstructionStage
                 {
                     SoilProfile = soilProfile
                 }
             },
             Soils               = soils
         },
         PreprocessingInput =
         {
             PreConstructionStages        =
             {
                 new PreConstructionStage
                 {
                     SurfaceLine          = surfaceLine,
                     CreateWaternet       = true,
                     WaternetCreatorInput = waternetCreatorInput
                 }
             }
         }
     });
 }
        public void CreateDaily_WithInput_ReturnWaternetCreatorInput([Values(true, false)] bool drainageConstructionPresent,
                                                                     [Values(true, false)] bool useDefaultOffsets)
        {
            // Setup
            var random = new Random(21);
            DrainageConstruction drainageConstruction = drainageConstructionPresent
                                                            ? new DrainageConstruction(random.Next(), random.Next())
                                                            : new DrainageConstruction();
            PhreaticLineOffsets phreaticLineOffsets = useDefaultOffsets
                                                          ? new PhreaticLineOffsets()
                                                          : new PhreaticLineOffsets(random.Next(), random.Next(),
                                                                                    random.Next(), random.Next());

            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                             = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile                             = new TestSoilProfile(),
                SlipPlane                               = new UpliftVanSlipPlane(),
                DikeSoilScenario                        = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
                AssessmentLevel                         = random.NextDouble(),
                WaterLevelRiverAverage                  = random.NextDouble(),
                WaterLevelPolderDaily                   = random.NextDouble(),
                DrainageConstruction                    = drainageConstruction,
                PhreaticLineOffsetsExtreme              = new PhreaticLineOffsets(),
                PhreaticLineOffsetsDaily                = phreaticLineOffsets,
                MinimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble(),
                MinimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble(),
                AdjustPhreaticLine3And4ForUplift        = random.NextBoolean(),
                LeakageLengthOutwardsPhreaticLine3      = random.NextDouble(),
                LeakageLengthInwardsPhreaticLine3       = random.NextDouble(),
                LeakageLengthOutwardsPhreaticLine4      = random.NextDouble(),
                LeakageLengthInwardsPhreaticLine4       = random.NextDouble(),
                PiezometricHeadPhreaticLine2Outwards    = random.NextDouble(),
                PiezometricHeadPhreaticLine2Inwards     = random.NextDouble(),
                PenetrationLengthDaily                  = random.NextDouble()
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = UpliftVanWaternetCreatorInputCreator.CreateDaily(input);

            // Assert
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.HeadInPlLine3);
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.HeadInPlLine4);
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.WaterLevelRiver);
            Assert.AreEqual(input.WaterLevelPolderDaily, waternetCreatorInput.WaterLevelPolder);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.UseDefaults, waternetCreatorInput.UseDefaultOffsets);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeTopAtRiver, waternetCreatorInput.PlLineOffsetBelowPointBRingtoetsWti2017);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeTopAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowShoulderBaseInside, waternetCreatorInput.PlLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(input.PhreaticLineOffsetsDaily.BelowDikeToeAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(input.PenetrationLengthDaily, waternetCreatorInput.PenetrationLength);

            AssertGeneralWaternetCreatorInputValues(input, waternetCreatorInput);
            AssertIrrelevantValues(waternetCreatorInput);
        }
Exemple #4
0
        public void Create_ValidDikeSoilScenario_ReturnInputWithDikeSoilScenario(MacroStabilityInwardsDikeSoilScenario macroStabilityInwardsDikeSoilScenario,
                                                                                 DikeSoilScenario expectedDikeSoilScenario)
        {
            // Setup
            var input = new WaternetCalculatorInput(
                new WaternetCalculatorInput.ConstructionProperties
            {
                DrainageConstruction = new DrainageConstruction(),
                PhreaticLineOffsets  = new PhreaticLineOffsets(),
                SurfaceLine          = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile          = new TestSoilProfile(),
                DikeSoilScenario     = macroStabilityInwardsDikeSoilScenario
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = WaternetCreatorInputCreator.Create(input);

            // Assert
            Assert.AreEqual(expectedDikeSoilScenario, waternetCreatorInput.DikeSoilScenario);
        }
        /// <summary>
        /// Creates a <see cref="WaternetCreatorInput"/> based on the given <paramref name="input"/> under daily circumstances,
        /// which can be used by <see cref="IUpliftVanKernel"/>.
        /// </summary>
        /// <param name="input">The <see cref="UpliftVanCalculatorInput"/> to get the information from.</param>
        /// <returns>A new <see cref="WaternetCreatorInput"/> with the given information from <paramref name="input"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> is <c>null</c>.</exception>
        /// <exception cref="InvalidEnumArgumentException">Thrown when <see cref="UpliftVanCalculatorInput.DikeSoilScenario"/>
        /// is an invalid value.</exception>
        /// <exception cref="NotSupportedException">Thrown when <see cref="UpliftVanCalculatorInput.DikeSoilScenario"/>
        /// is a valid value, but unsupported.</exception>
        public static WaternetCreatorInput CreateDaily(UpliftVanCalculatorInput input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            WaternetCreatorInput creatorInput = CreateBaseWaternetCreatorInput(input);

            creatorInput.WaterLevelRiver   = input.WaterLevelRiverAverage;
            creatorInput.HeadInPlLine3     = input.WaterLevelRiverAverage;
            creatorInput.HeadInPlLine4     = input.WaterLevelRiverAverage;
            creatorInput.WaterLevelPolder  = input.WaterLevelPolderDaily;
            creatorInput.UseDefaultOffsets = input.PhreaticLineOffsetsDaily.UseDefaults;
            creatorInput.PlLineOffsetBelowPointBRingtoetsWti2017 = input.PhreaticLineOffsetsDaily.BelowDikeTopAtRiver;
            creatorInput.PlLineOffsetBelowDikeTopAtPolder        = input.PhreaticLineOffsetsDaily.BelowDikeTopAtPolder;
            creatorInput.PlLineOffsetBelowShoulderBaseInside     = input.PhreaticLineOffsetsDaily.BelowShoulderBaseInside;
            creatorInput.PlLineOffsetBelowDikeToeAtPolder        = input.PhreaticLineOffsetsDaily.BelowDikeToeAtPolder;
            creatorInput.PenetrationLength = input.PenetrationLengthDaily;
            return(creatorInput);
        }
 private static void AssertIrrelevantValues(WaternetCreatorInput waternetCreatorInput)
 {
     Assert.AreEqual(0, waternetCreatorInput.WaterLevelRiverLow); // Only for macro stability outwards
 }
        private static void AssertGeneralWaternetCreatorInputValues(UpliftVanCalculatorInput input, WaternetCreatorInput waternetCreatorInput)
        {
            Assert.AreEqual(input.WaterLevelRiverAverage, waternetCreatorInput.WaterLevelRiverAverage);
            Assert.AreEqual(input.DrainageConstruction.IsPresent, waternetCreatorInput.DrainageConstructionPresent);
            if (input.DrainageConstruction.IsPresent)
            {
                Assert.AreEqual(input.DrainageConstruction.XCoordinate, waternetCreatorInput.DrainageConstruction.X);
                Assert.AreEqual(input.DrainageConstruction.ZCoordinate, waternetCreatorInput.DrainageConstruction.Z);
            }

            Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopRiver, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(input.MinimumLevelPhreaticLineAtDikeTopPolder, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(DikeSoilScenario.SandDikeOnClay, waternetCreatorInput.DikeSoilScenario);
            Assert.AreEqual(input.AdjustPhreaticLine3And4ForUplift, waternetCreatorInput.AdjustPl3And4ForUplift);
            Assert.AreEqual(input.LeakageLengthOutwardsPhreaticLine3, waternetCreatorInput.LeakageLengthOutwardsPl3);
            Assert.AreEqual(input.LeakageLengthInwardsPhreaticLine3, waternetCreatorInput.LeakageLengthInwardsPl3);
            Assert.AreEqual(input.LeakageLengthOutwardsPhreaticLine4, waternetCreatorInput.LeakageLengthOutwardsPl4);
            Assert.AreEqual(input.LeakageLengthInwardsPhreaticLine4, waternetCreatorInput.LeakageLengthInwardsPl4);
            Assert.AreEqual(input.PiezometricHeadPhreaticLine2Outwards, waternetCreatorInput.HeadInPlLine2Outwards);
            Assert.AreEqual(input.PiezometricHeadPhreaticLine2Inwards, waternetCreatorInput.HeadInPlLine2Inwards);
            Assert.AreEqual(input.WaterVolumetricWeight, waternetCreatorInput.UnitWeightWater);
        }
Exemple #8
0
        public void Create_WithInput_ReturnWaternetCreatorInput([Values(true, false)] bool drainageConstructionPresent,
                                                                [Values(true, false)] bool useDefaultOffsets)
        {
            // Setup
            var    random                  = new Random(21);
            double assessmentLevel         = random.Next();
            double waterLevelRiverAverage  = random.Next();
            double waterLevelPolderExtreme = random.Next();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.Next();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.Next();
            bool   adjustPhreaticLine3And4ForUplift        = random.NextBoolean();
            double leakageLengthOutwardsPhreaticLine3      = random.Next();
            double leakageLengthInwardsPhreaticLine3       = random.Next();
            double leakageLengthOutwardsPhreaticLine4      = random.Next();
            double leakageLengthInwardsPhreaticLine4       = random.Next();
            double piezometricHeadPhreaticLine2Outwards    = random.Next();
            double piezometricHeadPhreaticLine2Inwards     = random.Next();
            double penetrationLength     = random.Next();
            double waterVolumetricWeight = random.Next();

            DrainageConstruction drainageConstruction = drainageConstructionPresent
                                                            ? new DrainageConstruction(random.Next(), random.Next())
                                                            : new DrainageConstruction();
            PhreaticLineOffsets phreaticLineOffsets = useDefaultOffsets
                                                          ? new PhreaticLineOffsets()
                                                          : new PhreaticLineOffsets(random.Next(), random.Next(),
                                                                                    random.Next(), random.Next());

            var input = new WaternetCalculatorInput(
                new WaternetCalculatorInput.ConstructionProperties
            {
                SurfaceLine            = new MacroStabilityInwardsSurfaceLine("test"),
                SoilProfile            = new TestSoilProfile(),
                DikeSoilScenario       = MacroStabilityInwardsDikeSoilScenario.SandDikeOnClay,
                AssessmentLevel        = assessmentLevel,
                WaterLevelRiverAverage = waterLevelRiverAverage,
                WaterLevelPolder       = waterLevelPolderExtreme,
                DrainageConstruction   = drainageConstruction,
                PhreaticLineOffsets    = phreaticLineOffsets,
                MinimumLevelPhreaticLineAtDikeTopRiver  = minimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder,
                AdjustPhreaticLine3And4ForUplift        = adjustPhreaticLine3And4ForUplift,
                LeakageLengthOutwardsPhreaticLine3      = leakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3       = leakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4      = leakageLengthOutwardsPhreaticLine4,
                LeakageLengthInwardsPhreaticLine4       = leakageLengthInwardsPhreaticLine4,
                PiezometricHeadPhreaticLine2Outwards    = piezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards     = piezometricHeadPhreaticLine2Inwards,
                PenetrationLength     = penetrationLength,
                WaterVolumetricWeight = waterVolumetricWeight
            });

            // Call
            WaternetCreatorInput waternetCreatorInput = WaternetCreatorInputCreator.Create(input);

            // Assert
            Assert.AreEqual(DikeSoilScenario.SandDikeOnClay, waternetCreatorInput.DikeSoilScenario);
            Assert.AreEqual(assessmentLevel, waternetCreatorInput.WaterLevelRiver);
            Assert.AreEqual(assessmentLevel, waternetCreatorInput.HeadInPlLine3);
            Assert.AreEqual(assessmentLevel, waternetCreatorInput.HeadInPlLine4);
            Assert.AreEqual(waterLevelRiverAverage, waternetCreatorInput.WaterLevelRiverAverage);
            Assert.AreEqual(waterLevelPolderExtreme, waternetCreatorInput.WaterLevelPolder);
            Assert.AreEqual(drainageConstruction.IsPresent, waternetCreatorInput.DrainageConstructionPresent);
            if (drainageConstructionPresent)
            {
                Assert.AreEqual(drainageConstruction.XCoordinate, waternetCreatorInput.DrainageConstruction.X);
                Assert.AreEqual(drainageConstruction.ZCoordinate, waternetCreatorInput.DrainageConstruction.Z);
            }

            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, waternetCreatorInput.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(phreaticLineOffsets.UseDefaults, waternetCreatorInput.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsets.BelowDikeTopAtRiver, waternetCreatorInput.PlLineOffsetBelowPointBRingtoetsWti2017);
            Assert.AreEqual(phreaticLineOffsets.BelowDikeTopAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(phreaticLineOffsets.BelowShoulderBaseInside, waternetCreatorInput.PlLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsets.BelowDikeToeAtPolder, waternetCreatorInput.PlLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, waternetCreatorInput.AdjustPl3And4ForUplift);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, waternetCreatorInput.LeakageLengthOutwardsPl3);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, waternetCreatorInput.LeakageLengthInwardsPl3);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, waternetCreatorInput.LeakageLengthOutwardsPl4);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, waternetCreatorInput.LeakageLengthInwardsPl4);
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, waternetCreatorInput.HeadInPlLine2Outwards);
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, waternetCreatorInput.HeadInPlLine2Inwards);
            Assert.AreEqual(penetrationLength, waternetCreatorInput.PenetrationLength);
            Assert.AreEqual(waterVolumetricWeight, waternetCreatorInput.UnitWeightWater);

            AssertIrrelevantValues(waternetCreatorInput);
        }