Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs =================================================================== diff -u -r1257 -r1353 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs (.../DesignResult.cs) (revision 1257) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs (.../DesignResult.cs) (revision 1353) @@ -48,7 +48,7 @@ private PipingDesignResults pipingDesignResults; /// - /// Gets the safety factor (derived result). + /// Gets or sets the safety factor. /// Note: this is a placeholder, not to be part of the results as written to xml /// /// @@ -64,13 +64,28 @@ { case FailureMechanismSystemType.StabilityInside: case FailureMechanismSystemType.StabilityOutside: + case FailureMechanismSystemType.HorizontalBalance: return StabilityDesignResults.SafetyFactor; case FailureMechanismSystemType.Piping: - return PipingDesignResults.SafetyFactor(); + return PipingDesignResults.SafetyFactor; } } return safetyFactor; } + set + { + if (DamFailureMechanismeCalculation != null) + { + if (DamFailureMechanismeCalculation.FailureMechanismSystemType == FailureMechanismSystemType.Piping) + { + PipingDesignResults.SafetyFactor = value; + } + else + { + StabilityDesignResults.SafetyFactor = value; + } + } + } } /// Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj =================================================================== diff -u -r1237 -r1353 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1237) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1353) @@ -153,6 +153,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerVNKDesignInputFileFail.xml =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerVNKDesignInputFileFail.xml (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerVNKDesignInputFileFail.xml (revision 1353) @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs =================================================================== diff -u -r1241 -r1353 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs (.../DesignCalculatorShoulderPerPoint.cs) (revision 1241) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorShoulderPerPoint.cs (.../DesignCalculatorShoulderPerPoint.cs) (revision 1353) @@ -140,6 +140,7 @@ { string resultMessage = exception.Message; kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults); + ChangeSafetyFactor(designResults, -1); } finally { @@ -160,6 +161,18 @@ } } + private static void ChangeSafetyFactor(List designResults, double safetyFactor) + { + designResults[0].SafetyFactor = 1; + + foreach (var designResult in designResults) + { + var factor = designResult.SafetyFactor; + factor = safetyFactor; + designResult.SafetyFactor = factor; + } + } + /// /// Calculates the maximum level for the shoulder. /// Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/PipingDesignResults.cs =================================================================== diff -u -r877 -r1353 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/PipingDesignResults.cs (.../PipingDesignResults.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/Results/PipingDesignResults.cs (.../PipingDesignResults.cs) (revision 1353) @@ -66,21 +66,49 @@ } } - public double? SafetyFactor() + /// + /// Gets or sets the safety factor. + /// + /// + /// The safety factor. + /// + public double? SafetyFactor { - switch (pipingModelType) + get { - case PipingModelType.Bligh: - return blighFactor; - case PipingModelType.SellmeijerVnk: - return sellmeijerVnkFactor; - case PipingModelType.Sellmeijer4Forces: - return sellmeijer4ForcesFactor; - case PipingModelType.Wti2017: - return wti2017Factor; - default: - return null; - } + switch (pipingModelType) + { + case PipingModelType.Bligh: + return blighFactor; + case PipingModelType.SellmeijerVnk: + return sellmeijerVnkFactor; + case PipingModelType.Sellmeijer4Forces: + return sellmeijer4ForcesFactor; + case PipingModelType.Wti2017: + return wti2017Factor; + default: + return null; + } + } + set + { + if (pipingModelType == PipingModelType.Bligh) + { + blighFactor = value; + } + if (pipingModelType == PipingModelType.SellmeijerVnk) + { + sellmeijerVnkFactor = value; + } + if (pipingModelType == PipingModelType.Sellmeijer4Forces) + { + sellmeijer4ForcesFactor = value; + } + if (pipingModelType == PipingModelType.Wti2017) + { + wti2017Factor = value; + } + } } /// Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerVnkTests.cs =================================================================== diff -u -r1238 -r1353 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerVnkTests.cs (.../PipingSellmeijerVnkTests.cs) (revision 1238) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerVnkTests.cs (.../PipingSellmeijerVnkTests.cs) (revision 1353) @@ -22,6 +22,7 @@ using System.IO; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Io; using NUnit.Framework; @@ -133,5 +134,25 @@ Assert.AreEqual(0.582, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); } + [Test] + public void TestIfSellmeijerVnkCalculationResultIsSetToFailDueToShoulderWidthError() + { + // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerVNK.damx" + // Set Analysis type to "Adapt geometry" + // Change required safety factor piping to 1.01 + const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerVNKDesignInputFileFail.xml"; + string inputString = File.ReadAllText(fileName); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); + // expected value = -1 because exception was raised for the shoulder width + Assert.AreEqual(-1.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkFactor, tolerance); + Assert.AreEqual("The new shoulder width is too large to fit in the current surface line.", output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ResultMessage); + } + } }