Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r1200 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1200) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1215) @@ -174,12 +174,18 @@ Validatie faalt voor locatie '{0}', ondergrond scenario '{1}', ontwerp scenario '{2}' + + Maximum aantal iteraties {0} is overschreden. + Het ontwerpen is niet gelukt in locatie '{0}', ondergrondprofiel '{1}' Factor bereikt = {1:0.000}, Factor benodigd = {1:0.000}. + + Een kernel berekening is mislukt. + De buitenwaartse waterstand ({0}) ligt onder het buitenwaartse maaiveld ({1}). Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r1200 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1200) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1215) @@ -236,6 +236,15 @@ } /// + /// Looks up a localized string similar to Maximum design iterations ({0} exceeded.. + /// + internal static string DesignMaxIterationsExceeded { + get { + return ResourceManager.GetString("DesignMaxIterationsExceeded", resourceCulture); + } + } + + /// /// Looks up a localized string similar to The design was not successful in location '{0}', soilprofile '{1}'. /// internal static string DesignUnsuccessful { @@ -254,6 +263,15 @@ } /// + /// Looks up a localized string similar to A kernel calculation failed.. + /// + internal static string KernelCalculationFailed { + get { + return ResourceManager.GetString("KernelCalculationFailed", resourceCulture); + } + } + + /// /// Looks up a localized string similar to River level ({0}) is below surface level at river side ({1}).. /// internal static string MStabXmlDoc_CreateMStabXmlDoc_RiverLevelHighIsBelowSurfaceLevelOutside { Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r1203 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1203) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 1215) @@ -716,7 +716,7 @@ Assert.AreEqual(DesignResultStabilityDesignResultsStabilityModelType.BishopUpliftVan, result.StabilityDesignResults.StabilityModelType); } - [Test] + [Test, Ignore("Not implemented yet")] // 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) Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.nl-NL.resx =================================================================== diff -u -r877 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1215) @@ -117,6 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + GetCotangentOfInnerSlope heeft karakteristiek punt insteek berm of dijk teen polderzijde nodig. + + + GetCotangentOfInnerSlope heeft karakteristiek punt bovenkant dijk binnenkant nodig. + Bij het samenstellen van de aquifer laag voor 1D profiel {0} hebben de samen te voegen lagen verschillende interpolatie methoden hetgeen niet is toegestaan. Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs =================================================================== diff -u -r1090 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 1090) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 1215) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Properties; using Deltares.DamEngine.Data.Standard; namespace Deltares.DamEngine.Data.Geotechnics @@ -525,7 +526,36 @@ return 0.0; } + /// + /// Gets the cotangent of inner slope. + /// + /// The line. + /// + /// + /// GetCotangentOfInnerSlope requires characteristic point DikeTopAtPolder to be defined. + /// or + /// GetCotangentOfInnerSlope requires either of characteristic points ShoulderBaseInside or DikeToeAtPolder to be defined. + /// + public static double GetCotangentOfInnerSlope(this SurfaceLine2 line) + { + GeometryPoint geometryPoint = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + if (geometryPoint == null) + throw new InvalidOperationException(Resources.GetCotangentOfInnerSlopeDikeTopAtPolderRequired); + GeometryPoint dikeToeInward = line.GetDikeToeInward(); + if (dikeToeInward == null) + throw new InvalidOperationException(Resources.GetCotangentOfInnerSlopeDikeToeAtPolderRequired); + return Math.Abs((dikeToeInward.X - geometryPoint.X) / (geometryPoint.Z - dikeToeInward.Z)); + } + /// + /// Gets the limit point for shoulder design. + /// + /// The line. + /// + public static GeometryPoint GetLimitPointForShoulderDesign(this SurfaceLine2 line) + { + return line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside) ?? line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + } #region Private methods /// /// Create a horizontal line from a given starting X coordinate and ending at the Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r877 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1215) @@ -61,6 +61,24 @@ } /// + /// Looks up a localized string similar to GetCotangentOfInnerSlope requires either of characteristic points ShoulderBaseInside or DikeToeAtPolder to be defined.. + /// + internal static string GetCotangentOfInnerSlopeDikeToeAtPolderRequired { + get { + return ResourceManager.GetString("GetCotangentOfInnerSlopeDikeToeAtPolderRequired", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to GetCotangentOfInnerSlope requires characteristic point DikeTopAtPolder to be defined.. + /// + internal static string GetCotangentOfInnerSlopeDikeTopAtPolderRequired { + get { + return ResourceManager.GetString("GetCotangentOfInnerSlopeDikeTopAtPolderRequired", resourceCulture); + } + } + + /// /// Looks up a localized string similar to In combining the aquifer layer for 1D profile {0}, different water pressure interpolation models are used in the layers concerned which is not allowed.. /// internal static string SoilProfile1DAquiferLayerCombiner_CombineLayers_InconsistentWaterpressureInterpolationModel { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs =================================================================== diff -u -r1211 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 1211) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 1215) @@ -21,14 +21,17 @@ using System; using System.Collections.Generic; +using System.Linq; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; +using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Calculators.DikesDesign { @@ -37,6 +40,7 @@ /// public class DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption { + private const double defaultMaxFractionOfDikeHeightForShoulderHeight = 0.67; public static void PerformDesignCalculationFirstSlopeAdaptionThenShoulderAdaption (IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, @@ -45,124 +49,88 @@ { Location location = damKernelInput.Location; SoilGeometryProbability subSoilScenario = damKernelInput.SubSoilScenario; - double requiredSafetyFactor = location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope.Value; const int maxRedesignIterations = 200; - int iterationIndex = 1; - SurfaceLine2 orgSurfaceLine = location.SurfaceLine; + 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 - var EmbankmentDesignParameters = new EmbankmentDesignParameters(); - kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out EmbankmentDesignParameters); - string previousFilename = EmbankmentDesignParameters.PreviousGeometry2DFilename; - // CreateInitialGeometry(scenario, stabilityCalculator, soilProfileProbability, orgSurfaceLine, out previousFilename); + EmbankmentDesignParameters embankmentDesignParameters; + kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out embankmentDesignParameters); SurfaceLine2 surfaceLine = designScenario.GetMostRecentSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName).FullDeepClone(); -// var designEmbankmentDesignParameters = new DesignEmbankmentDesignParameters -// { -// EmbankmentMaterialname = location.DikeEmbankmentMaterial, -// PreviousGeometry2DFilename = previousFilename -// }; -// try { - double? beta; + iterationIndex = 1; bool isRedesignRequired; - double? exitPointXCoordinate; location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); List locationCalculationMessages; - PrepareResult prepareResult = kernelWrapper.Prepare(damKernelInput, 0, out kernelDataInput, out kernelDataOutput); - if (prepareResult == PrepareResult.Successful) + KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, iterationIndex, out locationCalculationMessages); + DesignAdvise designAdivse; + string evaluationMessage; + isRedesignRequired = !kernelWrapper.EvaluateDesign(damKernelInput, kernelDataInput, kernelDataOutput, out designAdivse, out evaluationMessage); + if (!isRedesignRequired && surfaceLine != null) { - kernelWrapper.Execute(kernelDataInput, kernelDataOutput, out locationCalculationMessages); + // Set redesigned surfaceline to original, so in case no redesign is needed, the original surfaceline will be returned + designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, surfaceLine); } - // stabilityCalculator.Calculate(designScenario, subSoilScenario.SoilProfile1D, - // GetFullSoilGeometry2DName(subSoilScenario.StiFileName), - // iterationIndex, mstabDesignEmbankment); -// mstabDesignEmbankment.PreviousGeometry2DFilename = stabilityCalculator.StabilityProjectFilename; -// mstabDesignEmbankment.EmbankmentMaterialname = location.ShoulderEmbankmentMaterial; -// MStabResults? mStabResults = designScenario.GetMStabResults(subSoilScenario.SoilProfile1D, -// subSoilScenario.StiFileName); -// double? safetyFactor = mStabResults.Value.zone1.safetyFactor; -// beta = designScenario.GetFailureProbabilityStability(subSoilScenario.SoilProfile1D, -// subSoilScenario.StiFileName); -// isRedesignRequired = IsRedesignRequired(safetyFactor, requiredSafetyFactor, betaRequired, beta); -// exitPointXCoordinate = mStabResults.Value.zone1.circleSurfacePointRightXCoordinate; -// -// if (!isRedesignRequired && surfaceLine != null) -// { -// // Set redesigned surfaceline to original, so in case no redesign is needed, the original surfaceline will be returned -// designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, -// subSoilScenario.StiFileName, surfaceLine); -// } -// else -// { -// 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) -// { -// coTangent += stepCoTangent; -// } -// -// // Design for slope adaption -// GeometryPoint limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); -// while (isRedesignRequired && (coTangent < endCoTangent)) -// { + else + { + 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; + + // Find out for which cotangent we want to start designing + while (coTangent <= orgCotangent) + { + coTangent += stepCoTangent; + } + + // 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); + + 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 + 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); + + coTangent += stepCoTangent; + } + + // Then shoulder adaption + while (isRedesignRequired && surfaceLine != null) + { // iterationIndex++; // if (iterationIndex >= maxRedesignIterations) // { // throw new MaximumRedesignIterationsReachedException(); // } -// var surfaceLineSlopeAdapter = new SurfaceLineSlopeAdapter(surfaceLine, designScenario.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) -// { -// throw new SurfaceLineException(validationError.Text); -// } -// designScenario.SetRedesignedSurfaceLine(subSoilScenario.SoilProfile1D, -// subSoilScenario.StiFileName, surfaceLine); -// -// // Recalculate new surfaceline -// designScenario.Location.AlignBoundaryPointsOfPL1LineWithAdaptedSurfaceLine(surfaceLine); -// stabilityCalculator.Calculate(designScenario, subSoilScenario.SoilProfile1D, -// GetFullSoilGeometry2DName(subSoilScenario.StiFileName), -// iterationIndex, mstabDesignEmbankment); -// mStabResults = designScenario.GetMStabResults(subSoilScenario.SoilProfile1D, -// subSoilScenario.StiFileName); -// safetyFactor = mStabResults.Value.zone1.safetyFactor; -// exitPointXCoordinate = mStabResults.Value.zone1.circleSurfacePointRightXCoordinate; -// beta = designScenario.GetFailureProbabilityStability(subSoilScenario.SoilProfile1D, -// subSoilScenario.StiFileName); -// isRedesignRequired = IsRedesignRequired(safetyFactor, requiredSafetyFactor, betaRequired, beta); -// limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); -// -// coTangent += stepCoTangent; -// } -// -// // Then shoulder adaption -// while (isRedesignRequired && surfaceLine != null) -// { -// iterationIndex++; -// if (iterationIndex >= maxRedesignIterations) -// { -// throw new MaximumRedesignIterationsReachedException(); -// } -// // // Determine new width and height for shoulder // double shoulderHeight; // double shoulderWidth; @@ -192,10 +160,10 @@ // beta = designScenario.GetFailureProbabilityStability(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName); // isRedesignRequired = IsRedesignRequired(safetyFactor, requiredSafetyFactor, betaRequired, beta); // limitPointForShoulderDesign = surfaceLine.GetLimitPointForShoulderDesign(); -// } -// } -// } - designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, "Succes"); + } + } + } + designScenario.SetResultMessage(subSoilScenario.SoilProfile1D, subSoilScenario.StiFileName, "Succes"); } catch (Exception exception) { @@ -217,30 +185,29 @@ // } } - //private void CreateInitialGeometry(StabilityCalculator stabilityCalculator, SoilGeometryProbability soilProfileProbability, SurfaceLine2 surfaceLine, out String initialgeometryFile) - //{ - // const int IterationIndex = -1; - // initialgeometryFile = StabilityCalculator.DetermineCalculationFilename(scenario.Location.Name, scenario.LocationScenarioID, soilProfileProbability.SoilGeometryName, IterationIndex); - // initialgeometryFile = initialgeometryFile + stabilityCalculator.GetFilenameExtension(); - // initialgeometryFile = Path.Combine(stabilityCalculator.GetStabilityCalculationDirectory(), initialgeometryFile); - // double riverLevel = 0.5 * (surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z + - // surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z); - // string soilgeometry2DFilename = null; - // if (soilProfileProbability.SoilGeometry2DName != null) - // { - // soilgeometry2DFilename = - // Path.GetFullPath(Path.Combine(DamProject.ProjectMap, Path.Combine(scenario.Location.MapForSoilGeometries2D, soilProfileProbability.SoilGeometry2DName))); - // } - // XDocument mstabXML = stabilityCalculator.CreateMStabXmlDoc(initialgeometryFile, scenario, soilProfileProbability.SoilProfile, - // soilgeometry2DFilename, riverLevel, null, surfaceLine); - // mstabXML.Save(initialgeometryFile + ".xml"); - // var stabilityServiceAgent = new StabilityServiceAgent(); - // stabilityServiceAgent.CreateProjectFile(mstabXML.ToString()); - // if (!File.Exists(initialgeometryFile)) - // { - // throw new DamFailureMechanismeCalculatorException("Initial geometry file (sti) is not created."); - // } - //} + private static void KernelCalculate(out IKernelDataInput kernelDataInput, IKernelWrapper kernelWrapper, out IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, + int iterationIndex, out List locationCalculationMessages) + { + locationCalculationMessages = new List(); + PrepareResult prepareResult = kernelWrapper.Prepare(damKernelInput, iterationIndex, out kernelDataInput, out kernelDataOutput); + if (prepareResult != PrepareResult.Successful) + { + throw new DesignCalculatorException(Resources.KernelCalculationFailed); + } + kernelWrapper.Execute(kernelDataInput, kernelDataOutput, out locationCalculationMessages); + } + + private static double CalculateMaximumShoulderLevel(SurfaceLine2 surfaceLine, double maxFractionOfDikeHeightForShoulderHeight) + { + var top = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; + var bottom = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + if (top - bottom <= 0) + { + throw new SurfaceLineAdapterException(Resources.SurfaceLineShoulderAdapterMaxShoulderHeightError); + } + double maxHeight = Math.Abs((top - bottom) * maxFractionOfDikeHeightForShoulderHeight); + return bottom + maxHeight; + } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1212 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1212) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1215) @@ -473,7 +473,31 @@ public bool EvaluateDesign(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out DesignAdvise designAdvise, out string evaluationMessage) { - throw new NotImplementedException(); + DamMacroStabilityInput damMacroStabilityInput = kernelDataInput as DamMacroStabilityInput; + DamMacroStabilityOutput damMacroStabilityOutput = kernelDataOutput as DamMacroStabilityOutput; + DamMacroStabilityUtils.ThrowWhenMacroStabilityKernelInputNull(damMacroStabilityInput); + DamMacroStabilityUtils.ThrowWhenMacroStabilityKernelOutputNull(damMacroStabilityOutput); + DamMacroStabilityUtils.ThrowWhenMacroStabilityDamKernelInputNull(damKernelInput); + double fosRequired = damKernelInput.Location.ModelFactors.RequiredSafetyFactorStabilityInnerSlope.Value; + var zoneResult = damMacroStabilityOutput.StabilityOutputItems[0].Zone1Results; + double fosAchieved = zoneResult.SafetyFactor; + double exitPointXCoordinate = zoneResult.CircleSurfacePointRightXCoordinate; + GeometryPoint limitPointForShoulderDesign = damKernelInput.Location.SurfaceLine.GetLimitPointForShoulderDesign(); + evaluationMessage = String.Format(Resources.FactorAchievedVsFactorRequired, fosAchieved, fosRequired); + if (exitPointXCoordinate > limitPointForShoulderDesign.X) + { + designAdvise = DesignAdvise.ShoulderInwards; + } + else + { + designAdvise = DesignAdvise.SlopeInwards; + } + bool isDesignReady = fosAchieved >= fosRequired; + if (isDesignReady) + { + designAdvise = DesignAdvise.None; + } + return isDesignReady; } /// @@ -485,6 +509,15 @@ return DesignStrategy.SlopeAdaptionBeforeShoulderAdaption; } + /// + /// Prepares the design. + /// + /// The kernel data input. + /// The kernel data output. + /// The dam kernel input. + /// Index of the iteration. + /// The embankment design parameters. + /// Initial geometry file (sti) is not created. public void PrepareDesign(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, int iterationIndex, out EmbankmentDesignParameters embankmentDesignParameters) { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r1200 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1200) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1215) @@ -255,4 +255,10 @@ No Dam input object defined for Macro Stability + + Maximum design iterations ({0} exceeded. + + + A kernel calculation failed. + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs =================================================================== diff -u -r1212 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 1212) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 1215) @@ -346,11 +346,11 @@ ThrowWhenKernelInputNull(damPipingBlighInput); ThrowWhenDamKernelInputNull(damKernelInput); ThrowWhenKernelOutputNull(damPipingBlighOutput); - double fosRequiered = damKernelInput.Location.ModelFactors.RequiredSafetyFactorPiping.Value; + double fosRequired = damKernelInput.Location.ModelFactors.RequiredSafetyFactorPiping.Value; double fosAchieved = damPipingBlighOutput.FoSp; - evaluationMessage = String.Format(Resources.FactorAchievedVsFactorRequired, fosAchieved, fosRequiered); + evaluationMessage = String.Format(Resources.FactorAchievedVsFactorRequired, fosAchieved, fosRequired); designAdvise = DesignAdvise.None; - return (fosAchieved >= fosRequiered); + return (fosAchieved >= fosRequired); } public void PrepareDesign(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.resx =================================================================== diff -u -r877 -r1215 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.resx (.../Resources.resx) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Properties/Resources.resx (.../Resources.resx) (revision 1215) @@ -1,103 +1,128 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + GetCotangentOfInnerSlope requires either of characteristic points ShoulderBaseInside or DikeToeAtPolder to be defined. + + + GetCotangentOfInnerSlope requires characteristic point DikeTopAtPolder to be defined. + In combining the aquifer layer for 1D profile {0}, different water pressure interpolation models are used in the layers concerned which is not allowed.