Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs =================================================================== diff -u -rf70ea48294c1c30550bd7a9073fd498550f485db -rd130bdd9fa648640ad0ba701fc015278c78a45c4 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs (.../HydraRingConfiguration.cs) (revision f70ea48294c1c30550bd7a9073fd498550f485db) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs (.../HydraRingConfiguration.cs) (revision d130bdd9fa648640ad0ba701fc015278c78a45c4) @@ -42,7 +42,7 @@ public class HydraRingConfiguration { private readonly IList hydraRingCalculations; - private readonly IDictionary failureMechanismDefaults; + private IEnumerable fixedFailureMechanismSettings; private readonly IEnumerable defaultFailureMechanismSettings; private readonly IEnumerable defaultSubMechanismSettings; @@ -53,98 +53,7 @@ { hydraRingCalculations = new List(); - failureMechanismDefaults = new Dictionary - { - { - HydraRingFailureMechanismType.AssessmentLevel, - new FailureMechanismDefaults(1, 2, 26, new[] - { - 1 - }) - }, - { - HydraRingFailureMechanismType.WaveHeight, - new FailureMechanismDefaults(11, 2, 28, new[] - { - 11 - }) - }, - { - HydraRingFailureMechanismType.WavePeakPeriod, - new FailureMechanismDefaults(11, 2, 29, new[] - { - 14 - }) - }, - { - HydraRingFailureMechanismType.WaveSpectralPeriod, - new FailureMechanismDefaults(11, 2, 29, new[] - { - 16 - }) - }, - { - HydraRingFailureMechanismType.QVariant, - new FailureMechanismDefaults(3, 6, 114, new[] - { - 3, - 4, - 5 - }) - }, - { - HydraRingFailureMechanismType.DikesOvertopping, - new FailureMechanismDefaults(101, 1, 1, new[] - { - 102, - 103 - }) - }, - { - HydraRingFailureMechanismType.DikesPiping, - new FailureMechanismDefaults(103, 1, 44, new[] - { - 311, - 313, - 314 - }) - }, - { - HydraRingFailureMechanismType.StructuresOvertopping, - new FailureMechanismDefaults(110, 1, 60, new[] - { - 421, - 422, - 423 - }) - }, - { - HydraRingFailureMechanismType.StructuresClosure, - new FailureMechanismDefaults(111, 1, 65, new[] - { - 422, - 424, - 425, - 426, - 427 - }) - }, - { - HydraRingFailureMechanismType.StructuresStructuralFailure, - new FailureMechanismDefaults(112, 1, 65, new[] - { - 422, - 424, - 425, - 430, - 431, - 432, - 433, - 434, - 435 - }) - } - }; + InitializeFixedFailureMechanismSettings(); defaultFailureMechanismSettings = new[] { @@ -767,6 +676,80 @@ } /// + /// Initializes some fixed settings on a per basis. + /// + /// + /// These fixed settings cannot be overruled and just reflect: + /// - some supported ids within Hydra-Ring; + /// - a WTI 2017 specific configuration of Hydra-Ring. + /// + private void InitializeFixedFailureMechanismSettings() + { + fixedFailureMechanismSettings = new[] + { + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.AssessmentLevel, 1, 2, 26, new[] + { + 1 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.WaveHeight, 11, 2, 28, new[] + { + 11 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.WavePeakPeriod, 11, 2, 29, new[] + { + 14 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.WaveSpectralPeriod, 11, 2, 29, new[] + { + 16 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.QVariant, 3, 6, 114, new[] + { + 3, + 4, + 5 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.DikesOvertopping, 101, 1, 1, new[] + { + 102, + 103 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.DikesPiping, 103, 1, 44, new[] + { + 311, + 313, + 314 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.StructuresOvertopping, 110, 1, 60, new[] + { + 421, + 422, + 423 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.StructuresClosure, 111, 1, 65, new[] + { + 422, + 424, + 425, + 426, + 427 + }), + new FixedFailureMechanismSettings(HydraRingFailureMechanismType.StructuresStructuralFailure, 112, 1, 65, new[] + { + 422, + 424, + 425, + 430, + 431, + 432, + 433, + 434, + 435 + }) + }; + } + + /// /// Gets or sets the . /// public HydraRingTimeIntegrationSchemeType? TimeIntegrationSchemeType { get; set; } @@ -885,16 +868,16 @@ foreach (var hydraRingCalculation in hydraRingCalculations) { - var failureMechanismDefault = failureMechanismDefaults[hydraRingCalculation.FailureMechanismType]; - var defaultfailureMechanismSettings = defaultFailureMechanismSettings.First(fms => fms.FailureMechanismType == hydraRingCalculation.FailureMechanismType); + var fixedFailureMechanismSettingsForCalculation = fixedFailureMechanismSettings.First(ffms => ffms.FailureMechanismType == hydraRingCalculation.FailureMechanismType); + var defaultFailureMechanismSettingsForCalculation = defaultFailureMechanismSettings.First(fms => fms.FailureMechanismType == hydraRingCalculation.FailureMechanismType); orderedDictionaries.Add(new OrderedDictionary { { "SectionId", 999 // TODO: Dike section integration }, { - "MechanismId", failureMechanismDefault.MechanismId + "MechanismId", fixedFailureMechanismSettingsForCalculation.MechanismId }, { "LayerId", null // Fixed: no support for revetments @@ -903,10 +886,10 @@ "AlternativeId", null // Fixed: no support for piping }, { - "Method", failureMechanismDefault.CalculationTypeId + "Method", fixedFailureMechanismSettingsForCalculation.CalculationTypeId }, { - "VariableId", failureMechanismDefault.VariableId + "VariableId", fixedFailureMechanismSettingsForCalculation.VariableId }, { "LoadVariableId", null // Fixed: not relevant @@ -921,10 +904,10 @@ "TableStepSize", null // Fixed: no support for type 3 computations (see "Method") }, { - "ValueMin", defaultfailureMechanismSettings.ValueMin + "ValueMin", defaultFailureMechanismSettingsForCalculation.ValueMin }, { - "ValueMax", defaultfailureMechanismSettings.ValueMax + "ValueMax", defaultFailureMechanismSettingsForCalculation.ValueMax }, { "Beta", !double.IsNaN(hydraRingCalculation.Beta) ? (double?) hydraRingCalculation.Beta : null @@ -941,9 +924,9 @@ foreach (var hydraRingCalculation in hydraRingCalculations) { - var defaultsForFailureMechanism = failureMechanismDefaults[hydraRingCalculation.FailureMechanismType]; + var fixedFailureMechanismSettingsForCalculation = fixedFailureMechanismSettings.First(ffms => ffms.FailureMechanismType == hydraRingCalculation.FailureMechanismType); - foreach (var subMechanimsId in defaultsForFailureMechanism.SubMechanismIds) + foreach (var subMechanimsId in fixedFailureMechanismSettingsForCalculation.SubMechanismIds) { var configurationForSubMechanism = defaultSubMechanismSettings.First(cs => cs.FailureMechanismType == hydraRingCalculation.FailureMechanismType && cs.SubMechanismId == subMechanimsId); @@ -953,7 +936,7 @@ "SectionId", 999 // TODO: Dike section integration }, { - "MechanismId", defaultsForFailureMechanism.MechanismId + "MechanismId", fixedFailureMechanismSettingsForCalculation.MechanismId }, { "LayerId", null // Fixed: no support for revetments @@ -1110,28 +1093,39 @@ /// /// Container of default Hydra-Ring settings for a specific . /// - private class FailureMechanismDefaults + private class FixedFailureMechanismSettings { private readonly int variableId; private readonly int mechanismId; private readonly int calculationTypeId; private readonly IEnumerable subMechanismIds; + private readonly HydraRingFailureMechanismType failureMechanismType; /// - /// Creates a new instance of the class. + /// Creates a new instance of the class. /// + /// The the specify the fixed settings for. /// The corresponding mechanism id. /// The corresponding calculation type id. /// The corresponding variable id. /// The corresponding sub mechanism ids. - public FailureMechanismDefaults(int mechanismId, int calculationTypeId, int variableId, IEnumerable subMechanismIds) + public FixedFailureMechanismSettings(HydraRingFailureMechanismType failureMechanismType, int mechanismId, int calculationTypeId, int variableId, IEnumerable subMechanismIds) { + this.failureMechanismType = failureMechanismType; this.mechanismId = mechanismId; this.variableId = variableId; this.calculationTypeId = calculationTypeId; this.subMechanismIds = subMechanismIds; } + public HydraRingFailureMechanismType FailureMechanismType + { + get + { + return failureMechanismType; + } + } + /// /// Gets the mechanism id that corresponds to a specific . ///