Index: dam clients/DamUI/trunk/src/Dam/Data/DamProjectData.cs
===================================================================
diff -u -r339 -r593
--- dam clients/DamUI/trunk/src/Dam/Data/DamProjectData.cs (.../DamProjectData.cs) (revision 339)
+++ dam clients/DamUI/trunk/src/Dam/Data/DamProjectData.cs (.../DamProjectData.cs) (revision 593)
@@ -280,6 +280,10 @@
return designCalculations;
}
+ set
+ {
+ designCalculations = value;
+ }
}
[ReadOnly(true)]
Index: dam clients/DamUI/trunk/src/Dam/Data/DamEngineIo/FillDamUiFromXmlOutput.cs
===================================================================
diff -u -r531 -r593
--- dam clients/DamUI/trunk/src/Dam/Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 531)
+++ dam clients/DamUI/trunk/src/Dam/Data/DamEngineIo/FillDamUiFromXmlOutput.cs (.../FillDamUiFromXmlOutput.cs) (revision 593)
@@ -19,9 +19,148 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
+using Deltares.DamEngine.Io.XmlOutput;
+using Deltares.Geometry;
+using Deltares.Geotechnics.GeotechnicalGeometry;
+using Deltares.Geotechnics.SurfaceLines;
+using SurfaceLine = Deltares.DamEngine.Io.XmlOutput.SurfaceLine;
+
namespace Deltares.Dam.Data.DamEngineIo
{
+ ///
+ /// Class to support the conversion of XmlOutput (as provided by the Engine) to DamUI objects.
+ ///
public class FillDamUiFromXmlOutput
{
+ ///
+ /// Adds the output to dam project data.
+ /// Precondition is that dam project data is filled and contains all relevant data that is referred to in the Output.
+ ///
+ /// The dam project data.
+ /// The output.
+ ///
+ public static DamProjectData AddOutputToDamProjectData(DamProjectData damProjectData, Output output)
+ {
+ if (output != null && output.Results != null && output.Results.CalculationResults != null &&
+ output.Results.CalculationResults.DesignResults != null)
+ {
+ CreateDesignResultsOutput(output, damProjectData);
+ }
+ return damProjectData;
+ }
+
+ private static void CreateDesignResultsOutput(Output output, DamProjectData damProjectData)
+ {
+ if (damProjectData.WaterBoard.Dikes[0] != null)
+ {
+ // Design results
+ damProjectData.DesignCalculations = new List();
+ for (int i = 0; i < output.Results.CalculationResults.DesignResults.Length; i++)
+ {
+ var designResult = output.Results.CalculationResults.DesignResults[i];
+ var desResult = new CsvExportData(designResult.LocationName, designResult.ScenarioName)
+ {
+ DamFailureMechanismeCalculation = damProjectData.DamProjectCalculationSpecification.CurrentSpecification, // hoort uit echo invoer te komen, niet uit invoer zelf
+ SelectedStabilityKernelType = StabilityKernelType.DamClassic, // de enige die we nu doen
+ AnalysisType = DamProjectCalculationSpecification.SelectedAnalysisType, //is nu vanuit invoer, niet echo invoer tenzij damproject de echo is!
+ ProbabilisticType = ProbabilisticType.Deterministic, // is dit de enige voor nu ?
+ Dike = damProjectData.WaterBoard.Dikes[0], // is de enige voor nu
+ CalculationResult = ConversionHelper.ConvertToCalculationResult(designResult.CalculationResult),
+ BaseFileName = designResult.BaseFileName,
+ ProfileName = designResult.ProfileName
+ };
+ desResult.CalculationResult = ConversionHelper.ConvertToCalculationResult(designResult.CalculationResult);
+ desResult.Scenario = GetScenarioByName(damProjectData, designResult.LocationName, designResult.ScenarioName);
+ if (designResult.PipingDesignResults != null)
+ {
+ CreateDesignResultsPipingOutput(designResult, desResult);
+ }
+ //NumberOfIterations = designResult.StabilityDesignResults.NumberOfIterations/designResult.NwoResults.NumberOfIterations dus vullen daar waar beschikbaar CreateDesignResultsStbilityOutput/CreateDesignResultsNwoOutput
+ damProjectData.DesignCalculations.Add(desResult);
+ }
+ }
+ }
+
+ private static void CreateDesignResultsPipingOutput(DesignResult designResult, CsvExportData desResult)
+ {
+ desResult.ResultMessage = designResult.PipingDesignResults.ResultMessage;
+ if (designResult.PipingDesignResults.RedesignedSurfaceLine != null)
+ {
+ desResult.RedesignedSurfaceLine2Piping = new SurfaceLine2();
+
+ }
+ var surfaceLine = ConvertXmlSurfaceLineToSurfaceLine2(designResult.PipingDesignResults.RedesignedSurfaceLine);
+ desResult.RedesignedSurfaceLine2Piping = surfaceLine;
+ if (designResult.PipingDesignResults.UpliftFactorSpecified) desResult.UpliftFactor = designResult.PipingDesignResults.UpliftFactor;
+ if (designResult.PipingDesignResults.HeaveFactorSpecified) desResult.HeaveFactor = designResult.PipingDesignResults.HeaveFactor;
+ if (designResult.PipingDesignResults.BlighFactorSpecified) desResult.BlighPipingFactor = designResult.PipingDesignResults.BlighFactor;
+ if (designResult.PipingDesignResults.BlighHcriticalSpecified) desResult.BlighHCritical = designResult.PipingDesignResults.BlighHcritical;
+ if (designResult.PipingDesignResults.Sellmeijer4ForcesFactorSpecified) desResult.Sellmeijer4ForcesPipingFactor = designResult.PipingDesignResults.Sellmeijer4ForcesFactor;
+ if (designResult.PipingDesignResults.Sellmeijer4ForcesHcriticalSpecified) desResult.Sellmeijer4ForcesHCritical = designResult.PipingDesignResults.Sellmeijer4ForcesHcritical;
+ if (designResult.PipingDesignResults.SellmeijerVnkFactorSpecified) desResult.SellmeijerPipingFactor= designResult.PipingDesignResults.SellmeijerVnkFactor;
+ if (designResult.PipingDesignResults.SellmeijerVnkHcriticalSpecified) desResult.SellmeijerHCritical = designResult.PipingDesignResults.SellmeijerVnkHcritical;
+ if (designResult.PipingDesignResults.Wbi2017FactorSpecified) desResult.Wti2017PipingFactor = designResult.PipingDesignResults.Wbi2017Factor;
+ if (designResult.PipingDesignResults.Wbi2017HcriticalSpecified) desResult.Wti2017HCritical = designResult.PipingDesignResults.Wbi2017Hcritical;
+ if (designResult.PipingDesignResults.ExitPointXSpecified) desResult.LocalPipingExitPointX = designResult.PipingDesignResults.ExitPointX;
+
+ if (designResult.PipingDesignResults.UpliftSituation != null)
+ {
+ var uplift = designResult.PipingDesignResults.UpliftSituation;
+ desResult.IsUplift = uplift.IsUplift;
+ desResult.Pl3MinUplift = uplift.Pl3MinUplift;
+ desResult.Pl3HeadAdjusted = uplift.Pl3HeadAdjusted;
+ desResult.Pl3LocalLocationXMinUplift = uplift.Pl3LocationXMinUplift;
+ desResult.Pl4MinUplift = uplift.Pl4MinUplift;
+ desResult.Pl4HeadAdjusted = uplift.Pl4HeadAdjusted;
+ desResult.Pl4LocalLocationXMinUplift = uplift.Pl4LocationXMinUplift;
+ }
+ }
+
+ private static Scenario GetScenarioByName(DamProjectData damProjectData, string locationName, string scenarioName)
+ {
+ var locations = damProjectData.Locations;
+ foreach (var location in locations)
+ {
+ if (location.Name == locationName)
+ {
+ foreach (var scenario in location.Scenarios)
+ {
+ if (scenario.LocationScenarioID == scenarioName)
+ {
+ return scenario;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private static SurfaceLine2 ConvertXmlSurfaceLineToSurfaceLine2(SurfaceLine inputSurfaceLine)
+ {
+ var surfaceLine = new SurfaceLine2
+ {
+ Name = inputSurfaceLine.Name
+ };
+ surfaceLine.CharacteristicPoints.Geometry = surfaceLine.Geometry;
+ AddPointsToSurfaceLine(inputSurfaceLine, surfaceLine);
+ return surfaceLine;
+ }
+
+ private static void AddPointsToSurfaceLine(SurfaceLine inputSurfaceLine, SurfaceLine2 surfaceLine)
+ {
+ surfaceLine.Geometry = new LocalizedGeometryPointString();
+ for (int j = 0; j < inputSurfaceLine.Points.Length; j++)
+ {
+ var inputPoint = inputSurfaceLine.Points[j];
+ var geometryPoint = new GeometryPoint()
+ {
+ X = inputPoint.X,
+ Y = 0.0,
+ Z = inputPoint.Z
+ };
+ surfaceLine.AddCharacteristicPoint(geometryPoint, ConversionHelper.ConvertToDamPointType(inputPoint.PointType));
+ }
+ }
}
}
Index: dam clients/DamUI/trunk/src/Dam/Data/CsvExportData.cs
===================================================================
diff -u -r341 -r593
--- dam clients/DamUI/trunk/src/Dam/Data/CsvExportData.cs (.../CsvExportData.cs) (revision 341)
+++ dam clients/DamUI/trunk/src/Dam/Data/CsvExportData.cs (.../CsvExportData.cs) (revision 593)
@@ -39,27 +39,21 @@
namespace Deltares.Dam.Data
{
///
- ///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
+ /// Class for presenting Design results.
///
- public class CsvExportData : ICloneable, IVisibleEnabled, IGeographicPoint
+ ///
+ ///
+ ///
+ public class CsvExportData : IVisibleEnabled, IGeographicPoint
{
- private string id;
private string baseFileName;
+ private string scenarioName;
+ private string locationName;
+ private int locationScenarioCount;
+ private double xRd;
+ private double yRd;
+ private string profileName;
+
private string calculationSubDir;
private Dike dike;
private AnalysisType analysisType;
@@ -110,175 +104,27 @@
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 CsvExportData(string id, Dike dike, DamFailureMechanismeCalculationSpecification damFailureMechanismeCalculationSpecification, Scenario scenario, SoilProfile1D soilProfile,
- string soilGeometry2DName, AnalysisType analysisType, int nwoResultIndex, ProbabilisticType probabilisticType)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Name of the location.
+ /// Name of the scenario.
+ public CsvExportData(string locationName, string scenarioName)
{
- this.id = id;
- this.BaseFileName = "";
- this.CalculationSubDir = "";
- this.dike = dike;
- this.damFailureMechanismeCalculationSpecification = damFailureMechanismeCalculationSpecification;
- this.scenario = scenario;
- this.soilProfile = soilProfile;
- this.SoilGeometry2DName = soilGeometry2DName;
- this.analysisType = analysisType;
- this.failureProbabilityPiping = null;
- this.redesignedSurfaceLinePiping = null;
- this.safetyFactorStability = null;
- this.failureProbabilityStability = null;
- this.redesignedSurfaceLineStability = null;
- this.zone1SafetyFactorStability = null;
- this.LocalZone1EntryPointX = null;
- this.LocalZone1ExitPointX = null;
- this.zone2SafetyFactorStability = null;
- this.LocalZone2EntryPointX = null;
- this.LocalZone2ExitPointX = null;
- this.blighPipingFactor = null;
- this.blighHCritical = null;
- this.sellmeijer2ForcesPipingFactor = null;
- this.sellmeijer2ForcesHCritical = null;
- this.sellmeijer4ForcesPipingFactor = null;
- this.sellmeijer4ForcesHCritical = null;
- this.sellmeijerPipingFactor = null;
- this.sellmeijerHCritical = null;
- this.wti2017PipingFactor = null;
- this.wti2017HCritical = null;
- this.isUplift = null;
- this.pl3MinUplift = null;
- this.pl3HeadAdjusted = null;
- this.pl3LocalLocationXMinUplift = null;
- this.pl4MinUplift = null;
- this.pl4HeadAdjusted = null;
- this.pl4LocalLocationXMinUplift = null;
- this.nwoId = "";
- this.nwoResultIndex = nwoResultIndex;
- this.locationXrdStart = null;
- this.locationXrdEnd = null;
- this.locationYrdStart = null;
- this.locationYrdEnd = null;
- this.locationZrdStart = null;
- this.locationZrdEnd = null;
- this.dirty = true;
-
- if (damFailureMechanismeCalculationSpecification != null)
- {
- this.probabilisticType = probabilisticType;
- switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType)
- {
- case FailureMechanismSystemType.StabilityInside:
- case FailureMechanismSystemType.StabilityOutside:
-
- if (analysisType == AnalysisType.AdaptNWO)
- {
- // an index of 0 can also indicate an error message. That has no futher data so check if there actualy is any.
- if (scenario.NwoResults.Count > 0)
- {
- this.nwoId = scenario.NwoResults[nwoResultIndex].NwoId;
- this.locationXrdStart = scenario.NwoResults[nwoResultIndex].LocationXrdStart;
- this.locationYrdStart = scenario.NwoResults[nwoResultIndex].LocationYrdStart;
- this.locationZrdStart = scenario.NwoResults[nwoResultIndex].LocationZrdStart;
- this.locationXrdEnd = scenario.NwoResults[nwoResultIndex].LocationXrdEnd;
- this.locationYrdEnd = scenario.NwoResults[nwoResultIndex].LocationYrdEnd;
- this.locationZrdEnd = scenario.NwoResults[nwoResultIndex].LocationZrdEnd;
- this.dirty = true;
- this.BaseFileName = scenario.NwoResults[nwoResultIndex].MStabResults.CalculationName;
- this.CalculationSubDir =
- scenario.NwoResults[nwoResultIndex].MStabResults.CalculationSubDir;
- this.numberOfIterations =
- scenario.NwoResults[nwoResultIndex].MStabResults.IterationNumber;
- this.safetyFactorStability = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.safetyFactor;
- this.zone1SafetyFactorStability = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.safetyFactor;
- this.LocalZone1EntryPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.entryPointXCoordinate;
- this.LocalZone1ExitPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone1.exitPointXCoordinate;
- if (scenario.NwoResults[nwoResultIndex].MStabResults.zone2 != null)
- {
- this.zone2SafetyFactorStability = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.safetyFactor;
- this.LocalZone2EntryPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.entryPointXCoordinate;
- this.LocalZone2ExitPointX = scenario.NwoResults[nwoResultIndex].MStabResults.zone2.Value.exitPointXCoordinate;
- }
- }
- }
- else
- {
- MStabResults? mstabResults = scenario.GetMStabResults(this.SoilProfile, this.SoilGeometry2DName);
- this.resultMessage = scenario.GetResultMessage(this.SoilProfile, this.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;
- this.LocalZone1EntryPointX = mstabResults.Value.zone1.entryPointXCoordinate;
- this.LocalZone1ExitPointX = mstabResults.Value.zone1.exitPointXCoordinate;
- if (mstabResults.Value.zone2 != null)
- {
- this.zone2SafetyFactorStability = mstabResults.Value.zone2.Value.safetyFactor;
- this.LocalZone2EntryPointX = mstabResults.Value.zone2.Value.entryPointXCoordinate;
- this.LocalZone2ExitPointX = mstabResults.Value.zone2.Value.exitPointXCoordinate;
- }
- }
- }
- this.failureProbabilityStability = scenario.GetFailureProbabilityStability(this.SoilProfile, this.SoilGeometry2DName);
- this.redesignedSurfaceLineStability = scenario.GetRedesignedSurfaceLine(this.SoilProfile, this.SoilGeometry2DName);
-
- UpliftSituation? upliftSituation = scenario.GetStabilityUpliftSituation(this.SoilProfile, this.SoilGeometry2DName);
- if (upliftSituation != null)
- {
- SetUpliftSituationResults(upliftSituation.Value);
- }
-
- break;
-
- 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);
- if (upliftSituationPiping != null)
- {
- SetUpliftSituationResults(upliftSituationPiping.Value);
- }
- PipingResults? pipingResults = scenario.GetPipingResults(this.SoilProfile, this.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.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.locationName = locationName;
+ this.scenarioName = scenarioName;
}
///
@@ -296,75 +142,50 @@
return localPoint;
}
- ///
- /// Determines the stability calculation run result.
- ///
- /// The result message.
- /// The mstab results.
- ///
- private CalculationResult DetermineStabilityCalculationResult(string message, MStabResults? mstabResults)
- {
- CalculationResult result;
- if ((message != null) && this.resultMessage.Contains("FAIL"))
- {
- result = CalculationResult.UnexpectedError;
- }
- else
- {
- // If no failure and no results, then no run has been made
- result = mstabResults != null ? CalculationResult.Succeeded : CalculationResult.NoRun;
- }
- return result;
- }
-
- ///
- /// Sets the uplift situation results.
- ///
- /// The uplift situation.
- private void SetUpliftSituationResults(UpliftSituation upliftSituation)
- {
- this.isUplift = upliftSituation.IsUplift;
- if (upliftSituation.Pl3MinUplift < double.MaxValue)
- {
- this.pl3MinUplift = upliftSituation.Pl3MinUplift;
- }
- if (upliftSituation.Pl3HeadAdjusted < double.MaxValue)
- {
- this.pl3HeadAdjusted = upliftSituation.Pl3HeadAdjusted;
- }
- if (upliftSituation.Pl3LocationXMinUplift < double.MaxValue)
- {
- this.pl3LocalLocationXMinUplift = upliftSituation.Pl3LocationXMinUplift;
- }
- if (upliftSituation.Pl4MinUplift < double.MaxValue)
- {
- this.pl4MinUplift = upliftSituation.Pl4MinUplift;
- }
- if (upliftSituation.Pl4HeadAdjusted < double.MaxValue)
- {
- this.pl4HeadAdjusted = upliftSituation.Pl4HeadAdjusted;
- }
- if (upliftSituation.Pl4LocationXMinUplift < double.MaxValue)
- {
- this.pl4LocalLocationXMinUplift = upliftSituation.Pl4LocationXMinUplift;
- }
- }
-
[Browsable(false)]
public StabilityKernelType SelectedStabilityKernelType
{
get { return selectedStabilityKernelType; }
set { selectedStabilityKernelType = value; }
}
+ ///
+ /// Gets or sets the number of iterations (as used in the design calculation).
+ ///
+ ///
+ /// The number of iterations.
+ ///
[Label("Number of iterations")]
[ReadOnly(true)]
public int NumberOfIterations
{
- get { return numberOfIterations; }
+ get
+ {
+ if (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside ||
+ damFailureMechanismeCalculationSpecification.FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside)
+ {
+ if (AnalysisType == AnalysisType.AdaptNWO)
+ numberOfIterations = scenario.NwoResults[nwoResultIndex].MStabResults.IterationNumber;
+ else
+ {
+ var mstabResults = scenario.GetMStabResults(soilProfile, soilGeometry2DName);
+ if (mstabResults != null)
+ {
+ numberOfIterations = mstabResults.Value.IterationNumber;
+ }
+ }
+ }
+ return numberOfIterations;
+ }
set { numberOfIterations = value; }
}
+ ///
+ /// Gets the result file.
+ ///
+ ///
+ /// The result file.
+ ///
[Browsable(false)]
[Label("Image file")]
public string ResultFile
@@ -395,9 +216,15 @@
}
}
+ ///
+ /// Gets the input file.
+ ///
+ ///
+ /// The input file.
+ ///
[Browsable(false)]
[Label("Input file")]
- public string InputFile
+ private string InputFile
{
get
{
@@ -421,9 +248,15 @@
}
}
+ ///
+ /// Gets the piping result file.
+ ///
+ ///
+ /// The piping result file.
+ ///
[Browsable(false)]
[Label("Input file")]
- public string PipingResultFile
+ private string PipingResultFile
{
// Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location)
get
@@ -447,7 +280,7 @@
[Label("Analysis")]
[PropertyOrder(1, 2)]
[ReadOnly(true)]
- public AnalysisType AnalysisType
+ public AnalysisType AnalysisType // moet vanuit invoer komen
{
get { return analysisType; }
set { analysisType = value; }
@@ -456,26 +289,19 @@
[Label("Probabilistic")]
[PropertyOrder(1, 3)]
[ReadOnly(true)]
- public ProbabilisticType ProbabilisticType
+ public ProbabilisticType ProbabilisticType // moet vanuit invoer komen
{
get { return probabilisticType; }
set { probabilisticType = value; }
}
[Browsable(false)]
- public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculation
+ public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculation // moet vanuit invoer komen
{
get { return damFailureMechanismeCalculationSpecification; }
set { damFailureMechanismeCalculationSpecification = value; }
}
- [CsvExportColumn("id", 1)]
- [Browsable(false)]
- public string ID
- {
- get { return this.id; }
- }
-
[CsvExportColumn("DikeName", 2)]
[Browsable(false)]
[Label("Dike")]
@@ -484,18 +310,38 @@
get { return dike.Name; }
}
+ [Browsable(false)]
+ public Dike Dike
+ {
+ get
+ {
+ return dike;
+ }
+ set
+ {
+ dike = value;
+ }
+ }
+
[CsvExportColumn("Calculation", 3)]
[Browsable(false)]
public string Calculation
{
- get { return this.damFailureMechanismeCalculationSpecification != null ? this.damFailureMechanismeCalculationSpecification.ToString() : ""; }
+ get { return damFailureMechanismeCalculationSpecification != null ? damFailureMechanismeCalculationSpecification.ToString() : ""; }
}
[CsvExportColumn("Scenario", 4)]
[Browsable(false)]
public string ScenarioName
{
- get { return this.Scenario.LocationScenarioID; }
+ get
+ {
+ return scenarioName;
+ }
+ set
+ {
+ scenarioName = value;
+ }
}
[CsvExportColumn("LocationName", 5)]
@@ -504,21 +350,22 @@
[ReadOnly(true)]
public string LocationName
{
- get { return this.Scenario.Location.Name; }
+ get
+ {
+ return locationName;
+ }
+ set
+ {
+ locationName = value;
+ }
}
- [Browsable(false)]
- public int LocationScenarioCount
- {
- get { return this.Scenario.Location.Scenarios.Count; }
- }
-
[Label("Scenario")]
[PropertyOrder(0, 2)]
[ReadOnly(true)]
public string ScenarioDefinitionName
{
- get { return this.Scenario.LocationScenarioID + " of " + this.LocationScenarioCount.ToString(); }
+ get { return scenarioName + " of " + locationScenarioCount.ToString(); }
}
[Label("Calculation result")]
@@ -555,14 +402,11 @@
{
get
{
- return (this.Scenario != null) ? this.Scenario.Location.XRd : 0.0;
+ return xRd;
}
set
{
- if (this.Scenario != null)
- {
- this.Scenario.Location.XRd = value;
- }
+ xRd = value;
}
}
@@ -577,22 +421,19 @@
{
get
{
- return (this.Scenario != null) ? this.Scenario.Location.YRd : 0.0;
+ return yRd;
}
set
{
- if (this.Scenario != null)
- {
- this.Scenario.Location.YRd = value;
- }
+ yRd = value;
}
}
[CsvExportColumn("LocationScenarioId", 8)]
[Browsable(false)]
public string LocationScenarioId
{
- get { return this.Scenario.LocationScenarioID; }
+ get { return scenarioName; }
}
[Label("River level")]
@@ -670,23 +511,6 @@
}
}
- 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);
@@ -697,7 +521,7 @@
[Browsable(false)]
public string StabilityProfileName
{
- get { return GetSoilProfileName(FailureMechanismSystemType.StabilityInside); }
+ get { return ProfileName; }
}
[CsvExportColumn("StabilityProfileProbability", 17)]
@@ -715,7 +539,7 @@
[Browsable(false)]
public string PipingProfileName
{
- get { return GetSoilProfileName(FailureMechanismSystemType.Piping); }
+ get { return ProfileName; }
}
[CsvExportColumn("PipingProfileProbability", 19)]
@@ -1731,23 +1555,20 @@
get { return this.Scenario.Location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; }
}
- [CsvExportColumn("FlowSlideSafetyFactor", 91)]
- [Label("Flowslide safety factor")]
- [Format("F3")]
- [Unit(UnitType.None)]
- [ReadOnly(true)]
[Browsable(false)]
- public double? FlowSlideSafetyFactor
- {
- get { return this.safetyFactorFlowSlide; }
- set { this.safetyFactorFlowSlide = value; }
- }
-
- [Browsable(false)]
public Scenario Scenario
{
get { return scenario; }
- set { scenario = value; }
+ set
+ {
+ scenario = value;
+ scenarioName = scenario.LocationScenarioID;
+ locationName = scenario.Location.Name;
+ locationScenarioCount = scenario.Location.Scenarios.Count;
+ xRd = scenario.Location.XRd;
+ yRd = scenario.Location.YRd;
+
+ }
}
[Browsable(false)]
@@ -1836,22 +1657,35 @@
{
get
{
- var res = "";
- switch (damFailureMechanismeCalculationSpecification.FailureMechanismSystemType)
+ if (scenario != null)
{
- case FailureMechanismSystemType.HorizontalBalance:
- case FailureMechanismSystemType.StabilityOutside:
- case FailureMechanismSystemType.StabilityInside:
- res = StabilityProfileName;
- break;
- case FailureMechanismSystemType.Piping:
- res = PipingProfileName;
- break;
+ GetSoilProfileName(damFailureMechanismeCalculationSpecification.FailureMechanismSystemType);
}
- return res;
+ return profileName;
}
+ set
+ {
+ profileName = value;
+ }
}
+ 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 : "";
+ }
+
[Label("Profile probability")]
[Format("F3")]
[PropertyOrder(2, 2)]
@@ -1918,10 +1752,7 @@
break;
case FailureMechanismSystemType.Piping:
res = PipingFactor;
- break;
- case FailureMechanismSystemType.FlowSlide:
- res = FlowSlideSafetyFactor;
- break;
+ break;
}
return res;
}
@@ -2330,73 +2161,6 @@
}
///
- /// Returns the begin point and and point as a list
- ///
- [XmlIgnore]
- public List Points
- {
- get
- {
- if (dirty)
- {
- dirty = false;
- points.Clear();
- if (this.locationXrdStart.HasValue && this.locationYrdStart.HasValue)
- {
- points.Add(new GeographicPoint(this.locationXrdStart.Value, this.locationYrdStart.Value));
- }
- if (this.locationXrdEnd.HasValue && this.locationYrdEnd.HasValue)
- {
- points.Add(new GeographicPoint(this.locationXrdEnd.Value, this.locationYrdEnd.Value));
- }
- }
-
- return points;
- }
- }
-
- ///
- /// Copy data
- ///
- ///
- public void Assign(CsvExportData csvExportData)
- {
- 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;
- }
-
- ///
/// Copies the result file.
///
/// The extension.
@@ -2468,20 +2232,6 @@
}
}
- ///
- /// 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);
-
- csvExportData.Assign(this);
-
- return csvExportData;
- }
-
public bool IsEnabled(string property)
{
return true;
Index: dam clients/DamUI/trunk/src/Dam/Tests/CsvExporterTest.cs
===================================================================
diff -u -r339 -r593
--- dam clients/DamUI/trunk/src/Dam/Tests/CsvExporterTest.cs (.../CsvExporterTest.cs) (revision 339)
+++ dam clients/DamUI/trunk/src/Dam/Tests/CsvExporterTest.cs (.../CsvExporterTest.cs) (revision 593)
@@ -19,15 +19,9 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Deltares.Geotechnics;
-using Deltares.Geotechnics.GeotechnicalGeometry;
-
using System.Collections.Generic;
using System.IO;
-
using Deltares.Dam.Data;
-using Deltares.Geotechnics.Soils;
-using Deltares.Geotechnics.SurfaceLines;
using NUnit.Framework;
namespace Deltares.Dam.Tests
@@ -65,37 +59,13 @@
var file = File.CreateText(FileName);
file.WriteLine(writtenContent);
file.Close();
-
- using(var surfaceLine2 = new SurfaceLine2
+ var exportData = new CsvExportData("locatioName", "scenarioName");
+ var creator = new CsvExporter(FileName, new List { exportData });
+ creator.WriteFile();
+ using (var reader = File.OpenText(FileName))
{
- Geometry = new LocalizedGeometryPointString(),
- CharacteristicPoints = { GeometryMustContainPoint = true }
- })
- using (var dike = new Dike())
- {
- dike.Locations.Add(new Location
- {
- SurfaceLine2 = surfaceLine2,
- Segment = new Dam.Data.Segment()
- });
- var scenario = new Scenario() { Location = dike.Locations[0] };
- var exportData = new CsvExportData(
- "Test",
- dike,
- null,
- scenario,
- new SoilProfile1D(),
- "",
- AnalysisType.NoAdaption,
- 0,
- ProbabilisticType.Deterministic);
- var creator = new CsvExporter(FileName, new List { exportData });
- creator.WriteFile();
- using (var reader = File.OpenText(FileName))
- {
- var fileContent = reader.ReadToEnd();
- Assert.IsFalse(fileContent.Contains((writtenContent)));
- }
+ var fileContent = reader.ReadToEnd();
+ Assert.IsFalse(fileContent.Contains((writtenContent)));
}
}
Index: dam clients/DamUI/trunk/src/Dam/Tests/DamEngineIo/FillDamUiFromXmlOutputTests.cs
===================================================================
diff -u -r575 -r593
--- dam clients/DamUI/trunk/src/Dam/Tests/DamEngineIo/FillDamUiFromXmlOutputTests.cs (.../FillDamUiFromXmlOutputTests.cs) (revision 575)
+++ dam clients/DamUI/trunk/src/Dam/Tests/DamEngineIo/FillDamUiFromXmlOutputTests.cs (.../FillDamUiFromXmlOutputTests.cs) (revision 593)
@@ -35,29 +35,38 @@
[Test]
public void SimpleTest()
{
-// var output = CreateTestOutput();
-// var damProjectData = new DamProjectData();
-// FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
+ var damProjectData = CreateInputProjectData();
+ var output = CreateTestOutput();
+ FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
-// const string inputFilename = "OutputFile.xml";
-// //DamProjectData expectedDamProjectData = CreateExampleDamProjectData();
-// var output = CreateTestOutput();
-// var damProjectData = CreateInputProjectData();
-// var expectedDamProjectData = FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
-// // Input input = FillXmlInputFromDamUi.CreateInput(expectedDamProjectData);
-// DamXmlSerialization.SaveOutputAsXmlFile(inputFilename, output);
-// output = DamXmlSerialization.LoadOutputFromXmlFile(inputFilename);
-// DamProjectData actualDamProjectData = FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
-// ;
-// CompareDamProjectData(actualDamProjectData, expectedDamProjectData);
+ const string inputFilename = "OutputFile.xml";
+ var expectedDamProjectData = FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
+ // Input input = FillXmlInputFromDamUi.CreateInput(expectedDamProjectData);
+ DamXmlSerialization.SaveOutputAsXmlFile(inputFilename, output);
+ output = DamXmlSerialization.LoadOutputFromXmlFile(inputFilename);
+ DamProjectData actualDamProjectData = FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output);
+
+ CompareDamProjectData(actualDamProjectData, expectedDamProjectData);
+ Assert.AreEqual(expectedDamProjectData.DesignCalculations[0].CalculationResult, actualDamProjectData.DesignCalculations[0].CalculationResult);
+ Assert.AreEqual(expectedDamProjectData.DesignCalculations[0].SafetyFactor, actualDamProjectData.DesignCalculations[0].SafetyFactor);
+ Assert.AreEqual(expectedDamProjectData.DesignCalculations[0].LocationName, actualDamProjectData.DesignCalculations[0].LocationName);
+
}
private DamProjectData CreateInputProjectData()
{
var project = new DamProjectData();
+ var spec = new DamFailureMechanismeCalculationSpecification
+ {
+ FailureMechanismSystemType = FailureMechanismSystemType.Piping,
+ PipingModelType = PipingModelType.Bligh
+ };
+ project.DamProjectCalculationSpecification.CurrentSpecification = spec;
+
project.WaterBoard.Dikes.Add(new Dike());
- var location1 = new Location("Location 1");
+ Location location1 = new Location();
+ location1.Name = "Location 1";
var scenario1 = new Scenario();
scenario1.LocationScenarioID = "Scenario 1";
scenario1.Location = location1;
@@ -91,13 +100,9 @@
{
var desResult = new DesignResult
{
- Id = i.ToString(),
LocationName = "Location " + (i + 1).ToString(),
ScenarioName = "Scenario " + (i + 1).ToString(),
ProfileName = "Profile " + (i + 1).ToString(),
- SafetyFactorSpecified = true,
- SafetyFactor = 0.44 * i,
- FailureProbabilitySpecified = false,
CalculationResult = 1 * i
};
output.Results.CalculationResults.DesignResults[i] = desResult;
Index: dam clients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs
===================================================================
diff -u -r560 -r593
--- dam clients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 560)
+++ dam clients/DamUI/trunk/src/Dam/Forms/DamPlugin.cs (.../DamPlugin.cs) (revision 593)
@@ -674,12 +674,20 @@
var damEnginInterface = new EngineInterface(inputXml);
string validationMessages = damEnginInterface.Validate();
- string outputXml = damEnginInterface.Run();
-
- // Next 2 lines for debugging
- const string outputFilename = "OutputFile.xml";
- File.WriteAllText(outputFilename, outputXml);
-
+
+ // now the validation messages should be deserialized. If any, they should be passed on to the Validator
+ // and checked for errors. IF errors are found, then no calculation. When no messages or only warnings then
+ // do calculate. For now, just check length
+ if (validationMessages.Length == 0)
+ {
+ // only if validation is ok, then
+ string outputXml = damEnginInterface.Run();
+ var output = DamXmlSerialization.LoadOutputFromXmlString(outputXml);
+ FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProject.DamProjectData, output);
+ // Next 2 lines for debugging
+ const string outputFilename = "OutputFile.xml";
+ File.WriteAllText(outputFilename, outputXml);
+ }
}
catch (Exception e)
{