Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingOutputFactory.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingOutputFactory.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingOutputFactory.cs (revision 6c6c25920e249dbd3009b0503c7062a968bf8b36)
@@ -0,0 +1,154 @@
+// 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.Util;
+
+namespace Ringtoets.Piping.Data
+{
+ ///
+ /// Factory class to create .
+ ///
+ public static class DerivedPipingOutputFactory
+ {
+ ///
+ /// Creates a new based on the given parameters.
+ ///
+ /// The output of a calculation.
+ /// General input that influences the
+ /// probability estimate for a piping assessment.
+ /// The norm to assess for.
+ /// The contribution of piping as a percentage (0-100)
+ /// to the total of the failure probability of the assessment section.
+ /// The created .
+ /// Thrown when
+ /// or is null.
+ public static DerivedPipingOutput Create(PipingOutput output, PipingProbabilityAssessmentInput probabilityAssessmentInput,
+ double norm, double contribution)
+ {
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
+ if (probabilityAssessmentInput == null)
+ {
+ throw new ArgumentNullException(nameof(probabilityAssessmentInput));
+ }
+
+ double upliftFactorOfSafety = output.UpliftFactorOfSafety;
+ double heaveFactorOfSafety = output.HeaveFactorOfSafety;
+ double sellmeijerFactorOfSafety = output.SellmeijerFactorOfSafety;
+
+ double upliftReliability = SubMechanismReliability(upliftFactorOfSafety, upliftFactors, norm);
+ double upliftProbability = StatisticsConverter.ReliabilityToProbability(upliftReliability);
+
+ double heaveReliability = SubMechanismReliability(heaveFactorOfSafety, heaveFactors, norm);
+ double heaveProbability = StatisticsConverter.ReliabilityToProbability(heaveReliability);
+
+ double sellmeijerReliability = SubMechanismReliability(sellmeijerFactorOfSafety, sellmeijerFactors, norm);
+ double sellmeijerProbability = StatisticsConverter.ReliabilityToProbability(sellmeijerReliability);
+
+ double pipingProbability = PipingProbability(upliftProbability, heaveProbability, sellmeijerProbability);
+ double pipingReliability = StatisticsConverter.ProbabilityToReliability(pipingProbability);
+
+ double requiredProbability = RequiredProbability(probabilityAssessmentInput.A,
+ probabilityAssessmentInput.B,
+ probabilityAssessmentInput.SectionLength,
+ norm,
+ contribution);
+ double requiredReliability = StatisticsConverter.ProbabilityToReliability(requiredProbability);
+
+ return new DerivedPipingOutput(upliftFactorOfSafety, upliftReliability,
+ upliftProbability, heaveFactorOfSafety,
+ heaveReliability, heaveProbability,
+ sellmeijerFactorOfSafety, sellmeijerReliability,
+ sellmeijerProbability, requiredProbability,
+ requiredReliability, pipingProbability,
+ pipingReliability, pipingReliability / requiredReliability);
+ }
+
+ ///
+ /// Calculates the probability of occurrence of the piping failure mechanism.
+ ///
+ /// The calculated probability of the heave sub mechanism.
+ /// The calculated probability of the uplift sub mechanism.
+ /// The calculated probability of the Sellmeijer sub mechanism.
+ /// A value representing the probability of occurrence of piping.
+ private static double PipingProbability(double probabilityOfHeave, double probabilityOfUplift, double probabilityOfSellmeijer)
+ {
+ return Math.Min(Math.Min(probabilityOfHeave, probabilityOfUplift), probabilityOfSellmeijer);
+ }
+
+ ///
+ /// Calculates the required probability of the piping failure mechanism for the complete assessment section.
+ ///
+ /// The constant a.
+ /// The constant b.
+ /// The length of the assessment section.
+ /// The norm.
+ /// The contribution of piping to the total failure.
+ /// A value representing the required probability.
+ private static double RequiredProbability(double constantA, double constantB, double sectionLength, double norm, double contribution)
+ {
+ return (norm * contribution) / (1 + (constantA * sectionLength) / constantB);
+ }
+
+ private static double SubMechanismReliability(double factorOfSafety, SubCalculationFactors factors, double norm)
+ {
+ double bNorm = StatisticsConverter.ProbabilityToReliability(norm);
+
+ return (1 / factors.A) * (Math.Log(factorOfSafety / factors.B) + (factors.C * bNorm));
+ }
+
+ #region Sub calculation constants
+
+ private struct SubCalculationFactors
+ {
+ public double A;
+ public double B;
+ public double C;
+ }
+
+ private static readonly SubCalculationFactors upliftFactors = new SubCalculationFactors
+ {
+ A = 0.46,
+ B = 0.48,
+ C = 0.27
+ };
+
+ private static readonly SubCalculationFactors heaveFactors = new SubCalculationFactors
+ {
+ A = 0.48,
+ B = 0.37,
+ C = 0.30
+ };
+
+ private static readonly SubCalculationFactors sellmeijerFactors = new SubCalculationFactors
+ {
+ A = 0.37,
+ B = 1.04,
+ C = 0.43
+ };
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj
===================================================================
diff -u -r642a4946d235601302d544697856fed3b5c7a2bd -r6c6c25920e249dbd3009b0503c7062a968bf8b36
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 642a4946d235601302d544697856fed3b5c7a2bd)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 6c6c25920e249dbd3009b0503c7062a968bf8b36)
@@ -12,6 +12,7 @@
+
@@ -44,6 +45,11 @@
Core.Common.Base
False
+
+ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
+ Core.Common.Util
+ False
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingOutputFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingOutputFactoryTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingOutputFactoryTest.cs (revision 6c6c25920e249dbd3009b0503c7062a968bf8b36)
@@ -0,0 +1,92 @@
+// 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 NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+
+namespace Ringtoets.Piping.Data.Test
+{
+ [TestFixture]
+ public class DerivedPipingOutputFactoryTest
+ {
+ [Test]
+ public void Create_OutputNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => DerivedPipingOutputFactory.Create(null,
+ new PipingProbabilityAssessmentInput(),
+ double.NaN,
+ double.NaN);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("output", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_ProbabilityAssessmentInputNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => DerivedPipingOutputFactory.Create(new PipingOutput(new PipingOutput.ConstructionProperties()),
+ null,
+ double.NaN,
+ double.NaN);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("probabilityAssessmentInput", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase(30000, 1.2, 7.36633055700265E-06)]
+ [TestCase(30000, 1.0, 4.13743266617776E-05)]
+ [TestCase(20000, 1.2, 9.53352884976163E-06)]
+ [TestCase(20000, 1.0, 5.24016937211752E-05)]
+ public void Create_ValidData_ReturnsExpectedValue(int returnPeriod, double factorOfSafety, double expectedResult)
+ {
+ // Setup
+ var probabilityAssessmentInput = new PipingProbabilityAssessmentInput
+ {
+ SectionLength = 6000
+ };
+
+ var calculatorResult = new PipingOutput(new PipingOutput.ConstructionProperties
+ {
+ UpliftFactorOfSafety = 1.2,
+ HeaveFactorOfSafety = 1.4,
+ SellmeijerFactorOfSafety = 0.9
+ });
+ const double norm = 1.0 / 30000;
+
+ // Call
+ DerivedPipingOutput derivedOutput = DerivedPipingOutputFactory.Create(calculatorResult, probabilityAssessmentInput, norm, 1000);
+
+ // Assert
+ Assert.AreEqual(7.3e-6, derivedOutput.UpliftProbability, 1e-6);
+ Assert.AreEqual(0.004, derivedOutput.HeaveProbability, 1e-6);
+ Assert.AreEqual(1.0988e-5, derivedOutput.SellmeijerProbability, 1e-6);
+ Assert.AreEqual(1.33, derivedOutput.PipingReliability, derivedOutput.PipingReliability.GetAccuracy());
+ Assert.AreEqual(4.77, derivedOutput.RequiredReliability, derivedOutput.RequiredReliability.GetAccuracy());
+ Assert.AreEqual(0.907, derivedOutput.PipingFactorOfSafety, derivedOutput.PipingFactorOfSafety.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj
===================================================================
diff -u -r642a4946d235601302d544697856fed3b5c7a2bd -r6c6c25920e249dbd3009b0503c7062a968bf8b36
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 642a4946d235601302d544697856fed3b5c7a2bd)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 6c6c25920e249dbd3009b0503c7062a968bf8b36)
@@ -21,6 +21,7 @@
+