Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

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

added test for LAC decision factor

parent 11648b48
No related branches found
No related tags found
No related merge requests found
......@@ -49,9 +49,9 @@ namespace TUGraz.VectoCore.Models.Declaration
"LAC Decision Factor File for Vdrop must consist of at least two lines with numeric values (below file header)");
}
if (table.Columns.Contains("v_target") && table.Columns.Contains("decision factor")) {
if (table.Columns.Contains("v_target") && table.Columns.Contains("decision_factor")) {
Data = table.Rows.Cast<DataRow>()
.ToDictionary(r => r.ParseDouble("v_drop").KMPHtoMeterPerSecond(), r => r.ParseDouble("decision factor"));
.ToDictionary(r => r.ParseDouble("v_drop").KMPHtoMeterPerSecond(), r => r.ParseDouble("decision_factor"));
} else {
Data = table.Rows.Cast<DataRow>()
.ToDictionary(r => r.ParseDouble(0).KMPHtoMeterPerSecond(), r => r.ParseDouble(1));
......@@ -86,7 +86,7 @@ namespace TUGraz.VectoCore.Models.Declaration
"LAC Decision Factor File for Vtarget must consist of at least two lines with numeric values (below file header)");
}
if (table.Columns.Contains("v_target") && table.Columns.Contains("decision factor")) {
if (table.Columns.Contains("v_target") && table.Columns.Contains("decision_factor")) {
Data = table.Rows.Cast<DataRow>()
.ToDictionary(r => r.ParseDouble("v_target").KMPHtoMeterPerSecond(), r => r.ParseDouble("decision_factor"));
} else {
......
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Tests.Utils;
namespace TUGraz.VectoCore.Tests.Models.Simulation
{
[TestClass]
public class LACDecisionFactorTest
{
[TestMethod]
public void LAC_DF_Test()
{
var lac = new LACDecisionFactor();
for (var vVehicle = 0.SI<MeterPerSecond>();
vVehicle < 100.KMPHtoMeterPerSecond();
vVehicle += 1.KMPHtoMeterPerSecond()) {
for (var vTarget = vVehicle; vTarget > 0; vTarget -= 1.KMPHtoMeterPerSecond()) {
var df_coast = lac.Lookup(vTarget, vVehicle - vTarget);
if (vTarget < 48.KMPHtoMeterPerSecond())
AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget));
if (vVehicle - vTarget > 11)
AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget));
if (vTarget > 52.KMPHtoMeterPerSecond() && vVehicle - vTarget < 9.KMPHtoMeterPerSecond())
AssertHelper.AreRelativeEqual(df_coast, 1.0, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget));
}
}
}
}
}
\ No newline at end of file
......@@ -95,6 +95,7 @@
<Compile Include="Models\SimulationComponentData\ValidationTest.cs" />
<Compile Include="Models\Simulation\FactoryTest.cs" />
<Compile Include="Models\Simulation\LossMapRangeValidationTest.cs" />
<Compile Include="Models\Simulation\LACDecisionFactorTest.cs" />
<Compile Include="Reports\ModDataTest.cs" />
<Compile Include="Models\Simulation\MeasuredSpeedModeTest.cs" />
<Compile Include="Models\Simulation\PwheelModeTests.cs" />
......@@ -1331,7 +1332,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Integration\FullPowertrain\" />
<Folder Include="Models\DeclarationData\" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
......
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