Index: dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj =================================================================== diff -u -r350 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 350) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 404) @@ -60,7 +60,7 @@ - + @@ -85,6 +85,7 @@ + Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Assessment Regional/RWScenariosCalculation.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Assessment Regional/RWScenariosCalculation.cs (.../RWScenariosCalculation.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Assessment Regional/RWScenariosCalculation.cs (.../RWScenariosCalculation.cs) (revision 404) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Text.RegularExpressions; using Deltares.DamEngine.Calculators.SchematizationFactor; @@ -33,6 +34,7 @@ using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Language; using Deltares.DamEngine.Data.Standard.Logging; +using Deltares.Stability.Calculation; namespace Deltares.DamEngine.Calculators.Dikes_Assessment_Regional { @@ -291,7 +293,7 @@ catch (Exception e) { job.CalculationResult = CalculationResult.UnexpectedError; - sendMessageDelegate(new LogMessage(LogMessageType.Warning, job.Location, String.Format("Error: {0}", e.Message))); + sendMessageDelegate(new LogMessage(LogMessageType.Warning, job, String.Format(job.LocationName + " Error: {0}", e.Message))); } } @@ -335,9 +337,9 @@ // waterLevel = job.Location.BoezemLevelTp; // break; // } -// job.SoilGeometryProbability.SoilProfile.EnsureUniqueLayerIds(); +// //job.SoilGeometryProbability.SoilProfile.EnsureUniqueLayerIds(); // var calculationName = GetCalculationNameForPipingCalculator(job); -// calculator.FilenameCalculation = Path.Combine(Path.Combine(DamProject.ProjectWorkingPath, job.FailureMechanismType.ToString()), calculationName); +// calculator.FilenameCalculation = Path.Combine(Path.Combine(DamProjectData.ProjectWorkingPath, job.FailureMechanismType.ToString()), calculationName); // calculator.IsHydraulicShortcut = (job.HydraulicShortcutType == HydraulicShortcutType.HydraulicShortcut); // double? pipingFactor = calculator.CalculatePipingFactor(job.Location, job.Location.LocalXZSurfaceLine2, job.SoilGeometryProbability.SoilProfile, waterLevel); // job.BaseFileName = calculator.FilenameCalculation; @@ -360,7 +362,7 @@ // else // { // throw new RWScenariosCalculationException(String.Format("Uplift criterion not defined for location {0}", job.Location.Name)); -// } ##Bka +// } //##Bka } @@ -369,18 +371,15 @@ string calculationName; switch (job.PipingModelOption) { - case PipingModelType.Sellmeijer : calculationName = String.Format("Calc(Sellmeijer)_Loc({0})_Pro({1}))", - job.Location.Name, job.SoilGeometryProbability.SoilProfile.Name); + case PipingModelType.SellmeijerVnk : calculationName = String.Format("Calc(SellmeijerVnk)_Loc({0})_Pro({1}))", + job.LocationName, job.SoilProfileName); break; - case PipingModelType.Sellmeijer2Forces: calculationName = String.Format("Calc(Sellmeijer2Forces)_Loc({0})_Pro({1}))", - job.Location.Name, job.SoilGeometryProbability.SoilProfile.Name); - break; case PipingModelType.Sellmeijer4Forces: calculationName = String.Format("Calc(Sellmeijer4Forces)_Loc({0})_Pro({1}))", - job.Location.Name, job.SoilGeometryProbability.SoilProfile.Name); + job.LocationName, job.SoilProfileName); break; // Set Sellmeijer4Forces as default. default: calculationName = String.Format("Calc(Sellmeijer4Forces)_Loc({0})_Pro({1}))", - job.Location.Name, job.SoilGeometryProbability.SoilProfile.Name); + job.LocationName, job.SoilProfileName); break; } calculationName = Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_"); @@ -398,7 +397,7 @@ // PipingCalculator calculator; // switch (job.PipingModelOption) // { -// case PipingModelType.Sellmeijer: calculator = new PipingCalculatorSellmeijer(modelParametersForPLLines, +// case PipingModelType.SellmeijerVnk: calculator = new PipingCalculatorSellmeijer(modelParametersForPLLines, // 1.0, null, null, null, job.Location.ModelFactors.UpliftCriterionPiping.Value); // break; // case PipingModelType.Sellmeijer2Forces: calculator = new PipingCalculatorSellmeijer2Forces(modelParametersForPLLines, @@ -422,54 +421,54 @@ /// private void ProcessJobStability(RWScenarioProfileResult job) { -// StabilityCalculation calculator = new StabilityCalculation(); -// -// lock (runningJobs) -// { -// runningJobs[calculator] = job; -// } -// -// calculator.MStabExePath = this.MStabExePath; -// calculator.RegisterSendMessage(this.SendStabilityMessage); -// -// string soilDatabaseName = job.Location.SoildatabaseName; + StabilityCalculation calculator = new StabilityCalculation(); + + lock (runningJobs) + { + runningJobs[calculator] = job; + } + + // calculator.MStabExePath = this.MStabExePath; + calculator.RegisterSendMessage(this.SendStabilityMessage); + + string soilDatabaseName = job.Location.SoildatabaseName; // DamFailureMechanismeCalculationSpecification damCalculation = // calculator.GetSpecification(this.evaluationJob.DikeName, soilDatabaseName, job.Location, new SoilGeometry(job.SoilGeometryProbability.SoilProfile, null), // (MStabModelType)job.MstabModelOption, job.LoadSituation, job.DikeDrySensitivity, job.HydraulicShortcutType, MStabParameters); // // calculator.SaveToFile(damCalculation.FailureMechanismeParamatersMStab); -// + // string inputFile = damCalculation.FailureMechanismeParamatersMStab.MStabParameters.ProjectFileName; // // job.BaseFileName = inputFile.Replace(DamProject.ProjectWorkingPath, @"").Replace(".sti", ""); -// + // calculator.Load(inputFile); -// job.CalculationResult = calculator.Run(); -// -// if (job.CalculationResult == CalculationResult.Succeeded) -// { -// string results = ""; -// -// job.CalculationResult = calculator.GetResults(ref results); -// XmlDeserializer deserializer = new XmlDeserializer(); + job.CalculationResult = calculator.Run(); + + if (job.CalculationResult == CalculationResult.Succeeded) + { + string results = ""; + + job.CalculationResult = calculator.GetResults(ref results); + //XmlDeserializer deserializer = new XmlDeserializer(); // RWResult result = (RWResult)deserializer.XmlDeserializeFromString(results, typeof(RWResult)); -// + // job.SafetyFactor = result.SafetyFactor; // job.ProbabilityOfFailure = result.ProbabilityOfFailure; // job.RwResultType = result.RwResultType; // job.CalculationResult = result.CalculationResult; -// } -// else -// { + } + else + { // job.RwResultType = (damCalculation.FailureMechanismeParamatersMStab.MStabParameters.IsProbabilistic ? RWResultType.ProbabilityOfFailure : RWResultType.SafetyFactor); -// job.SafetyFactor = double.NaN; -// job.ProbabilityOfFailure = double.NaN; -// } -// -// lock (runningJobs) -// { -// runningJobs.Remove(calculator); -// } ##Bka + job.SafetyFactor = double.NaN; + job.ProbabilityOfFailure = double.NaN; + } + + lock (runningJobs) + { + runningJobs.Remove(calculator); + } } /// @@ -483,8 +482,7 @@ if (logMessage.Subject != null) { RWScenarioProfileResult job = (RWScenarioProfileResult)runningJobs[(ICalculation)logMessage.Subject]; - logMessage.Subject = job.Location; - // logMessage.Detail = job.SoilGeometryProbability.SoilProfile.Name; + logMessage.Subject = job.Location; } } @@ -509,7 +507,7 @@ // scenarios were succesfully created, so results are available foreach (RWScenarioProfileResult job in tasks) { - if (job.Location.Name.Equals(location.Name)) + if (job.LocationName.Equals(location.Name)) { RWScenarioResult scenarioResult = null; foreach (RWScenarioResult existingScenarioResult in scenariosResult.RWScenarioResults) Index: dam engine/trunk/Xsds Liquid/DamCalculationResults.xsd =================================================================== diff -u -r379 -r404 --- dam engine/trunk/Xsds Liquid/DamCalculationResults.xsd (.../DamCalculationResults.xsd) (revision 379) +++ dam engine/trunk/Xsds Liquid/DamCalculationResults.xsd (.../DamCalculationResults.xsd) (revision 404) @@ -18,6 +18,22 @@ + + + + + + + + + + + + + + + + @@ -30,11 +46,11 @@ - - + + - + Index: dam engine/trunk/Xsds Liquid/DamRWScenarioResult.xsd =================================================================== diff -u -r379 -r404 --- dam engine/trunk/Xsds Liquid/DamRWScenarioResult.xsd (.../DamRWScenarioResult.xsd) (revision 379) +++ dam engine/trunk/Xsds Liquid/DamRWScenarioResult.xsd (.../DamRWScenarioResult.xsd) (revision 404) @@ -12,10 +12,7 @@ - - - @@ -93,8 +90,7 @@ - - + @@ -106,14 +102,12 @@ - - + - @@ -180,5 +174,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/CsvExportData.cs =================================================================== diff -u -r395 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/CsvExportData.cs (.../CsvExportData.cs) (revision 395) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/CsvExportData.cs (.../DesignResult.cs) (revision 404) @@ -32,37 +32,18 @@ namespace Deltares.DamEngine.Data.General.Results { - /// - ///1:"Id":invoer - ///2:"Dijkringnaam":invoer - ///3:"RDX":invoer - ///4:"RDY":invoer - ///5:"Scenarionummer (waterhoogtenummer, hoeveelste \"entry\" uit tabel; 1, 2, 3, 4 of 5)":invoer - ///6:"Waterhoogtewaarde":invoer - ///7:"Dijkhoogte bestaand":invoer - ///8:"Huidige locatie teen":invoer - ///9:"Dijktafelhoogte":invoer - ///10:"1Dprofiel":invoer - ///11:"Mechanisme":invoer - ///12:"1Dprofiel kans":invoer - ///13:"Berekende lokatie teen":uitvoer - ///14:"Bermhoogte":uitvoer - ///15:"Dijkbasis bestaand":invoer - ///16:"Dijkbasis nieuw":uitvoer - /// - public class CsvExportData : ICloneable + public class DesignResult : ICloneable { private string id; + private double xrd; + private double yrd; private string baseFileName; - private string calculationSubDir; - private Dike dike; - private AnalysisType analysisType; - private ProbabilisticType probabilisticType; - private DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification; - private DesignScenario scenario; - private SoilProfile1D soilProfile; - private string soilGeometry2DName; - private double? safetyFactorFlowSlide; + + private string locationName; + private string scenarioName; + + + private double? failureProbabilityPiping; private double? localPipingExitPointX; private SurfaceLine2 redesignedSurfaceLinePiping; @@ -78,8 +59,6 @@ private double? heaveFactor; private double? blighPipingFactor; private double? blighHCritical; - private double? sellmeijer2ForcesPipingFactor; - private double? sellmeijer2ForcesHCritical; private double? sellmeijer4ForcesPipingFactor; private double? sellmeijer4ForcesHCritical; private double? sellmeijerPipingFactor; @@ -104,29 +83,117 @@ private CalculationResult calculationResult = CalculationResult.NoRun; private string resultMessage = ""; private int numberOfIterations; - private ResultEvaluation resultEvaluation = ResultEvaluation.NotEvaluated; - private string notes = ""; - private bool dirty = true; - private List points = new List(); - private StabilityKernelType selectedStabilityKernelType = StabilityKernelType.DamClassic; private SurfaceLine2 redesignedSurfaceLineStability; - public CsvExportData() + public DesignResult() { } - public CsvExportData(string id, Dike dike, DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification, DesignScenario scenario, SoilProfile1D soilProfile, + //temp place holders, must be removed/replaced as these are not realy part of results + 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) + public DesignScenario Scenario { get; set; } + public double? DikeLength { get; set; } + public CalculationResult CalculationResult // derived result, involves ResultMessage, mstabResults (stab) or PipingFactor == null && this.PipingFailureProbability + { + get { return calculationResult;} + set{calculationResult = value;} + } + [XmlIgnore] + public double? SafetyFactor // derived result + { + get + { + double? res = null; + switch (DamFailureMechanismeCalculation.FailureMechanismSystemType) + { + case FailureMechanismSystemType.HorizontalBalance: + case FailureMechanismSystemType.StabilityOutside: + case FailureMechanismSystemType.StabilityInside: + res = StabilitySafetyFactor; + break; + case FailureMechanismSystemType.Piping: + res = PipingFactor; + break; + } + return res; + } + } + [XmlIgnore] + 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; + } + } + + [XmlIgnore] + public double? FailureProbability // derived result + { + get + { + double? res = null; + switch (DamFailureMechanismeCalculation.FailureMechanismSystemType) + { + case FailureMechanismSystemType.HorizontalBalance: + case FailureMechanismSystemType.StabilityOutside: + case FailureMechanismSystemType.StabilityInside: + res = StabilityFailureProbability; + break; + case FailureMechanismSystemType.Piping: + res = PipingFailureProbability; + break; + } + return res; + } + } + //Identifiers, needed to retrace the origin of the result + public string LocationName + { + get { return locationName; } + } + + public string ScenarioName // input, not result + { + get { return scenarioName; } + } + + public string StabilityProfileName { get; set; } //methode terughalen uit csvexport indien nodig + + public DesignResult(string id, DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification, DesignScenario scenario, SoilProfile1D soilProfile, string soilGeometry2DName, AnalysisType analysisType, int nwoResultIndex, ProbabilisticType probabilisticType) { this.id = id; + xrd = scenario.Location.XRd; + yrd = scenario.Location.YRd; + locationName = scenario.Location.Name; + scenarioName = scenario.LocationScenarioID; // terughalen vanuit csvexport indien echt nodig this.BaseFileName = ""; - this.CalculationSubDir = ""; - this.dike = dike; - this.damFailureMechanismeCalculationSpecification = damFailureMechanismeCalculationSpecification; - this.scenario = scenario; - this.soilProfile = soilProfile; - this.SoilGeometry2DName = soilGeometry2DName; - this.analysisType = analysisType; + DamFailureMechanismeCalculation = damFailureMechanismeCalculationSpecification; +// this.scenario = scenario; +// this.soilProfile = soilProfile; +// this.SoilGeometry2DName = soilGeometry2DName; this.failureProbabilityPiping = null; this.redesignedSurfaceLinePiping = null; this.safetyFactorStability = null; @@ -140,8 +207,6 @@ this.LocalZone2ExitPointX = null; this.blighPipingFactor = null; this.blighHCritical = null; - this.sellmeijer2ForcesPipingFactor = null; - this.sellmeijer2ForcesHCritical = null; this.sellmeijer4ForcesPipingFactor = null; this.sellmeijer4ForcesHCritical = null; this.sellmeijerPipingFactor = null; @@ -163,11 +228,9 @@ this.locationYrdEnd = null; this.locationZrdStart = null; this.locationZrdEnd = null; - this.dirty = true; - + if (damFailureMechanismeCalculationSpecification != null) { - this.probabilisticType = probabilisticType; switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) { case FailureMechanismSystemType.StabilityInside: @@ -185,12 +248,8 @@ this.locationXrdEnd = scenario.NwoResults[nwoResultIndex].LocationXrdEnd; this.locationYrdEnd = scenario.NwoResults[nwoResultIndex].LocationYrdEnd; this.locationZrdEnd = scenario.NwoResults[nwoResultIndex].LocationZrdEnd; - this.dirty = true; this.BaseFileName = scenario.NwoResults[nwoResultIndex].MStabResults.CalculationName; - this.CalculationSubDir = - scenario.NwoResults[nwoResultIndex].MStabResults.CalculationSubDir; - this.numberOfIterations = - scenario.NwoResults[nwoResultIndex].MStabResults.IterationNumber; + 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; @@ -205,14 +264,13 @@ } else { - MStabResults? mstabResults = scenario.GetMStabResults(this.SoilProfile, this.SoilGeometry2DName); - this.resultMessage = scenario.GetResultMessage(this.SoilProfile, this.SoilGeometry2DName); + MStabResults? mstabResults = scenario.GetMStabResults(soilProfile, soilGeometry2DName); + this.resultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName); calculationResult = DetermineStabilityCalculationResult(this.resultMessage, mstabResults); if (mstabResults != null) { BaseFileName = mstabResults.Value.CalculationName; - CalculationSubDir = mstabResults.Value.CalculationSubDir; numberOfIterations = mstabResults.Value.IterationNumber; this.safetyFactorStability = mstabResults.Value.zone1.safetyFactor; this.zone1SafetyFactorStability = mstabResults.Value.zone1.safetyFactor; @@ -226,10 +284,10 @@ } } } - this.failureProbabilityStability = scenario.GetFailureProbabilityStability(this.SoilProfile, this.SoilGeometry2DName); - this.redesignedSurfaceLineStability = scenario.GetRedesignedSurfaceLine(this.SoilProfile, this.SoilGeometry2DName); + this.failureProbabilityStability = scenario.GetFailureProbabilityStability(soilProfile, soilGeometry2DName); + this.redesignedSurfaceLineStability = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName); - UpliftSituation? upliftSituation = scenario.GetStabilityUpliftSituation(this.SoilProfile, this.SoilGeometry2DName); + UpliftSituation? upliftSituation = scenario.GetStabilityUpliftSituation(soilProfile, soilGeometry2DName); if (upliftSituation != null) { SetUpliftSituationResults(upliftSituation.Value); @@ -239,58 +297,37 @@ case FailureMechanismSystemType.Piping: - this.failureProbabilityPiping = scenario.GetFailureProbabilityPiping(this.SoilProfile, this.SoilGeometry2DName); - this.resultMessage = scenario.GetResultMessage(this.SoilProfile, this.SoilGeometry2DName); - this.redesignedSurfaceLinePiping = scenario.GetRedesignedSurfaceLine(this.SoilProfile, this.SoilGeometry2DName); - UpliftSituation? upliftSituationPiping = scenario.GetStabilityUpliftSituation(this.SoilProfile, this.SoilGeometry2DName); + this.failureProbabilityPiping = scenario.GetFailureProbabilityPiping(soilProfile, soilGeometry2DName); + this.resultMessage = scenario.GetResultMessage(soilProfile, soilGeometry2DName); + this.redesignedSurfaceLinePiping = scenario.GetRedesignedSurfaceLine(soilProfile, soilGeometry2DName); + UpliftSituation? upliftSituationPiping = scenario.GetStabilityUpliftSituation(soilProfile, soilGeometry2DName); if (upliftSituationPiping != null) { SetUpliftSituationResults(upliftSituationPiping.Value); } - PipingResults? pipingResults = scenario.GetPipingResults(this.SoilProfile, this.SoilGeometry2DName); + PipingResults? pipingResults = scenario.GetPipingResults(soilProfile, soilGeometry2DName); if (pipingResults != null) { BaseFileName = pipingResults.Value.CalculationName; - CalculationSubDir = pipingResults.Value.CalculationSubDir; this.blighPipingFactor = pipingResults.Value.BlighPipingFactor; this.blighHCritical = pipingResults.Value.BlighHCritical; - this.sellmeijer2ForcesPipingFactor = pipingResults.Value.Sellmeijer2ForcesPipingFactor; - this.sellmeijer2ForcesHCritical = pipingResults.Value.Sellmeijer2ForcesHCritical; this.sellmeijer4ForcesPipingFactor = pipingResults.Value.Sellmeijer4ForcesPipingFactor; this.sellmeijer4ForcesHCritical = pipingResults.Value.Sellmeijer4ForcesHCritical; - this.sellmeijerPipingFactor = pipingResults.Value.SellmeijerPipingFactor; - this.sellmeijerHCritical = pipingResults.Value.SellmeijerHCritical; + 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; } - this.calculationResult = (this.PipingFactor == null && this.PipingFailureProbability == null) ? CalculationResult.RunFailed : CalculationResult.Succeeded; - break; - case FailureMechanismSystemType.FlowSlide: - this.safetyFactorFlowSlide = scenario.GetSafetyFactorFlowSlide(this.SoilProfile, this.SoilGeometry2DName); - break; + this.calculationResult = (this.PipingFactor == null && PipingFailureProbability == null) ? CalculationResult.RunFailed : CalculationResult.Succeeded; + break; } } } /// - /// Determines the global point coordinates based on global surface line. - /// - /// The local point. - /// The global surface line. - /// - private GeometryPoint DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine(GeometryPoint localPoint, SurfaceLine2 globalSurfaceLine) - { - CoordinateSystemConverter coordinateSystemConverter = new CoordinateSystemConverter(); - coordinateSystemConverter.DefineGlobalXYZBasedOnLine(globalSurfaceLine.Geometry); - - coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(localPoint); - return localPoint; - } - - /// /// Determines the stability calculation run result. /// /// The result message. @@ -344,341 +381,41 @@ } } - public StabilityKernelType SelectedStabilityKernelType - { - get { return selectedStabilityKernelType; } - set { selectedStabilityKernelType = value; } - } - public int NumberOfIterations // real results for NWo { get { return numberOfIterations; } set { numberOfIterations = value; } } - public string ResultFile //derived result - { - get - { - if (!String.IsNullOrEmpty(BaseFileName)) - { - const string wmfExtension = ".wmf"; - string fullBaseFilename = DamProjectData.ProjectWorkingPath; - if (CalculationSubDir != "") - { - fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); - } - fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; - string fullFilename = fullBaseFilename + wmfExtension; - if (!File.Exists(fullFilename)) - { - fullFilename = fullBaseFilename + "z1" + wmfExtension; - } - if (!File.Exists(fullFilename)) - { - fullFilename = fullBaseFilename + "z2" + wmfExtension; - } - return fullFilename; - } - return ""; - } - } - - public string InputFile // derived result - { - get - { - if (!String.IsNullOrEmpty(BaseFileName)) - { - string fileExtension = ".sti"; - if (selectedStabilityKernelType != StabilityKernelType.DamClassic) - { - fileExtension = ".dsx"; - } - string fullBaseFilename = DamProjectData.ProjectWorkingPath; - if (CalculationSubDir != "") - { - fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); - } - fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; - string fullFilename = fullBaseFilename + fileExtension; - return fullFilename; - } - return ""; - } - } - - public string PipingResultFile //derived result - { - // Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location) - get - { - if (!String.IsNullOrEmpty(BaseFileName)) - { - const string txtExtension = ".txt"; - string fullBaseFilename = DamProjectData.ProjectWorkingPath; - if (CalculationSubDir != "") - { - fullBaseFilename = Path.Combine(fullBaseFilename, CalculationSubDir); - } - fullBaseFilename = fullBaseFilename + Path.DirectorySeparatorChar + BaseFileName; - string fullFilename = fullBaseFilename + txtExtension; - return fullFilename; - } - return ""; - } - } - - public AnalysisType AnalysisType // input, not result - { - get { return analysisType; } - set { analysisType = value; } - } - - public ProbabilisticType ProbabilisticType // input, not result - { - get { return probabilisticType; } - set { probabilisticType = value; } - } - - [Browsable(false)] - public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculation // input, not result - { - get { return damFailureMechanismeCalculationSpecification; } - set { damFailureMechanismeCalculationSpecification = value; } - } - public string ID { get { return this.id; } } - public string DikeName // input, not result - { - get { return dike.Name; } - } - - public string Calculation // input, not result - { - get { return this.damFailureMechanismeCalculationSpecification != null ? this.damFailureMechanismeCalculationSpecification.ToString() : ""; } - } - - public string ScenarioName // input, not result - { - get { return this.Scenario.LocationScenarioID; } - } - - public string LocationName // input, not result - { - get { return this.Scenario.Location.Name; } - } - - public int LocationScenarioCount // input, not result - { - get { return this.Scenario.Location.Scenarios.Count; } - } - - public string ScenarioDefinitionName // input, not result - { - get { return this.Scenario.LocationScenarioID + " of " + this.LocationScenarioCount.ToString(); } - } - - public CalculationResult CalculationResult // derived result, involves ResultMessage, mstabResults (stab) or PipingFactor == null && this.PipingFailureProbability - { - get - { - return calculationResult; - } - set - { - calculationResult = value; - } - } - public string ResultMessage // real result { get { return resultMessage; } set { resultMessage = value; } } [XmlIgnore] - public double X //Xrd iput but very usefull as output as well + public double Xrd //Xrd iput but very usefull as output as well { get { - return (this.Scenario != null) ? this.Scenario.Location.XRd : 0.0; - } - set - { - if (this.Scenario != null) - { - this.Scenario.Location.XRd = value; - } - } + return xrd; + } } [XmlIgnore] - public double Y //Yrd iput but very usefull as output as well + public double Yrd //Yrd iput but very usefull as output as well { get { - return (this.Scenario != null) ? this.Scenario.Location.YRd : 0.0; - } - set - { - if (this.Scenario != null) - { - this.Scenario.Location.YRd = value; - } - } + return yrd; + } } - public string LocationScenarioId // input, not output ##Bka: this is the same as ScenarioName so why both?????? - { - get { return this.Scenario.LocationScenarioID; } - } - - public double? RiverLevel // input, not output - { - get { return this.Scenario.RiverLevel; } - } - - public double? RiverLevelLow // input, not output - { - get { return this.Scenario.RiverLevelLow; } - } - - public double? DikeTableHeight // input, not output - { - get { return this.Scenario.DikeTableHeight; } - } - - public double? SlopeDampingPiezometricHeightPolderSide // input, not output - { - get { return this.Scenario.Location.SlopeDampingPiezometricHeightPolderSide; } - } - - public double? CurrentDikeHeight // input, not output - { - get { return this.Scenario.Location.SurfaceLine2.GetDikeHeight(); } - } - - public double? CurrentDikeToeAtPolderX // input, not output - { - get - { - double? x = null; - GeometryPoint point = this.Scenario.Location.SurfaceLine2.GetDikeToeInward(); - if (point != null) - x = point.X; - return x; - } - } - - public double? CurrentDikeToeAtPolderZ // input, not output - { - get - { - double? z = null; - GeometryPoint point = this.Scenario.Location.SurfaceLine2.GetDikeToeInward(); - if (point != null) - z = point.Z; - return z; - } - } - - private string GetSoilProfileName(FailureMechanismSystemType failureMechanismType) - { - string soilprofilename = ""; - if (this.SoilProfile != null) - { - soilprofilename = this.SoilProfile.Name; - } - else - { - if (this.SoilGeometry2DName != null) - { - soilprofilename = this.SoilGeometry2DName; - } - } - return failureMechanismType == this.damFailureMechanismeCalculationSpecification.FailureMechanismSystemType ? soilprofilename : ""; - } - - private double? GetSoilProfileProbability(FailureMechanismSystemType? failureMechanismType) - { - return this.Scenario.Location.GetSoilProfileProbability(this.SoilProfile, failureMechanismType); - } - - public string StabilityProfileName // derived input, not output - { - get { return GetSoilProfileName(FailureMechanismSystemType.StabilityInside); } - } - - public double? StabilityProfileProbability // derived input, not output - { - get { return GetSoilProfileProbability(FailureMechanismSystemType.StabilityInside); } - } - - public string PipingProfileName // derived input, not output - { - get { return GetSoilProfileName(FailureMechanismSystemType.Piping); } - } - - public double? PipingProfileProbability //derived input, not output - { - get { return GetSoilProfileProbability(FailureMechanismSystemType.Piping); } - } - - public double? CurrentDikeLength // input, not output - { - get { return this.Scenario.Location.SurfaceLine2.GetDikeLength(); } - } - - public double? StabilityToeAtPolderX // derived result stab - { - get - { - if (this.redesignedSurfaceLineStability == null) - return null; - - GeometryPoint point = this.redesignedSurfaceLineStability.GetDikeToeInward(); - if (point != null) - return point.X; - else - return null; - } - } - - public double? StabilityToeAtPolderZ // derived result stab - { - get - { - if (this.redesignedSurfaceLineStability == null) - return null; - - GeometryPoint point = this.redesignedSurfaceLineStability.GetDikeToeInward(); - if (point != null) - return point.Z; - else - return null; - } - } - - public double? StabilityShoulderHeight // derived result stab - { - get - { - if (this.redesignedSurfaceLineStability == null) - return null; - - GeometryPoint point = this.redesignedSurfaceLineStability.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - if (point != null) - return point.Z; - else - return null; - } - } - public double? StabilitySafetyFactor // real result stab and nwostab { get { return this.safetyFactorStability; } @@ -691,107 +428,12 @@ set { this.failureProbabilityStability = value; } } - public double? RequiredSafetyFactorStabilityInnerSlope // input - { - get { return this.Scenario.RequiredSafetyFactorStabilityInnerSlope;} - } - - public double? RequiredSafetyFactorStabilityOuterSlope //input - { - get { return this.Scenario.RequiredSafetyFactorStabilityOuterSlope; } - } - - public double? RequiredSafetyFactorPiping // input - { - get { return this.Scenario.RequiredSafetyFactorPiping; } - } - - public double? PipingToeAtPolderX // derived result piping - { - get - { - if (this.redesignedSurfaceLinePiping == null) - return null; - - GeometryPoint point = this.redesignedSurfaceLinePiping.GetDikeToeInward(); - if (point != null) - return point.X; - else - return null; - } - } - - public double? PipingToeAtPolderZ // derived result piping - { - get - { - if (this.redesignedSurfaceLinePiping == null) - return null; - - GeometryPoint point = this.redesignedSurfaceLinePiping.GetDikeToeInward(); - if (point != null) - return point.Z; - else - return null; - } - } - - public double? PipingShoulderHeight // derived result piping - { - get - { - if (this.redesignedSurfaceLinePiping == null) - return null; - - GeometryPoint point = redesignedSurfaceLinePiping.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - if (point != null) - return point.Z; - else - return null; - } - } - public double? PipingFailureProbability // real result piping { get { return this.failureProbabilityPiping; } set { this.failureProbabilityPiping = value; } } - public double? RequiredFailureProbabilityPiping // input - { - get { return this.Scenario.RequiredProbabilityOfFailurePiping; } - } - - public double? DikeLength // derived value - { - get - { - double? maxDikeLength = null; - List dikeLengths = new List(); - SurfaceLine2 surfaceLine = this.Scenario.Location.SurfaceLine2; - if (surfaceLine != null) - dikeLengths.Add(surfaceLine.GetDikeLength()); - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityInside: - if (redesignedSurfaceLineStability != null) - dikeLengths.Add(redesignedSurfaceLineStability.GetDikeLength()); - break; - case FailureMechanismSystemType.Piping: - if (redesignedSurfaceLinePiping != null) - dikeLengths.Add(redesignedSurfaceLinePiping.GetDikeLength()); - break; - } - - foreach (double? dikeLength in dikeLengths) - { - if (dikeLength.HasValue && (!maxDikeLength.HasValue || maxDikeLength < dikeLength)) - maxDikeLength = dikeLength; - } - return maxDikeLength; - } - } - public double? Zone1SafetyFactorStability // real result for stab and nwostab { get { return this.zone1SafetyFactorStability; } @@ -804,95 +446,12 @@ set { localZone1EntryPointX = value; } } - [XmlIgnore] - public double? Zone1EntryPointX // derived result - { - get - { - if (this.LocalZone1EntryPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone1EntryPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - [XmlIgnore] - public double? Zone1EntryPointY // derived result - { - get - { - if (this.LocalZone1EntryPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone1EntryPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - - [XmlIgnore] - public double? Zone1EntryPointZ // derived result - { - get - { - if (this.LocalZone1EntryPointX == null) - return null; - if (redesignedSurfaceLineStability == null) - return null; - return this.redesignedSurfaceLineStability.Geometry.GetZatX(this.LocalZone1EntryPointX.Value); - } - } - public double? LocalZone1ExitPointX // real result stab and nwostab { get { return localZone1ExitPointX; } set { localZone1ExitPointX = value; } } - public double? Zone1ExitPointX // derived result - { - get - { - if (this.LocalZone1ExitPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone1ExitPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - public double? Zone1ExitPointY // derived result - { - get - { - if (this.LocalZone1ExitPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone1ExitPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - - public double? Zone1ExitPointZ // derived result - { - get - { - if (this.LocalZone1ExitPointX == null) - return null; - if (redesignedSurfaceLineStability == null) - return null; - return this.redesignedSurfaceLineStability.Geometry.GetZatX(this.LocalZone1ExitPointX.Value); - } - } - public double? Zone2SafetyFactorStability // real result stab and nwostab { get { return this.zone2SafetyFactorStability; } @@ -905,94 +464,12 @@ set { localZone2EntryPointX = value; } } - public double? Zone2EntryPointX // derived result - { - get - { - if (this.LocalZone2EntryPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone2EntryPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - - } - } - - public double? Zone2EntryPointY // derived result - { - get - { - if (this.LocalZone2EntryPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone2EntryPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - - } - } - - public double? Zone2EntryPointZ // derived result - { - get - { - if (this.LocalZone2EntryPointX == null) - return null; - if (redesignedSurfaceLineStability == null) - return null; - return this.redesignedSurfaceLineStability.Geometry.GetZatX(this.LocalZone2EntryPointX.Value); - } - } - public double? LocalZone2ExitPointX // real result stab and nwostab { get { return localZone2ExitPointX; } set { localZone2ExitPointX = value; } } - public double? Zone2ExitPointX // derived result - { - get - { - if (this.LocalZone2ExitPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone2ExitPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - public double? Zone2ExitPointY // derived result - { - get - { - if (this.LocalZone2ExitPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalZone2ExitPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - - public double? Zone2ExitPointZ // derived result - { - get - { - if (this.LocalZone2ExitPointX == null) - return null; - if (redesignedSurfaceLineStability == null) - return null; - return this.redesignedSurfaceLineStability.Geometry.GetZatX(this.LocalZone2ExitPointX.Value); - } - } - public bool? IsUplift // real result stab and piping { get { return this.isUplift; } @@ -1017,36 +494,6 @@ set { this.pl3LocalLocationXMinUplift = value; } } - [XmlIgnore] - public double? Pl3LocationXMinUplift // derived result - { - get - { - if (this.pl3LocalLocationXMinUplift == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.pl3LocalLocationXMinUplift.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - [XmlIgnore] - public double? Pl3LocationYMinUplift // derived result - { - get - { - if (this.pl3LocalLocationXMinUplift == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.pl3LocalLocationXMinUplift.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - public double? Pl4MinUplift // real result stab and piping { get { return this.pl4MinUplift; } @@ -1065,36 +512,6 @@ set { this.pl4LocalLocationXMinUplift = value; } } - [XmlIgnore] - public double? Pl4LocationXMinUplift // derived result - { - get - { - if (this.pl4LocalLocationXMinUplift == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.pl4LocalLocationXMinUplift.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - [XmlIgnore] - public double? Pl4LocationYMinUplift // derived result - { - get - { - if (this.pl4LocalLocationXMinUplift == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.pl4LocalLocationXMinUplift.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - public double? UpliftFactor // real result piping { get { return this.upliftFactor; } @@ -1119,18 +536,6 @@ set { this.blighHCritical = value; } } - public double? Sellmeijer2ForcesPipingFactor // real result piping - { - get { return this.sellmeijer2ForcesPipingFactor; } - set { this.sellmeijer2ForcesPipingFactor = value; } - } - - public double? Sellmeijer2ForcesHCritical // real result piping - { - get { return this.sellmeijer2ForcesHCritical; } - set { this.sellmeijer2ForcesHCritical = value; } - } - public double? Sellmeijer4ForcesPipingFactor // real result piping { get { return this.sellmeijer4ForcesPipingFactor; } @@ -1186,721 +591,107 @@ get { return this.nwoResultIndex; } } - public double? NWOLocationXrdStart + public double? NWOLocationXrdStart // real result nwostab { get { return this.locationXrdStart; } } - public double? NWOLocationYrdStart + public double? NWOLocationYrdStart // real result nwostab { get { return this.locationYrdStart; } } - public double? NWOLocationZrdStart + public double? NWOLocationZrdStart // real result nwostab { get { return this.locationZrdStart; } } - public double? NWOLocationXrdEnd + public double? NWOLocationXrdEnd // real result nwostab { get { return this.locationXrdEnd; } } - public double? NWOLocationYrdEnd + public double? NWOLocationYrdEnd // real result nwostab { get { return this.locationYrdEnd; } } - public double? NWOLocationZrdEnd { get { return this.locationZrdEnd; } } + 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 double? DikeToeAtRiverXrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; } - } - - public double? DikeToeAtRiverYrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Y; } - } - - public double? DikeToeAtRiverZrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).Z; } - } - - public double? DikeTopAtRiverXrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X; } - } - - public double? DikeTopAtRiverYrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Y; } - } - - public double? DikeTopAtRiverZrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z; } - } - - public double? DikeTopAtPolderXrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; } - } - - public double? DikeTopAtPolderYrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Y; } - } - - public double? DikeTopAtPolderZrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z; } - } - - public double? DikeToeAtPolderXrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X; } - } - - public double? DikeToeAtPolderYrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Y; } - } - - public double? DikeToeAtPolderZrd // input - { - get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; } - } - - public double? FlowSlideSafetyFactor // real result flowslide - { - get { return this.safetyFactorFlowSlide; } - set { this.safetyFactorFlowSlide = value; } - } - - public DesignScenario Scenario // holds input as well as results. must not be part of result xml in itself - { - get { return scenario; } - set { scenario = value; } - } - - public SoilProfile1D SoilProfile //##Bka : only used internally, no need to return as real result - { - get { return soilProfile; } - set { soilProfile = value; } - } - - public string SoilGeometry2DName //##Bka : only used internally, no need to return as real result - { - get { return soilGeometry2DName; } - set { soilGeometry2DName = value; } - } - - /// - /// Creates a new instance based on - /// with global coordinates instead of local coordinates. - /// - public SurfaceLine2 CreateRedesignedSurfaceLineStabilityGlobal() - { - if (this.RedesignedSurfaceLine2Stability == null) - return null; - - SurfaceLine2 originalSurfaceLine = this.Scenario.Location.SurfaceLine2; - var coordinateSystemConverter = new CoordinateSystemConverter(); - coordinateSystemConverter.DefineGlobalXYZBasedOnLine(originalSurfaceLine.Geometry); - - var redesignedSurfaceLineStabilityGlobal = new SurfaceLine2 - { - CharacteristicPoints = { GeometryMustContainPoint = true }, - Geometry = new GeometryPointString() - }; - redesignedSurfaceLineStabilityGlobal.Assign(this.RedesignedSurfaceLine2Stability); - coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(redesignedSurfaceLineStabilityGlobal.Geometry); - - return redesignedSurfaceLineStabilityGlobal; - } - public SurfaceLine2 RedesignedSurfaceLine2Stability // real result stab { get { return redesignedSurfaceLineStability; } set { redesignedSurfaceLineStability = value; } } - /// - /// Creates a new instance based on - /// with global coordinates instead of local coordinates. - /// - public SurfaceLine2 CreateRedesignedSurfaceLinePipingGlobal() - { - if (this.RedesignedSurfaceLine2Piping == null) - return null; - - SurfaceLine2 originalSurfaceLine = this.Scenario.Location.SurfaceLine2; - var coordinateSystemConverter = new CoordinateSystemConverter(); - coordinateSystemConverter.DefineGlobalXYZBasedOnLine(originalSurfaceLine.Geometry); - - var redesignedSurfaceLinePipingGlobal = new SurfaceLine2 - { - CharacteristicPoints = { GeometryMustContainPoint = true }, - Geometry = new GeometryPointString() - }; - redesignedSurfaceLinePipingGlobal.Assign(this.RedesignedSurfaceLine2Piping); - coordinateSystemConverter.ConvertLocalXZToGlobalXYZ(redesignedSurfaceLinePipingGlobal.Geometry); - - return redesignedSurfaceLinePipingGlobal; - } - public SurfaceLine2 RedesignedSurfaceLine2Piping // real result piping { get { return redesignedSurfaceLinePiping; } set { redesignedSurfaceLinePiping = value; } } - [XmlIgnore] - public string ProfileName // derived input - { - get - { - var res = ""; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityOutside: - case FailureMechanismSystemType.StabilityInside: - res = StabilityProfileName; - break; - case FailureMechanismSystemType.Piping: - res = PipingProfileName; - break; - } - return res; - } - } - - [XmlIgnore] - public double? ProfileProbability // derived input - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityOutside: - case FailureMechanismSystemType.StabilityInside: - res = StabilityProfileProbability; - break; - case FailureMechanismSystemType.Piping: - res = PipingProfileProbability; - break; - } - return res; - } - } - - [XmlIgnore] - public MStabModelType? StabilityModel // derived input - { - get - { - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityOutside: - case FailureMechanismSystemType.StabilityInside: - return damFailureMechanismeCalculationSpecification.FailureMechanismeParamatersMStab.MStabParameters.Model; - default: - return null; - } - } - } - - [XmlIgnore] - public double? SafetyFactor // derived result - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityOutside: - case FailureMechanismSystemType.StabilityInside: - res = StabilitySafetyFactor; - break; - case FailureMechanismSystemType.Piping: - res = PipingFactor; - break; - case FailureMechanismSystemType.FlowSlide: - res = FlowSlideSafetyFactor; - break; - } - return res; - } - } - - [XmlIgnore] - public double? FailureProbability // derived result - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.HorizontalBalance: - case FailureMechanismSystemType.StabilityOutside: - case FailureMechanismSystemType.StabilityInside: - res = StabilityFailureProbability; - break; - case FailureMechanismSystemType.Piping: - res = PipingFailureProbability; - break; - } - return res; - } - } - - [XmlIgnore] - public double? RequiredFailureProbability // derived input - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.Piping: - res = RequiredFailureProbabilityPiping; - break; - } - return res; - } - } - - [XmlIgnore] - public double? RequiredSafetyFactor // derived input - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityOutside: - res = RequiredSafetyFactorStabilityOuterSlope; - break; - case FailureMechanismSystemType.StabilityInside: - res = RequiredSafetyFactorStabilityInnerSlope; - break; - case FailureMechanismSystemType.Piping: - res = RequiredSafetyFactorPiping; - break; - } - return res; - } - } - - [XmlIgnore] - public double? ShoulderHeight // derived result - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityInside: - res = StabilityShoulderHeight; - break; - case FailureMechanismSystemType.Piping: - res = PipingShoulderHeight; - break; - } - return res; - } - } - - [XmlIgnore] - public double? ToeAtPolderX // derived result - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityInside: - res = StabilityToeAtPolderX; - break; - case FailureMechanismSystemType.Piping: - res = PipingToeAtPolderX; - break; - } - return res; - } - } - - [XmlIgnore] - public double? ToeAtPolderZ // derived result - { - get - { - double? res = null; - switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType) - { - case FailureMechanismSystemType.StabilityInside: - res = StabilityToeAtPolderZ; - break; - case FailureMechanismSystemType.Piping: - res = PipingToeAtPolderZ; - break; - } - return res; - } - } - - [XmlIgnore] - public PipingModelType? PipingModel // input - { - get - { - if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) - { - return damFailureMechanismeCalculationSpecification.PipingModelType; - } - return null; - } - } - - [XmlIgnore] - public double? PipingFactor // derived result - { - get - { - double? res = null; - if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) - { - switch (damFailureMechanismeCalculationSpecification.PipingModelType) - { - case PipingModelType.Bligh: - res = BlighPipingFactor; - break; - case PipingModelType.Sellmeijer: - res = SellmeijerPipingFactor; - break; - case PipingModelType.Sellmeijer2Forces: - res = Sellmeijer2ForcesPipingFactor; - break; - case PipingModelType.Sellmeijer4Forces: - res = Sellmeijer4ForcesPipingFactor; - break; - case PipingModelType.Wti2017: - res = Wti2017PipingFactor; - break; - } - } - return res; - } - } - - [XmlIgnore] - public double? LocalPipingEntryPointX // derived result or input - { - get - { - GeometryPoint point = null; - if (this.RedesignedSurfaceLine2Piping != null) - { - point = this.RedesignedSurfaceLine2Piping.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); - } - else - { - point = this.scenario.Location.LocalXZSurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); - } - if (point != null) - return point.X; - else - return null; - } - } - - [XmlIgnore] - public double? PipingEntryPointX // derived result - { - get - { - if (this.LocalPipingEntryPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalPipingEntryPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - [XmlIgnore] - public double? PipingEntryPointY // derived result - { - get - { - if (this.LocalPipingEntryPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalPipingEntryPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - public double? LocalPipingExitPointX // real result piping { get { return localPipingExitPointX; } set { localPipingExitPointX = value; } } - [XmlIgnore] - public double? PipingExitPointX // derived result - { - get - { - if (this.LocalPipingExitPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalPipingExitPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.X; - } - } - - [XmlIgnore] - public double? PipingExitPointY // derived result - { - get - { - if (this.LocalPipingExitPointX == null) - return null; - - GeometryPoint point = DetermineGlobalPointCoordinatesBasedOnGlobalSurfaceLine( - new GeometryPoint(this.LocalPipingExitPointX.Value, 0.0), this.Scenario.Location.SurfaceLine2); - - return point.Y; - } - } - - public double? SeepageLength // derived result - { - get { return LocalPipingExitPointX - LocalPipingEntryPointX; } - } - - [XmlIgnore] - public double? HCritical // derived - { - get - { - double? res = null; - if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.Piping) - { - switch (damFailureMechanismeCalculationSpecification.PipingModelType) - { - case PipingModelType.Bligh: - res = BlighHCritical; - break; - case PipingModelType.Sellmeijer: - res = SellmeijerHCritical; - break; - case PipingModelType.Sellmeijer2Forces: - res = Sellmeijer2ForcesHCritical; - break; - case PipingModelType.Sellmeijer4Forces: - res = Sellmeijer4ForcesHCritical; - break; - case PipingModelType.Wti2017: - res = Wti2017HCritical; - break; - } - } - return res; - } - } - public string BaseFileName // real result for all except flowslide. Is base for derived props. { get { return baseFileName; } set { baseFileName = value; } } - public string CalculationSubDir // input - { - get { return calculationSubDir; } - set { calculationSubDir = value; } - } - - public ResultEvaluation ResultEvaluation // input - { - get { return resultEvaluation; } - set - { - resultEvaluation = value; - } - } - - public string Notes // input - { - get { return notes; } - set - { - notes = value; - } - } - /// - /// Returns the begin point and end point as a list - /// - [XmlIgnore] - public List Points // derived nwo results - { - get - { - if (dirty) - { - dirty = false; - points.Clear(); - if (this.locationXrdStart.HasValue && this.locationYrdStart.HasValue) - { - points.Add(new GeometryPoint(this.locationXrdStart.Value, this.locationYrdStart.Value)); - } - if (this.locationXrdEnd.HasValue && this.locationYrdEnd.HasValue) - { - points.Add(new GeometryPoint(this.locationXrdEnd.Value, this.locationYrdEnd.Value)); - } - } - - return points; - } - } - - /// /// Copy data /// - /// - public void Assign(CsvExportData csvExportData) + /// + public void Assign(DesignResult designResult) { - this.id = csvExportData.id; - this.BaseFileName = csvExportData.BaseFileName; - this.CalculationSubDir = csvExportData.CalculationSubDir; - this.NumberOfIterations = csvExportData.NumberOfIterations; - this.dike = csvExportData.dike; - this.damFailureMechanismeCalculationSpecification = csvExportData.damFailureMechanismeCalculationSpecification; - this.Scenario = csvExportData.Scenario; - this.SoilProfile = csvExportData.SoilProfile; - this.SoilGeometry2DName = csvExportData.SoilGeometry2DName; - this.probabilisticType = csvExportData.ProbabilisticType; - - this.failureProbabilityPiping = csvExportData.failureProbabilityPiping; - this.redesignedSurfaceLinePiping = csvExportData.redesignedSurfaceLinePiping; - this.safetyFactorStability = csvExportData.safetyFactorStability; - this.failureProbabilityStability = csvExportData.failureProbabilityStability; - this.zone1SafetyFactorStability = csvExportData.zone1SafetyFactorStability; - this.LocalZone1EntryPointX = csvExportData.LocalZone1EntryPointX; - this.LocalZone1ExitPointX = csvExportData.LocalZone1ExitPointX; - this.zone2SafetyFactorStability = csvExportData.zone2SafetyFactorStability; - this.LocalZone2EntryPointX = csvExportData.LocalZone2EntryPointX; - this.LocalZone2ExitPointX = csvExportData.LocalZone2ExitPointX; - this.blighPipingFactor = csvExportData.blighPipingFactor; - this.blighHCritical = csvExportData.blighHCritical; - this.sellmeijer2ForcesPipingFactor = csvExportData.sellmeijer2ForcesPipingFactor; - this.sellmeijer2ForcesHCritical = csvExportData.sellmeijer2ForcesHCritical; - this.sellmeijer4ForcesPipingFactor = csvExportData.sellmeijer4ForcesPipingFactor; - this.sellmeijer4ForcesHCritical = csvExportData.sellmeijer4ForcesHCritical; - this.sellmeijerPipingFactor = csvExportData.sellmeijerPipingFactor; - this.sellmeijerHCritical = csvExportData.sellmeijerHCritical; - this.wti2017PipingFactor = csvExportData.wti2017PipingFactor; - this.wti2017HCritical = csvExportData.wti2017HCritical; - this.redesignedSurfaceLineStability = csvExportData.redesignedSurfaceLineStability; - this.calculationResult = csvExportData.calculationResult; + 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; } /// - /// Copies the result file. - /// - /// The extension. - private void CopyResultFile(string extension) - { - string copyResFile = Path.GetDirectoryName(InputFile) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(InputFile) + " (copy)" + extension; - var resFile = Path.ChangeExtension(InputFile, extension); - File.Copy(resFile, copyResFile, true); - } - - private string GetCurrentExeForOpenCalculationFile() - { - var exeName = DamProjectData.MStabExePath; - if (SelectedStabilityKernelType != StabilityKernelType.DamClassic) - { - exeName = Path.GetDirectoryName(exeName) + "\\MStab.exe"; - } - return exeName; - } - - /// - /// Opens the calculation file. - /// - public void OpenCalculationFile() - { - if (File.Exists(InputFile)) - { - string copyFile = Path.GetDirectoryName(InputFile) + Path.DirectorySeparatorChar + - Path.GetFileNameWithoutExtension(InputFile) + " (copy)" + Path.GetExtension(InputFile); - File.Copy(InputFile, copyFile, true); - var exeName = GetCurrentExeForOpenCalculationFile(); - if (SelectedStabilityKernelType == StabilityKernelType.DamClassic) - { - const string stdExtension = ".std"; - CopyResultFile(stdExtension); - - const string stoExtension = ".sto"; - CopyResultFile(stoExtension); - } - Process process = new Process(); - process.StartInfo.RedirectStandardOutput = false; - process.StartInfo.FileName = exeName; - if (SelectedStabilityKernelType == StabilityKernelType.DamClassicWti || - SelectedStabilityKernelType == StabilityKernelType.AdvancedWti) - { - process.StartInfo.Arguments = " -rto " + " \"" + copyFile + "\""; - } - else - { - process.StartInfo.Arguments = " \"" + copyFile + "\""; - } - process.StartInfo.UseShellExecute = false; - process.StartInfo.WindowStyle = ProcessWindowStyle.Normal; - process.Start(); - } - else - { - if (File.Exists(PipingResultFile)) - { - string copyFile = Path.GetTempPath() + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(PipingResultFile) + " (copy)" + - Path.GetExtension(PipingResultFile); - - File.Copy(PipingResultFile, copyFile, true); - System.Diagnostics.Process.Start(copyFile); - } - } - } - - /// /// Make a clone of object /// /// public object Clone() { - CsvExportData csvExportData = new CsvExportData(this.id, this.dike, this.damFailureMechanismeCalculationSpecification, this.Scenario, - this.SoilProfile, this.SoilGeometry2DName, this.analysisType, this.nwoResultIndex, this.probabilisticType); + var soilProfile = new SoilProfile1D(); + var soilGeometry2DName = ""; + DesignResult designResult = new DesignResult(id, DamFailureMechanismeCalculation, Scenario, + soilProfile, soilGeometry2DName, AnalysisType, nwoResultIndex, ProbabilisticType); - csvExportData.Assign(this); + designResult.Assign(this); - return csvExportData; + return designResult; } } } \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/DamProjectData.cs =================================================================== diff -u -r350 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/DamProjectData.cs (.../DamProjectData.cs) (revision 350) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/DamProjectData.cs (.../DamProjectData.cs) (revision 404) @@ -50,7 +50,7 @@ private List jobs = new List(); private SchematizationFactorData schematizationFactorData = new SchematizationFactorData(); private List calculations = null; // will be created and initialized in property - private List designCalculations = null; + private List designCalculations = null; private List schematizationFactors = null; private SensorData sensorData; @@ -246,7 +246,7 @@ { if (designCalculations == null) { - designCalculations = new List(); + designCalculations = new List(); } else { @@ -263,7 +263,7 @@ } [XmlIgnore] - public List DesignCalculations + public List DesignCalculations { get { Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Stability/StabilityCalculation.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Stability/StabilityCalculation.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Stability/StabilityCalculation.cs (revision 404) @@ -0,0 +1,506 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection; +using System.Text; +using System.Xml.Serialization; +using Deltares.DamEngine.Calculators.Stability; +using Deltares.DamEngine.Data.Standard.Calculation; +using Deltares.DamEngine.Data.Standard.Logging; + +#if DELPHI +using Dump; +using InterfaceData; +using MStabDataTypes; +using StartCalculation; +#else + +#endif + +namespace Deltares.Stability.Calculation +{ + public delegate void Func(String aMsg); + + public class StabilityCalculation : ICalculation, IDisposable + { +// private TStartCalculation calculationmodule = new TStartCalculation(); +// private TDump dumpdata = null; + + private StringBuilder log = new StringBuilder(); + private MStabProject mStabProject = null; + + /// + /// Marks if is a composite child of this class and should + /// be disposed in or not. + /// + private bool mStabProjectIsCompositeChild = false; + + public StabilityCalculation() {} + + #region ICalculation Members + + public string Version + { + get + { + // if (calculationmodule == null) + { + return ""; + } +// else +// { +// return calculationmodule.Version(); +// } + } + } + + public IList Messages + { + get + { + // if (mStabProject == null) + { + return new List(); + } +// else +// { +// return mStabProject.Messages; +// } + } + } + + public CalculationResult RegisterUserAbort(UserAbortDelegate userAbortDelegate) + { +// if (calculationmodule == null) +// { +// return CalculationResult.UnexpectedError; +// } +// else +// { +// var lp = (TUserAbortDelegate) Delegate.CreateDelegate(typeof(TUserAbortDelegate), userAbortDelegate.Target, userAbortDelegate.Method.Name); +// calculationmodule.SetUserAbortDelegate(lp); +// return CalculationResult.Succeeded; +// } + return CalculationResult.UnexpectedError; + } + + public CalculationResult RegisterSendMessage(SendMessageDelegate sendMessageDelegate) + { + // if (calculationmodule == null) + // { + // return CalculationResult.UnexpectedError; + // } + // else + // { + // //var lp = (TSendMessageDelegate) Delegate.CreateDelegate(typeof (TSendMessageDelegate), sendMessageDelegate.Target, sendMessageDelegate.Method.Name); + // //this.calculationmodule.SetSendMessageDelegate(lp); + // return CalculationResult.Succeeded; + // } + return CalculationResult.UnexpectedError; + } + + public CalculationResult RegisterSendDebugInfo(SendDebugInfodelegate sendDebugInfoDelegate) + { + // if (calculationmodule == null) + // { + // return CalculationResult.UnexpectedError; + // } + // else + // { + // var d = (Delegate) sendDebugInfoDelegate; + // calculationmodule.SetSendDebugInfoDelegate((TSendDebugInfoDelegate) d); + // return CalculationResult.Succeeded; + // } + return CalculationResult.UnexpectedError; + } + + public CalculationResult Load(string input) + { + //input will be an xml string + + //Loads the input file and create a filled mStabProject + if (input.Length == 0) + { + return CalculationResult.NoInput; + } + + if (input.ToLower().EndsWith(".xml") || input.ToLower().EndsWith(".dsx")) + { + try + { + mStabProject = LoadXML(input); + } + catch (Exception e) + { + log.AppendLine(e.Message); + log.AppendLine(e.StackTrace); + return CalculationResult.UnexpectedError; + } + } + else if (input.ToLower().EndsWith(".sti")) + { + try + { + mStabProject = LoadSTI(input); + } + catch (Exception e) + { + log.AppendLine(e.Message); + log.AppendLine(e.StackTrace); + return CalculationResult.UnexpectedError; + } + } + else + { + try + { + mStabProject = LoadXMLString(input); + } + catch (Exception e) + { + log.AppendLine(e.Message); + log.AppendLine(e.StackTrace); + return CalculationResult.UnexpectedError; + } + } + + mStabProjectIsCompositeChild = true; + return CalculationResult.Succeeded; + } + + public CalculationResult Validate() + { + // if (calculationmodule == null) + // { + // return CalculationResult.UnexpectedError; + // } + // else + // { + // return (CalculationResult) calculationmodule.Validate(); + // } + return CalculationResult.UnexpectedError; + } + + /// + /// Triggers the StartCalculation (Delphi.Net Stability.Package assembly) + /// + public CalculationResult Run() + { + // //Load all stability objects + // TInterfaceData stabilityObjects = LoadStabilityObjects(); + // + // //Start Calculation + // if (stabilityObjects != null) + // { + // stabilityObjects.SetExePath(Assembly.GetExecutingAssembly().CodeBase); + // } + // + // var result = CalculationResult.Succeeded; + // + // try + // { + // dumpdata = new TDump(); + // result = (CalculationResult) calculationmodule.Calculate(stabilityObjects, dumpdata); //Calculate should return results + // + // //DataEventPublisher.IsDataEventPublishStopped = true; + // mStabProject.SlidingData = ConvertDumpData2CalculationResults.Convert(dumpdata, mStabProject.Stability.SoilProfile); + // } + // catch (Exception e) + // { + // result = CalculationResult.UnexpectedError; + // var logMessage = new LogMessage(LogMessageType.FatalError, this, e.Message); + // mStabProject.Messages.Add(logMessage); + // log.AppendLine(e.Message); + // log.AppendLine(e.StackTrace); + // } + // finally + // { + // //DataEventPublisher.IsDataEventPublishStopped = false; + // } + // + // return result; + return CalculationResult.UnexpectedError; + } + + public CalculationResult GetResults(ref string results) + { + if (mStabProject != null) + { +// if (mStabProject.SlidingData != null) +// { +// var serializer = new XmlSerializer(); +// results = serializer.SerializeToString(mStabProject); +// return CalculationResult.Succeeded; +// } +// else + { + return CalculationResult.RunFailed; + } + } + else + { + return CalculationResult.InvalidInputData; + } + } + + public CalculationResult RegisterProgress(ProgressDelegate progressDelegate) + { + // if (calculationmodule == null) + // { + // return CalculationResult.UnexpectedError; + // } + // else + // { + // var lp = (ProgressDelegate) Delegate.CreateDelegate(typeof(ProgressDelegate), progressDelegate.Target, progressDelegate.Method.Name); + // calculationmodule.SetProgressDelegate(lp); + // return CalculationResult.Succeeded; + // } + return CalculationResult.UnexpectedError; + } + + public CalculationResult RegisterGetValues(GetValuesDelegate getValuesDelegate) + { + // if (calculationmodule == null) + // { + // return CalculationResult.UnexpectedError; + // } + // else + // { + // var lp = (TGetValuesDelegate) Delegate.CreateDelegate(typeof(TGetValuesDelegate), getValuesDelegate.Target, getValuesDelegate.Method.Name); + // calculationmodule.SetGetValuesDelegate(lp); + // return CalculationResult.Succeeded; + // } + return CalculationResult.UnexpectedError; + } + + public CalculationResult RegisterSetValues(SetValuesDelegate setValuesDelegate) + { + // if (calculationmodule == null) + // { + // return CalculationResult.UnexpectedError; + // } + // else + // { + // var lp = (TSetValuesDelegate) Delegate.CreateDelegate(typeof(TSetValuesDelegate), setValuesDelegate.Target, setValuesDelegate.Method.Name); + // calculationmodule.SetSetValuesDelegate(lp); + // return CalculationResult.Succeeded; + // } + return CalculationResult.UnexpectedError; + } + + #endregion + + public MStabProject LoadXML(string aXMLFile) + { + //Create MStab project + MStabProject myStabProject = null; + + //Initialize NewMStab Objects + +// var classFactory = new ClassFactory(); +// DataEventPublisher.InvokeWithoutPublishingEvents(() => +// { +// try +// { +// var Deserializer = new XmlDeserializer(); +// myStabProject = (MStabProject) Deserializer.XmlDeserialize(aXMLFile, typeof(MStabProject), classFactory); +// myStabProject.OriginalStiFileName = aXMLFile; +// } +// catch (Exception e) +// { +// Debug.Assert(false, e.ToString()); +// } +// }); + return myStabProject; + } + + public MStabProject LoadXMLString(string xml) + { + //Create MStab project + MStabProject myStabProject = null; + + //Initialize NewMStab Objects + +// var classFactory = new ClassFactory(); +// DataEventPublisher.InvokeWithoutPublishingEvents(() => +// { +// try +// { +// var Deserializer = new XmlDeserializer(); +// myStabProject = (MStabProject) Deserializer.XmlDeserializeFromString(xml, typeof(MStabProject), classFactory); +// myStabProject.OriginalStiFileName = "string.xml"; +// } +// catch (Exception e) +// { +// Debug.Assert(false, e.ToString()); +// } +// }); + return myStabProject; + } + + //Temporally funcion + public static void Save2XML(MStabProject aMStabProject, string aXMLFileName) + { +// try +// { +// var Serializer = new XmlSerializer(); +// Serializer.Serialize(aMStabProject, aXMLFileName); +// } +// catch (Exception e) +// { +// Debug.Assert(false, e.ToString()); +// } + } + + /// + /// Load STI file and return the MStabProject object + /// + /// Filename of STI file + /// MStabProject project + public static MStabProject LoadSTI(string aSTIFile) + { + try + { + //var converter = new Converter(); + + MStabProject project = new MStabProject(); +// project.SetStabilityModel(converter.ConvertClassicMStab(aSTIFile)); +// +// if (project != null) +// { +// project.OriginalStiFileName = aSTIFile; +// return project; +// } + } + catch (Exception e) + { + Debug.Assert(false, e.ToString()); + } + return null; + } + + /// + /// Converts given STI file into an xml file + /// + /// STI input file + /// XML input file + public static void ConvertSti2XML(string aSTIFile, string aXMLFile) + { + using (MStabProject myStabProject = LoadSTI(aSTIFile)) + { + Save2XML(myStabProject, aXMLFile); + } + } + +// public TInterfaceData LoadStabilityObjects() +// { +// var stabilityObjects = new TInterfaceData(); +// try +// { +// LoadObjects.LoadGeometry(mStabProject, ref stabilityObjects); +// LoadObjects.LoadSoil(mStabProject, ref stabilityObjects); +// LoadObjects.LoadWaternet(mStabProject, ref stabilityObjects); +// LoadObjects.LoadWaternet(mStabProject, ref stabilityObjects); +// LoadObjects.LoadGeoTextiles(mStabProject, ref stabilityObjects); +// LoadObjects.LoadDefinitions(mStabProject, ref stabilityObjects); +// LoadObjects.LoadCalculations(mStabProject, ref stabilityObjects); +// LoadObjects.LoadLoads(mStabProject, ref stabilityObjects); +// stabilityObjects.SetTutorialFileName(mStabProject.OriginalStiFileName); +// CalculationDelegateFunctions.SetDelegateFunctions(ref stabilityObjects, mStabProject); +// } +// catch (GeometryException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (SoilException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (WaternetException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (GeoTextileException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (DefinitionException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (CalculationsException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (LoadsException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// catch (DelegateFunctionsException e) +// { +// Debug.WriteLine(e.ToString()); +// return stabilityObjects; +// } +// return stabilityObjects; +// } + + public CalculationResult DoCalculate(string input, ref string output) + { + CalculationResult result = Load(input); + if (result == CalculationResult.Succeeded) + { + result = Validate(); + + if (result == CalculationResult.Succeeded) + { + result = Run(); + if (result == CalculationResult.Succeeded) + { + result = GetResults(ref output); + } + else + { + output = log.ToString(); + } + } + else + { + output = log.ToString(); + } + } + else + { + output = log.ToString(); + } + + return result; + } + + /// + /// Claims the loaded (from ) that is + /// the composite child of , turning that instance + /// into an aggregate child of instead. + /// + /// The loaded project or null if no project has been loaded yet. + public MStabProject ClaimLoadedMStabProject() + { + mStabProjectIsCompositeChild = false; + return mStabProject; + } + + public void Dispose() + { + if (mStabProjectIsCompositeChild && mStabProject != null) + { + mStabProject.Dispose(); + } + } + } +} \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/SchematizationFactor/SchematizationFactorCalculation.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/SchematizationFactor/SchematizationFactorCalculation.cs (.../SchematizationFactorCalculation.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/SchematizationFactor/SchematizationFactorCalculation.cs (.../SchematizationFactorCalculation.cs) (revision 404) @@ -12,15 +12,16 @@ { public class SchematizationFactorIntermediate { - private SoilProfile1D soilProfile; + private string soilProfileName; private double safetyFactor; private double probPercentage; private double summedProbPercentage; - public SoilProfile1D SoilProfile + public string SoilProfileName + { - get { return soilProfile; } - set { soilProfile = value; } + get { return soilProfileName; } + set { soilProfileName = value; } } public double SafetyFactor @@ -146,11 +147,11 @@ var results = new RWSchematizationFactorsResult(); var macroStabilityInnerSideWetResult = - CalculateSchematizationFactorResultForType(SchematizationType.MacroStabiltyInnerSideWet); + CalculateSchematizationFactorResultForType(SchematizationType.MacroStabilityInnerSideWet); results.SchematizationFactorResults.Add(macroStabilityInnerSideWetResult); var macroStabiltyInnerSideDryResult = - CalculateSchematizationFactorResultForType(SchematizationType.MacroStabiltyInnerSideDry); + CalculateSchematizationFactorResultForType(SchematizationType.MacroStabilityInnerSideDry); results.SchematizationFactorResults.Add(macroStabiltyInnerSideDryResult); return results; @@ -210,7 +211,7 @@ // hij toch liever 0 of 100% ziet. schematizationFactorResult.SummedProfileProbability = mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SummedProbPercentage; - schematizationFactorResult.OriginalDecisiveSoilProfileName = mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SoilProfile.Name; + schematizationFactorResult.OriginalDecisiveSoilProfileName = mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SoilProfileName; while (!CheckOnB7(mswIntermediates, basicSchematization, allowedProbability, schematizationFactor)) { //increase Pallowed @@ -234,7 +235,7 @@ schematizationFactorResult.SummedProfileProbability = mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SummedProbPercentage; schematizationFactorResult.SoilProfileName = - mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SoilProfile.Name; + mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SoilProfileName; schematizationFactorResult.DecisiveScenarioName = decisiveScenarioResults.ScenarioType; schematizationFactorResult.SafetyFactor = mswIntermediates.SchematizationFactorIntermediates[basicSchematization].SafetyFactor; @@ -281,8 +282,8 @@ { var inter = new SchematizationFactorIntermediate(); inter.SafetyFactor = rwScenarioProfileResult.SafetyFactor; - inter.SoilProfile = rwScenarioProfileResult.SoilGeometryProbability.SoilProfile; - inter.ProbPercentage = rwScenarioProfileResult.SoilGeometryProbability.Probability; + inter.SoilProfileName = rwScenarioProfileResult.SoilProfileName; + inter.ProbPercentage = rwScenarioProfileResult.SoilProfileProbability; intermediateResults.SchematizationFactorIntermediates.Add(inter); } intermediateResults.SortBySafetyFactor(); @@ -296,7 +297,7 @@ double minSafetyFactor = Double.MaxValue; switch (schematizationType) { - case SchematizationType.MacroStabiltyInnerSideWet: + case SchematizationType.MacroStabilityInnerSideWet: { // scenarios 3, 4, 7 and 8 are relevant. foreach (RWScenarioResult scenarioResult in scenariosResult.RWScenarioResults) @@ -319,7 +320,7 @@ } break; } - case SchematizationType.MacroStabiltyInnerSideDry: + case SchematizationType.MacroStabilityInnerSideDry: { // scenarios 1, 2, 5 and 6 are relevant. foreach (RWScenarioResult scenarioResult in scenariosResult.RWScenarioResults) Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculator.cs =================================================================== diff -u -r354 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculator.cs (.../DamProjectCalculator.cs) (revision 354) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculator.cs (.../DamProjectCalculator.cs) (revision 404) @@ -150,7 +150,7 @@ /// /// Perform the calculations /// - public List> Calculate(DamProjectData damProjectData, IList scenarios) + public List> Calculate(DamProjectData damProjectData, IList scenarios) { foreach (var scenario in scenarios) { @@ -292,7 +292,7 @@ { // Save the results after each calculation, because these will be deleted in the next calculation - var calculationresults = new List(); + var calculationresults = new List(); foreach (var calculationSpecification in damProjectCalculationSpecification.DamCalculationSpecifications) { @@ -365,7 +365,7 @@ // First perform calculate Bishop CalculateOneCalculationTypeForScenario(scenario, bishopCalculationSpecification, probabilisticType, analysisType); // Save the results, because these will be deleted in the next calculation - var calculationresults = new List(); + var calculationresults = new List(); calculationresults.AddRange(scenario.CalculationResults); // Now run LiftVan calculation CalculateOneCalculationTypeForScenario(scenario, liftvanCalculationSpecification, probabilisticType, analysisType); @@ -606,9 +606,7 @@ soilProfileProbability.SoilGeometryName); scenario.SetResultMessage(soilProfileProbability.SoilProfile, soilProfileProbability.SoilGeometry2DName, exception.Message); - var resultRecord = new CsvExportData( - "Error: " + exception.Message, - dike, + var resultRecord = new DesignResult("Error: " + exception.Message, damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications[0], scenario, soilProfileProbability.SoilProfile, @@ -638,7 +636,7 @@ /// /// true if it is Bishop; otherwise, false. /// - private bool IsBishopResult(CsvExportData calculationResult) + private bool IsBishopResult(DesignResult calculationResult) { return ((calculationResult.DamFailureMechanismeCalculation.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) && (calculationResult.DamFailureMechanismeCalculation.FailureMechanismeParamatersMStab.MStabParameters.Model == MStabModelType.Bishop)); @@ -651,7 +649,7 @@ /// /// true if it is UpliftVan; otherwise, false. /// - private bool IsUpliftVanResult(CsvExportData calculationResult) + private bool IsUpliftVanResult(DesignResult calculationResult) { return ((calculationResult.DamFailureMechanismeCalculation.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) && (calculationResult.DamFailureMechanismeCalculation.FailureMechanismeParamatersMStab.MStabParameters.Model == MStabModelType.UpliftVan)); @@ -661,11 +659,11 @@ /// Create new results depending on Uplift /// /// - private void PostprocessForStabilityUpliftVanBishop(ref List> allCalculationResults) + private void PostprocessForStabilityUpliftVanBishop(ref List> allCalculationResults) { - var normativeCalculationResults = new List(); - var bishopCalculationResults = new List(); - var upliftVanCalculationResults = new List(); + var normativeCalculationResults = new List(); + var bishopCalculationResults = new List(); + var upliftVanCalculationResults = new List(); // First collect all Bishop and Uplift calculations foreach (var calculationResults in allCalculationResults) @@ -691,15 +689,15 @@ bishopLiftvancalculation.FailureMechanismeParamatersMStab.MStabParameters.Model = MStabModelType.BishopUpliftVan; foreach (var bishopCalculationRecord in bishopCalculationResults) { - CsvExportData liftVanCalculationResult = (from calculationResult in upliftVanCalculationResults + DesignResult liftVanCalculationResult = (from calculationResult in upliftVanCalculationResults where calculationResult.LocationName.Equals(bishopCalculationRecord.LocationName) && calculationResult.ScenarioName.Equals(bishopCalculationRecord.ScenarioName) && calculationResult.StabilityProfileName.Equals(bishopCalculationRecord.StabilityProfileName) select calculationResult).ToList().FirstOrDefault(); - CsvExportData normativeCalculationResult = SelectStabilityNormativeResult(bishopCalculationRecord, liftVanCalculationResult, + DesignResult normativeCalculationResult = SelectStabilityNormativeResult(bishopCalculationRecord, liftVanCalculationResult, bishopCalculationRecord.AnalysisType, bishopCalculationRecord.ProbabilisticType); // Clone this result, to make sure the original won't be changed - normativeCalculationResult = (CsvExportData) normativeCalculationResult.Clone(); + normativeCalculationResult = (DesignResult) normativeCalculationResult.Clone(); normativeCalculationResult.DamFailureMechanismeCalculation = bishopLiftvancalculation; normativeCalculationResults.Add(normativeCalculationResult); // Add the normative result also to the scenario @@ -715,7 +713,7 @@ /// /// /// - private CsvExportData SelectStabilityNormativeResult(CsvExportData bishopCalculationRecord, CsvExportData liftVanCalculationResult, AnalysisType analysisType, ProbabilisticType probabilisticType) + private DesignResult SelectStabilityNormativeResult(DesignResult bishopCalculationRecord, DesignResult liftVanCalculationResult, AnalysisType analysisType, ProbabilisticType probabilisticType) { switch (analysisType) { @@ -753,7 +751,7 @@ /// /// /// - private CsvExportData SelectStabilityNormativeResultDeterministicNormal(CsvExportData liftVanCalculationResult, CsvExportData bishopCalculationRecord) + private DesignResult SelectStabilityNormativeResultDeterministicNormal(DesignResult liftVanCalculationResult, DesignResult bishopCalculationRecord) { if ((liftVanCalculationResult != null) && (liftVanCalculationResult.StabilitySafetyFactor.HasValue)) { @@ -780,7 +778,7 @@ /// /// /// - private CsvExportData SelectStabilityNormativeResultProbabilisticDesign(CsvExportData liftVanCalculationResult, CsvExportData bishopCalculationRecord) + private DesignResult SelectStabilityNormativeResultProbabilisticDesign(DesignResult liftVanCalculationResult, DesignResult bishopCalculationRecord) { throw new ApplicationException("Not implemented yet"); } @@ -791,7 +789,7 @@ /// /// /// - private CsvExportData SelectStabilityNormativeResultDeterministicDesign(CsvExportData liftVanCalculationResult, CsvExportData bishopCalculationRecord) + private DesignResult SelectStabilityNormativeResultDeterministicDesign(DesignResult liftVanCalculationResult, DesignResult bishopCalculationRecord) { if ((liftVanCalculationResult != null) && (liftVanCalculationResult.StabilitySafetyFactor.HasValue)) { @@ -830,7 +828,7 @@ /// /// /// - private CsvExportData SelectStabilityNormativeResultProbabilisticNormal(CsvExportData liftVanCalculationResult, CsvExportData bishopCalculationRecord) + private DesignResult SelectStabilityNormativeResultProbabilisticNormal(DesignResult liftVanCalculationResult, DesignResult bishopCalculationRecord) { throw new ApplicationException("Not implemented yet"); } Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/RWSchematizationFactorsResult.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/RWSchematizationFactorsResult.cs (.../RWSchematizationFactorsResult.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/RWSchematizationFactorsResult.cs (.../RWSchematizationFactorsResult.cs) (revision 404) @@ -48,7 +48,7 @@ private double detrimentFactor; private double safetyFactor; - public virtual Location Location + public virtual Location Location // <-- hier verder. gebruik nakijken in Dam new VS12 { get { return location; } set { location = value; } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r350 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 350) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 404) @@ -76,6 +76,7 @@ + Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/DAMEnumerations.cs =================================================================== diff -u -r350 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/DAMEnumerations.cs (.../DAMEnumerations.cs) (revision 350) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/DAMEnumerations.cs (.../DAMEnumerations.cs) (revision 404) @@ -99,8 +99,7 @@ StabilityInside, StabilityOutside, Piping, - HorizontalBalance, - FlowSlide + HorizontalBalance } public enum MStabModelType @@ -120,8 +119,7 @@ public enum PipingModelType { Bligh, - Sellmeijer, - Sellmeijer2Forces, + SellmeijerVnk, Sellmeijer4Forces, Wti2017 }; @@ -268,11 +266,11 @@ public enum SchematizationType //Schematizationfactor { - MacroStabiltyInnerSideWet, - MacroStabiltyInnerSideDry, + MacroStabilityInnerSideWet, + MacroStabilityInnerSideDry, PipingWet, PipingDry, - HorzontalBalanceDry + HorizontalBalanceDry } public enum DataSourceTypeSensors //Sensors Index: dam engine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs =================================================================== diff -u -r337 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs (.../DesignScenario.cs) (revision 337) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Design/DesignScenario.cs (.../DesignScenario.cs) (revision 404) @@ -92,7 +92,7 @@ private CalculationResult calculationResult = CalculationResult.NoRun; private Location location = null; - private readonly List calculationResults = new List(); + private readonly List calculationResults = new List(); private Dictionary stabilityUpliftSituations; private Dictionary pipingResults; @@ -130,7 +130,7 @@ [XmlIgnore] public IList NwoResults { get; set; } - public List CalculationResults + public List CalculationResults { get { return calculationResults; } } Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/PipingResults.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/PipingResults.cs (.../PipingResults.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/PipingResults.cs (.../PipingResults.cs) (revision 404) @@ -27,12 +27,10 @@ public string CalculationSubDir { get; set; } public double? BlighPipingFactor { get; set; } public double? BlighHCritical { get; set; } - public double? Sellmeijer2ForcesPipingFactor { get; set; } - public double? Sellmeijer2ForcesHCritical { get; set; } public double? Sellmeijer4ForcesPipingFactor { get; set; } public double? Sellmeijer4ForcesHCritical { get; set; } - public double? SellmeijerPipingFactor { get; set; } - public double? SellmeijerHCritical { get; set; } + public double? SellmeijerVnkPipingFactor { get; set; } + public double? SellmeijerVnkHCritical { get; set; } public double? Wti2017PipingFactor { get; set; } public double? Wti2017HCritical { get; set; } public double? PipingExitPointX { get; set; } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculator.cs =================================================================== diff -u -r337 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculator.cs (.../DAMFailureMechanismeCalculator.cs) (revision 337) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DAMFailureMechanismeCalculator.cs (.../DAMFailureMechanismeCalculator.cs) (revision 404) @@ -141,8 +141,8 @@ return SelectStabilityProbabilities(soilProfileProbabilities); case FailureMechanismSystemType.Piping: return SelectPipingProbabilities(soilProfileProbabilities); - case FailureMechanismSystemType.FlowSlide: - return SelectFlowSlideProbabilities(soilProfileProbabilities); +// case FailureMechanismSystemType.FlowSlide: +// return SelectFlowSlideProbabilities(soilProfileProbabilities); } return null; } @@ -294,7 +294,7 @@ // betas[i] = 1; // waterLevelProbabilistic.Mean = waterLevels[i]; // string calculationName = String.Format("Prob{0}_Loc({1})_Sce({2})_Pro({3})_wl({4})", -// PipingModelType.Sellmeijer.ToString(), scenario.Location.Name, scenario.LocationScenarioID, soilProfileProbability.SoilGeometryName, i); +// PipingModelType.SellmeijerVnk.ToString(), scenario.Location.Name, scenario.LocationScenarioID, soilProfileProbability.SoilGeometryName, i); // calculationName = Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_"); // pipingCalculator.FilenameCalculation = pipingCalculator.PipingCalculationDirectory + calculationName; // @@ -448,7 +448,7 @@ // throw new DamFailureMechanismeCalculatorException(exception.Message); // } // -// if (pipingCalculationType == PipingModelType.Sellmeijer) +// if (pipingCalculationType == PipingModelType.SellmeijerVnk) // { // scenario.SetSafetyFactorPiping(soilProfileProbability.SoilProfile, soilProfileProbability.SoilGeometry2DName, safetyFactor); // if (ProbabilisticType == ProbabilisticType.ProbabilisticFragility) @@ -473,9 +473,9 @@ // pipingResults.BlighHCritical = pipingCalculator.HCritical; // pipingResults.BlighPipingFactor = safetyFactor; // break; -// case PipingModelType.Sellmeijer: -// pipingResults.SellmeijerHCritical = pipingCalculator.HCritical; -// pipingResults.SellmeijerPipingFactor = safetyFactor; +// case PipingModelType.SellmeijerVnk: +// pipingResults.SellmeijerVnkHCritical = pipingCalculator.HCritical; +// pipingResults.SellmeijerVnkPipingFactor = safetyFactor; // break; // case PipingModelType.Sellmeijer2Forces: // pipingResults.Sellmeijer2ForcesHCritical = pipingCalculator.HCritical; @@ -1323,9 +1323,9 @@ // pipingResults.BlighHCritical = pipingCalculator.HCritical; // pipingResults.BlighPipingFactor = safetyFactor; // break; -// case PipingModelType.Sellmeijer: -// pipingResults.SellmeijerHCritical = pipingCalculator.HCritical; -// pipingResults.SellmeijerPipingFactor = safetyFactor; +// case PipingModelType.SellmeijerVnk: +// pipingResults.SellmeijerVnkHCritical = pipingCalculator.HCritical; +// pipingResults.SellmeijerVnkPipingFactor = safetyFactor; // break; // case PipingModelType.Sellmeijer2Forces: // pipingResults.Sellmeijer2ForcesHCritical = pipingCalculator.HCritical; @@ -1950,7 +1950,7 @@ // case PipingModelType.Bligh: // return new PipingCalculatorBligh(modelParametersForPLLines, // requiredSafetyFactorPiping, location.GaugePLLines, location.Gauges, upliftCriterion); -// case PipingModelType.Sellmeijer: +// case PipingModelType.SellmeijerVnk: // PipingProbabilisticParameters? actualPipingProbabilisticParameters = null; // if ((ProbabilisticType == ProbabilisticType.Probabilistic) || (ProbabilisticType == ProbabilisticType.ProbabilisticFragility)) // { Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculatorCsvExportDataBuilder.cs =================================================================== diff -u -r337 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculatorCsvExportDataBuilder.cs (.../DamProjectCalculatorCsvExportDataBuilder.cs) (revision 337) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/General/DamProjectCalculatorCsvExportDataBuilder.cs (.../DamProjectCalculatorCsvExportDataBuilder.cs) (revision 404) @@ -41,13 +41,13 @@ /// /// Instantiate a new instance of the with general settings which to use in creating - /// . + /// . /// - /// The for which to create . - /// The for which to create . - /// The for which to create . - /// The for which to create . - /// The for which to create + /// The for which to create . + /// The for which to create . + /// The for which to create . + /// The for which to create . + /// The for which to create public DamProjectCalculatorCsvExportDataBuilder(Dike dike, DesignScenario scenario, DamFailureMechanismeCalculationSpecification damFailureMechanismCalculationSpecification, AnalysisType analysisType, ProbabilisticType probabilisticType) { Dike = dike; @@ -59,42 +59,41 @@ } /// - /// Returns a new instance of . Messages that were added using are added to the + /// Returns a new instance of . Messages that were added using are added to the /// and the message queue is cleared. /// - /// The for which to create this . - /// The to set for the to be created . Default is the 0th . - /// The newly constructed with messages appended using . - public CsvExportData Build(SoilGeometryProbability soilGeometryProbability, StabilityKernelType kernelType = (StabilityKernelType) 0) + /// The for which to create this . + /// The to set for the to be created . Default is the 0th . + /// The newly constructed with messages appended using . + public DesignResult Build(SoilGeometryProbability soilGeometryProbability, StabilityKernelType kernelType = (StabilityKernelType) 0) { return Build(soilGeometryProbability, kernelType, 0); } /// - /// Returns a new instance of . Messages that were added using are added to the + /// Returns a new instance of . Messages that were added using are added to the /// and the message queue is cleared. /// - /// The for which to create this . - /// An optional index to associate the with some other object of a list. - /// The newly constructed with messages appended using . - public CsvExportData Build(SoilGeometryProbability soilGeometryProbability, int index) + /// The for which to create this . + /// An optional index to associate the with some other object of a list. + /// The newly constructed with messages appended using . + public DesignResult Build(SoilGeometryProbability soilGeometryProbability, int index) { return Build(soilGeometryProbability, 0, index); } - private CsvExportData Build(SoilGeometryProbability soilGeometryProbability, StabilityKernelType kernelType, int index) + private DesignResult Build(SoilGeometryProbability soilGeometryProbability, StabilityKernelType kernelType, int index) { - var data = new CsvExportData( + var data = new DesignResult( Message.ToString(), - Dike, FailureMechanismSystemType, Scenario, soilGeometryProbability.SoilProfile, soilGeometryProbability.SoilGeometry2DName, AnalysisType, index, ProbabilisticType); - data.SelectedStabilityKernelType = kernelType; + //data.SelectedStabilityKernelType = kernelType; #Bka Message.Clear(); Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Assessment Regional/RWScenarioSelector.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Assessment Regional/RWScenarioSelector.cs (.../RWScenarioSelector.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Assessment Regional/RWScenarioSelector.cs (.../RWScenarioSelector.cs) (revision 404) @@ -186,13 +186,10 @@ private RWScenarioProfileResult GetScenario(ScenarioType scenarioType, Enum[] choices, Location location, SoilGeometryProbability soilGeometryProbability, FailureMechanismSystemType failureMechanismType, MStabModelType modelOption) { - RWScenarioProfileResult scenario = new RWScenarioProfileResult(); - scenario.Location = location; - scenario.SoilGeometryProbability = soilGeometryProbability; + RWScenarioProfileResult scenario = new RWScenarioProfileResult(location, soilGeometryProbability); scenario.FailureMechanismType = failureMechanismType; scenario.MstabModelOption = modelOption; scenario.PipingModelOption = PipingModelType; - scenario.MStabParameters = MStabParameters; scenario.LoadSituation = (LoadSituation)choices[0]; scenario.DikeDrySensitivity = (DikeDrySensitivity)choices[1]; scenario.HydraulicShortcutType = (HydraulicShortcutType)choices[2]; @@ -217,9 +214,7 @@ private RWScenarioProfileResult GetScenario(ScenarioType scenarioType, Enum[] choices, Location location, SoilGeometryProbability soilGeometryProbability, FailureMechanismSystemType failureMechanismType, PipingModelType pipingModelType) { - RWScenarioProfileResult scenario = new RWScenarioProfileResult(); - scenario.Location = location; - scenario.SoilGeometryProbability = soilGeometryProbability; + RWScenarioProfileResult scenario = new RWScenarioProfileResult(location, soilGeometryProbability); scenario.FailureMechanismType = failureMechanismType; scenario.MstabModelOption = MStabModelType.Bishop; scenario.PipingModelOption = pipingModelType; Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/LocationJob.cs =================================================================== diff -u -r337 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/General/LocationJob.cs (.../LocationJob.cs) (revision 337) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/LocationJob.cs (.../LocationJob.cs) (revision 404) @@ -54,10 +54,6 @@ private double designRequiredFactor = 0.0; - public LocationJob() - { - } - public LocationJob(object subject) : base(subject) { @@ -156,106 +152,12 @@ locationResult.StabilityTimeSerie.Entries.Count > 0 && HasUsableStabilityTimeSerieEntries())); } } - - public LocationResult GetLocationResultWithStabilityTimeSerie(string locationName) - { - LocationResult result = null; - if (locationResult != null && locationResult.StabilityTimeSerie != null && - locationResult.StabilityTimeSerie.LocationId == locationName && - locationResult.StabilityTimeSerie.Entries != null && locationResult.StabilityTimeSerie.Entries.Count > 1) - { - result = locationResult; - } - return result; - } - - public LocationResult GetFirstLocationResultWithStabilityTimeSerie() - { - LocationResult result = null; - if (locationResult != null && locationResult.StabilityTimeSerie != null && - locationResult.StabilityTimeSerie.Entries != null && locationResult.StabilityTimeSerie.Entries.Count > 1) - { - result = locationResult; - } - return result; - } - - public RWScenarioProfileResult GetAssesmentResultByProfile(ScenarioType scenarioType, string profileName) - { - if (this.HasRWScenarioResults) - { - RWScenarioResult scenarioResult = this.LocationResult.RWScenariosResult.GetScenarioResult(scenarioType); - if (scenarioResult != null) - { - foreach (var res in scenarioResult.RWScenarioProfileResults) - { - if (res.SoilProfileName == profileName) - return res; - } - } - } - - return null; - } - - public CsvExportData GetFirstDesignResult() - { - if (this.HasScenarioResults) - { - DesignScenario scenario = Location.Scenarios[0]; - if (scenario != null && scenario.CalculationResults.Count > 0) - { - return scenario.CalculationResults[0]; - } - } - return null; - } - - public CsvExportData GetDesignResultByProfileScenarioAndCalculationName(string profileName, string scenarioName, - string calculationName) - { - if (this.HasScenarioResults) - { - foreach (var scenario in Location.Scenarios) - { - foreach (var calculationResult in scenario.CalculationResults) - { - if (calculationResult.ProfileName == profileName && - calculationResult.ScenarioName == scenarioName && - calculationResult.Calculation == calculationName) - return calculationResult; - } - } - } - return null; - } - + /// /// Return the result of the profile with highest probability of occurrence /// /// /// - public RWScenarioProfileResult GetRWScenarioResultOfProfileWithHighestProbablilityOfOccurrence(ScenarioType scenarioType) - { - if (this.HasRWScenarioResults) - { - RWScenarioResult scenarioResult = this.LocationResult.RWScenariosResult.GetScenarioResult(scenarioType); - if (scenarioResult != null && scenarioResult.RWScenarioProfileResults.Count > 0) - { - RWScenarioProfileResult rwScenarioProfileResult = scenarioResult.RWScenarioProfileResults[0]; - for (int i = 1; i < scenarioResult.RWScenarioProfileResults.Count; i++) - { - if (scenarioResult.RWScenarioProfileResults[i].SoilProfileProbability > rwScenarioProfileResult.SoilProfileProbability) - { - rwScenarioProfileResult = scenarioResult.RWScenarioProfileResults[i]; - } - } - return rwScenarioProfileResult; - } - } - return null; - } - /// /// Return result with the lowest safetyfactor /// @@ -332,10 +234,10 @@ if (calculationResult.SafetyFactor.Value < res) { res = calculationResult.SafetyFactor.Value; - if (calculationResult.RequiredSafetyFactor != null) - { - designRequiredFactor = calculationResult.RequiredSafetyFactor.Value; - } +// if (calculationResult.RequiredSafetyFactor != null) #Bka should come from input, not results +// { +// designRequiredFactor = calculationResult.RequiredSafetyFactor.Value; +// } } } } @@ -356,23 +258,23 @@ { foreach (var calculationResult in scenario.CalculationResults) { - if (calculationResult.Calculation.Equals("FlowSlide")) +// if (calculationResult.Calculation.Equals("FlowSlide")) #Bka: flowslide not for now! +// { +// designRequiredFactor = 1.0; // This is a hack to make FlowSlide color display correct; +// // TODO: make a good generic method to display colored results +// } + // else { - designRequiredFactor = 1.0; // This is a hack to make FlowSlide color display correct; - // TODO: make a good generic method to display colored results - } - else - { if (calculationResult.PipingFailureProbability != null) { if (calculationResult.PipingFailureProbability.Value > res && calculationResult.PipingFailureProbability.Value < DamGlobalConstants.NoRunValue) { res = calculationResult.PipingFailureProbability.Value; - if (calculationResult.RequiredFailureProbability != null) - { - designRequiredFactor = calculationResult.RequiredFailureProbability.Value; - } +// if (calculationResult.RequiredFailureProbability != null) #Bka required value must come from input, not results +// { +// designRequiredFactor = calculationResult.RequiredFailureProbability.Value; +// } } } @@ -539,48 +441,6 @@ } [XmlIgnore] - public double X - { - get { return this.Location.XRd; } - set { this.Location.XRd = value; } - } - - [XmlIgnore] - public double Y - { - get { return this.Location.YRd; } - set { this.Location.YRd = value; } - } - - [XmlIgnore] - public static ScenarioType CurrentScenarioType - { - get { return currentScenarioType; } - set { currentScenarioType = value; } - } - - [XmlIgnore] - public static string CurrentProfileName - { - get { return currentProfileName; } - set { currentProfileName = value; } - } - - [XmlIgnore] - public static string CurrentScenarioName - { - get { return currentScenarioName; } - set { currentScenarioName = value; } - } - - [XmlIgnore] - public static string CurrentCalculation - { - get { return currentCalculation; } - set { currentCalculation = value; } - } - - [XmlIgnore] public static DateTime CurrentTime { get { return currentTime; } Index: dam engine/trunk/Xsds Liquid/DamDesignResult.xsd =================================================================== diff -u -r394 -r404 --- dam engine/trunk/Xsds Liquid/DamDesignResult.xsd (.../DamDesignResult.xsd) (revision 394) +++ dam engine/trunk/Xsds Liquid/DamDesignResult.xsd (.../DamDesignResult.xsd) (revision 404) @@ -60,22 +60,15 @@ - - - - + + - - - - - Index: dam engine/trunk/src/Deltares.DamEngine.Data/RWScenarios/EvaluationJob.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/RWScenarios/EvaluationJob.cs (.../EvaluationJob.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Data/RWScenarios/EvaluationJob.cs (.../EvaluationJob.cs) (revision 404) @@ -115,23 +115,17 @@ } - foreach (RWScenarioResult scenarioResult in locationJob.LocationResult.RWScenariosResult.RWScenarioResults) - { - foreach (RWScenarioProfileResult scenarioProfileResult in scenarioResult.RWScenarioProfileResults) - { - scenarioProfileResult.Location = locationJob.Location; - } - } +// foreach (RWScenarioResult scenarioResult in locationJob.LocationResult.RWScenariosResult.RWScenarioResults) +// { +// foreach (RWScenarioProfileResult scenarioProfileResult in scenarioResult.RWScenarioProfileResults) +// { +// scenarioProfileResult.Location = locationJob.Location; +// } +// } #Bka: if this is really needed, location must be added as non serializeable object. - if ((this.locations.IndexOf(location) < 0) || (this.locations.IndexOf(location) >= this.results.Count)) + if ((this.locations.IndexOf(location) >= 0) || (this.locations.IndexOf(location) < this.results.Count)) { - // var failedRes = new RWSchematizationFactorsResult(); - // failedRes.SchematizationFactorResults. = CalculationResult.UnexpectedError; - // locationJob.LocationResult.RWScenariosResult = failedRes; - } - else - { if (schematizationFactorResults.Count > this.locations.IndexOf(location)) { locationJob.LocationResult.SchematizationFactorsResult = Index: dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/NwoResults.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/NwoResults.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/NwoResults.cs (revision 404) @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deltares.DamEngine.Data.General.Results +{ + public class NwoResults + { + private readonly string nwoId; + private readonly int ResultIndex; + private double? locationXrdStart; + private double? locationYrdStart; + private readonly double? locationZrdStart; + private double? locationXrdEnd; + private double? locationYrdEnd; + private readonly double? locationZrdEnd; + private string resultMessage = ""; + private int numberOfIterations; + private double? safetyFactorStability; + + } +} Index: dam engine/trunk/src/Deltares.DamEngine.Data/RWScenarios/RWScenariosResult.cs =================================================================== diff -u -r334 -r404 --- dam engine/trunk/src/Deltares.DamEngine.Data/RWScenarios/RWScenariosResult.cs (.../RWScenariosResult.cs) (revision 334) +++ dam engine/trunk/src/Deltares.DamEngine.Data/RWScenarios/RWScenariosResult.cs (.../RWScenariosResult.cs) (revision 404) @@ -22,18 +22,25 @@ using System.Collections.Generic; using System.ComponentModel; using System.IO; +using System.Xml.Serialization; using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.Standard.Calculation; namespace Deltares.DamEngine.Data.RWScenarios { - public class RWScenariosResult : RWResult + public class RWScenariosResult { private IList rwScenarioResults = new List(); + private CalculationResult calculationResult = CalculationResult.NoRun; - public RWScenariosResult() + public CalculationResult CalculationResult { + get { return calculationResult; } + set { calculationResult = value; } } + public double SafetyFactor { get; set; } + public IList RWScenarioResults { get { return rwScenarioResults; } @@ -54,22 +61,26 @@ } } - public class RWScenarioResult : RWResult + public class RWScenarioResult { private LoadSituation loadSituation = LoadSituation.Wet; private DikeDrySensitivity _dikeDrySensitivity = DikeDrySensitivity.None; private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut; private UpliftType upliftType = UpliftType.NoUplift; private MStabModelType modelOption; - + private CalculationResult calculationResult = CalculationResult.NoRun; private ScenarioType scenarioType = ScenarioType.Scenario01; private IList rwScenarioProfileResults = new List(); - public RWScenarioResult() + public CalculationResult CalculationResult { + get { return calculationResult; } + set { calculationResult = value; } } + public double SafetyFactor { get; set; } + public IList RWScenarioProfileResults { get { return rwScenarioProfileResults; } @@ -116,7 +127,7 @@ public class RWScenarioProfileResult : RWResult { private FailureMechanismSystemType failureMechanismType = FailureMechanismSystemType.StabilityInside; - private DikeDrySensitivity _dikeDrySensitivity = DikeDrySensitivity.None; + private DikeDrySensitivity dikeDrySensitivity = DikeDrySensitivity.None; private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut; private UpliftType upliftType = UpliftType.NoUplift; private LoadSituation loadSituation = LoadSituation.Wet; @@ -129,54 +140,26 @@ private ScenarioType scenarioType = ScenarioType.Scenario01; private string baseFileName = ""; - public const string CalculationCategory = "Calculation"; - - public RWScenarioProfileResult() + public RWScenarioProfileResult(Location location, SoilGeometryProbability soilGeometryProbability) { + this.location = location; + this.soilGeometryProbability = soilGeometryProbability; } - public virtual Location Location + public Location Location { - get { return location; } - set { location = value; } - } - - public string LocationName - { - get { return this.Location.Name; } - } - - public double DetrimentFactor - { get { - // For Piping, ignore the given detriment factor and use the required safety for Piping - if (scenarioType == ScenarioType.Scenario10 || scenarioType == ScenarioType.Scenario11) - return DamGlobalConstants.RequiredSafetyPipingForAssessment; - return this.Location.DetrimentFactor; + return location; } } - public string SoilProfileName - { - get - { - var res = ""; - if (SoilGeometryProbability != null) - res = SoilGeometryProbability.SoilProfile.Name; - return res; - } - } - public double SoilProfileProbability + public const string CalculationCategory = "Calculation"; + + public string LocationName { - get - { - var res = 0.0; - if (SoilGeometryProbability != null) - res = SoilGeometryProbability.Probability; - return res; - } + get { return location.Name; } } public LoadSituation LoadSituation @@ -187,8 +170,8 @@ public DikeDrySensitivity DikeDrySensitivity { - get { return _dikeDrySensitivity; } - set { _dikeDrySensitivity = value; } + get { return dikeDrySensitivity; } + set { dikeDrySensitivity = value; } } public HydraulicShortcutType HydraulicShortcutType @@ -215,8 +198,6 @@ set { pipingModelOption = value; } } - public MStabParameters MStabParameters { get; set; } - public ScenarioType ScenarioType { get { return scenarioType; } @@ -229,50 +210,31 @@ set { baseFileName = value; } } - public string InputFile + public FailureMechanismSystemType FailureMechanismType { - get { return DamProjectData.ProjectWorkingPath + Path.DirectorySeparatorChar + baseFileName + ".sti"; } + get { return failureMechanismType; } + set { failureMechanismType = value; } } - public string ResultFile + public SoilGeometryProbability SoilGeometryProbability { + get { return soilGeometryProbability; } + } + + public string SoilProfileName + { get { - const string wmfExtension = ".wmf"; - string fullBaseFilename = DamProjectData.ProjectWorkingPath + Path.DirectorySeparatorChar + baseFileName; - string fullFilename = fullBaseFilename + wmfExtension; - if (!File.Exists(fullFilename)) - { - fullFilename = fullBaseFilename + "z1" + wmfExtension; - } - if (!File.Exists(fullFilename)) - { - fullFilename = fullBaseFilename + "z2" + wmfExtension; - } - return fullFilename; + return soilGeometryProbability.SoilProfile.Name; } } - public string PipingResultFile + public double SoilProfileProbability { get { - return "leeg"; + return soilGeometryProbability.Probability; } - // Note Bka: Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location) - // get { return baseFileName + PipingCalculator.PipingFilenameExtension; } ##Bka: most probably unwanted, replace with other mechanism. Or delete when NOT USED } - - public FailureMechanismSystemType FailureMechanismType - { - get { return failureMechanismType; } - set { failureMechanismType = value; } - } - - public SoilGeometryProbability SoilGeometryProbability - { - get { return soilGeometryProbability; } - set { soilGeometryProbability = value; } - } } } Fisheye: Tag 404 refers to a dead (removed) revision in file `dam engine/trunk/src/Deltares.DamEngine.Data/General/Results/CsvExportData.cs'. Fisheye: No comparison available. Pass `N' to diff?