Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj
===================================================================
diff -u -r684 -r745
--- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 684)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 745)
@@ -44,10 +44,12 @@
+
+
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapperTests.cs
===================================================================
diff -u
--- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapperTests.cs (revision 0)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapperTests.cs (revision 745)
@@ -0,0 +1,300 @@
+// Copyright (C) Stichting Deltares 2017. 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.Collections.Generic;
+using System.Data;
+using Deltares.DamEngine.Calculators.KernelWrappers.Common;
+using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingBligh;
+using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces;
+using Deltares.DamEngine.Data.Design;
+using Deltares.DamEngine.Data.General;
+using Deltares.DamEngine.Data.General.Results;
+using Deltares.DamEngine.Data.Geometry;
+using Deltares.DamEngine.Data.Geotechnics;
+using Deltares.DamEngine.Data.Standard.Logging;
+using NUnit.Framework;
+
+namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.DamPipingBligh
+{
+ [TestFixture]
+ public class DamPipingBlighKernelWrapperTests
+ {
+ [Test]
+ public void TestFullCalculation()
+ {
+ // expected results are based on test in 'https://repos.deltares.nl/repos/dam/dam classic' revision 190
+ // Hc = SeepageLength / CreepFactor = 40.5 / 18 = 2.25
+ // CreepFactor is calculated with D70
+ // reducedFall = HRiver - HExit - (Rc * DTotal) = 2.0 - 0.0 - (0.3 * 5.0) = 0.5
+ // FoSp = Hc / reducedFall = 2.25 / 0.5
+
+ const double diff = 0.0001;
+
+ var location = new Location("Location 1")
+ {
+ SurfaceLine = CreateSurfaceLineTutorial1()
+ };
+
+ var designScenario = new DesignScenario
+ {
+ LocationScenarioID = "1",
+ Location = location,
+ RiverLevel = 2.0,
+ ModelFactors =
+ {
+ UpliftCriterionPiping = 1.0
+ }
+ };
+
+ var subSoilScenario = new SoilGeometryProbability();
+ subSoilScenario.SoilProfile1D = CreateClaySandProfileForPipingBligh();
+ subSoilScenario.SegmentFailureMechanismType = FailureMechanismSystemType.Piping;
+
+ var damKernelInput = new DamKernelInput
+ {
+ DesignScenario = designScenario,
+ Location = location,
+ SubSoilScenario = subSoilScenario
+ };
+
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+
+ // Prepare the wrapper. Result is input for the calculation dll
+ IKernelDataInput damPipingInput;
+ IKernelDataOutput kernelDataOutput;
+ kernelWrapper.Prepare(damKernelInput, out damPipingInput, out kernelDataOutput);
+
+ // Validate the input
+ List messages;
+ kernelWrapper.Validate(damPipingInput, kernelDataOutput, out messages);
+ Assert.AreEqual(0, messages.Count);
+
+ // Run the dll
+ kernelWrapper.Execute(damPipingInput, kernelDataOutput, out messages);
+ DamPipingBlighOutput damPipingOutput = (DamPipingBlighOutput)kernelDataOutput;
+ Assert.AreEqual(0, messages.Count);
+ Assert.AreEqual(4.5, damPipingOutput.FoSp, diff);
+ Assert.AreEqual(2.25, damPipingOutput.Hc, diff);
+
+ // Fill the design results
+ DesignResult result;
+ kernelWrapper.PostProcess(damKernelInput, damPipingOutput, "", out result);
+ Assert.AreEqual(FailureMechanismSystemType.Piping, result.DamFailureMechanismeCalculation.FailureMechanismSystemType);
+ Assert.AreEqual(PipingModelType.Bligh, result.DamFailureMechanismeCalculation.PipingModelType);
+ Assert.IsNotNullOrEmpty(result.LocationName);
+ Assert.IsNotNullOrEmpty(result.ScenarioName);
+ Assert.IsNotNullOrEmpty(result.ProfileName);
+ Assert.AreEqual(4.5, result.PipingDesignResults.BlighFactor, diff);
+ Assert.AreEqual(2.25, result.PipingDesignResults.BlighHcritical, diff);
+ }
+
+ [Test]
+ public void TestPrepare()
+ {
+ const double diff = 0.0001;
+
+ var designScenario = new DesignScenario();
+ designScenario.Location = new Location();
+ designScenario.RiverLevel = 2.0;
+ designScenario.ModelFactors.UpliftCriterionPiping = 1.0;
+
+ var location = new Location();
+ location.SurfaceLine = CreateSurfaceLineTutorial1();
+
+ var subSoilScenario = new SoilGeometryProbability();
+ subSoilScenario.SoilProfile1D = CreateClaySandProfileForPipingBligh();
+ subSoilScenario.SegmentFailureMechanismType = FailureMechanismSystemType.Piping;
+
+ var damKernelInput = new DamKernelInput
+ {
+ DesignScenario = designScenario,
+ Location = location,
+ SubSoilScenario = subSoilScenario
+ };
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+ IKernelDataInput kernelDataInput;
+ IKernelDataOutput kernelDataOutput;
+ kernelWrapper.Prepare(damKernelInput, out kernelDataInput, out kernelDataOutput);
+ DamPipingBlighInput damPipingInput = (DamPipingBlighInput)kernelDataInput;
+ Assert.AreEqual(2.0, damPipingInput.HRiver, diff);
+ Assert.AreEqual(0.0, damPipingInput.HExit, diff);
+ Assert.AreEqual(0.3, damPipingInput.Rc, diff);
+ Assert.AreEqual(5.0, damPipingInput.DTotal, diff);
+ Assert.AreEqual(40.5, damPipingInput.SeepageLength, diff);
+ Assert.AreEqual(180.0, damPipingInput.D70, diff);
+ }
+
+ [Test]
+ public void TestValidate()
+ {
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+
+ // Validate without setting values. Expected error messages.
+ var damPipingInput = new DamPipingBlighInput();
+ var damPipingOutput = new DamPipingBlighOutput();
+ List messages;
+ kernelWrapper.Validate(damPipingInput, damPipingOutput, out messages);
+ Assert.IsTrue(messages.Count > 0);
+
+ // Validate the input when valid input is provided. Expected no messages.
+ damPipingInput = new DamPipingBlighInput
+ {
+ HRiver = 1.0,
+ HExit = 0.0,
+ Rc = 0.3,
+ DTotal = 2.0,
+ SeepageLength = 40.5,
+ D70 = 200.0,
+ };
+ messages.Clear();
+ kernelWrapper.Validate(damPipingInput, damPipingOutput, out messages);
+ Assert.AreEqual(0, messages.Count);
+ }
+
+ [Test]
+ public void TestPostProcess()
+ {
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+
+ var subSoilScenario = new SoilGeometryProbability();
+ subSoilScenario.SoilProfile1D = CreateClaySandProfileForPipingBligh();
+ subSoilScenario.SegmentFailureMechanismType = FailureMechanismSystemType.Piping;
+ var input = new DamKernelInput
+ {
+ DesignScenario = new DesignScenario(),
+ Location = new Location(),
+ SubSoilScenario = subSoilScenario
+ };
+ input.DesignScenario.Location = new Location();
+
+ DamPipingBlighOutput output = new DamPipingBlighOutput
+ {
+ FoSp = 1.1,
+ Hc = 2.2
+ };
+
+ DesignResult result;
+ kernelWrapper.PostProcess(input, output, "", out result);
+ Assert.AreEqual(output.FoSp, result.PipingDesignResults.BlighFactor);
+ Assert.AreEqual(output.Hc, result.PipingDesignResults.BlighHcritical);
+ }
+
+ [Test]
+ [Category(Categories.WorkInProgress)]
+ [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "Geen invoer object gedefinieerd voor Bligh")]
+ [SetUICulture("nl-NL")]
+ public void TestLanguageNLThrowsExceptionInExecuteWhenInputIsNull()
+ {
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+ List messages;
+ kernelWrapper.Execute(null, null, out messages);
+ }
+
+ [Test]
+ [Category(Categories.WorkInProgress)]
+ [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "No input object defined for Bligh")]
+ [SetUICulture("en-US")]
+ public void TestLanguageENThrowsExceptionInExecuteWhenInputIsNull()
+ {
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+ List messages;
+ kernelWrapper.Execute(null, null, out messages);
+ }
+
+ [Test]
+ [Category(Categories.WorkInProgress)]
+ [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "Geen uitvoer object gedefinieerd voor Bligh")]
+ [SetUICulture("nl-NL")]
+ public void TestThrowsExceptionInPostProcessWhenOutputIsNull()
+ {
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+ DesignResult result;
+ kernelWrapper.PostProcess(new DamKernelInput(), null, "", out result);
+ }
+
+ [Test]
+ [Category(Categories.WorkInProgress)]
+ [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "Geen invoer object gedefinieerd voor Bligh")]
+ [SetUICulture("nl-NL")]
+ public void TestThrowsExceptionInPostProcessWhenInputIsNull()
+ {
+ var kernelWrapper = new DamPipingBlighKernelWrapper();
+ DesignResult result;
+ kernelWrapper.PostProcess(null, new DamPipingBlighOutput(), "", out result);
+ }
+
+ private static SoilProfile1D CreateClaySandProfileForPipingBligh()
+ {
+ SoilProfile1D soilProfile1D = new SoilProfile1D();
+ SoilLayer1D soilLayer1D1 = new SoilLayer1D();
+ soilLayer1D1.Name = "L0";
+ soilLayer1D1.TopLevel = 10.0;
+ soilLayer1D1.Soil = new Soil("HW-OBO", 12.0, 10.0);
+ soilLayer1D1.Soil.DryUnitWeight = 0.01;
+ soilLayer1D1.IsAquifer = false;
+ soilLayer1D1.Soil.SoilType = SoilType.Clay;
+ soilProfile1D.Layers.Add(soilLayer1D1);
+
+ SoilLayer1D soilLayer1D2 = new SoilLayer1D();
+ soilLayer1D2.Name = "L1";
+ soilLayer1D2.TopLevel = -5.0;
+ soilLayer1D2.Soil = new Soil("Alg-zand (0-30)", 22.0, 20.0);
+ soilLayer1D2.Soil.DryUnitWeight = 0.01;
+ soilLayer1D2.IsAquifer = true;
+ soilProfile1D.Layers.Add(soilLayer1D2);
+ soilProfile1D.BottomLevel = -10.0;
+
+ foreach (SoilLayer1D layer in soilProfile1D.Layers)
+ {
+ layer.Soil.BelowPhreaticLevel = 1.0;
+ layer.Soil.AbovePhreaticLevel = 1.0;
+ layer.Soil.DiameterD70 = 0.00018;
+ }
+ return soilProfile1D;
+ }
+
+ private static SurfaceLine2 CreateSurfaceLineTutorial1(bool includingTraffic = false)
+ {
+ 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)
+ {
+ line.EnsurePointOfType(35.0, 5.0, CharacteristicPointType.TrafficLoadOutside);
+ line.EnsurePointOfType(38.5, 5.0, CharacteristicPointType.TrafficLoadInside);
+ }
+ 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;
+ }
+ }
+}
Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Categories.cs
===================================================================
diff -u
--- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Categories.cs (revision 0)
+++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Categories.cs (revision 745)
@@ -0,0 +1,28 @@
+// Copyright (C) Stichting Deltares 2017. 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.
+
+namespace Deltares.DamEngine.Calculators.Tests
+{
+ public static class Categories
+ {
+ public const string WorkInProgress = "Work_In_Progress";
+ }
+}
Index: dam classic/trunk/src/Dam/Data/Deltares.Dam.Data.csproj
===================================================================
diff -u -r709 -r745
--- dam classic/trunk/src/Dam/Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 709)
+++ dam classic/trunk/src/Dam/Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 745)
@@ -441,7 +441,6 @@
SoilProfileDataSet.xsd
- Component
SoilProfileDataSet.cs