// Copyright (C) Stichting Deltares 2017. 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;
using Ringtoets.Common.Data.Probabilistics;
using BaseConstructionProperties = Ringtoets.Common.Data.StructureBase.ConstructionProperties;
namespace Ringtoets.ClosingStructures.Data
{
///
/// Definition of a closing structure for the
///
public class ClosingStructure : StructureBase
{
///
/// Initializes a new instance of the class.
///
/// The construction properties.
/// Thrown when
/// or is null, empty or consists of whitespace.
/// Thrown when is null.
public ClosingStructure(ConstructionProperties constructionProperties) : base(constructionProperties)
{
StorageStructureArea = new VariationCoefficientLogNormalDistribution(2)
{
Mean = constructionProperties.StorageStructureArea.Mean,
CoefficientOfVariation = constructionProperties.StorageStructureArea.CoefficientOfVariation
};
AllowedLevelIncreaseStorage = new LogNormalDistribution(2)
{
Mean = constructionProperties.AllowedLevelIncreaseStorage.Mean,
StandardDeviation = constructionProperties.AllowedLevelIncreaseStorage.StandardDeviation
};
WidthFlowApertures = new NormalDistribution(2)
{
Mean = constructionProperties.WidthFlowApertures.Mean,
StandardDeviation = constructionProperties.WidthFlowApertures.StandardDeviation
};
LevelCrestStructureNotClosing = new NormalDistribution(2)
{
Mean = constructionProperties.LevelCrestStructureNotClosing.Mean,
StandardDeviation = constructionProperties.LevelCrestStructureNotClosing.StandardDeviation
};
InsideWaterLevel = new NormalDistribution(2)
{
Mean = constructionProperties.InsideWaterLevel.Mean,
StandardDeviation = constructionProperties.InsideWaterLevel.StandardDeviation
};
ThresholdHeightOpenWeir = new NormalDistribution(2)
{
Mean = constructionProperties.ThresholdHeightOpenWeir.Mean,
StandardDeviation = constructionProperties.ThresholdHeightOpenWeir.StandardDeviation
};
AreaFlowApertures = new LogNormalDistribution(2)
{
Mean = constructionProperties.AreaFlowApertures.Mean,
StandardDeviation = constructionProperties.AreaFlowApertures.StandardDeviation
};
CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2)
{
Mean = constructionProperties.CriticalOvertoppingDischarge.Mean,
CoefficientOfVariation = constructionProperties.CriticalOvertoppingDischarge.CoefficientOfVariation
};
FlowWidthAtBottomProtection = new LogNormalDistribution(2)
{
Mean = constructionProperties.FlowWidthAtBottomProtection.Mean,
StandardDeviation = constructionProperties.FlowWidthAtBottomProtection.StandardDeviation
};
ProbabilityOrFrequencyOpenStructureBeforeFlooding = constructionProperties.ProbabilityOrFrequencyOpenStructureBeforeFlooding;
FailureProbabilityOpenStructure = constructionProperties.FailureProbabilityOpenStructure;
IdenticalApertures = constructionProperties.IdenticalApertures;
FailureProbabilityReparation = constructionProperties.FailureProbabilityReparation;
InflowModelType = constructionProperties.InflowModelType;
}
///
/// Gets the storage area of the closing structure.
/// [m^2]
///
public VariationCoefficientLogNormalDistribution StorageStructureArea { get; }
///
/// Gets the allowed increase of level for storage of the closing structure.
/// [m]
///
public LogNormalDistribution AllowedLevelIncreaseStorage { get; }
///
/// Gets the width of the flow apertures of the closing structure.
/// [m]
///
public NormalDistribution WidthFlowApertures { get; }
///
/// Gets the crest level of the opened closing structure.
/// [m+NAP]
///
public NormalDistribution LevelCrestStructureNotClosing { get; }
///
/// Gets the interior water level of the closing structure.
/// [m+NAP]
///
public NormalDistribution InsideWaterLevel { get; }
///
/// Gets the threshold height of the opened closing structure.
/// [m+NAP]
///
public NormalDistribution ThresholdHeightOpenWeir { get; }
///
/// Gets the area of the flow aperture of the closing structure.
/// [m^2]
///
public LogNormalDistribution AreaFlowApertures { get; }
///
/// Gets the critical overtopping discharge per meter of the closing structure.
/// [m^3/s/m]
///
public VariationCoefficientLogNormalDistribution CriticalOvertoppingDischarge { get; }
///
/// Gets the flow width of the closing structure at the bottom protection.
/// [m]
///
public LogNormalDistribution FlowWidthAtBottomProtection { get; }
///
/// Gets the probability or frequency of the closing structure being open before flooding.
/// [1/year]
///
/// Because this property can also be used to denote a frequency, there
/// is no guarantee that this property returns a value in the range [0.0, 1.0]
/// nor that formal rules of probability apply.
public double ProbabilityOrFrequencyOpenStructureBeforeFlooding { get; private set; }
///
/// Gets the probability of failing to close the closing structure.
/// [1/year]
///
public double FailureProbabilityOpenStructure { get; private set; }
///
/// Gets the number of identical apertures of the closing structure.
///
public int IdenticalApertures { get; private set; }
///
/// Gets the probability of failing to repair a failed closure of the closing structure.
/// [1/year]
///
public double FailureProbabilityReparation { get; private set; }
///
/// Gets the type of closing structure inflow model.
///
public ClosingStructureInflowModelType InflowModelType { get; private set; }
///
/// Copies the property values of the to the
/// .
///
/// The to get the property
/// values from.
/// Thrown when
/// is null.
public void CopyProperties(ClosingStructure fromStructure)
{
base.CopyProperties(fromStructure);
AllowedLevelIncreaseStorage.Mean = fromStructure.AllowedLevelIncreaseStorage.Mean;
AllowedLevelIncreaseStorage.StandardDeviation = fromStructure.AllowedLevelIncreaseStorage.StandardDeviation;
AreaFlowApertures.Mean = fromStructure.AreaFlowApertures.Mean;
AreaFlowApertures.StandardDeviation = fromStructure.AreaFlowApertures.StandardDeviation;
CriticalOvertoppingDischarge.Mean = fromStructure.CriticalOvertoppingDischarge.Mean;
CriticalOvertoppingDischarge.CoefficientOfVariation = fromStructure.CriticalOvertoppingDischarge.CoefficientOfVariation;
FailureProbabilityOpenStructure = fromStructure.FailureProbabilityOpenStructure;
FailureProbabilityReparation = fromStructure.FailureProbabilityReparation;
IdenticalApertures = fromStructure.IdenticalApertures;
FlowWidthAtBottomProtection.Mean = fromStructure.FlowWidthAtBottomProtection.Mean;
FlowWidthAtBottomProtection.StandardDeviation = fromStructure.FlowWidthAtBottomProtection.StandardDeviation;
InflowModelType = fromStructure.InflowModelType;
InsideWaterLevel.Mean = fromStructure.InsideWaterLevel.Mean;
InsideWaterLevel.StandardDeviation = fromStructure.InsideWaterLevel.StandardDeviation;
LevelCrestStructureNotClosing.Mean = fromStructure.LevelCrestStructureNotClosing.Mean;
LevelCrestStructureNotClosing.StandardDeviation = fromStructure.LevelCrestStructureNotClosing.StandardDeviation;
ProbabilityOrFrequencyOpenStructureBeforeFlooding = fromStructure.ProbabilityOrFrequencyOpenStructureBeforeFlooding;
StorageStructureArea.Mean = fromStructure.StorageStructureArea.Mean;
StorageStructureArea.CoefficientOfVariation = fromStructure.StorageStructureArea.CoefficientOfVariation;
ThresholdHeightOpenWeir.Mean = fromStructure.ThresholdHeightOpenWeir.Mean;
ThresholdHeightOpenWeir.StandardDeviation = fromStructure.ThresholdHeightOpenWeir.StandardDeviation;
WidthFlowApertures.Mean = fromStructure.WidthFlowApertures.Mean;
WidthFlowApertures.StandardDeviation = fromStructure.WidthFlowApertures.StandardDeviation;
}
public override bool Equals(object obj)
{
return base.Equals(obj) && Equals((ClosingStructure) obj);
}
public override int GetHashCode()
{
unchecked
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ AllowedLevelIncreaseStorage.GetHashCode();
hashCode = (hashCode * 397) ^ AreaFlowApertures.GetHashCode();
hashCode = (hashCode * 397) ^ CriticalOvertoppingDischarge.GetHashCode();
hashCode = (hashCode * 397) ^ FailureProbabilityOpenStructure.GetHashCode();
hashCode = (hashCode * 397) ^ FailureProbabilityReparation.GetHashCode();
hashCode = (hashCode * 397) ^ IdenticalApertures.GetHashCode();
hashCode = (hashCode * 397) ^ FlowWidthAtBottomProtection.GetHashCode();
hashCode = (hashCode * 397) ^ InflowModelType.GetHashCode();
hashCode = (hashCode * 397) ^ InsideWaterLevel.GetHashCode();
hashCode = (hashCode * 397) ^ LevelCrestStructureNotClosing.GetHashCode();
hashCode = (hashCode * 397) ^ ProbabilityOrFrequencyOpenStructureBeforeFlooding.GetHashCode();
hashCode = (hashCode * 397) ^ StorageStructureArea.GetHashCode();
hashCode = (hashCode * 397) ^ ThresholdHeightOpenWeir.GetHashCode();
hashCode = (hashCode * 397) ^ WidthFlowApertures.GetHashCode();
return hashCode;
}
}
private bool Equals(ClosingStructure other)
{
return AllowedLevelIncreaseStorage.Equals(other.AllowedLevelIncreaseStorage)
&& AreaFlowApertures.Equals(other.AreaFlowApertures)
&& CriticalOvertoppingDischarge.Equals(other.CriticalOvertoppingDischarge)
&& FailureProbabilityOpenStructure.Equals(other.FailureProbabilityOpenStructure)
&& FailureProbabilityReparation.Equals(other.FailureProbabilityReparation)
&& IdenticalApertures.Equals(other.IdenticalApertures)
&& FlowWidthAtBottomProtection.Equals(other.FlowWidthAtBottomProtection)
&& InflowModelType.Equals(other.InflowModelType)
&& InsideWaterLevel.Equals(other.InsideWaterLevel)
&& LevelCrestStructureNotClosing.Equals(other.LevelCrestStructureNotClosing)
&& ProbabilityOrFrequencyOpenStructureBeforeFlooding.Equals(other.ProbabilityOrFrequencyOpenStructureBeforeFlooding)
&& StorageStructureArea.Equals(other.StorageStructureArea)
&& ThresholdHeightOpenWeir.Equals(other.ThresholdHeightOpenWeir)
&& WidthFlowApertures.Equals(other.WidthFlowApertures);
}
///
/// Class holding the various construction parameters for .
///
public new class ConstructionProperties : BaseConstructionProperties
{
///
/// Initializes a new instance of the class.
///
public ConstructionProperties()
{
StorageStructureArea = new VariationCoefficientLogNormalDistribution(2)
{
Mean = RoundedDouble.NaN,
CoefficientOfVariation = (RoundedDouble) 0.1
};
AllowedLevelIncreaseStorage = new LogNormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.1
};
WidthFlowApertures = new NormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.2
};
LevelCrestStructureNotClosing = new NormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.05
};
InsideWaterLevel = new NormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.1
};
ThresholdHeightOpenWeir = new NormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.1
};
AreaFlowApertures = new LogNormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.01
};
CriticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2)
{
Mean = RoundedDouble.NaN,
CoefficientOfVariation = (RoundedDouble) 0.15
};
FlowWidthAtBottomProtection = new LogNormalDistribution(2)
{
Mean = RoundedDouble.NaN,
StandardDeviation = (RoundedDouble) 0.05
};
ProbabilityOrFrequencyOpenStructureBeforeFlooding = 1;
FailureProbabilityOpenStructure = 1;
IdenticalApertures = 1;
FailureProbabilityReparation = 1;
InflowModelType = ClosingStructureInflowModelType.VerticalWall;
}
///
/// Gets the storage area of the closing structure.
/// [m^2]
///
public VariationCoefficientLogNormalDistribution StorageStructureArea { get; }
///
/// Gets the allowed increase of level for storage of the closing structure.
/// [m]
///
public LogNormalDistribution AllowedLevelIncreaseStorage { get; }
///
/// Gets the width of the flow apertures of the closing structure.
/// [m]
///
public NormalDistribution WidthFlowApertures { get; }
///
/// Gets the crest level of the opened closing structure.
/// [m+NAP]
///
public NormalDistribution LevelCrestStructureNotClosing { get; }
///
/// Gets the interior water level of the closing structure.
/// [m+NAP]
///
public NormalDistribution InsideWaterLevel { get; }
///
/// Gets the threshold height of the opened closing structure.
/// [m+NAP]
///
public NormalDistribution ThresholdHeightOpenWeir { get; }
///
/// Gets the area of the flow aperture of the closing structure.
/// [m^2]
///
public LogNormalDistribution AreaFlowApertures { get; }
///
/// Gets the critical overtopping discharge per meter of the closing structure.
/// [m^3/s/m]
///
public VariationCoefficientLogNormalDistribution CriticalOvertoppingDischarge { get; }
///
/// Gets the flow width of the closing structure at the bottom protection.
/// [m]
///
public LogNormalDistribution FlowWidthAtBottomProtection { get; }
///
/// Gets or sets the probability or frequency of the closing structure being open before flooding.
/// [1/year]
///
/// Because this property can also be used to denote a frequency, there
/// is no guarantee that this property returns a value in the range [0.0, 1.0]
/// nor that formal rules of probability apply.
public double ProbabilityOrFrequencyOpenStructureBeforeFlooding { get; set; }
///
/// Gets or sets the probability of failing to close the closing structure.
/// [1/year]
///
public double FailureProbabilityOpenStructure { get; set; }
///
/// Gets or sets the number of identical apertures of the closing structure.
///
public int IdenticalApertures { get; set; }
///
/// Gets or sets the probability of failing to repair a failed closure of the closing structure.
/// [1/year]
///
public double FailureProbabilityReparation { get; set; }
///
/// Gets or sets the type of closing structure inflow model.
///
public ClosingStructureInflowModelType InflowModelType { get; set; }
}
}
}