Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs =================================================================== diff -u -r435 -r444 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs (.../DesignResult.cs) (revision 435) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/DesignResult.cs (.../DesignResult.cs) (revision 444) @@ -21,16 +21,17 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; using Deltares.DamEngine.Data.Design; -using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Data.Standard; using Deltares.DamEngine.Data.Standard.Calculation; namespace Deltares.DamEngine.Data.General.Results { + /// + /// Contains the results for the design calculations. + /// + /// public class DesignResult : ICloneable { private string id; @@ -40,143 +41,92 @@ private string locationName; private string scenarioName; - - - - private double? failureProbabilityPiping; - private double? localPipingExitPointX; - private SurfaceLine2 redesignedSurfaceLinePiping; - private double? safetyFactorStability; - private double? failureProbabilityStability; - private double? zone1SafetyFactorStability; - private double? localZone1EntryPointX; - private double? localZone1ExitPointX; - private double? zone2SafetyFactorStability; - private double? localZone2EntryPointX; - private double? localZone2ExitPointX; - private double? upliftFactor; - private double? heaveFactor; - private double? blighPipingFactor; - private double? blighHCritical; - private double? sellmeijer4ForcesPipingFactor; - private double? sellmeijer4ForcesHCritical; - private double? sellmeijerPipingFactor; - private double? sellmeijerHCritical; - private double? wti2017PipingFactor; - private double? wti2017HCritical; - private bool? isUplift; - private double? pl3MinUplift; - private double? pl3HeadAdjusted; - private double? pl3LocalLocationXMinUplift; - private double? pl4MinUplift; - private double? pl4HeadAdjusted; - private double? pl4LocalLocationXMinUplift; - private readonly string nwoId; - private readonly int nwoResultIndex; - private double? locationXrdStart; - private double? locationYrdStart; - private readonly double? locationZrdStart; - private double? locationXrdEnd; - private double? locationYrdEnd; - private readonly double? locationZrdEnd; + private string profileName; + private double? safetyFactor; + private double? failureProbability; private CalculationResult calculationResult = CalculationResult.NoRun; - private string resultMessage = ""; - private int numberOfIterations; - private SurfaceLine2 redesignedSurfaceLineStability; - public DesignResult() - { - } - - //temp place holders, must be removed/replaced as these are not realy part of results + private NwoDesignResults nwoDesignResults; + private StabilityDesignResults stabilityDesignResults; + private PipingDesignResults pipingDesignResults; + + + /// + /// Gets or sets the dam failure mechanisme calculation. + /// Note: this is a placeholder, not to be part of the results as written to xml + /// + /// + /// The dam failure mechanisme calculation. + /// public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculation { get; set; } - public AnalysisType AnalysisType { get; set; } // if realy needed, move to proper location (stability) - public ProbabilisticType ProbabilisticType { get; set; } // if realy needed, move to proper location (stability) + + /// + /// Gets or sets the scenario. + /// Note: this is a placeholder, not to be part of the results as written to xml + /// + /// + /// The scenario. + /// public DesignScenario Scenario { get; set; } - public double? DikeLength { get; set; } - public CalculationResult CalculationResult // derived result, involves ResultMessage, mstabResults (stab) or PipingFactor == null && this.PipingFailureProbability + + /// + /// Gets or sets the length of the dike as derived value. + /// Note: this is a placeholder, not to be part of the results as written to xml. + /// It is currently used by the DamProjectCalculator. + /// + /// + /// The length of the dike. + /// + public double? DikeLength { - get { return calculationResult;} - set{calculationResult = value;} - } - public double? SafetyFactor // derived result - { get { - double? res = null; + double? maxDikeLength = null; + List dikeLengths = new List(); + SurfaceLine2 surfaceLine = Scenario.Location.SurfaceLine2; + if (surfaceLine != null) + dikeLengths.Add(surfaceLine.GetDikeLength()); switch (DamFailureMechanismeCalculation.FailureMechanismSystemType) { - case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityOutside: case FailureMechanismSystemType.StabilityInside: - res = StabilitySafetyFactor; + if (stabilityDesignResults.RedesignedSurfaceLine != null) + dikeLengths.Add(stabilityDesignResults.RedesignedSurfaceLine.GetDikeLength()); break; case FailureMechanismSystemType.Piping: - res = PipingFactor; + if (pipingDesignResults.RedesignedSurfaceLine != null) + dikeLengths.Add(pipingDesignResults.RedesignedSurfaceLine.GetDikeLength()); break; } - return res; - } - } - public double? PipingFactor // derived result - { - get - { - double? res = null; - if (DamFailureMechanismeCalculation.FailureMechanismSystemType == FailureMechanismSystemType.Piping) - { - switch (DamFailureMechanismeCalculation.PipingModelType) - { - case PipingModelType.Bligh: - res = BlighPipingFactor; - break; - case PipingModelType.SellmeijerVnk: - res = SellmeijerPipingFactor; - break; - case PipingModelType.Sellmeijer4Forces: - res = Sellmeijer4ForcesPipingFactor; - break; - case PipingModelType.Wti2017: - res = Wti2017PipingFactor; - break; - } - } - return res; - } - } - public double? FailureProbability // derived result - { - get - { - double? res = null; - switch (DamFailureMechanismeCalculation.FailureMechanismSystemType) + foreach (double? dikeLength in dikeLengths) { - case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityOutside: - case FailureMechanismSystemType.StabilityInside: - res = StabilityFailureProbability; - break; - case FailureMechanismSystemType.Piping: - res = PipingFailureProbability; - break; + if (dikeLength.HasValue && (!maxDikeLength.HasValue || maxDikeLength < dikeLength)) + maxDikeLength = dikeLength; } - return res; + return maxDikeLength; } } - //Identifiers, needed to retrace the origin of the result - public string LocationName - { - get { return locationName; } - } - public string ScenarioName // input, not result + /// + /// Initializes a new instance of the class. + /// Is only to be used by this.Clone(), nowhere else + /// + internal DesignResult() { - get { return scenarioName; } + // only for Clone() method } - public string StabilityProfileName { get; set; } //methode terughalen uit csvexport indien nodig - + /// + /// Initializes a new instance of the class. + /// + /// The identifier. + /// The dam failure mechanisme calculation specification. + /// The scenario. + /// The soil profile. + /// Name of the soil geometry2 d. + /// Type of the analysis. + /// Index of the nwo result. + /// Type of the probabilistic. public DesignResult(string id, DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification, DesignScenario scenario, SoilProfile1D soilProfile, string soilGeometry2DName, AnalysisType analysisType, int nwoResultIndex, ProbabilisticType probabilisticType) { @@ -185,491 +135,341 @@ yrd = scenario.Location.YRd; locationName = scenario.Location.Name; scenarioName = scenario.LocationScenarioID; // terughalen vanuit csvexport indien echt nodig - this.BaseFileName = ""; + baseFileName = ""; DamFailureMechanismeCalculation = damFailureMechanismeCalculationSpecification; -// this.scenario = scenario; -// this.soilProfile = soilProfile; -// this.SoilGeometry2DName = soilGeometry2DName; - this.failureProbabilityPiping = null; - this.redesignedSurfaceLinePiping = null; - this.safetyFactorStability = null; - this.failureProbabilityStability = null; - this.redesignedSurfaceLineStability = null; - this.zone1SafetyFactorStability = null; - this.LocalZone1EntryPointX = null; - this.LocalZone1ExitPointX = null; - this.zone2SafetyFactorStability = null; - this.LocalZone2EntryPointX = null; - this.LocalZone2ExitPointX = null; - this.blighPipingFactor = null; - this.blighHCritical = null; - this.sellmeijer4ForcesPipingFactor = null; - this.sellmeijer4ForcesHCritical = null; - this.sellmeijerPipingFactor = null; - this.sellmeijerHCritical = null; - this.wti2017PipingFactor = null; - this.wti2017HCritical = null; - this.isUplift = null; - this.pl3MinUplift = null; - this.pl3HeadAdjusted = null; - this.pl3LocalLocationXMinUplift = null; - this.pl4MinUplift = null; - this.pl4HeadAdjusted = null; - this.pl4LocalLocationXMinUplift = null; - this.nwoId = ""; - this.nwoResultIndex = nwoResultIndex; - this.locationXrdStart = null; - this.locationXrdEnd = null; - this.locationYrdStart = null; - this.locationYrdEnd = null; - this.locationZrdStart = null; - this.locationZrdEnd = null; - + Scenario = scenario; + if (damFailureMechanismeCalculationSpecification != null) { switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityInside: case FailureMechanismSystemType.StabilityOutside: - + profileName = soilGeometry2DName; if (analysisType == AnalysisType.AdaptNWO) { // an index of 0 can also indicate an error message. That has no futher data so check if there actualy is any. if (scenario.NwoResults.Count > 0) { - this.nwoId = scenario.NwoResults[nwoResultIndex].NwoId; - this.locationXrdStart = scenario.NwoResults[nwoResultIndex].LocationXrdStart; - this.locationYrdStart = scenario.NwoResults[nwoResultIndex].LocationYrdStart; - this.locationZrdStart = scenario.NwoResults[nwoResultIndex].LocationZrdStart; - this.locationXrdEnd = scenario.NwoResults[nwoResultIndex].LocationXrdEnd; - this.locationYrdEnd = scenario.NwoResults[nwoResultIndex].LocationYrdEnd; - this.locationZrdEnd = scenario.NwoResults[nwoResultIndex].LocationZrdEnd; - this.BaseFileName = scenario.NwoResults[nwoResultIndex].MStabResults.CalculationName; - this.numberOfIterations = scenario.NwoResults[nwoResultIndex].MStabResults.IterationNumber; - this.safetyFactorStability = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.safetyFactor; - this.zone1SafetyFactorStability = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.safetyFactor; - this.LocalZone1EntryPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.entryPointXCoordinate; - this.LocalZone1ExitPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.exitPointXCoordinate; + nwoDesignResults = new NwoDesignResults + { + NwoId = scenario.NwoResults[nwoResultIndex].NwoId, + LocationXrdStart = scenario.NwoResults[nwoResultIndex].LocationXrdStart, + LocationYrdStart = scenario.NwoResults[nwoResultIndex].LocationYrdStart, + LocationZrdStart = scenario.NwoResults[nwoResultIndex].LocationZrdStart, + LocationXrdEnd = scenario.NwoResults[nwoResultIndex].LocationXrdEnd, + LocationYrdEnd = scenario.NwoResults[nwoResultIndex].LocationYrdEnd, + LocationZrdEnd = scenario.NwoResults[nwoResultIndex].LocationZrdEnd, + NumberOfIterations = scenario.NwoResults[nwoResultIndex].MStabResults.IterationNumber, + SafetyFactor = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.safetyFactor, + Zone1SafetyFactor = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.safetyFactor, + LocalZone1EntryPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.entryPointXCoordinate, + LocalZone1ExitPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.exitPointXCoordinate, + ResultIndex = nwoResultIndex + }; + if (scenario.NwoResults[nwoResultIndex].MStabResults.zone2 != null) { - this.zone2SafetyFactorStability = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.safetyFactor; - this.LocalZone2EntryPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.entryPointXCoordinate; - this.LocalZone2ExitPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.exitPointXCoordinate; + nwoDesignResults.Zone2SafetyFactor = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.safetyFactor; + nwoDesignResults.LocalZone2EntryPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.entryPointXCoordinate; + nwoDesignResults.LocalZone2ExitPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.exitPointXCoordinate; } + baseFileName = scenario.NwoResults[nwoResultIndex].MStabResults.CalculationName; } } else { + stabilityDesignResults = new StabilityDesignResults(); MStabResults? mstabResults = scenario.GetMStabResults(soilProfile, soilGeometry2DName); - this.resultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName); - calculationResult = DetermineStabilityCalculationResult(this.resultMessage, mstabResults); + stabilityDesignResults.ResultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName); + calculationResult = DetermineStabilityCalculationResult(stabilityDesignResults.ResultMessage, mstabResults); if (mstabResults != null) { - BaseFileName = mstabResults.Value.CalculationName; - numberOfIterations = mstabResults.Value.IterationNumber; - this.safetyFactorStability = mstabResults.Value.zone1.safetyFactor; - this.zone1SafetyFactorStability = mstabResults.Value.zone1.safetyFactor; - this.LocalZone1EntryPointX = mstabResults.Value.zone1.entryPointXCoordinate; - this.LocalZone1ExitPointX = mstabResults.Value.zone1.exitPointXCoordinate; + baseFileName = mstabResults.Value.CalculationName; + stabilityDesignResults.NumberOfIterations = mstabResults.Value.IterationNumber; + stabilityDesignResults.SafetyFactor = mstabResults.Value.zone1.safetyFactor; + stabilityDesignResults.Zone1SafetyFactor = mstabResults.Value.zone1.safetyFactor; + stabilityDesignResults.LocalZone1EntryPointX = mstabResults.Value.zone1.entryPointXCoordinate; + stabilityDesignResults.LocalZone1ExitPointX = mstabResults.Value.zone1.exitPointXCoordinate; if (mstabResults.Value.zone2 != null) { - this.zone2SafetyFactorStability = mstabResults.Value.zone2.Value.safetyFactor; - this.LocalZone2EntryPointX = mstabResults.Value.zone2.Value.entryPointXCoordinate; - this.LocalZone2ExitPointX = mstabResults.Value.zone2.Value.exitPointXCoordinate; + stabilityDesignResults.Zone2SafetyFactor = mstabResults.Value.zone2.Value.safetyFactor; + stabilityDesignResults.LocalZone2EntryPointX = mstabResults.Value.zone2.Value.entryPointXCoordinate; + stabilityDesignResults.LocalZone2ExitPointX = mstabResults.Value.zone2.Value.exitPointXCoordinate; } } } - this.failureProbabilityStability = scenario.GetFailureProbabilityStability(soilProfile, soilGeometry2DName); - this.redesignedSurfaceLineStability = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName); + stabilityDesignResults.FailureProbability = scenario.GetFailureProbabilityStability(soilProfile, soilGeometry2DName); + failureProbability = stabilityDesignResults.FailureProbability; + stabilityDesignResults.RedesignedSurfaceLine = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName); UpliftSituation? upliftSituation = scenario.GetStabilityUpliftSituation(soilProfile, soilGeometry2DName); if (upliftSituation != null) { - SetUpliftSituationResults(upliftSituation.Value); + stabilityDesignResults.UpliftSituation = upliftSituation; } - break; case FailureMechanismSystemType.Piping: - - this.failureProbabilityPiping = scenario.GetFailureProbabilityPiping(soilProfile, soilGeometry2DName); - this.resultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName); - this.redesignedSurfaceLinePiping = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName); + pipingDesignResults = new PipingDesignResults(damFailureMechanismeCalculationSpecification.PipingModelType); + profileName = soilProfile.Name; + pipingDesignResults.FailureProbability = scenario.GetFailureProbabilityPiping(soilProfile, soilGeometry2DName); + failureProbability = pipingDesignResults.FailureProbability; + pipingDesignResults.ResultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName); + pipingDesignResults.RedesignedSurfaceLine = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName); UpliftSituation? upliftSituationPiping = scenario.GetStabilityUpliftSituation(soilProfile, soilGeometry2DName); if (upliftSituationPiping != null) { - SetUpliftSituationResults(upliftSituationPiping.Value); + pipingDesignResults.UpliftSituation = upliftSituationPiping; } PipingResults? pipingResults = scenario.GetPipingResults(soilProfile, soilGeometry2DName); if (pipingResults != null) { - BaseFileName = pipingResults.Value.CalculationName; - this.blighPipingFactor = pipingResults.Value.BlighPipingFactor; - this.blighHCritical = pipingResults.Value.BlighHCritical; - this.sellmeijer4ForcesPipingFactor = pipingResults.Value.Sellmeijer4ForcesPipingFactor; - this.sellmeijer4ForcesHCritical = pipingResults.Value.Sellmeijer4ForcesHCritical; - this.sellmeijerPipingFactor = pipingResults.Value.SellmeijerVnkPipingFactor; - this.sellmeijerHCritical = pipingResults.Value.SellmeijerVnkHCritical; - this.wti2017PipingFactor = pipingResults.Value.Wti2017PipingFactor; - this.wti2017HCritical = pipingResults.Value.Wti2017HCritical; - this.localPipingExitPointX = pipingResults.Value.PipingExitPointX; - this.heaveFactor = pipingResults.Value.HeaveFactor; - this.upliftFactor = pipingResults.Value.UpliftFactor; + baseFileName = pipingResults.Value.CalculationName; + pipingDesignResults.BlighFactor = pipingResults.Value.BlighPipingFactor; + pipingDesignResults.BlighHcritical = pipingResults.Value.BlighHCritical; + pipingDesignResults.Sellmeijer4ForcesFactor = pipingResults.Value.Sellmeijer4ForcesPipingFactor; + pipingDesignResults.Sellmeijer4ForcesHcritical = pipingResults.Value.Sellmeijer4ForcesHCritical; + pipingDesignResults.SellmeijerVnkFactor = pipingResults.Value.SellmeijerVnkPipingFactor; + pipingDesignResults.SellmeijerVnkHcritical = pipingResults.Value.SellmeijerVnkHCritical; + pipingDesignResults.Wti2017Factor = pipingResults.Value.Wti2017PipingFactor; + pipingDesignResults.Wti2017Hcritical = pipingResults.Value.Wti2017HCritical; + pipingDesignResults.LocalExitPointX = pipingResults.Value.PipingExitPointX; + pipingDesignResults.HeaveFactor = pipingResults.Value.HeaveFactor; + pipingDesignResults.UpliftFactor = pipingResults.Value.UpliftFactor; } - this.calculationResult = (this.PipingFactor == null && PipingFailureProbability == null) ? CalculationResult.RunFailed : CalculationResult.Succeeded; + calculationResult = (pipingDesignResults.SafetyFactor() == null && pipingDesignResults.FailureProbability == null) ? CalculationResult.RunFailed : CalculationResult.Succeeded; break; } } } /// - /// Determines the stability calculation run result. + /// Gets the identifier. /// - /// The result message. - /// The mstab results. - /// - private CalculationResult DetermineStabilityCalculationResult(string message, MStabResults? mstabResults) + /// + /// The identifier. + /// + public string Id { - CalculationResult result; - if ((message != null) && message.Contains("FAIL")) - { - result = CalculationResult.UnexpectedError; - } - else - { - // If no failure and no results, then no run has been made - result = mstabResults != null ? CalculationResult.Succeeded : CalculationResult.NoRun; - } - return result; + get { return id; } } /// - /// Sets the uplift situation results. + /// Gets the XRD. /// - /// The uplift situation. - private void SetUpliftSituationResults(UpliftSituation upliftSituation) + /// + /// The XRD. + /// + public double Xrd { - this.isUplift = upliftSituation.IsUplift; - if (upliftSituation.Pl3MinUplift < double.MaxValue) - { - this.pl3MinUplift = upliftSituation.Pl3MinUplift; - } - if (upliftSituation.Pl3HeadAdjusted < double.MaxValue) - { - this.pl3HeadAdjusted = upliftSituation.Pl3HeadAdjusted; - } - if (upliftSituation.Pl3LocationXMinUplift < double.MaxValue) - { - this.pl3LocalLocationXMinUplift = upliftSituation.Pl3LocationXMinUplift; - } - if (upliftSituation.Pl4MinUplift < double.MaxValue) - { - this.pl4MinUplift = upliftSituation.Pl4MinUplift; - } - if (upliftSituation.Pl4HeadAdjusted < double.MaxValue) - { - this.pl4HeadAdjusted = upliftSituation.Pl4HeadAdjusted; - } - if (upliftSituation.Pl4LocationXMinUplift < double.MaxValue) - { - this.pl4LocalLocationXMinUplift = upliftSituation.Pl4LocationXMinUplift; - } - } - - public int NumberOfIterations // real results for NWo - { - get { return numberOfIterations; } - set { numberOfIterations = value; } - } - - public string ID - { - get { return this.id; } - } - - public string ResultMessage // real result - { - get { return resultMessage; } - set { resultMessage = value; } - } - - public double Xrd //Xrd iput but very usefull as output as well - { get { return xrd; } } - public double Yrd //Yrd iput but very usefull as output as well + /// + /// Gets the yrd. + /// + /// + /// The yrd. + /// + public double Yrd { get { return yrd; } } - public double? StabilitySafetyFactor // real result stab and nwostab + //Identifiers, needed to retrace the origin of the result + /// + /// Gets the name of the location. + /// For identification purpose + /// + /// + /// The name of the location. + /// + public string LocationName { - get { return this.safetyFactorStability; } - set { this.safetyFactorStability = value; } + get { return locationName; } } - public double? StabilityFailureProbability // real result stab + /// + /// Gets the name of the scenario. + /// For identification purpose + /// + /// + /// The name of the scenario. + /// + public string ScenarioName { - get { return this.failureProbabilityStability; } - set { this.failureProbabilityStability = value; } + get { return scenarioName; } } - public double? PipingFailureProbability // real result piping + /// + /// Gets or sets the name of the profile. + /// For identification purpose + /// + /// + /// The name of the profile. + /// + public string ProfileName { - get { return this.failureProbabilityPiping; } - set { this.failureProbabilityPiping = value; } + get + { + return profileName; + } + set + { + profileName = value; + } } - public double? Zone1SafetyFactorStability // real result for stab and nwostab + /// + /// Gets or sets the name of the base file. + /// + /// + /// The name of the base file. + /// Can be used to retrace results files. + /// + public string BaseFileName // real result for all. { - get { return this.zone1SafetyFactorStability; } - set { this.zone1SafetyFactorStability = value; } + get { return baseFileName; } + set { baseFileName = value; } } - public double? LocalZone1EntryPointX // real result for stab and nwostab + /// + /// Gets or sets the calculation result. + /// This is a derived result. + /// + /// + /// The calculation result. + /// + public CalculationResult CalculationResult { - get { return localZone1EntryPointX; } - set { localZone1EntryPointX = value; } + get { return calculationResult; } + set { calculationResult = value; } } - public double? LocalZone1ExitPointX // real result stab and nwostab + /// + /// Gets the safety factor (derived result). + /// + /// + /// The safety factor. + /// + public double? SafetyFactor { - get { return localZone1ExitPointX; } - set { localZone1ExitPointX = value; } + get + { + return safetyFactor; + } + set + { + safetyFactor = value; + } } - public double? Zone2SafetyFactorStability // real result stab and nwostab + /// + /// Gets or sets the failure probability (derived result). + /// + /// + /// The failure probability. + /// + public double? FailureProbability { - get { return this.zone2SafetyFactorStability; } - set { this.zone2SafetyFactorStability = value; } + get + { + return failureProbability; + } + set + { + failureProbability = value; + } } - - public double? LocalZone2EntryPointX // real result stab and nwostab + /// + /// Gets or sets the nwo design results. + /// + /// + /// The nwo design results. + /// + public NwoDesignResults NwoDesignResults { - get { return localZone2EntryPointX; } - set { localZone2EntryPointX = value; } + get + { + return nwoDesignResults; + } + set + { + nwoDesignResults = value; + } } - public double? LocalZone2ExitPointX // real result stab and nwostab - { - get { return localZone2ExitPointX; } - set { localZone2ExitPointX = value; } - } - - public bool? IsUplift // real result stab and piping - { - get { return this.isUplift; } - set { this.isUplift = value; } - } - - public double? Pl3MinUplift // real result stab and piping - { - get { return this.pl3MinUplift; } - set { this.pl3MinUplift = value; } - } - - public double? Pl3HeadAdjusted // real result stab and piping - { - get { return this.pl3HeadAdjusted; } - set { this.pl3HeadAdjusted = value; } - } - - public double? Pl3LocalLocationXMinUplift // real result stab and piping - { - get { return this.pl3LocalLocationXMinUplift; } - set { this.pl3LocalLocationXMinUplift = value; } - } - - public double? Pl4MinUplift // real result stab and piping - { - get { return this.pl4MinUplift; } - set { this.pl4MinUplift = value; } - } - - public double? Pl4HeadAdjusted // real result stab and piping - { - get { return this.pl4HeadAdjusted; } - set { this.pl4HeadAdjusted = value; } - } - - public double? Pl4LocalLocationXMinUplift // real result stab and piping - { - get { return this.pl4LocalLocationXMinUplift; } - set { this.pl4LocalLocationXMinUplift = value; } - } - - public double? UpliftFactor // real result piping - { - get { return this.upliftFactor; } - set { this.upliftFactor = value; } - } - - public double? HeaveFactor // real result piping - { - get { return this.heaveFactor; } - set { this.heaveFactor = value; } - } - - public double? BlighPipingFactor // real result piping - { - get { return this.blighPipingFactor; } - set { this.blighPipingFactor = value; } - } - - public double? BlighHCritical // real result piping - { - get { return this.blighHCritical; } - set { this.blighHCritical = value; } - } - - public double? Sellmeijer4ForcesPipingFactor // real result piping - { - get { return this.sellmeijer4ForcesPipingFactor; } - set { this.sellmeijer4ForcesPipingFactor = value; } - } - - public double? Sellmeijer4ForcesHCritical // real result piping - { - get { return this.sellmeijer4ForcesHCritical; } - set { this.sellmeijer4ForcesHCritical = value; } - } - - public double? SellmeijerPipingFactor // real result piping - { - get { return this.sellmeijerPipingFactor; } - set { this.sellmeijerPipingFactor = value; } - } - - public double? SellmeijerHCritical // real result piping - { - get { return this.sellmeijerHCritical; } - set { this.sellmeijerHCritical = value; } - } - /// - /// Gets or sets the wti2017 piping factor. + /// Gets or sets the stability design results. /// /// - /// The wti2017 piping factor. + /// The stability design results. /// - public double? Wti2017PipingFactor // real result piping + public StabilityDesignResults StabilityDesignResults { - get { return wti2017PipingFactor; } - set { wti2017PipingFactor = value; } + get + { + return stabilityDesignResults; + } + set + { + stabilityDesignResults = value; + } } /// - /// Gets or sets the wti2017 h critical. + /// Gets or sets the piping design results. /// /// - /// The wti2017 h critical. + /// The piping design results. /// - public double? Wti2017HCritical // real result piping + public PipingDesignResults PipingDesignResults { - get { return wti2017HCritical; } - set { wti2017HCritical = value; } + get + { + return pipingDesignResults; + } + set + { + pipingDesignResults = value; + } } - public string NwoId { get { return this.nwoId; } } // real result nwostab - - public int NwoResultIndex // real result nwostab - { - get { return this.nwoResultIndex; } - } - - public double? NWOLocationXrdStart // real result nwostab - { - get { return this.locationXrdStart; } - } - - public double? NWOLocationYrdStart // real result nwostab - { - get { return this.locationYrdStart; } - } - - public double? NWOLocationZrdStart // real result nwostab - { - get { return this.locationZrdStart; } - } - - public double? NWOLocationXrdEnd // real result nwostab - { - get { return this.locationXrdEnd; } - } - - public double? NWOLocationYrdEnd // real result nwostab - { - get { return this.locationYrdEnd; } - } - - public double? NWOLocationZrdEnd { get { return this.locationZrdEnd; } } // real result nwostab - //Note: using SurfaceLine instead of LocalXzSurfaceLine must give the proper RD coors. If this is not the case, error is somewhere else. Do not convert here! - - public SurfaceLine2 RedesignedSurfaceLine2Stability // real result stab - { - get { return redesignedSurfaceLineStability; } - set { redesignedSurfaceLineStability = value; } - } - - public SurfaceLine2 RedesignedSurfaceLine2Piping // real result piping - { - get { return redesignedSurfaceLinePiping; } - set { redesignedSurfaceLinePiping = value; } - } - - public double? LocalPipingExitPointX // real result piping - { - get { return localPipingExitPointX; } - set { localPipingExitPointX = value; } - } - - public string BaseFileName // real result for all. - { - get { return baseFileName; } - set { baseFileName = value; } - } - /// /// Copy data /// /// - public void Assign(DesignResult designResult) + private void Assign(DesignResult designResult) { - this.id = designResult.id; - this.BaseFileName = designResult.BaseFileName; - this.NumberOfIterations = designResult.NumberOfIterations; -// this.damFailureMechanismeCalculationSpecification = designResult.damFailureMechanismeCalculationSpecification; -// this.Scenario = designResult.Scenario; -// this.SoilProfile = designResult.SoilProfile; -// this.SoilGeometry2DName = designResult.SoilGeometry2DName; - this.failureProbabilityPiping = designResult.failureProbabilityPiping; - this.redesignedSurfaceLinePiping = designResult.redesignedSurfaceLinePiping; - this.safetyFactorStability = designResult.safetyFactorStability; - this.failureProbabilityStability = designResult.failureProbabilityStability; - this.zone1SafetyFactorStability = designResult.zone1SafetyFactorStability; - this.LocalZone1EntryPointX = designResult.LocalZone1EntryPointX; - this.LocalZone1ExitPointX = designResult.LocalZone1ExitPointX; - this.zone2SafetyFactorStability = designResult.zone2SafetyFactorStability; - this.LocalZone2EntryPointX = designResult.LocalZone2EntryPointX; - this.LocalZone2ExitPointX = designResult.LocalZone2ExitPointX; - this.blighPipingFactor = designResult.blighPipingFactor; - this.blighHCritical = designResult.blighHCritical; - this.sellmeijer4ForcesPipingFactor = designResult.sellmeijer4ForcesPipingFactor; - this.sellmeijer4ForcesHCritical = designResult.sellmeijer4ForcesHCritical; - this.sellmeijerPipingFactor = designResult.sellmeijerPipingFactor; - this.sellmeijerHCritical = designResult.sellmeijerHCritical; - this.wti2017PipingFactor = designResult.wti2017PipingFactor; - this.wti2017HCritical = designResult.wti2017HCritical; - this.redesignedSurfaceLineStability = designResult.redesignedSurfaceLineStability; - this.calculationResult = designResult.calculationResult; + // copy place holders + DamFailureMechanismeCalculation = designResult.DamFailureMechanismeCalculation; + Scenario = designResult.Scenario; + + // copy direct data + id = designResult.id; + xrd = designResult.Xrd; + yrd = designResult.Yrd; + baseFileName = designResult.BaseFileName; + locationName = designResult.LocationName; + scenarioName = designResult.ScenarioName; + profileName = designResult.ProfileName; + safetyFactor = designResult.SafetyFactor; + failureProbability = designResult.FailureProbability; + calculationResult = designResult.calculationResult; + nwoDesignResults = new NwoDesignResults(); + designResult.NwoDesignResults.CloneProperties(nwoDesignResults); + stabilityDesignResults = new StabilityDesignResults(); + designResult.StabilityDesignResults.CloneProperties(stabilityDesignResults); + pipingDesignResults = new PipingDesignResults(DamFailureMechanismeCalculation.PipingModelType); + designResult.PipingDesignResults.CloneProperties(pipingDesignResults); } /// @@ -678,14 +478,32 @@ /// public object Clone() { - var soilProfile = new SoilProfile1D(); - var soilGeometry2DName = ""; - DesignResult designResult = new DesignResult(id, DamFailureMechanismeCalculation, Scenario, - soilProfile, soilGeometry2DName, AnalysisType, nwoResultIndex, ProbabilisticType); + DesignResult designResult = new DesignResult(); designResult.Assign(this); return designResult; - } + } + + /// + /// Determines the stability calculation run result. + /// + /// The result message. + /// The mstab results. + /// + private CalculationResult DetermineStabilityCalculationResult(string message, MStabResults? mstabResults) + { + CalculationResult result; + if ((message != null) && message.Contains("FAIL")) + { + result = CalculationResult.UnexpectedError; + } + else + { + // If no failure and no results, then no run has been made + result = mstabResults != null ? CalculationResult.Succeeded : CalculationResult.NoRun; + } + return result; + } } } \ No newline at end of file