Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs =================================================================== diff -u -r686 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 686) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 715) @@ -23,6 +23,49 @@ /// The water level. /// The uplift situation. /// + public static PLLines CreatePlLinesForStability(Location location, SoilGeometryProbability subSoilScenario, + double waterLevel, string soilGeometry2DName, out UpliftSituation upliftSituation) + { + var plLinesCreator = new PLLinesCreator + { + WaterLevelRiverHigh = waterLevel, + SurfaceLine = location.SurfaceLine, + WaterLevelPolder = location.PolderLevel, + HeadInPLLine2 = location.HeadPl2, + HeadInPLLine3 = location.HeadPl3, + HeadInPLLine4 = location.HeadPl4, + ModelParametersForPLLines = location.ModelParametersForPLLines, + SoilProfile = subSoilScenario.SoilProfile1D, + SoilProfileType = subSoilScenario.SoilProfileType, + SoilGeometry2DName = soilGeometry2DName, + GaugePLLines = null, // TODO: Operational + Gauges = null, // TODO: Operational + IsAdjustPL3AndPL4SoNoUpliftWillOccurEnabled = true, // for stability this must be set to true + PlLineOffsetBelowDikeTopAtRiver = location.PlLineOffsetBelowDikeTopAtRiver, + PlLineOffsetBelowDikeTopAtPolder = location.PlLineOffsetBelowDikeTopAtPolder, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + IsHydraulicShortcut = false, // TODO: Regional + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + var plLines = plLinesCreator.CreateAllPLLines(location); + upliftSituation.Pl3HeadAdjusted = plLinesCreator.Pl3HeadAdjusted; + upliftSituation.Pl3LocationXMinUplift = plLinesCreator.Pl3LocationXMinUplift; + upliftSituation.Pl3MinUplift = plLinesCreator.Pl3MinUplift; + upliftSituation.Pl4HeadAdjusted = plLinesCreator.Pl4HeadAdjusted; + upliftSituation.Pl4LocationXMinUplift = plLinesCreator.Pl4LocationXMinUplift; + upliftSituation.Pl4MinUplift = plLinesCreator.Pl4MinUplift; + upliftSituation.IsUplift = false; // must be determined later on; just to avoid compiler error + return plLines; + } + + /// + /// Creates the pl lines. + /// + /// The location. + /// The soil profile. + /// The water level. + /// The uplift situation. + /// public static PLLines CreatePlLines(Location location, SoilProfile1D soilProfile, double waterLevel, out UpliftSituation upliftSituation) { var plLinesCreator = new PLLinesCreator Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapper.cs =================================================================== diff -u -r694 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapper.cs (.../DamMacroStabilityKernelWrapper.cs) (revision 694) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapper.cs (.../DamMacroStabilityKernelWrapper.cs) (revision 715) @@ -34,18 +34,32 @@ /// public PrepareResult Prepare(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) { - // TODO: this is just fake data + // ToDo zant set stiFileName +// string stabilityDirectory = GetStabilityCalculationDirectory(); +// string filenameExtension = GetFilenameExtension(); +// string fileName = calculationName + filenameExtension; +// var stabilityProjectFilename = Path.Combine(stabilityDirectory, fileName); + const string testFolder = @"..\..\Deltares.DamEngine.Calculators.Tests\Files\MacroStability"; // Relative paths in ini file do not work yet in DGeoStability 16.2. This is fixed in 18.1. var absoluteFolder = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), testFolder)); var stiFileName = Path.Combine(absoluteFolder, "test.sti"); - kernelDataInput = new DamMacroStabilityInput() + + + var damPipingInput = new DamMacroStabilityInput() { DGeoStabilityExePath = Path.Combine(DamMacroStabilityFolder, DGeoStabilityExe), DGeoStabilityInputFileName = stiFileName }; + kernelDataInput = damPipingInput; kernelDataOutput = new DamMacroStabilityOutput(); + // Write xml file + XDocument xmlDocument = CreateMstabDamXmlDocument(damKernelInput, damPipingInput); + + // Use xml file to create sti file + CreateStiFile(xmlDocument); + return PrepareResult.Successful; } @@ -82,14 +96,6 @@ DamMacroStabilityOutput damMacroStabilityOutput = (DamMacroStabilityOutput) kernelDataOutput; messages = new List(); - // ToDo zant Question: write sti file in prepare or in execute? - - // Write xml file - XDocument xmlDocument = CreateMstabDamXmlDocument(); - - // Use xml file to create sti file - CreateStiFile(xmlDocument); - // start calculation var calculator = StabilityCalculator(kernelDataInput); calculator.Calculate(); @@ -118,50 +124,34 @@ } } - internal XDocument CreateMstabDamXmlDocument() + internal XDocument CreateMstabDamXmlDocument(DamKernelInput damKernelInput, DamMacroStabilityInput kernelDataInput) { - // ToDo zant Fake data -// var stabilityProjectFilename = "testproject"; -// var scenario = new DesignScenario(); -// var soilProfile = new SoilProfile1D(); -// var soilGeometry2DName = "testgeom2D"; -// var riverLevel = 1.1; -// var mstabDesignEmbankment = new MStabDesignEmbankment(); -// var surfaceLine = new SurfaceLine2(); -// var trafficLoad = 2.2; -// var requiredSafetyFactor = 1.2; -// List errorMessages; -// -// XDocument TestmstabXml = MStabXmlDoc.CreateMStabXmlDoc(stabilityProjectFilename, scenario, soilProfile, soilGeometry2DName, -// riverLevel, mstabDesignEmbankment, surfaceLine, trafficLoad, requiredSafetyFactor, out errorMessages); -// TestmstabXml.Save(stabilityProjectFilename + ".xml"); - - // ToDo zant_xml tmp use predefined xml doc until CreateMstabDamXmlDocument is fully implemented const string testFolder = @"..\..\Deltares.DamEngine.Calculators.Tests\Files\MacroStability"; - var xmlFileName = Path.Combine(testFolder, "test.xml"); - var stiFileName = Path.Combine(testFolder, "test.sti"); + // var stabilityProjectFilename = Path.Combine(testFolder, "test.sti"); + // var soilDbName = var geometryFileName = Path.Combine(testFolder, "DWP_1.sti"); - var soilDbName = Path.Combine(testFolder, "DAM Tutorial Design0.soilmaterials.mdb"); - XDocument mstabXml = XDocument.Load(xmlFileName); - XElement inputElement = (from element in mstabXml.Root.Descendants() - where element.Name.LocalName == DamMStabAssembler.XmlElementNameInput - select element).Single(); - XAttribute mstabFileName = inputElement.Attribute(DamMStabAssembler.XmlAttributeMStabFileName); - Debug.Assert(mstabFileName != null, "mstabFileName != null"); - mstabFileName.Value = stiFileName; - // modify name of Soil DB Name - XAttribute dbName = inputElement.Attribute(DamMStabAssembler.XmlAttributeSoilDBName); - Debug.Assert(dbName != null, "dbName != null"); - dbName.Value = soilDbName; + var stabilityProjectFilename = kernelDataInput.DGeoStabilityInputFileName; + var scenario = damKernelInput.DesignScenario; + var subSoilScenario = damKernelInput.SubSoilScenario; + var riverLevel = scenario.RiverLevel; + var surfaceLine = scenario.Location.SurfaceLine; + var trafficLoad = scenario.Location.StabilityOptions.TrafficLoad; + var requiredSafetyFactor = scenario.RequiredSafetyFactorStabilityInnerSlope; + if (requiredSafetyFactor == null) + { + throw new MacroStabilityException("Required safety factor must be specified"); + } + List errorMessages; + + // ToDo zant + scenario.Location.StabilityOptions.MapForSoilGeometries2D = testFolder; + scenario.Location.SoildatabaseName = Path.Combine(testFolder, "DAM Tutorial Design0.soilmaterials.mdb"); + scenario.Location.DikeEmbankmentMaterial = "dijksmateriaal_klei"; - // modify name of geometry input file - XElement geometryOptionsElement = (from element in inputElement.Descendants() - where element.Name.LocalName == DamMStabAssembler.XmlElementGeometryCreationOptions - select element).Single(); - XAttribute geomFileName = geometryOptionsElement.Attribute(DamMStabAssembler.XmlAttributeSoilGeometry2DFilename); - Debug.Assert(geomFileName != null, "geomFileName != null"); - geomFileName.Value = geometryFileName; + XDocument mstabXml = MStabXmlDoc.CreateMStabXmlDoc(stabilityProjectFilename, scenario, subSoilScenario, + riverLevel, null, surfaceLine, trafficLoad, requiredSafetyFactor.Value, out errorMessages); + mstabXml.Save(stabilityProjectFilename + ".xml"); return mstabXml; } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapperTests.cs =================================================================== diff -u -r694 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapperTests.cs (.../DamMacroStabilityKernelWrapperTests.cs) (revision 694) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapperTests.cs (.../DamMacroStabilityKernelWrapperTests.cs) (revision 715) @@ -38,39 +38,39 @@ [TestFixture] public class DamMacroStabilityTests { - [Test] - public void TestFullCalculation() - { - const double diff = 0.01; +// [Test] +// public void TestFullCalculation() +// { +// const double diff = 0.01; +// +// // ToDo zant Fill input +// var damKernelInput = new DamKernelInput(); +// +// var kernelWrapper = new DamMacroStabilityKernelWrapper(); +// +// // Prepare the wrapper. Result is input for the calculation dll +// IKernelDataInput damStabilityInput; +// IKernelDataOutput kernelOutput; +// kernelWrapper.Prepare(damKernelInput, out damStabilityInput, out kernelOutput); +// +// // Validate the input +// List messages; +// kernelWrapper.Validate(damStabilityInput, kernelOutput, out messages); +// Assert.AreEqual(0, messages.Count); +// +// // Run the dll +// kernelWrapper.Execute(damStabilityInput, kernelOutput, out messages); +// DamMacroStabilityOutput damMacroStabilityOutput = (DamMacroStabilityOutput) kernelOutput; +// Assert.AreEqual(0, messages.Count); +// Assert.AreEqual(1.282, damMacroStabilityOutput.Zone1.SafetyFactor, diff); +// Assert.IsNull(damMacroStabilityOutput.Zone2); +// +// // Fill the design results +// DesignResult result; +// kernelWrapper.PostProcess(damKernelInput, damMacroStabilityOutput, "", out result); +// Assert.AreEqual(1.282, result.StabilityDesignResults.SafetyFactor, diff); +// } - // ToDo zant Fill input - var damKernelInput = new DamKernelInput(); - - var kernelWrapper = new DamMacroStabilityKernelWrapper(); - - // Prepare the wrapper. Result is input for the calculation dll - IKernelDataInput damStabilityInput; - IKernelDataOutput kernelOutput; - kernelWrapper.Prepare(damKernelInput, out damStabilityInput, out kernelOutput); - - // Validate the input - List messages; - kernelWrapper.Validate(damStabilityInput, kernelOutput, out messages); - Assert.AreEqual(0, messages.Count); - - // Run the dll - kernelWrapper.Execute(damStabilityInput, kernelOutput, out messages); - DamMacroStabilityOutput damMacroStabilityOutput = (DamMacroStabilityOutput) kernelOutput; - Assert.AreEqual(0, messages.Count); - Assert.AreEqual(1.71, damMacroStabilityOutput.Zone1.SafetyFactor, diff); - Assert.IsNull(damMacroStabilityOutput.Zone2); - - // Fill the design results - DesignResult result; - kernelWrapper.PostProcess(damKernelInput, damMacroStabilityOutput, "", out result); - Assert.AreEqual(1.71, result.StabilityDesignResults.SafetyFactor, diff); - } - [Test] public void TestCreateDGeoStabilityInputFile() { Index: dam engine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs =================================================================== diff -u -r711 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs (.../FillDamFromXmlInput.cs) (revision 711) +++ dam engine/trunk/src/Deltares.DamEngine.Interface/FillDamFromXmlInput.cs (.../FillDamFromXmlInput.cs) (revision 715) @@ -166,7 +166,8 @@ foreach (var designScenario in location.Scenarios) { designScenario.Location = location; - } + } + location.SoilList = project.Dike.SoilList; } } @@ -280,7 +281,7 @@ designScenario.RequiredSafetyFactorPiping = (inputLocationDesignScenario.RequiredSafetyFactorPipingSpecified ? (double?)inputLocationDesignScenario.RequiredSafetyFactorPiping : null); location.Scenarios.Add(designScenario); - } + } } location.DikeEmbankmentMaterial = inputLocation.DikeEmbankmentMaterial; if (inputLocation.StabilityOptions != null) Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs =================================================================== diff -u -r701 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 701) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 715) @@ -32,14 +32,14 @@ var surfaceLine = scenario.Location.SurfaceLine; var trafficLoad = 10.0; - var soilProfile = damProjectData.Dike.SoilProfiles[0]; + var subSoilScenario = scenario.Location.Segment.SoilProfileProbabilities[0]; + subSoilScenario.SoilProfileType = SoilProfileType.ProfileTypeStiFile; - XDocument mstabXml = MStabXmlDoc.CreateMStabXmlDoc(stabilityProjectFilename, scenario, soilProfile, null, + // ToDo mStabDesignEmbankment for now set to null + XDocument mstabXml = MStabXmlDoc.CreateMStabXmlDoc(stabilityProjectFilename, scenario, subSoilScenario, scenario.RiverLevel, null, surfaceLine, trafficLoad, requiredSafetyFactor, out errorMessages); mstabXml.Save(stabilityProjectFilename + ".xml"); - // ToDo zant The results below where taken from a the xml file generated with this test. - XElement inputElement = (from element in mstabXml.Root.Descendants() where element.Name.LocalName == DamMStabAssembler.XmlElementNameInput select element).Single(); @@ -55,7 +55,6 @@ XElement surfaceLineElement = (from element in inputElement.Descendants() where element.Name.LocalName == DamMStabAssembler.XmlElementSurfaceLine select element).Single(); - Assert.AreEqual(8, surfaceLineElement.Elements().Count()); var surfacePointElement = surfaceLineElement.Elements().First(); attribute = surfacePointElement.Attributes(DamMStabAssembler.XmlAttributeXCoord).FirstOrDefault(); Assert.IsNotNull(attribute); @@ -65,7 +64,6 @@ XElement characteristicPointsElement = (from element in inputElement.Descendants() where element.Name.LocalName == DamMStabAssembler.XmlElementCharacteristicPoints select element).Single(); - Assert.AreEqual(6, characteristicPointsElement.Elements().Count()); var characteristicPointElement = characteristicPointsElement.Elements().First(); attribute = characteristicPointElement.Attributes(DamMStabAssembler.XmlAttributeXCoord).FirstOrDefault(); Assert.IsNotNull(attribute); @@ -77,7 +75,6 @@ XElement externalPlLinesElement = (from element in inputElement.Descendants() where element.Name.LocalName == DamMStabAssembler.XmlElementExternalPLLines select element).Single(); - Assert.AreEqual(4, externalPlLinesElement.Elements().Count()); var plLineElement = externalPlLinesElement.Elements().First(); Assert.AreEqual(6, plLineElement.Elements().Count()); attribute = plLineElement.Attributes(DamMStabAssembler.XmlAttributeIsPhreatic).FirstOrDefault(); @@ -104,6 +101,17 @@ attribute = modelElement.Attributes(DamMStabAssembler.XmlAttributeGridPosition).FirstOrDefault(); Assert.IsNotNull(attribute); + // ToDo zant To add traffic load, surfaceline needs point with CharacteristicPointType.TrafficLoadInside and point with CharacteristicPointType.TrafficLoadOutside + // XElement TrafficLoadElement = (from element in inputElement.Descendants() + // where element.Name.LocalName == DamMStabAssembler.XmlElementTrafficLoad + // select element).Single(); +// attribute = TrafficLoadElement.Attributes(DamMStabAssembler.XmlAttributeXCoordinateAtRiver).FirstOrDefault(); +// Assert.IsNotNull(attribute); +// attribute = TrafficLoadElement.Attributes(DamMStabAssembler.XmlAttributeXCoordinateAtPolder).FirstOrDefault(); +// Assert.IsNotNull(attribute); +// attribute = TrafficLoadElement.Attributes(DamMStabAssembler.XmlAttributeLoad).FirstOrDefault(); +// Assert.IsNotNull(attribute); + XElement calculationOptionsElement = (from element in inputElement.Descendants() where element.Name.LocalName == DamMStabAssembler.XmlElementCalculationOptions select element).Single(); @@ -150,36 +158,36 @@ select element).Single(); Assert.IsTrue(slipCircleElement.HasAttributes); - XElement profileElement = (from element in mstabXml.Root.Descendants() - where element.Name.LocalName == DamMStabAssembler.XmlElementProfile - select element).Single(); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeName); - Assert.IsNotNull(attribute); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeXCoordinate); - Assert.IsNotNull(attribute); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeYCoordinate); - Assert.IsNotNull(attribute); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributePhreaticLevel); - Assert.IsNotNull(attribute); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeHasPhreaticLevel); - Assert.IsNotNull(attribute); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeBottomLevel); - Assert.IsNotNull(attribute); - attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeBottomSandLayerID); - Assert.IsNotNull(attribute); +// XElement profileElement = (from element in mstabXml.Root.Descendants() +// where element.Name.LocalName == DamMStabAssembler.XmlElementProfile +// select element).Single(); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeName); +// Assert.IsNotNull(attribute); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeXCoordinate); +// Assert.IsNotNull(attribute); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeYCoordinate); +// Assert.IsNotNull(attribute); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributePhreaticLevel); +// Assert.IsNotNull(attribute); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeHasPhreaticLevel); +// Assert.IsNotNull(attribute); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeBottomLevel); +// Assert.IsNotNull(attribute); +// attribute = profileElement.Attribute(DamMStabAssembler.XmlAttributeBottomSandLayerID); +// Assert.IsNotNull(attribute); +// +// XElement LayersElement = (from element in profileElement.Descendants() +// where element.Name.LocalName == DamMStabAssembler.XmlElementLayers +// select element).Single(); +// Assert.AreEqual(3, LayersElement.Elements().Count()); +// var LayerElement = LayersElement.Elements().First(); +// attribute = LayerElement.Attributes(DamMStabAssembler.XmlAttributeID).FirstOrDefault(); +// Assert.IsNotNull(attribute); +// attribute = LayerElement.Attributes(DamMStabAssembler.XmlAttributeSoilID).FirstOrDefault(); +// Assert.IsNotNull(attribute); +// attribute = LayerElement.Attributes(DamMStabAssembler.XmlAttributeTopLevel).FirstOrDefault(); +// Assert.IsNotNull(attribute); - XElement LayersElement = (from element in profileElement.Descendants() - where element.Name.LocalName == DamMStabAssembler.XmlElementLayers - select element).Single(); - Assert.AreEqual(3, LayersElement.Elements().Count()); - var LayerElement = LayersElement.Elements().First(); - attribute = LayerElement.Attributes(DamMStabAssembler.XmlAttributeID).FirstOrDefault(); - Assert.IsNotNull(attribute); - attribute = LayerElement.Attributes(DamMStabAssembler.XmlAttributeSoilID).FirstOrDefault(); - Assert.IsNotNull(attribute); - attribute = LayerElement.Attributes(DamMStabAssembler.XmlAttributeTopLevel).FirstOrDefault(); - Assert.IsNotNull(attribute); - } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Files/MacroStability/expectedTest.sti =================================================================== diff -u -r583 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Files/MacroStability/expectedTest.sti (.../expectedTest.sti) (revision 583) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Files/MacroStability/expectedTest.sti (.../expectedTest.sti) (revision 715) @@ -2,9 +2,9 @@ ============================================================================== COMPANY : LICENSE : Unknown -DATE : 11-10-2017 -TIME : 14:53:48 -FILENAME : D:\src\dam\dam classic\trunk\data\Dam\Benchmarks\KernelComparison\Dam Tutorial Design\DAM Tutorial Design.Calc\Stability\Bishop\Loc(DWP_1)_Sce(1)_Pro(DWP_1_sti).sti +DATE : 23-10-2017 +TIME : 11:59:31 +FILENAME : D:\src\dam\dam engine\trunk\data\DAM Tutorial Design\DAM Tutorial Design.Calc\Stability\Bishop\Loc(DWP_1)_Sce(1)_Pro(DWP_1_sti)_Ite(0).sti CREATED BY : DGeoStability version 15.1.2.4 ========================== BEGINNING OF DATA ========================== [VERSION] @@ -622,18 +622,18 @@ 60 50.115 2.630 0.000 61 60.704 1.710 0.000 62 61.770 1.711 0.000 - 63 0.000 2.935 0.000 - 64 29.023 2.935 0.000 - 65 38.000 2.435 0.000 - 66 42.170 2.435 0.000 - 67 52.340 2.435 0.000 + 63 0.000 4.400 0.000 + 64 35.090 4.400 0.000 + 65 38.000 3.900 0.000 + 66 42.170 3.900 0.000 + 67 52.340 2.690 0.000 68 60.640 1.600 0.000 69 66.330 1.600 0.000 70 106.000 1.600 0.000 71 0.000 -10.000 0.000 72 106.000 -10.000 0.000 - 73 0.000 2.935 0.000 - 74 106.000 2.935 0.000 + 73 0.000 4.400 0.000 + 74 106.000 4.400 0.000 75 0.000 -10.000 0.000 76 106.000 -10.000 0.000 [END OF POINTS] @@ -1113,8 +1113,8 @@ 11 - Boundarynumber at bottom of layer 13 - Layer number, next line is material of layer klei antropogeen - 99 - Piezometric level line at top of layer - 99 - Piezometric level line at bottom of layer + 1 - Piezometric level line at top of layer + 1 - Piezometric level line at bottom of layer 13 - Boundarynumber at top of layer 12 - Boundarynumber at bottom of layer 14 - Layer number, next line is material of layer @@ -1126,7 +1126,7 @@ 15 - Layer number, next line is material of layer dijksmateriaal_klei 1 - Piezometric level line at top of layer - 1 - Piezometric level line at bottom of layer + 99 - Piezometric level line at bottom of layer 15 - Boundarynumber at top of layer 14 - Boundarynumber at bottom of layer [END OF LAYERS] @@ -1228,7 +1228,7 @@ 0 = number of items [END OF BOND STRESS DIAGRAMS] [MINIMAL REQUIRED CIRCLE DEPTH] - 0.00 [m] + 1.50 [m] [Slip Circle Selection] IsMinXEntryUsed=0 IsMaxXEntryUsed=0 @@ -1269,9 +1269,9 @@ 1 1 = Pl-top and pl-bottom 1 1 = Pl-top and pl-bottom 1 1 = Pl-top and pl-bottom - 99 99 = Pl-top and pl-bottom 1 1 = Pl-top and pl-bottom 1 1 = Pl-top and pl-bottom + 1 99 = Pl-top and pl-bottom [MODEL FACTOR] 1.00 = Limit value stability factor 0.08 = Standard deviation for limit value stability factor Fisheye: Tag 715 refers to a dead (removed) revision in file `dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilLayerAssembler.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs (revision 715) @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Deltares.DamEngine.Io; +using NUnit.Framework; + +namespace Deltares.DamEngine.Interface.Tests +{ + [TestFixture] + public class MacroStabilityTests + { + private const double tolerance = 0.0005; + +// [Test] +// public void CanPerformMacroStabilityTutorialDesign() +// { +// const string fileName = @"TestFiles\MacroStabilityTutorialDesignInputFile.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(1.282, output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.SafetyFactor, tolerance); +// } + + } +} Index: dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj =================================================================== diff -u -r625 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 625) +++ dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 715) @@ -63,6 +63,7 @@ + @@ -92,6 +93,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs =================================================================== diff -u -r698 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs (.../DamMStabAssembler.cs) (revision 698) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs (.../DamMStabAssembler.cs) (revision 715) @@ -281,22 +281,6 @@ inputElement.Add(designElement); } - // Profile - SoilProfile1D profile = failureMechanismeParamatersMStab.SoilProfile; - if (profile != null) - { - var soilProfileAssembler = new SoilProfileAssembler(); - XNamespace tnsa = soilProfileAssembler.ElementNamespace; - doc.Root.Add(new XAttribute(XNamespace.Xmlns + "tnsa", tnsa.NamespaceName)); - - - //TODO: Remove duplicate code. The method GetProfileElement should call the SoilProfileAssembler already defined in another namespace - XElement profileElement = GetProfileElement(profile, tns, tnsa); - // XElement profileElement = soilProfileAssembler.CreateDataTransferObject(profile); //GetProfileElement(profile, tns, tnsa); - // profileElement.Name = tns.GetName(profileElement.Name.LocalName);// .SetNamespace(DamMStabAssembler.XmlElementProfile, tns.NamespaceName); - doc.Root.Add(profileElement); - } - return doc; } @@ -656,17 +640,6 @@ schemas.Add(fileIdentificationAssembler.ElementNamespace, XmlReader.Create(xsdStream)); } - // ProfileDefinition - var soilProfileAssembler = - new SoilProfileAssembler(); - assembly = soilProfileAssembler.GetType().Assembly; - schemaName = Path.GetFileName(soilProfileAssembler.ElementNamespace); - resourceName = - (from string name in assembly.GetManifestResourceNames() - where name.EndsWith(schemaName + ".xsd") - select name).Single(); - xsdStream = Common.GetEmbeddedFile(assembly, resourceName); - schemas.Add(soilProfileAssembler.ElementNamespace, XmlReader.Create(xsdStream)); doc.Validate(schemas, (o, e) => { result = false; Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Stability/StabilityCalculator.cs =================================================================== diff -u -r711 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Stability/StabilityCalculator.cs (.../StabilityCalculator.cs) (revision 711) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Stability/StabilityCalculator.cs (.../StabilityCalculator.cs) (revision 715) @@ -100,7 +100,7 @@ /// The waterlevel. /// The waterlevel low. /// - private PLLines CreateAllPLLines(Location location, SurfaceLine2 surfaceLine, SoilProfile soilProfile, + public PLLines CreateAllPLLines(Location location, SurfaceLine2 surfaceLine, SoilProfile soilProfile, string soilGeometry2DName, double waterlevel, double? waterlevelLow) { switch (location.ModelParametersForPLLines.PLLineCreationMethod) Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Files/MacroStability/test.xml =================================================================== diff -u -r583 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Files/MacroStability/test.xml (.../test.xml) (revision 583) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Files/MacroStability/test.xml (.../test.xml) (revision 715) @@ -1,7 +1,7 @@  - - + + @@ -55,26 +55,26 @@ - - - - - + + + + + - - + + - - + + Index: dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/FillDamFromXmlInputTests.cs =================================================================== diff -u -r711 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/FillDamFromXmlInputTests.cs (.../FillDamFromXmlInputTests.cs) (revision 711) +++ dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/FillDamFromXmlInputTests.cs (.../FillDamFromXmlInputTests.cs) (revision 715) @@ -238,6 +238,7 @@ TrafficLoad = 11.11, MinimalCircleDepth = 1.21 }; + location.SoilList = dike.SoilList; dike.Locations.Add(location); } } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs =================================================================== diff -u -r707 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs (.../DesignCalculator.cs) (revision 707) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs (.../DesignCalculator.cs) (revision 715) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStability; using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingBligh; using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; @@ -97,9 +98,11 @@ switch (failureMechanismSystemType) { case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityInside: case FailureMechanismSystemType.StabilityOutside: throw new NotImplementedException(Resources.DesignCalculatorKernelNotImplemented); + case FailureMechanismSystemType.StabilityInside: + kernelWrapper = new DamMacroStabilityKernelWrapper(); + break; case FailureMechanismSystemType.Piping: switch (pipingModelType) { Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r684 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 684) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 715) @@ -106,8 +106,6 @@ - - Fisheye: Tag 715 refers to a dead (removed) revision in file `dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs =================================================================== diff -u -r711 -r715 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 711) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 715) @@ -3,12 +3,11 @@ using System.IO; using System.Xml.Linq; using Deltares.DamEngine.Calculators.General; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStability.Assemblers; using Deltares.DamEngine.Calculators.Properties; -using Deltares.DamEngine.Calculators.Stability; -using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; -using Deltares.DamEngine.Data.General.PlLines; +using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Logging; @@ -21,23 +20,24 @@ /// /// /// - /// - /// + /// /// /// /// /// /// /// /// - public static XDocument CreateMStabXmlDoc(string mstabProjectFilename, DesignScenario scenario, SoilProfile1D soilProfile, - string soilGeometry2DName, double riverLevel, + public static XDocument CreateMStabXmlDoc(string mstabProjectFilename, DesignScenario scenario, + SoilGeometryProbability subSoilScenario, double riverLevel, MStabDesignEmbankment mstabDesignEmbankment, SurfaceLine2 surfaceLine, - double trafficLoad, double requiredSafetyFactor, out List errorMessages) + double? trafficLoad, double requiredSafetyFactor, out List errorMessages) { errorMessages = new List(); - SoilProfile1D profile1D = soilProfile; + var profile1D = subSoilScenario.SoilProfile1D; + var soilGeometry2DName = subSoilScenario.StiFileName; + ConsistencyCheck(scenario, profile1D, soilGeometry2DName); FailureMechanismeParamatersMStab failureMechanismeParamatersMStab = new FailureMechanismeParamatersMStab(); @@ -72,8 +72,9 @@ -scenario.Location.XSoilGeometry2DOrigin; failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.PLLineAssignment = CalculationHelper.PLLineCreationMethod2PLLineAssignment(scenario.Location.ModelParametersForPLLines.PLLineCreationMethod); - failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.IntrusionVerticalWaterPressureType = - scenario.Location.IntrusionVerticalWaterPressure.Value; + if (scenario.Location.IntrusionVerticalWaterPressure != null) + failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.IntrusionVerticalWaterPressureType = + scenario.Location.IntrusionVerticalWaterPressure.Value; failureMechanismeParamatersMStab.MStabParameters.GeometryCreationOptions.PenetrationLength = scenario.Location.ModelParametersForPLLines.PenetrationLength; @@ -86,7 +87,7 @@ failureMechanismeParamatersMStab.RiverLevel = riverLevel; // scenario.RiverLevel; failureMechanismeParamatersMStab.DikeTableHeight = scenario.DikeTableHeight ?? surfaceLine.GetDefaultDikeTableHeight() ?? 0; - failureMechanismeParamatersMStab.TrafficLoad = trafficLoad; + if (trafficLoad != null) failureMechanismeParamatersMStab.TrafficLoad = trafficLoad.Value; // Horizontal balance; TODO: Combine with code in StabilityCalculation if (failureMechanismeParamatersMStab.MStabParameters.Model == MStabModelType.HorizontalBalance) @@ -103,9 +104,7 @@ surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; failureMechanismeParamatersMStab.MStabParameters.HorizontalBalanceArea.YTop = riverLevel; failureMechanismeParamatersMStab.MStabParameters.HorizontalBalanceArea.YBottom = - profile1D.InBetweenAquiferLayer != null - ? profile1D.InBetweenAquiferLayer.TopLevel - : profile1D.BottomAquiferLayer.TopLevel; + profile1D.InBetweenAquiferLayer?.TopLevel ?? profile1D.BottomAquiferLayer.TopLevel; int planeCount = (int)(Math.Round((failureMechanismeParamatersMStab.MStabParameters.HorizontalBalanceArea.YTop - failureMechanismeParamatersMStab.MStabParameters.HorizontalBalanceArea.YBottom) / 0.25)); @@ -160,30 +159,39 @@ errorMessages.Add(logMessage); } - var currentSurfaceLine = scenario.GetMostRecentSurfaceLine(soilProfile, Path.GetFileName(soilGeometry2DName)); + var currentSurfaceLine = scenario.GetMostRecentSurfaceLine(subSoilScenario.SoilProfile1D, Path.GetFileName(soilGeometry2DName)); if (currentSurfaceLine == null) { currentSurfaceLine = surfaceLine; } - SoilProfileType soilProfileType = SoilProfileType.ProfileType1D; - if (string.IsNullOrEmpty(soilGeometry2DName)) - { - soilProfileType = SoilProfileType.ProfileTypeStiFile; - } - var waterLevel = riverLevelHigh.Value; - failureMechanismeParamatersMStab.PLLines = CalculationHelper.CreateAllPLLines(waterLevel, - scenario.Location, soilGeometry2DName, soilProfileType); + UpliftSituation upliftSituation; + failureMechanismeParamatersMStab.PLLines = PlLinesHelper.CreatePlLinesForStability( + scenario.Location, subSoilScenario, waterLevel, soilGeometry2DName, out upliftSituation); + // // ToDo zant Move this CreateAllPLLines to CalculationHelper. riverLevelLow used for stability outwards only + // var calculator = new StabilityCalculator(failureMechanismeParamatersMStab, + // ProgramType.MStab, + // scenario.Location.ModelParametersForPLLines, + // scenario.Location.TrafficLoad, + // scenario.Location.MinimalCircleDepth, + // requiredSafetyFactor, + // "", + // null, + // scenario.Location.GaugePLLines, + // scenario.Location.Gauges, + // scenario.Location.SoilList); + // failureMechanismeParamatersMStab.PLLines = calculator.CreateAllPLLines( + // scenario.Location, surfaceLine, soilProfile, soilGeometry2DName, waterLevel, riverLevelLow); + // Slip circle definition for Uplift Van; TODO: Combine with code in StabilityCalculation if (failureMechanismeParamatersMStab.MStabParameters.Model == MStabModelType.UpliftVan) { // Determine right side of slip plane grid (right grid) // This is the location with the lowest uplift factor or, if present, the second NWO point - var upliftLocationAndResult = CalculationHelper.GetLocationWithLowestUpliftFactor(currentSurfaceLine, soilProfile, - soilGeometry2DName, - failureMechanismeParamatersMStab.PLLines, + var upliftLocationAndResult = CalculationHelper.GetLocationWithLowestUpliftFactor(currentSurfaceLine, + subSoilScenario.SoilProfile1D, soilGeometry2DName, failureMechanismeParamatersMStab.PLLines, scenario.Location); double upliftCriterion = scenario.GetUpliftCriterionStability(scenario.Location.ModelFactors.UpliftCriterionStability);