Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r1215 -r1216 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1215) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1216) @@ -120,9 +120,18 @@ Het opgegeven niveau {0} in AquitardEvaluator valt buiten het grondprofiel '{1}' en moet tussen {2} en {3} liggen. + + Initiele geometry file (sti) is niet aangemaakt. + + + Ontwerpen wordt niet ondersteund voor dit model ({0}). + Model Horizontaal Evenwicht ondersteunt geen 2D profielen. + + Vereiste evenwichtsfactor is niet opgegeven. + Het gebruik van zones is niet toegestaan voor buitenwaardse stabiliteit. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1215 -r1216 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1215) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1216) @@ -318,7 +318,7 @@ var requiredSafetyFactor = damKernelInput.Location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope; if (requiredSafetyFactor == null) { - throw new MacroStabilityException("Required safety factor must be specified"); + throw new MacroStabilityException(Resources.DamMacroStabilityKernelWrapper_NoRequiredSafetyFactorSpecified); } List errorMessages; @@ -524,8 +524,12 @@ DamMacroStabilityInput damMacroStabilityInput = kernelDataInput as DamMacroStabilityInput; DamMacroStabilityUtils.ThrowWhenMacroStabilityKernelInputNull(damMacroStabilityInput); - string projectWorkingPath = damKernelInput.ProjectDir; //TODO #The - MStabModelType model = MStabModelType.Bishop; //TODO #The + string projectWorkingPath = damKernelInput.ProjectDir; + MStabModelType model = FailureMechanismParametersMStab.MStabParameters.Model; + if (model != MStabModelType.Bishop && model != MStabModelType.BishopUpliftVan) + { + throw new MacroStabilityException(string.Format(Resources.DamMacroStabilityKernelWrapper_DesignNotSupportedForModel, model)); + } string initialgeometryFile = DamMacroStabilityUtils.GetStabilityInputFileName(damKernelInput, iterationIndex, model, projectWorkingPath); var location = damKernelInput.Location; var surfaceLine = damKernelInput.Location.SurfaceLine; @@ -556,7 +560,7 @@ if (!File.Exists(initialgeometryFile)) { - throw new MacroStabilityException("Initial geometry file (sti) is not created."); + throw new MacroStabilityException(Resources.DamMacroStabilityKernelWrapper_CannotCreateInitialGeometryFile); } } private DesignResult NewDesignResult(DamKernelInput damKernelInput, DesignScenario designScenario) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r1215 -r1216 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1215) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1216) @@ -261,4 +261,13 @@ A kernel calculation failed. + + Initial geometry file (sti) is not created. + + + Design not support for this model ({0}). + + + Required safety factor must be specified. + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs =================================================================== diff -u -r1215 -r1216 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 1215) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 1216) @@ -28,6 +28,7 @@ using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; @@ -41,15 +42,15 @@ public class DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption { private const double defaultMaxFractionOfDikeHeightForShoulderHeight = 0.67; - public static void PerformDesignCalculationFirstSlopeAdaptionThenShoulderAdaption - (IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, - IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, - DesignScenario designScenario, - List calculationMessages, List designCalculations) + public static void PerformDesignCalculationFirstSlopeAdaptionThenShoulderAdaption(IKernelWrapper kernelWrapper, + IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, + DesignScenario designScenario, List calculationMessages, List designCalculations) { Location location = damKernelInput.Location; SoilGeometryProbability subSoilScenario = damKernelInput.SubSoilScenario; const int maxRedesignIterations = 200; + string resultMessage = ""; + List designResults; int iterationIndex = -1; // Create the file with the initial geometry to be used to determine which layers have to be defined as dike embankment material @@ -64,6 +65,7 @@ location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); List locationCalculationMessages; KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, iterationIndex, out locationCalculationMessages); + calculationMessages.AddRange(locationCalculationMessages); DesignAdvise designAdivse; string evaluationMessage; isRedesignRequired = !kernelWrapper.EvaluateDesign(damKernelInput, kernelDataInput, kernelDataOutput, out designAdivse, out evaluationMessage); @@ -77,93 +79,90 @@ double maxFractionOfDikeHeightForShoulderHeight = designScenario.Location.UseNewMaxHeightShoulderAsFraction ? designScenario.Location.NewMaxHeightShoulderAsFraction : defaultMaxFractionOfDikeHeightForShoulderHeight; double maxShoulderLevel = CalculateMaximumShoulderLevel(surfaceLine, maxFractionOfDikeHeightForShoulderHeight); - while (isRedesignRequired && surfaceLine != null) + + // First slope adaption + double startCoTangent = location.SlopeAdaptionStartCotangent; + double endCoTangent = location.SlopeAdaptionEndCotangent; + double stepCoTangent = location.SlopeAdaptionStepCotangent; + var orgCotangent = surfaceLine.GetCotangentOfInnerSlope(); + double coTangent = startCoTangent; + double currentCoTangent = orgCotangent; + + // Find out for which cotangent we want to start designing + while (coTangent <= orgCotangent) { - // First slope adaption - double startCoTangent = location.SlopeAdaptionStartCotangent; - double endCoTangent = location.SlopeAdaptionEndCotangent; - double stepCoTangent = location.SlopeAdaptionStepCotangent; - var orgCotangent = surfaceLine.GetCotangentOfInnerSlope(); - double coTangent = startCoTangent; + coTangent += stepCoTangent; + } - // Find out for which cotangent we want to start designing - while (coTangent <= orgCotangent) + // Design for slope adaption + while (isRedesignRequired && (coTangent < endCoTangent)) + { + iterationIndex++; + ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); + + var surfaceLineSlopeAdapter = new SurfaceLineSlopeAdapter(surfaceLine, location); + // The parameter for ConstructNewSurfaceLineBySlope is the tangent of the slope, so use reciproce value + surfaceLine = surfaceLineSlopeAdapter.ConstructNewSurfaceLineBySlope(1 / coTangent); + currentCoTangent = coTangent; + + var validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); + if (validationError != null) { - coTangent += stepCoTangent; + throw new SurfaceLineException(validationError.Text); } + designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, + subSoilScenario.StiFileName, surfaceLine); - // Design for slope adaption - while (isRedesignRequired && (coTangent < endCoTangent)) - { - iterationIndex++; - if (iterationIndex >= maxRedesignIterations) - { - throw new DesignCalculatorException(string.Format(Resources.DesignMaxIterationsExceeded, maxRedesignIterations)); - } - var surfaceLineSlopeAdapter = new SurfaceLineSlopeAdapter(surfaceLine, location); - // The parameter for ConstructNewSurfaceLineBySlope is the tangent of the slope, so use reciproce value - surfaceLine = surfaceLineSlopeAdapter.ConstructNewSurfaceLineBySlope(1 / coTangent); + // Recalculate new surfaceline + location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); + damKernelInput.Location.SurfaceLine = surfaceLine; + kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out embankmentDesignParameters); + KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, iterationIndex, out locationCalculationMessages); + calculationMessages.AddRange(locationCalculationMessages); + isRedesignRequired = !kernelWrapper.EvaluateDesign(damKernelInput, kernelDataInput, kernelDataOutput, out designAdivse, out evaluationMessage); - var validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); - if (validationError != null) - { - throw new SurfaceLineException(validationError.Text); - } - designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, - subSoilScenario.StiFileName, surfaceLine); + coTangent += stepCoTangent; + } - // Recalculate new surfaceline - location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); - damKernelInput.Location.SurfaceLine = surfaceLine; - kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out embankmentDesignParameters); - KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, iterationIndex, out locationCalculationMessages); - isRedesignRequired = !kernelWrapper.EvaluateDesign(damKernelInput, kernelDataInput, kernelDataOutput, out designAdivse, out evaluationMessage); + // Then shoulder adaption + while (isRedesignRequired && surfaceLine != null) + { + iterationIndex++; + ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); - coTangent += stepCoTangent; - } + // Determine new width and height for shoulder + double shoulderHeight; + double shoulderWidth; + GeometryPoint limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); + DetermineNewShoulderWidthAndHeight(designScenario.Location.StabilityShoulderGrowDeltaX, + designScenario.Location.StabilityShoulderGrowSlope, surfaceLine, limitPointForShoulderDesign, + out shoulderHeight, out shoulderWidth); - // Then shoulder adaption - while (isRedesignRequired && surfaceLine != null) + // Create new shoulder + var surfaceLineShoulderAdapter = new SurfaceLineShoulderAdapter(surfaceLine, designScenario.Location); + surfaceLineShoulderAdapter.MaxShoulderLevel = maxShoulderLevel; + surfaceLineShoulderAdapter.SlopeOfNewShoulder = currentCoTangent; + surfaceLine = surfaceLineShoulderAdapter.ConstructNewSurfaceLine(shoulderWidth, shoulderHeight, false); + + var validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); + if (validationError != null) { -// iterationIndex++; -// if (iterationIndex >= maxRedesignIterations) -// { -// throw new MaximumRedesignIterationsReachedException(); -// } -// -// // Determine new width and height for shoulder -// double shoulderHeight; -// double shoulderWidth; -// DetermineNewShoulderWidthAndHeight(designScenario.Location.StabilityShoulderGrowDeltaX, -// designScenario.Location.StabilityShoulderGrowSlope, surfaceLine, limitPointForShoulderDesign, out shoulderHeight, out shoulderWidth); -// -// // Create new shoulder -// var surfaceLineShoulderAdapter = new SurfaceLineShoulderAdapter(surfaceLine, designScenario.Location); -// surfaceLineShoulderAdapter.MaxShoulderLevel = maxShoulderLevel; -// surfaceLineShoulderAdapter.SlopeOfNewShoulder = currentCoTangent; -// surfaceLine = surfaceLineShoulderAdapter.ConstructNewSurfaceLine(shoulderWidth, shoulderHeight, false); -// -// var validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); -// if (validationError != null) -// { -// throw new SurfaceLineException(validationError.Text); -// } -// designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, surfaceLine); -// -// // Recalculate new surfaceline -// designScenario.Location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); -// stabilityCalculator.Calculate(scenario, subSoilScenario.SoilProfile1D, -// GetFullSoilGeometry2DName(subSoilScenario.StiFileName), -// iterationIndex, mstabDesignEmbankment); -// mStabResults = designScenario.GetMStabResults(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName); -// safetyFactor = mStabResults.Value.zone1.safetyFactor; -// beta = designScenario.GetFailureProbabilityStability(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName); -// isRedesignRequired = IsRedesignRequired(safetyFactor, requiredSafetyFactor, betaRequired, beta); -// limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); + throw new SurfaceLineException(validationError.Text); } + designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, surfaceLine); + + // Recalculate new surfaceline + designScenario.Location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); + damKernelInput.Location.SurfaceLine = surfaceLine; + kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out embankmentDesignParameters); + KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, iterationIndex, out locationCalculationMessages); + calculationMessages.AddRange(locationCalculationMessages); + isRedesignRequired = !kernelWrapper.EvaluateDesign(damKernelInput, kernelDataInput, kernelDataOutput, out designAdivse, out evaluationMessage); } } - designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, "Succes"); + designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, "Succes"); + kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, resultMessage, out designResults); + } catch (Exception exception) { @@ -178,15 +177,30 @@ designScenario.CalculationResult = CalculationResult.RunFailed; // Redesign not succesful, so no redesigned surfaceline will be returned designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, null); + kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, designScenario, errorMessage, out designResults); } -// foreach (var errorMessage in stabilityCalculator.ErrorMessages) -// { -// errorMessages.Add(errorMessage); -// } + designCalculations.AddRange(designResults); + } + private static void ThrowWhenMaxIterationsExceeded(int iterationIndex, int maxRedesignIterations) + { + if (iterationIndex >= maxRedesignIterations) + { + throw new DesignCalculatorException(string.Format(Resources.DesignMaxIterationsExceeded, maxRedesignIterations)); + } } - private static void KernelCalculate(out IKernelDataInput kernelDataInput, IKernelWrapper kernelWrapper, out IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, + /// + /// Call the kernel calculation. + /// + /// The kernel data input. + /// The kernel wrapper. + /// The kernel data output. + /// The dam kernel input. + /// Index of the iteration. + /// The location calculation messages. + /// + private static void KernelCalculate(out IKernelDataInput kernelDataInput, IKernelWrapper kernelWrapper, out IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, int iterationIndex, out List locationCalculationMessages) { locationCalculationMessages = new List(); @@ -198,6 +212,37 @@ kernelWrapper.Execute(kernelDataInput, kernelDataOutput, out locationCalculationMessages); } + /// + /// Determines the new height and width of the shoulder width + /// + /// The shoulder grow delta X. + /// The shoulder grow slope. + /// The surface line. + /// The limit point for shoulder design. + /// New height of the shoulder. + /// New width of the shoulder. + private static void DetermineNewShoulderWidthAndHeight(double shoulderGrowDeltaX, double shoulderGrowSlope, + SurfaceLine2 surfaceLine, GeometryPoint limitPointForShoulderDesign, out double shoulderHeight, out double shoulderWidth) + { + // Determine new shoulderpoint + var newShoulderPoint = new GeometryPoint() + { + X = limitPointForShoulderDesign.X + shoulderGrowDeltaX, + Z = limitPointForShoulderDesign.Z + shoulderGrowDeltaX * shoulderGrowSlope + }; + + // Determine new shoulder width and height + shoulderWidth = surfaceLine.DetermineShoulderLengthForGivenShoulderTopInside(newShoulderPoint); + shoulderHeight = newShoulderPoint.Z - surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + } + + /// + /// Calculates the maximum shoulder level. + /// + /// The surface line. + /// Maximum height of the fraction of dike height for shoulder. + /// + /// private static double CalculateMaximumShoulderLevel(SurfaceLine2 surfaceLine, double maxFractionOfDikeHeightForShoulderHeight) { var top = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r1215 -r1216 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1215) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1216) @@ -22,6 +22,7 @@ using System.IO; using System.Text.RegularExpressions; using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Io; using Deltares.DamEngine.Io.XmlInput; @@ -716,13 +717,61 @@ Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); } - [Test, Ignore("Not implemented yet")] + [Test, Category("Work_In_Progress")] // Expected results are determined by running .\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx // with Dam Classic rev.1059 // Select 1st location (DWP_1) // Model Bishop, Set safetyfactor Inwards to 1.4 // Design strategy: SlopeAdaptionBeforeShoulderAdaption // Result: + // SF = 1.444 + // Shoulderheight = 2.799 + // DTH = 4.9 + // Dikelength = 45.387 + // Zone 1 entrypoint circle local X = 39.081 + // Zone 1 entrypoint circle local Z = 5.281 + // Zone 1 exitpoint circle local X = 67.577 + // Zone 1 exitpoint circle local Z = 1.138 + // Iterations = 5 + public void CanPerformStabilityInwardsDesignTutorialDesignSlopeAdaptionBeforeShoulderAdaption_OneLocation() + { + const string calcDir = "TestStabInwardsBishopDesign"; + const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile1LocationWithAdaption.xml"; + string inputString = File.ReadAllText(fileName); + inputString = XmlAdapter.ChangeValueInXml(inputString, "ProjectPath", ""); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used + inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "StabilityDesignMethod", "SlopeAdaptionBeforeShoulderAdaption"); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + + string outputString = engineInterface.Run(); + + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(output); + + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); + SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; + + Assert.AreEqual(1.444, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.SafetyFactor, tolerance); + Assert.AreEqual(1.444, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1SafetyFactor, tolerance); + + Assert.AreEqual(39.081, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1EntryPointX, tolerance); + Assert.AreEqual(67.577, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1ExitPointX, tolerance); + Assert.AreEqual(45.387, redesignedSurfaceLine.GetDikeLength(), tolerance); + Assert.AreEqual(5, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.NumberOfIterations); + Assert.AreEqual("", output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.ResultMessage); + } + + [Test, Category("Work_In_Progress")] + // Expected results are determined by running .\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx + // with Dam Classic rev.1059 + // Select 1st location (DWP_1) + // Model Bishop, Set safetyfactor Inwards to 1.4 + // Design strategy: OptimizedSlopeAndShoulderAdaption + // Result: // SF = 1.412 // Shoulderheight = 3.889 // DTH = 4.9 @@ -731,7 +780,8 @@ // Zone 1 entrypoint circle local Z = 4.144 // Zone 1 exitpoint circle local X = 67.077 // Zone 1 exitpoint circle local Z = 1.677 - public void CanPerformStabilityInwardsDesignTutorialDesign1Location() + // Iterations = 5 + public void CanPerformStabilityInwardsDesignTutorialDesignOptimizedSlopeAndShoulderAdaption_OneLocation() { const string calcDir = "TestStabInwardsBishopDesign"; const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile1LocationWithAdaption.xml"; @@ -740,54 +790,29 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "CalculationMap", calcDir); // Current directory will be used inputString = XmlAdapter.ChangeValueInXml(inputString, "MapForSoilgeometries2D", @"TestFiles\DAM Tutorial Design.geometries2D.0\"); inputString = XmlAdapter.ChangeValueInXml(inputString, "SoilDatabaseName", @"TestFiles\DAM Tutorial Design0.soilmaterials.mdb"); + inputString = XmlAdapter.ChangeValueInXml(inputString, "StabilityDesignMethod", "OptimizedSlopeAndShoulderAdaption"); EngineInterface engineInterface = new EngineInterface(inputString); Assert.IsNotNull(engineInterface.DamProjectData); string outputString = engineInterface.Run(); Assert.IsNotNull(outputString); var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); -// Assert.AreEqual(1.282, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.SafetyFactor, tolerance); -// // Zone1SafetyFactor=1.282 -// Assert.AreEqual(1.282, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1SafetyFactor, tolerance); -// -// // Zone1EntryPointX Local =38.818 Global=47.238 -// Assert.AreEqual(38.818, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1EntryPointX, tolerance); -// // Zone1ExitPointX Local=64.262 Global=72.682 -// Assert.AreEqual(64.262, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1ExitPointX, tolerance); -// -// // Zone2SafetyFactor null, is set to default reading from output.xml -// Assert.AreEqual(0, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone2SafetyFactor, tolerance); -// // Zone2EntryPointX null, is set to default reading from output.xml -// Assert.AreEqual(0, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone2EntryPointX, tolerance); -// // Zone2ExitPointX null, is set to default reading from output.xml -// Assert.AreEqual(0, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone2ExitPointX, tolerance); -// -// // NumberOfIterations=0 -// Assert.AreEqual(0, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.NumberOfIterations); -// // ResultMessage "" -// Assert.AreEqual("", output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.ResultMessage); -// -// // Check that a line is specified -// Assert.IsNotNull(output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.RedesignedSurfaceLine); -// -// // Profile name = DWP_1.sti -// Assert.AreEqual("DWP_1.sti", output.Results.CalculationResults.DesignResults[0].ProfileName); -// -// // Uplift -// var upliftSituation = output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.UpliftSituation; -// Assert.IsNotNull(upliftSituation); -// Assert.AreEqual(true, upliftSituation.IsUplift); -// Assert.AreEqual(1.141, upliftSituation.Pl3MinUplift, tolerance); -// Assert.AreEqual(4.4, upliftSituation.Pl3HeadAdjusted, tolerance); -// Assert.AreEqual(60.64, upliftSituation.Pl3LocationXMinUplift, tolerance); -// Assert.AreEqual(0.0, upliftSituation.Pl4MinUplift, tolerance); -// Assert.AreEqual(0.0, upliftSituation.Pl4HeadAdjusted, tolerance); -// Assert.AreEqual(0.0, upliftSituation.Pl4LocationXMinUplift, tolerance); -// -// // Calculation Result -// Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(output); + + Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); + SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; + + Assert.AreEqual(1.444, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.SafetyFactor, tolerance); + Assert.AreEqual(1.444, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1SafetyFactor, tolerance); + + Assert.AreEqual(39.081, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1EntryPointX, tolerance); + Assert.AreEqual(67.577, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.Zone1ExitPointX, tolerance); + Assert.AreEqual(45.387, redesignedSurfaceLine.GetDikeLength(), tolerance); + Assert.AreEqual(5, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.NumberOfIterations); + Assert.AreEqual("", output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.ResultMessage); } + [Test] // Expected results are determined by running .\DamUI\trunk\data\DamEngineTestProjects\DAM Tutorial Design\DAM Tutorial Design.damx // with Dam Classic rev.1059 @@ -816,7 +841,7 @@ return result; } - + } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r1215 -r1216 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1215) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1216) @@ -70,6 +70,24 @@ } /// + /// Looks up a localized string similar to Initial geometry file (sti) is not created.. + /// + internal static string DamMacroStabilityKernelWrapper_CannotCreateInitialGeometryFile { + get { + return ResourceManager.GetString("DamMacroStabilityKernelWrapper_CannotCreateInitialGeometryFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Design not support for this model ({0}).. + /// + internal static string DamMacroStabilityKernelWrapper_DesignNotSupportedForModel { + get { + return ResourceManager.GetString("DamMacroStabilityKernelWrapper_DesignNotSupportedForModel", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Model horizontal balance does not support 2d-geometries.. /// internal static string DamMacroStabilityKernelWrapper_HorBal2DProfNotAllowed { @@ -79,6 +97,15 @@ } /// + /// Looks up a localized string similar to Required safety factor must be specified.. + /// + internal static string DamMacroStabilityKernelWrapper_NoRequiredSafetyFactorSpecified { + get { + return ResourceManager.GetString("DamMacroStabilityKernelWrapper_NoRequiredSafetyFactorSpecified", resourceCulture); + } + } + + /// /// Looks up a localized string similar to The use of Zone Areas is not allowed for stability outside.. /// internal static string DamMacroStabilityKernelWrapper_OutsideWithZoneAreasNotAllowed {