Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingSemiProbabilisticDesignValueFactory.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingSemiProbabilisticDesignValueFactory.cs (.../PipingSemiProbabilisticDesignValueFactory.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingSemiProbabilisticDesignValueFactory.cs (.../PipingSemiProbabilisticDesignValueFactory.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -13,34 +13,25 @@
///
/// Creates the design variable for .
///
- public static DesignVariable GetThicknessCoverageLayer(PipingData pipingData)
+ public static DesignVariable GetThicknessCoverageLayer(PipingData pipingData)
{
- return new DesignVariable(pipingData.ThicknessCoverageLayer)
- {
- Percentile = 0.05
- };
+ return CreateDesignVariable(pipingData.ThicknessCoverageLayer, 0.05);
}
///
/// Creates the design variable for .
///
- public static DesignVariable GetPhreaticLevelExit(PipingData pipingData)
+ public static DesignVariable GetPhreaticLevelExit(PipingData pipingData)
{
- return new DesignVariable(pipingData.PhreaticLevelExit)
- {
- Percentile = 0.05
- };
+ return CreateDesignVariable(pipingData.PhreaticLevelExit, 0.05);
}
///
/// Creates the design variable for .
///
- public static DesignVariable GetDampingFactorExit(PipingData pipingData)
+ public static DesignVariable GetDampingFactorExit(PipingData pipingData)
{
- return new DesignVariable(pipingData.DampingFactorExit)
- {
- Percentile = 0.95
- };
+ return CreateDesignVariable(pipingData.DampingFactorExit, 0.95);
}
#endregion
@@ -50,47 +41,51 @@
///
/// Creates the design variable for .
///
- public static DesignVariable GetSeepageLength(PipingData pipingData)
+ public static DesignVariable GetSeepageLength(PipingData pipingData)
{
- return new DesignVariable(pipingData.SeepageLength)
- {
- Percentile = 0.05
- };
+ return CreateDesignVariable(pipingData.SeepageLength, 0.05);
}
///
/// Creates the design variable for .
///
- public static DesignVariable GetDiameter70(PipingData pipingData)
+ public static DesignVariable GetDiameter70(PipingData pipingData)
{
- return new DesignVariable(pipingData.Diameter70)
- {
- Percentile = 0.05
- };
+ return CreateDesignVariable(pipingData.Diameter70, 0.05);
}
///
/// Creates the design variable for .
///
- public static DesignVariable GetDarcyPermeability(PipingData pipingData)
+ public static DesignVariable GetDarcyPermeability(PipingData pipingData)
{
- return new DesignVariable(pipingData.DarcyPermeability)
- {
- Percentile = 0.95
- };
+ return CreateDesignVariable(pipingData.DarcyPermeability, 0.95);
}
///
/// Creates the design variable for .
///
- public static DesignVariable GetThicknessAquiferLayer(PipingData pipingData)
+ public static DesignVariable GetThicknessAquiferLayer(PipingData pipingData)
{
- return new DesignVariable(pipingData.ThicknessAquiferLayer)
+ return CreateDesignVariable(pipingData.ThicknessAquiferLayer, 0.95);
+ }
+
+ #endregion
+
+ private static DesignVariable CreateDesignVariable(NormalDistribution distribution, double percentile)
+ {
+ return new NormalDistributionDesignVariable(distribution)
{
- Percentile = 0.95
+ Percentile = percentile
};
}
- #endregion
+ private static DesignVariable CreateDesignVariable(LognormalDistribution distribution, double percentile)
+ {
+ return new LognormalDistributionDesignVariable(distribution)
+ {
+ Percentile = percentile
+ };
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/DesignVariable.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/DesignVariable.cs (.../DesignVariable.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/DesignVariable.cs (.../DesignVariable.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -8,17 +8,17 @@
/// This class is a representation of a variable derived from a probabilistic distribution,
/// based on a percentile.
///
- public class DesignVariable
+ public abstract class DesignVariable where DistributionType : IDistribution
{
private double percentile;
- private IDistribution distribution;
+ private DistributionType distribution;
///
- /// Initializes a new instance of the class with
+ /// Initializes a new instance of the class with
/// equal to 0.5.
///
/// is null.
- public DesignVariable(IDistribution distribution)
+ protected DesignVariable(DistributionType distribution)
{
Distribution = distribution;
percentile = 0.5;
@@ -28,7 +28,7 @@
/// Gets or sets the probabilistic distribution of the parameter being modeled.
///
/// is null.
- public IDistribution Distribution
+ public DistributionType Distribution
{
get
{
@@ -67,9 +67,6 @@
/// Gets the design value based on the and .
///
/// A design value.
- public double GetDesignValue()
- {
- return Distribution.InverseCDF(Percentile);
- }
+ public abstract double GetDesignValue();
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/IDistribution.cs
===================================================================
diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/IDistribution.cs (.../IDistribution.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/IDistribution.cs (.../IDistribution.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -8,12 +8,14 @@
public interface IDistribution
{
///
- /// Performs the inverse Cumulative Density Function on the distribution, returning
- /// the concrete realization corresponding with the given probability.
+ /// Gets or sets the mean (expected value, E(X)) of the distribution.
///
- /// The probability, for which P(X<x) applies where x will be the returned result.
- /// The concrete realization value.
- /// is not in the range [0.0, 1.0].
- double InverseCDF(double p);
+ double Mean { get; set; }
+
+ ///
+ /// Gets or sets the standard deviation (square root of the Var(X)) of the distribution.
+ ///
+ /// Standard deviation is less then or equal to 0.
+ double StandardDeviation { get; set; }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistribution.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistribution.cs (.../LognormalDistribution.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistribution.cs (.../LognormalDistribution.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -1,7 +1,5 @@
using System;
-using MathNet.Numerics.Distributions;
-
using Ringtoets.Piping.Data.Properties;
namespace Ringtoets.Piping.Data.Probabilistics
@@ -12,48 +10,53 @@
public class LognormalDistribution : IDistribution
{
private double standardDeviation;
+ private double mean;
///
/// Initializes a new instance of the class,
- /// initialized as the standard log-normal distribution.
+ /// initialized as the standard log-normal distribution (mu=0, sigma=1).
///
public LognormalDistribution()
{
- Mean = 0.0;
- StandardDeviation = 1.0;
+ // Simplified calculation mean and standard deviation given mu=0 and sigma=1.
+ mean = Math.Exp(-0.5);
+ StandardDeviation = Math.Sqrt((Math.Exp(1) - 1) * Math.Exp(1));
}
///
- /// Gets or sets the mean (μ) of the distribution.
+ /// Gets or sets the mean (expected value, E(X)) of the distribution.
///
- public double Mean { get; set; }
-
- ///
- /// Gets or sets the standard deviation (σ) of the distribution.
- ///
- public double StandardDeviation
+ /// Expected value is less then or equal to 0.
+ public double Mean
{
get
{
- return standardDeviation;
+ return mean;
}
set
{
if (value <= 0)
{
- throw new ArgumentException(Resources.StandardDeviation_Should_be_greater_than_zero);
+ throw new ArgumentOutOfRangeException("value", Resources.LognormalDistribution_Mean_must_be_greater_equal_to_zero);
}
- standardDeviation = value;
+ mean = value;
}
}
- public virtual double InverseCDF(double p)
+ public double StandardDeviation
{
- if (p < 0.0 || p > 1)
+ get
{
- throw new ArgumentOutOfRangeException("p", Resources.IDistribution_InverseCDF_Probability_must_be_in_range);
+ return standardDeviation;
}
- return LogNormal.InvCDF(Mean, StandardDeviation, p);
+ set
+ {
+ if (value <= 0)
+ {
+ throw new ArgumentOutOfRangeException("value", Resources.StandardDeviation_Should_be_greater_than_zero);
+ }
+ standardDeviation = value;
+ }
}
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistributionDesignVariable.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistributionDesignVariable.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistributionDesignVariable.cs (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -0,0 +1,63 @@
+using System;
+
+namespace Ringtoets.Piping.Data.Probabilistics
+{
+ ///
+ /// This class defines a design variable for a lognormal distribution.
+ ///
+ public class LognormalDistributionDesignVariable : DesignVariable
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// A lognormal distribution.
+ public LognormalDistributionDesignVariable(LognormalDistribution distribution) : base(distribution) {}
+
+ public override double GetDesignValue()
+ {
+ var normalSpaceDesignValue = DetermineDesignValueInNormalDistributionSpace();
+ return ProjectFromNormalToLognormalSpace(normalSpaceDesignValue);
+ }
+
+ ///
+ /// Projects into 'normal
+ /// distribution' space and calculates the design value for that value space.
+ ///
+ /// The design value in 'normal distribution' space.
+ /// Design values can only be determined in 'normal distribution' space.
+ private double DetermineDesignValueInNormalDistributionSpace()
+ {
+ var normalDistribution = CreateNormalDistributionFromLognormalDistribution();
+ var normalDistributionDesignVariable = new NormalDistributionDesignVariable(normalDistribution)
+ {
+ Percentile = Percentile
+ };
+ return normalDistributionDesignVariable.GetDesignValue();
+ }
+
+ private static double ProjectFromNormalToLognormalSpace(double normalSpaceDesignValue)
+ {
+ return Math.Exp(normalSpaceDesignValue);
+ }
+
+ ///
+ /// Determine normal distribution parameters from log-normal parameters, as
+ /// design value can only be determined in 'normal distribution' space.
+ /// Below formula's come from Tu-Delft College dictaat "b3 Probabilistisch Ontwerpen"
+ /// by ir. A.C.W.M. Vrouwenvelder and ir.J.K. Vrijling 5th reprint 1987.
+ ///
+ /// A normal distribution based on the parameters of .
+ private NormalDistribution CreateNormalDistributionFromLognormalDistribution()
+ {
+ double sigmaLogOverMuLog = Distribution.StandardDeviation / Distribution.Mean;
+ double sigmaNormal = Math.Sqrt(Math.Log(sigmaLogOverMuLog * sigmaLogOverMuLog + 1.0));
+ double muNormal = Math.Log(Distribution.Mean) - 0.5 * sigmaNormal * sigmaNormal;
+
+ return new NormalDistribution
+ {
+ Mean = muNormal,
+ StandardDeviation = sigmaNormal
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistribution.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -1,7 +1,5 @@
using System;
-using MathNet.Numerics.Distributions;
-
using Ringtoets.Piping.Data.Properties;
namespace Ringtoets.Piping.Data.Probabilistics
@@ -23,14 +21,8 @@
StandardDeviation = 1.0;
}
- ///
- /// Gets or sets the mean (μ) of the distribution.
- ///
public double Mean { get; set; }
- ///
- /// Gets or sets the standard deviation (σ) of the distribution.
- ///
public double StandardDeviation
{
get
@@ -41,19 +33,10 @@
{
if (value <= 0)
{
- throw new ArgumentException(Resources.StandardDeviation_Should_be_greater_than_zero);
+ throw new ArgumentOutOfRangeException("value", Resources.StandardDeviation_Should_be_greater_than_zero);
}
standardDeviation = value;
}
}
-
- public double InverseCDF(double p)
- {
- if (p < 0.0 || p > 1)
- {
- throw new ArgumentOutOfRangeException("p", Resources.IDistribution_InverseCDF_Probability_must_be_in_range);
- }
- return Normal.InvCDF(Mean, StandardDeviation, p);
- }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistributionDesignVariable.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistributionDesignVariable.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistributionDesignVariable.cs (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -0,0 +1,18 @@
+using MathNet.Numerics.Distributions;
+
+namespace Ringtoets.Piping.Data.Probabilistics
+{
+ public class NormalDistributionDesignVariable : DesignVariable
+ {
+ public NormalDistributionDesignVariable(NormalDistribution distribution) : base(distribution) {}
+
+ public override double GetDesignValue()
+ {
+ // Design factor is determined using the 'probit function', which is the inverse
+ // CDF function of the standard normal distribution. For more information see:
+ // "Quantile function" https://en.wikipedia.org/wiki/Normal_distribution
+ var designFactor = Normal.InvCDF(0.0, 1.0, Percentile);
+ return Distribution.Mean + designFactor * Distribution.StandardDeviation;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/ShiftedLognormalDistribution.cs
===================================================================
diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/ShiftedLognormalDistribution.cs (.../ShiftedLognormalDistribution.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/ShiftedLognormalDistribution.cs (.../ShiftedLognormalDistribution.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -10,10 +10,5 @@
/// Gets or sets the shift applied to the log-normal distribution.
///
public double Shift { get; set; }
-
- public override double InverseCDF(double p)
- {
- return base.InverseCDF(p) + Shift;
- }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -97,6 +97,15 @@
}
///
+ /// Looks up a localized string similar to Gemiddelde moet groter zijn dan 0..
+ ///
+ internal static string LognormalDistribution_Mean_must_be_greater_equal_to_zero {
+ get {
+ return ResourceManager.GetString("LognormalDistribution_Mean_must_be_greater_equal_to_zero", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Voor het maken van een segment zijn twee punten nodig..
///
internal static string Segment2D_Constructor_Segment_must_be_created_with_two_points {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -135,4 +135,7 @@
Kans moet in het bereik van [0, 1] opgegeven worden.
+
+ Gemiddelde moet groter zijn dan 0.
+
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj
===================================================================
diff -u -r2da86d14cee084c7d6bfa52136d387cdcdb0a025 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 2da86d14cee084c7d6bfa52136d387cdcdb0a025)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -59,7 +59,9 @@
+
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationInputsProperties.cs
===================================================================
diff -u -r5076e379f409c3b5ba41eb98256e3dd5d140571c -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationInputsProperties.cs (.../PipingCalculationInputsProperties.cs) (revision 5076e379f409c3b5ba41eb98256e3dd5d140571c)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationInputsProperties.cs (.../PipingCalculationInputsProperties.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -101,15 +101,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_DampingFactorExit_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_DampingFactorExit_Description")]
- public DesignVariable DampingFactorExit
+ public DesignVariable DampingFactorExit
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(data.PipingData);
}
set
{
- data.PipingData.DampingFactorExit = (LognormalDistribution)value.Distribution;
+ data.PipingData.DampingFactorExit = value.Distribution;
data.PipingData.NotifyObservers();
}
}
@@ -118,15 +118,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_PhreaticLevelExit_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_PhreaticLevelExit_Description")]
- public DesignVariable PhreaticLevelExit
+ public DesignVariable PhreaticLevelExit
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(data.PipingData);
}
set
{
- data.PipingData.PhreaticLevelExit = (NormalDistribution)value.Distribution;
+ data.PipingData.PhreaticLevelExit = value.Distribution;
data.PipingData.NotifyObservers();
}
}
@@ -162,15 +162,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_ThicknessCoverageLayer_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_ThicknessCoverageLayer_Description")]
- public DesignVariable ThicknessCoverageLayer
+ public DesignVariable ThicknessCoverageLayer
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(data.PipingData);
}
set
{
- data.PipingData.ThicknessCoverageLayer = (LognormalDistribution)value.Distribution;
+ data.PipingData.ThicknessCoverageLayer = value.Distribution;
data.PipingData.NotifyObservers();
}
}
@@ -211,15 +211,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_SeepageLength_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_SeepageLength_Description")]
- public DesignVariable SeepageLength
+ public DesignVariable SeepageLength
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetSeepageLength(data.PipingData);
}
set
{
- data.PipingData.SeepageLength = (LognormalDistribution)value.Distribution;
+ data.PipingData.SeepageLength = value.Distribution;
data.PipingData.NotifyObservers();
}
}
@@ -260,15 +260,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_Diameter70_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_Diameter70_Description")]
- public DesignVariable Diameter70
+ public DesignVariable Diameter70
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetDiameter70(data.PipingData);
}
set
{
- data.PipingData.Diameter70 = (LognormalDistribution)value.Distribution;
+ data.PipingData.Diameter70 = value.Distribution;
data.PipingData.NotifyObservers();
}
}
@@ -277,15 +277,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_DarcyPermeability_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_DarcyPermeability_Description")]
- public DesignVariable DarcyPermeability
+ public DesignVariable DarcyPermeability
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetDarcyPermeability(data.PipingData);
}
set
{
- data.PipingData.DarcyPermeability = (LognormalDistribution)value.Distribution;
+ data.PipingData.DarcyPermeability = value.Distribution;
data.PipingData.NotifyObservers();
}
}
@@ -326,15 +326,15 @@
[ResourcesCategory(typeof(Resources), "Categories_General")]
[ResourcesDisplayName(typeof(Resources), "PipingData_ThicknessAquiferLayer_DisplayName")]
[ResourcesDescription(typeof(Resources), "PipingData_ThicknessAquiferLayer_Description")]
- public DesignVariable ThicknessAquiferLayer
+ public DesignVariable ThicknessAquiferLayer
{
get
{
return PipingSemiProbabilisticDesignValueFactory.GetThicknessAquiferLayer(data.PipingData);
}
set
{
- data.PipingData.ThicknessAquiferLayer = (LognormalDistribution)value.Distribution;
+ data.PipingData.ThicknessAquiferLayer = value.Distribution;
data.PipingData.NotifyObservers();
}
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/DesignVariableTypeConverter.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/DesignVariableTypeConverter.cs (.../DesignVariableTypeConverter.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/DesignVariableTypeConverter.cs (.../DesignVariableTypeConverter.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -25,8 +25,8 @@
{
if (destinationType == typeof(string))
{
- var designVariable = (DesignVariable)value;
- var variablesText = string.Join(", ", Parameters.Select(p => p.GetSummary((T)designVariable.Distribution, culture)));
+ var designVariable = (DesignVariable)value;
+ var variablesText = string.Join(", ", Parameters.Select(p => p.GetSummary(designVariable.Distribution, culture)));
return String.Format("{0} ({1})", designVariable.GetDesignValue(), variablesText);
}
return base.ConvertTo(context, culture, value, destinationType);
@@ -41,7 +41,7 @@
{
IObservable observableParent = GetObservableOwnerOfDistribution(context);
- var designVariable = (DesignVariable)value;
+ var designVariable = (DesignVariable)value;
PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(designVariable.Distribution);
var properties = new PropertyDescriptor[Parameters.Length+2];
properties[0] = new SimpleReadonlyPropertyDescriptorItem(Resources.DesignVariableTypeConverter_DestributionType_DisplayName,
@@ -73,7 +73,7 @@
private static PropertyDescriptor CreatePropertyDescriptor(PropertyDescriptorCollection originalProperties, ParameterDefinition parameter, IObservable observableParent)
{
PropertyDescriptor originalMeanPropertyDescriptor = originalProperties.Find(parameter.PropertyName, false);
- var reroutedPropertyDescriptor = new RoutedPropertyDescriptor(originalMeanPropertyDescriptor, o => ((DesignVariable)o).Distribution);
+ var reroutedPropertyDescriptor = new RoutedPropertyDescriptor(originalMeanPropertyDescriptor, o => ((DesignVariable)o).Distribution);
return new TextPropertyDescriptorDecorator(reroutedPropertyDescriptor,
parameter.Symbol,
parameter.Description)
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingDataTest.cs
===================================================================
diff -u -r7c544bdc0a35c6f193d1e786b8c001e9977c50d1 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingDataTest.cs (.../PipingDataTest.cs) (revision 7c544bdc0a35c6f193d1e786b8c001e9977c50d1)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingDataTest.cs (.../PipingDataTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -1,4 +1,6 @@
-using Core.Common.Base;
+using System;
+
+using Core.Common.Base;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Piping.Calculation.TestUtil;
@@ -29,24 +31,26 @@
Assert.AreEqual(0, defaultConstructed.PhreaticLevelExit.Mean);
Assert.AreEqual(1, defaultConstructed.PhreaticLevelExit.StandardDeviation);
+ double defaultLogNormalMean = Math.Exp(-0.5);
+ double defaultLogNormalStandardDev = Math.Sqrt((Math.Exp(1) - 1) * Math.Exp(1));
Assert.IsInstanceOf(defaultConstructed.DampingFactorExit);
Assert.AreEqual(1, defaultConstructed.DampingFactorExit.Mean);
- Assert.AreEqual(1, defaultConstructed.DampingFactorExit.StandardDeviation);
+ Assert.AreEqual(defaultLogNormalStandardDev, defaultConstructed.DampingFactorExit.StandardDeviation);
Assert.IsInstanceOf(defaultConstructed.ThicknessCoverageLayer);
- Assert.AreEqual(0, defaultConstructed.ThicknessCoverageLayer.Mean);
- Assert.AreEqual(1, defaultConstructed.ThicknessCoverageLayer.StandardDeviation);
+ Assert.AreEqual(defaultLogNormalMean, defaultConstructed.ThicknessCoverageLayer.Mean);
+ Assert.AreEqual(defaultLogNormalStandardDev, defaultConstructed.ThicknessCoverageLayer.StandardDeviation);
Assert.IsInstanceOf(defaultConstructed.SeepageLength);
- Assert.AreEqual(0, defaultConstructed.SeepageLength.Mean);
- Assert.AreEqual(1, defaultConstructed.SeepageLength.StandardDeviation);
+ Assert.AreEqual(defaultLogNormalMean, defaultConstructed.SeepageLength.Mean);
+ Assert.AreEqual(defaultLogNormalStandardDev, defaultConstructed.SeepageLength.StandardDeviation);
Assert.IsInstanceOf(defaultConstructed.Diameter70);
- Assert.AreEqual(0, defaultConstructed.Diameter70.Mean);
- Assert.AreEqual(1, defaultConstructed.Diameter70.StandardDeviation);
+ Assert.AreEqual(defaultLogNormalMean, defaultConstructed.Diameter70.Mean);
+ Assert.AreEqual(defaultLogNormalStandardDev, defaultConstructed.Diameter70.StandardDeviation);
Assert.IsInstanceOf(defaultConstructed.DarcyPermeability);
- Assert.AreEqual(0, defaultConstructed.DarcyPermeability.Mean);
- Assert.AreEqual(1, defaultConstructed.DarcyPermeability.StandardDeviation);
+ Assert.AreEqual(defaultLogNormalMean, defaultConstructed.DarcyPermeability.Mean);
+ Assert.AreEqual(defaultLogNormalStandardDev, defaultConstructed.DarcyPermeability.StandardDeviation);
Assert.IsInstanceOf(defaultConstructed.ThicknessAquiferLayer);
- Assert.AreEqual(0, defaultConstructed.ThicknessAquiferLayer.Mean);
- Assert.AreEqual(1, defaultConstructed.ThicknessAquiferLayer.StandardDeviation);
+ Assert.AreEqual(defaultLogNormalMean, defaultConstructed.ThicknessAquiferLayer.Mean);
+ Assert.AreEqual(defaultLogNormalStandardDev, defaultConstructed.ThicknessAquiferLayer.StandardDeviation);
Assert.AreEqual(0, defaultConstructed.PiezometricHeadExit);
Assert.AreEqual(0, defaultConstructed.PiezometricHeadPolder);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/DesignVariableTest.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/DesignVariableTest.cs (.../DesignVariableTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/DesignVariableTest.cs (.../DesignVariableTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -20,7 +20,7 @@
mocks.ReplayAll();
// Call
- var designVariable = new DesignVariable(distributionMock);
+ var designVariable = new SimpleDesignVariable(distributionMock);
// Assert
Assert.AreSame(distributionMock, designVariable.Distribution);
@@ -32,7 +32,7 @@
public void ParameteredConstructor_DistributionIsNull_ThrowArgumentNullException()
{
// Call
- TestDelegate call = () => new DesignVariable(null);
+ TestDelegate call = () => new SimpleDesignVariable(null);
// Assert
var exception = Assert.Throws(call);
@@ -52,7 +52,7 @@
var distributionMock = mocks.StrictMock();
mocks.ReplayAll();
- var designVariable = new DesignVariable(distributionMock);
+ var designVariable = new SimpleDesignVariable(distributionMock);
// Call
TestDelegate call = () => designVariable.Percentile = invalidPercentile;
@@ -75,7 +75,7 @@
var distributionMock = mocks.StrictMock();
mocks.ReplayAll();
- var designVariable = new DesignVariable(distributionMock);
+ var designVariable = new SimpleDesignVariable(distributionMock);
// Call
designVariable.Percentile = validPercentile;
@@ -93,7 +93,7 @@
var distributionMock = mocks.StrictMock();
mocks.ReplayAll();
- var designVariable = new DesignVariable(distributionMock);
+ var designVariable = new SimpleDesignVariable(distributionMock);
// Call
TestDelegate call = () => designVariable.Distribution = null;
@@ -104,29 +104,14 @@
Assert.AreEqual("Een kansverdeling moet opgegeven zijn om op basis van die data een rekenwaarde te bepalen.", customMessagePart);
}
- [Test]
- public void GetDesignValue_DistributionSet_ReturnInverseCdfForGivenPercentile()
+ private class SimpleDesignVariable : DesignVariable
{
- // Setup
- const double percentile = 0.5;
- const double expectedValue = 1.1;
+ public SimpleDesignVariable(IDistribution distribution) : base(distribution) {}
- var mocks = new MockRepository();
- var distribution = mocks.StrictMock();
- distribution.Expect(d => d.InverseCDF(percentile)).Return(expectedValue);
- mocks.ReplayAll();
-
- var designVariable = new DesignVariable(distribution)
+ public override double GetDesignValue()
{
- Percentile = percentile
- };
-
- // Call
- var designValue = designVariable.GetDesignValue();
-
- // Assert
- Assert.AreEqual(expectedValue, designValue);
- mocks.VerifyAll();
+ throw new NotImplementedException();
+ }
}
}
}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/LognormalDistributionDesignVariableTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/LognormalDistributionDesignVariableTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/LognormalDistributionDesignVariableTest.cs (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -0,0 +1,55 @@
+using System;
+
+using NUnit.Framework;
+
+using Ringtoets.Piping.Data.Probabilistics;
+
+namespace Ringtoets.Piping.Data.Test.Probabilistics
+{
+ [TestFixture]
+ public class LognormalDistributionDesignVariableTest
+ {
+ [Test]
+ public void ParameterdConstructor_ValidLognormalDistribution_ExpectedValues()
+ {
+ // Setup
+ var lognormalDistribution = new LognormalDistribution();
+
+ // Call
+ var designValue = new LognormalDistributionDesignVariable(lognormalDistribution);
+
+ // Assert
+ Assert.AreSame(lognormalDistribution, designValue.Distribution);
+ Assert.AreEqual(0.5, designValue.Percentile);
+ }
+
+ [Test]
+ [TestCase(75, 1, 0.05, 73.36660252)]
+ [TestCase(75, 1, 0.95, 76.65613487)]
+ [TestCase(75, 5, 0.95, 78.73383874)]
+ [TestCase(75, 5, 0.05, 71.37978448)]
+ [TestCase(1, 5, 0.5, 0.40824829)]
+ public void GetDesignVariable_ValidLognormalDistribution_ReturnExpectedValue(
+ double expectedValue, double variance, double percentile,
+ double expectedResult)
+ {
+ // Setup
+ var lognormalDistribution = new LognormalDistribution
+ {
+ Mean = expectedValue,
+ StandardDeviation = Math.Sqrt(variance)
+ };
+
+ var designVariable = new LognormalDistributionDesignVariable(lognormalDistribution)
+ {
+ Percentile = percentile
+ };
+
+ // Call
+ double result = designVariable.GetDesignValue();
+
+ // Assert
+ Assert.AreEqual(expectedResult, result, 1e-6);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/LognormalDistributionTest.cs
===================================================================
diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/LognormalDistributionTest.cs (.../LognormalDistributionTest.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/LognormalDistributionTest.cs (.../LognormalDistributionTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -17,73 +17,57 @@
// Assert
Assert.IsInstanceOf(distribution);
- Assert.AreEqual(0.0, distribution.Mean);
- Assert.AreEqual(1.0, distribution.StandardDeviation);
+ Assert.AreEqual(Math.Exp(-0.5), distribution.Mean);
+ Assert.AreEqual(Math.Sqrt((Math.Exp(1)-1)*Math.Exp(1)), distribution.StandardDeviation);
}
[Test]
[TestCase(0)]
- [TestCase(-4)]
- public void StandardDeviation_SettingNotGreaterThan0_ThrowArgumentException(double newStd)
+ [TestCase(-123.45)]
+ public void Mean_SettingToLessThanOrEqualTo0_ThrowArgumentOutOfRangeException(double newMean)
{
// Setup
var distribution = new LognormalDistribution();
// Call
- TestDelegate call = () => distribution.StandardDeviation = newStd;
+ TestDelegate call = () => distribution.Mean = newMean;
// Assert
- ArgumentException exception = Assert.Throws(call);
- Assert.AreEqual("Standaard afwijking (\u03C3) moet groter zijn dan 0.", exception.Message);
+ var exception = Assert.Throws(call);
+ var customMessagePart = exception.Message.Split(new[]{Environment.NewLine}, StringSplitOptions.None)[0];
+ Assert.AreEqual("Gemiddelde moet groter zijn dan 0.", customMessagePart);
}
[Test]
- [TestCase(-26749.34)]
- [TestCase(0.0 - 1e-6)]
- [TestCase(1.0 + 1e-6)]
- [TestCase(5678.896432)]
- public void InverseCDF_InvalidProbability_ThrowArgumentOutOfRangeException(double invalidProbability)
+ [TestCase(0 + 1e-6)]
+ [TestCase(156.23)]
+ public void Mean_SettingValidValue_ValueIsSet(double newMean)
{
// Setup
var distribution = new LognormalDistribution();
// Call
- TestDelegate call = () => distribution.InverseCDF(invalidProbability);
+ distribution.Mean = newMean;
// Assert
- var exception = Assert.Throws(call);
- var customMessagePart = exception.Message.Split(new[]
- {
- Environment.NewLine
- }, StringSplitOptions.RemoveEmptyEntries)[0];
- Assert.AreEqual("Kans moet in het bereik van [0, 1] opgegeven worden.", customMessagePart);
+ Assert.AreEqual(newMean, distribution.Mean);
}
- ///
- /// Test oracle has been generated using EXCEL 2010, using the LOGNORM.INV function.
- ///
[Test]
- [TestCase(0, 0.0)]
- [TestCase(0.025, 0.0402791721)]
- [TestCase(0.25, 0.6812149047)]
- [TestCase(0.5, 3.0041660239)]
- [TestCase(0.75, 13.2484087440)]
- [TestCase(0.975, 224.0615444190)]
- [TestCase(1, double.PositiveInfinity)]
- public void InverseCDF_ValidProbability_ReturnExpectedRealization(double probability, double expectedRealization)
+ [TestCase(0)]
+ [TestCase(-4)]
+ public void StandardDeviation_SettingNotGreaterThan0_ThrowArgumentOutOfRangeException(double newStd)
{
// Setup
- var distribution = new LognormalDistribution
- {
- Mean = 1.1,
- StandardDeviation = 2.2
- };
+ var distribution = new LognormalDistribution();
// Call
- var realization = distribution.InverseCDF(probability);
+ TestDelegate call = () => distribution.StandardDeviation = newStd;
// Assert
- Assert.AreEqual(expectedRealization, realization, 1e-6);
+ ArgumentException exception = Assert.Throws(call);
+ string customMessagePart = exception.Message.Split(new []{Environment.NewLine}, StringSplitOptions.None)[0];
+ Assert.AreEqual("Standaard afwijking (\u03C3) moet groter zijn dan 0.", customMessagePart);
}
}
}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/NormalDistributionTest.cs
===================================================================
diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/NormalDistributionTest.cs (.../NormalDistributionTest.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/NormalDistributionTest.cs (.../NormalDistributionTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -24,7 +24,7 @@
[Test]
[TestCase(0)]
[TestCase(-4)]
- public void StandardDeviation_SettingNotGreaterThan0_ThrowArgumentException(double newStd)
+ public void StandardDeviation_SettingNotGreaterThan0_ThrowArgumentOutOfRangeException(double newStd)
{
// Setup
var distribution = new NormalDistribution();
@@ -33,57 +33,9 @@
TestDelegate call = () => distribution.StandardDeviation = newStd;
// Assert
- ArgumentException exception = Assert.Throws(call);
- Assert.AreEqual("Standaard afwijking (\u03C3) moet groter zijn dan 0.", exception.Message);
+ ArgumentException exception = Assert.Throws(call);
+ string customMessagePart = exception.Message.Split(new []{Environment.NewLine}, StringSplitOptions.None)[0];
+ Assert.AreEqual("Standaard afwijking (\u03C3) moet groter zijn dan 0.", customMessagePart);
}
-
- [Test]
- [TestCase(-26749.34)]
- [TestCase(0.0 - 1e-6)]
- [TestCase(1.0 + 1e-6)]
- [TestCase(5678.896432)]
- public void InverseCDF_InvalidProbability_ThrowArgumentOutOfRangeException(double invalidProbability)
- {
- // Setup
- var distribution = new NormalDistribution();
-
- // Call
- TestDelegate call = () => distribution.InverseCDF(invalidProbability);
-
- // Assert
- var exception = Assert.Throws(call);
- var customMessagePart = exception.Message.Split(new[]
- {
- Environment.NewLine
- }, StringSplitOptions.RemoveEmptyEntries)[0];
- Assert.AreEqual("Kans moet in het bereik van [0, 1] opgegeven worden.", customMessagePart);
- }
-
- ///
- /// Test oracle has been generated using EXCEL 2010, using the NORM.INV function.
- ///
- [Test]
- [TestCase(0, double.NegativeInfinity)]
- [TestCase(0.025, -3.2119207660)]
- [TestCase(0.25, -0.3838774504)]
- [TestCase(0.5, 1.1000000000)]
- [TestCase(0.75, 2.5838774504)]
- [TestCase(0.975, 5.4119207660)]
- [TestCase(1, double.PositiveInfinity)]
- public void InverseCDF_ValidProbability_ReturnExpectedRealization(double probability, double expectedRealization)
- {
- // Setup
- var distribution = new NormalDistribution
- {
- Mean = 1.1,
- StandardDeviation = 2.2
- };
-
- // Call
- var realization = distribution.InverseCDF(probability);
-
- // Assert
- Assert.AreEqual(expectedRealization, realization, 1e-6);
- }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/ShiftedLognormalDistributionTest.cs
===================================================================
diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/ShiftedLognormalDistributionTest.cs (.../ShiftedLognormalDistributionTest.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/ShiftedLognormalDistributionTest.cs (.../ShiftedLognormalDistributionTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -1,7 +1,5 @@
-using System;
+using NUnit.Framework;
-using NUnit.Framework;
-
using Ringtoets.Piping.Data.Probabilistics;
namespace Ringtoets.Piping.Data.Test.Probabilistics
@@ -19,56 +17,5 @@
Assert.IsInstanceOf(distribution);
Assert.AreEqual(0.0, distribution.Shift);
}
-
- [Test]
- [TestCase(-26749.34)]
- [TestCase(0.0 - 1e-6)]
- [TestCase(1.0 + 1e-6)]
- [TestCase(5678.896432)]
- public void InverseCDF_InvalidProbability_ThrowArgumentOutOfRangeException(double invalidProbability)
- {
- // Setup
- var distribution = new ShiftedLognormalDistribution();
-
- // Call
- TestDelegate call = () => distribution.InverseCDF(invalidProbability);
-
- // Assert
- var exception = Assert.Throws(call);
- var customMessagePart = exception.Message.Split(new[]
- {
- Environment.NewLine
- }, StringSplitOptions.RemoveEmptyEntries)[0];
- Assert.AreEqual("Kans moet in het bereik van [0, 1] opgegeven worden.", customMessagePart);
- }
-
- ///
- /// Test oracle has been generated using EXCEL 2010, using the LOGNORM.INV function,
- /// then adding the shift to the result.
- ///
- [Test]
- [TestCase(0, 3.3)]
- [TestCase(0.025, 3.3402791721)]
- [TestCase(0.25, 3.9812149047)]
- [TestCase(0.5, 6.3041660239)]
- [TestCase(0.75, 16.5484087440)]
- [TestCase(0.975, 227.3615444190)]
- [TestCase(1, double.PositiveInfinity)]
- public void InverseCDF_ValidProbability_ReturnExpectedRealization(double probability, double expectedRealization)
- {
- // Setup
- var distribution = new ShiftedLognormalDistribution
- {
- Mean = 1.1,
- StandardDeviation = 2.2,
- Shift = 3.3
- };
-
- // Call
- var realization = distribution.InverseCDF(probability);
-
- // Assert
- Assert.AreEqual(expectedRealization, realization, 1e-6);
- }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj
===================================================================
diff -u -r78aece3188a23a908e7c0a47e53e5facd1c7edb5 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 78aece3188a23a908e7c0a47e53e5facd1c7edb5)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -55,6 +55,7 @@
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs
===================================================================
diff -u -r1efcd2277f5a38d44a78e4a9286eec35134fe8dd -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision 1efcd2277f5a38d44a78e4a9286eec35134fe8dd)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -140,13 +140,13 @@
double meanDiameter70 = random.NextDouble();
double beddingAngle = random.NextDouble();
- IDistribution dampingFactorExit = new LognormalDistribution();
- IDistribution phreaticLevelExit = new NormalDistribution();
- IDistribution thicknessCoverageLayer = new LognormalDistribution();
- IDistribution seepageLength = new LognormalDistribution();
- IDistribution diameter70 = new LognormalDistribution();
- IDistribution darcyPermeability = new LognormalDistribution();
- IDistribution thicknessAquiferLayer = new LognormalDistribution();
+ var dampingFactorExit = new LognormalDistribution();
+ var phreaticLevelExit = new NormalDistribution();
+ var thicknessCoverageLayer = new LognormalDistribution();
+ var seepageLength = new LognormalDistribution();
+ var diameter70 = new LognormalDistribution();
+ var darcyPermeability = new LognormalDistribution();
+ var thicknessAquiferLayer = new LognormalDistribution();
RingtoetsPipingSurfaceLine surfaceLine = new RingtoetsPipingSurfaceLine();
PipingSoilProfile soilProfile = new TestPipingSoilProfile();
@@ -162,20 +162,20 @@
WaterVolumetricWeight = waterVolumetricWeight,
UpliftModelFactor = upliftModelFactor,
PiezometricHeadExit = piezometricHeadExit,
- DampingFactorExit = new DesignVariable(dampingFactorExit),
- PhreaticLevelExit = new DesignVariable(phreaticLevelExit),
+ DampingFactorExit = new LognormalDistributionDesignVariable(dampingFactorExit),
+ PhreaticLevelExit = new NormalDistributionDesignVariable(phreaticLevelExit),
PiezometricHeadPolder = piezometricHeadPolder,
- ThicknessCoverageLayer = new DesignVariable(thicknessCoverageLayer),
+ ThicknessCoverageLayer = new LognormalDistributionDesignVariable(thicknessCoverageLayer),
SellmeijerModelFactor = sellmeijerModelFactor,
SellmeijerReductionFactor = sellmeijerReductionFactor,
- SeepageLength = new DesignVariable(seepageLength),
+ SeepageLength = new LognormalDistributionDesignVariable(seepageLength),
SandParticlesVolumicWeight = sandParticlesVolumicWeight,
WhitesDragCoefficient = whitesDragCoefficient,
- Diameter70 = new DesignVariable(diameter70),
- DarcyPermeability = new DesignVariable(darcyPermeability),
+ Diameter70 = new LognormalDistributionDesignVariable(diameter70),
+ DarcyPermeability = new LognormalDistributionDesignVariable(darcyPermeability),
WaterKinematicViscosity = waterKinematicViscosity,
Gravity = gravity,
- ThicknessAquiferLayer = new DesignVariable(thicknessAquiferLayer),
+ ThicknessAquiferLayer = new LognormalDistributionDesignVariable(thicknessAquiferLayer),
MeanDiameter70 = meanDiameter70,
BeddingAngle = beddingAngle,
SurfaceLine = surfaceLine,
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj
===================================================================
diff -u -reee6c7815d1e418eac38c1c552fb279c0887ef55 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision eee6c7815d1e418eac38c1c552fb279c0887ef55)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -66,7 +66,6 @@
-
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs (.../LognormalDistributionDesignVariableTypeConverterTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs (.../LognormalDistributionDesignVariableTypeConverterTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -49,7 +49,7 @@
Mean = 1.1,
StandardDeviation = 2.2
};
- var designVariable = new DesignVariable(distribution);
+ var designVariable = new LognormalDistributionDesignVariable(distribution);
var converter = new LognormalDistributionDesignVariableTypeConverter();
@@ -80,7 +80,7 @@
{
// Setup
var distribution = new LognormalDistribution();
- var designVariable = new DesignVariable(distribution);
+ var designVariable = new LognormalDistributionDesignVariable(distribution);
var converter = new LognormalDistributionDesignVariableTypeConverter();
// Call
@@ -150,7 +150,7 @@
pipingData.Attach(observer);
- DesignVariable dampingFactorExit = calculationInputsProperties.DampingFactorExit;
+ DesignVariable dampingFactorExit = calculationInputsProperties.DampingFactorExit;
var properties = new LognormalDistributionDesignVariableTypeConverter().GetProperties(typeDescriptorContextMock, dampingFactorExit);
// Precondition
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/NormalDistributionDesignVariableTypeConverterTest.cs
===================================================================
diff -u -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 -r394db7c1bd905eb7444b9b2c47bcb5111bb63af6
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/NormalDistributionDesignVariableTypeConverterTest.cs (.../NormalDistributionDesignVariableTypeConverterTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/NormalDistributionDesignVariableTypeConverterTest.cs (.../NormalDistributionDesignVariableTypeConverterTest.cs) (revision 394db7c1bd905eb7444b9b2c47bcb5111bb63af6)
@@ -49,7 +49,7 @@
Mean = 1.1,
StandardDeviation = 2.2
};
- var designVariable = new DesignVariable(distribution);
+ var designVariable = new NormalDistributionDesignVariable(distribution);
var converter = new NormalDistributionDesignVariableTypeConverter();
// Call
@@ -79,7 +79,7 @@
{
// Setup
var distribution = new NormalDistribution();
- var designVariable = new DesignVariable(distribution);
+ var designVariable = new NormalDistributionDesignVariable(distribution);
var converter = new NormalDistributionDesignVariableTypeConverter();
// Call
@@ -149,7 +149,7 @@
pipingData.Attach(observer);
- DesignVariable designVariable = calculationInputsProperties.PhreaticLevelExit;
+ DesignVariable designVariable = calculationInputsProperties.PhreaticLevelExit;
var properties = new NormalDistributionDesignVariableTypeConverter().GetProperties(typeDescriptorContextMock, designVariable);
// Precondition
Fisheye: Tag 394db7c1bd905eb7444b9b2c47bcb5111bb63af6 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/ShiftedLognormalDistributionDesignVariableTypeConverterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?