Index: dam clients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.BenchmarkTests.csproj =================================================================== diff -u -r339 -r744 --- dam clients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.BenchmarkTests.csproj (.../Deltares.Dam.BenchmarkTests.csproj) (revision 339) +++ dam clients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.BenchmarkTests.csproj (.../Deltares.Dam.BenchmarkTests.csproj) (revision 744) @@ -118,6 +118,14 @@ + + False + ..\..\..\lib\DamEngine\Deltares.DamEngine.Interface.dll + + + False + ..\..\..\lib\DamEngine\Deltares.DamEngine.Io.dll + False ..\..\..\lib\DSL-Geographic\Deltares.Geographic.dll Index: dam clients/DamUI/trunk/src/Dam/Tests/DamPipingBenchmarkTest.cs =================================================================== diff -u -r342 -r744 --- dam clients/DamUI/trunk/src/Dam/Tests/DamPipingBenchmarkTest.cs (.../DamPipingBenchmarkTest.cs) (revision 342) +++ dam clients/DamUI/trunk/src/Dam/Tests/DamPipingBenchmarkTest.cs (.../DamPipingBenchmarkTest.cs) (revision 744) @@ -23,8 +23,11 @@ using System.Collections.Generic; using System.IO; using Deltares.Dam.Data; +using Deltares.Dam.Data.DamEngineIo; using NUnit.Framework; using Deltares.Dam.TestHelper; +using Deltares.DamEngine.Interface; +using Deltares.DamEngine.Io; using Deltares.Standard.TestUtils; namespace Deltares.Dam.Tests @@ -40,66 +43,77 @@ /// /// /// - private static List> ComputeProject(string projectFilename) + private static List ComputeProject(string projectFilename, PipingModelType pipingModel) { // Read dikering using (var damProjectData = ProjectLoader.LoadProjectData(projectFilename)) { Assert.AreEqual(1, damProjectData.WaterBoard.Dikes.Count); var dike = damProjectData.WaterBoard.Dikes[0]; Assert.AreEqual(1, dike.Locations.Count); + damProjectData.DamProjectCalculationSpecification.CurrentSpecification.PipingModelType = pipingModel; + DamEngine.Io.XmlInput.Input input = FillXmlInputFromDamUi.CreateInput(damProjectData); + string inputXml = DamXmlSerialization.SaveInputAsXmlString(input); - // Calculate dijkring - // TODO: DAMUI Start - //var damProjectCalculator = new DamProjectCalculator(damProjectData); - //damProjectCalculator.CalculationBaseDirectory = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(projectFilename)), "CalculationFiles"); - //damProjectCalculator.MStabProgramPath = CmstabProgramPath; - //var allCalculationresults = damProjectCalculator.Calculate(damProjectData, dike.Scenarios); - //return allCalculationresults; - return null; - // TODO: DAMUI End + var damEnginInterface = new EngineInterface(inputXml); + string validationMessages = damEnginInterface.Validate(); + + if (string.IsNullOrEmpty(validationMessages)) + { + // only if validation is ok, then + string outputXml = damEnginInterface.Run(); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputXml); + FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output); + } + var allCalculationresults = damProjectData.DesignCalculations; + return allCalculationresults; } } /// /// Benchmark test 1 /// [Test] - [Category(Categories.WorkInProgress)] // To be checked public void Bm01OneAquiferOneLayer() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 1\Integratietest piping 1.damx"; - var allCalculationresults = ComputeProject(projectFilename); + var allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer4Forces); double expectedPipingFactor = 0.506; // This is calculated according to spreadsheet double expectedHCritical = 1.618839023; // This is calculated according to spreadsheet double expectedLocalPipingExitPointX = 35; // This is just taken from the calculation result itself - double expectedPl3HeadAdjusted = 1.2619775739041792; // This is just taken from the calculation result itself - double expectedPl4HeadAdjusted = 0.0; // This is just taken from the calculation result itself - - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); - Assert.AreEqual(expectedHCritical, allCalculationresults[0][0].Sellmeijer4ForcesHCritical.Value, cTolerance); - Assert.AreEqual(true, allCalculationresults[0][0].IsUplift.Value); - Assert.AreEqual(expectedLocalPipingExitPointX, allCalculationresults[0][0].LocalPipingExitPointX.Value, cTolerance); - Assert.AreEqual(expectedPl3HeadAdjusted, allCalculationresults[0][0].Pl3HeadAdjusted.Value, cTolerance); - Assert.AreEqual(expectedPl4HeadAdjusted, allCalculationresults[0][0].Pl4HeadAdjusted.Value, cTolerance); - - expectedPipingFactor = 0.3774; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + double expectedPl3HeadAdjusted = 0.0; // For Piping, this must always be 0 + double expectedPl4HeadAdjusted = 0.0; // For Piping, this must always be 0 + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedHCritical, allCalculationresults[0].Sellmeijer4ForcesHCritical.Value, cTolerance); + Assert.AreEqual(true, allCalculationresults[0].IsUplift.Value); + Assert.AreEqual(expectedLocalPipingExitPointX, allCalculationresults[0].LocalPipingExitPointX.Value, cTolerance); + Assert.AreEqual(expectedPl3HeadAdjusted, allCalculationresults[0].Pl3HeadAdjusted.Value, cTolerance); + Assert.AreEqual(expectedPl4HeadAdjusted, allCalculationresults[0].Pl4HeadAdjusted.Value, cTolerance); + + // Sellmeijer2Forces NOT supported for now + //expectedPipingFactor = 0.3774; // This is just taken from the calculation result itself + //Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + + allCalculationresults.Clear(); + allCalculationresults = ComputeProject(projectFilename, PipingModelType.Bligh); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].BlighPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.36395601533789024; // This is just taken from the calculation result itself - expectedHCritical = 1.3830328582839828; // This is just taken from the calculation result itself - expectedLocalPipingExitPointX = 35; // This is just taken from the calculation result itself - expectedPl3HeadAdjusted = 0.0; // This is just taken from the calculation result itself - expectedPl4HeadAdjusted = 0.0; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); - Assert.AreEqual(expectedHCritical, allCalculationresults[0][0].Wti2017HCritical.Value, cTolerance); - Assert.AreEqual(true, allCalculationresults[0][0].IsUplift.Value); - Assert.AreEqual(expectedLocalPipingExitPointX, allCalculationresults[0][0].LocalPipingExitPointX.Value, cTolerance); + // Wti2017 NOT supported for now +// allCalculationresults.Clear(); +// allCalculationresults = ComputeProject(projectFilename, PipingModelType.Wti2017); +// expectedPipingFactor = 0.36395601533789024; // This is just taken from the calculation result itself +// expectedHCritical = 1.3830328582839828; // This is just taken from the calculation result itself +// expectedLocalPipingExitPointX = 35; // This is just taken from the calculation result itself +// expectedPl3HeadAdjusted = 0.0; // This is just taken from the calculation result itself +// expectedPl4HeadAdjusted = 0.0; // This is just taken from the calculation result itself +// Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Wti2017PipingFactor.Value, cTolerance); +// Assert.AreEqual(expectedHCritical, allCalculationresults[0].Wti2017HCritical.Value, cTolerance); +// Assert.AreEqual(true, allCalculationresults[0].IsUplift.Value); +// Assert.AreEqual(expectedLocalPipingExitPointX, allCalculationresults[0].LocalPipingExitPointX.Value, cTolerance); //Assert.AreEqual(expectedPl3HeadAdjusted, allCalculationresults[0][0].Pl3HeadAdjusted.Value, cTolerance); //Assert.AreEqual(expectedPl4HeadAdjusted, allCalculationresults[0][0].Pl4HeadAdjusted.Value, cTolerance); } @@ -108,92 +122,120 @@ /// Benchmark test 2 /// [Test] - [Category(Categories.WorkInProgress)] // To be checked public void Bm02OneAquiferTwoLayers() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 2\Integratietest piping 2.damx"; - var allCalculationresults = ComputeProject(projectFilename); + var allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer4Forces); double expectedPipingFactor = 0.489; // This is calculated according to spreadsheet - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.3688; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + // Sellmeijer2Forces is NOT supported for now + //allCalculationresults.Clear(); + //allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer2Forces); + //expectedPipingFactor = 0.3688; // This is just taken from the calculation result itself + //Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + allCalculationresults.Clear(); + allCalculationresults = ComputeProject(projectFilename, PipingModelType.Bligh); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].BlighPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.35572120356770748; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); + // Wti2017 is not supported for now + //allCalculationresults.Clear(); + //allCalculationresults = ComputeProject(projectFilename, PipingModelType.Wti2017); + //expectedPipingFactor = 0.35572120356770748; // This is just taken from the calculation result itself + //Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Wti2017PipingFactor.Value, cTolerance); } /// /// Benchmark test 3 /// [Test] - [Category(Categories.WorkInProgress)] // To be checked public void Bm03OneAquiferThreeLayers() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 3\Integratietest piping 3.damx"; - var allCalculationresults = ComputeProject(projectFilename); + var allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer4Forces); double expectedPipingFactor = 0.494; // This is calculated according to spreadsheet - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.3733; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + // Sellmeijer2Forces is NOT supported for now + // allCalculationresults.Clear(); + // allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer2Forces); + // expectedPipingFactor = 0.3733; // This is just taken from the calculation result itself + // Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + allCalculationresults.Clear(); + allCalculationresults = ComputeProject(projectFilename, PipingModelType.Bligh); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].BlighPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.36005969460534598; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); + // Wti2017 is not supported for now + // allCalculationresults.Clear(); + // allCalculationresults = ComputeProject(projectFilename, PipingModelType.Wti2017); + // expectedPipingFactor = 0.36005969460534598; // This is just taken from the calculation result itself + // Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Wti2017PipingFactor.Value, cTolerance); } /// /// Benchmark test 4 /// [Test] - [Category(Categories.WorkInProgress)] // To be checked public void Bm04TwoAquifersOneLayer() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 4\Integratietest piping 4.damx"; - var allCalculationresults = ComputeProject(projectFilename); + var allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer4Forces); double expectedPipingFactor = 0.608; // This is calculated according to spreadsheet - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.4410; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + // Sellmeijer2Forces is NOT supported for now + // allCalculationresults.Clear(); + // allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer2Forces); + // expectedPipingFactor = 0.4410; // This is just taken from the calculation result itself + // Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + allCalculationresults.Clear(); + allCalculationresults = ComputeProject(projectFilename, PipingModelType.Bligh); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].BlighPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.42527879109125538; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); + // Wti2017 is not supported for now + // allCalculationresults.Clear(); + // allCalculationresults = ComputeProject(projectFilename, PipingModelType.Wti2017); + // expectedPipingFactor = 0.42527879109125538; // This is just taken from the calculation result itself + // Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Wti2017PipingFactor.Value, cTolerance); } /// /// Benchmark test 5 /// [Test] - [Category(Categories.WorkInProgress)] // To be checked public void Bm05TwoAquifersTwoLayers() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 5\Integratietest piping 5.damx"; - var allCalculationresults = ComputeProject(projectFilename); + var allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer4Forces); double expectedPipingFactor = 0.618; // This is calculated according to spreadsheet - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.4494; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + // Sellmeijer2Forces is NOT supported for now + // allCalculationresults.Clear(); + // allCalculationresults = ComputeProject(projectFilename, PipingModelType.Sellmeijer2Forces); + // expectedPipingFactor = 0.4494; // This is just taken from the calculation result itself + // Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); + allCalculationresults.Clear(); + allCalculationresults = ComputeProject(projectFilename, PipingModelType.Bligh); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); + Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].BlighPipingFactor.Value, cTolerance); - expectedPipingFactor = 0.43345922746899618; // This is just taken from the calculation result itself - Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); + // Wti2017 is not supported for now + // allCalculationresults.Clear(); + // allCalculationresults = ComputeProject(projectFilename, PipingModelType.Wti2017); + // expectedPipingFactor = 0.43345922746899618; // This is just taken from the calculation result itself + // Assert.AreEqual(expectedPipingFactor, allCalculationresults[0].Wti2017PipingFactor.Value, cTolerance); } } }