Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveUsingCompleteDataSetTest.cs =================================================================== diff -u -r4630 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveUsingCompleteDataSetTest.cs (.../DamLiveUsingCompleteDataSetTest.cs) (revision 4630) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveUsingCompleteDataSetTest.cs (.../DamLiveUsingCompleteDataSetTest.cs) (revision 5807) @@ -62,7 +62,7 @@ Assert.That(runner.RunnerDelegate, Is.Not.Null); Assert.That(runner.CalculationParameters, Is.Not.Null); Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); runner.Process(); runner.WriteResultsToFile(outputFile); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/XmlCalculationParameters.xsd =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/XmlCalculationParameters.xsd (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/XmlCalculationParameters.xsd (revision 5807) @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Fisheye: Tag 5807 refers to a dead (removed) revision in file `DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/SampleCalculationParameters.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Grebbedijk/live.ParametersFile.xml =================================================================== diff -u -r4055 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Grebbedijk/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 4055) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Grebbedijk/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 5807) @@ -1,35 +1,34 @@ - - - - - 1 - 0 - 0 - - - Bishop - Grid - 1 - - \ No newline at end of file + + + + + 1 + 0 + 0 + + + Bishop + Grid + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/Deltares.Dam.Application.Live.csproj =================================================================== diff -u -r4812 -r5807 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/Deltares.Dam.Application.Live.csproj (.../Deltares.Dam.Application.Live.csproj) (revision 4812) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/Deltares.Dam.Application.Live.csproj (.../Deltares.Dam.Application.Live.csproj) (revision 5807) @@ -23,6 +23,8 @@ + + ..\..\lib\DamEngine\Deltares.DamEngine.Data.dll Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs =================================================================== diff -u -r5754 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (.../GeneralHelper.cs) (revision 5754) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/GeneralHelper.cs (.../GeneralHelper.cs) (revision 5807) @@ -103,7 +103,7 @@ Assert.Multiple(() => { Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); }); } Fisheye: Tag 5807 refers to a dead (removed) revision in file `DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/CalculationParametersDefinition.xsd'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Io/XmlCalculationParameters.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Io/XmlCalculationParameters.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Io/XmlCalculationParameters.cs (revision 5807) @@ -0,0 +1,246 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// +// This source code was auto-generated by xsd, Version=4.8.3928.0. +// +namespace Deltares.DamLive.Io { + using System.Xml.Serialization; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] + [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)] + public partial class XmlCalculationParameters { + + private XmlCalculationParametersCalculationModules calculationModulesField; + + private XmlCalculationParametersStabilityParameters stabilityParametersField; + + /// + public XmlCalculationParametersCalculationModules CalculationModules { + get { + return this.calculationModulesField; + } + set { + this.calculationModulesField = value; + } + } + + /// + public XmlCalculationParametersStabilityParameters StabilityParameters { + get { + return this.stabilityParametersField; + } + set { + this.stabilityParametersField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] + public partial class XmlCalculationParametersCalculationModules { + + private bool stabilityInsideField; + + private bool stabilityInsideFieldSpecified; + + private bool stabilityOutsideField; + + private bool stabilityOutsideFieldSpecified; + + private bool pipingWtiField; + + private bool pipingWtiFieldSpecified; + + private bool pipingBlighField; + + private bool pipingBlighFieldSpecified; + + /// + public bool StabilityInside { + get { + return this.stabilityInsideField; + } + set { + this.stabilityInsideField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool StabilityInsideSpecified { + get { + return this.stabilityInsideFieldSpecified; + } + set { + this.stabilityInsideFieldSpecified = value; + } + } + + /// + public bool StabilityOutside { + get { + return this.stabilityOutsideField; + } + set { + this.stabilityOutsideField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool StabilityOutsideSpecified { + get { + return this.stabilityOutsideFieldSpecified; + } + set { + this.stabilityOutsideFieldSpecified = value; + } + } + + /// + public bool PipingWti { + get { + return this.pipingWtiField; + } + set { + this.pipingWtiField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool PipingWtiSpecified { + get { + return this.pipingWtiFieldSpecified; + } + set { + this.pipingWtiFieldSpecified = value; + } + } + + /// + public bool PipingBligh { + get { + return this.pipingBlighField; + } + set { + this.pipingBlighField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool PipingBlighSpecified { + get { + return this.pipingBlighFieldSpecified; + } + set { + this.pipingBlighFieldSpecified = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)] + public partial class XmlCalculationParametersStabilityParameters { + + private StabilityCalculationModel calculationModelField; + + private bool calculationModelFieldSpecified; + + private StabilitySearchMethod searchMethodField; + + private bool searchMethodFieldSpecified; + + /// + public StabilityCalculationModel CalculationModel { + get { + return this.calculationModelField; + } + set { + this.calculationModelField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool CalculationModelSpecified { + get { + return this.calculationModelFieldSpecified; + } + set { + this.calculationModelFieldSpecified = value; + } + } + + /// + public StabilitySearchMethod SearchMethod { + get { + return this.searchMethodField; + } + set { + this.searchMethodField = value; + } + } + + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + public bool SearchMethodSpecified { + get { + return this.searchMethodFieldSpecified; + } + set { + this.searchMethodFieldSpecified = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + public enum StabilityCalculationModel { + + /// + Bishop, + + /// + UpliftVan, + + /// + BishopUpliftVan, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + public enum StabilitySearchMethod { + + /// + Grid, + + /// + BeeSwarm, + } +} Fisheye: Tag 5807 refers to a dead (removed) revision in file `DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/CalculationParametersAssemblerTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/SensorModelRunner.cs =================================================================== diff -u -r5706 -r5807 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/SensorModelRunner.cs (.../SensorModelRunner.cs) (revision 5706) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/SensorModelRunner.cs (.../SensorModelRunner.cs) (revision 5807) @@ -24,6 +24,7 @@ using System.Linq; using Deltares.Dam.Application.Live.Properties; using Deltares.Dam.Data; +using Deltares.DamLive.Data; namespace Deltares.Dam.Application.Live; @@ -61,7 +62,7 @@ CalculationParameters calcParams = CalculationParameters ?? new CalculationParameters(); calcParams.WorkingPath = WorkingPath; calcParams.StabilityWorkingPath = StabilityWorkingPath; - ReadUserSettingsSlipCircleDefinition(calcParams.MStabParameters.SlipCircleDefinition); + ReadUserSettingsSlipCircleDefinition(calcParams.StabilityParameters.SlipCircleDefinition); List locations = ProjectData.Locations; if (!string.IsNullOrWhiteSpace(Filter)) Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Data/Deltares.DamLive.Data.csproj =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Data/Deltares.DamLive.Data.csproj (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Data/Deltares.DamLive.Data.csproj (revision 5807) @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/FillDomainFromXmlCalculationParametersTests.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/FillDomainFromXmlCalculationParametersTests.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/FillDomainFromXmlCalculationParametersTests.cs (revision 5807) @@ -0,0 +1,88 @@ +// 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 Deltares.Dam.Application.Live; +using Deltares.Dam.Data; +using Deltares.DamLive.Io; +using Deltares.DamLive.Data; +using KellermanSoftware.CompareNetObjects; +using NUnit.Framework; + +namespace Deltares.DamLive.Tests; + +[TestFixture] +public class FillDomainFromXmlCalculationParametersTests +{ + [Test] + public void CanWriteAndReadCalculationParametersDataToXml() + { + const string filename = "CalculationParameters.xml"; + CalculationParameters expectedData = CreateExampleCalculationParameters(); + + // Write file + XmlCalculationParameters writeXml = FillXmlCalculationParametersFromDomain.CreateCalculationParameters(expectedData); + CalculationParametersXmlSerialization.SaveAsXmlFile(filename, writeXml); + + // Load file + XmlCalculationParameters readXml = CalculationParametersXmlSerialization.LoadFromXmlFile(filename); + CalculationParameters actualData = FillDomainFromXmlCalculationParameters.CreateCalculationParameters(readXml); + CompareCalculationParametersData(actualData, expectedData); + } + + private static CalculationParameters CreateExampleCalculationParameters() + { + var calculationModules = new CalculationModules + { + PipingBligh = false, + PipingWti = false, + StabilityOutside = false, + StabilityInside = true + }; + + var stabilityParameters = new MStabParameters + { + Model = MStabModelType.UpliftVan, + SearchMethod = MStabSearchMethod.BeeSwarm + }; + + var calculationParameters = new CalculationParameters + { + CalculationModules = calculationModules, + StabilityParameters = stabilityParameters + }; + + return calculationParameters; + } + + private static void CompareCalculationParametersData(CalculationParameters actual, CalculationParameters expected) + { + var compare = new CompareLogic + { + Config = + { + MaxDifferences = 100 + } + }; + + ComparisonResult result = compare.Compare(expected, actual); + Assert.That(result.Differences, Is.Empty, "Differences found read/write Input object:" + result.DifferencesString); + } +} \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideBishopGrid/live.ParametersFile.xml =================================================================== diff -u -r4857 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideBishopGrid/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 4857) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideBishopGrid/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 5807) @@ -1,14 +1,13 @@  - + 1 0 + 0 0 - 0 - + Bishop Grid - 2 - - \ No newline at end of file + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs =================================================================== diff -u -r5797 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs (.../StabilityInsideBishopGridTest.cs) (revision 5797) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideBishopGridTest.cs (.../StabilityInsideBishopGridTest.cs) (revision 5807) @@ -82,7 +82,7 @@ Assert.That(runner.DamProjectData, Is.Not.Null); Assert.That(runner.CalculationParameters, Is.Not.Null); Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); runner.StabilityWorkingPath = Path.GetTempPath(); runner.Run(); Fisheye: Tag 5807 refers to a dead (removed) revision in file `DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/CalculationParameters.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Set1/Deltares.Dam.Application.Live.Tests.ParametersFile.xml =================================================================== diff -u -r4055 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Set1/Deltares.Dam.Application.Live.Tests.ParametersFile.xml (.../Deltares.Dam.Application.Live.Tests.ParametersFile.xml) (revision 4055) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Set1/Deltares.Dam.Application.Live.Tests.ParametersFile.xml (.../Deltares.Dam.Application.Live.Tests.ParametersFile.xml) (revision 5807) @@ -1,35 +1,34 @@ - - - - - 1 - 1 - 1 - - - UpliftVan - Grid - 1 - - \ No newline at end of file + + + + + 1 + 1 + 1 + + + UpliftVan + Grid + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/ModelRunner.cs =================================================================== diff -u -r4127 -r5807 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/ModelRunner.cs (.../ModelRunner.cs) (revision 4127) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/ModelRunner.cs (.../ModelRunner.cs) (revision 5807) @@ -21,12 +21,13 @@ using System; using System.IO; -using System.Reflection; using System.Xml.Linq; using Deltares.Dam.Application.Live.Properties; using Deltares.Dam.Data; using Deltares.Dam.Data.Assemblers; using Deltares.Standard.Application; +using Deltares.DamLive.Io; +using Deltares.DamLive.Data; namespace Deltares.Dam.Application.Live; @@ -112,13 +113,14 @@ if (CalculationParameters == null && ParametersFile != null) { // Read calculation parameters, if available - CalculationParameters = CalculationParameters.LoadFromFile(ParametersFile); + XmlCalculationParameters xmlCalculationParameters = CalculationParametersXmlSerialization.LoadFromXmlFile(ParametersFile.FullName); + CalculationParameters = FillDomainFromXmlCalculationParameters.CreateCalculationParameters(xmlCalculationParameters); } } /// - /// Creates and set's up the working directories. By default the directory the output file - /// will be used if the working path is not set + /// Creates and set's up the working directories. By default, the directory the output file + /// will be used if the working path is not set. /// public virtual void CreateAndSetWorkingDirectories() { Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongMissingValuesTest.cs =================================================================== diff -u -r4630 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongMissingValuesTest.cs (.../DamLivePulauTekongMissingValuesTest.cs) (revision 4630) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLivePulauTekongMissingValuesTest.cs (.../DamLivePulauTekongMissingValuesTest.cs) (revision 5807) @@ -65,7 +65,7 @@ Assert.That(runner.DamProjectData, Is.Not.Null); Assert.That(runner.CalculationParameters, Is.Not.Null); Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); runner.Run(); Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanBeeSwarmTest.cs =================================================================== diff -u -r5797 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanBeeSwarmTest.cs (.../StabilityInsideUpliftVanBeeSwarmTest.cs) (revision 5797) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanBeeSwarmTest.cs (.../StabilityInsideUpliftVanBeeSwarmTest.cs) (revision 5807) @@ -86,7 +86,7 @@ Assert.That(runner.DamProjectData, Is.Not.Null); Assert.That(runner.CalculationParameters, Is.Not.Null); Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); runner.Run(); runner.OutputTimeSeriesCollection.Save("UpliftVanBeeSwarmOutputFile" + maxCores); Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Io/Deltares.DamLive.Io.csproj =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Io/Deltares.DamLive.Io.csproj (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Io/Deltares.DamLive.Io.csproj (revision 5807) @@ -0,0 +1,3 @@ + + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideUpliftVanGrid/live.ParametersFile.xml =================================================================== diff -u -r4857 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideUpliftVanGrid/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 4857) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideUpliftVanGrid/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 5807) @@ -1,14 +1,13 @@ - - + + 1 0 0 - 0 + 0 - + UpliftVan Grid - 2 - - \ No newline at end of file + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Data/CalculationParameters.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Data/CalculationParameters.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Data/CalculationParameters.cs (revision 5807) @@ -0,0 +1,42 @@ +// 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 Deltares.Dam.Data; + +namespace Deltares.DamLive.Data; + +public class CalculationModules +{ + public bool StabilityInside { get; set; } + public bool StabilityOutside { get; set; } + public bool PipingWti { get; set; } + public bool PipingBligh { get; set; } +} + +public class CalculationParameters +{ + public string WorkingPath { get; set; } + public string StabilityWorkingPath { get; set; } + public string PipingWorkingPath { get; set; } + + public CalculationModules CalculationModules { get; set; } + public MStabParameters StabilityParameters { get; set; } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs =================================================================== diff -u -r5794 -r5807 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs (.../MStabParameters.cs) (revision 5794) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs (.../MStabParameters.cs) (revision 5807) @@ -20,8 +20,6 @@ // All rights reserved. using System.Collections; -using System.ComponentModel; -using System.Xml.Serialization; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; @@ -43,54 +41,6 @@ Specified = 1 } -public class SheetPiling : IAssignable, ICloneable -{ - public double XCoordinate { get; set; } - public double YCoordinate { get; set; } - public double ZCoordinate { get; set; } - public double Length { get; set; } - - public void Assign(SheetPiling sheetPiling) - { - XCoordinate = sheetPiling.XCoordinate; - YCoordinate = sheetPiling.YCoordinate; - ZCoordinate = sheetPiling.ZCoordinate; - Length = sheetPiling.Length; - } - - public SheetPiling Clone() - { - var sheetPiling = new SheetPiling(); - sheetPiling.Assign(this); - return sheetPiling; - } -} - -public class HorizontalBalanceArea : IAssignable, ICloneable -{ - public double XLeft { get; set; } - public double XRight { get; set; } - public double YTop { get; set; } - public double YBottom { get; set; } - public int PlaneCount { get; set; } - - public void Assign(HorizontalBalanceArea horizontalBalanceArea) - { - XLeft = horizontalBalanceArea.XLeft; - XRight = horizontalBalanceArea.XRight; - YTop = horizontalBalanceArea.YTop; - YBottom = horizontalBalanceArea.YBottom; - PlaneCount = horizontalBalanceArea.PlaneCount; - } - - public HorizontalBalanceArea Clone() - { - var horizontalBalanceArea = new HorizontalBalanceArea(); - horizontalBalanceArea.Assign(this); - return horizontalBalanceArea; - } -} - public class SlipCircleDefinition : IVisibleEnabled, IAssignable, ICloneable { private const string upliftVanTangentLinesDistanceObject = "upliftVanTangentLinesDistance"; @@ -568,133 +518,23 @@ } } -public class MStabGeometryCreationOptions : IAssignable, ICloneable -{ - public MStabGeometryCreationOptions() - { - SoilProfileType = SoilProfileType.SoilProfile1D; - SoilGeometry2DFilename = ""; - XOffsetSoilGeometry2DOrigin = 0.0; - MaterialForDike = ""; - MaterialForShoulder = ""; - IsDrySituation = false; - PLLineAssignment = PLLineAssignment.ExpertKnowledge; - IntrusionVerticalWaterPressureType = IntrusionVerticalWaterPressureType.Standard; - PenetrationLength = 0.0; - IsDesign = false; - } - - [XmlOldName("SoilGeometryType")] public SoilProfileType SoilProfileType { get; set; } - - public string SoilGeometry2DFilename { get; set; } - public double XOffsetSoilGeometry2DOrigin { get; set; } - public string MaterialForDike { get; set; } - public string MaterialForShoulder { get; set; } - public bool IsDrySituation { get; set; } - public PLLineAssignment PLLineAssignment { get; set; } - public IntrusionVerticalWaterPressureType IntrusionVerticalWaterPressureType { get; set; } - public double PenetrationLength { get; set; } - public bool IsDesign { get; set; } - - public void Assign(MStabGeometryCreationOptions mstabGeometryCreationOptions) - { - SoilProfileType = mstabGeometryCreationOptions.SoilProfileType; - SoilGeometry2DFilename = mstabGeometryCreationOptions.SoilGeometry2DFilename; - XOffsetSoilGeometry2DOrigin = mstabGeometryCreationOptions.XOffsetSoilGeometry2DOrigin; - MaterialForDike = mstabGeometryCreationOptions.MaterialForDike; - MaterialForShoulder = mstabGeometryCreationOptions.MaterialForShoulder; - IsDrySituation = mstabGeometryCreationOptions.IsDrySituation; - PLLineAssignment = mstabGeometryCreationOptions.PLLineAssignment; - IntrusionVerticalWaterPressureType = mstabGeometryCreationOptions.IntrusionVerticalWaterPressureType; - PenetrationLength = mstabGeometryCreationOptions.PenetrationLength; - IsDesign = mstabGeometryCreationOptions.IsDesign; - } - - public MStabGeometryCreationOptions Clone() - { - var mstabGeometryCreationOptions = new MStabGeometryCreationOptions(); - mstabGeometryCreationOptions.Assign(this); - return mstabGeometryCreationOptions; - } -} - -public class MStabCalculationOptions : IAssignable, ICloneable -{ - public double MinimalCircleDepth { get; set; } - - [Label("MStab Zone Types")] - [ReadOnly(true)] - public MStabZonesType ZonesType { get; set; } - - public void Assign(MStabCalculationOptions mstabCalculationOptions) - { - MinimalCircleDepth = mstabCalculationOptions.MinimalCircleDepth; - ZonesType = mstabCalculationOptions.ZonesType; - } - - public MStabCalculationOptions Clone() - { - var mstabCalculationOptions = new MStabCalculationOptions(); - mstabCalculationOptions.Assign(this); - return mstabCalculationOptions; - } -} - public class MStabParameters : ICloneable, IVisibleEnabled, IDomain { private MStabGridPosition gridPosition; public MStabParameters() { - IsCalculateAllStabilityProjectsAtOnce = true; - IsOverrulePLLineCreationMethod = false; - PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD; Model = MStabModelType.UpliftVan; SearchMethod = MStabSearchMethod.BeeSwarm; gridPosition = MStabGridPosition.Right; - CalculationOptions = new MStabCalculationOptions(); - GeometryCreationOptions = new MStabGeometryCreationOptions(); - SheetPiling = null; - HorizontalBalanceArea = new HorizontalBalanceArea(); SlipCircleDefinition = new SlipCircleDefinition(); } - - public bool IsCombinedBishopUpliftVanCalculation - { - get - { - return (Model == MStabModelType.BishopUpliftVan); - } - } - // IsCombinedBishopUpliftVanCalculation (formerly IsAutoSelectCalculation) is the same as Model == MStabModel.BishopUpliftVan - // This property was first implemented for FewsDam and later MStabModel.BishopUpliftVan was implemented for normal DAM operation - // Now we will use Model == MStabModel.BishopUpliftVan for both FewsDam and DAM - // This readonly property is implemented for backward compatibiity - - public bool IsCalculateAllStabilityProjectsAtOnce { get; set; } - - // Normally PLLine creation is specified per location. - // If IsOverrulePLLineCreationMethod is set to true the settings in the locations will be - // overruled with the value in PLLineCreationMethod - public bool IsOverrulePLLineCreationMethod { get; set; } - public PLLineCreationMethod PLLineCreationMethod { get; set; } - + [Label("Model")] public MStabModelType Model { get; set; } public MStabSearchMethod SearchMethod { get; set; } - - public bool IsProbabilistic { get; set; } public string ProjectFileName { get; set; } - public string SoilDatabaseName { get; set; } - public MStabForbiddenZone ForbiddenZone { get; set; } - public MStabGeometryCreationOptions GeometryCreationOptions { get; set; } - public SheetPiling SheetPiling { get; set; } - public HorizontalBalanceArea HorizontalBalanceArea { get; set; } - [Validate] public SlipCircleDefinition SlipCircleDefinition { get; set; } - - public MStabCalculationOptions CalculationOptions { get; set; } - public MStabGridPosition GridPosition { get @@ -709,75 +549,13 @@ } } - [Label("MStab Zone Types")] - [ReadOnly(true)] - [XmlIgnore] - public MStabZonesType ZonesType - { - get - { - return CalculationOptions.ZonesType; - } - set - { - CalculationOptions.ZonesType = value; - } - } - public void Assign(MStabParameters mstabParameters) { Model = mstabParameters.Model; SearchMethod = mstabParameters.SearchMethod; - IsProbabilistic = mstabParameters.IsProbabilistic; GridPosition = mstabParameters.GridPosition; ProjectFileName = mstabParameters.ProjectFileName; - SoilDatabaseName = mstabParameters.SoilDatabaseName; - if (ForbiddenZone != null) - { - ForbiddenZone.Assign(mstabParameters.ForbiddenZone); - } - else - { - ForbiddenZone = null; - } - if (CalculationOptions != null) - { - CalculationOptions.Assign(mstabParameters.CalculationOptions); - } - else - { - CalculationOptions = null; - } - - if (GeometryCreationOptions != null) - { - GeometryCreationOptions.Assign(mstabParameters.GeometryCreationOptions); - } - else - { - GeometryCreationOptions = null; - } - - if (SheetPiling != null) - { - SheetPiling.Assign(mstabParameters.SheetPiling); - } - else - { - SheetPiling = null; - } - - if (HorizontalBalanceArea != null) - { - HorizontalBalanceArea.Assign(mstabParameters.HorizontalBalanceArea); - } - else - { - HorizontalBalanceArea = null; - } - - SoilDatabaseName = mstabParameters.SoilDatabaseName; if (SlipCircleDefinition != null) { SlipCircleDefinition.Assign(mstabParameters.SlipCircleDefinition); @@ -791,36 +569,12 @@ public MStabParameters Clone() { var mstabParameters = new MStabParameters(); - if (ForbiddenZone != null) - { - mstabParameters.ForbiddenZone = ForbiddenZone.Clone(); - } - if (GeometryCreationOptions != null) - { - mstabParameters.GeometryCreationOptions = GeometryCreationOptions.Clone(); - } - - if (SheetPiling != null) - { - mstabParameters.SheetPiling = SheetPiling.Clone(); - } - - if (HorizontalBalanceArea != null) - { - mstabParameters.HorizontalBalanceArea = HorizontalBalanceArea.Clone(); - } - if (SlipCircleDefinition != null) { mstabParameters.SlipCircleDefinition = SlipCircleDefinition.Clone(); } - if (CalculationOptions != null) - { - mstabParameters.CalculationOptions = CalculationOptions.Clone(); - } - mstabParameters.Assign(this); return mstabParameters; Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/FillDomainFromXmlCalculationParameters.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/FillDomainFromXmlCalculationParameters.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/FillDomainFromXmlCalculationParameters.cs (revision 5807) @@ -0,0 +1,85 @@ +// 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 Deltares.Dam.Data; +using Deltares.DamLive.Io; +using Deltares.DamLive.Data; + +namespace Deltares.Dam.Application.Live; + +public static class FillDomainFromXmlCalculationParameters +{ + public static CalculationParameters CreateCalculationParameters(XmlCalculationParameters xmlCalculationParameters) + { + var calculationParameters = new CalculationParameters(); + TransferCalculationModules(xmlCalculationParameters.CalculationModules, calculationParameters); + TransferStabilityParameters(xmlCalculationParameters.StabilityParameters, calculationParameters); + return calculationParameters; + } + + private static void TransferCalculationModules(XmlCalculationParametersCalculationModules calculationModulesXml, CalculationParameters calculationParameters) + { + var calculationModules = new CalculationModules(); + if (calculationModulesXml != null) + { + if (calculationModulesXml.PipingWtiSpecified) + { + calculationModules.PipingWti = calculationModulesXml.PipingWti; + } + + if (calculationModulesXml.PipingBlighSpecified) + { + calculationModules.PipingBligh = calculationModulesXml.PipingBligh; + } + + if (calculationModulesXml.StabilityInsideSpecified) + { + calculationModules.StabilityInside = calculationModulesXml.StabilityInside; + } + + if (calculationModulesXml.StabilityOutsideSpecified) + { + calculationModules.StabilityOutside = calculationModulesXml.StabilityOutside; + } + } + + calculationParameters.CalculationModules = calculationModules; + } + + private static void TransferStabilityParameters(XmlCalculationParametersStabilityParameters stabilityParametersXml, CalculationParameters calculationParameters) + { + var stabParameters = new MStabParameters(); + if (stabilityParametersXml != null) + { + if (stabilityParametersXml.CalculationModelSpecified) + { + stabParameters.Model = XmlConversionHelper.ConvertToModelType(stabilityParametersXml.CalculationModel); + } + + if (stabilityParametersXml.SearchMethodSpecified) + { + stabParameters.SearchMethod = XmlConversionHelper.ConvertToSearchMethod(stabilityParametersXml.SearchMethod); + } + } + + calculationParameters.StabilityParameters = stabParameters; + } +} \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveGrebbedijkTest.cs =================================================================== diff -u -r4630 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveGrebbedijkTest.cs (.../DamLiveGrebbedijkTest.cs) (revision 4630) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveGrebbedijkTest.cs (.../DamLiveGrebbedijkTest.cs) (revision 5807) @@ -61,7 +61,7 @@ Assert.That(runner.DamProjectData, Is.Not.Null); Assert.That(runner.CalculationParameters, Is.Not.Null); Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); runner.Run(); //runner.WriteResultsToFile(outputFile); Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs =================================================================== diff -u -r5754 -r5807 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 5754) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 5807) @@ -21,7 +21,6 @@ using System; using System.IO; -using System.Reflection; using System.Xml.Linq; using Deltares.Dam.Application.Live.Properties; using Deltares.Dam.Data; @@ -31,9 +30,11 @@ using Deltares.DamEngine.Io; using Deltares.DamEngine.Io.XmlInput; using Deltares.DamEngine.Io.XmlOutput; +using Deltares.DamLive.Io; using Deltares.Standard.Application; using Deltares.Standard.Logging; using Location = Deltares.Dam.Data.Location; +using Deltares.DamLive.Data; namespace Deltares.Dam.Application.Live; @@ -294,7 +295,8 @@ if (CalculationParameters == null && ParametersFile != null) { // Read calculation parameters, if available - CalculationParameters = CalculationParameters.LoadFromFile(ParametersFile); + XmlCalculationParameters xmlCalculationParameters = CalculationParametersXmlSerialization.LoadFromXmlFile(ParametersFile.FullName); + CalculationParameters = FillDomainFromXmlCalculationParameters.CreateCalculationParameters(xmlCalculationParameters); } } @@ -315,11 +317,6 @@ Logger.LogError("Calculation module PipingBligh not implemented yet"); } - if (CalculationParameters.CalculationModules.PipingSellmeijer) - { - Logger.LogError("Calculation module PipingSellmeijer not implemented yet"); - } - if (CalculationParameters.CalculationModules.PipingWti) { RunPiping(FailureMechanismSystemType.Piping); @@ -328,14 +325,10 @@ private void RunStability(FailureMechanismSystemType failureMechanismSystemType) { - ReadUserSettingsSlipCircleDefinition(CalculationParameters.MStabParameters.SlipCircleDefinition); + ReadUserSettingsSlipCircleDefinition(CalculationParameters.StabilityParameters.SlipCircleDefinition); DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismSystemType = failureMechanismSystemType; DamProjectData.DamProjectCalculationSpecification.CurrentSpecification.FailureMechanismeParamatersMStab.MStabParameters = - CalculationParameters.MStabParameters; - foreach (Location location in DamProjectData.Locations) - { - location.StabilityZoneType = CalculationParameters.MStabParameters.ZonesType; - } + CalculationParameters.StabilityParameters; CallDamEngine(); if (DamProjectData.OutputTimeSerieCollection != null && DamProjectData.OutputTimeSerieCollection.Series.Count > 0) Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs =================================================================== diff -u -r5797 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs (.../StabilityInsideUpliftVanGridTest.cs) (revision 5797) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/StabilityInsideUpliftVanGridTest.cs (.../StabilityInsideUpliftVanGridTest.cs) (revision 5807) @@ -79,7 +79,7 @@ Assert.That(runner.DamProjectData, Is.Not.Null); Assert.That(runner.CalculationParameters, Is.Not.Null); Assert.That(runner.CalculationParameters.CalculationModules, Is.Not.Null); - Assert.That(runner.CalculationParameters.MStabParameters, Is.Not.Null); + Assert.That(runner.CalculationParameters.StabilityParameters, Is.Not.Null); runner.Run(); runner.OutputTimeSeriesCollection.Save("UpliftVanOutputFile" + maxCores); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj =================================================================== diff -u -r4826 -r5807 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 4826) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Deltares.Dam.Data.csproj (.../Deltares.Dam.Data.csproj) (revision 5807) @@ -85,8 +85,8 @@ - - + + Index: DamClients/DamLive/trunk/src/DamLive.sln =================================================================== diff -u -r4811 -r5807 --- DamClients/DamLive/trunk/src/DamLive.sln (.../DamLive.sln) (revision 4811) +++ DamClients/DamLive/trunk/src/DamLive.sln (.../DamLive.sln) (revision 5807) @@ -44,6 +44,10 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{E586156A-9813-4C79-A11F-CE73BF7BBE21}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.DamLive.Io", "Deltares.DamLive.Io\Deltares.DamLive.Io.csproj", "{8E500EE6-3388-4137-8043-AB5E86418E95}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.DamLive.Data", "Deltares.DamLive.Data\Deltares.DamLive.Data.csproj", "{6322217F-210A-4F1F-8022-E7F65F1F94AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 @@ -74,6 +78,14 @@ {1252608D-4B29-406C-851B-9F56689FF720}.Debug|x86.Build.0 = Debug|x86 {1252608D-4B29-406C-851B-9F56689FF720}.Release|x86.ActiveCfg = Release|x86 {1252608D-4B29-406C-851B-9F56689FF720}.Release|x86.Build.0 = Release|x86 + {8E500EE6-3388-4137-8043-AB5E86418E95}.Debug|x86.ActiveCfg = Debug|Any CPU + {8E500EE6-3388-4137-8043-AB5E86418E95}.Debug|x86.Build.0 = Debug|Any CPU + {8E500EE6-3388-4137-8043-AB5E86418E95}.Release|x86.ActiveCfg = Release|Any CPU + {8E500EE6-3388-4137-8043-AB5E86418E95}.Release|x86.Build.0 = Release|Any CPU + {6322217F-210A-4F1F-8022-E7F65F1F94AC}.Debug|x86.ActiveCfg = Debug|Any CPU + {6322217F-210A-4F1F-8022-E7F65F1F94AC}.Debug|x86.Build.0 = Debug|Any CPU + {6322217F-210A-4F1F-8022-E7F65F1F94AC}.Release|x86.ActiveCfg = Release|Any CPU + {6322217F-210A-4F1F-8022-E7F65F1F94AC}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -87,5 +99,7 @@ {E91EA5AE-2C11-4C02-B5B0-D83ACA3FB3E3} = {6A55AC8E-14F0-4F4E-94C6-602BE8B3B2C9} {6C4EC8AD-4B8E-4D99-8F27-63C3B232ECC4} = {6A55AC8E-14F0-4F4E-94C6-602BE8B3B2C9} {F6A85256-50BA-4E97-8E3C-D8D488DFAF44} = {E586156A-9813-4C79-A11F-CE73BF7BBE21} + {8E500EE6-3388-4137-8043-AB5E86418E95} = {95699CCD-37A6-4F2E-9462-F2F474AD8AE8} + {6322217F-210A-4F1F-8022-E7F65F1F94AC} = {95699CCD-37A6-4F2E-9462-F2F474AD8AE8} EndGlobalSection EndGlobal Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/IModelRunner.cs =================================================================== diff -u -r4127 -r5807 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/IModelRunner.cs (.../IModelRunner.cs) (revision 4127) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/IModelRunner.cs (.../IModelRunner.cs) (revision 5807) @@ -20,6 +20,7 @@ // All rights reserved. using Deltares.Dam.Data; +using Deltares.DamLive.Data; namespace Deltares.Dam.Application.Live; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/GenerateClasses.bat =================================================================== diff -u --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/GenerateClasses.bat (revision 0) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Xsd/GenerateClasses.bat (revision 5807) @@ -0,0 +1,3 @@ +REM Start the Developer Command Prompt (for VS2015) and go to this directory. Then start this batchfile. +xsd /c /l:cs /n:Deltares.DamLive.Io XmlCalculationParameters.xsd +copy XmlCalculationParameters.cs ..\src\Deltares.DamLive.Io\XmlCalculationParameters.cs Fisheye: Tag 5807 refers to a dead (removed) revision in file `DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/CalculationParametersAssembler.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Io/CalculationParametersXmlSerialization.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Io/CalculationParametersXmlSerialization.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Io/CalculationParametersXmlSerialization.cs (revision 5807) @@ -0,0 +1,45 @@ +// 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.IO; +using System.Xml.Serialization; + +namespace Deltares.DamLive.Io; + +public static class CalculationParametersXmlSerialization +{ + public static XmlCalculationParameters LoadFromXmlFile(string filename) + { + string calculationParametersXml = File.ReadAllText(filename); + var xmlSerializer = new XmlSerializer(typeof(XmlCalculationParameters)); + var reader = new StringReader(calculationParametersXml); + var calculationParameters = (XmlCalculationParameters) xmlSerializer.Deserialize(reader); + return calculationParameters; + } + + public static void SaveAsXmlFile(string filename, XmlCalculationParameters calculationParameters) + { + var xmlSerializer = new XmlSerializer(typeof(XmlCalculationParameters)); + TextWriter writer = new StreamWriter(filename); + xmlSerializer.Serialize(writer, calculationParameters); + writer.Close(); + } +} \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/FillXmlCalculationParametersFromDomain.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/FillXmlCalculationParametersFromDomain.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/FillXmlCalculationParametersFromDomain.cs (revision 5807) @@ -0,0 +1,73 @@ +// 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 Deltares.Dam.Data; +using Deltares.DamLive.Io; +using Deltares.DamLive.Data; + +namespace Deltares.Dam.Application.Live; + +public static class FillXmlCalculationParametersFromDomain +{ + public static XmlCalculationParameters CreateCalculationParameters(CalculationParameters calculationParameters) + { + var calculationParametersXml = new XmlCalculationParameters(); + TransferCalculationModules(calculationParameters.CalculationModules, calculationParametersXml); + TransferStabilityParameters(calculationParameters.StabilityParameters, calculationParametersXml); + + return calculationParametersXml; + } + + private static void TransferCalculationModules(CalculationModules calculationModules, XmlCalculationParameters calculationParametersXml) + { + var xmlCalculationParametersCalculationModules = new XmlCalculationParametersCalculationModules(); + + if (calculationModules != null) + { + xmlCalculationParametersCalculationModules.PipingWtiSpecified = true; + xmlCalculationParametersCalculationModules.PipingBlighSpecified = true; + xmlCalculationParametersCalculationModules.StabilityInsideSpecified = true; + xmlCalculationParametersCalculationModules.StabilityOutsideSpecified = true; + + xmlCalculationParametersCalculationModules.PipingWti = calculationModules.PipingWti; + xmlCalculationParametersCalculationModules.PipingBligh = calculationModules.PipingBligh; + xmlCalculationParametersCalculationModules.StabilityInside = calculationModules.StabilityInside; + xmlCalculationParametersCalculationModules.StabilityOutside = calculationModules.StabilityOutside; + } + + calculationParametersXml.CalculationModules = xmlCalculationParametersCalculationModules; + } + + private static void TransferStabilityParameters(MStabParameters stabilityParameters, XmlCalculationParameters calculationParametersXml) + { + var xmlCalculationParametersStabilityParameters = new XmlCalculationParametersStabilityParameters(); + if (stabilityParameters != null) + { + xmlCalculationParametersStabilityParameters.CalculationModelSpecified = true; + xmlCalculationParametersStabilityParameters.SearchMethodSpecified = true; + + xmlCalculationParametersStabilityParameters.CalculationModel = XmlConversionHelper.ConvertToModelType(stabilityParameters.Model); + xmlCalculationParametersStabilityParameters.SearchMethod = XmlConversionHelper.ConvertToSearchMethod(stabilityParameters.SearchMethod); + } + + calculationParametersXml.StabilityParameters = xmlCalculationParametersStabilityParameters; + } +} \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveIntegrationTest.cs =================================================================== diff -u -r5795 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveIntegrationTest.cs (.../DamLiveIntegrationTest.cs) (revision 5795) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/DamLiveIntegrationTest.cs (.../DamLiveIntegrationTest.cs) (revision 5807) @@ -26,6 +26,7 @@ using Deltares.Dam.Application.Live; using Deltares.Dam.Data; using Deltares.Dam.Data.Sensors; +using Deltares.DamLive.Data; using Deltares.DamLive.TestHelper; using Deltares.Standard.IO; using NUnit.Framework; @@ -49,7 +50,9 @@ /// /// See setup method /// + [Test] [Category("Integration")] + [Category("Work_In_Progress")] public void Run_UsingTestFiles_HasExpectedResultsInOutputFile() { runner.Run(); @@ -142,7 +145,6 @@ inputFile = Path.Combine(actualTestPath, "live.FEWS.InputFile.1Step.xml"); outputFile = Path.Combine(actualTestPath, "live.FEWS.OutputFile.xml"); projectFile = Path.Combine(actualTestPath, "output.damx"); - string soilDatabasFile = Path.Combine(actualTestPath, "output0.soilmaterials.mdb"); DamProject.SetTestProgramVersion("19.1"); damProjectData = DamProject.LoadData(projectFile); @@ -468,19 +470,16 @@ WaterLevelOffset = 0, CalculationParameters = new CalculationParameters { - MStabParameters = new MStabParameters + StabilityParameters = new MStabParameters { Model = MStabModelType.Bishop, - IsProbabilistic = false, - SoilDatabaseName = Path.Combine(@".\", soilDatabasFile), SearchMethod = MStabSearchMethod.Grid, - GridPosition = MStabGridPosition.Right, - CalculationOptions = new MStabCalculationOptions() + GridPosition = MStabGridPosition.Right }, CalculationModules = new CalculationModules { PipingBligh = false, - PipingSellmeijer = false, + PipingWti = false, StabilityInside = true } }, Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Set3/live.ParametersFile.xml =================================================================== diff -u -r4055 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Set3/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 4055) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/DamLive/Set3/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 5807) @@ -1,35 +1,34 @@ - - - - - 1 - 0 - 0 - - - Bishop - Grid - 1 - - \ No newline at end of file + + + + + 1 + 0 + 0 + + + Bishop + Grid + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/XmlConversionHelperTests.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/XmlConversionHelperTests.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/XmlConversionHelperTests.cs (revision 5807) @@ -0,0 +1,65 @@ +// 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 Deltares.Dam.Application.Live; +using Deltares.Dam.Data; +using Deltares.DamLive.Io; +using NUnit.Framework; + +namespace Deltares.DamLive.Tests; + +[TestFixture] +public class XmlConversionHelperTests +{ + [Test] + [TestCase(StabilitySearchMethod.Grid, MStabSearchMethod.Grid)] + [TestCase(StabilitySearchMethod.BeeSwarm, MStabSearchMethod.BeeSwarm)] + public void CanConvertToDataSearchMethodType(StabilitySearchMethod xmlType, MStabSearchMethod dataType) + { + Assert.That(XmlConversionHelper.ConvertToSearchMethod(xmlType), Is.EqualTo(dataType)); + } + + [Test] + [TestCase(MStabSearchMethod.Grid, StabilitySearchMethod.Grid)] + [TestCase(MStabSearchMethod.BeeSwarm, StabilitySearchMethod.BeeSwarm)] + public void CanConvertToXmlSearchMethodType(MStabSearchMethod dataType, StabilitySearchMethod xmlType) + { + Assert.That(XmlConversionHelper.ConvertToSearchMethod(dataType), Is.EqualTo(xmlType)); + } + + [Test] + [TestCase(StabilityCalculationModel.Bishop, MStabModelType.Bishop)] + [TestCase(StabilityCalculationModel.UpliftVan, MStabModelType.UpliftVan)] + [TestCase(StabilityCalculationModel.BishopUpliftVan, MStabModelType.BishopUpliftVan)] + public void CanConvertToDataModelType(StabilityCalculationModel xmlType, MStabModelType dataType) + { + Assert.That(XmlConversionHelper.ConvertToModelType(xmlType), Is.EqualTo(dataType)); + } + + [Test] + [TestCase( MStabModelType.Bishop, StabilityCalculationModel.Bishop)] + [TestCase( MStabModelType.UpliftVan, StabilityCalculationModel.UpliftVan)] + [TestCase( MStabModelType.BishopUpliftVan, StabilityCalculationModel.BishopUpliftVan)] + public void CanConvertToXmlModelType(MStabModelType dataType, StabilityCalculationModel xmlType) + { + Assert.That(XmlConversionHelper.ConvertToModelType(dataType), Is.EqualTo(xmlType)); + } +} \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideUpliftVanBeeSwarm/live.ParametersFile.xml =================================================================== diff -u -r4857 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideUpliftVanBeeSwarm/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 4857) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/TestData/IntegrationTests/StabilityInsideUpliftVanBeeSwarm/live.ParametersFile.xml (.../live.ParametersFile.xml) (revision 5807) @@ -1,14 +1,13 @@ - - + + 1 0 0 - 0 + 0 - + UpliftVan BeeSwarm - 2 - - \ No newline at end of file + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/Deltares.DamLive.Tests.csproj =================================================================== diff -u -r4812 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/Deltares.DamLive.Tests.csproj (.../Deltares.DamLive.Tests.csproj) (revision 4812) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/Deltares.DamLive.Tests.csproj (.../Deltares.DamLive.Tests.csproj) (revision 5807) @@ -52,10 +52,7 @@ PreserveNewest - - - PreserveNewest - + PreserveNewest @@ -126,4 +123,9 @@ PreserveNewest + + + 3.9.0 + + \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/ModelRunnerTest.cs =================================================================== diff -u -r4630 -r5807 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/ModelRunnerTest.cs (.../ModelRunnerTest.cs) (revision 4630) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/ModelRunnerTest.cs (.../ModelRunnerTest.cs) (revision 5807) @@ -23,6 +23,8 @@ using System.IO; using Deltares.Dam.Application.Live; using Deltares.Dam.Data; +using Deltares.DamLive.Io; +using Deltares.DamLive.Data; using NUnit.Framework; namespace Deltares.DamLive.Tests; @@ -130,7 +132,8 @@ DamProject.SetTestProgramVersion("19.1"); damProjectData = DamProject.LoadData(projectFile); - runner.CalculationParameters = CalculationParameters.LoadFromFile(paramFile); + XmlCalculationParameters xmlCalculationParameters = CalculationParametersXmlSerialization.LoadFromXmlFile(paramFile); + runner.CalculationParameters = FillDomainFromXmlCalculationParameters.CreateCalculationParameters(xmlCalculationParameters); runner.ProjectData = damProjectData; runner.InputTimeSeriesCollection = TimeSerieCollection.LoadFromFile(inputFile); runner.OutputTimeSeriesCollection = new TimeSerieCollection(); @@ -196,7 +199,7 @@ CalculationParameters = new CalculationParameters { CalculationModules = new CalculationModules(), - MStabParameters = new MStabParameters() + StabilityParameters = new MStabParameters() }, ProjectData = damProjectData, InputTimeSeriesCollection = new TimeSerieCollection(), Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/XmlConversionHelper.cs =================================================================== diff -u --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/XmlConversionHelper.cs (revision 0) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/XmlConversionHelper.cs (revision 5807) @@ -0,0 +1,91 @@ +// 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 Deltares.Dam.Data; +using Deltares.DamLive.Io; + +namespace Deltares.Dam.Application.Live; + +public static class XmlConversionHelper +{ + public static MStabModelType ConvertToModelType(StabilityCalculationModel model) + { + var translationTable = new Dictionary + { + { + StabilityCalculationModel.Bishop, MStabModelType.Bishop + }, + { + StabilityCalculationModel.UpliftVan, MStabModelType.UpliftVan + }, + { + StabilityCalculationModel.BishopUpliftVan, MStabModelType.BishopUpliftVan + } + }; + return translationTable[model]; + } + + public static StabilityCalculationModel ConvertToModelType(MStabModelType model) + { + var translationTable = new Dictionary + { + { + MStabModelType.Bishop, StabilityCalculationModel.Bishop + }, + { + MStabModelType.UpliftVan, StabilityCalculationModel.UpliftVan + }, + { + MStabModelType.BishopUpliftVan, StabilityCalculationModel.BishopUpliftVan + } + }; + return translationTable[model]; + } + + public static MStabSearchMethod ConvertToSearchMethod(StabilitySearchMethod model) + { + var translationTable = new Dictionary + { + { + StabilitySearchMethod.Grid, MStabSearchMethod.Grid + }, + { + StabilitySearchMethod.BeeSwarm, MStabSearchMethod.BeeSwarm + } + }; + return translationTable[model]; + } + + public static StabilitySearchMethod ConvertToSearchMethod(MStabSearchMethod model) + { + var translationTable = new Dictionary + { + { + MStabSearchMethod.Grid, StabilitySearchMethod.Grid + }, + { + MStabSearchMethod.BeeSwarm, StabilitySearchMethod.BeeSwarm + } + }; + return translationTable[model]; + } +} \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/FailureMechanismeParamatersMStab.cs =================================================================== diff -u -r4539 -r5807 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/FailureMechanismeParamatersMStab.cs (.../FailureMechanismeParamatersMStab.cs) (revision 4539) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/FailureMechanismeParamatersMStab.cs (.../FailureMechanismeParamatersMStab.cs) (revision 5807) @@ -57,23 +57,6 @@ [Validate] public MStabParameters MStabParameters { get; set; } /// - /// Checks whether all rerquired data is there. - /// - public bool IsComplete - { - get - { - return - !string.IsNullOrEmpty(MStabParameters.SoilDatabaseName) && - PLLines != null && - (SoilProfile != null || MStabParameters.GeometryCreationOptions.SoilGeometry2DFilename != "") && - Location != null && - SurfaceLine != null && - !string.IsNullOrEmpty(MStabParameters.ProjectFileName); - } - } - - /// /// Performs the Assignment /// ///