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 65f72134 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

refactor graphwriter to run HEV/BEV tests in parallel

parent c13d8e61
No related branches found
No related tags found
No related merge requests found
......@@ -29,42 +29,43 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.Linq;
using TUGraz.VectoCore.Tests.Utils;
namespace GraphDrawer
{
internal class Program
{
private const string HELP = @"
Tool for plotting graphs comparing Vecto 2.2 and Vecto 3
--split <leng> ... split input into parts of length <len> (in m), only distance output
";
private static void Main(string[] args)
{
if (args.Contains("--split")) {
using System;
using System.Linq;
using TUGraz.VectoCore.Tests.Utils;
namespace GraphDrawer
{
internal class Program
{
private const string HELP = @"
Tool for plotting graphs comparing Vecto 2.2 and Vecto 3
--split <leng> ... split input into parts of length <len> (in m), only distance output
";
private static void Main(string[] args)
{
var graphWriter = new GraphWriter();
if (args.Contains("--split")) {
Console.Error.WriteLine("plotting graphs splitted by distance");
var idx = Array.FindIndex(args, x => x == "--split");
var lenght = int.Parse(args[idx + 1]);
var success = true;
var start = 0;
do {
var idx = Array.FindIndex(args, x => x == "--split");
var lenght = int.Parse(args[idx + 1]);
var success = true;
var start = 0;
do {
Console.Error.WriteLine("plotting {0} - {1}", start / 1000, (start + lenght) / 1000);
success = GraphWriter.WriteDistanceSlice(args[0], args[1], start, start + lenght);
start += lenght;
} while (success);
success = graphWriter.WriteDistanceSlice(args[0], args[1], start, start + lenght);
start += lenght;
} while (success);
Console.Error.WriteLine("plotting full cycle");
GraphWriter.Write(args[0], args[1]);
graphWriter.Write(args[0], args[1]);
Console.Error.WriteLine("done");
return;
}
return;
}
Console.Error.WriteLine("plotting graphs...");
GraphWriter.Write(args[0], args[1]);
graphWriter.Write(args[0], args[1]);
Console.Error.WriteLine("done");
}
}
}
}
}
\ No newline at end of file
......@@ -32,25 +32,25 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
_kernel = new StandardKernel(new VectoNinjectModule());
xmlInputReader = _kernel.Get<IXMLInputDataReader>();
InitGraphWriter();
}
private void InitGraphWriter()
private GraphWriter GetGraphWriter()
{
var graphWriter = new GraphWriter();
//#if TRACE
GraphWriter.Enable();
graphWriter.Enable();
//#else
//GraphWriter.Disable();
//graphWriter.Disable();
//#endif
GraphWriter.Xfields = new[] { ModalResultField.dist };
graphWriter.Xfields = new[] { ModalResultField.dist };
GraphWriter.Yfields = new[] {
graphWriter.Yfields = new[] {
ModalResultField.v_act, ModalResultField.altitude, ModalResultField.acc, ModalResultField.Gear,
ModalResultField.P_ice_out, ModalResultField.FCMap
};
GraphWriter.Series1Label = "ADAS PCC";
GraphWriter.PlotIgnitionState = true;
graphWriter.Series1Label = "ADAS PCC";
graphWriter.PlotIgnitionState = true;
return graphWriter;
}
......@@ -113,7 +113,7 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
var modFilename = writer.GetModDataFileName(run.RunName, run.CycleName, run.RunSuffix);
GraphWriter.Write(modFilename);
GetGraphWriter().Write(modFilename);
}
[TestCase(0, TestName = "AT EcoRoll Neutral DH1.8 const"),
......@@ -154,7 +154,7 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
var modFilename = writer.GetModDataFileName(run.RunName, run.CycleName, run.RunSuffix);
GraphWriter.Write(modFilename);
GetGraphWriter().Write(modFilename);
}
......@@ -195,7 +195,7 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
var modFilename = writer.GetModDataFileName(run.RunName, run.CycleName, run.RunSuffix);
GraphWriter.Write(modFilename);
GetGraphWriter().Write(modFilename);
}
[TestCase(@"TestData\Integration\ADAS\Group9_AT_EngineStopStart.xml")]
......@@ -289,7 +289,7 @@ namespace TUGraz.VectoCore.Tests.Integration.ADAS
var progress = jobContainer.GetProgress();
Assert.IsTrue(progress.All(r => r.Value.Success), string.Concat<Exception>(progress.Select(r => r.Value.Error)));
var modFilename = writer.GetModDataFileName(run.RunName, run.CycleName, run.RunSuffix);
GraphWriter.Write(modFilename);
GetGraphWriter().Write(modFilename);
}
......
......@@ -46,22 +46,28 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries
public void Init()
{
//LogManager.DisableLogging();
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
}
private GraphWriter getGraphWriter()
{
var graphWriter = new GraphWriter();
#if TRACE
GraphWriter.Enable();
graphWriter.Enable();
#else
GraphWriter.Disable();
graphWriter.Disable();
#endif
GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
graphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
GraphWriter.Yfields = new[] {
graphWriter.Yfields = new[] {
ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_ice_avg, ModalResultField.Gear,
ModalResultField.P_ice_out, ModalResultField.T_ice_fcmap, ModalResultField.FCMap
};
GraphWriter.Series1Label = "Vecto 3";
GraphWriter.Series2Label = "Vecto 2.0_aux";
graphWriter.Series1Label = "Vecto 3";
graphWriter.Series2Label = "Vecto 2.0_aux";
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
}
return graphWriter;
}
private static string GetSlopeString(double slope)
{
......@@ -303,7 +309,7 @@ namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
GraphWriter.Write(modFileName, @"..\..\TestData\Integration\BusAuxiliaries\Vecto2.0\" + compareFileName);
getGraphWriter().Write(modFileName, @"..\..\TestData\Integration\BusAuxiliaries\Vecto2.0\" + compareFileName);
}
}
}
\ No newline at end of file
......@@ -46,23 +46,28 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
[OneTimeSetUp]
public void Init()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
//LogManager.DisableLogging();
}
public GraphWriter GetGraphWriter()
{
var graphWriter = new GraphWriter();
#if TRACE
GraphWriter.Enable();
graphWriter.Enable();
#else
GraphWriter.Disable();
graphWriter.Disable();
#endif
GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
graphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist };
GraphWriter.Yfields = new[] {
graphWriter.Yfields = new[] {
ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_ice_avg, ModalResultField.Gear,
ModalResultField.P_ice_out, ModalResultField.T_ice_fcmap, ModalResultField.FCMap
};
GraphWriter.Series1Label = "Vecto 3";
GraphWriter.Series2Label = "Vecto 2.2";
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
}
graphWriter.Series1Label = "Vecto 3";
graphWriter.Series2Label = "Vecto 2.2";
return graphWriter;
}
private static string GetSlopeString(double slope)
{
......@@ -81,7 +86,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
var imgv22 =
@"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v22.vmod";
GraphWriter.Write(imgV3, imgv22);
GetGraphWriter().Write(imgV3, imgv22);
}
[TestCase, Category("ComparisonV2")]
......@@ -89,7 +94,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
{
var imgV3 = @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v3.vmod";
GraphWriter.Write(imgV3);
GetGraphWriter().Write(imgV3);
}
[Category("ComparisonV2"),
......@@ -255,7 +260,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
GraphWriter.Write(modFileName,
GetGraphWriter().Write(modFileName,
@"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck\" + modFileName);
}
......@@ -285,7 +290,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
GraphWriter.Write(modFileName,
GetGraphWriter().Write(modFileName,
@"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck_Overspeed\" + modFileName);
}
......@@ -444,7 +449,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
GraphWriter.Write(modFileName, @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach\" + modFileName);
GetGraphWriter().Write(modFileName, @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach\" + modFileName);
}
[Category("ComparisonV2"),
......@@ -473,7 +478,7 @@ namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
GraphWriter.Write(modFileName,
GetGraphWriter().Write(modFileName,
@"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach_Overspeed\" + modFileName);
}
......
......@@ -31,9 +31,10 @@ using Wheels = TUGraz.VectoCore.Models.SimulationComponent.Impl.Wheels;
namespace TUGraz.VectoCore.Tests.Integration.Hybrid
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class ParallelHybridTest
{
private ModalResultField[] Yfields;
//private ModalResultField[] Yfields;
public const string MotorFile = @"TestData\Hybrids\ElectricMotor\GenericEMotor.vem";
public const string BatFile = @"TestData\Hybrids\Battery\GenericBattery.vbat";
......@@ -43,30 +44,39 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
public const string GearboxIndirectLoss = @"TestData\Components\Indirect Gear.vtlm";
public const string GearboxDirectLoss = @"TestData\Components\Direct Gear.vtlm";
public const bool PlotGraphs = true;
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
InitGraphWriter();
//InitGraphWriter();
}
private void InitGraphWriter()
private GraphWriter GetGraphWriter(ModalResultField[] emYFields)
{
//#if TRACE
GraphWriter.Enable();
//#else
//GraphWriter.Disable();
//#endif
GraphWriter.Xfields = new[] { ModalResultField.dist };
Yfields = new[] {
var Yfields = new[] {
ModalResultField.v_act, ModalResultField.altitude, ModalResultField.acc, ModalResultField.Gear,
ModalResultField.P_ice_out, ModalResultField.BatterySOC, ModalResultField.FCMap
};
GraphWriter.Series1Label = "Hybrid";
GraphWriter.PlotIgnitionState = true;
}.Concat(emYFields).ToArray();
var graphWriter = new GraphWriter();
graphWriter.Xfields = new[] { ModalResultField.dist };
graphWriter.Yfields = Yfields;
graphWriter.Series1Label = "Hybrid";
graphWriter.PlotIgnitionState = true;
if (PlotGraphs) {
graphWriter.Enable();
} else {
graphWriter.Disable();
}
return graphWriter;
}
......@@ -77,7 +87,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P2HybridDriveOff(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P2 }).ToArray();
var GraphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P2 });
var cycleData = string.Format(
@" 0, 0, {1}, 3
700, {0}, {1}, 0", vmax, slope);
......@@ -127,8 +137,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P2HybridConstantSpeed(double vmax, double initialSoC, double slope, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P2 }).ToArray();
var cycleData = string.Format(
@" 0, {0}, {1}, 0
7000, {0}, {1}, 0", vmax, slope);
......@@ -156,7 +164,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P2 });
graphWriter.Write(modFilename);
}
[
......@@ -180,8 +189,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P2HybriDriveCycle(string declarationMission, double payload, double initialSoC, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P2 }).ToArray();
var cycleData = RessourceHelper.ReadStream(
DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." +
declarationMission +
......@@ -211,7 +218,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
job.Execute();
job.WaitFinished();
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P2 });
graphWriter.Write(modFilename);
}
......@@ -293,9 +302,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P2HybridBrakeStandstill(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P2 }).ToArray();
//var dst =
var cycleData = string.Format(
@" 0, {0}, {1}, 0
200, 0, {1}, 3", vmax, slope);
......@@ -320,7 +326,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P2 });
graphWriter.Write(modFilename);
}
// - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -348,8 +355,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P3HybridConstantSpeed(double vmax, double initialSoC, double slope, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P3 }).ToArray();
var cycleData = string.Format(
@" 0, {0}, {1}, 0
7000, {0}, {1}, 0", vmax, slope);
......@@ -377,7 +382,8 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P3 });
graphWriter.Write(modFilename);
}
[
......@@ -387,8 +393,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P3HybridDriveOff(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P3 }).ToArray();
var cycleData = string.Format(
@" 0, 0, {1}, 3
700, {0}, {1}, 0", vmax, slope);
......@@ -411,7 +415,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P3 });
graphWriter.Write(modFilename);
}
[TestCase(50, 0.79, 0, TestName = "P3 Hybrid Brake Standstill 50km/h SoC: 0.79, level"),
......@@ -420,8 +426,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P3HybridBrakeStandstill(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P3 }).ToArray();
//var dst =
var cycleData = string.Format(
@" 0, {0}, {1}, 0
......@@ -447,7 +451,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P3 });
graphWriter.Write(modFilename);
}
......@@ -463,8 +469,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P3HybriDriveCycle(string declarationMission, double payload, double initialSoC, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P3 }).ToArray();
var cycleData = RessourceHelper.ReadStream(
DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." +
declarationMission +
......@@ -493,7 +497,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P3 });
graphWriter.Write(modFilename);
}
// - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -520,8 +526,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P4HybridConstantSpeed(double vmax, double initialSoC, double slope, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P4 }).ToArray();
var cycleData = string.Format(
@" 0, {0}, {1}, 0
7000, {0}, {1}, 0", vmax, slope);
......@@ -549,7 +553,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P3 });
graphWriter.Write(modFilename);
}
[
......@@ -559,8 +565,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P4HybridDriveOff(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P4 }).ToArray();
var cycleData = string.Format(
@" 0, 0, {1}, 3
700, {0}, {1}, 0", vmax, slope);
......@@ -583,7 +587,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P4 });
graphWriter.Write(modFilename);
}
[TestCase(50, 0.79, 0, TestName = "P4 Hybrid Brake Standstill 50km/h SoC: 0.79, level"),
......@@ -592,9 +598,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
public void P4HybridBrakeStandstill(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P4 }).ToArray();
//var dst =
var cycleData = string.Format(
@" 0, {0}, {1}, 0
200, 0, {1}, 3", vmax, slope);
......@@ -619,7 +622,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P4 });
graphWriter.Write(modFilename);
}
[
......@@ -633,9 +638,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
TestCase("Coach", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle Coach, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
]
public void P4HybriDriveCycle(string declarationMission, double payload, double initialSoC, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_P4 }).ToArray();
{
var cycleData = RessourceHelper.ReadStream(
DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." +
declarationMission +
......@@ -664,7 +667,9 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_P4 });
graphWriter.Write(modFilename);
}
// =================================================
......
......@@ -53,25 +53,32 @@ namespace TUGraz.VectoCore.Tests.Integration.ShiftStrategy
public class ShiftStrategyTest
{
[OneTimeSetUp]
public void DisableLogging()
public void RunBeforeAnyTests()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
}
public GraphWriter GetGraphWriter()
{
var graphWriter = new GraphWriter();
//LogManager.DisableLogging();
#if TRACE
GraphWriter.Enable();
graphWriter.Enable();
#else
GraphWriter.Disable();
graphWriter.Disable();
#endif
GraphWriter.Xfields = new[] { ModalResultField.dist };
graphWriter.Xfields = new[] { ModalResultField.dist };
GraphWriter.Yfields = new[] {
graphWriter.Yfields = new[] {
ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_ice_avg, ModalResultField.Gear,
ModalResultField.P_ice_out, /*ModalResultField.T_eng_fcmap, */ ModalResultField.FCMap,
};
GraphWriter.PlotDrivingMode = true;
GraphWriter.Series1Label = "Vecto 3";
graphWriter.PlotDrivingMode = true;
graphWriter.Series1Label = "Vecto 3";
return graphWriter;
}
[Test,
......@@ -103,7 +110,7 @@ namespace TUGraz.VectoCore.Tests.Integration.ShiftStrategy
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
GraphWriter.Write(modFile);
GetGraphWriter().Write(modFile);
}
[TestCase()]
......
......@@ -45,39 +45,39 @@ using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Tests.Utils
{
public static class GraphWriter
public class GraphWriter
{
private static bool _enabled = true;
private bool _enabled = true;
private static Size _diagramSize = new Size(2000, 440);
private Size _diagramSize = new Size(2000, 440);
private static readonly Font AxisLabelFont = new Font("Consolas", 10);
private static readonly Font AxisTitleFont = new Font("Verdana", 12);
private static readonly Font LegendFont = new Font("Verdana", 14);
private readonly Font AxisLabelFont = new Font("Consolas", 10);
private readonly Font AxisTitleFont = new Font("Verdana", 12);
private readonly Font LegendFont = new Font("Verdana", 14);
public static string Series2Label { get; set; }
public string Series2Label { get; set; }
public static string Series1Label { get; set; }
public string Series1Label { get; set; }
public static ModalResultField[] Yfields { get; set; }
public ModalResultField[] Yfields { get; set; }
public static ModalResultField[] Xfields { get; set; }
public ModalResultField[] Xfields { get; set; }
public static bool PlotDrivingMode = false;
public bool PlotDrivingMode = false;
public static bool PlotIgnitionState = false;
public bool PlotIgnitionState = false;
public static void Enable()
public void Enable()
{
_enabled = true;
}
public static void Disable()
public void Disable()
{
_enabled = false;
}
public static void Write(string fileNameV3, string fileNameV22 = null)
public void Write(string fileNameV3, string fileNameV22 = null)
{
if (!_enabled) {
return;
......@@ -230,7 +230,7 @@ namespace TUGraz.VectoCore.Tests.Utils
}
}
public static bool WriteDistanceSlice(string fileNameV3, string fileNameV22, double start, double end)
public bool WriteDistanceSlice(string fileNameV3, string fileNameV22, double start, double end)
{
if (!_enabled) {
return true;
......@@ -395,7 +395,7 @@ namespace TUGraz.VectoCore.Tests.Utils
chartArea.Position.Y = (i * (100.0f - titleHeight)) / numCharts + titleHeight;
}
private static ChartArea AddChartArea(Chart chart, string name, string axisXTitle, int xMax, int xMin,
private ChartArea AddChartArea(Chart chart, string name, string axisXTitle, int xMax, int xMin,
string axisYTitle, bool discreteValues)
{
var chartArea = new ChartArea { Name = name };
......@@ -431,7 +431,7 @@ namespace TUGraz.VectoCore.Tests.Utils
return chartArea;
}
private static Legend CreateLegend(Chart chart, string dockToChartArea)
private Legend CreateLegend(Chart chart, string dockToChartArea)
{
var legend = new Legend(dockToChartArea) {
Docking = Docking.Right,
......
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