Code development platform for open source projects from the European Union institutions

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

allow PCC segment preprocessing for AT gearboxes as well

parent 9aad13b1
No related branches found
No related tags found
No related merge requests found
......@@ -40,10 +40,44 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
}
var gearbox = Container.Gearbox as Gearbox;
if (gearbox == null) {
throw new VectoException("no gearbox found...");
if (gearbox != null) {
RunPreprocessingAMTGearbox(gearbox, vehicle);
return;
}
var atGearbox = Container.Gearbox as ATGearbox;
if (atGearbox != null) {
RunPreprocessingATGearbox(atGearbox, vehicle);
return;
}
throw new VectoException("no valid gearbox found...");
}
private void RunPreprocessingATGearbox(ATGearbox gearbox, Vehicle vehicle)
{
var modData = Container.ModalData as ModalDataContainer;
SlopeData.Clear();
for (var speed = MinSpeed; speed <= MaxSpeed; speed += SpeedStep) {
var gear = FindLowestGearForSpeed(speed);
gearbox.Gear = gear;
gearbox.TorqueConverterLocked = true;
gearbox.DisengageGearbox = true;
//gearbox._nextGear = new GearInfo(gear, true);
vehicle.Initialize(speed, 0.SI<Radian>());
var slope = SearchSlope(vehicle, Container);
modData?.Reset();
SlopeData[speed] = slope;
}
}
private void RunPreprocessingAMTGearbox(Gearbox gearbox, Vehicle vehicle)
{
var modData = Container.ModalData as ModalDataContainer;
SlopeData.Clear();
......@@ -68,6 +102,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl
data.VehicleData.DynamicTyreRadius;
return Container.RunData.GearboxData.Gears.Select(
x => {
if (double.IsNaN(x.Value.Ratio)) {
// ignore converter gears
return 0u;
}
var n = speed * ratio * x.Value.Ratio;
return n < data.EngineData.IdleSpeed ? 0 : x.Key;
}).Max();
......
......@@ -64,7 +64,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
: base(container, runData)
{
_strategy = strategy;
_strategy.Gearbox = this;
if (_strategy != null) {
_strategy.Gearbox = this;
}
LastShift = -double.MaxValue.SI<Second>();
TorqueConverter = new TorqueConverter(this, _strategy, container, ModelData.TorqueConverterData,
runData);
......@@ -118,7 +120,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
public override IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity)
{
if (CurrentState.Disengaged) {
if (_strategy!= null && CurrentState.Disengaged) {
Gear = _strategy.InitGear(0.SI<Second>(), Constants.SimulationSettings.TargetTimeInterval, outTorque,
outAngularVelocity);
}
......
......@@ -208,6 +208,7 @@
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringInputDataProvider.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringJobInputDataProvider.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringOverspeed.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringPCCInputDataProvider.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringRetarderDataProvider.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringTorqueConverterDataProvider.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\DataProvider\XMLEngineeringVehicleComponentsDataProvider.cs" />
......@@ -229,6 +230,7 @@
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringGearshiftData.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringInputData.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringJobInputData.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringPCCInputData.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringVehicleComponentsData.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringVehicleData.cs" />
<Compile Include="InputData\FileIO\XML\Engineering\Interfaces\IXMLEngineeringEngineStopStartData.cs" />
......
......@@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Ninject;
using NUnit.Framework;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.FileIO.JSON;
using TUGraz.VectoCore.InputData.FileIO.XML;
using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation;
using TUGraz.VectoCore.Models.Simulation.Impl;
......@@ -18,25 +20,35 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation
[TestFixture]
public class SimulationPreprocessingTest
{
private StandardKernel _kernel;
private IXMLInputDataReader xmlInputReader;
public const string Class9Decl =
@"TestData\Generic Vehicles\Declaration Mode\Class9_RigidTruck_6x2\Class9_RigidTruck_DECL.vecto";
public const string Class9DeclAT =
@"E:\QUAM\Workspace\VECTO_DEV_ADAS\VectoCore\VectoCoreTest\TestData\Integration\ADAS\Group9_AT_PCC.xml";
public const string Class5Eng = @"TestData\Integration\ADAS\Group5PCCEng\Class5_Tractor_ENG.vecto";
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
_kernel = new StandardKernel(new VectoNinjectModule());
xmlInputReader = _kernel.Get<IXMLInputDataReader>();
}
[TestCase(Class9Decl),
TestCase(Class9DeclAT)
]
public void TestSimulationPreprocessingPccRollSlope(string jobFile)
{
var fileWriter = new FileOutputWriter(jobFile);
var sumWriter = new SummaryDataContainer(fileWriter);
var jobContainer = new JobContainer(sumWriter);
var dataProvider = JSONInputDataFactory.ReadJsonJob(jobFile);
var dataProvider = Path.GetExtension(jobFile) == ".xml" ? xmlInputReader.CreateDeclaration(jobFile) : JSONInputDataFactory.ReadJsonJob(jobFile);
var runsFactory = new SimulatorFactory(ExecutionMode.Declaration, dataProvider, fileWriter) {
ModalResults1Hz = false,
WriteModalResults = true,
......
This diff is collapsed.
This diff is collapsed.
......@@ -3126,6 +3126,12 @@
<Content Include="TestData\Integration\ADAS\Group5_EngineStopStart.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\Integration\ADAS\Group9_AT_PCC.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\Integration\ADAS\Group9_AT_PCCEcoRoll.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\Integration\DeclarationMode\Class4_Vocational\Rigid Truck_4x2_vehicle-class-4_EURO6_2018.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
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