// Copyright (C) Stichting Deltares 2018. All rights reserved.
//
// This file is part of the application DAM - UI.
//
// DAM - UI is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using Deltares.Standard.Attributes;
namespace Deltares.Dam.Data
{
public class RWScenariosResult : RWResult
{
private IList rwScenarioResults = new List();
public RWScenariosResult()
{
}
public IList RWScenarioResults
{
get { return rwScenarioResults; }
private set { rwScenarioResults = value; }
}
public RWScenarioResult GetScenarioResult(ScenarioType scenarioType)
{
foreach (RWScenarioResult scenarioResult in this.RWScenarioResults)
{
if (scenarioResult.ScenarioType == scenarioType)
{
return scenarioResult;
}
}
return null;
}
}
public class RWScenarioResult : RWResult
{
private LoadSituation loadSituation = LoadSituation.Wet;
private DikeDrySensitivity _dikeDrySensitivity = DikeDrySensitivity.None;
private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut;
private UpliftType upliftType = UpliftType.NoUplift;
private MStabModelType modelOption;
private ScenarioType scenarioType = ScenarioType.Scenario01;
private IList rwScenarioProfileResults = new List();
public RWScenarioResult()
{
}
public IList RWScenarioProfileResults
{
get { return rwScenarioProfileResults; }
private set { rwScenarioProfileResults = value; }
}
public LoadSituation LoadSituation
{
get { return loadSituation; }
set { loadSituation = value; }
}
public DikeDrySensitivity DikeDrySensitivity
{
get { return _dikeDrySensitivity; }
set { _dikeDrySensitivity = value; }
}
public HydraulicShortcutType HydraulicShortcutType
{
get { return hydraulicShortcutType; }
set { hydraulicShortcutType = value; }
}
public UpliftType UpliftType
{
get { return upliftType; }
set { upliftType = value; }
}
public MStabModelType ModelOption
{
get { return modelOption; }
set { modelOption = value; }
}
public ScenarioType ScenarioType
{
get { return scenarioType; }
set { scenarioType = value; }
}
}
public class RWScenarioProfileResult : RWResult
{
private FailureMechanismSystemType failureMechanismType = FailureMechanismSystemType.StabilityInside;
private DikeDrySensitivity _dikeDrySensitivity = DikeDrySensitivity.None;
private HydraulicShortcutType hydraulicShortcutType = HydraulicShortcutType.NoHydraulicShortcut;
private UpliftType upliftType = UpliftType.NoUplift;
private LoadSituation loadSituation = LoadSituation.Wet;
private MStabModelType mstabModelOption;
private PipingModelType pipingModelOption;
private SoilGeometryProbability soilGeometryProbability = null;
private Location location = null;
private ScenarioType scenarioType = ScenarioType.Scenario01;
private string baseFileName = "";
public const string CalculationCategory = "Calculation";
public RWScenarioProfileResult()
{
}
[Browsable(false)]
[Label("Location")]
public virtual Location Location
{
get { return location; }
set { location = value; }
}
[Label("Location")]
[PropertyOrder(0, 1)]
public string LocationName
{
get { return this.Location.Name; }
}
[ReadOnly(true)]
[Format("F3")]
[Label("Detriment factor")]
[Category(ResultCategory)]
[PropertyOrder(2, 1)]
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;
}
}
[Label("Soil profile")]
[Category(CalculationCategory)]
[PropertyOrder(2, 2)]
public string SoilProfileName
{
get
{
var res = "";
if (SoilGeometryProbability != null)
res = SoilGeometryProbability.SoilProfile.Name;
return res;
}
}
[ReadOnly(true)]
[Format("F3")]
[Label("Soil profile probability")]
[Category(CalculationCategory)]
[PropertyOrder(2, 3)]
public double SoilProfileProbability
{
get
{
var res = 0.0;
if (SoilGeometryProbability != null)
res = SoilGeometryProbability.Probability;
return res;
}
}
[ReadOnly(true)]
[Label("Load situation")]
[Category(CalculationCategory)]
[PropertyOrder(2, 4)]
public LoadSituation LoadSituation
{
get { return loadSituation; }
set { loadSituation = value; }
}
[ReadOnly(true)]
[Label("Dry sensitivity")]
[Category(CalculationCategory)]
[PropertyOrder(2, 5)]
public DikeDrySensitivity DikeDrySensitivity
{
get { return _dikeDrySensitivity; }
set { _dikeDrySensitivity = value; }
}
[ReadOnly(true)]
[Label("Hydraulic shortcut")]
[Category(CalculationCategory)]
[PropertyOrder(2, 6)]
public HydraulicShortcutType HydraulicShortcutType
{
get { return hydraulicShortcutType; }
set { hydraulicShortcutType = value; }
}
[ReadOnly(true)]
[Label("Uplift type")]
[Category(CalculationCategory)]
[PropertyOrder(2, 7)]
public UpliftType UpliftType
{
get { return upliftType; }
set { upliftType = value; }
}
[ReadOnly(true)]
[Label("Model Stability")]
[Category(CalculationCategory)]
[PropertyOrder(2, 8)]
[XmlOldName("ModelOption")]
public MStabModelType MstabModelOption
{
get { return mstabModelOption; }
set { mstabModelOption = value; }
}
[ReadOnly(true)]
[Label("Model Piping")]
[Category(CalculationCategory)]
[PropertyOrder(2, 8)]
public PipingModelType PipingModelOption
{
get { return pipingModelOption; }
set { pipingModelOption = value; }
}
[Browsable(false)]
[Category(CalculationCategory)]
public MStabParameters MStabParameters { get; set; }
[ReadOnly(true)]
[Label("Scenario")]
[PropertyOrder(0, 2)]
public ScenarioType ScenarioType
{
get { return scenarioType; }
set { scenarioType = value; }
}
[Browsable(false)]
[Label("File name")]
public string BaseFileName
{
get { return baseFileName; }
set { baseFileName = value; }
}
[Browsable(false)]
[Label("Input file")]
public string InputFile
{
get { return DamProject.ProjectWorkingPath + Path.DirectorySeparatorChar + baseFileName + ".sti"; }
}
[Browsable(false)]
[Label("Image file")]
public string ResultFile
{
get
{
const string wmfExtension = ".wmf";
string fullBaseFilename = DamProject.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;
}
}
[Browsable(false)]
[Label("Input file")]
public string PipingResultFile
{
// Note Bka: Path of piping is not based on the working dir but on assembly (Assembly.GetExecutingAssembly().Location)
get { return baseFileName + ".txt"; }
}
[Label("Failure mechanism")]
public FailureMechanismSystemType FailureMechanismType
{
get { return failureMechanismType; }
set { failureMechanismType = value; }
}
[Browsable(false)]
[Label("Soil geometry")]
public SoilGeometryProbability SoilGeometryProbability
{
get { return soilGeometryProbability; }
set { soilGeometryProbability = value; }
}
}
}