Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit ab0f2f6e authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

extending validation

parent 1e07b015
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ namespace TUGraz.VectoCore.Models.Declaration ...@@ -50,7 +50,7 @@ namespace TUGraz.VectoCore.Models.Declaration
[Required, SIRange(500, 100000)] [Required, SIRange(500, 100000)]
public Newton TyreTestLoad { get; internal set; } public Newton TyreTestLoad { get; internal set; }
[Required, SIRange(Double.MinValue, 1)] [Required, SIRange(0, 1, ExecutionMode.Engineering), SIRange(double.MinValue, 1, ExecutionMode.Declaration)]
public double AxleWeightShare { get; internal set; } public double AxleWeightShare { get; internal set; }
public bool TwinTyres { get; internal set; } public bool TwinTyres { get; internal set; }
......
...@@ -155,13 +155,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data ...@@ -155,13 +155,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
var rrc = 0.0.SI<Scalar>(); var rrc = 0.0.SI<Scalar>();
var wheelsInertia = 0.0.SI<KilogramSquareMeter>(); var wheelsInertia = 0.0.SI<KilogramSquareMeter>();
foreach (var axle in _axleData) { foreach (var axle in _axleData) {
if (axle.AxleWeightShare.IsEqual(0, 1e-12)) {
continue;
}
var nrWheels = axle.TwinTyres ? 4 : 2; var nrWheels = axle.TwinTyres ? 4 : 2;
var baseValue = (axle.AxleWeightShare * TotalVehicleWeight() * g / axle.TyreTestLoad / nrWheels).Value(); 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);
//}
rrc += axle.AxleWeightShare * axle.RollResistanceCoefficient * rrc += axle.AxleWeightShare * axle.RollResistanceCoefficient *
Math.Pow(baseValue, Physics.RollResistanceExponent - 1); Math.Pow(baseValue, Physics.RollResistanceExponent - 1);
wheelsInertia += nrWheels * axle.Inertia; wheelsInertia += nrWheels * axle.Inertia;
...@@ -175,6 +174,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data ...@@ -175,6 +174,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
{ {
var mode = GetExecutionMode(validationContext); var mode = GetExecutionMode(validationContext);
if (vehicleData.AxleData.Count < 1) {
return new ValidationResult("At least two axles need to be specified");
}
var weightShareSum = vehicleData.AxleData.Sum(axle => axle.AxleWeightShare); var weightShareSum = vehicleData.AxleData.Sum(axle => axle.AxleWeightShare);
if (!weightShareSum.IsEqual(1.0, 1E-10)) { if (!weightShareSum.IsEqual(1.0, 1E-10)) {
return new ValidationResult( return new ValidationResult(
...@@ -202,6 +205,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data ...@@ -202,6 +205,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
} }
// vvvvvvv these checks apply only for declaration mode! vvvvvv // vvvvvvv these checks apply only for declaration mode! vvvvvv
if (vehicleData.AxleConfiguration.NumAxles() != vehicleData.AxleData.Count) {
return
new ValidationResult(
string.Format("For a {0} type vehicle exactly {1} number of axles have to pe specified. Found {2}",
vehicleData.AxleConfiguration.GetName(), vehicleData.AxleConfiguration.NumAxles(), vehicleData.AxleData.Count));
}
if (vehicleData.TotalVehicleWeight() > gvwTotal) { if (vehicleData.TotalVehicleWeight() > gvwTotal) {
return new ValidationResult( return new ValidationResult(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment