Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/FillDamFromXmlInputTests.cs =================================================================== diff -u -r1974 -r1990 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/FillDamFromXmlInputTests.cs (.../FillDamFromXmlInputTests.cs) (revision 1974) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/FillDamFromXmlInputTests.cs (.../FillDamFromXmlInputTests.cs) (revision 1990) @@ -30,6 +30,7 @@ using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Io; using Deltares.DamEngine.Io.XmlInput; +using Deltares.DamEngine.TestHelpers; using KellermanSoftware.CompareNetObjects; using NUnit.Framework; using Segment = Deltares.DamEngine.Data.General.Segment; @@ -45,21 +46,18 @@ [TestFixture] public class FillDamFromXmlInputTests { - const AnalysisType expectedAnalysisType = AnalysisType.AdaptGeometry; - const AnalysisType notExpectedAnalysisType = AnalysisType.NoAdaption; - [Test] public void CanWriteAndReadDamProjectDataToXml() { const string inputFilename = "InputFile.xml"; - DamProjectData expectedDamProjectData = CreateExampleDamProjectData(); + DamProjectData expectedDamProjectData = TestDataCreator.CreateExampleDamProjectData(); // Write input file Input input = FillXmlInputFromDam.CreateInput(expectedDamProjectData); DamXmlSerialization.SaveInputAsXmlFile(inputFilename, input); // Init static that is to be loaded with not expected value - DamProjectCalculationSpecification.SelectedAnalysisType = notExpectedAnalysisType; + DamProjectCalculationSpecification.SelectedAnalysisType = TestDataCreator.notExpectedAnalysisType; // Load input file input = DamXmlSerialization.LoadInputFromXmlFile(inputFilename); @@ -70,15 +68,15 @@ [Test] public void CanWriteAndReadDamProjectDataToXmlString() { - DamProjectData expectedDamProjectData = CreateExampleDamProjectData(); + DamProjectData expectedDamProjectData = TestDataCreator.CreateExampleDamProjectData(); // Write input string string xmlString; Input input = FillXmlInputFromDam.CreateInput(expectedDamProjectData); xmlString = DamXmlSerialization.SaveInputAsXmlString(input); // Init static that is to be loaded with not expected value - DamProjectCalculationSpecification.SelectedAnalysisType = notExpectedAnalysisType; + DamProjectCalculationSpecification.SelectedAnalysisType = TestDataCreator.notExpectedAnalysisType; // Load input string input = DamXmlSerialization.LoadInputFromXmlString(xmlString); @@ -97,571 +95,9 @@ Assert.AreEqual(7, actualDamProjectData.CalculationMessages.Count); } - 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 DamProjectData CreateExampleDamProjectData() - { - var damProjectData = new DamProjectData(); - damProjectData.ProjectPath = @"D:\TestDir"; - damProjectData.CalculationMap = @"Sub\Calc"; - damProjectData.MaxCalculationCores = 3; - - FillAnalysisSpecification(damProjectData); - FillStabilityParameters(damProjectData); - - damProjectData.Dike = new Dike(); - Dike dike = damProjectData.Dike; - FillSurfaceLines(dike); - FillSoils(dike); - FillAquiferSoils(dike.SoilList); - FillSoilProfiles1D(dike); - FillSoilProfiles2D(dike); - FillSegments(damProjectData); - FillLocations(dike, damProjectData.Segments, damProjectData.ProjectPath); - FillInputTimeSeries(dike); - FillSensorData(damProjectData); - - return damProjectData; - } - - private void FillSensorData(DamProjectData damProjectData) - { - damProjectData.SensorData = new SensorData(); // SensorLocations, Sensors and SensorGroups are automatically created - var sensorData = damProjectData.SensorData; - var sensor1 = new Sensor() - { - ID = 1, - Name = "Sensor 1", - RelativeLocation = 12.2, - SensorType = SensorType.WaterLevel, - PlLineMappings = new[] { PlLineType.Pl1 } - }; - sensorData.Sensors.Add(sensor1); - var sensor2 = new Sensor() - { - ID = 2, - Name = "Sensor 2", - RelativeLocation = 24.2, - SensorType = SensorType.PolderLevel, - PlLineMappings = new [] { PlLineType .Pl1} - }; - sensorData.Sensors.Add(sensor2); - var sensorGroup1 = new SensorGroup() - { - ID = 1, - SensorArray = new Sensor[] { sensor1, sensor2 } - }; - sensorData.SensorGroups.Add(sensorGroup1); - var sensorLocation1 = new SensorLocation() - { - Location = damProjectData.Dike.Locations[0], - SensorGroup = sensorGroup1, - SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = DataSourceTypeSensors.LocationData, - SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = DataSourceTypeSensors.LocationData, - SourceTypePl1WaterLevelAtPolder = DataSourceTypeSensors.Sensor, - SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.Sensor, - SourceTypePl3 = DataSourceTypeSensors.Sensor, - SourceTypePl4 = DataSourceTypeSensors.Sensor, - SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = DataSourceTypeSensors.LocationData, - SourceTypePl1PlLineOffsetBelowShoulderBaseInside = DataSourceTypeSensors.LocationData - }; - damProjectData.Dike.Locations[0].SensorLocation = sensorLocation1; - sensorData.SensorLocations.Add(sensorLocation1); - - var sensor3 = new Sensor() - { - ID = 3, - Name = "Sensor 3", - RelativeLocation = 8.8, - SensorType = SensorType.PiezometricHead, - PlLineMappings = new [] { PlLineType.Pl3, PlLineType.Pl4} - }; - sensorData.Sensors.Add(sensor3); - var sensorGroup2 = new SensorGroup() - { - ID = 2, - SensorArray = new Sensor[] { sensor3 } - }; - sensorData.SensorGroups.Add(sensorGroup2); - var sensorLocation2 = new SensorLocation() - { - Location = damProjectData.Dike.Locations[0], - SensorGroup = sensorGroup1, - SourceTypePl1PlLineOffsetBelowDikeTopAtRiver = DataSourceTypeSensors.LocationData, - SourceTypePl1PlLineOffsetBelowDikeTopAtPolder = DataSourceTypeSensors.LocationData, - SourceTypePl1WaterLevelAtPolder = DataSourceTypeSensors.Sensor, - SourceTypePl1WaterLevelAtRiver = DataSourceTypeSensors.Sensor, - SourceTypePl3 = DataSourceTypeSensors.Sensor, - SourceTypePl4 = DataSourceTypeSensors.Sensor, - SourceTypePl1PlLineOffsetBelowDikeToeAtPolder = DataSourceTypeSensors.LocationData, - SourceTypePl1PlLineOffsetBelowShoulderBaseInside = DataSourceTypeSensors.LocationData - }; - damProjectData.Dike.Locations[2].SensorLocation = sensorLocation2; - sensorData.SensorLocations.Add(sensorLocation2); - } - - private void FillInputTimeSeries(Dike dike) - { - const int timeSeriesCount = 2; - const int timeEntriesCount = 3; - const string idWaterLevel = "WaterLevel"; - const string idWaterPressure = "WaterPressure"; - dike.InputTimeSerieCollection = new TimeSerieCollection(); - for (int i = 0; i < timeSeriesCount; i++) - { - string locationId = String.Format("location{0}", i); - var timeSerie = dike.InputTimeSerieCollection.AddNewSeries(locationId); - timeSerie.ParameterId = (i % 2 == 0) ? idWaterLevel : idWaterPressure; - timeSerie.ForecastDateTime = DateTime.Now; - timeSerie.Type = "instantaneous"; - timeSerie.StartDateTime = new DateTime(2012, 12, 31); - timeSerie.EndDateTime = new DateTime(2012, 12, 31, 1, 0, 0); - timeSerie.MissVal = -9999.0; - timeSerie.LongName = timeSerie.LocationId + "long"; - timeSerie.StationName = String.Format("station{0}", i); - timeSerie.Units = "m"; - timeSerie.SourceOrganisation = String.Format("organisation{0}", i); - timeSerie.SourceSystem = String.Format("system{0}", i); - timeSerie.FileDescription = String.Format("filedescription{0}", i); - timeSerie.Region = String.Format("region{0}", i); - if ((i % 2 == 0)) - { - timeSerie.TimeStep.Multiplier = 3600; - timeSerie.TimeStep.Unit = TimeStepUnit.Second; - } - else - { - timeSerie.TimeStep.Divider = 24; - timeSerie.TimeStep.Unit = TimeStepUnit.Day; - } - for (int j = 0; j < timeEntriesCount; j++) - { - Stochast stochastValue = new Stochast() - { - Mean = 1.0 * j, - Distribution = j, - StandardDeviation = 0.1 * j - }; - timeSerie.Entries.Add(new TimeSerieEntry - { - - DateTime = new DateTime(2012, 12, 31, 1, j * 10, 0), - Value = j, - Flag = 1, - BasisFileName = String.Format("BasisFileName{0}", i), - RelativeCalculationPathName = String.Format("RelativeCalculationPathName{0}", i), - StochastValue = stochastValue - }); - } - } - } - - private void FillAquiferSoils(SoilList soilList) - { - for (int i = 0; i < soilList.Soils.Count; i++) - { - // All even indeces are set to true, all odd indices are set to false - soilList.AquiferDictionary.Add(soilList.Soils[i], (i % 2) == 0); - } - } - - private static void FillAnalysisSpecification(DamProjectData damProjectData) - { - damProjectData.DamProjectType = DamProjectType.Design; - damProjectData.DamProjectCalculationSpecification = new DamProjectCalculationSpecification(); - DamProjectCalculationSpecification.SelectedAnalysisType = expectedAnalysisType; - var calculationSpecification = new DamFailureMechanismeCalculationSpecification(); - calculationSpecification.FailureMechanismSystemType = FailureMechanismSystemType.Piping; - calculationSpecification.CalculationModel = PipingModelType.Bligh; - damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(calculationSpecification); - } - - private static void FillStabilityParameters(DamProjectData damProjectData) - { - // Note: DamProjectCalculationSpecification created and filled by FillAnalysisSpecification - var curspec = damProjectData.DamProjectCalculationSpecification.CurrentSpecification; - curspec.FailureMechanismParametersMStab = new FailureMechanismParametersMStab - { - MStabParameters = new MStabParameters - { - SearchMethod = MStabSearchMethod.Grid, - SlipCircleDefinition = new SlipCircleDefinition - { - GridSizeDetermination = GridSizeDetermination.Specified, - BishopGridHorizontalPointCount = 4, - BishopGridHorizontalPointDistance = 1.2, - BishopGridVerticalPointCount = 5, - BishopGridVerticalPointDistance = 1.1, - BishopTangentLinesDefinition = TangentLinesDefinition.Specified, - BishopTangentLinesDistance = 0.25, - UpliftVanLeftGridHorizontalPointCount = 6, - UpliftVanLeftGridHorizontalPointDistance = 0.7, - UpliftVanLeftGridVerticalPointCount = 3, - UpliftVanLeftGridVerticalPointDistance = 1.3, - UpliftVanRightGridHorizontalPointCount = 8, - UpliftVanRightGridHorizontalPointDistance = 1.76, - UpliftVanRightGridVerticalPointCount = 11, - UpliftVanRightGridVerticalPointDistance = 0.14, - UpliftVanTangentLinesDefinition = TangentLinesDefinition.OnBoundaryLines, - UpliftVanTangentLinesDistance = 0.01 - } - } - }; - } - - private void FillSoils(Dike dike) - { - const int soilCount = 3; - dike.SoilList = new SoilList(); - for (int i = 0; i < soilCount; i++) - { - 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.SuMeasured; - soil.UseDefaultShearStrengthModel = false; - soil.Cohesion = 10 + 0.1 * i; - soil.FrictionAngle = 13 + 0.1 * i; - soil.Ocr = 14 + 0.1 * i; - soil.SlopeRestProfile = 15 + 0.1 * i; - soil.DilatancyType = DilatancyType.Zero; - - //soil.CuBottom = 11 + 0.1 * i; - //soil.CuTop = 12 + 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; - soil.SoilType = ConversionHelper.ConvertToSoilType(i); - - dike.SoilList.Add(soil); - } - var dikemat = new Soil - { - Name = "DikeMat", - AbovePhreaticLevel = 7, - BelowPhreaticLevel = 8, - DryUnitWeight = 9, - BeddingAngle = 18, - DiameterD70 = 19, - DiameterD90 = 20, - PermeabKx = 21, - WhitesConstant = 22 - }; - dike.SoilList.Add(dikemat); - } - - 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, 13.0, 5.4, CharacteristicPointType.TrafficLoadOutside); - AddPointToSurfaceLine(surfaceLine, 14.0, 4.52, CharacteristicPointType.TrafficLoadInside); - AddPointToSurfaceLine(surfaceLine, 18.0, 1.0, CharacteristicPointType.DikeToeAtPolder); - AddPointToSurfaceLine(surfaceLine, 24.0, 1.0, CharacteristicPointType.SurfaceLevelInside); - } - - private static void FillLocations(Dike dike, IList segments, string projectPath) - { - const int locationCount = 3; - for (int i = 0; i < locationCount; i++) - { - var location = new Data.General.Location(); - location.Name = "Location " + (i + 1).ToString(); - location.XSoilGeometry2DOrigin = 1.23; - location.ModelParametersForPlLines.PlLineCreationMethod = (PlLineCreationMethod)i; - location.IntrusionVerticalWaterPressure = (IntrusionVerticalWaterPressureType)i; - location.PolderLevel = 1.0 * i + 0.11; - location.PolderLevelLow = 1.0 * i + 0.09; - 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.PlLineOffsetDryBelowDikeTopAtRiver = 1.0 * i + 0.24; - location.PlLineOffsetDryBelowDikeTopAtPolder = 1.0 * i + 0.25; - location.PlLineOffsetDryBelowShoulderBaseInside = 1.0 * i + 0.26; - location.PlLineOffsetDryBelowDikeToeAtPolder = 1.0 * i + 0.27; - location.HeadPl2 = 1.0 * i + 0.28; - location.HeadPl3 = 1.0 * i + 0.29; - location.HeadPl4 = 1.0 * i + 0.30; - location.DikeSoilScenario = (DikeSoilScenario)i; - // Used for regional assessment - location.DikeTableHeight = 1.0 * i + 0.31; - location.BoezemLevelHbp = 1.0 * i + 0.32; - location.BoezemLevelLbp = 1.0 * i + 0.33; - location.BoezemLevelTp = 1.0 * i + 0.34; - location.RwBankProtectionBottomLevel = 1.0 * i + 0.35; - location.DredgingDepth = 1.0 * i + 0.36; - location.DetrimentFactor = 1.0 * i + 0.37; - location.DikeMaterialType = SoilType.Loam; - - 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); - } - location.DikeEmbankmentMaterial = "DikeMat"; - location.StabilityOptions = new StabilityOptions - { - SoilGeometries2DPath = Path.Combine(projectPath, @"Sub\TestMap"), - StabilityZoneType = MStabZonesType.ZoneAreas, - ForbiddenZoneFactor = 1.23, - ZoneAreaRestSlopeCrestWidth = 8.23, - TrafficLoad = 11.11, - MinimalCircleDepth = 1.21, - SoilDatabaseName = "test.mdb", - }; - location.RedesignDikeHeight = false; - location.RedesignDikeShoulder = false; - location.ShoulderEmbankmentMaterial = "ShoulderMat" + (i + 1).ToString(); ; - location.StabilityShoulderGrowSlope = 10.0 * i + 0.50; - location.StabilityShoulderGrowDeltaX = 10.0 * i + 0.51; - location.StabilitySlopeAdaptionDeltaX = 10.0 * i + 0.52; - location.SlopeAdaptionStartCotangent = 10.0 * i + 0.53; - location.SlopeAdaptionEndCotangent = 10.0 * i + 0.54; - location.SlopeAdaptionStepCotangent = 10.0 * i + 0.55; - location.UseNewDikeTopWidth = true; - location.UseNewDikeSlopeInside = true; - location.UseNewDikeSlopeOutside = true; - location.UseNewShoulderTopSlope = true; - location.UseNewShoulderBaseSlope = true; - location.UseNewMaxHeightShoulderAsFraction = true; - location.UseNewMinDistanceDikeToeStartDitch = true; - location.UseNewDitchDefinition = true; - location.NewDikeTopWidth = 10.0 * i + 0.56; - location.NewDikeSlopeInside = 10.0 * i + 0.57; - location.NewDikeSlopeOutside = 10.0 * i + 0.58; - location.NewShoulderTopSlope = 10.0 * i + 0.59; - location.NewShoulderBaseSlope = 10.0 * i + 0.60; - location.NewMaxHeightShoulderAsFraction = 10.0 * i + 0.61; - location.NewMinDistanceDikeToeStartDitch = 10.0 * i + 0.62; - location.UseNewDitchDefinition = true; - location.NewWidthDitchBottom = 10.0 * i + 0.63; - location.NewSlopeAngleDitch = 10.0 * i + 0.64; - location.NewDepthDitch = 10.0 * i + 0.65; - location.StabilityDesignMethod = StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption; - location.SoilList = dike.SoilList; - // ModelFactors - location.ModelFactors = new ModelFactors() - { - RequiredSafetyFactorPiping = 10.0 * i + 0.65, - RequiredSafetyFactorStabilityInnerSlope = 10.0 * i + 0.66, - RequiredSafetyFactorStabilityOuterSlope = 10.0 * i + 0.67, - UpliftCriterionStability = 10.0 * i + 0.68, - UpliftCriterionPiping = 10.0 * i + 0.69 - }; - 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); - if (soilProfileProbability.SoilProfile2D != null) - { - soilProfileProbability.SoilProfileType = SoilProfileType.ProfileType2D; - } - else - { - soilProfileProbability.SoilProfileType = SoilProfileType.ProfileTypeStiFile; - } - } - 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); - } - } - private void CompareDamProjectData(DamProjectData actual, DamProjectData expected) { - Assert.AreEqual(expectedAnalysisType, DamProjectCalculationSpecification.SelectedAnalysisType); + Assert.AreEqual(TestDataCreator.expectedAnalysisType, DamProjectCalculationSpecification.SelectedAnalysisType); var compare = new CompareLogic { Config = { MaxDifferences = 100 } }; var result = compare.Compare(expected, actual);