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

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

Merge pull request #516 in VECTO/vecto-sim from...

Merge pull request #516 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-579-vecto-gui-crashes-null-reference to master

* commit '99023f22':
  declarationdataadapter: write wheels dimenstion string to axle data
  add validation of tyre dimension (declaration mode)
  check if a wheel dimension is selected
parents 2b226a27 99023f22
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ Public Class VehicleAxleDialog
.RollResistanceCoefficient = TbRRC.Text.ToDouble(0),
.TyreTestLoad = TbFzISO.Text.ToDouble(0).SI(Of Newton)(),
.TwinTyres = CbTwinT.Checked,
.WheelsDimension = CbWheels.SelectedItem.ToString(),
.WheelsDimension = If(IsNothing(CbWheels.SelectedItem), "", CbWheels.SelectedItem.ToString()),
.Inertia = TbI_wheels.Text.ToDouble(0).SI(Of KilogramSquareMeter)()
}
......
......@@ -133,7 +133,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
TwinTyres = DeclarationData.Trailer.TwinTyres,
RollResistanceCoefficient = DeclarationData.Trailer.RollResistanceCoefficient,
TyreTestLoad = DeclarationData.Trailer.TyreTestLoad.SI<Newton>(),
Inertia = trailerWheel.Inertia
Inertia = trailerWheel.Inertia,
WheelsDimension = trailerWheel.WheelType
}));
}
retVal.AxleData = axleData;
......@@ -473,4 +474,4 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
};
}
}
}
\ No newline at end of file
}
......@@ -29,31 +29,46 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System.ComponentModel.DataAnnotations;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
namespace TUGraz.VectoCore.Models.Declaration
{
public class Axle : SimulationComponentData
{
public string WheelsDimension { get; internal set; }
[Required, SIRange(0, 100)]
public KilogramSquareMeter Inertia { get; internal set; }
[Required, SIRange(0.003, 0.015)]
public double RollResistanceCoefficient { get; internal set; }
[Required, SIRange(500, 100000)]
public Newton TyreTestLoad { get; internal set; }
[Required, SIRange(0, 1, ExecutionMode.Engineering), SIRange(double.MinValue, 1, ExecutionMode.Declaration)]
public double AxleWeightShare { get; internal set; }
public bool TwinTyres { get; internal set; }
public AxleType AxleType { get; internal set; }
}
}
\ No newline at end of file
using System;
using System.ComponentModel.DataAnnotations;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
namespace TUGraz.VectoCore.Models.Declaration
{
[CustomValidation(typeof(Axle), "ValidateAxleData")]
public class Axle : SimulationComponentData
{
public string WheelsDimension { get; internal set; }
[Required, SIRange(0, 100)]
public KilogramSquareMeter Inertia { get; internal set; }
[Required, SIRange(0.003, 0.015)]
public double RollResistanceCoefficient { get; internal set; }
[Required, SIRange(500, 100000)]
public Newton TyreTestLoad { get; internal set; }
[Required, SIRange(0, 1, ExecutionMode.Engineering), SIRange(double.MinValue, 1, ExecutionMode.Declaration)]
public double AxleWeightShare { get; internal set; }
public bool TwinTyres { get; internal set; }
public AxleType AxleType { get; internal set; }
public static ValidationResult ValidateAxleData(Axle axle, ValidationContext validationContext)
{
var execMode = GetExecutionMode(validationContext);
if (execMode == ExecutionMode.Engineering)
return ValidationResult.Success;
try {
DeclarationData.Wheels.Lookup(axle.WheelsDimension);
} catch (Exception) {
return new ValidationResult(string.Format("Unknown Tyre dimenstion '{0}'", axle.WheelsDimension));
}
return ValidationResult.Success;
}
}
}
......@@ -419,7 +419,7 @@ namespace TUGraz.VectoCore.OutputData.XML
private string CreateIdString(string id)
{
var regexp = new Regex("[^a-zA-Z0-9_-]");
var regexp = new Regex("[^a-zA-Z0-9_.-]");
return regexp.Replace(id, "");
}
}
......
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