Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

Merge branch 'feature/VECTO-1240-hybrid-powertrain' of...

Merge branch 'feature/VECTO-1240-hybrid-powertrain' of https://citnet.tech.ec.europa.eu/CITnet/stash/scm/vecto/mq_vecto-dev into feature/VECTO-1240-hybrid-powertrain
parents 694b1cb7 d5027f9a
Branches
Tags
No related merge requests found
......@@ -46,6 +46,7 @@ Tool for plotting graphs comparing Vecto 2.2 and Vecto 3
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");
......@@ -54,16 +55,16 @@ Tool for plotting graphs comparing Vecto 2.2 and Vecto 3
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);
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;
}
Console.Error.WriteLine("plotting graphs...");
GraphWriter.Write(args[0], args[1]);
graphWriter.Write(args[0], args[1]);
Console.Error.WriteLine("done");
}
}
......
......@@ -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);
}
......
......@@ -29,12 +29,13 @@ using ElectricSystem = TUGraz.VectoCore.Models.SimulationComponent.ElectricSyste
namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class BatteryElectricTest
{
private ModalResultField[] Yfields;
//private ModalResultField[] Yfields;
public const string MotorFile = @"TestData\BatteryElectric\GenericVehicleB4\GenericEMotor_125kW_485Nm.vem";
public const string BatFile = @"TestData\BatteryElectric\GenericVehicleB4\GenericBattery_243kWh_750V.vbat";
......@@ -48,27 +49,30 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
public void RunBeforeAnyTests()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
InitGraphWriter();
}
private void InitGraphWriter()
private GraphWriter GetGraphWriter(ModalResultField[] yFields)
{
var graphWriter = new GraphWriter();
//#if TRACE
GraphWriter.Enable();
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.BatterySOC,
};
GraphWriter.Series1Label = "Hybrid";
GraphWriter.PlotIgnitionState = true;
}.Concat(yFields).ToArray();
graphWriter.Xfields = new[] { ModalResultField.dist };
graphWriter.Yfields = yFields;
graphWriter.Series1Label = "BEV";
graphWriter.PlotIgnitionState = true;
return graphWriter;
}
......@@ -94,8 +98,6 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
] // the vehicle can drive max. 56km/h!! 80km/h testcase makes no sense
public void B4BEVConstantSpeed(double vmax, double initialSoC, double slope, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_B4 }).ToArray();
var cycleData = string.Format(
@" 0, {0}, {1}, 0
7000, {0}, {1}, 0", vmax, slope);
......@@ -119,7 +121,9 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_B4 });
graphWriter.Write(modFilename);
}
......@@ -130,7 +134,6 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
]
public void B4BEVDriveOff(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_B4 }).ToArray();
var cycleData = string.Format(
@" 0, 0, {1}, 3
700, {0}, {1}, 0", vmax, slope);
......@@ -149,7 +152,9 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_B4 });
graphWriter.Write(modFilename);
}
[
......@@ -164,8 +169,6 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
]
public void B4BEVDriveCycle(string declarationMission, double payload, double initialSoC, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_B4 }).ToArray();
var cycleData = RessourceHelper.ReadStream(
DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." +
declarationMission +
......@@ -192,8 +195,8 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename + ".vmod");
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_B4 });
graphWriter.Write(modFilename + ".vmod");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -220,8 +223,6 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
] // the vehicle can drive max. 56km/h!! 80km/h testcase makes no sense
public void B3BEVConstantSpeed(double vmax, double initialSoC, double slope, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_B3 }).ToArray();
var cycleData = string.Format(
@" 0, {0}, {1}, 0
7000, {0}, {1}, 0", vmax, slope);
......@@ -245,7 +246,9 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename + ".vmod");
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_B3 });
graphWriter.Write(modFilename + ".vmod");
}
......@@ -256,7 +259,6 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
]
public void B3BEVDriveOff(double vmax, double initialSoC, double slope)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_B3 }).ToArray();
var cycleData = string.Format(
@" 0, 0, {1}, 3
700, {0}, {1}, 0", vmax, slope);
......@@ -275,7 +277,9 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename + ".vmod");
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_B3 });
graphWriter.Write(modFilename + ".vmod");
}
[
......@@ -290,8 +294,6 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
]
public void B3BEVDriveCycle(string declarationMission, double payload, double initialSoC, double pAuxEl)
{
GraphWriter.Yfields = Yfields.Concat(new[] { ModalResultField.P_electricMotor_mech_B3 }).ToArray();
var cycleData = RessourceHelper.ReadStream(
DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." +
declarationMission +
......@@ -318,7 +320,9 @@ namespace TUGraz.VectoCore.Tests.Integration.BatteryElectric
job.WaitFinished();
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename + ".vmod");
var graphWriter = GetGraphWriter(new[] { ModalResultField.P_electricMotor_mech_B3 });
graphWriter.Write(modFilename + ".vmod");
}
......
......@@ -46,21 +46,27 @@ 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,22 +46,27 @@ 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);
}
......@@ -348,9 +357,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);
......@@ -375,7 +381,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);
}
// - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -403,8 +410,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);
......@@ -432,7 +437,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);
}
[
......@@ -442,8 +448,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);
......@@ -466,7 +470,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"),
......@@ -475,8 +481,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
......@@ -502,7 +506,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);
}
......@@ -518,8 +524,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 +
......@@ -548,7 +552,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);
}
// - - - - - - - - - - - - - - - - - - - - - - - - -
......@@ -575,8 +581,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);
......@@ -604,7 +608,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);
}
[
......@@ -614,8 +620,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);
......@@ -638,7 +642,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"),
......@@ -647,9 +653,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);
......@@ -674,7 +677,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);
}
[
......@@ -689,8 +694,6 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
]
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 +
......@@ -719,7 +722,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.
Please register or to comment