Index: Ringtoets.sln
===================================================================
diff -u -rfca19abd4b2c9638276f02f1a748874c5043d2e6 -r32b132d289373b9182dfd4abfb28a5c2e0ea5d8c
--- Ringtoets.sln (.../Ringtoets.sln) (revision fca19abd4b2c9638276f02f1a748874c5043d2e6)
+++ Ringtoets.sln (.../Ringtoets.sln) (revision 32b132d289373b9182dfd4abfb28a5c2e0ea5d8c)
@@ -1330,8 +1330,8 @@
{C48E2C11-3FDA-4356-A10F-757469A108FD}.CreateInstallerWithDemoProject|x86.ActiveCfg = CreateInstallerWithDemoProject|x86
{C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|Mixed Platforms.Build.0 = Debug|x86
{C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|x86.ActiveCfg = Debug|x86
{C48E2C11-3FDA-4356-A10F-757469A108FD}.Debug|x86.Build.0 = Debug|x86
{C48E2C11-3FDA-4356-A10F-757469A108FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
Index: Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoProjectCommand.cs
===================================================================
diff -u -rfca19abd4b2c9638276f02f1a748874c5043d2e6 -r32b132d289373b9182dfd4abfb28a5c2e0ea5d8c
--- Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoProjectCommand.cs (.../AddNewDemoProjectCommand.cs) (revision fca19abd4b2c9638276f02f1a748874c5043d2e6)
+++ Ringtoets/Demo/src/Ringtoets.Demo/Commands/AddNewDemoProjectCommand.cs (.../AddNewDemoProjectCommand.cs) (revision 32b132d289373b9182dfd4abfb28a5c2e0ea5d8c)
@@ -1,6 +1,6 @@
using System;
-using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Reflection;
using Core.Common.Gui;
@@ -42,36 +42,69 @@
demoAssessmentSection.InitializePipingFailureMechanism();
}
- //var pipingFailureMechanism = demoAssessmentSection.PipingFailureMechanism;
+ var pipingFailureMechanism = demoAssessmentSection.PipingFailureMechanism;
- //using (var tempPath = new TemporaryImportFile("DR6_surfacelines.csv"))
- //{
+ using (var tempPath = new TemporaryImportFile("DR6_surfacelines.csv"))
+ {
- // var surfaceLinesImporter = new PipingSurfaceLinesCsvImporter();
- // surfaceLinesImporter.ImportItem(tempPath.FilePath, pipingFailureMechanism.SurfaceLines);
- //}
+ var surfaceLinesImporter = new PipingSurfaceLinesCsvImporter();
+ surfaceLinesImporter.ImportItem(tempPath.FilePath, pipingFailureMechanism.SurfaceLines);
+ }
+
+ using (var tempPath = new TemporaryImportFile("complete.soil"))
+ {
+
+ var surfaceLinesImporter = new PipingSoilProfilesImporter();
+ surfaceLinesImporter.ImportItem(tempPath.FilePath, pipingFailureMechanism.SoilProfiles);
+ }
+
+ var calculation = pipingFailureMechanism.Calculations.First();
+ calculation.SurfaceLine = pipingFailureMechanism.SurfaceLines.First(sl => sl.Name == "PK001_0001");
+ calculation.SoilProfile = pipingFailureMechanism.SoilProfiles.First(sl => sl.Name == "AD640M00_Segment_36005_1D2");
}
public IGui Gui { get; set; }
+ ///
+ /// Class for creating a temporary file in the windows Temp directory based on a
+ /// file stored in Embedded Resources.
+ ///
private class TemporaryImportFile : IDisposable
{
private readonly string tempTargetFolderPath;
private readonly string fullFilePath;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Name of the file with build action 'Embedded Resource' within this project.
public TemporaryImportFile(string embeddedResourceFileName)
{
tempTargetFolderPath = Path.Combine(Path.GetTempPath(), "demo_traject");
+ Directory.CreateDirectory(tempTargetFolderPath);
+
fullFilePath = Path.Combine(tempTargetFolderPath, embeddedResourceFileName);
+
+ var stream = GetStreamToFileInResource(embeddedResourceFileName);
+
+ var bytes = GetBinaryDataOfStream(stream);
+
+ File.WriteAllBytes(fullFilePath, bytes);
+ }
+
+ private Stream GetStreamToFileInResource(string embeddedResourceFileName)
+ {
var assembly = Assembly.GetAssembly(GetType());
- var stream = assembly.GetManifestResourceStream(GetType(), "Ringtoets.Demo.Resources."+embeddedResourceFileName);
+ string embeddedResourceName = assembly.GetManifestResourceNames().First(n => n.EndsWith(embeddedResourceFileName));
+ return assembly.GetManifestResourceStream(embeddedResourceName);
+ }
+
+ private static byte[] GetBinaryDataOfStream(Stream stream)
+ {
+ var bytes = new byte[stream.Length];
var reader = new BinaryReader(stream);
- List bytes = new List();
- while (reader.PeekChar() != -1)
- {
- bytes.Add(reader.ReadByte());
- }
- File.WriteAllBytes(fullFilePath, bytes.ToArray());
+ reader.Read(bytes, 0, (int)stream.Length);
+ return bytes;
}
public string FilePath
Index: Ringtoets/Demo/src/Ringtoets.Demo/Resources/complete.soil
===================================================================
diff -u
Binary files differ
Index: Ringtoets/Demo/src/Ringtoets.Demo/Ringtoets.Demo.csproj
===================================================================
diff -u -rfca19abd4b2c9638276f02f1a748874c5043d2e6 -r32b132d289373b9182dfd4abfb28a5c2e0ea5d8c
--- Ringtoets/Demo/src/Ringtoets.Demo/Ringtoets.Demo.csproj (.../Ringtoets.Demo.csproj) (revision fca19abd4b2c9638276f02f1a748874c5043d2e6)
+++ Ringtoets/Demo/src/Ringtoets.Demo/Ringtoets.Demo.csproj (.../Ringtoets.Demo.csproj) (revision 32b132d289373b9182dfd4abfb28a5c2e0ea5d8c)
@@ -31,15 +31,15 @@
true
- bin\x86\Debug\
+ bin\Debug\
DEBUG;TRACE
full
x86
prompt
MinimumRecommendedRules.ruleset
- bin\x86\Release\
+ bin\Release\
TRACE
true
pdbonly
@@ -51,7 +51,7 @@
bin\CreateInstallerWithDemoProject\
- bin\x86\CreateInstallerWithDemoProject\
+ bin\CreateInstallerWithDemoProject\
@@ -125,6 +125,7 @@
+
Index: Ringtoets/Demo/src/Ringtoets.Demo/RingtoetsDemoProjectRibbon.xaml.cs
===================================================================
diff -u -rfca19abd4b2c9638276f02f1a748874c5043d2e6 -r32b132d289373b9182dfd4abfb28a5c2e0ea5d8c
--- Ringtoets/Demo/src/Ringtoets.Demo/RingtoetsDemoProjectRibbon.xaml.cs (.../RingtoetsDemoProjectRibbon.xaml.cs) (revision fca19abd4b2c9638276f02f1a748874c5043d2e6)
+++ Ringtoets/Demo/src/Ringtoets.Demo/RingtoetsDemoProjectRibbon.xaml.cs (.../RingtoetsDemoProjectRibbon.xaml.cs) (revision 32b132d289373b9182dfd4abfb28a5c2e0ea5d8c)
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using System.Linq;
using Core.Common.Controls;
using Core.Common.Gui.Forms;
Index: Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoProjectCommandTest.cs
===================================================================
diff -u -rfca19abd4b2c9638276f02f1a748874c5043d2e6 -r32b132d289373b9182dfd4abfb28a5c2e0ea5d8c
--- Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoProjectCommandTest.cs (.../AddNewDemoProjectCommandTest.cs) (revision fca19abd4b2c9638276f02f1a748874c5043d2e6)
+++ Ringtoets/Demo/test/Ringtoets.Demo.Test/Commands/AddNewDemoProjectCommandTest.cs (.../AddNewDemoProjectCommandTest.cs) (revision 32b132d289373b9182dfd4abfb28a5c2e0ea5d8c)
@@ -1,4 +1,6 @@
-using Core.Common.Base;
+using System.Linq;
+
+using Core.Common.Base;
using Core.Common.Controls;
using Core.Common.Gui;
@@ -7,7 +9,9 @@
using Rhino.Mocks;
using Ringtoets.Demo.Commands;
+using Ringtoets.Piping.Calculation.Piping;
using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Service;
namespace Ringtoets.Demo.Test.Commands
{
@@ -57,11 +61,54 @@
var demoProject = (AssessmentSection) project.Items[0];
Assert.AreEqual("Demo traject", demoProject.Name);
- Assert.AreEqual(1, demoProject.PipingFailureMechanism.SoilProfiles);
- Assert.AreEqual(1, demoProject.PipingFailureMechanism.SurfaceLines);
+ var profiles = demoProject.PipingFailureMechanism.SoilProfiles.ToArray();
+ Assert.AreEqual(26, profiles.Length);
+ var surfaceLines = demoProject.PipingFailureMechanism.SurfaceLines.ToArray();
+ Assert.AreEqual(4, surfaceLines.Length);
- Assert.AreEqual(1, demoProject.PipingFailureMechanism.Calculations);
+ Assert.AreEqual(1, demoProject.PipingFailureMechanism.Calculations.Count);
+ var calculation = demoProject.PipingFailureMechanism.Calculations.First();
+ AssertCalculationAbleToCalculate(calculation);
mocks.VerifyAll();
}
+
+ private void AssertCalculationAbleToCalculate(PipingData calculation)
+ {
+ Assert.AreEqual(1.0, calculation.UpliftModelFactor, 1e-3);
+ Assert.AreEqual(1.0, calculation.SellmeijerModelFactor, 1e-3);
+
+ Assert.AreEqual(10.0, calculation.WaterVolumetricWeight, 1e-3);
+ Assert.AreEqual(0.0, calculation.AssessmentLevel, 1e-3);
+ Assert.AreEqual(0.0, calculation.PiezometricHeadExit, 1e-3);
+ Assert.AreEqual(0.0, calculation.PiezometricHeadPolder, 1e-3);
+ Assert.AreEqual(0.3, calculation.SellmeijerReductionFactor, 1e-3);
+ Assert.AreEqual(16.5, calculation.SandParticlesVolumicWeight, 1e-3);
+ Assert.AreEqual(0.25, calculation.WhitesDragCoefficient, 1e-3);
+ Assert.AreEqual(1.33e-6, calculation.WaterKinematicViscosity, 1e-3);
+ Assert.AreEqual(9.81, calculation.Gravity, 1e-3);
+ Assert.AreEqual(0.000208, calculation.MeanDiameter70, 1e-3);
+ Assert.AreEqual(37, calculation.BeddingAngle, 1e-3);
+
+ Assert.AreEqual("PK001_0001", calculation.SurfaceLine.Name);
+ Assert.AreEqual("AD640M00_Segment_36005_1D2", calculation.SoilProfile.Name);
+
+ Assert.AreEqual(3.666, PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(calculation).GetDesignValue(), 1e-3);
+ Assert.AreEqual(-1.645, PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(calculation).GetDesignValue(), 1e-3);
+ Assert.AreEqual(0.011, PipingSemiProbabilisticDesignValueFactory.GetThicknessCoverageLayer(calculation).GetDesignValue(), 1e-3);
+ Assert.AreEqual(0.011, PipingSemiProbabilisticDesignValueFactory.GetSeepageLength(calculation).GetDesignValue(), 1e-3);
+ Assert.AreEqual(0.011, PipingSemiProbabilisticDesignValueFactory.GetDiameter70(calculation).GetDesignValue(), 1e-3);
+ Assert.AreEqual(2.345, PipingSemiProbabilisticDesignValueFactory.GetDarcyPermeability(calculation).GetDesignValue(), 1e-3);
+ Assert.AreEqual(2.345, PipingSemiProbabilisticDesignValueFactory.GetThicknessAquiferLayer(calculation).GetDesignValue(), 1e-3);
+
+ Assert.IsTrue(PipingCalculationService.Validate(calculation));
+ PipingCalculationService.Calculate(calculation);
+ Assert.IsTrue(calculation.HasOutput);
+ Assert.AreEqual(0.0021, calculation.Output.HeaveFactorOfSafety, 1e-3);
+ Assert.AreEqual(-143.3235, calculation.Output.HeaveZValue, 1e-3);
+ Assert.AreEqual(4.4072, calculation.Output.UpliftFactorOfSafety, 1e-3);
+ Assert.AreEqual(5.6044, calculation.Output.UpliftZValue, 1e-3);
+ Assert.AreEqual(0.0016, calculation.Output.SellmeijerFactorOfSafety, 1e-3);
+ Assert.AreEqual(-1.6387, calculation.Output.SellmeijerZValue, 1e-3);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Demo/test/Ringtoets.Demo.Test/Ringtoets.Demo.Test.csproj
===================================================================
diff -u -rfca19abd4b2c9638276f02f1a748874c5043d2e6 -r32b132d289373b9182dfd4abfb28a5c2e0ea5d8c
--- Ringtoets/Demo/test/Ringtoets.Demo.Test/Ringtoets.Demo.Test.csproj (.../Ringtoets.Demo.Test.csproj) (revision fca19abd4b2c9638276f02f1a748874c5043d2e6)
+++ Ringtoets/Demo/test/Ringtoets.Demo.Test/Ringtoets.Demo.Test.csproj (.../Ringtoets.Demo.Test.csproj) (revision 32b132d289373b9182dfd4abfb28a5c2e0ea5d8c)
@@ -31,15 +31,15 @@
true
- bin\x86\Debug\
+ bin\Debug\
DEBUG;TRACE
full
x86
prompt
MinimumRecommendedRules.ruleset
- bin\x86\Release\
+ bin\Release\
TRACE
true
pdbonly
@@ -51,7 +51,7 @@
bin\CreateInstallerWithDemoProject\
- bin\x86\CreateInstallerWithDemoProject\
+ bin\CreateInstallerWithDemoProject\
@@ -90,10 +90,18 @@
{f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
Core.Common.Utils
+
+ {d64e4f0e-e341-496f-82b2-941ad202b4e3}
+ Ringtoets.Piping.Calculation
+
{ce994cc9-6f6a-48ac-b4be-02c30a21f4db}
Ringtoets.Piping.Data
+
+ {10B8D63D-87E8-46DF-ACA9-A8CF22EE8FB5}
+ Ringtoets.Piping.Service
+
{ffe3a667-3a4c-4f48-bc6b-1589867fcb41}
Ringtoets.Demo