Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs
===================================================================
diff -u -r4117 -r4124
--- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 4117)
+++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 4124)
@@ -360,7 +360,6 @@
private void RunPiping(FailureMechanismSystemType failureMechanismSystemType)
{
- ReadUserSettingsSlipCircleDefinition(CalculationParameters.MStabParameters.SlipCircleDefinition);
DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = failureMechanismSystemType;
CallDamEngine();
Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs
===================================================================
diff -u
--- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs (revision 0)
+++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/PipingWtiInsideTest.cs (revision 4124)
@@ -0,0 +1,143 @@
+// Copyright (C) Stichting Deltares 2023. All rights reserved.
+//
+// This file is part of the application DAM - Live.
+//
+// DAM - Live 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;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Deltares.Dam.Application.Live;
+using Deltares.Dam.Data;
+using Deltares.DamLive.TestHelper;
+using Deltares.Standard.IO;
+using NUnit.Framework;
+
+namespace Deltares.DamLive.Tests;
+
+public class PipingWtiInsideTest
+{
+ const string projectIntegrationFilename = @"DAMLive.damx";
+ const string input1aFilename = @"live.InputTimeSeriesMHW.xml";
+ const string output1aFilename = @"live.OutputTimeSeriesMHW.xml";
+ const string calculationParametersIntegrationFilename = @"live.ParametersFile.xml";
+
+ const string testWorkingFolder = @".\damLivePipingWtiWork";
+ private const string testIntegrationDataFolder = @"..\..\..\data\IntegerationTests\PipingWti";
+ private List locations;
+
+ private string inputFile;
+ private string outputFile;
+ private string projectFile;
+ private string parameterFile;
+
+ private DamEngineRunner runner;
+
+ [SetUp]
+ public void SetupFixture()
+ {
+ IoHelper.RemoveTestWorkingDirectory(testWorkingFolder); // to be sure no test directory exist from previous tests
+ Directory.CreateDirectory(testWorkingFolder);
+ }
+
+ [TearDown]
+ public void TearDownFixture()
+ {
+ //IoHelper.RemoveTestWorkingDirectory(testWorkingFolder);
+ }
+
+ [TearDown]
+ public void TearDownTest()
+ {
+ GeneralHelper.AssertNoErrors(runner);
+ }
+
+ [SetUp]
+ public void SetupTest() {}
+
+ [Test]
+ [Category("Integration")]
+ [Category("Work_In_Progress")]
+ [TestCase(1)]
+ [TestCase(20)]
+ public void CalculatePipingInsideWt1ModelUsingTestFilesHasExpectedResultsInOutputFile(int maxCores)
+ {
+ const double cTolerance = 0.0005;
+ GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1aFilename,
+ output1aFilename, calculationParametersIntegrationFilename,
+ projectIntegrationFilename, out runner, out locations);
+ //SetupPipingProject(maxCores);
+ runner.Initialize();
+ runner.MaxCalculationCores = maxCores;
+ Assert.IsNotNull(runner);
+ Assert.IsNotNull(runner.DamProjectData);
+ Assert.IsNotNull(runner.CalculationParameters);
+ Assert.IsNotNull(runner.CalculationParameters.CalculationModules);
+
+ runner.Run();
+ //runner.WriteResultsToFile(outputFile);
+
+ GeneralHelper.AssertNoErrors(runner);
+
+ // Assertions
+
+ List series = runner.OutputTimeSeriesCollection.Series;
+
+ var seriesCount = 0;
+
+ string[] validParameterIDs = Enum.GetNames(typeof(TimeSerieParameters));
+ foreach (TimeSerie timeSeries in series)
+ {
+ Assert.IsTrue(validParameterIDs.Any(n => n == timeSeries.ParameterId));
+ Assert.IsTrue(locations.Any(l => l.Name == timeSeries.LocationId));
+ // StabilityInside check
+ if (timeSeries.ParameterId == TimeSerieParameters.PipingFactor.ToString())
+ {
+ if (timeSeries.LocationId == "Purmer_PU0042+00_K")
+ {
+ TimeSerieEntry firstEntry = timeSeries.Entries.First();
+ Assert.AreEqual(0.740, firstEntry.Value, cTolerance, "The computed safety factory is not correct");
+ TimeSerieEntry lastEntry = timeSeries.Entries.Last();
+ Assert.AreEqual(0.680, lastEntry.Value, cTolerance, "The computed safety factory is not correct");
+ }
+
+ if (timeSeries.LocationId == "Purmer_PU0042+00_K_V")
+ {
+ TimeSerieEntry firstEntry = timeSeries.Entries.First();
+ Assert.AreEqual(0.740, firstEntry.Value, cTolerance, "The computed safety factory is not correct");
+ TimeSerieEntry lastEntry = timeSeries.Entries.Last();
+ Assert.AreEqual(0.680, lastEntry.Value, cTolerance, "The computed safety factory is not correct");
+ }
+
+ if (timeSeries.LocationId == "Purmer_PU0110+20_R")
+ {
+ TimeSerieEntry firstEntry = timeSeries.Entries.First();
+ Assert.AreEqual(90, firstEntry.Value, cTolerance, "The computed safety factory is not correct");
+ TimeSerieEntry lastEntry = timeSeries.Entries.Last();
+ Assert.AreEqual(90, lastEntry.Value, cTolerance, "The computed safety factory is not correct");
+ }
+ }
+
+ seriesCount++;
+ }
+
+ Assert.IsTrue(seriesCount > 0, "No output time series");
+ }
+
+}
\ No newline at end of file
Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs
===================================================================
diff -u -r4121 -r4124
--- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs (.../StabilityInsideBishopGridTest.cs) (revision 4121)
+++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs (.../StabilityInsideBishopGridTest.cs) (revision 4124)
@@ -26,24 +26,21 @@
using Deltares.Dam.Application.Live;
using Deltares.Dam.Data;
using Deltares.DamLive.TestHelper;
-using Deltares.Standard.IO;
using NUnit.Framework;
namespace Deltares.DamLive.Tests;
-
[TestFixture]
[Category("Integration")]
-
public class StabilityInsideBishopGridTest
{
- const string projectStabilityFilename = @"DAMLive.damx";
+ const string projectIntegrationFilename = @"DAMLive.damx";
const string input1aFilename = @"live.InputTimeSeriesMHW.xml";
const string output1aFilename = @"live.OutputTimeSeriesMHW.xml";
- const string calculationParametersStabilityFilename = @"live.ParametersFile.xml";
+ const string calculationParametersIntegrationFilename = @"live.ParametersFile.xml";
const string testWorkingFolder = @".\damLiveBishopGridWork";
- private const string testStablityDataFolder = @"..\..\..\data\IntegerationTests\StabilityInsideBishopGrid";
+ private const string testIntegrationDataFolder = @"..\..\..\data\IntegerationTests\StabilityInsideBishopGrid";
private List locations;
private string inputFile;
@@ -52,7 +49,7 @@
private string parameterFile;
private DamEngineRunner runner;
-
+
[SetUp]
public void SetupFixture()
{
@@ -69,21 +66,24 @@
[TearDown]
public void TearDownTest()
{
- AssertNoErrors();
+ GeneralHelper.AssertNoErrors(runner);
}
[SetUp]
public void SetupTest() {}
-
- [Test] //, Ignore("")]
+
+ [Test]
[Category("Integration")]
[Category("Work_In_Progress")]
[TestCase(1)]
[TestCase(20)]
public void CalculateStabilityInsideBishopGridUsingTestFilesHasExpectedResultsInOutputFile(int maxCores)
{
const double cTolerance = 0.0005;
- SetupStabilityProject(maxCores);
+ GeneralHelper.SetupIntegrationProject(maxCores, testWorkingFolder, testIntegrationDataFolder, input1aFilename,
+ output1aFilename, calculationParametersIntegrationFilename,
+ projectIntegrationFilename, out runner, out locations);
+ //SetupStabilityProject(maxCores);
runner.Initialize();
runner.MaxCalculationCores = maxCores;
Assert.IsNotNull(runner);
@@ -95,7 +95,7 @@
runner.Run();
//runner.WriteResultsToFile(outputFile);
- AssertNoErrors();
+ GeneralHelper.AssertNoErrors(runner);
// Assertions
@@ -128,64 +128,24 @@
}
else
{
- //Assert.AreEqual(1.493, firstEntry.Value, cTolerance, "The computed safety factory is not correct");
+ Assert.AreEqual(1.493, firstEntry.Value, cTolerance, "The computed safety factory is not correct");
}
}
+
if (timeSeries.LocationId == "Purmer_PU0110+20_R")
{
TimeSerieEntry firstEntry = timeSeries.Entries.First();
// Following value was 0.590 in the previous DamLive version, but that has to do with how the
// reference level Su is handled in D-GeoStability 18.1 and D-GeoStability 15.1
Assert.AreEqual(1.317, firstEntry.Value, cTolerance, "The computed safety factory is not correct");
}
-
-
}
seriesCount++;
}
Assert.IsTrue(seriesCount > 0, "No output time series");
-
}
-
- private void SetupStabilityProject(int maxCores)
- {
- string actualTestPath = Path.GetFullPath(testWorkingFolder + maxCores.ToString());
- Directory.CreateDirectory(actualTestPath);
-
- DirectoryHelper.CopyRecursive(actualTestPath, testStablityDataFolder);
-
- inputFile = Path.Combine(actualTestPath, input1aFilename);
- outputFile = Path.Combine(actualTestPath, output1aFilename);
- parameterFile = Path.Combine(actualTestPath, calculationParametersStabilityFilename);
- projectFile = Path.Combine(actualTestPath, projectStabilityFilename);
- DamProject.SetTestProgramVersion("23.1");
- DamProjectData damData = DamProject.LoadData(projectFile);
- locations = damData.Locations;
-
- // Load the sensor time serie data (see input file for details)
- TimeSerieCollection inputTimeSeries = TimeSerieCollection.LoadFromFile(inputFile);
- //ShortenTimeSeries(inputTimeSeries);
- inputTimeSeries.Save(Path.ChangeExtension(inputFile, "short.xml"));
-
- runner = new DamEngineRunner
- {
- DamXFile = new FileInfo(projectFile),
- ParametersFile = new FileInfo(parameterFile),
- FewsInputFile = new FileInfo(inputFile),
- FewsOutputFile = new FileInfo(outputFile),
- Filter = "",
- InputTimeSeriesCollection = inputTimeSeries
- };
- }
- private void AssertNoErrors()
- {
- if (runner.HasErrors)
- {
- Assert.Fail("The test failed. See the error log in the test output console for more info");
- }
- }
}
\ No newline at end of file
Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DAMEnumerations.cs
===================================================================
diff -u -r4070 -r4124
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DAMEnumerations.cs (.../DAMEnumerations.cs) (revision 4070)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DAMEnumerations.cs (.../DAMEnumerations.cs) (revision 4124)
@@ -198,7 +198,8 @@
ProbabilityOfFailurePipingSellmeijer,
OvertoppingErosion,
StabilityInsideFactor,
- StabilityOutsideFactor
+ StabilityOutsideFactor,
+ PipingFactor
}
public enum UpliftType
Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs
===================================================================
diff -u
--- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (revision 0)
+++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (revision 4124)
@@ -0,0 +1,75 @@
+// Copyright (C) Stichting Deltares 2023. All rights reserved.
+//
+// This file is part of the application DAM - Live.
+//
+// DAM - Live 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.IO;
+using Deltares.Dam.Application.Live;
+using Deltares.Dam.Data;
+using Deltares.Standard.IO;
+using NUnit.Framework;
+
+namespace Deltares.DamLive.TestHelper;
+
+public class GeneralHelper
+{
+ public static void SetupIntegrationProject(int maxCores, string testWorkingFolder, string testIntegrationDataFolder,
+ string input1aFilename, string output1aFilename,
+ string calculationParametersIntegrationFilename, string projectIntegrationFilename,
+ out DamEngineRunner runner, out List locations)
+ {
+ string actualTestPath = Path.GetFullPath(testWorkingFolder + maxCores.ToString());
+
+ Directory.CreateDirectory(actualTestPath);
+
+ DirectoryHelper.CopyRecursive(actualTestPath, testIntegrationDataFolder);
+
+ string inputFile = Path.Combine(actualTestPath, input1aFilename);
+ string outputFile = Path.Combine(actualTestPath, output1aFilename);
+ string parameterFile = Path.Combine(actualTestPath, calculationParametersIntegrationFilename);
+ string projectFile = Path.Combine(actualTestPath, projectIntegrationFilename);
+ DamProject.SetTestProgramVersion("23.1");
+ DamProjectData damData = DamProject.LoadData(projectFile);
+ locations = damData.Locations;
+
+ // Load the sensor time serie data (see input file for details)
+ TimeSerieCollection inputTimeSeries = TimeSerieCollection.LoadFromFile(inputFile);
+ //ShortenTimeSeries(inputTimeSeries);
+ inputTimeSeries.Save(Path.ChangeExtension(inputFile, "short.xml"));
+
+ runner = new DamEngineRunner
+ {
+ DamXFile = new FileInfo(projectFile),
+ ParametersFile = new FileInfo(parameterFile),
+ FewsInputFile = new FileInfo(inputFile),
+ FewsOutputFile = new FileInfo(outputFile),
+ Filter = "",
+ InputTimeSeriesCollection = inputTimeSeries
+ };
+ }
+
+ public static void AssertNoErrors(DamEngineRunner runner)
+ {
+ if (runner.HasErrors)
+ {
+ Assert.Fail("The test failed. See the error log in the test output console for more info");
+ }
+ }
+}
\ No newline at end of file