diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs index 70cb17b7a150a778cc79e39de1a3a5f1186e17e4..4c32251d17b5b4accb147de178dc1a7bb474d7da 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs @@ -85,7 +85,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data /// <summary> /// The Gross Vehicle Weight of the Vehicle. /// </summary> - [Required, SIRange(3500, 40000, ExecutionMode.Declaration), SIRange(0, 1000000, ExecutionMode.Engineering)] + [Required, + SIRange(3500, 40000, ExecutionMode.Declaration), + SIRange(0, 1000000, ExecutionMode.Engineering)] public Kilogram GrossVehicleWeight { get; internal set; } /// <summary> @@ -109,7 +111,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data internal set { _wheelsInertia = value; } } - [Required, SIRange(0, 1E12)] + //[Required, SIRange(0, 1E12)] public double TotalRollResistanceCoefficient { get @@ -155,11 +157,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data foreach (var axle in _axleData) { var nrWheels = axle.TwinTyres ? 4 : 2; var baseValue = (axle.AxleWeightShare * TotalVehicleWeight() * g / axle.TyreTestLoad / nrWheels).Value(); - if (baseValue.IsEqual(0)) { - throw new VectoSimulationException( - "Axle Roll Resistance Coefficient could not be calculated. One of the values is 0: AxleWeightShare: {0}, TotalVehicleWeight: {1}, TyreTestLoad: {2}, nrWheels: {3}", - axle.AxleWeightShare, TotalVehicleWeight(), axle.TyreTestLoad, nrWheels); - } + //if (baseValue.IsEqual(0)) { + // throw new VectoSimulationException( + // "Axle Roll Resistance Coefficient could not be calculated. One of the values is 0: AxleWeightShare: {0}, TotalVehicleWeight: {1}, TyreTestLoad: {2}, nrWheels: {3}", + // axle.AxleWeightShare, TotalVehicleWeight(), axle.TyreTestLoad, nrWheels); + //} rrc += axle.AxleWeightShare * axle.RollResistanceCoefficient * Math.Pow(baseValue, Physics.RollResistanceExponent - 1); wheelsInertia += nrWheels * axle.Inertia; @@ -178,6 +180,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data string.Format("Sum of axle weight share is not 1! sum: {0}, difference: {1}", weightShareSum, 1 - weightShareSum)); } + for (var i = 0; i < vehicleData.AxleData.Count; i++) { + if (vehicleData.AxleData[i].TyreTestLoad.IsSmallerOrEqual(0)) { + return new ValidationResult(string.Format("Tyre test load (FzISO) for axle {0} must be greater than 0.", i)); + } + } + + + if (vehicleData.TotalRollResistanceCoefficient <= 0) { + return + new ValidationResult(string.Format("Total rolling resistance must be greater than 0! {0}", + vehicleData.TotalRollResistanceCoefficient)); + } // total gvw is limited by max gvw (40t) var gvwTotal = VectoMath.Min(vehicleData.GrossVehicleWeight + vehicleData.TrailerGrossVehicleWeight, @@ -185,6 +199,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data if (mode != ExecutionMode.Declaration) { return ValidationResult.Success; } + // vvvvvvv these checks apply only for declaration mode! vvvvvv + if (vehicleData.TotalVehicleWeight() > gvwTotal) { return new ValidationResult(