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

Skip to content
Snippets Groups Projects
Commit 0d083f7b authored by Michael KRISPER's avatar Michael KRISPER
Browse files

updated validation

parent 00b8f426
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 34 deletions
......@@ -31,7 +31,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Exceptions;
using TUGraz.VectoCore.Models.Declaration;
......@@ -44,31 +43,31 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
[CustomValidation(typeof(VectoRunData), "ValidateRunData")]
public class VectoRunData : SimulationComponentData
{
[Required, ValidateObject]
[ValidateObject]
public VehicleData VehicleData { get; internal set; }
[Required, ValidateObject]
[ValidateObject]
public CombustionEngineData EngineData { get; internal set; }
[Required, ValidateObject]
[ValidateObject]
public GearboxData GearboxData { get; internal set; }
[Required, ValidateObject]
[ValidateObject]
public AxleGearData AxleGearData { get; internal set; }
[Required, ValidateObject]
public DrivingCycleData Cycle { get; internal set; }
[Required, ValidateObject]
[ValidateObject]
public IEnumerable<AuxData> Aux { get; internal set; }
[ValidateObject]
public string AccelerationLimitingFile { get; internal set; }
[Required, ValidateObject]
[ValidateObject]
public RetarderData Retarder { get; internal set; }
[Required, ValidateObject]
[ValidateObject]
public DriverData DriverData { get; internal set; }
public bool IsEngineOnly { get; internal set; }
......@@ -76,21 +75,21 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
[Required, MinLength(1)]
public string JobName { get; set; }
[Required]
public string ModFileSuffix { get; set; }
[Required, ValidateObject]
[ValidateObject]
public DeclarationReport Report { get; set; }
[Required, ValidateObject]
public LoadingType Loading { get; set; }
[Required, ValidateObject]
[ValidateObject]
public Mission Mission { get; set; }
public class AuxData
{
[Required] public string ID;
// ReSharper disable once InconsistentNaming
public string ID;
[Required] public AuxiliaryType Type;
......@@ -98,7 +97,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
public string[] TechList;
[Required, SIRange(0, 100 * Constants.Kilo)] public Watt PowerDemand;
[SIRange(0, 100 * Constants.Kilo)] public Watt PowerDemand;
[Required] public AuxiliaryDemandType DemandType;
......
......@@ -76,7 +76,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
private VehicleContainer BuildEngineOnly(VectoRunData data)
{
var container = new VehicleContainer(_modData, _sumWriter, ExecutionMode.EngineOnly);
var container = new VehicleContainer(_modData, _sumWriter, ExecutionMode.EngineOnly) { RunData = data };
var cycle = new PowertrainDrivingCycle(container, data.Cycle);
var directAux = new EngineAuxiliary(container);
......@@ -91,7 +91,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
private VehicleContainer BuildPWheel(VectoRunData data)
{
var container = new VehicleContainer(_modData, _sumWriter, ExecutionMode.Engineering);
var container = new VehicleContainer(_modData, _sumWriter, ExecutionMode.Engineering) { RunData = data };
var gearbox = new CycleGearbox(container, data.GearboxData);
......
......@@ -48,7 +48,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
public RetarderType Type { get; internal set; }
[SIRange(0, double.MaxValue)]
[SIRange(double.Epsilon, double.MaxValue)]
public double Ratio { get; internal set; }
}
}
\ No newline at end of file
......@@ -121,16 +121,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
var g = Physics.GravityAccelleration;
var RRC = 0.0.SI<Scalar>();
var rrc = 0.0.SI<Scalar>();
var wheelsInertia = 0.0.SI<KilogramSquareMeter>();
foreach (var axle in _axleData) {
var nrWheels = axle.TwinTyres ? 4 : 2;
RRC += axle.AxleWeightShare * axle.RollResistanceCoefficient *
rrc += axle.AxleWeightShare * axle.RollResistanceCoefficient *
Math.Pow((axle.AxleWeightShare * TotalVehicleWeight() * g / axle.TyreTestLoad / nrWheels).Value(),
Physics.RollResistanceExponent - 1);
wheelsInertia += nrWheels * axle.Inertia;
}
TotalRollResistanceCoefficient = RRC;
TotalRollResistanceCoefficient = rrc;
WheelsInertia = wheelsInertia;
}
......
......@@ -438,7 +438,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
{
var tbl = VectoCSVFile.Read(@"TestData/MeasuredSpeed/VairBetaFull.vcdb");
var dataBus = new MockVairVechicleContainer();
var dataBus = new MockVairVehicleContainer();
var vairbeta = new CrosswindCorrectionVAirBeta(5.SI<SquareMeter>(),
CrossWindCorrectionCurveReader.ReadCdxABetaTable(tbl));
......
......@@ -462,13 +462,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
{
var engineData = MockSimulationDataFactory.CreateEngineDataFromFile(CoachEngine);
var motorway = engineData.WHTCMotorway;
Assert.AreEqual(motorway, 0);
Assert.AreEqual(motorway, 1);
var rural = engineData.WHTCRural;
Assert.AreEqual(rural, 0);
Assert.AreEqual(rural, 1);
var urban = engineData.WHTCUrban;
Assert.AreEqual(urban, 0);
Assert.AreEqual(urban, 1);
var displace = engineData.Displacement;
Assert.AreEqual(0.01273, displace.Value());
......
......@@ -13,8 +13,8 @@
"Inertia": 3.8,
"FullLoadCurve": "24t Coach.vfld",
"FuelMap": "24t Coach.vmap",
"WHTC-Urban": 0.0,
"WHTC-Rural": 0.0,
"WHTC-Motorway": 0.0
"WHTC-Urban": 1.0,
"WHTC-Rural": 1.0,
"WHTC-Motorway": 1.0
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
"CurbWeight": 8862.0,
"CurbWeightExtra": 0.0,
"Loading": 0.0,
"MassMax": 11990.0,
"MassMax": 11.9,
"CdA": 6.16498344,
"Rim": "-",
"rdyn": 520.0,
......
......@@ -11,7 +11,7 @@
"CurbWeight": 8862.0,
"CurbWeightExtra": 0.0,
"Loading": 0.0,
"MassMax": 11990.0,
"MassMax": 11.9,
"CdA": 6.16498344,
"Rim": "-",
"rdyn": 520.0,
......
......@@ -11,7 +11,7 @@
"CurbWeight": 12000.0,
"CurbWeightExtra": 0.0,
"Loading": 0.0,
"MassMax": 12000.0,
"MassMax": 12,
"CdA": 4.15,
"rdyn": 421.0,
"Rim": "5° DC Rims",
......
......@@ -13,8 +13,8 @@
"Inertia": 2.13098,
"FullLoadCurve": "o9061750850E4.vfld",
"FuelMap": "om9062101120_e4e5_b7c_sl2499_20110727.vmap",
"WHTC-Urban": 0.0,
"WHTC-Rural": 0.0,
"WHTC-Motorway": 0.0
"WHTC-Urban": 1.0,
"WHTC-Rural": 1.0,
"WHTC-Motorway": 1.0
}
}
\ No newline at end of file
......@@ -42,7 +42,7 @@ using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Tests.Utils
{
public class MockVairVechicleContainer : IVehicleContainer
public class MockVairVehicleContainer : IVehicleContainer
{
// only CycleData Lookup is set / accessed...
......
......@@ -91,7 +91,7 @@
<Compile Include="Models\SimulationComponent\GearboxPowertrainTest.cs" />
<Compile Include="Utils\InputDataHelper.cs" />
<Compile Include="Utils\MockSimulationDataFactory.cs" />
<Compile Include="Utils\MockVairVechicleContainer.cs" />
<Compile Include="Utils\MockVairVehicleContainer.cs" />
<Compile Include="Utils\Port.cs" />
<Compile Include="Models\SimulationComponentData\AuxiliaryTypeHelperTest.cs" />
<Compile Include="Models\Simulation\AuxTests.cs" />
......
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