Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingFailureMechanismType.cs =================================================================== diff -u -rdd33f3b9d039c570742b8233da23326538c848cf -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingFailureMechanismType.cs (.../HydraRingFailureMechanismType.cs) (revision dd33f3b9d039c570742b8233da23326538c848cf) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingFailureMechanismType.cs (.../HydraRingFailureMechanismType.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -35,6 +35,7 @@ WavePeakPeriod, WaveSpectralPeriod, DikesOvertopping, + DikesHeight, DikesPiping, StructuresOvertopping, StructuresClosure, Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Hydraulics/DikeHeightCalculationInput.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Hydraulics/DikeHeightCalculationInput.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Hydraulics/DikeHeightCalculationInput.cs (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -0,0 +1,212 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using Ringtoets.HydraRing.Calculation.Data.Input.Overtopping; + +namespace Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics +{ + /// + /// Container for all data necessary for performing a dike height calculation via Hydra-Ring. + /// + public class DikeHeightCalculationInput : TargetProbabilityCalculationInput + { + private readonly HydraRingSection section; + private readonly IEnumerable profilePoints; + private readonly IEnumerable forelandPoints; + private readonly HydraRingBreakWater breakWater; + + private readonly double modelFactorCriticalOvertopping; + private readonly double factorFbMean; + private readonly double factorFbStandardDeviation; + private readonly double factorFnMean; + private readonly double factorFnStandardDeviation; + private readonly double modelFactorOvertopping; + private readonly double criticalOvertoppingMean; + private readonly double criticalOvertoppingStandardDeviation; + private readonly double modelFactorFrunupStandardDeviation; + private readonly double modelFactorFrunupMean; + private readonly double exponentModelFactorShallowStandardDeviation; + private readonly double exponentModelFactorShallowMean; + + /// + /// Creates a new instance of the class. + /// + /// The id of the hydraulic station to use during the calculation. + /// The norm to use during the calculation. + /// The section to use during the calculation. + /// The model factor critical overtopping to use during the calculation. + /// The mean of the factor Fb to use during the calculation + /// The standard deviation of the factor Fb to use during the calculation. + /// The mean of the factor Fn to use during the calculation. + /// The standard deviation of the factor Fn to use during the calculation. + /// The factor overtopping to use during the calculation. + /// The mean of the critical overtopping to use during the calculation. + /// The standard deviation of the critical overtopping to use during the calculation. + /// The mean of the factor frunup to use during the calculation. + /// The standard deviation of the factor frunup to use during the calculation. + /// The mean of the exponent model factor shallow to use during the calculation. + /// The standard deviation of the exponent model factor shallow to use during the calculation. + /// The profile points to use during the calculation. + /// The foreland points to use during the calculation. + /// The break water to use during the calculation. + public DikeHeightCalculationInput(long hydraulicBoundaryLocationId, double norm, + HydraRingSection hydraRingSection, double hydraRingModelFactorCriticalOvertopping, + double hydraRingFactorFbMean, double hydraRingFactorFbStandardDeviation, + double hydraRingFactorFnMean, double hydraRingFactorFnStandardDeviation, + double hydraRingmodelFactorOvertopping, double hydraRingCriticalOvertoppingMean, + double hydraRingCriticalOvertoppingStandardDeviation, double hydraRingModelFactorFrunupMean, + double hydraRingModelFactorFrunupStandardDeviation, double hydraRingExponentModelFactorShallowMean, + double hydraRingExponentModelFactorShallowStandardDeviation, + IEnumerable hydraRingProfilePoints, + IEnumerable hydraRingForelandPoints, + HydraRingBreakWater hydraRingBreakWater) + : base(hydraulicBoundaryLocationId, norm) + { + section = hydraRingSection; + modelFactorCriticalOvertopping = hydraRingModelFactorCriticalOvertopping; + factorFbMean = hydraRingFactorFbMean; + factorFbStandardDeviation = hydraRingFactorFbStandardDeviation; + factorFnMean = hydraRingFactorFnMean; + factorFnStandardDeviation = hydraRingFactorFnStandardDeviation; + modelFactorOvertopping = hydraRingmodelFactorOvertopping; + modelFactorFrunupMean = hydraRingModelFactorFrunupMean; + modelFactorFrunupStandardDeviation = hydraRingModelFactorFrunupStandardDeviation; + exponentModelFactorShallowMean = hydraRingExponentModelFactorShallowMean; + exponentModelFactorShallowStandardDeviation = hydraRingExponentModelFactorShallowStandardDeviation; + + criticalOvertoppingMean = hydraRingCriticalOvertoppingMean; + criticalOvertoppingStandardDeviation = hydraRingCriticalOvertoppingStandardDeviation; + profilePoints = hydraRingProfilePoints; + forelandPoints = hydraRingForelandPoints; + breakWater = hydraRingBreakWater; + } + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return HydraRingFailureMechanismType.DikesHeight; + } + } + + public override int VariableId + { + get + { + return 1; + } + } + + public override HydraRingSection Section + { + get + { + return section; + } + } + + public override IEnumerable ProfilePoints + { + get + { + return profilePoints; + } + } + + public override IEnumerable ForelandsPoints + { + get + { + return forelandPoints; + } + } + + public override HydraRingBreakWater BreakWater + { + get + { + return breakWater; + } + } + + public override IEnumerable Variables + { + get + { + return GetHydraRingVariables(); + } + } + + public override int? GetSubMechanismModelId(int subMechanismId) + { + switch (subMechanismId) + { + case 102: + return 94; + case 103: + return 95; + default: + return null; + } + } + + private IEnumerable GetHydraRingVariables() + { + // Dike height + yield return new HydraRingVariable(1, HydraRingDistributionType.Deterministic, 0.0, + HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + + // Model factor critical overtopping + yield return new HydraRingVariable(8, HydraRingDistributionType.Deterministic, modelFactorCriticalOvertopping, + HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + + // Factor Fb + yield return new HydraRingVariable(10, HydraRingDistributionType.Normal, double.NaN, + HydraRingDeviationType.Standard, factorFbMean, factorFbStandardDeviation, + double.NaN); + + // Factor Fn + yield return new HydraRingVariable(11, HydraRingDistributionType.Normal, double.NaN, + HydraRingDeviationType.Standard, factorFnMean, factorFnStandardDeviation, + double.NaN); + + // Model factor overtopping + yield return new HydraRingVariable(12, HydraRingDistributionType.Deterministic, modelFactorOvertopping, + HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + + // Critical overtopping + yield return new HydraRingVariable(17, HydraRingDistributionType.LogNormal, double.NaN, + HydraRingDeviationType.Standard, criticalOvertoppingMean, + criticalOvertoppingStandardDeviation, double.NaN); + + // Model factor Frunup + yield return new HydraRingVariable(120, HydraRingDistributionType.Normal, double.NaN, + HydraRingDeviationType.Variation, modelFactorFrunupMean, + modelFactorFrunupStandardDeviation, double.NaN); + + // Exponent model factor shallow + yield return new HydraRingVariable(123, HydraRingDistributionType.Normal, double.NaN, + HydraRingDeviationType.Standard, exponentModelFactorShallowMean, + exponentModelFactorShallowStandardDeviation, double.NaN); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/FailureMechanismDefaultsProvider.cs =================================================================== diff -u -ra02bc3699e3ded023af30aced1e28e1676a39307 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/FailureMechanismDefaultsProvider.cs (.../FailureMechanismDefaultsProvider.cs) (revision a02bc3699e3ded023af30aced1e28e1676a39307) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/FailureMechanismDefaultsProvider.cs (.../FailureMechanismDefaultsProvider.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -84,6 +84,13 @@ }) }, { + HydraRingFailureMechanismType.DikesHeight, new FailureMechanismDefaults(101, new[] + { + 102, + 103 + }) + }, + { HydraRingFailureMechanismType.DikesPiping, new FailureMechanismDefaults(103, new[] { 311, Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/FailureMechanismSettingsProvider.cs =================================================================== diff -u -r95ef650c982927603a743b7ccd4f43b45a616f56 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/FailureMechanismSettingsProvider.cs (.../FailureMechanismSettingsProvider.cs) (revision 95ef650c982927603a743b7ccd4f43b45a616f56) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/FailureMechanismSettingsProvider.cs (.../FailureMechanismSettingsProvider.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -64,6 +64,10 @@ new FailureMechanismSettings(double.NaN, double.NaN, 1017) }, { + HydraRingFailureMechanismType.DikesHeight, + new FailureMechanismSettings(5, 15, 1017) + }, + { HydraRingFailureMechanismType.DikesPiping, new FailureMechanismSettings(double.NaN, double.NaN, 3015) }, Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/SubMechanismSettingsProvider.cs =================================================================== diff -u -r8b314e225c508616076c3cd8345286505711981f -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/SubMechanismSettingsProvider.cs (.../SubMechanismSettingsProvider.cs) (revision 8b314e225c508616076c3cd8345286505711981f) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/SubMechanismSettingsProvider.cs (.../SubMechanismSettingsProvider.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -131,6 +131,17 @@ } }, { + HydraRingFailureMechanismType.DikesHeight, new Dictionary + { + { + 102, new SubMechanismSettings(1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 10000, 20000, 0.1, -6.0, 6.0, 25) + }, + { + 103, new SubMechanismSettings(1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 10000, 20000, 0.1, -6.0, 6.0, 25) + } + } + }, + { HydraRingFailureMechanismType.DikesPiping, new Dictionary { { Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/VariableDefaultsProvider.cs =================================================================== diff -u -r9f08122750310ba06e28e435c3c4bdf5e873d99b -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/VariableDefaultsProvider.cs (.../VariableDefaultsProvider.cs) (revision 9f08122750310ba06e28e435c3c4bdf5e873d99b) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Providers/VariableDefaultsProvider.cs (.../VariableDefaultsProvider.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -142,6 +142,35 @@ } }, { + HydraRingFailureMechanismType.DikesHeight, new Dictionary + { + { + 1, new VariableDefaults(300) + }, + { + 8, new VariableDefaults(300) + }, + { + 10, new VariableDefaults(300) + }, + { + 11, new VariableDefaults(300) + }, + { + 12, new VariableDefaults(300) + }, + { + 17, new VariableDefaults(300) + }, + { + 120, new VariableDefaults(300) + }, + { + 123, new VariableDefaults(300) + } + } + }, + { HydraRingFailureMechanismType.DikesPiping, new Dictionary { { Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r150366ef474f9522b3af857c29e3eac484910700 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 150366ef474f9522b3af857c29e3eac484910700) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -56,6 +56,7 @@ + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs =================================================================== diff -u -r759de5bbd411b0140aa72d2887a026f3e4b3eb97 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs (.../HydraRingFailureMechanismTypeTest.cs) (revision 759de5bbd411b0140aa72d2887a026f3e4b3eb97) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs (.../HydraRingFailureMechanismTypeTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -29,9 +29,9 @@ public class HydraRingFailureMechanismTypeTest { [Test] - public void Values_HasTen() + public void Values_HasEleven() { - Assert.AreEqual(10, Enum.GetValues(typeof(HydraRingFailureMechanismType)).Length); + Assert.AreEqual(11, Enum.GetValues(typeof(HydraRingFailureMechanismType)).Length); } } } \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -0,0 +1,142 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using MathNet.Numerics.Distributions; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Data.Input; +using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics; +using Ringtoets.HydraRing.Calculation.Data.Input.Overtopping; + +namespace Ringtoets.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class DikeHeightCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + var norm = 10000; + var expectedBeta = -Normal.InvCDF(0.0, 1.0, 1.0 / norm); + int hydraulicBoundaryLocationId = 1000; + HydraRingSection expectedHydraRingSection = new HydraRingSection(1, double.NaN, double.NaN); + + const double modelFactorCriticalOvertopping = 1; + const double factorFnMean = 4.75; + const double factorFnStandardDeviation = 0.5; + const double hydraRingFactorFnMean = 2.6; + const double hydraRingFactorFnStandardDeviation = 0.35; + const double hydraRingmodelFactorOvertopping = 1; + const double criticalOvertoppingMean = 22.22; + const double criticalOvertoppingStandardDeviation = 33.33; + const double hydraRingModelFactorFrunupMean = 1; + const double hydraRingModelFactorFrunupStandardDeviation = 0.07; + const double hydraRingExponentModelFactorShallowMean = 0.92; + const double hydraRingExponentModelFactorShallowStandardDeviation = 0.24; + var expectedRingProfilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var expectedRingForelandPoints = new List + { + new HydraRingForelandPoint(2.2, 3.3) + }; + var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); + + // Call + DikeHeightCalculationInput dikeHeightCalculationInput = new DikeHeightCalculationInput(hydraulicBoundaryLocationId, norm, expectedHydraRingSection, + modelFactorCriticalOvertopping, factorFnMean, factorFnStandardDeviation, + hydraRingFactorFnMean, hydraRingFactorFnStandardDeviation, hydraRingmodelFactorOvertopping, + criticalOvertoppingMean, criticalOvertoppingStandardDeviation, hydraRingModelFactorFrunupMean, + hydraRingModelFactorFrunupStandardDeviation, hydraRingExponentModelFactorShallowMean, + hydraRingExponentModelFactorShallowStandardDeviation, expectedRingProfilePoints, + expectedRingForelandPoints, expectedRingBreakWater); + + // Assert + const int expectedCalculationTypeId = 2; + const int expectedVariableId = 1; + Assert.IsInstanceOf(dikeHeightCalculationInput); + Assert.AreEqual(expectedCalculationTypeId, dikeHeightCalculationInput.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, dikeHeightCalculationInput.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.DikesHeight, dikeHeightCalculationInput.FailureMechanismType); + Assert.AreEqual(expectedVariableId, dikeHeightCalculationInput.VariableId); + Assert.IsNotNull(dikeHeightCalculationInput.Section); + CheckDikeHeightVariables(GetDefaultDikeHeightVariables().ToArray(), dikeHeightCalculationInput.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, dikeHeightCalculationInput.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, dikeHeightCalculationInput.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, dikeHeightCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, dikeHeightCalculationInput.Beta); + + var hydraRingSection = dikeHeightCalculationInput.Section; + Assert.AreEqual(expectedHydraRingSection, hydraRingSection); + } + + [Test] + [TestCase(101, null)] + [TestCase(102, 94)] + [TestCase(103, 95)] + [TestCase(104, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + HydraRingSection hydraRingSection = new HydraRingSection(1, double.NaN, double.NaN); + + // Call + DikeHeightCalculationInput dikeHeightCalculationInput = new DikeHeightCalculationInput(1, 1000, hydraRingSection, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1)); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, dikeHeightCalculationInput.GetSubMechanismModelId(subMechanismModelId)); + } + + private void CheckDikeHeightVariables(HydraRingVariable[] expected, HydraRingVariable[] actual) + { + Assert.AreEqual(expected.Length, actual.Length); + for (int i = 0; i < expected.Length; i++) + { + Assert.AreEqual(expected[i].Value, actual[i].Value, 1e-6); + Assert.AreEqual(expected[i].DeviationType, actual[i].DeviationType); + Assert.AreEqual(expected[i].DistributionType, actual[i].DistributionType); + Assert.AreEqual(expected[i].Mean, actual[i].Mean, 1e-6); + Assert.AreEqual(expected[i].Shift, actual[i].Shift, 1e-6); + Assert.AreEqual(expected[i].Variability, actual[i].Variability, 1e-6); + Assert.AreEqual(expected[i].VariableId, actual[i].VariableId, 1e-6); + } + } + + private IEnumerable GetDefaultDikeHeightVariables() + { + yield return new HydraRingVariable(1, HydraRingDistributionType.Deterministic, 0, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(8, HydraRingDistributionType.Deterministic, 1.0, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(10, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 4.75, 0.5, double.NaN); + yield return new HydraRingVariable(11, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 2.6, 0.35, double.NaN); + yield return new HydraRingVariable(12, HydraRingDistributionType.Deterministic, 1.0, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(17, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Standard, 22.22, 33.33, double.NaN); + yield return new HydraRingVariable(120, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Variation, 1, 0.07, double.NaN); + yield return new HydraRingVariable(123, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 0.92, 0.24, double.NaN); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs =================================================================== diff -u -r150366ef474f9522b3af857c29e3eac484910700 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (.../HydraRingConfigurationServiceIntegrationTest.cs) (revision 150366ef474f9522b3af857c29e3eac484910700) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (.../HydraRingConfigurationServiceIntegrationTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -225,7 +225,122 @@ Assert.AreEqual(expectedCreationScript, creationScript); } } + + [Test] + public void GenerateDataBaseCreationScript_HydraRingConfigurationWithDikeHeightCalculation_ReturnsExpectedCreationScript() + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService("34-1", HydraRingTimeIntegrationSchemeType.FerryBorgesCastanheta, HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + var hydraRingSection = new HydraRingSection(1, 2.2, 3.3); + const double norm = 1000; + const double modelFactorCriticalOvertopping = 1; + const double factorFnMean = 4.75; + const double factorFnStandardDeviation = 0.5; + const double hydraRingFactorFnMean = 2.6; + const double hydraRingFactorFnStandardDeviation = 0.35; + const double hydraRingmodelFactorOvertopping = 1; + const double criticalOvertoppingMean = 22.22; + const double criticalOvertoppingStandardDeviation = 33.33; + const double hydraRingModelFactorFrunupMean = 1; + const double hydraRingModelFactorFrunupStandardDeviation = 0.07; + const double hydraRingExponentModelFactorShallowMean = 0.92; + const double hydraRingExponentModelFactorShallowStandardDeviation = 0.24; + var profilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput(new DikeHeightCalculationInput(hydraulicBoundaryLocationId, norm, hydraRingSection, + modelFactorCriticalOvertopping, factorFnMean, factorFnStandardDeviation, hydraRingFactorFnMean, hydraRingFactorFnStandardDeviation, + hydraRingmodelFactorOvertopping, criticalOvertoppingMean, criticalOvertoppingStandardDeviation, hydraRingModelFactorFrunupMean, + hydraRingModelFactorFrunupStandardDeviation, hydraRingExponentModelFactorShallowMean, hydraRingExponentModelFactorShallowStandardDeviation, + profilePoints, forelandPoints, breakWater)); + + var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 101, 1, 1, 2, 1, 0, 0, 0, 0, 5, 15, 3.09023230616781);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 102, 1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 20000, 100000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 103, 1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 20000, 100000, 0.1, -6, 6, 25);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 1, 0, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 8, 1, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 10, 0, 2, 4.75, 0.5, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 11, 0, 2, 2.6, 0.35, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 12, 1, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 17, 0, 4, 22.22, 33.33, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 120, 0, 2, 1, NULL, NULL, NULL, 0, 0.07, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 123, 0, 2, 0.92, 0.24, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 101, 1, 1, 1017);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 102, 94);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 103, 95);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + var databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDataBaseCreationScript(databaseFilePath); + + // Assert + var creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + [Test] public void GenerateDataBaseCreationScript_HydraRingConfigurationWithStructuresOvertoppingCalculationCalculation_ReturnsExpectedCreationScript() { Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs =================================================================== diff -u -ra02bc3699e3ded023af30aced1e28e1676a39307 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs (.../FailureMechanismDefaultsProviderTest.cs) (revision a02bc3699e3ded023af30aced1e28e1676a39307) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs (.../FailureMechanismDefaultsProviderTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -56,6 +56,11 @@ 102, 103 })] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 101, new[] + { + 102, + 103 + })] [TestCase(HydraRingFailureMechanismType.DikesPiping, 103, new[] { 311, Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismSettingsProviderTest.cs =================================================================== diff -u -r95ef650c982927603a743b7ccd4f43b45a616f56 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismSettingsProviderTest.cs (.../FailureMechanismSettingsProviderTest.cs) (revision 95ef650c982927603a743b7ccd4f43b45a616f56) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismSettingsProviderTest.cs (.../FailureMechanismSettingsProviderTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -34,6 +34,7 @@ [TestCase(HydraRingFailureMechanismType.WavePeakPeriod, 5.0, 15.0, 14)] [TestCase(HydraRingFailureMechanismType.WaveSpectralPeriod, 5.0, 15.0, 16)] [TestCase(HydraRingFailureMechanismType.DikesOvertopping, double.NaN, double.NaN, 1017)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 5.0, 15.0, 1017)] [TestCase(HydraRingFailureMechanismType.DikesPiping, double.NaN, double.NaN, 3015)] [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, double.NaN, double.NaN, 4404)] [TestCase(HydraRingFailureMechanismType.StructuresClosure, double.NaN, double.NaN, 4505)] Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/SubMechanismSettingsProviderTest.cs =================================================================== diff -u -rde737ee4b24659d188bb137d385572159bc099ff -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/SubMechanismSettingsProviderTest.cs (.../SubMechanismSettingsProviderTest.cs) (revision de737ee4b24659d188bb137d385572159bc099ff) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/SubMechanismSettingsProviderTest.cs (.../SubMechanismSettingsProviderTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -66,6 +66,8 @@ [TestCase(HydraRingFailureMechanismType.WaveSpectralPeriod, 16, 1, 4)] [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 102, 1, 4)] [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 103, 1, 4)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 102, 1, 4)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 103, 1, 4)] [TestCase(HydraRingFailureMechanismType.DikesPiping, 311, 1, 4)] [TestCase(HydraRingFailureMechanismType.DikesPiping, 313, 1, 4)] [TestCase(HydraRingFailureMechanismType.DikesPiping, 314, 1, 4)] Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs =================================================================== diff -u -r9f08122750310ba06e28e435c3c4bdf5e873d99b -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs (.../VariableDefaultsProviderTest.cs) (revision 9f08122750310ba06e28e435c3c4bdf5e873d99b) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs (.../VariableDefaultsProviderTest.cs) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -52,6 +52,14 @@ [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 17, 300)] [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 120, 300)] [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 123, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 1, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 8, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 10, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 11, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 12, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 17, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 120, 300)] + [TestCase(HydraRingFailureMechanismType.DikesHeight, 123, 300)] [TestCase(HydraRingFailureMechanismType.DikesPiping, 23, 6000)] [TestCase(HydraRingFailureMechanismType.DikesPiping, 42, 999999)] [TestCase(HydraRingFailureMechanismType.DikesPiping, 43, 999999)] Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -r150366ef474f9522b3af857c29e3eac484910700 -r8692161b4e1e558746fcca9d3204c33d606fb311 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 150366ef474f9522b3af857c29e3eac484910700) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 8692161b4e1e558746fcca9d3204c33d606fb311) @@ -62,6 +62,7 @@ +