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

adding testcases for P4 vehicle on all cycles

parent 00f0e019
No related branches found
No related tags found
No related merge requests found
......@@ -578,6 +578,51 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
GraphWriter.Write(modFilename);
}
[
TestCase("LongHaul", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle LongHaul, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
TestCase("RegionalDelivery", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle RegionalDelivery, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
TestCase("UrbanDelivery", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle UrbanDelivery, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
TestCase("Construction", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle Construction, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
TestCase("Urban", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle Urban, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
TestCase("Suburban", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle SubUrban, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
TestCase("Interurban", 2000, 0.5, 0, TestName = "P4 Hybrid DriveCycle InterUrban, SoC: 0.5 Payload: 2t P_auxEl: 0kW"),
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 +
Constants.FileExtensions.CycleFile);
var cycle = DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false);
const bool largeMotor = true;
var modFilename = string.Format("SimpleParallelHybrid-P4_cycle_{0}-{1}_{2}_{3}.vmod", declarationMission, initialSoC, payload, pAuxEl);
const PowertrainPosition pos = PowertrainPosition.HybridP4;
var job = CreateEngineeringRun(
cycle, modFilename, initialSoC, pos, 1.0, largeMotor: true, pAuxEl: pAuxEl, payload: payload.SI<Kilogram>());
var run = job.Runs.First().Run;
var hybridController = (HybridController)((VehicleContainer)run.GetContainer()).HybridController;
Assert.NotNull(hybridController);
var modData = ((ModalDataContainer)((VehicleContainer)run.GetContainer()).ModData).Data;
var data = run.GetContainer().RunData;
//File.WriteAllText(
// $"{modFilename}.json",
// JsonConvert.SerializeObject(data, Formatting.Indented));
run.Run();
Assert.IsTrue(run.FinishedWithoutErrors);
Assert.IsTrue(modData.Rows.Count > 0);
GraphWriter.Write(modFilename);
}
// =================================================
public static JobContainer CreateEngineeringRun(DrivingCycleData cycleData, string modFileName, double initialSoc, PowertrainPosition pos, double ratio, bool largeMotor = false, double pAuxEl = 0, Kilogram payload = null)
......@@ -634,7 +679,7 @@ namespace TUGraz.VectoCore.Tests.Integration.Hybrid
GearboxData = gearboxData,
VehicleData = vehicleData,
AirdragData = airdragData,
JobName = modFileName,
JobName = Path.GetFileNameWithoutExtension(modFileName),
Cycle = cycleData,
Retarder = new RetarderData() { Type = RetarderType.None },
Aux = new List<VectoRunData.AuxData>(),
......
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