// 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; using Core.Common.Base.Data; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.Data.Structures; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.ClosingStructures.Data { /// /// Class that holds all closing structures calculation specific input parameters. /// public class ClosingStructuresInput : StructuresInputBase { private readonly NormalDistribution thresholdHeightOpenWeir; private readonly NormalDistribution drainCoefficient; private readonly LogNormalDistribution areaFlowApertures; private readonly NormalDistribution levelCrestStructureNotClosing; private readonly NormalDistribution insideWaterLevel; private RoundedDouble factorStormDurationOpenStructure; private double failureProbabilityOpenStructure; private double failureProbabilityReparation; private double probabilityOrFrequencyOpenStructureBeforeFlooding; private RoundedDouble deviationWaveDirection; /// /// Creates a new instance of the class. /// public ClosingStructuresInput() { factorStormDurationOpenStructure = new RoundedDouble(2, 1.0); deviationWaveDirection = new RoundedDouble(2); failureProbabilityOpenStructure = 0; failureProbabilityReparation = 0; probabilityOrFrequencyOpenStructureBeforeFlooding = 1.0; thresholdHeightOpenWeir = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble) 0.1 }; drainCoefficient = new NormalDistribution(2) { Mean = (RoundedDouble) 1, StandardDeviation = (RoundedDouble) 0.2 }; areaFlowApertures = new LogNormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble) 0.01 }; levelCrestStructureNotClosing = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble) 0.05 }; insideWaterLevel = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = (RoundedDouble) 0.1 }; } #region Structure /// /// Gets or sets the type of closing structure inflow model. /// public ClosingStructureInflowModelType InflowModelType { get; set; } #endregion protected override void UpdateStructureParameters() { if (Structure != null) { StructureNormalOrientation = Structure.StructureNormalOrientation; LevelCrestStructureNotClosing = Structure.LevelCrestStructureNotClosing; FlowWidthAtBottomProtection = Structure.FlowWidthAtBottomProtection; CriticalOvertoppingDischarge = Structure.CriticalOvertoppingDischarge; WidthFlowApertures = Structure.WidthFlowApertures; StorageStructureArea = Structure.StorageStructureArea; AllowedLevelIncreaseStorage = Structure.AllowedLevelIncreaseStorage; InflowModelType = Structure.InflowModelType; AreaFlowApertures = Structure.AreaFlowApertures; FailureProbabilityOpenStructure = Structure.FailureProbabilityOpenStructure; FailureProbabilityReparation = Structure.FailureProbabilityReparation; IdenticalApertures = Structure.IdenticalApertures; InsideWaterLevel = Structure.InsideWaterLevel; ProbabilityOrFrequencyOpenStructureBeforeFlooding = Structure.ProbabilityOrFrequencyOpenStructureBeforeFlooding; ThresholdHeightOpenWeir = Structure.ThresholdHeightOpenWeir; } } #region Hydraulic data /// /// Gets or sets the inside water level. /// [m+NAP] /// public NormalDistribution InsideWaterLevel { get { return insideWaterLevel; } set { insideWaterLevel.Mean = value.Mean; insideWaterLevel.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the deviation of the wave direction. /// [degrees] /// public RoundedDouble DeviationWaveDirection { get { return deviationWaveDirection; } set { RoundedDouble newDeviationWaveDirection = value.ToPrecision(deviationWaveDirection.NumberOfDecimalPlaces); if (!double.IsNaN(newDeviationWaveDirection) && (Math.Abs(newDeviationWaveDirection) > 360)) { throw new ArgumentOutOfRangeException("value", RingtoetsCommonDataResources.DeviationWaveDirection_Value_needs_to_be_between_negative_360_and_positive_360); } deviationWaveDirection = newDeviationWaveDirection; } } #endregion #region Model factors /// /// Gets or sets the drain coefficient. /// /// Only sets the mean. public NormalDistribution DrainCoefficient { get { return drainCoefficient; } set { drainCoefficient.Mean = value.Mean; } } /// /// Gets or sets the factor for the storm duration for an open structure. /// public RoundedDouble FactorStormDurationOpenStructure { get { return factorStormDurationOpenStructure; } set { factorStormDurationOpenStructure = value.ToPrecision(factorStormDurationOpenStructure.NumberOfDecimalPlaces); } } #endregion #region Schematization /// /// Gets or sets the threshold height of the open weir. /// [m+NAP] /// public NormalDistribution ThresholdHeightOpenWeir { get { return thresholdHeightOpenWeir; } set { thresholdHeightOpenWeir.Mean = value.Mean; thresholdHeightOpenWeir.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the area flow apertures. /// [m^2] /// public LogNormalDistribution AreaFlowApertures { get { return areaFlowApertures; } set { areaFlowApertures.Mean = value.Mean; areaFlowApertures.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the failure probability of an open structure. /// [1/year] /// /// Thrown when the value of the probability /// is not in the interval [0, 1]. public double FailureProbabilityOpenStructure { get { return failureProbabilityOpenStructure; } set { if (!ValidProbabilityValue(value)) { throw new ArgumentOutOfRangeException("value", RingtoetsCommonDataResources.FailureProbability_Value_needs_to_be_between_0_and_1); } failureProbabilityOpenStructure = value; } } /// /// Gets or sets the reparation failure probability. /// [1/year] /// /// Thrown when the value of the probability /// is not in the interval [0, 1]. public double FailureProbabilityReparation { get { return failureProbabilityReparation; } set { if (!ValidProbabilityValue(value)) { throw new ArgumentOutOfRangeException("value", RingtoetsCommonDataResources.FailureProbability_Value_needs_to_be_between_0_and_1); } failureProbabilityReparation = value; } } /// /// Gets or sets the amount of identical apertures. /// public int IdenticalApertures { get; set; } /// /// Gets or sets the level of crest of the structures that are not closed. /// [m+NAP] /// public NormalDistribution LevelCrestStructureNotClosing { get { return levelCrestStructureNotClosing; } set { levelCrestStructureNotClosing.Mean = value.Mean; levelCrestStructureNotClosing.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the failure probability or frequency of an open structure before flooding. /// /// Thrown when the value of the probability /// is not in the interval [0, 1]. public double ProbabilityOrFrequencyOpenStructureBeforeFlooding { get { return probabilityOrFrequencyOpenStructureBeforeFlooding; } set { if (!ValidProbabilityValue(value)) { throw new ArgumentOutOfRangeException("value", RingtoetsCommonDataResources.FailureProbability_Value_needs_to_be_between_0_and_1); } probabilityOrFrequencyOpenStructureBeforeFlooding = value; } } #endregion } }