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

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

more clear implementation of wheels class (confusion about dynamic tyre radius...

more clear implementation of wheels class (confusion about dynamic tyre radius and wheel diameter), extending testcase
parent 8e75b7d2
No related branches found
No related tags found
No related merge requests found
......@@ -97,7 +97,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
retVal.CurbWeight += mission.BodyCurbWeight + mission.TrailerCurbWeight;
retVal.Loading = loading;
retVal.DynamicTyreRadius =
DeclarationData.DynamicTyreRadius(data.Axles[DeclarationData.PoweredAxle()].Wheels); // TODO!
DeclarationData.Wheels.Lookup(data.Axles[DeclarationData.PoweredAxle()].Wheels).DynamicTyreRadius; // TODO!
var aerodynamicDragArea = data.AirDragArea + mission.DeltaCdA;
......
......@@ -89,12 +89,6 @@ namespace TUGraz.VectoCore.Models.Declaration
get { return Instance()._electricSystem ?? (Instance()._electricSystem = new ElectricSystem()); }
}
public static Meter DynamicTyreRadius(string wheels)
{
var wheelsEntry = Wheels.Lookup(wheels.RemoveWhitespace());
return wheelsEntry.DynamicTyreRadius * wheelsEntry.CircumferenceFactor / (2 * Math.PI);
}
/// <summary>
/// Formula for calculating the payload for a given gross vehicle weight.
/// (so called "pc-formula", Whitebook Apr 2016, Part 1, p.187)
......
......@@ -29,6 +29,7 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
......@@ -62,7 +63,7 @@ namespace TUGraz.VectoCore.Models.Declaration
.Select(row => new Entry {
WheelType = row.Field<string>(0).RemoveWhitespace(),
Inertia = row.ParseDouble("inertia").SI<KilogramSquareMeter>(),
DynamicTyreRadius = row.ParseDouble("d").SI().Milli.Meter.Cast<Meter>(),
WheelsDiameter = row.ParseDouble("d").SI().Milli.Meter.Cast<Meter>(),
CircumferenceFactor = row.ParseDouble("f")
}).ToDictionary(e => e.WheelType);
_dimensions = table.Rows.Cast<DataRow>().Select(row => row.Field<string>(0)).ToArray();
......@@ -72,8 +73,13 @@ namespace TUGraz.VectoCore.Models.Declaration
{
public string WheelType;
public KilogramSquareMeter Inertia;
public Meter DynamicTyreRadius;
public Meter WheelsDiameter;
public double CircumferenceFactor;
public Meter DynamicTyreRadius
{
get { return WheelsDiameter * CircumferenceFactor / (2 * Math.PI); }
}
}
public string[] GetWheelsDimensions()
......
......@@ -60,16 +60,17 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration
MissionType.Construction,
};
[TestCase("285/60 R22.5", 10.6, 0.914, 3.03),
TestCase("285/70 R19.5", 7.9, 0.895, 3.05),
TestCase("395/85 R20", 27.9, 1.18, 3.05)]
public void WheelDataTest(string wheels, double inertia, double dynamicRadius, double circumferenceFactor)
[TestCase("285/60 R22.5", 10.6, 0.914, 3.03, 0.440766),
TestCase("285/70 R19.5", 7.9, 0.895, 3.05, 0.434453),
TestCase("395/85 R20", 27.9, 1.18, 3.05, 0.572798)]
public void WheelDataTest(string wheels, double inertia, double wheelsDiameter, double circumferenceFactor, double expectedDynamicRadius)
{
var tmp = DeclarationData.Wheels.Lookup(wheels);
AssertHelper.AreRelativeEqual(inertia, tmp.Inertia);
AssertHelper.AreRelativeEqual(dynamicRadius, tmp.DynamicTyreRadius);
AssertHelper.AreRelativeEqual(wheelsDiameter, tmp.WheelsDiameter);
AssertHelper.AreRelativeEqual(circumferenceFactor, tmp.CircumferenceFactor);
Assert.AreEqual(expectedDynamicRadius, tmp.DynamicTyreRadius.Value(), 1e-6);
}
[
......
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