Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (revision 511) @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1} + Library + Properties + Deltares.DamEngine.Calculators.Tests + Deltares.DamEngine.Calculators.Tests + v4.5 + 512 + + + true + ..\bin\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + ..\bin\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + ..\..\lib\NUnit\nunit.framework.dll + + + + + + + + + + {e943b1d5-fafa-4afe-9071-f8b22cf612ea} + Deltares.DamEngine.Calculators + + + {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E} + Deltares.DamEngine.Data + + + + + \ No newline at end of file Index: dam engine/trunk/src/DamEngine.sln =================================================================== diff -u -r401 -r511 --- dam engine/trunk/src/DamEngine.sln (.../DamEngine.sln) (revision 401) +++ dam engine/trunk/src/DamEngine.sln (.../DamEngine.sln) (revision 511) @@ -17,42 +17,74 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.DamEngine.Io", "Deltares.DamEngine.Io\Deltares.DamEngine.Io.csproj", "{1560A423-F338-4DEC-8583-1DFF7077F104}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deltares.DamEngine.Calculators.Tests", "Deltares.DamEngine.Calculators.Tests\Deltares.DamEngine.Calculators.Tests.csproj", "{783E7BC6-CD3F-4851-B5EF-46DE954AACD1}" + ProjectSection(ProjectDependencies) = postProject + {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA} = {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {750464A3-CBFA-429F-920E-B430867F1120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {750464A3-CBFA-429F-920E-B430867F1120}.Debug|Any CPU.Build.0 = Debug|Any CPU {750464A3-CBFA-429F-920E-B430867F1120}.Debug|x86.ActiveCfg = Debug|x86 {750464A3-CBFA-429F-920E-B430867F1120}.Debug|x86.Build.0 = Debug|x86 + {750464A3-CBFA-429F-920E-B430867F1120}.Release|Any CPU.ActiveCfg = Release|Any CPU + {750464A3-CBFA-429F-920E-B430867F1120}.Release|Any CPU.Build.0 = Release|Any CPU {750464A3-CBFA-429F-920E-B430867F1120}.Release|x86.ActiveCfg = Release|x86 {750464A3-CBFA-429F-920E-B430867F1120}.Release|x86.Build.0 = Release|x86 + {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Debug|Any CPU.Build.0 = Debug|Any CPU {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Debug|x86.ActiveCfg = Debug|x86 {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Debug|x86.Build.0 = Debug|x86 + {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Release|Any CPU.ActiveCfg = Release|Any CPU + {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Release|Any CPU.Build.0 = Release|Any CPU {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Release|x86.ActiveCfg = Release|x86 {968516F9-1B92-4ADB-AE4A-CFF54EE43126}.Release|x86.Build.0 = Release|x86 + {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA}.Debug|Any CPU.ActiveCfg = Debug|x86 {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA}.Debug|x86.ActiveCfg = Debug|x86 {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA}.Debug|x86.Build.0 = Debug|x86 + {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA}.Release|Any CPU.ActiveCfg = Release|x86 {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA}.Release|x86.ActiveCfg = Release|x86 {E943B1D5-FAFA-4AFE-9071-F8B22CF612EA}.Release|x86.Build.0 = Release|x86 + {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Debug|Any CPU.Build.0 = Debug|Any CPU {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Debug|x86.ActiveCfg = Debug|x86 {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Debug|x86.Build.0 = Debug|x86 + {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Release|Any CPU.Build.0 = Release|Any CPU {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Release|x86.ActiveCfg = Release|x86 {B7A49C1A-1C91-4D72-ABA9-9FBAC2509D8E}.Release|x86.Build.0 = Release|x86 + {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57}.Debug|Any CPU.ActiveCfg = Debug|x86 {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57}.Debug|x86.ActiveCfg = Debug|x86 {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57}.Debug|x86.Build.0 = Debug|x86 + {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57}.Release|Any CPU.ActiveCfg = Release|x86 {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57}.Release|x86.ActiveCfg = Release|x86 {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57}.Release|x86.Build.0 = Release|x86 + {1560A423-F338-4DEC-8583-1DFF7077F104}.Debug|Any CPU.ActiveCfg = Debug|x86 {1560A423-F338-4DEC-8583-1DFF7077F104}.Debug|x86.ActiveCfg = Debug|x86 {1560A423-F338-4DEC-8583-1DFF7077F104}.Debug|x86.Build.0 = Debug|x86 + {1560A423-F338-4DEC-8583-1DFF7077F104}.Release|Any CPU.ActiveCfg = Release|x86 {1560A423-F338-4DEC-8583-1DFF7077F104}.Release|x86.ActiveCfg = Release|x86 {1560A423-F338-4DEC-8583-1DFF7077F104}.Release|x86.Build.0 = Release|x86 + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1}.Debug|Any CPU.ActiveCfg = Debug|x86 + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1}.Debug|x86.ActiveCfg = Debug|x86 + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1}.Debug|x86.Build.0 = Debug|x86 + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1}.Release|Any CPU.ActiveCfg = Release|x86 + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1}.Release|x86.ActiveCfg = Release|x86 + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {968516F9-1B92-4ADB-AE4A-CFF54EE43126} = {3888E604-1A01-474C-885B-B9BBC19054D4} {9CB1ECCE-2F86-418D-BBDC-166BD1FB7F57} = {3888E604-1A01-474C-885B-B9BBC19054D4} + {783E7BC6-CD3F-4851-B5EF-46DE954AACD1} = {3888E604-1A01-474C-885B-B9BBC19054D4} EndGlobalSection EndGlobal Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesInput.cs =================================================================== diff -u -r510 -r511 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesInput.cs (.../DamPipingSellmeijer4ForcesInput.cs) (revision 510) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesInput.cs (.../DamPipingSellmeijer4ForcesInput.cs) (revision 511) @@ -1,13 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; namespace Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces { - class DamPipingSellmeijer4ForcesInput : IKernelDataInput + public class DamPipingSellmeijer4ForcesInput : IKernelDataInput { public double HRiver { get; set; } public double HExit { get; set; } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesOutput.cs =================================================================== diff -u -r510 -r511 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesOutput.cs (.../DamPipingSellmeijer4ForcesOutput.cs) (revision 510) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesOutput.cs (.../DamPipingSellmeijer4ForcesOutput.cs) (revision 511) @@ -1,13 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; namespace Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces { - class DamPipingSellmeijer4ForcesOutput : IKernelDataOutput + public class DamPipingSellmeijer4ForcesOutput : IKernelDataOutput { public double FoSp { get; set; } public double Hc { get; set; } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Properties/AssemblyInfo.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Properties/AssemblyInfo.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/Properties/AssemblyInfo.cs (revision 511) @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Deltares.DamEngine.Calculators.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Deltares")] +[assembly: AssemblyProduct("Deltares.DamEngine.Calculators.Tests")] +[assembly: AssemblyCopyright("Copyright © Deltares 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("783e7bc6-cd3f-4851-b5ef-46de954aacd1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/DamPipingSellmeijer4ForcesTests.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/DamPipingSellmeijer4ForcesTests.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/DamPipingSellmeijer4ForcesTests.cs (revision 511) @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces; +using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Standard.Logging; +using NUnit.Framework; + +namespace Deltares.DamEngine.Calculators.Tests +{ + [TestFixture] + public class DamPipingSellmeijer4ForcesTests + { + + [Test] + public void TestCalculation() + { + // expected results are based on test in 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 + // reducedFall = HRiver - HExit - (Rc * DTotal) = 1.0 - 0.0 - (0.3 * 2.0) = 0.4 + // FoSp = Hc / reducedFall = 4.7596 / 0.4 = 11.899 + // For calculation of Hc see TestCanCalculateHCritical + // See also "..\..\doc\Evaluation Piping\Nieuwe rekenregel bligh Sellmeijeruli.xls" + + const double diff = 0.0001; + + // ToDo Fill input + var damKernelInput = new DamKernelInput(); + + var kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper(); + + // Prepare the wrapper. Result is input for the calculation dll + var damPipingInput = kernelWrapper.Prepare(damKernelInput); + + // Validate the input + List messages; + kernelWrapper.Validate(damPipingInput, out messages); + Assert.AreEqual(0, messages.Count); + + // Run the dll + DamPipingSellmeijer4ForcesOutput output = (DamPipingSellmeijer4ForcesOutput) kernelWrapper.Execute(damPipingInput, out messages); + Assert.AreEqual(0, messages.Count); + Assert.AreEqual(11.899117458988471, output.FoSp, diff); + Assert.AreEqual(4.7596469835953883, output.Hc, diff); + + // Fill the design results + DesignResult result; + kernelWrapper.PostProcess(output, out result); + Assert.AreEqual(11.899117458988471, result.PipingDesignResults.Sellmeijer4ForcesFactor, diff); + Assert.AreEqual(4.7596469835953883, result.PipingDesignResults.Sellmeijer4ForcesHcritical, diff); + } + + } +} Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs =================================================================== diff -u -r510 -r511 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 510) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 511) @@ -12,8 +12,13 @@ namespace Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces { - class DamPipingSellmeijer4ForcesKernelWrapper : IKernelWrapper + public class DamPipingSellmeijer4ForcesKernelWrapper : IKernelWrapper { + /// + /// Prepares the specified dam kernel input. + /// + /// The dam kernel input. + /// public IKernelDataInput Prepare(DamKernelInput damKernelInput) { // TODO: this is just fake data @@ -33,6 +38,12 @@ }; } + /// + /// Validates the specified kernel data input. + /// + /// The kernel data input. + /// The return messages. + /// public int Validate(IKernelDataInput kernelDataInput, out List messages) { var calculator = PipingCalculatorSellmeijer4Forces(kernelDataInput); @@ -45,13 +56,19 @@ return messages.Count; } + /// + /// Executes the kernel. + /// + /// The kernel data input. + /// The return messages. + /// public IKernelDataOutput Execute(IKernelDataInput kernelDataInput, out List messages) { - var calculatorBligh = PipingCalculatorSellmeijer4Forces(kernelDataInput); - calculatorBligh.Calculate(); + var calculator = PipingCalculatorSellmeijer4Forces(kernelDataInput); + calculator.Calculate(); var damPipingOutput = new DamPipingSellmeijer4ForcesOutput(); - damPipingOutput.FoSp = calculatorBligh.FoSp; - damPipingOutput.Hc = calculatorBligh.Hc; + damPipingOutput.FoSp = calculator.FoSp; + damPipingOutput.Hc = calculator.Hc; messages = new List(); return damPipingOutput; } @@ -69,29 +86,43 @@ HExit = damPipingInput.HExit, Rc = damPipingInput.Rc, DTotal = damPipingInput.DTotal, + AquiferHeight = damPipingInput.AquiferHeight, SeepageLength = damPipingInput.SeepageLength, - D70 = damPipingInput.D70 + D70 = damPipingInput.D70, + WhitesConstant = damPipingInput.WhitesConstant, + BeddingAngle = damPipingInput.BeddingAngle, + PermeabilityKx = damPipingInput.PermeabilityKx, + WaterViscosity = damPipingInput.WaterViscosity, }; return calculator; } + /// + /// Fills the design results with the kernel output. + /// + /// The kernel data output. + /// The design result. + /// public void PostProcess(IKernelDataOutput kernelDataOutput, out DesignResult designResult) { DamPipingSellmeijer4ForcesOutput damPipingOutput = kernelDataOutput as DamPipingSellmeijer4ForcesOutput; if (damPipingOutput == null) { throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_PostProcess_NoOutputObjectDefinedForSellmeijer4Forces); } + + // TODO: this is just fake data string id = "id"; string soilProfile2DName = "soilProfile2DName"; var d = new DamFailureMechanismeCalculationSpecification(); var s = new DesignScenario(); + s.Location = new Location(); var p = new SoilProfile1D(); - designResult = new DesignResult(id, d, s, p, soilProfile2DName, AnalysisType.NoAdaption, 0); + var pipingDesignResults = new PipingDesignResults(PipingModelType.Sellmeijer4Forces); - pipingDesignResults.BlighFactor = damPipingOutput.FoSp; - pipingDesignResults.BlighHcritical = damPipingOutput.Hc; + pipingDesignResults.Sellmeijer4ForcesFactor = damPipingOutput.FoSp; + pipingDesignResults.Sellmeijer4ForcesHcritical = damPipingOutput.Hc; designResult.PipingDesignResults = pipingDesignResults; } }