using System;
using System.Drawing;
using System.Runtime.Serialization;
using Deltares.Geotechnics;
using Deltares.Geotechnics.Soils;
using Deltares.Probabilistic;
using Deltares.Stability;
namespace Deltares.MStab.IO.Classic
{
[Serializable]
public class SoilDataException : Exception
{
//
// For guidelines regarding the creation of new exception types, see
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
// and
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
//
public SoilDataException() {}
public SoilDataException(string message)
: base(message) {}
public SoilDataException(string message, Exception inner)
: base(message, inner) {}
protected SoilDataException(
SerializationInfo info,
StreamingContext context)
: base(info, context) {}
}
internal class SoilData
{
private StabilityModel mStabProject = null;
///
/// Manders Create new SoilList from classic MStab inputfile
///
public void GetSoilData(int handle, ref StabilityModel stabilityModel)
{
if (stabilityModel == null)
{
throw new SoilDataException("NewMStabProject not instantiated!");
}
mStabProject = stabilityModel;
if (stabilityModel.SoilModel == null)
{
throw new SoilDataException("SoilModel not instantiated!");
}
try
{
StressCurves(handle);
var lBuffer = new char[1024];
ClassicSoilFunctionDefinitions.SoilNameList soilNameList = null;
double lTempValue = -1;
GetClassicSoil.GetClassicSoilList(handle, ref soilNameList);
for (int nIndexI = 0; nIndexI < soilNameList.numberOfItems; nIndexI++)
{
if (!soilNameList.soilName[nIndexI].ToLower().Equals("undetermined"))
{
var lSoilItem = new Soil();
lSoilItem.Name = soilNameList.soilName[nIndexI];
lSoilItem.Description = soilNameList.soilName[nIndexI];
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilGamDry", ref lTempValue);
lSoilItem.AbovePhreaticLevel = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilGamWet", ref lTempValue);
lSoilItem.BelowPhreaticLevel = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilColor", ref lTempValue);
//RGB instead of BGR BitRotation is not implemented yet in C# so a quick and dirty alternative provided below
var Value = (int) lTempValue;
int bVal = Value & 0xff0000;
int gVal = Value & 0x00ff00;
int rVal = Value & 0x0000ff;
gVal = gVal >> 8;
bVal = bVal >> 16;
lSoilItem.Color = Color.FromArgb(rVal, gVal, bVal);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilMatStrengthType", ref lTempValue);
lSoilItem.UseDefaultShearStrengthModel = lTempValue == 0;
// original declaration : TMatStrengthTypeSet = (mstNone, mstCphi, mstStressTab, mstPseudoStressTab, mstMeasuredCu, mstCalculatedCu, mstGradientCu);
switch ((int) lTempValue)
{
case 0:
lSoilItem.UseDefaultShearStrengthInput = true;
break; // Use default.
case 1:
lSoilItem.ShearStrengthModel = ShearStrengthModel.CPhi;
break;
case 2:
lSoilItem.ShearStrengthModel = ShearStrengthModel.StressTable;
break;
case 3:
lSoilItem.ShearStrengthModel = ShearStrengthModel.PseudoValues;
break;
case 4:
lSoilItem.ShearStrengthModel = ShearStrengthModel.CuMeasured;
break;
case 5:
lSoilItem.ShearStrengthModel = ShearStrengthModel.CuCalculated;
break;
case 6:
lSoilItem.ShearStrengthModel = ShearStrengthModel.CuGradient;
break;
}
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilProbInputValues", ref lTempValue);
lSoilItem.UseDefaultShearStrengthInput = lTempValue == 0.0;
switch ((int) lTempValue)
{
case 1:
lSoilItem.InputModeReliabilityAnalysisOption = ReliabilityAnalysisOption.Mean;
break;
case 2:
lSoilItem.InputModeReliabilityAnalysisOption = ReliabilityAnalysisOption.Design;
break;
}
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCohesion", ref lTempValue);
lSoilItem.Cohesion = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilPhi", ref lTempValue);
lSoilItem.FrictionAngle = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilRatioCuPc", ref lTempValue);
lSoilItem.RatioCuPc = Math.Max(lTempValue, 0.0001);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilRatioCuPcPassive", ref lTempValue);
lSoilItem.RatioCuPcPassive = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilRatioCuPcActive", ref lTempValue);
lSoilItem.RatioCuPcActive = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilPOP", ref lTempValue);
lSoilItem.POP = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStrengthIncreaseExponent", ref lTempValue);
lSoilItem.StrengthIncreaseExponent = lTempValue;
//RRatio
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilRRatio", ref lTempValue);
lSoilItem.RRatio = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuTop", ref lTempValue);
lSoilItem.CuTop = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuActiveTop", ref lTempValue);
lSoilItem.CuActiveTop = Math.Max(lTempValue, 0.0001);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuPassiveTop", ref lTempValue);
lSoilItem.CuPassiveTop = Math.Max(lTempValue, 0.0001);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuBottom", ref lTempValue);
lSoilItem.CuBottom = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuActiveBottom", ref lTempValue);
lSoilItem.CuActiveBottom = Math.Max(lTempValue, 0.0001);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuPassiveBottom", ref lTempValue);
lSoilItem.CuPassiveBottom = Math.Max(lTempValue, 0.0001);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilCuGradient", ref lTempValue);
lSoilItem.CuGradient = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilExcessPorePressure", ref lTempValue);
lSoilItem.ExcessPorePressure = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilRestSlope", ref lTempValue);
var classicRestSlope = (int) lTempValue;
switch (classicRestSlope)
{
case 0:
lSoilItem.RestSlope = 2;
break;
case 1:
lSoilItem.RestSlope = 4;
break;
default:
lSoilItem.RestSlope = 0;
break;
}
//Add Sigma tau curve
var lClassicSigmaTau = new ClassicMStabFunctionDefinitions.Curves();
lClassicSigmaTau.itemName = new string(lBuffer);
//Get StressTableNames from Soil (bondstress and sigma tau)
ClassicSoilFunctionDefinitions.SoilParamListString lParamStringList = null;
GetClassicSoil.GetClassicSoilItemString(handle, soilNameList.soilName[nIndexI], ref lParamStringList);
if (lParamStringList.StressTableName.Equals("") == false)
{
var stressCurve = (StressCurve) stabilityModel.SoilModel.StressCurves.Find(x => x.Name == (lParamStringList.StressTableName));
lSoilItem.StressTable = stressCurve;
}
//retrieve the bondstress tables
else if (lParamStringList.SoilBondStressTableName.Equals("") == false)
{
var stressCurve = (BondStressCurve) stabilityModel.SoilModel.BondStressCurves.Find(x => x.Name == (lParamStringList.SoilBondStressTableName));
lSoilItem.BondStressTable = stressCurve;
}
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdCohesion", ref lTempValue);
lSoilItem.CohesionStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdCu", ref lTempValue);
lSoilItem.CuStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdCuGradient", ref lTempValue);
lSoilItem.CuGradientStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdCuTop", ref lTempValue);
lSoilItem.CuTopStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdPn", ref lTempValue);
lSoilItem.PnStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdPhi", ref lTempValue);
lSoilItem.FrictionAngleStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdPOP", ref lTempValue);
lSoilItem.POPStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdRatioCuPc", ref lTempValue);
lSoilItem.RatioCuPcStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdRatioCuPcActive", ref lTempValue);
lSoilItem.RatioCuPcActiveStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdRatioCuPcPassive", ref lTempValue);
lSoilItem.RatioCuPcPassiveStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilStdRRatio", ref lTempValue);
lSoilItem.RRatioStochast.Deviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistCohesion", ref lTempValue);
lSoilItem.CohesionStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistCu", ref lTempValue);
lSoilItem.CuStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistCuGradient", ref lTempValue);
lSoilItem.CuGradientStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistCuTop", ref lTempValue);
lSoilItem.CuTopStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistPhi", ref lTempValue);
lSoilItem.FrictionAngleStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistPn", ref lTempValue);
lSoilItem.PnStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistPOP", ref lTempValue);
lSoilItem.POPStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistRatioCuPc", ref lTempValue);
lSoilItem.RatioCuPcStochast.DistributionType = ConvertToDistributionType(lTempValue);
lSoilItem.RatioCuPcStochast.Shift = 0.0001; // As the minimum value of RatioCuPc = 0.0001, set the shift the same to prevent validation error
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistRatioCuPcActive", ref lTempValue);
lSoilItem.RatioCuPcActiveStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistRatioCuPcPassive", ref lTempValue);
lSoilItem.RatioCuPcPassiveStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistRRatio", ref lTempValue);
lSoilItem.RRatioStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDistStressTable", ref lTempValue);
lSoilItem.StressTableStochast.DistributionType = ConvertToDistributionType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilFormReferencePn", ref lTempValue);
lSoilItem.FormReferencePn = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignStdPOP", ref lTempValue);
lSoilItem.POPStochast.DesignDeviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignStdCohesion", ref lTempValue);
lSoilItem.CohesionStochast.DesignDeviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignStdPhi", ref lTempValue);
lSoilItem.FrictionAngleStochast.DesignDeviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignStdCu", ref lTempValue);
lSoilItem.CuStochast.DesignDeviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignStdRatioCuPc", ref lTempValue);
lSoilItem.RatioCuPcStochast.DesignDeviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignStdRRatio", ref lTempValue);
lSoilItem.RRatioStochast.DesignDeviation = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignPartialPOP", ref lTempValue);
lSoilItem.POPStochast.DesignFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignPartialCohesion", ref lTempValue);
lSoilItem.CohesionStochast.DesignFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignPartialPhi", ref lTempValue);
lSoilItem.FrictionAngleStochast.DesignFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignPartialCu", ref lTempValue);
lSoilItem.CuStochast.DesignFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignPartialRatioCuPc", ref lTempValue);
lSoilItem.RatioCuPcStochast.DesignFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilDesignPartialRRatio", ref lTempValue);
lSoilItem.RRatioStochast.DesignFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilExcessPorePressure", ref lTempValue);
lSoilItem.ExcessPorePressure = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilPorePressureFactor", ref lTempValue);
lSoilItem.PorePressureFactor = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilUseProbDefaults", ref lTempValue);
lSoilItem.UseDefaultProbabilisticValues = lTempValue == 1.0;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilSoilGroup", ref lTempValue);
lSoilItem.SoilGroup = Convert.ToInt32(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilSoilType", ref lTempValue);
lSoilItem.SoilType = ConvertToSoilType(lTempValue);
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilBeddingAngle", ref lTempValue);
lSoilItem.BeddingAngle = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilPermeabKx", ref lTempValue);
lSoilItem.PermeabKx = lTempValue;
GetClassicSoil.GetClassicSoilParamValueDouble(handle, soilNameList.soilName[nIndexI], "SoilWhitesConstant", ref lTempValue);
lSoilItem.WhitesConstant = lTempValue;
stabilityModel.SoilModel.Create(lSoilItem);
}
}
//Select default soil (0)
if (stabilityModel.SoilModel.Soils.Count > 0)
{
stabilityModel.SoilModel.DefaultStabilitySoilMaterial = stabilityModel.SoilModel.Soils[0];
}
}
catch (Exception e)
{
throw e;
}
}
public void GetProbabilisticDefaults(int handle, StabilityModel stabilityModel)
{
ClassicMStabFunctionDefinitions.MStabProbabilisticDefaults oldDefaults = null;
GetClassicMStab.GetClassicProbabilisticDefaults(handle, ref oldDefaults);
var newDefaults = new ProbabilisticDefaults();
stabilityModel.ProbabilisticDefaults = newDefaults;
newDefaults.CohesionStochast.DesignFactor = oldDefaults.cohesionDesignPartial;
newDefaults.CohesionStochast.DesignDeviation = oldDefaults.cohesionDesignStdDev;
newDefaults.CohesionStochast.DistributionType = ConvertToDistributionType(oldDefaults.cohesionDistribution);
newDefaults.CohesionStochast.Variation = oldDefaults.cohesionVariationTotal;
newDefaults.CompressionStochast.DesignFactor = oldDefaults.compressionRatioDesignPartial;
newDefaults.CompressionStochast.DesignDeviation = oldDefaults.compressionRatioDesignStdDev;
newDefaults.CompressionStochast.DistributionType = ConvertToDistributionType(oldDefaults.compressionRatioDistribution);
newDefaults.CompressionStochast.Variation = oldDefaults.compressionRatioVariationTotal;
newDefaults.ConsolidationStochast.DesignFactor = oldDefaults.consolidationCoefDesignPartial;
newDefaults.ConsolidationStochast.DesignDeviation = oldDefaults.consolidationCoefDesignStdDev;
newDefaults.ConsolidationStochast.DistributionType = ConvertToDistributionType(oldDefaults.consolidationCoefDistribution);
newDefaults.ConsolidationStochast.Deviation = oldDefaults.consolidationCoefTotalStdDev;
newDefaults.CuStochast.DesignFactor = oldDefaults.cuDesignPartial;
newDefaults.CuStochast.DesignDeviation = oldDefaults.cuDesignStdDev;
newDefaults.CuStochast.DistributionType = ConvertToDistributionType(oldDefaults.cuDistribution);
newDefaults.CuStochast.Variation = oldDefaults.cuVariationTotal;
newDefaults.HydraulicPressureStochast.DesignFactor = oldDefaults.hydraulicPressureDesignPartial;
newDefaults.HydraulicPressureStochast.DesignDeviation = oldDefaults.hydraulicPressureDesignStdDev;
newDefaults.HydraulicPressureStochast.DistributionType = ConvertToDistributionType(oldDefaults.hydraulicPressureDistribution);
newDefaults.HydraulicPressureStochast.Deviation = oldDefaults.hydraulicPressureTotalStdDev;
newDefaults.FrictionAngleStochast.DesignFactor = oldDefaults.phiDesignPartial;
newDefaults.FrictionAngleStochast.DesignDeviation = oldDefaults.phiDesignStdDev;
newDefaults.FrictionAngleStochast.DistributionType = ConvertToDistributionType(oldDefaults.phiDistribution);
newDefaults.FrictionAngleStochast.Variation = oldDefaults.phiVariationTotal;
newDefaults.POPStochast.DesignFactor = oldDefaults.popDesignPartial;
newDefaults.POPStochast.DesignDeviation = oldDefaults.popDesignStdDev;
newDefaults.POPStochast.DistributionType = ConvertToDistributionType(oldDefaults.popDistribution);
newDefaults.POPStochast.Variation = oldDefaults.popVariationTotal;
newDefaults.RatioCuPcStochast.DesignFactor = oldDefaults.ratioCuPcDesignPartial;
newDefaults.RatioCuPcStochast.DesignDeviation = oldDefaults.ratioCuPcDesignStdDev;
newDefaults.RatioCuPcStochast.DistributionType = ConvertToDistributionType(oldDefaults.ratioCuPcDistribution);
newDefaults.RatioCuPcStochast.Variation = oldDefaults.ratioCuPcVariationTotal;
newDefaults.StressTableStochast.DesignFactor = oldDefaults.stressTableDesignPartial;
newDefaults.StressTableStochast.DesignDeviation = oldDefaults.stressTableDesignStdDev;
newDefaults.StressTableStochast.DistributionType = ConvertToDistributionType(oldDefaults.stressTableDistribution);
newDefaults.StressTableStochast.Variation = oldDefaults.stressTableVariationTotal;
newDefaults.LimitValueBishopStochast.DistributionType = ConvertToDistributionType(oldDefaults.limitValueBishopDistribution);
newDefaults.LimitValueBishopStochast.Mean = oldDefaults.limitValueBishopMean;
newDefaults.LimitValueBishopStochast.Deviation = oldDefaults.limitValueBishopStdDev;
newDefaults.LimitValueVanStochast.DistributionType = ConvertToDistributionType(oldDefaults.limitValueVanDistribution);
newDefaults.LimitValueVanStochast.Mean = oldDefaults.limitValueVanMean;
newDefaults.LimitValueVanStochast.Deviation = oldDefaults.limitValueVanStdDev;
}
///
/// Manders SigmaTau stresscurve list
///
private void StressCurves(int handle)
{
if (mStabProject.SoilModel == null)
{
throw new SoilDataException("Soilmodel not instantiated!");
}
//determine dowel action and pull out action, regarding soil resistance of reinforcements
var soilResistance = new ClassicMStabFunctionDefinitions.MStabSoilResistance();
GetClassicSoil.GetClassicSoilResistance(handle, ref soilResistance);
if (soilResistance.soilResistanceDowelAction == 0)
{
mStabProject.NailLateralStress = NailLateralStress.Ultimate;
}
else
{
mStabProject.NailLateralStress = NailLateralStress.Soil;
}
if (soilResistance.soilResistancePullOut == 0)
{
mStabProject.NailShearStress = NailShearStress.Ultimate;
}
else
{
mStabProject.NailShearStress = NailShearStress.Bond;
}
//get bond stress diagrams, set bondstresscurves
ClassicMStabFunctionDefinitions.MStabBondStressDiagrams bondStressDiagrams = null;
GetClassicSoil.GetClassicMStabBondStresses(handle, ref bondStressDiagrams);
for (int curveIndex = 0; curveIndex < bondStressDiagrams.numberOfEntries; curveIndex++)
{
var bondStressCurve = new BondStressCurve();
for (int i = 0; i < bondStressDiagrams.curves[curveIndex].stressPointCount; i++)
{
ClassicMStabFunctionDefinitions.StressPoint point = bondStressDiagrams.curves[curveIndex].stressPoint[i];
var bond = new BondStress();
bond.Sigma = point.sigma;
bond.Tau = point.tau;
bondStressCurve.AddBondStress(bond, i);
}
mStabProject.SoilModel.Create(bondStressCurve);
if (bondStressCurve.GetType() == typeof(BondStressCurve))
{
//Item name used as ID in old mstab so:
mStabProject.SoilModel.BondStressCurves[mStabProject.SoilModel.BondStressCurves.Count - 1].Name = //.Description =
bondStressDiagrams.curves[curveIndex].itemName;
}
}
//sigma tau
ClassicMStabFunctionDefinitions.MStabSigmaTauCurves curves = null;
GetClassicSoil.GetClassicMStabSigmaTau(handle, ref curves);
for (int curveIndex = 0; curveIndex < curves.numberOfEntries; curveIndex++)
{
var stresscurve = new StressCurve();
stresscurve.NumberOfTest = curves.curves[curveIndex].numberOfTests;
for (int i = 0; i < curves.curves[curveIndex].stressPointCount; i++)
{
ClassicMStabFunctionDefinitions.StressPoint point = curves.curves[curveIndex].stressPoint[i];
var sigmaTau = new SigmaTau();
sigmaTau.Sigma = point.sigma;
sigmaTau.Tau = point.tau;
sigmaTau.TauCharacteristic = point.tauCharacteristic;
sigmaTau.TauMean = point.tauMean;
stresscurve.SigmaTaus.Add(sigmaTau);
}
mStabProject.SoilModel.Create(stresscurve);
//Item name used as ID in old mstab so:
mStabProject.SoilModel.StressCurves[mStabProject.SoilModel.StressCurves.Count - 1].Name = curves.curves[curveIndex].itemName;
}
}
private DistributionType ConvertToDistributionType(double lTempValue)
{
int classicDistribution = Convert.ToInt32(lTempValue);
switch (classicDistribution)
{
case 0:
return DistributionType.Deterministic;
case 1:
return DistributionType.Uniform;
case 2:
return DistributionType.Normal;
case 3:
return DistributionType.LogNormal;
case 4:
return DistributionType.Exponential;
default:
throw new Exception("Cannot convert distribution type: " + classicDistribution);
}
}
private SoilType ConvertToSoilType(double lTempValue)
{
int soilTypeIndex = Convert.ToInt32(lTempValue);
switch (soilTypeIndex)
{
case 0:
return SoilType.Sand;
case 1:
return SoilType.Peat;
case 2:
return SoilType.Loam;
case 3:
return SoilType.Clay;
case 4:
return SoilType.Gravel;
default:
throw new Exception("Cannot convert soil type: " + soilTypeIndex);
}
}
}
}