Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/Deltares.DamPiping.SellmeijerVNKCalculator.csproj
===================================================================
diff -u -r366 -r371
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/Deltares.DamPiping.SellmeijerVNKCalculator.csproj (.../Deltares.DamPiping.SellmeijerVNKCalculator.csproj) (revision 366)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/Deltares.DamPiping.SellmeijerVNKCalculator.csproj (.../Deltares.DamPiping.SellmeijerVNKCalculator.csproj) (revision 371)
@@ -44,11 +44,23 @@
Properties\GlobalAssemblyInfo.cs
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
"$(ProjectDir)..\..\utils\svn_insert_version.cmd" "$(ProjectDir)Properties"
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCommonData.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCommonData.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCommonData.cs (revision 371)
@@ -0,0 +1,54 @@
+using Deltares.DamPiping.SellmeijerVNKCalculator.Geo;
+
+namespace Deltares.DamPiping.SellmeijerVNKCalculator
+{
+ public class PipingCommonData
+ {
+ // soil properties
+
+ // calc params
+
+ public PipingCommonData()
+ {
+ IsAdjustHeadDrop = true;
+ InitializeDefaults();
+ }
+
+ public PipingCommonData(PipingCommonData pipingCommonData)
+ {
+ WaterViscosity = pipingCommonData.WaterViscosity;
+ WaterUnitWeight = pipingCommonData.WaterUnitWeight;
+
+ ParticleUnitWeight = pipingCommonData.ParticleUnitWeight;
+ WhitesConstant = pipingCommonData.WhitesConstant;
+ BeddingAngle = pipingCommonData.BeddingAngle;
+
+ IsAdjustHeadDrop = pipingCommonData.IsAdjustHeadDrop;
+ SafetyFactor = pipingCommonData.SafetyFactor;
+ FluidisationGradient = pipingCommonData.FluidisationGradient;
+ }
+
+ public double WaterViscosity { get; set; }
+ public double WaterUnitWeight { get; set; }
+ public double ParticleUnitWeight { get; set; }
+ public double WhitesConstant { get; set; }
+ public double BeddingAngle { get; set; }
+ public bool IsAdjustHeadDrop { get; set; }
+ public double SafetyFactor { get; set; }
+ public double FluidisationGradient { get; set; }
+
+ public void InitializeDefaults()
+ {
+ WaterViscosity = Physics.WaterViscosity;
+ WaterUnitWeight = Physics.UnitWeightOfwater;
+
+ ParticleUnitWeight = 26.5;
+ WhitesConstant = 0.25;
+ BeddingAngle = 37.0;
+
+ IsAdjustHeadDrop = true;
+ SafetyFactor = 1.2;
+ FluidisationGradient = 0.3;
+ }
+ }
+}
\ No newline at end of file
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingModel2Data.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingModel2Data.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingModel2Data.cs (revision 371)
@@ -0,0 +1,150 @@
+namespace Deltares.DamPiping.SellmeijerVNKCalculator
+{
+ using System.Collections.Generic;
+
+ public class PipingModelModel2Data
+ {
+ private double fHeight1 = 0.0;
+ private double fHeight2 = 0.0;
+
+ private double fPermeability1 = 0.0;
+ private double fPermeability2 = 0.0;
+ private double fPermeability3 = 0.0;
+
+ private double fParticleDiameter = 0.0;
+
+ private double fSeepageLength = 0.0;
+ private double fCrackLength = 0.0;
+
+ private PipingCommonData fPipingCommonData = null;
+
+ private static List fRowHeaderTextList = new List();
+
+ private double fHeadDrop = 0.0;
+
+ private string fMessages;
+ private string fWarningMessage;
+
+ private bool fIsHeadDropCalculation = true;
+
+ public PipingModelModel2Data()
+ {
+ fPipingCommonData = new PipingCommonData();
+ InitializeDefaults();
+ }
+
+ static PipingModelModel2Data()
+ {
+ fRowHeaderTextList.Clear();
+
+ fRowHeaderTextList.Add("gamma_w");
+ fRowHeaderTextList.Add("mu");
+ fRowHeaderTextList.Add("gamma_p");
+ fRowHeaderTextList.Add("eta");
+ fRowHeaderTextList.Add("theta");
+ fRowHeaderTextList.Add("Adapt");
+ fRowHeaderTextList.Add("F");
+ fRowHeaderTextList.Add("i");
+ fRowHeaderTextList.Add("D1");
+ fRowHeaderTextList.Add("D2");
+ fRowHeaderTextList.Add("K1");
+ fRowHeaderTextList.Add("K2");
+ fRowHeaderTextList.Add("K3");
+ fRowHeaderTextList.Add("Do");
+ fRowHeaderTextList.Add("d70");
+ // special case: the "Calculation" column header can change with user's language preference
+ //FRowHeaderTextList.Add(LanguageSupport.GetText("CalculationType", System.Threading.Thread.CurrentThread.CurrentCulture));
+ //FRowHeaderTextList.Add("Calculate");
+ fRowHeaderTextList.Add("L");
+ fRowHeaderTextList.Add("dH");
+ fRowHeaderTextList.Add("Calculate"); // moved to end
+ }
+
+ public PipingModelModel2Data(ref PipingCommonData aPipingCommonData)
+ {
+ InitializeDefaults();
+ fPipingCommonData = aPipingCommonData;
+ }
+
+ public PipingModelModel2Data(PipingModelModel2Data aModel2CalculationData)
+ {
+ fSeepageLength = aModel2CalculationData.SeepageLength;
+ fCrackLength = aModel2CalculationData.CrackLength; // vertical seepage length
+
+ fHeight1 = aModel2CalculationData.Height1;
+ fHeight2 = aModel2CalculationData.Height2;
+
+ fPermeability1 = aModel2CalculationData.Permeability1;
+ fPermeability2 = aModel2CalculationData.Permeability2;
+ fPermeability3 = aModel2CalculationData.Permeability3;
+
+ fParticleDiameter = aModel2CalculationData.ParticleDiameter;
+
+ fHeadDrop = aModel2CalculationData.HeadDrop;
+
+ fMessages = aModel2CalculationData.Messages;
+ fWarningMessage = aModel2CalculationData.WarningMessage;
+
+ fIsHeadDropCalculation = aModel2CalculationData.IsHeadDropCalculation;
+
+ fPipingCommonData = new PipingCommonData(aModel2CalculationData.PipingCommonData);
+ }
+
+ public void InitializeDefaults()
+ {
+
+ fCrackLength = 0.0; // vertical seepage length
+
+ fHeight1 = 10.0;
+ fHeight2 = 10.0;
+
+ fPermeability1 = 1.0e-4;
+ fPermeability2 = 1.0e-4;
+ fPermeability3 = 1.0e-4;
+
+ fParticleDiameter = 200.0;
+
+ if (fIsHeadDropCalculation)
+ {
+ fSeepageLength = 50.0;
+ fHeadDrop = 0.0;
+ }
+ else
+ {
+ fHeadDrop = 3.46;
+ fSeepageLength = 0.0;
+ }
+
+ fMessages = "";
+ fWarningMessage = "";
+
+ fIsHeadDropCalculation = true;
+ }
+
+ public PipingCommonData PipingCommonData { set { fPipingCommonData = value; } get { return fPipingCommonData; } }
+
+ // Model2 data as properties (VNK)
+ public double SeepageLength { set { fSeepageLength = value; } get { return fSeepageLength; } }
+
+ public double CrackLength { set { fCrackLength = value; } get { return fCrackLength; } }
+
+ public double ParticleDiameter { set { fParticleDiameter = value; } get { return fParticleDiameter; } }
+
+ public double Height1 { set { fHeight1 = value; } get { return fHeight1; } }
+ public double Height2 { set { fHeight2 = value; } get { return fHeight2; } }
+
+ public double Permeability1 { set { fPermeability1 = value; } get { return fPermeability1; } }
+ public double Permeability2 { set { fPermeability2 = value; } get { return fPermeability2; } }
+ public double Permeability3 { set { fPermeability3 = value; } get { return fPermeability3; } }
+
+ public double HeadDrop { get { return fHeadDrop; } set { fHeadDrop = value; } }
+
+ public bool IsHeadDropCalculation { get { return fIsHeadDropCalculation; } set { fIsHeadDropCalculation = value; } }
+
+ public string Messages { get { return fMessages; } set { fMessages = value; } }
+ public string WarningMessage { get { return fWarningMessage; } set { fWarningMessage = value; } }
+
+ public static List RowHeaderTextList { get { return fRowHeaderTextList; } }
+
+ }
+}
Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.SellmeijerVNKCalculatorTests/PipingCalculatorSellmeijerVNKTest.cs
===================================================================
diff -u -r366 -r371
--- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.SellmeijerVNKCalculatorTests/PipingCalculatorSellmeijerVNKTest.cs (.../PipingCalculatorSellmeijerVNKTest.cs) (revision 366)
+++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.SellmeijerVNKCalculatorTests/PipingCalculatorSellmeijerVNKTest.cs (.../PipingCalculatorSellmeijerVNKTest.cs) (revision 371)
@@ -11,11 +11,155 @@
{
var bc = new PipingCalculatorSellmeijerVNK
{
-// HRiver = 1
+ HRiver = 1
};
// bc.Calculate();
-// Assert.AreEqual(0, bc.FoSp);
-// Assert.AreEqual(double.NaN, bc.Hc);
+// Assert.AreEqual(0.123, bc.FoSp);
+// Assert.AreEqual(1.222, bc.Hc);
+ // Assert.AreEqual(0, bc.FoSp);
+ // Assert.AreEqual(double.NaN, bc.Hc);
}
+
+ [Test]
+ public void TestCalculation()
+ {
+// // 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;
+ var bc = new PipingCalculatorSellmeijerVNK
+ {
+// HRiver = 1.0,
+// HExit = 0.0,
+// Rc = 0.3,
+// DTotal = 2.0,
+// AquiferHeight = 8.0,
+// SeepageLength = 40.5,
+// D70 = 200.0,
+// WhitesConstant = 0.25,
+// BeddingAngle = 37.0,
+// WaterViscosity = 1.33E-06,
+// PermeabilityKx = 0.0001
+ };
+// bc.Calculate();
+// Assert.AreEqual(11.899117458988471, bc.FoSp, diff);
+// Assert.AreEqual(4.7596469835953883, bc.Hc, diff);
+ }
+
+// [Test]
+// public void CalculateTheSellmeijerPipingFactorForProfileWithTwoSandlayers()
+// {
+// const double cTolerance = 0.01;
+// using (var surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
+// using (var dike = new Dike())
+// using (var location = new Location())
+// {
+// var soilProfile = FactoryForSoilProfileTests.CreatePipingSellmeijerProfileWithTwoSandlayers();
+// var modelParametersForPLLines = new ModelParametersForPLLines();
+// modelParametersForPLLines.DampingFactorPL4 = 0.0;
+//
+// var calculator = new PipingCalculatorSellmeijer(modelParametersForPLLines,
+// 1.0, dike.GaugePLLines, dike.Gauges, null, 1.0);
+//
+// var actual = calculator.CalculatePipingFactor(location, surfaceLine, soilProfile, 1.0);
+//
+// // Phreatic level in profile
+// // Mass of soil volume above
+// // material above bottom sandlayer: 0 to -5 m
+// // dry/wet 5 m x 1 kN/m3 = 5
+// // Phreatic pressure (Head PLLine 4 is ca. 1.0
+// // 6.0 m x 10 kN/m3 = 60,0
+// // UpliftFactor = 5/60.0 = 0.0833
+// // UpliftFactor < 1.0, so piping will occur in toe of dike
+// //
+// // See dgs-as2.geodelft.nl/DGWebPiping for calculation
+// // ===========
+// // gamma_w = 9.81
+// // mu = 1.33E-06
+// // gamma_p = 26.5
+// // eta = 0.25
+// // theta = 37
+// // F = 1.2
+// // i = 0.3
+// // ===========
+// // D1 = dikte bovenste zandlaag = 2.0
+// // D2 = dikte onderste zandlaag = 6.0
+// // k1 = 0.0001
+// // k2 = 0.0002
+// // k3 = 0.0001
+// // Do = 2.0
+// // D70 = 200
+// // Calculate dH
+// // L = ToeOfDike.x - entrypoint.x = 50.5 - 10.0 = 40.5
+// // ===========
+// // Hc = Calculated dH = 3.65
+// // Ha = waterlevel - polderlevel = 1.0 - 0.0 = 1.0
+// // Piping factor = Hc / Ha = 3.46
+// const double expected = 3.65;
+//
+// Assert.AreEqual(expected, actual.Value, cTolerance);
+// }
+// }
+//
+// [Test]
+// public void CalculateTheSellmeijerPipingFactorForProfileWithOneSandlayer()
+// {
+// const double cTolerance = 0.01;
+// using (var surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
+// using (var dike = new Dike())
+// using (var location = new Location())
+// {
+// var soilProfile = FactoryForSoilProfileTests.CreatePipingSellmeijerProfileWithOneSandlayer();
+// var modelParametersForPLLines = new ModelParametersForPLLines();
+// modelParametersForPLLines.DampingFactorPL4 = 0.0;
+//
+// var calculator = new PipingCalculatorSellmeijer(modelParametersForPLLines,
+// 1.0, dike.GaugePLLines, dike.Gauges, null, 1.0);
+// calculator.FilenameCalculation = Path.GetFullPath(".\\CalculateTheSellmeijerPipingFactorForProfileWithOneSandlayer");
+//
+// var actual = calculator.CalculatePipingFactor(location, surfaceLine, soilProfile, 1.0);
+//
+// // Phreatic level in profile
+// // Mass of soil volume above
+// // material above bottom sandlayer: 0 to -5 m
+// // dry/wet 5 m x 1 kN/m3 = 5
+// // Phreatic pressure (Head PLLine 4 is ca. 1.0
+// // 6.0 m x 10 kN/m3 = 60,0
+// // UpliftFactor = 5/60.0 = 0.0833
+// // UpliftFactor < 1.0, so piping will occur in toe of dike
+// //
+// // See dgs-as2.geodelft.nl/DGWebPiping for calculation
+// // ===========
+// // gamma_w = 9.81
+// // mu = 1.33E-06
+// // gamma_p = 26.5
+// // eta = 0.25
+// // theta = 37
+// // F = 1.2
+// // i = 0.3
+// // ===========
+// // D1 = dikte bovenste zandlaag = 4.0
+// // D2 = dikte onderste zandlaag = 4.0
+// // k1 = 0.0001
+// // k2 = 0.0001
+// // k3 = 0.0001
+// // Do = 2.0
+// // D70 = 200
+// // Calculate dH
+// // L = ToeOfDike.x - entrypoint.x = 50.5 - 10.0 = 40.5
+// // ===========
+// // Hc = Calculated dH = 4.13581
+// // Ha = waterlevel - polderlevel = 1.0 - 0.0 = 1.0
+// // Piping factor = Hc / Ha = 4.13581
+// const double expected = 4.13581;
+//
+// Assert.AreEqual(expected, actual.Value, cTolerance);
+// }
+// }
+
+
+
+
}
}
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/Geo/Physics.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/Geo/Physics.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/Geo/Physics.cs (revision 371)
@@ -0,0 +1,33 @@
+namespace Deltares.DamPiping.SellmeijerVNKCalculator.Geo
+{
+ ///
+ /// Physics class with constants that can be redefined
+ ///
+ public class Physics
+ {
+ ///
+ /// The gravity constant in m/s2
+ ///
+ public const double GravityConstant = 9.81;
+
+ ///
+ /// The water density in kg/m3 For temperature = 4 degree Celcius
+ ///
+ ///
+ public const double WaterDensity = 1000;
+
+ ///
+ /// Gets the unit weight of water in kN/m3.
+ ///
+ ///
+ /// The unit weight of water.
+ ///
+ public const double UnitWeightOfwater = GravityConstant*WaterDensity*0.001;
+
+ ///
+ /// The water viscosity
+ ///
+ public const double WaterViscosity = 1.33E-06;
+
+ }
+}
\ No newline at end of file
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/CalcDlls/MPipingCalc2.dll
===================================================================
diff -u
Binary files differ
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalc2Dll.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalc2Dll.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalc2Dll.cs (revision 371)
@@ -0,0 +1,109 @@
+namespace Deltares.DamPiping.SellmeijerVNKCalculator
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ // PC2
+ public delegate IntPtr PC2_Model2CreateHandle();
+ public delegate void PC2_Model2SetSoilProperties(IntPtr CalcHandle, SoilPropertiesStruct PCSoilProperties);
+ public delegate void PC2_Model2SetWaterProperties(IntPtr CalcHandle, WaterPropertiesStruct PCWaterProperties);
+ public delegate void PC2_Model2SetCrackLength(IntPtr CalcHandle, double CrackLength);
+ public delegate void PC2_Model2SetHeadDrop(IntPtr CalcHandle, double HeadDrop);
+ public delegate void PC2_Model2SetSeepageLength(IntPtr CalcHandle, double SeepageLength);
+ public delegate void PC2_Model2SetHeights(IntPtr CalcHandle, int HeightCount, double[] Height);
+ public delegate void PC2_Model2SetPermeabilities(IntPtr CalcHandle, int PermeabilityCount, double[] Permeability);
+ public delegate void PC2_Model2SetCalculationParameters(IntPtr CalcHandle, CalculationParametersStruct PCCalculationParameters);
+ public delegate double PC2_Model2GetHeadDrop(IntPtr CalcHandle);
+ public delegate double PC2_Model2GetSeepageLength(IntPtr CalcHandle);
+ public delegate void PC2_Model2Calculate(IntPtr CalcHandle);
+ public delegate string PC2_Model2GetCalculationMessages(IntPtr CalcHandle);
+ public delegate void PC2_Model2DestroyHandle(IntPtr CalcHandle);
+
+ public class PipingCalc2Dll
+ {
+
+ private const string CMPipingCalcVNK = @"CalcDlls\MPipingCalc2.dll";
+ //private const string CMPipingCalcVNK = @"d:\DelphiWin32Projects\trunk\sources\MPipingCalc\Install Version\MPipingCalc2.dll";
+
+ // PC2
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern IntPtr PC2_CreateHandle();
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetSoilProperties(IntPtr CalcHandle, SoilPropertiesStruct PCSoilProperties);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetWaterProperties(IntPtr CalcHandle, WaterPropertiesStruct PCWaterProperties);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetCrackLength(IntPtr CalcHandle, double CrackLength);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetHeadDrop(IntPtr CalcHandle, double HeadDrop);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetSeepageLength(IntPtr CalcHandle, double SeepageLength);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetHeights(IntPtr CalcHandle, int HeightCount, [MarshalAs(UnmanagedType.LPArray)] double[] Height);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetPermeabilities(IntPtr CalcHandle, int PermeabilityCount, [MarshalAs(UnmanagedType.LPArray)] double[] Permeability);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_SetCalculationParameters(IntPtr CalcHandle, CalculationParametersStruct PCCalculationParameters);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern double PC2_GetHeadDrop(IntPtr CalcHandle);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern double PC2_GetSeepageLength(IntPtr CalcHandle);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_Calculate(IntPtr CalcHandle);
+
+ [DllImport(CMPipingCalcVNK)]
+ [return: MarshalAs(UnmanagedType.LPStr)]
+ private static extern string PC2_GetCalculationMessages(IntPtr CalcHandle);
+
+ [DllImport(CMPipingCalcVNK)]
+ private static extern void PC2_DestroyHandle(IntPtr CalcHandle);
+
+ // PC2
+ public static PC2_Model2Calculate Model2PC2Calculate = null;
+ public static PC2_Model2CreateHandle Model2PC2CreateHandle = null;
+ public static PC2_Model2DestroyHandle Model2PC2DestroyHandle = null;
+ public static PC2_Model2GetHeadDrop Model2PC2GetHeadDrop = null;
+ public static PC2_Model2GetSeepageLength Model2PC2GetSeepageLength = null;
+ public static PC2_Model2SetCalculationParameters Model2PC2SetCalculationParameters = null;
+ public static PC2_Model2SetCrackLength Model2PC2SetCrackLength = null;
+ public static PC2_Model2SetHeadDrop Model2PC2SetHeadDrop = null;
+ public static PC2_Model2SetHeights Model2PC2SetHeights = null;
+ public static PC2_Model2SetPermeabilities Model2PC2SetPermeabilities = null;
+ public static PC2_Model2SetSeepageLength Model2PC2SetSeepageLength = null;
+ public static PC2_Model2SetSoilProperties Model2PC2SetSoilProperties = null;
+ public static PC2_Model2SetWaterProperties Model2PC2SetWaterProperties = null;
+ public static PC2_Model2GetCalculationMessages Model2PC2GetCalculationMessages = null;
+
+
+ static PipingCalc2Dll()
+ {
+ // PC2
+ Model2PC2Calculate = new PC2_Model2Calculate(PC2_Calculate);
+ Model2PC2CreateHandle = new PC2_Model2CreateHandle(PC2_CreateHandle);
+ Model2PC2DestroyHandle = new PC2_Model2DestroyHandle(PC2_DestroyHandle);
+ Model2PC2GetCalculationMessages = new PC2_Model2GetCalculationMessages(PC2_GetCalculationMessages);
+ Model2PC2GetHeadDrop = new PC2_Model2GetHeadDrop(PC2_GetHeadDrop);
+ Model2PC2GetSeepageLength = new PC2_Model2GetSeepageLength(PC2_GetSeepageLength);
+ Model2PC2SetCalculationParameters = new PC2_Model2SetCalculationParameters(PC2_SetCalculationParameters);
+ Model2PC2SetCrackLength = new PC2_Model2SetCrackLength(PC2_SetCrackLength);
+ Model2PC2SetHeadDrop = new PC2_Model2SetHeadDrop(PC2_SetHeadDrop);
+ Model2PC2SetHeights = new PC2_Model2SetHeights(PC2_SetHeights);
+ Model2PC2SetPermeabilities = new PC2_Model2SetPermeabilities(PC2_SetPermeabilities);
+ Model2PC2SetSeepageLength = new PC2_Model2SetSeepageLength(PC2_SetSeepageLength);
+ Model2PC2SetSoilProperties = new PC2_Model2SetSoilProperties(PC2_SetSoilProperties);
+ Model2PC2SetWaterProperties = new PC2_Model2SetWaterProperties(PC2_SetWaterProperties);
+ }
+ }
+}
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalculatorSellmeijerVNK.cs
===================================================================
diff -u -r366 -r371
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalculatorSellmeijerVNK.cs (.../PipingCalculatorSellmeijerVNK.cs) (revision 366)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalculatorSellmeijerVNK.cs (.../PipingCalculatorSellmeijerVNK.cs) (revision 371)
@@ -1,12 +1,263 @@
-using System;
+using Deltares.DamPiping.SellmeijerVNKCalculator.Geo;
+using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.IO;
namespace Deltares.DamPiping.SellmeijerVNKCalculator
{
public class PipingCalculatorSellmeijerVNK
{
+
+ public const double RcDefault = 0.3;
+ // public const double Epsilon = 1e-8;
+ // protected const double DegreeToRadian = Math.PI / 180.0;
+ // protected static double GammaPDividedByGammaW = 16.5 / Physics.UnitWeightOfwater; // Gamma korrel is now assumed 16.5 kN/m3
+ public const string PipingFilenameExtension = ".txt";
+ public const string DamParametersSectionId = "[DamParameters]";
+ public const string ResultsSectionId = "[Results]";
+ protected const double CToleranceHead = 0.00000001;
+
+ private double foSp;
+ private double hc;
+ private double rc = RcDefault;
+ private double reducedFall;
+ private string fileName = "";
+
+ ///
+ /// River level as input
+ ///
+ public double HRiver { get; set; }
+
+ ///
+ /// Phreatic level at exit point as input
+ ///
+ public double HExit { get; set; }
+
+ ///
+ /// Polder level as input
+ ///
+ public double PolderLevel { get; set; }
+
+ ///
+ /// Surface level as input
+ ///
+ public double SurfaceLevel { get; set; }
+
+ ///
+ /// Reduction factor as input
+ ///
+ public double Rc
+ {
+ get { return rc; }
+ set { rc = value; }
+ }
+
+ ///
+ /// Total thickness of cover layer as input
+ ///
+ public double DTotal { get; set; }
+
+ ///
+ /// Thickness of the layer in between aquifer as input
+ ///
+ public double DInBetweenAquiferlayer { get; set; }
+
+ ///
+ /// Thickness of the bottom aquifer layer as input
+ ///
+ public double DBottomAquiferlayer { get; set; }
+
+ ///
+ /// The permeability kx of the layer in between aquifer as input
+ ///
+ public double PermeabilityInBetweenAquiferlayer { get; set; }
+
+ ///
+ /// The permeability kx of the bottom aquifer layer as input
+ ///
+ public double PermeabilityBottomAquiferlayer { get; set; }
+
+ ///
+ /// Seepage length (xExit - xEntry) as input
+ ///
+ public double SeepageLength { get; set; }
+
+ ///
+ /// Median grainsize D70 as input
+ ///
+ public double D70 { get; set; }
+
+ ///
+ /// The whites constant as input
+ ///
+ public double WhitesConstant { get; set; }
+
+ ///
+ /// The bedding angle as input
+ ///
+ public double BeddingAngle { get; set; }
+
+ ///
+ /// The water viscosity as input
+ ///
+ public double WaterViscosity { get; set; }
+
+ ///
+ /// Safety factor of piping as result
+ ///
+ public double FoSp
+ {
+ get { return foSp; }
+ }
+
+ ///
+ /// Critical head difference for piping as result.
+ ///
+ public double Hc
+ {
+ get
+ {
+ return hc;
+ }
+ }
+
+ public string FilenameCalculation { get; set; }
+
+ ///
+ /// Start the calculation of all output parameters.
+ ///
+ public void Calculate()
+ {
+ PipingModel2Calculation pipingModel2Calculation = SetData();
+ hc = CalculateHCritical(pipingModel2Calculation);
+ reducedFall = GetReducedFall();
+ DetermineFactorOfSafety();
+ }
+
+ private PipingModel2Calculation SetData()
+ {
+ var pipingModel2Calculation = CreateAndFillPipingModel2Calculation();
+ pipingModel2Calculation.IsHeadDropCalculation = true; // Constant
+ pipingModel2Calculation.SeepageLength = SeepageLength;
+ pipingModel2Calculation.CrackLength = DTotal;
+ return pipingModel2Calculation;
+ }
+
+ private double CalculateHCritical(PipingModel2Calculation pipingModel2Calculation)
+ {
+ // Reference level is highest value of surfaceLevel or PolderLevel
+ // Uit TR Zandmeevoerende wellen (1999): "Het verval dH is gelijk aan het verschil tussen buitenwaterstand (het ontwerppeil(OP))
+ // bij zeedijken en de maatgevende hoogwaterstand (MHW bij rivierdijken) en de waterstand binnendijks ter plaatse van het uittredepunt,
+ // rekening houdend met zeespiegelrijzing etc.(zie paragraaf 3.7.2). In dien ter plaatse van het uittreepunt of de opbarstlocatie
+ // geen vrije waterstand heerst kan gerekend worden met het maaiveldniveau, rekening houdend met eventuele maaiveld daling (zie paragraaf 3.7.2)."
+
+ // Ouput piping parameters and dam parameters to project file
+ if (FilenameCalculation != null)
+ {
+ if (FilenameCalculation != "")
+ {
+ string directoryName = Path.GetDirectoryName(FilenameCalculation);
+ if (!String.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
+ {
+ Directory.CreateDirectory(directoryName);
+
+ }
+ fileName = String.Format("{0}{1}", FilenameCalculation, PipingFilenameExtension);
+ Console.WriteLine(fileName);
+ File.WriteAllLines(fileName, pipingModel2Calculation.ParametersToStrings().ToArray());
+
+ // Write Dam parameters to calculation file
+ var damParameterStrings = new List
+ {
+ DamParametersSectionId,
+ String.Format("PolderLevel={0}", PolderLevel),
+ String.Format("SurfaceTopLevel={0}", SurfaceLevel),
+ String.Format("ReferenceLevel={0}", HExit),
+ String.Format("WaterLevel={0}", HRiver),
+ ""
+ };
+ File.AppendAllText(fileName, string.Join(Environment.NewLine, damParameterStrings.ToArray()));
+ }
+ }
+ pipingModel2Calculation.CalculateHeadDropPC2();
+
+ return pipingModel2Calculation.HeadDrop;
+ }
+
+ private void DetermineFactorOfSafety()
+ {
+ const double cDefaultMaxReturnValue = 90.0;
+ foSp = cDefaultMaxReturnValue;
+ // If actual headdrop is almost zero or smaller than zero then piping will be no problem
+ // The pipingfactor will be set to cDefaultMaxReturnValue
+ if (reducedFall > CToleranceHead)
+ {
+ foSp = hc / reducedFall;
+ }
+
+ // Write results to calculation file
+ if (fileName != "")
+ {
+ var resultStrings = new List
+ {
+ ResultsSectionId,
+ String.Format("HCritical={0}", hc),
+ String.Format("HActual={0}", reducedFall),
+ String.Format("PipingFactor={0}", foSp),
+ ""
+ };
+ File.AppendAllText(fileName, string.Join(Environment.NewLine, resultStrings.ToArray()));
+ }
+ }
+
+ private double GetReducedFall()
+ {
+ // The Leidraad says that 0.3 * d can be substracted from hActual
+ // In the piping Sellmeijer model (PipingModel2 for VNK) 0.3 * d is added to the hCritical
+ // So we do not substract 0.3 * d from hActual (written by Tom The and Erik Vastenburg)
+ return HRiver - HExit;
+ }
+
+ ///
+ /// Create PipingModel2Calculation object and fill with input parameters
+ ///
+ ///
+ private PipingModel2Calculation CreateAndFillPipingModel2Calculation()
+ {
+ var pipingModel2Calculation = new PipingModel2Calculation();
+
+ pipingModel2Calculation.HeadDrop = 0.0;// Not used, to be calculated
+ pipingModel2Calculation.PipingCommonData.BeddingAngle = BeddingAngle; // From soilmaterials of upper sandlayer
+ pipingModel2Calculation.PipingCommonData.FluidisationGradient = Rc; //Constant
+ pipingModel2Calculation.PipingCommonData.WaterUnitWeight = Physics.UnitWeightOfwater; //Constant
+ pipingModel2Calculation.PipingCommonData.WaterViscosity = WaterViscosity; //Constant
+ pipingModel2Calculation.PipingCommonData.WhitesConstant = WhitesConstant; // From soilmaterials of upper sandlayer
+ pipingModel2Calculation.PipingCommonData.SafetyFactor = 1.20; //Constant toetsen/ontwerpen = 1.2 en calamiteit = 1.0
+ pipingModel2Calculation.PipingCommonData.IsAdjustHeadDrop = true; // Constant
+
+ // Soil parameters
+ pipingModel2Calculation.PipingCommonData.ParticleUnitWeight = 26.50; // Constant
+ pipingModel2Calculation.Permeability1 = PermeabilityInBetweenAquiferlayer; // Kx From upper sandlayer
+ pipingModel2Calculation.Permeability2 = PermeabilityBottomAquiferlayer; // Kx From bottom sandlayer
+ pipingModel2Calculation.Permeability3 = PermeabilityInBetweenAquiferlayer; // Kx From upper sandlayer
+ pipingModel2Calculation.ParticleDiameter = D70; // D70 D60 From soilmaterials of upper sandlayer
+
+ // Geometry parameters
+ pipingModel2Calculation.Height1 = DInBetweenAquiferlayer; // Thickness upper sandlayer
+ pipingModel2Calculation.Height2 = DBottomAquiferlayer; // Thickness bottom sandlayer
+ return pipingModel2Calculation;
+ //
+ // particleunitweight = gamma_p can be calculated as follows
+ // (gamma_sat - gamma_water) = (gamma_p - gamma_water) / (1 - n); for now 26.50 is good enough
+ //
+ // limit heights: see TPC2Preprocessing.AdjustParameters()
+ // CD1MinSeepageLengthFactor = 0.02; = D1 / Length
+ // CD2MinSeepageLengthFactor = 0.03; = D2 / Length
+ // CD1MaxSeepageLengthFactor = 1.4;
+ // CD2MaxSeepageLengthFactor = 1.4;
+ //
+ // Kx or Ky: Sel: Use Kx
+ }
+
}
}
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingModel2Calculation.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingModel2Calculation.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingModel2Calculation.cs (revision 371)
@@ -0,0 +1,522 @@
+namespace Deltares.DamPiping.SellmeijerVNKCalculator
+{
+ using System;
+ using System.Text;
+ using System.IO;
+ using System.Runtime.InteropServices;
+ using System.Globalization;
+ using System.Collections.Generic;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RingDataStruct
+ {
+ public double WaterUnitWeight; //1
+ public double WaterViscosity; //2
+ public double ParticleUnitWeight; //3
+ public double ParticleDiameter; //4
+ public double Model2Layer1Thickness; //5
+ public double Model2Layer2Thickness; //6
+ public double Model2Soil1Permeability; //7
+ public double Model2Soil2Permeability; //8
+ public double Model2Soil3Permeability; //9
+ public double VerticalSeepageLength; //10
+ public double SeepageLength; //11
+ public double BeddingAngle; //12
+ public double WhitesConstant; //13
+ public double SafetyFactor; //14
+ public double FluidisationGradient; //15
+ } ;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct SoilPropertiesStruct
+ {
+ public double ParticleUnitWeight; //1
+ public double ParticleD70; //2
+ public double BeddingAngle; //3
+ public double WhitesConstant; //4
+ } ;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct WaterPropertiesStruct
+ {
+ public double UnitWeight;
+ public double Viscosity;
+ } ;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct CalculationParametersStruct
+ {
+ public int CalculationType; //1
+ [MarshalAs(UnmanagedType.I1)]
+ public bool IsAdjustHeadDrop; //2
+ public double SafetyFactor; //3
+ public double FluidisationGradient; //4
+ }
+
+ public class PipingModel2Calculation
+ {
+ private const string sPipingParametersSectionId = "[PipingParameters]";
+ private const int cTotalParameterCount = 15;
+ private const string sDebugFile = "VNK-Debug.log";
+ private const int cMaxPath = 256;
+
+ private PipingModelModel2Data fCurrentCalculationData = null;
+
+ private string fHomeDir = "";
+
+ private string fSessionId = "";
+
+ public PipingModel2Calculation()
+ {
+ fCurrentCalculationData = new PipingModelModel2Data();
+ }
+
+ public PipingModel2Calculation(ref PipingCommonData aPipingCommonData)
+ {
+ fCurrentCalculationData = new PipingModelModel2Data(ref aPipingCommonData);
+ }
+
+ // wrap the Model2 data as properties here again (VNK)
+ public PipingCommonData PipingCommonData
+ {
+ set { fCurrentCalculationData.PipingCommonData = value; }
+ get { return fCurrentCalculationData.PipingCommonData; }
+ }
+
+ public bool IsHeadDropCalculation
+ {
+ set { fCurrentCalculationData.IsHeadDropCalculation = value; }
+ get { return fCurrentCalculationData.IsHeadDropCalculation; }
+ }
+
+ public double SeepageLength
+ {
+ set { fCurrentCalculationData.SeepageLength = value; }
+ get { return fCurrentCalculationData.SeepageLength; }
+ }
+
+ public double CrackLength
+ {
+ set { fCurrentCalculationData.CrackLength = value; }
+ get { return fCurrentCalculationData.CrackLength; }
+ }
+
+ public double ParticleDiameter
+ {
+ set { fCurrentCalculationData.ParticleDiameter = value; }
+ get { return fCurrentCalculationData.ParticleDiameter; }
+ }
+
+ public double Height1
+ {
+ set { fCurrentCalculationData.Height1 = value; }
+ get { return fCurrentCalculationData.Height1; }
+ }
+
+ public double Height2
+ {
+ set { fCurrentCalculationData.Height2 = value; }
+ get { return fCurrentCalculationData.Height2; }
+ }
+
+ public double Permeability1
+ {
+ set { fCurrentCalculationData.Permeability1 = value; }
+ get { return fCurrentCalculationData.Permeability1; }
+ }
+
+ public double Permeability2
+ {
+ set { fCurrentCalculationData.Permeability2 = value; }
+ get { return fCurrentCalculationData.Permeability2; }
+ }
+
+ public double Permeability3
+ {
+ set { fCurrentCalculationData.Permeability3 = value; }
+ get { return fCurrentCalculationData.Permeability3; }
+ }
+
+ public double HeadDrop
+ {
+ get { return fCurrentCalculationData.HeadDrop; }
+ set { fCurrentCalculationData.HeadDrop = value; }
+ }
+
+ public string Messages
+ {
+ get { return fCurrentCalculationData.Messages; }
+ set { fCurrentCalculationData.Messages = value; }
+ }
+
+ public string HomeDir
+ {
+ get { return fHomeDir; }
+ set { fHomeDir = value; }
+ }
+
+ public string SessionId
+ {
+ get { return fSessionId; }
+ set { fSessionId = value; }
+ }
+
+ public void CalculateHeadDropPC2()
+ {
+ const string cMessageError = "Error";
+
+ fCurrentCalculationData.Messages = "";
+ var fCalcHandle = PipingCalc2Dll.Model2PC2CreateHandle();
+
+ if (fCalcHandle == IntPtr.Zero)
+ {
+ fCurrentCalculationData.HeadDrop = 0.0;
+ fCurrentCalculationData.Messages = cMessageError;
+ return;
+ }
+ try
+ {
+ // soil properties
+ SoilPropertiesStruct soilProperties = new SoilPropertiesStruct
+ {
+ BeddingAngle = fCurrentCalculationData.PipingCommonData.BeddingAngle,
+ ParticleD70 = fCurrentCalculationData.ParticleDiameter,
+ ParticleUnitWeight = fCurrentCalculationData.PipingCommonData.ParticleUnitWeight,
+ WhitesConstant = fCurrentCalculationData.PipingCommonData.WhitesConstant
+ };
+ PipingCalc2Dll.Model2PC2SetSoilProperties(fCalcHandle, soilProperties);
+
+ // water properties
+ WaterPropertiesStruct waterProperties = new WaterPropertiesStruct
+ {
+ UnitWeight = fCurrentCalculationData.PipingCommonData.WaterUnitWeight,
+ Viscosity = fCurrentCalculationData.PipingCommonData.WaterViscosity
+ };
+ PipingCalc2Dll.Model2PC2SetWaterProperties(fCalcHandle, waterProperties);
+
+ PipingCalc2Dll.Model2PC2SetCrackLength(fCalcHandle, fCurrentCalculationData.CrackLength);
+ PipingCalc2Dll.Model2PC2SetHeadDrop(fCalcHandle, fCurrentCalculationData.HeadDrop);
+ PipingCalc2Dll.Model2PC2SetSeepageLength(fCalcHandle, fCurrentCalculationData.SeepageLength);
+
+ // heights
+ double[] heightArray = new double[2];
+ heightArray[0] = fCurrentCalculationData.Height1;
+ heightArray[1] = fCurrentCalculationData.Height2;
+ PipingCalc2Dll.Model2PC2SetHeights(fCalcHandle, heightArray.Length, heightArray);
+
+ // permeabilities
+ double[] permeabilityArray = new double[3];
+ permeabilityArray[0] = fCurrentCalculationData.Permeability1;
+ permeabilityArray[1] = fCurrentCalculationData.Permeability2;
+ permeabilityArray[2] = fCurrentCalculationData.Permeability3;
+ PipingCalc2Dll.Model2PC2SetPermeabilities(fCalcHandle, permeabilityArray.Length, permeabilityArray);
+
+ //calculation parameters
+ CalculationParametersStruct calculationParameters = new CalculationParametersStruct();
+ if (fCurrentCalculationData.IsHeadDropCalculation)
+ calculationParameters.CalculationType = 1;
+ else
+ calculationParameters.CalculationType = 2;
+ calculationParameters.FluidisationGradient = fCurrentCalculationData.PipingCommonData.FluidisationGradient;
+ calculationParameters.IsAdjustHeadDrop = fCurrentCalculationData.PipingCommonData.IsAdjustHeadDrop;
+ // Note: next safety factor only relevant when IsAdjustHeadDrop is true.
+ calculationParameters.SafetyFactor = fCurrentCalculationData.PipingCommonData.SafetyFactor;
+ PipingCalc2Dll.Model2PC2SetCalculationParameters(fCalcHandle, calculationParameters);
+
+ // calculate
+ try
+ {
+ PipingCalc2Dll.Model2PC2Calculate(fCalcHandle);
+ if (fCurrentCalculationData.IsHeadDropCalculation)
+ fCurrentCalculationData.HeadDrop = PipingCalc2Dll.Model2PC2GetHeadDrop(fCalcHandle);
+ else
+ fCurrentCalculationData.SeepageLength = PipingCalc2Dll.Model2PC2GetSeepageLength(fCalcHandle);
+ }
+ catch
+ {
+ throw new PipingCalculationException("Error in Piping DLL");
+ }
+
+ fCurrentCalculationData.Messages = "";
+ if (double.IsNaN(fCurrentCalculationData.HeadDrop))
+ fCurrentCalculationData.Messages = cMessageError;
+ }
+ finally
+ {
+ // cleanup
+ PipingCalc2Dll.Model2PC2DestroyHandle(fCalcHandle);
+ }
+ }
+
+// ///
+// /// Throw helper
+// ///
+// ///
+// public void ThrowIfNotAssigned(Object currentObject, string objectName)
+// {
+// if (currentObject == null)
+// {
+// throw new PipingCalculationException(string.Format("Missing input {0}", objectName));
+// }
+// }
+//
+//
+//
+// ///
+// /// Read debug log from file
+// ///
+// ///
+// ///
+// private string ReadDebugLog(string APath)
+// {
+// try
+// {
+// StreamReader stream = File.OpenText(APath);
+// stream.ReadLine(); // first line
+//
+// string LLine2 = stream.ReadToEnd();
+// stream.Close();
+// File.Delete(APath);
+//
+// return LLine2;
+// }
+// catch
+// {
+// return null;
+// }
+// }
+//
+// // TEMP... this has to be done more generically
+// private void SetCurrentValueFromString(string aField, string aValue)
+// {
+// double doubleValue = 0.0;
+// bool boolValue = true;
+//
+// switch (aField)
+// {
+// case "gamma_w":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.WaterUnitWeight = doubleValue;
+// break;
+// }
+// case "mu":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CMinWaterViscosity,
+// PipingConstants.CMaxWaterViscosity, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.WaterViscosity = doubleValue;
+// break;
+// }
+// case "gamma_p":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.ParticleUnitWeight = doubleValue;
+// break;
+// }
+// case "eta":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CMinWhitesConstant,
+// PipingConstants.CMaxWhitesConstant, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.WhitesConstant = doubleValue;
+// break;
+// }
+// case "theta":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CMinBeddingAngle,
+// PipingConstants.CMaxBeddingAngle, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.BeddingAngle = doubleValue;
+// break;
+// }
+// case "Adapt":
+// {
+// if (GetBoolValueFromString(aValue, ref boolValue))
+// fCurrentCalculationData.PipingCommonData.IsAdjustHeadDrop = boolValue;
+// break;
+// }
+// case "F":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CMinSafetyFactor,
+// PipingConstants.CMaxSafetyFactor, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.SafetyFactor = doubleValue;
+// break;
+// }
+// case "i":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CMinFluidisationGradient,
+// PipingConstants.CMaxFluidisationGradient, ref doubleValue))
+// fCurrentCalculationData.PipingCommonData.FluidisationGradient = doubleValue;
+// break;
+// }
+// case "D1":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.Height1 = doubleValue;
+// break;
+// }
+// case "D2":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.Height2 = doubleValue;
+// break;
+// }
+// case "K1":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.Permeability1 = doubleValue;
+// break;
+// }
+// case "K2":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.Permeability2 = doubleValue;
+// break;
+// }
+// case "K3":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.Permeability3 = doubleValue;
+// break;
+// }
+// case "Do":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, 0.0, PipingConstants.CDelphiMaxDouble,
+// ref doubleValue))
+// fCurrentCalculationData.CrackLength = doubleValue;
+// break;
+// }
+// case "d70":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.ParticleDiameter = doubleValue;
+// break;
+// }
+// case "L":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.SeepageLength = doubleValue;
+// break;
+// }
+// case "dH":
+// {
+// if (ValidateDoubleToRangeFromString(aValue, PipingConstants.CNoiseTolerance,
+// PipingConstants.CDelphiMaxDouble, ref doubleValue))
+// fCurrentCalculationData.HeadDrop = doubleValue;
+// break;
+// }
+// case "Calculate":
+// {
+// if (aValue == PipingModelModel2Data.RowHeaderTextList[15])
+// fCurrentCalculationData.IsHeadDropCalculation = false;
+// else
+// fCurrentCalculationData.IsHeadDropCalculation = true;
+// break;
+// }
+// default:
+// break;
+// }
+// }
+//
+// // TEMP... this has to be done more generically
+// private bool ValidateDoubleToRangeFromString(string aStringValue, double aMin, double aMax, ref double aValue)
+// {
+// double doubleValue = 0.0;
+//
+// // the CSV read would have changed all decimal separators to '.'
+// // specify this to the double parsing, else we'd get wrong values
+// // if the current thread has a diff decimal separator
+// NumberFormatInfo ni = new NumberFormatInfo();
+// ni.CurrencyDecimalSeparator = ".";
+// ni.NumberDecimalSeparator = ".";
+//
+// try
+// {
+// doubleValue = Double.Parse(aStringValue, ni);
+// }
+// catch
+// {
+// return false;
+// }
+//
+// if (doubleValue < aMin)
+// doubleValue = aMin;
+// else if (doubleValue > aMax)
+// doubleValue = aMax;
+//
+// aValue = doubleValue;
+// return true;
+// }
+//
+// private bool GetBoolValueFromString(string aStringValue, ref bool aValue)
+// {
+// bool boolValue = true;
+//
+// try
+// {
+// boolValue = bool.Parse(aStringValue);
+// }
+// catch
+// {
+// return false;
+// }
+//
+// aValue = boolValue;
+// return true;
+// }
+//
+ ///
+ ///
+ ///
+ ///
+ public List ParametersToStrings()
+ {
+ List parameterStrings = new List();
+
+ // soil properties
+ parameterStrings.Add(sPipingParametersSectionId);
+ parameterStrings.Add(String.Format("BeddingAngle={0}", fCurrentCalculationData.PipingCommonData.BeddingAngle));
+ parameterStrings.Add(String.Format("ParticleDiameter={0}", fCurrentCalculationData.ParticleDiameter));
+ parameterStrings.Add(String.Format("ParticleUnitWeight={0:0.00}",
+ fCurrentCalculationData.PipingCommonData.ParticleUnitWeight));
+ parameterStrings.Add(String.Format("WhitesConstant={0}",
+ fCurrentCalculationData.PipingCommonData.WhitesConstant));
+ //// water properties
+ parameterStrings.Add(String.Format("WaterUnitWeight={0:0.00}",
+ fCurrentCalculationData.PipingCommonData.WaterUnitWeight));
+ parameterStrings.Add(String.Format("WaterViscosity={0:E4}",
+ fCurrentCalculationData.PipingCommonData.WaterViscosity));
+
+ parameterStrings.Add(String.Format("CrackLength={0:0.00}", fCurrentCalculationData.CrackLength));
+ parameterStrings.Add(String.Format("HeadDrop={0:0.00}", fCurrentCalculationData.HeadDrop));
+ parameterStrings.Add(String.Format("SeepageLength={0:0.00}", fCurrentCalculationData.SeepageLength));
+
+ //// heights
+ parameterStrings.Add(String.Format("Height1={0:0.00}", fCurrentCalculationData.Height1));
+ parameterStrings.Add(String.Format("Height2={0:0.00}", fCurrentCalculationData.Height2));
+ //// permeabilities
+ parameterStrings.Add(String.Format("Permeability1={0:E5}", fCurrentCalculationData.Permeability1));
+ parameterStrings.Add(String.Format("Permeability2={0:E5}", fCurrentCalculationData.Permeability2));
+ parameterStrings.Add(String.Format("Permeability3={0:E5}", fCurrentCalculationData.Permeability3));
+
+ parameterStrings.Add(String.Format("IsHeadDropCalculation={0}",
+ fCurrentCalculationData.IsHeadDropCalculation));
+ parameterStrings.Add(String.Format("IsAdjustHeadDrop={0}",
+ fCurrentCalculationData.PipingCommonData.IsAdjustHeadDrop));
+ parameterStrings.Add(String.Format("SafetyFactor={0:0.00}",
+ fCurrentCalculationData.PipingCommonData.SafetyFactor));
+ parameterStrings.Add(String.Format("FluidisationGradient={0:0.00}",
+ fCurrentCalculationData.PipingCommonData.FluidisationGradient));
+
+ return parameterStrings;
+ }
+
+ }
+}
\ No newline at end of file
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalculationException.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalculationException.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.SellmeijerVNKCalculator/PipingCalculationException.cs (revision 371)
@@ -0,0 +1,29 @@
+namespace Deltares.DamPiping.SellmeijerVNKCalculator
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ [Serializable]
+ public class PipingCalculationException : Exception
+ {
+ public PipingCalculationException()
+ {
+ }
+
+ public PipingCalculationException(string message)
+ : base(message)
+ {
+ }
+
+ public PipingCalculationException(string message, Exception inner)
+ : base(message, inner)
+ {
+ }
+
+ protected PipingCalculationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ }
+}
\ No newline at end of file