// Copyright (C) Stichting Deltares 2018. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.IO; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Io; using NUnit.Framework; namespace Deltares.DamEngine.Interface.Tests { [TestFixture] public class PipingSellmeijerVnkTests { private const double tolerance = 0.0005; [Test] public void CanPerformSellmeijerVnkDesignPipingVoorbeeld1() { // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerVNK.damx" // Set Analysis type to "No Adaption" const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerVNKInputFile.xml"; string inputString = File.ReadAllText(fileName); EngineInterface engineInterface = new EngineInterface(inputString); Assert.IsNotNull(engineInterface.DamProjectData); string outputString = engineInterface.Run(); // Factor piping = 0.463 // Kritische hoogte = 1.619 // Factor opdrijven = 0.351 // Kwelweglengte piping = 25.0 // Intredepunt x-lokaal = 10.0 // Uittredepunt x-lokaal = 35.0 // Opdrijven = true // Profielnaam = soilprofile_01 // PL3 opdrijven = 0.582 // PL3 stijghoogte aangepast = 1.262 // PL3 locatie opdriven lokaal = 35.0 // PL4 opdrijven = 0.0 // PL4 stijghoogte aangepast = 0.0 // PL4 locatie opdrijven lokaal = 0.0 // Locatie naam = "profiel 1" // ID locatie scenario = "1" // Heave Factor = 90.0 Assert.IsNotNull(outputString); var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); Assert.AreEqual(0.463, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkFactor, tolerance); Assert.AreEqual(1.759, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkHcritical, tolerance); Assert.AreEqual(35.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ExitPointX, tolerance); // The following values are not the same as in the classic UI // The upliftfactor there is 0.351, but that is the Wti Upliftfactor // The adjusted PL3/PL4 values there are not 0.0, but those are the values for stability; for piping no adjustment has to be made Assert.AreEqual(0.5825, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.IsUplift); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3LocationXMinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4MinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4HeadAdjusted, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4LocationXMinUplift, tolerance); } [Test] public void CanPerformSellmeijerVnkDesignWithAdaptionPipingVoorbeeld1() { // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerVNK.damx" // Set Analysis type to "Adapt geometry" // Change required safety factor piping to 1.01 const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerVNKDesignInputFile.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); DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].PipingDesignResults.RedesignedSurfaceLine; // uplift = true Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.IsUplift); // shoulder height = 1.995 Assert.AreEqual(1.995, redesignedSurfaceLine.DetermineShoulderHeight(), tolerance); // dike length = 84.486 Assert.AreEqual(84.486, redesignedSurfaceLine.GetDikeLength(), tolerance); // ShoulderLength = X_Kruin binnenberm - X_Insteek binnenberm = 82.51 - 29.01 = 53.5 // Read from PipingSellmeijerVNK_Piping_CharacteristicPoints.csv by export surfacelines in Release Assert.AreEqual(53.5, redesignedSurfaceLine.DetermineShoulderLength(), tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3LocationXMinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4MinUplift, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4HeadAdjusted, tolerance); Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4LocationXMinUplift, tolerance); // The ExitPointX in Dam 15.1.2.24738 is (incorrectly) not shown // ExitPointX = X_Teen dijk binnenwaarts = 94.486 // Read from PipingSellmeijerVNK_Piping_CharacteristicPoints.csv by export surfacelines in Release Assert.AreEqual(94.486, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ExitPointX, tolerance); // The following values are not the same as in the Dam 15.1.2.24738 release // The final piping calculation at the redesigned situation is done at X = 29.014 (the "insteek van de berm"), // but it should have been done at X = 94.486 (the "teen van de dijk") // Found expected values by debugging with Classic // after change in Classic: upliftLocationDeterminator.GetLocationAndResult(upliftcriterion - 0.000000001) // The Factor in Dam 15.1.2.24738 is 1.167, but that is not correct, because that is the value at X = 29.014 // expected value = 1.070 Assert.AreEqual(1.070, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkFactor, tolerance); // The Hcritical in Dam 15.1.2.24738 is 2.105, but that is not correct, because that is the value at X = 29.014 // expected value = 4.067 Assert.AreEqual(4.067, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkHcritical, tolerance); // The upliftfactor in Dam 15.1.2.24738 is (incorrectly) not shown // expected value = 0.582 Assert.AreEqual(0.582, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); } [Test] public void TestIfSellmeijerVnkCalculationResultIsSetToFailDueToShoulderShoulderLengthError() { // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerVNK.damx" // Set Analysis type to "Adapt geometry" const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerVNKDesignInputFileFail.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(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); // expected value = -1 because exception was raised for the shoulder length Assert.AreEqual(-1.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkFactor, tolerance); Assert.AreEqual("The new shoulder length is too large to fit in the current surface line.", output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ResultMessage); Assert.AreEqual("Location Profiel 1, subsoil scenario 'soilprofile_01', design scenario '1': " + "The calculation failed with error message " + "'The design was not successful. " + "The new shoulder length is too large to fit in the current surface line.'", output.Results.CalculationMessages[0].Message1); } [Test] public void TestIfSellmeijerVnkCalculationGeneratesNoErrorWhenNewShoulderLengthIsSmaller() { // Based on ".\data\DamEngineTestProjects\Invoer3\DeltaDijk\DeltaDijk normal.damx" // Set Analysis type to "Adapt geometry" const string fileName = @"TestFiles\DeltaDijkInvoer3VNKAdaptionShoulderLength.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(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.SellmeijerVnkFactor > -1); Assert.AreEqual("", output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ResultMessage); } } }