diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs index 843925cacfcbd8223b25c91469852a94a1c86398..238da75a9e1c7aef1bd2eb5c76a4d3252de84fb9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs @@ -31,12 +31,14 @@ using System; using System.ComponentModel.DataAnnotations; +using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; namespace TUGraz.VectoCore.Models.SimulationComponent.Data { + [CustomValidation(typeof(CombustionEngineData), "ValidateData")] public class CombustionEngineData : SimulationComponentData { [Required, SIRange(1000 * 1E-6, 20000 * 1E-6)] @@ -89,5 +91,14 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data WHTCCorrectionFactor = WHTCCorrectionFactor, }; } + + // ReSharper disable once UnusedMember.Global -- used in CustomValidation + public static ValidationResult ValidateData(CombustionEngineData data, ValidationContext context) + { + if (data.Inertia.IsEqual(0)) { + LogManager.GetLogger(typeof(CombustionEngineData).FullName).Error("Warning: Engine Inertia is 0!"); + } + return ValidationResult.Success; + } } } \ No newline at end of file