diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 4b9c9b40d7a7ab388ff5ac6a19d14d6f5f7b980f..739e2fd6885a514b787ba1fb8b2b893b4a417bde 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -785,13 +785,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return container; } - private IVehicleContainer BuildPWheelBatteryElectric(VectoRunData data) + private static IVehicleContainer BuildPWheelBatteryElectric(VectoRunData data, IModalDataContainer modData, WriteSumData sumWriter) { if (data.Cycle.CycleType != CycleType.PWheel) throw new VectoException("CycleType must be DistanceBased or MeasuredSpeed"); ValidateBatteryElectric(data); - var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; + var container = new VehicleContainer(data.ExecutionMode, modData, sumWriter) { RunData = data }; var es = new ElectricSystem(container); @@ -919,13 +919,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return pto; } - private IVehicleContainer BuildMeasuredSpeedBatteryElectric(VectoRunData data) + private static IVehicleContainer BuildMeasuredSpeedBatteryElectric(VectoRunData data, IModalDataContainer modData, WriteSumData sumWriter) { if (data.Cycle.CycleType != CycleType.MeasuredSpeed) throw new VectoException("CycleType must be DistanceBased or MeasuredSpeed"); ValidateBatteryElectric(data); - var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; + var container = new VehicleContainer(data.ExecutionMode, modData, sumWriter) { RunData = data }; var es = new ElectricSystem(container); @@ -1020,13 +1020,13 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return container; } - private IVehicleContainer BuildMeasuredSpeedGearBatteryElectric(VectoRunData data) + private static IVehicleContainer BuildMeasuredSpeedGearBatteryElectric(VectoRunData data, IModalDataContainer modData, WriteSumData sumWriter) { if (data.Cycle.CycleType != CycleType.MeasuredSpeedGear) throw new VectoException("CycleType must be DistanceBased or MeasuredSpeed"); ValidateBatteryElectric(data); - var container = new VehicleContainer(data.ExecutionMode, _modData, _sumWriter) { RunData = data }; + var container = new VehicleContainer(data.ExecutionMode, modData, sumWriter) { RunData = data }; var es = new ElectricSystem(container); @@ -1112,7 +1112,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return container; } - private void ValidateBatteryElectric(VectoRunData data) + private static void ValidateBatteryElectric(VectoRunData data) { if (data.ElectricMachinesData.Count > 1) { diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatteryElectricMotorController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatteryElectricMotorController.cs index 29760afe0c89d02a12b627ac9602ed909325b758..2117c48d80202a1805c4faf74c07a3f827092038 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatteryElectricMotorController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatteryElectricMotorController.cs @@ -43,7 +43,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { return null; } - if (DataBus.VehicleInfo.VehicleSpeed.IsSmallerOrEqual(GearboxModelData?.DisengageWhenHaltingSpeed ?? Constants.SimulationSettings.ClutchDisengageWhenHaltingSpeed) + if ((DataBus.VehicleInfo.VehicleSpeed ?? 0.SI<MeterPerSecond>()).IsSmallerOrEqual(GearboxModelData?.DisengageWhenHaltingSpeed ?? Constants.SimulationSettings.ClutchDisengageWhenHaltingSpeed) && outTorque.IsSmaller(0)) { return null; } diff --git a/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs index 1cdf4f987dbde68a9baa80f4d05527a25de0cc3a..9b2161ea49a7ab56a3cddf5c8383c3d5d41341a1 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs @@ -137,9 +137,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation var runData = reader.NextRun().First(); var writer = new MockModalDataContainer(); - var builder = new PowertrainBuilder(writer); - - var powerTrain = builder.Build(runData) as VehicleContainer; + var powerTrain = PowertrainBuilder.Build(runData, new MockModalDataContainer()) as VehicleContainer; Assert.NotNull(powerTrain); }