Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs =================================================================== diff -u -r1131 -r1134 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs (.../MacroStabilityTests.cs) (revision 1131) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs (.../MacroStabilityTests.cs) (revision 1134) @@ -547,16 +547,16 @@ Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); } - [Test, Category("Work_In_Progress")] - public void TestRunMacroStabilityWithError() + [Test] + public void TestRunMacroStabilityWithErrorUpliftVan() { // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\DeltaDijk_zonering_BI // with Dam Classic rev.1059 // This project has 2 locations with each 2 profiles // In one the combinations location-profile (1st location, 2nd profile) DGeoStability stops during the calculation. // Then the kernel tries to read the safety factor, but fails because the dumpfile is not complete. // In Release+Classic this returned a result Unexpected Error but the calculation continued with the next combination. - const string calcDir = "TestOutStabWithError"; + const string calcDir = "TestOutStabWithErrorUpliftVan"; if (Directory.Exists(calcDir)) { Directory.Delete(calcDir, true); // delete previous results @@ -613,6 +613,66 @@ Assert.AreEqual(3.157, result.StabilityDesignResults.SafetyFactor, tolerance); } + + [Test] + public void TestRunMacroStabilityWithErrorBishopUpliftVan() + { + // Expected results are determined by running dam\dam clients\DamUI\trunk\data\DamEngineTestProjects\DeltaDijk_zonering_BI + // with Dam Classic rev.1059 + // This project has 2 locations with each 2 profiles + // In one the combinations location-profile (1st location, 2nd profile) DGeoStability stops during the calculation. + // Then the kernel tries to read the safety factor, but fails because the dumpfile is not complete. + // In Release+Classic this returned a result Unexpected Error but the calculation continued with the next combination. + const string calcDir = "TestOutStabWithErrorBishopUpliftVan"; + if (Directory.Exists(calcDir)) + { + Directory.Delete(calcDir, true); // delete previous results + } + + Directory.CreateDirectory(calcDir); + + const string fileName = @"TestFiles\ErrorInDGeoStabilityCalculation.xml"; + string inputString = File.ReadAllText(fileName); + inputString = ChangeInputModel(inputString, InputStabilityModelType.BishopUpliftVan); + inputString = ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DeltaDijk normal.geometries2D.0\"); + inputString = ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DeltaDijk normal0.soilmaterials.mdb"); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + + string outputString = engineInterface.Run(); + + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + + Assert.AreEqual(12, output.Results.CalculationResults.DesignResults.Length); + + var result = output.Results.CalculationResults.DesignResults[3]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Bishop + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor=2.219 + Assert.AreEqual(2.219, result.StabilityDesignResults.SafetyFactor, tolerance); + + result = output.Results.CalculationResults.DesignResults[4]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Uplift Van + Assert.AreEqual(CalculationResult.UnexpectedError, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor not specified + Assert.IsFalse(result.StabilityDesignResults.SafetyFactorSpecified); + + result = output.Results.CalculationResults.DesignResults[5]; + Assert.AreEqual("6-4-3-A-1-C", result.LocationName); + Assert.AreEqual("6-4-3-A-1-C_2_s", result.ProfileName); + // Bishop/Uplift Van + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(result.CalculationResult)); + // SafetyFactor=2.219 + Assert.AreEqual(2.219, result.StabilityDesignResults.SafetyFactor, tolerance); + } + public string ChangeInputModel(string input, InputStabilityModelType modelType) { string pattern = "StabilityModelType=\"Bishop\""; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1131 -r1134 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1131) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1134) @@ -376,15 +376,29 @@ { if (damMacroStabilityOutput.StabilityOutputItems.Count > 1) // UpliftVan was calculated { - var designResult = NewDesignResult(damKernelInput); var damMacroStabilityOutputItem = damMacroStabilityOutput.StabilityOutputItems[1]; if (damMacroStabilityOutputItem != null) { + var designResult = NewDesignResult(damKernelInput); FillDesignResult(damMacroStabilityOutputItem, designResult); designResult.StabilityDesignResults.UpliftSituation = damMacroStabilityOutput.UpliftSituation; + designResults.Add(designResult); } + } + else + { + // add empty result for UpliftVan + var designResult = NewDesignResult(damKernelInput); + designResult.DamFailureMechanismeCalculation.FailureMechanismParametersMStab.MStabParameters.Model = + MStabModelType.UpliftVan; + designResult.CalculationResult = CalculationResult.NoRun; + designResult.StabilityDesignResults.UpliftSituation = damMacroStabilityOutput.UpliftSituation; designResults.Add(designResult); - // add worst result from Bishop/UpliftVan + } + // add worst result from Bishop/UpliftVan, but only if both succeeded. + if (designResults[0].CalculationResult == CalculationResult.Succeeded && + designResults[1].CalculationResult == CalculationResult.Succeeded) + { if (designResults[0].StabilityDesignResults.SafetyFactor <= designResults[1].StabilityDesignResults.SafetyFactor) { designResults.Add(designResults[0]); @@ -396,15 +410,14 @@ } else { - // add empty result for UpliftVan - var designResult = NewDesignResult(damKernelInput); - designResult.DamFailureMechanismeCalculation.FailureMechanismParametersMStab.MStabParameters.Model = - MStabModelType.UpliftVan; - designResult.CalculationResult = CalculationResult.NoRun; - designResult.StabilityDesignResults.UpliftSituation = damMacroStabilityOutput.UpliftSituation; - designResults.Add(designResult); - // add Bishop result as final result - designResults.Add(designResults[0]); + if (designResults[1].CalculationResult == CalculationResult.Succeeded) + { + designResults.Add(designResults[1]); // only Uplift Van succeeded + } + else + { + designResults.Add(designResults[0]); // only Bishop succeeded or both did not succeed + } } } }