// Copyright (C) Stichting Deltares 2019. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero 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; using System.Collections.Generic; using System.Linq; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General.Gauges; using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.General.Sensors; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Validation; namespace Deltares.DamEngine.Data.General { public class Location { // Added initial value as these properties must be tested for real values on import private static DamProjectType damProjectType = DamProjectType.Operational; private readonly List scenarios = new List(); private ModelParametersForPlLines modelParametersForPlLines = new ModelParametersForPlLines(); private string dikeEmbankmentMaterial = ""; private double dikeTableHeight; private IList gaugePlLines = new List(); private IList gauges = new List(); private double? headPl2; private double? headPl3; private double? headPl4; // Start of parameters that are also defined in modelparameters private Pl1Line localXzpl1Line; private StabilityOptions stabilityOptions; private ModelFactors modelFactors = new ModelFactors(); private string name = ""; private double newDepthDitch = 1.0; private double newDikeSlopeInside = 1.0/3.0; // as tangent private double newDikeSlopeOutside = 1.0/3.0; // as tangent private double newDikeTopWidth = 5.0; private double newMaxHeightShoulderAsFraction = 2.0/3.0; // as tangent private double newMinDistanceDikeToeStartDitch = 5.0; private double newShoulderBaseSlope = 1.0/3.0; // as tangent private double newShoulderTopSlope = 1.0/20.0; // as tangent private double newSlopeAngleDitch = 1.0/0.5; // as tangent private double newWidthDitchBottom = 1.0; private double pLLineOffsetBelowDikeToeAtPolder = 0.1; private double pLLineOffsetBelowDikeTopAtPolder = 1.5; private double pLLineOffsetBelowDikeTopAtRiver = 0.5; private double pLLineOffsetBelowShoulderBaseInside = 0.1; private double polderLevel; private bool redesignDikeHeight = true; private bool redesignDikeShoulder = true; private double scenarioRiverLevel; private Segment segment; private SensorLocation sensorLocation; private string shoulderEmbankmentMaterial = ""; private double slopeAdaptionEndCotangent = 6.0; private double slopeAdaptionStartCotangent = 3.0; private double slopeAdaptionStepCotangent = 0.5; private double slopeDampingPiezometricHeightPolderSide; private StabilityDesignMethod stabilityDesignMethod = StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption; private double stabilityShoulderGrowDeltaX = 2.0; private double stabilityShoulderGrowSlope = 1.0/3; private double stabilitySlopeAdaptionDeltaX = 2.0; private bool useNewDikeSlopeInside; private bool useNewDikeSlopeOutside; private bool useNewDikeTopWidth; private bool useNewDitchDefinition; private bool useNewMaxHeightShoulderAsFraction; private bool useNewMinDistanceDikeToeStartDitch; private bool useNewShoulderBaseSlope; private bool useNewShoulderTopSlope; private double xRdDikeLine; private double xSoilGeometry2DOrigin; private double? plLineOffsetFactorBelowShoulderCrest; private double? plLineOffsetBelowDikeCrestMiddle; private IntrusionVerticalWaterPressureType? intrusionVerticalWaterPressure = IntrusionVerticalWaterPressureType.Standard; /// /// Initializes a new instance of the class. /// public Location() { SoilList = null; } /// /// Initializes a new instance of the class. /// /// The name. public Location(string name) : this() { this.name = name; } /// /// Gets a value indicating whether this instance has a sensor location. /// /// /// true if this instance has a sensor location; otherwise, false. /// public bool HasSensorLocation { get { return sensorLocation != null; } } /// /// Gets or sets the sensor location. /// /// /// The sensor location. /// public virtual SensorLocation SensorLocation { get { return sensorLocation; } set { sensorLocation = value; sensorLocation.Location = this; } } /// /// Gets or sets the name. /// /// /// The name. /// public virtual string Name { get { return name; } set { name = value; } } /// /// Gets or sets the x rd dike line (for senesors). /// /// /// The x rd dike line. /// public virtual double XRdDikeLine { get { return xRdDikeLine; } set { xRdDikeLine = value; } } /// /// Gets or sets the x soil geometry2 d origin. /// /// /// The x soil geometry2 d origin. /// public virtual double XSoilGeometry2DOrigin { get { return xSoilGeometry2DOrigin; } set { xSoilGeometry2DOrigin = value; } } /// /// Gets or sets the local XZPL1 line. /// /// /// The local XZPL1 line. /// public virtual Pl1Line LocalXzpl1Line { get { return localXzpl1Line; } set { localXzpl1Line = value; } } /// /// The surfaceline in local coordinates /// /// Composite relationship. [Validate] public virtual SurfaceLine2 SurfaceLine { get; set; } /// /// Gets or sets the Segment /// public virtual Segment Segment { get { return segment; } set { segment = value; } } /// /// Gets or sets the model factors. /// /// /// The model factors. /// public virtual ModelFactors ModelFactors { get { return modelFactors; } set { modelFactors = value; } } /// /// Gets or sets the uplift criterion stability. /// /// /// The uplift criterion stability. /// public virtual double? UpliftCriterionStability { get { return ModelFactors.UpliftCriterionStability; } set { ModelFactors.UpliftCriterionStability = value; } } /// /// Gets or sets the uplift criterion piping. /// /// /// The uplift criterion piping. /// public virtual double? UpliftCriterionPiping { get { return ModelFactors.UpliftCriterionPiping; } set { ModelFactors.UpliftCriterionPiping = value; } } /// /// Gets or sets the slope damping piezometric height polder side. /// /// /// The slope damping piezometric height polder side. /// public virtual double SlopeDampingPiezometricHeightPolderSide { get { return slopeDampingPiezometricHeightPolderSide; } set { slopeDampingPiezometricHeightPolderSide = value; } } /// /// Gets or sets the height of the dike table. /// /// /// The height of the dike table. /// public virtual double DikeTableHeight { get { return dikeTableHeight; } set { dikeTableHeight = value; } } /// /// Gets or sets the soil list. /// /// /// The soil list. /// public SoilList SoilList { get; set; } /// /// Gets or sets the gauges. /// /// /// The gauges. /// public virtual IList Gauges { get { return gauges; } set { gauges = value; } } /// /// Gets or sets the gauge pl lines. /// /// /// The gauge pl lines. /// public virtual IList GaugePlLines { get { return gaugePlLines; } set { gaugePlLines = value; } } /// /// Gets or sets a value indicating whether [redesign dike height]. /// /// /// true if [redesign dike height]; otherwise, false. /// public bool RedesignDikeHeight { get { return redesignDikeHeight; } set { redesignDikeHeight = value; } } /// /// Gets or sets a value indicating whether [redesign dike shoulder]. /// /// /// true if [redesign dike shoulder]; otherwise, false. /// public bool RedesignDikeShoulder { get { return redesignDikeShoulder; } set { redesignDikeShoulder = value; } } /// /// Gets or sets the stability design method. /// /// /// The stability design method. /// public StabilityDesignMethod StabilityDesignMethod { get { return stabilityDesignMethod; } set { stabilityDesignMethod = value; } } /// /// Gets or sets the slope adaption start cotangent. /// /// /// The slope adaption start cotangent. /// public double SlopeAdaptionStartCotangent { get { return slopeAdaptionStartCotangent; } set { slopeAdaptionStartCotangent = value; } } /// /// Gets or sets the slope adaption end cotangent. /// /// /// The slope adaption end cotangent. /// public double SlopeAdaptionEndCotangent { get { return slopeAdaptionEndCotangent; } set { slopeAdaptionEndCotangent = value; } } /// /// Gets or sets the slope adaption step cotangent. /// /// /// The slope adaption step cotangent. /// public double SlopeAdaptionStepCotangent { get { return slopeAdaptionStepCotangent; } set { slopeAdaptionStepCotangent = value; } } /// /// Gets or sets a value indicating whether [use new dike top width]. /// /// /// true if [use new dike top width]; otherwise, false. /// public bool UseNewDikeTopWidth { get { return useNewDikeTopWidth; } set { useNewDikeTopWidth = value; } } /// /// Gets or sets the new width of the dike top. /// /// /// The new width of the dike top. /// public double NewDikeTopWidth { get { return newDikeTopWidth; } set { newDikeTopWidth = value; } } /// /// Gets or sets a value indicating whether [use new dike slope inside]. /// /// /// true if [use new dike slope inside]; otherwise, false. /// public bool UseNewDikeSlopeInside { get { return useNewDikeSlopeInside; } set { useNewDikeSlopeInside = value; } } /// /// Gets or sets the new dike slope inside. /// /// /// The new dike slope inside. /// public double NewDikeSlopeInside { get { return newDikeSlopeInside; } set { newDikeSlopeInside = value; } } /// /// Gets or sets a value indicating whether [use new dike slope outside]. /// /// /// true if [use new dike slope outside]; otherwise, false. /// public bool UseNewDikeSlopeOutside { get { return useNewDikeSlopeOutside; } set { useNewDikeSlopeOutside = value; } } /// /// Gets or sets the new dike slope outside. /// /// /// The new dike slope outside. /// public double NewDikeSlopeOutside { get { return newDikeSlopeOutside; } set { newDikeSlopeOutside = value; } } /// /// Gets or sets a value indicating whether [use new shoulder top slope]. /// /// /// true if [use new shoulder top slope]; otherwise, false. /// public bool UseNewShoulderTopSlope { get { return useNewShoulderTopSlope; } set { useNewShoulderTopSlope = value; } } /// /// Gets or sets the new shoulder top slope. /// /// /// The new shoulder top slope. /// public double NewShoulderTopSlope { get { return newShoulderTopSlope; } set { newShoulderTopSlope = value; } } /// /// Gets or sets a value indicating whether [use new shoulder base slope]. /// /// /// true if [use new shoulder base slope]; otherwise, false. /// public bool UseNewShoulderBaseSlope { get { return useNewShoulderBaseSlope; } set { useNewShoulderBaseSlope = value; } } /// /// Gets or sets the new shoulder base slope. /// /// /// The new shoulder base slope. /// public double NewShoulderBaseSlope { get { return newShoulderBaseSlope; } set { newShoulderBaseSlope = value; } } /// /// Gets or sets a value indicating whether [use new maximum height shoulder as fraction]. /// /// /// true if [use new maximum height shoulder as fraction]; otherwise, false. /// public bool UseNewMaxHeightShoulderAsFraction { get { return useNewMaxHeightShoulderAsFraction; } set { useNewMaxHeightShoulderAsFraction = value; } } /// /// Gets or sets the new maximum height shoulder as fraction. /// /// /// The new maximum height shoulder as fraction. /// public double NewMaxHeightShoulderAsFraction { get { return newMaxHeightShoulderAsFraction; } set { newMaxHeightShoulderAsFraction = value; } } /// /// Gets or sets a value indicating whether [use new minimum distance dike toe start ditch]. /// /// /// true if [use new minimum distance dike toe start ditch]; otherwise, false. /// public bool UseNewMinDistanceDikeToeStartDitch { get { return useNewMinDistanceDikeToeStartDitch; } set { useNewMinDistanceDikeToeStartDitch = value; } } /// /// Gets or sets the new minimum distance dike toe start ditch. /// /// /// The new minimum distance dike toe start ditch. /// public double NewMinDistanceDikeToeStartDitch { get { return newMinDistanceDikeToeStartDitch; } set { newMinDistanceDikeToeStartDitch = value; } } /// /// Gets or sets a value indicating whether [use new ditch definition]. /// /// /// true if [use new ditch definition]; otherwise, false. /// public bool UseNewDitchDefinition { get { return useNewDitchDefinition; } set { useNewDitchDefinition = value; } } /// /// Gets or sets the new width ditch bottom. /// /// /// The new width ditch bottom. /// public double NewWidthDitchBottom { get { return newWidthDitchBottom; } set { newWidthDitchBottom = value; } } /// /// Gets or sets the new slope angle ditch. /// /// /// The new slope angle ditch. /// public double NewSlopeAngleDitch { get { return newSlopeAngleDitch; } set { newSlopeAngleDitch = value; } } /// /// Gets or sets the new depth ditch. /// /// /// The new depth ditch. /// public double NewDepthDitch { get { return newDepthDitch; } set { newDepthDitch = value; } } /// /// Gets the scenarios. /// /// /// The scenarios. /// [Validate] public List Scenarios { get { return scenarios; } } /// /// Gets or sets the type of the dam project. /// /// /// The type of the dam project. /// public static DamProjectType DamProjectType { get { return damProjectType; } set { damProjectType = value; } } /// /// Gets or sets the stability options. /// /// /// The stability options. /// public StabilityOptions StabilityOptions { get { return stabilityOptions; } set { stabilityOptions = value; } } #region Design parameters /// /// Gets or sets the dike embankment material. /// /// /// The dike embankment material. /// public virtual string DikeEmbankmentMaterial { get { return dikeEmbankmentMaterial; } set { dikeEmbankmentMaterial = value; } } /// /// Gets or sets the shoulder embankment material. /// /// /// The shoulder embankment material. /// public virtual string ShoulderEmbankmentMaterial { get { return shoulderEmbankmentMaterial; } set { shoulderEmbankmentMaterial = value; } } /// /// Gets or sets the stability shoulder grow slope. /// /// /// The stability shoulder grow slope. /// public virtual double StabilityShoulderGrowSlope { get { return stabilityShoulderGrowSlope; } set { stabilityShoulderGrowSlope = value; } } /// /// Gets or sets the stability shoulder grow delta x. /// /// /// The stability shoulder grow delta x. /// public virtual double StabilityShoulderGrowDeltaX { get { return stabilityShoulderGrowDeltaX; } set { stabilityShoulderGrowDeltaX = value; } } /// /// Gets or sets the stability slope adaption delta x. /// /// /// The stability slope adaption delta x. /// public virtual double StabilitySlopeAdaptionDeltaX { get { return stabilitySlopeAdaptionDeltaX; } set { stabilitySlopeAdaptionDeltaX = value; } } #endregion #region PlLine creation parameters /// /// Gets or sets the dike soil scenario. /// /// /// The dike soil scenario. /// public DikeSoilScenario DikeSoilScenario { get; set; } /// /// Gets or sets the head pl 2. /// /// /// The head pl 2. /// public virtual double? HeadPl2 { get { return headPl2; } set { headPl2 = value; } } /// /// Gets or sets the head PL3. /// /// /// The head PL3. /// public virtual double? HeadPl3 { get { return headPl3; } set { headPl3 = value; } } /// /// Gets or sets the head PL4. /// /// /// The head PL4. /// public virtual double? HeadPl4 { get { return headPl4; } set { headPl4 = value; } } /// /// Gets or sets the pl line offset below dike top at river. /// /// /// The pl line offset below dike top at river. /// public virtual double PlLineOffsetBelowDikeTopAtRiver { get { return pLLineOffsetBelowDikeTopAtRiver; } set { pLLineOffsetBelowDikeTopAtRiver = value; } } /// /// Gets or sets the pl line offset below dike top at polder. /// /// /// The pl line offset below dike top at polder. /// public virtual double PlLineOffsetBelowDikeTopAtPolder { get { return pLLineOffsetBelowDikeTopAtPolder; } set { pLLineOffsetBelowDikeTopAtPolder = value; } } /// /// Gets or sets the pl line offset below shoulder base inside. /// /// /// The pl line offset below shoulder base inside. /// public virtual double PlLineOffsetBelowShoulderBaseInside { get { return pLLineOffsetBelowShoulderBaseInside; } set { pLLineOffsetBelowShoulderBaseInside = value; } } /// /// Gets or sets the pl line offset below dike toe at polder. /// /// /// The pl line offset below dike toe at polder. /// public virtual double PlLineOffsetBelowDikeToeAtPolder { get { return pLLineOffsetBelowDikeToeAtPolder; } set { pLLineOffsetBelowDikeToeAtPolder = value; } } /// /// Gets or sets the use pl line offset below dike crest middle. /// /// /// The use pl line offset below dike crest middle. /// public bool? UsePlLineOffsetBelowDikeCrestMiddle { get; set; } /// /// Gets or sets the pl line offset below dike crest middle. /// /// /// The pl line offset below dike crest middle. /// public double? PlLineOffsetBelowDikeCrestMiddle { get { return plLineOffsetBelowDikeCrestMiddle; } set { plLineOffsetBelowDikeCrestMiddle = value; } } /// /// Gets or sets the use pl line offset factor below shoulder crest. /// /// /// The use pl line offset factor below shoulder crest. /// public bool? UsePlLineOffsetFactorBelowShoulderCrest { get; set; } /// /// Gets or sets the pl line offset factor below shoulder crest. /// /// /// The pl line offset factor below shoulder crest. /// public double? PlLineOffsetFactorBelowShoulderCrest { get { return plLineOffsetFactorBelowShoulderCrest; } set { plLineOffsetFactorBelowShoulderCrest = value; } } /// /// Gets or sets the intrusion vertical water pressure. /// /// /// The intrusion vertical water pressure. /// public IntrusionVerticalWaterPressureType? IntrusionVerticalWaterPressure { get { return intrusionVerticalWaterPressure; } set { intrusionVerticalWaterPressure = value; } } #endregion #region Waterlevels /// /// Gets or sets the polder level. /// /// /// The polder level. /// public virtual double PolderLevel { get { return polderLevel; } set { polderLevel = value; } } /// /// Gets or sets the river level. /// /// /// The river level. /// public virtual double RiverLevel { get { return scenarioRiverLevel; } set { scenarioRiverLevel = value; } } #endregion /// /// Gets the dike embankment soil. /// /// public Soil GetDikeEmbankmentSoil() { if ((stabilityOptions != null && String.IsNullOrEmpty(stabilityOptions.SoilDatabaseName)) || String.IsNullOrEmpty(DikeEmbankmentMaterial)) { return null; } return SoilList.GetSoilByName(DikeEmbankmentMaterial); } /// /// Aligns the boundary points of PL1 line with adapted surface line. /// /// The adapted surface line. public void AlignBoundaryPointsOfPl1LineWithAdaptedSurfaceLine(SurfaceLine2 adaptedSurfaceLine) { if ((LocalXzpl1Line != null) && (LocalXzpl1Line.Points.Count > 1)) { GeometryPoint lastPointPl1Line = LocalXzpl1Line.Points.Last(); GeometryPoint lastPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.Last(); lastPointPl1Line.X = lastPointSurfaceLine.X; GeometryPoint firstPointPl1Line = LocalXzpl1Line.Points.First(); GeometryPoint firstPointSurfaceLine = adaptedSurfaceLine.Geometry.Points.First(); firstPointPl1Line.X = firstPointSurfaceLine.X; } } /// /// Gets or sets the model parameters for pl lines. /// /// /// The model parameters for pl lines. /// public ModelParametersForPlLines ModelParametersForPlLines { get { return modelParametersForPlLines; } set { modelParametersForPlLines = value; } } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { return Name; } /// /// Adds a new sensor location. /// public void AddSensorLocation() { var factory = new SensorFactory(); SensorLocation = factory.CreateSensorLocation(this); } } }