using System; using System.ComponentModel; using System.Xml.Serialization; using Deltares.Geotechnics; using Deltares.Geotechnics.Soils; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; using Deltares.Standard.Units; using Deltares.Standard.Validation; namespace Deltares.Stability { public enum StabilityCalculationSide { LeftSide = 0, RightSide = 1 } public enum ZoneOvertoppingType { [Label("<= 0.1 l/m/s")] [XmlOldName("True")] Standard, [Label("> 0.1 l/m/s")] [XmlOldName("False")] Extended } public enum ZonePolicy { Standard, DikesOnPeat } [Impact(Impact.Computation)] public class ZoneAreas : IVisibleEnabled, IDisposable { private StabilityCalculationSide calculationside = StabilityCalculationSide.RightSide; private double designLevelInfluenceX = 0; private double designLevelInfluenceY = 0; private double dikeTableHeight = 0; private double dikeTableWidth = 3; private double leftSideMinimalRoad = 0; private double remoldingFactor = 0.5; private double restProfileStartX = 0; private double rightSideMinimalRoad = 0; private double safetyZone1DOV = 1.19; private double safetyZone1a = 1.19; private double safetyZone1b = 1.11; private double safetyZone2a = 1; private double safetyZone2b = 1; private double safetyZone3a = 0.9; private double safetyZone3b = 0.9; private double schematizationFactor = 0.8; private StabilityModel stabilityModel = null; private ZoneOvertoppingType standardOvertopping = ZoneOvertoppingType.Standard; private double xSafeProfileStart; private double xStartDov; private double yStartDov; private ZonePolicy zonePolicy = ZonePolicy.Standard; public ZoneAreas() { DataEventPublisher.OnAfterChange += DataEventPublisher_OnAfterChange; } /// /// Remolding Reduction factor /// [Unit(UnitType.None)] [Minimum(0)] [Maximum(1)] [Format("F3")] public double RemoldingFactor { get { return remoldingFactor; } set { DataEventPublisher.BeforeChange(this, "RemoldingFactor"); remoldingFactor = value; DataEventPublisher.AfterChange(this, "RemoldingFactor"); } } /// /// Schematization Reduction Factor /// [Unit(UnitType.None)] [Minimum(0)] [Maximum(1)] [Format("F3")] public double SchematizationFactor { get { return schematizationFactor; } set { DataEventPublisher.BeforeChange(this, "SchematizationFactor"); schematizationFactor = value; DataEventPublisher.AfterChange(this, "SchematizationFactor"); } } /// /// Dike table height /// [Format("F2")] [Unit(UnitType.Length)] public double DikeTableHeight { get { return dikeTableHeight; } set { DataEventPublisher.BeforeChange(this, "DikeTableHeight"); dikeTableHeight = value; DataEventPublisher.AfterChange(this, "DikeTableHeight"); } } /// /// Dike table Width /// Width of diketable in restprofile /// default value is 3.0 m /// [Format("F2")] [Unit(UnitType.Length)] public double DikeTableWidth { get { return dikeTableWidth; } set { DataEventPublisher.BeforeChange(this, "DikeTableWidth"); dikeTableWidth = value; DataEventPublisher.AfterChange(this, "DikeTableWidth"); } } /// /// Start x-coordinate restprofile /// [Format("F2")] [Unit(UnitType.Length)] public double RestProfileStartX { get { return restProfileStartX; } set { DataEventPublisher.BeforeChange(this, "RestProfileStartX"); restProfileStartX = value; DataEventPublisher.AfterChange(this, "RestProfileStartX"); } } /// /// Boundary of design level influence at x /// [Format("F2")] [Unit(UnitType.Length)] public double DesignLevelInfluenceX { get { return designLevelInfluenceX; } set { DataEventPublisher.BeforeChange(this, "DesignLevelInfluenceX"); designLevelInfluenceX = value; DataEventPublisher.AfterChange(this, "DesignLevelInfluenceX"); } } /// /// Boundary of design level influence at y /// [Format("F2")] [Unit(UnitType.Length)] public double DesignLevelInfluenceY { get { return designLevelInfluenceY; } set { DataEventPublisher.BeforeChange(this, "DesignLevelInfluenceY"); designLevelInfluenceY = value; DataEventPublisher.AfterChange(this, "DesignLevelInfluenceY"); } } /// /// Boundary of design level influence at y /// public ZoneOvertoppingType StandardOvertopping { get { return standardOvertopping; } set { if (standardOvertopping != value) { DataEventPublisher.BeforeChange(this, "StandardOvertopping"); standardOvertopping = value; DataEventPublisher.AfterChange(this, "StandardOvertopping"); } } } /// /// Required safety in zone 1a /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone1a { get { return safetyZone1a; } set { DataEventPublisher.BeforeChange(this, "SafetyZone1a"); safetyZone1a = value; DataEventPublisher.AfterChange(this, "SafetyZone1a"); } } /// /// Required safety in zone 1b /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone1b { get { return safetyZone1b; } set { DataEventPublisher.BeforeChange(this, "SafetyZone1b"); safetyZone1b = value; DataEventPublisher.AfterChange(this, "SafetyZone1b"); } } /// /// Required safety in zone 2a /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone2a { get { return safetyZone2a; } set { DataEventPublisher.BeforeChange(this, "SafetyZone2a"); safetyZone2a = value; DataEventPublisher.AfterChange(this, "SafetyZone2a"); } } /// /// Required safety in zone 2b /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone2b { get { return safetyZone2b; } set { DataEventPublisher.BeforeChange(this, "SafetyZone2b"); safetyZone2b = value; DataEventPublisher.AfterChange(this, "SafetyZone2b"); } } /// /// Required safety in zone 3a /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone3a { get { return safetyZone3a; } set { DataEventPublisher.BeforeChange(this, "SafetyZone3a"); safetyZone3a = value; DataEventPublisher.AfterChange(this, "SafetyZone3a"); } } /// /// Required safety in zone 3b /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone3b { get { return safetyZone3b; } set { DataEventPublisher.BeforeChange(this, "SafetyZone3b"); safetyZone3b = value; DataEventPublisher.AfterChange(this, "SafetyZone3b"); } } /// /// Left side of minimal road /// [Unit(UnitType.Length)] [Format("F2")] public double LeftSideMinimalRoad { get { return leftSideMinimalRoad; } set { DataEventPublisher.BeforeChange(this, "LeftSideMinimalRoad"); leftSideMinimalRoad = value; DataEventPublisher.AfterChange(this, "LeftSideMinimalRoad"); } } /// /// Left side of minimal road /// [Unit(UnitType.Length)] [Format("F2")] public double RightSideMinimalRoad { get { return rightSideMinimalRoad; } set { DataEventPublisher.BeforeChange(this, "RightSideMinimalRoad"); rightSideMinimalRoad = value; DataEventPublisher.AfterChange(this, "RightSideMinimalRoad"); } } /// /// Stability calculation at /// public StabilityCalculationSide Calculationside { get { return calculationside; } set { if (calculationside != value) { DataEventPublisher.BeforeChange(this, "Calculationside"); calculationside = value; DataEventPublisher.AfterChange(this, "Calculationside"); } } } // To be replaced by zone policy [XmlIgnore] public bool IsDOVCalculation { get { return StabilityModel.ModelOption == ModelOptions.Spencer || ZonePolicy == ZonePolicy.DikesOnPeat; } set { ZonePolicy = value ? ZonePolicy.DikesOnPeat : ZonePolicy.Standard; } } public ZonePolicy ZonePolicy { get { return StabilityModel.ModelOption == ModelOptions.Spencer ? ZonePolicy.DikesOnPeat : zonePolicy; } set { DataEventPublisher.BeforeChange(this, "ZonePolicy"); zonePolicy = value; DataEventPublisher.AfterChange(this, "ZonePolicy"); } } [Unit(UnitType.Length)] [Format("F2")] public double XStartDOV { get { return xStartDov; } set { DataEventPublisher.BeforeChange(this, "XStartDOV"); xStartDov = value; DataEventPublisher.AfterChange(this, "XStartDOV"); } } [Unit(UnitType.Length)] [Format("F2")] public double YStartDOV { get { return yStartDov; } set { DataEventPublisher.BeforeChange(this, "YStartDOV"); yStartDov = value; DataEventPublisher.AfterChange(this, "YStartDOV"); } } [Unit(UnitType.Length)] [Format("F2")] public double XSafeProfileStart { get { return xSafeProfileStart; } set { DataEventPublisher.BeforeChange(this, "XSafeProfileStart"); xSafeProfileStart = value; DataEventPublisher.AfterChange(this, "XSafeProfileStart"); } } /// /// Required safety in zone 1 for DOV /// [Minimum(0.5)] [Maximum(10)] [Format("F3")] public double SafetyZone1DOV { get { return safetyZone1DOV; } set { DataEventPublisher.BeforeChange(this, "SafetyZone1DOV"); safetyZone1DOV = value; DataEventPublisher.AfterChange(this, "SafetyZone1DOV"); } } [Browsable(false)] [XmlIgnore] public StabilityModel StabilityModel { get { return stabilityModel; } set { stabilityModel = value; } } public void Dispose() { DataEventPublisher.OnAfterChange -= DataEventPublisher_OnAfterChange; } public bool IsEnabled(string property) { switch (property) { case "IsDOVCalculation": case "ZonePolicy": return stabilityModel != null && StabilityModel.ModelOption != ModelOptions.Spencer; default: return true; } } public bool IsVisible(string property) { switch (property) { case "IsDOVCalculation": case "ZonePolicy": return stabilityModel != null && StabilityModel.HasZonePlot; case "SafetyZone1DOV": case "XStartDOV": case "YStartDOV": case "XSafeProfileStart": return stabilityModel != null && StabilityModel.HasZonePlot && ZonePolicy == ZonePolicy.DikesOnPeat; default: return stabilityModel != null && StabilityModel.HasZonePlot && ZonePolicy != ZonePolicy.DikesOnPeat; } } private void DataEventPublisher_OnAfterChange(object sender, PublishEventArgs e) { if (sender == StabilityModel && e.Properties.Length > 0 && e.Property == "HasZonePlot") { DataEventPublisher.AfterChange(this); } } } }