Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresInput.cs =================================================================== diff -u -r2f6400116d57c2b49f7089dbc9c8cd935c185a36 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresInput.cs (.../ClosingStructuresInput.cs) (revision 2f6400116d57c2b49f7089dbc9c8cd935c185a36) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresInput.cs (.../ClosingStructuresInput.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -43,12 +43,12 @@ private readonly LogNormalDistribution areaFlowApertures; private readonly NormalDistribution levelCrestStructureNotClosing; private readonly NormalDistribution insideWaterLevel; - private readonly LogNormalDistribution storageStructureArea; + private readonly VariationCoefficientLogNormalDistribution storageStructureArea; private readonly LogNormalDistribution allowedLevelIncreaseStorage; private readonly LogNormalDistribution flowWidthAtBottomProtection; - private readonly NormalDistribution widthFlowApertures; - private readonly LogNormalDistribution stormDuration; - private readonly LogNormalDistribution criticalOvertoppingDischarge; + private readonly VariationCoefficientNormalDistribution widthFlowApertures; + private readonly VariationCoefficientLogNormalDistribution stormDuration; + private readonly VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge; private RoundedDouble structureNormalOrientation; private RoundedDouble factorStormDurationOpenStructure; private double failureProbablityOpenStructure; @@ -114,35 +114,35 @@ StandardDeviation = (RoundedDouble) 0.1 }; - storageStructureArea = new LogNormalDistribution(2) + storageStructureArea = new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble) double.NaN + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.1 }; - storageStructureArea.SetStandardDeviationFromVariationCoefficient(0.1); flowWidthAtBottomProtection = new LogNormalDistribution(2) { Mean = (RoundedDouble) double.NaN, StandardDeviation = (RoundedDouble) 0.05 }; - criticalOvertoppingDischarge = new LogNormalDistribution(2) + criticalOvertoppingDischarge = new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble) double.NaN + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.15 }; - criticalOvertoppingDischarge.SetStandardDeviationFromVariationCoefficient(0.15); - widthFlowApertures = new NormalDistribution(2) + widthFlowApertures = new VariationCoefficientNormalDistribution(2) { Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.05 }; - widthFlowApertures.SetStandardDeviationFromVariationCoefficient(0.05); - stormDuration = new LogNormalDistribution(2) + stormDuration = new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble) 6.0 + Mean = (RoundedDouble) 6.0, + CoefficientOfVariation = (RoundedDouble) 0.25 }; - stormDuration.SetStandardDeviationFromVariationCoefficient(0.25); UpdateForeshoreProperties(); } @@ -330,7 +330,7 @@ /// [hrs] /// /// Only sets the mean. - public LogNormalDistribution StormDuration + public VariationCoefficientLogNormalDistribution StormDuration { get { @@ -499,7 +499,7 @@ /// Gets or sets the storage structure area. /// [m^2] /// - public LogNormalDistribution StorageStructureArea + public VariationCoefficientLogNormalDistribution StorageStructureArea { get { @@ -508,7 +508,7 @@ set { storageStructureArea.Mean = value.Mean; - storageStructureArea.StandardDeviation = value.StandardDeviation; + storageStructureArea.CoefficientOfVariation = value.CoefficientOfVariation; } } @@ -533,7 +533,7 @@ /// Gets or sets the critical overtopping discharge. /// [m^3/s/m] /// - public LogNormalDistribution CriticalOvertoppingDischarge + public VariationCoefficientLogNormalDistribution CriticalOvertoppingDischarge { get { @@ -542,7 +542,7 @@ set { criticalOvertoppingDischarge.Mean = value.Mean; - criticalOvertoppingDischarge.StandardDeviation = value.StandardDeviation; + criticalOvertoppingDischarge.CoefficientOfVariation = value.CoefficientOfVariation; } } @@ -572,7 +572,7 @@ /// Gets or sets the width of flow apertures. /// [m] /// - public NormalDistribution WidthFlowApertures + public VariationCoefficientNormalDistribution WidthFlowApertures { get { @@ -581,7 +581,7 @@ set { widthFlowApertures.Mean = value.Mean; - widthFlowApertures.StandardDeviation = value.StandardDeviation; + widthFlowApertures.CoefficientOfVariation = value.CoefficientOfVariation; } } Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/GeneralClosingStructuresInput.cs =================================================================== diff -u -ra76bb82a008a01449840d2afcc31d5aec4f5ba3f -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/GeneralClosingStructuresInput.cs (.../GeneralClosingStructuresInput.cs) (revision a76bb82a008a01449840d2afcc31d5aec4f5ba3f) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/GeneralClosingStructuresInput.cs (.../GeneralClosingStructuresInput.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -54,11 +54,11 @@ StandardDeviation = (RoundedDouble) 0.2 }; - ModelFactorSubCriticalFlow = new NormalDistribution(1) + ModelFactorSubCriticalFlow = new VariationCoefficientNormalDistribution(1) { Mean = (RoundedDouble) 1, + CoefficientOfVariation = (RoundedDouble) 0.1 }; - ModelFactorSubCriticalFlow.SetStandardDeviationFromVariationCoefficient(0.1); ModelFactorInflowVolume = new RoundedDouble(2, 1); } @@ -123,7 +123,7 @@ /// /// Gets the model factor for sub critical flow. /// - public NormalDistribution ModelFactorSubCriticalFlow { get; private set; } + public VariationCoefficientNormalDistribution ModelFactorSubCriticalFlow { get; private set; } /// /// Gets the model factor for incoming flow volume. Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs =================================================================== diff -u -r2f6400116d57c2b49f7089dbc9c8cd935c185a36 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision 2f6400116d57c2b49f7089dbc9c8cd935c185a36) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresInputTest.cs (.../ClosingStructuresInputTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -88,7 +88,7 @@ Assert.IsNaN(input.CriticalOvertoppingDischarge.Mean); Assert.IsNaN(input.WidthFlowApertures.Mean); AssertEqualValue(6.0, input.StormDuration.Mean); - AssertEqualValue(0.25, input.StormDuration.GetVariationCoefficient()); + AssertEqualValue(0.25, input.StormDuration.CoefficientOfVariation); Assert.AreEqual(1.0, input.ProbabilityOpenStructureBeforeFlooding); } @@ -472,14 +472,14 @@ { // Setup var input = new ClosingStructuresInput(); - LogNormalDistribution storageStructureArea = GenerateLogNormalDistribution(); + VariationCoefficientLogNormalDistribution storageStructureArea = GenerateVariationVariationCoefficientLogNormalDistribution(); //Call input.StorageStructureArea = storageStructureArea; //Assert Assert.AreEqual(storageStructureArea.Mean, input.StorageStructureArea.Mean); - Assert.AreEqual(storageStructureArea.StandardDeviation, input.StorageStructureArea.StandardDeviation); + Assert.AreEqual(storageStructureArea.CoefficientOfVariation, input.StorageStructureArea.CoefficientOfVariation); } [Test] @@ -502,14 +502,14 @@ { // Setup var input = new ClosingStructuresInput(); - LogNormalDistribution criticalOvertoppingDischarge = GenerateLogNormalDistribution(); + VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge = GenerateVariationVariationCoefficientLogNormalDistribution(); //Call input.CriticalOvertoppingDischarge = criticalOvertoppingDischarge; //Assert Assert.AreEqual(criticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.Mean); - AssertEqualValue(criticalOvertoppingDischarge.StandardDeviation, input.CriticalOvertoppingDischarge.StandardDeviation); + AssertEqualValue(criticalOvertoppingDischarge.CoefficientOfVariation, input.CriticalOvertoppingDischarge.CoefficientOfVariation); } [Test] @@ -549,14 +549,14 @@ { // Setup var input = new ClosingStructuresInput(); - NormalDistribution widthApertures = GenerateNormalDistribution(); + VariationCoefficientNormalDistribution widthApertures = GenerateVariationCoefficientNormalDistribution(); //Call input.WidthFlowApertures = widthApertures; //Assert Assert.AreEqual(widthApertures.Mean, input.WidthFlowApertures.Mean); - Assert.AreEqual(widthApertures.StandardDeviation, input.WidthFlowApertures.StandardDeviation); + Assert.AreEqual(widthApertures.CoefficientOfVariation, input.WidthFlowApertures.CoefficientOfVariation); } [Test] @@ -581,16 +581,16 @@ { // Setup var input = new ClosingStructuresInput(); - LogNormalDistribution stormDuration = GenerateLogNormalDistribution(); + VariationCoefficientLogNormalDistribution stormDuration = GenerateVariationVariationCoefficientLogNormalDistribution(); - RoundedDouble initialStd = input.StormDuration.StandardDeviation; + RoundedDouble initialStd = input.StormDuration.CoefficientOfVariation; //Call input.StormDuration = stormDuration; //Assert Assert.AreEqual(stormDuration.Mean, input.StormDuration.Mean); - AssertEqualValue(initialStd, input.StormDuration.StandardDeviation); + AssertEqualValue(initialStd, input.StormDuration.CoefficientOfVariation); } [Test] @@ -640,6 +640,16 @@ }; } + private static VariationCoefficientLogNormalDistribution GenerateVariationVariationCoefficientLogNormalDistribution() + { + var random = new Random(22); + return new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble)(0.01 + random.NextDouble()), + CoefficientOfVariation = (RoundedDouble)random.NextDouble() + }; + } + private static NormalDistribution GenerateNormalDistribution() { var random = new Random(22); @@ -649,5 +659,15 @@ StandardDeviation = (RoundedDouble) random.NextDouble() }; } + + private static VariationCoefficientNormalDistribution GenerateVariationCoefficientNormalDistribution() + { + var random = new Random(22); + return new VariationCoefficientNormalDistribution(2) + { + Mean = (RoundedDouble)(0.01 + random.NextDouble()), + CoefficientOfVariation = (RoundedDouble)random.NextDouble() + }; + } } } \ No newline at end of file Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/GeneralClosingStructuresInputTest.cs =================================================================== diff -u -r67d6a305cec6967c1247f3d9cba8a817499d2a1d -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/GeneralClosingStructuresInputTest.cs (.../GeneralClosingStructuresInputTest.cs) (revision 67d6a305cec6967c1247f3d9cba8a817499d2a1d) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/GeneralClosingStructuresInputTest.cs (.../GeneralClosingStructuresInputTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -51,9 +51,9 @@ AssertEqualValue(0.09, inputParameters.ModelFactorOvertoppingFlow.Mean); AssertEqualValue(0.06, inputParameters.ModelFactorOvertoppingFlow.StandardDeviation); - Assert.IsInstanceOf(inputParameters.ModelFactorSubCriticalFlow); + Assert.IsInstanceOf(inputParameters.ModelFactorSubCriticalFlow); AssertEqualValue(1, inputParameters.ModelFactorSubCriticalFlow.Mean); - AssertEqualValue(0.1, inputParameters.ModelFactorSubCriticalFlow.GetVariationCoefficient()); + AssertEqualValue(0.1, inputParameters.ModelFactorSubCriticalFlow.CoefficientOfVariation); Assert.IsInstanceOf(inputParameters.ModelFactorStorageVolume); AssertEqualValue(1.0, inputParameters.ModelFactorStorageVolume.Mean); Fisheye: Tag 92372ba046f1df1593268f692339a53dc1b94e12 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IDistributionExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 92372ba046f1df1593268f692339a53dc1b94e12 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IDistributionVariationCoefficient.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj =================================================================== diff -u -r443fcdbfa5d49c306f76bb12f054c6e6bf859e18 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 443fcdbfa5d49c306f76bb12f054c6e6bf859e18) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -48,8 +48,6 @@ - - Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/LogNormalDistributionTest.cs =================================================================== diff -u -rce31448a066c084f755439f3e7d453bfb042b291 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/LogNormalDistributionTest.cs (.../LogNormalDistributionTest.cs) (revision ce31448a066c084f755439f3e7d453bfb042b291) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/LogNormalDistributionTest.cs (.../LogNormalDistributionTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -128,104 +128,6 @@ } [Test] - [TestCase(1, 10, 20, 2.0)] - [TestCase(3, 5, 100, 20.000)] - public void GetVariationCoefficient_ValidValues_ReturnExpectedValues(int numberOfDecimalPlaces, double mean, double standardDeviation, - double expectedVariationCoefficient) - { - // Setup - var distribution = new LogNormalDistribution(numberOfDecimalPlaces) - { - Mean = new RoundedDouble(numberOfDecimalPlaces, mean), - StandardDeviation = new RoundedDouble(numberOfDecimalPlaces, standardDeviation) - }; - - // Call - var variationCoefficient = distribution.GetVariationCoefficient(); - - // Assert - Assert.AreEqual(numberOfDecimalPlaces, variationCoefficient.NumberOfDecimalPlaces); - Assert.AreEqual(expectedVariationCoefficient, variationCoefficient.Value); - } - - [Test] - public void SetStandardDeviationFromVariationCoefficient_InvalidValues_ThrowArgumentOutOfRangeException() - { - // Setup - const double variationCoefficient = -1; - const int numberOfDecimalPlaces = 1; - var distribution = new LogNormalDistribution(numberOfDecimalPlaces) - { - Mean = new RoundedDouble(numberOfDecimalPlaces, 1), - }; - - // Call - TestDelegate call = () => distribution.SetStandardDeviationFromVariationCoefficient(variationCoefficient); - - // Assert - const string expectedMessage = "Standaard afwijking (\u03C3) moet groter zijn dan 0."; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); - } - - [Test] - [TestCase(1, 10, 2, 20.0)] - [TestCase(3, 5, 20, 100.000)] - public void SetStandardDeviationFromVariationCoefficient_ValidValues_SetsStandardDeviation(int numberOfDecimalPlaces, double mean, - double variationCoefficient, double expectedStandardDeviation) - { - // Setup - var distribution = new LogNormalDistribution(numberOfDecimalPlaces) - { - Mean = new RoundedDouble(numberOfDecimalPlaces, mean), - }; - - // Call - distribution.SetStandardDeviationFromVariationCoefficient(variationCoefficient); - - // Assert - Assert.AreEqual(expectedStandardDeviation, distribution.StandardDeviation.Value); - } - - [Test] - [TestCase(-1)] - [TestCase(-2)] - public void SetMeanFromVariationCoefficient_InvalidValues_ThrowArgumentOutOfRangeException(double variationCoefficient) - { - // Setup - const int numberOfDecimalPlaces = 1; - var distribution = new LogNormalDistribution(numberOfDecimalPlaces) - { - StandardDeviation = new RoundedDouble(numberOfDecimalPlaces, 1), - }; - - // Call - TestDelegate call = () => distribution.SetMeanFromVariationCoefficient(variationCoefficient); - - // Assert - const string expectedMessage = "Variatiecoƫfficiƫnt moet groter zijn dan 0."; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); - } - - [Test] - [TestCase(1, 20, 2, 10.0)] - [TestCase(3, 100, 20, 5.000)] - public void SetMeanFromVariationCoefficient_ValidValues_SetsStandardDeviation(int numberOfDecimalPlaces, double standardDeviation, - double variationCoefficient, double expectedMean) - { - // Setup - var distribution = new LogNormalDistribution(numberOfDecimalPlaces) - { - StandardDeviation = new RoundedDouble(numberOfDecimalPlaces, standardDeviation), - }; - - // Call - distribution.SetMeanFromVariationCoefficient(variationCoefficient); - - // Assert - Assert.AreEqual(expectedMean, distribution.Mean.Value); - } - - [Test] [TestCase(1, 5.6)] [TestCase(3, 5.647)] [TestCase(4, 5.6473)] Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/GeneralStabilityPointStructuresInput.cs =================================================================== diff -u -ra828baefd6d87005fe1c60fed60979c9b17e45f7 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/GeneralStabilityPointStructuresInput.cs (.../GeneralStabilityPointStructuresInput.cs) (revision a828baefd6d87005fe1c60fed60979c9b17e45f7) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/GeneralStabilityPointStructuresInput.cs (.../GeneralStabilityPointStructuresInput.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -48,17 +48,17 @@ StandardDeviation = (RoundedDouble) 0.2 }; - ModelFactorSubCriticalFlow = new NormalDistribution(2) + ModelFactorSubCriticalFlow = new VariationCoefficientNormalDistribution(2) { Mean = (RoundedDouble) 1, + CoefficientOfVariation = (RoundedDouble) 0.1 }; - ModelFactorSubCriticalFlow.SetStandardDeviationFromVariationCoefficient(0.1); - ModelFactorCollisionLoad = new NormalDistribution(1) + ModelFactorCollisionLoad = new VariationCoefficientNormalDistribution(1) { Mean = (RoundedDouble) 1, + CoefficientOfVariation = (RoundedDouble) 0.2 }; - ModelFactorCollisionLoad.SetStandardDeviationFromVariationCoefficient(0.2); ModelFactorLoadEffect = new NormalDistribution(2) { @@ -115,12 +115,12 @@ /// /// Gets the model factor for sub critical flow. /// - public NormalDistribution ModelFactorSubCriticalFlow { get; private set; } + public VariationCoefficientNormalDistribution ModelFactorSubCriticalFlow { get; private set; } /// /// Gets the model factor for collision load. /// - public NormalDistribution ModelFactorCollisionLoad { get; private set; } + public VariationCoefficientNormalDistribution ModelFactorCollisionLoad { get; private set; } /// /// Gets the model factor for load effect. Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs =================================================================== diff -u -ra828baefd6d87005fe1c60fed60979c9b17e45f7 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision a828baefd6d87005fe1c60fed60979c9b17e45f7) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresInput.cs (.../StabilityPointStructuresInput.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -39,14 +39,14 @@ { private readonly NormalDistribution insideWaterLevelFailureConstruction; private readonly NormalDistribution insideWaterLevel; - private readonly LogNormalDistribution stormDuration; + private readonly VariationCoefficientLogNormalDistribution stormDuration; private readonly NormalDistribution modelFactorSuperCriticalFlow; private readonly NormalDistribution drainCoefficient; private readonly NormalDistribution levelCrestStructure; private readonly NormalDistribution thresholdHeightOpenWeir; private readonly LogNormalDistribution areaFlowApertures; - private readonly LogNormalDistribution constructiveStrengthLinearModel; - private readonly LogNormalDistribution constructiveStrengthQuadraticModel; + private readonly VariationCoefficientLogNormalDistribution constructiveStrengthLinearModel; + private readonly VariationCoefficientLogNormalDistribution constructiveStrengthQuadraticModel; private ForeshoreProfile foreshoreProfile; private RoundedDouble structureNormalOrientation; private RoundedDouble volumicWeightWater; @@ -73,11 +73,11 @@ StandardDeviation = (RoundedDouble) 0.1 }; - stormDuration = new LogNormalDistribution(2) + stormDuration = new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble) 6.0 + Mean = (RoundedDouble) 6.0, + CoefficientOfVariation = (RoundedDouble) 0.25 }; - stormDuration.SetStandardDeviationFromVariationCoefficient(0.25); modelFactorSuperCriticalFlow = new NormalDistribution(2) { @@ -109,17 +109,17 @@ StandardDeviation = (RoundedDouble) 0.01 }; - constructiveStrengthLinearModel = new LogNormalDistribution(2) + constructiveStrengthLinearModel = new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble) double.NaN + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.1 }; - constructiveStrengthLinearModel.SetStandardDeviationFromVariationCoefficient(0.1); - constructiveStrengthQuadraticModel = new LogNormalDistribution(2) + constructiveStrengthQuadraticModel = new VariationCoefficientLogNormalDistribution(2) { - Mean = (RoundedDouble) double.NaN + Mean = (RoundedDouble) double.NaN, + CoefficientOfVariation = (RoundedDouble) 0.1 }; - constructiveStrengthQuadraticModel.SetStandardDeviationFromVariationCoefficient(0.1); UpdateForeshoreProperties(); } @@ -262,7 +262,7 @@ /// Gets or sets the storm duration. /// /// Only sets the mean. - public LogNormalDistribution StormDuration + public VariationCoefficientLogNormalDistribution StormDuration { get { @@ -412,7 +412,7 @@ /// Gets or sets the constructive strength of the linear load model. /// [kN/m^2] /// - public LogNormalDistribution ConstructiveStrengthLinearLoadModel + public VariationCoefficientLogNormalDistribution ConstructiveStrengthLinearLoadModel { get { @@ -421,15 +421,15 @@ set { constructiveStrengthLinearModel.Mean = value.Mean; - constructiveStrengthLinearModel.StandardDeviation = value.StandardDeviation; + constructiveStrengthLinearModel.CoefficientOfVariation = value.CoefficientOfVariation; } } /// /// Gets or sets the constructive strength of the quadratic load model. /// [kN/m] /// - public LogNormalDistribution ConstructiveStrengthQuadraticLoadModel + public VariationCoefficientLogNormalDistribution ConstructiveStrengthQuadraticLoadModel { get { @@ -438,7 +438,7 @@ set { constructiveStrengthQuadraticModel.Mean = value.Mean; - constructiveStrengthQuadraticModel.StandardDeviation = value.StandardDeviation; + constructiveStrengthQuadraticModel.CoefficientOfVariation = value.CoefficientOfVariation; } } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/GeneralStabilityPointStructuresInputTest.cs =================================================================== diff -u -r200b418bcf28a2daad8dae6fdf7500bb1ea26627 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/GeneralStabilityPointStructuresInputTest.cs (.../GeneralStabilityPointStructuresInputTest.cs) (revision 200b418bcf28a2daad8dae6fdf7500bb1ea26627) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/GeneralStabilityPointStructuresInputTest.cs (.../GeneralStabilityPointStructuresInputTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -47,13 +47,13 @@ Assert.AreEqual(new RoundedDouble(2, 1), inputParameters.ModelFactorStorageVolume.Mean); Assert.AreEqual(new RoundedDouble(2, 0.2), inputParameters.ModelFactorStorageVolume.StandardDeviation); - Assert.IsInstanceOf(inputParameters.ModelFactorSubCriticalFlow); + Assert.IsInstanceOf(inputParameters.ModelFactorSubCriticalFlow); Assert.AreEqual(new RoundedDouble(2, 1), inputParameters.ModelFactorSubCriticalFlow.Mean); - Assert.AreEqual(new RoundedDouble(2, 0.1), inputParameters.ModelFactorSubCriticalFlow.GetVariationCoefficient()); + Assert.AreEqual(new RoundedDouble(2, 0.1), inputParameters.ModelFactorSubCriticalFlow.CoefficientOfVariation); - Assert.IsInstanceOf(inputParameters.ModelFactorCollisionLoad); + Assert.IsInstanceOf(inputParameters.ModelFactorCollisionLoad); Assert.AreEqual(new RoundedDouble(1, 1), inputParameters.ModelFactorCollisionLoad.Mean); - Assert.AreEqual(new RoundedDouble(2, 0.2), inputParameters.ModelFactorCollisionLoad.GetVariationCoefficient()); + Assert.AreEqual(new RoundedDouble(2, 0.2), inputParameters.ModelFactorCollisionLoad.CoefficientOfVariation); Assert.IsInstanceOf(inputParameters.ModelFactorLoadEffect); Assert.AreEqual(new RoundedDouble(2, 1), inputParameters.ModelFactorLoadEffect.Mean); Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs =================================================================== diff -u -ra828baefd6d87005fe1c60fed60979c9b17e45f7 -r92372ba046f1df1593268f692339a53dc1b94e12 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision a828baefd6d87005fe1c60fed60979c9b17e45f7) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresInputTest.cs (.../StabilityPointStructuresInputTest.cs) (revision 92372ba046f1df1593268f692339a53dc1b94e12) @@ -69,7 +69,7 @@ AssertEqualValue(0.1, input.InsideWaterLevel.StandardDeviation); AssertEqualValue(6.0, input.StormDuration.Mean); - AssertEqualValue(0.25, input.StormDuration.GetVariationCoefficient()); + AssertEqualValue(0.25, input.StormDuration.CoefficientOfVariation); AssertEqualValue(1.1, input.ModelFactorSuperCriticalFlow.Mean); AssertEqualValue(0.03, input.ModelFactorSuperCriticalFlow.StandardDeviation); @@ -260,16 +260,16 @@ { // Setup var input = new StabilityPointStructuresInput(); - LogNormalDistribution stormDuration = GenerateLogNormalDistribution(); + VariationCoefficientLogNormalDistribution stormDuration = GenerateVariationCoefficientLogNormalDistribution(); - RoundedDouble initialStd = input.StormDuration.StandardDeviation; + RoundedDouble initialStd = input.StormDuration.CoefficientOfVariation; //Call input.StormDuration = stormDuration; //Assert Assert.AreEqual(stormDuration.Mean, input.StormDuration.Mean); - AssertEqualValue(initialStd, input.StormDuration.StandardDeviation); + AssertEqualValue(initialStd, input.StormDuration.CoefficientOfVariation); } #endregion @@ -420,29 +420,29 @@ { // Setup var input = new StabilityPointStructuresInput(); - LogNormalDistribution constructiveStrengthLinearLoadModel = GenerateLogNormalDistribution(); + VariationCoefficientLogNormalDistribution constructiveStrengthLinearLoadModel = GenerateVariationCoefficientLogNormalDistribution(); // Call input.ConstructiveStrengthLinearLoadModel = constructiveStrengthLinearLoadModel; // Assert AssertEqualValue(constructiveStrengthLinearLoadModel.Mean, input.ConstructiveStrengthLinearLoadModel.Mean); - AssertEqualValue(constructiveStrengthLinearLoadModel.StandardDeviation, input.ConstructiveStrengthLinearLoadModel.StandardDeviation); + AssertEqualValue(constructiveStrengthLinearLoadModel.CoefficientOfVariation, input.ConstructiveStrengthLinearLoadModel.CoefficientOfVariation); } [Test] public void Properties_ConstructiveStrengthQuadraticLoadModel_ExpectectedValues() { // Setup var input = new StabilityPointStructuresInput(); - LogNormalDistribution constructiveStrengthQuadraticLoadModel = GenerateLogNormalDistribution(); + VariationCoefficientLogNormalDistribution constructiveStrengthQuadraticLoadModel = GenerateVariationCoefficientLogNormalDistribution(); // Call input.ConstructiveStrengthQuadraticLoadModel = constructiveStrengthQuadraticLoadModel; // Assert AssertEqualValue(constructiveStrengthQuadraticLoadModel.Mean, input.ConstructiveStrengthQuadraticLoadModel.Mean); - AssertEqualValue(constructiveStrengthQuadraticLoadModel.StandardDeviation, input.ConstructiveStrengthQuadraticLoadModel.StandardDeviation); + AssertEqualValue(constructiveStrengthQuadraticLoadModel.CoefficientOfVariation, input.ConstructiveStrengthQuadraticLoadModel.CoefficientOfVariation); } #endregion @@ -463,6 +463,16 @@ }; } + private static VariationCoefficientLogNormalDistribution GenerateVariationCoefficientLogNormalDistribution() + { + var random = new Random(22); + return new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble)(0.01 + random.NextDouble()), + CoefficientOfVariation = (RoundedDouble)random.NextDouble() + }; + } + private static NormalDistribution GenerateNormalDistribution() { var random = new Random(22);