Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInput.cs =================================================================== diff -u --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInput.cs (revision 0) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInput.cs (revision 005a3c4605da079014376d3ba779cb1478dcdaec) @@ -0,0 +1,146 @@ +// 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; + +namespace Ringtoets.HydraRing.Calculation.Data.Input.Structures +{ + /// + /// Container of all data necessary for performing a flooded culvert based structures closure calculation via Hydra-Ring. + /// + public class StructuresClosureFloodedCulvertCalculationInput : StructuresClosureCalculationInput + { + private readonly double drainCoefficientMean; + private readonly double drainCoefficientStandardDeviation; + private readonly double areaFlowAperturesMean; + private readonly double areaFlowAperturesStandardDeviation; + private readonly double waterLevelInsideMean; + private readonly double waterLevelInsideStandardDeviation; + + /// + /// Creates a new instance of . + /// + /// The id of the hydraulic station to use during the calculation. + /// The section to use during the calculation. + /// The gravitational acceleration to use during the calculation. + /// The factor of the storm duration for an open structure to use during the calculation. + /// The failure probability for an open structure to use during the calculation. + /// The reparation failure probabilty to use during the calculation. + /// The identical aperture to use during the calculation. + /// The mean of the allowable increase of the level for the storage to use during the calculation. + /// The standard deviation of the allowable increase of the level for the storage to use during the calculation. + /// The mean of the model factor for the storage volume to use during the calculation. + /// The standard deviation of the model factor for the storage volume to use during the calculation. + /// The mean of the storage structure area to use during the calculation. + /// The variation of the storage structure area to use during the calculation. + /// The model factor for incoming flow volume to use during the calculation. + /// The mean of the flow width at bottom protection to use during the calculation. + /// The standard deviation of the flow width at bottom protection to use during the calculation. + /// The mean of the critical overtopping discharge to use during the calculation. + /// The variation of the critical overtopping discharge to use during the calculation. + /// The failure probability of structure given erosion to use during the calculation. + /// The mean of the storm duration to use during the calculation. + /// The variation of the storm duration to use during the calculation. + /// The propability of an open structure before flooding to use during the calculation. + /// The mean of the drain coefficient to use during the calculation. + /// The standard deviation of the drain coefficient to use during the calculation. + /// The mean of the area of flow apertures to use during the calculation. + /// The standard diviation of the area of flow apertures to use during the calculation. + /// The mean of the waterlevel inside to use during the calculation. + /// The standard deviation of the waterlevel inside to use during the calculation. + public StructuresClosureFloodedCulvertCalculationInput(long hydraulicBoundaryLocationId, HydraRingSection hydraRingSection, + double hydraRingGravitationalAcceleration, double hydraRingFactorStormDurationOpenStructure, + double hydraRingFailureProbabilityOpenStructure, double hydraRingFailureProbabilityReparation, + double hydraRingIdenticalAperture, double hydraRingAllowableIncreaseOfLevelForStorageMean, + double hydraRingAllowableIncreaseOfLevelForStorageStandardDeviation, double hydraRingModelFactorForStorageVolumeMean, + double hydraRingModelFactorForStorageVolumeStandardDeviation, double hydraRingStorageStructureAreaMean, + double hydraRingStorageStructureAreaVariation, double hydraRingModelFactorForIncomingFlowVolume, + double hydraRingFlowWidthAtBottomProtectionMean, double hydraRingFlowWidthAtBottomProtectionStandardDeviation, + double hydraRingCriticalOvertoppingDischargeMean, double hydraRingCriticalOvertoppingDischargeVariation, + double hydraRingFailureProbabilityOfStructureGivenErosion, double hydraRingStormDurationMean, + double hydraRingStormDurationVariation, double hydraRingProbabilityOpenStructureBeforeFlooding, + double hydraRingDrainCoefficientMean, double hydraRingDrainCoefficientStandardDeviation, + double hydraRingAreaFlowAperturesMean, double hydraRingAreaFlowAperturesStandardDeviation, + double hydraRingWaterLevelInsideMean, double hydraRingWaterLevelInsideStandardDeviation) + : base(hydraulicBoundaryLocationId, hydraRingSection, + hydraRingGravitationalAcceleration, hydraRingFactorStormDurationOpenStructure, + hydraRingFailureProbabilityOpenStructure, hydraRingFailureProbabilityReparation, + hydraRingIdenticalAperture, hydraRingAllowableIncreaseOfLevelForStorageMean, + hydraRingAllowableIncreaseOfLevelForStorageStandardDeviation, hydraRingModelFactorForStorageVolumeMean, + hydraRingModelFactorForStorageVolumeStandardDeviation, hydraRingStorageStructureAreaMean, + hydraRingStorageStructureAreaVariation, hydraRingModelFactorForIncomingFlowVolume, + hydraRingFlowWidthAtBottomProtectionMean, hydraRingFlowWidthAtBottomProtectionStandardDeviation, + hydraRingCriticalOvertoppingDischargeMean, hydraRingCriticalOvertoppingDischargeVariation, + hydraRingFailureProbabilityOfStructureGivenErosion, hydraRingStormDurationMean, + hydraRingStormDurationVariation, hydraRingProbabilityOpenStructureBeforeFlooding) + { + drainCoefficientMean = hydraRingDrainCoefficientMean; + drainCoefficientStandardDeviation = hydraRingDrainCoefficientStandardDeviation; + areaFlowAperturesMean = hydraRingAreaFlowAperturesMean; + areaFlowAperturesStandardDeviation = hydraRingAreaFlowAperturesStandardDeviation; + waterLevelInsideMean = hydraRingWaterLevelInsideMean; + waterLevelInsideStandardDeviation = hydraRingWaterLevelInsideStandardDeviation; + } + + public override IEnumerable Variables + { + get + { + var variables = base.Variables.ToList(); + variables.AddRange(GetVariables()); + + return variables.OrderBy(v => v.VariableId); + } + } + + public override int? GetSubMechanismModelId(int subMechanismId) + { + switch (subMechanismId) + { + case 424: + return 107; + case 425: + return 113; + default: + return null; + } + } + + private IEnumerable GetVariables() + { + // Drain coefficient + yield return new HydraRingVariable(66, HydraRingDistributionType.Normal, double.NaN, + HydraRingDeviationType.Standard, drainCoefficientMean, + drainCoefficientStandardDeviation, double.NaN); + + // Area of flow apertures + yield return new HydraRingVariable(67, HydraRingDistributionType.LogNormal, + double.NaN, HydraRingDeviationType.Standard, areaFlowAperturesMean, + areaFlowAperturesStandardDeviation, double.NaN); + + // Waterlevel inside + yield return new HydraRingVariable(93, HydraRingDistributionType.Normal, double.NaN, + HydraRingDeviationType.Standard, waterLevelInsideMean, + waterLevelInsideStandardDeviation, double.NaN); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj =================================================================== diff -u -r8efa69259273360cbc69986142938d7e1e826b2a -r005a3c4605da079014376d3ba779cb1478dcdaec --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 8efa69259273360cbc69986142938d7e1e826b2a) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 005a3c4605da079014376d3ba779cb1478dcdaec) @@ -55,6 +55,7 @@ + Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs (revision 005a3c4605da079014376d3ba779cb1478dcdaec) @@ -0,0 +1,134 @@ +// 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 NUnit.Framework; +using Ringtoets.HydraRing.Calculation.Data; +using Ringtoets.HydraRing.Calculation.Data.Input.Structures; +using Ringtoets.HydraRing.Calculation.TestUtil; + +namespace Ringtoets.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresClosureFloodedCulvertCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + var hydraRingSection = new HydraRingSection(1, double.NaN, double.NaN); + + const double gravitationalAcceleration = 9.81; + const double factorStormDurationOpenStructure = 0.1; + const double failureProbabilityOpenStructure = 0.04; + const double failureProbabilityReparation = 0.08; + const double identicalAperture = 0.4; + const double allowableIncreaseOfLevelForStorageMean = 3.3; + const double allowableIncreaseOfLevelForStorageStandardDeviation = 0.1; + const double modelFactorForStorageVolumeMean = 1.0; + const double modelFactorForStorageVolumeStandardDeviation = 0.2; + const double storageStructureAreaMean = 4.4; + const double storageStructureAreaStandardDeviation = 0.1; + const double modelFactorForIncomingFlowVolume = 1; + const double flowWidthAtBottomProtectionMean = 5.5; + const double flowWidthAtBottomProtectionStandardDeviation = 0.05; + const double criticalOvertoppingDischargeMean = 6.6; + const double criticalOvertoppingDischargeMeanStandardDeviation = 0.15; + const double failureProbabilityOfStructureGivenErosion = 7.7; + const double stormDurationMean = 7.5; + const double stormDurationStandardDeviation = 0.25; + const double probabilityOpenStructureBeforeFlooding = 0.04; + const double drainCoefficientMean = 1; + const double drainCoefficientStandardDeviation = 0.2; + const double areaFlowAperturesMean = 0.4; + const double areaFlowAperturesStandardDeviation = 0.01; + const double waterLevelInsideMean = 4.3; + const double waterLevelInsideStandardDeviation = 0.1; + + // Call + var input = new StructuresClosureFloodedCulvertCalculationInput(hydraulicBoundaryLocationId, hydraRingSection, + gravitationalAcceleration, factorStormDurationOpenStructure, + failureProbabilityOpenStructure, failureProbabilityReparation, + identicalAperture, allowableIncreaseOfLevelForStorageMean, + allowableIncreaseOfLevelForStorageStandardDeviation, modelFactorForStorageVolumeMean, + modelFactorForStorageVolumeStandardDeviation, storageStructureAreaMean, + storageStructureAreaStandardDeviation, modelFactorForIncomingFlowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeMeanStandardDeviation, + failureProbabilityOfStructureGivenErosion, stormDurationMean, + stormDurationStandardDeviation, probabilityOpenStructureBeforeFlooding, + drainCoefficientMean, drainCoefficientStandardDeviation, + areaFlowAperturesMean, areaFlowAperturesStandardDeviation, + waterLevelInsideMean, waterLevelInsideStandardDeviation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(65, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresClosure, input.FailureMechanismType); + Assert.AreSame(hydraRingSection, input.Section); + HydraRingVariableAssert.AreEqual(GetDefaultOvertoppingVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 107)] + [TestCase(425, 113)] + [TestCase(426, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresClosureFloodedCulvertCalculationInput(111, new HydraRingSection(1, double.NaN, double.NaN), + 1.1, 222, 333, 5.5, 6.6, 7.7, 8.8, 11, 22, 33, 44, 55, + 66, 77, 88, 99, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); + + // Call + int? actualSubmechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubmechanismModelId); + } + + private static IEnumerable GetDefaultOvertoppingVariables() + { + yield return new HydraRingVariable(58, HydraRingDistributionType.Deterministic, 9.81, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(63, HydraRingDistributionType.Deterministic, double.NaN, HydraRingDeviationType.Standard, 0.1, double.NaN, double.NaN); + yield return new HydraRingVariable(66, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 1, 0.2, double.NaN); + yield return new HydraRingVariable(67, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Standard, 0.4, 0.01, double.NaN); + yield return new HydraRingVariable(68, HydraRingDistributionType.Deterministic, 0.04, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(69, HydraRingDistributionType.Deterministic, 0.08, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(71, HydraRingDistributionType.Deterministic, 0.4, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(93, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 4.3, 0.1, double.NaN); + yield return new HydraRingVariable(94, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Standard, 3.3, 0.1, double.NaN); + yield return new HydraRingVariable(95, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Standard, 1.0, 0.2, double.NaN); + yield return new HydraRingVariable(96, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Variation, 4.4, 0.1, double.NaN); + yield return new HydraRingVariable(97, HydraRingDistributionType.Deterministic, 1, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + yield return new HydraRingVariable(103, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 5.5, 0.05, double.NaN); + yield return new HydraRingVariable(104, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Variation, 6.6, 0.15, double.NaN); + yield return new HydraRingVariable(105, HydraRingDistributionType.Normal, double.NaN, HydraRingDeviationType.Standard, 7.7, 0, double.NaN); + yield return new HydraRingVariable(108, HydraRingDistributionType.LogNormal, double.NaN, HydraRingDeviationType.Variation, 7.5, 0.25, double.NaN); + yield return new HydraRingVariable(129, HydraRingDistributionType.Deterministic, 0.04, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj =================================================================== diff -u -r8efa69259273360cbc69986142938d7e1e826b2a -r005a3c4605da079014376d3ba779cb1478dcdaec --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 8efa69259273360cbc69986142938d7e1e826b2a) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 005a3c4605da079014376d3ba779cb1478dcdaec) @@ -59,6 +59,7 @@ +