From 8f65c02188e7eb22d5b898dada9faf263dcecec1 Mon Sep 17 00:00:00 2001 From: Markus Quaritsch <markus.quaritsch@tugraz.at> Date: Wed, 15 Jun 2022 15:10:02 +0200 Subject: [PATCH] bugfix loading gearbox file for battery electric vehicles bugfix: PCC for IHPC and IEPC --- VECTO/GUI/VectoJobForm.vb | 2 +- .../Impl/PCCEcoRollEngineStopPreprocessor.cs | 4 +++- .../Impl/DefaultDriverStrategy.cs | 24 ++++++++++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index 8de0045c8c..2a1ffb8d41 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -484,7 +484,7 @@ Public Class VectoJobForm Else TbENG.Text = "" End If - If (JobType <> VectoSimulationJobType.BatteryElectricVehicle AndAlso inputData.JobInputData.Vehicle.Components.GearboxInputData IsNot Nothing) Then + If (JobType <> VectoSimulationJobType.BatteryElectricVehicle orelse inputData.JobInputData.Vehicle.Components.GearboxInputData IsNot Nothing) Then TbGBX.Text = GetRelativePath(inputData.JobInputData.Vehicle.Components.GearboxInputData.DataSource.SourceFile, _basePath) Else TbGBX.Text = "" diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs index d2b1379ec1..1b6c4c75fb 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PCCEcoRollEngineStopPreprocessor.cs @@ -125,7 +125,9 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl var gradient = 0.SI<Radian>(); foreach (var motor in container.ElectricMotors.Values) { - ((motor as ElectricMotor).Control as DummyElectricMotorControl).EmTorque = null; + if ((motor as ElectricMotor).Control is DummyElectricMotorControl emCtl) { + emCtl.EmTorque = null; + } } var initialResponse = vehicle.Request(absTime, simulationInterval, acceleration, gradient); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index bf6b18be3e..be24cb9f28 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -114,13 +114,25 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl if (ADAS.PredictiveCruiseControl != PredictiveCruiseControlType.None) { // create a dummy powertrain for pre-processing and estimations var testContainer = new SimplePowertrainContainer(data); - if (data.JobType != VectoSimulationJobType.BatteryElectricVehicle && data.JobType != VectoSimulationJobType.SerialHybridVehicle && - data.JobType != VectoSimulationJobType.IEPC_E && data.JobType != VectoSimulationJobType.IEPC_S) - PowertrainBuilder.BuildSimplePowertrain(data, testContainer); - else { - PowertrainBuilder.BuildSimplePowertrainElectric(data, testContainer); - } + switch (data.JobType) { + case VectoSimulationJobType.BatteryElectricVehicle: + case VectoSimulationJobType.SerialHybridVehicle: + case VectoSimulationJobType.IEPC_E: + case VectoSimulationJobType.IEPC_S: + PowertrainBuilder.BuildSimplePowertrainElectric(data, testContainer); + break; + case VectoSimulationJobType.IHPC: + case VectoSimulationJobType.ParallelHybridVehicle: + PowertrainBuilder.BuildSimpleHybridPowertrain(data, testContainer); + break; + case VectoSimulationJobType.ConventionalVehicle: + PowertrainBuilder.BuildSimplePowertrain(data, testContainer); + break; + default: + throw new ArgumentOutOfRangeException(nameof(data.JobType)); + } + container.AddPreprocessor(new PCCSegmentPreprocessor(testContainer, PCCSegments, data?.DriverData.PCC)); } } -- GitLab