Exemplo n.º 1
0
        public void Constructor_SetProperties_ExpectedValues()
        {
            // Setup
            var    random            = new Random(31);
            double waterLevelPolder  = random.NextDouble();
            bool   useDefaultOffsets = random.NextBoolean();
            double phreaticLineOffsetBelowDikeTopAtRiver     = random.NextDouble();
            double phreaticLineOffsetBelowDikeTopAtPolder    = random.NextDouble();
            double phreaticLineOffsetBelowShoulderBaseInside = random.NextDouble();
            double phreaticLineOffsetBelowDikeToeAtPolder    = random.NextDouble();

            // Call
            var configuration = new MacroStabilityInwardsLocationInputConfiguration
            {
                WaterLevelPolder  = waterLevelPolder,
                UseDefaultOffsets = useDefaultOffsets,
                PhreaticLineOffsetBelowDikeTopAtRiver     = phreaticLineOffsetBelowDikeTopAtRiver,
                PhreaticLineOffsetBelowDikeTopAtPolder    = phreaticLineOffsetBelowDikeTopAtPolder,
                PhreaticLineOffsetBelowShoulderBaseInside = phreaticLineOffsetBelowShoulderBaseInside,
                PhreaticLineOffsetBelowDikeToeAtPolder    = phreaticLineOffsetBelowDikeToeAtPolder
            };

            // Assert
            Assert.AreEqual(waterLevelPolder, configuration.WaterLevelPolder);
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder, configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside, configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 2
0
 private static void SetMacroStabilityInwardsLocationInputParameters(MacroStabilityInwardsLocationInputConfiguration configuration,
                                                                     IMacroStabilityInwardsLocationInput input)
 {
     configuration.WaterLevelPolder  = input.WaterLevelPolder;
     configuration.UseDefaultOffsets = input.UseDefaultOffsets;
     configuration.PhreaticLineOffsetBelowDikeTopAtRiver     = input.PhreaticLineOffsetBelowDikeTopAtRiver;
     configuration.PhreaticLineOffsetBelowDikeTopAtPolder    = input.PhreaticLineOffsetBelowDikeTopAtPolder;
     configuration.PhreaticLineOffsetBelowShoulderBaseInside = input.PhreaticLineOffsetBelowShoulderBaseInside;
     configuration.PhreaticLineOffsetBelowDikeToeAtPolder    = input.PhreaticLineOffsetBelowDikeToeAtPolder;
 }
Exemplo n.º 3
0
        public void GetMacroStabilityInwardsLocationInputConfiguration_DescendantElementNameNotFound_ReturnNull()
        {
            // Setup
            const string descendantElementName = "differentElementName";

            var element = new XElement("Root", new XElement(descendantElementName));

            // Call
            MacroStabilityInwardsLocationInputConfiguration configuration = element.GetMacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.IsNull(configuration);
        }
Exemplo n.º 4
0
        public void Constructor_Always_ExpectedValues()
        {
            // Call
            var configuration = new MacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.IsNull(configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Configure a new <see cref="MacroStabilityInwardsLocationInputConfiguration"/> with
        /// values taken from <paramref name="inputDaily"/>.
        /// </summary>
        /// <param name="inputDaily">The input to take the values from.</param>
        /// <returns>A new <see cref="MacroStabilityInwardsLocationInputConfiguration"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="inputDaily"/> is <c>null</c>.</exception>
        public static MacroStabilityInwardsLocationInputConfiguration ToMacroStabilityInwardsLocationInputConfiguration(
            this IMacroStabilityInwardsLocationInputDaily inputDaily)
        {
            if (inputDaily == null)
            {
                throw new ArgumentNullException(nameof(inputDaily));
            }

            var configuration = new MacroStabilityInwardsLocationInputConfiguration();

            SetMacroStabilityInwardsLocationInputParameters(configuration, inputDaily);

            return(configuration);
        }
Exemplo n.º 6
0
        public void GetMacroStabilityInwardsLocationInputConfiguration_WithoutProperties_ReturnMacroStabilityInwardsLocationInputConfiguration()
        {
            // Setup
            var element = new XElement("Root", new XElement("dagelijks"));

            // Call
            MacroStabilityInwardsLocationInputConfiguration configuration = element.GetMacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.IsNull(configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 7
0
        public void GetMacroStabilityInwardsLocationInputConfiguration_WithPhreaticLineOffsetBelowDikeToeAtPolder_ReturnMacroStabilityInwardsLocationInputConfiguration()
        {
            // Setup
            var    random = new Random(31);
            double phreaticLineOffsetBelowDikeToeAtPolder = random.NextDouble();

            var element = new XElement("Root", new XElement("dagelijks", new XElement("teendijkbinnenwaarts", phreaticLineOffsetBelowDikeToeAtPolder)));

            // Call
            MacroStabilityInwardsLocationInputConfiguration configuration = element.GetMacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.IsNull(configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 8
0
        public void GetMacroStabilityInwardsLocationInputConfiguration_WithUseDefaultOffsets_ReturnMacroStabilityInwardsLocationInputConfiguration()
        {
            // Setup
            var  random            = new Random(31);
            bool useDefaultOffsets = random.NextBoolean();

            var element = new XElement("Root", new XElement("dagelijks", new XElement("gebruikdefaults", useDefaultOffsets)));

            // Call
            MacroStabilityInwardsLocationInputConfiguration configuration = element.GetMacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.IsNull(configuration.WaterLevelPolder);
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.IsNull(configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
Exemplo n.º 9
0
        public void ToMacroStabilityInwardsLocationInputConfiguration_ValidMacroStabilityInwardsLocationInputDaily_ReturnsNewMacroStabilityInwardsLocationInputConfigurationWithParametersSet()
        {
            // Setup
            var random = new Random(31);

            bool          useDefaultOffsets = random.NextBoolean();
            RoundedDouble waterLevelPolder  = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowDikeTopAtRiver     = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowDikeTopAtPolder    = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowShoulderBaseInside = random.NextRoundedDouble();
            RoundedDouble phreaticLineOffsetBelowDikeToeAtPolder    = random.NextRoundedDouble();

            var mockRepository = new MockRepository();
            var inputDaily     = mockRepository.Stub <IMacroStabilityInwardsLocationInputDaily>();

            inputDaily.UseDefaultOffsets = useDefaultOffsets;
            inputDaily.WaterLevelPolder  = waterLevelPolder;
            inputDaily.PhreaticLineOffsetBelowDikeTopAtRiver     = phreaticLineOffsetBelowDikeTopAtRiver;
            inputDaily.PhreaticLineOffsetBelowDikeTopAtPolder    = phreaticLineOffsetBelowDikeTopAtPolder;
            inputDaily.PhreaticLineOffsetBelowShoulderBaseInside = phreaticLineOffsetBelowShoulderBaseInside;
            inputDaily.PhreaticLineOffsetBelowDikeToeAtPolder    = phreaticLineOffsetBelowDikeToeAtPolder;
            mockRepository.ReplayAll();

            // Call
            MacroStabilityInwardsLocationInputConfiguration configuration = inputDaily.ToMacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver,
                            configuration.PhreaticLineOffsetBelowDikeTopAtRiver,
                            phreaticLineOffsetBelowDikeTopAtRiver.GetAccuracy());
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder,
                            configuration.PhreaticLineOffsetBelowDikeTopAtPolder,
                            phreaticLineOffsetBelowDikeTopAtPolder.GetAccuracy());
            Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside,
                            configuration.PhreaticLineOffsetBelowShoulderBaseInside,
                            phreaticLineOffsetBelowShoulderBaseInside.GetAccuracy());
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder,
                            configuration.PhreaticLineOffsetBelowDikeToeAtPolder,
                            phreaticLineOffsetBelowDikeToeAtPolder.GetAccuracy());
            mockRepository.VerifyAll();
        }
Exemplo n.º 10
0
        public void GetMacroStabilityInwardsLocationInputConfiguration_ValidDescendantElement_ReturnMacroStabilityInwardsLocationInputConfiguration()
        {
            // Setup
            var    random            = new Random(31);
            double waterLevelPolder  = random.NextDouble();
            bool   useDefaultOffsets = random.NextBoolean();
            double phreaticLineOffsetBelowDikeTopAtRiver     = random.NextDouble();
            double phreaticLineOffsetBelowDikeTopAtPolder    = random.NextDouble();
            double phreaticLineOffsetBelowShoulderBaseInside = random.NextDouble();
            double phreaticLineOffsetBelowDikeToeAtPolder    = random.NextDouble();

            var waterLevelPolderElement  = new XElement("polderpeil", waterLevelPolder);
            var useDefaultOffsetsElement = new XElement("gebruikdefaults", useDefaultOffsets);
            var phreaticLineOffsetBelowDikeTopAtRiverElement     = new XElement("buitenkruin", phreaticLineOffsetBelowDikeTopAtRiver);
            var phreaticLineOffsetBelowDikeTopAtPolderElement    = new XElement("binnenkruin", phreaticLineOffsetBelowDikeTopAtPolder);
            var phreaticLineOffsetBelowShoulderBaseInsideElement = new XElement("insteekbinnenberm", phreaticLineOffsetBelowShoulderBaseInside);
            var phreaticLineOffsetBelowDikeToeAtPolderElement    = new XElement("teendijkbinnenwaarts", phreaticLineOffsetBelowDikeToeAtPolder);

            var element = new XElement("Root", new XElement("dagelijks",
                                                            waterLevelPolderElement,
                                                            useDefaultOffsetsElement,
                                                            phreaticLineOffsetBelowDikeTopAtRiverElement,
                                                            phreaticLineOffsetBelowDikeTopAtPolderElement,
                                                            phreaticLineOffsetBelowShoulderBaseInsideElement,
                                                            phreaticLineOffsetBelowDikeToeAtPolderElement));

            // Call
            MacroStabilityInwardsLocationInputConfiguration configuration = element.GetMacroStabilityInwardsLocationInputConfiguration();

            // Assert
            Assert.AreEqual(waterLevelPolder, configuration.WaterLevelPolder);
            Assert.AreEqual(useDefaultOffsets, configuration.UseDefaultOffsets);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtRiver, configuration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(phreaticLineOffsetBelowDikeTopAtPolder, configuration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(phreaticLineOffsetBelowShoulderBaseInside, configuration.PhreaticLineOffsetBelowShoulderBaseInside);
            Assert.AreEqual(phreaticLineOffsetBelowDikeToeAtPolder, configuration.PhreaticLineOffsetBelowDikeToeAtPolder);
        }
        private static void AssertConfiguration(MacroStabilityInwardsCalculationConfiguration configuration, bool hydraulicBoundaryLocation)
        {
            Assert.AreEqual("Calculation", configuration.Name);

            if (hydraulicBoundaryLocation)
            {
                Assert.IsNull(configuration.AssessmentLevel);
                Assert.AreEqual("Locatie", configuration.HydraulicBoundaryLocationName);
            }
            else
            {
                Assert.AreEqual(1.1, configuration.AssessmentLevel);
                Assert.IsNull(configuration.HydraulicBoundaryLocationName);
            }

            Assert.AreEqual("Profielschematisatie", configuration.SurfaceLineName);
            Assert.AreEqual("Ondergrondmodel", configuration.StochasticSoilModelName);
            Assert.AreEqual("Ondergrondschematisatie", configuration.StochasticSoilProfileName);

            Assert.AreEqual(ConfigurationDikeSoilScenario.SandDikeOnClay, configuration.DikeSoilScenario);
            Assert.AreEqual(10.5, configuration.WaterLevelRiverAverage);

            Assert.IsTrue(configuration.DrainageConstructionPresent);
            Assert.AreEqual(10.6, configuration.XCoordinateDrainageConstruction);
            Assert.AreEqual(10.7, configuration.ZCoordinateDrainageConstruction);

            Assert.AreEqual(10.9, configuration.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(10.8, configuration.MinimumLevelPhreaticLineAtDikeTopPolder);

            Assert.IsTrue(configuration.AdjustPhreaticLine3And4ForUplift);

            Assert.AreEqual(20.1, configuration.PiezometricHeadPhreaticLine2Inwards);
            Assert.AreEqual(20.2, configuration.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(10.1, configuration.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(10.2, configuration.LeakageLengthOutwardsPhreaticLine3);
            Assert.AreEqual(10.3, configuration.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(10.4, configuration.LeakageLengthOutwardsPhreaticLine4);

            MacroStabilityInwardsLocationInputConfiguration dailyConfiguration = configuration.LocationInputDaily;

            Assert.IsNotNull(dailyConfiguration);
            Assert.AreEqual(2.2, dailyConfiguration.WaterLevelPolder);
            Assert.IsTrue(dailyConfiguration.UseDefaultOffsets);
            Assert.AreEqual(2.21, dailyConfiguration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(2.24, dailyConfiguration.PhreaticLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(2.22, dailyConfiguration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(2.23, dailyConfiguration.PhreaticLineOffsetBelowShoulderBaseInside);

            MacroStabilityInwardsLocationInputExtremeConfiguration extremeConfiguration = configuration.LocationInputExtreme;

            Assert.IsNotNull(extremeConfiguration);
            Assert.AreEqual(15.2, extremeConfiguration.WaterLevelPolder);
            Assert.AreEqual(16.2, extremeConfiguration.PenetrationLength);
            Assert.IsFalse(extremeConfiguration.UseDefaultOffsets);
            Assert.AreEqual(15.21, extremeConfiguration.PhreaticLineOffsetBelowDikeTopAtRiver);
            Assert.AreEqual(15.24, extremeConfiguration.PhreaticLineOffsetBelowDikeToeAtPolder);
            Assert.AreEqual(15.22, extremeConfiguration.PhreaticLineOffsetBelowDikeTopAtPolder);
            Assert.AreEqual(15.23, extremeConfiguration.PhreaticLineOffsetBelowShoulderBaseInside);

            Assert.AreEqual(0.4, configuration.SlipPlaneMinimumDepth);
            Assert.AreEqual(0.5, configuration.SlipPlaneMinimumLength);
            Assert.AreEqual(0.6, configuration.MaximumSliceWidth);

            Assert.IsTrue(configuration.CreateZones);
            Assert.AreEqual(ConfigurationZoningBoundariesDeterminationType.Manual, configuration.ZoningBoundariesDeterminationType);
            Assert.AreEqual(10.0, configuration.ZoneBoundaryLeft);
            Assert.AreEqual(43.5, configuration.ZoneBoundaryRight);

            Assert.IsTrue(configuration.MoveGrid);
            Assert.AreEqual(ConfigurationGridDeterminationType.Automatic, configuration.GridDeterminationType);

            Assert.AreEqual(ConfigurationTangentLineDeterminationType.LayerSeparated, configuration.TangentLineDeterminationType);
            Assert.AreEqual(10, configuration.TangentLineZTop);
            Assert.AreEqual(1, configuration.TangentLineZBottom);
            Assert.AreEqual(5, configuration.TangentLineNumber);

            MacroStabilityInwardsGridConfiguration leftGridConfiguration = configuration.LeftGrid;

            Assert.IsNotNull(leftGridConfiguration);
            Assert.IsNaN(leftGridConfiguration.XLeft);
            Assert.IsNaN(leftGridConfiguration.XRight);
            Assert.IsNaN(leftGridConfiguration.ZTop);
            Assert.IsNaN(leftGridConfiguration.ZBottom);
            Assert.AreEqual(6, leftGridConfiguration.NumberOfVerticalPoints);
            Assert.AreEqual(5, leftGridConfiguration.NumberOfHorizontalPoints);

            MacroStabilityInwardsGridConfiguration rightGridConfiguration = configuration.RightGrid;

            Assert.IsNotNull(rightGridConfiguration);
            Assert.AreEqual(1, rightGridConfiguration.XLeft);
            Assert.AreEqual(2, rightGridConfiguration.XRight);
            Assert.AreEqual(4, rightGridConfiguration.ZTop);
            Assert.AreEqual(3, rightGridConfiguration.ZBottom);
            Assert.AreEqual(5, rightGridConfiguration.NumberOfVerticalPoints);
            Assert.AreEqual(6, rightGridConfiguration.NumberOfHorizontalPoints);

            ScenarioConfiguration scenarioConfiguration = configuration.Scenario;

            Assert.IsNotNull(scenarioConfiguration);
            Assert.AreEqual(8.8, scenarioConfiguration.Contribution);
            Assert.IsFalse(scenarioConfiguration.IsRelevant);
        }