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

Skip to content
Snippets Groups Projects
Commit 7474fe09 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

testcases for axle gear work (values within range of given map, no extrapolation)

parent 892b5c28
No related branches found
No related tags found
No related merge requests found
using System;
using System.Globalization;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TUGraz.VectoCore.Models.SimulationComponent.Data;
using TUGraz.VectoCore.Utils;
......@@ -40,13 +41,13 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData
public void TestInterpolation()
{
var rdyn = Double.Parse(TestContext.DataRow["rDyn"].ToString());
var speed = double.Parse(TestContext.DataRow["v"].ToString());
var speed = double.Parse(TestContext.DataRow["v"].ToString(), CultureInfo.InvariantCulture);
var gbxData = GearboxData.ReadFromFile(TestContext.DataRow["GearboxDataFile"].ToString());
var angSpeed = SpeedToAngularSpeed(speed, rdyn) * gbxData.AxleGearData.Ratio;
var PvD = Double.Parse(TestContext.DataRow["PowerGbxOut"].ToString()).SI<Watt>();
var PvD = Double.Parse(TestContext.DataRow["PowerGbxOut"].ToString(), CultureInfo.InvariantCulture).SI<Watt>();
var torqueToWheels = Formulas.PowerToTorque(PvD, angSpeed);
var torqueFromEngine = 0.SI<NewtonMeter>();
......@@ -58,7 +59,8 @@ namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData
var powerEngine = Formulas.TorqueToPower(torqueFromEngine, angSpeed);
var loss = powerEngine - PvD;
Assert.AreEqual(Double.Parse(TestContext.DataRow["GbxPowerLoss"].ToString()), loss.Double(), 0.1,
Assert.AreEqual(Double.Parse(TestContext.DataRow["GbxPowerLoss"].ToString(), CultureInfo.InvariantCulture),
loss.Double(), 0.1,
TestContext.DataRow["TestName"].ToString());
}
......
TestName,GearboxDataFile,rDyn,v,Gear,PowerGbxOut,GbxPowerLoss
Test1,TestData\Components\24t Coach.vgbx,520,20.320,A,279698.4,9401.44062
Test2,TestData\Components\24t Coach.vgbx,520,0.5858335,A,17173.5,409.773677587509
Test3,TestData\Components\24t Coach.vgbx,520,0.3996113,A,292.5253,118.282541632652
Test4,TestData\Components\24t Coach.vgbx,520,5.327739,A,57431.12,2222.78785705566
Test5,TestData\Components\24t Coach.vgbx,520,5.661779,A,73563.93,2553.00283432007
Test6,TestData\Components\24t Coach.vgbx,520,14.15156,A,212829.5,6822.16882705688
Test7,TestData\Components\24t Coach.vgbx,520,14.55574,A,15225.52,4308.41207504272
Test8,TestData\Components\24t Coach.vgbx,520,4.601774,A,-1240.225,1362.09738254547
Test9,TestData\Components\24t Coach.vgbx,520,3.934339,A,-698.5989,1164.5405292511
Test1,TestData\Components\24t Coach.vgbx,"520","20.320",A,"279698.4","9401.44062"
Test2,TestData\Components\24t Coach.vgbx,"520","0.5858335",A,"17173.5","409.773677587509"
Test3,TestData\Components\24t Coach.vgbx,"520","0.3996113",A,"292.5253","118.282541632652"
Test4,TestData\Components\24t Coach.vgbx,"520","5.327739",A,"57431.12","2222.78785705566"
Test5,TestData\Components\24t Coach.vgbx,"520","5.661779",A,"73563.93","2553.00283432007"
Test6,TestData\Components\24t Coach.vgbx,"520","14.15156",A,"212829.5","6822.16882705688"
Test7,TestData\Components\24t Coach.vgbx,"520","14.55574",A,"15225.52","4308.41207504272"
Test8,TestData\Components\24t Coach.vgbx,"520","4.601774",A,"-1240.225","1362.09738254547"
Test9,TestData\Components\24t Coach.vgbx,"520","3.934339",A,"-698.5989","1164.5405292511"
\ No newline at end of file
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