Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs =================================================================== diff -u -r692 -r698 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs (.../DamMStabAssembler.cs) (revision 692) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/DamMStabAssembler.cs (.../DamMStabAssembler.cs) (revision 698) @@ -361,7 +361,7 @@ { var profileElement = new XElement(tns + XmlElementProfile); profileElement.Add(new XAttribute(XmlAttributeName, profile.Name)); - //ToDo zant_xml properties missing #Bka: just fake the missing params as these are not really relevant (not even PhreaticLevel as this is never given a value within Dam) + // #Bka: just fake the missing params as these are not really relevant (not even PhreaticLevel as this is never given a value within Dam) profileElement.Add(new XAttribute(XmlAttributeXCoordinate, 0)); profileElement.Add(new XAttribute(XmlAttributeYCoordinate, 0)); profileElement.Add(new XAttribute(XmlAttributePhreaticLevel, 0)); @@ -375,7 +375,6 @@ profileElement.Add(layersElement); } - //ToDo zant_xml properties missing #Bka: BottomAquiferLayer and InBetweenAquiferLayer were there, added InfiltrationLayer // Bottom sand layer if (profile.BottomAquiferLayer != null) profileElement.Add(new XAttribute(XmlAttributeBottomSandLayerID, profile.BottomAquiferLayer.Name)); @@ -392,7 +391,6 @@ private static void GetProfileLayersElement(SoilProfile1D profile, XNamespace tnsa, XElement layersElement) { - //ToDo zant_xml no more ids #Bka : names are used instead profile.EnsureUniqueLayerNames(); foreach (SoilLayer1D layer in profile.Layers) { @@ -433,7 +431,7 @@ } } } - //ToDo zant_xml properties missing #Bka: Dupuit is not to be used in this version so that is ok + // #zant properties missing #Bka: Dupuit is not to be used in this version so that is ok // if (failureMechanismeParamatersMStab.DupuitPLLines != null) // { // externalPLLinesElement = new XElement(tnsb + XmlElementExternalPLLines); Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs =================================================================== diff -u -r692 -r698 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs (.../SoilProfileAssembler.cs) (revision 692) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/Assemblers/SoilProfileAssembler.cs (.../SoilProfileAssembler.cs) (revision 698) @@ -50,9 +50,6 @@ XmlElementName, XmlElementNamespace, Assembly.GetExecutingAssembly().GetEmbeddedFile(XsdEmbeddedResourcePath)) { - // ToDo zant_xml no X and Y property anymore? #Bka: these are not relevant anymore as these are not used in the engine - // this.AddOrUpdateMapping("X", "XCoordinate"); - // this.AddOrUpdateMapping("Y", "YCoordinate"); } public override SoilProfile1D CreateDomainObject(XElement dtoObj) Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs =================================================================== diff -u -r692 -r698 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 692) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 698) @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStability; @@ -18,100 +19,457 @@ [Test, Category("Work_In_Progress")] public void TestCreateMStabXmlDoc() { - var soilGeometry2DName = "testgeom2D"; - var riverLevel = 1.1; - var mstabDesignEmbankment = new MStabDesignEmbankment(); - var trafficLoad = 2.2; - var requiredSafetyFactor = 1.2; + DamProjectData damProjectData = CreateExampleDamProjectData(); List errorMessages; var stabilityProjectFilename = "testproject"; var soilDbName = "soilmaterials.mdb"; - var scenario = new DesignScenario(); - scenario.Location = new Location(); + var requiredSafetyFactor = 1.2; + + var scenario = damProjectData.Dike.Scenarios[0]; + scenario.Location.SoilList = damProjectData.Dike.SoilList; scenario.Location.SoildatabaseName = soilDbName; - // ToDo zant_mxl I think a Location needs Segments for location.GetMostProbableProfile while creating Pl lines - //#Bka : Esther. to get this working you must add a lot more data otherwise this test will never work - scenario.Location.Segment = new Segment(); - scenario.Location.Segment.SoilProfileProbabilities.Add(new SoilGeometryProbability()); //#Bka SoilprofProb should be filled! - var soilProfile = CreatePipingSellmeijerProfileWithOneSandlayer(); - var surfaceLine = CreateSurfaceLineTutorial1(); - XDocument mstabXml = MStabXmlDoc.CreateMStabXmlDoc(stabilityProjectFilename, scenario, soilProfile, soilGeometry2DName, - riverLevel, mstabDesignEmbankment, surfaceLine, trafficLoad, requiredSafetyFactor, out errorMessages); + var surfaceLine = scenario.Location.SurfaceLine; + var trafficLoad = 10.0; + var soilProfile = damProjectData.Dike.SoilProfiles[0]; + + XDocument mstabXml = MStabXmlDoc.CreateMStabXmlDoc(stabilityProjectFilename, scenario, soilProfile, null, + 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(); - XAttribute attribute = inputElement.Attribute(DamMStabAssembler.XmlAttributeMStabFileName); + var attribute = inputElement.Attribute(DamMStabAssembler.XmlAttributeMStabFileName); + Assert.IsNotNull(attribute); Assert.AreEqual(stabilityProjectFilename, attribute.Value); attribute = inputElement.Attribute(DamMStabAssembler.XmlAttributeSoilDBName); + Assert.IsNotNull(attribute); Assert.AreEqual(soilDbName, attribute.Value); XElement surfaceLineElement = (from element in inputElement.Descendants() where element.Name.LocalName == DamMStabAssembler.XmlElementSurfaceLine select element).Single(); - Assert.AreEqual(10, surfaceLineElement.Elements().Count()); + Assert.AreEqual(8, surfaceLineElement.Elements().Count()); + var surfacePointElement = surfaceLineElement.Elements().First(); + attribute = surfacePointElement.Attributes(DamMStabAssembler.XmlAttributeXCoord).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = surfacePointElement.Attributes(DamMStabAssembler.XmlAttributeYCoord).FirstOrDefault(); + Assert.IsNotNull(attribute); - XElement charPoints = (from element in inputElement.Descendants() - where element.Name.LocalName == DamMStabAssembler.XmlElementCharacteristicPoints - select element).Single(); - Assert.AreEqual(10, charPoints.Elements().Count()); + 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); + attribute = characteristicPointElement.Attributes(DamMStabAssembler.XmlAttributeYCoord).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = characteristicPointElement.Attributes(DamMStabAssembler.XmlAttributeCharacteristicPointType).FirstOrDefault(); + Assert.IsNotNull(attribute); + + 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(); + Assert.IsNotNull(attribute); + attribute = plLineElement.Attributes(DamMStabAssembler.XmlAttributeBoundaryLayer).FirstOrDefault(); + Assert.IsNotNull(attribute); + var plPointElement = plLineElement.Elements().First(); + attribute = plPointElement.Attributes(DamMStabAssembler.XmlAttributeXCoord).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = plPointElement.Attributes(DamMStabAssembler.XmlAttributeYCoord).FirstOrDefault(); + Assert.IsNotNull(attribute); + + XElement modelElement = (from element in inputElement.Descendants() + where element.Name.LocalName == DamMStabAssembler.XmlElementModel + select element).Single(); + attribute = modelElement.Attributes(DamMStabAssembler.XmlAttributeCalculationModel).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = modelElement.Attributes(DamMStabAssembler.XmlAttributeShearStrength).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = modelElement.Attributes(DamMStabAssembler.XmlAttributeProbabilistic).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = modelElement.Attributes(DamMStabAssembler.XmlAttributeSearchMethod).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = modelElement.Attributes(DamMStabAssembler.XmlAttributeGridPosition).FirstOrDefault(); + Assert.IsNotNull(attribute); + + XElement calculationOptionsElement = (from element in inputElement.Descendants() + where element.Name.LocalName == DamMStabAssembler.XmlElementCalculationOptions + select element).Single(); + attribute = calculationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeMinimalCircleDepth).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = calculationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeZonesType).FirstOrDefault(); + Assert.IsNotNull(attribute); + + XElement geometryCreationOptionsElement = (from element in inputElement.Descendants() + where element.Name.LocalName == DamMStabAssembler.XmlElementGeometryCreationOptions + select element).Single(); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeSoilGeometryType).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeSoilGeometry2DFilename).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeXOffsetSoilGeometry2DOrigin).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeMaterialForDike).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeMaterialForShoulder).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeIsUseOriginalPLLineAssignments).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeIsUseOriginalCalculationOptions).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeIsDrySituation).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributePLLineAssignment).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeIntrusionVerticalWaterPressure).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributePenetrationLength).FirstOrDefault(); + Assert.IsNotNull(attribute); + attribute = geometryCreationOptionsElement.Attributes(DamMStabAssembler.XmlAttributeIsDesign).FirstOrDefault(); + Assert.IsNotNull(attribute); + + XElement horizontalBalanceAreaElement = (from element in inputElement.Descendants() + where element.Name.LocalName == DamMStabAssembler.XmlElementHorizontalBalanceArea + select element).Single(); + Assert.IsTrue(horizontalBalanceAreaElement.HasAttributes); + + XElement slipCircleElement = (from element in inputElement.Descendants() + where element.Name.LocalName == DamMStabAssembler.XmlElementSlipCircleDefinition + 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 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); + } - private static SoilProfile1D CreatePipingSellmeijerProfileWithOneSandlayer() + + + private DamProjectData CreateExampleDamProjectData() { - SoilProfile1D soilProfile1D = new SoilProfile1D(); - SoilLayer1D soilLayer1D1 = new SoilLayer1D(); - soilLayer1D1.Name = "L0"; - soilLayer1D1.TopLevel = 10.0; - soilLayer1D1.Soil = new Soil("Topmaterial", 1.0, 1.0); - soilLayer1D1.Soil.PermeabKx = 0.0003; - soilLayer1D1.Soil.DiameterD70 = 0.0003; - soilLayer1D1.Soil.WhitesConstant = 0.5; - soilLayer1D1.Soil.BeddingAngle = 57.0; - soilLayer1D1.IsAquifer = false; - soilProfile1D.Layers.Add(soilLayer1D1); + var damProjectData = new DamProjectData(); - SoilLayer1D soilLayer1D2 = new SoilLayer1D(); - soilLayer1D2.Name = "L1"; - soilLayer1D2.TopLevel = -2.0; - soilLayer1D2.Soil = new Soil("Sand", 22.0, 20.0); - soilLayer1D2.Soil.PermeabKx = 0.0001; - soilLayer1D2.Soil.DiameterD70 = 0.0002; - soilLayer1D2.Soil.WhitesConstant = 0.25; - soilLayer1D2.Soil.BeddingAngle = 37.0; - soilLayer1D2.IsAquifer = true; - soilProfile1D.Layers.Add(soilLayer1D2); - soilProfile1D.BottomLevel = -10.0; - return soilProfile1D; + FillAnalysisSpecification(damProjectData); + + damProjectData.Dike = new Dike(); + Dike dike = damProjectData.Dike; + FillSurfaceLines(dike); + FillSoils(dike); + FillSoilProfiles1D(dike); + FillSoilProfiles2D(dike); + FillSegments(damProjectData); + FillLocations(dike, damProjectData.Segments); + return damProjectData; } - private static SurfaceLine2 CreateSurfaceLineTutorial1(bool includingTraffic = false) + + private static void FillAnalysisSpecification(DamProjectData damProjectData) { - SurfaceLine2 surfaceLine2 = new SurfaceLine2(); - surfaceLine2.Name = "Tutorial1"; - surfaceLine2.Geometry = new GeometryPointString(); - surfaceLine2.CharacteristicPoints.GeometryMustContainPoint = true; - SurfaceLine2 line = surfaceLine2; - line.EnsurePointOfType(0.0, 0.0, CharacteristicPointType.SurfaceLevelOutside); - line.EnsurePointOfType(10.0, 0.0, CharacteristicPointType.DikeToeAtRiver); - line.EnsurePointOfType(34.5, 5.0, CharacteristicPointType.DikeTopAtRiver); - if (includingTraffic) + damProjectData.DamProjectType = DamProjectType.Design; + damProjectData.DamProjectCalculationSpecification = new DamProjectCalculationSpecification(); + DamProjectCalculationSpecification.SelectedAnalysisType = AnalysisType.AdaptGeometry; + var calculationSpecification = new DamFailureMechanismeCalculationSpecification(); + calculationSpecification.FailureMechanismSystemType = FailureMechanismSystemType.Piping; + calculationSpecification.CalculationModel = PipingModelType.Bligh; + damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(calculationSpecification); + } + + private void FillSoils(Dike dike) + { + const int soilCount = 3; + dike.SoilList = new SoilList(); + for (int i = 0; i < soilCount; i++) { - line.EnsurePointOfType(35.0, 5.0, CharacteristicPointType.TrafficLoadOutside); - line.EnsurePointOfType(38.5, 5.0, CharacteristicPointType.TrafficLoadInside); + Soil soil = new Soil() { Name = String.Format("Soil {0}", i) }; + //soil.SoilType = SoilType.Loam; + + soil.AbovePhreaticLevel = 7 + 0.1 * i; + soil.BelowPhreaticLevel = 8 + 0.1 * i; + soil.DryUnitWeight = 9 + 0.1 * i; + + //soil.ShearStrengthModel = ShearStrengthModel.CuMeasured; + + //soil.Cohesion = 10 + 0.1 * i; + //soil.CuBottom = 11 + 0.1 * i; + //soil.CuTop = 12 + 0.1 * i; + //soil.DilatancyType = DilatancyType.Zero; + //soil.FrictionAngle = 13 + 0.1 * i; + //soil.Ocr = 14 + 0.1 * i; + //soil.PoP = 15 + 0.1 * i; + //soil.RatioCuPc = 16 + 0.1 * i; + //soil.StrengthIncreaseExponent = 17 + 0.1 * i; + //soil.UsePop = true; + + soil.BeddingAngle = 18 + 0.1 * i; + soil.DiameterD70 = 19 + 0.1 * i; + soil.DiameterD90 = 20 + 0.1 * i; + soil.PermeabKx = 21 + 0.1 * i; + soil.WhitesConstant = 22 + 0.1 * i; + + dike.SoilList.Add(soil); } - line.EnsurePointOfType(40.5, 5.0, CharacteristicPointType.DikeTopAtPolder); - line.EnsurePointOfType(50.5, 0.0, CharacteristicPointType.DikeToeAtPolder); - line.EnsurePointOfType(58.5, 0.0, CharacteristicPointType.DitchDikeSide); - line.EnsurePointOfType(59.5, -2.0, CharacteristicPointType.BottomDitchDikeSide); - line.EnsurePointOfType(61.5, -2.0, CharacteristicPointType.BottomDitchPolderSide); - line.EnsurePointOfType(61.5, 0.0, CharacteristicPointType.DitchPolderSide); - line.EnsurePointOfType(75.0, 0.0, CharacteristicPointType.SurfaceLevelInside); - line.Geometry.SyncCalcPoints(); - return line; } + + private void FillSurfaceLines(Dike dike) + { + const int surfaceLineCount = 3; + for (int i = 0; i < surfaceLineCount; i++) + { + var surfaceLine = new SurfaceLine2(); + surfaceLine.Name = String.Format("SurfaceLine {0}", i); + surfaceLine.CharacteristicPoints.Geometry = surfaceLine.Geometry; + AddPointsToSurfaceLines(surfaceLine); + surfaceLine.Geometry.SyncCalcPoints(); + dike.SurfaceLines2.Add(surfaceLine); + } + } + + private void AddPointsToSurfaceLines(SurfaceLine2 surfaceLine) + { + AddPointToSurfaceLine(surfaceLine, 0.0, 0.0, CharacteristicPointType.SurfaceLevelOutside); + AddPointToSurfaceLine(surfaceLine, 2.0, 0.5, CharacteristicPointType.None); + AddPointToSurfaceLine(surfaceLine, 4.0, 0.0, CharacteristicPointType.DikeToeAtRiver); + AddPointToSurfaceLine(surfaceLine, 9.0, 5.0, CharacteristicPointType.DikeTopAtRiver); + AddPointToSurfaceLine(surfaceLine, 10.0, 5.2, CharacteristicPointType.None); + AddPointToSurfaceLine(surfaceLine, 13.0, 5.4, CharacteristicPointType.DikeTopAtPolder); + AddPointToSurfaceLine(surfaceLine, 18.0, 1.0, CharacteristicPointType.DikeToeAtPolder); + AddPointToSurfaceLine(surfaceLine, 24.0, 1.0, CharacteristicPointType.SurfaceLevelInside); + } + + private void AddPointToSurfaceLine(SurfaceLine2 surfaceLine, double xCoordinate, double zCoordinate, CharacteristicPointType characteristicPointType) + { + var geometryPoint = new GeometryPoint() + { + X = xCoordinate, + Y = 0.0, + Z = zCoordinate, + }; + surfaceLine.AddCharacteristicPoint(geometryPoint, characteristicPointType); + } + + private static void FillLocations(Dike dike, IList segments) + { + const int locationCount = 3; + for (int i = 0; i < locationCount; i++) + { + var location = new Data.General.Location(); + location.Name = "Location " + (i + 1).ToString(); + location.ModelParametersForPLLines.PLLineCreationMethod = (PLLineCreationMethod)i; + location.IntrusionVerticalWaterPressure = (IntrusionVerticalWaterPressureType)i; + location.PolderLevel = 1.0 * i + 0.11; + location.ModelParametersForPLLines.DampingFactorPL4 = 1.0 * i + 0.12; + location.ModelParametersForPLLines.DampingFactorPL3 = 1.0 * i + 0.13; + location.ModelParametersForPLLines.PenetrationLength = 1.0 * i + 0.14; + location.PlLineOffsetBelowDikeCrestMiddle = 1.0 * i + 0.15; + location.UsePlLineOffsetFactorBelowShoulderCrest = true; + location.PlLineOffsetFactorBelowShoulderCrest = 1.0 * i + 0.16; + location.PlLineOffsetDryBelowDikeCrestMiddle = 1.0 * i + 0.17; + location.UsePlLineOffsetDryFactorBelowShoulderCrest = true; + location.PlLineOffsetDryFactorBelowShoulderCrest = 1.0 * i + 0.18; + location.SlopeDampingPiezometricHeightPolderSide = 1.0 * i + 0.19; + location.PlLineOffsetBelowDikeTopAtRiver = 1.0 * i + 0.20; + location.PlLineOffsetBelowDikeTopAtPolder = 1.0 * i + 0.21; + location.PlLineOffsetBelowShoulderBaseInside = 1.0 * i + 0.22; + location.PlLineOffsetBelowDikeToeAtPolder = 1.0 * i + 0.23; + location.HeadPl2 = 1.0 * i + 0.24; + location.HeadPl3 = 1.0 * i + 0.25; + location.HeadPl4 = 1.0 * i + 0.21; + location.SurfaceLine = dike.SurfaceLines2[i]; + location.Segment = segments[i % 2]; // alternate between the 2 available segments + for (int j = 0; j < 3; j++) + { + var designScenario = FillDesignScenario(i, j); + designScenario.Location = location; + location.Scenarios.Add(designScenario); + } + dike.Locations.Add(location); + } + } + + private static void FillSoilProfiles1D(Dike dike) + { + dike.SoilProfiles = new List(); + const int profilesCount = 2; + for (int i = 0; i < profilesCount; i++) + { + var profile = new SoilProfile1D(); + profile.Name = "Profile1D " + (i + 1).ToString(); + profile.BottomLevel = -21.12 * (i + 1); + const int layerCount = 3; + for (int j = 0; j < layerCount; j++) + { + var layer = new SoilLayer1D + { + Name = "Layer" + (j + 1).ToString(), + Soil = dike.SoilList.Soils[j], + TopLevel = 1 * -j + }; + if (j < 2) + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; + layer.IsAquifer = false; + } + else + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; + layer.IsAquifer = true; + } + profile.Layers.Add(layer); + } + dike.SoilProfiles.Add(profile); + } + } + private static DesignScenario FillDesignScenario(int locationIndex, int scenarioIndex) + { + // The parameter factor is used to create unique data for the design scenario + int factor = (locationIndex + 1) * (scenarioIndex + 1); + var designScenario = new DesignScenario(); + designScenario.LocationScenarioID = scenarioIndex.ToString(); + designScenario.RiverLevel = 1.0 * factor + 0.51; + designScenario.RiverLevelLow = 1.0 * factor + 0.52; + designScenario.DikeTableHeight = 1.0 * factor + 0.53; + designScenario.PlLineOffsetBelowDikeTopAtRiver = 1.0 * factor + 0.54; + designScenario.PlLineOffsetBelowDikeTopAtPolder = 1.0 * factor + 0.55; + designScenario.PlLineOffsetBelowShoulderBaseInside = 1.0 * factor + 0.56; + designScenario.PlLineOffsetBelowDikeToeAtPolder = 1.0 * factor + 0.57; + designScenario.PlLineOffsetBelowDikeCrestMiddle = 1.0 * factor + 0.58; + designScenario.UsePlLineOffsetBelowDikeCrestMiddle = true; + designScenario.PlLineOffsetFactorBelowShoulderCrest = 1.0 * factor + 0.59; + designScenario.UsePlLineOffsetFactorBelowShoulderCrest = true; + designScenario.HeadPl3 = 1.0 * factor + 0.60; + designScenario.HeadPl4 = 1.0 * factor + 0.61; + designScenario.UpliftCriterionStability = 1.0 * factor + 0.62; + designScenario.UpliftCriterionPiping = 1.0 * factor + 0.63; + designScenario.RequiredSafetyFactorStabilityInnerSlope = 1.0 * factor + 0.64; + designScenario.RequiredSafetyFactorStabilityOuterSlope = 1.0 * factor + 0.65; + designScenario.RequiredSafetyFactorPiping = 1.0 * factor + 0.66; + return designScenario; + } + + private static void FillSoilProfiles2D(Dike dike) + { + dike.SoilProfiles2D = new List(); + const int profilesCount = 2; + for (int i = 0; i < profilesCount; i++) + { + var profile = new SoilProfile2D + { + Name = "Profile2D " + (i + 1).ToString() + }; + + const int preConCount = 2; + for (int j = 0; j < preConCount; j++) + { + var preCon = new PreConsolidationStress + { + Name = "Precon " + (j + 1).ToString(), + StressValue = 3.33 * (i + 1) * (j + 1), + X = 12.3 * (i + 1) * (j + 1), + Z = 0.3 * (-i - 1) * (j + 1) + }; + profile.PreconsolidationStresses.Add(preCon); + } + const int layerCount = 3; + for (int j = 0; j < layerCount; j++) + { + var layer = new SoilLayer2D + { + Name = "Layer" + (j + 1).ToString(), + Soil = dike.SoilList.Soils[j] + + }; + if (j < 2) + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; + layer.IsAquifer = false; + } + else + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; + layer.IsAquifer = true; + } + layer.GeometrySurface = new GeometrySurface(); + var outerLoop = new GeometryLoop(); + outerLoop.Points.Add((new GeometryPoint(0, 0))); + outerLoop.Points.Add((new GeometryPoint(0, 10))); + outerLoop.Points.Add((new GeometryPoint(10, 10))); + layer.GeometrySurface.OuterLoop = outerLoop; + var innerloop = new GeometryLoop(); + innerloop.Points.Add((new GeometryPoint(1, 1))); + innerloop.Points.Add((new GeometryPoint(1, 9))); + innerloop.Points.Add((new GeometryPoint(9, 9))); + layer.GeometrySurface.InnerLoops.Add(innerloop); + profile.Surfaces.Add(layer); + } + dike.SoilProfiles2D.Add(profile); + } + } + + private static void FillSegments(DamProjectData damProjectData) + { + var segmentCount = 2; + for (int i = 0; i < segmentCount; i++) + { + var segment = new Segment(); + segment.Name = "Segment " + i.ToString(); + var soilProfileProbability = new SoilGeometryProbability(); + if (i == 0) + { + soilProfileProbability.SegmentFailureMechanismType = FailureMechanismSystemType.StabilityInside; + soilProfileProbability.SoilProfile2DName = "Profile2D " + (i + 1).ToString(); +// soilProfileProbability.SoilProfile2D = FillDamFromXmlInput.FindSoilProfile2DByName(damProjectData.Dike.SoilProfiles2D, +// soilProfileProbability.SoilProfile2DName); + soilProfileProbability.SoilProfileType = SoilProfileType.ProfileType2D; + } + else + { + soilProfileProbability.SegmentFailureMechanismType = FailureMechanismSystemType.Piping; + soilProfileProbability.SoilProfile1DName = "Profile1D " + (i + 1).ToString(); +// soilProfileProbability.SoilProfile1D = FillDamFromXmlInput.FindSoilProfile1DByName(damProjectData.Dike.SoilProfiles, +// soilProfileProbability.SoilProfile1DName); + soilProfileProbability.SoilProfileType = SoilProfileType.ProfileType1D; + } + soilProfileProbability.Probability = 0.003 * (i + 1); + segment.SoilProfileProbabilities.Add(soilProfileProbability); + damProjectData.Segments.Add(segment); + } + } } } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs =================================================================== diff -u -r692 -r698 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs (.../PLLinesCreator.cs) (revision 692) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PLLinesCreator.cs (.../PLLinesCreator.cs) (revision 698) @@ -446,7 +446,12 @@ throw new PLLinesCreatorException("Damping factor < 0.0"); } - SoilLayer1D relevantAquiferLayer = GetRelevantAquiferLayer(plLineType, actualSoilProfile); + // ToDo bka #zant: Is this change correct? actualSoilProfile is null for ProfileTypeStiFile + SoilLayer1D relevantAquiferLayer = null; + if (actualSoilProfile != null) + { + relevantAquiferLayer = GetRelevantAquiferLayer(plLineType, actualSoilProfile); + } if (relevantAquiferLayer != null) { Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs =================================================================== diff -u -r692 -r698 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 692) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStability/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 698) @@ -144,6 +144,7 @@ if (failureMechanismeParamatersMStab.MStabParameters.GridPosition == MStabGridPosition.Left && scenario.RiverLevelLow.HasValue) { riverLevelLow = scenario.RiverLevelLow.Value; + // ToDo bka #zant: riverLevelLow is not used. In classic it was used in CreateAllPLLines } double? riverLevelHigh = riverLevel; var surfaceLevelOutside = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside); @@ -162,22 +163,15 @@ currentSurfaceLine = surfaceLine; } - //ToDo zant_xml CreateAllPLLines was changed #Bka: I could not quite retrace this to Dam classic but I believe - // ToDo zant_mxl I think a Location needs Segments for location.GetMostProbableProfile while creating Pl lines - // #Bka: a location must have a Segment otherwise it is invalid data. - // failureMechanismeParamatersMStab.PLLines = CalculationHelper.CreateAllPLLines(scenario.Location, currentSurfaceLine, - // soilProfile, soilGeometry2DName, riverLevelHigh.Value, riverLevelLow); - // #Bka: if soilGeometry2DName the type must be a sti file (2D) else it must be 1D SoilProfileType soilProfileType = SoilProfileType.ProfileType1D; if (string.IsNullOrEmpty(soilGeometry2DName)) { soilProfileType = SoilProfileType.ProfileTypeStiFile; } - var waterLevel = riverLevelHigh.Value; // What is the waterlevel? #Bka: I believe this must be riverLevelHigh.Value but check with Tom + var waterLevel = riverLevelHigh.Value; failureMechanismeParamatersMStab.PLLines = CalculationHelper.CreateAllPLLines(waterLevel, scenario.Location, soilGeometry2DName, soilProfileType); - // End of ToDo zant_xml CreateAllPLLines was changed // Slip circle definition for Uplift Van; TODO: Combine with code in StabilityCalculation if (failureMechanismeParamatersMStab.MStabParameters.Model == MStabModelType.UpliftVan) @@ -202,7 +196,6 @@ failureMechanismeParamatersMStab.MStabParameters.ProjectFileName = mstabProjectFilename; failureMechanismeParamatersMStab.MStabParameters.SoilDatabaseName = scenario.Location.SoildatabaseName; - //ToDo zant_xml Fails because PLLines are not created yet if (!failureMechanismeParamatersMStab.IsComplete) { throw new Exception("Not all required data is available"); @@ -228,8 +221,6 @@ }; } - - /// /// ///